Technical Aspects in IT

Stand on the shoulders of giants – http://scholar.google.com

Google Wave

Posted by scmay on October 22, 2009

Add me.
scmay83@googlewave.com

Posted in Uncategorized | Tagged: | Leave a Comment »

Using .NET to export data to Excel

Posted by scmay on August 6, 2009

Asked to transfer data from database in .NET VS2005 to Ms Excel (2007)

Tons of links/codes out there, but with many errors too.

Links that helped me:
How to Export Data to Excel from an ASP.NET Application + Avoid the File Format Differ Prompt – this summarizes a lot of the questions about exporting to Excel

Working with MS Excel(xls / xlsx) Using MDAC and Oledb – have not had a chance to look at this but it looks promising (VS2008)

Solutions that I came up with (with some improvisation)
Solution 1
This works, but always prompt with the error The file you are trying to open, ‘name.ext’, is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?
Solution to that issue is given in the link.

Solution 2 which uses OLEDB, improvised from the original code here. This looks good, but I haven’t done enough testing yet what happens when its opened in Excel 03 and client environment…will update this in due time.

* Tried pastebin, looks good. Lets hope my code remains permanent, and doesn’t disappear after a while.

Posted in .net, C#, excel | Tagged: | Leave a Comment »

Errors upgrading SQL Server 2005 to SQL Server 2008

Posted by scmay on June 26, 2009

I have an existing SQL Server 2005 database which I would like to use in SQL Server 2008 database.

Everyone knows there are 2 ways to do this. Attach a database ( you need mdf and ldf file ) or Restore from a backup file (thus you need .bak file)

As much as I tried attaching the database, I could not update my login ID in the database (using the conventional sp_change_users_login ‘Auto_Fix’, ‘MyLoginName’)

So, I tried restoring the database. Steps followed are from here

I hit an error at –Restore Database step

Msg 3154, Level 16, State 4, Line 1
The backup set holds a backup of a database other than the existing ‘MyDatabaseName’ database.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

Which brings me to this link

So the fix for me is

USE master
ALTER DATABASE MyDatabaseName SET SINGLE_USER WITH ROLLBACK IMMEDIATE
RESTORE DATABASE MyDatabaseName
FROM DISK = ‘C:\MyDatabaseName.bak’
WITH MOVE ‘YourMDFLogicalName’ TO ‘D:\DataYourMDFFile.mdf’,
REPLACE

Posted in sql server | Tagged: , | Leave a Comment »

If it doesn’t break, don’t change it

Posted by scmay on June 9, 2009

I noticed something wasn’t quite right in one of the database settings. Sure, it won’t be obvious and it will never get spotted on the surface if everything is entered via the system, but if you were to manually enter via database, sooner or later some error is going to happen. I was thinking of fixing it, but then I remembered a colleague once said, “If it doesn’t break, don’t change it” (it might become worse after changing it)

Which was what happened to my VS2005, which was running pretty slow and I decided to ‘clean’ the registry manager, till I realised that ‘cleaning’ meant removing most of the keys (which meant that the program was really stupid to identify which keys should be removed and which shouldn’t). Sad to say, Resharper could not work on my VS2005 and also made my VS weird. (Eg I cannot add a new file in a project)

VS2003 went through the whole clean-up-and-reinstall process, but since I was mainly working on VS2005 and the reinstall usually takes up a lot of time I had to do without Resharper for sometime. Strangely, I managed to install Resharper again the other day after months without it (It did not work previously, clean-and-install, contacting Helpdesk and etc)

Posted in Uncategorized | Leave a Comment »

Drive detected in Device Manager but not shown in My Computer

Posted by scmay on June 2, 2009

My pendrive does not get automatically displayed in my work PC (XP) but it is displayed in the device manager.

Easy way out

Click Start. Right click My Computer > Manage. Select Disk Management. You should see your drive there. Right click and Change Drive Letter and Paths.

Posted in Uncategorized | Leave a Comment »

Agile Business Analysis

Posted by scmay on March 24, 2009

