Category Archives: Uncategorized

Weather Underground Script

Since weather.com is ending their free XOAP service conkyForecast will no longer work at the end of this month.

Therefore I wrote a small script to get the temperature and condition from Weather Underground

#!/usr/bin/python
#
# Fetches Weather info from Weather Underground
#
# Usage: ./wundergound.py zipcode
#
# International:
#  * Go to http://www.wunderground.com/
#  * Find your city
#  * Click the RSS icon
#  * Station ID is the number that follows /stations/ in the url
#
#

# Values are either True or False
metric=False
international=False

import sys
import feedparser

def usage():
    print("Usage:")
    if international:
        print("  ./wunderground.py StationID")
    else:
        print("  ./weunderground.py zipcode")
    sys.exit(1)

if not len(sys.argv) == 2:
    usage()

location=sys.argv[1]

if international:
    url="http://rss.wunderground.com/auto/rss_full/global/stations/"
else:
    url="http://rss.wunderground.com/auto/rss_full/"

feed=feedparser.parse(url+location)

if not feed.feed:
    # Assume Error
    print("Error")
    sys.exit(1)

current=feed['items'][0].title

if metric:
    temp=current.split(",")[0].split(":")[1].split("/")[1].strip()
else:
    temp=current.split(",")[0].split(":")[1].split("/")[0].strip()

condition=current.split(",")[1].split("-")[0].strip()

print('%s - %s' % (temp, condition))

 

Example:


$ ./wunderground 11201
69.6F - Clear

I’m using this script for my conky config:

${execi 600 /home/pyther/scripts/wunderground 11201}

Remote Assistance – Win XP/Vista/7

I was looking for a solution that would allow me to remotely connect to machines on the local network. We often get phone calls form users asking for help. It is way easier to provide help if we can see their screens and we usually end up having to visit their workstation. This can be time consuming, especially when we are in the middle of a project.

In my search, I came across a wonderful gem called Microsoft Remote Assistance which happens to be included in Windows XP/Vista/7.

How does it Work?

  1. Tech enters the Machine name of the client that he/she wants to provide Remote Assistance to.
  2. User is prompted to allow Tech to view their computer (Yes/No)
  3. Tech then can request to take control
  4. Again, the user is prompted to allow the tech to take control

Enabling Remote Assistance on the Domain (via Group Policy)

Computer Configuration -> Policies -> Admin Templates -> System -> Remote Assistance

  • Offer Remote Assistance -> Enable
  • Solicited Remote Assistance -> Disable (If you don’t want your users requesting others for Remote Assistance)

You then have two choices “Allow helpers to control the computer” or “Allow helpers to only view the computer”. In addition to selecting one of these choices, you have to add the users and groups that should be able to provide remote assistance.

Offering Remote Assistance

  • Start -> All Programs -> Maintenance -> Windows Remote Assistance or type in msra.exe
  • Click “Help Someone who has invited you”
  • Click “Advance connection option for the help desk”
  • Lastly, enter the machine name or ip address of the machine you want to provide Remote Assistance to

 

How can I possibly remember all the host names?

I’ve created a small C# application that you can have your users run. I would put it on a shared drive and push out a shortcut via group policy.

WhoAmI

Source: WhoAmI.zip
Bin: Included in source ./WhoAmI/bin/Release/WhoAmI.exe

Offering Remote Assistance – A nice GUI app

Although the method mentioned above works it is long and convoluted. I put together a small  C# app to easily offer Remote Assistance to a user.

The app simply calls msra.exe /offerra <hostname>

Source: RemoteAssistance.zip
Bin: Included in souce ./RemoteAssistance/bin/Release/RemoteAssitance.exe

Ideas for the two Easy GUI apps came from SYNACK over at edugeek. http://www.edugeek.net/forums/coding/49448-easy-gui-remote-assistance-support.html

More Information:

HDTV Recording (MPEG2) to DVD

I record an episode of Dateline NBC because one of my family members wanted to see it, but she wasn’t going to be home to catch the episode. After much fooling around I finally got something that worked well.

So I’m tossing this here in hopes I will remember it and that someone else will find it useful.

The recording was in HD at a resolution of 1920×1280.

mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:480,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=6000:keyint=18:trell:aspect=16/9:acodec=ac3:abitrate=224:threads=4 -ofps 30000/1001 -o output.mpg input.mpg

And as another note: When you have a 16/9 video and you scale it to 720×480 (4/3) it will show the full frame to the wide screen tv (making the video look correct) or it will be stretched on a fullscreen television if the dvd player is outputting 4/3 letterbox. If the dvd player is outputting in cropped mode it will cut the extra width of and just show you the 4/3 portion.

^^ – This is how I understand the processes. It may be extremely wrong. If it is and you have a better understanding please let me know!

Webkit

Webkit has been a piece of software I have been interested with for quite a while. For those who do not know, webkit is a web rendering engine. Safari and Google Chrome are two popular browsers that use webkit as their rendering engine.

Webkit was forked from the KHTML project by Apple in 2002. At the time it was know as WebCore and JavascriptCore.  A year later, Apple provided patches to the KHTML project. The KDE team was able to use some of the code, but much of it was poorly documented and the coding style differed greatly. In 2005, Apple opensourced their fork (WebCore and JavascriptCore) as webkit.

I first gave webkit a shot about a year or so ago. I read about midori, a web browser that uses webkit, and I decide to give it a try. Midori was very simple and basic, which I liked and it was faster than firefox. However, webkit would crash a lot when loading/rendering web pages, resulting in midori crashing. Of course nobody likes this and I switched back to Firefox. From that point on, I was impressed with what was going on and tried the combination of webkit/midori every few months.

Over the last year, there have been huge improvements with webkit.
Here is a look at the current status of webkit:

The Good:

  • Spell Check support. Let me explain. When spell check support was introduced it would detect misspelled word, but there was no way to see a list of suggestions or pick a suggestion. Before, when a suggestion was picked it would erase the word!  Now, it is possible fix the spelling mistake by selecting (highlighting) the word and right clicking. It is a tad bit annoying that the whole word needs be selected, but it something that you get use to.
  • Fast: If you thought Firefox was fast, webkit is even faster and it seems to do pretty decent job at rendering javascript quickly too.
  • HTML 5 Video: Youtube has deployed HTML 5 videos which only work in webkit based browsers at the moment. There are two file formats for html 5 video: OGG Theora and H264. Mozilla wants ogg theora to become the norm because it is an open and free format, whereas h264 is bound with licensing restrictions and the future is unknown for the codec (will it remain free?). Due to Mozilla stance on the issue and licensing issues, Firefox only works with OGG Theora video clips. Youtube videos are encoded in H264 therefore they won’t work with Firefox. Webkit gets around this issue by using the native operating system’s video player. In the case of linux, webkit uses gstreamer, which results in all videos being processed by gstreamer, not webkit.
  • Developer Tools: Although the inspect page/element program needs some work, it has some very promising features. It is similar to firebug, but it also has features that allow you to see what is being stored locally (cookie, session info, etc..), how fast your page is loading, how long each element takes to load, an error console, and a scripts debugger.
  • Independent: Webkit is independent from any browser. This makes it much easier to integrate webkit into a web browser. Google chrome, Safari, Midori, Aora, and Uzbl are just a few browsers that use webkit as their rendering backend. As a result, you get developers that will provide patches to Webkit because they want their browser to do x, y, z or render pages better.

The Bad:

  • Crashes: Although all web browser crash at some point in time webkit still seems to crash every now and then. Granted, within the last few days I’ve only had one or two crashes, but Firefox and other browsers rarely ever crash (unless if flash is loaded). However, Midori and other webkit browsers can restore the session if their is a crash.
  • API: There is still a lot that needs to be done with the API. For example, form auto complete needs to be implemented. Any form auto complete that is seen right now is being implement by the browser (midori, safari, chrome). It would also be nice to get right click spelling to work (without having to select the word). Lastly, the organization of the right click menus could be improved.
  • Webpages: There are a handle full of web pages that simply won’t work with webkit right now. The two that come to mind are the University of Akrons Zipline (Student Center, specifically) and Cisco Netacad. Both of these sites use long and complex URLs and the cisco netacad site is built around flash.

Webkit has seen major improvements, but still has a long way to go until it reaches the maturity and stability of other browser on the market. I would consider webkit to be usable on day to day basis providing you don’t have to access one of those overly complex pages that don’t work well with webkit.

Arch Linux AUR Packages:
midori-git: http://aur.archlinux.org/packages.php?ID=14349
libwebkit-nightly:  http://aur.archlinux.org/packages.php?ID=34814

PacketTracer 5.2.1 – Linux

There is a bug with PacketTracer which seems relatively minor but can cause a lot of frustration to users.

Take me for example: I am taking Cisco 3. It has been 2 years since I took Cisco 1 and 2. The first day in class we were given a review packet tracer file to work on. I forgot to save and when I finally remembered it bit me in the but! I went to save my work and PacketTracer crashed! I lost everything.

Issue: PacketTracer 5.2.1 crashes / segfaults on linux when saving files.

Reason: PacketTracer 5.2.1  is built against Qt 4.4.3.  However, it is using the system version of Qt which is likely newer. In my case, I’m using Qt 4.5.3. Many other distributions also use 4.5.3. It appears that there has been a code change between Qt 4.4.3 and 4.4.5; therefore, making 4.4.5 incompatible with PT 5.2.1.

Solution: Have PacketTracer use the qt libs that it ships with.
This  can be accomplished with the use of LD_LIBRARY_PATH and a shell script.

