Tuesday, May 24, 2011

Testing Latex code on blog

This morning I was trying to find out how to write newsletter with html in gmail. Some how I stumbled onto this. Did you ever wonder how you can produce nice mathematical equations in documents without using MS Word. In fact, MS Word is a pain when it comes to creating mathematical equations. Latex is a typesetting language used to produce nice documents. You can write anything and everything, including complex mathematical equations, with Latex.

But then the problem is how to produce it on the blogs. There are blog spaces just for this. But it's not that easy though. Some of the people came up with nice idea of using javascript for this purpose. If you google for mathjax you will know how to write blogs with math equations. Of course, you need to know Latex in the first place.

I did simple test here to write mathematical solution to quadratic equation. As you can see it works beautifully. I am so excited ... In the next few days I will write another post about it in detail.


\[
\frac{-b\pm\sqrt{b^2-4ac}}{2a}
\]

Friday, April 1, 2011

www.timeanddate.com

I have always liked this website. It has good apps and free clocks, in both html and flash, in case you are interested to put them on your personal page. Here is the one I took from there to show here:

Flash Based Clock:



Text based clocks (HTML/Javascript):


It has different styled clocks in both text and flash formats. The best part is you can customize to your liking. Give it a try.

Copying all the songs from iTunes Music folder: I love Unix

Very often I need to start working on new computers for whatever reasons. Long time back I used to listen to music all the time while I was working in front of the computer. Some how over the years I completely stopped listening to music while working. Still, my iTunes library on my personal computer has tons of songs.

Recently, all of sudden I do feel like listening to music. At least now and then if not all the time. So, I thought of copying songs from my personal computer to office computer. The problem with the iTunes is that it doesn't play music from the folders you keep songs in. It does maintain its own library, which means it copies all the songs. So, I don't like to maintain songs separately from iTunes. If I did then it would be like wasting lot of space.

Anyway, coming to the problem how do I copy the songs from my computer that's there at home to the computer that's there at my work place. The one thing you could do is by copying the entire music into hard-drive and copy it back to your office computer. But, the problem with this method is it takes a while if you have huge collection. I don't care about tagging at all. I just want to listen to music. So I'd just like to copy the entire music files. At the same time I don't want to copy all the folders from iTunes Music folder. iTunes has weird way of naming folders, which I absolutely hate it.

Being a Linux guy, I wanted to linux way. Or you could say Unix way. First, what I wanted to do was to avoid copying music to hard-drive or taking my laptop to work place. Hence, I went for rsyncing. I've used rsync to sync the data from my personal computer to office computer. rsync is amazing in the sense if you are backing up data constantly from the same computer or at least from the same location on your computer. rsync doesn't copy the files that have been already copied before, unlike scp. For example, there are 100 files in one of the folder. You rsynced it today. In a week time from now you made another 50 files. After a week time, you want to back up those 50 files too. When you do rsync it just checks the files on both sides and immediately knows that it doesn't have to copy first 100 files but just 50 files. Where as scp tries to copy all the files.

I know what you are thinking now. What's the big deal, you might be thinking. Right? Yeah, it's no big deal if you are dealing with data in mb. If you are dealing with data in GBs and TBs it takes days. So I prefer rsync over scp for backing up data.

It's pretty simple. The command goes like this from the terminal.
rsync -e ssh -az <path_to_itunes_music_folder>/ <user>@<ip-destination>:~/Desktop/<directory_of_your_choice>

This command would prompt for password and when you enter the password it hangs there until it finishes copying. Once you are done, you can log on to the the office computer remotely using ssh to check for the music.

ssh <user>@<ip-destination>

Once you are there on the remote computer you can check whether copying is in progress by doing ls.

ls
du -sh ~/Desktop/<path_to_directory_of_music>

The second command above gives the size in human readable format, like in mb and gb. So once rsync is done what I wanted to do was to get the all the mp3 files into one folder on my office computer. So from the remote shell I ran this command.

find . \( -name "*.m4a" -o -name "*.m4p" -o -name "*.mp3" \) -exec mv {} <path_to_desired_folder> \;
du -sh <path_to_the_desired_folder>
ls -l | wc -l

The first line finds all the .mp3, .m4a and .m4p songs and moves them to the desired folder. The next command tells you the size of the folder containing copied songs. Now you should see all the songs copied into that folder. It's just one folder. That's it. The third command tells you the number of songs you have by subtracting one from the number you see on the terminal.

The last thing you do is to add the songs from this folder to iTunes library. So now I have all my songs in iTunes on my office computer. I did it all this with two commands sitting at home. You can ask me how I added the songs to iTunes library sitting at home. I have used remote desktop to do that. I use chicken of vnc. Try it out. In the end I did everything in short time with out any hassles. Simple and effective. The lesson is learn Unix. I love Unix.

Cash from Google

Yep. I made little bit money through my videos on youtube. Isn't it awesome? I never made these videos with an intention of making money at all. For that matter I did't even expect good viewership. Surprisingly, lot of people liked my videos as not only they were helpful in replacing factory installed radios in Honda civic cars with aftermarket cd/blutooth receivers but also saved money for people. It costs at least $100 to $200 just for installation.

Anyway, over the time they got good number of views and Google offered me revenue through ads. Why not? After an year, last month Google paid me $112 as my earnings.

