Referer Parser

So I spent most of yesterday working on relearning how to parse Apache logs and how to get it automated and onto a working online user interface, which was rather fun. Haven’t really had much time to do web development after I started working, hence why I decided to use an existing framework and slowly build off of that.

So what I ended up with is a simple parsing of my logs directory. It’s a bit unpolished, but for now, it’ll do.

* links do nothing in this preview

When you click on a link, it calls the tool I wrote called and passes in the log file I want (i.e. parse.php?log=access.log.2006-03-10.gz). The tool can distinguish between compressed files (.gz) and raw files (no extension). If it detects it’s a gzip file, it’ll decompress it and then rerun the tool with the location of the extracted file.

What the tool does is generate the results in XML format, similar to the following:

<domainlist>
<domain name="search.yahoo.com">
<referer from="http://search.yahoo.com/" to="GET /blog/ HTTP/1.0" date="2006-03-11 04:01:56" ip="125.247.105.242" />
</domain>
</domainlist>

I actually group the entries by domain. There’s no sorting yet, but I didn’t find that necessary in my case, since all I really wanted was a easy way to see who’s linked my site and be able to collapse all the google ones if they’re not interesting.

After it generated this file, it would automatically zip that file (reduces my ~2MB xml files to ~100KB) and then email it to me. I’m trying to figure out if I’m allowed to schedule to run this once a day instead of having to do this on demand.

The next thing I needed was an XML viewer. I was contemplating at first to use IE or Firefox, but decided against it. IE was finicky about expanding and collapsing items. Firefox just hang when trying to load a 2MB xml file. So I searched online and the first couple of links in my search result ended up with either: MindFusion XML Viewer or IBM XML Viewer. The IBM one is no longer available, so I went ahead and got the MindFusion one. It was free after all and the screenshot looked decent. At first it didn’t show me all the information I wanted as fast as possible, but after enabling Name and Value in tree and Expand On Load, it was a lot better.

The final thing I wanted to do was to require authentication in order to load this page. Turns out there was a easy way just by creating a users file (htpasswd -c ~/users username) followed by a .htaccess point to that file. You can find more information on how to do this if you’re running Apache by clicking on the link under my reference list below.

Here’s an example: access.log.2006-03-11.gz

Finally, to give credit for references I used:
Apache log file parser class
PHPMailer
Using User Authentication

Religious Joke

I was watching Keeping Mum (review to come later), and Mr. Bean was searching onilne for religious jokes, which got me searching for the site “Giggle with God”. Turns out the site doesn’t exist and was probably created for the movie only, though the several jokes posted on that page when I paused are in fact real jokes. So while, I was searching for this site, I ended up searching for religious jokes too and found this really funny one:

A Sunday school teacher was discussing the Ten Commandments with her five and six year olds. After explaining the commandment to “honor thy father and thy mother,” she asked,”Is there a commandment that teaches us how to treat our brothers and sisters?”

Without missing a beat one little boy answered, “Thou shall not kill.”

Most of the other religious jokes gave a few chuckles, so they weren’t really worth posting.


Random Crap:

Short pya! flood:

(img) 撃ち抜かれたハート – Bullet through the Heart – bullet going through the Ace of hearts in slow motion.
(img) 禁止事項 – Prohibited Items – No Durian! Doesn’t have a fine associated though…
(img) あったかメガネ – Hot Glasses – flame on!
(img) よろしくお願いしますnya – Forgive me please – cute praying cat
(img) キリスト – Christ – do you see Jesus?
(img) wan・・・・? – puppy flower basket
(vid) 食事の邪魔をするnya! – Don’t Disturb Me While I’m Eating – cat pushes dog away when dog tries to take his food
(vid) 棒術使い – Crazy Pinatas – I always thought a game where you give a kid a bat and blindfold them and let them swing crazily was a bit crazy
(img) パンチングマシーンならぬ… – Not a Punching Machine… – I wonder what you’re suppose to do in this game… spank?
(img) ウッシッシ – Totoro Bush
(img) それとなく似てる件について – The case isn’t that it’s similar – don’t really care about the airplane, but the bunny is cute.

Man Says Stripper Delivered a Rob-O-GramA retired salesman alleged a stripper and her friend beat and robbed him in his home. John Skinner, 54, said he was on his way to Bible study on Jan. 23 when exotic dancer Maureen Murphy, 25, knocked on his door and offered him a free strip-o-gram.

Canada’s lost, lonely whale feared killed by boatThe young male whale, which often played with boats in an apparent search for companionship, may have miscalculated the tug’s power and was pulled into the blades, a Department of Oceans and Fisheries biologist said. so sad…

Cat Comforts Grieving Orangutan at Zoo – these articles about different species mingling with each other are coming up WAY TOO OFTEN NOW.

Live action Pacman running around a library (from Deadlock) – I would’ve appreciated this during finals. Then again, I never went to study in the library.

Absence makes the glass glow fondlyWhen either person picks up a glass, red light-emitting diodes glow on their partner’s glass. When one puts a glass to their lips, the other glass glows brightly. Article wasn’t too interesting, but I did start wondering what technology is this based off of. Is there a wifi connection on the glass itself? Would the glass still glow in remote areas or in the middle of nowhere where technology and cell phone signals can’t reach?

A plant that glows when thirstySome people like to talk to their plants. Now, students at Singapore Polytechnic say they have created a plant that can communicate with people — by glowing when it needs water. – Maybe now they can make people glow when they’re being sarcastic, so I don’t have to guess.

Mayor Probed in ‘Speed Trap’ Check CaseCrosby told Morgan that he had to either write another check that didn’t have the words “for speed trap” written in bold letters or face the charges in traffic court. … “As mayor of this city, if I accept that check from that gentleman, I’m admitting we run a speed trap, and that’s a bald-faced lie,” Crosby said Tuesday. Coopertown lies about 20 miles northwest of Nashville on a state highway used by motorists to travel between interstates 24 and 65. The town generates nearly 30 percent of its revenue from traffic tickets.

Tree-climbing robot (from /.) – A remarkable, if slightly creepy, tree-climbing robot is being developed by robotics experts from Carnegie Mellon and several other US Universities. Check out the video.

Considering the aesthetic and psychological effects of your color choices (from MS newsgroup):

One thing I found interesting is what particular colors do for the eyes, how they are received by the parts of our eye and what happens when those messages are sent to the brain. Color plays a large roll in how we react to situations, how we relax, how we are stimulated, and even affects the way we eat and socialize with others.

RED: Did you know that red was one of the first colors a baby can discern, that male babies prefer yellow based reds such as tomato colors. And that female babies prefer blue based reds such as raspberry. The chemical reaction of red while eating will cause a person to eat more, and stay longer. Thus making this an ideal color for restaurant decor or in bars.

ORANGE: This color is associated with low quality or being very accessible. This color is used in both the restaurant and hotel industry to convey low cost to passers by. Wether its a lobby, a roof, or a bill board, it gets our attention and tells us its a bargain. Orange is not what one would use to bring about a feeling of elegance, but of something informal or very casual.

YELLOW: The color yellow is transmitted to the brain faster than any other color, in nature yellow represents caution (hornets, bees, and fire). In our world yellow represents caution in warning signs, construction signs, and fire trucks. Babies will cry more when surrounded by yellow, and studies have shown adults to lose tempers when around yellow. Its a very high anxiety color, but in turn is good for drawing attention, or for packaging products. Yellow flowers in the foyer are said to be great when selling a house, the people remember the house with the beautiful yellow flowers after a long day of home shopping.

BLUE: This is the number one favorite color of people by far, it represents respectability, responsibility, knowledge, caring, and trustworthiness. Country type blues are the number one color in homes, but blue is not a color that sells houses well. Blue is a color that encourages fantasy and at the same time is very tranquilizing. This color is ideal for calming, such as doctors offices and in the rooms of over-active children. Blue is not a color that goes well with eating, if you want to push away from the table sooner (or the in-laws are coming)…..dig out the blue dishes.

GREEN: These are living colors. Green is a great color around food and diminishes sweetness. Green represents wealth and money, makes people feel secure and tended. Some health disorders such as eczema, diarrhea, and stomach upset tend to lessen in a room painted in green.

BROWN: This is a very friendly color, its will represent someone as being believable. Browns work very well in interiors, and its known to be a warm and friendly color.

GREY: Its the only color without an after-image, known as a color representing creativity. Grey is best for a background color and will inspire people to do more for a longer period.

BLACK & WHITE: These are not colors, but are known as the power twins because of the bold statements they make. Black represents dignity, sophistication, refinement, and authority. White represents delicacy, purity, and cleanliness. White also encourages precision in the workplace.

Quadruped humans discovered – interesting news video on how some people walk on all 4 limbs.

Fate/stay night Episode 10

Yay! More FSN!

Fate/stay night Episode 10 – A Peaceful Interlude

