Showing posts with label IT 流. Show all posts
Showing posts with label IT 流. Show all posts

Tango



Tango,是在令人眼花缭乱的众多apps中,还挺受萧遥喜爱的,尤其是在海洋与萧遥相隔万里时。要是没有它,萧遥还真不知道有什么其他方法,可以让萧遥在无需额外付费的情况下,就可以听见海洋的声音,甚至是看见海洋远在异国的身影。

只要你的智能手机能够无线上网,或者签购了任何电讯公司的宽频配套,就能立即下载Tango,随时与自己喜欢的对象,进行声音或者影像对话。不过,双方都需要拥有tango户口,并且同时上网才能进行对话。

不过当海洋回国后,Tango就被萧遥晾在一旁,直到今天upgrade了tango,才发现Tango也添加了文字讯息服务。早知道这样,我就不需要安装whatsapp了。

不过在upgrade了Tango以后,却在开启程序时出现了"Application is not installed on your phone"这样的问题。萧遥需要到Settings -->  Manage Applications 将Tango的安装位置从SD card 移至手机才将问题给解决。

如果你正在寻找类似的通讯软件,不妨试试橘色Tango。

Hello Android 学习记录簿



为了预防脑袋生锈,决定利用休业的这段日子学习android。查阅了一下市场上的相关书籍,觉得由Pragmatic出版的<>,无论是排版或者内容,都非常适合我这种android新手。

而在学习的过程中,也因为自己的疏忽,导致一些问题的出现。在此,就列出部分的问题,作为自己日后的参考用途:
1)Chapter 6: Storing local data
Problem: About game activity will be invoked when continue button is clicked.
Solution:


2) Chapter 7.2: Web with a View
Problem: Unknown chromium error: -400 in LogCat. (Webpage not available on screen)
Solution: Add permission android:name="android.permission.INTERNET" into AndroidManifest.xml

原来Chrome也能下载youtube影片

还没换去chrome前,火狐一直是我最喜欢用的浏览器,但google chrome的出现,却让我对火狐的忠诚度有了改变。Format了电脑以后,我就没再安装火狐了,可是却一直对火狐能下载youtube video的这个附加功能念念不忘。今天,我发现到原来chrome也有这项功能,这下我可以专心一意地对着chrome,正式跟火狐say拜拜了。

方法非常简单,只要到这个网站安装Youtube Downloader Version 2.0,然后再跟着下面这个video,按几下按钮,就可以轻轻松松地将youtube上面的任何影音给下载下来。

Different ways how to escape an XML string in C#

Encountered XML parsing error problem while coding yesterday. After looking for solution through internet, found out that there are some special characters need to be escaped in order for xml parsing to work correctly.

These special characters and their replacement values are:

< -> &lt;
> -> &gt;
" -> &quot;
' -> &apos;
& -> &amp;

Here are 4 ways you can encode XML in C#:

1. string.Replace() 5 times

This is ugly but it works. Note that Replace("&", "&amp;") has to be the first replace so we don't replace other already escaped &.


string xml = "<node>it's my \"node\" & i like it<node>";
encodedXml
= xml.Replace("&", "&amp;").Replace("<", "&lt;").Replace(">", "&gt;").Replace("\"", "&quot;").Replace("'", "&apos;");
// RESULT: &lt;node&gt;it&apos;s my &quot;node&quot; &amp; i like it&lt;node&gt;
2. System.Web.HttpUtility.HtmlEncode()

Used for encoding HTML, but HTML is a form of XML so we can use that too. Mostly used in ASP.NET apps. Note that HtmlEncode does NOT encode apostrophes ( ' ).


string xml = "<node>it's my \"node\" & i like it<node>";
string encodedXml = HttpUtility.HtmlEncode(xml);


// RESULT: &lt;node&gt;it's my &quot;node&quot; &amp; i like it&lt;node&gt;
3. System.Security.SecurityElement.Escape()

In Windows Forms or Console apps I use this method. If nothing else it saves me including the System.Web reference in my projects and it encodes all 5 chars.


string xml = "<node>it's my \"node\" & i like it<node>";
string encodedXml = System.Security.SecurityElement.Escape(xml);


// RESULT: &lt;node&gt;it&apos;s my &quot;node&quot; &amp; i like it&lt;node&gt;
4. System.Xml.XmlTextWriter

Using XmlTextWriter you don't have to worry about escaping anything since it escapes the chars where needed. For example in the attributes it doesn't escape apostrophes, while in node values it doesn't escape apostrophes and qoutes.


string xml = "<node>it's my \"node\" & i like it<node>";
using (XmlTextWriter xtw = new XmlTextWriter(@"c:\xmlTest.xml", Encoding.Unicode))
{
xtw.WriteStartElement(
"xmlEncodeTest");
xtw.WriteAttributeString(
"testAttribute", xml);
xtw.WriteString(xml);
xtw.WriteEndElement();
}


// RESULT:
/*

<xmlEncodeTest testAttribute="&lt;node&gt;it's my &quot;node&quot; &amp; i like it&lt;node&gt;">
&lt;node&gt;it's my "node" &amp; i like it&lt;node&gt;

</xmlEncodeTest>
*/


Reference: http://weblogs.sqlteam.com/mladenp/archive/2008/10/21/Different-ways-how-to-escape-an-XML-string-in-C.aspx

GetDate and GetUTCDate

今天才发现原来sql server有两种获取当下时间的方法:

a) GETDATE() : Returns local regional time of your SQL SERVER machine (if you are connected to the server remotely)

b) GETUTCDATE(): Returns date and UTC times

Coordinated Universal Time (UTC) is a time standard based on international atomic time with leap seconds added at irregular intervals to compensate for the Earth's slowing rotation.


ASP Script Error

花了两天的时间debug code,觉得其中最难搞的就是这个error。
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement

后来才知道原来在 ASP Script 里如果<% IF....THEN....ELSE IF....THEN....END IF%>在<% FOR....NEXT%> block里头的话,ELSE IF不能有space。一定要是 ELSEIF。不然以上的error就会跑出来,令人抓狂.....

安装Sql Server 2005的问题(三)

解决了安装service pack1时会跳出来的信息,终于可以顺利安装了。但是,除了Sql Client Native能够成功安装外,其余的service都是warning。后来实在没办法,只好移除所有Sql Server 2005的相关软件,包括Sql Server 2005 Express以及刚刚安装的Sql Server 2005 Developer,然后再重新安装Developer Edition和Service Pack1。这一次终于成功了。所有要安装的service,都显示成功!!

可是,问题又来了,怎么我就是找不到Business Intelligence Management Studio啊?上网查一查,试着到SQL 2005\SQL Server x86\Tools\Setup按vs_setup.msi安装visual studio2005,然后到Tools directory那里打 command start /wait setup.exe /qb REINSTALL=SQL_WarehouseDevWorkbench REINSTALLMODE=OMUS.
还是不行!!快要被气疯了!!接着再仔细阅读些资料,才发现原来自己没有安装这个client component。呵呵....重新再安装一次,终于,看见Business Intelligence Management Studio了。我也能开始学习integration service了。 ^ ^

安装SQL Server 2005的问题(二)

不知道为什么,总是无法顺利安装Service Pack1。

问题:

—————————
Pending Reboot Files Found
—————————
A previous program installation caused unrelated pending file operations. The patch installation will succeed even if your computer is not rebooted.

Do you want to proceed?
—————————
Yes No
—————————

我选择 Yes.

—————————
Locked Files Found
—————————
The following files are currently locked.

In order to prevent a necessary reboot at the end of the patch install process, close down all other applications before proceeding.

Write locked file: C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\msftesql.exe (msftesql.exe)
Write locked file: C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\msftepxy.dll (msftesql.exe)
Write locked file: C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn\msfte.dll (msftesql.exe)

—————————
Cancel Try Again Continue
—————————

到了这里,首先要到Services那里停止所有Sql Server的service。
接下来,一定要确定"Windows Management Instrumentation"这个service被终止。
接着按Try Again,就可以继续安装 service pack 1 了。

安装Sql Server 2005的问题

我的电脑原本就有Sql Server 2005 Express Edition。由于最近需要用到express edition所没有的integration service,所以需要另外安装Sql Server 2005 Developer Edition。就在安装以后遇见了不少问题,今天就先来分享其中一个。待我完全解决之后再来做个整理。

问题:安装 Sql Server 2005 Service Pack 1 时有 Unable to install Windows Installer MSP file的讯息。

解决:
1. Export the MSIRefCount\Uninstall registry entry. To do this, follow these steps:
a. Click Start, click Run, type Regedit, and then click OK to open Registry Editor.
b. In Registry Editor, locate the following registry subkey:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\90\Bootstrap\MSIRefCount
c. In the right panel, click the Uninstall registry entry.
d. On the File menu, click Export.
e. Specify a location and a file name, and then click Save.
Notice that the value of the MSIRefCount\Uninstall registry entry contains references to all the components that are dependant on the SQL Server Setup Support files.

2. Uninstall the existing SQL Server Setup Support files by using Add or Remove Programs in Control Panel.

Note When you try to uninstall the SQL Server Setup Support files, you receive a warning message that resembles the following:

Warning 26002. The following products(s) is dependent on Microsoft SQL Server Setup Support Files (English). If you uninstall Microsoft SQL Server Setup Support Files (English), they will be broken. Please uninstall those product(s) first. Do you want to go ahead to uninstall Microsoft SQL Server Setup Support Files (English) anyway?

When you receive this warning message, click Yes.

3. Reinstall the 9.00.1399.06 version of the SQL Server Setup Support files. To do this, follow these steps:
a. Open the Servers\Setup folder from the SQL Server 2005 installation media.

Note If you use the SQL Server 2005 installation CDs, not the DVD, to install SQL Server 2005, the Setup folder that you must access is on the Servers CD.
b. Double-click the SqlSupport.msi file to install the 9.00.1399.06 version of the SQL Server Setup Support files.
c. Follow the installation wizard through the rest of the installation processes.

4. Import the registry setting through the registry file that you saved in step 1.

5. Reinstall SQL Server 2005 SP1.

Reference: http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B918357

解毒之晨

前天早上又因为把file copy进同事的电脑而中毒。我实在无法容忍自己的电脑有病毒的存在。于是便花了近一个早上的时间来替电脑解毒。为了不浪费一个早上的心血,在这里便把解毒的方法贴出来和大家一同分享。

要解除len.js的方法如下:

1. Press Ctrl+Alt+Del to end process wscript.exe
2. Go to folder option, click show hidden files and uncheck hide protected OS files
3. Go to all of your local drives, delete len.js and autorun.INF
4. Type regedit in RUN. Go to HKEY_CURRENT_USER --> Software --> Microsoft --> Internet Explorer --> Main and delete registry with name Window_Title

当len.js被清除以后,你就能重新double-click进入自己的local drive了。

ASP.NET AJAX Shorthand Syntax

$get('YourControlName')
Shortcut to Sys.UI.DomElement.getElementById - gets a reference to the DOM element, same as document.getElementById

$find()
Shortcut to Sys.Application.findComponent

$create()
Shortcut to Sys.Application.Component.create

$addHandler(FormElement, EventName, HandlerMethod)
Shortcut to Sys.UI.DomEvent.addHandler

$clearHandlers(FormElement)
Shortcut to Sys.UI.DomEvent.clearHandlers

$removeHandler(FormElement)
Shortcut to Sys.UI.DomEvent.removeHandler