Thursday, April 2, 2009

Madness in March - recap

Since I didn't get much of time to post during March I've thought I'll write at least recap of what happened during it.

There's no particular order.

For me March started from fast dating session. I don't know if I appreciate integrating of modern non-Jewish concepts into something that is at least a tradition which proved itself many times but since it was organized by a rabby whom I know I decided I'd go. Especially after turning down another offer with out even wondering about details...
I knew most of people there would be much older than me but I let it to be just a fun time spending. It turned out I knew like 7 or 8 from 15 girls there. I knew age of about 12 of them. I marked three girls just to have someone marked there but I didn't mark one girl I was thinking of cuz I assumed she's older than me. It turned out she was younger and she marked me. I didn't push anything forward after that so I've never went out with her though. I still think I need someone stronger than I and MO just won't work for me.

Next there was Purim. I don't like people getting drunk anytime but that's something that bothers me especially every Purim. I feel depressed and antisocial. I try to avoid places where people drink. I just don't believe they yoitze in most cases but I think they just get drunk because it's another reason to.

March 13 is always marked for me as my older brother's birthday, but also I have one tradition on this day for past 5 years - I start saying my upcoming age. For example officially I'm 20 until June but I already say 21.

I've got a new Twitter account - follow me at @btslowly

Last two weeks were a mental disaster - besides regular antisocial feeling I felt like I just can't talk to anyone - none would agree and everything would go wrong. Except for work stuff - that just goes on and I never have anything to complain about.
Someone actually was able to calm me down by just having a conversation online and I'm still very thankful to that person!

Regarding work - one of our devs quit in the first days of March and I'm now one on one with my head of department in our room :). We actually have one more full-time guy in Canada (he more there recently) and we now have first outsourced freelancer from Argentina. Cool guy. I've got bunch of extra stuff to take care of but he helped me a lot. I think I f'ed up seriously only once but not delivering project on due date which I set myself. That went far to top bosses but seems like it wasn't a disaster (I hope).

One of my friends finally finished his long road of giur! I am very happy for him!! Beizrat Hashem after Peisach he goes to yeshiva!

Unfortunately, my other friend's mother in law passed away in a very young age - she wasn't even 50 yet. Boruch Dayan Emes.

Over past 5 weeks I've met 3 non-native Russian speakers. Usually it's a rare thing to meet one person who'd all of a sudden would start learning Russian... I understand people learn French, Spanish, Japanese but Russian? Wth do you need it for?
So one of them somehow end up learning in Russian university for a semester or so. Second guy is my new colleague from Argentina - he learned Russian for 4 years just to know it. Third is a girl from frum blogosphere. She refused to tell neither openly nor in a private conversation how she end up knowing Russian but I'll leave it up to her.

This is a second post I wrote on my iPhone - kinda big deal because I often have things to day based on emotions (good or bad) and it's very important to write them down right away or they'll loose that taste which drives to write it down. That's how I didn't post like about 5 posts in March. May be it's good for some of them though...

Btw, iPhone!
First of all I've got new headphones for it Apple in-ear ones. They say these headphones incompatible with iPhone. Here's why: first of all they've got additional controls for volume which iPhone doesn't support. Second is that microphone is facing back so it doesn't catch voice as good as it's supposed to. I understand that they were trying to make controls more useful since you don't need mic for iPod 99% of time.
Another tidbit of the month is iPhone OS 3.0 - looks very promising because of copy/paste, full Bluetooth support, MMS (do you ever use them??), search and tethering. The last one does not mean we'll get it right after 3.0 is released but it's a big promise!
One advice - if you plan on buying iPhone hold until June and buy a new one for obvious reasons.

I might have forgotten something but this is most of notable stuff.

Friday, March 27, 2009

At the lowest peak of emotions...

It is all about depression and apathy. When there's no interests and no goals. When it's all about being alone and music in the ears.

When it's all about finishing daily work and there's nothing after, just back home (without any will) and next day back to work.

When nothing is cared about, not even money wasted or broken items at home that noons else would care about.

