Posts

Showing posts from 2011

MySQL Database corrupted and can not be repaired

I tried to use SQL Command to reparid the table. Unfortunately all attempts failed because following error: MYD file not found (Errcode:2) In order to fix it, look for the file  /mysql/schema/tablename.TMD . Simply rename this file to tablename.MYD. If for some reason there is already an MYD file rename the TMD file to BKP. Once that's done, run a: REPAIR TABLE schema.tablename;  If that doesn't work you may have to simply drop the table and restore from a backup. From http://www.hmailserver.com/documentation/latest/?page=howto_repair_mysql

Got problem about MySQL: .MYD' not found (Errcode: 2)

After half an year working perfectly, this morning I found one of my database stopped to response. After checking the error, I found following error {MySql.Data.MySqlClient.MySqlException (0x80004005): File '.xxxxx.MYD' not found (Errcode: 2)    at MySql.Data.MySqlClient.MySqlStream.OpenPacket()    at MySql.Data.MySqlClient.NativeDriver.ReadResult(UInt64& affectedRows, Int64& lastInsertId)    at MySql.Data.MySqlClient.MySqlDataReader.GetResultSet()    at MySql.Data.MySqlClient.MySqlDataReader.NextResult()    at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)    at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader()    at MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()    at CWShared.NDMySql.SetSellerCrawlTime(Int32 iProductSN, Int32 iSellerSN, DateTime dLastUpdate)} After searching a little bit, the following page provides the answer: http://dev.mysql.com/doc/refman/5.0/en/myisam-crash-recovery.html

validation key generator

The following web page provides a useful tool to create the validation key for a web site deployed in a web farm environment http://www.codeproject.com/KB/aspnet/machineKey.aspx The following is a sample section put in a web config file     <machineKey validationKey="C6770799B95A1F3E94ABAC69786357FFB65309007F844F0E2BDAC000D7AA3648B2D084D35654132C9A21C9BDF54F4800C841EFE143CBBB46CA38CAA31BCF26AF" decryptionKey="56E020EE87BE153C8E60EB4AFAB0F7D772CE45B71ED9C101C77D7F7B68E38C80" validation="SHA1" decryption="AES" />

Javascript file source path trick for web page in folders

If a master page is used as the master of a page in a sub folder, the javascript file must be referenced as following in the master page <script src="/Scripts/jquery-1.4.1.js" type="text/javascript"></script> If it is referenced as (without the "/" at the befginning of the path, which indicates the relative path to the root) <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script> All pages in the subfolder will not be able to access this javascript file. This style indicates the relative path to the current page. Stylesheet of master page can be indicated as following <link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />     

Alternate Style Sheets

This is an good article talking about working with alternate style sheet: http://www.alistapart.com/articles/alternate/ And as a live demo, the following page uses alternate style sheet.  http://www.alistapart.com/d/slidingdoors/final_tabs.html If opened in Fixfox, you can choose View - > Page Style, and then choose different view style for this document.

Detect browser javascript on and off in ASP.Net using c#

The value of Request.Browser.JavaScript indicates whether Javascript is enabled in browser. The above method is depreciated. A better solution is as following (C#):         bool bJavascript = Request.Browser.JavaScript;         System.Version version = Request.Browser.EcmaScriptVersion;         if (version.Major >= 1)         {             bJavascript = true;         }

How to clear MS SQL Server Database log file on GoDaddy

GoDaddy does not allow webmaster to clear the MS SQL Server database log file. And the Database file size is limited to 200 MB. I used to call GoDaddy to truncate the log file. However, it is really time consuming. Using following workflow I can successfully truncate my SQL Server log file. 1. Create a new MS SQL Server DB name it as NDTemplate.  2. Backup this database as an empty database. The backup file is about 1.6MB 3. Backup the original DB that you need to truncate. At my case this backup file is about 200MB. 4. Generate database script for the full database, and execute this sql script against the empty database. 5. Export the data in the Database to the new DB 6. Backup the new DB again and restore it against the original DB. Now the database will have all the data and structure. But the log file is minimized. It will only include the initial insert log.

List of cell phone screen resolution

The following web page contains a list of cell phone screen resolution sorted by brand and model http://cartoonized.net/cellphone-screen-resolution.php

Arvixe server is down again

It is second time the server at Arvixe for my website has problem now. http://forum.arvixe.com/smf/servernetwork-status/poppy-network-issues/ ========== The datacenter that the server poppy is located in has had a network issue affecting a portion of the datacenter. We are working as diligently as possible to identify and resolve the issue as soon as possible. We will continue to monitor and update the customers affected on this server via this post. ========= One clients complains that it has been down for 6 hours already. 

Merge stylesheet and javascript file

The following article is a good start talking about  Combining, Compressing, Minifying ASP.NET ScriptResource and HTML Markups

Web Browser control memory leakage

There is a quite long discussion regarding to the memory leak in IE webBrowser control. I noticed this problem as well. In my C# Windows form application, I used the WebBrowser control to navigate a list of web pages. Originally every navigation will consum 5MB memory and never release this memory until application crashes. After install IE 8, this problem disappeared. Memory usage stays quite stable. My development environment is Visual Studio 2010 Express + Visual Studio 2010 Service pack Beta 1 + Vista with Service pack 2 + IE 8. It looks IE 8 did the trick to remove this memory leakage.

Add compiler option to Visual Web Developer Express

In Visual Web Developer 2005 Express Edition, there is no direct way to compile the web site. However, we can add a pre-compile menu to the VWD using the external tools 1. In main VWD top menu bar, select the Tools -> External tools menu. 2. In the pop out dialog, click add to add a menu item. 3. In the Title edit box, add text: Pre-&Compile (non-updatable) 4. Specify the the Command text by browsing to the asp.net compiler. By default it is C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler.exe 5. In the arguments text box, add following text: -p "$(ProjectDir)" -v / "$(ProjectDir)\..\Compiled" You can specify other options such as us output window or not. Click Apply to add this menu. Now you can start to compile your application. You can also compile the application as update-able web site. Update-able web site using Partial Compilation, which compiles only the CodeBeside classes but leaves the ASPX pages to compile at run time on the se...