Category Archives: Tips

Uninstall XCode / Xcode 4 Preview

There is no application in Mac OSX to uninstall Programs. The only thing you can do is drag an application to the Trash Can.
However, it is quite simple to uninstall applications on MAC OS; you just move the application to the trash bin. Doing this, however, does not completely take care of uninstalling programs on Mac.

To understand why, you need to know that programs on Mac computers are of two types; the bundled programs, which can be uninstalled just by moving them to the Trash bin, and the non-bundled programs, which can be uninstalled using the same method, but additional manual work is required to clean up after them. Many programs leave behind settings and other small files that continue to take up space on your hard drive. These must be cleared out as well to ensure that you efficiently uninstall programs on Mac.

Here are some third-party uninstallers for your Mac, and their features:

Appcleaner

Appcleaner
Finds support files and preferences left behind by programs, and removes them from your hard disk.
Select the program that you want to uninstall and drag and drop it into AppCleaner

Apptrap

Apptrap
Takes care of supporting files, preferences and system files.
When you delete an application, an AppTrap window pops up and asks you if you want to remove the trashed program’s associated files.

Now, what about XCode?

The thing is that XCode is not listed as application, application bunldes and widgets.
To succefully remove XCode you have to run this command

sudo /Library/uninstall-devtools –mode=all

is the directory where the tools are installed. For typical installations the full path is /Developer/Library/uninstall-devtools
Cant find it

find / -type f -name “uninstall-devtools”

Easy enough, just make sure this is what you really intend to do as once it’s gone, it’s gone.

Enable TSQL xp_cmdshell command

SQL Server blocked access to procedure ‘sys.xp_cmdshell’ of component ‘xp_cmdshell’ because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of ‘xp_cmdshell’ by using sp_configure

A simple script to enable xp_cmdshell in SQL Server

sp_configure 'show advanced options',1
GO
RECONFIGURE
GO
sp_configure xp_cmdshell,1
GO
RECONFIGURE

Remove Maintance WP State

Description of error

If you’ve been keeping on top of your WordPress updates using the automatic upgrade feature, you may have run into a problem immediately after upgrading. A message that prevents access to any page on your blog, “Briefly unavailable for scheduled maintenance. Check back in a minute”.

Cause of this message

During an automatic upgrade, WordPress places a file in the blog root directory called “.maintenance” to prevent visitors from being confronted with ugly, broken pages during the upgrade process. That’s a great little built-in feature, but if the upgrade gets interrupted or fails for any reason, that file doesn’t get deleted and nobody, including you, can access your blog. No worries, this is (most likely) the simplest fix ever.

Official Solution

All you have to do is delete the .maintenance file from the blog root directory. Simple as it gets. After you’ve deleted the files you should be able to access the site just fine, but you may have to run the automatic upgrade again. How do you know if you should run it again? You’ll see a notification on the dashboard page that a new version of WordPress is available…same as you always see when a new upgrade is available. If you don’t see that message, you’re good to go.

In case problem persists

In my case the “. maintenance” file was not there at all. Started exploring the blog files and there it was.
In wp-content/upgrade/<pluggin_name>.temp
The pluggin name was the latest pluggin i tried to update. So i deleted this folder and everything came back to normal state.

I hope this helps.

Rebuild Icon Cache in Windows (Vista and 7)

Rebuilding the Icon Cache Database

  • Close all folder windows that are currently open.
  • Launch Task Manager using the CTRL+SHIFT+ESC key sequence, or by running taskmgr.exe.
  • In the Process tab, right-click on the Explorer.exe process and select End Process.
  • Click the End process button when asked for confirmation.
  • From the File menu of Task Manager, select New Task (Run…)
  • Type CMD.EXE, and click OK
  • In the Command Prompt window, type the commands one by one and press ENTER after each command:
    CD /d %userprofile%\AppData\Local
    DEL IconCache.db /a
    EXIT
    
  • In Task Manager, click File, select New Task (Run…)
  • Type EXPLORER.EXE, and click OK.

Why Google Chrome?

There are some features that most ppl hasnt noticed in google Chrome. For my opinion Google Chrome will be the no1 choise of all net freaks.

Incognito mode (private browsing)

For times when you want to browse in stealth mode, for example, to plan surprises like gifts or birthdays, Google Chrome offers the incognito browsing mode. Here’s how the incognito mode works:

