Ivor O’Connor

September 27, 2009

HTML/CSS Helper

Filed under: css, html5 — ioconnor @ 12:58 pm

The best resource by far I’ve seen on this topic can be found at: http://www.somacon.com/p141.php

It’s good because you can click on buttons to see the effect it has on a demo table. The CSS code is also modified so you can simply cut and paste where needed.

They have two other pages for lists and text.

I wish somebody would come out with website layout done in a similar manner.

September 23, 2009

Synthesizing Voice From The Command Line

Filed under: Uncategorized — ioconnor @ 10:56 pm

danger1Today’s RSS feed from the Linux Journal, Synthesizing Voice FromThe Command Line was fun. Sort of reminds me of the robot.

sudo apt-get install saytime libsox-fmt-oss festival
saytime
echo Danger, Will Robinson! Destroy, Damage, Death. | text2wave | aplay

September 20, 2009

Largest Offshore Wind Parks

Filed under: Uncategorized — ioconnor @ 1:05 pm

From Denmark showcases world-biggest offshore wind park

The “Horns Rev 2” by DONG Energy, Danish owned energy company, produces 209 megawatts from 91 Turbines 30km off the west shore of central Denmark, in the north sea, costing $694 million. Consisting of 13 parallel rows of seven turbines in a fan-like shape. Siemen 2.3MW turbines are used. Blade diameter is 93 meters centered on a shaft 114.5 meters above sea level that drops down an additional 30-40 meters. It is the first platform to house up to 24 workers year-round. This platform connects to the turbines via buried cables which centralizes and conditions the power before sending it ashore via another subsea cable. It took the number one title away from DONG Energy’s Nysted wind farm that produces 166MWs. Denmark gets 20% of it’s electricity from wind. The number one title will pass on to a 630MW London array wind park in the Thames Estuary before the London Olympics starts in 2012.

From Rule Britannia: UK is Now World’s #1 Offshore Wind Power Producer

194 MW wind farm off the coast of Skegness Lincolnshire has just been completed. Another 938 MWs of power will be added in the next three months. And 1000 MW more by the end of 2012. If I’m adding right this is a total of 4,938 MWs. Probably more if land based wind is added to the mix.

From Wind Energy Could Power All of Britain’s Homes by 2020

This article claims 2 GWs are produced offshore currently, written in 2007, and that by 2020 there may be 33 GWs of energy produced by wind. Since the numbers seem bogus I’ll discount the whole article.

Largest Offshore Wind Power Producers By Country

  1. 590 MW: United Kingdom (UK gets 3GWs of power from wind. So 20% of it’s wind power is from offshore.)
  2. 423 MW: Denmark (20% of the total power, ==> Denmark must need 2115 MWs of power.)

September 19, 2009

Replacing Unison With Git

Filed under: Uncategorized — ioconnor @ 4:55 pm

Unison works across M$, Macs, and *nix machines. Unison synchronizes files between two machines. Git is not made for synchronizing files between two machines but it can be made to do so. It supposedly works on multiple platforms just like Unison does. In addition it does version control and keeps track of file and directory name changes along with files you delete. More importantly you can keep multiple machines in sync, not just two. I use the following two scripts, run from cron, on the machines I want kept in sync:
A script to pull in the changes somebody has made followed by a script to push out the changes. I should make a master script to do one right after the other. Perhaps also some monitor program that can pop-up to tell me when I need to do a three way merge.  (I haven’t needed these additions yet.)
The script to pull in the changes:

#!/bin/bash

# GLOBALS
sGitLogFile=~/common-git.log
sPathToLocalDir=~/common
sPathToRemoteGit=…

function doGitPull {
cd $sPathToLocalDir >> $sGitLogFile 2>&1
#pwd >> $sGitLogFile 2>&1
#whoami >> $sGitLogFile 2>&1
#printenv >> $sGitLogFile 2>&1
git pull –verbose $sPathToRemoteGit HEAD >> $sGitLogFile 2>&1
}

