Archive for the ‘Uncategorized’ Category

The Night

March 14, 2009

BMO, Hands, Yani, Food, Washroom, Miracle, AmrAl, Tim Hortons, Chat, PrzChb, No 6, Couple, Sunrise, What?!, Lew, Tiny , Bawsh, Lew, Sunset, What?!,  Lew,  Lew, Lew …

Omar Khayyam

Omar Khayyam

Lame, Bash script programming

October 19, 2008

About 2 weeks ago I bought a San disk Sansa Clip[official, any thing but ipod], $ GB. sorry I forgot to tell you about that. Anyway, I want to listen to Podcasts and Audio books which I usually download Elllo, Grammar Girl, and Just Vocabulary. The problem was that these podcasts have a lot of small mp3 files, something in the order of 500. So keeping track of last file which you have listened to is really hard. I am not sure what is the solution in more advance players like ipod touch or Creative Zen, but the solution which I found for my player was to concatenate all files (or at least each 50 or 100 files) together. Because Sansa Clip has a feature that can resume playing podcasts and audio books so my solution was fine.

I search the internet and I found out that a way for concatenating the mp3 files is to use cat file in Linux like this:

cat *.mp3 > allCont.mp3

This command will help you if all the files which you are concatenating have similar structure. By Structure I mean sampling rate and number of channels. That is because when they are concatenating all of them will share a same header file. Still it doesn’t seem to be be big problem, if I can find a program which can change sampling rate and number of channels of mp3 file in batch mode then I will be fine.

I searched again, yes! There is a program called lame[official, wiki] which can does anything you want by mp3 files. Really neat program which is open source and can be compiled easily both in Linux and Windows. You can even do more things like changing raw PCM and wav file into mp3 files. It also supports variable bit rate (VBR) which means in the parts of file where there is more high frequencies it will use higher sampling rate to preserve the quality and in the silent parts it will use lower sampling rate to achieve higher compression. This was the best documentation I found about lame. So again a simple command will change the file:

lame -b 32 -mm FileName.mp3 FileName_DS_32.mp3

Which means FileName.mp3 will be downsampled (DS) to 32 kbps and will have just only one channel(mono instead of stereo). The output file will be FileName_DS_32.mp3 .

Every thing was fine up to this stage, I did all of them in 1-2 hours, searching and installing lame on both linux and Mac os. The problem started when I tried to find a bash script which can be used to do the same thing to all files in a folder. I am not going to be offensive but I think about 90% of people on the Internet who speak like “Linux Nerds” do not know anything about computers. They just copy a piece of code from one forum to another without understanding. I tried 3 or 4 different ones, but none of them worked. So I decided to learn bash programming by myself and then write it, I started about 1:30 am, crazy ha?! Anyway here is the result:

