Blog Home  Home RSS 2.0 Atom 1.0 CDF  
 
hoohee.com - Monday, April 17, 2006
 Monday, April 17, 2006

I have developed an application which uses SQL Server as a data store and was looking for a way to install it with my appliation in a seamless fashion. With a lot of trial and error and a couple of hours trawling the internet for a decent source for this kind of info, I found a very interesting page on Microsoft's website.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsse/html/EmSQLExCustApp.asp

Finally, I decided to use the command prompt to  launch the installer.

SQLEXPR.EXE -q /norebootchk /qb reboot=ReallySuppress addlocal=all instancename=SQLCatalog SCCCHECKLEVEL=IncompatibleComponents:1;MDAC25Version:0 ERRORREPORTING=1 SQLAUTOSTART=1 SAPWD=SQLPassword SECURITYMODE=SQL DISABLENETWORKPROTOCOLS=0

Then I adapted an NSIS script I had (see below). All you need to do then is call the function UpdateMSDE from your NSIS script.

; English
!define URL_MSDE "
http://www.microsoft.com/downloads/info.aspx?na=46&p=8&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=57856CDD-DA9B-4AD0-9A8A-F193AE8410AD&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2ff%2fd%2f4%2ffd407f12-0845-4d51-b084-779860d57ba5%2fSQLEXPR.EXE&oRef=http%3a%2f%2fwww.microsoft.com%2fsql%2feditions%2fexpress%2fdefault.mspx"


Function TestMSDE

        ;MessageBox MB_OK "Checking $1   $2"
 ReadRegStr $0 HKLM \
        "$1" "$2"

        IfErrors SQLServerNotFound SQLServerFound

 SQLServerFound:
                ;MessageBox MB_OK "Checking $3   $4"
  ReadRegStr $5 HKLM  $3 $4
                IfErrors SPNotFound SPFound

 SPFound:
  ;Check the first digit of the version; must be 8
  StrCpy $0 $5
  StrCpy $1 $0 1
  StrCmp $1 "8" SQLServer2000Found SQLServerVersionError

 SQLServer2000Found:
                Push 1
  Goto ExitCheckMinSQLVersion

 SQLServerVersionError:
  ;MessageBox MB_OK|MB_ICONEXCLAMATION  "This product requires a minimum SQLServer version of 8; detected version $0. Setup will install SQLExpress 2005."
  Push 0
  Goto ExitCheckMinSQLVersion

 SQLServerNotFound:
  ;MessageBox MB_OK|MB_ICONEXCLAMATION  "SQLServer was not detected; this is required for installation. Setup will install SQLExpress 2005."
                Push 0
  Goto ExitCheckMinSQLVersion

 SPNotFound:
  ;MessageBox MB_OK|MB_ICONEXCLAMATION  "SQLServer version $0 was detected. SQLServer version 8 (or later) is required for installation. Setup will install SQLExpress 2005."
  Push 0
  Goto ExitCheckMinSQLVersion

 ExitCheckMinSQLVersion:
 
FunctionEnd

Function ExistsMSDE

   ; search for SQL server
   StrCpy $1 "SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion"
   StrCpy $2 "CurrentVersion"
   StrCpy $3 "SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion"
   StrCpy $4 "CSDVersion"
   Call TestMSDE
  
   pop $1
   IntCmp $1 1 Found
  
   ; search for SQLExpress 2005 instance
   StrCpy $1 "SOFTWARE\Microsoft\Microsoft SQL Server\$SQLCatalog\MSSQLServer\CurrentVersion"
   StrCpy $2 "CurrentVersion"
   StrCpy $3 "SOFTWARE\Microsoft\Microsoft SQL Server\$SQLCatalog\MSSQLServer\CurrentVersion"
   StrCpy $4 "CSDVersion"
   Call TestMSDE
  
   pop $1
   IntCmp $1 1 Found
  
   ;jump to not found which will then start the installer
   ;IfFileExists 'C:\MSDERelA\Setup.exe' NotFound
  
   ; let's try to download SQLExpress 2005
   MessageBox MB_YESNO|MB_ICONEXCLAMATION  "SQLExpress 2005 not found. Do you want me to download installer from ${URL_MSDE}?" IDYES true IDNO false

