GIT clone over HTTP: who knew?
September 12, 2008
Quick note for others and so I don’t forget.
If you’re behind a proxy (like I am) and try to do a git-clone using the git:// protocol, surely it will fail if you’re firewall is restrictive. The beautiful thing is, you can use http:// protocol instead to get around this restriction.
So for instance, let’s say we want to clone a copy of yubnub from github. In the cygwin command line, you would normally do:
git clone git://github.com/jcnetdev/yubnub.git
However that will fail. Instead do:
git clone http://github.com/jcnetdev/yubnub.git
The only other gotcha is that you might need to setup your proxy in your environment. To do this, simply do:
export http_proxy=http://<username>:<password>@<proxy_ip>:<proxy_port>
where:
username = your network username (someuser)
password = your network password (somepassword)
proxy_ip = the ip address of your proxy server (192.168.1.1)
proxy_port = the port number for the proxy (80)
the full string would look like this:
export http_proxy=http://someuser:somepassword@192.168.1.1:80
Getting Git-SVN to work under Cygwin
September 4, 2008
This has taken me DAYS to get working and finally i got it. Here are the steps:
Download the Cgywin setup.exe from the Cygwin site.
Next is to READ AND FOLLOW the instructions for setting up Git during the install. The instruction are at the bottom of the page entitled “Install Cygwin”.
After the installation you will need to run “ash rebaseall” from the cygwin\bin directory in a command line in order to update Git-SVN. So open a command prompt (START -> RUN -> CMD) and type in cd\cygwin\bin (or whatever your cygwin installation folder is) and run “ash rebaseall”.
Hopefully this help someone out there
MagicJack support phone number
September 4, 2008
Been seeing a lot of post about people not being able to get in touch with Magicjack for support questions. By doing some investigation I have uncovered their phone numbers.
Main Office: (561) 594-2140 this is just a recording telling you where to get support, you can leave a message if you want
Support: (281) 404-1551 open from 11am to 8pm EST
You can also always do a onlive chat with a support person by going to the customercase page on thier site:
This whole week we’ve been trying to get my designer’s old Epson Stylus Pro 7500 with a Fiery RIP Station v1.5 to work under MAC OSX Leopard. Turns out this isn’t supported anymore by Epson, but you can get it to work if you have the correct PPD!
The Jim at Epson support was kind enough to send me the PPD via email and once installed the printer is now working just fine.
The steps to take are as follows:
1) Download the file “Epson Stylus Pro 7500 PPD.dmg” from the box.net widget.
2) Extract the dmg
3) open a new finder window and copy the PPD file to the following directory: Macintosh HD -> Library -> Printers -> PPDS -> Contents -> Resources
4) Now change the driver for your 7500 and select the new “Fiery X2 5100 series” driver from the drop down and your set!
IIS Admin service terminates with 0×8021080A
August 6, 2008
After having some disk problems, I tried to start my development service and low and behold the World Wide Web publishing service wouldn’t start. Seems that the IIS Admin service (which the WWW service depends on) was terminating with an error code of 0×8021080A. Seems that during the chkdsk something was overwritten or corrupted.
Investigating I came to find that MetaBase.xml file that the IIS Admin service uses was a 0KB size. Which means basically that it lost all the configuration that IIS had. For those that don’t know, IIS has two XML files (MBSchema.xml and MetaBase.xml) that it uses to store all the configuration for your websites and IIS which are located in c:\windows\system32\inetsrv.
Even though this basically sucked, it was very easy to fix:
1) in windows explorer, browse to c:\windows\system32\inetsrv
2) rename the two XML files that IIS uses for configure.
3) goto the history folder (c:\windows\system32\inetsrv\history) and find the most recent backups of the two files.
4) copy the backups to the c:\windows\system32\inetsrv and rename them.
5) start the IIS Admin service.
Windows update error: 0×80072ee2
July 29, 2008
Ran into this little gem today and figured out the solution:
1) open up services.
start -> control panel -> administrtive tools -> services
2) stop the automatic updates and background intelligent transfer service.
3) remove the c:\windows\softwaredistribution folder
4) restart the automatic updates and background intelligent transfer service.
5) rerun windows update.
My many hats
July 10, 2008
I wear a lot of hats where I work. People often ask me what hats I wear when I perform the many tasks at hand. Here is the list:
Network administration: a Sherlock Holmes hat
Database administration: wizard hat (and robe)
Website Administration: Baseball cap
Technical Support: Yamika
ColdFusion Programming: Sombrero
.Net Programming: a jimmy hat ![]()
Rebulding MSDB in SQL Server 2005
May 26, 2008
Again I spent a gorgeous day in front of the computer trying to solve a major problem.
Seems that because of some diskspace issures we had in April, my MSSQL configure got hosed and the server hasn’t been able to perform any backups nor has the sql server agent been running. This was due to the fact that the MSDB database has been corrupted.
The following are the steps that I took to get everything back up and running. I will warn you that by doing these steps, you will lose all you Maintenance Plans that you had and you will have to recreate them. Figure that this is a small price to pay because let’s face it, you got to have backups.
I would strongly suggest that you don’t be an idiot like me and make sure that you backup your msdb database. However if you are like me and didn’t do this, these steps should get everything back on track.
- Put MSSQL into single user mode
- Restart SQL Server
- Connect to SQL server through the Management Console. From this point on we will be using TSQL to issue the commands so click the New Query button on the top left. At this point you should be in the master database inside the query window.
- Detach the MSDB database using the following commands:
use master
go
sp_detach_db ‘msdb’
goand click Execute
- We need to move (or rename, I prefer moving them) the existing MDF and LDF files for the MSDB database so that we can recreate it.
- Usually these files are located in the following directory:
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data
Your’s might differ. - Move (or rename) the MSDBDATA.mdf and MSDBLOG.ldf files.
- Usually these files are located in the following directory:
- Back to the Management Studio. Open up the instmsdb.sql file in a new query window. This file is usually located in the following directory:
C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Install - Execute the file. If you see any errors about xp_cmdshell, just ignore them. They are common and the script will take care of it.
- At this point you should have your MSDB database restored. The only thing left is cleanup.
- Execute the following command to make sure that xp_cmdshell is once again set to disable for security reasons:
EXEC sp_configure ’show advanced options’, 1
GO
RECONFIGURE WITH OVERRIDE
GO
EXEC sp_configure ‘xp_cmdshell’, 0
GO
RECONFIGURE WITH OVERRIDE
GO - Shutdown SQL Server
- Go back into your Startup Paremeters for your server in the SQL Server Configuration Manager and removed the -c;-m;-T3608 parameters we added earlier.
- Restart SQL Server
Everything should be cool at this point and you’ll be able to recreate any Maintenance Plans and Jobs.
Let me know if you have a better way or a way to restore the configuration information from the old msdb database.
CF8 Error: Cron service not available error
May 12, 2008
This morning all of our sites were throwing this cryptic ColdFusion error, even after a reboot the error was still there. I did a search on Google and came across this post that describes the fix.
- open your {cf_root}\lib directory
- rename neo-cron.xml to neo-cron.xxx
- if you have a neo-cron.bak, trying renaming it to neo-cron.xml. If you don’t you can download an empty neo-cron.xml from my box.net widget.
- restart ColdFusion.
Other SQL optimization tips
March 28, 2008
Ben started a whirl wind of ideas with his recent post about optimizing SQL queries for better performance. I was getting too carried away with commenting and decided that further tips that I had should be put down in my own post. Below are the ideas that I commented on, along with some new ones.
1) Create indexes on foreign key(s)
I think, no wait, I know that this is the most overlooked design aspect on almost every database. Far too often people forget to create an index for the foreign key(s) that are on a table. I guess the reason is because since all database servers automatically create an index on the columns that you specify to make up the primary key, why shouldn’t it do the same for foreign keys? Well it doesn’t and this is why it’s the most overlooked and biggest culprit of performance lost in a database.
2) Normalization
How many times have you seen a statement that joins 10 different tables all to grab a single value from each table? I’m so guilty of this, I should be thrown to the wolves. Again this is a HUGE performance hog and can be avoided by sitting down and taking the time to normalize your database. What is normalization you ask? It’s the idea that some data that is in one table can be copied into another table to prevent a join from occurring. I guess an example I can give is:
You have 2 tables named employees and companies. Companies has an one to many relation to Employees. When you write a query to retrieve an employee’s company name, you create a join between the employees table and the companies table and retrieve the company name.
It’s simple and we all do it and it’s probably not the greatest example, but I wanted something simple. Now if you wanted to normalize this, you would create a column on the employees table called company_name and copy the value from the companies table into that column, thus preventing you from have to create a join when retrieving the company name in a query which will improve the performance of the query. This can be accomplished at the application level or by using triggers within the database.
Now I wouldn’t use normalization in this situation, again I wanted something simple to explain the concept. With that said, when should you start and how do you determine what to normalize all depends on the data and the time the queries are taking to retrieve it. Most of time though I only normalize simple data that isn’t changed too often. For that stuff I use views.
3) Views and Indexed Views
Yes they’re different and indexed views aren’t supported on all database platforms so this doesn’t pertain to everyone.
Normalization is tough to deal with and maintain. So how do we go about increasing the performance of our database with copying columns and data everywhere, we use views!
Views are basically queries that you can save and then use like normal table when writing other queries. The idea is that instead of writing the same sub-queries or derived tables all the time and throughout your application, you can move those statements into views and then interact with them as you would with any other table.
Views are a great place to house the business logic of your application when you don’t want to or can’t use stored procedures. I use them a lot in applications to calculate expiration dates of memberships, totaling up line items in a shopping cart or just about any other calculations that the application needs.
Imagine trying to maintain a set of complicated calculations and business logic in an application that is copied over and over in queries scattered everywhere? You can’t!
Now I understand that most people argue that calculations like these should be moved into classes with the application, but I’ve found that that’s not always a smart thing to do and can sometimes cause bigger performance lost then realized. Imagine if you would, you have a method in your application that calculates the expiration date of a member and you need to access to this information at the database level. Well if the calculation is performed at the application level, that means you will need to copy and translate the logic to your database. By moving this calculation to a view you now have access to the information from both your database and the application and it’s all in one place! Also now since the calculation is being performed at the database level it makes you write less code in your application and not have to calculation for each record you return.
Ok great… so what is an indexed view? An index view is the basically the same thing as a regular view only you have the option of creating indexes on it where as a regular view you can’t. This can greatly increase the performance of queries that use views or span across multiple views. BE FOREWARNED though there are STRICT guidelines that you must follow in the creation and use of these views and they differ between database servers. You must consult your database servers documentation when attempting to use them.
Examples on using and creating indexed views in MSSQL 2000 can be found here.
4) Clustered Indexes
At the beginning of this article I mentioned that placing indexes on foreign key can be a big help and that almost all database server automatically create indexes for primary keys. Well expanding on that is the use of clustered indexes versus regular indexes.
When you create a regular old index on a table your database server basically creates a file on the server with information about where everything is within that table. Nothing happens to the data within the original table. Not so when you create a clustered index. A clustered index tells the database server how to physically write the data for this table onto the server’s disk. This is the reason why you can only have one clustered index on a table and it’s THE MOST important decision you can make when talking about performance.
Remember the advice at the beginning about placing index on foreign keys? Well to expand on that, you should also determine if your foreign key should be used as or be part of the clustered index on the table.
Let’s look back at the scenario I gave between the employees and the companies. After we’ve written our application, we noticed that throughout our application, there are many times when we query to list or find employees that are part of a particular company. Further investigation reveals that the only time we’re ever querying the employees table directly is when We’re authenticating a login or retrieving their profile.
By looking at this scenario it would probably make sense to include the company foreign key within the clustered index on the employees table and make it the first column of the index. Reason is that this will dramatically speed up the seek time of getting all the employees for a company since they will all be located around each other.
Now let me pull the reigns back a little. I’m not saying that you should go about doing this on every table in your database. There are very specific situations where this action makes sense and it doesn’t occur often. The only way to be completely sure is to load test your database in a testing environment with the change. Another HUGE WARNING! Doing this will cause the physical restructuring of data on the disk and as such it can take an incredibly long time to complete this change on large tables. Again, only testing can determine if a change like this is worth making.
5) Dropping, Rebuilding and Defragging Indexes and General Maintenance
When was the last time you rebuild or defragged your indexes?
Have you updated the statistics on the database lately?
How about checked the integrity of your data?
When was the last time you backed up your data?
Do you have any idea what I’m saying?
If your aren’t continually performing proper maintenance on your database, none of the ideas I talked about make any sense doing. Without proper maintenance your database will continue to degrade in performance no matter what you do. Almost all aspects of maintenance is automated and it’s so simple there’s no reason not to do it. MSSQL is especially easy since it has the Database Maintenance Plan wizard to guide you though it all. Check out the documentation the came with your database server to see what maintenance options or wizards it comes with.


