Text

Help my Key Commands are broken

I live and breathe key commands, even when a key command is defined I will often redefine it to be shorter or more convenient. (Move email to reference folder, Alt-M-M Ref Enter, Should just be Super-R)

So recently when I upgraded from Debian Squeeze to Wheezy and my Ctrl-F was not working, I was pretty concerned. No ^-F in the Terminal, not C-x C-F in emacs, no Find in any application.

The worst is trying to google for a key command. Searching for the Control Key, should I use the ^, C, Ctrl, Ctl, Control

Turns out… That a nice program that I have not yet learned all the magic of stole my Control key from me, and from all X-windowing events. xbindkeys was kind enough to redefine C-F to open an xterm window.

Editing the appropriate lines in ~/.xbindkeysrc had me on my merry way.

 # set directly keycode (here control + f with my keyboard)
 "xterm"
   c:41 + m:0x4

I found this problem by getting lucky on ask ubuntu.

Text

Making the web your own

I don’t often find myself bothered by the look of the web. out of place tile
But when I do, I want to fix it.

In my day job I am a software developer and my boss often assigns bug fixes and documentation updates to me. So we have a company wide website where all these things are maintained. The site maintains a list of tasks for me, a place to log hours/effort and a place for weekly notes.

page without style

You will probably note the small grey box for weekly notes is 4.5 lines tall. There are 5 days in a work week but only 4.5 lines in my box. What if my one of my days notes extend beyond the 80 character width of the box? Then only 3 days worth of notes are visible. Lastly, why does the box width not resize to fit the page width?

These are the things that I found were bothering my nearly everyday when I use this site so I found a solution.

The solution I found is stylish a Firefox/Chrome plugin that lets you apply a custom style sheet to any page on the web.

So I made my box bigger.

After installing the plugin, you can define a style sheet for any page, or family of pages on the web that you want. Lets take for example Daring Fireball. I have heard many people complain about the 11pt Verdana on light grey background.

By defining a simple CSS style sheet with Stylish we can make all the font bigger and have a proper grey text on black background.

A couple of things to note about the style sheet.

  • moz-document-domain ()

    • Use this to apply a style to any site on a domain. More info can be had at the projects github page
  • Use :!important after everything.

    • This is how you overwrite the current style, make this one important and take over what the previously defined rule is. (Yes, I know Cascading Style Sheets, but you need the important for some reason)

Here is what Gruber’s site looks like after we have improved it.

You can also go to User Styles to see what websites others have re-skinned.

Link

Fill them in with some form of text expansion and there may be a space at the end!!!

Text

Clang Compiler, You So Crazy

Just had this amazing experience. I am currently reading though my C programming book; I am trying to pick up all the things I missed the first time.

So I wrote up a short example program

    #include <stdio.h>
    int main () 
    {
       int i = 10;
       float y = 12.56;
       printf("i = %d, y = %f\n", y, i );
       return 0;
    }

Then compiled it using

    cc -o conversions conversionsSpec.c

Got a couple of warnings

    conversionsSpec.c:8:30: warning: format specifies type 'int' but the argument has type 'float' [-Wformat]
    printf("i = %d, y = %f\n", y, i );
                ~~             ^
                %f
    conversionsSpec.c:8:33: warning: format specifies type 'double' but the argument has type 'int' [-Wformat]
      printf("i = %d, y = %f\n", y, i );
                          ~~        ^
                          %d
    2 warnings generated.

But despite the warnings, when you run it.

    john@imac:~/kingBook$ ./conversion 
    i = 10, y = 12.560000

Even though the arguments to printf are improperly ordered, the compiler has divined your intention and printed them properly.


For the very curious my c compiler is clang.

    john@imac:~/kingBook$ type cc
    cc is hashed (/usr/bin/cc)
    john@imac:~/kingBook$ ls -l /usr/bin/cc
    lrwxr-xr-x  1 root  wheel  5 Feb 13 20:19 /usr/bin/cc -> clang
Tags: Clang
Text

markdown-mode.el

I’ve been getting great use out of [ markdown-mode.el ][ http://jblevins.org/projects/markdown-mode/ ] recently. All my notes for work are written in markdown and thus are plain text searchable. YEAH!

Thanks so much to the creator Jason Blevins.

The thing that I could not get figured out was the CSS style sheet. Using M-x customize-group RET markdown you can access a variable called markdown-css-path. I tried a relative path ~/Desktop/MarkdownStyle.css and an absolute path /home/john/Desktop/MarkdownStyle.css but neither would apply my style when I executed M-x markdown-preview.

Then after looking at the generated HTML, I saw that the sheet was being inclued but not executed so clicking on the sheet brought me to a page that stated file:///MarkdownStyle.css was not found.

So the markdown-css-path requires a file:/// style URL. All fixed up.

Tags: markdown
Text

Is my regex matching?!?!

Thanks to
http://www.ibm.com/developerworks/aix/library/au-regexp/index.html

Highlighting with sed

You can also do regexp highlighting in sed, the stream editor. The sed
command:

’s/regexp/[&]/g’


outputs a copy of the input with all instances of regexp enclosed in
brackets.

simple example:

john@pleasure:~$ sed ‘s/text.*here/[&]/g’ my_file.txt
some [text here]
some [text there]
some [text everywhere]
some texh missspelled here
some text allover the place
here text
there text
there [text there]

Tags: regex sed
Photo
Feel the power of the delete key. Not for the faint of heart.

Feel the power of the delete key. Not for the faint of heart.

Quote
"Anyhow, I have found a way to boot the CD. Press Escape, and then F9, during the POST to enter the Boot Device Menu, and inserting the disc when this menu is
displayed (NOT any earlier), and then choose the “Notebook Upgrade Bay” option to boot from the CDROM. (Really….Upgrade Bay means Optical Drive???) Sigh Why is it
so difficult to implement a BIOS that correctly boots from CDs. I
thought we had these kind of problems behind us. Appearently, booting
from CD problems are still an issue today."

http://andre.blaatschaap.be/2012/03/installing-archlinux-on-hp-elitebook-8530w/

Tags: archLinux
Link

Thanks to Josh Staiger for posting this simple copy and paste fix for my emacs shell.

Tags: Emacs
Text

Keep Reading

I love electronic books, especially when they come from well stocked places like Books24x7 which I can read for free through my Alma Mater’s Library subscription. The problem comes if you take along time to turn the page you will be disconnected from the service. This then requires a reloading of the page, changing the url, then clicking OK. So I wrote a script.

tell application "Safari"
	set currentTab to current tab of front window
	set currentURL to currentTab's URL
	--trim_line(currentURL, "login.asp", 1) //not sure why trim_line() doesn't work
	set the URL of the front document to "http://ezproxy.msoe.edu:2091/"
--Click Button
  	delay 1
	JavaScript "document.forms['loginform'].submit()" in front document

end tell
—If you have any suggestions for making this more generic e.g., using trim_instead of setting the url directly, or getting the form name directly. Let me know. Thanks.