echo “{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{” >> $sGitLogFile 2>&1 # Time stamp the end of processing
echo $(date +%F[%T]) ” = STARTING TIME of pull” >> $sGitLogFile 2>&1 # Time stamp the start of processing
doGitPull
echo $(date +%F[%T]) ” = ENDING TIME of pull” >> $sGitLogFile 2>&1 # Time stamp the end of processing
echo “}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}” >> $sGitLogFile 2>&1 # Time stamp the end of processing
echo “” >> $sGitLogFile 2>&1 # Time stamp the end of processing

A script to push the changes out:

#!/bin/bash

# GLOBALS
sGitLogFile=~/common-git.log
sPathToLocalDir=~/common
sPathToRemoteGit=….

function doGitPush {
cd $sPathToLocalDir >> $sGitLogFile 2>&1
git add –verbose -A >> $sGitLogFile 2>&1
git commit –verbose -m”bkup” >> $sGitLogFile 2>&1
git push –verbose $sPathToRemoteGit master –receive-pack=’git receive-pack’ >> $sGitLogFile 2>&1
}

echo “{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{” >> $sGitLogFile 2>&1
echo $(date +%F[%T]) ” = STARTING TIME of common-push ” >> $sGitLogFile 2>&1 # Time stamp the start of processing
doGitPush >> $sGitLogFile 2>&1
echo $(date +%F[%T]) ” = ENDING TIME of common-push\n\n\n” >> $sGitLogFile 2>&1 # Time stamp the end of processing
echo “}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}” >> $sGitLogFile 2>&1

September 16, 2009

Git’s Post Receive Hook

Filed under: Uncategorized — ioconnor @ 7:56 pm

I’ve been using git for everything in the World lately. To be honest I’ve not been understanding much of anything I read. I basically read something and then hack around until I get it working. The hack around part is a pain. It consists of writing little scripts and then testing how I think it works and finding it doesn’t really work that way. So then I run the setup script again which erases all the work and initializes everything all over to the point where I failed. So I can try over. And over. And over about 20x.

Anyways, today I read this excellent post http://debuggable.com/posts/git-tip-auto-update-working-tree-via-post-receive-hook:49551efe-6414-4e86-aec6-544f4834cda3 and implemented it. It allows me to simply push the changes out to the webserver without ftp or rsync. It’s quite nice. Just make an executable file at .git/hooks/post-receive and stick in it:

#!/bin/sh
cd ..
env -i /usr/local/bin/git reset –hard


I need to make the .git directory off limits to prying eyes. I will do that in the future. For now though it doesn’t have anything in it that is not already viewable so it’s not important. Later though.

September 13, 2009

US Open Debacle

Filed under: Uncategorized — ioconnor @ 5:00 pm

My take? Serena Williams should sue the US Open for all they are worth. And then some. She should set an example that causes the other tournament organizers to sit up and be honest.

Here’s the problem. A lines judge makes a horribly bad call. What’s more this judge does so at a very crucial moment. The immediate replays all show that Serena did not have a foot fault. Rather than fix the bad call this judge sticks with it. It’s like she has an agenda.

You have to wonder why a judge would ever give a foot fault call at that moment even if it were a foot fault. There is a courtesy that is normally extended to professionals. You don’t call foot faults at crucial moments unless the you are absolutely 100% sure, have multiple judges corroborating it, have video to back it up, and have been warning the player in question beforehand. Repeatedly.

What should be in the press this morning is a background check on the lines judge. What motives she could have had. Is she getting paid for this. Who all might be involved. Basically a full background check on this lady calling the foot fault and the people running the US Open.

Then there was a dispute about what Serena actually said. This lines lady said Serena threatened to kill her. Serena emphatically denies this. Were there any tapings? This lines ladies reputation had already proven to be faulty. Relying on her word is utter stupidity. Yet with no witnesses or tapes this lady caused Serena to lose the match. You’d think the US Open would have recording devices on all judges. They are suppose to be honest. A taping device would help prove their honesty. The fact they don’t only means they are dishonest.

Serena needs to take legal action.

To add insult to injury all the news channels including NPR focus on Serena. Somehow it is her fault. In today’s world justice is never served. Instead things are always twisted so the officials are never in the focus.