true:
   nsisdl::download /TIMEOUT=30000 "${URL_MSDE}" "$PLUGINSDIR\SQLEXPR.EXE"
   Pop $0
   StrCmp $0 "success" Downloaded
   MessageBox MB_OK "Download failed: $0"
  
false:
   MessageBox MB_OK "Failed to detect MSDE or SQLExpress on this machine. The installer will continue but the application will fail to start. You will have to manually install the database engine and run the database creation scripts."
   Goto NotFound
  
Downloaded:
   ; run installer
   ExecWait "$PLUGINSDIR\SQLEXPR.EXE -q /norebootchk /qb reboot=ReallySuppress addlocal=all instancename=$SQLCatalog SCCCHECKLEVEL=IncompatibleComponents:1;MDAC25Version:0 ERRORREPORTING=1 SQLAUTOSTART=1 SAPWD=$SQLPassword SECURITYMODE=SQL DISABLENETWORKPROTOCOLS=0"
   ;ExecWait 'net start mssql$$$SQLCatalog'
   Sleep 10000 ; wait for a 10 seconds
   Goto Found
  
NotFound:
   Push 0
  
   Goto Exit
  
Found:
   Push 1
  
Exit:
  
FunctionEnd

Function UpdateMSDE
   Call ExistsMSDE
   pop $1
  
   IntCmp $1 1 Found
 
Found:
 
Exit:

FunctionEnd

Yes I know. The script needs a bit of cleaning. But I trust you can do it.

4/17/2006 9:45:35 AM (AUS Eastern Standard Time, UTC+10:00)  #    Comments [0]   MSSQL  | 
 Sunday, April 16, 2006

I've looked around for a decent personal finance software, which is free and simple to use, but couldn't find one.

I have started working on an application which I have called "Money Man". Once I finish the first cut of code, I will publish on this site for grabs.

The architecture I have devised will have the following constituents:

  • .NET 2.0
  • Firebird embedded

I do not expect the final package to be bigger than 4 MB.

Stay in touch for more...

4/16/2006 9:52:10 AM (AUS Eastern Standard Time, UTC+10:00)  #    Comments [1]   Money Man  | 
 Wednesday, April 12, 2006

The world is changing, you better believe it and get on the bandwagon.

The next big change in the corporate world is going to be KNOWLEDGE related. This is not the kind of knowledge that you only use, rather, it comes in a variety of flavours and textures. There is the "soft" and the "hard".

You will have to deal with: knowledge capture, knowledge capital, knowledge workers, knowledge economy, knowledge management, knowledge transfer, knowledge innovation, knowledge enablement, and me.

Interested? Read on.

If you're in the software industry you would understand that what we do, day in and day out, is deal with knowledge. We develop software using knowledge. We license our software to companies wanting to use it. We charge for our knowledge as a service. Does this sound familiar to you?

To succeed in a competative market, software companies have to build and leverage this knowledge and the way to do it is by being innovative and creative. They will have to convert into knowldge specialists organizations with sharp cuts in middle management.

The problem that most organizations have when faced with change is that most individuals become defensive and mistakes are repeated. We all know the issue but no one wants to take responsibility to resolve it. My opinion is to be honest and take a lead.

Before I leave you to ponder, here are a few links of interest on this topic:

4/12/2006 9:11:06 PM (AUS Eastern Standard Time, UTC+10:00)  #    Comments [0]   Management  | 
 Saturday, April 08, 2006

General consensus of "The Last Templar" was of a reasonable read with a very disappointing ending. Scoring was averaged of about 6 out of 10.