Webpages that you open and files downloaded while you are incognito aren’t recorded in your browsing and download histories.
All new cookies are deleted after you close all incognito windows that you’ve opened.
Changes made to your Google Chrome bookmarks and general settings while in incognito mode are always saved.
Keyboard shortcut: Ctrl+Shift+N

Advanced Search in Address Bar

Chrome uses a search engine as your type a url. So the address bar can be used for search and for inserting a url. Autocomplete is very helpful even in very specific searches.

Also Check out this screen. In options

There are default Search options but also Other search engines from Sites you use mostly (this is done for you automatically)

Quick Search

Type your search. As you type you can see the number of occurrences (current occurrences is highlighted in orange).
Check out that the search string is highlighted in the scrollbar also.

Keyboard shortcut: CTRL + F

Speed

see some past test i did with tracemonkey here

CLLocationManager delegate method is not called in iOS4

Weird bug-easy solution.
I did have this weird issue also when updating to SDK4.0. I couldn’t get CLLocationManager to work on simulator. This problem also existed in iPhone Simulator 3.1.3.

The solution is quite weird. Open the Airport (wifi) in your mac and the CLLocationManager will work as before fetching the Cupertino, or in my case fetching a wide area of my country.
I guess the Location is estimated by the internet ip address of your connection.

Continue reading CLLocationManager delegate method is not called in iOS4

Check for Database Constraints

sql server

Problem
Adding constraints such as check constraints or foreign keys to a table are best practices to keep your data as clean as possible with minimal data enforcement rules performed at the database level. Unfortunately sometimes issues may occur where the data becomes out of synch and one of these constraints has been violated. This may be due to disabled constraints or constraints that are later added with the NOCHECK option. Finding these issues can be done by running queries to check each of the constraints, but is there any easier way to determine if the data the constraints support has been violated?

Solution
As mentioned already, one approach would be to write queries for each of the constraints and check the data to see if the constraints are being enforced. This is probably not all that difficult, but it could be time consuming. Another approach to tackle this issue is to use the DBCC CHECKCONSTRAINTS command. This command allows you to check the constraints to ensure that no data is violating the constraints that have been setup.

This command can be run as follows:

DBCC CHECKCONSTRAINTS (TableName) - checks an individual table
DBCC CHECKCONSTRAINTS (ConstraintName) - checks an individual constraint
DBCC CHECKCONSTRAINTS WITH ALL_CONSTRAINTS - checks all constraints in the database
DBCC CHECKCONSTRAINTS WITH ALL_ERRORMSGS - returns all rows that violate constraints
DBCC CHECKCONSTRAINTS WITH NO_INFOMSGS - suppress messages when query runs

SQL Server, Empty your Database & Reset Identity Columns **made Simple

sql server

This is a SQL Script that Cleans your Database Records & resets Identity Columns, and it is all in 6 lines!

/*Disable Constraints &amp; Triggers*/
exec sp_MSforeachtable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
exec sp_MSforeachtable 'ALTER TABLE ? DISABLE TRIGGER ALL'
/*Perform delete operation on all table for cleanup*/
exec sp_MSforeachtable 'DELETE ?'
/*Enable Constraints &amp; Triggers again*/
exec sp_MSforeachtable 'ALTER TABLE ? CHECK CONSTRAINT ALL'
exec sp_MSforeachtable 'ALTER TABLE ? ENABLE TRIGGER ALL'
/*Reset Identity on tables with identity column*/
exec sp_MSforeachtable 'IF OBJECTPROPERTY(OBJECT_ID(''?''), ''TableHasIdentity'') = 1 BEGIN DBCC CHECKIDENT (''?'',RESEED,0) END'

If you dont want to miss any saved Diagrams… Continue reading SQL Server, Empty your Database & Reset Identity Columns **made Simple

SQL Script for Constrains

sql server

This is a SQL Script that returns a list of all constrains in a database..

SELECT f.name AS ForeignKey,
	OBJECT_NAME(f.parent_object_id) AS TableName,
	COL_NAME(fc.parent_object_id, fc.parent_column_id) AS ColumnName,
	OBJECT_NAME (f.referenced_object_id) AS ReferenceTableName,
	COL_NAME(fc.referenced_object_id, fc.referenced_column_id) AS ReferenceColumnName
FROM sys.foreign_keys AS f
	INNER JOIN sys.foreign_key_columns AS fc ON f.OBJECT_ID = fc.constraint_object_id