Tuesday, May 25, 2010

About C / C++ / C#: Challenge 35 is Heating Up

If you can't see this email, click here

About.com

C / C++ / C#

Fundamentals

Tips & Tools

Going Pro



From David Bolton, your Guide to C / C++ / C#
With four marked entries so far and a fifth one to mark there is still time to get your entry in for the Knight's Tour programming Challenge with a week still to run. The Interesting discovery of the Week is the DragonFireSDK which lets you develop and debug iPhone Apps on Windows. Details below. See you next week!

Location, Location, Location!
Thanks to Google releasing yet another API, software can now determine where it is physically located with a high degree of accuracy. I've mixed feelings about this as it can be used to lock software to a location "This money counting App is not permitted to run outside of Fort Knox" or "Residents of xyz country are barred from running this software".but equally it could be useful say for scavenger hunts and other uses. Originally an acquisition called Dodgeball for mobile devices, it was bought by Google in 2005 and with the increased accuracy of IP geo-location can now also be used with desktop PCs. That's not quite perfect though and requires an Internet connection, plus Google don't keep location logs so I'm not too worried by it. Latitude uses a restful architecture. Restful is a slightly vague term (ReST = Representation State Transfer) meaning you access it like a web address. The OpenRasta framework is an open source framework that is built on .NET that lets you create development of restful web sites and services. You access the Latitude API URIs in this form. https://www.googleapis.com/latitude/v1/resourceID?parameters The Developer's Guide is a pretty good way to get started. All the data from Google Latitude is returned in JavaScript Object Notation (JSON). You'll also find that json.org is a good place to find information on JSON) with 20 odd links to code in C, C++ and C# to handle JSON. It's an increasingly popular alternative to XML.

Develop iPhone Game Apps on Windows
DragonFireSDK Sample GameThis is one of those rarities where I mention a commercial product or service because I think its of interest to readers. Disclaimer: I have no involvement financial or otherwise with them. Apple's clause 3.3.1 forbids iPhone development except in C/C++ or Objective-C and binaries can't be linked against any other runtime. So if someone provided a SDK that maps C/C++ (written on a Windows PC) to Objective-C and a build service that takes your build and returns a fully compiled Mac Binary then it should be fully compliant. The proof of the pudding is that there are several Apps in the App Store built using it already. That's what DragonFireSDK does; it's not free but it's not very expensive either for something that lets you develop and debug . There's a fee of $49.95 for the Starter Kit which includes the Windows library and an iPhone Simulator for Windows. The iPhone Simulator is built into your App when developing on Windows so you can debug your code and see it run. You can later upgrade to the Ultimate (or $50 or buy it immediately) for $99.95) that lets you submit to the App Store. Test Builds cost $1 (you get 10) and each submission to the App Store costs $10. DragonFire have published their API documentation online so you can view it before buying which is very good. It certainly simplifies game development and is a C API rather than C++ specifically. The API is well thought out though focuses on games to start with so the overall functionality of the iPhone (APIs etc) that are exposed is probably only 10%-20%. I get the feeling they will be expanding it as time goes on; They have a labs section where users can try out new features before they are incorporated. The skeleton framework for all games using DragonFire is that it has to implement three functions: AppMain() for the game code initialization code, AppExit() is called when the game is terminated so the App can save state and everything etc and OnTimer() which is called 30 times/sec so is where you put logic and rendering code etc. It's effectively the game loop. The only snag of course with DragonFire is that it uses a reduced set of iPhone OS API calls. The current set of DragonFire SDK calls doesn't include any networking or URL fetching so multi player games aren't currently feasible. That said I think they've done an amazing job with it!

Programming Challenge 35 Marking Early
As there are several entries already, I thought I'd start marking them early and all three are very fast ranging from the slowest 0.00273168 by Sean Jordan to the current fastest so far from Gaurav Sarode. Mind you I haven't verified the Knight's Tours moves yet (I will!). There's plenty of time left to enter (or re-enter) but I won't be posting source code until after the competition has finished in about two weeks time. Have fun!

Code Library for C, Objective-C, C++ and C#
This is the code library with all examples, free downloads for this topic.

 


C / C++ / C# Ads
Featured Articles
Development Projects from Initial Design to Completed Code
Reviews of Software - Tools, Compilers, Editors etc
Book Reviews
Top Tools, Utilities and Resources
Glossary of Programming Terms
Never Programmed Before? Start Here

 

More from About.com

Great Stuff Kids Love
From the hottest tunes and best online videos to favorite books and classic toys, here are our top picks for the kids in your life. More >