#!/bin/bash
for inp in *.mp3; do
    #inp  : input file name with extension (.mp3)
    #tmp1 : all blanks ' ' are replaced by '_'
    #tmp2 : without extention, just file name
    #out  : output file name, which is (inp_DS_32.mp3), you can modify it as you wish (DS: DownSample)

    #In order to see these varables add an statement like this
    #echo $tmp2
    tmp1=${inp//' '/'_'}
    tmp2=${tmp1%.mp3}
    out="${tmp2}_DS_32.mp3"

    lame -b 32 -mm "$inp" $out
done

mkdir downSample
mv *_DS_32.mp3 downSample
cd downSample
cat *.mp3 > concatenate.mp3

Main part of this code is the for loop which will be run one time for each file. Input file name in changed in order to get rid of blank spaces in it. For example if input name is “557 File Name.mp3″ then variable tmp1 will be “557_File_Name.mp3″. Then we should get rid of file extension (.mp3), because we want to add _DS_32 to the end of file name. This step is done by help of tmp2 variable which will be “557_File_Name” . Finally output file name will be in the out variable which in the case of our example will be “557_File_Name_DS_32.mp3″. At the last step lame is called by its appropriate arguments, input, and output file names. To write this bash script I used these sources Bash Guid for Beginners and Advance Bash Scripting Guide. I also found this document very useful, bash pitfalls.

After for loop, I simply make a new directory called downSample and then move (cut/past) all new files into that folder. Then as I said cat is used to find concatenate new files together. Just change the ID3 tags of this file (simply in iTunes) and then copy it into your Sansa Clip. Don’t forget to enjoy it.

Size of resulted files are really interesting in comparison of original ones. The only one which doesn’t have problems in the mp3 files was JustVocabulary, so I compare its sizes. I downloaded 258 files when I subscribed to this podcast through the iTunes store. All the files are recorded in two channels with 96 kbps bit rate. When I concatenate all of them together the result size is 1.29 GB, practically one third of my player capacity. When I change them to one channel and 32 kbps then size of concatenated file is 283 MB. Amazing, ha? And you know I haven’t lost any quality, because these file generally contain voice, and basically if there is any music I don’t care about it quality. I guess I deserve a thumbs up :D

Hiking, Camping, Backpacking HELP

October 15, 2008

This weekend I went to a snowshoeing trip with our university outdoor club. However there was no snow for snowshoeing, I enjoyed the hiking part. There 9 men and a woman in group who amongst them 7 of them were professional hikers. Because of that moving with them was a little bit hard for me, especially with a 30 kilogram backpack. Beside their fitter body in comparison to mine, they have a lot of gears which make their life very easy. Before the trip I hadn’t enough time to search the internet for some information about cloth, gear, and food for trip. I belief if I’d tried I would find very good resources. In this post I am going to write down my experiences which may be useful for other beginners who will go for a trip like me. Before I start, I should mention MEC for Canadians. The easiest way to prepare for a trip is to go MEC, find a helpful seller (all of them are outdoor experts) and ask him/her to help you with the trip. In the following I am assuming that you’re going to stay out for at least one night. The most important thing about all gears and clothes is their weight, because you are going to carry them for a long time. First I am going to start with necessary gears:

  • Backpack: You need a backpack to carry your stuff. Because you will carry every necessary thing for life during the whole trip (amazing, ha?!), so its size depends on the trip length. If you are going to go somewhere by car and stay for a while and then start hiking, then you can have an extra bag for that period. In the following by hiking I mean the period that you leave the car and you will come back to it, during this time the only thing you will have is your backpack.
  • Tent: To be protected from wind, rain, and snow you need a tent. It will be very good to share it with one or two other persons, because its weight will be shared.
  • Sleeping bag, sleeping mat (pad): Sleeping bags are made for different temperatures ranges from -30 to 0. Made for colder weather, thicker, and more heavier sleeping bag would be. So based on the time of the trip in the year and weather prediction, try to choose one which fits to your needs well.
  • Wool shirt: When you are doing an exrecise like hiking, biking, or skiing you need something breathable. For this purpose cotton is the worst choice because gets wet easy by your sweat and does not get dry easily. The thing that professionals suggest is Merino Wool. I didn’t have one of those shirts, but I saw other ones with those shirts. They are really comfortable, believe me. Here you can read about its features.
  • Hat: You’ll need one, even if you are going to hiking in the middle of summer. Hats are used to regulate your body temperature. According to those experts, 90% of body heats leaks from our head. So whenever you feel cold you should cover it with you hat, and when you feel warm you should remove it. piece of cake!
  • Glove/Mitt: If the weather is going to be cold and windy, having a wind-proof and/or water-proof glove will be really handy. I personally don’t like mitt because I feel like unable to do anything with my fingers, but if you don’t feel like that try mitt. They are better because all finger’s heat will be gather together and make the warm. Even if it is not going to be cold, gloves will prevent scratches on your hand if you fall.
  • Headlamp: If you are going to stay for night, and you don’t have a headlamp, then even don’t think about trip. It is the silliest thing to think about headlamp as a luxury, unnecessary thing. I’ve had that though, and then I found out that it was ridiculous.
  • Wind-proof coat/pants: They are really pleasant when you will finish hiking and want to waer something to make you feel warm. Even in the short breaks through the way, when you body is wet by your sweat, they are helpful.
  • Long John: Anything else like a pair of tight thin pants is useful to keep you warm.
  • Water bottle: You need at least 1 liter of water for each hour of intense hiking. So if there is no crick on your way, or you don’t like to drink crick water you should have enough water with you. Water should be easy to access, so some people use water bags (hydration systems) which has a long pipe and a bag. Bag should be in the top of backpack, and pipe is used for drinking.

In another post I will talk about food. Here is the best shot I got during this trip, enjoy it

Littlehorn

Littlehorn

Boy’s summer camp

August 26, 2008

Two weeks ago I went to a boy’s summer camp as a volunteer to help them. Actually one of my friends, Jake, has been going there for three years and this year he also brought me to there. I was there for two days, it was fun. Camp was beside a lake near the Red Deer river in the south west of Sunder.

During the time which I was there a lot of things reminded me a chapter of a book which I read about three years ago. The book’s name is Funny in Farsi, it is been written by a woman who has spend her childhood in USA as an emigrant. She has an incredible story telling ability and a very funny sense of hummers in her writings. Those make Firoozeh Dumas’s books really interesting and amusing. I am wondering that weather her books are also interesting for people not from her home country or it is just wonderful for readers familiar with that culture. I will be really happy if somebody help me with that, although I am going to ask my “foreign”friends to read it.

Anyway, being in the camp and remembering a chapter of her book about her awful experience in the summer camp made me to read that book for the second time, this time in the original language. I really enjoy it, sometimes which I am sad, and coincidentally in these weeks I almost always am, it cheers me up. Every night when I start reading, at the beginning I think that I am not in its mood, but after 10 minuets I found myself laughing loudly!!!

I will write a full post about both of her books, Funny in Farsi and Laughing without an accent when I read them. Meanwhile take a look at her website and watch this interview:

Security move out

April 12, 2008

Finally I finished copy/past of my previous posts. Actually tonight I realized that I have a big security hole which may cause serious problems in the future. So I decided to move out from blogger and come to here. All of previous posts have a date in the parenthesis which are their real date.

Because this post is technically my first post on wordpress so nice to meet you buddy

Youtube Account

April 12, 2008

I set up my YouTube account, you can find it here. The first uploaded video is 2008 Countdown, here is the video

(1/1/08)

First Post of 2008

April 12, 2008

Happy new year every one,
Me and some of my friends celebrate the new year in the Churchill square. First we went to an Italian restaurant and eat dinner. Then we got to the churchill square around 11:15 pm . There were a lot of people there. They performed some live music and then when we approached to the 12:00 they start counting down. Finally there were an amazing firework show there. It longs about 15 minuets. I took some pictures from that show using my Nikon P5100, here is the best one

  • Scene Mode : Firework show
  • Shutter speed: 4 second
  • Aperture: f 2.7 (max)
  • ISO: 64
  • Flash: off

I took it using the automatic setting of Scene Mode. There is an option in this mode naming Firework show, I chose this scene mode to take this picture. The camera sets the parameters and you just press the shutter-release button, even an amateur like me can take such amazing photos ;) I also use the night landscape and night portrait options to take photos. The following picture is taken by night landscape option. I like to name it people who watch firework show.

  • Scene Mode : Night Landscape
  • Shutter speed: 1/4 second
  • Aperture: f 2.7 (max)
  • ISO: 400
  • Flash: off

