Web Development and other ramblings

Month

November 2010

11 posts

Awesome re-indent from Textmate

4.6.3 Re-indent Text If you have code which has broken indent, you can select it and use Text → Indent Selection (without a selection it indents the current line).

The rules for estimating the indent are setup per-language using bundle preferences. For more details see theindentation rules section.

Nov 21, 2010
Deleting duplicate rows in mysql

http://forums.mysql.com/read.php?47,255365,257894#msg-257894

consider employee table(number,name,salary) to contain your data 
1 ethan 900 
1 ethan 900 
2 sumakar 800 
3 jay 800 
4 jack 700 
4 jack 700 
4 jack 700 

Follow the three steps below, 

Step 1: Move the non duplicates to a temporary table 

CREATE TABLE new_employee AS 
SELECT * FROM employee WHERE 1 GROUP BY number,name,salary; 

Step 2: delete old table 
We no longer need the table with all the duplicate entries, so drop it! 
DROP TABLE employee; 

Step 3: rename the new_table to the name of the old_table 
RENAME TABLE new_employee TO employee; 


If your table has indexes, hold on a minute…;)

————————————————————————————————

This worked like a charm. However I did it a sligthly different way, using Sequel Pro on Mac OSX:

1) Right-click the table on the sidebar and click “Duplicate Table”. Make sure that you check the box that says duplicate table. This could take a while with a large table, mine had about 67,000 rows.

2) Truncate the original table.

3) In the query window, use the query as stated above, but with an insert:

INSERT INTO table
SELECT * FROM tmp_table GROUP BY id, category

etc. 

Nov 15, 2010
Snippet :: jQuery Syntax Highlighter → steamdev.com
Nov 8, 2010
Creating a secure Git repository

I have been using git for about a year. One of the differences between Git and Subversion is that Git does not require a server for you to use it because of its distributed nature. However, more times than not, you are working with a team of developers and you need to have access to a centralized server to push and pull from. The default method to setup git is through SSH.

Here is a short tutorial on setting up the server through SSH http://blog.commonthread.com/post/1034988660/setting-up-a-git-server

So now we have our git server up and running. Pretty simple, eh? But there is one big problem. There are many cases where you don’t trust the collaborators you are working with and now you have given them full access to the command line through SSH. They may not have root access but they would be able to create files in their home directory and possibly read files outside!

At this point, I wondered how Git hosting sites like GitHub or Codaset address this problem. Surely, they don’t have people accessing their servers using the SSH shell, right? So, I asked the question on stack overflow (http://stackoverflow.com/questions/3116508/securing-git-server), which has saved my butt more than a few times. It seems there is a shell that comes with Git that will only allow push and pull and won’t let them access the shell via SSH.

Setting the git user’s shell to /usr/bin/git-shell should do the trick. For instructions please see: http://www.kernel.org/pub/software/scm/git/docs/everyday.html

Note: Some people suggest the use of Gitosis or Gitolite. I haven’t tried either but as I understand it Gitosis allows you to setup teams and groups for more fine-grained control over which users access which repositories. For my purposes, using git-shell was the easiest and pretty secure, in my opinion.

Update (11/5/2010): This site pretty much sums it up http://articles.slicehost.com/2009/5/13/capistrano-series-setting-up-git

Nov 5, 2010
Kobe triple double!
Nov 4, 2010
Lakers v. Kings

fuckyeahlakers:

ESPN. 10 minutes.

Just a friendly reminder.

Nov 3, 2010
Wow, what a play by the bucks out of the timeout

That’s why Scott Skiles is one of the best coaches in the league.

Nov 3, 2010
git add -u to add deleted files to staging area → stackoverflow.com
Nov 3, 2010
Introducing the Ars Technica Reader for iPad → arstechnica.com

The user interface is very simple HTML and CSS. This is great, because the Webkit team has implemented a ton of neat stuff like animations, transforms, transitions, advanced CSS3 rules like text and box shadows, gradients, and the canvas tag. They make it easier than ever to meet our designer’s exacting standards and to build fast, beautiful applications without resorting to weird tricks and hacks.

Nov 1, 2010
[HowTo] Backup and Restore MySql Databases at SANIsoft – PHP for E Biz → sanisoft.com

Very informative. Mentions ways to backup mysql databases using a mysqldump or by backing up the actual physical database file.

Nov 1, 2010
Nov 1, 201030 notes
Next page →
2012 2013
  • January
  • February
  • March
  • April
  • May
  • June 1
  • July
  • August
  • September
  • October
  • November
  • December
2011 2012 2013
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
2010 2011 2012
  • January 1
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October
  • November
  • December
2010 2011
  • January
  • February
  • March
  • April
  • May
  • June
  • July
  • August
  • September
  • October 5
  • November 11
  • December 1