Character development was poor. Great action scenes. Well researched and good story jumps into the past.

Our next book is "Paradigms Lost" by John Casti.

4/8/2006 12:11:50 AM (AUS Eastern Standard Time, UTC+10:00)  #    Comments [0]   Book Club  | 
 Sunday, March 26, 2006

 

      

 

      

 

  

3/26/2006 7:31:58 PM (AUS Eastern Standard Time, UTC+10:00)  #    Comments [0]   Activities  | 

The Commonwelath Games 2006 in Melbourne was a delightful competition and Melbourne was packed with people from all over the Commonwealth countries and all over Australia.

I had the chance to be part of this event and benefit from a few photo shooting sessions.

In this section of my website, I would like to share with you my experience, hoping that you might find it enjoyable.

3/26/2006 7:05:01 PM (AUS Eastern Standard Time, UTC+10:00)  #    Comments [0]   Commonwealth Games 2006  | 

Experiments in sports photography: Cycling

The shots below were taken on 26/03/2006 during the Commonwealth Games 2006, 100 Km cycling competition for Women and Men.

I have made a few mistakes during the shooting session but by the end of it, I was getting better results.

Here's a list of tips I got out of today's exercise:

  1. Understand the sports and study the venue. Don't leave it till the last minute like I did.
  2. Learn about the competitors and their style. I did not even know who the contestants were.
  3. Use a high speed ISO film. I used 1600 ISO.
  4. Take your shots with a large depth of field as focusing is a bit hard at high speed. I was using an apparture range of 13 to 22.
  5. Do not stand in hard sun light or in the shadow, pick a well lit area with soft light. In some of the picture below, you will notice that faces are not recognizable. The colours came out bright as intended but the faces were a bit on the dark side.
  6. Use the flash when in a dark spots or when cyclists are riding in the shadow. When using the flash, pick your shots as the flash might not recharge fast enough to allow you another chance at shooting your target.
  7. Pick a long stretch or road and move your camera horizontally at the same speed as your subject. I found that keeping the cyclist in the middle of the frame while having the lense at its widest angle produces the best results.
  8. When panning with your subject, do experiment with slow shutter speeds. Reduce the shutter speed to capture the effect of speed (a blurry background with a focused cyclist).
  9. Do not zoom too much, you can always crop later. It especially applies to shooting on bends and during downhill rides as cyclists tend to pick up speed.
  10. Choose a hilly area and stand on the uphill, you'll get plenty of time to shoot the competitors and some interesting facial expressions. It's a bit hard for the contestants and easy to photograph.

 

      

 

      

 

      

 

      

 

      

3/26/2006 6:59:27 PM (AUS Eastern Standard Time, UTC+10:00)  #    Comments [0]   Cycling  | 
 Wednesday, March 22, 2006

How many times have you thought you had a strong opinion about something?

Does it happen often to you?

Regardless of what I do, I find things, daily, around me spinning out of synch with my expectation. I have this urge to define how they should spin, but found, through experience, bitching about them to be more satisfying. HEHEHE!

The oportunity has arisen for my bitching to be posted under this space, and so it goes...

WARNING: Do not proceed further if you disagree or are offended by strong opinion.

3/22/2006 7:00:13 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0]   Opinions  | 
 Tuesday, March 21, 2006

The photos below were taken during a few of my business trips to France.

 

      

 

      

 

      

 

      

 

      

 

      

 

      

3/21/2006 11:26:08 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [1]   France  | 

You will find in this section a collection of photos I have taken over the years since I have become a hobbyist photographer.

Please honour us by leaving a critique.

I hope you enjoy your photo browsing sessions.

The full album can be accessed on the following URL: http://www.hoohee.com/Photos

3/21/2006 11:05:36 PM (AUS Eastern Daylight Time, UTC+11:00)  #    Comments [0]   Photography  | 
Copyright © 2008 Emile Bassil. All rights reserved.