Saturday, December 29, 2007

Tuesday, December 25, 2007

2 + 2 = 1

One of my friends was, to put it mildly, quiet upset today. He received a cell phone bill for, drum roll please, $400. I knew that he recently switched carriers and got a new phone and thought that the high number was due to him buying the phone from the carrier and the carrier charging him for this month and next month, not an uncommon practice. Turns out it's his second month. Also turns out he likes to talk, a lot. He's got a 400 minute plan, subtract weekends, that's an average of 20 minutes per day. However, he's been spending an hour to an hour and a half per day! With that kind of usage, you can burn through your minutes in less than a week. What happens with the other 3 weeks? Thirty five cents per minute, at least 60 minutes per day for 15 days plus the $30 plan cost plus taxes, fees, charges, yep, that's $400.

Here's a lesson to all of you, it's 400 minutes per month, not 400 minutes per day. Take a calculator, divide your total minutes by 20, that's your daily allowance. And having rollover minutes only helps if you have minutes to roll over.

Monday, December 24, 2007

A fair trade

Every morning, Shlomik watches cartoons and drinks from his bottle while we both get ready to go outside. Yeah, I know, he's too old for a bottle, but it's less mess and the only safe way to change him. The trick though, is measuring out the juice so that he would finish by the time we leave.

Last Friday Shlomik still had half a bottle left and absolutely refused to give me the bottle, both at home and at the group. He ended up taking the bottle in with him. I forgot to tell my dad, who picks up every day, to make sure to get the bottle back and the bottle is probably gone. The same thing happened today. The bottle wasn't empty and Shlomik refused to give to me. I tried reasoning with him, telling him to put it on a box and it'll be there when he comes back in the evening, asking him for the bottle, telling him that it'll get lost if he bring it to the group. No dice. Then I had an epiphany. I offered him a trade, his bottle for a cookie. Success! He gave me the bottle and took the cookie. Ironically, instead of eating the cookie, he ended up holding it in his hand most of the time. When I reminded him about the cookie as we were walking, all he did was to just place it in his mouth.

Tuesday, December 18, 2007

Sixth Sense

I received an interesting email from a client. I made an online application for this client for managing a database of client and workers. There's 3 ways to find a worker, application number, name and url.

The email was from the manager and the problem that she was having is that she entered the wrong application number when she was entering a worker and if I could fix it. That was the email. No application number entered, no correct application number, no worker name and no url. The whole request was "I entered wrong application number, please change it." Well, I feel kinda flattered, she thinks I'm psychic. Then again, this is the same client that has personnel copy/pasting the page when I ask them for url and sending the url when I ask them to copy/paste the error on the page.

My favorite is alway the "it's not there" excuse.
"It's not there."
"Yes it is."
"No it's not."
"Read to me the options from the top."
"...oh, there it is!"
Do you read books? Newspapers? Then how come when you sit down in front of a computer you get tunnel vision and see nothing besides the 100x100 pixel square you're looking at at the moment?!

Saturday, December 15, 2007

Separation Anxiety

A guy from my shul wanted me to take a look at his computer. First, he wanted me to come to his house and look at it there, not gonna happen. Then we had a discussion about when he can come over and bring the computer. I suggested Sunday afternoon, he asked about Saturday night, I agreed.

The guy calls me Saturday evening, says he'll come in around an hour. Now have in mind that he knows I have a 2 year old son. He comes in 2 hours, calls me on my house phone even though I gave him my cell and specifically told him not to call my house phone. So at around 8:30PM this genius rings my doorbell, did I mention I have a 2 year old kid and incidentally, he has kids too so he should know better.

Now here's the kicker, he wants me to look at the computer right now, at 8:30PM while he stands and watches. I tell him, no way, not gonna happen and that he should leave the computer and come back Sunday. His repose is that he'll take the computer because he doesn't want to leave it and will come back Sunday afternoon. He knows me, I know him, for more than year, he doesn't want to leave it in my house. I tell him that I would have to run rootkit, malware and antivirus scans and that it would take up to 3 hours or more and that I will not be sitting there with him for those 3 hours no matter when he brings the computer. To demonstrate his great knowledge of computers he tells me that adaware takes 15 minutes to run. Yeah, sure, the minimal surface scan, good job. The meeting ends with me telling him that if he will not leave the computer today or tomorrow and will insist on sitting there and watching me, like I got nothing better to do, he can take the computer and not come back today or tomorrow.

Honestly, some people have no idea what a business is or how it's run. Sure, I can come to your house and sit there and fix your computer and then I'll give you bill for a couple hundred dollars. And where have you ever heard of a computer repair center that would let you sit there and watch over the tech's shoulder as he's working. On the other hand, maybe I should have told him that I'll come to his house, really hate house calls, and how much he's gonna have to pay me. Though the way he was acting, let him go to geek squad, he mentioned them in our conversation by the way, have them destroy his computer and charge him 3 times more. Maybe that'll be a learning experience for him, maybe not.

Tuesday, October 30, 2007

Поезд (Poezd)

Shlomik loves trains. Whenever he sees a train in a book, on TV or the above-ground subway, he points and happily says "Поезд!" (poezd, train in Russian). Every day, when I take him to day care, we pass under the Q train. That has quickly become the main attraction of our short walk. Starting from a block behind and until a block after, he's looking for the train and saying "поезд." If we're really lucky, there will be two trains passing at the same time and maybe another one in thirty seconds.

Shlomik's love of trains gave me a great idea, to take him to the New York Transit Museum. We realized that idea this Sunday. The museum is located underground and the entrance is made to look exactly like the subway entrance. The first floor houses the gift shop and the main part of the museum, including attractions for kids. The basement is a real train station with two trains on each side which are made up of different passenger cars from different years. One of the trains is terminated by a yellow work car on one end and a locomotive on the other. You can enter and walk around all of the cars, except for the locomotive. There's also a floor display of the drive system.

On the main floor, there are photographic and video presentations. There are decommissioned turn-styles, money counting machines, money changing machines, a control unit for raising and lowering a bridge, model trains and much more. For kids, there are interactive exhibits showing how different engines work, an exhibit letting kids "refuel" a bus, operational traffic lights and even an MTA trashcan which is topped by a fiberglass cover in case visitors decide it's a trashcan instead of an exhibit. The main attraction for kids are the front parts of two buses and and a train where a driver sits. They can sit in the driver's seat, spin the wheel, turn on and off lights and windshield wipers and flip switches and press buttons. Shlomik had a grand time pretending to drive a bus and a train.

On the way out, we visited the gift shop. The gift shop is surprisingly cheap and stocked with merchandise for both kids and adults. We bought Shlomik a metal locomotive, t-shirt, train whistle and a children's book about trains. Next to the store, Shlomik almost got into a fight with the museum's feline mascot. He loves cats and now he finally met a trained cat that didn't run away from him. He cornered the cat and one of them was about to go into offensive before we dragged him away.

We all enjoyed the trip. One part of the trip that I didn't at all enjoy, though, was dragging the big heavy carriage. They should really make the train and museums more carriage and wheelchair accessible.

Tuesday, October 2, 2007

At the zoo

This Sunday we went to Prospect Park Zoo. The main reason to go there on chol chamoed Sukkot is tashlich. There's a pond with fish in the World of Animals exhibit that's perfect for saying tashlich.

This time, we went with Shlomik. We went to the zoo a little late and didn't have enough time to see all of the exhibits. We did, however, have enough time to visits the red pandas, meerkats and the petting zoo. Shlomik absolutely loved the red pandas and was especially happy when one of them walked near the glass, right in front of him. The meerkats were also a great source of enjoyment for him.

The most hilarious part of the trip was at the petting zoo. Initially, Shlomik was very happy to get acquainted with the goat and the sheep. He was even trying to stick his hands inside, through the fence. The friendliness, however, quickly turned to displeasure over a very crucial item, food. My mother went to get some animal feed pellets and started feeding the sheep. Shlomik was very much enjoying the show and even wanted to feed them himself, or so we thought. After giving him a single pellet, he immediately attempted to put it in his mouth. After I snatched it away, he started acting as if the sheep were taking away his food. He started trying to hit my mother for feeding them and trying to hit them for eating his food. I think he was also saying no. From the side, it was very funny.

Inside, there was a cow and two llamas. The cow, Shlomik's favorite animal, was unfortunately too busy eating hay and was standing with her back to us. Trying to bribe her with animal feed didn't work. The llamas, on the other hand, were very happy to get their pellets. Shlomik was at first somewhat afraid of touching the llamas, but after I took his hand petted the llamas, he became brave enough to do it himself.

Altogether, it was a nice trip. We all enjoyed it very much and are planning on coming there again soon. First, I have to renew my membership online or at the aquarium. Unfortunately, no such option at the zoo.

Monday, August 27, 2007

UI Design: Pictures and Transitions

Last week, my brother-in-law sent me a link to a couple photos he posted on imageshack. After clicking on the link, I was treated to one of the worst photo sharing sites I have ever seen. There were three pictures setup as a slideshow. As each photo appeared, the slideshow application would zoom in on a random part of the picture. At the end of the zoom, there was a fade transition during which the next picture would appear and start to zoom in before it finished fading in. At no time was I able to view a full sized, stationary picture. There were no controls to pause the slideshow, navigate the pictures, make picture large size or view them in any normal fashion. ImageShack, you get an F-.

Most other photo sharing sites have a normal user interface that allows to view the pictures, instead showing off the programmer's "coolness." Some of these sites, however, have a very annoying feature. When you click on a thumbnail, the picture slowly enlarges. I find these transitions very annoying. It's a waste of time and only looks cool the first time, on the first site. The process of going from thumbnail to full picture, should have no delay, preload them in the background.

Online slideshows can have transitions, however, these must be fast. A fast fade or slide, as long as it doesn't waste time. Each picture should stay on the screen for a few seconds. Lastly, it's very important to include controls that allow the user to pause and to traverse the presentation forward and back. The internet is a big place, there's lots of things to see. Making users waste their time looking at your "cool" transitions in a fifty photo album should be a crime.

There is one place where transitions and viewing time can be slower. That place is digital photo frames. I have such a frame and leave it for Shabbat so that my family and my guests can look
at pictures of my son. Everybody is sitting, eating, drinking, relaxing, nobody is in a rush. This is the most appropriate place to have one to two second transitions and around five second pauses, allowing people to view the photos. The programmer must always remember, they're not there to show off their skills, they're these to make the user's experience as pleasant as possible.

Sunday, August 19, 2007

Free, as advetised

Last week I got a DS Lite. Because I was looking for bargains, I bought it separately from the game, Puzzle Quest: Challenge of the Warlords, that I wanted. The DS Lite arrived first, without a game. I knew this was going to happen and had in mind to ask my friend for some games. Unfortunately, by the time UPS brought the game, my friend was already leaving for work. I decided to see if I can do anything without any games. I went through the initial setup and found something curious, DS Download Play.

DS Download Play, as I read in the manual, is a service for downloading free content like demo games and movies to your DS Lite. What the manual failed to mention was the details. I clicked on DS Download Play and watched it trying to connect. Fruitlessly waited a couple of minutes. Deciding that the problem is my basement, I tried different location and event went outside. All for naught. I tried searching on Google and that's when I found out how deviously evil and ingenious Nintendo is. Turns out that though the service is free, and even though all other games require at most an internet connection, for you to use DS Download Play, you actually have to go to a store. The only way you can get free content for your DS, is if you go to a game store and download it there. This is a great marketing tool, forcing people to look at what's new and perhaps buy a game while they get their "free" stuff. Like I said, incredibly evil.

On a side note, I consider the fact that for 15 plus minutes, the DS showed a looking for software available for download message, is a major bug. The correct message would be "trying to establish connection." And the correct way of handling a lack of that connection is not to continue displaying that message, but rather to time out, perhaps, after 60 seconds and display an error message that connection could not be established. An even better solution would be to include instructions on how to use the feature, both in the error message and in the manual.

Sunday, August 12, 2007

No one's faster than USPS

When people hear "Government Employee" what they see in their mind is long lines and workers barely doing anything. I've seen DOT, on a daily basis, come to work at 10AM, leave at 4PM or 4:30PM and probably take at least an hour for lunch. I've seen five MTA workers install floor displays, where two of them were doing the work and the other three were standing and looking at what their co-workers were doing.

Today, I'd like to talk about the fastest of the city employees, the USPS package delivery. Yes, I did in fact say USPS. The Postal Office has lines whenever you come there and at least a 30 minute waiting period. When I needed to pick up a package, I tried coming there at 9AM, 10AM, 12PM, 2PM, etc. with the exactly same result. No matter when I came, there was a line and I had to wait for 30 minutes or more to get my package. You may ask, "now hold on, you just said that the USPS package delivery is the fastest of the city employees." You're right, I did say that. The problem is, their speed is in how fast they run from your door after ringing the bell.

I live in the basement and my door is not at the front of the house, but rather on the side and close to the back. Whenever I get a delivery from UPS or FedEx, I have ample time to walk upstairs and open the door. The delivery person is always there waiting for me. Not so with USPS. It seems that the USPS delivery guy, as a kid, used to be one of those pranksters who would ring your bell and run away. Unlike UPS and FedEx, when the delivery is from USPS, when I open my door the driver is either getting in the truck or driving away. It takes me 30 seconds to a minute to come to the door and as I mentioned before, my door is towards the back of the house. The only way that the delivery guy would have enough time to ring the bell and be in his truck by the time I get to the door is if he waited 5 or at most 10 seconds before leaving.

Next time you hear someone say that all government employees sit around and do nothing, you can confidently say that there's one exception, the USPS delivery guy.

Sunday, August 5, 2007

Lighthouse Pro and Web 0.20

One of the concepts associated with Web 2.0 is using AJAX to refresh data on a page, instead of refreshing the page. JavaScript is used to sort and filter the data and and load any changes. Today, I'd like to bring an example of how horribly wrong this can turn out when a developer has no understanding of what he's doing.

The company I work for uses Lighthouse Pro by Raymond Camden. Lighthouse Pro is an online bug tracking application written in ColdFusion. Before the move to Web 0.20, Lighthouse Pro suffered bad UI design and usability problems. One of the worst problems, and one which is still present, was that all notes got added to one very narrow textbox. The ideal way would be to use a separate table where each note would be a separate row with its own status, owner, attachment, etc. Why the notes were not implemented this way I have no idea, however, the complete lack of understanding of UI design is unacceptable. The notes textbox seems to be at default width and height making it unreadable. There are many other small annoyances. Two other problems I had with it is the 30 minute session timeout and filter settings being stored as session, instead of client, variables.

Recently, a new version of Lighthouse Pro was released. The planned move was to web 2.0, the result, web 0.20. As I mentioned earlier, filter settings were stored originally in session, now they're not being stored at all. Each time you open a bug and change status, you're brought back to the task list with all filters removed. I usually set 2 filters, one for status and one for owner. Now, I need to do that every freaking time I submit a change. Not only that, the current version of Lighthouse Pro shows bugs in reverse chronological order, so each time you loose your place and have to click through to wherever you were working. Besides the lack of persistent filters and page, the list is not actually updated live and requires a refresh to see any new bugs. The latest version not only doesn't improve the usability, but whatever usability there was is now gone completely.

If you're a developer and want to implement AJAX and web 2.0, remember, you're doing this not for bragging rights, but to improve usability of your product and to make the user's job easier. If you're adding AJAX to make your data sortable without refresh, make sure you're also using it to at least fetch data. If there's 5 filters and 10 sorts, make sure the user doesn't need to set them every time he does something. Stop designing for 800x600 resolution, either make everything scalable or at least use 1024x768. If you can't implement a scalable interface and you must have backward compatibility for 800x600, use settings and separate stylesheets for each resolution. I'm sure the user would prefer to set the resolution, even if it has to be done at each login, than having to read 2 pages of text inside a box the size of their cellphone.

Monday, July 30, 2007

I, for one, welcome our new Google overlords

Google search, besides searching for content in websites, incorporates various functions that activate either based on a prefix or on the form of the search request. I knew that these functions were present and used some of them at one time or another. The functions I used was address lookup by entering the phone number, calculator, maps, site information, word definition and currency and measurement conversions. Now all of these functions are not really related to any outside company and are not something unexpected.

Recently, I tried a new kind of search with surprising results. Having in mind the different functions that at incorporated into Google search, I decided to type in a UPS tracking number. I was quiet surprised when Google redirected me to the UPS tracking detail page. Usually, when I want to lookup the progress of my package, I have to go to UPS website, enter tracking number, click agreement box and click submit. I very much don't enjoy all that typing and clicking. Now, with the power of firefox and Google, I can just type in the UPS number into the search box and press enter. I looked up on Google's search help what else can google do. Google can give you weather if you search for "weather zip". You can enter FedEx and USPS tracking numbers for tracking information. You can look up UPC codes, vehicle ids and patents. Besides these there are also unlisted search patterns.

Some may say that these services are evil in some way or another, that Google is becoming a monopoly, I, for one, welcome our new Google overlords. The more services are integrated into Google search, the better.

P.S. as I was writing this, I tried to search for "show times transformers". Above the search results, Google presented me with a link to the Transformers trailer, movie length, average rating and link to collection of review from different sources and a form input to enter my zip code. After I entered my zip code and clicked submit, I was presented with a page within Google that showed 13 closest movie theaters and show times for the movie. I love Google!!!

Wednesday, July 25, 2007

Three weeks

Finally the three weeks are over. Now I can go back to listening to kawaii radio, eating meat and being able to trim my moustache which is getting in the way of my eating.

Tisha B'Av was ok. After coming home from shul, caught up on my webmanga and read Komanda by Yuriy Pogulai. After ma'ariv, we had some cake and drinks in shul. When I came home I had a beer, just like last the fast. I like being different. I wonder, am I the only person who thinks the tune of Eli Tzion is that of a war hymn. Each year, when we sing it, I imagine an army of Jews walking down the streets and killing anti-semites.

Of all the prohibitions during the three weeks and omer, the hardest for me is music. I don't shave and only trim my beard Fridays when I'm not too lazy. Music, however, is my daily companion. I'm listening to kawaii radio or some other music when I'm at home or working and I have my Creative Nano for when I'm outside.

Thursday, July 12, 2007

Ike Ike

My son Shlomik loves music. When he was less than a year old, Бременские Музиканты (Bremenskiye Muzikanti) was all he needed. He could watch over and over and really loved music and singing. A couple months ago I found the cartoon По Дороге с Облаками (Po Doroge s Oblakami) about which he's also now crazy.

Recently I introduced Shlomik to something different and the result is amazing. I often listen to Kawaii Radio on Winamp. Unlike other Japanese radio stations, they only play songs from anime. One song in particular that I decided to look up on YouTube was Ike Ike by Hinoi Team. The moment Shlomik saw the video and heard the music, he was hooked. He learned how to pronounce Ike Ike and is asking for it constantly and after he finishes watching the music video, it's around three minutes, he says "more." He loves the video so much that he even tries to mimic the moves, or at least claps. If he dares to learns more of the lyrics than I, no more Ike Ike.

Hinoi Team have another song, Night of Fire, which is fun to watch but not as good. I saw some of the other music videos, but they weren't even as good as Night of Fire. Shlomik also responded well to Shangri-la and Asu e no Brilliant Road by Angela, though nothing comes close to Ike Ike.

Sunday, July 8, 2007

Facebook news

I recently created an account on facebook. I entered my profile, uploaded a picture and searched for any friends and friends that already have an account. Then I set to doing what I do best, well, one of the things I do best, using my powers of persuasion and annoyingness I managed to force a lot of my friends and some of my family to join. I also created two groups, one, "Family Levitansky" I mentioned before and it's a group for my extended family. The other group is "Jews who love anime" and so far I got nine members.

Facebook is a great alternative to myspace. I created an account on myspace but don't have any real interest in using it. Besides the core problems of bad design, allowing users to set background music and background pictures which make the whole page unreadable, there's the spam factor. The moment you join, you'll get invites and messages from other users advertising porn and not the safe kind. Altogether, the idea you get from myspace is that it's a place for infantile teens and nothing more.

Now, on to the main point of this post. Whenever one of your friends does something like update profile, join a group, become friends, you get a news item on your homepage. One of my friends, in an attempt at humor, entered thinking as on of his Activities in his profile. Later, deciding that it's not as funny as he thought, he decided to remove it. Now this is the news item that me and his other friends saw on their homepage, "...has updated his profile. He removed Thinking from his activities." That is gold. That's what I call hilarious. My only regret is that the staff of facebook never saw what kind of a sense of humor their creation has.

Sunday, July 1, 2007

Dafina: Revision n

Most of my recipes are not static, they evolve. Just because I like the way something came out, doesn't mean it can't be better or different. The recipe that changes the most, probably because it's used weekly, is the one for dafina (sephardic cholent).
I don't remember where I got the original recipe. Maybe it was online. Maybe it was by talking to people. Probably a mix of the two. Whatever the case, the recipe has been changing over time as I added or removed ingredients based both on my seeing what my friends put into cholent and my personal experimentation. This week's dafina consisted of the following, the order is layer based:
  1. Chopped onion and garlic
  2. Cholent meat
  3. Bottle of beer
  4. Hot paprika, cumin, salt, cinnamon, shawarma spices, black pepper, honey, cayenne pepper and whole black pepper
  5. 2lb bag of frozen spinach
  6. Rice and barley
  7. Veal tongue (or jachnun)
  8. Sweet potatoes
  9. Whole eggs in shells
  10. Dates
  11. 1 fresh ginger root
The last five ingredients should be arranged as the top layer unless your crock pot is small and if it is, use your own discretion. Add water until it at least covers the rice and barley, though you can add as much as the top of the eggs or even more.
There you have it, my current dafina recipe. The taste is sweet and the consistency will be based on the amount of water added.

Thursday, June 28, 2007

Pony ride

On Sunday we went to the annual street fair on avenue M. The primary reason for going was to put Shlomik on a pony. We bought some things for ourselves. Bought Shlomik some toys, including maracas from a Native American stand.

Native American stands are my favorite at the fair. They always have cool music, musical instruments and clothes. We bought a sweater there for Shlomik. Last year I bouht t-shirts with wolves. This year, unfortunately, they didn't have anything with animals.

Shlomik got to ride on a pony for half a block and back and got his picture taken. He somewhat enjoyed the ride, would've enjoyed it more if he wasn't tired. Unfortunately, I didn't bring a camcorder or camera. The pictures were taken by the ride owners using a polaroid and that's why they look so bad. I'm amazed that they still use that outdated crap. The film is pretty expensive, the pictures are bad and very small. For the same money or less they can either buy very small capacity flash memory in china or have a photo printer in their car. Another solution would be to burn CDs which cost only $.10 and take less than a minute to burn. Even if customer does not have a computer, something unforgivable in this day and age, local and regional photo development shops accept any kind of media and because of the high resolution of digital cameras the resulting images can be printed as small or as big as you want.

Tuesday, June 26, 2007

Levitansky Family Tree

My dad's relatives made a five generation family tree for him for his birthday.
The tree starts with Nokhim Levitansky and Chaya Pevsner. The tree is primarily of the Levitansky family, but also includes Levit, Leviton, Shapera, Sorkin, Swidler, and my dad's branch, starting from his father, Ruzin. I used Family Tree Maker to enter all the data into a file and came up with over 200 people. Google and Facebook were very useful for finding contact information for my distant cousins, some of whom replied to my emails. I created a group on Facebook, "Levitansky Family," where we can all meet. The group also has a link to a PDF of the family tree, which I'm hosting on my site. I found family in NJ, TX, WI and OH.
I asked my dad to look for any old photos, hopefully going all the way back to Nokhim, so that I can scan them in and post my group. A lot of information is missing from the family tree and some of the names are probably misspelled or even wrong. I'm hoping my extended family will help me correct any mistakes and to continue expanding the family tree as the our family expands.

Wednesday, June 20, 2007

SQL - Adding columns to a table

I'm a great proponent of using Enterprise Manager for creating and altering tables. For years I used the GUI exclusively for database management and only used the query analyzer for writing queries and doing quick selects.
In my last projects, I had to create and alter tables using scripts. Since the site was live and I was working on the staging site, the database schema on the live site would have to be altered instantaneously. I looked up how to alter tables using scripts and found something that I could have used on many occasions when altering table in Enterprise Manager.
Enterprise Manager is a great tool, but it has one shortcoming when dealing with tables. If you need to add a column with a default value, you would have to run an update query on the table because most of the time, the column would get added with nulls instead of the default value. If you need to add a column with a not null constraint, that's when it gets fun. You need to the column with a default and not null checked off, save the table, update the table, check not null on and save the table one more time. Annoying, time consuming, not fun. Now lets tackle the same problem using a script:
ALTER TABLE table-name ADD
column-name column-type NOT NULL DEFAULT default-value WITH VALUES
Short and beautiful. DEFAULT specifies a default value and WITH VALUES instructs SQL Server to populate all rows with the default value.

Wednesday, June 13, 2007

T-SQL - Using CASE in SELECT

Today I had a task of modifying my code on an investment site I made. The task was to change the color of a row if a ticket is near closing time, 30 minutes, or passed it and an email hasn't been sent to the clearing house yet.
I had two choices, either do it inside the query or in ColdFusion. I decided to do it inside the query.

SELECT t.id, trade_date, ...,
CASE WHEN
(
DATEDIFF(n,GETDATE(),CONVERT(CHAR(10),trade_date,110) + ' ' + cutoff_p) <= 30 AND d.amount_p > 0
AND email_date IS NULL
)
OR
(
DATEDIFF(n,GETDATE(),CONVERT(CHAR(10),trade_date,110) + ' ' + cutoff_r) <= 30 AND d.amount_r > 0
AND email_date IS NULL
)
THEN 1 ELSE 0 END AS alert
FROM ticket t JOIN ticket_detail d ON t.id = d.ticketid
LEFT OUTER JOIN fund f ON d.fundcode = f.fundcode
ORDER BY trade_date, account_name
CASE is a very useful statement in SQL. It can be used either as CASE expression WHEN or CASE WHEN expression. Here, I'm using the later form.
I have 2 columns,
cutoff_r and cutoff_p. They hold the cutoff times for purchases and redemptions. These colums are not DATETIME, rather they are of type VARCHAR. Since the cutoff values are VARCHAR, they have to be converted to DATETIME.
First, lets add the cutoff times to the date the fund is supposed to be traded:
CONVERT(CHAR(10),trade_date,110) + ' ' + cutoff_p
The trading date is converted into USA standard, or mm-dd-yyyy, a CHAR 10 characters long. Then the cutoff time, which is in the h:mm(A/PM) form, is concatenated at the end. Notice the space in the middle. Without it, the hour will immediately follow year and confuse SQL Server.
The first condition is comparing current time with the new trade date and checking that there's less than 30 minutes until cutoff or that the time has passed, in which case the result will be negative. The second condition checks if the trade is a purchase and the third condition checks if an email was sent. If all are true, then the expression is true.
Next, I add a duplicate expression that checks if the trade is a redemption. I could have put the email sent check outside, but then I would have to enclose whole thing in another pair of parenthesis since this is an OR comparison.
The last part,
THEN 1 ELSE 0 END AS alert
states that if the expression is true, then return 1, else, return 0 and name the column alert.

Monday, June 4, 2007

Jaws

Today we went to see the doctor for Shlomik's checkup. He grew 1.5cm smarter and 1.25" taller.
He was behaving somewhat better than last time, though that could be either because his grandpa was there or because of the time past since his fun visit for a blood test. Shlomik also got a shot. Next visit is in another three months.

Shlomik hasn't had any new teeth in months. This shabbat, we found a new tooth in the front. Originally, he had four on top and three on the bottom and this was the tooth he was missing from the bottom. I was somewhat concerned about his tooth not coming out for such a long time. I asked the doctor if it was a problem. In answer, lo and behold, the doctor showed me that Shlomik actually has two back teeth that already broke through and I think he mentioned another two. Now he'll finally be able to chew his food better instead of swallowing it half chewed, if he's not too lazy.

Wednesday, May 30, 2007

Sick

Today I'm sick and was also sick yesterday. Being sick sucks. I don't really have a temperature, but all the symptoms of a cold are there. Now finishing my second container of chicken soup. What really sucks is that I'm all out of both store bought pepper vodka and my homemade one.
I put up my Sinai Academy / BHI alumni page. Took me around 8 hours to make, including the back-end. The add profile form and list sort and filter are both using AJAX. I solicited some people to add their profiles and now there's 6 total. Not bad considering I just posted it.
A girl from BHI signed up and suggested I check out facebook. Nice site, but you have to add people to your account if you want to see their info. There's a lot of people from BHI, but very few from Sinai and only one person that I know. For some reason, Sinai, a more technically inclined school than BHI, has no current website or alumni list. BHI has a nice alumni website, albeit no more updates since last year and webmaster's email is dead. Sinai, on the other hand, has two websites, both haven't been updated in years. Gena's Sinai alumni page is gone. I know there are people on LinkedIn, unfortunately, they don't provide a field or search for high school. I emailed LinkedIn customer service about this oversite three days ago. I got an auto-reply that they'll get back to me within three business days. It's been three business days, no reply.

Monday, May 28, 2007

Prospect Park

We took Shlomik to Prospect Park zoo today. Never noticed before that Prospect Park train station has an elevator. It's in the middle of the platform and instead of walking to the park's main entrance, you can just cross the street and walk along the road to the zoo.
When we got to the zoo, Shlomik fell asleep. We walked around waiting for him to wake up. The baboons had a baby. Shlomik woke up when we got to the red pandas. He loved them. He kept screaming and pointing. My mother even bought him a small plushy of a red panda. We tried to get him inside a turtle shell that's towards the end of the trail but he only agreed to sit on top of the shell. He liked the sea lion feeding.
Before going to see the sea lion feeding, we went to the "Animals in our Lives" exhibit. He loved the meerkats. He stood right in front of the glass and started banging on it and yelling. He looked very happy. One of his first words was moo, or boo as he says it, and now he finally got to see a cow. He was pointing at it and saying boo, but did not want to get too close to it as it was big and I guess kinda scary for him. We also saw sheep, goats and llamas. Shlomik decided that a llama is also a cow, boo.
There were some changes in the zoo. Mice, hamsters and guinea pigs got replaced with insects. Insects are not that cute, put back the guinea pigs. Capybaras got replaced with two Asian Small-Clawed Otters. The otters are very cute, but I liked the Capybaras too. A Capybara is the biggest of the rodent family.

Friday, May 25, 2007

Usernames

Yesterday I answered a question on LinkedIn about using username vs email for logins. Both have their pluses and minuses. Usernames are more secure but can be very frustrating for the users.
Most developers fail to understand what the user will have to go through when registering. One of the worst experiences I had with a sign-up page would be where all the information was asked on one page and validation was done server-side. Why is this bad? Well, I was asked for username, password, security question and asked to validate with CAPTCHA. Most of the time, the username a user wants is not available and that was the case with me. After entering all that information, I was sent back to the sign-up page, except now I had to not only re-enter the username, but also the password, security question and answer and the CAPTCHA. Now, consider having to do that five times or more and think how frustrated the user will become.
Incidentally, I also have an interesting experience regarding the security question. I was setting up an account for my wife and the security question was city of birth. The city where she was born is four characters long, however, I was informed that that's too short and a city name has to be at least five characters long. So, if you were born in a city with four characters or less, tough luck, go use some other site.
To make the user experience as painless as possible, any field that has a high probability of failing validation, like username and password, must be validated before the user hits submit. Though it's best to leave the server-side validation in place in case the user has JavaScript disabled, client-side validation must be present. Username should be validated using AJAX. Password, security question and any other volatile fields that require validation but don't require a call to the server, should be validated as they are entered. All other fields and "required field" validation can be done when user hits submit with an onsubmit function. Warning message can be outputted with an alert or by writing to an error div. I, personally, prefer an error div since it looks nicer than the alert popup.

Monday, May 21, 2007

Shlomik

Shlomik learned some new words. One word is matzah, no wonder here. He loves matzah, in fact, that's the only way he'll eat soup, by filling the bowl with matzah. Another word was water, didn't sound very cleat so not sure about it. Also, he should be saying juice instead since that's what he mostly drinks. Today, he also said Anna. Anna is my friend's daughter who dropped by today. There's a picture of her feeding Shlomik on the photos page.
I got my firewire cable today, which means I'll be able to upload some videos of Shlomik eating. Unless I'm too lazy of course.
We're going away for all except one meal for Shavuot. For that meal, the menu is beef tongue, yum. We're eating duck now, and that got me thinking of buying a duck and roasting it in the rotisserie.

Friday, May 18, 2007

Ocha ga arimaska?

On Wednesday, I went with my friend to Katagiri, a Japanese store in Manhattan.

While walking to the store from the train, we passed by a pet store. To the left and right of the entrance there were window "cages" filled with the most adorable puppies. Some of the puppies were fighting, some were lounging around and some were just walking around, but all of them were kawaii!
Katagiri was a little disappointing, and the gift shop, even more so. Originally, we were planning on going to Sunrise Mart in the Village, anothe Japanese store. However, after finding out that Sunrise Mart is a "small, cozy, Japanese supermarket" and Katagiri is the "oldest Japanese store in New York" and it has an adjoining gift shop, we went to Katagiri. I don't know which store is bigger, but Katagiri seemed very small and perhaps we should have went to Sunrise. On a positive note, I bought a 12 pack of the very hard to find Kirin beer, two 150oz bags of imported green tea leaves and two packs of green tea with brown rice. Barley tea, a famous summer drink in Japan, was unfortunately not Kosher and unlike tea leaves, needs to be Kosher. Most of the shopper and all of the workers were Japanese and were very nice. The store also sells sushi rice though a bigger selection of rice and nori can be found in bigger stores in Chinatown.
The gift shop was a big disappointment. The store was tiny with hardly anything there and what was there was ridiculously overpriced. Plastic soup bowls that I ordered from Japan for $3 were being sold for $8. A one cup traditional tea kettle went for $73. The Chinese owned Japanese store on Brighton is not only cheaper but 3 or 4 times bigger.
Next time I want to check out Sunrise Mart, specifically to find out if they have Kirin. If Sunrise doesn't, I guess I'm going back to Katagiri.

Tuesday, May 15, 2007

Lazy

Today was a lazy day. I had about an hour's worth of bugs in the morning and then spent the day on digg and fark. Wanted to go to a new Chinese store on ave U for some loose tea, didn't. Had some other stuff I wanted to do but was out of it the whole day. Well, tomorrow is a new day which I plan to utilize. One of my friends has vacation and was planning to go to Manhattan to check out some Japanese stores. I decided I'll tag along, they should have tea too. Also, have an idea for a new t-shirt design involving otters.
Last, but not least, I started the process of dual booting XP and Ubuntu on my old computer.
Progress report on everything tomorrow.

Monday, May 14, 2007

Siyum

We finished Chagigah today and started Yevamos. That's the end of our monthly parties. By the time we finish Yevamos, it's going to be September. Today's siyum was nice, though could use more meat. We started ordering food from Benny's on Ocean Ave and M about 3 months ago. He makes awesome shish lamb ribs. Dolma's always good, plov could have been better. We got some new dish, ground lamb balls in fried dough, excellent. As usual there was Russian potato salad, though this time it was topped with a Maraschino cherry. Different, but tasty.
Made brown rice in my Zojirushi rice cooker for Shlomik today. My mother decided to add some soup to the bowl. Shlomik decided it would look nicer on the tray of the highchair than in the bowl. Maybe it's my dislike of modern art, but I was not amused.
Bought a coffee maker for my friend's birthday and one for myself, you gotta love Woot.

Saturday, May 12, 2007

Ubuntu

Using the alternate CD, I've finally managed to install XUbuntu Feisty. Not only has the 450MHz Compaq piece of crap stopped crashing, it's now running faster.
One of the things I love about Ubuntu is the Add/Remove programs function. Never before has it been easier to find and install what you need. Whether you want a game, an office application or a system application, all you have to do is scroll through the available programs, click the one you want, and you have it. The best part, they're all free.
Now all that's left is to make all my friends with old computers install Ubuntu or XUbuntu.
With Dell embracing Ubuntu and HP on the way, the only thing that's keeping Ubuntu from taking the upper hand is games. Dual booting is an option, however, with Micro$oft stopping distribution of XP and Vista's horrible compatibility issues and Wine's spotty performance, all we can hope for is that either someone makes a more stable program for running windows applications in linux or that game companies will start coming out with linux versions of their games.

Friday, May 11, 2007

Ubuntu

A couple days ago I decided to try installing XUbuntu on my wife's old computer (museum piece). Now, to fully appreciate what kind of crap it is, it's one of Compaq's screw ups. This model is assembled on a motherboard with onboard SIS video, 2 for a dollar CD-ROM and a weak PSU. This model is also famous for its constant crashes under Windows, mostly attributed to the video card. To start, I added 2 more sticks of ram since XUbuntu requires a minimum of 128MB for install and this crap had 64MB - 8MB video. After trying and failing to install the OS in silent mode and finally turning off the logo to see what the software is doing, I found out that the 2 for a dollar CD-ROM is most probably trashed. Today I replaced it with a bit newer CD-ROM that my dad had lying around. Though the no loading problem was solved, I was faced with a new problem, probably because of the video card. The install would freeze at 15% of the last step. Thanks to the power of Google, I was glad to discover that I'm not the only one with that problem and that there's a solution that's almost guaranteed to work. The solution is using a text only install. The problem is that I have to download another 700MB image, which is what I'm doing now. Hopefully this story will have a happy ending, preferably tomorrow.
My dad fixed my bike today. After almost a year I finally have a bike again. Yes, I'm that lazy. I considered buying a new bike, however, it would very likely get stolen or at least the wheels would be. My old bike, on the other hand, doesn't look like something that a thief would want. My first outing was to go buy meat in my favorite supermarket, which is unfortunately a half hour away if I walk there. Today they had 2 additions to their meat menu, one of which I bought. They make very good shish lamb and kufta which I buy every week and "grill" in my rotisserie. Today they had shish kebab made out of sweetbread. I bought it, cooked, tried one piece...I think it's too salty, also very expensive. The other novelty which I didn't buy, was a meat lollipop. No, that's not my name for it, that's what was printed on the package. What this contraption look like is actually a swirly lollipop, though 3 on a skewer instead of on. The pieces are made from long strips of meat wound into a circle. Perhaps I'll try it next week if they still have it.

Thursday, May 10, 2007

RSS

Added RSS to my site. One channel for news and one for Daf Yomi. Also, finally moved my news posts into a database instead of adding them by hand every time. The admin page and RSS feeds were very easy to write. I'm finally adding a programming section to my site and the first article will be about setting up RSS feeds using PHP and MySQL. The only real snag I hit while working on the feeds was that Google Reader takes its time refreshing feeds. There's a refresh button, but it doesn't seem to do anything other than refresh the window. It doesn't actually refresh its cache. Adding items to my feed and not seeing them in the Reader made me think they were formatted wrong, but googling the problem led to find out that Google Reader may take a few hours to refresh the feed.
On another note, I finally got a tape for my camcorder. My son, who's now 15 months old, was very much enjoying the show when I flipped the screen towards him so he could watch himself eat. Now with the tape, I can tape the cute faces he was making.