Posts

How to Create Cross Domain Javascript API

I need to create a simple Javascript cross domain API so that I can share data across a few web sites, and also allow other websites to consume my data through Javascrript API. The following article is a good start point:   Javascript: Cross-Domain API For Your Website , or  Javascript cross-domain api for your website An example of Cross Domain Javascript API is disqus, other than many successful Google Javascript API. The complete disqus javascript API can be found from this page:    disqus embed.js . It provides good example of how to handle different browser and perform cross domain call. Note: In Asp.net, you can allow cross domain call by using following: Response . AppendHeader ( "Access-Control-Allow-Origin" , "*" ); Or you can set the cross-origin resource sharing in web.config file as indicated in article   cross-origin resource sharing How ever, IE doe not support COSR accroding to the discussion, therefore, Proxy service is required. ...

Responsive Web Design

Google has an document about  How to Building Smartphone-Optimized Websites . In this document, responsive web design is the first suggestion. I have been looking for a easy to implement responsive css framework that can change my websites layout so that they can fit to smart phone device for quite a little while. However, most of them requires more than a css file.  After searching aroung, I found a good article that introducts 10 well adopted grid frameworks  10 Lightweight & Minimal Responsive Grid Frameworks Among them, the  Simple Grid  is very clean and simple. It does not work well on IE 7 or IE 8. Other than that, it works fine.  The  Proportional Grids  is also a quite stable and simple one. For a website that involves user input, I would recommend  Base Framework which is almost ready to use so that you do not have to worry about the user input formatting. It is very important to add following line to the he...

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.