Rob Kraft's Software Development Blog

Software Development Insights

How to activate Windows Server 2008

Posted by robkraft on February 7, 2010

I spent several hours a few weeks ago simply attempting to activate my copy of Windows Server 2008 (64bit) on a new computer. The problem I experienced is that I was not prompted to activate it at any time during the install or during the configuration and subsequent reboots over the following few days. In the past, didn’t the operating systems nag us early and often to be activated?
I thought that maybe Windows had already activated itself somehow based on the way I had acquired the DVD. I was not sure what was going on or how to figure out if it had been activated. Eventually I called a Microsoft rep but I had a very difficult time explaining to him that I did not have an immediate problem; rather that I just wanted to know why I was not prompted to activate Windows. The lack of activation concerned me because I was going to deliver this server to a remote site then occasionally manage it via RDP. I did not want to discover one month later that the operating system locked up because it was not activated and that it required me to be there in person to unlock it.
I finally found the place to activate Windows Server 2008 in Control Panel, System. There, I was able to enter the Product Key and complete the activation. I wish that Microsoft would have made this easier to find, or included in their help documentation an entry about it.

Posted in I.T. | Leave a Comment »

You may not need to upgrade Quickbooks just to run on Windows 7

Posted by robkraft on November 11, 2009

If you have problems with specific features of Quickbooks after upgrading to Windows 7, first try running Quickbooks in Windows XP Compatibility mode. You can set the compatibility mode by right-clicking your Quickbooks icon, selecting properties, then the Compatibility tab. Then click the “Run the program in compatibility mode for” checkbox and choose Windows XP (Service Pack 3) from the dropdown.
I did this and it solve the problem I had trying to send an invoice where I get error -20 from the Quickbooks PDF Converter in Quickbooks Pro 2007.

Posted in I.T. | Tagged: | Leave a Comment »

Great free tool: CodeRushExpress

Posted by robkraft on September 9, 2009

CodeRush now provides a free version of their tool called CodeRush Express. You can download it from this URL:
http://www.devexpress.com/Products/Visual_Studio_Add-in/CodeRushX

They also provide a nice list of features and short tutorials on each.

If you are not familiar with the features that CodeRush or ReSharper provide that can increase developer productivity in Visual Studio .Net, this is a great way to learn.

Posted in Code Design, Free tools, Visual Studio 2008 | 2 Comments »

Gold-plating the code

Posted by robkraft on September 7, 2009

Developer society has given the phrase “Gold-plating” a stigma similar to “socialized” in the political world.

Some things that appear to be gold plating may not really be gold plating. Recently, while developing a web site, we decided to incorporate support for WCAG even though it was not part of the requirements. That sure screams “Gold-plating”, doesn’t it. At first I thought so, but on second thought I realized that it does not. The only support we really added for WCAG was to use PNG images instead of JPG images. It didn’t really take us extra time to implement, other than the time taken to be aware of WCAG compliance.

Sometimes it is good to think about future possible requirements because they can alter a decision that you make today. Without considering future possible requirements, some decisions appear completely arbitrary, such as PNG or JPG, but when you consider likely future requirements, you see that one choice will work better than the other.

Posted in Code Design | 1 Comment »

Explaining “Refactoring” to non-programmers

Posted by robkraft on September 6, 2009

Many programmers use the word refactoring to describe the changes they make to existing code that doesn’t add any new features or fix any existing bugs. The obvious question that should arise is, “Then why are you doing anything to the code?” The answer is usually, “We need to re-write the code before we can add new features to it.”

Here is an example of a case where we needed to refactor some code:

In version 1.0 of our software, we stored metadata about all our objects (Customers, orders, etc.). For example, we stored that the FirstName or the customer object was a 50 byte string, and that the ID of the customer was an 8 byte integer). We used that metadata to dynamically build web forms with all the fields from each object.

In version 2.0 of our software, we used the same metadata to build a gridview of all objects (Customers, orders, etc.). We discovered that we wanted to allow some fields in the grid that we did not allow in the form, so we implemented a workaround to support this.

In version 3.0 of our software, we added support for a new type of field that linked to other objects, which required us to workaround the workaround we implemented of the second release.

Now, in version 4.0, we want to add more options to the grid that will require us to workaround the workaround of the workaround; OR, we can possibly refactor the software so that it does not have workarounds. This means we will change the design so that our code and database store more information to eliminate the workarounds. For example, instead of hardcoding workarounds such as, “If this is the customer object and it is the zip code field, …”, we add a flag in the database that we set to true for the customer object and the zip code field, and then our code can just check this flag and implement the desired behavior. This new code is easier to maintain and support and build upon.

This is a very simplistic example of refactoring, but hopefully it can provide some understanding to non-programmers of the importance and value of refactoring