#!/bin/sh

export LD_LIBRARY_PATH="/opt/pt/lib"
/opt/pt/bin/PacketTracer5

Adjust the paths as necessary, save the file, and make it executable.
PT might not look as nice and pretty, but it won’t crash!

RHCT Here I Come!

Well the big day is tomorrow! After spending nearly half a day, yesterday, getting virtualbox to boot RHEL 5.3 and studying today, I pray I am ready.  The catcher with virtualbox was that acpi_io had to be enabled or else the kernel would hang on boot.

I’ll update you guys tomorrow!

New Computer

Well I was not excepting this to come. Let me explain. First my mother’s laptop died, sort of. It would be on AC power and then suddenly switch over to battery power. Because the battery no longer held a long charge ( <5 min), this became problematic. I decided it was best to give my mom my Dell Vostro 1000 laptop and just buy some cheap stuff from newegg. As you may or may not know my desktop at the time was an Atom 1.6ghz. This was enough for normal everyday tasks, but not enough for the occasional Virtual Machine or movie conversion.

$150 for a motherboard, cpu, and a stick of ram sure in the hell beats $400 for a mediocre laptop.  I ordered the parts, but later that night I found out that the sata card on my server stopped working. This meant no more Hard Drives! Needless to say this caused the Linux to crash and it was impossible to bootup again.

So Linux saved the day… It was about 11:00pm and I was getting ready to go to bed. This was when I found out my server’s sata card just died. So I took my Atom desktop, took out the hard drive, and tossed the server’s drive in there. Then with a little bit of file editing (fstab, grub, and inintrd boot image) I had the system back up and running.  So in three hours I had the whole server back online with all its services going. Now lets see that happen with Windows.

Finally, the motherboard, stick of ram, and cpu arrived. To make a long story short, I installed everything into the case that was housing, the now broken, server. Everything was going fine and I installed Arch Linux. I went to run firefox, but had no luck. I was receiving a “Bus Error”. After a quick google and some time on IRC I determined there was a corrupt library installed. Instead of trying to figure out what lib was corrupt I figured it was just easier to reinstall as I didn’t have much setup.

I reinstalled and now everything is working without a hitch. Now for the part you’ve all been waiting for, the specs!

The PSU and case are 4-5 years old, but, hey, they work. Overall this is a pretty nice system. It has more than enough power for what I need it to do. My only complaint with the motherboard is that suspend-2-ram is total trash in Linux. The onboard nvidia graphics are pretty nice too. I can play UT2004 which makes me happy!

I need to replace the power supply as it is very loud! I will probably do this before I go of to college as I doubt my roomate wants to listen to a blaring fan all night long!

Learning Dvorak…

First off I want to say I’m not dead yet!

So I decided to learn how to type with the dvorak keyboard layout. I had tried this once before, but I gave up! Surprisingly I remembered some of the layout. You are suppose to be able to type faster with the dvorak layout and I think I see how this is possible. There are many common words which can be typed only using the middle and top rows. Also the majority of the “letter” keys are typed with the right hand, which is easier for everyone who is right handed.

I started this adventurer a few days ago and to my surprise my typing speed is not all that bad. If I had to guess I’d say I am typing at about 25-30 words a minute right now. I presume that with some more practice I’ll be doing 40-50 words in a few more days.

Overall I am happy with the switch. Hopefully once I become more comfortable I will be able to switch between dvorak and qwerty without a problem.

http://upload.wikimedia.org/wikipedia/commons/2/25/KB_United_States_Dvorak.svg

[rant] Irrelevant/Unrelated replies to Topics

Over the last few weeks I have noticed a lot of replies in the archlinux forums that have nothing to with a given topic.

Take something like this post: http://bbs.archlinux.org/viewtopic.php?id=65023

The OP is having problems getting eth0 to get an ip via dhcp on startup, however the op states that manually running dhcpcd eth0 works without a problem. So I type out a reply, submit it, and I wait for the op’s response. In the meantime someone posts saying:

Are you getting ab IP, but just not connecting to the internet? If so, comment out the following 2 lines in rc.conf:

gateway=”default gw 192.168.0.1″
ROUTES=(!gateway)

The ROUTES=(!gateway) prevents the gateway from being set. Commenting out those two lines aren’t going to do anything! Nothing I tell you, well at least to fix the problem at hand!

and then you get this post:

My guess is that you have to remove the ! from the front of gateway in ROUTES=(!gateway)

That’s what I used to have to do on my old desktop.

Also, be sure that 192.168.0.1 is actually your gateway. If you don’t know you run dhcpcd then run route.

If you have even the most basic concept of networking, you would know that dhcp would pull in the default gw and all the other information such as dns servers. Regardless, this has nothing to do the op’s problem because the op stated that running dhcpcd manually works! Thus you can infer that the correct gateway is being set with dhcp.

Continue reading