Jul 9 2008

Microsoft DreamSpark

Even thought I am a Windows user, I am no where near a Microsoft lackey but recently I learned that Microsoft is giving away a ton of professional grade software to students. Through the Microsoft DreamSpark program, students can get access to Visual Studio 2008 Professional, Windows Server 2003 Standard Edition, Microsoft Expression Studio, XNA Studio, XNA Creators Club, SQL Server 2005, as well as other free software such as their express edition software. That is well over $1,500 of free software. I am typically not a Microsoft fanboy but I do have to give credit to Microsoft for making its development tools free of charge to students across the world. Now I wish Adobe would do the same.

Technorati Tags: , , , , , , ,

May 13 2008

Perforce Report

I’m a really competitive developer and I like to see how many files I checked in a week compared to my fellow coworkers. I know that counting then number of changed files is no way near a correct accounting of my productivity but it is an easily quantifiable metric. Perforce has an optional P4Report download that can be used create reports on the code repository. P4Report has a command-line client, P4SQL. With P4SQL you can write SQL-like statements to query the whole repository.

Download P4Report and make sure it is in your path. Once you have it in your path, start the p4sql command.

The first useful SQL statement is to find all the available tables in the system. To list all tables, you can use the following.

select * from systabs;

Perforce has a large number of database tables of which I find the following the most useful, changes, files, users, clients, fixes, and branches.

To list all the changes that you have committed you can execute a command like the following, just replace the ‘juixe’ with your own username.

select * from changes where lcase(user) = 'juixe';

I was curious and wanted to find the largest revision any single file has attained, meaning most modified file, to accomplish this I executed the following command.

select max(revision) from files;

If you use Perforce version control, you can use P4Report to query your teams check-ins and use it as an additional metric or tool in your development process.

Technorati Tags: , , , , ,

Mar 10 2008

Repair A Crashed MySQL Table

I went through a bit of a scare with my blog today. All of a sudden I keep getting a barrage of emails informing me that my new WordPress blog had been successfully set up at Juixe TechKnow. I was like, WTF! I immediately emailed the technical support for my hosting provider but they did not know and give me any insight as to what happened to my blog. At first I thought I had been infected with a WordPress virus, or that someone at my hosting provider had inadvertently deleted my blog. As it turned out, as i dug around I discovered a ton of WordPress database errors that read like the following…

Table 'wp_options' is marked as crashed and should be repaired

As it turned out, only the WordPress options table had been corrupted and this was easy to fix simply by repairing that table.

To repair a MySQL table, log into your database using phpMydmin web client. Select you database from the database drop down on the left hand side. At this point, you should be looking at a list of all the tables in the database. Check the database table that has crashed and at the select repair table from the drop down options at the bottom of the list of tables. That should fix crashed or corrupted MySQL tables.

If you don’t have phpMyAdmin web client, you can just run the repair table command. From your MySQL query console enter the following.


Technorati Tags: , , , ,

Nov 16 2007

SQL Server Query Shortcuts

Sometime back I detailed the command to describe the details a database table for Microsoft SQL Server. To detail the a given database table you can use the sp_help command. If you don’t want to type sp_help every time you want to see the structure of a table you can use a query shortcut. Microsoft SQL Server Management Studio Express has a series of shortcuts, available under the Options | Options menu. You can add custom query shortcuts. The shortcut for sp_help is Alt + F1. Just select a table name and hit Alt + F1 to see the table details. If no table is selected you will get details on all the available tables.

SQL Server Query Shortcuts

Technorati Tags: , , , ,

Oct 27 2007

Top Programming Books on Google Book Search

Here is an extensive list of top programming books available for preview on Google Books. Google Books provides scans of thousands of textbooks. The scans are not the best, most books have visible scan defects in them.

Even though the scans are not the best, there are some features that just work well. Just like Google Maps, where you can send a link to a map (with a set size, address, etc), with Google Books you can send a link to a specific page in a certain book with specific words highlighted. Google also has handy links such as the table of contents, popular passages, and where to buy the book (perhaps in a better quality PDF format).

All the books listed here have a ‘limited preview’, meaning that some pages are not available for viewing but for the most part you can browse through most the the book. Google Books does indicate the pages that are not available.

The Java Language Specification
Effective Java Programming language
Java: The complete Reference
Java In A Nutshell
Head First Java

Practical C++ Programming
C++ The Core Language
The Concurrent C Programming Language
C++ Primer Plus

The C# Programming Language
The Visual Basic .NET Programming Language
Pro C# 2005 and the .NET 2.0 Platform
Learning Visual Basic .NET
VB.NET Language in a Nutshell

Python in a Nutshell
Learning Python
Visual Quickstart Guide: Python
Python Pocket Reference
Python Cookbook

JavaScript: The Definitive Guide
Beginning JavaScript with DOM Scripting and AJAX
The Book of JavaScript
The Complete Reference JavaScript
JavaScript Bible
DOM Scripting

Ruby in a Nutshell
The Ruby Way
Beginning Ruby
Ruby on Rails: Up and Running
Rails Solutions: Ruby on Rails Made Easy
Beginning Ruby on Rails E-Commerce

PHP in a Nutshell
Programming PHP
PHP Cookbook
Learning PHP and MySQL
Learning PHP 5

Visual Quickstart Guide: MySQL
MySQL Cookbook
MySQL in a Nutshell
MySQL Tutorial
Programming SQL Server 2005
SQL Server 2005: Developer’s Guide
SQL Server 2005: A Beginner’s Guide
Beginning SQL Server 2005 Express

Technorati Tags: , , , , , , , , , , , , ,

May 28 2007

Java Persistence API – Best Practices and Tips

This JavaOne 2007 session was packed the rim but I soon discovered I should have gone elsewhere. Everything in Java has some type of context and JPA is no different, the speaker was talking about the Persistence Context, blah, blah, Entity Manager, something or other. I found this session a bit hard to follow, a bit too technical and really dry. The slides looked like endless paragraphs from Tolstoy’s The Death of Ivan IIyich. A JPA junkie snapped pictures of the slides so that he can decipher and analyze them at a later time, or so I imagined, with the help of Java non the less.

Here are some general rules that I was able to grasp from this session… You need to manage the relationship of the parent and child object explicitly for each object individually. You should try to use left joins to fetch data in your queries. Using the @Version annotation attribute will help to detect parallel updates to a entity. You should use named queries whenever possible because they are cached by the JPA provider. Use fully qualified names for your queries such as ‘Employee.findByName’ to avoid named collisions. Concatenating strings in an attempt to make dynamic queries is not a best practice because it is open to SQL injection. Use named parameters in queries to avoid SQL injection. Try to avoid native SQL queries so that your application can be more database portable. That said, native queries might be required for vendor specific functionality or stored procedures.

Technorati Tags: , , , , , ,