Amin Mahpour Official Blog

12Sep/080

Thecellbiology.com in last 7 days

After release of Cellopedia beta, a vast number of visitors, visited the project site in last 7 days.  the location distribution of the visitors are as follows:

image

In next month we will create development site so everybody can help the project "programatically". For now you can help Cellopedia open Free source spirit by adding articles!

9Sep/080

Implementation of Services in Silverlight with asp.net(VB.net code)

Introduction

If you search the web you can find plenty of C# samples for implementation of silverlight service but very few if not for VB.net.

here i will show you how to use services in silverlight in VB.net way.

Important notes

This walkthrough is designed for silverlight 2 beta 2 and VS 2008. If you have upgraded from silverlight 2 beta 1, I strongly recommend you to visit this post for more information on silverlight VB.net service issues and how to fix it.

The walkthrough

  1. Create an ASP.net web Site (name it services) in VS2008 (do not forget to assign Visual Basic for language!)
  2. Right click on asp.net Web Site in solution explorer and select add item. select Silverlight-Enabled WCF service and leave the default name (Service.svc), click add.
    image
    This will create a Service.vb class as follows:
    Imports System.ServiceModel
    Imports System.ServiceModel.Activation

    <ServiceContract(Namespace:="")> _
    <AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)> _
    Public Class Service

        <OperationContract()> _
       
    Public Sub DoWork()
           
    ' Add your operation implementation here
        End Sub

        ' Add more operations here and mark them with <OperationContract()>

    End Class

  3. Add a function called GetData under DoWork sub:
        <OperationContract()> _
       
    Public Function GetData(ByVal param As String) As String
           
    Return "Service is OK!"
       
    End Function
  4. Right click on solution in solution explorer and select Add>New project. select silverlight application from list and name it SilverService
    image
  5. Click ok to create the silverlight application.
  6. Right click on silverlight application and select add service reference.
  7. Click discover button. and change namespace to serviceSL , this will automatically recognize your service:
    image
  8. Click OK.
  9. open ServiceReferences.ClientConfig and in endpoint node, change the value of contract from ServiceSL.Service to SilverService.ServiceSL.Service. There is a bug in silverlight that do not type full project name before service name! if you do not change this, you will get an exception error on runtime.
  10. Open page.vb
  11. Add a textblock named "response":
    <TextBlock x:Name="response"></TextBlock>
  12. Open up page.xaml.vb.
  13. Add the following code:

       
    Private Sub Page_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
           
    Dim Service As New ServiceSL.ServiceClient
           
    AddHandler Service.GetDataCompleted, t color="#808080"> 
    AddressOf
     handle_GetData
           
    Service.GetDataAsync("some thing")
       
    End Sub

        Private Sub handle_GetData(ByVal ob As Object, ByVal e As ServiceSL.GetDataCompletedEventArgs)
           
    response.Text = e.Result
       
    End Sub

  14. Build application to see the results
  15. Modify these code to fit your interests! for example use LINQ and LINQ to SQL Classes to retrieve data from server securely!
Filed under: Silverlight No Comments
3Sep/085

Google bans Iranian from downloading chrome

UPDATE: Google finally allowed Iranians to download Google Chrome, Picasa and Google Earth! That’s a great news!

Today I tried to download Google's new browser called chrome, unfortunately Google banned me to do so!

The source page is http://dl.google.com/service/prod_unavailable.html.

The funny of matter is that Google says "file not found"! instead of "This download service is banned from your country (Iran only)" or "This download has no audience in Iran!". thanks to Google for this joke! I mean it...

It seems that not only Google bans downloading the browser from Iran originated IPs from it's own web site but also it does not allow Iranian people to install and or use it through third party web sites! I heard that, it is an open source project (what a great spirit for open source software).

It is not the first time that Google impose software sanction to Iranian people:

Google Earth, Picasa and other downloadable service

I am not so sad because this is the Google that looses Iranian support. on Alexa statistic page, It is indicated that Iran is seventh major user of Google with 2.9 percent in compare with japan with 2.5 percent and fourth country in Google traffic rank.

There are other browsers on the net that Iranian community can use such as Firefox(Iranians proved that before! visit this page for more information), IE, Safari and Opera!

Filed under: Uncategorized 5 Comments