When you keep things to yourself and just silently fail instead if showing your anger. You just stop asking about something when you realize people can't do it easy even if you really need it.

When it's about getting to work at the last minute because there's nothing at night to leave earlier. When there are 5 days a week that don't differ from each other.

When it's all about constant analyzing what's going on, realizing certain things but not taking steps to fix them.

When playlist in the iPhone didn't change for almost six month and it's little bit more than 2100 songs playing morning to evening 5 days a week.

When it's about to refuse shidduchim realizing strange things why I am not good for shidduchim and why no normal girl would deal with me and when it doesn't have to do anything with money.

Then it means there's no motivation to change anything in mylife.

I don't like to complain usually, this is just emotional post, otherwise I would never post it anywhere.

Thursday, February 26, 2009

Siddur for Blackberry Storm

This one is going to be short.

My friend recently asked me to help find Siddur for his new Blackberry Storm (he got it at work).

I am not familiar with Blackberry so I will just dump my findings:

First you may need to set up/fix Hebrew on Storm: http://cheservices.com/blackberry/

Resource 1:
It includes: Chumash, Tehillim, Rambam, Siddur, Targum, Mishnayos, Gemara / Talmud, Shulchan Aruch and much more for your BlackBerry.

Check out the instructions and desktop installation files at this link:
http://www.jewishcontent.org/pda/blackberry/

The installation files are also available OTA from your BlackBerry at:
http://www.jewishcontent.org/pda/blackberry/ota.html

PS. it's interesting to see how nusach Ari goes on the first place and Ashkenaz goes last one after three others...

Resource 2:
ASiddur is a siddur written in J2ME. This allows it to be used on many cell phones, Blackberries, Palm and Windows Mobile PDAs (with some extra software installed). When development is finished, ASiddur will be able to infer the correct text of each tefilla based on the date.

Homepage: http://mysite.verizon.net/asiddur/asiddur.html
Download: http://code.google.com/p/asiddur/ (you will want a development version since it has scrolling fixed for Storm)

Monday, February 23, 2009

Translate and format phone number with PHP

Prior to writing some function that I plan reusing in couple of different places I often do a research at how other people solve my problem. Sometimes it saves time by giving an easily modifiable and customizable piece of code, sometimes shows how not to do, sometimes just lets me know where my personal solution would've failed and how to fix it.
Also my memory is not very good so I often forget functions I rarely use or haven't used at all but read it's docs.

This one got me really frustrated that most of solutions I've seen within first 3 or 4 pages on Google and with couple of different search queries (all together I saw over 50 solutions including identical) were written in a very long form, which did not add functionality to the code but even made it more limited for different variations of phone number 'spelling'.

In USA phone number can be at least written in these forms and there will be many other ways that I didn't think off (why am I supposed to think of every way phone number could be spelled if I am writing a universal function??):

+1 (800) 282-8623
800.282.8623
(800) 282 - 8623
1.800.CUCUMBER

May be I was searching wrong but I didn't find a short all in one universal solution. I didn't find a solution that would be shorter than mine. But main thing that I didn't find was converting branded phone number (i.e. 1800flowers.com) to it's numeric representation. Obviously I knew I can do it with a simple enough RegEx but I hoped I will see how other people do it.

So here's what I've got in the first place:

