snicknet.net

‘Keepin it White n Nerdy’

Archive for the ‘Coding’ Category

What a Weekend

Posted by Nick on Mar-2-2008 under Coding, School, Work

Well, I can’t believe another weekend has come and gone. This weekend felt particularly long, and yet this is only the case because I had so much to do. On Saturday I helped Izzie out at his data center. We racked up a new server. It was much quicker than last time, all went very smooth. Afterwards we played a few rounds of Red Alert 2. The rest of the time was spent working on Jame’s and my new venture.

I got a pretty nice looking proof of concept put together. Unfortunately we are able to come up with features far faster than I am able to code them. I’m proud to say that at least we have something to show. I still have much work to do. Currently the show piece is just static code. The next big phase of the project will be to drop in the database aspect to the whole thing. It’s all planned out in my head, but every time I think about it I realize how far I have to go. This next week at school should be rather eventful. Between several projects and possibly getting the Arbitech job I’m in for a treat.

I did get a small moment to test out the iPhone FTP daemon offered by the dev team. I must say that my tests show this to be the perfect method for transferring those large video files to my phone. I was originally going to SCP the files to the phone, but I quickly discovered the limitations of that protocol when I topped out at 300kb/s. FTP resulted in a significant gain, 6.5mb/s. Thanks go out to Izzie for this awesome recommendation. I still need to write the scripts. Perhaps if I get sick of writing PHP for work, I’ll switch gears and write PHP for my iPhone.

I remember when I first wanted to start learning database driven web page programming. I asked a friend about PHP. He immediately scolded me and told me to use ASP, I didn’t really pick up on it. Fortunately, ASP .NET was release around this time. So, I tried that out and learned to code in it using VB. That worked for quite some time. I wrote my first multi-user web application in ASP .NET while I worked at Coast IRB. I started running into PHP when I had to modify a few little projects for Coast that I hadn’t written. Then I started tinkering with open source projects which are pretty much entirely written in PHP. Now, here I am, and all I write now is PHP. I wouldn’t venture to say I’m a professional by any stretch of the imagination. I still consult online forums and code examples frequently, but I have learned a lot while working on my various projects. I can safely say I far prefer PHP to ASP .NET. Well, I better hit the sack. Gotta rest up for whatever tomorrow has in store for me.

Random Thoughts on a Friday Evening

Posted by Nick on Feb-29-2008 under Coding, Work

Well, the job at Arbitech is looking like a go. After they check and ensure I’m not a psycho bent on IT Armageddon through a background check I should receive an offer sometime next week. So, I’m on hold for a few days on the job front. As for coding I have some big milestones to hit this weekend. I plan on spacing everything out so I don’t go completely insane. I’ll throw in some light gaming between crazy coding, we’ll see how that pans out tomorrow. As for coding drive, I found some today :). I must forewarn my readers, I’m a big movie guy and as corny as it sounds I like reciting lines, playing soundtracks, and viewing my life as if I were in a movie on occasion (Mind you I have absolutely no desire to actually be in one). Consider yourselves warned. My dream car for as long as I can remember has been an Aston Martin, any flavor would do, because to me they’re all drop dead gorgeous. So, my vision: “I’m driving an Aston Martin V8 Vantage, manual of course, while blaring a compilation CD of the most popular James Bond intros. Cruisin up the coast.” So, there you have it, coding fuel. Go ahead, laugh, jeer. Say what you want, but it’s my vision, so no copying it. Plus should my vision become a reality I have all the right to laugh at everyone I see while attempting this life fulfilling moment. Alright people, lets hear about those crazy things that fuel our day to day lives.

Interesting Kind of Day

Posted by Nick on Feb-28-2008 under Coding, School, Work

Well, today was different to say the least. I started to pick out my classes for the next quarter this morning. I got a rough schedule put together before I headed out for school. I am lucky enough to have yet another quarter of driving to UCI everyday of the week. Once again I’m only able to take three classes and then everything else causes a conflict. It’s like UCI purposefully punishes transfer students and slows them down to make more money off of them. I was able to schedule in 18 units across 6 classes at Saddleback and IVC without any trouble. Whatever…so, I’m driving to UCI and I get a phone call from an unrecognized number. Normally I let them go to voicemail, but I had some time to kill and nothing going on for the day so I answered. It turned out to be Arbitech. I had interviewed for a part time position there about three weeks ago. I never heard back after the second interview and had by now presumed the position to be filled. I have my application in at Starbucks right now as my fall back. So, it turns out that Arbitech wants me back for a 3rd and final interview to meet the COO. I was a bit dazed over the whole thing figuring this job to be long gone. So, I’m set to go in tomorrow morning at 10am. I start pondering the schedule I created for the next quarter and it hits me that I have absolutely zero work time in this schedule. I have 7 separate classes in all for the next quarter. I haven’t quite figured out what I’m going to do. UCI doesn’t offer any evening courses, and every class is offered once, twice if it’s a really popular class. I was quite upset about this and contacted the deans office to find out why a school that’s making a couple million every three months not to mention state funding can’t offer some of their courses in the evening or at least twice a day. I left a message. I went through the rest of my day, I eventually got a voice mail from the deans secretary stating that I probably wanted to talk to Student Affairs. I’m not sure what to do on that front for the moment. They’re not going to listen to me anyway. I had planned on discussing the problem of non-English speaking math teachers and UCI’s un-flexible schedule. I doubt anyone else has complained. Everyone on campus doesn’t question anything, they’re just there and accept it for what it is. It baffles my mind to see all these people so worried about getting straight A’s on their report cards so that their parents don’t  kill them. They don’t turn out to be human by the time they’re done. After class I was driving home, and completely forgot a job I had to do, my mind was just racing over all the different things that had happened. Needless to say that customer was a bit angry, I’ve rescheduled for tomorrow morning at 9AM, it better be quick. I’m not running late for that last interview. I don’t need their patronage if I get this job.

I have soooooo much stuff to do, and yet I can’t seem to muster an ounce of energy to do any of it. I need to code a prototype for tomorrow as a proof of concept and I can’t seem to focus my mind on anything. I don’t know what’s wrong with me. I’ve been like this for the last few days. I just don’t want to do anything. It’s horrible. I’m wasting a lot of time that I don’t have to waste. I could just sit here and write for hours about seemingly meaningless subjects. Why is it so hard to focus? Perhaps I will try rewarding myself for coding. As I make progress on my code I will write some more on my blog. We’ll see if that works.

Let There Be Video

Posted by Nick on Feb-27-2008 under Coding, General

So, I have completed 1/3 of my iPhone video converter script. I tested out several shows this evening and I can safely say I think that part of this project is completed. I did run into a few minor issues while testing. When I first started playing video I got 80% of the way through the show and then my iPhone crashed. Each time I tried seeking to that point in the video file my iPhone would crash again and again. I decided it was time for an upgrade. So, first I tried restoring the phone from 1.1.3 to 1.1.3 and re-jailbreaking it. After my settings were all restored my mail application crashed. I tried a few things with no luck. Then I decided to take the plunge and upgrade to 1.1.4. Same problem. So, I ended up doing a full restore of 1.1.4 on my phone and rebuilding it from scratch. I can safely say this was a great choice. Since I hadn’t restored my phone since I bought it, I had miscellaneous folders from various applications and all sorts of upgrade leftovers from the 1.0.0 through 1.1.3. I now have a clean, streamlined, well running 1.1.4 iPhone that can do cell triangulation. I setup my Apache server again without any trouble, copied over my show and everything worked like a charm. Apple definitely did some bug fixes and possibly a small overclock on the front side bus again like they did in 1.1.1. The phone is more responsive and video is much smoother.  Overall I’m very pleased with this phase of the project. I’m very much looking forward to the release of the SDK on March 6. Hopefully these extra few days allowed Apple the time needed to make the SDK that much better. I think my next task will be to script the automatic conversion of selected videos after they download. I’ll have to go through some code and figure out the best plan of attack for this. I will post my findings.

5 Days Since My Last Post!!!!

Posted by Nick on Feb-26-2008 under Coding, General, School

Wow, I’ve been incredibly busy over the last five days. This morning I looked at my blog page and nearly fell out of my chair when I realized it’s been five days since my last post. This weekend I went to Los Angeles with my friends Izzie and Larry to help them setup some new servers at a data center. It took longer than expected, but it was a great experience being back in a data center. This place was still very small, only a handful of racks were even occupied by one server. After getting everything setup we went to Fat Burger and met up with my partner in crime James. Sunday I stayed at home and did some chores. I had school yesterday and here we are today. I have made some progress with my video converter. The script is pretty much done. The only thing left is the fine tuning of my video conversion line. I ended up going with PHP as my script language. I’m more familiar with it and in the end it just was easier. I have my aspect ratios dynamically being calculated and the appropriate dimensions being used. I will try and get this script finished today. I really want this project squared away. It would get me about 1/3 of the way done with the project as a whole. Still left is a script to take the converted videos and push them to my iPhone and a script to queue up my TV show downloads. I got my Apache server on my iPhone all setup and pointed to the /var partition so that I’m using part of the 7GB partition on my phone to store the videos rather than part of the 300MB system partition. This was a fun chore as I had to SSH into the phone and chmod the httpd.conf file so I could alter it. Once I did that, made my changes, and restarted Apache all was working perfectly. Well, I have a rough draft for  paper due in about 2 hours that I haven’t written. I’ll try and post an update before I go to bed tonight. Unfortunately with so many projects in school and out I’m not sure what I will get accomplished.