Join About.com's User Panel!
Share your opinions and help us make About.com more relevant, informative and enjoyable to use. More>




This newsletter is written by:
David Bolton
C / C++ / C# Guide
Email Me | My Blog | My Forum
 
Sign up for more free newsletters on your favorite topics
You are receiving this newsletter because you subscribed to the About C / C++ / C# newsletter. If you wish to change your email address or unsubscribe, please click here.

About respects your privacy: Our Privacy Policy

Contact Information:
249 West 17th Street
New York, NY, 10011

© 2010 About.com
 


Must Reads
Programming Challenges
About C, C++ and C#
C++ for Beginners
C++ Programming
Intro to OOP

Advertisement

Tuesday, May 18, 2010

About C / C++ / C#: Programmers Do Marketing?

If you can't see this email, click here

About.com

C / C++ / C#

Fundamentals

Tips & Tools

Going Pro



From David Bolton, your Guide to C / C++ / C#
I keep a weather eye on the computer book market and noticed an interesting new trend. Books that show you how to market your Apps for the App Store. I've got a couple on order so I'll take a look and review them. Although my brief is to educate about C, C++ and C# (now including Objective-C), I like to look at those languages not just from a purist programming language point of view but from how developers use them as well. That said, all three entries have some code in each! Have a great week!

What's New in Visual C++ Part 1
These are a few of the changes I'll cover others in later blog entries.

The auto keyword

In C++ this has an additional meaning the compiler uses the auto keyword to declare a variable from the right hand side of the = ; i.e. initializing expression.. The older meaning and the same as in C was that an auto variable was local to a function and you still needed the type. eg auto int result; It's use was in my experience pretty rare as it was the default storage type in functions. Now in C++ it tells the compiler go figure what type to use from the expression. This new use helps declarations with templates, pointers to functions, or pointers to members declarations, however it also works for simple types. Note that when you use auto you must provide an initializer. auto count=0; // int auto str="a"; // char and you can't use it to declare the return type of a function or method! By default this is the new meaning of the word.

Coding bug Caught by Yoda Is
In Star Wars, if Yoda talking is, things backwards spoken are, a bit like parts of German that I taught was. Yiddish is apparently similar and Yoda/Yiddish seems perhaps more than a coincidence. In coding you can do things a bit Yodaish for example: #include <stdio.h> int main(int argc, char* argv[]) {     int a=4;     if (4==a)        printf("A = 4");     return 0; } The if (4== a) is Yodaish and looks a bit odd but the expression is commutative, i.e. the order doesn't matter. It's quite sensible to put it this way round once you've got your head into reading it. if (a=4) compiles and runs even though it's a bug because it assigns the value 4 and teh expression has a true value. This is a compile error in C#. if (4=a) does not compile in C, C++ or C#. Yoda finds this bug in all three languages as a value can't be assigned a variable. Hurray for Yoda!

Optional Parameters in C# 4.0
In methods, optional parameters have existed in other programming language for quite a while; C++ and Delphi for instance. What makes them more interesting is that they aren't just for method arguments in C# 4.0, but for constructors, indexers, or delegates as well. This simple example shows it with three instances of the test class being called. the second using the default parameter of 5 and the third with a named parameter. using System.IO; namespace ConsoleApplication1 {     class test     {         public test(int Testval = 5)         {             System.Console.WriteLine("Value = {0}",Testval) ;         }     }     class Program     {         static void Main(string[] args)         {             test t = new test(6) ;             test t1 = new test() ;             test t2 = new test(Testval: 78) ;         }     } } The output is Value = 6> Value = 5 Value = 78

Welcome to the C Area with Articles about C Programming
The C Area is where all the articles about C Programming are found. Technical articles, source code, experiences, hints etc.

 


C / C++ / C# Ads
Featured Articles
Welcome to the C++ Area with Articles about C++ Development
Welcome to the C Sharp Area with Articles about C Sharp Development
Learn about Commercial Software Development
All about Games Programming
Code Library for C, Objective-C, C++ and C#
Development Projects from Initial Design to Completed Code

 

More from About.com

Disney Trip Planner
Everything you need to plan the perfect Disney vacation -- from when to go and what to do, to saving money and picking a hotel. More >



Join About.com's User Panel!
Share your opinions and help us make About.com more relevant, informative and enjoyable to use. More>




This newsletter is written by:
David Bolton
C / C++ / C# Guide
Email Me | My Blog | My Forum
 