As it can be seen there is noticeable noise in the picture caused by high ISO value (400). I took the Fixed range Auto 64-400 option for ISO sensitivity parameter to avoid higher values of ISO. However this option works only in the manual modes (M, A, S, P). In the other shots I will choose 64-200 range to avoid this problem. And here is a shot by Night Portrait option:

  • Scene Mode : Night Portrait
  • Shutter speed: 1/9 second
  • Aperture: f 2.7 (max)
  • ISO: 400
  • Flash: on

Just ignore the bear-like face and think about the picture quality. The foreground is clearly distinct from background. I like this kind of pictures, they seems to be made by photoshop by they are real. Also note that foreground which is illuminated better than background (because of flash light) has less noise. So again you can take beautiful shots using this simple option. But you should be aware of Auto Focus because if you have not correct Auto Focus then you will take such a blurred photo

  • Scene Mode : Night Portrait
  • Shutter speed: 0.0704 second
  • Aperture: f 2.7 (max)
  • ISO: 400
  • Flash: on

It is clear that in this image focus is not on the foreground (bear-like person). So it become a little burred and the best feature of this photo is destroied because of this problem.

OK, it was my new year celebration for 2008. You may now think that what a bad nerd I am! I did not talk even one word about anything else, just photography. OK, you are right. I did not talk and now I am going to about other issues. There was a beautiful firework show in the Churchill square, you saw 4 photos from that huge event above and you can see more here.

Nothing more, happy new year (Maybe I am really a nerd ;)

(1/1/08)

The First Post

April 12, 2008

Hi,
My name is Saman, I am an abroad graduate student. I am trying to improve my English language skills, so I decide to make this blog. I am going to write my daily notes here in English. So my main goal of writing here is to practice and learn English, as the name of blog suggests “Just For Train”. Beside training, I will be happy if I find out somebody is addicted to my blog!
I appreciate any kind of comments, specially the ones which reminds some of my mistakes related to using the English language. Also feel free to shout me your feelings about my thoughts.

With the Best Regards