Moving Forward

Posted by Nick on Feb-21-2008 under Cars, Coding, Work

Well, not to much happened today overall, but I’ll catch you up on the little things. First, I called up Starbucks to see how the applications were moving along. They’re still going through the stack from Monday. I’m keeping my fingers crossed for that phone call. Hopefully by tomorrow I’ll hear something. Next up, a client of mine who is an avid VW fan like myself informed me that there is a beautiful Audi A6 S-series at our local VW dealership. I drooled on the pictures for a bit. I was seriously considering until I saw it was automatic. After slapping myself back to reality I realized that for a much smaller cost I could mod the Jetta further and escape starting another car loan. I think I will keep with this plan. Every once in a while temptation springs up and I want to get a new car so bad. Luckily it usually turns out to be a passing thing. If all goes well with Starbucks hopefully I’ll be posting some Jetta mods in a few months. I have started brainstorming my plan of attack for this new business venture with James. I still have a lot of research to do and hopefully this weekend I’ll get some time to do a bit. On my wireless video syncing front I did further testing today. I tried a bunch of scripts that are currently available for converting video for viewing on the iPhone and iPod Videos. None were super advanced and resulted in either poor quality video or unplayable formats. I have decided to pursue writing my very own script to do the conversion processes using ffmpeg. This will be my first major shell script so I’m guessing it’ll take a few tries. I got part of the script squared away this evening when I came across a post describing how to parse out values from the command line. Credit goes to prowla for this line found here. Using prowla’s command as a basis I have come up with a line to get the values needed to calculate proper aspect ratios:

tcprobe -d 0 -i filename | grep “frame size” | sed ’s/^*-g //’ | awk ‘{print $1}’

This returns just the frame size of the video that you input. From there I will parse the height and width and perform the division to figure out the appropriate conversion size and to add the proper amount of padding to the top and bottom of the frame. I’m going to try and make a bit more progress on this tonight. Once this is complete and I can properly calculate the values I will write a basic ffmpeg command to convert a video. I have settled on using MPEG4 compression, or lack there of, for compressing my videos. I have not had a single successful conversion with H264 that was playable on the iPhone, until I figure out the B frame settings and all of that I will stick with the easy solution. Once the videos are converted I will write a script to SSH them into my phone each morning at 1AM or something around then. If I can accomplish this I will be only a stone throw away from having a fully wireless media flow with my iPhone.

iPhone Video Update

Posted by Nick on Feb-20-2008 under Coding

Well, I made some good progress today with my video distribution system. I had converted some videos this morning using ffmpeg and streamed those to my iPhone over wifi and the edge network. The quality wasn’t great, but it worked. After getting home from school I worked some more with ffmpeg and Quicktime trying to figure out exactly what format I needed for the best balance of speed and quality. I couldn’t seem to get any 3gp videos to stream to the iPhone properly. So, I can make MPEG4 videos that play, great. I was ready to throw in the towel and go to bed when I had a sudden thought. What if I were to write a script that runs each night at midnight and syncs files locally to my iPhone. I wouldn’t ever physically sync my phone and I’d have fresh content on it. I first tried using the Boss Tool plugin for file:// support in Safari. I didn’t have any luck with this. My mind then turned to Apache. What if I hosted a local file on a local http server and played the video embeded in a local html file. Presto! So, with Apache installed I am able to play videos. Tomorrow I will work out some details like how to change where my hosted directory for Apache is on the iPhone so that I can utilize the 7GB partition rather than the 300MB system partition for storing my videos. Then I will hammer out my ffmpeg format and write my script. The script will convert the videos and once I’m asleep each night it will copy them to the phone as well as generate an html page containing each of the videos it has converted. Then, I will watch the videos and delete them as I’m done with them. I’m very excited to get this system going because it will be the first “wireless sync” with usability for the iPhone. I’ll keep you posted with tomorrows developments.

Batteries are Running Low

Posted by Nick on Feb-19-2008 under Coding, General, School

After going non stop all weekend and then school today, I’m starting to feel the effects. I’m exhausted. I did buy some toys today. I grabbed a power inverter for my car so that I can charge and use my laptop in my car. I also ran out and grabbed a USB Bluetooth dongle. My intention was to start work on my bluetooth cell phone proximity script. I got a nasty surprise when I found out that the iPhone is unable to pair with any devices that aren’t handsets. I have searched non-stop for several hours and can safely say that at this point in time, there is no fix. I discussed a few alternative options with my friend Izzie. I may try doing something similar with WiFi. My worry there is that WiFi connects and disconnects rather regulaly on the iPhone to conserver battery power and the last thing I want is my lights turning on and off while I’m at home because my phone is saving power. So, for now this project will have to be placed on hold. I also grabbed a book on my way home called “Linux Multimedia Hacks”. It’s really neat. I found several things that I plan on trying out. One thing I setup and am playing with at the moment is Festival the text-to-speech engine. I’m quite impressed with how versatile the engine is for it’s size. I’m playing with the idea of writing a script to read weather forecasts to me. We’ll see how it turns out.  Not sure how much I will get done tonight. I have a bunch of math problems to do, and a small computer job at 9:30AM tomorrow morning. I’ve gotta find some time to get caught up on sleep. I can’t believe I had a 3 day weekend and non of it was spent catching up on sleep. Luckily we only have 4 weekdays as a result and 1 is down with 3 left. Well, I better get going so that I can get some sleep tonight. Oh, before I forget, Monday I went to the Starbuck’s hiring fair. I was lucky enough to have someone interviewing me that recognized me from when I worked there. So, if all goes according to plan I should get a call in the next few days, and I’ll officially be a barista once again. I’m soooo looking forward to that regular paycheck. Goodnight.

Busy Weekend with One Day to Go

Posted by Nick on Feb-18-2008 under Cars, Coding, General, Work

Me and two of my friends have been helping my boss do a major network migration this weekend. We started Saturday morning and finished last night. I’ll be going in tomorrow morning when everyone is back to help out with any minor issues. I’m really excited. This was a great income boost. While working I started drawing out my dream data flow for media between my devices. I’ll upload a picture later, but the idea is that TV, music, and movies will be connected to all my machines and will be wherever I want them when I want them. So, auto syncing of the latest shows to my iPhone and in time a machine in my car. I started work on this last night by constructing a little computer to work on downloading torrents. I will be using TED to fetch the torrent files for the various shows I want. Then I will use some kind of cron job to add the torrents to TorrentFlux. I have chosen TorrentFlux because of it’s web interface. This way I can queue up my own torrent as well. Ideally this will become my download server after I develop some kind of Rapidshare downloading site. Well I’m off to get some oil for the Jetta and grab an application for Starbucks. I’ll be going to the hiring fair today. I’m hoping I can get a job.

Finals are Over!!!

Posted by Nick on Feb-12-2008 under Coding, General, School

Today was my last final. My schedule worked out really nicely such that I had one final yesterday and my last one today. That signifies the half way point for the quarter. It’s hard to believe it’s already half over. I haven’t gotten any more progress done on my projects. I did however help a friend from school plan out a custom server that we will be building in the next week. That should be a fun project. Steve is still looking very glum. I fear that he was over watered when I got him. His pot doesn’t have a hole in the bottom and so he might have root issues. I’m not quite sure what to do with him. I’ll have to look around online and see what the procedure is for drying out his roots. I am quite enjoying my progress on my room automation page though thus far. I can safely say it has made me far more lazy and I enjoy it very much :). I’m having a hard time deciding where to go next with this project. The current interface is simple, but is hard to expand being static. As for my RealAge changes in my life I can safely say I definitely am feeling some changes. I thought the first day was going to be all placebo, but today I’m still getting that same boost in energy. I feel more awake all day and I get tired at a normal time. I haven’t felt this normal or regular in a long time. I’m working on my speeding. I found that not speeding when I had to be somewhere in a time crunch made me more stressed. Therefore I have set some ground rules for myself. I will only speed when absolutely necessary, but I will no speed over 80MPH. I don’t use it as a past time anymore. I have dropped down on how aggressive I am, changing into open lanes to speed by a few people is a no no. I can say with absolute certainty that it is helping my gas mileage if nothing else. All the sites that talk about it saving you a few MPG are right on the money. I’m definitely going to make an effort tomorrow morning to get something accomplished in terms of one of my projects. I have to figure out the best interface for the myRoom project. Speaking of which, I setup the Amarok XUL Firefox Remote plugin this weekend. Awesome plugin. It lets you control Amarok on another machine from any machine that has Firefox installed. You can search your music, add things to the playlist, and control the player. The last piece for me is creating a web version of this so that I can do these things from my iPhone and not just from my desktop. This coupled with an IR blaster that will switch on/off my receiver as well as change it’s input to whichever computer I’m playing audio from will be a huge step forward on this project. I came across a likely candidate for my IR blaster, although I fear it is out of my budget at the moment. I’m shooting for Monday to go to the hiring fair at Starbucks. I’ll have to pick up an application tomorrow on my way to school. If I can get hired there I will be able to move forward with that IR blaster. Well that’s all for now.