Tuesday, October 27, 2009

The New Citrix!

Citrix new slogan:" Simplicity is power"
Watch this CitrixTV clip...

Thursday, September 24, 2009

VBS Utility Class

i had written several vbs and hta scripts at work to do some automation for me. here's a utility class for registry read/write, file create/write, getting hostname and others. just customize it in anyway you want. if you have any questions, just drop me a line.

[listing 1] Util class
--------------------------
Class Util
Dim m_oFso, m_oShl, m_oNet, m_appLoc
Private Sub Class_Initialize
Set m_oFso = CreateObject("Scripting.FileSystemObject")
Set m_oShl = CreateObject("WScript.Shell")
Set m_oNet = CreateObject("WScript.Network")
m_appLoc = m_oFso.GetFolder(".")
End Sub
Private Sub Class_Terminate
Set m_oFso = Nothing
Set m_oShl = Nothing
Set m_oNet = Nothing
End Sub
Public Property Get HostName
HostName = m_oNet.ComputerName
End Property
Public Sub CopyFolder(srcDir, tarDir, bOverWrite)
m_oFso.CopyFolder srcDir, tarDir, bOverWrite
End Sub
Public Sub DeleteFolderFiles(folderPath)
Dim oFile, oFolder
If Not m_oFso.FolderExists(folderPath) Then Exit Sub
Set oFolder = m_oFso.GetFolder(folderPath)
For Each oFile In oFolder.Files
DeleteFile oFile
Next
End Sub
Public Sub DeleteFile(strPath)
m_oFso.DeleteFile strPath, True
End Sub
Public Sub CreateFile(strPath)
Dim g: Set g = m_oFso.CreateTextFile(strPath)
g.Close
End Sub
Public Sub RenameFile(strOrig, strNew)
m_oFso.MoveFile strOrig, strNew
End Sub
Public Sub CreateFolder(strPath)
If m_oFso.FolderExists(strPath) Then Exit Sub
Dim oPF: oPF = m_oFso.GetParentFolderName(strPath)
If Not m_oFso.FolderExists(oPF) Then CreateFolder oPF
m_oFso.CreateFolder(strPath)
End Sub
Public Function PathExists(strPath)
Dim bRes: bRes = m_oFso.FileExists(strPath)
If Not bRes Then bRes = m_oFso.FolderExists(strPath)
PathExists = bRes
End Function
Public Function WriteReg(keyRoot, vValue, vType)
On Error Resume Next
m_oShl.RegWrite keyRoot, vValue, vType
WriteReg = (Err.Number = 0)
End Function
Public Function WriteRegString(keyRoot, strValue)
WriteRegString = WriteReg(keyRoot, strValue, "REG_SZ")
End Function
Public Function WriteRegExpString(keyRoot, strValue)
WriteRegExpString = WriteReg(keyRoot, strValue, "REG_EXPAND_SZ")
End Function
Public Function WriteRegDword(keyRoot, dwValue)
WriteRegDword = WriteReg(keyRoot, dwValue, "REG_DWORD")
End Function
Public Function WriteRegBinary(keyRoot, binValue)
WriteRegBinary = WriteReg(keyRoot, binValue, "REG_BINARY")
End Function
Public Function ReadReg(keyRoot)
On Error Resume Next
ReadReg = m_oShl.RegRead(keyRoot)
If Not Err.Number = 0 Then ReadReg = "[notfound]"
End Function
Public Function RegValueExist(keyRoot)
RegValueExist =( ReadReg(keyRoot) <> "[notfound]")
End Function
Public Property Get AppPath
AppPath = m_appLoc
End Property
Public Function RunCommand(cmd)
RunCommand = ""
On Error Resume Next
Dim tmpOut: tmpOut = m_oShl.ExpandEnvironmentStrings("%TEMP%\$tmp.out")
Dim retCode: retCode = m_oShl.Run("%comspec% /c " & cmd & " >""" & tmpOut & """" , 0, True)
Dim outFile: Set outFile = m_objFso.OpenTextFile(tmpOut)
If Err.Number <> 0 Then
RunCommand = outFile.ReadAll
'MsgBox outFile.ReadAll
outFile.Close
m_objFso.DeleteFile tmpOut
End If
Set outFile = Nothing
End Function
Public Sub RunRawCmd(cmd, bWin,bWait)
m_oShl.Run "%comspec% /c " & cmd, bWin, bWait
End Sub
Public Sub RestartSystem()
m_oShl.Run "shutdown -r -f -t 00", 0, False
End Sub
Public Function ImportRegFile(regFile)
'ImportRegFile = RunCommand("reg import """ & regFile & """")
ImportRegFile = RunCommand("regedit /s """ & regFile & """")
End Function
Public Sub Sleep(nSecs)
Dim t: t="~$slp.vbs"
RunRawCmd "echo wscript.sleep " & nSecs & "000> " & t & " & " & t & " & del /f/q " & t, 0, True
End Sub
Public Property Let CurrentDirectory(strDir)
m_oShl.CurrentDirectory = strDir
End Property
Public Property Get CurrentDirectory
CurrentDirectory = m_oShl.CurrentDirectory
End Property

End Class

--------------------------

Tuesday, September 15, 2009

File Comparison Batch Script

at work, i needed to compare the files in the mounted ISO image to the extracted raw files. there are several tools which compares directories like the built-in fc.exe of windows and other freewares but what i needed is something simple which would only check for the files on the the same folder location which is just relative to the root location. for example, the mounted ISO image is my reference subject and the files in it should be found on the extracted file structure of the same relative folder location.

here's what i've came up. posting it here for future reference and for those who might have the same needs.

listing: compdir.bat
---------------
::reference dir
@set REFDIR=%~1
::this is the copied directory which should be checked
@set CMPDIR=%~2
::call the root first
@call :CMPPROC
@goto XXX

:CMPPROC
@set MRGPATH=%REFDIR%%~1
@echo RefDir: %MRGPATH%
@echo TarDir: %CMPDIR%%~1
@echo ------------------------------------
::check on the files
@for /f "usebackq tokens=* delims=" %%i in (`@dir /b/a:-d "%MRGPATH%"`) do @if exist "%CMPDIR%%~1\%%i" (@call :CMPFILE "%%i" "%MRGPATH%\%%i" "%CMPDIR%%~1\%%i" ) else (@echo [NG] "%%i")
@echo ------------------------------------
::iterate on the sub directories
@for /f "usebackq tokens=* delims=" %%i in (`@dir /b/a:d "%MRGPATH%"`) do @call :CMPPROC "%~1\%%i"
@goto :EOF

:CMPFILE
@fc /B "%~2" "%~3" >nul
@if %ERRORLEVEL%==0 (@echo [OK] "%~1") else (@echo [NG] "%~1")
@goto :EOF

:XXX
@echo Done

---------------

Monday, August 17, 2009

M$ Word patent infringement

Last week, many articles went out after the Texas federal court judgment in favor of i4i, a Canadian software companion. The dispute was related to M$ usage of custom XML methodology in its Office suite especially Word, for which i4i owns the technology patent. One blog article disclosed that M$ developers knew about this technology before Word 2003/2007 was developed and that one developer's email stating "i4i will become obsolete" when the new version of Word goes out to market. Following the court's decision, M$ was ordered to stop selling its Word application and this becomes a worry to the many enterprises who had been using Word especially those companies primarily using SharePoint. the current case is still not over though. M$ had filed an appeal and might be settling this off the court... perhaps might even buy i4i! M$ has been ordered to pay around $300M and to stop selling those Word apps. You may expect M$ to either release a hotfix or patch to remove reading custom XML files in Word; or rather M$ to get into a licensing agreement with i4i for its technology.

related articles:
Jury orders Microsoft to pay $200M in damages to i4i
Judge bans Microsoft from selling Word

google: i4i+word

Thursday, July 30, 2009

Windows 7 RTMed

last week, Windows 7 has been RTMed (details here). having just tried playing with the RC builds on my work, there are several new features which seems very alluring to have like native support for ISO image burning. this article lists several good things in Windows7. but will it really sell out? i'm still pessimistic about it but once it starts shipping out the Windows7 lite version for the netbooks, i think it will then start selling. but again, considering the compatibility of old devices/drivers and softwares, many people will stick to the old windows XP for a little while. anyway, let's just wait for it release and go-to-market date. my personal advice however, is to wait....

Saturday, April 4, 2009

Will Windows 7 sell?

our company is currently testing new versions of our products on top of Windows 7, which is scheduled to be released to market next year 2010. this had given me a chance to have a feel-of-use of this new Windows version to be.
my first impression was - "it looks almost the same as Vista". yes, the GUI is based on Vista with some minor modifications like the task bar which seems to be "Mac-like" a bit. for a heavy XP user like me, i think i won't be switching to Windows 7 when it will be released; unless the GUI has be more near XP-tic...
"will W7 do a good sell out next year compare to Vista" had been a topic of discussions with several of my IT related friends. some are pretty optimistic that it will. but personally, i doubt... i think it will follow Vista's path. why? here are my thoughts about this.
1. hardware requirements
compared to the HW requirements of its XP predecessor, W7 has almost the same system requirements for an installation. this implies that if you're an XP user now, your machine might not be able to cater to this OS' needs. some hardwares like audio or video might not have any driver releases for these new OS. so buying the OS alone won't be enough; you'll need to invest on a new hardware also.
2. GUI modifications
one main reason why Vista did not sell to its existing users is that the GUI were largely modified. too much abstraction like the UAC and used-to-there icons and shortcuts were moved to other locations. this had made a decrease in productivity of the existing XP users considering that they have to search where or ask some one. rather than forcing it's users to use the new GUI, MS should be giving choices to users on to which kind of GUI he would like to use - Vista-tic one or XP-tic one... If MS could incorporate it classic XP GUI into W7 as a selectable alternate GUI inside the system, i think many XP users will be moving into W7 gradually - changing its system from XP-tic configuration to W7 or Vista-tic like configuration on a step by step basis.
3. net/mobile pc trend
nowadays, mobile users are increasing with the spread of wifi accessibility on public places. netbooks are getting popular and i think it will overtake the number of desktop and laptop users in 3-4 years from now considering its attractive price! most netbooks however are very limited in terms of system extensibility. Windows ULCPC Windows XP Home EOM licensing was revised to limit the hardware capability of the PC like to only support 1GB of RAM. MS is trying to divert users wanting netbooks of higher capability to buy laptop (now generally is pre-installed with Vista) rather than a netbook. again another strategy to make Vista sell out.
4. new software versions
whenever there's a new Windows version, application softwares relying on the programming interfaces provided by the OS should make sure their application works on that platform. due to the underlying architectural changes, most existing softwares will not work on top of a new Windows OS version. thus if you buy a program which used to work on XP, it might not work on Vista. this implies that you will need to buy new application software versions which are compatible with the newer Windows7 OS platform. in short, you'll need to invest on new software versions too...

so what's the catch! now that you know what kind of new investments are necessary if you'll be switching to a new OS, you better have to think twice before getting one.
if you're not "financially" ready to make a new investment for another computer, OS and softwares, i would suggest that you stick to your current PC until the time of real-necessity arises. this subtle new investment requirement is actually the main hurdle which W7 has to get rid off the way.

Wednesday, March 4, 2009

Citrix XenServer for FREE!!!

last feb 23, citrix announced that it will make xen server free to everyone! the info leaked out prior to the announcement but it seems to be "leaked off" in purpose. feb 23 is also the day for the vmworld event and having the info posted out in the blog, rumors had spread out to the participants of the vmworld; and stole that day from vmware i guess.

check it out: XenServer

Saturday, January 31, 2009

Google search returns all links as "harmful"

i'm a heavy user of google search. a while ago, i noticed that all the links returned by the search engine were sub-labeled with "This site may harm your computer". clicking on the link will guide you to the google advisory page and you can't go to the site you wanted! it seems that google's server is incorrectly returning the results... maintenance or something going on???
tried searching for the key "Google", and guess what!? it was also tagged as harmful (see pix).

Tuesday, January 6, 2009

Weird ethernet issue

HAPPY NEW YEAR!!!
work resumed last monday after 3 weeks of holidays! sad to say, i was bedridden for around 1 week during christmas due to cough and colds. sigh...

yesterday, i was trying to print out a testcase to our network printer but i kept on getting a network location not found error! i can see a shared folder but not its contents. tried restarting the system (win xp sp3) for several times but to no effect. i checked the event logs but nothing strange in the trace either. then i thought that it could be the network issue as the DNS & DHCP server had just been re-imported into a new virtual host. so i plugged my laptop into a different network segment but still to no avail.
next, i decided to removed my laptop from the current windows domain, restarted it and logged in with the local admin account. then tried re-joining the same domain once again after renewing the ip address but still the result! grrrr... wtf! if i can't make this laptop join the domain, it would be a lot of trouble for me at work! so i tried updating the ethernet card's driver, but still the same issue. i was getting hopeless and decided to run a windows repair using the installer cd. it took me around an hour to run the repair re-installation. tried joining the domain after the repair but still that damn "network location not found" error message dialog kept on popping up! last resort was to reinstall the system but i don't want to as it will surely take me several days to complete the application installation and tune-ups. i was searching for ghost backups if i had (i couldn't remember if i had taken one either.) unfortunately, i found no ghost snapshot images among my backup hdds.
before resorting to re-installing the OS, it came to me to try uninstalling the ethernet device and have the system re-discover that new device. that's what i did now and the system properly detected a new device and asked for the device driver installation. i set the location of the driver and installed it. after that, i tried re-joining the domain, 10secs... 20 secs... of waiting; the error message did not appeared! 25secs... at last my laptop was able to join the domain!!! whew. that was a very simple solution at all! i should have done this before trying other things then!!!
really didn't kwow what caused this problem. i had tried looking for traces but got no clue at all... anyway, now that i know; it would be easier then next time!
btw, i saw several posts on forums having the same issue. it seems that most people resorted to reverting the previous snapshots or re-installing the entire OS. i hope that this will also serve as a reference to you if ever you'll encounter the same symptoms of trouble...