Google Chrome 6 Leaving off http://

Chrome 6 is now leaving off the http:// in the address bar. Innnnnnteresting….
Chrome 6 not displaying http:// in the address bar

tweet from 2010-09-03 10:39:08

YouTube ads turn piracy into revenue http://tgam.ca/wun (via @globeandmail) This Shouldn’t be news. I say duh. Redefine piracy.

tweet from 2010-09-03 09:28:14

The Ubuntu 10.10 default wallpaper is hideous http://bit.ly/acU6ax :(

GNP Does Not Measure What Makes Life Worthwhile

Here is a fantastic quote that I came across while watching the Ted Talk Nic Marks: The Happy Planet Index.

Gross National Product counts air pollution and cigarette advertising, and ambulances to clear our highways of carnage. It counts special locks for our doors and the jails for the people who break them. It counts the destruction of the redwood and the loss of our natural wonder in chaotic sprawl. It counts napalm and counts nuclear warheads and armored cars for the police to fight the riots in our cities. It counts Whitman’s rifle and Speck’s knife, and the television programs which glorify violence in order to sell toys to our children. Yet the gross national product does not allow for the health of our children, the quality of their education or the joy of their play. It does not include the beauty of our poetry or the strength of our marriages, the intelligence of our public debate or the integrity of our public officials. It measures neither our wit nor our courage, neither our wisdom nor our learning, neither our compassion nor our devotion to our country, it measures everything in short, except that which makes life worthwhile.

-Robert F. Kennedy

Reference

tweet from 2010-08-31 16:34:49

Check this video out — Nic Marks: The Happy Planet Index http://t.co/82QQF0i via @youtube

tweet from 2010-08-30 18:49:25

Internet was just down for 30mins. During, due to my cloud computing lifestyle, I watched to see if the paint would get any drier.

tweet from 2010-08-30 09:45:04

Just set up a basic mail server on Ubuntu. Not very difficult at all. :D https://help.ubuntu.com/community/PostfixBasicSetupHowto

tweet from 2010-08-30 08:11:55

The Full-On Assault On Cable Is Underway http://t.co/wKhMANG via @techcrunch with Canadian internet bandwidth caps this will not work.

tweet from 2010-08-30 05:38:06

It’s 5:35am, I’m awake, in the backyard and have already had breakfast? Work has turned me into a morning person. School will end that.

tweet from 2010-08-29 23:31:12

I am tweeting from wordpress… interesting

Twitter Tools Title

I just finished installing Twitter Tools so that I can have some integration between this blog and http://twitter.com/torypages

When I first installed it, the tweets on the blog would repeat the tweet in the title which I did not care for. I’m still unsure what I want in the title but for now I have basically stuck the date.

It was thanks to this post that led me to the code below.

To change what goes into the title find the function do_tweet_post($tweet) and update what is next to ‘post_title’.

