70-542… Pass?


I just checked on my MCP portal and found I passed my beta exam for “70-542 TS: Microsoft Office SharePoint Server 2007 - Application Development”. Suprise for me!

I took 2 beta exams early January. I only able to pass one of it and failed on “70-541 TS: Microsoft Windows SharePoint Services 3.0 - Application Development”.  Don’t ask me why and how. Just try my best to shoot all the correct answers! :P
P/s: I guess if you dig around on MOSS for few months, you could pass it easily too!

Adding item to sharepoint 2003 SPList Programmatically


I come accross some problems when adding new item to a SPList. The error i got is “Value does not fall within the expected range. ” This would only happen if you target list is empty. After do some googling, this seems is MS known bugs. Luckly there is workarround to solve this issue. Simple rules is

1. Add a new item, assign “Title” item and save it

2. Get the newly created item and update it with remaining items.

Here are the codes:

SPListItem newListItem = spList.Items.Add();

newListItem["Title"] = “The title”;

newListItem.Update();

SPListItem existingListItem = spList.GetItemByID(newListItem.ID);

existingListItem[2] = “Category 1″;

existingListItem.Update();

P/s: You only need to add new item as in this way for the empty SPList. Once u have at least one item.. the error will gone.

Please visit the original article: http://blog.buro9.com/2007/02/26/sharepoint-splistitem-quirks for more information…

MS SQL xp_cmdshell permission error


Do you ever get Access denied error when using MS SQL xp_cmdshell command?

E.g.  I have an special AD account access to \\server2\backups folder.  In my Store Procedure, I have to copy db.bak from local folder to share folder.

EXEC xp_cmdshell ‘copy c:\SQLbcks\db.bak \\server2\backups\db.bak, NO_OUTPUT’;

I get access denied error because xp_cmdshell use permission associate with SQL server service account (local system account). I have to change the SQL service account to use the AD account in order xp_cmdshell able to use the correct permission.  This seems a bit weired.  Do we have other solutions?

Setting audience user group in MOSS 2007


I spent some time to find out why my AD groups do not appear while add a user rule in my new audience. Finally i found that we have to start a full import user profile to solve this problem. After import profile done, wait for few seconds….Why? You cannot get the group immediately. I guess MOSS  may take some time to process and propagate to shared services… So just wait a moment and you will get it right away… =)

Automated link exchange system - AutoLinkManager


Do you ever feel tired for searching link partners and publishing web pages every time a link exchange request takes place?

Link exchange process is time consuming and tedious. You require finding potential link partners, sending and replying emails, publishing others’ website by modifying your HTML pages, and check whether your link partners are still linking to your site periodically, etc. Soon, you will find that you spend too much time in your reciprocal link exchange campaign instead of doing business tasks.

 

AutoLinkManager simplifies the entire link exchange process, making your life a lot easier. We offer online link exchange system that allows you to exchange links with any member in our directory, manage incoming link exchange requests, build a categorized directory and publish your link pages to your web hosting. We keep your link exchange requests organized!

 

 

alm2.jpg

Read the rest of this entry »

How to import multiple CSV files using MS SQL store procedure?


I had come across this task few days ago. Hence, put it here for future reference. The requirement is simple. System need to scan a specific folder and import all files into database. Ideally, these are the steps how I do it:

  1. Create a import format file using BCP for BULK INSERT usage
  2. Use master..xp_cmdshell to get all the file names in to table variable
  3. Loop through the table and import data one by one using OPENROWSET and BULK

Create Sample Payment Table

Run Create_Payment_Table.sql to create a “Payment” Table. The columns must match with columns in CSV file.

Creating an XML Format file

Run

EXEC master..xp_cmdshell ‘bcp yourdbname.dbo.Payment format nul -T -t, -c -x -f C:\Payment.xml’

to create an XML format file for BULK INSERT usage.

Alter Sample Payment Table to add more columns

Run Alter_Payment_Table.sql to add extra columns ID, Filename, BatchID, DateCreated, DateModified for tracking purpose.

How to scan all CSV files in a specific folder?

Let say we expect all CSV files will be drop in c:\inbox folder. So, we will use master..xp_cmdshell with DIR dos command to get all the file names.

Store Proc “usp_import”

Loop through inbox folder and call “usp_import_common” to start import.

First declare a @Files table variable and insert result into @Files

Declare @Files Table ([File] varchar(250) null)

Insert all files’ name to @Files

INSERT @Files ([File])
EXEC master..xp_cmdshell ‘DIR C:\inbox\*.csv /b’

Open cursor to import CSV files one by one via store proc “usp_import_common”.

DECLARE @FILENAME VARCHAR(250)
DECLARE file_cursor CURSOR FOR
SELECT [File] FROM @Files
WHERE
[File] NOT IN (‘NULL’,‘File Not Found’)

OPEN file_cursor

FETCH NEXT FROM file_cursor
INTO @FILENAME

WHILE @@FETCH_STATUS = 0
BEGIN
SELECT @FullFileName = @FilePath + @FILENAME
–Start Import
EXEC usp_import_common @FullFileName
FETCH NEXT FROM file_cursor
INTO @FILENAME
END
CLOSE file_cursor
DEALLOCATE file_cursor

