english test

I’m not as smart as I think.

Advanced
You scored 100% Beginner, 93% Intermediate, 81% Advanced, and 61% Expert!
You have an extremely good understanding of beginner, intermediate, and
advanced level commonly confused English words, getting at least 75% of
each of these three levels’ questions correct. This is an exceptional score. Remember, these are commonly confused English words, which means most people don’t use them properly. You got an extremely respectable score.

Thank you so much for taking my test. I hope you enjoyed it!

For the complete Answer Key, visit my blog: http://shortredhead78.blogspot.com/.

My test tracked 4 variables How you compared to other people your age and gender:

You scored higher than 68% on Beginner
You scored higher than 30% on Intermediate
You scored higher than 8% on Advanced
You scored higher than 15% on Expert

Link: The Commonly Confused Words Test written by shortredhead78 on Ok Cupid

vim word and code completion

Microsoft’s intellisense is an awesome power for developers to wield code faster.

I prefer vim for various reasons which I will not list.

Sometimes completing words or variable names in vim would be nice. Particularly when I forget the case of a variable because I am not using consistent style of variable names, or when I’m using someone elses code.

I’ve been familiar with vim and tags for a while. Vim will read a file named tags from the current directory and use it to index other files. The tags file is generated by the program ctags which is hopefully the version from the exuberant ctags project. Its great to be able to navigate to function implementations and member declarations. Tags are great.

I’m new to vim’s dictionary functions. I learned about it in vim tip #91. I added

" enable words completion
set dictionary+=/usr/share/dict/words
" use ctrl-n ctrl-n instead of ctrl-x ctrl-k
set complete-=k complete+=k

to my .vimrc.

Now I can ctrl-n to cycle through variables, function, in the tags file, or words in dict/words.

The piece which is a bonus is when I don’t have a match in those files, vim actually scans included files. I stumbled on this when testing in a C file. I don’t write much C, but it turns out vim will scan included files in your current file for word matches. This are the complete+i and d options. See :help complete for more information.

It turns out ctrl-n automatically completes variables based on tags, includes, and other things listed in the vim help. I did not need to add anything to my vimrc to have this support, I just needed to know to use it. The vimrc additions just include using ctrl-n for the vim dictionary feature.

As a “P” person (perl/python/php), it would be awesome to have “includes” include searching perl/python/php based on use/import/require&include. But I’ve not found how to do this. For now, tags will do. Same for C#.

Coupled with code folding, there is not much vim won’t do. I’ve been using vim for years, and I’ve always found it difficult to find good documentation. There is so much out there geared toward new users, that finding intermediate to advanced tips is difficult. :help is sometimes good enough, but other times I want more of a howto or users guide.

“Learn vi” should always be translated to learn vim, including regex, code folds and tags. Now I extend this list to include completion.

The Importance of Being Correct

I don’t like being wrong. I mean who really likes to be wrong? I don’t mind saying wrong things. I like to argue, so I often play devil’s advocate. This I enjoy. Its fun to challenge ideas and thoughts. Being wrong when figuring things out is fine. Being wrong on a long term decision or strategy is a real bummer.

I’m very proud of the firewall at my Dad’s house. It is an old tank of a desktop PC running Linux and iptables for network address translation. I’m sure it has protected my dad from the hell that many experience with cable modem viruses and the old Windows Messaging popups. I’m also proud that I installed Debian on it sometime in 1998 and never reinstalled. It moved from Debian 2.0 to 2.1 to 2.2 while in testing, back to 2.1 without hiccup. It is a tribute to Debian’s excellent packaging.

For the past year+ I’ve been running the 2.6 kernel on this particular computer. It has run fine. I noticed some network problems in connectivity between a long network drop from this computer to my Dad’s primary workstation. I did everything short of running a new drop. I replaced NICs in Dad’s computer. I recrimped ends. I added and removed hubs and switches in the mix. Connectivity always seemed poor.

Last weekend I finally upgraded to a recent 2.6 kernel. I installed the 2.6.10-1 debian package. I had been running a 2.6.5 package which I never upgraded. I didn’t see a need to upgrade. (please don’t comment about the numerous security issues with the 2.6.5 kernel. I know. I don’t care.) The 2.6.10 kernel fixed the connectivity issues.

I cannot beleive that 2.6.5 has some driver problems with the rtl8139 card, but apparently, that is the issue I was having. I haven’t had these kinds of issues with linux in a long time. I guess that is what I get for being an early adopter of 2.6.

The amazing part is that I only upgraded the kernel because I was there in person to install a large disk drive. I had tried using network disks, but because of the buggy driver, the performance was poor. Now that the network is performing, I can use network disk. This is good, because the disk that I put in has already died! It was an old 10G drive, so I won’t call it bad luck exactly, but it is strange luck for sure.

Moral of the story: I have no idea. Don’t rule out the bug being in the kernel or software…. maybe? … oh and being wrong sucks.

fun quiz

What “Happy Bunny” phrase are you?

hi, loser

You are a very outgoing and fun person. Everyone loves to be around you because your personality is so out there!

Personality Test Results

Click Here to Take This Quiz
Brought to you by YouThink.com quizzes and personality tests.

Nothing else much is up.

I’m trying to package mono-1.1.4 for ubuntu. Making debs is not as easy as making RPMS. Or maybe its not as well documented. I’m still not sure if dpkg-build ever actually runs make install. No biggie. I’ll figure it out eventually.

