Friday, October 31, 2008

Rake TODOs

I've been doing a lot of rails work lately and I've been finding lots of new features in the language and tools. I need to start writing them done to help with my memory. Today I found a good one in rake
rake notes
As usual, rails is all about convention over configuration. There are 3 different tags that will show up if you use them in your code (FIXME, OPTIMIZE, TODO). I've been using the TODO a lot, but I am going to start adding some OPTIMIVE to my coed as well. I've always been a firm believer in optiimize when necessary, but this will help me put in some hints in case things start to slow down.

Thursday, August 21, 2008

wix with custom screen

Needed to create a custom screen for my wix UI, but I still wanted to use the existing screens as well. This worked well. This shows a custom dialog, button wireup, font setting, ..




<UI Id="UserInterface">
<Property Id="DefaultUIFont" Value="WixUI_Font_Normal" />
<TextStyle Id="WixUI_Font_Normal" FaceName="Tahoma" Size="8" />
<TextStyle Id="WixUI_Font_Bigger" FaceName="Tahoma" Size="12" />
<TextStyle Id="WixUI_Font_Title" FaceName="Tahoma" Size="9" Bold="yes" />

<Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />

<DialogRef Id="BrowseDlg" />
<DialogRef Id="DiskCostDlg" />
<DialogRef Id="ErrorDlg" />
<DialogRef Id="FatalError" />
<DialogRef Id="FilesInUse" />
<DialogRef Id="MsiRMFilesInUse" />
<DialogRef Id="PrepareDlg" />
<DialogRef Id="ProgressDlg" />
<DialogRef Id="ResumeDlg" />
<DialogRef Id="UserExit" />

<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
<Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="InstallDirDlg">1</Publish>

<Publish Dialog="InstallDirDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="SetTargetPath" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="Next" Event="NewDialog" Value="CustomizeDlg" Order="2">1</Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Property="_BrowseProperty" Value="[WIXUI_INSTALLDIR]" Order="1">1</Publish>
<Publish Dialog="InstallDirDlg" Control="ChangeFolder" Event="SpawnDialog" Value="BrowseDlg" Order="2">1</Publish>

<Publish Dialog="CustomizeDlg" Control="Back" Event="NewDialog" Value="InstallDirDlg">1</Publish>
<Publish Dialog="CustomizeDlg" Control="Next" Event="NewDialog" Value="SqlDialog" Order="2"></Publish>

<Publish Dialog="SqlDialog" Control="Back" Event="NewDialog" Value="CustomizeDlg">1</Publish>
<Publish Dialog="SqlDialog" Control="Next" Event="NewDialog" Value="LogonAccountDialog" Order="2"></Publish>
<Dialog Id="SqlDialog" Width="370" Height="270" Title="[ProductName] Setup">
<Control Id="Title" Type="Text" X="15" Y="6" Width="200" Height="15" Transparent="yes" NoPrefix="yes" Text="{\WixUI_Font_Title}ProSolv Database Settings" />
<Control Id="Description" Type="Text" X="25" Y="23" Width="280" Height="15" Transparent="yes" NoPrefix="yes" Text="Specify the database that the ProSolv Server Applications will use." />
<Control Id="BannerBitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="44" TabSkip="no" Text="!(loc.InstallDirDlgBannerBitmap)" />
<Control Id="BannerLine" Type="Line" X="0" Y="44" Width="370" Height="0" />

<Control Id="serverLabel" Type="Text" Height="17" Width="78" X="19" Y="93" Text="Database Server" />
<Control Id="sqlServer" Type="Edit" Height="15" Width="215" X="102" Y="93" Property="SQL_SERVER" />

<Control Id="databaseLabel" Type="Text" Height="17" Width="58" X="19" Y="121" Text="Database" />
<Control Id="sqlDatabase" Type="Edit" Height="15" Width="215" X="102" Y="121" Property="SQL_DATABASE" />

<Control Id="userLabel" Type="Text" Height="17" Width="58" X="19" Y="152" Text="Username" />
<Control Id="sqlUser" Type="Edit" Height="15" Width="215" X="102" Y="152" Property="SQL_USER" />

<Control Id="passLabel" Type="Text" Height="17" Width="58" X="19" Y="183" Text="Password" />
<Control Id="sqlPassword" Type="Edit" Height="15" Width="215" X="102" Y="183" Property="SQL_PASSWORD" Password="yes" />

<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
<Control Id="Next" Type="PushButton" X="236" Y="243" Width="56" Height="17" Default="yes" Text="Next" />
<Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17" Text="Back" />
<Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="Cancel">
<Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
</Control>
</Dialog>
</UI>

Wednesday, August 20, 2008

Query for Goodness

Here is a query for work. Needed to know that state of the system, so I returned it's goodnesss. Good example of useing a case statement in sql



select case
when good = 3 and bad = 0 and ugly = 0 then 'good'
when bad = 1 then 'bad'
when ugly > 0 then 'ugly'
end as 'Goodness'
from
(select count(*) as good from dbUpdateVersion where dbversion in (399,401,402) ) tbl1,
(select count(*) as bad from dbUpdateVersion where dbVersion = 400 ) tbl2,
(select count(*) as ugly from dbUpdateVersion where dbversion > 402 ) tbl3

Wednesday, August 6, 2008

vi case insensitive search

I have looked for this many times and have just now found it. In order to do a one-off case insensitive search, start your search with \c. For example, to finf Shortcut and shortcut

/\cshortcut

will match both. More documentation can be found with :help. Chapter 7 Ignoring case in a pattern

Monday, July 28, 2008

Writing Spec documents

Here are some things to think about when you are writing a spec. Some of these items are technology dependent (this is really in reference to a spec for RoR)
  1. Make sure you understand the requirements. If you have any questions about what is being asked, make sure that you get them answered first. If you don't understand the requirement completely, you can not write the software. This is the most important part of writing the spec. Again, ask questions early and often. Do not assume.
  2. Content is much more important than format. If you are spending more than 10 minutes on the formatting it is too long. Just write stuff down that conveys what you are trying to accomplish.
A checklist of items that to think about when you are writing the spec
  • Screen additions, modifications
  • Url design / Route configuration
  • Database changes
  • Code
    • Controllers
    • Views
    • Models
  • Tests
    • Selenium
    • Spec

Tuesday, July 22, 2008

i18n fun with resources

I am having some issues finding dlls that are supposed to be created when I compile my projects with VS2005. The resources that I have are suppose to compile to dlls in language specific folders (after being linked with Al.exe). I seemed to have found an issue though. When you inlude a project in a seperate project and then compile the second project. It does not call Al.exe on the resources of the first project. Seems kind of odd to me. Investigateion will continue.

Wednesday, July 16, 2008

VI regex rocks

Still working on internationalizing our product today. I have this list of files that used to only be in English that I need to make sure can be added in all of our translated languages. This issue is that I need to make sure that after I copy these sections for each languages, all of the files have unique names. Enters vi and regular expressions. With this simple regex

:1,$s/Id=".*" Name="\(.*\)" S/Id="En\1" Name="\1" S/

I turned
<File Id="file714" Name="ACC_NCDR.mod" Source="$(var.PCodePath)\Modules\ACC_NCDR.mod" />
into
<File Id="EnACC_NCDR.mod" Name="ACC_NCDR.mod" Source="$(var.PCodePath)\Modules\ACC_NCDR.mod" />

The interesting par is the \(.*\). That is remembered as the first expression and the matched value is then inserted when you use \1. In perl , they are called named expressions.