We,all know the importance of functions in C. And any good-programmer will be using well coded functions in his program, may be including them in a loop as well.But, while using the function in a nested if else we must be careful and should keep in mind the output of the function and what exactly do we want.I am saying this because my program returned insane values due to a careless use of functions.
The problem causing bit of code is here:
if(strt < insert(strt,end,value)
{
//some stuff;
}
else if(strt == insert(strt,end,value)
{
//some stuff;
}
what happened here was that, for the 1st if statement the function insert was called. Now suppose the value is false and the other if statement is to be implemented, then it will again call the insert function which is not how it should happen because for the new function, it will find a new value instead of the old value. So, it is better to store the value of the function and compare the stored value.
Lets hope that we don't make this mistake again. : )
Tweet
Friday, November 19, 2010
Wednesday, November 17, 2010
Boosting your browsing speed in Mozilla
you may be happy with the time it takes for a webpage to load in Mozilla but getting a better browsing speed is always a welcome change isn't it? Here is a simple way to boost your speed.
->Open a new tab and in the address-bar type: about:config
->Now in the box of filer type browser.cache
->Now turn the value ofbrowser.cache.disk.enable to false. It can be done by just double clicking it.
->Similarly set browser.cache.memory.enable to true.
->Now right click on an empty space select new->integer and give it name : browser.cache.memory.capacity and in the give it value100000 or 100Mb.
Mind you this will store the cache in main memmory and may take upto 100Mb of your RAM.So just take care of not giving some superficial value as capacity.Also, the process will increase the speed of cached pages only.Anyways, any betterment is welcome isn't it?
Tweet
->Open a new tab and in the address-bar type: about:config
->Now in the box of filer type browser.cache
->Now turn the value ofbrowser.cache.disk.enable to false. It can be done by just double clicking it.
->Similarly set browser.cache.memory.enable to true.
->Now right click on an empty space select new->integer and give it name : browser.cache.memory.capacity and in the give it value100000 or 100Mb.
Mind you this will store the cache in main memmory and may take upto 100Mb of your RAM.So just take care of not giving some superficial value as capacity.Also, the process will increase the speed of cached pages only.Anyways, any betterment is welcome isn't it?
Tweet
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.
Tweet
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.
Tweet
Wednesday, October 13, 2010
Another useful html tag!
WEll, this time I am talking about the < pre > tag. It is used when you donot want to insert all the whitespaces individually.
Simply speaking, this tag is used when you want to have a preset text in your web-page.
Generally, the white spaces in your script are neglected by the browser. And they can be added using ' ' ( meaning new blank space).Instead if you are using the 'pre' tag, it will display the text as it is written.
Despite the advantage, this tag is rarely seen in the web-pages.
This is the w3schools article on the tag.
PS: Being busy with my other work, am not able to blog regularly
Tweet
Simply speaking, this tag is used when you want to have a preset text in your web-page.
Generally, the white spaces in your script are neglected by the browser. And they can be added using ' ' ( meaning new blank space).Instead if you are using the 'pre' tag, it will display the text as it is written.
Despite the advantage, this tag is rarely seen in the web-pages.
This is the w3schools article on the tag.
PS: Being busy with my other work, am not able to blog regularly
Tweet
Thursday, October 7, 2010
# in html!
All the C programmers tend to think of #include as soon as they see '#' symbol. But not all the people know that there is # used in html also!
Well we all have seen the wiikipedia page on one or the other thing,right? Now, there is a table of contents in every page. The elements of this table point to links in the same page. This is where a # symbol comes in handy. It is basically used to maintain an index within the web-page.
while giving the address give href="#link" instead of the entire address of the page.
and to give the target location give name="link" as a part of the 'a' attribute of the location
Here the difference from a normal href is that here we are starting the URL with # indicating that the target is in the same page. Also we have given an attribute 'name' with value=link. This is the address of the target.
(How else would the browser know where to point next?)
Hope you will find it helpfull.
Tweet
Well we all have seen the wiikipedia page on one or the other thing,right? Now, there is a table of contents in every page. The elements of this table point to links in the same page. This is where a # symbol comes in handy. It is basically used to maintain an index within the web-page.
while giving the address give href="#link" instead of the entire address of the page.
and to give the target location give name="link" as a part of the 'a' attribute of the location
Here the difference from a normal href is that here we are starting the URL with # indicating that the target is in the same page. Also we have given an attribute 'name' with value=link. This is the address of the target.
(How else would the browser know where to point next?)
Hope you will find it helpfull.
Tweet
Sunday, October 3, 2010
Time for some shortcuts!!
Usage of mouse all the time to navigate is not so ergonomic, is it? Today I and my friend had nothing else to do so tried out many combinations of key strokes to see what happened. Here are some that might be interesting!
For navigation purpose:
-> Well some of you may be knowing that to go to the previous directory in
your Explorer, be it your internet explorer or the file one, you can use
backspace key.
But do you know that to navigate forward you can use shift + backspace?
for e.g search anything in google and go to the first webpage. now press
backspace
and you will reach back to the search result and now press shift + backspace.
-> You may use windows + D for navigating to the desktop. And press it again to go
back to return to your application.
Notepad:
-> The function keys do have some use in notepad.
-> First is F1: for help
-> Next is F5: for date and time. (Who needs it?)
-> Next is F10: To go to the menubar. If you dont want to use the function keys you
may also use atl button followed by the underlined letter in the respective
field e.g alt + f for file menu.
More will be coming soon!
For navigation purpose:
-> Well some of you may be knowing that to go to the previous directory in
your Explorer, be it your internet explorer or the file one, you can use
backspace key.
But do you know that to navigate forward you can use shift + backspace?
for e.g search anything in google and go to the first webpage. now press
backspace
and you will reach back to the search result and now press shift + backspace.
-> You may use windows + D for navigating to the desktop. And press it again to go
back to return to your application.
Notepad:
-> The function keys do have some use in notepad.
-> First is F1: for help
-> Next is F5: for date and time. (Who needs it?)
-> Next is F10: To go to the menubar. If you dont want to use the function keys you
may also use atl button followed by the underlined letter in the respective
field e.g alt + f for file menu.
More will be coming soon!
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.
Tweet
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.
Tweet
Subscribe to:
Posts (Atom)