w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Is there a preferred method of transferring native JavaScript methods to other objects?
You don't need to do anything: String.prototype.toUpperCase.call(anyObject) If you want to shorten that, you'll need to bind call to toUpperCase: var toUpperCase = Function.call.bind(String.prototype.toUpperCase);

Categories : Javascript

ASP.NET MVC Session Based Model Binder - Update Value Back to Session
You need to save it back to Session in your controller: public RedirectToRouteAction AddToCart(Cart cart) { cart.AddItem(newItem); HttpContext.Session["Cart"] = cart; } UPDATE: Session variables are stored in a SessionStateItemCollection object that implements IEnumerable and ICollection. When you save an object in the Session, only a reference to the object is stored, not a new instance of it. So, when you make changes to the object, you are actually making changes to the same object that is in your Session (a reference to it is stored in the Session). This is just like creating an object and adding it to a List. When you update the object after adding it to the List, you are actually updating the same instance in the List. So, in this case, you don't have to save the Cart ba

Categories : Asp Net Mvc

Take back up of session objects before session gets timed out?
I think you should store your data into database instead of such way. it's is not good approach to maintain data such way. I am not aware about your application requirement. but right approach to set data when session set & remove attribute after session expired. It will create security thread if your application concern with security. Do good coding with right approach and pattern instead of to achieve small thing with very fast result.

Categories : Java

