Search Results

Search found 1675 results on 67 pages for 'andrew bullock'.

Page 32/67 | < Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • Running another ruby script from a ruby script

    - by Andrew Grimm
    In ruby, is it possible to specify to call another ruby script using the same ruby interpreter as the original script is being run by? For example, if a.rb runs b.rb a couple of times, is it possible to replace system("ruby", "b.rb", "foo", "bar") with something like run_ruby("b.rb", "foo", "bar") so that if you used ruby1.9.1 a.rb on the original, ruby1.9.1 would be used on b.rb, but if you just used ruby a.rb on the original, ruby would be used on b.rb? I'd prefer not to use shebangs, as I'd like it to be able to run on different computers, some of which don't have /usr/bin/env. Edit: I didn't mean load or require and the like, but spawning new processes (so I can use multiple CPUs).

    Read the article

  • Programmer Puzzle: Encoding a chess board state throughout a game

    - by Andrew Rollings
    Not strictly a question, more of a puzzle... Over the years, I've been involved in a few technical interviews of new employees. Other than asking the standard "do you know X technology" questions, I've also tried to get a feel for how they approach problems. Typically, I'd send them the question by email the day before the interview, and expect them to come up with a solution by the following day. Often the results would be quite interesting - wrong, but interesting - and the person would still get my recommendation if they could explain why they took a particular approach. So I thought I'd throw one of my questions out there for the Stack Overflow audience. Question: What is the most space-efficient way you can think of to encode the state of a chess game (or subset thereof)? That is, given a chess board with the pieces arranged legally, encode both this initial state and all subsequent legal moves taken by the players in the game. No code required for the answer, just a description of the algorithm you would use. EDIT: As one of the posters has pointed out, I didn't consider the time interval between moves. Feel free to account for that too as an optional extra :) EDIT2: Just for additional clarification... Remember, the encoder/decoder is rule-aware. The only things that really need to be stored are the player's choices - anything else can be assumed to be known by the encoder/decoder. EDIT3: It's going to be difficult to pick a winner here :) Lots of great answers!

    Read the article

  • redoing object model construction to fit with asynchronous data fetching

    - by Andrew Patterson
    I have a modeled a set of objects that correspond with some real world concepts. TradeDrug, GenericDrug, TradePackage, DrugForm Underlying the simple object model I am trying to provide is a complex medical terminology that uses numeric codes to represent relationships and concepts, all accessible via a REST service - I am trying to hide away some of that complexity with an object wrapper. To give a concrete example I can call TradeDrug d = Searcher.FindTradeDrug("Zoloft") or TradeDrug d = new TradeDrug(34) where 34 might be the code for Zoloft. This will consult a remote server to find out some details about Zoloft. I might then call GenericDrug generic = d.EquivalentGeneric() System.Out.WriteLine(generic.ActiveIngredient().Name) in order to get back the generic drug sertraline as an object (again via a background REST call to the remote server that has all these drug details), and then perhaps find its ingredient. This model works fine and is being used in some applications that involve data processing. Recently however I wanted to do a silverlight application that used and displayed these objects. The silverlight environment only allows asynchronous REST/web service calls. I have no problems with how to make the asychhronous calls - but I am having trouble with what the design should be for my object construction. Currently the constructors for my objects do some REST calls sychronously. public TradeDrug(int code) { form = restclient.FetchForm(code) name = restclient.FetchName(code) etc.. } If I have to use async 'events' or 'actions' in order to use the Silverlight web client (I know silverlight can be forced to be a synchronous client but I am interested in asychronous approaches), does anyone have an guidance or best practice for how to structure my objects. I can pass in an action callback to the constructor public TradeDrug(int code, Action<TradeDrug> constructCompleted) { } but this then allows the user to have a TradeDrug object instance before what I want to construct is actually finished. It also doesn't support an 'event' async pattern because the object doesn't exist to add the event to until it is constructed. Extending that approach might be a factory object that itself has an asynchronous interface to objects factory.GetTradeDrugAsync(code, completedaction) or with a GetTradeDrugCompleted event? Does anyone have any recommendations?

    Read the article

  • MGTwitterEngine - Using getImageAtURL on iPhone

    - by Andrew Malchow
    Essentially, I'm working on asynchronously downloading images and adding them to specific UITableView cells (twitter profile images using MGTwitterEngine from Matt Gemmell). I've looked at general asynchronous download code and must admit, I'm still too much of a noob to understand it well enough to adapt it to my purposes. Instead, I'm attempting to use Gemmell's included getImageAtUrl method to add the images. I have it working to the point that -imageReceived: receives the images for visible cells, however, I'm stuck as to how to include them into the appropriate cells at that point. - (void)imageReceived:(UIImage *)image forRequest:(NSString *)identifier { NSLog(@"Got an image:%@",image); // What goes here? Or elsewhere? } This method is within my main view controller, I also have a custom cell controller where I'm drawing the cell content using Loren Brichter's fast scrolling code. Any help with this MGTwitterEngine method in particular, or with dynamically adding these images to my table cells would be greatly appreciated.

    Read the article

  • Embedded Vimeo Video Callbacks

    - by Andrew
    This post is kind of a follow up to a post I made earlier in regards to HTML5 video callbacks. In that thread, I was given a great piece of code that would allow for the browser to be informed of when the video stops playing and then fire off an action (with jQuery). This is the code I'm currently using: $('video.normal').bind('ended', function(){ $(this).fadeOut().queue(function(){ $(this).siblings('.post-video').fadeIn(); $(this).dequeue(); }); }); Which basically fades the video out when it's completed and brings a poster frame of the video (or similar image) back into view. Well, the scope of the project has changed and now the client is asking for true full screen video and different size videos to be delivered based on user connection speed, something that's a little over my head and a lot over budget. So I've been researching and a Vimeo Plus player seems like a great alternative for visitors using a desktop browser (HD embeds, true full screen, and more). Thing is, I need that above code to continue working in some capacity or another, so does the embedded Vimeo player offer a similar callback that I can utilize? Or am I SOL here? Thanks in advance!

    Read the article

  • php get, random records, and the back button

    - by Andrew Heath
    My site has a library full of games, nations, game scenarios, etc. library.php is given a type=___ & id=___ for example library.php?type=scenario&id=ABCD001 library.php saves the id to a session variable and loads an include appropriate for the type This all works just dandy. Now, I wanted to give my users the option of pulling up a random scenario. To do that, I added a special id to the logic within lib-scenario.php (the include) such that if given library.php?type=scenario&id=random the include knows to run an alternate query for a random record rather than for the actual id This also works just dandy... unless someone hits the Random Scenario button two+ times in a row, and decides that the previous random scenario was way cooler, I want to go back to that. Because the http address is always directory/library.php?type=scenario&id=random no matter how many times you click Random Scenario, as soon as you click back you'll be taken to the last page with an alternate address you visited. So, if you start at the Home page, and hit Random Scenario 35 times, then decide the 34th one was what you wanted and click BACK, you'll be put back onto the Home page. I must admit this was not a problem I had anticipated. One of my testers was the first to have the urge to back-up in the random scenario stream and here we are. How can I add back-up functionality to my script?

    Read the article

  • Shipping Java code with data baked into the .jar

    - by Andrew
    I need to ship some Java code that has an associated set of data. It's a simulator for a device, and I want to be able to include all of the data used for the simulated records in the one .JAR file. In this case, each simulated record contains four fields (calling party, called party, start of call, call duration). What's the best way to do that? I've gone down the path of generating the data as Java statements, but IntelliJ doesn't seem particularly happy dealing with a 100,000 line Java source file! Is there a smarter way to do this? In the C#/.NET world I'd create the data as a separate file, embed it in the assembly as a resource, and then use reflection to pull that out at runtime and access it. I'm unsure of what the appropriate analogy is in the Java world. FWIW, Java 1.6, shipping for Solaris.

    Read the article

  • Are there any radix/patricia/critbit trees for Python?

    - by Andrew Dalke
    I have about 10,000 words used as a set of inverted indices to about 500,000 documents. Both are normalized so the index is a mapping of integers (word id) to a set of integers (ids of documents which contain the word). My prototype uses Python's set as the obvious data type. When I do a search for a document I find the list of N search words and their corresponding N sets. I want to return the set of documents in the intersection of those N sets. Python's "intersect" method is implemented as a pairwise reduction. I think I can do better with a parallel search of sorted sets, so long as the library offers a fast way to get the next entry after i. I've been looking for something like that for some time. Years ago I wrote PyJudy but I no longer maintain it and I know how much work it would take to get it to a stage where I'm comfortable with it again. I would rather use someone else's well-tested code, and I would like one which supports fast serialization/deserialization. I can't find any, or at least not any with Python bindings. There is avltree which does what I want, but since even the pair-wise set merge take longer than I want, I suspect I want to have all my operations done in C/C++. Do you know of any radix/patricia/critbit tree libraries written as C/C++ extensions for Python? Failing that, what is the most appropriate library which I should wrap? The Judy Array site hasn't been updated in 6 years, with 1.0.5 released in May 2007. (Although it does build cleanly so perhaps It Just Works.)

    Read the article

  • Find an asp:Button in VB.NET

    - by Andrew
    I'm trying to code a section for my website in VB but VB can't seem to find a button. Is there a way for the code to find it? I know where it is. Loginview Login LoginTemplate. How do I get VB.NET to point to that location?

    Read the article

  • Multicolor text in TreeView (Embarcadero RAD studio)

    - by Andrew
    Hello everyone, I am writing a piece of software in C++ RAD studio 2010 and got a question about TreeView. Is it possible to use multicolor text in a TTreeView component? I could not find a easy way but to implement custom drawing which seems to be weird nowadays. Are there any straight-forward ways or maybe additional components that can do it for me?

    Read the article

  • How to get NSFormatter subclass to work with NSTableColumn sort key and selector?

    - by Andrew
    My setup: I have a sqlite database from which I populate a NSMutableArray of NSDictionary objects this is the DataSource for my NSTableView. One of the columns holds "time", the time is a float that holds seconds. I would like to display the values in this column as minutes:seconds. For instance my data would be 123.4329387 I want to display 2:03 which I have no problem doing with a subclass of NSFormatter (or NSNumberFormatter) applied to my NSTextField in the column. I have sorting set up by using the Table Column Attributes in IB, I just have the sort key set to "time" and the selector set to "compare:" which works fine without the formatter. Currently this gives me something like this when I sort (descending) 1:37, 1:31, 0:10, 0:10, 0:09, 1:30, 1:30, 1:26, 0:09 and similar nonsense, it looks like something is going on but it's definitely not sorted. How do I get the sort to look at the underlying data instead of the formatted value? Alternately, how do I specify a custom sort method and where do I put the code for said method? I have searched around quite a bit and have not found anything to help me out with this problem, any help with this is most appreciated.

    Read the article

  • Drupal adding JS

    - by Andrew
    I know this is not a Drupal forum but this forum is quick at responding so I thought I should give it a shot. Here's my problem. I'm trying to insert reference to the javascript file in the header by using drupal_add_js function. I placed this line inside template preprocess function of template.php. The result....is not working at all. There is no script link in output as it should be. Can anyone tell me what am I doing wrong? Drupal Version - 6x function phptemplate_preprocess_page(&$vars) { $url = drupal_get_path("theme","mysite"); drupal_add_js($url."/jquery.js"); drupal_add_js($url."/drupal.js"); .....

    Read the article

  • maximum execution time for javascript

    - by Andrew Chang
    I know both ie and firefox have limits for javascript execution here: hxxp://support.microsoft.com/?kbid=175500 Based on number of statements executed, I heard it was 5 million somewhere in ie hxxp://webcache.googleusercontent.com/search?q=cache:_iKHhdfpN-MJ:kb.mozillazine.org/Dom.max_script_run_time+dom.max_script_run_time&hl=en&gl=ca&strip=1 (google cache since site takes forever to load for me) based on number of seconds in firefox, it's 10 seconds by default for my version The thing I don't get is what cases will go over these limits: I'm sure a giant loop will go over the limit for execution time But will an event hander go over the limit, if itself it's execution time is under the limit but if it occurs multiple times? Example: Lets say I have a timer on my page, that executes some javascript every 20 seconds. The execution time for the timer handler is 1 second. Does firefox and ie treat each call of the timer function seperatly, so it never goes over the limit, or is it that firefox/ie adds up the time of each call so after the handler finishes, so after 200 seconds on my site (with the timer called 10 times) an error occurs even though the timer handler itself is only 1 second long?

    Read the article

  • LINQ/C#: Where & Foreach using index in a list/array

    - by Andrew White
    Hi, I have a list/array and need to process certain elements, but also need the index of the element in the processing. Example: List Names = john, mary, john, bob, simon Names.Where(s = s != "mary").Foreach(MyObject.setInfo(s.index, "blah") But cannot use the "index" property with lists, inversely if the names were in an Array I cannot use Foreach... Any suggestions?

    Read the article

  • Linux tail only whole words

    - by Andrew
    Hello, I need to print last 20 characters of string, but only whole words. Delimiter is a space "". Let's consider this example: string="The quick brown fox jumps over the lazy dog" echo $string | tail -c20 returns s over the lazy dog. And I need it to return over the lazy dog instead. Do you know how to accomplish that? Thanks!

    Read the article

  • Better way to write this regex to match multi-ordered property list?

    - by Andrew Philips
    I've been whacking on this regex for a while, trying to build something that can pick out multiple ordered property values (DTSTART, DTEND, SUMMARY) from an .ics file. I have other options (like reading one line at a time and scanning), but wanted to build a single regex that can handle the whole thing. SAMPLE PERL # There has got to be a better way... my $x1 = '(?:^DTSTART[^\:]*:(?<dts>.*?)$)'; my $x2 = '(?:^DTEND[^\:]*:(?<dte>.*?)$)'; my $x3 = '(?:^SUMMARY[^\:]*:(?<dtn>.*?)$)'; my $fmt = "$x1.*$x2.*$x3|$x1.*$x3.*$x2|$x2.*$x1.*$x3|$x2.*$x3.*$x1|$x3.*$x1.*$x2|$x3.*$x2.*$x1"; if ($evts[1] =~ /$fmt/smo) { printf "lines:\n==>\n%s\n==>\n%s\n==>\n%s\n", $+{dts}, $+{dte}, $+{dtn}; } else { print "Failed.\n"; } SAMPLE DATA BEGIN:VEVENT UID:0A5ECBC3-CAFB-4CCE-91E3-247DF6C6652A TRANSP:OPAQUE SUMMARY:Gandalf_flinger1 DTEND:20071127T170005 DTSTART,lang=en_us:20071127T103000 DTSTAMP:20100325T003424Z X-APPLE-EWS-BUSYSTATUS:BUSY SEQUENCE:0 END:VEVENT SAMPLE OUTPUT lines: == 20071127T103000 == 20071127T170005 == Gandalf_flinger1

    Read the article

  • WinForms form freezes

    - by andrew
    On a form (F1) i have a button, from which if i create another form (lets call it F2) and show it there's no problem but i'd like to do something like this Some thread in my app is running a connection and listens for messages from a server. when a message arrives, my main form is registered to get an event that runs a function. From that function i'm trying to create and show the F2 type form (empty, nothing modified in it): it shows it but then it freezes my application. more exactly: public partial class Form1 : Form { public Form1() { InitializeComponent(); ConnectionManagerThread.getResponseListener().MessageReceived += Form1_OnMessageReceived; } private void Form1_OnMessageReceived(object sender, MessageEventArgs e) { Form2 f2 = new Form2(); f2.Show(); } }

    Read the article

  • passing argument 1 from incompatible pointer type

    - by Andrew
    Why does this code...: NSDictionary *testDictionary = [NSDictionary dictionaryWithObjectsAndKeys:kABOtherLabel, @"other", kABWorkLabel, @"work", nil]; throw this warning: warning: passing argument 1 of 'dictionaryWithObjectsAndKeys' from incompatible pointer type Incidentally, the code works as expected, but I don't like leaving warnings un-delt-with. I assume it doesn't like that I'm storing a constant in a dictionary. Well, where can I store it then? Should I just place (void *) before every constant?

    Read the article

  • Using Active Objects and BLOBs

    - by Andrew L.
    I am in a group of people who are creating a Defect Tracking program as a project. We have been using Active Objects and have run into some issues. Currently maximum file size for the blob is approx. 2Mb but we want to be able to increase it up to 2Gb. We currently have been looking at many sites and have not been able to find out how to increase the size. We are currently storing the blob as an array of bytes. Our current error says, Packet for Query is too large? We don't know how to set the variable, and we don't know how to set it using AO. We are programming this in Java, too. We are wondering if anyone has a solution to this problem. Thanks for the Help.

    Read the article

  • Problem with cruise control and visual svn

    - by Andrew
    Hi Wonder if anyone can help, I am experiencing a strange issue with my configuration of cruisecontrol.net and visual svn. I am setting the current ccnet.config <sourcecontrol type="svn"> <trunkUrl>https://bladerunner.azullo.local:8443/svn/application/trunk</trunkUrl> <executable>C:\Program Files (x86)\VisualSVN Server\bin\svn.exe</executable> <username>test</username> <password>test</password> <workingDirectory>D:\Development\Build\application\</workingDirectory> </sourcecontrol> <publishers> <xmllogger/> </publishers> <modificationDelaySeconds>10</modificationDelaySeconds> </project> When I run this I expect it to go to https://bladerunner.azullo.local:8443/svn/application/trunk, however i get the following ThoughtWorks.CruiseControl.Core.CruiseControlException: Source control operation failed: svn: OPTIONS of 'http://bladerunner.azullo.local:8080/svn/application/trunk': could not connect to server (http://bladerunner.azullo.local:8080) . Process command: C:\Program Files (x86)\VisualSVN Server\bin\svn.exe update D:\Development\build\application\ --username test --password ** --no-auth-cache --non-interactive at ThoughtWorks.CruiseControl.Core.Sourcecontrol.ProcessSourceControl.Execute(ProcessInfo processInfo) at ThoughtWorks.CruiseControl.Core.Sourcecontrol.Svn.UpdateSource(IIntegrationResult result) at ThoughtWorks.CruiseControl.Core.IntegrationRunner.Build(IIntegrationResult result) at ThoughtWorks.CruiseControl.Core.IntegrationRunner.Integrate(IntegrationRequest request) So for some reason it goes to 'http://bladerunner.azullo.local:8080/svn/application/trunk' If I remove the username and password elements in the ccnet.config. It goes to the correct url. I dont understand this behaviour. I have configured visual svn with a certificate using Active directory Certificate Services, if this was the problem I would expect it to show an error regarding the certificate instead of changing the url. I have cleared our state etc Any Ideas

    Read the article

  • batch file to merge .js files from subfolders into one combined file

    - by Andrew Johns
    I'm struggling to get this to work. Plenty of examples on the web, but they all do something just slightly different to what I'm aiming to do, and every time I think I can solve it, I get hit by an error that means nothing to me. After giving up on the JSLint.VS plugin, I'm attempting to create a batch file that I can call from a Visual Studio build event, or perhaps from cruise control, which will generate JSLint warnings for a project. The final goal is to get a combined js file that I can pass to jslint, using: cscript jslint.js < tmp.js which would validate that my scripts are ready to be combined into one file for use in a js minifier, or output a bunch of errors using standard output. but the js files that would make up tmp.js are likely to be in multiple subfolders in the project, e.g: D:\_projects\trunk\web\projectname\js\somefile.debug.js D:\_projects\trunk\web\projectname\js\jquery\plugins\jquery.plugin.js The ideal solution would be to be able to call a batch file along the lines of: jslint.bat %ProjectPath% and this would then combine all the js files within the project into one temp js file. This way I would have flexibility in which project was being passed to the batch file. I've been trying to make this work with copy, xcopy, type, and echo, and using a for do loop, with dir /s etc, to make it do what I want, but whatever I try I get an error.

    Read the article

  • When to use CouchDB vs RDBMS

    - by Andrew Whitehouse
    I am looking at CouchDB, which has a number of appealing features over relational databases including: intuitive REST/HTTP interface easy replication data stored as documents, rather than normalised tables I appreciate that this is not a mature product so should be adopted with caution, but am wondering whether it is actually a viable replacement for an RDBMS (in spite of the intro page saying otherwise - http://couchdb.apache.org/docs/intro.html). Under what circumstances would CouchDB be a better choice of database than an RDBMS (e.g. MySQL), e.g. in terms of scalability, design + development time, reliability and maintenance. Are there still cases where an RDBMS is still clearly the right choice? Is this an either-or choice, or is a hybrid solution more likely to emerge as best practice?

    Read the article

  • Ruby Enterprise fails to compile with GCC 4.5

    - by Andrew
    Ruby Enterprise Edition fails to compile from sources with GCC 4.5, but sucessfully compiles with 4.3.3. Actually, not sure if it's about GCC, but, in fact, i686 Arch linux system with laest updates won't compile RE. Compilation fails with the message: mkdir -p .ext/common make PRELIBS='-Wl,-rpath,/opt/ruby-enterprise-1.8.7-2010.01/lib -L/opt/ruby-enterprise-1.8.7-2010.01/lib -ltcmalloc_minimal ' ./lib/fileutils.rb:1215: [BUG] Segmentation fault ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2010.01 make: *** [.rbconfig.time] Aborted Are there any solutions excepting GCC downgrade?

    Read the article

  • Help with SSh Tunnel [closed]

    - by Andrew Johnson
    I am running a Django instance locally and doing some Facebook development. So, I set up a port on a remote machine to forward to my local machine, so that Facebook can hit the web server, and have the requests forwarded to my local machine. Unfortunately, I'm getting the following error in my browser when I try and access the page: http://dev.thegreathive.com/ Any idea what I'm doing wrong? I think the problem is on my local machine, since if I kill the SSH tunnel, the error message changes.

    Read the article

< Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >