Wednesday, August 17, 2011

timetable.sh for lazy people like me

   It is always very difficult for me to remember the time-table, especially for the first few weeks of semester. The condition was worse this semester, so I HAD to find a solution for this.I know, taking a photograph of the timetable would do it but I thought of doing something new (yeah!!)
 
   Since, the start of this semester, I had started using Linux and so I thought of making a shell script to help me.Well, fortunately I stuck to this idea and hence after about an hour of Googling, I was able to learn enough of shell scripting to help me here.Well, to save u from even one hour of googling, I am sharing the skeleton of the program:

#! /bin/bash

if [ "$#" == "0" ]
then
 
   set `date +%u`
if [ "$1" -eq "1" ]
then
   echo -e "Monday's timetable\n"

else if [ "$1" -eq "2" ]
then
   echo -e "\nTuesday\n"
else if [ "$1" -eq "3" ]
then
   echo -e "\n Wednesday\n"
  
else if [ "$1" -eq "4" ]
then
   echo -e "\n Thursday\n"
  
else if [ "$1" -eq "5" ]
then
   echo -e "\nFriday\n"
 fi
 fi
 fi
 fi
 fi
  
else

if [ "$1" == "1" ]
then
      same thing again


fi

fi


So, why did I use $# here?
  $# tells me the no of arguments passed. So if we passed a day number as an argument, then show that day's timetable, otherwise find the day of the week and then display the timetable.

why echo -e?
   Normally, echo doesnot support escape sequences so we need to add -e for them.

and date +%u gives u  the day of the week

We use the set command to give the value to the variable $1. $1 and all are special variables used in Shell script.

U can use == or -eq for checking the comparison. And it is visible that u need to end each if statement using fi!!

Anyways, now I have a shell script to tell me the timetable whenever I need it. Now all I need to do is make it autorun everyday in the morning and also turn it into a linux command. Will do that, and let u know :)

Enjoy this code till then. Yes, u are also welcome to tell me how to do the above!
  

Friday, July 8, 2011

Pixel Paint:what ,how and how much?

   Ever since I heard about jQuery, I wanted to use it,explore it and play with but due to some other reason(or in other words procrastination!) I was unable to do so. Finally, last Friday and set and learnt it from w3schools, the best available tutor I guess. Now, coming to the topic:
What?
Well Pixel paint is an under development painting tool that I have created and uploaded to OpenWorld . You can try it there. The painting stuff is completely based on jQuery as that is what I wanted to practise while creating this. I will be adding more features as and when I am able to develop them. Currently, because of poor internet connectivity I am unable to add the latest eraser tool that I just created but anyways, the current pen tool is just fine.I think the tool is the best explanation of what it is.

How?
Like I mentioned it above, I was learning jQuery and wanted to practise it. Coincidentally, Google+ came out the same week. With it's excellent UI and vibrant colors, it inspired me to add more color to what all stuff I made. I was thinking on what new animations could be done and suddenly light Bulb! The idea of an online painting tool just popped up to me.Making of the first version of Online Paint needed just 1 hour of jQuery designing and testing. A few more hours of designing and the first version was out! Coming to the next point:

How much?


As talked above, the version 0.2.3 had just dot painting facility, now the online version is 1.3.3 which has an addition of pen tool which enables you to draw lines. The one in my laptop is 2.4.3 which has the same UI but with an addition of eraser tool which is still a bit buggy, also one of the bugs of the previous versions have been removed. I wish to add a load more number of  features but I need to improve my skills and may eventually have to change the coding completely.

Anyways, that's all about Pixel paint that I can share with you right now. Will post more updates and will notify you people too!

  

Sunday, June 26, 2011

Boosting Mozilla Firefox's speed

 
     This post is continuation of one of my old post . Firefox lets us tweak it in a large number of ways and hence there is always a scope of your getting a better performance out of the browser. For eg, if you are contnuously online and if suppose you donot frequently visit same pages, you may limit the cache size on the disk or ram to reduce the memory usage of the browser to a lower value without much problems. Anyways, coming back to the post.
     Last time I talked about changing the disk and memory cache size of the browser.But, these are not of much use during offline viewing of pages. Certain pages having smart javascripts can make use of the offline caching facility of the browser to serve you better. To provide these with larger size, you just need to increase the size of browser.cache.offline.capacity to a larger value, 100000 in my case.
     It might happen that your browser may have browser.cache.offline.enable false i.e off. So you better turn it on!Just by double clicking it!
     You may also increase the value of image.cache.size Though I donot feel the need to do it. Also one thing should be taken care of. Providing large cache to Firefox will help to a certain extent. Beyond that it will only cause memory related issues.
   These were a few tweaks at the background level of the browser. There is another way to increase the speed also!  Just don't install add-ons without thinking. It may cause the browser to go slow.Also, it is recommended that you constantly update your browser and add-ons.
   There is a known issue with Java Console that while installing new versions, it forgets to remove the older ones so you will have to personally remove them.
   Will meet you soon with new updates, till then keep coding and stay tuned to the blog!
 

Friday, June 17, 2011

New animation: could be used for tutorial pages

   Many times writing tutorials, you may need to put up some questions for the user to answer. It maybe just to give him an example or for some other reason. But, they all have the same working: type the answer and then press the "check!" button. Some will give an alert saying you are incorrect or others will just put up a text or something.But in all of them you have to press the button.
  Lazy guys like me hate doing that much too! So I prefer to use this code to take in the input:

<input type="text" onkeyup="checkanswer()" onfocusout="back()" id="ans"/>

also to show whether the answer is correct or not, I made this script:


<script type="text/javascript">
function checkanswer()
{
var check = document.getElementById("ans");
if(check.value=='Your Answer Here')
{
document.bgColor="#00ff00";
}
else
{
document.bgColor="#ffffff";
}
}


        function back()
       {
                document.bgColor="#ffffff";
       }
</script>


Well the script is self explanatory. After everykeypress, it checks if the answer is correct because of the onkeyup event.If answer is correct, the background colour changes to green, otherwise red. When you move the focus away from the text box the background becomes white away due to the onfocusout event.

This is quite useful for lazy guys like me :)

My main intention was to change the background color of the textbox but could not figure out how to do it so far. So send in your comments on how to do that :)
BTW check the demo here :


Thursday, June 2, 2011

Twitter Sorter

  I'm sure all the tweeters will be following different people for different purposes. Some for news, some people coz they are family, some coz you are their fans and many more reasons. Some of these people tend to tweet a lot and hence you timeline is flooded with their tweets.
  It happens with me many times that Engadget is tweeting excessively while I am not interested in them right now. God! I hate such moments! I always wished that My timeline was sorted according to category. Yes, Twitter has lists and you can read the tweets of the lists but that is too long. Hence, I am making an application called twitter sorter. It sorts all my tweets according to categories. My basic plan is setting the categories according to the Lists created by the user but not all users create lists (damn them!). Also, I wonder wether I should keep the tweets as seperate selectable objects or just show them as texts.
   Well, I am waiting for suggestions so please send them in!

Wednesday, April 13, 2011

High Quality Pages Algorithm:Google becomes more strict

  We know that Google consistently strives to give it's users better search results(why else would we use it?). Recently it launched a +1 button. And now it has launched a high quality pages algorithm . Some feel that this move is a reflecion of block sites chrome extension. Especially given that 85% of the black list is same as that of  the extension.
Why need such an algorithm?
  We are all aware of the presence of spammer sites, sites having copied content and the phishing sites.Its best that we donot get such sites in our search results. Hence Google is constantly striving to refine it's search results. The +1 service had been launched some time back, but it was just for social searches.Also it felt a bit manipulatable. Hence such an algorithm to get rid of so called 'Content Farming' websites.


What are high quality site?
 Here is a Google guideline as to what is a good quality site.All in all we can say that if a site is anyways trying to steal your data, cloaks link or has deceptive or a manipulative behaviour, then you are degrading the quality of your site. Also you better not spam through your website.



Is this algorithm powerful?
  Well, given the fact that it has been created by Google, says it all doesn't it? During the testing period, 2% of overall search queries were affected in the US. The percentage may seem small but given the number of daily search queries on Google, we can definitely say that a large number of sites will have been hit.

Will my site be affected?
 It all depends on your sites performance on Google's quality test.One thing though, don't think that your site can be manually be removed from the filter coz the system is currently fully automated and I think only if there will be negative responses, will Google think of manually adding exceptions. Till then, give your users something to love.Also make sure you go through Google's manual of good quality sites!Time to be obedient students to a strict teacher.

This service has been released just in US so far but will come to other English speaking users soon. Lastly, here is a list of all the sites affected by Googles algorithm ,for people who still believe that their site can beat it :)

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!