Tuesday, July 17, 2012

Use Database Publishing Wizard tool in VS 2010

In Visual Studio 2010, "SQL Database Publishing Wizard" feature should be installed as one component named Microsoft SQL Publishing Wizard 1.4 during the installation.

It should be located at the path:  
C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Publishing\1.4\SqlPubWiz.exe

If not exist, you can extract the SQL Database Publishing Wizard tool in the WCU\SQLPub folder in the installation media and then try the installation of tool by clicking on the SqlPubWiz.msi file.

Friday, April 27, 2012

Fix 5 Common SEO problems using URLRewrite module and Web.config

There are an example code used to fix top 5 common problems for SEO, to get unique urls, improve ranking on Search Engine likes Google, Bing, Yaoo

This example is run on example.com

                    <!--Fix 5 Common SEO problems using URLRewrite module and Web.config-->
                    <rule name="No-slash to slash">
                        <match url="http://example.com"/>
                        <action type="Redirect" url="http://example.com/" redirectType="Permanent"/>
                    <rule name="www to non-www">
                        <match url="(.*)"/>
                            <add input="{HTTP_HOST}" pattern="^example\.com$" negate="true"/>
                        <action type="Redirect" url="http://example.com/{R:1}" redirectType="Permanent"/>
                    <rule name="No Default.aspx" stopProcessing="true">
                        <match url="(.*?)/?Default\.aspx$"/>
                        <action type="Redirect" url="{R:1}/" redirectType="Permanent"/>
                    <rule name="No .aspx" stopProcessing="true">
                        <match url="(.*?)\.aspx$"/>
                        <action type="Redirect" url="{R:1}.html" redirectType="Permanent"/>
                    <rule name="Lower Case URLs" stopProcessing="true">
                        <match url="[A-Z]" ignoreCase="false"/>
                        <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                            <add input="{URL}" pattern="WebResource.axd" negate="true"/>
                        <action type="Redirect" url="{ToLower:{URL}}" redirectType="Permanent"/>

                    <!--End Fix 5 Common SEO problems using URLRewrite module and Web.config-->

Place at between:


Tuesday, April 24, 2012

RESOLVED: The solutions for addition s1600 to image at Picasa

Recently, Picasa has changed their privacy and default size for images when you upload using API to be 512px. Mean of smaller than the original size of every images. Big problem, if your websites have embedded these images.

Picasa support give a solution like addition "s1600/Filename.jpg" instead of old name in every image urls. But I can't modify every post when my blog/websites have had more than hundreds or thousands post. Too much, to modify by hand :(

My solutions as the following hope to resolve this if you have same problems.

Solution 1: (update data in column containing image url by update query, tested for SQL Server)

update [e_Image] set
imageurl= replace(imageurl,reverse(left(reverse(imageurl), charindex('/', reverse(imageurl)) -1)),
's1600/'+ reverse(left(reverse(imageurl), charindex('/', reverse(imageurl)) -1))) 

Execute, and see the results.

Solution 2:  (use javascript to replace old file name with new name contain "s1600/" when page load)

This solution is coded  by youself. 


Query to get FileName from URL (in SQL Server)

There are queries to get the file name from a column named: 'ImageUrl' containing list of image Url.

SELECT imageurl
  ,reverse(left(reverse(imageurl), charindex('/', reverse(imageurl)) -1)) as 'File Name'
 from [e_Image]

And result as the following:

Monday, December 26, 2011

How to disable Autoconfiguration IPv4 Address

Sometime you setup windows server 2008 to vmware using LAN or wifi, you chose Bridge mode to share internet connections between host and virtual machine may be cause of issues with internet connection at virtual machine. They can not connect to the internet or appear a message likes "conflict IP address"

Enter: Run > cmd > ipconfig /all

You may see the following issues:


Ethernet adapter Local Area Connection:

Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Intel(R) 82567LM-3 Gigabit Network Connection
Physical Address. . . . . . . . . : 00-23-24-08-30-57
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::8508:6cb9:5112:f8c9 (Preferred)
Autoconfiguration IPv4 Address. . :
Subnet Mask . . . . . . . . . . . :

IPv4 Address. . . . . . . . . . . :
Subnet Mask . . . . . . . . . . . :
Default Gateway . . . . . . . . . :
DNS Servers . . . . . . . . . . . :
NetBIOS over Tcpip. . . . . . . . : Enabled

To fix it, enter these from Command Prompt:

C:\Users\lyngtinh> netsh interface ipv4 show inter

result as:

Idx Met MTU State Name
--- ---------- ---------- ------------ ---------------------------
1 50 4294967295 connected Loopback Pseudo-Interface 1
11 10 1500 connected Local Area Connection

11: <=Keep it in mind

Next run this command:

C:\Users\lyngtinh>netsh interface ipv4 set interface 11 dadtransmits=0 store=persistent

Next, enter
Run > services.msc > disable DHCP Client service

Final, restart your server.

Good luck!

Tuesday, July 26, 2011

Fix unicode characters error for PHP 5.3.6 using FastCgi on Windows Server 2003

I have ever seen an error, the websites on my windows server 2003 can not show the unicode characters as normal in my language when I update PHP engine using ISAPI module to FastCgi for performance.

It was a bad day, when my customers called to me to complain about this. Because they can not read their website content as everyday, the characters are really crazy.

Yes, cause of this problems because I updated to PHP using FastCgi protocol. This protocol has some changes for mysql library.

To fix it,
- Open : Path_to_mysql/my.ini
- Find: default-character-set=.... and edit to: default-character-set=latin1
- Find: character-set-server=.... and edit to: character-set-server=latin1
- Start menu => Run => enter: services.msc => Find mysql service and restart it.

Okey, my websites came back as normal, work fine for me.


Cannot start mysql service on windows server 2003

Once you removed and reinstall Mysql on windows server 2003, you may facing to an error likes: "Can not start services".

To fix it, you have to remove all of the relating to mysql data at:
C:\Documents and Settings\All Users\Application Data\MySQL
C:\Program Files\MySQL (path to mysql implementation, this is an example of mine)
Okey, next step you may reinstall and restart mysql service as normal, it works for me.