Nothing else much up. Need new music to listen to at work.

I Want to Pipe My Output to Two Commands

syndicate said, “cat file |/sbin/command | /bin/command2” would be cool.

Yes, it would be cool. I thought maybe it would be possible by copying file descriptors, but I couldn’t quite figure that properly. The magic was in using a fifo.

Specifically large read operations should only be done once. Lets say we are reading an entire disk using dd, and sending that somewhere via netcat.

Normally we would just dd if=/dev/sda | netcat somewhere 1234

But it would be nice to compare the md5sum at both ends. If we run md5sum /dev/sda we get the md5sum, but now we have read the entire disk twice. That can take a long time. Lets only read it once!

The solution looks like this:

mkfifo myfifo ; dd if=/dev/sda | tee mkfifo | netcat somewhere 1234 & md5sum test

The data is sent to the fifo and netcat at the same time. The fifo is blocking so it is important to read from as soon as possible, so we start reading from it with md5sum immediately.

A solution on the receiving end to write the file and md5sum it immeidately is as easy at tee:

netcat -l -p 1234 | tee file | md5sum

ASP.NET generated html textarea instead of input type text in a datagrid

aka… learning is growing and growing means growing pains.

One of the wonderful things about ASP.NET is Microsoft’s ASP.NET Web Matrix. It includes a GUI Web Forms designer as well as many excellent templates for data driven pages. It is free, which means that coupled with IIS5.1 on Windows XP or even MONO on Linux, you can develop ASP.NET Web applications for free. There is no need to pay $$$ for Visual Studio.NET.

I’m new to ASP.NET, but since I’m not new to the web or programming, I often find myself trying to do slightly more advanced things with unfamiliar tools. This happened today with the datagrid control. I have a very simple SQL Table that drives a very simple FAQ for a website that is still powered by old ASP. I won’t vent how painful it is to maintain this old ASP code other than this sentance mentioning it. Amazingly, no one ever write a front end for maintaining this table of FAQ entries! Maybe some used Access to maintain it? I find it hard to believe someone actually edited things with direct SQL commands, or SQL Enterprise Manager. I wanted a very easy way to update the FAQ.

ASP.NET’s DataGrid control provides a very easy way to get this done. In fact, with ASP.NET Web Matrix, I was able to say “File->New->Data Pages->Editable Data Grid” and have a template ready for me to change to our environment. I change connectionString, SelectCommand, and the INSERT and UPDATE lines and I had a working page! That was so easy it was awesome! But who wants to edit html in a input type=text html control?

Google Groups didn’t show much about easy solutions for this. The only reply I found suggested using TemplateColumns and inserting the textarea directly. Well, I’ve seen DataGrid TemplateColumns before, and they are an excellent and powerful features, but I wanted a quick hack into editing a table. TemplateColumns would have been overkill.

I learned that ASP.NET doesn’t differentiate between input type=text and textarea. Instead ASP.NET decides which to display at page render time. If the ASP.NET TextBox control is multiline and has row and column counts greater than 1, it renders a textarea instead of an input box. (To be clear, it depends on teh values of TextBox members TextMode, Rows, and Columns.)

The biggest question to me, as a DataGrid newbie, was to find where to set these properties. It must be done programatically at run time, because we don’t have access to the controls at design time. Well, we might have some access to the controls are run time, but that involves the ColumnTemplates that we are trying to avoid. It turns out that the DataGrid.ItemDataBound event is where things need to be.

Add attribute OnItemDataBound="DataGrid_ItemBound" to the asp:datagrid tag.

Then set properties in that event function.
For example:

void DataGrid_ItemBound(object sender, DataGridItemEventArgs e) {
if ( e.Item.Cells[3].Controls.Count > 0 ) {
((TextBox)e.Item.Cells[3].Controls[0]).TextMode = TextBoxMode.MultiLine;
((TextBox)e.Item.Cells[4].Controls[0]).TextMode = TextBoxMode.MultiLine;
((TextBox)e.Item.Cells[3].Controls[0]).Rows = 20;
((TextBox)e.Item.Cells[4].Controls[0]).Rows = 20;
((TextBox)e.Item.Cells[3].Controls[0]).Columns = 40;
((TextBox)e.Item.Cells[4].Controls[0]).Columns = 40;
}
}

The event gets called for every binding. If you are familiar a little with the DataGrid, you know that even in edit mode, the grid is displayed, so the non-edit table cells need to be displayed, so the if block is important here!

aspvbs.vim if..endif folds

add this line


syn region AspVBSFold start="^\s*\(if\)\s\+.*$" end="^\s*end\s\+\(if\)\>.*$" fold contained transparent keepend

It helps a lot 🙂

flickr + xscreensaver = fun

Yesterday I fixed the livejournal script that comes with xscreensaver to work with any rss feed. No more boring fortune output when xscreensaver randomly picks Noseguy. Instead, a random quote from your favorite rss feed is displayed.

Today I hacked up JWZ’s xscreensaver-getimage-file perl script to pull images from Flickr instead of a file or directory on your computer.

It was easy to do using Flickr::API and LWP::UserAgent.

glscreensaver, blitspin, decayscreen, distort, and any other xscreensaver that normally would pull an image from a directory, will now pull a random photo from any users public flickr photos.

Here is how to install it on an ubuntu hoary system. This is probably true for warty, and debian, and many other distributions.
Continue reading “flickr + xscreensaver = fun”