Tuesday, November 2, 2010

About C / C++ / C#: Programming Contest 41 Started

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#
Before the start of the month there were three entries in already. By the time you read this, contest 40 should have been fully marked so congrats to whoever wins! The big news this week is that Microsoft have admitted that Silverlight is now intended mainly to be for Windows Phone development. Details below. Make it a good one!

Silverlight - Microsoft shifts the Battlefield
For the last three years I've believed that Silverlight was in direct competition with Flash to be the web GUI development tool of choice. I think it could have done better had they lowered the bar to entry (i.e. made it free) but it's maybe too late now. A recent proclamation from Microsoft shows that they view Silverlight differently. Zdnet's writer who follows Microsoft, Mary Jo Foley asked Bob Muglia, the Microsoft President in charge of the company's server and tools business who said that Silverlight is now being focused on Windows Phone development.The true cross-platform for web development will be HTML5/JavaScript which is being touted the Flash Killer. All sides now agree on this, even Adobe. It looks like there will be a Silverlight 5 but after that who knows? I'm not sure what this means to Moonlight (the Linux equivalent of Silverlight). But if you thought of doing client GUI development, I'd suggest looking very strongly at HTML5/JavaScript. Once Internet Explorer 9 comes out, all major browsers (Chrome, IE, Firefox, Opera and Safari, well Safari 4) will support HTML5 Canvas which lets you draw graphics on a browser web page and within a year or two will fully support the GPU for browser rendering. For C# though there is still a rosy future ahead in server and desktop software. For the moment though, I won't be covering Windows Phone development because (a) I only have an iPhone (I'm always open to an offer of loan of a Windows phone!) and (b) I have to replace my aging XP driven PC with a Windows 7 one. That should happen in a month or two. If you have a phone and Windows 7 or Vista you can download the free bundle for Silverlight development on Window Phone.

Running Dos Games on an iPhone
It seems that for a day, this was available in the App Store but then Apple presumably found it was an emulator and killed it. It's based on DosBox which emulates an Intel x86 PC, complete with sound, graphics, mouse, joystick, modem, etc., necessary for running many old MS-DOS games that simply cannot be run on modern PCs and operating systems, such as Microsoft Windows XP, Windows Vista, Linux and FreeBSD. It's very mature and is used by games publishers including Steam and GOG.com. DosPad is a conversion of DosBox to the iPhone and iPad. The source code is available on Google code. so you could run it in the Mac iPhone emulator or even put it on your iPhone if you've paid your $99 to be a registered iPhone developer. Incidentally I've been holding off iPhone tutorials until Xcode 4 is fully released which can't be far off as this page on Xcode 4 shows.

Contest 41 Data Preparation
Generating two sets of 500,000 ints each of which are unique numbers is not the hardest problem but being a programmer I tried to do it the easy way. I used Excel as it simplified checking duplicates ina sorted data column. If the value on row x is the same as the value on row x-1 then there's a duplicate value. Course I didn't fully copy and paste the formulas on every row and so version one actually had 64 duplicates in it plus it was sorted. So I've written a Csharp program to clean up the data and desort it. When you work on an Excel, pasting formulas etc and then having cleared those, it seems to leave a few tabs on some rows so I used String.trim() to remove them. Desorting is easy. just allocate enough space to read all the numbers in, put a magic value in each slot and then read the file and put the value in a randomly picked spot that has the magic value. If a collision occurs where a non magic value is already there just increment the index until a magic value is found. It uses StreamReader and StreamWriters to read and write the text files and a generic List to hold all the numbers. Incidentally, although amax is 500,000 there are a few more rows in the two data files. You can view it here.

Other Blogs You might find Interesting
This is a list of Blogs that you might find interesting.

 


C / C++ / C# Ads
Featured Articles
Never Programmed Before? Start Here
Welcome to the C Area with Articles about C Programming
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#

 

More from About.com

Is it a Cold or the Flu?
Knowing whether you have a cold or the flu can help you treat your symptoms more effectively. More >



Concerned About Your Drinking?
This short quiz can help you identify whether or not you have a drinking problem. Take the quiz now >




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

No comments: