Search Results

Search found 4252 results on 171 pages for 'david 85'.

Page 125/171 | < Previous Page | 121 122 123 124 125 126 127 128 129 130 131 132  | Next Page >

  • grails: quering in a composite structure

    - by Asaf David
    hey i have the following domain model: class Location { String name static hasMany = [locations:Location, persons:Person] } class Person { String name } so basically each location can hold a bunch of people + "sub-locations". what is the best way to recursively query for all persons under a location (including it's sub locations, and their sub locations, etc')?

    Read the article

  • Application window sent behind other windows on closing different thread (C#)

    - by david.murrant
    I'm writing a Windows Forms Application in C#.NET On startup, the application displays a splash screen which is running in a separate thread. Whilst the splash screen is showing, the main application is initialising. Once the main application has finished initialising, the main form of the application is displayed, and the splash screen still shows over the top. Everything so far is as expected. Then, the Splash screen is closed, which causes that thread to exit. For some reason, at the point, the main application windows gets sent behind all other open Windows, notably the Windows Explorer window where you clicked the .exe file to run the application in the first place! What could be causing the windows to suddenly jump "behind" like this?

    Read the article

  • Refactoring if/else logic

    - by David
    I have a java class with a thousand line method of if/else logic like this: if (userType == "admin") { if (age > 12) { if (location == "USA") { // do stuff } else if (location == "Mexico") { // do something slightly different than the US case } } else if (age < 12 && age > 4) { if (location == "USA") { // do something slightly different than the age > 12 US case } else if (location == "Mexico") { // do something slightly different } } } else if (userType == "student") { if (age > 12) { if (location == "USA") { // do stuff } else if (location == "Mexico") { // do something slightly different than the US case } } else if (age < 12 && age > 4) { if (location == "USA") { // do something slightly different than the age > 12 US case } else if (location == "Mexico") { // do something slightly different } } How should I refactor this into something more managable?

    Read the article

  • How to load jQuery if it's not already loaded?

    - by David
    Hi I'm working on a weather widget, so in order to optimize it i want to check if jQuery has been loaded in the page, if Not, the widget will load it from my website. Because not all the websites use jQuery. how to do that? Example of how to put my widget: <html> blah blah blah ................. <script src="http://www.xxx.com/weather.js"></script> </body> </html> Thank you

    Read the article

  • Return more then One field from database SQLAlchemy

    - by David Neudorfer
    This line: used_emails = [row.email for row in db.execute(select([halo4.c.email], halo4.c.email!=''))] Returns: ['[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]'] I use this to find a match: if recipient in used_emails: If it finds a match I need to pull another field (halo4.c.code) from the database in the same row. Any suggestions on how to do this?

    Read the article

  • font-smoothing not applied to buttons

    - by David
    I have used this snippet to prevent webkit from changing antialiasing when using CSS transforms: html{ -webkit-font-smoothing: antialiased; } This works fine for most cases, however I noticed some weirdness in chrome when playing around with Bootstrap using this HTML: <button class="btn btn-inverse">John Doe</button> <a class="btn btn-inverse">John Doe</a>? This is how it looks in OSX/Chrome: Fiddle: http://jsfiddle.net/hY2J7/. In fact, it seems that it is not applied to buttons at all. Is there a safer technique to trigger the same antialiasing in webkit for all elements?

    Read the article

  • Xml with spaces as InnerText

    - by David Rutten
    I'm parsing Xml data which has entries like this: <item name="UserText" type_name="gh_string" type_code="10"> </item> I'm supposed to read the 6 spaces as a String, but both the InnerText and InnerXml values of the System.Xml.XmlNode are zero length Strings. Is there any way I can get at this whitespace data in existing files and what do I need to do in the future to prevent this sort of screw up?

    Read the article

  • Need help managing MySql connections

    - by David Jenings
    I'm having trouble finding a clear explanation of connection pooling. I'm building an app using the .NET connector I downloaded from mysql.com. The app only needs one db connection but will be running simultaneously on about 6 machines on my network. Normally, I'd create the connection at startup and just leave it. But I'm seeing lots of posts from people who say that's bad practice. Also I'm concerned about timeouts. My app will run 24/7 and there may be extended periods without database activity. I'm leaning toward the following: using (MySqlConnection conn = new MySqlConnection(connStr)) { conn.Open(); // use connection } But I'm not sure I understand what's going on in the background. Is this actually closing the connection and allowing gc to kill the object, or is there a built in pooling behavior that preserves the object and redelivers it the next time I try to create one? I certainly don't want the app reauthenticating across the network every time I hit the database. Can anyone offer me some advise?

    Read the article

  • ASP.NET MVC model state as text

    - by David Moorhouse
    Is there an easy way to get a summary string of the errors that have been added to a controller's modelstate? I'm looking to return this in an Ajax method and want the validation errors etc to be returned to the client (i.e. the view does not exist for this method call). Or do I have to loop through the modelstate and look at each object and extract the error text manually?

    Read the article

  • jQuery slider - set background color to show desired range

    - by David
    Howdy, I'm setting up a Filament Group jQuery UI slider and using it in a gradebook. We need to allow teachers to set a desired background range (to show the desirable values vs. the actual value for a given grade). I'm hoping to set a shaded area (as shown in this picture) that would indicate to people viewing the slider which values are desirable. If the handle is within the desired ranges, then the value is satisfactory. If the handle is out of the background shaded range, then some changes may need to happen. Any suggestions on how to accomplish this? Based on what I've experimented with using Firebug, it looks like a <div class="ui-slider"> is setup, but the values inside of it don't seem to allow setting background-colors (only the div allows for that). Thanks for your help.

    Read the article

  • "Share on LinkedIn" widget chokes on encoded spaces in url param

    - by David Droddy
    Does anyone know why I am not able to include my own, URL encoded URL params with URL encoded spaces? See the URL on my jsBin page constructed from LinkedIn's example--I have added (%3FnestedParam%3Done%20space) at the end of the "URL" value. THEN, if you remove the encoded space (%3FnestedParam%3DoneSpace) it works fine: Try it out: http://jsbin.com/acosa3/3 Thanks!

    Read the article

  • how to construct a long string

    - by david
    I need to construct a long string with javascript. Thats how i tried to do it: var html = '<div style="balbalblaba">&nbsp;</div>'; for(i = 1; i <= 400; i++){ html=+html; }; When i execute that in firefox its taking ages or makes it crash. what is the best way to do that? What is generally the best way to construct big strings in JS. can someone help me?

    Read the article

  • ActionScript: Using 'in' on protected/private variables?

    - by David Wolever
    Is there any way to mimic the in operator, but testing for the existence of protected or private fields? For example, this: <mx:Script><![CDATA[ public var pub:Boolean = true; protected var prot:Boolean = true; private var priv:Boolean = true; ]]></mx:Script> <mx:creationComplete><![CDATA[ for each (var prop in ["pub", "prot", "priv", "bad"]) trace(prop + ":", prop in this); ]]></mx:creationComplete> Will trace: pub: true prot: false priv: false bad: false When I want to see: pub: true prot: true priv: true bad: false

    Read the article

  • has_many :through default values

    - by David Lyod
    I have a need to design a system to track users memberships to groups with varying roles (currently three). class Group < ActiveRecord::Base has_many :memberships has_many :users, :through => :memberships end class Role < ActiveRecord::Base has_many :memberships has_many :users, :through => :memberships end class Membership < ActiveRecord::Base belongs_to :user belongs_to :role belongs_to :group end class User < ActiveRecord::Base has_many :memberships has_many :groups, :through => :memberships end Ideally what I want is to simply set @group.users << @user and have the membership have the correct role. I can use :conditions to select data that has been manually inserted as such : :conditions => ["memberships.grouprole_id= ? ", Grouprole.find_by_name('user')] But when creating the membership to the group the grouprole_id is not being set. Is there a way to do this as at present I have a somewhat repetitive piece of code for each user role in my Group model.

    Read the article

  • Easy way to compute how close an auto_increment is to its maximum value?

    - by David M
    So yesterday we had a table that has an auto_increment PK for a smallint that reached its maximum. We had to alter the table on an emergency basis, which is definitely not how we like to roll. Is there an easy way to report on how close each auto_increment field that we use is to its maximum? The best way I can think of is to do a SHOW CREATE TABLE statement, parse out the size of the auto-incremented column, then compare that to the AUTO_INCREMENT value for the table. On the other hand, given that the schema doesn't change very often, should I store information about the columns' maximum values and get the current AUTO_INCREMENT with SHOW TABLE STATUS?

    Read the article

  • SDL (And Others) Virtual Key Input

    - by David C
    Today I set up the input in my application for all the different keys. This works fine except for virtual keys, for example, caret or ampersand. Keys that normally need shift to be got at. Using SDL these virtual keys don't work. As in they do not register an event. if (event.type == SDL_KEYDOWN) { switch (event.key.keysym.sym) { case SDLK_CARET: Keys[KeyCodes::Caret] = KeyState::Down; break; case SDLK_UP: Keys[KeyCodes::Up] = KeyState::Down; break; default: break; } I am absolutely sure my system works with physical keys like Up. The program queries a keystate like so: if (Keys[KeyCode] == KeyState::Down) { lua_pushboolean(L, true); } else { lua_pushboolean(L, false); } KeyCode is passed in as an argument. So why are virtual keys, or keys that need shift to get at not working using SDL's KeyDown event type? Is more code needed to get to them? Or am I being stupid?

    Read the article

  • C# recursive programming with lists

    - by David Torrey
    I am working on a program where each item can hold an array of items (i'm making a menu, which has a tree-like structure) currently i have the items as a list, instead of an array, but I don't feel like I'm using it to its full potential to simplify code. I chose a list over a standard array because the interface (.add, .remove, etc...) makes a lot of sense. I have code to search through the structure and return the path of the name (i.e. Item.subitem.subsubitem.subsubsubitem). Below is my code: public class Item { //public Item[] subitem; <-- Array of Items public List<Item> subitem; // <-- List of Items public Color itemColor = Color.FromArgb(50,50,200); public Rectangle itemSize = new Rectangle(0,0,64,64); public Bitmap itemBitmap = null; public string itemName; public string LocateItem(string searchName) { string tItemName = null; //if the item name matches the search parameter, send it up) if (itemName == searchName) { return itemName; } if (subitem != null) { //spiral down a level foreach (Item tSearchItem in subitem) { tItemName = tSearchItem.LocateItem(searchName); if (tItemName != null) break; //exit for if item was found } } //do name logic (use index numbers) //if LocateItem of the subitems returned nothing and the current item is not a match, return null (not found) if (tItemName == null && itemName != searchName) { return null; } //if it's not the item being searched for and the search item was found, change the string and return it up if (tItemName != null && itemName != searchName) { tItemName.Insert(0, itemName + "."); //insert the parent name on the left --> TopItem.SubItem.SubSubItem.SubSubSubItem return tItemName; } //default not found return null; } } My question is if there is an easier way to do this with lists? I've been going back and forth in my head as to whether I should use lists or just an array. The only reason I have a list is so that I don't have to make code to resize the array each time I add or remove an item.

    Read the article

  • CGRect var as property value?

    - by David.Chu.ca
    CGRect type is a structure type. If I want to define a property as this type, should I use assign or retain attribute for this type? @interface MyClass { CGRect rect; ... } @property (nonatomic, assign) rect; // or retain?

    Read the article

< Previous Page | 121 122 123 124 125 126 127 128 129 130 131 132  | Next Page >