How to get process information from windowHandle in Native with Java?
Considering use Java Native Access. Download jna.jar and platform.jar from here. You may have noticed that we can use GetWindowThreadProcessId in user32.dll to get the pid from a window handle. Then we can use OpenProcess in kernel32.dll to get a pointer to that process. Then the bunch of APIs like GetProcessMemoryInfo and GetModuleBaseName in psapi.dll can help you to get process information from that process object and the GetProcessTimes in kernel32.dll can return cpu usage. The GetProcessMemoryInfo contains a structure named PROCESS_MEMORY_COUNTERS which needs Structure in JNA to handle. static class Kernel32 { static { Native.register("kernel32"); } public static int PROCESS_QUERY_INFORMATION = 0x0400; public static int PROCESS_VM_READ = 0x0010; public static nati

Categories : Java

Calling back into a native application from Java, via JNI
Is there maybe a method to dynamically and explicitly bind a native void method(); to a function pointer or something? Yes there is! You can use RegisterNatives to dynamically bind Java methods with C/C++ functions. To change implementation you can first call UnregisterNatives followed by a new call to RegisterNatives.

Categories : Java

Back button not working in Native Activity
Adding this fixed it.... while (1) { int ident; int events; struct android_poll_source* source; while ((ident=ALooper_pollAll(-1, NULL, &events, (void**)&source)) >= 0) { if (source != NULL) { source->process(state, source); } if (state->destroyRequested != 0) { term_display(); return; } } }

Categories : Android

Open native map and then back to application phonegap
I come back with a solution that I used in my case, after a lot of research I found that the only way to do it was to use the mapKit framework. So I simply used cordova MapKit plugin (https://github.com/phonegap/phonegap-plugins/tree/master/iOS/MapKit) with some modifications because this version is not necessary up to date. I setup a view with the map view and a toolbar with a back button on the top, so we can access the native map and then back to the application easily. Med.

Categories : Iphone

How works the Laravel 4 native session driver?
It's exactly what the name says :) native session driver is using native php mechanism for session storage (cookies) - laravel is using laravel/vendor/symfony/http-foundationSymfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php for that.

Categories : Laravel

how to dump the call stack information for native(C/C++) process explicitly when it is not crashed in linux
Throw an exception and catch it immediately. I'm not familiar enough with C but in java this would look like this: try { throw new RuntimeException("bla bla"); } catch (Exception ex) { ex.printStackTrace(); }

Categories : Android

CodeIgniter sessions versus PHP native session support
I have been working with CodeIgniter for quite a while now and I have pondered this subject myself. I think the main advantage of using CI Sessions rather than native PHP session is that CI Sessions offer a lot more security. If you are hosting your website on shared hosting you have to be careful not to share your session data with the other hosts. CI sessions will regenerate the session ID but native PHP sessions don't. CI sessions also allow you to encrypt your session in the config file $config['encryption_key'] = "YOUR KEY";

Categories : PHP

Android Facebook native app not getting user email and birthday even with permissions set and correct information in fields
When you are using Request.GraphUserCallback(), its best to use it in MAIN UI THREAD Session s = Session.getActiveSession(); if(s!=null) { Request.executeMeRequestAsync(s,new Request.GraphUserCallback() { @Override public void onCompleted(GraphUser user, Response response) { if(user!=null) { try { String fbid=null; String birthday=null; fbid=user.getId(); birthday=user.getBirthday(); } catch (JSONException e1) { e1.printStackTrace(); } } } }); }

Categories : Android

kohana3.3.0 native session lifetime expired by incorrect calculation
I added one statement to sync up session with client cookie, everything is ok. setcookie($this->_name, session_id(), time()+$this->_lifetime, Cookie::$path, Cookie::$domain, Cookie::$secure, Cookie::$httponly); in systemclassesKohanaSessionNative.php#protected function _read($id = NULL)

Categories : PHP

how can is delete all session information?
userdata is a function not an array Read Session docs Try this, if(!$this->session->userdata('user_level')) { $this->session->userdata = array(); $this->session->sess_destroy(); } If you want to unset a single session variable then use it like, $this->session->unset_userdata('user_level');// to remove user_level from session Read http://ellislab.com/forums/viewthread/195025/

Categories : PHP

How to use session in jsp pages to get information?
Use <% String username = (String)request.getSession().getAttribute(...); %> Note that your use of <%! ... %> is translated to class-level, but request is only available in the service() method of the translated servlet. See how JSP code is translated to a servlet.

Categories : Java

how can I get back my paypal classic api information?
You can find classic API credentials in sandbox / test by going to www.sandbox.payal.com and logging in to the seller account. Next, go to 'Profile' in here followed by 'API Access'. The same navigation can be used for www.paypal.com for retrieving live API credentials.

Categories : Java

CakePHP: saving information in session
Are you unit testing your auth adapter? It is hard to tell what is wrong but I'm more or less sure authenticate() does not return the array but always false? Because if authenticate() returns valid user data it would be written to the session. See http://api.cakephp.org/2.3/source-class-AuthComponent.html#543, that calls http://api.cakephp.org/2.3/source-class-AuthComponent.html#690 which calls all configured auth adapters. If your adapter returns an user array it should work. So I assume your adapter fails to return the array.

Categories : PHP

How to profile hibernate JPA session information?
Use Visual VM, with all the plug-ins installed. Attach it to your app's JVM PID when you start it up. It'll show you memory, threads, and lots more. I don't think it'll be a good idea to profile on a production server. Put that code on another box and run a significant load for a long period of time. That'll show the problem.

Categories : Java

i'm not using rvm correctly - 'forgets' information on new session
You have a system installation of rvm - /usr/local/rvm, it is not recommended for basic use (mainly because of the problems you have and many others). Start with cleaning ~/.zshrc from forced PATH= as it is described in this pull request https://github.com/robbyrussell/oh-my-zsh/pull/1359 Then update RVM: rvmsudo /usr/local/rvm/bin/rvm get head --auto-dotfiles and restart computer. There is problem with system installation that it is loading early and the default ruby is loaded when computer is started, you need to restart computer for the new default to be effective. This problem does not happen when you use user installation of rvm. optionally Remove system installation and install rvm for user: Remove system rvm: rm -rf /etc/rvmrc /etc/profile.d/rvm.sh /usr/local/rvm Restart

Categories : Ruby On Rails

Is there a way to go back and edit the information the user entered?
You can put all of your input into a while block: while (1): Correct = True while Correct: Correct = False Employee=raw_input("Enter Your Name:") ... needToCorrect=raw_input("Is the last Entry Correct?(y/n):") if needToCorrect == "n": Correct = True w.writerow([Employee,WorkOrder,PartNumber,Process,Qty,Date,Time,Correct]) Then if a user notices something is incorrect, an "n" will prompt the user to return and retype the fields. If you want only to correct certain fields, a similar, more complicated, method would work fine.

Categories : Python

Ruby on rails passing information from session into db
You can have the current_user (for example) method: def current_user @current_user ||= User.find_by_id(session[:user_id]) end If you already have this, you can create post with: @post = current_user.posts.create(params[:post]) You should also check, of course, if any user is signed in before creating post, or you'll have NoMethodError.

Categories : Ruby On Rails

How do I get customer information back when using a PayPal subscription button
Use the 'custom' variable. Doc: https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/#id08A6HI00JQU

Categories : Paypal

Getting back information added with multiple calls to a function
Either create 2 instances of your object; $test1 = new Test; $test1->func("test1"); $test2 = new Test; $test2->func("test2"); echo $test1->buildFunc(); echo $test2->buildFunc(); Or make test an array; class Test { var $test = array(); public function func($val) { $this->test[] = $val; } public function buildFunc() { return print_r($this->test, true); } }

Categories : PHP

AngularJS - Access node/express session information
Consider using "ng-init" on the DOM that defines the ng-app, that is a server side data printed in Express (assume Dust template). Below is a simple example of this: <body ng-app="testApp" ng-controller="homeCtrl" ng-init="logged_in_user = {req.user}"> <div... ... </body> then you can access the logged_in_user in your homeCtrl, as "scope.logged_in_user" Hope this helps.. -Bhaskara

Categories : Angularjs

Can other websites read the session information for a user that is used on my site?
No, since: Cookies are not sent to sites other than the one that set them The data isn't stored in a cookie, it is stored in the session store on the server. The cookie contains a token that is used to identify which session in the session store is associated with the particular client.

Categories : PHP

Where to save detailed user session information for EmberJS app?
The general approach that I've taken before is to store the currently logged in user as App.CurrentUser. Then you can use it in any template. Once I've pulled the User object I call Ember.set('App.CurrentUser',user) to store it, and then Ember.get('App.CurrentUser') to retrieve it in other routes or controllers. Here's a short jsbin with the general idea : http://jsbin.com/ucanam/994/edit

Categories : Ember Js

Can I use html5 local storage for storing user authentication session information
Instead of the localStorage, look at sessionStorage object: http://www.w3schools.com/html/html5_webstorage.asp It works exactly like localStorage, but the whole sessionStorage object will be deleted when the browser window is closed - but will survive any page refreshes. It is an ideal place for storing session ids and alike.

Categories : Angularjs

How to log in back to the same page when a session expires using 'devise'
Sessions? Pff, try using cookies, update the page URL on every page to the cookie, and therefore when they leave, it will come back to the last viewed page, and the cookie will stay. However, I can't give an example, I don't even know what Ruby is? Hopefully cookies exist there too. I can give you the basic logic, OK? Users visits page: A: URL = www.abc.com/A B: URL = www.abc.com/B However when they load A, it sets a cookie to the URL, /A. When they go to B it sets URL B. They left... Then when they come back, it will still be set to B, and you can use that to redirect them to B's URL.

Categories : Ruby

Executing 2 blocking processes and need the control back in the same ssh session
If you just want to run this script in the background, and get control of your ssh session back while it's running… that has nothing to do with Python, or ssh, it's basic shell job control. For example, assuming your shell on the remote machine is sh/bash/similar, instead of this: remote_machine$ python script.py … do this: remote_machine$ python script.py & [1] 55341 remote_machine$ Now you've got the prompt back. You can interact with the main interpreter process as %1 or PID 55341. After it finally finishes, the next prompt you get will show something like this: [1]+ Done python You can't directly interact with the two child processes this way. You can always grep for them if you want, or search for child processes of PID 55341… but you might find your life easier if

Categories : Python

how to create a server which can reply to a SMS from cell phone and search relevant information back to that number?
I think your biggest problem is doing this securely. If someone forgets their password, a safer alternative is to have them reset it after confirming their identity. However, if you want to look into this further, a quick Google search yielded this result: http://research.microsoft.com/en-us/downloads/2bdeb3c6-9945-4804-a9bc-0d53704d35da/

Categories : Sql Server

Pass variables back to the invoker of a Python interactive console session
Your shareVars dictionary is the namespace the interactive shell works in; any assignments to that namespace are reflected directly in that dictionary. If you need to round-trip certain variables, you'll need to set those variables from the shareVars dictionary: a, b, c = shareVars['a'], shareVars['b'], shareVars['c'] Like everywhere else in Python, rebinding a variable in the interactive shell does not update other references to the old value.

Categories : Python

Flurry Sessions:Whether session ends if Back Key/Home key pressed in Android App
That's totally fine and is how you should be implementing Flurry. AFAIK Flurry buffers things and batch sends them back. The delay is also in case you are switching between apps and come back to your app quickly - it simply carries on the session. From the Flurry Docs Insert a call to FlurryAgent.onEndSession(Context) when a session is complete. We recommend using the onStop method of each Activity in your application. Make sure to match up a call to onEndSession for each call of onStartSession, passing in the same Context object that was used to call onStartSession. So long as there is any Context that has called onStartSession but not onEndSession, the session will be continued. Also, if a new Context calls onStartSession within 10 seconds of the last Context calling onEndSessi

Categories : Android

How can i disable the back browser button after user press logout and destroy session?
You should do a redirect from your logout script. For example: header("Location: index.php"); You if user hits back next time, it'll go to the logout.php page again, where you can do the check again and redirect again :) It's an infinite loop if the user tries again.

Categories : PHP

Manage form data on click of asp.net back button (other than handling though Session or Viewstate)
You can use a query string that holds the IDs of the selected items in textbox, dropdown, check box, etc., like this: Search.aspx?textId=3&dropdownId=7 You would also need to pass these values to your results page, so they can be passed back to the search page when you want to get back. Results.aspx?textId=3&dropdownId=7 Note: This alternative becomes unwieldy as the number of parameters increases, but it is a viable alternative to Session cache.

Categories : C#

SQLAlchemy - Multithreaded Persistent Object Creation, how to merge back into single session to avoid state conflict?
Each session is thread-local; in other words there is a separate session for each thread. If you decide to pass some instances to another thread, they will become "detached" from the session. Use db.session.add_all(objects) in the receiving thread to put them all back. For some reason, it looks like you're creating objects with the same identity (primary key columns) in different threads, then trying to send them both to the database. One option is to fix why this is happening, so that identities will be guaranteed unique. You may also try merging; merged_object = db.session.merge(other_object, load=False). Edit: zzzeek's comment clued me in on something else that may be going on: With Flask-SQLAlchemy, the session is tied to the app context. Since that is thread local, spawning a

Categories : Python

"Unsatisfied native code filter" when exporting OSGi bundle containing native Android lib
It seems like the target platform defined under 'Window -> Preferences -> Plug-in Development - Target Platform' prevented the export to succeed. I added a new entry copying the settings from my current target platform (chose option 'Current Target'). There, I changed under 'Environment' the 'Architecture' value to 'arm'. As 'arm' was not an option provided by the drop-down list, I typed it manually into the text field. That's it. When using this target configuration, everything works fine now. The bundle is exported successfully and I can use it on my Android device.

Categories : Android

Java - Custom allocator interface for native/non-native routines
The declaration of the memoryPool variable must use the correct type parameter. You don't say what T is; whatever it is it's incompatible with double[][]. DynamicMemoryPool<double[][]> memoryPool = new DynamicMemoryPool<double[][]>(200, false, new JavaAllocator(), size);

Categories : Java

how to start a session by adding a link and end the session in the same way and showing session datas
Here is how you can end the session with a link, by passing a $_GET parameter <a href="?logout"> Log out </a> <?php if(isset($_GET['logout'])) { session_destroy(); } ?> It is worthy to note, that you must have already started the session with session_start() before destroying it.

Categories : PHP

I know how to send information from Form1 to Form2, but how do I edit it and send it back if the data is contained in a List in Form1?
When you make new Form1() inside Form2, you are creating a completely new Form1 with no filled data. It's not the original Form1 that called Form2. So, what you need is to set that Form1 to the original, not to a new one: public partial class Form2 : Form { public Form2() { InitializeComponent(); } public Form1 fm1; //just declare, but let Form1 do the assign job. //the rest of the code... } And in Form 1 for (int i = c; i <= 0; i++) { if (lstCart.GetSelected(i)) { Form2 fm2 = new Form2(); fm2.productNameTextBox.Text = myBasket[i].ProductName; fm2.quantityTextBox.Text = Convert.ToString(myBasket[i].Quantity); fm2.latestPriceTextBox.Text = Convert.ToString(myBasket[i].LatestPrice); //here is the news:

Categories : C#

Sturts 2 session invalidation with setting request session to a new session
If you want to access the struts session after you invalidated the servlet session you should update or renew the struts session. For example SessionMap session = (SessionMap) ActionContext.getContext().getSession(); //invalidate session.invalidate(); //renew servlet session session.put("renewServletSession", null); session.remove("renewServletSession"); //populate the struts session session.entrySet(); now struts session is ready to use the new servlet session and you ready to reuse the struts session.

Categories : Java

Multiple java threads using native interface vs single java thread for multi threaded native
From a design perspective, I would prefer approach #1 because it means that you don't have to manage threads in your JNI code. This adheres to the "single responsibility principle": your native code only needs to change if your algorithm changes. I also think that the facilities (threadpools and futures) that Java provides are easier to use than direct threads. However, if you do this you should pay particular attention to the warning about pinning and unpinning arrays from multiple threads. A better approach IMO is to allocate a direct ByteBuffer, and access it from JNI using GetDirectBufferAddress. This would let you use a Java-side threadpool to manage the work, and would eliminate any native-side concerns about buffer copies.

Categories : Java



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