Blogger Jeff = new Blogger

Programming and stuff in Western PA

Applescript to repeatedly try to connect to internet stream in ITunes

I listen to the same radio station each and every morning. Problem is, so do a lot of other people. The server I need to connect to allows for a maximum of 100 connections, so what I end up doing is repeatedly trying to connect until I can get one of those connections. Until now….

I created this little applescript to hammer away at that server. I saved it as a playlist, and just run the following :

local e
set e to 0

tell application "iTunes"
	repeat
		try
			play playlist ("My Radio Station Playlist name")
			delay (2)
		on error errStr number errorNumber
			set e to errorNumber
			
		end try
		
		if e is not equal to -5421 then
			exit repeat
		else
			log "Try again"
		end if
		
		
	end repeat
end tell

January 7, 2009 Posted by | Technology | , | 1 Comment

Finally, just DATES in SQL Server 2008

I’m just getting around to snooping around Sql Server 2008, and noticed that they have FINALLY added just a DATE datatype. What this means is that we can now just store a date, rather than a date and the time. No more will we have to write SELECT CONVERT(VARCHAR,GETDATE(),101)!!!!!

This now does the trick :

SELECT CAST(GETDATE() AS DATE)

December 18, 2008 Posted by | Technology | | Leave a comment

New GMail themes, including the coolest one ever!

I checked my GMail today, and noticed a new “Themes” link.  I clicked on it and behold, a plethora of new color themes for my GMail.  I then found the mother of all themes : Terminal!

 

11-20-2008 2-56-34 PM

November 20, 2008 Posted by | Technology | Leave a comment

Accessing bookmarks quickly in FireFox 3

I don’t have a problem admitting that I can be "slow" at times to discover things that have existed for a while. One of those finds, for me, is the ability to type in a FireFox’s bookmark title in the address bar.  For me, this is very similar to using Quicksilver for the Mac, where you just start typing something, and Quicksilver starts to filter through it’s huge list of applications it has indexed on your machine. The nice thing about FireFox’s address search is that you usually only have to type a letter or two of a bookmark before it appears.  This is way quicker than messing around with a mouse.  All I did below was hit Command+L (drops the cursor in the address bar), and then start typing the bookmark I want to access.

September 14, 2008 Posted by | Technology | Leave a comment

Google Chrome and Application Shortcuts

I downloaded Google’s new browser Chrome last week, and wasn’t all that impressed.  It didn’t seem, to me, to run that much faster than my Firefox 3 (keep in mind I was running Chrome through my Parallels for Mac VM).

The one awesome thing Chrome brings to the table is the concept of an Application shortcut.  This is nothing more than a desktop shortcut to a particular Web Application.  For instance, I use Google Docs an awful lot, so I created an Application shortcut to a Google spreadsheet.  Now instead of opening up a browser and navigating to Google Docs, etc… I can now just click on the shortcut, and it opens up the spreadsheet in it’s own window, with it appearing to be an independent app, much like an MS Office document.

September 12, 2008 Posted by | Firefox, Technology | 1 Comment

Moving from iPhoto to Picasa

I moved my 5 gigabytes worth of digital photos from my Mac to my PC tonight. This is usually a pretty easy thing to do, as you just copy your “Originals” folder in the iPhoto directory to it’s new destination. I didn’t care about copying the photo albums from iPhoto, but the problem I ran into was getting to the keywords my wife and I added for every stinking photo. iPhoto uses it’s own proprietary method for storing keywords, so I needed to export them somehow.

Thankfully I found the iphotokeywordutilities app that did the trick for me. It’s a little tricky to get going, as you have to :
1.download iphotokeywordutilities
2.Open iPhoto and select the photos whose keywords you want to export.
3. You then click on the applescript from the downloaded zip

What iphotokeywordutilities does is take the iPhoto keyword and embed it right into the image’s IPTC keyword attribute.

July 26, 2008 Posted by | iPhoto, Technology | 2 Comments

Need to create a Wiki?

I was tasked with this a month or so ago, and came upon a great site called http://www.wikimatrix.org/. It even has a wizard that asks you a number of questions, and then recomends different wiki apps for you.

I ended up downloading and trying 4 different Wikis. These ranged from one written in javascript, to a php based one, and even “asp.old” one. I went with ScrewTurn Wiki, which is a .Net based, Open Source app, written in C#. ScrewTurn comes with an installer, that creates an IIS site for you. One big requirement I had was that the Wiki content pages themselves had to be created outside of the Wiki, because I was using a script to pull out the API class data. Screwturn is also very easy to configure out of the box, has a support forum, and is skinnable.

April 14, 2008 Posted by | ASP.Net, Technology | Leave a comment

Sql Server 2008 CTP

You can download it from here.

I’ll have to download this and take a spin.

Two things I’ve read about that sound neat off the bat :

(1) Automatic auditing : one of my recent posts detailed how to do this. As I said, I end up doing this on practically every project, so it’s nice Microsoft is baking this right in.

(2) Date only and Time only datatypes : HALLELUJAH! I can’t tell you how many times this has screwed me when doing date comparison, and all I’m concerned with is a date, but the time element throws it off.

March 13, 2008 Posted by | SQL Server, Technology | Leave a comment

SQL Server Audit tables the easy way

One of the more common tasks I perform from project to project is the creation of audit tables. The easiest way I know how to do this is to create a copy of the table I want to audit, and then add a trigger to the parent table. For my example I’ll use my ever-so-popular MLB database and my TEAMS table. The schema for TEAMS looks like:

CREATE TABLE [dbo].[TEAMS](
    [TEAM_ID] [int] IDENTITY(1,1) NOT NULL,
    [TEAM_NAME] [varchar](50) NOT NULL,
    [CITY] [varchar](50) NOT NULL,
    [LEAGUE] [nchar](2) NULL
) ON [PRIMARY]

GO

The audit table for TEAMS will be an exact copy, with a couple of modifications. First, TEAM_ID needs to be a copy, so it’s no longer an identity column, The second change I made was to add an AUDIT_DT column to capture when the change occurred :

CREATE TABLE [dbo].[TEAMS_AUDIT](
    [TEAM_ID] [int] NOT NULL,
    [TEAM_NAME] [varchar](50) NOT NULL,
    [CITY] [varchar](50) NOT NULL,
    [LEAGUE] [nchar](2) NULL,
    [AUDIT_DT] [smalldatetime] NOT NULL DEFAULT (getdate())
) ON [PRIMARY]

I then add a trigger to the TEAMS table to capture updates and deletes (I only want to capture when the original column changes, not when it’s added) :

CREATE TRIGGER TRG_TEAMS 
   ON  TEAMS 
   AFTER UPDATE,DELETE
AS 
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    INSERT INTO [MLB].[dbo].[TEAMS_AUDIT]
           ([TEAM_ID]
           ,[TEAM_NAME]
           ,[CITY]
           ,[LEAGUE])
     SELECT [TEAM_ID]
           ,[TEAM_NAME]
           ,[CITY]
           ,[LEAGUE]
    FROM DELETED
END
GO

That’s it! A couple of things you may want to consider when creating an audit table is :

  • Remember that the audit table gets an insert for each update/delete to the parent table. This can have some performance ramifications. One of the things I do is not put any indexes on the audit table.
  • You’ll want to purge the data from this table from time to time (or back it up).



Digg!

Tags:

March 2, 2008 Posted by | SQL Server, Technology | Leave a comment

Traits of a great software developer

Here’s my two cents on what I think it takes to be a great software developer:

Knowledgeable : If the person doesn’t know what they’re talking about, then it doesn’t matter if they have every other trait on this list. Certifications are nice, but anyone can cram for one or go to one of those nifty sights that list the actual exam questions.

Nothing beats good old fashioned work experience. How the person obtains their knowledge isn’t all that important. I’ve worked with quite a few people who weren’t Comp Sci majors, or weren’t “certified”, or never even graduated from college, who could run circles around other developers who were. In this day and age, so much information is available at your fingertips via the internet that if you take the time, you can learn on your own. Which brings me to my next trait …

Works well independently : With technology changing so often, a good developer has to be able to learn things on their own. A lot of people,however, have trouble with this, and need to “training” from others to learn things. I’m not saying training or learning from others is bad, but if a person needs a lot of hand holding, then they’re going to cost their company more money in regards to time and resources.

Self-Motivated : I think this one speaks for itself, but I have been around a lot of people who need to be kicked and pushed if you want them to get things done. These people usually don’t last too long.

Humility : This is a tough one, and some people may disagree that this is an important trait. I’m sure we’ve all been around a hot-shot developer or two in our time. They’re real nice to have on a team because of their skills, but man can they get annoying. I’ve been with a company that had to “trim some fat”, and surprisingly, they let the best developer go not because he made too much money, but because of his cocky personality. The great developers I’ve been around don’t have much of an ego.

Excellent Communication Skills : This can be a tough one to grasp too. I know for me, it took a couple of years and almost cost me my second job. It wasn’t that I couldn’t talk, but rather, that I didn’t talk. I was shy and tried to stay hidden. The great developers I’ve been around aren’t afraid to ask the tough questions and make sure no questions go unanswered.

Plug and Play : Great developers are able to be plugged into any project and produce the same great results each time. It has little to do with programming languages but more to do with them applying the same work effort to every project.

Can handle criticism : All programmers make mistakes and write bugs (some more than others). However, I have seen some guys get real uptight and defensive when their mistakes are bought up to them. With communication with others being such an important part of a developer’s job, at some point, someone is going to criticize something you do.

Willing to teach others : Younger devs need mentors. It is the responsibility of the more experienced devs to be willing to pass down their knowledge. I’m sure we’ve all worked with a guy or two who wants to keep everything they know “in the vault”.

Accountability : This one’s a tough one too, but the good ones know when to step up and take responsibility for something.

Organized : Not so much the “tidy work area” kind of organized, but more like knowing where everything is, documenting meetings, emails, phone calls.

Enjoys what they do : I think most developers like what they do, but some are just more passionate than others.

Tags:

February 19, 2008 Posted by | Technology | 2 Comments