Posted in Code Design | 1 Comment »

Staining the deck – Choosing the best approach in software

Posted by robkraft on August 28, 2009

I stained my deck recently. I stained it the hard way. I used a brush and it took nearly 40 hours. It was only after I was done and talking to a friend about it that I learned spraying would have been a better option. Sure, I would have spent 4 hours in preparation time to cover everything I did not want stained, but after that I probably could have completed the job in 6 to 8 additional hours. On top of that, the spray would have been more effective than the brush in between the boards, and it would have been easier to apply to the bottom of the deck.
What does this have to do with software? It is an analogy, of course. All developers know that we can write software that will do what the user wants, but what we don’t know (or at least I will admit that I don’t always know), is if the approach I am using is the best. Perhaps there is a way to get the job done more quickly and with better results, and the only thing that prevents me from using the better approach is my lack of awareness of it.
This is why software developers that want to label themselves as professionals need to continually learn new processes, patterns, best practices and tools appearing in the software world. We never know when one of them will be the best option for the next job.

Posted in Code Design | Leave a Comment »

Another virus bagged and tagged

Posted by robkraft on August 14, 2009

A friend sent me his computer recently so that I could remove a virus from it. The only problem he noticed was when doing google searches, if he clicked on a result it usually went to a different URL. I think the first time you went to a site it worked, but then subsequent searches would go to the wrong site. He was redirected to nasty sites; just incorrect sites; perhaps to get him to believe that those sites were responsible for the redirects and any retaliation he made would be against them.
I discovered other problems once I received his PC. I could not run regedit or regedt32. When I launched them from explorer, there would be a pause and then explorer itself would shut down and restart. So I downloaded another registry tool and used it to look in the registry but I found nothing suspicious. After some monitoring of processes, and using msconfig to boot into minimal windows and still experiencing the problem with regedit, I finally decided to disable all the browser add-ins to see if I could get google search to work. One of those add-ins was the problem, and I used a process of elimination to determine it was an addin called googletoolbar1.dll that was the lone file in a subfolder in c:\program files. Googletoolbar1.dll is usually a helpful tool, but this particular version of it was infected.
So I got the browser to work and I was beginning to suspect that the CA Security Center product installed on his PC was preventing me from running regedit. However there were two other problems I was experiencing. One, CA Security Center could not receive its updates (which is often the sign of a virus), and two, Adobe udpater was failing to update. Any product that cannot receive its updates may be experiencing said problem because the virus does not want the updates applied.
I just happened to notice a process appear briefly in task manager with a suspicious name. I caught that it ended with .qea and when I searched the hard drive I found jjbkqmy.qea in c:\windows. I googled and binged for that file name but found zero matches. This told me that it was a file with a randomly generated name and most certainly was a virus. I deleted it; but it came right back. I rebooted to windows minimum mode and deleted it, and it came right back.
I assumed that the file was getting copied from another area of the hard drive immediately after the delete, so I looked for a file of the same size elsewhere on the drive.
The file size was 19k and I found hundreds of other files that were also 19k. I also noticed that the creation date/time of the file seemed to have occurred during the install of the OS, or perhaps application of XP2 or some major upgrade that replaced almost all OS files.
To narrow my search, I searched at the dos prompt to find the exact bite size (18,944 I think). I then used a dos search to dump all files names and sizes to a text file. I then opened the text file with notepad and searched it for all files that had the exact size of 18,944. There were still quite a few; but most I found another copy of the exact file name in the Recycle bin. When I looked in the recycle bin through windows explorer, I could not see it even though windows explorer was “showing all files”; but at a dos prompt using show hidden option “/ah” I could see the file. There were 3 other suspicious files in the recycle bin, so I deleted all the .exe files in the recycle bin (and jjbkqmy.qea) using dos.
I then opened the jjbkqmy.qea file in c:\windows using notepad and cut out half of its contents then saved it. I rebooted windows.
The virus was gone (I guess it could not reload the damaged “c:\windows\jjbkqmy.qea” back into explorer). I was able to download updates to CA Security Center and adobe updates; and I could run regedit again. I ran CA Security Center and it found some viruses and trojans and quarantined them; but it did not mark the jjbkqmy.qea file I had determined was a virus. Note, before I modified the file using notepad I had made a backup of the file and put it in another folder. I specifically had CA Security Center scan that file but it did not identify it as containing a virus. I also had Spybot scan the file but Spybot found nothing to complain about.
The CA Security Center product contained a link to report potential viruses so I used that link to upload the jjbkqmy.qea backup file I had. Within 12 hours CA had sent me a reply:
“Analysis of your submission #1542929 has been completed”,
The Windows PE (I386,DLL) file “jjbkqmy.qea” has been determined to be
malicious.
 
