w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
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

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

Vb.Net : Mdi Child alway in Maximize state when the other child form close
If I understand this question correctly, if you want to make sure a from is maximized when you close a different form, you could use the FormClosed event like: Private Sub Form1_FormClosed(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.FormClosed Form2.WindowState = FormWindowState.Maximized End Sub HTH

Categories : Vb.Net

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

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

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

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

akka - making a single actor the child of several other actors (in a router)
I figured this out somewhat. The issue is you want to have a certain supervision strategy - you can use the supervision strategy from the class like so by creating a router of one actor. val actor: ActorRef = system.actorOf(Props(classOf[ActorClass], system.deadLetters).withRouter( RoundRobinRouter(1, supervisorStrategy = zkSupervisor))) val zkSupervisor = AllForOneStrategy() { case _: WhateverException ⇒ //do stuff Restart }

Categories : Scala

angular-ui-router blank page with index.html in URL
Add url:'/' to the base abstract view. .state('layout', { abstract : true, url:'/', views : { "headerView" : { templateUrl : 'partials/header.html', controller : 'LoginController' }, "navigationView" : { templateUrl : 'partials/navigation.html', controller : 'NavigationController' } } })

Categories : Angularjs

Router marionette backbone remove/rename base url (index.html)
That's a job for your server configuration: you need it to rewrite the routes with index.html to remove it but still perform the appropriate actions (e.g. using Apache's modrewrite, I believe).

Categories : Javascript

Saving state of Child windows in WPF C#
You can use Settings to share data between different Windows/Controls and even save application data when closing/starting an application. The .NET Framework allows you to create and access values that are persisted between application execution sessions. These values are called settings. Settings can represent user preferences, or valuable information the application needs to use. For example, you might create a series of settings that store user preferences for the color scheme of an application. Or you might store the connection string that specifies a database that your application uses. Settings allow you to both persist information that is critical to the application outside of the code, and to create profiles that store the preferences of individual users. Yo

Categories : C#

How to keep hover state on parent when on child element?
If you want to use jQuery following one is may be help you : $(document).ready(function() { $('#child').hover(function(){ $('#parent').addClass('hoverClass'); }, function(){ $('#parent').removeClass('hoverClass'); }); });

Categories : Jquery

mySQL index and preparing state
Could you not simply rewrite the query as follows: SELECT a.Transaction FROM table1 a INNER JOIN table2 b ON b.Transaction = a.Transaction WHERE (b.Plugin='XXX' AND b.Server='XXX') AND a.Detail NOT IN ('Monitor','Version','monitor','version') ORDER BY a.Date DESC, a.Millisecond DESC LIMIT 10 So you join the table2 (which will be faster) and remove all the subqueries. This should be much faster.

Categories : Mysql

How to propagate the state of a class filed to child threads Immediately?
You have parallel execution on the code block passed to the Parallel.ForEach method. So some threads will be just past the if (Interrupted) test when your main thread sets it to true. Only subsequent executions of the foreach loop will catch it.

Categories : C#

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

Z-Index Does Not Work on Child Div
Generally not the best idea to have a child div you want to appear behind it's parent. Usually you would take the child div outside the parent to do this. Nonetheless it is possible. Add z-index:-1 to the child div and remove position:relative from the parent. HTML <div id='testtexture'> <div id='testinside'> <div class="test"></div> </div> </div> CSS .test { position: relative; z-index: -1; width: 50px; margin: 0 auto; height: auto; min-height: 130px; padding-bottom: 50px; background: blue; } #testinside { background: red; } See fiddle: http://jsfiddle.net/gBQqQ/1/ If you use firebug, you can see div.test is still there in the correct position behind it's parent. As a side note, the styling vertic

Categories : HTML

Get index of child using jQuery
EDIT Since no one can reproduce the problem, here are some possibilities: The version of jQuery you're using is conflicting with another script on your page. Since it seems your click event handler is firing because your getting an alert box. Try using the latest version of jQuery. Your version of jQuery is conflicting with the current browser you are using. When you're having JavaScript issues you should report the versions of the library you are using (if any) and of your browser. Check your results in another browser and report back. Your HTML is being manipulated before your click event is fired. What other code do you have on the page? Share a more complete source code listing. alert($(this).parent().prevAll().length); Use .prevAll to get all previous siblings, then use

Categories : Javascript

add class to third child of tr from index 2 to 4
Perhaps this way: $("tr").slice(1,4).children(":nth-child(3)") So, Using your variables lastRowIndex and currentIndex, the query to add myClass should be : $("tr").slice(lastRowIndex-1, currentIndex) .children(":nth-child(3)").addClass("myClass")

Categories : Jquery

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 index child on top of parent's brother's children
With your hierarchy it is impossible, as the DisplayList is a tree as a whole, and is rendered depth first. So, put Container under Dock, and give it child index less than InfoPanel. dock.addChild(container); dock.addChild.infoPanel); container.addChild(ball); main.addChild(dock); This approach will net you the requested goal. In case you need to add another layer, say between Container and InfoPanel, add another container between them, and add required stuff to that container.

