AJAX-PHP Requesting a local page secure? |
There are the same risks with this as there are with any client-side code:
it can be manipulated. You should regard anything done on the client as
insecure, and verify on the server that you have what you should have.
|
Unexpected response code (401) when requesting: writeMoment |
The relevant line in the error is probably
08-31 17:04:08.470: I/GooglePlusPlatform(528):
{"code":401,"errors":[{"message":"Unauthorized","domain":"global","reason":"unauthorized"}]}
Indicating that there is an authorization error. Since it looks like you
are asking for the valid scope, as well as the visible activity you need,
the problem probably lies elsewhere. Did you enable the Google+ API in the
code console? Have you successfully authenticated as this user and
authorized actions under this scope?
|
how to run method in master page before execute child page code in IsPostBack? |
You need to have a look at the ASP.NET Webforms page lifecycle in order to
understand what happens when.
Here is some docs regarding that:
http://msdn.microsoft.com/en-us/library/ms178472(v=vs.100).aspx#lifecycle_events
The problem you have at the moment is that the Button click event happens
after the Page_Load event, so when you click the button you probably
experience that Label1.Text is one click "behind".
Look at the docs and place the Label1.Text assignment in PreRender for
example.
Like @ArabicProgrammer is answering, it is better yet to actually make use
of the Culture support that is available in the .NET Framework. If you use
that method instead, you can display the language using something like
this.
<%= System.Threading.Thread.CurrentThread.CurrentCulture.DisplayName %
|
Unicode signs shown on development page, but not on actual page with same code |
Try putting this in your <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
Also, try changing the de-DE in the <html> tag to
<html lang="de" prefix="og: http://ogp.me/ns#">
let me know if that works
|
AJAX code for calling code-behind method from aspx page doesn't work |
try this:
in your anchor do this:
<a href="javascript:void(0)" id="kontakt">Go to Kontakt</a>
and modify your ajax script to this:
$('a').click(function (e) {
var data = { 'id': $(this).attr("id") };
var dataVal = JSON.stringify(data);
$.ajax({
type: "POST",
url: "Default.aspx/loadNewPage",
contentType: "application/json; charset=utf-8",
data: dataVal,
dataType: "json",
success: function (id) {
}
});
});
|
Adding JavaScript Code to A Single Page in Joomla (Google Remarketing Code) |
You could use a module which allows to run custom code in it. There are
several solutions to this in the JED:
http://extensions.joomla.org/extensions/core-enhancements/coding-a-scripts-integration/custom-code-in-modules
|
node.js page in different tabs shows the same page source code |
Yes, it's because your browser caches page sources and when you are trying
to view it, shows the latest loaded page.
If you add some logging, you'll understand what i mean.
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
res.write('<p>' + Math.random() + '</p>');
res.end();
console.log('Message has been sent');
}).listen(3000);
When you open your page in new tab, you can see in console that browser
loads new version of it. But when you trying to view the source browser
doesn't load anything.
If you want to avoid this behaviour, try to reload the source, after you
open it.
|
generate code using form button and then display generated code on page |
You can use tag to show HTML entities You need to encode all
Your HTML entities like < => < like way.
Also you can show a text area in which all those HTML code need to echo, it
will not execute your code simply it will print it.
|
How to get source code after simulate web page button click in code |
A hacky approach would be to:
Attach an event handler to the 'onclick' event of the button.
Then, once the event is triggered, use the Microsoft Internet Controls
(SHDocVw) type library in order to get the last URL opened in IE.
Lastly, navigate to the URL and once the document is loaded, get the source
of the document from the webBrowser1.DocumentText property.
In your project, add a reference to the Microsoft Internet Controls type
library (you'll find it in the COM tab). Add at the top of your file:
using SHDocVw;
The code:
webBrowser1.Navigate(url);
while (webBrowser1.ReadyState != WebBrowserReadyState.Complete)
{
Application.DoEvents();
}
// assign the button to a variable
var button = webBrowser1.Document.GetElementById("downloadButton");
// attach an event handler for
|
C# Code only getting pagesource for visible page, not for scrolled down page |
using HtmlAgilityPack;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication5
{
class Program
{
static void Main(string[] args)
{
WebClient wc = new WebClient();
var sourceCode =
wc.DownloadString("http://dota-trade.com/equipment?order=name");
HtmlDocument doc = new HtmlDocument();
doc.LoadHtml(sourceCode);
var node = doc.DocumentNode;
var nodes = node.SelectNodes("//a");
List<string> links = new List<string>();
foreach (var item in nodes)
{
var link = item.Attributes["href"].Value;
links.Add(link.Contains("h
|
insert html code to a page via php script in other page |
As Filippo Toso said, you may include the HTML file in your code.php.
Perhaps, if you don't want to have two files, you may make only one file
and set the form to act like that:
<form id="createNewGallery" name="newgallery" method="GET"
action="./"><p><strong>please choose the number of pictures
you want to upload:
</strong>
<select name="numOfPictures" id="numOfPictures">
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
<option>9</option>
<option>10</option>
</select></p>
<input name="submitNumOfPictures" type="submit" />
<
|
Requesting JSON from PHP |
You need to set the HTTP Accept header to tell the server that you want it
to give you JSON:
Accept: application/json
(assuming that the remote server is correctly implemented to read the
header)
The Content-Type request header indicates the type of the payload that you
are POSTing.
In your case, it does not apply, since you're sending a GET request.
|
Requesting an API which uses CORS on IE7 |
The same origin policy predates IE7. Any browser that does not support
CORS will simply not allow you to make cross-domain ajax requests. The
same origin policy is enforced in IE7. Perhaps JSONP is an option for you.
Hard to say without more knowledge of your situation. If JSONP is not an
option for you, the request must be proxied from a server on the same
origin when using IE7.
|
Requesting header by name angular |
In asp.net each request runs in its own independent context and hence the
header access as you have shown in your code make sense.
This does not hold good for angular or in fact any client side framework.
You can always get the headers for any request or response made using
angular $http but the question is which request? During the lifetime of the
app you would make many such requests.
Let's say you want to get the current userid, you can create a service that
returns the logged in user. There are two ways to implement such a sevice
create a method on server to return this data. Invoke this method from
service and cache results
on the client side assuming there is a login request made through angular,
implement a success callback method which can update the service with the
logged use
|
requesting a template to the domain |
If your template has got 3 files header.php, content.php and footer.php,
you have to put them in "template" directory. Also, in the root dir you can
create some files which include the template form otterresti dir.
It's an example.
|
Requesting Definitions Using the Wordnik API |
The API documentation will probably tell you that.
Yes, parse the data. If the data is coming down as XML, then you can parse
it with an XMLReader, or you can load it into an XMLDocument. It looks like
you're asking for JSON, though. If so, you'll want a JSON parser. Check out
Json.Net.
Again, check out the API documentation.
Their documentation page is suspiciously sparse. You'll probably get better
response on their Google group or one of the other sources listed on their
support page.
|
404 error when requesting json in Reddit API |
The /api/me.json route only accepts GET requests:
s = client.get('http://www.reddit.com/api/me.json')
There is no POST route for that endpoint, so you'll get a 404 for that.
Also, if you need to pass modhash to the server, do so in the data passed
in the POST request; setting client.modhash does not then pass that
parameter to the server. You retrieve the modhash from your me.json GET
response:
r = client.get('http://www.reddit.com/api/me.json')
modhash = r.json()['modhash']
Note how the response from requests has a .json() method, there is no need
to use the json module yourself.
You then use the modhash in POST request data:
client.post('http://www.reddit.com/api/updateapp', {'modhash': modhash,
'about_url': '...', ...})
|
Requesting new permissions fail handling |
private void requestPublishPermissions(Session session) {
List<String> PERMISSIONS = Arrays.asList("publish_actions",
"publish_stream");
if (session != null) {
pendingAnnounce = true;
Session.NewPermissionsRequest newPermissionsRequest = new
Session.NewPermissionsRequest(this, PERMISSIONS);
newPermissionsRequest.setRequestCode(REAUTH_ACTIVITY_CODE);
Session mSession = Session.openActiveSessionFromCache(this);
mSession.addCallback(callback);
mSession.requestNewPublishPermissions(newPermissionsRequest);
}
}
|
Requesting image with POST using RestKit |
You should not use RestKit for this. RestKit is meant to be used for
mapping objects from JSON / XML / ... It is not meant for receiving image
data. Instead, use AFNetworking which is included with RestKit (used
internally for all comms) and can much better handle a simple post and
image response.
If you need to do some object serialisation to create the JSON to do your
post then look at using RKSerialization and RKMapperOperation.
|
How to keep the browser from requesting a file for a second time |
You need to turn on the browser leverage caching using .htaccess files.
In order to make the files cached by the browser, say for example the
images, stylesheets, JavaScript etc, you need to turn on the Leverage
Caching using a .htaccess file, by which you can specifically inform the
browser that specific content won't be changing for a specified period - a
week/month/year. As the browser will not repeatedly request that content it
will drastically improve your page loading speed for future visits from the
same browser.
In your .htaccess file, you can add the following (for files that won't
change)
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1
|
how to use github api token in python for requesting |
For one, I would recommend using a wrapper for the API. You're asking a lot
of questions on here that could be simplified by finding a wrapper whose
API you appreciate. There's a list of wrappers written in Python here.
As for your actually answering your question, the GitHub documentation is
fairly clear that you need to send the Authorization header. Your call
would actually look like this:
self.headers = {'Authorization': 'token %s' % self.api_token}
r = requests.post(url, headers=self.headers)
Since it seems like you're using requests and a class, might I be so bold
as to make a recommendation? Let's say you're doing something like making a
client for the API. You might have a class like so:
class GitHub(object):
def __init__(self, **config_options):
self.__dict__.upda
|
Ember not requesting models by id after first request |
A route's activate hook is only called when the route is first transitioned
to. It is not called again if the route's model changes. So when you
transition into App.DatasetRoute either by entering the url directly or by
clicking link on index page, the activate hook runs and your dataset is
reloaded. When you switch from #/1 to #/2, the route remains active and no
hook is called.
If I am understanding your question correctly, you want to reload the
dataset whenever a user visits its url. In that case instead of the route's
activate hook what you probably want to do is observe changes to the
dataset controller's content. Something like this should work:
App.DatasetController = Ember.ObjectController.extend({
refreshOnChange: function() {
var dataset = this.get('content');
if (da
|
php - get null from requesting data from server |
Just temporarily while debugging, you'll need to expand the code a little
to explain it:
<?php
mysql_connect("54.249.251.55","MYID","MYPASS"); //connect database
echo mysql_error();
mysql_select_db("aubook");//select name of the database
echo mysql_error();
$cmd = "select * from book limit 0,20";
$sql=mysql_query($cmd);
echo mysql_error();
while($row=mysql_fetch_assoc($sql))
$output[]=$row;
if (count($output) == 0)
echo "The database contained no records.";
print(json_encode($output));
mysql_close();
?>
|
browserstack requesting localhost:45691 |
BrowserStack provides a feature of Local Testing via Command Line Tunnel.
To check if tunnel is connected or not, their JavaScript(JS) tries to talk
to a http server which runs on port 45691 inside BrowserStackTunnel.jar.
When you don't have this Command Line Tunnel set, then the JS gets these
errors, which turns to 200 OK response as soon as tunnel gets connected.
|
will not display the page - will not let me see the page
|
Your problems is most likely that TinyMCE escapes all HTML tags. To allow
code to be embedded without adding the security risk of allowing other HTML
tags to be inserted, I think this is what you want:
https://code.google.com/p/tinymce-pre-plugin/
|
symfony assetic gives 500 error when requesting files |
In order to have a better understanding of what is going in, perhaps you
could execute the commands related to assets in verbose mode (from your
project root directory when using a standard Symfony2 edition) ?
php app/console assets:install --symlink -v
php app/console assetic:dump -v
|
prevent browser from requesting default route |
Solution is to place index.html file inside of public folder.
Now, it can be loaded and manipulated locally with ajax ( like a template
). Also hash in the url will work ( no request to server ) - that was my
main issue.
|
Requesting an iOS development certificate from Xcode 4.6.3 issue |
From Organizer it is not going to work, until you don't have .p12
certificate for your system. Make a .p12 certificate for your distribution
profile where it is set by admin and then you can check with provisioning
profiles.
|
Angular + Facebook JS SDK login: Not requesting my permissions |
Try attaching a listener to the facebook login event / statuschange:
$facebookProvider.Event.subscribe('auth.authResponseChange', function
(response) {
console.log(response);
})
And look at the response element to see if you have an error or not
|
Requesting URL parameter breaks inputstream Java |
I suppose you are using a HttpServletRequest and from the
ServletRequest#getParameter() documentation:
If the parameter data was sent in the request body, such as occurs with an
HTTP POST request, then reading the body directly via getInputStream() or
getReader() can interfere with the execution of this method.
Are you using either getInputStream() or getReader() prior to your
getParameter() ?
A related answer here might help you solve your problem:
http://stackoverflow.com/a/17129256/1524381
|
Receiving an error when requesting members for an array |
Plain old C arrays don't have members. So it has no size or erase. If you
did want it to have members though, C++11 offers a class called
std::array<T,N> which can be used in your case by simply doing
std::array<int, 6> games = { ... }. Note however that std::array does
not have an erase member function, but it has a size member function.
|
Google Analytics - event tracking code in separate |