Now, these videos are making $20 a month. Which is pretty cool because I never expected money. I guess when you help people without expecting anything back it gets paid off. Dividends are always there for helping.

It's not that much money, but like someone said each penny helps. More over, I am it's an impetus for me to make some more helpful videos for people. It's worth it. Not because of the money but because of the appreciative comments you get from people. Soon I'll start making videos on maths, programming and unix. There is lot of stuff we can help withto people. I guess everyone needs help from everyone. I will post the links here right after making them. I guess this is the right time to invest in good video camera.

Sent from my phone.

Wednesday, March 30, 2011

Blood Donation Experience

I guess it's been almost a week since I wrote last time. Yeah, for the first time in my life I donated blood. Always wanted to do it though. During my engineering days I got one opportunity but blood group didn't match. For whatever reasons could never do it.

In my first year here in US I went to give blood after seeing an email request for blood donation. Funnily, I wasn't eligible as the rule says one should be here at least 3 years before donating. Crazily, after that 4 years passed and never got chance again.

Finally, yesterday I got another email with the same request. This time evrything went well and they took one pint of Manchu bloodline. After giving blood the one thing I absolutely didn't understand was the fear of some people about donating blood. Anyway, it was nothing. It took exactly 5 minutes for me to draw a pint of blood. By the way one pint is almost 500ml. If you don't know the amount of blood in human body would be around 6 liters.

People asked me whether I was feeling dizzy, etc. To be frank I didn't feel anything. Overall, it was very good expirience and for a good cause. I have decided to donate blood at least 4 times a year.

By the way, I forgot to add something. They give you some snacks along with some juice in case that helps. It seems in America 60 percent of the people are eligible to give blood, but only 2 percent donate. I guess it's social responsibility of everyone because in the end we are helping ourselves but not any other species. More over, there is no replacement for human blood and platelets.

Sent from my phone.

Wednesday, March 23, 2011

CC and BCC fields in Gmail

I'm not sure how many of you use these fields regularly when emailing people from Gmail. Being a user support specialist I got to use this very often.

I can always use the To field it self. But there is a purpose for CC and BCC fields. They stand for carbon copy and blind carbon copy respectively. To field is used for people who you intend to send. CC field is used to make other people understand you sent the email to the intended. For example, you can cc the emails to your boss to let him know that you are doing the duty. BCC is used when you don't want the person to know whom else you are sharing the email with and hence blind.

Coming to the point, like I said a while back I need to cc the emails to my group when ever I answer users' questions. I always use Apple mail client as I work in Mac environment. Recently, my university switched to Gmail. I don't have MobileMe subscrption with Apple. Which means I can't synchronize my mail clients on office and home computers which is a big nuisance. It costs $99 for year to have this subscrption. In a way it was a blessing in disguise that university switched to Gmail. Since it is a web interface I don't have to worry about synchronizing my laptop and desktop unless I want to store the emails for offline use. Even then it works but with some complicated setup which I will explain later.

In Apple mail CC field is always open. Where as in Gmail interface it's not. Which means I need to click everytime I want to cc the email to my different groups. I amsure you might be thinking what the heck. Right? Believe me you'd feel the same way if you are used to using keyboard all the time. You can do things fast if you are used to keyboard. So I wanted to have my Gmail compose window open up with cc field open whenever I want to write a new email or reply people. Fair enough. Unfortunately, it's not easy. Since Iike using keyboard I opyed for keyboard shortcuts in settings. Then if you press d the compose window opens up with cc field open. Great! But this shortcut doesn't work when you want to to reply to some email that's been there inyour inbox. Frustrating.

The next solution would be using some javascript. It's a nice solution since Gmail heavily uses javascript it is highly customizable. So before I started writing my own script with my not so co siderable javascript experience I wanted to google for it. First thing that came up was the solution I wanted. How exciting. Ha! Except that itdoesn't work with new Gmail user interface. So now I am determined to write it onmy own. I don't know how long it's going to take as I'vegot million things to do at my work.

I will definitely post it here as soon as I finish it. In the mean time I got to get off the bus before it goes beyond my place. Home sweet home.

Sent from my phone.

PATH's response

Yesterday I sent an email to PATH managememt about path cars not showing the time change. I was very surprised to see the prompt response. They wrote they had a software glitch because of which time change never updated. Fair enough as I can see that happening. Few years back time change used to be on the exact date all the time. Not anymore. Now it moves a week or two depending on some weather factors. I guess their software wasn't ready for that. Sounds silly but I do see a lot like this.

Anyway, they said they had been trying to change time manually. Even then it shouldn't have taken more than a week. At least, I am glad that they know the problem and accepted it and trying to fix it. That's what I call professionalism at work. They asked me to send the car numbers if I didn't see the time update. I will I see one. The coach I got off just now was showing right time. Over all felt great.

Sent from my phone.

PBS Script Generator: Interdependent dropdown/select menus in Javascript

PBS SCRIPT GENERATOR
SH/BASH TCSH/CSH
Begin End Abort

About Me

LA, CA, United States
Here I write about the battles that have been going on in my mind. It's pretty much a scribble.

Sreedhar Manchu

Sreedhar Manchu
Higher Education: Not a simple life anymore