UPDATE 2009.12.07:
“Serena Williams fined record $82,500 for U.S. Open outburst” . I’m certainly glad I don’t watch TV. That I don’t have a TV to watch. (Unless I were to get it out of storage.) I don’t pay cable or dsl or dish monthly rates. And I encourage everybody to do the same. Further don’t attend these events. Unless players can exhibit some emotion and call a spade a spade why watch? It’s bogus and I don’t want to see politically correct anything. I’d like to see some tempers being lost. I’d like to see some swearing, breaking of tennis rackets, and a few tennis balls served directly at the judges. (Hopefully hitting them.) There is no point watching judges who make bad calls and then fine players for getting angry at them. Oh wait, America is the land of the free, where you can make the stupidest damn rules imaginable and if you got the venue you can make it stick. Blah.

Bush’s Doing?

Filed under: Uncategorized — ioconnor @ 12:38 pm

spaceI have not seen any clear space pictures of 9/11. It was such a clear beautiful day I would have thought there would be some crystal clear much higher resolution pictures. Yet this does show the dust plume. My kids and I walked through the dust, going from the dusty side to the docks that morning. It was cold on the docks but we were able to get past all the closed off areas and watch up close from there. We had gotten a light sprinkling of dust. We had managed to thread our way through the wild crowds. Obviously we were not able to talk with the school officials that morning about going to a better HS as was scheduled. (NYC High Schools suck. Something about not having the money to spend on anything but the rent of the building and the metal detectors with security guards.) Instead we moved to Summit NJ days later so we would not have to put up with lousy schools.

To this day I wonder why we have not looked into all the evidence that points toward Bush and cohorts. It’s probably because Obama is controlled by the same companies and their lobbyists that Bush was.

September 12, 2009

Bringing Wind Power To The Consumer?

Filed under: Uncategorized — ioconnor @ 11:19 pm

I suspect this is 10 years off, if it works, but it is interesting. It potentially possibly be the start of something totally new.

Here’s the article I originally found it in: http://news.cnet.com/8301-11128_3-10350718-54.html?part=rss&tag=feed&subj=GreenTech

LED Lights

Filed under: Uncategorized — ioconnor @ 11:13 pm

CFBs, Conpact Fluorescent Bulbs, are the rage currently. Yet they burn out quickly if turned off and on frequently, use lots of mercury, and are not as efficient as LEDs. Now LED lights appear to be ready for mass production in Japan thanks to Panasonic. How long will it be until we are using them here instead of CFBs? (And at what price?)

“September 10, 2009… Osaka, Japan–Panasonic Corporation, a leader in electronics technology and innovation, today unveiled bulb-shaped LED (light-emitting diode) lamps, the latest addition to its EVERLEDS LED lighting products.”

“the 6.9 W standard type LED bulbs deliver the brightness equivalent to 60 W incandescent bulbs”

“The E26 base LED bulbs have a long lifespan of up to 40,000 hours. That means they last for about 19 years when used for 5.5 hours a day.”

Are ESL bulbs better than CFL or LED?

Vu1’s Electron Stimulated Luminescence (ESL) lights can last up to 6,000 hours, about three to four times the lifespan of incandescents and comparable to CFLs. They produce 50 percent less heat than incandescents.
….

Meanwhile, LED bulbs are energy efficient at around 40,000 to 50,000 hours a bulb but tend to be expensive. For instance, Panasonic’s new EverLeds light will likely retail for around $40 when it hits stores in Japan next month.

//

Vu1’s ESL bulb would be around $20 when it hits the market, according to spokesman James Quick. Vu1 might market the bulb in mid-2010 if its funding holds up. It plans to begin manufacturing at its EU plant by the end of this year.

So if LED lightbulbs last 7 times longer than the ESL bulbs shouldn’t the ESL bulbs cost 1/7th the price? Not 1/2 the price?

SQL Naming Conventions

Filed under: Uncategorized — ioconnor @ 6:50 pm

This will be an ongoing post. As more is discovered, including my personal preferences, more will be added. The first site through google seems like a good starting point. Though it comes from a M$ SQL user. I’ll use it as the template which I’ll add on to or delete out as I see fit. Just understanding all he wrote is more than I can handle. This post will change dramatically with time.