function do_tweet_post($tweet) {
		global $wpdb;
		remove_action('publish_post', 'aktt_notify_twitter', 99);
		$data = array(
			'post_content' => $wpdb->escape(aktt_make_clickable($tweet->tw_text))
			, 'post_title' => 'tweet from ' . get_date_from_gmt(date('Y-m-d H:i:s', $tweet->tw_created_at))
			, 'post_date' => get_date_from_gmt(date('Y-m-d H:i:s', $tweet->tw_created_at))
			, 'post_category' => array($this->blog_post_category)

....
....
....

Get Last Column of Each Row of Tab Delimited File

I had a file that was of this form

aaa bbb ccc hhh
aaa hhh
nnn vvv hhh
vvv aaa eee aaa hhh

Where each one of those spaces is a tab. I required the last column of each row. That is, I needed each field where “hhh” exists. And this was solved with the following code!

 $ cat tabDelimitedFile.txt | awk -F\\t '{print $NF}'

One Line, Rename Files in Directory

 $ ls | while read i; do mv "$i" "some prefix $i"; done;

the read part of the while waits for input and takes the input and stores it in “i”. The while loop gets it’s input from ls. At each line of ls, the current line is sent to the read.

Delete Empty Folders

This command will delete all the empty folders in your current directly and all its children.

 $ find . -depth -type d -empty -exec rmdir "{}" \;
  • The “.” specifies that we want to search from our current directory.
  • -depth” gives a recursive effect to this.
  • The “-type d” specifies that we only want to return directories.
  • -empty” finds regular files and folders but the “-type d” part makes it so that we only find directories.
  • The items found after “-exec” are to be executed each time an item is found.
  • rmdir” removes only empty directories. One could also write “rm -r” but that is less safe since it will also remove directories that are not empty.
  • The ” “{}” ” acts sort of like a variable that holds the name of the item that was found. The double quotes around it may not be needed, but, it didn’t hurt the execution of the command when I ran it.
  • And, the “\;” finishes it all off.

Character Issues and MySQL

A lot of times I work with databases with French characters or other characters and I finally found a solution that has helped in my particular case thus it may help in yours. It is to specify the the character encoding right on the command line with

--default-character-set=utf8

so, a command might look like

 $ mysql -u Tory -pMyPassword --default-character-set=utf8 < commandsToRun.sql 

Google – Verizon -> Google Evil?

My goal of this post is just to add more buzz to the internet, more gasoline to the fire regarding the Google – Verizon proposed evil deal. In fact, you will find nothing new here. I almost don’t even want you to read it. I just hope, that after posting this there will be one more hit on the search engines regarding the topic. I am just wanting to popularize the topic.

I do however think that the This Week in Google net cast from twit.tv regarding the topic is very worth while and that you should check it out http://twit.tv/twig55.

Though, I will say that until now I have always given Google credit even though they sometimes do things that are a little scary. I have also defended them when people say they are too big. I would say that though they are big, they play nice unlike Microsoft.

I don’t want to give up Google. Google has been a commendable player in the past. I hope I can continue to love them. But, Google has now shown an evil side and I avoid evil businesses as much as I can.

Bash. Variables. Sed. Replace. Slashes

Here is an example how to replace text containing slashes with new text that also contains slashes. It will ultimately convert “A cool website is http://www.yahoo.com” to “A cool website is http://www.google.com”

#!/bin/bash

A="http://www.google.com";
B="http://www.yahoo.com";
C="A cool website is $B";

echo "A = $A";
echo "B = $B";
echo "C = $C";

A=`echo "$A" | sed 's/\//\\\\\//g'`
B=`echo "$B" | sed 's/\//\\\\\//g'`

echo "----------After Running Fixing----------";

echo "A = $A";
echo "B = $B";
echo "C = $C";

echo "-----------After running sed------------";

echo "$C" | sed "s/$B/$A/g"

Reading Files by Line w/ Spaces

#!/bin/bash
SAVEIFS=$IFS;
IFS="\n";
while read LINE ; do
     echo "${LINE}";
done < myFileWithSpaces.txt;
IFS=$SAVEIFS;

Finding Folders

This command will find all folders in your current directory and deeper where the folder name has the word “tea”, and then later followed by “cup” with anything in between. This will also ignore case.

$ find ./ -iname *tea*cup* -type d
    This will match folder names such as

  • tea cup
  • TeA and Cup
  • wickedTeaCUP
  • super.tea.in.my.cup.right.now

Count Number of Lines Given by any Command

Here is how you count the number of files outputted from any command using the ls command as an example

 $ ls -A | wc -l

This is a bit curious actually because ls -A doesn’t necessarily print each file on each line but the line count is still equal to the number of files. I presume that this is because bash is deciding not create newlines where new line characters exist.

There is a simple way to test to see if this is true. If we run

 $ ls -A > test.txt 

The output of ls -A will be sent into a file named test.txt instead of the wc program. After having done that we can run

 $ cat -E test.txt

which will represent each newline character with a $. And, as I have just found out, and as you’ll be able to see, there is a $ after each file. Thus, when you run ls -A the newline characters are there, the shell just decides to not necessarily print each file to a newline

Next