w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
How to direct user to a child state when he is transitioning to its parent state using UI-Router
First, add a property to the 'manager.staffDetail.view' state of abstract:true. This isn't required, but you want to set this since you'd never go to this state directly, you'd always go to one of it's child states. Then do one of the following: Give the 'manager.staffDetail.view.schedule' state an empty URL. This will make it match the same url as it's parent state url, because it appends nothing to the parent url. .state('manager.staffDetail.view.schedule', {url:'', ... Or if you want to keep the url of the default child route unchanged, then set up a redirect in your module.config. This code here will redirect any location of '/staff/{id}/view' to the location of '/staff/{id}/view/schedule': $urlRouterProvider.when('/staff/{id}/view', '/staff/{id}/view/schedule');

Categories : Angularjs

What's the purpose of setting $rootScope.$state = $state; with angular-ui ui-router?
I don't think this is standard code. The only reason i see these being added to you rootScope it to facilitate binding within the html view everywhere. Else if you want to bind to some property of either $state or $stateParams you would have to inject the $tate and $stateParams service into the controller. Ideally this should be injected into controllers that require this service. If you remove it any html binding dependent on it would fail. Search html views for bindings with name $state and $stateParams and you would find where they are used.

Categories : Angularjs

How to set up a child or grandchild state as the default index state with ui-router?
Solved this problem with .when(). Sample: ui-router-test. $urlRouterProvider .when('/', ['$state', function ($state) { $state.transitionTo('contacts.detail', {contactId: 1}, {location: false}); }]) .when('/contacts', ['$state', function ($state) { $state.transitionTo('contacts.detail', {contactId: 1}, {location: false}); }]) .otherwise('/'); $stateProvider .state("home", { url: "/" }) .state('contacts', { url: '/contacts', template: 'Contacts: <div ui-view></div>' }) .state('contacts.detail', { url: '/:contactId', template: '<p class="lead">Contact ID is {{$stateParams.contactId}}</p>' });

Categories : Javascript

Preserve state with Angular UI-Router
I have found Angular-Multi-View to be a godsend for this scenario. It lets you preserve state in one view while other views are handling the route. It also lets multiple views handle the same route. You can do this with UI-Router but you'll need to nest the views which IMHO can get ugly.

Categories : Angularjs

Angular UI Router - Views in an Inherited State
According to the ui-router documentation, when the application is in a particular state—when a state is "active"—all of its ancestor states are implicitly active as well. So, for example, when the "contacts.list" state is active, the "contacts" state is implicitly active as well, because it's the parent state to "contacts.list". Child states will load their templates into their parent's ui-view. I'd reccomend looking over the section of their documentation entitled Nested States & Views to gain a fuller understanding of how to do this. In the code you have provided us here, the parent state of the search template is home, while .state('header.search', { templateUrl: "views/search.html", controller: "SearchCtrl" }) implies that the parent state of the search template sho

Categories : Javascript

