Showing posts with label C#. Show all posts
Showing posts with label C#. Show all posts

Sunday, April 3, 2011

One wrong click and all my files gone!

   Currently I am working on an application for syncing folders(yeah I know its a common app,but it's a useful one!).I as usual started could not compile the code in the first time coz of some syntax errors but what followed next was more horrific(for me) and enjoyable(for some).
   In my code I instead of copying the file, wrote the command for moving the file.Now, for the command we need to give a name for the output file. As this is a sync app, I need to give the same name to the output file.Hence, there came a villain named extractname(). It extracted the name Ok but it gave the name in the reverse order! Hence beads.c became c.sdaeb! Also, I forgot to add another '\' at the end of the folder name.
  But, this was a logical error and not a syntax error so it passed without any trouble till I ran it. While running it, I thought that there would not be a major problem and hence selected a not so important folder as the source and a new folder as destination.
  But, fate had something else in mind! Not only did all my files move out of the folder but as I had forgotten to put the extra '\' in place, they all went to the wrong folder and it's not over yet. The files were named like testc.sdaebs and testc.xiptas .I was stunned, confuse and angry over myself. Thankfully, after some debugging I came to know about the horrific mistake I made. Now I have renamed the files and they are at the right places. Also the code is corrected and the basic version of my app is ready.Now some more functionality and the app will be completely ready!

Monday, November 15, 2010

Exploiting facebook/twitter mobile facilities

We have seen many GPRS based applications for tweeting and updating your facebook status. But what to do if you want to tweet/update status without connecting to internet? Well, facebook and twitter have facilities where you can tweet/update status by simply sending a message to a certain number. You can use that technique in your application. For this you just have to know the method for sending a message from your mobile. If you are coding in C# it is very simple to do.
You just have to writing the following code:
->Microsoft.WindowsMobile.PocketOutlook.SmsMessage sms = new SmsMessage(number,text);
->sms.Send();
In case of facebook the number will be:923223265 and for twitter it is:53000.
Another thing that needs to be kept in mind is that, you need to add
Microsoft.WindowsMobile.PocketOutlook in the references.

This is a simple way to keep your app different from others.Though C# is used for programming for windows mobile.

Tuesday, September 28, 2010

My first C# project

I was very keen on jumping from writing console applications to applications having a better user-interface and being able to handle events such as a mouse-click. So I jumped over to C#. The guide that i was using turned out to be incorrect one and created a lot of confusion. But in the end I was atleast able to understand how to make a form(interface) and how to handle events.
So, I started meddling with things on my own.For starters I thought of an application that took some input and gave a corresponding output based on some formula . This, led to the project I am talking about.
Last year I had made a program that calculated the 'Daily Breathing Loss' based on a given formula. I just had to take the inputs,use a formula and print the output. Easy isn't it? So, I thought that I could use the code to explain how a simple C# program is made. Coders in VB might find it similar. I have attached, the .zip file and the.rar file. You can download as per your wish. In this code, I have not included any extra header file and have used the default template of the Visual Studio 2008 C# programs.