fate stay night 10fate stay night 10fate stay night 10fate stay night 10fate stay night 10fate stay night 10fate stay night 10fate stay night 10fate stay night 10

Spoilers: (Show)

Difference between TKIP and AES

If you’re using WPA-PSK (Pre-Shared Key), the Linksys WRT54GL gives you two options for WPA Algorithm: TKIP and AES. I knew AES was supposedly the newer and better solution, but I wanted to find out what the main difference between the two was. After searching online for a bit, I found this Wireless FAQ.

19. Q: What is TKIP?
TKIP is a quick-fix method to quickly overcome the inherent weaknesses in WEP security, especially the reuse of encryption keys. TKIP is involved in the IEEE 802.11i WLAN security standard, and the specification might be officially released by early 2003.

20. Q: What is AES?
AES (Advanced Encryption Standard), a chip-based security, has been developed to ensure the highest degree of security and authenticity for digital information, wherever and however communicated or stored, while making more efficient use of hardware and/or software than previous encryption standards. It is also included in IEEE 802.11i standard. Compare with AES, TKIP is a temporary protocol for replacing WEP security until manufacturers implement AES at the hardware level.

RedOctane Ignition 3.0

In my previous post, I mentioned I started playing this DDR like clone called StepMania. So I’ve got fed up with the Kraft Dance Pad. I finally figured out why I sucked so badly, not to say that I’m good, but I’m not as bad as I originally thought I was. The dance pad has what StepMania refers to as the Joystick Axes Problem where Up+Down won’t work and Left+Right won’t work because they implemented the the up, down, left, right buttons as joystick axes instead of buttons so to a computer up+down and left+right is never possible simultaneously.

So I asked around and apparently the industry standard for home dance pads is RedOctane Ignition, where 3.0 is the current version which supports PS1, PS2, Xbox, and PC USB. I was told to just search eBay and look for clones. The clones themselves costed more than used/refurbished Ignition 3.0s, so I decided to get the Ignitions instead. The going price for used Ignition 3.0 on eBay was ~$50 shipped. I decided to get 2 since I could probably save on shipping and it’d be fun to play with 2 people or even enter solo dual pad mode. Ended up purchasing 2 for $94 shipped. Sent payment on Wednesday and got my package today.

Setting it up was actually pretty fun. I didn’t know how they were going to break the foam apart to ship in such a small box.

redoctane ignition 3.0redoctane ignition 3.0redoctane ignition 3.0redoctane ignition 3.0redoctane ignition 3.0redoctane ignition 3.0

Turns out it’s puzzle-like and it’s working out pretty well. I gave it a try and all the buttons are associated with a button and not just the axes.

So I finally got my first B score in StepMania, which I’ve never gotten before with the Kraft Dance Pad (now I know why), though I still get E’s for over 50% of my attempts. I am getting better though, or at least I hope so.

Favicon Picker

So I decided that my bookmark toolbar real estate was getting expensive, so I was wondering what I could do to give it more real estate. I saw a bunch of browser screenshots from other people, and saw a couple where no name was next to the icon, but instead the user would use the image of the icon (usually called the favicon – mine is detective conan) and I thought that was interesting. I’ve been doing that for some time now and I can have so much more bookmarks on my toolbar, it’s amazing.

However, I’m a bit irked with sites that don’t have the favicon setup, so I have to leave the name next to it. Then I remember there used to be something I can do to change the icon, even if the site didn’t have one. I googled for it and found: Favicon Picker, however this version wasn’t compatible with the latest Firefox 1.5. In one of the comments, it pointed to Favicon_Picker 0.3.0 is available for Firefox 1.5 Beta. This version worked! and now I can update all my icons and removed their names.

My precious bookmark real estate is back! I know it didn’t matter on my Dell FPW2405 24″ LCD, but on my laptop that has a 12″ LCD and can only run at 1024×768, bookmark real estate gets precious.

Here’s a piece of what my bookmark toolbar looks like:
toolbar

Hacking the Linksys WRT54GL

So I recently purchased a Linksys WRT54GL, hopefully to solve my lagging problem when the old Belkin router was ever overloaded with packets and connections. At which then I’ll have to unplug the router and power it back on.

There are several open source firmwares that work with this mode:
Sveasoft
dd-wrt
HyperWRT

The one I decided to use was dd-wrt. Sveasoft decided to charge for their newest firmware ($20/yr for support). Talisman, their old firmware which works on the WRT54G and WRT54GS, is still free, but Alchemy, their firmware that works on the WRT54GL is not. HyperWRT is the enhanced version of the existing Linksys firmware with bonuses, but has only a limited feature set. DD-WRT on the other hand is trying to replace what Sveasoft’s has done with Alchemy and to continue the project freely.

I finished upgraded the firmware to DD-WRT v2.3 (Standard Generic). The firmware upgrade went through fine, and I started customizing the settings and adding port forwards. However, I noticed that websites were loading awfully slow and when I tried to download a file, it would only get 4KB/s and eventually disconnect. I thought maybe I got the wrong version of the firmware, so I tried to installing the newest firmware from Linksys to see if the problem still occured. The firmware reverted back fine, but now I can’t seem to even go online. DNS resolving works, but no sites would connect. I made sure my connection worked on my old Belkin router and it did. So I was back to square 1.

I thought maybe I enabled some settings in DD-WRT that is causing problems in the Linksys firmware. Since DD-WRT v2.3 is rather new and may have bugs, I downloaded and installed v2.2 (Final R2). Since they never listed WRT54GL, I went for the Generic last time, but this time decided to give the WRT54G version a try. While upgrading the firmware, it reported the upgrade had fail. I was like oh shoot! But I was still able to connect to the router and decided to try the Generic v2.2. The one installed fine and I thought that’s good, until my router wouldn’t ever exit out of diagnostic mode. The power light would keep blinking. Pinging 192.168.1.1 didn’t get any response either.

I thought, crap, I broke my new toy. Started searching online for a way to hard reset the firmware like what I could do to my Linksys PAP2. There were suggestions of holding the reset button for 10 minutes, but it turns out that only resetted the settings and not the firmware. I finally found a site that taught me how to do it. It required opening the router and shorting 2 pins on one of the flash roms. This in turns allows you to force upload a firmware to it.

At first I was stumped on how to open up the router. I couldn’t find any screws and it looked like I’d break the rubber feet if I tried to pull on it any harder.

linksys wrt54gllinksys wrt54gllinksys wrt54gl

So I searched online on how to open it up and it turns out it was just as simply as pulling it apart. No screws involved. There is a warranty sticker which will be detached if you open the box, so do note by opening the router, you void your warranty.

linksys wrt54gllinksys wrt54gllinksys wrt54gl

Next was finding the chip and then the associated pins. It turns out I was doing this the hard way. I could’ve saved myself a lot of time and trouble trying to search for this pins with the handicap of part of the case was covering it. I won’t put you through the same headache, so lets continue for now.

linksys wrt54gllinksys wrt54gllinksys wrt54gl

You can unscrew the 2 antennas and then pop out the remainder of the case.

linksys wrt54gllinksys wrt54gllinksys wrt54gllinksys wrt54gllinksys wrt54gllinksys wrt54gl

Finding the chip was easy. It has the big word “FLASH” on it. On one side, you’ll see pins marked from 1 to 24 and on the other side, you’ll find pins marked from 25 to 48. The 2 pins we want to short are pins 15 and 16. You can enlarge the last image and the click on FULL SIZE to see which pins exactly. I’ve made them red so it can be found easier. Finding the pins were awfully hard, especially when 15 and 16 are smack in the middle. So if you CAN NOT ping your router (by default set to 192.168.1.1), unplug your router, find a sharp metallic object and short those 2 pins, and plug the power back on. I used a small screwdriver and that worked out fine. You should be able to ping the router now.

The next thing you want to do is rename the firmware you want to replace with to code.bin. Open up a command prompt (Start -> Run -> cmd) and type the following:
tftp -i 192.168.1.1 put code.bin
BUT DO NOT HIT ENTER YET

The next instructions I got didn’t work out exactly for me. I was told to reset the router and when my system was connected to the router, to push that binary through immediately. But by resetting the router, I wasn’t able to ping the router any more. So what I ended up doing was shorting the pins again, and made sure I could pin my router, and then I pushed the firmware through (hitting enter on the command prompt). If you get a timeout message, that means it can’t connect. If you get a transmission complete or successful, then means the firmware is in.

However, with the original firmware back in, it still wasn’t able to connect to the internet, meaning no webpage would load. I then tried installing DD-WRT v2.3 (Mini Generic). After the router rebooted, which took a few minutes, everything was fine and dandy. I didn’t have the lag which I saw initially and everything just worked. I had to reset my wireless setting and my port forwardings. I even boosted my wireless transmission power from 28mW to 251mW, which I don’t think I’m technically allowed.

But so far, life is once again good.

