I was writing some games using the windows phone 7 tools and I found out that its a pretty cool sdk with .Net framework 4.0. For games you can either do silverlight or XNA. The first decision that you will have to make is to whether go Silverlight or go XNA ? If you plan to have 3D graphics/ animation, extensive control on drawing and coloring, show lot of images or trying to process rapid user input then go with XNA, otherwise silverlight is also pretty powerful if all you have to do is to manipulate windows phone controls and write a little logic to create your app. What I found out is you will need to read data files as there is no support or built in database in the phone. For me its a good thing, I do not want to write database wrappers or start a war with entity framework. File processing and Handling is kind of neat and you can pretty much do everything 90% of the time that you would with a database. I don’t think it is a cool idea to write “Payroll Management System” for a cell phone, I mean common ? what is the computer for ??
So coming from the Web/desktop/laptop world its very simple to read a file in .Net. Here is what you would do normally in ASP.Net or a C# Windows Application.
// Assuming file is in the same directory or your project
StreamReader sr = new StreamReader(“file.txt”);
string str = sr.ReadLine();
Pretty Simple huh !! It is a little tricky with XNA 4.0. Primarily you should have the files in the ContentProject and not your game project. If you look at the Game project references, you will see a reference to the ContentProject. So place the files in the Content Project, then change the file properties. You should change the Build Action property to “NONE” and “Copy to Output directory” to “Copy always”. This would put the files in your executable’s path. XNA provides a TileContainer Class and you can call the static method OpenStream and pass in the path (Content Project).
Stream testpath = TitleContainer.OpenStream(“Content/Test.txt”);
StreamReader reader = new StreamReader(testpath);
string line = reader.ReadLine();
For silverlight since you do not have the content project and the files possibly are included in your project you can do:
Stream testpath = Application.GetResourceStream(new Uri(“Test.txt”, UriKind.Relative)).Stream;
StreamReader reader = new StreamReader(testpath);
string line = reader.ReadLine();
I found this the google way, just putting it out there, it may save some time for someone trying to read files in their windows 7 applications. You can pretty much apply the same logic for StreamWriter to create and write to files.
Happy Coding and Best of luck 🙂
I would really appreciate if anyone can help me out with this networking scenario. I am not upto date with any networking products and dont have extensive knowledge, would appreciate your feedback.
Please see the attached diagram. Here is the explanation.
Client 1 and Client 2 are connected to Server 1 in Location 1. They are a part of a Corporate Network (WAN)
Client 3 is at Location 2. Client 3 is also connected to Corporate Network (WAN)
Location 1 and Location 2 are connected through
Client 3 wants to Connect to Server 1 (so that client 3 feels that it is on the same LAN as Client 1 and Client 2) . What would be a good mechanism to achieve this ?
I did some research on this and found that this can be achieved using VPN. So I am thinking in terms of setting a vpn at location 1 and making Server 1 the VPN Server. Configure Client 3 to connect to this VPN. All communication would be over the internet.
Server1 : Windows Server 2003
Client 3: Windows XP.
If you are aware of any third party products that are reliable or might help to set up a VPN I would appreciate your expert feedback.
Thank you very much.
I wasted some 3 hours to set it up. Did not exactly waste, I always find the setting the development environment the most annoying, difficult step in my development efforts. Here are some step by step instructions you can follow to save your time. This will include JDK, Eclipse, ADT Plugin and some configuration.
1. Install the Java Development Kit. I installed JDK 1.6. It can be installed from JDK DOWNLOAD . Make sure it is installed by going to command prompt and executing java -version
2. Download the Eclipse and Unzip it to a directory. I installed Version: Helios Release Build id: 20100617-1415 from http://eclipse.org/
3. Install the Android SDK. I downloaded the SDK from ANDROID SDK . To install unzip the directory and run the setup. It should bring up a utility where available packages and libraries would be downloaded. Create a test virtual device with 32 MB as your storage. Here is a screenshot after installation:
4. Add the Android SDK location to your Path (Go to Environment Variables and edit the path variable). In my scenario I added “C:\android-sdk_r06-windows\android-sdk-windows” to my path.
5. Install the ADT Plugin. Here is how:
Start Eclipse, then select Help > Software Updates…. In the dialog that appears, click the Available Software tab.
Click Add Site…
In the Add Site dialog that appears, enter this URL in the “Location” field:
https://dl-ssl.google.com/android/eclipse/Note: If you have trouble acquiring the plugin, try using “http” in the Location URL, instead of “https” (https is preferred for security reasons).
Back in the Available Software view, you should see the plugin listed by the URL, with “Developer Tools” nested within it. Select the checkbox next to Developer Tools and click Install…
On the subsequent Install window, “Android DDMS” and “Android Development Tools” should both be checked. Click Next.
Read and accept the license agreement, then click Finish.
6. Now you have installed JDK, Eclipse, Android SDK and the ADT Plugin and updated your PATH to have the location of Android SDK. Open Eclipse –> Create New Project –> Android Project , Select a name for your application and a suitable API Version to be safe I chose (1.6)
7. After the new project is created try and build it. Ideally it should build fine but it did not. It had issues with the build path (the sdk libraries were not included in the build path). In the package explorer right click on your project and select properties. In the left pane click on “Java Build Path” and check the “Android 1.6” or whatever you selected as your API version.
8. Clean the project and build it again. If it builds fine go ahead and run it “Run As – Android Application”.
9. HOORAY !! Time for victory dance. Here is a snapshot of ANDROID App running in the emulator.
I am also a beginner in android application development and pretty excited about it since I can test and deploy my applications in my DROID. Cheers and have a great rest of the day. I am heading to the JAVA BAR.
This is not really a rant, I cant understand why the International Cricket Council makes such stupid decisions. I am not saying that I am very smart and ICC should hire me to consult them, I am just an average fan and I like the sport, have a lot of memories associated with it. One Question that I think of again and again as we are in the middle of the “ICC World T20 2010” in the West Indies, is loss of game after game after game due to rain. Unfair advantage to teams batting second usually due to “D/L” System kicks in and totally changes the equation. Please when scheduling such tournaments and assigning venues for international tournaments consider the weather and the nature of the game and the facilities available. Primarily I do believe that T20 is designed for more entertainment, by entertainment i means the batsmen dominating the bowlers, lot of big hits and stumps flying around, thats action. I dont get it when the batting team is 80 – 5 in 12 overs and are consolidating for the next 5 overs in a 20 over game ??? Are we talking world T20 or World Test match Series ?? I would highly suggest ICC to open up their eyes and save the sport from loosing fans and popularity. It would have been far so better if the “World T20” would have been scheduled at any of the venues listed below:
I am totally not suggesting that a cricketing nation like WestIndies should be ignored, not at all, but for hosting international tournaments Like “T20 Word cup” ICC needs to put in some effort to raise the pitch standard (atleast even bounced wickets), the grounds (may be roof and lights) and if nothing please check the weather forecast and history before making the schedule. God dammit !! RawRRrrrrrrr !!