Search Results

Search found 2672 results on 107 pages for 'michael baldry'.

Page 63/107 | < Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >

  • Cygwin bash syntax error - but script run perfectly well in Ubuntu

    - by Michael Mao
    #!/bin/bash if test "$#" == "4"; then echo "$*"; else echo "args-error" >&2; fi; This little code snippet troubles me a lot when I tried to run it on both Ubuntu and Cygwin. Ubuntu runs bash version 4.0+ whereas Cygwin runs 3.2.49; But I reckon version collision shall not be the cause of this, this code runs well under fedora 10 which is also using bash version 3.+ So basically I am wondering if there is a way to code my script once and for all so there are not to have this awful issue later on. Many thanks in advance.

    Read the article

  • Wondering about a way to conserve memory in C# using List<> with structs

    - by Michael Ryan
    I'm not even sure how I should phrase this question. I'm passing some CustomStruct objects as parameters to a class method, and storing them in a List. What I'm wondering is if it's possible and more efficient to add multiple references to a particular instance of a CustomStruct if a equivalent instance it found. This is a dummy/example struct: public struct CustomStruct { readonly int _x; readonly int _y; readonly int _w; readonly int _h; readonly Enum _e; } Using the below method, you can pass one, two, or three CustomStruct objects as parameters. In the final method (that takes three parameters), it may be the case that the 3rd and possibly the 2nd will have the same value as the first. List<CustomStruct> _list; public void AddBackground(CustomStruct normal) { AddBackground(normal, normal, normal); } public void AddBackground(CustomStruct normal, CustomStruct hover) { AddBackground(normal, hover, hover); } public void AddBackground(CustomStruct normal, CustomStruct hover, CustomStruct active) { _list = new List<CustomStruct>(3); _list.Add(normal); _list.Add(hover); _list.Add(active); } As the method stands now, I believe it will create new instances of CustomStruct objects, and then adds a reference of each to the List. It is my understanding that if I instead check for equality between normal and hover and (if equal) insert normal again in place of hover, when the method completes, hover will lose all references and eventually be garbage collected, whereas normal will have two references in the List. The same could be done for active. That would be better, right? The CustomStruct is a ValueType, and therefore one instance would remain on the Stack, and the three List references would just point to it. The overall List size is determined not by the object Type is contains, but by its Capacity. By eliminating the "duplicate" CustomStuct objects, you allow them to be cleaned up. When the CustomStruct objects are passed to these methods, new instances are created each time. When the structs are added to the List, is another copy made? For example, if i pass just one CustomStruct, AddBackground(normal) creates a copy of the original variable, and then passes it three times to Addbackground(normal, hover, active). In this method, three copies are made of the original copy. When the three local variables are added to the List using Add(), are additional copies created inside Add(), and does that defeat the purpose of any equality checks as previously mentioned? Am I missing anything here?

    Read the article

  • Why do C compilers prepend underscores to external names?

    - by Michael Burr
    I've been working in C for so long that the fact that compilers typically add an underscore to the start of an extern is just understood... However, another SO question today got me wondering about the real reason why the underscore is added. A wikipedia article claims that a reason is: It was common practice for C compilers to prepend a leading underscore to all external scope program identifiers to avert clashes with contributions from runtime language support I think there's at least a kernel of truth to this, but also it seems to no really answer the question, since if the underscore is added to all externs it won't help much with preventing clashes. Does anyone have good information on the rationale for the leading underscore? Is the added underscore part of the reason that the Unix creat() system call doesn't end with an 'e'? I've heard that early linkers on some platforms had a limit of 6 characters for names. If that's the case, then prepending an underscore to external names would seem to be a downright crazy idea (now I only have 5 characters to play with...).

    Read the article

  • How to branch with TortoiseHG

    - by Michael Tiller
    I downloaded TortoiseHg 1.0 for evaluation. For the life of me I can't figure out how to make a branch. It seems to understand branches (e.g. in its repository browser) but I just can't seem to find a way to make a branch. This seems like such a fundamental capability since out of the often touted benefits of DVC is the lightweight branching. I Googled around and couldn't find much discussion of this topic (at least for recent versions) so I have to assume I'm missing something, right?

    Read the article

  • Cakephp how to use Set Class to make an assoc array?

    - by michael
    I have the output array from a $Model-find() query which also pulls data from a hasMany relationship: Array( [Parent] => Array ( [id] => 1 ) [Child] => Array ( [0] => Array ( [id] => aaa [score] => 3 [src] => stage6/tn~4bbb38cc-0018-49bf-96a9-11a0f67883f5.jpg [parent_id] => 1 ) [1] => Array ( [id] => bbb [score] => 5 [src] => stage0/tn~4bbb38cc-00ac-4b25-b074-11a0f67883f5.jpg [parent_id] => 1 ) [2] => Array ( [id] => ccc [score] => 2 [src] => stage4/tn~4bbb38cc-01c8-44bd-b71d-11a0f67883f5.jpg [parent_id] => 1 ) ) ) I'd like to transform this output into something like this, where the child id is the key to additional child attributes: Array( [aaa] => Array ( [score] => 3 [src] => stage6/tn~4bbb38cc-0018-49bf-96a9-11a0f67883f5.jpg ) [bbb] => Array ( [score] => 5 [src] => stage0/tn~4bbb38cc-00ac-4b25-b074-11a0f67883f5.jpg ) [ccc] => Array ( [score] => 2 [src] => stage4/tn~4bbb38cc-01c8-44bd-b71d-11a0f67883f5.jpg ) } Is there an easy way to use Set::extract, Set::combine, Set::insert, etc. to do this efficiently? I cannot figure it out.

    Read the article

  • How can I set the TextColor of a TextAppearanceSpan?

    - by michael
    Hi, I currently able to create a Medium size TextAppearanceSpan, But how can I set the text color to a specified RBG color (say #c71585)? new TextAppearanceSpan(context, android.R.style.TextAppearance_Medium); I see there is a constructor for public TextAppearanceSpan(Context context, int appearance, int colorList) { But what is the int for colorList? Is there any example for this? Thank you.

    Read the article

  • Payment Processors - What do I need to know if I want to accept credit cards on my website?

    - by Michael Pryor
    This question talks about different payment processors and what they cost, but I'm looking for the answer to what do I need to do if I want to accept credit card payments? Assume I need to store credit card numbers for customers, so that the obvious solution of relying on the credit card processor to do the heavy lifting is not available. PCI Data Security, which is apparently the standard for storing credit card info, has a bunch of general requirements, but how does one implement them? And what about the vendors, like Visa, who have their own best practices? Do I need to have keyfob access to the machine? What about physically protecting it from hackers in the building? Or even what if someone got their hands on the backup files with the sql server data files on it? What about backups? Are there other physical copies of that data around? Tip: If you get a merchant account, you should negotiate that they charge you "interchange-plus" instead of tiered pricing. With tiered pricing, they will charge you different rates based on what type of Visa/MC is used -- ie. they charge you more for cards with big rewards attached to them. Interchange plus billing means you only pay the processor what Visa/MC charges them, plus a flat fee. (Amex and Discover charge their own rates directly to merchants, so this doesn't apply to those cards. You'll find Amex rates to be in the 3% range and Discover could be as low as 1%. Visa/MC is in the 2% range). This service is supposed to do the negotiation for you (I haven't used it, this is not an ad, and I'm not affiliated with the website, but this service is greatly needed.) This blog post gives a complete rundown of handling credit cards (specifically for the UK).

    Read the article

  • jQuery Cycle plugin: One pager to control multiple slideshow on a page

    - by Michael
    Hi there, I have a cycle plugin set up on a page (images) with a pager to control the horizontal slide. My issue is that there is a transparent overlay that needs to sit over part of the images for some text relating to each image but would rather have that with a different transition effect for this so it doesn't slide in from the left. Am I able to set up to slideshows, each with 3 pieces of related content, that I can position correctly and have them controlled with the one pager? My script currently looks like this: $(function() { $('.s4').before('<div id="nav" class="nav">').cycle({ fx: 'fade', speed: 'slow', speedIn: 'slow', // speed of the 'in' transition speedOut: 'slow', timeout: 6000, pager: '#nav' }); }); I hope this makes sense, Thanks

    Read the article

  • applicationShouldTerminateAfterLastWindowClosed: does not seem to work when the red x is used to clo

    - by Michael Minerva
    I have a small OSX Cocoa app that just bring up an IKPicutreTaker and saves the picture to a file if one is set. I use applicationShouldTerminateAfterLastWindowClosed: to close the application when the pictureTaker is closed. This all works fine when I either set(this is done when you have picked the picture you want) or when you hit cancel, but when I click on the red arrow in the top left of the windows, the application does not quit when the window is closed this way. Is this intended functionality or am I doing something wrong (not setting some flag?). Also, is there some way to disable this button?

    Read the article

  • Regexing it up with IIS re-write module

    - by Michael Jasper
    I am developing a profile-based web application where each user is assigned there own url through their username & iis rewrite mod's magic. A typical user's profile url would be http://www.mymark.com/mike Each user is also created a blog in a multi-user wordpress installation. The wordpress url would look like this: http://www.mymark.com/blog/mike I am trying to use the rewrite module to create more canonical urls for the user (http://www.mymark.com/mike/blog), and have tried several regex variations that I have created through RegExr(a regex generation tool) and come up with this as the pattern to match (www.|)mymark.com/([^/]+)/blog but haven't had any success so far. What am I doing wrong here? Here is a screen shot of my re-write rule:

    Read the article

  • Use Java Annotation not to run a method

    - by Michael Mao
    Hi all: I've got a method in my class only for testing purpose : private void printOut(String msg, Object value) { System.out.println(msg + value); } It is a wrapper method for System.out.println(); So I hope, with the use of Annotation, I can choose not to run this method during productive environment while still keep those diagnostic output ready if I am to switch back to debugging environment. Which Annotation shall I put on top of the method name?

    Read the article

  • Reset UITextField's original placeholder text

    - by Michael
    I'm adding some user feedback mechanism into my app. The user types some comments into a text field and when that editing is done it updates a UITextView. Then when the user hits the submit button and moves on in the app the user may have need to send more feedback from the same form for a different item. I can reset the other fields and labels in the app to their default values when I hide the view, but not the textField (?). How can I reestablish the placeholder text next time the user accesses this view? Your suggestions are humbly appreciated.

    Read the article

  • javascript binding

    - by Michael
    MyObj = { ajax: null, init: function() { this.ajax = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(); this.ajax.onload = function() { return function() {this.onload.apply(this, [null]);} }; }, onload: function () { Reader.log("I really hope I can use `this.ajax` here"); } } isn't it correct way to bind onload to MyObj? For some reason onload never called. However if I avoid binding and just put this.ajax.onload = this.onload then onload invoked. How to get binding work?

    Read the article

  • How do I test database-related code with NUnit?

    - by Michael Haren
    I want to write unit tests with NUnit that hit the database. I'd like to have the database in a consistent state for each test. I thought transactions would allow me to "undo" each test so I searched around and found several articles from 2004-05 on the topic: http://weblogs.asp.net/rosherove/archive/2004/07/12/180189.aspx http://weblogs.asp.net/rosherove/archive/2004/10/05/238201.aspx http://davidhayden.com/blog/dave/archive/2004/07/12/365.aspx http://haacked.com/archive/2005/12/28/11377.aspx These seem to resolve around implementing a custom attribute for NUnit which builds in the ability to rollback DB operations after each test executes. That's great but... Does this functionality exists somewhere in NUnit natively? Has this technique been improved upon in the last 4 years? Is this still the best way to test database-related code? Edit: it's not that I want to test my DAL specifically, it's more that I want to test pieces of my code that interact with the database. For these tests to be "no-touch" and repeatable, it'd be awesome if I could reset the database after each one. Further, I want to ease this into an existing project that has no testing place at the moment. For that reason, I can't practically script up a database and data from scratch for each test.

    Read the article

  • Save PyML.classifiers.multi.OneAgainstRest(SVM()) object?

    - by Michael Aaron Safyan
    I'm using PYML to construct a multiclass linear support vector machine (SVM). After training the SVM, I would like to be able to save the classifier, so that on subsequent runs I can use the classifier right away without retraining. Unfortunately, the .save() function is not implemented for that classifier, and attempting to pickle it (both with standard pickle and cPickle) yield the following error message: pickle.PicklingError: Can't pickle : it's not found as __builtin__.PySwigObject Does anyone know of a way around this or of an alternative library without this problem? Thanks. Edit/Update I am now training and attempting to save the classifier with the following code: mc = multi.OneAgainstRest(SVM()); mc.train(dataset_pyml,saveSpace=False); for i, classifier in enumerate(mc.classifiers): filename=os.path.join(prefix,labels[i]+".svm"); classifier.save(filename); Notice that I am now saving with the PyML save mechanism rather than with pickling, and that I have passed "saveSpace=False" to the training function. However, I am still gettting an error: ValueError: in order to save a dataset you need to train as: s.train(data, saveSpace = False) However, I am passing saveSpace=False... so, how do I save the classifier(s)? P.S. The project I am using this in is pyimgattr, in case you would like a complete testable example... the program is run with "./pyimgattr.py train"... that will get you this error. Also, a note on version information: [michaelsafyan@codemage /Volumes/Storage/classes/cse559/pyimgattr]$ python Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) [GCC 4.2.1 (Apple Inc. build 5646)] on darwin Type "help", "copyright", "credits" or "license" for more information. import PyML print PyML.__version__ 0.7.0

    Read the article

  • NSTimer to smooth out playback position

    - by Michael
    I have an audio player and I want to show the current time of the the playback. I'm using a custom play class. The app downloads the mp3 to a file then plays from the file when 5% has been downloaded. I have a progress view update as the file plays and update a label on each call to the progress view. However, this is jerky... sometimes even going backward a digit or two. I was considering using an NSTimer to smooth things out. I would be fired every second to a method and pass the percentage played figure to the method then update the label. First, does this seem reasonable? Second, how do I pass the percentage (a float) over to the target of the timer. Right now I am putting the percent played into a dictionary but this seems less than optimal. This is what is called update the progress bar: -(void)updateAudioProgress:(Percentage)percent { audio = percent; if (!seekChanging) slider.value = percent; NSMutableDictionary *myDictionary = [[NSMutableDictionary alloc] init]; [myDictionary setValue:[NSNumber numberWithFloat:percent] forKey:@"myPercent"]; [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(myTimerMethod:) userInfo:myDictionary repeats:YES]; [myDictionary release]; } This is called first after 5 seconds but then updates each time the method is called. As always, comments and pointers appreciated.

    Read the article

  • How to add monsters to a Pokemon game?

    - by Michael J. Hardy
    My friends and I are starting a game like Pokemon and we wanted to know how will we add monsters to the game? We're using VisualBasic because my friend's brother said it would be easier. So far we can put pictures of the monsters on the screen and you can click to attack and stuff. Right now when we want to add a monster we have to make a new window. This will take us a long time to make all the windows for each type of monster. Is there a tool or something to make this go faster? How do game companies do this?

    Read the article

  • How to fit a custom graph to the boost graph library template?

    - by Michael
    I'm rusty on C++ templates and I'm using the boost graph library (a fatal combination). I've searched the web and can't find any direct instructions on how to take a custom graph structure and fit enough of it to BGL (boost graph library) that I can use boosts graph traversing algorithms. Anyone familiar enough with the library to help me out?

    Read the article

  • Expression Blend 2/WPF Book

    - by Michael Damatov
    I'm looking for an Expression Blend 2 book that includes best-practices (Expression Blend 2/Visual Studio 2008) designer perspective (Expression Blend 2) programmer perspective (interoperability with Visual Studio 2008) How-To-chapters for Windows Forms developers (how to solve the same problem with WPF) Could you make a recommendation?

    Read the article

  • Writing a Compiler for .net - IL or Bytecode?

    - by Michael Stum
    I'm currently diving into the inner workings of .net, which means IL. As an exercise, I want to build a brainf..k compiler for .net (yes, they already exist, but as said it's for learning purposes). For the moment I'm just writing some text files that contain .il and compile them with ilasm, which works. But I wonder if I could/should go one level deeper and write bytecode directly? My "concern" is the Windows PE Stuff when compiling an EXE - instead of ilasm I would need some sort of Bytecode linker that would take my MSIL/CIL bytecode and generate the PE Stuff for it? Or do compilers "only" compile their language to IL and execute ilasm? Is there a managed version of it that I can call/embed from my compiler?

    Read the article

< Previous Page | 59 60 61 62 63 64 65 66 67 68 69 70  | Next Page >