Categories : Actionscript

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

Wordpress undefined index notice in child theme
For undefined index notices normally the solution is using isset(): if ( !isset( $_POST['custom_meta_box_nonce'] ) || !wp_verify_nonce( $_POST['custom_meta_box_nonce'], basename(__FILE__) ) )

Categories : PHP

How to give a child element a higher z-index than the parent element
z-index is relative to the siblings within the same parent. you will have to take the <a> out of the <header> to create the desired effect. If the parent has lower z-index than the modal, everything in it will be behind the modal, regardless of the children's z-index Please also attach a jsFiddle or something so we can show you how to fix this.

Categories : HTML

how to get the index of a child node under a parent node using python?
Using xml.etree.ElementTree: import xml.etree.ElementTree as ET root = ET.fromstring('''<?xml version="1.0"?> <BCPFORMAT ... </BCPFORMAT>''') # Accessing parent node: http://effbot.org/zone/element.htm#accessing-parents parent_map = {c: p for p in root.getiterator() for c in p} child = root.find('.//*[@ID="1"]') print(list(parent_map[child]).index(child)) # => 0 Using lxml: import lxml.etree as ET root = ET.fromstring('''<?xml version="1.0"?> <BCPFORMAT ... </BCPFORMAT>''') child = root.find('.//*[@ID="1"]') print(child.getparent().index(child)) # => 0

Categories : Python

z-index and stacking; removing a child from stacking context
I guess you do not need to change the location of the #widget. In my view, the answer lies in your question itself. Check this out Edited CSS: #block1{ background-color: #abc; color: #123; z-index:3; } #block3 { background-color: #abc; color: #123; z-index:1; }

Categories : HTML

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

To index or not to index – are there reasons to index columns already included in a primary key?
Based upon your application you can decide what works best for indexes on the other columns in the table. For example, if you have a large percentage of queries including certain columns it may make sense to include them as indexes. You can include a single index per column or create a "covering index" that may include additional columns that you know will be returned in SQL queries frequently by your application. Here is some other helpful advice: You can run SQL Management Studio and issue some of your SELECT/INSERT/UPDATE/DELETE queries using the "Display Estimated Execution Plan". This will give you a visual graph of what the DBMS is doing under the covers. If you see "table scans" or "index scans" you can increase performance by adding indexes to change to "table seek" or "index s

Categories : Sql Server

How does index affect the result of two tables - one with index and another without index?
But the order of the rows are not the same and I don't know how to compare the data in both Of course. You added a clustered index - this means that the indexed table is stored sorted according to the index. But without an ORDER BY clause, there is not defined order. I don't know how to compare the data in both Use the ORDER BY clause to order the data as you wish. This will allow for comparisons. The query you have posted should return corresponding rows in the same order as your join condition is on COL_1, so not so sure why the issue is.

Categories : SQL



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