function _format_phone ($phone) {
$regex = array('/[^0-9A-Z]/i','/[ABC]/i','/[DEF]/i','/[GHI]/i','/[JKL]/i','/[MNO]/i','/[PQRS]/i','/[TUV]/i','/[WXYZ]/i');
$replace = array('',2,3,4,5,6,7,8,9);
$new_phone = preg_replace($regex,$replace,$phone);
if (preg_match("/^[1]?[2-9][0-8]\d[2-9]\d{2}\d{4}\d*$/",$new_phone)) {
return preg_replace("/^[1]?([2-9][0-8]\d)([2-9]\d{2})(\d{4})([0-9]*)$/", "$1-$2-$3", $new_phone);
} else {
return $phone;
}
}
OR:
function _format_phone ($phone) {
$new_phone = preg_replace('/[^0-9A-Z]/i','',$phone);
$new_phone = strtr($phone,'abcdefghijklmnopqrstuvwxyz','22233344455566677778889999');
if (preg_match("/^[1]?[2-9][0-8]\d[2-9]\d{2}\d{4}\d*$/",$new_phone)) {
return preg_replace("/^[1]?([2-9][0-8]\d)([2-9]\d{2})(\d{4})([0-9]*)$/", "$1-$2-$3", $new_phone);
} else {
return $phone;
}
}
Well, after bashing other solutions I accept that my solution is not ideal either. At least I'm concerned about IF statement containing check for RegEx while using preg_replace() twice. However I think it's much more functional and shorter than many others at the same time. At least in 7-8 lines it provides more functionality:
  • Cleanup all formatting characters
  • Translate letters to numbers
  • Format phone number to desired standard (very customizable)
  • Fail silently by returning original phone number if something went wrong

TinyURL with one line of PHP? Easy!

Everyday we learn something new. For programmers it's especially important so that we don't sour and stink like a month-old milk.

Yesterday I was looking for a better (read cleverer) solutions to build a TinyURL analog. Everyone find his own need to build such a service, I needed it to be able to share URLs in SMS (text messages), track usage and statistics and be independent from 3rd party solutions such as bit.ly (one rule I learned at my job - you can't rely on anyone - even google may go down while you're up and your service should not be interrupted).

So saying that much I'm pushing away the solution which is really one line of PHP! To convert URL to it's short representation you need:
$short_url = base_convert($url_id, 10, 36);
To convert short URL to it's original you will need:
$url_id = base_convert($short_url, 36, 10);
This will return a numeric id of the long URL stored in the DB with following structure:
CREATE TABLE `urls` (
`id` int(11) NOT NULL auto_increment,
`url` text NOT NULL,
PRIMARY KEY (`id`)
);
Obviously you will need little bit more lines of code to provide some type of interface for your application, but it's main part is done by magic of base_convert() function which converts regular decimal number (base 10) to base 36 which uses letters of English alphabet as additional digits.

And if you are so lazy that you can't even think about writing your own application utilizing provided function or you trully believe in Open Source - I also found a full listing of such application for you.

Just to break the silence

Unfortunately these days are pretty busy and I can't find a good moment to bring my thoughts in a right order and dump them here.

Anyways here's a short recap of past three weeks:
  • Week of Shabbos B'shalach:
    • My friend got a mouse. Real one. She waited for it for a while and sounded happy!
    • I finally happened to get out of town!!!! After a year or even more... Went to Perth Amboy and enjoyed it very much. Will use next opportunity to go there again!
    • Going to Perth Amboy involved taking train (not the subway) and this is something that I enjoy from only one thought about it. Almost missed my stop 2 hours before Shabbos...
    • Watched Coraline. Enjoyed. And had a thought that if we were looking for some new trend happening around us (like radio, phones, TVs, PCs and cell phones in XX century) then Coraline is definitely part of it. You would ask how? There's a new trend of movies coming which is made cartoonish but not for kids. And 9 will prove my theory [although I am linking to it's preview you'd better to watch it in the movie theater to get better emotions about it]. And one of the better sides of this very new trend is that it's not centered on scenes with sex which every regular movie today is just a must have. Tiring...
    • My mom went to Israel for the first time in her life!!!
  • Week of Shabbos Yisro:
    • Can't recall anything significant now
    • Found this video and find it amazing!
  • Week of Shabbos Mishpatim
    • Second OT! This time to Monsey. Went with my friend. Went to two families for seudos and both of them were great. Gave us (at least me) a lot of good emotions.
    • On motzey Shabbos we went to: New Square (Rebbe's Tish), Schmuz at Ohr Samayach (this one I enjoyed a lot) and Kiryas Joel (however we came there at 11 and didn't know where to go; we asked some chossid if there's any place to eat and he said probably everything is closed; so we didn't really see the town)