pya! FLOOD

Yet another pya! FLOOD.

You might see a lot of chocolate photos, the reason being that this section of pya! occurred around Valentine’s day.

Here’s some preview:


「壁掛け時計」をインスパイヤ – “Wall Mounted Clock” Inspire – the clock actually displays your system clock time

(vid) ぞうさん – Elephant Surprise – why you should never risk being test subject for stage performers, especially when they’re elephants
(vid) さわれないnya… – Can’t Touch… – cute cat shown a series of cat funnies
(img) 現在増殖進行中 – Currently Multiplying – amazing at the number of 7-11s in Japan
(img) 5匹のnya – 5 kittens – pretty cute
(img) (nya)ぱくっ♪ ぴとっ♪ zzZZZ zzZZZ – Singing and Sleeping Kittens
(img) 液晶テレビ? – LCD? – haha, a ghetto rig to get the TV mounted inside the wall, or in this case, through it
(img) 不可能物体(自作編) – Impossible Object (Original Structure) – is there a trick to this?
(img) 手芸 – Handicraft – even my funky hands can’t do that, maybe Mechy can
(vid) 実写スーパーマリオ – Real Super Mario Bros. – haha, this is hilarious!!
(img) カードの切り方が人生だ。- Cuttng the Card is Life. – if photo is real, amazing what this guy is capable of doing simultaneously
(vid) pya!更新5分前キターー!! – 5 Minutes of Anger – my guess is he’s playing some MMORPG
(img) ヘイ!タクシー! – Hey! Taxi! – I find this an interesting way to get cars to slow down. when drivers see what resembles to be human-like figures, we tend to slow down as if t was instinctual
(img) 看板の思う壺 – Look at the Poster*NOT WORK SAFE* interesting advertisement for a lingerie store (or what I think is a lingerie store…)
(img) マトリックス – Matrix – sprite version of the garage scene where Morpheus battles the twins
(img) 巧の業 – Carving Skills – you know you’re famous when a doll is based off of you
(img) おっぱい – Breasts*NOT WORK SAFE* chocolate breasts
(img) 二人の愛が溢れ出るクマー – 2 People’s Overflowing Love Bear – i thought the knife was a nice addition and the heart shape blood was nice
(img) クッキー – Cookie – in the shape of Mario sprite and mushroom sprite
(img) 何人用ですか? – How many people can it fit? – limosine version of the motorcycle
(vid) 不可能物体 – Impossible Object – here’s the video showing of how the card is actually interlaced. I wonder if it was actually created like that
(img) 恋人用 – For Sweetheart – a second straw hole that says: For Your Partner
(vid) 一瞬で水から氷に – Instantly from Water to Ice – that’s just how cold it has to be before they’re allowed to cancel a dog race
(img) マリオ64 – Mario 64 – 64 different Mario sprites
(img) 小さな獲物nya – Small Insect – the picture has a nice tone about it with everything white including the cat, but the ladybug is red
(img) SAMURAI – the Star Wars version of The Last Samurai
(img) ドキドキハラハラ・・・ – CHU CHU… – puppy moter monorail
(img) 寒すぎて頭に来たので… – Coldness has reached the Head – -18° fucking cold
(img) 芸術家 – Artist*NOT WORK SAFE* female trouble – when kids learn to draw nude woman
(img) パラソル – Parasol – a choclate umbrella!
(img) 脱糞 – Samurai Statues

Enjoy!

3 Day Weekend!

We were supposed to get Firday off, but due to some build problems, what we expected to start testing on Tuesday, ended up to the point where we could only start testing on Friday. This was also the first time I saw my lead so pissed that he actually used f********* in an email. Though I haven’t been there quite as long, my other teammates said this was the first time they’ve seen him that angry. My lead is a pretty laid back guy and to see him that upset actually scared me.

Anyway, this extra day off is to compensate for the extra weekends we came in to work. I’m happy, though I have been working 10-12hr days this week. I got in before 10 this morning and left at 9 something. We did hold a morale event for the team this Thursday and we went bowling again. My scores for the 3 games were 91, 118, and 67. My 3rd game was horrible. My 1st 4 boxes were: X 1 X 0. But our team did manage to get a free lunch by winning the 2nd round. The description was iffy, but the rule was a decent place, no fast food, but no Met either (Met = Metropolitan Grill, apparently the best steak house in Seattle).

But I’m glad this RC0 push for InfoCard is finally over. We also got a new teammate and he’ll be helping me on the UI aspect which I’ve been lagging. Yay!