I had the privilege yesterday to attend the Agile Business Analysis talk by Ellen Gottesdiener, the one hour session for those who were unable to attend the ongoing Software Development Conference.

It was interesting being amongst the Business Analysts, learning what they did, how Agile fits into the business perspective and something that I took away with me that day, how one should test their system (verification & validation)

I look forward to attend more sessions such as these.

For those interested, please take a look at Australia IIBA they are certainly encouraging more BA’s to join them.

Posted in Uncategorized | Tagged: , , , | Leave a Comment »

Bushfire assistance – Technical Assistance needed

Posted by scmay on February 12, 2009

 As you know, many families have been severely impacted by the recent bushfires in Victoria. A great deal of people have been left homeless and displaced, and as various aid agencies’ efforts to provide immediate assistance and relief gain traction, thoughts are now turning to ‘what next’. One simple tool that can assist families to start picking up the pieces of their lives is access to the internet, along with various other tools such as printers, scanners copiers and fax machines. To meet this need, Melbourne organisation Infoxchange aims to establish Technology Resource Hubs in locations affected by the fires, and are also working to connect people in affected areas who have a technology need with people who are able to help out. In order to successfully scale their activities, Infoxchange are seeking of donations of both equipment and time. Which is where you come in :) If you have technology skills, and can volunteer some time to go out onsite to assist with installing machines and configuring networking and internet connections, it’d be great if you could please register at the link below. If you can’t physically help, but have serviceable PCs or laptops laying around that could be pressed into service as internet browsing systems, or if you have any networking gear that’s surplus to requirements, then please also contact Infoxchange via the link below – they’d be pleased to accept your donations.

http://www.bushfirerelief.infoxchange.net.au/

Posted in Uncategorized | Leave a Comment »

Visual Studio 2005 Keyboard Environment, missing Step Into F11

Posted by scmay on January 29, 2009

I’m not sure if I’m the only one, I recently used another user profile on VS2005, needless to say all the environment settings were reset and I realized that my favourite Step Into button no longer exists, and the keyboard F11 no longer works. Only using Step Over F10 isn’t very favourable. 

http://msdn.microsoft.com/en-us/library/bb245788(VS.80).aspx

 

Anyway, this is what I did.

Tools > Import and Export Settings

Import selected environment settings

Yes, save my current settings

Default Settings > General Development Settings

(Description: Configures the environment to closely match VS .NET 2003 to provide an experience that is already familiar to you. Select this collection of settings if you develop in more than one programming language)

 

Someone else has blogged about the menu settings different for C# and VB, so he adds/changes the C# environment into the menu to get the Step Into button

http://blogs.vertigo.com/personal/keithc/Blog/archive/2007/07/20/missing-menu-options-in-visual-studio-2005.aspx

Posted in Uncategorized | Tagged: , , , , , , | Leave a Comment »

Drop a default constraint without knowing the name

Posted by scmay on January 6, 2009

This is a very nice script written by Rob Farley

http://msmvps.com/blogs/robfarley/archive/2007/11/26/two-ways-to-find-drop-a-default-constraint-without-knowing-its-name.aspx

declare @table_name nvarchar(256)
declare @col_name nvarchar(256)
set @table_name = N’Department’
set @col_name = N’ModifiedDate’

select t.name, c.name, d.name, d.definition
from sys.tables t
    join
    sys.default_constraints d
        on d.parent_object_id = t.object_id
    join
    sys.columns c
        on c.object_id = t.object_id
        and c.column_id = d.parent_column_id
where t.name = @table_name
and c.name = @col_name

Posted in Uncategorized | Tagged: | 1 Comment »

Twitter subscriptions in WordPress

Posted by scmay on November 18, 2008

I was trying to figure how to use my (dead)  Twitter account. Figured it would be rather useful if I had some RSS subscriptions published. As you probably know by now, Twitter is not a click-and-drag widget yet (as of now) on the WordPress Design.

Found this, looks like it worked.

http://en.forums.wordpress.com/topic/twitter-updates-not-displaying?replies=29

Posted in Uncategorized | Tagged: , , | Leave a Comment »