Daily Archives

Articles indexed Monday June 18 2012

Page 3/16 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • What web technology could I use which would support a decision tree?

    - by Rami Alhamad
    I am a big game development fan but I haven't done any commercial work in the past. I have been asked by a non-profit to look at developing a game similar to the award-winning www.playspent.org They want the following features: support 5 scenarios mobile isn't important but compatibility with older browsers would be a big bonus they want it to be visual and audible bonus is to have it easily modifiable support 4 languages I don't have much knowledge of Flash and would rather avoid using it as a solution. I started breaking down the problem into segments that I will need to examine, they are as follows: ability to read the game flow from a file that they can produce (xml, etc.) db design to store decision tree language challenge browser compatibility I am leaning towards an Google app engine/GWT solution but I am not sure what technology is best for this. I am really hoping to get your opinion/recommendation on my approach and on what technology is best. A special thanks (and beer if you live in Toronto) will be awarded to anyone who can help give me a ballpark estimate on how much such a game should go for. I know it's tough to estimate but any rough figure will help (how much would you charge for building something like playspent.org?) Thanks in advance

    Read the article

  • How can I keep track of a battle log on a web game?

    - by Jay W
    Recently I started working on a Web turn-based PvP RPG game. Now I'm working on the battle system but I encountered some issues: How can I keep track of everything that happens in the battle? It should keep track of the characters on the field, inventory, the damage done etc. I first thought I would simply put it in the (MySQL) database, but I think it will be too much. Especially if several people are in a battle. I thought of puting this in sessions or cookies but I don't think thats reliable. Does anyone have an idea how I can do this?

    Read the article

  • Spree customize/extend user roles and permissions

    - by swapnil
    I am trying to specify some custom roles in Spree for example role 'client' and extend the permissions to access the admin section for this role. This user will be able to access only those Product created by that user. Concept is letting a user with role 'client' manage only products and other certain Models. To start with I added CanCan plugin and defined a RoleAbility Class in role_ability.rb Just following this post : Spree Custom Roles Permissions class RoleAbility include CanCan::Ability def initialize(user) user ||= User.new if user.has_role? 'admin' can :manage, :all elsif user.has_role? 'client_admin' can :read, Product can :admin, Product end end end Added this to an initializer : config/initializers/spree.rb Ability.register_ability(RetailerAbility) Also extended admin_products_controller_decorator.rb :app/controllersadmin_products_controller_decorator.rb Admin::ProductsController.class_eval do def authorize_admin authorize! :admin, Product authorize! params[:action].to_sym, Product end end But I am getting flash message 'Authorisation Failure' Trying to find some luck, I referred following links A github gist for Customizing Spree Roles : https://gist.github.com/1277326 Here's a similar issue what I am facing : http://groups.google.com/group/spree-user/browse_thread/thread/1e819e10410d03c5/23b269e09c7ed47e All efforts in vain... Any pointers of what is going on here highly appreciated ? Thanks in advance.

    Read the article

  • NHibernate Overcoming NotSupportedException

    - by Jordan Wallwork
    Does anyone know of any way to overcome NotSupportedException? I have a method against a User: public virtual bool IsAbove(User otherUser) { return HeirarchyString.StartsWith(otherUser.HeirarchyString); } And I want to do: _session.Query<User>.Where(x => loggedInUser.IsAbove(x)); But this throws a NotSupportedException. The real pain though is that using _session.Query<User>.Where(x => loggedInUser.HeirarchyString.StartsWith(x.HeirarchyString)); works absolutely fine. I don't like this as a solution, however, because it means that if I change how the IsAbove method works, I have to remember all the places where I have duplicated the code whenever I want to update it

    Read the article

  • Why do browsers encode special characters differently with ajax requests?

    - by Andrei Oniga
    I have a web application that reads the values of a few input fields (alphanumeric) and constructs a very simple xml that is passes to the server, using jQuery's $.ajax() method. The template for that xml is: <request> <session>[some-string]</session> <space>[some-string]</space> <plot>[some-string]</plot> ... </request> Sending such requests to the server when the inputs contain Finnish diacritical characters (such as ä or ö) raises a problem in terms of character encoding with different browsers. For instance, if I add the word Käyttötarkoitus" in one of the inputs, here's how Chrome and Firefox send EXACTLY the same request to the server: Chrome: <request> <session>{string-hidden}</session> <space>2080874</space> <plot>Käyttötarkoitus</plot> ... </request> FF 12.0: <request> <session>{string-hidden}</session> <space>2080874</space> <plot>Käyttötarkoitus</plot> ... </request> And here is the code fragment that I use to send the requests: $.ajax({ type: "POST", url: url, dataType: 'xml;charset=UTF-8', data: xml, success: function(xml) { // }, error: function(jqXHR, textStatus, errorThrown) { // } }); Why do I get different encodings and how do I get rid of this difference? I need to fix this problem because it's causing other on the server-side.

    Read the article

  • Detecting that the stack is full in C/C++

    - by Martin Kristiansen
    When writing C++ code I've learned that using the stack to store memory is a good idea. But recently I ran into a problem: I had an experiment that had code that looked like this: void fun(unsigned int N) { float data_1[N*N]; float data_2[N*N]; /* Do magic */ } The code exploted with a seqmentation fault at random, and I had no idea why. It turned out that problem was that I was trying to store things that were to big on my stack, is there a way of detecting this? Or at least detecting that it has gone wrong?

    Read the article

  • Vim and clang_complete, how to explicitly compile my code

    - by puller
    I use Vim with clang_complete for omnicompletion. The plugin is automatically triggered when I need completion, e.g., after I type . or -> to access an object members or methods (see attached screenshot). The plugin works really nice, however I would need a way to trigger it manually (i.e. to compile my code for syntax checking). This is useful for two reasons: Static syntax checking Clear previous errors which have been fixed (which otherwise will remain in their buffer). See the two screenshots below for a better understanding. Any help is appreciated. Thanks. Screenshot 1 Screenshot 2

    Read the article

  • python: How to refer to specific item within a list of lists?

    - by user964689
    Python beginner here, I have a list of lists and want to refer to a specific part of that list. For example lol = [[1, 2, 4], [6, 7, 8], [9, 10, 14]] If I just want to print the first item in one of the lists, eg the 1, 6 or 9, how would I do that? I can only find ways to refer to each of the lists seperately eg lol[0] but not to then refer to an item within that list. Thank you in advance for your help! Cheers

    Read the article

  • IRC Server configuration possibilities

    - by Katai
    I need to know a couple of things, concerning IRC servers that I couldnt directly find out over google (or werent clear enough for me to be sure if it actually works) I'm working at a larger community site, and wanted to deliver an in-page chat. Since it would be a nice feature to let people access it from outside too, over their own clients, I tought implementing an IRC Server would be the best solution (probably dedicated, I'll have to teach myself a couple of things for that) I plan to include a Web-based IRC client over an APE Client / Server. The problem is, I want to strip down the user rights, to disallow many functionalities that IRC would offer: Change of nicknames: The user logs in over the Page login, and I'll automatically create an IRC auth for this user with that password. So basically, he would connect to the IRC client over a button. And after connecting, he shouldnt be able to change his nickname at all Creating channels: I want the possibility to create channels, but not from 'normal' users. Basically, I would prefer to set up basic channels that are public, and if a user really creates an own channel, that one should be private and via invitation (is that possible?) Private conversations: private conversations should be filtered out from the allaround IRC client, into separate 'in-browser-windows' that I create over JS. I guess I just have to filter the stuff coming from IRC - or is there a better solution to that? Only 'registered' users have access: Like I said, if someone registers on the page, I would like to create an IRC 'account' for him. Users that arent registered on the page, cant access the IRC server at all (or get thrown out). Mainly to avoid spammers or bots from outside. Is this stuff solvable over IRC? I've read some FAQ's and Instructions for IRC OP's and servers, but I couldnt find a clear answer - it seems that everyone can do pretty much everything - I would like to configure it in a way that user possibilities are more cut down. Basically, giving users the possibility to chat, but not more. So the Question basically is, how possible / solvable this issues are allaround, or if I have to find other solutions for this.

    Read the article

  • How to pass content in response from Exception filter in Asp.net WebAPI?

    - by jaffa
    Consider following code: My problem is: 1) I can't seem to cast the errors to HttpContent 2) I can't use the CreateContent extension method as this doesn't exist on the context.Response.Content.CreateContent public class ServiceLayerExceptionFilter : ExceptionFilterAttribute { public override void OnException(HttpActionExecutedContext context) { if (context.Response == null) { var exception = context.Exception as ModelValidationException; if ( exception != null ) { var modelState = new ModelStateDictionary(); modelState.AddModelError(exception.Key, exception.Description); var errors = modelState.SelectMany(x => x.Value.Errors).Select(x => x.ErrorMessage); // Cannot cast errors to HttpContent?? // var resp = new HttpResponseMessage(HttpStatusCode.BadRequest) {Content = errors}; // throw new HttpResponseException(resp); // Cannot create response from extension method?? //context.Response.Content.CreateContent } else { context.Response = new HttpResponseMessage(context.Exception.ConvertToHttpStatus()); } } base.OnException(context); } }

    Read the article

  • Same address, multiple shared_ptr counters, is it forbidden by C++ standard?

    - by icando
    Suppose I have some needs to do the following (This is just some imaginative code for discussion of the C++ standard, thus I won't discuss why I design it this way, so don't bother me something like: your design is wrong.) T* ptr = new T; shared_ptr<T> p(ptr); shared_ptr<T> q(ptr, SomeDeleterThatDoesnotDeleteButDoSomeOtherStuff()); Suppose the logic guarantees that p or some of its copies lives longer than any copies of q, so practically there won't be any problem. My question is, is it forbidden by C++ standard, e.g. explicitly stated as UB by C++ standard, that different shared_ptr counters share the same address? Thanks.

    Read the article

  • using same ids for many tags?

    - by gaurav rathor
    here is the example code that i was testing and i got confused that every one says that we can use or we should use only one time per id but i have testes using using it multiple times but its giving me the correct output. so what should i do. it is kinda working same like class for me in this example code: <html> <head> <style> #exampleID1 { background-color: blue; } #exampleID2 { text-transform: uppercase; } </style> </head> <body> <p id="exampleID1">This paragraph has an ID name of "exampleID1" and has a blue CSS defined background.</p> <p id="exampleID2">This paragraph has an ID name of "exampleID2" and has had its text transformed to uppercase letters.</p> <address id="exampleID1"> Written by W3Schools.com<br /> <a href="mailto:[email protected]">Email us</a><br /> Address: Box 564, Disneyland<br /> Phone: +12 34 56 78 </address> <blockquote id="exampleID1"> Here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation. </blockquote> </body> </html> please see the above code and answer me that why we should not use id selector two times in a page while its working fine.

    Read the article

  • Php inside javascript function

    - by jasminder
    What i am trying to do is inside script tags run javascript inside the php loops. For example: <script> $('#mydiv').mouseover(function(){ time(); function time(){ <?php $secs = 45; $secs--; if($secs <= 25){ ?>//javascript code here } }); </script> My main purpose is when the user mouseover a div, a javascript function runs and inside that javascript function there is php if conitions. If the time is less then 25 then do a specified javascript code. then another condition if the time is less that 10 then do another javascript function.Any type of help will be appreciated. THanks

    Read the article

  • How do I build (get/download) time.h library?

    - by coffeenet
    I am trying to build a project on Linux via Makefile. I keep getting cannot find <sys/time.h> error. I asked around, and I was told that my project doesn't have access to library folders. Therefore, I am trying to solve this problem by using the time library locally inside my project's folder. I am very new to Linux. So, please forgive my question if it sounds naive. I found this, but I don't know what files I need, and how to build the library. http://sourceware.org/git/?p=glibc.git;a=tree;f=time;h=c950c5d4dd90541e8f3c7e1649fcde4aead989bb;hb=master Where can I find the time.h library/package? How do I build the library?

    Read the article

  • FJSTransitionController setup and use in View Controller not main app delegate

    - by elliotrock
    I am trying to set up Corey Floyd's FJSTransitionController. My app uses a main view controller to manage the main view navigation. I also went through the source to fix it for ARC. Followed instructions and in my main delegate .h I have in the usual spots: FJTransitionController* mainTransitionController; @property (nonatomic,retain) FJTransitionController* mainTransitionController; delegate .m has the following @synthesize mainTransitionController And in the - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions mainTransitionController=[[FJTransitionController alloc] init]; // do I need to instantise? [self.window addSubview:mainTransitionController.view]; [mainTransitionController setViewControllerClass:[[mainViewController sendMissionsPanelViewController] class] forKey:@"missionView"]; The last line is complaining that there is no @interface for FJTransitionController? Any help please.

    Read the article

  • SVN: authz directory identifiers not support

    - by ledy
    Without using the authz, all the svn users can login and use the repos without issues. However, I would like to limit the access to some directories - not to be readable or writeable for all users. svnserve --version = 1.6.6 I tried both, granting access to users and groups. I also tried it separate, only group or only user access. [groups] admingroup=i_can_access_anything limitedgroup=i_am_limited [/] #*= @admingroup=rw i_can_access_anything=rw [projectX] #i also tried [repository:/projectX] #*= @limitedgroup=rw i_am_limited=rw Trying to access the / or /projectX at the svn fails. = access denied Without the authz, it works properly, but also grants access to other projects that do not belong to the "limited" user group :-/ Do you see what's wrong there? Thx

    Read the article

  • Facebook og:url ignored in favour of a Facebook hosted page about the og entity

    - by Dan
    I am trying to implement the Like button on my pages. Those pages represent the review page for a product. When a user Likes the page, it shows up in Facebook (not as a link, but as liking an entity), however when you click on the entity in Facebook it links through to a facebook.com hosted page representing the page. I want the user to be redirected to the og:url page? This happens for example when you Like an artist page on Grroveshar: http://grooveshark.com/#!/artist/Elbow/4795 I am clearly "doing it wrong". I am using the following markup to include the SDK. MYAPPID is included by the code generator Facebook provides so I assume it is required. <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/all.js#xfbml=1&appId=MYAPPID"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> Then my code to render the Like button. <div class="fb-like" data-send="false" data-width="450" data-show-faces="true"></div> And finally my og tags: <meta property="og:title" content="My product" /> <meta property="og:type" content="product" /> <meta property="og:url" content="http://site.com/product_1/" /> <meta property="og:image" content="http://site.com/image1.jpg" /> <meta property="og:site_name" content="My-Site-Name.com" /> <meta property="fb:admins" content="MYFACEBOOKID" /> <meta property="fb:app_id" content="MYAPPID" /> Thanks!

    Read the article

  • Finding matching submatrics inside a matrix

    - by DaveO
    I have a 100x200 2D array expressed as a numpy array consisting of black (0) and white (255) cells. It is a bitmap file. I then have 2D shapes (it's easiest to think of them as letters) that are also 2D black and white cells. I know I can naively iterate through the matrix but this is going to be a 'hot' portion of my code so speed is an concern. Is there a fast way to perform this in numpy/scipy? I looked briefly at Scipy's correlate function. I am not interested in 'fuzzy matches', only exact matches. I also looked at some academic papers but they are above my head.

    Read the article

  • Can anyone explain why this behaviour might be happening in Windows Forms?

    - by gizgok
    I'm developing a Windows Forms Application. See attached image for the Interface. Now I've put a close button (X) in the Panel(say Panel2) which has Application Constants as label.The first combo box is in another panel(say Panel1). Now when I click on the X button in Panel 2 I want the Panel to be invisible and the combo box text to be blank. Simple enough. So I write Panel2.visible=false; comboBox1.SelectedIndex=-1; When I click on X, the text in combo box goes blank, then I have to click again for the Panel2 to go invisible. Then I changed the sequence comboBox1.SelectedIndex=-1; Panel2.visible=fasle; and this works smooth. Not sure why this might be happening? Is there anything that I might be doing with my form design/code to have such a behaviour?

    Read the article

  • Unique number identifier generation

    - by xwrs
    I have to create logic for generation unique number identifier for records in database. id, generated in database is a separate column. At this moment, when user calls "create record" action, I save new record, get its database id, generate record number using this id, then put it to the edit form. Using this way means that all entity fields should be nullable to save record to database. I don't like this way. I know that should be better way. Is there a better practice to generate unique number identifier? What is possibility of generating non-unique random numbers? Thank you

    Read the article

  • Symfony 2 - UrlGenerator::doGenerate is called before listener

    - by guyaloni
    I want to add to the context a parameter, so when login is called I can use it in the route (similar to _locale). I can add this piece of code in HttpUtils.php (as resetLocale), but i don't find it very clean. The reason I need it is the firewall redirection to the login controller, which I would like to have in its route a customized parameter. My problem is that my listener is called after UrlGenerator::doGenerate is called, so I get a MissingMandatoryParametersException. Here is my config.yml relevant code: services: mycompany.demobundle.listener.request: class: MyCompany\DemoBundle\RequestListener arguments: [@router, @security.context] tags: - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest } Any idea???

    Read the article

  • Tutorial needed to learn Microsoft BI

    - by Zerotoinfinite
    I am a .NET developer and have a little experience in Sql Server. As we all know that .NET developer mostly deals with stored procedures in Sql Server. I am willing to learn BI (SSIS,SSRS,SSAS) from home. I have seen some article but I don't think that's going to work for me. I am seeking some Free video tutorials I can get to learn BI. Imp: I am asking this question here because I believe that many of you are genius BI and .NET developers so you guys can help me figure out which tutorial will take benift from my .net skills. Apologize : I used free in my question. I am guilt to say that I am one of the guy who is not willing to invest but the reason is this that currently I am Jobless. :-(

    Read the article

  • Cannot connect Nexus One Phone to Android adb

    - by appbee
    I am running Android SDK 2.2 and am trying to get the adb to connect to the Google Nexus One phone. Its a new phone, shipped straight from Google - haven't installed any apps on it yet. (I have Windows XP) Here is what I have done so far: Followed the instructions on setting up the device for development as given on the Android Developer's site: http://developer.android.com/guide/developing/device.html added android:debuggable="true" to my application manifest USB debuggable is checked on the phone downloaded the Device Drivers For Windows Revision 3 (this supports Nexus One phones) Went through the Hardware Installation wizard to install the device - the device shows up as "Android Composite ADB Interface". When I run adb devices on the shell, the device appears for a moment, then disappears. On the Eclipse console, I get the following message: [2010-11-13 11:54:42 - DeviceMonitor]Failed to start monitoring I have rebooted the pc several times, uninstalled and reinstalled the drivers several times, but I get the same error each time. As I was researching this problem, someone had recommended rebooting the phone. I am a bit confused by that - is that a soft or hard reboot? Do I just power the phone off/on and is there something more complex involved? Do I have to hard reboot it to reset to factory version - even though its brand new? Has anyone run into a similar problem? Any help on this would be great. I can't test my application on the device if the adb cannot view the device. Thanks so much in advance.

    Read the article

  • Memory management in iphone cocos2d

    - by muthu
    i am iphone developer very new to this field....i am developing a ebook app in iphone using cocos2d...i use more than 150 images(i guess) the problem while turning from one page to another images get hanged randomly...... i tried this also [[TextureMgr sharedTextureMgr] removeAllTextures]; but went in vain...i guess the the problem is with the memory.....this my coding for all the pages -(id)init { if( (self=[super init] )) { self.isTouchEnabled = YES; [SimpleAudioEngine sharedEngine]; NSLog(@"b4 cover"); Sprite *bg1 = [Sprite spriteWithFile:@"a.jpg"]; bg1.anchorPoint = CGPointZero; [self addChild:bg1 z:-1]; once = TRUE; soundId = [[SimpleAudioEngine sharedEngine] playEffect:@".mp3"]; } return self; } -(void) transitionfront:(id) sender { [[SimpleAudioEngine sharedEngine] stopEffect:soundId]; soundId1 = [[SimpleAudioEngine sharedEngine] playEffect:@"page_turn.mp3"]; flip = [[Sprite spriteWithFile:@"a.jpg"] retain]; [self addChild: flip z:1]; [flip setPosition:ccp(160,240)]; Animation* animation1 = [Animation animationWithName:@"Page1" delay:0.09]; for( int i=1;i<4;i++) [animation1 addFrameWithFilename: [NSString stringWithFormat:@".jpg", i]]; id action = [Animate actionWithAnimation: animation1]; //id action = [RepeatForever actionWithAction:[Animate actionWithAnimation: animation1]]; [flip runAction:action]; [NSTimer scheduledTimerWithTimeInterval:0.3 target:self selector:@selector(moveforward) userInfo:nil repeats:NO]; } -(void) moveforward { [[SimpleAudioEngine sharedEngine] stopEffect:soundId1]; [[Director sharedDirector] replaceScene: [ [Scene node] addChild: [nextpage node] z:0] ]; } -(void) transitionback:(id) sender { [[SimpleAudioEngine sharedEngine] stopEffect:soundId]; soundId1 = [[SimpleAudioEngine sharedEngine] playEffect:@".mp3"]; flip = [[Sprite spriteWithFile:@".jpg"] retain]; [self addChild: flip z:1]; [flip setPosition:ccp(160,240)]; Animation* animation1 = [Animation animationWithName:@"Page1" delay:0.09]; for( int i=3;i>0;i--) [animation1 addFrameWithFilename: [NSString stringWithFormat:@".jpg", i]]; id action = [Animate actionWithAnimation: animation1]; //id action = [RepeatForever actionWithAction:[Animate actionWithAnimation: animation1]]; [flip runAction:action]; [NSTimer scheduledTimerWithTimeInterval:0.3 target:self selector:@selector(movebackward) userInfo:nil repeats:NO]; } -(void) movebackward{ //[[SimpleAudioEngine sharedEngine]stopEffect:@".mp3"]; [[Director sharedDirector]replaceScene:[[Scene node]addChild:[b4page node] z:0]]; } -(void) glossary :(id) sender { [[SimpleAudioEngine sharedEngine]stopEffect:soundId]; [[Director sharedDirector]replaceScene:[[Scene node]addChild:[ node] z:0]]; } -(BOOL)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; CGPoint cocosTouchPoint = [touch locationInView: [touch view]]; CGPoint point = [[Director sharedDirector] convertToGL:cocosTouchPoint]; NSLog(@"pointx: %f pointy:%f", point.x, point.y); // Was a tab touched, if so, which one... if (CGRectContainsPoint(CGRectMake(220, 0, 100, 70), point)) { if(once) { NSLog(@"enterred page1"); [self transitionfront:nil]; once = FALSE; } } if (CGRectContainsPoint(CGRectMake(0,0,60,60), point)) { if(once) { NSLog(@"enterred cover"); [self transitionback:nil]; once = FALSE; } } if (CGRectContainsPoint(CGRectMake(100, 15, 30, 30), point)) { if(once){ [self glossary :nil]; once = FALSE; } } return kEventHandled; } -(void)playEffect:(NSString*)sound{ if(effectPlayer!=nil){ [effectPlayer release]; } NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:sound ofType:@"mp3"]]; effectPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:nil]; [effectPlayer setDelegate:self]; [effectPlayer play]; } -(void)stopEffect { [effectPlayer stop]; } -(void) dealloc{ [super dealloc]; } do pls help me........ do give me a exact coding this is the err..... *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: aesop.mp3)' 2010-05-27 10:43:09.834 abc[276:20b] Stack: ( 11674715, 2476006971, 11758651, 11758490, 5126917, 660698, 660881, 661061, 131577, 448857, 120432, 153433, 630890, 23694899, 23603228, 23630005, 47120081, 11459456, 11455560, 47114125, 47114322, 23633923, 9928, 9814 )

    Read the article

  • Fun with Python

    - by dotneteer
    I am taking a class on Coursera recently. My formal education is in physics. Although I have been working as a developer for over 18 years and have learnt a lot of programming on the job, I still would like to gain some systematic knowledge in computer science. Coursera courses taught by Standard professors provided me a wonderful chance. The three languages recommended for assignments are Java, C and Python. I am fluent in Java and have done some projects using C++/MFC/ATL in the past, but I would like to try something different this time. I first started with pure C. Soon I discover that I have to write a lot of code outside the question that I try to solve because the very limited C standard library. For example, to read a list of values from a file, I have to read characters by characters until I hit a delimiter. If I need a list that can grow, I have to create a data structure myself, something that I have taking for granted in .Net or Java. Out of frustration, I switched to Python. I was pleasantly surprised to find that Python is very easy to learn. The tutorial on the official Python site has the exactly the right pace for me, someone with experience in another programming. After a couple of hours on the tutorial and a few more minutes of toying with IDEL, I was in business. I like the “battery supplied” philosophy that gives everything that I need out of box. For someone from C# or Java background, curly braces are replaced by colon(:) and tab spaces. Although I tend to miss colon from time to time, I found that the idea of tab space is actually very nice once I get use to them. I also like to feature of multiple assignment and multiple return parameters. When I need to return a by-product, I just add it to the list of returns. When would use Python? I would use Python if I need to computer anything quick. The language is very easy to use. Python has a good collection of libraries (packages). The REPL of the interpreter allows me test ideas quickly before committing them into script. Lots of computer science work have been ported from Lisp to Python. Some universities are even teaching SICP in Python. When wouldn’t I use Python? I mostly would not use it in a managed environment, such as Ironpython or Jython. Both .Net and Java already have a rich library so one has to make a choice which library to use. If we use the managed runtime library, the code will tie to the particular runtime and thus not portable. If we use the Python library, then we will face the relatively long start-up time. For this reason, I would not recommend to use Ironpython for WP7 development. The only situation that I see merit with managed Python is in a server application where I can preload Python so that the start-up time is not a concern. Using Python as a managed glue language is an over-kill most of the time. A managed Scheme could be a better glue language as it is small enough to start-up very fast.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >