Wednesday, October 28, 2009
Cannot find System.Globalization.CultureAndRegionInfoBuilder??
Thursday, October 22, 2009
Flash cannot read a plain text file directly
The file content has to be:
1. variable format
value=32
2. xml format
but not only "32".
At least, I can't find any way to do that using AS2 now.
For as3 to read a file, you can look at the following link:
http://www.thekuroko.com/2007/05/26/reading-a-file-with-actionscript-3/
Wednesday, October 21, 2009
Check whether children elements exceed the overflow parent
<div id="s" style="background-color: green; width: 350px; height: 300px;">
</div>
<script><br />if (f.scrollWidth > f.clientWidth){<br />alert("overflowed");<br />}<br /></script></div>
Tuesday, October 20, 2009
Monday, October 19, 2009
Get user list of facebook application
You have to store it in your own database.
Thursday, October 15, 2009
Facebook API call usage
IList
FQL equivalent:
public static T Deserialize
{
T obj = Activator.CreateInstance
MemoryStream ms = new MemoryStream(Encoding.Unicode.GetBytes(json));
System.Runtime.Serialization.Json.DataContractJsonSerializer serializer = new System.Runtime.Serialization.Json.DataContractJsonSerializer(obj.GetType());
obj = (T)serializer.ReadObject(ms);
ms.Close();
return obj;
}
[DataContract]
public class Photo{
[DataMember]
public string src_big { get; set; }
};
protected void btnFromAlbum_Click(object sender, ImageClickEventArgs e)
{
panelImage.Visible = true;
fql qPhotos = new fql(API);
qPhotos.UseJson = true;
string result = qPhotos.query(string.Format("select src_big from photo where pid in (SELECT pid FROM photo_tag WHERE subject={0})", API.users.getLoggedInUser()));
List
litTest.Text = photos.Count.ToString();
lvPhotos.DataSource = photos;
lvPhotos.DataBind();
}
Steps for using XFBML
Using XFBML for prompt permission
Constraint: The action needs to be initiated by user
To do it automatically, using JS API instead.
Wednesday, October 14, 2009
Facebook Authorizing Applications
Using Facebook Developer Toolkit CanvasIFrameBasePage
The allow access popup will appear automatically.
IFrame vs FBML Facebook pages
http://wiki.developers.facebook.com/index.php/Choosing_between_an_FBML_or_IFrame_Application
http://www.stevetrefethen.com/wiki/Facebook%20application%20development%20in%20ASP.NET.ashx
http://www.stevetrefethen.com/blog/DevelopingFacebookApplicationsInCWithASPNET.aspx
Resizable IFrame
http://wiki.developers.facebook.com/index.php/Resizable_IFrame
Required by resizable IFrame
http://wiki.developers.facebook.com/index.php/Cross_Domain_Communication_Channel
IFrame Resize Demo
http://apps.facebook.com/wzhu_public_resize/
IFrame Url
http://wiki.developers.facebook.com/index.php/IFrame_Url
http://developers.facebook.com/news.php?blog=1&story=152
===========================================================================
Using IFrames in FBML Canvas Pages and FBML in IFrames
If you're using FBML for your canvas pages and you decide you want one of your pages to be rendered in an IFrame, don't use fb:iframe for that. Instead, you should use the fb_force_mode querystring parameter to switch modes which will accomplish the same thing without incurring a round trip to your server just to fetch the fb:iframe tag.
Similarly, if you are using IFrames for your application but want some particular page to be an FBML page, you can use fb_force_mode
to force a switch to FBML. If you find documentation that advises using fb:iframe for switching from FBML to IFrame mode, it was probably written before fb_force_mode was released; we should have all those instances cleaned up soon.
Common and Useful Database Design
http://www.dotblogs.com.tw/ajun/archive/2008/08/05/4816.aspx
做為一個寫程式的,開開資料結構是很平常的事,
但有時,我們總是會希望可以有方法驗證一下我們這樣的設計是不是真的合適,
通常我們是在系統跑了一段時候後才發現,少考慮了一些欄位,
不過這個還算小事,
有時因為需求的遺漏未考慮周全,結果卻要重新設計整個結構,那才是真正糟糕的.
現在有個網站 DatabaseAnswers.org 提供了超過500個資料結構的模型,
讓我們可以參考,
其中排行前二十名的如下
- Libraries and Books
- Inventory Control for Retail Stores
- Hotel Reservations
- Video Rentals
- School Management
- Clients and Fees
- CD Collections
- Customers and Invoices
- Payroll
- Apartment Rentals
- Customers and Services
- ERP
- Car Sales
- Customers and Addresses
- Driving Schools
- Health and Fitness Clubs
- Hospital Admissions
- Inventory of Files in Boxes
- Sports Clubs
- Airline Reservations
而該作者(Barry Williams)所製作資料模型也被Microsoft SQL Server 2005 Express 做為Starter Database Schemas推廣.
另外該作者也做了教學影片(Understanding a Database Schema)給初學者.
http://www.dotblogs.com.tw/ajun/archive/2008/08/05/4816.aspx
ListView with own datasource and datapager
If you find that you need to click the page number twice to change page, please look at the following code:
Linq on DataTable Query
Today I have to serialize the DataTable to JSON.
I get the cyclic reference error using the following code:
string example = new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(dt);
After googling, I find that we cannot serialize a dataTable directly using the JavaScriptSerializer provided. Some webs implement their own code for dataTable.
But I finally have a fine solution - use Linq to Query DataTable:
string example = new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(dt.AsEnumerable());
Also if you just want specific columns, you can do the following query:
var dataToSerialize = from p in ct.AsEnumerable()
select new{ Column1 = c.Field("c1");}
Tuesday, October 13, 2009
Facebook Tutorial in ASP.net
http://fbtutorial.qsh.eu/
This tutorial makes use of the Facebook developer Toolkit.
Another tutorial (Chinese version):
http://6yeah-facebook.blogspot.com/
Monday, October 12, 2009
Sunday, October 11, 2009
Fixing the IE Overflow Vertical Scrollbar Bug
http://www.ookii.org/post/the_joys_of_overflowauto_and_crossbrowser_development.aspx
I come up with this solution:
#divInfo {float:left; width:400px; overflow-x:auto; overflow-y:hidden;padding-bottom:20px;}
Friday, October 9, 2009
Apache PDFBox - PDF version 1.5
1. Download the latest PDFBox 0.8.0 from http://incubator.apache.org/pdfbox/download.html#pdfbox. Please download pdfbox-0.8.0-incubating-src.jar.
2. Extract the jar and open the java file src/main/java/org/apache/pdfbox/pdfparser/PDFXrefStreamParser.java.
3. Modify line 100 to look like
while(pdfSource.available() > 0 && objIter.hasNext())
4. Run ant to build the project and get the pdfbox-0.8.0-incubating.jar from target folder
Reference:
http://issues.apache.org/jira/browse/PDFBOX-533
Thursday, October 8, 2009
Introduction to PayPal for C# - ASP.NET developers
Tuesday, October 6, 2009
Rsync for Windows
http://stackoverflow.com/questions/106544/rsync-on-windows-socket-operation-on-non-socket
http://en.wikipedia.org/wiki/Rsync
http://en.wikipedia.org/wiki/Delta_encoding
SyncToy
http://www.microsoft.com/downloads/details.aspx?familyid=c26efa36-98e0-4ee9-a7c5-98d0592d8c52&displaylang=en
http://www.mydigitallife.info/2008/01/01/schedule-synctoy-to-run-and-automatically-and-repetitively/
http://www.terinea.co.uk/blog/2007/10/15/backup-tools-mirror-backups-and-microsoft-synctoy/