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.

Monday, January 26, 2009

Sexual Abuse in Jewish Communities (Boropark, Williamsburg)

Shared by someone who was abused themselves and struggles now in their life. I though this should be shared for as much as possible.

However, prior to watching these videos, please take your time and read this comment as a disclaimer

(Part 1) Protecting those who advocate for Jewish Survivors of Child Sexual Abuse - Rabbi Nochem Rosenberg



(Part 2) Protecting those who advocate for Jewish Survivors of Child Sexual Abuse - Rabbi Nochem Rosenberg



(Part 3) Protecting those who advocate for Jewish Survivors of Child Sexual Abuse - Rabbi Nochem Rosenberg



Part 1: Rabbi Nochem Rosenberg Update - January 11, 2009




Part 2: Problems in Advocating For Sexually Abused Children in Brooklyn (Update: 01/11/2009)


Part 3: Fighting Against Sexual Abuse in the Orthodox World of Brooklyn (Update: 01/11/2009)


Part 4: Witness Tampering - Sexual Abuse in the Jewish Community (Update: 01/11/2009)


Part 5: Jewish Sex Offenders and Prison (Update 01/11/2009)


(Part 6) Discusses A 14-Year Old Girl who was Sexually Assaulted (Update 01/-11-2009)


Part 7 - Educating Children about Sexual Abuse - Rabbi Nochem Rosenberg (Update: 01/11/2009)


Part 8: Changes needed to end sexual abuse in Borough Park and WIlliamsburg (01-11-2009)

Sunday, January 25, 2009

Shidduch mistakes (updated on 20090527)

Updates:
  • Added links to two more articles
  • Added Chanie's recommendations from comments to the post
  • 2009/01/29 - added a link to Bad4's post
  • 2009/05/27 - added a link to another Bad4's post
There's a day for everyone when they go for the first shidduch date. Some take it easy, others get very nervous. I was pretty nervous not to f/up something. We all tried to find out from our more experienced friends how to act, where to go, what to say, what to ask, what not to ask...

Anyway we end up doing some mistakes that other just couldn't predict to inform us beforehand.

I didn't happen to go on many shidduch dates yet, but I made my mistakes and I noticed some mistakes that girls did.

Here's my list - it contains my mistakes, things I noticed from girls I dated and my friends' experiences:
  • Do not talk too much, let girl talk. This requires some strong self control, but this is a very good habit for any situation.
  • Do not talk over the phone - discuss everything on dates - this gives you more topics to talk about so that you will never sit and look at each other trying to find next topic.
  • Do not go shopping right before date - if you happen to go anywhere these bags may make troubles for you, also you'll be exhausted and tired and will not look as impressive as you want.
  • Remember about time - first date shouldn't be longer than 1,5 - 2 hours (probably my biggest mistake so far) - what if a girl would graze her foot and will be feeling her less impressing (or whatever word is better here) - never forget about your 'partner'. Also, what if he/she doesn't like you from the first time but hesitates to show that by rushing to finish as soon as possible?
  • Date after full work day is not a good case either, especially if it's a first date - tired person would not look attractive nor will be able to concentrate well.
  • Be dressed properly. Imagine you're going to meet with your future boss of some company in Manhattan - would you come in jeans and wrinkled and emitted (released?) shirt or in some old t-shirt? So why wouldn't you take a person you go on date with at least same level of appreciation?
  • Have a back up plan - what if the place you go to will get closed or will be packed with no place to sit? What if a girl will be late on her bus to Lakewood? What if she's flaishiks and you're going to a dairy place? Or vegetarian? Just be prepared...
  • Do not show if you don't like girl/guy you with. Just try to politely finish date faster, but don't just tell it in face. I also heard of guys seeing a girl from another corner, thinking that they don't like her and just disappearing! Remember that she also spent her time, so be nice and don't let her stand there with stupid look for another hour thinking you're late or she messed up with place you were supposed to meet at.
  • Be on time. This never hurt anyone, however making someone to wait for you is not nice and is a first item in the list against you. This is more for guys than for girls though.
Chanie added some recommendations in the comments:
  • If you're a brilliant girl, don't show it on the first date. It turns guys off.
  • Don't make dirty jokes on any date- it's inappropriate.
  • Don't tell the guy/girl that they're not the weirdest, craziest person in the world. Some will get insulted.
Did you get something to add? It'll be cool if you post in your blog and then we'll all interlink to all posts on this topic. By that we may be able to prevent future mistakes and help other who only start.

Useful posts by other authors: