Wednesday, October 28, 2009

Cannot find System.Globalization.CultureAndRegionInfoBuilder??

Kindly add reference and choose sysglobl under the .NET tab.

Thursday, October 22, 2009

Resizing a Photographic image with GDI+ for .NET

http://www.codeproject.com/KB/GDI-plus/imageresize.aspx

Channel 9 learning center

http://channel9.msdn.com/learn/

Flash cannot read a plain text file directly

Today, I knew that flash cannot read a plain text file directly.

The file content has to be:
1. variable format
value=32
2. xml format
<xml>32<xml>

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="f" style="overflow: hidden; background-color: red; width: 300px; height: 300px;">
<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>

Monday, October 19, 2009

Javascript Toolbox

http://www.javascripttoolbox.com/

Get user list of facebook application

There is no way for us to get a list of users of an application.
You have to store it in your own database.

Thursday, October 15, 2009

Facebook API call usage

Get photos of a user

IList photos = API.photos.get(API.users.getLoggedInUser().ToString(), "", new List());

FQL equivalent:
public static T Deserialize(string json)
{
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 photos = Deserialize>(result);
litTest.Text = photos.Count.ToString();
lvPhotos.DataSource = photos;
lvPhotos.DataBind();
}

Steps for using XFBML

http://wiki.developers.facebook.com/index.php/XFBML

Using XFBML for prompt permission
Constraint: The action needs to be initiated by user
Would you like to receive email from our application?

To do it automatically, using JS API instead.

AJAX Requests in a Facebook Iframe Application

http://www.keywordintellect.com/facebook-development/how-to-run-simple-ajax-requests-in-a-facebook-iframe-application/

http://www.keywordintellect.com/facebook-development/facebook-iframe-authentication-across-pages-ajax-requests/

Wednesday, October 14, 2009

Facebook Authorizing Applications

http://wiki.developers.facebook.com/index.php/Authorizing_Applications

Using Facebook Developer Toolkit CanvasIFrameBasePage
The allow access popup will appear automatically.

Online VisualStudio IDE

http://www.coderun.com/ide/

IFrame vs FBML Facebook pages

Choosing between an FBML or IFrame Application
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個資料結構的模型,
讓我們可以參考,

其中排行前二十名的如下

  1. Libraries and Books
  2. Inventory Control for Retail Stores
  3. Hotel Reservations
  4. Video Rentals
  5. School Management
  6. Clients and Fees
  7. CD Collections
  8. Customers and Invoices
  9. Payroll
  10. Apartment Rentals
  11. Customers and Services
  12. ERP
  13. Car Sales
  14. Customers and Addresses
  15. Driving Schools
  16. Health and Fitness Clubs
  17. Hospital Admissions
  18. Inventory of Files in Boxes
  19. Sports Clubs
  20. 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:

http://forums.asp.net/t/1215848.aspx

Job Seekers: How to Tell Stories to Stand Out

http://www.cio.com/article/print/491747

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");}

Reference:
http://blogs.msdn.com/adonet/archive/2007/01/26/querying-datasets-introduction-to-linq-to-dataset.aspx

Friday, October 9, 2009

jqZoom and mousewheel js event

http://www.mind-projects.it/projects/jqzoom/demos.php#demo1


mousewheel in javascript:
http://adomas.org/javascript-mouse-wheel/

Google Maps API Examples and Test Pages

http://koti.mbnet.fi/ojalesa/exam/

Apache PDFBox - PDF version 1.5

Anyone working with lucene that may use Apache PDFBox library to extract text from PDF for indexing. However, the official build was unable to index PDF file version 1.5 and 1.6. Here is the fix for the issue.

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

http://www.codeproject.com/KB/aspnet/paypal_c_aspnet.aspx