Tables: Use “Pascal” notation for SQL server Objects like Tables, Views, and Stored Procedures; end with an ‘s’. If you have many subsets of tables group them with a prefix followed by a ‘_’. Capitalize the first letter of each concatenated word otherwise.

  • Examples: Products, Customers, UserDetails, Products_USA, Products_India, Products_Mexico

Stored Procs: Rules: sp<App Name>_[<Group Name >_]<Action><table/logical instance> Action can be: Get, Delete, Update, Write, Archive, Insert or some other verb.

  • Examples: spOrders_GetNewOrders, spProducts_UpdateProduct

Triggers: Rules: TR_<TableName>_<action>

  • Examples: TR_Orders_UpdateProducts, TR_Emails_LogEmailChanges, TR_UserDetails_updateUserName
  • Notes: The use of triggers is discouraged

Indexes: Rules: IX_<TableName>_<columns separated by _>

  • Examples: IX_Products_ProductID

Primary Keys: Rules: PK_<TableName>

  • Examples: PK_Products

Foreign Keys: Rules: FK_<TableName1>_<TableName2>

  • Example: FK_Products_Orders

Defaults: Rules: DF_<TableName>_<ColumnName>

  • Example: DF_Products_Quantity

Columns: If a column references another table’s column, name it <table name>ID

  • Example: The Customers table has an ID column
  • The Orders table should have a CustomerID column

General Rules:

  • Do not use spaces in the name of database objects
    • Do not use SQL keywords as the name of database objects
    • In cases where this is necessary, surround the
  • object name with brackets, such as [Year]
  • Do not prefix stored procedures with ‘sp_’. Apparently M$ uses this to do special processing. Since I’d never use SQL Server for anything I’ll discount this. However here is the explanation: The prefix sp_ is reserved for system stored procedures that ship with SQL Server. Whenever SQL Server encounters a procedure name starting with sp_, it first tries to locate the procedure in the master database, then it looks for any qualifiers (database, owner) provided, then it tries dbo as the owner. Time spent locating the stored procedure can be saved by avoiding the “sp_” prefix.
  • Prefix table names with the owner name. Some examples would have helped here. The author states: This improves readability and avoids unnecessary confusion. Microsoft SQL Server Books Online states that qualifying table names with owner names helps in execution plan reuse, further boosting performance.

Structure

  • Each table must have a primary key
    • In most cases it should be an IDENTITY column named ID
  • Normalize data to third normal form
    • Do not compromise on performance to reach third normal form. Sometimes, a little de-normalization results in better performance.
  • Do not use TEXT as a data type; use the maximum allowed characters of VARCHAR instead
  • In VARCHAR data columns, do not default to NULL; use an empty string instead
  • Columns with default values should not allow NULLs
  • As much as possible, create stored procedures on the same database as the main tables they will be accessing

Formatting

  • Use upper case for all SQL keywords
    • SELECT, INSERT, UPDATE, WHERE, AND, OR, LIKE, etc.
  • Indent code to improve readability
  • Comment code blocks that are not easily understandable
    • Use single-line comment markers(–)
    • Reserve multi-line comments (/*.. ..*/) for blocking out sections of code
  • Use single quote characters to delimit strings.
    • Nest single quotes to express a single quote or apostrophe within a string
      • For example, SET @sExample = ‘SQL’’s Authority’
  • Use parentheses to increase readability
    • WHERE (color=’red’ AND (size = 1 OR size = 2))
  • Use BEGIN..END blocks only when multiple statements are present within a conditional code segment.
  • Use one blank line to separate code sections.
  • Use spaces so that expressions read like sentences.
    • fillfactor = 25, not fillfactor=25
  • Format JOIN operations using indents
    • Also, use ANSI Joins instead of old style joins.
      • Example:
        old style join:
      • SELECT *
        FROM Table1, Table2
        WHERE Table1.d = Table2.c

        ANSI style join:
        SELECT *
        FROM Table1
        INNER JOIN Table2 ON Table1.d = Table2.c

  • Place SET statements before any executing code in the procedure.
Older Posts »

Create a free website or blog at WordPress.com.