Aliases reported by other AV products are listed here :
(Trojan-PSW.Win32.Kates.c) (Lando) (Infostealer.Daonol)

And an email a few hours later included:
With regards to the file “jjbkqmy.qea” submitted by you on 11 Aug
17:30:49 (Australian Eastern Standard Time), we have added detection for Win32/Daonol.K to the signature files.
 
The Windows PE (I386,DLL) file “jjbkqmy.qea” has been determined to be malicious. Our researchers have analyzed the file and confirmed the result. The file has been identified as Win32/Daonol.K trojan.
 
Aliases reported by other AV products are listed here :
(Trojan-PSW.Win32.Kates.c) (Lando) (Infostealer.Daonol)
 
Researcher comment:
Win32/Daonol Trojan Variant
 
CA products address this malware as follows:
——————————————–
CA Anti-Virus
Engine Update version Last Update
31.6.0 31.6.6675 13 Aug
Please check for the latest signature updates.

Posted in I.T. | 2 Comments »

How to close the IE 8 Developer Toolbar

Posted by robkraft on July 20, 2009

I spent about 30 minutes recently trying to prevent the Internet Explorer 8 Developer Toolbar from opening every time I opened my browser. I like the Developer Toolbar a lot, but I definitely don’t want it opening all the time. Finally I realized that you first have to dock it in an existing IE window, then close it within the IE window, then close IE. Before you do all of that, make sure you have all other instances of Internet Explorer closed.

Posted in Dev Environment, I.T. | Leave a Comment »

MethodsAndTools.com

Posted by robkraft on April 6, 2009

The website www.methodsandtools.com contains an archive of their magazines in PDF format. Each PDF contains many articles you may find useful in improving your skill in managing software development projects.

Posted in Magazine Online, Online Resources | Leave a Comment »

How to delete duplicate rows in SQL Server

Posted by robkraft on March 28, 2009

Developers new to SQL often expect that it should be easy to write a query to delete duplicate records, but that is not the case.  Here is a stored procedure you can use to delete duplicates.  There are two stored procedures here and you need both, both one just calls the other.  After compiling the stored procedures, you can use the following to delete all the duplicate records from a table:

SPINTERNAL_DELETEDUPLICATES ‘mytable’

CREATE PROCEDURE SPINTERNAL_LISTALLCOLUMNS
(
    @table_name VARCHAR(32),
    @Column_List VARCHAR(8000) OUT
)
AS
BEGIN
    DECLARE @Column_ID INT,
        @Column_Name VARCHAR(128)
    SELECT @COlumn_List =
    –partial query from http://vyaskn.tripod.com/code/generate_inserts.txt
    SELECT @Column_ID = MIN(ORDINAL_POSITION)
    FROM INFORMATION_SCHEMA.COLUMNS (NOLOCK)
    WHERE TABLE_NAME = @table_name
    –Loop through all the columns of the table, to get the column names and their data types
    WHILE @Column_ID IS NOT NULL
    BEGIN
        SELECT @Column_Name = QUOTENAME(COLUMN_NAME)
        FROM INFORMATION_SCHEMA.COLUMNS (NOLOCK)
        WHERE ORDINAL_POSITION = @Column_ID AND
        TABLE_NAME = @table_name
        SET @Column_List = @Column_List + @Column_Name + ‘,’
        SKIP_LOOP: –The label used in GOTO
        SELECT @Column_ID = MIN(ORDINAL_POSITION)
        FROM INFORMATION_SCHEMA.COLUMNS (NOLOCK)
        WHERE TABLE_NAME = @table_name AND
        ORDINAL_POSITION > @Column_ID
    END
    SET @Column_List = LEFT(@Column_List,LEN(@Column_List) 1)
END
 
CREATE PROCEDURE SPINTERNAL_DELETEDUPLICATES
(
    @table_name VARCHAR(32)
)
AS
BEGIN
    http://www.simple-talk.com/sql/t-sql-programming/removing-duplicates-from-a-table-in-sql-server/
    DECLARE @columns VARCHAR(8000)
    EXEC SPINTERNAL_LISTALLCOLUMNS @table_name, @columns OUT
    DECLARE @SQL VARCHAR(8000)
    SELECT @SQL = ‘with numbered as ( select ‘ + @columns + ‘, row_number() over
        (partition by ‘
+ @columns + ‘ order by ‘ + @columns + ‘) as nr
        from ‘
+ @table_name + ‘) DELETE FROM numbered where nr > 1’
    EXECUTE( @SQL)
END
 

Posted in Free tools, SQL Server | Leave a Comment »

 
Design a site like this with WordPress.com
Get started