Sign up for more free newsletters on your favorite topics
You are receiving this newsletter because you subscribed to the About C / C++ / C# newsletter. If you wish to change your email address or unsubscribe, please click here.

About respects your privacy: Our Privacy Policy

Contact Information:
249 West 17th Street
New York, NY, 10011

© 2010 About.com
 


Must Reads
Programming Challenges
About C, C++ and C#
C++ for Beginners
C++ Programming
Intro to OOP

Advertisement

Tuesday, May 11, 2010

About C / C++ / C#: Challenge 34 Marked

If you can't see this email, click here

About.com

C / C++ / C#

Fundamentals

Tips & Tools

Going Pro



From David Bolton, your Guide to C / C++ / C#
Congratulations to Shashi Sadasivan from Australia, our sole entrant this month whose C# entry was able to work out a straight line in 8 ms. I realized this week that I had been needlessly neglecting WPF from the C# tutorials as it is in the Visual C# 2008/2010 Express versions. I do try to create tutorials that require little or no additional expense to do them (except for iPhone!). Have a Good Week!

Ryzom has gone open source
RyzomDeveloped ten years ago and launched in 2004 the French developed massively multi-player online role-playing game (MMORPG) has not been a commercial success despite winning awards and the game engine from Ryzom called Nel has now been open sourced as Ryzom Core just a few days ago under the GNU Affero General Public License. Written in C++ , Ryzom Core has client, server, plus tools that were used to create Ryzom. Ryzom Core is basically a toolkit for developing massive multi-player online game universes. It provides the base technologies and a set of development methodologies for the development of both client and server code. As is common these days it uses Lua for scripting The developers have even provided a shard (a server holding part of the game world) for other game developers to test on. Interestingly, it's not just the 2 million lines of source code but the graphics, over 20,000 in total are also free (a 1.4 Gb download) under a Creative Commons license.

WPF Starting to Pickup?
WPF is of course Microsoft's vision for the future of desktop programming with Silverlight being a lite version on other platforms. I can't say that WPF has set the world on fire but recently I've noticed at work that it's being used a lot with WPF books appearing on many bookshelves. Even my own team (and I) are writing WPF Applications. Unlike Silverlight, WPF does not suffers from the limited access of only being used from the full Visual Studio, it's also in the Express editions (It was also in Visual C# 2008 Express as well I never noticed it) so I will be creating tutorials for it. I've also added a new library for Open Source WPF Apps and it has two to start with: Crack.net a debugging tool and Caliburn which helps architecting. Also there's a new crop of books launched to coincide with the .NET 4 and these include a few specifically on WPF so clearly the publishers think there's mileage there as well. If you want to spot trends watch publishers. They have to be ahead of the game so the books are there on time.

What's New in C# 4.0 Continued

Long overdue to C# is the introduction of named arguments. You can specify the name so the actual order doesn't matter. Call me old fashioned but I still think you should use the same order for consistency. So for a method called PerformAutopsy( string Name,int Age),
you would traditionally call it like this: PerformAutopsy("John Doe",71) ;
Now you can call it like this in C# 4.0 PerformAutopsy(Name:"John Doe",Age:71) ;
or PerformAutopsy(Age:71,Name:"John Doe") ;
But be careful mixing named with positional parameters: PerformAutopsy("John Doe",Age:71) ; // Ok
PerformAutopsy(Name:"John Doe",71) ; Not OK (positional arguments must be first).


Code Library for C, Objective-C, C++ and C#
This is the code library with all examples, free downloads for this topic.

 


C / C++ / C# Ads
Featured Articles
Development Projects from Initial Design to Completed Code
Reviews of Software - Tools, Compilers, Editors etc
Book Reviews
Top Tools, Utilities and Resources
Glossary of Programming Terms
Never Programmed Before? Start Here

 

More from About.com

Disney Trip Planner
Everything you need to plan the perfect Disney vacation -- from when to go and what to do, to saving money and picking a hotel. More >



Join About.com's User Panel!
Share your opinions and help us make About.com more relevant, informative and enjoyable to use. More>




This newsletter is written by:
David Bolton
C / C++ / C# Guide
Email Me | My Blog | My Forum
 
Sign up for more free newsletters on your favorite topics
You are receiving this newsletter because you subscribed to the About C / C++ / C# newsletter. If you wish to change your email address or unsubscribe, please click here.

About respects your privacy: Our Privacy Policy

Contact Information:
249 West 17th Street
New York, NY, 10011

© 2010 About.com
 


Must Reads
Programming Challenges
About C, C++ and C#
C++ for Beginners
C++ Programming
Intro to OOP

Advertisement