Feeds:
Posts
Comments

I am a BIG  fan of Google’s word processing editor : Google Docs.  It has become an indispensable part of my academic life.  To be honest, I have not touched MS Office since I discovered it. Everything’s got thrown up to Google Docs and … Done!! No more USB flash drive to carry on;  no more long time spending to search for a particular document which you don’t even remember its name. With Google Docs, just type the “unique” word that I am sure it is in the document. Boom…! My document shows up in no time. :)

OK, sure that’s enough advertising for Google :) ) .  Since Google Docs is that important to me,  I wrote a small script for Nautilus(kind of extension). This script provide an convenient way to upload your documents from local hard drive to Google Docs.

Just select all files you want to be sent to GDocs, then click on extension menu of Nautilus. That’s it.

The script itself was written in Python. It used  Zenity to take care of its GUI (~for simplicity’s sake). It supports all common document types. If some certain file’s formats are not supported to upload to Google Docs, you have the option to upload them as plain-text.

Instruction to install a Nautilus script can be found here: NautilusScriptHowto

You can download the script here: Send2GDocs.py

Send2GDocs Nautilus Script

Have fun and stay warm!

My Linux Desktop

My Desktop Screen - Click to view larger version

Took me some time to do the customizations that fit my style. :)
The OS I’m using is Ubuntu.

I took a wallpaper and applied some screenlets on it. I changed icons as well as windows colors to make everything match together.

Also, I made a wallpaper-integrated terminal for usage convenience.

In short, I absolutely like it :)

I coded a small stored procedure to detect which host are in the same Local Network with the SQL Server for further access. It’s kinda convenient since you don’t need any external scanner for this job. Only Transact-SQL is enough.
Note:
+ You’ll need permission to execute xp_cmdshell to use this stored procedure.
+ Change timeout setting in your SQL query executor script to a higher value(for ex timeout=3600) since scanning takes a while.

Running Procedure

Running Query

Result: Hosts online in the SQLServer's Local Network

Result: Hosts online in the SQLServer's Local Network

-----------------------------------------------
--Ping Scanner using T-SQL (C) Duong Thanh ( knightvn AT gmail.com)
--Detect which host are online on LAN by pinging from SQL Server
--Usage: EXEC spPingScan '192.168.1.0-254'
-------------------------------------------------
CREATE PROCEDURE spPingScan @ip_range varchar(200)
AS
BEGIN
	DECLARE @stpos int, @i int, @ip_start varchar(200), @start int
			,@head varchar(200),  @pos_dash int, @end int

	SET @ip_range = LTRIM(RTRIM(@ip_range))
	--ex: @ip_range = '192.168.1.1-10'
	SET @pos_dash = CHARINDEX('-', @ip_range) -- dash position
	SET @end = SUBSTRING(@ip_range, @pos_dash + 1, LEN(@ip_range) - @pos_dash) -- 233
	SET @ip_start = SUBSTRING (@ip_range, 1, LEN(@ip_range) - LEN(@end) - 1) -- 192.168.101.20

	SET @stpos = 1

	-- Get final . index
	SET @i = 1

	WHILE @i < 4
	BEGIN
		SET @stpos= CHARINDEX('.', @ip_start, @stpos+1)
		SET @i = @i + 1
	END 

	SET @start = CAST(SUBSTRING(@ip_start, @stpos+1, LEN(@ip_start) - @stpos) AS int) -- 10
	SET @head = SUBSTRING(@ip_start, 1, LEN(@ip_start) - LEN(@start)) -- 192.168.1.

    --tmp tables
	CREATE TABLE #tmpPingResult
	(  [ID] int identity NOT NULL, [content] varchar(400) NULL )

	CREATE TABLE #tmpHostsUp
	( [ID] int identity NOT NULL, [Host] varchar(50) NULL)

	DECLARE @j int, @cmd varchar(200), @host varchar(50)
	SET @cmd = ''
	SET @j = @start 

	WHILE (@j <= @end)
	BEGIN
		 SET @host = @head + LTRIM(RTRIM(CAST(@j as varchar(3))))
		 SET @cmd = 'ping -n 1 ' + @host
		 INSERT INTO #tmpPingResult EXEC master..xp_cmdshell @cmd

		 IF( (SELECT COUNT(*) FROM #tmpPingResult) > 8 )
		   BEGIN
			  INSERT INTO #tmpHostsUp VALUES (@host) --insert into host table if find a host up
		   END

		 TRUNCATE TABLE #tmpPingResult
		 SET @j = @j + 1
	END

  --return
  SELECT * FROM #tmpHostsUp

END

SQL  Server 2005 or later, for security purpose, following procedures are disabled by default:

  • xp_cmdshell : allows executing shell commands
  • sp_oacreate : creates an instance of an OLE object.
  • sp_makewebtask: creates output file

With sysadmin’s right, you can resurrect them:

Enable xp_cmdshell:

Exec sp_configure 'show advanced options',1;
RECONFIGURE;
EXEC sp_configure 'xp_cmdshell',1;
RECONFIGURE;

Enable sp_oacreate:

Exec sp_configure 'show advanced options',1;
RECONFIGURE;
exec sp_configure 'Ole Automation Procedures',1;
RECONFIGURE;

Enable sp_makewebtask:

Exec sp_configure 'show advanced options',1;
RECONFIGURE;
exec sp_configure 'Web Assistant Procedures',1;
RECONFIGURE;

Funny Emoticons App

Install my Funny Emoticons App for your facebook page  here : http://apps.facebook.com/duongapptest/


Just created a new facebook app based on Facebook Platform.  The app is simple, however, it took me a while to get used to the platform.  I used FBML(facebook markup language)  and Ajax in my app.

Some html and  javascript restrictions as well as their new “sandbox”  make development process a little bit more complicated.  But overall, the platform is great and they’re working on improving the documentation.  I’ll share with you what I know about the platform in later post.

Hope you like it!

Older Posts »