Search Results

Search found 1319 results on 53 pages for 'noah smith'.

Page 29/53 | < Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >

  • how to change string values in dictionary to int values

    - by tom smith
    I have a dictionary such as: {'Sun': {'Satellites': 'Mercury,Venus,Earth,Mars,Jupiter,Saturn,Uranus,Neptune,Ceres,Pluto,Haumea,Makemake,Eris', 'Orbital Radius': '0', 'Object': 'Sun', 'RootObject': 'Sun', 'Radius': '20890260'}, 'Earth': {'Period': '365.256363004', 'Satellites': 'Moon', 'Orbital Radius': '77098290', 'Radius': '63710.41000.0', 'Object': 'Earth'}, 'Moon': {'Period': '27.321582', 'Orbital Radius': '18128500', 'Radius': '1737000.10', 'Object': 'Moon'}} I am wondering how to change just the number values to ints instead of strings. def read_next_object(file): obj = {} for line in file: if not line.strip(): continue line = line.strip() key, val = line.split(": ") if key in obj and key == "Object": yield obj obj = {} obj[key] = val yield obj planets = {} with open( "smallsolar.txt", 'r') as f: for obj in read_next_object(f): planets[obj["Object"]] = obj print(planets)

    Read the article

  • Expression.OrElse, dynamically creating a condition.

    - by Jim
    Hi, I am attempting to create a dynamic where clause using the standard expression API. var query = ( from p in Parties orderby p.PartyId orderby p.FullName select p ).AsQueryable(); Expression<Func<Party, bool>> @fn = (p) => SqlMethods.Like(p.FullName, "%smith%") || SqlMethods.Like(p.Person.FirstName, "%smith%"); Expression<Func<Party, bool>> @sn = (p) => SqlMethods.Like(p.Person.FirstName, words[0]); ParameterExpression pe = Expression.Parameter(typeof(Party), "p"); Expression orelse = Expression.OrElse( Expression.Lambda(@fn, pe), Expression.Lambda(@sn, pe) ); The expressions above will ultimately be added to a where clause. I need to add a bunch of 'likes'. How do I do this? I get InvalidOperationException on the operator OrElse I have also tried Expression.Or Thanks Regards Craig.

    Read the article

  • Error setting env thru subprocess.call to run a python script on a remote linux machine

    - by John Smith
    I am running a python script on a windows machine to invoke another python script on a remote linux machine. I am using subprocess.call with ssh to do this, like below: subprocess.call('ssh -i <identify file> username@hostname python <script_on_linux_machine>') and this works fine. However, if I want to set some environment variables, like below: subprocess.call('ssh -i <identify file> username@hostname python <script_on_linux_machine>', env={key1:value1}) it fails. I get the following error: ssh_connect: getnameinfo failed ssh: connect to host <hostname> port 22: Operation not permitted 255 I've tried splitting the ssh commands into list and passing. Didn't help. I've tried to run other 'local'(windows) commands thru subprocess.call() and tried setting the env. It works fine. I've tried to run other commands(such as ls) on the remote linux machine. Again, subprocess.call() works fine, as long as I don't try to set the environment. What am I doing wrong? Would I be able to set the environment for a python script on a remote machine? Any help will be appreciated.

    Read the article

  • selecting a row by means of a button ... using didSelectRowAtIndexPath

    - by John Smith
    hey people , I have a question concerning a button I would like to create which selects my previous selected row. This is what I came up so far but since I'm new with the functionality and such I could definately use some pointers I created a toolbar with a button and behind this button is the following action. -(void)clickRow { selectedRow = [self.tableView indexPathForSelectedRow]; [self.tableView:[self tableView] didSelectRowAtIndexPath:selectedRow]; } in my didSelectRowAtIndexPath there is a rootViewController being pushed rvController = [RootViewController alloc] ...etc So what I would like is my function clickRow to select the row and push the new rootviewcontroller (which has the right info since I'm using a tree ). I tried something like this as well -(void)clickRow { NSDictionary *dictionary = [self.tableDataSource objectAtIndex:indexPath.row]; NSArray *Children = [dictionary objectForKey:@"Children"]; rvController = [[RootViewController alloc] initWithNibName:@"RootViewController" bundle:[NSBundle mainBundle]]; rvController.CurrentLevel += 1; rvController.CurrentTitle = [dictionary objectForKey:@"Title"]; [self.navigationController pushViewController:rvController animated:YES]; rvController.tableDataSource = Children; [rvController release]; } The last function works a little but a little is not enough;) For instance if I press the middle row or any other it constantly selects the toprow. thnx all for those of you reading and trying to help

    Read the article

  • Developing Job References

    - by Joe Smith
    How do you develop references for jobs? I have 6 years of programming experience spanning two jobs, but sadly I don't have a lot of people I can draw on as references. It's been several years since I left my last job, which was at a small company, and I've lost touch with the few people I knew there. I now work at another small company. I think I've gone as far as I can in my current position, and would like to look for greener pastures, but I can't exactly use my current boss as a reference, even though I have a very good repore with him. I'm sure he'd make a great reference down the road, but I'm afraid I'd insult him or jeopardize my current job by mentioning that I'm thinking of leaving and would like him to help me. I've applied to some jobs, and I have gotten several replies like, "Oh, you're exactly what we're looking for. Send us a couple references and we'll schedule an interview. Oh, no references? You must be a psychopath, nevermind." I've tried doing some small freelance work on the side, just so I can have a contact who can vouch for my work, but the competition for even small projects is pretty fierce and I can rarely devote adequate time to freelancing while holding a full time job. In addition, I often encounter a Catch-22 where a lot of freelancing jobs also require references. So how do programmers maintain existing references and develop new ones, especially while holding a full time job?

    Read the article

  • jquery autosize web interface?

    - by mark smith
    Hi there, I have been designing with jquery and using the jquery UI widgets .. but always been designing for 1024 x 768 ... Is there any tricks or plugins (preferably that work with jquery UI) to automatically resize elements of my interface ... that way when somebody views it at a higher resolution it doesn't look so small.. Anybody have any tips on this? Thanks

    Read the article

  • which regular expression will capture this sequence?

    - by John Smith
    The text follows this pattern <tr class="text" (any sequence of characters here, except ABC)ABC(any sequence of characters here, except ABC) <tr class="text" (any sequence of characters here, except ABC)ABC(any sequence of characters here, except ABC) <tr class="text" (any sequence of characters here, except ABC)ABC(any sequence of characters here, except ABC) <tr class="text" (any sequence of characters here, except ABC)ABC(any sequence of characters here, except ABC) so basically the above line might repeat itself multiple times, and the idea is to retrieve the first 3 characters immediately after ABC. I have tried regular expressions along the lines of \<tr class="text" [.]+ABC(?<capture>[.]{3}) but they all fail. Can someone give me a hint?

    Read the article

  • Android depth buffer issue: Advice for anyone experiencing problem

    - by Andrew Smith
    I've wasted around 30 hours this week writing and re-writing code, believing that I had misunderstood how the OpenGL depth buffer works. Everything I tried, failed. I have now resolved my problem by finding what may be an error in the Android implementation of OpenGL. See this API entry: http://www.opengl.org/sdk/docs/man/xhtml/glClearDepth.xml void glClearDepth(GLclampd depth); Specifies the depth value used when the depth buffer is cleared. The initial value is 1. Android's implementation has two versions of this command: glClearDepthx which takes an integer value, clamped 0-1 glClearDepthf which takes a floating point value, clamped 0-1 If you use glClearDepthf(1) then you get the results you would expect. If you use glClearDepthx(1), as I was doing then you get different results. (Note that 1 is the default value, but calling the command with the argument 1 produces different results than not calling it at all.) Quite what is happening I do not know, but the depth buffer was being cleared to a value different from what I had specified.

    Read the article

  • How can you query for an object using one of its properties' id

    - by James Smith
    I have two entities, say, House and People, where multiple people can live in one house. It's a unidirectional link where each Person has a field for which House they belong to, so the Person table has a column named house_id. I need to be able to return all the Person objects who belong to a certain House, but I only have the id of the house. This can be done like this: House house = houseDAO.findById(houseId); List people = session.createCriteria(Person.class).add(Restrictions.eq("house", house)).list(); But since I don't need the house, that's adding an unnecessary query. I've tried to do: session.createCriteria(Person.class).add(Restrictions.eq("house_id", houseId)).list(); But that doesn't work because house_id is not a property, it's a database column. I could just add an sql restriction, but is there a hibernate way of doing this?

    Read the article

  • WCF Rest services for use with the repository pattern?

    - by mark smith
    Hi there, I am considering moving my Service Layer and my data layer (repository pattern) to a WCF Rest service. So basically i would have my software installed locally (WPF client) which would call the Service Layer that exists via a Rest Service... The service layer would then call my data layer using a WCF Rest Service also OR maybe just call it via the DLL assembly I was hoping to understand what the performance would be like. Currently I have my datalayer and servicelayer installed locally via DLL Assemblies locally on the pc. Also i presume the WCF REST services won't support method overloading hance the same name but with a different signature?? I would really appreciate any feedback anyone can give. Thanks

    Read the article

  • Nested Usercontrols and ViewState

    - by Bob Smith
    I have a UserControlParent that dynamically loads UserControlChild. In the UserControlChild, I store a value using the ViewState object by doing a ViewState["count"] = myCount; On Postbacks, the ViewState returns a null. Is this because the UserControlChild is being loaded dynamically? If it helps, the UserControlParent is loaded dynamically in the ASPX page as well.

    Read the article

  • Determine branch of origin from bzr blame

    - by Dave Aaron Smith
    I had a complicated change that affected a bunch of files. I don't remember what bazaar branch I wrote that change in. We have a somewhat complicated merge setup, so the branch I'm in now lumps that change in with a lot of other changes. I'd like to do some very similar work so it would be nice to pull the original diff. I feel like I should be able to use bzr blame. I run this command on one of the files bzr blame --long path/to/file and I find one of the pertinent lines and get something like 1107.6.213 dsmith@satie 20091202 | tinyMCE.init({ Can I use that to figure out what branch and revision the original change came from? What do the 6 and 213 stand for?

    Read the article

  • .htaccess Redirect Loop, adding multiple .php extensions

    - by Ryan Smith
    I have sort of a small parent/teacher social network set up for my school. I use my .htaccess file to make the links to teacher profiles cleaner and to add a trailing slash to all urls. I get this problem when going to /teachers/teacher-name/ the link (sometimes) redirects to /teachers/teacher-name.php.php.php.php.php.php.php.php... Below is my .htaccess file. Sometimes if I clear my browser cache in Chrome it temporarily fixes it. I can't exactly wright .htaccess syntax, but I'm pretty familiar with it. Any suggestions are appreciated! RewriteEngine on RewriteBase / #remove php ext RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^([^/]+)/$ $1.php RewriteRule ^([^/]+)/([^/]+)/$ $1/$2.php #force trailing slash/ RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)([^/])$ /$1$2/ [L,R=301] #other rewrites RewriteRule ^teachers/([^/\.]+)/$ /teachers/profile.php?u=$1 RewriteRule ^teachers/([^/\.]+)/posts/$ /teachers/posts.php?u=$1 RewriteRule ^teachers/([^/\.]+)/posts/([^/\.]+)/$ /teachers/post.php?u=$1&p=$2 RewriteRule ^gallery/([^/\.]+)/$ /gallery/album.php?n=$1 RewriteRule ^gallery/([^/\.]+)/slideshow/$ /gallery/slideshow.php?n=$1 RewriteRule ^gallery/([^/\.]+)/([^/\.]+)/([^/\.]+)/$ /gallery/photo.php?a=$1&p=$2&e=$3 EDIT:I have attached a screenshot of exactly what I'm talking about.

    Read the article

  • Graph call "/me/friends" doesn't contain names if called from a testuser

    - by Marc
    When I log into Facebook with my account and call the Graph API with /me/friends it returns an array like this: [ {id: "6868...", name: "John Smith"}, {id: "7531...", name: "Diane Smith"}, ... ] But if I'm logged in with a Facebook testuser and do the same call I get an array like this: [ {id: "100002927..."}, {id: "100003151..."}, ... ] So I'm missing the name property. Bug? Or did I some mistake? I'm using the JS SDK, but I think that doesn't matter.

    Read the article

  • Converting the value from string to integer in a nested dictionary

    - by tom smith
    I want to change the numbers in my dictionary to int values for use later in my program. So far I have import time import math x = 400 y = 300 def read_next_object(file): obj = {} for line in file: if not line.strip(): continue line = line.strip() key, val = line.split(": ") if key in obj and key == "Object": yield obj obj = {} obj[key] = val yield obj planets = {} with open( "smallsolar.txt", 'r') as f: for obj in read_next_object(f): planets[obj["Object"]] = obj print(planets) scale=250/int(max([planets[x]["Orbital Radius"] for x in planets if "Orbital Radius" in planets[x]])) print(scale) and the output is {'Sun': {'Object': 'Sun', 'Satellites': 'Mercury,Venus,Earth,Mars,Jupiter,Saturn,Uranus,Neptune,Ceres,Pluto,Haumea,Makemake,Eris', 'Orbital Radius': '0', 'RootObject': 'Sun', 'Radius': '20890260'}, 'Moon': {'Object': 'Moon', 'Orbital Radius': '18128500', 'Period': '27.321582', 'Radius': '1737000.10'}, 'Earth': {'Object': 'Earth', 'Satellites': 'Moon', 'Orbital Radius': '77098290', 'Period': '365.256363004', 'Radius': '6371000.0'}} 3.2426140709476178e-06 I want to be able to convert the numbers in the dict to ints for further use. Any help in greatly appreciated.

    Read the article

  • Turning A Stacked List into workable data

    - by BoSox
    In Excel I have a list of names that in the cell appear stacked, and I want each name in its own column. I was thinking Python may be a good way to do this? Example: Joe Smith John Hawk Mike Green Lauren Smith One cell will look exactly like that, with each name on its line within the cell but all of the names contained in the cell. I have 50 cells each with 1-20 stacked names and I want to put each name in its own cell on a given row. So, in my example all of those names would occupy the same row but each would have their own column. Any ideas?

    Read the article

  • Compare two Xcode build settings

    - by John Smith
    I have a project where I use two build settings predominantly. Unfortunately today something went wrong. One compiles and the other doesn't. How can I compare the two build settings in XCode to see what the differences are? (For those interested, the error I get in one build is jump to case label crosses initialization of 'const char* selectorName' if you know what this means I'll be very grateful )

    Read the article

  • Get Specific Data From Array, Based On Another Value

    - by A Smith
    I have an array that outputs these values: Array ( [0] => stdClass Object ( [ID] => 6585 [COLOR] => red [Name] => steve ) [1] => stdClass Object ( [ID] => 5476 [COLOR] => blue [Name] => sol ) [2] => stdClass Object ( [ID] => 7564 [COLOR] => yellow [Name] => jake ) [3] => stdClass Object ( [ID] => 3465 [COLOR] => green [Name] => helen ) ) Now, I will know the ID of the person, and I need the get the COLOR value for that specific value set. How is this best achieved please?

    Read the article

  • Windows Azure - access webrole local storage from separate workerrole

    - by Brett Smith
    I'm running an application on windows azure, the MVC views need to be dynamic, I started by storing them as records in the database, but am quite keen to move them to a physical location. My concept was to create the physical file via code... which worked great and speeds up the page load dramatically. This was of course before I realised that the files were only available for the duration of the role Next I looked at a start up task to create the files when the role was started - however I then realised that any separate instances weren't going to sync up unless I monitored the database for changes. So I moved from a start up task to a function in the run method of the role that checks the database every 10 minutes to see if changes have occurred. The problem is that this seems to choke up the application (at least in the warm up stage). Ideally I would like to move the run function to it's own worker role that can sit there and push files out to web role instances, but I'm unsure on how I would go about accessing the web roles local storage from the worker role. Can anybody tell me whether this is actually possible? and hopefully point me in the right direction to achieve this? Just to clarify what I'm trying to achieve -View is created in user interface running on web role and stored in database -Separate web role (front end) has clientside application with virtualpath provider pointing Views requests to local storage (localresource) -separate worker role to create View structure and load this into clientside web role local storage

    Read the article

  • Looking for marg_setValue fix in iPhoneOS

    - by John Smith
    I am trying to compile a library originally written for Cocoa. Things are good until it looks for the function marg_setValue(). It says there is a syntax error before char in marg_setValue(argumentList,argumentOffset,char,(char)lua_toboolean(state,luaArgument)); (it's talking about the third argument, not (char) ) I am trying to port LuaObjectiveCBridge to the iPhone. It has two choices, either using Runtime or Foundation. I have discovered there are some problems with foundation so I am trying runtime. But the compiler is not co-operating.

    Read the article

  • accessing required modules from other modules

    - by john smith
    I have a bare-bone express application, exactly the one that is created with the express command. I have installed socket.io and attached it to my server, like this: var app = express(), server = http.createServer(app), io = io.listen(server); server.listen(8000); Now, I also have the routes files, which is called like this: app.get('/', routes.index); Inside this module I have the following function: exports.index = function(req, res){ socket.emit('news', { message: "foo" }); }; This obviously leads to a 500 reference error, because the routes file is an exportable module, and obviously has no idea what the socket is, as it is located in the app.js file. Is there a way I can access this socket object from this, or any other file? Please note that it is attached to the express generated app. extra: what about getting/setting session data? Thanks in advance.

    Read the article

  • Ideas for designing an automated content tagging system needed

    - by Benjamin Smith
    I am currently designing a website that amongst other is required to display and organise small amounts of text content (mainly quotes, article stubs, etc.). I currently have a database with 250,000+ items and need to come up with a method of tagging each item with relevant tags which will eventually allow for easy searching/browsing of the content for users. A very simplistic idea I have (and one that I believe is employed by some sites that I have been looking to for inspiration (http://www.brainyquote.com/quotes/topics.html)), is to simply search the database for certain words or phrases and use these words as tags for the content. This can easily be extended so that if for example a user wanted to show all items with a theme of love then I would just return a list of items with words and phrases relating to this theme. This would not be hard to implement but does not provide very good results. For example if I were to search for the month 'May' in the database with the aim of then classifying the items returned as realting to the topic of Spring then I would get back all occurrences of the word May, regardless of the semantic meaning. Another shortcoming of this method is that I believe it would be quite hard to automate the process to any large scale. What I really require is a library that can take an item, break it down and analyse the semantic meaning and also return a list of tags that would correctly classify the item. I know this is a lot to ask and I have a feeling I will end up reverting to the aforementioned method but I just thought I should ask if anyone knew of any pre-existing solution. I think that as the items in the database are short then it is probably quite a hard task to analyse any meaning from them however I may be mistaken. Another path to possibly go down would be to use something like amazon turk to outsource the task which may produce good results but would be expensive. Eventually I would like users to be able to (and want to!) tag content and to vote for the most relevant tags, possibly using a gameification mechanic as motivation however this is some way down the line. A temporary fix may be the best thing if this were the route I decided to go down as I could use the rough results I got as the starting point for a more in depth solution. If you've read this far, thanks for sticking with me, I know I'm spitballing but any input would be really helpful. Thanks.

    Read the article

< Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >