Archive

gallery tab

Okay, this is slightly obsessive-compulsive, but I will eventually figure out an easy way to get the gallery tab above to be highlighted instead of main when viewing the gallery page… but for now, it’s time for bed.

MS Works is no fun

I just spent my weekend fixing my sister-in-law’s computer; it had a virus so I spent the time backing up non-executables so I could do the notorious format and reinstall. That is, her photos, iTunes music and movies, and any other documents I could find.

Of the text documents, she had a surprising number of open document text (odt) files, which I was happy to see, but then I noticed a bunch of files with a wps extension. I originally thought WordPerfect, but when I tried to open them in OpenOffice, they ended up blank, which I could tell was wrong from opening them in notepad.

After a quick search, I found they were Microsoft Works documents, which are not importable in OpenOffice (or even MS Word by default) or convertible using any standalone converter. Long story short, I had to install Microsoft Word Viewer 2003, then install the Microsoft Works 6.0 to Word converter, open them in the viewer, then copy and paste the text into OpenOffice so I could then save them in odt format (after some crappy text manipulation). Not very fun, but it was the fastest, free way to get her documents back to her without installing Works again.

stumped

Okay, so I was reading through some old code of another programmer at my job a few weeks ago, and noticed something like this:

while (true)
{

//… some code here …
break;

}

I just shrugged it off, simply thinking he must have been on drugs when it was written, but then I noticed that he had used the exact same code in a project we are currently working on. For those not familiar with programming, the “while (true)” means keep doing the stuff inside the curly braces over and over, while the “break;” means to go ahead and stop repeating anything and go on to the next part of the program after the curly braces. I have tried to figure out what possible reason a while (true) statement with a break at the end would ever be useful, but it has me completely stumped. So either I’m not very bright, or I need to report a coworker for substance abuse.

regular expression lookaheads and IE

Okay, so I’m writing two computer related articles in a row, but I’ve been meaning to post this for a while now.

Anyway, a few weeks ago, we needed a regular expression for customer passwords. After searching Regular Expression Library, we found one that looked like it would work, and modified it to the following:

^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[0-z]{7,12}$

Normally, that would require the password to contain one small letter, one capital letter, one number, and be between 7 and 12 characters, inclusive. So we tested it, and it worked just as expected.
A couple days later, another programmer in our group told us it didn’t work, so we tested it again with perfect results. After arguing with him for about 1 to 2 seconds, we asked if he was using Firefox or Internet Explorer - he was using IE.

After a couple more days of research, I discovered that IE doesn’t necessarily parse lookaheads properly. Here’s what seems to be happening:

  1. The carot ^ is successfully matched, and because it is a zero-width search, the search position remains at position 0 (before the first character of the password; this is expected behavior)
  2. The first lookahead (?=.*[a-z]) looks ahead until it finds a lower case letter, if one is not found, the regular expression fails; however, if one IS found, IE decides to jump straight to the next part of the search that is NOT one of the lookaheads. That is, it checks that the lower case letter is followed by at least 7 to 12 characters
  3. If that succeeds, then it does the same thing with the next two lookaheads
  4. If all the lookaheads succeed, then the final check must pass; that is, the password can only be 7 to 12 characters long

Trying to put this simply, basically a small case letter, an upper case letter, and a number must all appear within the first 5 characters, followed by, at minimum, 7 more characters. So the password would only ever pass with a minimum of 10 characters (e.g. A0a1234567). And even with 10 characters, if one of the 3 lookaheads didn’t match right at the beginning, the entire regular expression would fail (e.g. aBc1234567 would still fail, since one of the numbers doesn’t have 7 more characters after it).

But being the freakin’ genius I am, I finally figured out a solution that worked in IE and Firefox:

(?=^.{7,12}$)(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[0-z]*$

Basically, this checks the length right from the start, if it’s not between 7 and 12 characters, it immediately fails; the other lookaheads now don’t care how many characters follow, they just care that the lower case letter, upper case letter, and number appear somewhere in the password at least once. The last part [0-z] simply makes sure that no weird characters are entered: just letters, numbers, and some limited punctuation.

would you believe?

Okay, that was pretty cliché, but I just recently found out that they have decided to cast Anne Hathaway as agent 99 in the new Get Smart movie, which is freaking awesome and Anne-tastic. I already knew that they were planning on having Steve Carrell play the part of Max, and while he is a perfect candidate for the part, he just isn’t hot enough (at least to me) to have prompted me to write a journal entry.

Checking around for a little more details about the movie, I came across The Get Smart Page. It is a poorly designed site, but has a lot of information (good and bad) about the show. It appears the site’s maintainer has obtained a copy of the movie script, and is unhappy with it. From what I can tell, his biggest problem with the new movie is that they’ve taken Max, who in the old series was a confident, bumbling fool, and turned him into an insecure, bumbling fool. Hopefully the movie turns out much better than he has interpreted from the script.

And back to some more exciting news: Time Life will be releasing the full original series on DVD soon. Get Smart is possibly one of the greatest comedies of all time; though, I would say it’s hard for me to decide between it and Scrubs. In fact, I’m almost as excited now as I was when I heard Scrubs was being released to DVD. I’ll just have to start saving now so I can afford to buy it.

they’re coming

I know some of you just couldn’t bear the anticipation, and while I know I could have just edited my old post to add this, it was simply too important to just go back and change — my Heelys have shipped and will be here by December 13th!

why am I so good?

I have a couple of confessions today: I really like Sudoku, and I really want a pair of Heelys; yes, the shoes with wheels on them, and, in case you were wondering, I’m 28. Anyway, I just recently starting playing Sudoku (I was introduced to it months ago, just never got into it until now); after I had played a few puzzles on the easiest setting, and beating the average player’s time the majority of the time, I decided that I was so awesome I could jump straight to the hardest setting — I was only able to get this far without guessing: evil puzzle.

After about 3 days of being retarded (off and on, total time spent was about 3 hours), I just decided to use the scratch system the game provided to solve the puzzle, by eliminating patterns that didn’t work. In other words, I solved it through trial and error (here’s the solution); though, I was under the impression that was unnecessary to solve any Sudoku puzzle (if you happen to know any tricks to get further than I did, please let me know). After I had solved the puzzle, I decided to go back and try using the built-in hint system; this at least made me feel a little better, because the hint system wasn’t even able to get as far as me.

If you’ve never played Sudoku, I highly recommend it; you can even find a few free versions on sourceforge.net. The screenshots I provided earlier were from the free windows version of the game on Sourceforge; and it’s extremely more functional than it is attractive, though it is possible to change the colors (I’m too lazy/busy writing dumb online journal posts).

So after I had decided to find a pair of Heelys, I checked a couple stores in St. George to see if they had my size. The sales person at the mall just laughed, then said no. The sales clerk at the next store at least replied with, “No, because I’ve checked.” He then said they could order a pair in, it’s that they just don’t keep a men’s size 12 in stock. I didn’t want to order them there, so I just gave up looking for my size, and actually forgot about them completely for the next few days; that is, until I was checking one of my favorite, extremely-poor-designed sites (though it does often list incredibly great deals), hot-deals.org. They listed that Heelys were on sale on buy.com for only $40 after Google checkout. I’m still waiting for them; and hopefully they get here before Christmas. Yum.

election day is almost here…

Well, it will be election day in a week ago.

I realize this is such a timely entry, but I still wanted to post it. I decided to vote for my last time in Utah (unless I decide to move back, which is entirely possible given the right financial situation); I will be losing my status as a Utah resident well before election time comes around again. And I fully intend to vote here in Arizona when it does.

From the previous paragraph, you can safely assume that my house, wife, and kids are still in Utah. I’ve just received two callers interested in buying our town house, and unfortunately for the current real estate market, had to assure them that my asking price was negotiable. In any case, I hope one of them decides to call back to make an appointment to see it (and, of course, buy it).

While I’m sure my family life is incredibly interesting, I’m sorry to inform you that this entry will more likely cover a topic from the title, probably elections.

It appears that Utah’s billion year incumbent, Orrin Hatch has been re-elected to the U.S. Senate. I tried to get my family and friends to vote for the candidate running against him, Pete Ashdown, but it appears it was too little, too late; hopefully in 6 years, Mr. Ashdown can make himself well-known enough to get our (well, Utah’s, not mine anymore) incumbent out of office.

My wife mentioned that Utahans likely feel that he is getting things done, and I really do hope that is the case, but he has made a comment before that I very much disagreed with. This news is incredibly old, but it’s the reason I looked for another candidate in the first place: Hatch made a statement a couple years ago (long enough ago not to have affected the election enough to lose) that some sort of technology should be invented to destroy the computers of those committing copyright infringement (specifically, downloading movies, music, or other media online without consent of the copyright holder). While the topic of copyright is a large enough topic for 50 trillion more entries, I’ll try to stay focused on why I chose to vote against Hatch.

There are many of Hatch’s policies that I agree with, a few including: allowing media to be edited (specifically, removing offensive content) for resale, stem cell research, tax cuts, and tax reform. Hatch claims to be pro-Constitutional, which I assume is a conservative view that the government only holds the rights specifically given to it by the people, and no more. Unfortunately, his comments about destroying a person’s property without being proven guilty doesn’t seem to fall in line with ”due process” of the fourth amendment. Even though he eventually retracted those comments, it still seems as though he temporarily set aside the fact that this government is required to assume innocence until proven otherwise.

Don’t get me wrong, if probable cause of copyright infringement can be shown, I have no problem with the courts issuing a warrant to determine if any infringement has actually happened (including the confiscation of the property in question, but not the desctruction or permanent confiscation before a guilty verdict).

I don’t really like the use of the word probable, as most people understand it today. Probable cause means that you have pretty damn convincing evidence showing this person committed the crime (fortunately, many judges do still understand this); and not that they “probably” (id est, “might have”) committed the crime.

And the biggest reason I chose to vote for Pete Ashdown, is because he truly listens to the people (or at least does a pretty dang convincing job of it). On his own website he encourages communication on issues by the community (using a wiki), and when he feels they have reached a good conclusion, makes it part of his official policy. The great thing is that these policies are contributed by the people, not just solutions Ashdown has come up with off the top of his head. Because I also agree with the majority of Ashdown’s policies, he was the perfect candidate for me to choose.

However, I do strongly believe that people make mistakes they regret, and are completely entitled to change their opinion, even on extemely important issues; new information can completely change the circumstances on which you may have previously based your former opinion. Since Orrin Hatch is now Intellectual Property Subcommittee Chairman, I sincerely hope he realizes the error, and works towards intellectual property reform that will protect the consumers as strongly as the copyright holders. I would really still like the ability to “own” a book, movie, game, or song (id est, all art); I don’t want to end up in a world where art can only be “rented” (aka, licensed) by consumers.

simple, sweet, habanero salsa

I have had a lot of friends and family ask me for my salsa recipe, and fortunately for them, AJ decided to ask me again the day after I set up my journal:

  • 8 medium-sized tomatoes (4-5 large or 10-12 small)
  • 1 green pepper
  • 4 cloves of garlic
  • 1 habanero (remove the seeds and white fleshy substance on the inside, or just use half a habanero if you need a milder salsa)
  • 1/4 - 1/2 onion (depending on how much onion you like)
  • 2-3 tablespoons brown sugar
  • salt to taste (usually about 1 teaspoon for me)

Cut tomatoes, green pepper, and onions up in to pieces small enough to fit it all in a food processor, and add them to the food processor. Then crush the garlic and the habanero and add them to the salsa. Finally, add the sugar and salt, and turn the food processor on for about 20-30 seconds (increase the time for smaller chunks in the salsa, decrease the time for larger ones)

Tip: If you don’t have a food processor, simply cut the tomatoes, onion, and green pepper into as small pieces as you want, then put them in a bowl where you will then add the crushed garlic, crushed habanero (or cut very, very small; trust me, you don’t really want to run in to large pieces of this), brown sugar, and salt. Then simply mix with a wooden spoon until the salt and sugar are thoroughly mixed in. Let the salsa sit for about an hour to allow habanero flavor to diffuse throughout the salsa.

Tip 2: If you don’t have a garlic press, you can crush the garlic with the flat edge of a kitchen knife (easiest when you use a larger knife). Sorry, this doesn’t work for the habanero if you don’t have a garlic press, you’ll just have to cut it up into very, very small pieces. You do not want to run in to large pieces of habanero, unless you enjoy pain.

Tip 3: Either use gloves when handling the habanero, or wash your hands afterwards, and by that I mean to use soap for at least 30 seconds. If you don’t, there will be a day that you will forget you had just made salsa and touch your face with your hands. If you don’t follow this tip, hopefully you enjoy the burning sensation in your eyes or nose for the next few minutes.

better than…

I was just testing the password-protection capabilities of this wordpress software. It’s interesting, it uses a permanent cookie to remember the password, so if you’re on a public computer, I wouldn’t recommend reading any password-protected posts unless you remember to clear the cookies afterwards. Anyway, nothing in here about sex yet.