web 2.0

Aug 27 2010

10 things Beginning Silverlight and WPF Developers Need to Know

Today come across 10 must know knowledge for WPF and Silverlight programmer, and they are



9. How to Hand-Code XAML

8. How to Use Expression Blend

7. How to Write Value Converters

6. Threading

5. Async Programming

4. An Architectural Pattern (like MVVM or similar)

3. The Layout System

2. Dependency Properties

1. Binding

0. Our limitations, and when to call in a designer.





Original article: http://10rem.net [More]

Tags: ,

Quick Tips

Jun 2 2010

Launch a browser from Silverlight application

It is a question in my mind about how to make my Silverlight application to launch a new instance of browser just like the some hyperlink in normal html/aspx page. After a quick search from the MSDN library and found the answer. Infact, it is very simple, as simple as 1 line of code :)


   1:  System.Windows.Browser.HtmlPage.Window.Navigate(new Uri("http://www.google.com", UriKind.Absolute), "_blank");


or

   1:  System.Windows.Browser.HtmlPage.Window.Navigate(new Uri("MyPage.aspx", UriKind.Relative));

[More]

Tags:

Quick Tips

May 26 2010

Kaxaml

Just would like to share a XAML tool that I found it when I googling just now.

[More]

Tags: ,

Tools

May 26 2010

Load image from resources dll in WPF/Silverlight

As you migrate your business solution application from previous .NET Winform/ASP.NET to microsoft WPF/Silverlight and you wish to reused the existing satellite resource dll which you have created in the pass.

Due to the image object is different between the .NET WinForm/ASP.NET (Bitmap) and WPF/Silverlight (BitmapImage). Which mean, we are not able to call GetObject() in ResourceManager and assign the image into the BitmapImage object in WPF/Silverlight.

   1:  BitmapImage bmpRaw = (BitmapImage)ResourceManager.GetObject("MyImage");


Instead, we have to load the return Bitmap object into MemoryStream before further assign to the BitmapImage object via the BitmapImage.StreamSource property.

   1:  System.IO.MemoryStream stream = new System.IO.MemoryStream();
   2:  bmpRaw.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
   3:  bmp.StreamSource = stream;


Again, here we have another hidden trap in the MemoryStream object! That is the MemoryStream data position (data address pointer) is set as end of data position after the Bitmap.Save()


Therefore, we must move the data position back to the begin position before we further use it in BitmapImage.StreamSource()

   1:  stream.Seek(0, System.IO.SeekOrigin.Begin);

[More]

Tags: ,

Quick Tips

May 18 2010

Reading LINQ return collection with specific array index

A friend just asking me about how to access the LINQ return result collection with a specific array index. Most likely first thought is walk through the collection by foreach. But this might be resource hungry, especially the return collection is huge.


So, there is a quick function in the <IEnemerable> interface which can anwser this question and does not require the foreach loop... That is the System.IEnumerable.ElementAt method, and below is the quick sample code which would like to share it.


   1:  Int32[] source = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
   2:   
   3:   
   4:  IEnumerable<Int32> query =
   5:      from value in source
   6:      where value < 5
   7:      select value;
   8:   
   9:   
  10:  Console.WriteLine(query.ElementAt(2));
 

[More]

Tags:

Quick Tips

May 13 2010

Failed to upload file in IE8

Yesterday morning, my colleague telling me about there is a problem in uploading files to repository. Then I futher request the error mwssage and notice it is complaining about an invalid file path by the System.IO.File object. After counter check the repository source code and found nothing can go wrong... therefore, decide asking Mr. Google, and so lucky manage to find an article in webtopics blog which explaining the root of the problem... that is IE8 changed some default settings due to security issue...


[More]

Tags:

IE8

Aug 26 2009

Password Protected Extension

Back to few days ago, a friend of mine who also using .NET BlogEngine was asking me about how to modify the code to make it support password protected post/page.


After I look into details about how am I going to kick start... and I found the best implementation is writing an 'Extension'. That how the 'PasswordProtected' extension was borned! See the sample post here! [More]

Tags: ,

BlogEngine.NET

Aug 26 2009

Password Protected Demo Post

This is a protected post, you are require to login prior read this post.

Tags: ,

BlogEngine.NET

Aug 20 2009

Implement Your Own Ip2Location Information Services

Nowaday every blogger also have free visitors map on thier side bar that power by the following providers,

Last week, I decided to implement my own IP to location information services for my blog, and I keep sourcing the free Geo IP information database. At first, I found the ipligence community free edition. Which only offers,

  •    Region Code/Name.

  •    Country Code/Name.


Later, I found a better free database from IPInfoDB, which offer a much more comprehensive IP Geo information. As it cover the following informations, [More]

Tags: , ,

Services

Aug 5 2009

Multiple Group Link List Widget

Recently a BE.NET user was requesting a link list widget that supported multiple group which is not available in the current 'Link List' widget. Therefore, I have spent some time to create a new widget by using the ASP.NET treeview control to have a better UI grouping presentation.

Throughout the development cycle, I thought of it will be added value if I exposed some of the basic settings to the user like list below,

  • Main node title.

  • Group node image.

  • Link node image.

  • Show/Hide the main node.

  • Show/hide the dotted line.

  • Expand/collapse node capability.

  • Cutomize the group and link node style.

  • The easy way to rearrange the group and link order.

  • Show/hide individual group/link.

  • Support multiple sub group.


[More]

Tags:

BlogEngine.NET