Store Proc “usp_import_common”

Import data using BULK command with “Payment.xml” as format file

– Set Payment’s table XML format file
SET @FormatFile =‘C:\Payment.xml’

– Get data from file
SET @SQL1 = +
‘INSERT Payment’ +
‘(’ +
[FileName],’ +
[InvoiceNo],’ +
[Date],’ +
[Status],’ +
[CheckNumber],’ +
[VoucherNo],’ +
[PaymentAmount],’ +
[BatchID]‘ +
‘) ‘
SET @SQL2 = +
‘SELECT’ +
”’ + @SourceFile + ”’,’ +
TMP.[InvoiceNo],’ +
TMP.[Date],’ +
TMP.[Status], ‘ +
TMP.[CheckNumber],’ +
TMP.[VoucherNo],’ +
TMP.[PaymentAmount],’ +
”’ + CAST (@BatchID AS VARCHAR(50)) + ”’ ‘ +
‘FROM OPENROWSET(’ +
BULK ”’ + @SourceFile + ”’, ‘ +
FORMATFILE = ”’ + @FormatFile + ”’, ‘ +
FIRSTROW = 2 ) TMP’
EXEC (@SQL1 + @SQL2)

After import, we will delete the CSV:

DECLARE @DirCMD VARCHAR(1000)
SELECT @DirCMD = ‘DEL “‘ + @SourceFile +
‘” /F’
EXEC master..xp_cmdshell @DirCMD

Finally copy testdata.csv file in to c:\inbox and run EXEC usp_import. Then, you are able to import data successfully.

You may download all the sql, xml and csv file here.

Is search engine optimization strategies (SEOS) important to a web site?


Search Engine
Yes! Definitely. Search engine optimization strategies play an important role in website development. Search engines are the starting point for most people when they’re looking for something on the Internet. This is why the most popular websites are search engines and web portals with search functions. Imagine that you are selling T-shirt online. When an Internet user key in “T-shirt” in google search engine. You website appear as top ranking in the search result. This will generate a huge traffic to your web site and off course may generate huge revenue to your company.

There are many statistics that illustrate the importance of search engines as a method of attracting traffic on the Internet:

• 24 percent of marketers said that over three-quarters of their traffic came from search engine referrals. [CyberAtlas Research - Aug 21, 2001]
• Nearly 60 percent of students reported using a search engine when picking an online retailer. [NACS - Mar 7, 2001]
• Study found that 55 percent of online purchases were made on sites found through search listings. [NPD Group -Feb 14, 2001]
• Search engines were used by 86 percent of users in Switzerland. [Wemf AG Research - Ag 31, 2000]
• Over 80 percent of Internet users reach sites through search engines. [Forrester Research - Jul 5, 2000]
• Nearly 48 percent of websites depend on search engine listings for the majority of their traffic and over 70 percent of all websites generate at least 20 percent of their traffic from search engine listings. [NetGambit - July 14, 1997]

Read the rest of this entry »

How is website design marketplace in Malaysia?


banner.jpg

Internet revolution has been started since early 90’s. Nowadays, I believe even a 15 years old school boy may able to build their own website using HTML language. We can always see some advertisement showing “Web design package – RM 300 for unlimited pages!” in Malaysia. I am a bit curious, how can people build a website with unlimited pages and only cost you RM300? Yes, I know HTML language is easy. However, will there really able to deliver a professional web design look? Is the website search engine friendly? Will they put a great deal of effort into the design? Do they have sufficient skills and experience to deliver what you want? Personally, I don’t think that they can deliver a good looking, professional website with only RM 300. If you know somewhere can get this kind of web design package please do let me know.

I had experience in web development for more than 4 years in Malaysia. I can tell you that the website design marketplace in Malaysia is very bad nowadays. A lot of companies do not want to spend more then RM 1000 for their website. We often heard from our clients that “XXX offer RM 300 for unlimited web pages. Why your packages so expensive?” At the end, we need to give more discounts in order to get the sales. This is the fact for all web design companies in Malaysia. However, I think everybody should know that there is no free lunch in this world. A good quality and successful web site be sure will cost you more compare to a budget website. In return, you will get better image for your company, generate more traffic to your website and increase your revenues. Besides, it can be an extremely effective method of communicating between you and your customer. If you planning go for budget web design package (RM 300), I will suggest you better do not waste this kind of money. Spend it for your staff lunch and hope your staff will work harder and get more sales for you rather than create a lousy, low quality and useless website.

Here are some of my previous projects done when I was a freelancer 2 years ago. http://www.quantum-profile.com. I am no longer work as freelancer now. As you can see, the “RM 300 for unlimited web pages”! It is hard to survive in this marketplace. I am currently working in an MNC software house in KLCC. However, sometime I still helping some friends or relative when they need me in website development…

My Techie Life


Welcome! Finally I decided put start up a blog about my techie life. This because i do get a lot of issue in my working life which make me crazy to solve it. So, I will try to post the usefull tips and anything which is interesting. For my own records and may be will help someone out there too….