w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Reponse.Redirect doesn't work immediately C#
You cannot redirect in a Try-Catch because a ThreadAbortedException is thrown. You need to pass false to Response.Redirect to do so. Boolean Indicates whether execution of the current page should terminate. So either save the redirect location and redirect after the try-catch or use Response.Redirect(url, false). string ProfileID, UserID, redirectUrl; try { ProfileID = Request.QueryString["ProfileID"].ToString(); string SelectQuery; DataSet ds; try { UserID = Session["UserID"].ToString(); if (ProfileID == UserID) { redirectUrl = "user/Default.aspx"; } else { //some code here } } finally { //some code here } } catch { redirectUrl = "DoesNotExists.aspx"; }

Categories : C#

How to extract Javascript code block from ajax reponse with jquery?
You can do this by simple string splitting: var str = "<script>alert('this is script code, which is not to be excuted')</script><div>Blah"; var script = str.substring(str.indexOf('<script>')+8, str.lastIndexOf("</script>")); console.log(script); Above code gives: alert('this is script code, which is not to be excuted') The problem arises when you have several scripts in your response. But you can handle that similarly

Categories : Javascript

Porting a C code to CUDA without modifying the original code line by line
If you do not like to change the code line by line you could try using OpenACC. OpenACC enables easily parallelizing legacy scientific and technical Fortran and C codes by compiler directives without modifying or adapting the underlying code itself. You just need to identify which areas of the code to accelerate, insert compiler directives and then the compiler does the job of mapping the original sequential computation into the parallel accelerator. I do not have personal experience with that, but, from some Conference presentations I attended, the ease of parallelization is paid a bit with performance.

Categories : C

My code is working and the first line is displaying correctly but the second line is concatenated with the first line etc
Change $(".Weight").text(weight + unit); to $(".Weight", this).text(weight + unit); so that only the .Weight cell of the current row is changed. A prevision following comments : it's useless to cache selectors here, there wouldn't be any noticeable gain and it makes the code harder to read and maintain using children is slower, which isn't very important. What's important is that using children departs from the semantic use of classes, it makes your code rely on the fact the .Weight element is a direct child and not, for example a span in a td. That's exactly the same reason than why you should generally prefer closest over parent.

Categories : Jquery

Why can one line of code work, but then the same line throws a null pointer exception later?
On the third line of your onStart method you are setting the context to the activity. Try setting it to the context instead. this.context = getActivity().getApplicationContext();

Categories : Java

HttpWebRequest/Reponse return cookies sent
You can use CookieContainer on HttpWebRequest and HttpWebResponse to pass the cookies that you are receiving from the server to your next requests, like a browser does. Some documentation and examples are here. There are also some methods for using cookies with WebClient: Using CookieContainer with WebClient class

Categories : C#

OutputCache not working when using Reponse.Cookies
I've found an answer in this other question. It looks as though OutputCache caches the output from a request, so for the same request with the same parameters it won't run the code in the action method, it'll just return the same output. So none of your code will be run on subsequent requests. It looks like the answer in the other post has some possible work-arounds.

Categories : Asp Net Mvc

Retrieve values from the reponse xml by GetGetElementByTheTagName
if you able to manage the xml content like this: $str = '<id>bYdSs9C</id><first-name>Jack</first-name> <last-name>Rudloph</last-name>'; we can use this to get the fields while ($str =~ /<.*?>(.*?)</.*?>/g) { print $1, " "; }

Categories : Xml

How to wait for line of code to finish before moving onto the next line
Use methods instead of "button-clicks": Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown MoveLastItem() MovePreviousItem() End Sub Private Sub MoveLastItem() bindingSource1.MoveLast(); End Sub Private Sub MovePreviousItem() bindingSource1.MovePrevious(); End Sub You just have call these methods from the button-click events handlers as well. Private Sub BindingNavigatorMoveLastItem_Clicked(sender As Object, args As EventArgs) Handles BindingNavigatorMoveLastItem.Click MoveLastItem() End Sub Private Sub BindingNavigatorMovePreviousItem_Clicked(sender As Object, args As EventArgs) Handles BindingNavigatorMovePreviousItem.Click MovePreviousItem() End Sub

Categories : Vb.Net

How to embed web-service reponse within the portlet that called it?
You ran into a Cross Domain Scripting problem. Read this and this to resolve the problem

Categories : Ajax

solr not return any results? anyone please explain this xml reponse?
The field type for both the fields fullname and shortname are string. From the field definition of string no analysis is being performed on this field. So the search term should be the exact case and match for the field to be returned. Change the field type to text and reindex the contents to check the search.

Categories : Apache

Does google wallet reponse return the tax deduted?
The financial information you are looking for is available in the "Earnings report" in the new Wallet Merchant Center: https://support.google.com/googleplay/android-developer/answer/3039702?hl=en

Categories : Android

Access facebook json reponse object
It works fine when I do it like this: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script> $(document).ready(function () { $.ajax("https://graph.facebook.com/128618520547487/?fields=posts.fields(picture,comments,likes,source,link,message)&access_token=CAACEdEose0cBAFOZAdI3zIOmKwkCi2tUZCAl2tpuIyh3WuE5B4njTviyzk4msgZCnKBVTNuXh2FQTf4XkfatgVHYer43TTw2kqV2vxHsjNbjbjiUPKToBrCpUP6ZBhVbr00GQTqjcCynzdGHHObe8OwYK7UMXLcZD", { dataType: "jsonp", jsonp: 'callback', success: function (json) { console.log(json.posts.data[0].likes.count); } }); }); </script> You MUST use jsonp when accessing files that are not on your own serv

Categories : Json

Changing height of UIView in reponse to finger drag
This should be straight-forward with a UIPanGestureRecognizer and a little math. To change the view to the correct frame (I'm using the name _viewToChange, so replace that with your view later), simply add: UIPanGestureRecognizer * pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)]; pan.maximumNumberOfTouches = pan.minimumNumberOfTouches = 1; [self addGestureRecognizer:pan]; to your init method for the super view, and define the method: - (void)pan:(UIPanGestureRecognizer *)aPan; { CGPoint currentPoint = [aPan locationInView:self]; [UIView animateWithDuration:0.01f animations:^{ CGRect oldFrame = _viewToChange.frame; _viewToChange.frame = CGRectMake(oldFrame.origin.x, currentPoint.y, oldFra

Categories : IOS

Reply-reponse pattern for primary-backup server
Set auto-startup to false; you can start/stop the adapter using its Lifecycle methods; you can either do that directly (by injecting it as a Lifecycle, or by sending a message to a <control=bus/> (e.g. @keepAliveMessageAdapter.start(). You can keep state in some bean (each time you get a ping), and configure an <inbound-channel-adapter/> to poll a method on that bean that returns the control bus command to start/stop the adapter.

Categories : Java

Firebug showing reponse too quickly because page is redirecting
I can think of two ways: Check the Network tab in Firebug. The request and response might still be in there. In the Scripts tab, try to find the code that is doing the redirection and set a breakpoint. Hit the "Stop at next breakpoint" button. Then execution will halt before the redirection code.

Categories : Ajax

redirect each new line of stderr to consecutive file
You would need to read each line of the output and explicitly redirect it to a new file. myProcess 2>&1 >/dev/null | grep 'Parsed' | tee parsed.txt | while IFS= read -r line; do echo "$line" >> line.$(date +%s).txt done Note as well the use of tee to write each line from grep to both the file parsed.txt as well as the while loop that redirects each line to a per-second file.

Categories : Osx

Is there a way to associate the reponse and query while invoking Nokia reverse geocoding api?
You can do that with any JavaScript callback by using immediately invoked function expression. Your code should look something like that: searchManager.reverseGeoCode({ latitude: lat, longitude: lng, onComplete: (function(localID) { return function(data, status, requestId) { processResults(data, status, requestId, localID); }; })(myID) }); To understand this example you need good comprehension of closures and above mentioned immediately invoked function expressions syntax.

Categories : Javascript

Process reponse data when getting a non HTTP 2xx answer with appAPI.request
As of now, the HTTP response text is not currently available in the onFailure callback. However, as we are constantly working on improvements, we will add this to our API in future releases. Disclaimer: I am a Crossrider employee

Categories : Javascript

Send SOAP service reponse without client requst in Axis2
A webservice cannot send a response without being called because it won't know where to send the data nor what function is being invoked (a ws could have many functions). The idea of a WS is to offer a service to everyone who can access it, so the response destinies are multiple. If you want to get the data from your DB every 5 minutes, your client will have to call the WS every 5 minutes or less (take into account the server processing time).

Categories : Web Services

Displaying reponse received from restful web service using backbone.js on next page
There are many ways to render a view after Ajax call. I am not sure what you want. If you are looking for pagination here is the link which can help you. If you meant to load a view after a ajax call, here is the simple solution. App.PostView = Backbone.View.extend({ template: Handlebars.compile('some {{value}}'), render: function(){ var newObject = this.model.toJSON(); $.ajax({ url:"/user", context:this, //pass view context success:function(data){ var modelObject = JSON.parse(data); this.$el.html(that.template(modelObject)); } }); } });

Categories : Javascript

How to let the program to to show the Gui Code before executing the next line of code in GWT?
You can set the label to the loading text, then you use the GWT Scheduler (http://www.gwtproject.org/javadoc/latest/com/google/gwt/core/client/Scheduler.html) Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { for (int i = 0; i < cities.length; ++i) { citiesOracle.add(cities[i]);} infoLabel.setText("data was loaded"); } } }); JavaScript (in a browser) is single threaded, so your label changed is queued to be updated after the click event. Using the Scheduler makes the browser able to process the label change before the loop. EDIT: This resource gives a better example how to use the Scheduler to execute long, CPU intensive processing, without triggeri

Categories : Gwt

Convert this line of Java code to C# code
That Java expression is converting a signed byte to unsigned and then to hexadecimal with zero fill. You should be able to code that in C#. FWIW, the Java code gives the same answer as this: Integer.toString(256 + arrayOfByte[i], 16).substring(1) or String.format("%02x", arrayOfByte[i]) Here's how the original works. The subexpression (0xFF & arrayOfByte[i]) is equivalent to (0xFF & ((int) arrayOfByte[i])) which converts a signed byte (-128 to +127) to an unsigned byte (0 to +255). The purpose of the magic 256 + in the original is to ensure that the result of toString will be 3 hex digits long. Finally, the leading digit is removed, leaving you with a zero padded 2 digit hex number.

Categories : C#

Don't understand meaning of 1 code line in example code
The syntax { <field>, <field> } for initializing a struct may only be used in a variable initializer. Edit: Based on the question that tia linked, this ought to work: lowerMiddle = (CGPointSPUserResizableViewAnchorPointPair) { CGPointMake(self.bounds.size.width/2, self.bounds.size.height), SPUserResizableViewLowerMiddleAnchorPoint };

Categories : C

Detect PC and redirect code help needed
You would create a function to encapsulate the test that you have above function usingPC(){ return preg_match("/window/i", $_SERVER['HTTP_USER_AGENT']); } To use this you would have to adapt your code to be: if(usingPC()) echo 'something'; else echo 'somethingelse'

Categories : PHP

AngularJS - Redirect to another domain from code
You not not defined ng-app on you html. And also not wired up your controller on html. See updated fiddle here http://plnkr.co/edit/pPJcWtLrbQOHDT5mXleK?p=preview

Categories : Javascript

HTTP Status code for content unavailable without a redirect
It sounds like the 4XX series of responses are appropriate here. From the RFC: The 4xx class of status code is intended for cases in which the client seems to have erred. Except when responding to a HEAD request, the server SHOULD include an entity containing an explanation of the error situation, and whether it is a temporary or permanent condition. With this in mind, I think 403 forbidden is the most appropriate: 10.4.4 403 Forbidden The server understood the request, but is refusing to fulfill it. Authorization will not help and the request SHOULD NOT be repeated. If the request method was not HEAD and the server wishes to make public why the request has not been fulfilled, it SHOULD describe the reason for the refusal in the entit

Categories : HTML

if window size is 300x500 then open page else redirect php code
PHP can't possibly know the window size. This is a task for JavaScript. Example of getting window size with JS

Categories : PHP

How to redirect a header file(to a library) to include some code in the instantiation?
For code that's already been compiled (that you don't have the source for), you can't intercept it without going through extraordinary means (patching memory using assembly language). This is assuming that QObject doesn't have some special mechanism that would allow you to "hook" the constructor. For code that you have control over, you can simply subclass AA and provide your own functionality in the constructor of your subclass.

Categories : C++

Script to redirect user to authors site if he removes code
Let's say the footer links look like this <div id="xyz-links"> <a href="http://xyz.com">Author xyz.com</a> </div> This should work for you! // xyz links removed! if ($("#xyz-links").length == 0) { window.location = "http://xyz.com"; } Here's a compressed ultra l33t vers10n 0==$("#xyz-links").length&&(window.location="http://xyz.com"); That said, this could be easily reverse engineered by anyone with brain larger than a peanut. Don't worry about not getting mad props or street cred for your ultra sweet codez! Leeches are gonna leech. Just keep writing good code and keep your head up, bru.

Categories : Javascript

how do I create a "blank" redirect page in HTML that has Google Analytics code in it?
use javascript to redirect to the "blank" page then place your google code on the blank site then use javascript to redirect to wherever you want and make sure you have the same google analytics code on the landing page you are sending them.

Categories : HTML

/Date(1381363200000)/ to get Simple Date object from this web service reponse?
The date is in epoch format. All you need to do, is convert it from epoch into a human readable date. Here's an example of how to do it in Java Date date = new Date(1381363200000); DateFormat format = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); String formatted = format.format(date); System.out.println(formatted); HTH

Categories : Android

what means .line in smali code syntax ? (android smali code)
.line n markers are used for debugging and stacktraces. When an exception goes uncaught, or the stacktrace needs to be filled in, the line number is taken from the .line statement. If this were missing, then stacktraces would lack line numbers.

Categories : Java

Facebook Oauth Issue | Multiple redirect with changing "code" parameter value in redirected url
I think I had a similar issue. When you get a request with the 'code' parameter, then you will want to send that back to FB. Doing so will allow you to get an 'access_token' in return. Relevant documentation can be read at this link: Login Flow And for clarity you would want to exchange the 'code' parameter for and 'access_token' by this GET request. GET https://graph.facebook.com/oauth/access_token? client_id={app-id} &redirect_uri={redirect-uri} &client_secret={app-secret} &code={code-parameter} In general, your question is similar to this question: Get Facebook OAuth token from code parameter

Categories : Java

What is this line of Js code exactly doing?
You are making changeName accessible as part of person. Consider it as exposing changeName. Without it, you cannot do me.changeName as me.changeName no longer exists outside of the scope of person.

Categories : Javascript

C++ , won't display last line of code
It probably showed it right before it disappeared. If you're going to write console programs, and if you're going to send output to a console, you should run them from a console so the output has some place to go.

Categories : C++

Need help understanding this line of code?
The (CTView*) reference is a "cast", a way of simply informing the compiler that you believe that self.view, which is technically defined as a UIView, is really a CTView, and therefore you want the compiler to permit the setAttString method without generating a warning.

Categories : Objective C

new line in xsl but the code is not working
If you output HTML with your XSLT and want a line break then use a br element e.g. <br/>, see http://www.w3.org/TR/html4/struct/text.html#h-9.3.2.1. The character &#10; is simply treated as white space and does not result in line break unless used inside a pre element or other element with the CSS defining white-space: pre.

Categories : Xslt

Error always on line 102 of my code
You are running with a stale bytecode cache or are re-running the code in an existing interpreter without restarting it. The traceback code has only bytecode to work with, which contains filename and linenumber information. When an exception occurs, the source file is loaded to retrieve the original line of code, but if the source file has changed, that leads to the wrong line being shown. Restart the interpreter and/or remove all *.pyc files; the latter will be recreated when the interpreter imports the code again. As for your specific exception; you probably imported the datetime class from the datetime module somewhere: from datetime import datetime The datetime class does not have a datetime attribute, only the module does.

Categories : Python

regarding a line of code on bit operation
As for the line a = 15 & ( a ^ (b << 3)); It takes b and bit-shift it right three times (if b is 0x01 then it becomes 0x08). Then takes the result of that and xors with a. Then that result is used to bitwise and with 15 (thereby masking away everything but the lowest four bits) and assigns the result to a. For the other code, I can explain exactly what it does in terms of operations, like I did above, but few here would be able to explain the meaning of it.

Categories : C



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.