So that was a short recap of my social part of life. Now I'm planning to post one or two technical posts on my recent findings.

Sunday, February 15, 2009

BTS's view and reply on “Goyish” Music, TV, and Movies by Babysitter

This was supposed to be a simple comment on Babysitter's post, but at some point I realized it's to big for a regular comment and is good enough to posted as a reply in my blog. Especially after I didn't write here for a long time it was a good chance to fix this issue.

So Babysitter was writing about her views on non-jewish music, movies and TV. She's an FFB (not to hurt any one's feelings) and I wanted to add my 2 cents as BT.

So here's a copy of my reply:

Music

From a BT point I'm more accustomed to non-jewish music. I should bring that at the age of 3 I knew AC/DC is playing on radio from first to second accords. Don't remember this myself but my brother recently told me this.

Anyway I think for the amount of non jewish music I listen to compared to jewish one I have more against jewish. Here are my points:

1) I hate these modern remixes of non-jewish music where new words were put up to make it sound jewish. It cuts my ears since I knew all this stuff in original. I know that our old Rabbeim used to take non-jewish music and that's how we have lots of nigunim today, but I would not compare Rabbeim of 200 years ago to people who of today's who try to kosher non-jewish stuff to make it appropriate for less modern masses. At some point I dreamed of finding some heavy metal styled jewish music but later I changed my point to "if you say that's tuma don't put it in a kosher pot". Though, I still appreciate open use of guitars on Shwekey's CDs (take Wedding Album for example).

2) As I mentioned before I trust to Rabbeim of 200 years ago who didn't write any songs for money. Today it's not that clear so many "inspirational" just doesn't make a cut for me since I don't know who wrote this, what was on in his mind at that moment, what was in his blood at that point (rare cases I guess) and how much of tzadik his is for the words in the lyrics. So most modern stuff is cut off for me except of Just One Shabbos and couple of others.

3) [this is not anti-jewish reason] I listen to goyishe music for my entire life, I grew up on it and there were days when it helped me survive through my long lasting depression. Today it is something irregular to see me without headphones or have my music turned off, however today often music for me is just a wall around myself which lets me concentrate on things I'm doing and forget about things around; I often don't pay attention to what exactly plays in my ipod and what words are being sang. Plus I know most of music (not exactly lyrics) in my ipod by heart.

I happened to share these views with one girls I was on shidduch with and then she said no. It is something very personal and doesn't have to be always shared with others as I learned.

As of my kids - I really don't want them to listen to crap I listen to so I understand at some point I will have to sacrifice most time of listening to it for my kids not take example of me.

TV

Can't say anything particular about TV, since I didn't watch TV much after I got PC at 13 so can't say much. If this is allowed to kids it has to be explicitly monitored as there's less of safe stuff on TV today than things that just dump tons of spoiling dirt on people watching it. I happen to come to my friends house sometimes and she always has TV on so I can catch some things going on there.

Movies

Movies. Should be judged on per item basis. What I learned is that movies for teens dirtier than any movies for adults. Seriously. Adult movies usually concentrated more on certain idea than bed scenes and such stuff.

For example I have a friend who is also FFB but comes from a russian BT family which is probably not as strict as pure muli-generational FFB families. She goes to movies and Broadway shows sometimes.  She has a personal view on many things and more into serious stuff than into teenagers' interests. She loves Johny Depp, Alan Rickman, Adrien Brody and many other charismatic characters.
So looking at her I can't say she's got spoiled anyhow by movies she watched.

Don't think I was spoiled much by movies either, although I for sure watched less movies than her. I watched American Beauty when I was about 13 and re-watched it recently, watched couple of American Pies about 5 or 7 years ago. That didn't add much to my spoilness either.
Yes, I should admit I was more opened to many things that happen in a non-frum world during my teen age than most of FFB boys and girls, but if they watch movies except of type of mentioned here and in the Babysitter's post I don't believe there will be lots of harm.