Sunday, May 22, 2011

Create Shortcut in C#

Last week I was working on a case to provide support for an application users. The application has two executables: one is app's main exe like app.exe and another one is for app's update like appUpdate.exe. For this update, we need to add a shortcut on clients machine desktop pointed to appUpdate.exe.

Like a typical shortcut, the one I need to put on client PCs has several settings: target, start in, run mode, icon and comments.



I tried to create a shortcut on my box first. Aftert that, I tried to copy this shortcut file (lnk) to a remote PC. It did not work. It seems that the lnk file some information are embedded in the file. When it is not in the machine where it was created. The machine name appears in the target.

I need a way to create a shortcut on fly. That's why I went to .net to create a simple console app do the job. This time SO helped me with an excellent open source library from a QA: ShellLink.cs. Within the source codes, there are actually two files I need: ShellLink.cs and FileIcon.cs. The library contains a wrapper class for Windows APIs. It is very straight forward.

The only change I made is to add a class level flag for any changes in shortcut properties. If any setter changes a value, this flag is true. Then I'll only save chances for the shortcut if any of properties are changed.

public class ShellLink : IDisposable {
private bool mChanged = false;
....
public string Target {
get { .... }
set { if (!value.Equals(Target)) {
mChanged = true;
....
}
....
}

Read More...

Sunday, May 15, 2011

Evernote Shared Link

Evernote is one of my favourite web services. I have taken a lots of notes about my programming experience and snip of codes. Recently Evernote announced that it adds public link to any private notes, as well as public ones. That's nice feature.

Here is one note I made last week about my experience to use console command to make to a network shared folder. With this tip, I can control the accessibility of sub folders. This node is from my public notebook: .Net

To test sharing of private note, here is my private note about Mac OS tip: Fix Failed Install.

Read More...

Sunday, May 08, 2011

Sina Blog

Let me continue to explain the Chinese web services. Today it is about blog. Sina provides a wide range web services. Sina blog is one of the most popular blog services in China. From its blog main page, you will see rich contents. The most interest area in the main page is the rank of bloggers.

For example, the number 1 for the current time is Xu Xiao Ming. He is so hot that his visits and followers will blow you away comparing to most western bloggers:



and Hanhan was the number one for many years. He is the most controversial person in China. He is so popular is mainly for this critics and sharp thoughts about government and current issues. He is still 8th in the rank.

Those top ones have most influence in Chinese, especially in young people. In Chinese followers or fans are called as fensi, which is a new word based on phonetic. It is interesting to see so many new words coming out almost every day. For Chinese absence just one year, they will don't know many new words when they come back. Chinese fensi love to read their their favourite blogs. It is interesting to read a long list of comments. As well, Sina provides a list of statistics about each blog, such reads, comments, forwards (copy to bloggers' blog) and favourites.



Most people just jump to their accounts to write or view blogs. On the top of Sina blog, there are some convenient links or menu items for accessing other sina services, as well as blog settings:



There is a list of menu items for personal information:



Writing blog is also very convenient. The on-line blog has a rich list of formats, photos, and videos, as well other options:





For uploading photos, you can only upload up to 20 photos per blog. Photo and video insert tool icons have other options such as reuse previous ones and web links.

Read More...

Sunday, May 01, 2011

Web Services for Chinese Blog and Twitter

In the past couple months I have spent many hours and effort to write Chinese blogs and twitters. Chinese is my mother language so it is natural for me to write. I know there are many web services to provide features and services specially for Chinese years ago. I even registered my account in two most popular ones, creaders.net and sina.com. However, I have spent rarely much time there. The main reason to switch my attention to those Chinese web sites was the time I went back to China last Christmas time vacation.

One thing got my attention is that almost every one in China with mobile phones have QQ. QQ becomes an alternative way to communicate. QQ's provider is a company called Tencent. Like Google and Twitter, QQ was started as a hobby app for people to communicate based on MSN text message. Soon it got Chinese people attention, and it spread out allover China. With so much people on QQ everyday, now Tencent have already attract many investors and it has been doing very well financially as well.

When I was surprised by Tencent success, I was told that Tencent was actually losing market in the blogger and twitter services in Chinese. Sina was and now is the biggest blog and twitter, or weibo in Chinese, in China. Since I already had account at Sina, I gave it a try when I was in China. I have continued my blog and weibo since then. The market is so hot there. I see that many famous people like celebrities, politicians, economic scholars, popular public speakers, naming just a few of types of people, have millions followers. Each time when they post any blog, news or a phrase, they reach to people instantly. Several times of comments, forwards, and favourites happen afterwards. I was joke to one CNet tech person, who is very active in new tech review and podcasts. I told her that if she was in weibo, she would have 100 times of followers. Unfortunately, none of western hot-people know Chinese.

Anyway, the reason I write my Chinese blogs and weibos are my exploration of web in this global environment. Now the English is not dominate language on the web. Actually, if you know another or more languages, you have great advantages over other people. For example, my weibo followers are about 55, while my twitter (@chudq) has only 18. The visits to my sina blog up to today are 2494, creaders blog are 8174. I have my principle to join those services, not just to attract people or pursue number of followers. I want to write my own idea, experience and tips, in one word: sharing. The followers are actually the people have the similar interest.

In terms of features, all Chinese web services are pretty good. For example, all Chinese blog web providers have nice editors with tones of tools for layout format. One most nice feature is HTML source code editing. I can almost write any HTML codes in my blog. This makes my control much easier. Weibo is similar as twitter. You can forward tweet, comment tweet, and group your followers. You can write private messages. The most popular feature is to add pictures and videos with tweet.



As you can see, pictures worth thousand words. With this feature, you can do your message more effectively. There are so much there. Most westerns don't know what is happening in Chinese Web services. Many webs are blocked and that's reality. However, in terms of freedom and dynamics, people are more active and I can see that Chinese people are very happy with what they have now. The media is not the correct picture. Personally speaking, I think western media give westerns wrong picture about China.

Read More...