How to manage state with the ui-router with multiple modules
I did resolve the issue. I also posted about this on the angular-ui github, and their response was basically, "well, that case isn't really what the router has been designed for, so if you want "fancier" state management, put the data in parameters and look at them yourself and implement whatever logic you need". I kinda felt that this was what the ui-router was designed for, so I extended it a bit (no source code changes) to accomplish this. The solution is a combination of abstract states, a fake "off" state, parameters in the router urls, and extending the $urlRouterProvider service. First extend the $urlRouterProvider: urlRouterProvider.when(/^((?!leftpanel).)*$/, ['$state', '$location', function ($state, $location) { //we've got just /app or /app/3434, nothing that contains /leftp

Categories : Angularjs

How to modify unix zip archive file structure on creation?
You need to change to the directory before running zip. You can do it like this: ( cd /home/ubuntu/dir_to_zip && zip /home/ubuntu/output.zip -r . ) Since the command is within parentheses, it will be executed in a subshell environment, so the cd will not change the current directory of the base shell.

Categories : Unix

Deep-linking fails to set state in Angular-UI ui-router
I added <base href="/"> in the <head> section of my HTML, and that solved the problem. To see the modified (and corrected) version, go here: http://gist2.perlmodules.net:8080/a/funny This bug and it's solution is described here: https://github.com/angular-ui/ui-router/issues/200#issuecomment-20932129 ...and in the link at the bottom of that page.

Categories : Angularjs

Access $stateParams of new state in service called from resolve function with UI Router
You can't inject the the incoming parameters into the service itself, but you can pass them to a function in the service (or you could also assign them to a property in the service). this plunker shows how to pass them to a function, which in turns stores them to a property in the service. Using a "dummy" property shouldn't hurt, but it is a bit ugly. :) It might make more sense to pass the parameters to the controller as a resolve property and then hand them out to a service from the controller constructor... that's what I'd do.

Categories : Javascript

Reset state when modify ng-repeat by orderBy and/or filter
The problem is probably with your ng-model setting. It looks like you are setting ng-model to a simple scope variable and when that changes the ng-model loses the binding. TO avoid this, try setting ng-model to the property of an object so that when the value changes, angular retains the reference to the object. something like this: $scope.modelObj = {prop:"This Value"}; Then.. <input ng-model='modelObj.prop' type='text'>

Categories : Javascript

How to modify state of button from trigger in Oracle Forms
Little bit hard to say when I don't know where your custom code is located. Usually you are hiding items by setting the Visible property to False using forms builtin Set_Item_Property. This should work both from the forms itself and any attached pll library. The syntax is: Set_Item_Property(<block_name.item_name>, VISIBLE, PROPERTY_FALSE);

Categories : Oracle

Modify This PHP Alphabet Pagination Script To Add Active State
Here you go, look for $class to see what I changed: $mysqli = new mysqli("x", "x", "x", "x"); $sort = $_REQUEST['letter']; if($sort == ""){ $qry= "SELECT * FROM table ORDER BY title ASC " ; }else{ $qry = "SELECT * FROM table WHERE title LIKE '$sort%' ORDER BY title ASC" ; } $execute = $mysqli->query($qry) or die(mysqli_error()); $row_cnt = mysqli_num_rows($execute); echo "<p>" ; for ($i = 65; $i < 91; $i++) { if(ord($sort) == $i) { $class = 'active'; } else { $class = ''; } printf('<a href="%s?letter=%s" class="%s">%s</a> | ', $PHP_SELF, chr($i), $class, chr($i)); } echo "</p>" ; if ($row_cnt > 0) { do{ while ($row = $execute->fetch_assoc()) { printf ("%s %s <br />", $row["id"], $row["title"]); } }

Categories : PHP

Haskell: TChan wrapping duplicated while using lens to modify state
dupTChan expects an argument like TChan a and is being applied something like MonadState ImmutableState m => m (TChan Broadcast). If you just try that directly you'll get a slightly different kind of type error *Main> :t dupTChan $ use broadcastChan <interactive>:1:12: No instance for (MonadState ImmutableState TChan) arising from a use of `use' Possible fix: add an instance declaration for (MonadState ImmutableState TChan) In the second argument of `($)', namely `use broadcastChan' In the expression: dupTChan $ use broadcastChan where GHC tries to unify TChan a and m (TChan Broadcast) by having a ~ TChan Broadcast and m ~ TChan, but it fails because TChan isn't an instance of MoandState. You can already see how the TChan (TChan Broadcast) error

Categories : Haskell

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

Oracle Trigger creation - table is mutating; trigger may not read or modify it
Oracle doesn't allow a row trigger to read or modify the table on which the trigger is defined. However, if PERSON_ID is a PRIMARY or UNIQUE key on PERSON_INFO_TAB (which seems to be the case given that it's used in a singleton SELECT) you don't really need to read the table - just use the OLD or NEW values where appropriate: create or replace trigger fb_pers_id_check2_tr before insert on ifsapp.person_info_tab for each row declare v_pid_ person_info_tab.person_id%type; format_name_ person_info_tab.name%type; begin v_pid_ := :new.person_id; format_name_ := REGEXP_REPLACE(UPPER(:new.name), 'W'); if length(v_pid_) < 3 and length(format_name_) < 21 and v_pid_ <> format_name_ then raise_application_error(-20001, 'Person ID: ' || v_pid_ ||

Categories : Oracle

Fat Free router blocks Backbone router, how/when does Backbone router.js work?
If you are not using pushState, then the backbones routes are easy to differentiate from the server routes: /route1 /route2 /route1#route/a /route1#route/b The part before the hash is the one transmitted to the server (F3 routes). The part after the hash corresponds to the backbone routes. //F3 routing $f3->route('GET /route1',…) $f3->route('GET /route2',…) //Backbone routing routes: { "route/a": "routeA", "route/b": "routeB", } Note that the Backbone router doesn't generate any HTTP request to the server (unless you specifically define it of course). What generates automatically HTTP requests is the Backbone model. A backbone model is mapped to a server resource using urlRoot. The methods fetch(), save() and destroy() are then mapped respectively to the GET, PUT and

Categories : Backbone Js

Meteorite router package installation - Uncaught 'error' event on 'mrt add router'
Node 0.10.9 has a couple of issues. I'm not sure it'll help but try mrt add router --repoPort=80 as suggested here : https://github.com/oortcloud/meteorite/issues/135

Categories : Javascript

KnockOut JS - applying a new binding. Error - Message: ReferenceError: 'router' is undefined; Bindings value: css: { active: router.isNavigating }
Before you execute the problematic code, the Composition lifecycle of Durandal has bound the the shell.jsand subsequently the ViewModel agency.js with the UI. Meanwhile in the addContact function, at the last line you basically change the whole binding applied to the view: ko.applyBindings(objAgency); So your whole UI is now bound to this objAgency which I guess does not contain a router instance as the errors is pointing : ReferenceError: 'router' is undefined; This error comes probably from the binding of the shell because is no longer bound to the UI since your code applied new bindings. SOLUTION: The applyBindings is managed by Durandal in the composition process. If you want to modify some properties of the ViewModel there's no need to update the bindings. I don't know if

Categories : Javascript

How to test Meteor router or Iron router with laika
I had the same problem. I needed to navigate to some page before running my tests. I'm using iron router as well. I figured you can't just execute Router.go('foo') and that's it. You need to wait until the actual routing took place. Fortunately the router exposes a method Router.current() which is a reactive data source that will change as soon as your page is ready. So, in order to navigate to a specific route before running my tests, I firstly run the following code block: // route to /some/path client.evalSync(function() { // react on route change Deps.autorun(function() { if (Router.current().path == '/some/path') { emit('return'); this.stop(); } }); Router.go('/some/path'); }); Since this is within an evalSync()everything that

Categories : Meteor

How to modify the buffer-list using modify-frame-parameters
(frame-parameter 'nil 'buffer-list) returns a list of buffers, not their names; thus you might want to replace (lambda (tab) (buffer-name (tabbar-tab-value tab))) with 'tabbar-tab-value

Categories : Emacs

Field default timestamp set to table creation time instead of row creation time
Aha, worked it out-- seems you need to tell the server_default command if you're sending in some SQL that needs to be executed on the DBMS itself: from sqlalchemy import text class Test(db.Model): id = db.Column(db.Integer, primary_key=True) created = db.Column(db.DateTime, server_default=text('now()')) That generates: CREATE TABLE test ( id SERIAL NOT NULL, created TIMESTAMP WITHOUT TIME ZONE DEFAULT now(), PRIMARY KEY (id) )

Categories : Python

Writing an app (for my class) which states user input on state names and that particular state's capital.
Generally, you want individual IBOutlets for each UI widget that's part of your interaction. (I assume you're using Storyboard…) You have outlets for UITextFields, but your buttons are in an NSMutableArray. This is almost surely not what you want. You also don't have any methods written that handle the extraction of the data from the text fields into the dictionaries you're keeping. So, you need to wire a button to an IBAction method. This method will extract the text from the UITextField IBOutlets (self.stateField.text) and save to the NSMutableDictionary. Be sure your IBOutlets are connected properly to your view controller code and that the buttons are properly wired to your IBAction method. Those keywords should get you on the right track to solving the question. Related: I see a lo

Categories : Objective C

how to use the steady state probability to select a state in each iteration of the python code?
Let's assume you have a vector of probabilities (instead of just 3) and also that your initial state is the first one. import random def markov(probs, iter): # normalize the probabilities total = sum(probs) probs = map(lambda e: float(e)/total, probs) # determine the number of states n = len(probs) # Set the initial state s = 0 for i in xrange(iter): thresh = random.random() buildup = 0 # When the sum of our probability vector is greater than `thresh` # we've found the next state for j in xrange(n): buildup += probs[j] if buildup >= thresh: break # Set the new state s = j return s And thus >>> markov([1,1,1], 100) 2 >>> markov([1,1,1], 100) 1 But this only returns the last state. It's eas

Categories : Python

Populate state and city dropdowns based on country and state using jQuery
You need to get the value of the "previous" dropdown, and filter out the other ones. Basicly you got two options: Have all three dropdowns with all values. Then filter out those which is not needed. Upon selecting a value in the first one, hook the change() event, make an ajax call to some backend with the selected value, and return the states and cities that corresponds to that country.

Categories : Javascript

Do not receive mobile state state change event when wi-fi is enabled
Listen for ConnectivityManager.CONNECTIVITY_ACTION In your Broadcast Receiver, check for intent received and get Network Info if (intent.getAction().equals(ConnectivityManager.CONNECTIVITY_ACTION)) { final NetworkInfo networkInfo = intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO); Check for if ((networkInfo.getType() == ConnectivityManager.TYPE_MOBILE) && !networkInfo.isConnected() Mobile Data is not available Other wise in case if (networkInfo.isConnected() && (networkInfo.getType() == ConnectivityManager.TYPE_MOBILE) Mobile Data is available To Update your UI you can read the current state of Mobile Data Using Connectivity Manager like: ConnectivityManager cm = (ConnectivityManager)applicationContext.getSystemService(Context.CON

Categories : Android

Custom state-enter and state-exit code with routing
$route service has two events $routeChangeStart and $routeChangeSuccess, these can be of some help for you. You can use $routeChangeStart before exiting and $routeChangeSuccess on entering. You can do $scope.$on on any controller to watch for these events.

Categories : Angularjs

How can I communicate the state of a data area's pristine state to my scope?
There is always an option to do $rootScope.$broadcast and send a message from the table page. This can he handled in the grid page. Something like this in table controller $scope.$watch('page.$pristine',function(newValue) { $rootScope.broadcast("formUpdated",{state:page.$pristine}); }); And something like this in grid controller $scope.on("formUpdated",function(args) { //args.state would have the state. }); Note:$rootScope has to be injected into your controller like you inject $scope

Categories : Angularjs

$state does not transition to defined state in unit test
Not sure if same goes for UI-Router, but often there is missing a Digest Cycle, so the easy out is trying to call $scope.$digest() or $scope.$apply() (you can do that on $rootScope in your case)... You might have to mock out the $template factory to avoid server calls that the $http backend will fault on (i believe it is called in UI-Router)...

Categories : Unit Testing

Android App state recovery from launch - resume state
Save the state of your application inside the onPause() of the Activity. Place your code to restore the state of your application inside of onResume() inside of the Activity. This is part of the Activity lifecycle. Just don't let the onResume() misleading language confuse you. The thing that resumes is the UI thread in this case, so this method will get called even when the application initially begins (when the UI appears). If you have trouble fixing this, just post your Activity code in your question.

Categories : Android

CSS transition properties on initial state or final state?
You can specify the transition-* properties on either the "forward" or "reverse" state of a transition. It doesn't only need to be on the former. The transition module sort of alludes to this: Authors can specify the value of ‘transition-duration’, ‘transition-timing-function’, or ‘transition-delay’ in the same rule where they specify the value that triggers the transition, or can change these properties at the same time as they change the property that triggers the transition. Since it's the new values of these ‘transition-*’ properties that affect the transition, these values will be used for the transitions to the associated transitioning values. In the below example I gave a transition-duration on :hover of 4s but you'll notice as soon as you mouse out it goes bac

Categories : CSS

Transition from Stopped state to Resumed state, what with onStart()?
Since you don't want the instance to be re-initialized during onStart(), just initialize during onCreate() and use this if you want to save state simply from resuming again. However, to save more persistent data you must use something like SharedPreferences, a SQLite Database, or a file.

Categories : Android

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=unknown state: unknown protocol
The problem appears to be that your target site, aristo4stu3.bgu.ac.il, is picky about SSL/TLS handshaking. I got two different results with the following OpenSSL command with different versions of OpenSSL: openssl s_client -connect aristo4stu3.bgu.ac.il:443 This does connect with the stock OpenSSL 0.9.8x on OS X 10.7.5. However, it does not connect using OpenSSL 1.0.1e - in that case the server just closes the connection (by sending a Close Notify alert) immediately after receiving the Client Hello. I captured packets with Wireshark, and the difference between what these two versions send is that 0.9.8x is sending an SSLv2 Client Hello advertising support through TLS 1.0, while 1.0.1e is sending a TLSv1 Client Hello advertising support through TLS 1.2. If I tell 1.0.1e not to use T

Categories : Ruby On Rails

I have two tables, 1st country 2nd is state queried using ST_contains the state lies within the country or not
You are almost there, only missing quotes: select c.cid from country as c, state as s where ST_Contains( '01030000000100000005000000000000000000F03F000000000000F03F000000000000F03F0000000000001040000000000000104000000000000010400000000000001040000000000000F03F000000000000F03F000000000000F03F', '010300000001000000050000000000000000000040000000000000004000000000000000400000000000000840000000000000084000000000000008400000000000000840000000000000004000000000000000400000000000000040') The 'weird' geometry is because Postgres transforms the Polygon into a geometry. You can transform them to text again by using ST_AsText() SELECT ST_AsText( state1 ) FROM state;

Categories : PHP

jquery TypeError: state is undefined var options = state.options;
<div> <a href="#" id="toggle3">Slide Toggle3</a><br /><br /> <a href="#" id="toggle4">Slide Toggle4</a><br /><br /> <div class="toggle" style="display:none; background-color:#4CF;width:100px;height:200px;"></div> </div> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script type="text/javascript"> $(function () { $('#toggle4').click(function () { $('.toggle').hide('1000'); $('.toggle').text('toggle 4 clicked'); $('.toggle').slideToggle('1000'); return false; }); }); $(function () { $('#toggle3').click(function () { $('.toggle').hide('1000'); $('.toggle').text('toggle 3 cl

Categories : Javascript

How do you `get` the current state from a a state monad that is part of a product monad?
The solution is to use a state monad with a product of your states: m :: State (Int, String) () Then you can run an operation that interacts with one of the two fields of the product using zoom and _1/_2 from the lens library, like this: m = do n <- zoom _1 get zoom _2 $ put (show n) To learn more about this technique, you can read my blog post on lenses which goes into much more detail.

Categories : Haskell

ARP behind router with NAT?
The X.X.5.7 and X.X.10.1 are likely in different subnets, so you would not be able to get ARP messages from one subnet to another. ARP is sent only in the same subnet. If the destination is in a different subnet, then the host (sitting behind the AP) would simply send it to the gateway (perhaps the AP). You mentioned that you were able to do this without NAT. I am curious without NAT, did you put the clients in the X.X.10.1 subnet or in X.X.5.1 subnet?

Categories : Networking

ASP.NET MVC Router
All the routes defined are generic. http://mydomain.com/pablo will match the first route http://mydomain.com/pablo/cozinha will match the second route http://mydomain.com/ will match the first route (So home page will not be displayed) http://mydomain.com/home/index will match the second route. (So home page will not be displayed) Routes should be defined from specific to generic order. e.g. you can change the routes as, public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Servico", "Func/{funcionario}/{servico}", new { controller = "Funcionario", action = "Servico", funcionario = UrlParameter.Optional, servico = UrlParameter.Optional },

Categories : Asp Net Mvc

Ember.js help for router map
Okay, so first up, you can remove the / from { path: '/:dynamic_id' }. Next, you need to understand that when a dynamic segment is expected within the route you are referencing in your linkTo helper, you need to pass model (or other) objects as additional parameters to the linkTo helper as context for each dynamic segment. This is probably why you're getting the error. Your router should look something like this: Stat.Router.map(function () { this.resource('one', {path: ':one_id'}, function(){ this.resource('two', {path: ':two_id'}, function(){ this.resource('three', {path: ':three_id'}, function () { this.resource('four', {path: ':four_id'}); }); }); }); }); And in your template, you should be pas

Categories : Javascript

C++ Sockets with Router
This has nothing to do with your program, and everything to do with your network configuration. Go learn about NAT (network address translation) and doing port forwarding or DMZ on your router. Usually you want your program to bind to all interfaces - INADDR_ANY - but the important one is the address on the network controlled by your router (often 192.168.0.0/16, but it can be any RFC1918 address block). Once you have your network configured on your router and binding the external interface from your program (don't hard code an address like in your example, just use INADDR_ANY) serv_addr.sin_addr.s_addr = inet_addr(INADDR_ANY);

Categories : C++

codeigniter uri (URL) setup using router
To solve the problem, just move $route['products/(:any)/(:num)'] = "products/selbygrp/$2"; above $route['products/(:any)'] = "products/detail/$1";

Categories : Codeigniter



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