Search Results

Search found 3489 results on 140 pages for 'chris welsh'.

Page 85/140 | < Previous Page | 81 82 83 84 85 86 87 88 89 90 91 92  | Next Page >

  • Python - Get Instance Variables

    - by Chris Bunch
    Is there a built-in method in Python to get an array of all a class' instance variables? For example, if I have this code: class hi: def __init__(self): self.ii = "foo" self.kk = "bar" Is there a way for me to do this: >>> mystery_method(hi) ["ii", "kk"] Thanks guys! Edit: I originally had asked for class variables erroneously. Thanks to all who brought this to my attention!

    Read the article

  • getting a tiled image collection on the iPad (deepzoom)

    - by Chris B
    I have a set of tiled image collections created via microsoft's deep zoom composer, and a silverlight app that currently consumes them for display via MultiScaleImage - it's all working pretty well - I'd just like to get some experience with iPad programming and have a couple of ideas for some ipad applications. All my ideas rely on me being able to display/manipulate these tiled image sets (on the iPad). I just picked up a iMac to facilitate this. I'm not seeing any objective-c / cocoa-touch libraries for this though, so am assuming I will have to roll my own. (Saw the seadragon ajax component, which is pretty slick, but I'm dealing with collections here, which it doesn't support. I would also like to roll this as a native app just to get the experience). The only open source project I found for displaying/manipulating the tiled image sets was Openzoom -a flash component. I'm not to familiar with actionscript either (python, java, c#, and c are the only languages I have really used), but briefly inspecting the code I didn't really have any issues with it and can probably use it for hints on how to swap the tiles in and out, etc.. But, as I'm pretty new to obj-c/cocoa-touch, some pointers in the right direction would be appreciated. 1) Are there any other projects out there I am missing, or is openzoom my best bet for some reference? 2) Should I be trying to do this display in the UIKit framework, or should I do it as an OpenGL display? 3) Any other suggestions/pointers that I didn't think to ask.

    Read the article

  • Deserialize jSON Google AJAX Translation API

    - by Chris Porter
    I've got the JSON coming back like this: {"responseData": [{"responseData":{"translatedText":"elefante"},"responseDetails":null,"responseStatus":200},{"responseData":{"translatedText":"Burro"},"responseDetails":null,"responseStatus":200}], "responseDetails": null, "responseStatus": 200} And I need to parse it into a ResponseData object I have set-up: public class ResponseData { public string translatedText = string.Empty; public object responseDetails = null; public HttpStatusCode responseStatus = HttpStatusCode.OK; public List<ResponseData> responseData { get; set; } } I Deserialize it like this: JavaScriptSerializer serializer = new JavaScriptSerializer(); ResponseData translation = serializer.Deserialize<ResponseData>(responseJson); But no matter what the translated text is always empty.

    Read the article

  • Dojo dialog, the iPad and the virtual keyboard issue

    - by Chris Butler
    Recently, I have been working on a project where the interface should work for desktop and tablets (in particular the iPad). One issue I am coming across is with a Dojo dialog on the iPad when text entry is taking place. Basically here is what happens: Load Dojo interface with buttons on iPad - OK Press button (touch) to show dialog (90% height and width) - OK Click on text box (touch) like DateTextBox or TimeTextBox - OK, the virtual keyboard is opened Click the date or time I want in the UI (touch) - OK, but I can't see all of the options since it is longer than the screen size... Try to scroll down (swipe up with two fingers or click 'next' in the keyboard) - not OK and the dialog repositions itself to have it's top at the top of the viewport area. Basically, the issue is that the dialog keeps trying to reposition itself. Am I able to stop dialog resizing and positioning if I catch the window onResize events? Does anyone else have this issue with the iPad and Dojo dialogs? Also, I found this StackOverflow topic on detecting the virtual keyboard, but it wasn't much help in this case... http://stackoverflow.com/questions/2593139/ipad-web-app-detect-virtual-keyboard-using-javascript-in-safari Thanks!

    Read the article

  • Replace duplicate spaces with single space in TSQL

    - by Chris
    I need to ensure that a given field does not have more than one space (not concerned about all white space, just space) between characters. So 'single spaces only' Needs to turn into 'single spaces only' The below will not work select replace('single spaces only',' ',' ') as it would result in 'single spaces only' I would really prefer to stick with native TSQL rather than a CLR based solution. Thoughts?

    Read the article

  • In Google App Engine, what is the simplest way to keep a record of items that you have put into memc

    - by Chris Boesch
    I am starting to use memcache more frequently to avoid having to recalculate things between page requests. When the memcache periodically clears, as it is designed to do, I have to start all over rebuilding various items that I have placed in memcache. What I would like to do is create a very simple model that enables me to periodically save the items that I put into memcache based on the memcache keys that I'm using along with a datetime that is related to the data being memcached. What is the best way to do this? I'm looking for something like this: class MemcacheRecord(db.Model): key = db.StringProperty(required=True) value = #Something that can store whatever memcache can validThru = db.DateTimeProperty(required=True) def set(self, key, value, validThru): #Save a new memcache record newMemcacheRecord = MemcacheRecord(key=key, value=value, validThru=validThru) .. return True # or False def get_latest(self, key): #Get the memcache record with the most recent validThru datetime latestMemcacheRecord = MemcacheRecord.all().order('-validThru').get() return {'validThru':latestMemcacheRecord.validThru, 'value':latestMemcachRecord.value}

    Read the article

  • checkUnique function?

    - by Chris Leah
    Hey, so I have created a function to check the DB for unique entries, but when I call the function it doesn't seem to work and gives me a fatal error any ideas from the function or do you wish to see the sign up page calling it. Thanks :) //Check for unique entries function checkUnique($table, $field, $compared) { $query = $mysqli->query('SELECT '.$mysqli->real_escape_string($field).' FROM '.$mysqli->real_escape_string($table).' WHERE "'.$mysqli->real_escape_string($field).'" = "'.$mysqli->real_escape_string($compared).'"'); if(!$query){ return TRUE; } else { return FALSE; } } The page calling it..... if (!empty($_POST['username']) && !empty($_POST['password']) && $_POST['password']==$_POST['password_confirm'] && !empty($_POST['email']) && validateEmail($_POST['email']) == TRUE && checkUnqiue('users', 'email', $_POST['email']) == TRUE && checkUnique('users', 'username', $_POST['username']) == TRUE)

    Read the article

  • Handling national language prefix for checkconstraints

    - by Chris Chilvers
    I'm trying to create a check constraint such as CHECK Type IN (N'Create', N'Remove') for an enumeration's value. Sqlite complains about this syntax and only accepts CHECK Type IN ('Create', 'Remove'). The main database will be Sql Server 2005, but I use sqlite's in memory database for unit tests. Is there any way to get sqlite to recognise the national language (N) prefix? Alternatively, is there an easy way when using FluentNHibernate to adapt an nvarchar constant to match the database's dialect?

    Read the article

  • Why can I not view foreign language characters in my mysql DB?

    - by Chris
    I am inserting the following characters into my DB: ?? / ?? This is the meta tag on the page that is inserting the characters: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> I have altered all the columns in my table that is holding the characters to be utf8_unicode_ci The foreign characters show up like so in the DB: 汉字 / 漢字 When I use a sql statement to display those foreign characters on a page, they display correctly again as: ?? / ?? I am guessing I have some setting that is not correct in my DB, since it stores it correctly, but does not display it correctly. What can i do to make the foreign language characters to display correctly in my DB?

    Read the article

  • Delete or comment out non-working JUnit tests?

    - by Chris Knight
    I'm currently building a CI build script for a legacy application. There are sporadic JUnit tests available and I will be integrating a JUnit execution of all tests into the CI build. However, I'm wondering what to do with the 100'ish failures I'm encountering in the non-maintained JUnit tests. Do I: 1) Comment them out as they appear to have reasonable, if unmaintained, business logic in them in the hopes that someone eventually uncomments them and fixes them 2) Delete them as its unlikely that anyone will fix them and the commented out code will only be ignored or be clutter for evermore 3) Track down those who have left this mess in my hands and whack them over the heads with the printouts of the code (which due to long-method smell will be sufficently suited to the task) while preaching the benefits of a well maintained and unit tested code base

    Read the article

  • How to force asp.net MVC 2 to redirect to default controller/action

    - by Chris
    In a brand new ASP.NET MVC2 project, I want the user to be redirected to http://<mysite>/home/index rather than http://<mysite>/ We do this with our other sites for tracking purposes, to avoid the scenario where hits to the same default page show up as http://<mysite>/ http://<mysite>/default.aspx How do I accomplish this so that http://<mysite>/ automatically redirects to whatever default controller/action I have set up in my routing? Please note that I am aware the two are functionally equivalent, as the default controller action will be executed either way. I'm just interested in forcing consistent URLs in the browser.

    Read the article

  • Displaying timecode using NSTimer and NSDateFormatter

    - by Chris B
    Hi. I am very close to completing my first iphone app and it has been a joy. I am trying to add running timecode using the current time via an NSTimer displaying the current time (NSDate) on a UILabel. NSDate is working fine for me, showing hour, minute, second, milliseconds. But instead of milliseconds, I need to show 24 frames per second. The problem is that I need the frames per second to be synced 100% with the hour, minute and second, so I can't add the frames in a separate timer. I tried that and had it working but the frame timer was not running in sync with the date timer. Can anyone help me out with this? Is there a way to customize NSDateFormatter so that I can have a date timer formatted with 24 frames per second? Right now I'm limited to formatting just hours, minutes, seconds, and milliseconds. Here's the code I'm using right now -(void)runTimer { // This starts the timer which fires the displayCount method every 0.01 seconds runTimer = [NSTimer scheduledTimerWithTimeInterval: .01 target: self selector: @selector(displayCount) userInfo: nil repeats: YES]; } //This formats the timer using the current date and sets text on UILabels - (void)displayCount; { NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease]; NSDate *date = [NSDate date]; // This will produce a time that looks like "12:15:07:75" using 4 separate labels // I could also have this on just one label but for now they are separated // This sets the Hour Label and formats it in hours [formatter setDateFormat:@"HH"]; [timecodeHourLabel setText:[formatter stringFromDate:date]]; // This sets the Minute Label and formats it in minutes [formatter setDateFormat:@"mm"]; [timecodeMinuteLabel setText:[formatter stringFromDate:date]]; // This sets the Second Label and formats it in seconds [formatter setDateFormat:@"ss"]; [timecodeSecondLabel setText:[formatter stringFromDate:date]]; //This sets the Frame Label and formats it in milliseconds //I need this to be 24 frames per second [formatter setDateFormat:@"SS"]; [timecodeFrameLabel setText:[formatter stringFromDate:date]]; }

    Read the article

  • Invert regexp in vim

    - by Chris J
    There's a few "how do I invert a regexp" questions here on stackoverflow, but I can't find one for vim (if it does exist, by goggle-fu is lacking today). In essence I want to match all non-printable characters and delete them. I could write a short script, or drop to a shell and use tr or something similar to delete, but a vim solution would be dandy :-) Vim has the atom \p to match printable characters, however trying to do this :s/[^\p]//g to match the inverse failed and just left me with every 'p' in the file. I've seen the (?!xxx) sequence in other questions, and vim seems to not recognise this sequence. I've not found seen an atom for non-printable chars. In the interim, I'm going to drop to external tools, but if anyone's got any trick up their sleeve to do this, it'd be welcome :-) Ta!

    Read the article

  • Emacs persistent folding mode

    - by Chris
    There are plenty of ways to fold code in Emacs and I've settled in on using the outline minor mode... it works great! However, I really want my folding to be persisted when I close and re-open files. It is quite frustrating to have folding set up in a file the way I like it, only to have that lost when I restart Emacs. Has anyone found a way to keep the folding state of a file persistent?

    Read the article

  • Objective-c memory management

    - by Chris
    I have a method which runs this: Track* track = [[Track alloc] init:[obj objectForKey:@"PersistentID"] :[obj objectForKey:@"Name"] :[obj objectForKey:@"Artist"] :(NSInteger*)[obj objectForKey:@"Total Time"] :(NSInteger*)[obj objectForKey:@"Play Count"]]; [self setCurrentTrack:(Track*) track]; [track release]; Do I have to release track?

    Read the article

  • JDBC/OSGi and how to dynamically load drivers without explicitly stating dependencies in the bundle?

    - by Chris
    Hi, This is a biggie. I have a well-structured yet monolithic code base that has a primitive modular architecture (all modules implement interfaces yet share the same classpath). I realize the folly of this approach and the problems it represents when I go to deploy on application servers that may have different conflicting versions of my library. I'm dependent on around 30 jars right now and am mid-way though bnding them up. Now some of my modules are easy to declare the versioned dependencies of, such as my networking components. They statically reference classes within the JRE and other BNDded libraries but my JDBC related components instantiate via Class.forName(...) and can use one of any number of drivers. I am breaking everything up into OSGi bundles by service area. My core classes/interfaces. Reporting related components. Database access related components (via JDBC). etc.... I wish for my code to be able to still be used without OSGi via single jar file with all my dependencies and without OSGi at all (via JARJAR) and also to be modular via the OSGi meta-data and granular bundles with dependency information. How do I configure my bundle and my code so that it can dynamically utilize any driver on the classpath and/or within the OSGi container environment (Felix/Equinox/etc.)? Is there a run-time method to detect if I am running in an OSGi container that is compatible across containers (Felix/Equinox/etc.) ? Do I need to use a different class loading mechanism if I am in a OSGi container? Am I required to import OSGi classes into my project to be able to load an at-bundle-time-unknown JDBC driver via my database module? I also have a second method of obtaining a driver (via JNDI, which is only really applicable when running in an app server), do I need to change my JNDI access code for OSGi-aware app servers?

    Read the article

  • assembly language programming (prime number)

    - by chris
    Prompt the user for a positive three digit number, then read it. Let's call it N. Divide into N all integer values from 2 to (N/2)+1 and test to see if the division was even, in which case N is instantly shown to be non-prime. Output a message printing N and saying that it is not prime. If none of those integer values divide evenly (remainder never is zero), then N is shown to be prime. Output a message printing N and saying that it is prime. Ask the user if he or she wants to test another number; if the user types "n" or "N", quit. If "y" or "Y", jump back and repeat. Comments in your code are essential. Hi. I am kinda in rush to do this.. please help me doing it. I'll be much appreciated. thank you

    Read the article

  • Loading Files in AppEngine

    - by Chris M
    I've got a tiny bit of code to display a file in app.yaml - url: /(.*\.(gif|png|jpg)) static_files: static/\1 upload: static/(.*\.(gif|png|jpg)) in main.py ... class ShowImage(webapp.RequestHandler): def get(self): rootpath = os.path.dirname(__file__) file = rootpath + "/static/tracker.gif"; fh=open(file, 'r') self.response.out.write(fh.read()) fh.close ... I can see the files gone up by going to my *.appspot.com/tracker.gif (as per the app.yaml) But using *.appspot.com/showimage returns Traceback (most recent call last): File "/base/python_lib/versions/1/google/appengine/ext/webapp/__init__.py", line 510, in __call__ handler.get(*groups) File "/base/data/home/apps/APPNAME/2.341131266814384624/main.py", line 170, in get fh=open(file, 'r') IOError: [Errno 2] No such file or directory: '/base/data/home/apps/APPNAME/2.341131266814384624/static/tracker.gif'

    Read the article

  • Placing & deleting element(s) from a object (stack)

    - by Chris
    Hello, Initialising 2 stack objects: Stack s1 = new Stack(), s2 = new Stack(); s1 = 0 0 0 0 0 0 0 0 0 0 (array of 10 elements wich is empty to start with) top:0 const int Rows = 10; int[] Table = new int[Rows]; public void TableStack(int[] Table) { for (int i=0; i < Table.Length; i++) { } } My question is how exactly do i place a element on a stack (push) or take a element from the stack (pop) as the following: Push: s1.Push(5); // s1 = 5 0 0 0 0 0 0 0 0 0 (top:1) s1.Push(9); // s1 = 5 9 0 0 0 0 0 0 0 0 (top:2) Pop: int number = s1.Pop(); // s1 = 5 0 0 0 0 0 0 0 0 0 0 (top:1) 9 got removed Do i have to use get & set, and if so how exactly do i implent this with a array? Not really sure what to exactly use for this. Any hints highly appreciated. The program uses the following driver to test the Stack class (wich cannot be changed or modified): public void ExecuteProgram() { Console.Title = "StackDemo"; Stack s1 = new Stack(), s2 = new Stack(); ShowStack(s1, "s1"); ShowStack(s2, "s2"); Console.WriteLine(); int getal = TryPop(s1); ShowStack(s1, "s1"); TryPush(s2, 17); ShowStack(s2, "s2"); TryPush(s2, -8); ShowStack(s2, "s2"); TryPush(s2, 59); ShowStack(s2, "s2"); Console.WriteLine(); for (int i = 1; i <= 3; i++) { TryPush(s1, 2 * i); ShowStack(s1, "s1"); } Console.WriteLine(); for (int i = 1; i <= 3; i++) { TryPush(s2, i * i); ShowStack(s2, "s2"); } Console.WriteLine(); for (int i = 1; i <= 6; i++) { getal = TryPop(s2); //use number ShowStack(s2, "s2"); } }/*ExecuteProgram*/ Regards.

    Read the article

  • What emoticons can you put into class names in your language?

    - by Chris Gill
    I've just had a "discussion" with a developer about naming classes in C#. My final throw away line was, "Let's not put any emoticons in our class names." I can't think of a way you could put emoticons in C# class names, but I haven't thought too hard about it. Is this possible? Does any programming language allow it? What would be the best/worst language to be able to perform this in? Update: The Scheme answer bests answers my question. It was a quick idea after a quick discussion so I'm going to accept after a short amount of time and then move on with my life. Thanks for the responses.

    Read the article

  • Fabfile with support for sqlalchemy-migrate deployments?

    - by Chris Reid
    I have database migrations (with sqlalchemy-migrate) working well in my dev environment. However, I'm a little stumped about how to integrate this into my deployment process. I'm using fabric for deployment but having some trouble scripting the migrations part. The path to the to migrations directory in site-packages is dynamic (due to changing egg version number) and I'd rather not hard code my db password into the fabfile. Does anyone have a fabfile that plays nicely with sqlalchemy-migrate?

    Read the article

  • Converting to and from Unicode in PHP

    - by Chris
    Hey, I'm using php 5 and need to communicate with another server that runs completely in unicode. I need to convert every string to unicode before sending it over. This seems like an easy task, but I haven't been able to find a way to do it yet. Is there a simple function that returns a unicode string? i.e. convert_to_unicode("the string i'm sending")

    Read the article

< Previous Page | 81 82 83 84 85 86 87 88 89 90 91 92  | Next Page >