Andri Yadi

A geeky technopreneur, trying to do something big with his startup
  • Crash Intro to Kinect Development

    Finally got an opportunity to deliver a speaking and demo about Kinect development yesterday (Oct 30, 2011), on a seminar entitled “Technology is Our Life” organized by computer science students of Universitas Padjajaran (UNPAD). It’s full house, attended by 200 persons mostly coming UNPAD, UNIKOM, and Maranatha University students. Most of them are fist timer with the Kinect, so they’re quite amazed what we can do with Kinect.

    Some photos:

    20111029_008

    20111029_020   20111029_024
    Demoing Skeletal Tracking and Light Saber


    Demoing PowerPoint control and Kinect Effect

    Kinect Development

    I’m gonna switch language to Bahasa Indonesia as there are already a lot of references in English, for example: Kinect for Windows SDK Quickstarts.

    Posting ini ingin berbagi tentang bagaimana memulai pengembangan aplikasi dengan Kinect. Bagi yang belum tahu Kinect (dan dari seminar kemarin, ternyata banyak yang belum tahu) pada dasarnya sebuah perangkat tambahan console game Xbox 360 dari Microsoft, yg berfungsi untuk mengenali gerakan dan suara pemain. Pertama kali diperkenalkan dengan codename “Project Natal” tanggal 1 Juni 2009, dan diluncurkan November tahun lalu, Kinect telah berkembang bukan lagi hanya sebagai pelengkap Xbox, tapi sudah di-hack untuk keperluan apapun, mulai dari hal-hal yang fun dan lucu, sampai untuk keperluan yang selama ini hanya bisa kita lihat di Sci-fi movies.

     

    Kinect digunakan untuk bekerja dengan gambar menggunakan gesture tangan dan jari, mirip salah satu film sci-fi terbaik Minority Report.

    Great stuff! But how can we achieve something like that? Well, lets start with something simple. To develop Kinect-based application, we need an SDK, other official SDK from Microsoft, or the open source found in OpenKinect.org site. For the sake of simplicity, I’ll use official Kinect SDK.

    Ingredients:

     

    Preparation

    1. Install Kinect for Windows SDK. Cukup double click pada file installer yang sudah di-download, misalnya: KinectSDK64.msi, dan ikuti petunjuk selanjutnya.
    2. Install ketiga file terkait dengan Microsoft Speech SDK (jika diperlukan untuk fungsionalitas pengenalan suara).
    3. Extract Coding4fun Kinect Toolkit (Coding4Fun.Kinect.zip). Di dalamnya akan ditemukan 2 dll penting: Coding4Fun.Kinect.WinForm.dll dan Coding4Fun.Kinect.Wpf.dll. Masing-masing berkaitan dengan apakah kita ingin men-develop aplikasi berbasis Windows Form atau Windows Presentation Foundation (WPF).

     

    Let’s Code

    1. Fire up Visual Studio 2010, dan buat project baru (File –> New –> Project). Kali ini kita membuat aplikasi berbasis WPF, so make sure untuk memilih WPF Application seperti dialog berikut.

    image

    2. Add Reference ke Microsoft.Research.Kinect dan Coding4Fun.Kinect.Wpf (karena kita membuat WPF application).

    Klik kanan pada project di dalam Solution Explorer.  Lalu muncul Add reference dialog, cari Microsoft.Research.Kinect, dan klik OK.

    image

    Untuk menambahkan referensi ke Coding4fun.Kinect.Wpf, buka Add reference dialog. Lalu Browse dan cari file dll tersebut. Jika kedua library di atas berhasil di-add reference, akan tampil seperti ini pada group References di dalam project.

    image

    3. Lets design the user interface. Double klik pada MainWindow,xaml (pada Solution Explorer), dan tulis code XAML berikut.

    <Window x:Class="KinectCamAndTilt.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MainWindow" mc:Ignorable="d"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Height="334" Width="842"
    Loaded="Window_Loaded" Closed="Window_Closed">
    <Grid Height="280
    "
    >
    <Image Height="240" HorizontalAlignment="Left" Margin="20,20,0,0"
    Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="320" />
    <Image Height="240" HorizontalAlignment="Left" Margin="359,20,0,0"
    Name="image2" Stretch="Fill" VerticalAlignment="Top" Width="320" />
    <Button Content="Up" Height="35" HorizontalAlignment="Left"
    Margin="733,20,0,0" Name="button1" VerticalAlignment="Top"
    Width="75" Click="button1_Click" />
    <Button Content="Reset" Height="35" HorizontalAlignment="Left"
    Margin="733,75,0,0" Name="button2" VerticalAlignment="Top"
    Width="75" Click="button2_Click" />
    <Button Content="Down" Height="35" HorizontalAlignment="Left"
    Margin="733,130,0,0" Name="button3" VerticalAlignment="Top"
    Width="75" Click="button3_Click" />
    </Grid>
    </Window>



    Dan akan didapatkan tampilan kira-kira seperti di bawah ini. Pada code XAML di atas, dituliskan 5 control:

    • image1 (kiri): untuk menampilkan video stream dari Kinect
    • image2: untuk menampilkan depth steam
    • button1: untuk menaikan sudut elevasi Kinect
    • button2: untuk me-reset sudut elevasi
    • button3: untuk menurunkan sudut elevasi

    image

    4. Mari tulis code untuk MainWindow,xaml.cs

    a. Pertama, make sure untuk menuliskan using statement seperti ini:

    using Microsoft.Research.Kinect.Nui;
    using Coding4Fun.Kinect.Wpf;

    b. Instansiasi kelas Runtime. Kelas ini bisa dianggap sebagai instance dari sensor Kinect dan sebagai pintu gerbang untuk mengakses fungsionalitasnya. Jadikan runtime sebagai global variable.

    Runtime runtime = new Runtime();

    c. Tulis code pada event handler Window Loaded dan Closed:

    private void Window_Loaded(object sender, RoutedEventArgs e)
    {
    runtime.Initialize(RuntimeOptions.UseColor | RuntimeOptions.UseDepth);

    runtime.VideoFrameReady += new EventHandler<ImageFrameReadyEventArgs>
    (runtime_VideoFrameReady);
    runtime.DepthFrameReady += new EventHandler<ImageFrameReadyEventArgs>
    (runtime_DepthFrameReady);

    runtime.VideoStream.Open(ImageStreamType.Video, 2,
    ImageResolution.Resolution640x480,
    ImageType.Color);
    runtime.DepthStream.Open(ImageStreamType.Depth, 2,
    ImageResolution.Resolution320x240,
    ImageType.Depth);

    runtime.NuiCamera.ElevationAngle = 0;
    }

    private void Window_Closed(object sender, EventArgs e)
    {
    runtime.Uninitialize();
    }

    d. Lalu handle event VideoFrameReady dan DepthFrameReady, seperti berikut:

    void runtime_VideoFrameReady(object sender, ImageFrameReadyEventArgs e)
    {
    image1.Source = e.ImageFrame.ToBitmapSource();
    }

    void runtime_DepthFrameReady(object sender, ImageFrameReadyEventArgs e)
    {
    image2.Source = e.ImageFrame.ToBitmapSource();
    }

    e. Handle event click untuk ketiga button di atas:

    private void button1_Click(object sender, RoutedEventArgs e)
    {
    //Camera.ElevationMaximum = +27 degree
    if (runtime.NuiCamera.ElevationAngle + 5 > Camera.ElevationMaximum)
    return;

    runtime.NuiCamera.ElevationAngle += 5;
    }

    private void button2_Click(object sender, RoutedEventArgs e)
    {
    runtime.NuiCamera.ElevationAngle = 0;
    }

    private void button3_Click(object sender, RoutedEventArgs e)
    {
    //Camera.ElevationMinimum= -27 degree
    if (runtime.NuiCamera.ElevationAngle - 5 < Camera.ElevationMinimum)
    return;

    runtime.NuiCamera.ElevationAngle -= 5;
    }

    5. Let’s try it. Tekan F5 dan seharusnya akan tampil:

    image

    • Video kiri menampilkan video stream dari Kinect
    • Video kanan menampilkan depth steam. Depth stream akan memperlihatkan kedalaman (jarak) dari setiap pixel ke sensor Kinect.
    • Button Up: untuk menaikan sudut elevasi Kinect, agar Kinect “melihat” ke atas. Sudut maksimum adalah +27 derajat.
    • Button Reset: untuk me-reset sudut elevasi (0 derajat).
    • Button Down: untuk menurunkan sudut elevasi. Sudut minimum adalah –27 derajat. 

    That’s it. You can download the complete source code here:

    Enjoy!

    Share this post: | | | |
  • Talk: The Future of Mobile Application Seminar - UNY

    To emphasize our focus in mobile app development, my company DyCode became one of the sponsor on "Nasional Seminar of Mobile Development: The Future of Mobile Application" that was held in Universitas Negeri Yogyakarta on April 17, 2011. Beside DyCode, this event also sponsored by Nokia, Axis, and other local companies in Jogja.

    In that seminar, I delivered a talk about Mobile Application Development. I talked about various mobile application development platforms, Windows Phone 7 and iOS, among other things. I also gave demos of how to start creating apps in those platforms.

    But on this seminar I gave something new and fresh for the audience who mostly are students, and different from the other seminars that I used to speak. I made a demo of how to make a remote control app for a Parrot AR.Drone, a quadrocopter (helicopter with 4 rotor). Then I played the drone all around the hall with the app that I just built. Awesome! I create the apps in iOS and Symbian. Too bad can't do it in WP7 for now, as WP7 doesn't support Socket yet, something that's mandatory to communicate with AR.Drone.

    The audience seemed very excited, because they could see an app that's fun and real, and demoed in the realtime. Hopefully, with the excitement like that will encourage them to start make mobile apps.

    Some photos:

    Presenting

    Presenting

    ARDrone is waiting

    AR.Drone is waiting to fly

    ARDrone is flying

    It's flying

    Q&A

    Q&A

    Audiences

    The audiences

    Thanks UNY and Jogja for the excitement!

    Share this post: | | | |
  • Talk: Mobile Apps Development with Windows Phone 7 & Others

    I was back for more to talk about mobile apps development. This time, the talk was at the seminar of Competency Improvement on Operating System and Application Development of Windows Platform, on Saturday, April 2, 2011. The event was organized by Politeknik LP3I Bandung and as always, MUGI Bandung, and attended by the students of Politeknik LP3I Bandung – Informatics Management major.

    This time, the talk was more focused on Windows Phone 7. I talked about mobile apps revolution, mobile ecosystems, and some intro to various mobile development platforms. Then, I did demo on how to start developing a basic WP7 Silverlight-based app, using Visual Studio 2010 and WP7 emulator. Some pretty basic stuffs that hopefully will encourage the early learners to start developing mobile apps. The presentation slide is quite the same as my talk on Arkavidia event (link).

    The app I demoed was about accessing REST service. On previous blog post, I wrote about YQL and gave an example how to query data from Flickr and Yahoo Places, then showed how to access the query REST-fully. My demo app was about accessing the very same service. Here’s what it looks like. It’s showing Flickr photos taken around Bandung, and upcoming events in Bandung, Indonesia.

    image image

    I’m still fixing some parts of the demo app to be more appropriate and will post the source code at the soonest.

    As for other platforms, I talked about Symbian with Qt & Qt Creator, and iOS with XCode and Objective-C & Cocoa Touch. I didn’t do some coding or anything, just showing my company's app, the great Movreak.

    01  Screenshot_12
    Movreak for Symbian                                    Movreak for iOS

     

    Photos

    Speaking event won’t be complete without photos. Here they are.

    IMG_7002-r
    Peace…

    IMG_7008
    Showing an actual WP7 device

    IMG_7011
    Talking about Windows Phone Development Toolkit

    IMG_7010
    The audience

    IMG_7014

    That’s it. Enjoy.

    Share this post: | | | |
  • YQL and REST

    SELECT * FROM Internet, that’s Yahoo Query Language or YQL promise. Data are everywhere in internet provided by thousands of web services and other sources. They are valuable, yet isolated, waiting for you to consume. Querying, filtering, joining, shaping of those data are needed before they can be used in applications. Doing that across all required data will require us to read pages of API documentation and issue specific HTTP requests to each services. This where something like YQL saves the day.

    To explain why you need YQL and what you can do with YQL is by pictures. Let’s say you want to create an application that combines data from maps, picture sharing service, search, and weather service. I don’t know what the hell you have in mind, but surely you’ll need to access those 4 services’ API with their own way and complexity.

    image

    What YQL can do is allowing you to query, filter, join data across any structured data on the web or web services, including those 4 services. You can basically fire YQL statements - in form of SQL-like syntax – only to YQL engine to work with multiple data source (or data table). YQL can be thought as a hub to access multiple web services or data providers.

    image

    I won’t talk much about YQL intro and concepts. I don’t get rewarded by Yahoo to do that, so please RTFM of YQL here: http://developer.yahoo.com/yql/guide/. My objective of writing about YQL is simply because I’m amazed of its power, possibility, and richness. As said, we can practically query against any web services on the internet to work with all data we want. With those data in hand, sky is only the limit of applications we can build.

    To feel about what we can do with YQL, let’s open YQL Console. From your browser, go to http://developer.yahoo.com/yql/console, you’ll get this:

    image

    Few notes:

    • You can type your YQL statement in left top box
    • On the left middle, you’ll find query result. You can get XML or JSON formatted result.
    • On the left bottom, you’ll find generated URL for RESTful query
    • On the right, you’ll find:
      • Query Aliases: It’s always hard to remember long complex query. Just create an alias
      • Recent Queries and Example Queries: I don’t to explain them
      • Data Tables: You can think Data Tables as…well…database tables. Write your query against them to get what you want. By default, YQL provides 162 data tables divided into 20 categories. Most of them are Yahoo own services.

    Let’s type some query. Let’s say, I wanna know more about Bandung, West Java. I can query to data table “geo.places”:

    select * from geo.places where text="Bandung, West Java"

    You’ll get XML response like this:

    <?xml version="1.0" encoding="UTF-8"?>
    <query xmlns:yahoo="http://www.yahooapis.com/v1/base.rng"
    yahoo:count="1" yahoo:created="2011-03-31T19:48:30Z" yahoo:lang="en-US">
    <diagnostics>
    <publiclyCallable>true</publiclyCallable>
    <url execution-time="143"><![CDATA[http://where.yahooapis.com/v1/places.q(Bandung%2C%20West%20Java);start=0;count=10]]></url>
    <user-time>162</user-time>
    <service-time>143</service-time>
    <build-version>11703</build-version>
    </diagnostics>
    <results>
    <place xmlns="http://where.yahooapis.com/v1/schema.rng"
    xml:lang="en-US" yahoo:uri="http://where.yahooapis.com/v1/place/1047180">
    <woeid>1047180</woeid>
    <placeTypeName code="7">Town</placeTypeName>
    <name>Bandung</name>
    <country code="ID" type="Country">Indonesia</country>
    <admin1 code="" type="Province">West Java</admin1>
    <admin2 code="" type="County">Bandung Kota</admin2>
    <admin3/>
    <locality1 type="Town">Bandung</locality1>
    <locality2/>
    <postal/>
    <centroid>
    <latitude>-6.912420</latitude>
    <longitude>107.606911</longitude>
    </centroid>
    <boundingBox>
    <southWest>
    <latitude>-6.936850</latitude>
    <longitude>107.562202</longitude>
    </southWest>
    <northEast>
    <latitude>-6.869990</latitude>
    <longitude>107.637627</longitude>
    </northEast>
    </boundingBox>
    <areaRank>3</areaRank>
    <popRank>12</popRank>
    </place>
    </results>
    </query>

    Or, if you want, you can get JSON instead. Check JSON instead of XML under YQL statement box. Let’s turn off “Diagnostics” to simplify response, and you get:

    {
    "query": {
    "count": 1,
    "created": "2011-03-31T19:54:59Z",
    "lang": "en-US",
    "results": {
    "place": {
    "lang": "en-US",
    "uri": "http://where.yahooapis.com/v1/place/1047180",
    "woeid": "1047180",
    "placeTypeName": {
    "code": "7",
    "content": "Town"
    },
    "name": "Bandung",
    "country": {
    "code": "ID",
    "type": "Country",
    "content": "Indonesia"
    },
    "admin1": {
    "code": "",
    "type": "Province",
    "content": "West Java"
    },
    "admin2": {
    "code": "",
    "type": "County",
    "content": "Bandung Kota"
    },
    "admin3": null,
    "locality1": {
    "type": "Town",
    "content": "Bandung"
    },
    "locality2": null,
    "postal": null,
    "centroid": {
    "latitude": "-6.912420",
    "longitude": "107.606911"
    },
    "boundingBox": {
    "southWest": {
    "latitude": "-6.936850",
    "longitude": "107.562202"
    },
    "northEast": {
    "latitude": "-6.869990",
    "longitude": "107.637627"
    }
    },
    "areaRank": "3",
    "popRank": "12"
    }
    }
    }
    }

    OK, you get the idea. Let’s try something little bit complex. Let’s say I want to get the URL of all Flicker photos that have geotag data and taken in Bandung, West Java.

    select urls.url.content from flickr.photos.info where photo_id in (select id from flickr.photos.search where has_geo="true" and woe_id in (select woeid from geo.places where text="Bandung, West Java"))

    The query should be self descriptive. It basically uses three data tables:

    • geo.places to get woeid (Where on Earth Identifier, a unique reference ID by Yahoo! of any feature on Earth)
    • flickr.photos.search to search photos near by a region identified by woeid
    • flickr.photos.info to get the URL of each photos

     

    REST

    We can do RESTful query from our application to YQL by using REST query URL. Let’s take a look this YQL console for our last YQL statement.

    image

    On the left bottom, you’ll find REST Query URL, something like this:

    http://query.yahooapis.com/v1/public/yql?q=select%20urls.url.content%20from%20flickr.photos.info%20where%20photo_id%20in%20(select%20id%20from%20flickr.photos.search%20where%20has_geo%3D%22true%22%20and%20woe_id%20in%20(select%20woeid%20from%20geo.places%20where%20text%3D%22Bandung%2C%20West%20Java%22))&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=

    That URL has parameters:

    • q : the YQL statement itself
    • format: expected result format, json or xml
    • env: allows you to use multiple Open Data Tables through a YQL environment file.
    • callback: the name of the JavaScript callback function for JSONP format

    If you open the URL from a web browser, you’ll get this (I actually format it to be readable).

    {
        "query": {
            "count": 10,
            "created": "2011-03-31T20:20:16Z",
            "lang": "en-US",
            "results": {
                "photo": [
                    {
                        "urls": {
                            "url": "
    http://www.flickr.com/photos/wiwin_wr/5574739718/"
                        }
                    },
                    {
                        "urls": {
                            "url": "
    http://www.flickr.com/photos/kamandanu/5573455614/"
                        }
                    },
                    {
                        "urls": {
                            "url": "
    http://www.flickr.com/photos/ikhlasulamal/5572197398/"
                        }
                    },
                    {
                        "urls": {
                            "url": "
    http://www.flickr.com/photos/ikhlasulamal/5571587697/"
                        }
                    },
                    {
                        "urls": {
                            "url": "
    http://www.flickr.com/photos/ikhlasulamal/5572184670/"
                        }
                    },
                    {
                        "urls": {
                            "url": "
    http://www.flickr.com/photos/ikhlasulamal/5572166598/"
                        }
                    },
                    {
                        "urls": {
                            "url": "
    http://www.flickr.com/photos/ikhlasulamal/5572164886/"
                        }
                    },
                    {
                        "urls": {
                            "url": "
    http://www.flickr.com/photos/luluk/5574683302/"
                        }
                    },
                    {
                        "urls": {
                            "url": "
    http://www.flickr.com/photos/ikhlasulamal/5572212992/"
                        }
                    },
                    {
                        "urls": {
                            "url": "
    http://www.flickr.com/photos/ikhlasulamal/5572190344/"
                        }
                    }
                ]
            }
        }
    }

    Now, to consume the YQL query result from .NET application, you can basically do HTTP request to that URL (using WebClient or HttpWebRequest class) and simply read the HTTP response. On the next post, I’m gonna talk about how to consume YQL results from .NET apps.

    That’s it. Enjoy.

    Share this post: | | | |
    Posted Apr 01 2011, 03:32 AM by andriyadi with no comments
    Filed under: ,
  • NuGet

    Having 2-3 months not code in Visual Studio make me not knowing some new stuffs. NuGet, among other things. NuGet is a package management system for .NET framework. It allows you to add 3rd party libraries directly from Visual Studio. For you who are PHP veterans, must have been acquaintance with PHP Extension and  Application Repository (PEAR), NuGet is something like it.

    To get the experience how easy and helpful NuGet is, let’s install it. First thing first, let’s check it if it’s not yet installed. Open Visual Studio 2010, go to Tools menu. If you don’t have a menu item like I show in this image – Library Package Manager – then you haven’t install NuGet.

    image

    To install NuGet,simply click Extension Manager from Tools menu, then Extension Manager dialog will show up.

    image

    Go to Online Gallery and search NuGet, you’ll get something like above picture. Select and install it. After it’s installed and restarting your Visual Studio, you’ll have Library Package Manager in Tools menu of Visual Studio.

    Let’s install a package. I want to install a package called RestSharp package. Luckily RestSharp provide package that can be installed using NuGet. So, I just open Package Manager Console and a window like below will show up in VS. In the console, type:

    Install-Package RestSharp

    Boom, RestSharp get downloaded. NuGet even check for dependencies, in this case Newtonsoft.Json. And done, RestSharp installed and ready to use in my project.

    image

    Share this post: | | | |
  • Talk: Mobile Development Platforms

    Long time no blogging, now getting back just to share the event that Narenda (you know him, don't you? A Nokia Indonesia guy :P) and I was part of, Arkavidia 2.0 Seminar. It's part of Arkavidia 2.0, a yearly event organized by ITB Informatics Engineering students. While Narenda talked about mobile business opportunity in Indonesia, which is mostly business stuffs, I'm blessed to talk about more fun stuffs, mobile development technologies.

    In this seminar, I shared about how to start jumping into mobile development in all mobile platforms: Windows Phone 7, Blackberry, Symbian, Android, and the last but not the least, iOS. Well, not all platforms, considering the time limitation. Given 30 minutes won't be enough to talk about all mobile technology awesomeness.

    Here's the slide: http://www.slideshare.net/andri_yadi/mobile-development-platforms

    Few photos taken during the seminar.

    _MG_8213.JPG

    So serious preparing the code

    _MG_8215.JPG

    Introducing myself as a movie freak while promoting Movreak app :)

    _MG_8220.JPG

    Answering questions

    _MG_8243.JPG

    Q & A session with all other speakers.

    Share this post: | | | |
  • Change Assembly’s *.dll.config from Other App

    It’s around 2 months since the last time I coded using .NET & VSTO, and many things starts to fade away :) But finally, I have an opportunity to get back to .NET & VSTO and starting to bump many obstacles.

    One thing that I met today was I want to create an installer of finished project. During the installation, I want to be able to change configuration file of an assembly that’s resulted in from the project. So, I create an installer’s custom action and I write the code to manipulate the config file.

    Turns out, changing assembly‘s configuration (*.dll.config) is not as easy as changing application’s configuration (*.exe.config), especially from other application domain. After 1 hour of contemplation, I managed to result in the working code.

    Let’s say the config file looks like this:

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
    <configSections>
    <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
    <section name="AnOutlookAddIn.Properties.Settings"
    type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
    allowExeDefinition="MachineToLocalUser"
    requirePermission="false" />
    </sectionGroup>
    </configSections>
    <userSettings>
    <AnOutlookAddIn.Properties.Settings>
    <setting name="WebServiceURL" serializeAs="String">
    <value>http://localhost:1075/WebService.asmx</value>
    </setting>
    </AnOutlookAddIn.Properties.Settings>
    </userSettings>
    </configuration>

    I want to be able to change “WebServiceURL” value. So, here’s the code:
       1: ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap();
       2:  
       3: // Full path to assembly's config file
       4: fileMap.ExeConfigFilename = @"C:\\Program Files (x86)\\DyCode\\AddIn\\AnOutlookAddIn.dll.config";
       5: Configuration config = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);
       6:  
       7: ConfigurationSectionGroup userSettings = config.GetSectionGroup("userSettings");
       8:  
       9: ClientSettingsSection clientUserSettings = 
      10:    (ClientSettingsSection)userSettings.Sections["AnOutlookAddIn.Properties.Settings"];
      11:  
      12: if (clientUserSettings != null)
      13: {
      14:  
      15:     SettingElement element = clientUserSettings.Settings.Get("WebServiceURL");
      16:     // Set the element value with the right Web service URL
      17:     element.Value.ValueXml.InnerText = @"http://localhost/WebService.asmx"; 
      18:  
      19:     clientUserSettings.SectionInformation.ForceSave = true;
      20: }
      21:  
      22: config.Save(ConfigurationSaveMode.Full);

    Please pay attention that:

    1. The key "AnOutlookAddIn.Properties.Settings" on line 10 must match with tag <AnOutlookAddIn.Properties.Settings> under <userSettings>.
    2. By default, *.dll.config or *.exe.config are resulted in from Settings editor of Visual Studio, and the Scope is by default set to Application. To be able to be manipulated, Scope must be change to User. That’s why you get <userSettings>, instead of <applicationSettings> in .config file.
    image
     
    That’s it for now. If I have time, I’ll post complete walkthrough to create custom installer for VSTO project. Enjoy!
     
    Share this post: | | | |
    Posted Sep 28 2010, 10:10 PM by andriyadi with no comments
    Filed under:
  • Configure SharePoint 2010 to Store Files (Blob) to The File System

    SharePoint is great for document management system, collaborative file storage, record management system, you name them all. One downside (or upside, depend on your perspective ) in SharePoint, it stores the files (or the blobs) in content database. The advantage of that approach is it simplify the backup and restore process. You backup a site collection, all related data of it are backed up in one file. The disadvantage is the database size can be gigantic if your SharePoint manages million of files. There’s a critical problem if you use SQL Server Express Edition which has a limitation in database file size, which is 4GB in 2008 and 10GB in 2008 R2.

    Fortunately, we can configure SharePoint so that it store the blob in the NTFS file system, instead of in database. It’s possible by leveraging FILESTREAM feature of SQL Server 2008 (both Express and non Express), and Remote BLOB Storage (RBS). RBS is a library API set that is incorporated as an add-on feature pack for Microsoft SQL Server 2008 and Microsoft SQL Server 2008 Express. RBS is designed to move the storage of binary large objects (BLOBs) from database servers to commodity storage solutions. More details about RBS is here.

    This blog post is all about the configuration. Let’s start. I spent a whole afternoon for this.

    Check SharePoint Web Application’s database

    First thing first, to configure FILESTREAM and RBS, you need to know what is SQL Server instance and database used by SharePoint.

    1. Open SharePoint Central Administration (Start –> All Programs –> Microsoft SharePoint 2010 Products –> SharePoint 2010 Central Administration)

    2. Click Application Management –> Manage content databases

    image

    3. Change web application you want to configure (1), and check the database name (2). In this case (generally), WSS_Content

    image

     

    Enable FILESTREAM on SQL Server 2008/2008 R2

    To enable and change FILESTREAM settings (adapted from How to: Enable FILESTREAM)
    1. On the Start menu, point to All Programs, point to Microsoft SQL Server 2008 R2, point to Configuration Tools, and then click SQL Server Configuration Manager.

    2. In the list of services, right-click SQL Server Services, and then click Open.

    3. In the SQL Server Configuration Manager snap-in, locate the instance of SQL Server on which you want to enable FILESTREAM.

    4. Right-click the instance, and then click Properties.

      image

    5. In the SQL Server Properties dialog box, click the FILESTREAM tab.

    6. Select the Enable FILESTREAM for Transact-SQL access check box.

    7. If you want to read and write FILESTREAM data from Windows, click Enable FILESTREAM for file I/O streaming access. Enter the name of the Windows share in the Windows Share Name box.

    8. If remote clients must access the FILESTREAM data that is stored on this share, select Allow remote clients to have streaming access to FILESTREAM data.

    9. Click Apply.

    10. In SQL Server Management Studio, right click database server name, and click New Query to display the Query Editor.

    11. In Query Editor, enter the following Transact-SQL code:

      EXEC sp_configure filestream_access_level, 2
      RECONFIGURE
    12. Click Execute.

     

    Provision a BLOB Store with the FILESTREAM provider

    1. Fire up SQL Server Management Studio

    2. Right click to WSS_Content database, and click New Query.

    image

    Write this TSQL

    use [WSS_Content]
    if not exists (select * from sys.symmetric_keys where name = N'##MS_DatabaseMasterKey##')
    create master key encryption by password = N'Admin Key Password !2#4'

    use [WSS_Content]
    if not exists (select groupname from sysfilegroups where groupname=N'RBSFilestreamProvider')
    alter database [WSS_Content] add filegroup RBSFilestreamProvider contains filestream

    use [WSS_Content]
    alter database [WSS_Content] add file (name = RBSFilestreamFile,
    filename = 'c:\BlobStore') to filegroup RBSFilestreamProvider


    Notes:

    I use “C:\BlobStore” folder to store all the files. You can change it to any folder you like.

    Tips from TechNet: For best performance, simplified troubleshooting, and as a general best practice, we recommend that you create the BLOB store on a volume that does not contain the operating system, paging files, database data, log files, or the tempdb file.

    After executing those TSQL, make sure the folder (C:\BlobStore in this case) is created.

     

    Install Remote Blob Storage (RBS)

    You must install RBS on the database server and on all Web servers and application servers in the SharePoint farm. You must configure RBS separately for each associated content database. Here’re the links to download the bits.

    X64 Package

    X86 Package

    IA64 Package

    Execute downloaded bits, RBS.msi. Here’re the wizards:

    image

    Select all features

    image

    Configure database connection. Adjust the server\instance (by the way, I use Sharepoint instance name, change it to reflect your environment). Database name is WSS_Content, the one I mentioned above. Change Filegroup for internal tables to PRIMARY.

    image

    Change FILESTREAM blob store filegroup to RBSFilestreamProvider. That’s a must, as we use RBS FILESTREAM provider for storing files.

     

    image

    Check the checkbox.

    image

    Name the Store.

    image

    Next, next, next. You’ll be prompted Task scheduler for RBS maintenance, configure it. Next, next, next, and finish successfully, hopefully :)

    Check the RBS installation

    Fire up SQL Server Management Studio, open New Query, write this:

    use [WSS_Content]
    select * from dbo.sysobjects where name like 'rbs%'

    If you see some results, then RBS installation is successful.

     

    Enable RBS

    The last step is enabling RBS on Web Server in the farm. For me, the web server is at the same server as the database server.

    Let’s go scripty by firing up SharePoint 2010 Management Shell (Start –> All Programs –> Microsoft SharePoint 2010 Products –> SharePoint 2010 Management Shell).

     

    image

    The script: (Change the http://SiteName to your web application URL)

    $cdb = Get-SPContentDatabase -WebApplication http://SiteName
    $rbss = $cdb.RemoteBlobStorageSettings
    $rbss.Installed()

    Now, you should see “True”, continue:

    $rbss.Enable()
    $rbss.SetActiveProviderName($rbss.GetProviderNames()[0])
    $rbss

    After the last line, you should the result like mine above.

    Test RBS

    Let’s test it. I refresh the SharePoint site. My first attempt is failed, SharePoint said that there’s a memory corrupt. What?!! Don’t be affraid, just restart the Web Server, and the site is back online.

    I test by uploading a file with size 9,125KB. The uploading is successful, now it’s time to check whether it’s stored in RBS. I open Windows Explorer, go to C:\BlobStore (the folder I used in above steps), drill down to some GUID-named folders. And I find this:

    image

    It’s exactly what it is, 9,125KB. And my afternoon is great, and now I want to eat some Sushi.

    Share this post: | | | |
  • Simple Gotcha in Windows Azure Storage

    If you start to learn Windows Azure Platform, especially when you need to work with Windows Azure Storage, you need to setup Development Storage in development environment. For the first time you debug a Cloud (project template for Windows Azure in Visual Studio) project, Windows Azure SDK will try to create development storage (whether you use it or not). It should be done smoothly. But life is not always as easy as it seems.

    I experienced something unexplained at the beginning. At the first time the cloud project is debugged, Windows Azure SDK will prepare development fabric and development storage. It take ages to complete. I notice that it's hang when it tries to create development storage. Turns our my local SQL Server Express instance name is not default (SQLEXPRESS), instead I use SHAREPOINT since I use the same machine for SharePoint 2010 development.

    So, I killed the development fabric. I try to find a program that try to create development storage. I find it named as DSInit.exe located in C:\Program Files\Windows Azure SDK\v1.2\bin\devstore (for Windows Azure SDK 1.2). Then I execute the program manually from command prompt using this command:

    DSInit /sqlInstance:SHAREPOINT

    And walah...development storage is created.
    Please note that I don't use .\SHAREPOINT as the paramater value. More detail about DSInit.exe is here.

    Then, a week ago I delivered a training of Windows Azure for Indonesia's ISVs. Guess what, I experinced the same problem. So, by confidence I use the same technique, and after more than an hour trying it's not successful. I gave up and reinstall the SQL Server, try to create development storage and it's successful. So, the moral story is if DSInit is still failed after you try every possible parameters, reinstall the SQL Server :)

    That's it. Enjoy.

    Share this post: | | | |
  • Yep, The Rumour is True, Bing Coming to the iPhone 4 and iOS4

    For you who are fans of Bing search engine, and still willing to use iPhone, it's coming to iOS4. Yes, iOS4 is the newest OS for iPx (iPhone/iPod Touch/iPad) devices, that's previously called iPhone OS and become obsolete since it's used for iPad as well. iOS4 was just introduced 1-2 hours ago on the Steve Jobs' keynote in Apple Worldwide Developer Conference (WWDC) 2010 in San Fransisco (Today, June 7, 10AM local time).

    Wait a minute, isn't iOS name is owned by Cisco for their routers and switches? Did Apple take Cisco's product name again as it did for iPhone name. Whatever...

    Google is still the default search engine in iPhone Safari. But now, you have option to switch to Bing. There you go Bing lover...
    Here're the photos of Bing on iPhone







    Hey, Microsoft build this Bing version for iPhone using HTML5. Great! (hopefully full support of HTML5 will be on IE9 soon) :)

    Steve Jobs also introduced the newest family member of the iPhone, the iPhone 4. If you've seen the iPhone 4 photos on the web lately (especially on Gizmodo), you ain't see the cool features. Most notable features:

    • The hardware is amazing. 960 x 640 display is just amazing for a phone. A4 processor will give you 10 hours wireless productivity, yet great performance. And there's a new censor called gyroscope, together with accelerometer will give you 6-axis motion sensing. Sky is the limit for apps you can create with it.
    • Camera and iMovie. 5 megapixel camera, with LED flash, finally. Real HD video camera and edit the video with iMovie right from the iPhone. Wow...iMovie, can't imagine how fast it runs, as it runs quite heavy on my Mac. Anyway, it's a great engineering both camera hardware and software
    • iOS4 itself. You'll find bunch of new features in this new OS. Most notable feature is multi-tasking. For iPhone developers, you'll get Golden Master version today..yay, definitely will download it.
    • iBooks and iAds. Not much to say about them
    • FaceTime. No, it's not Facebook. Yes, it's the new video call software in iPhone 4. From the demo, it's cool! Unfortunately, the video call can be made only in WIFI network, for 2010. Is the carrier network that bad?

    The iOS4 will be available for FREE on June 21, 2010. Yes, it's free (not like iPhone OS 3) for all iPx devices, including iPod Touch. Sorry guys, iPod Touch 1st gen is not supported.

    When is iPhone 4 available? June 15 is the pre-order starts, off course in US and 4 more countries. When it will be in Indonesia? I think next year. Won't wait for it officially in Indonesia.

    Watch the iPhone 4 video here: http://www.apple.com/iphone/design/#design-video

    Share this post: | | | |
  • Visual Studio 2010 Community Launch and Bandung Charity Event

    MUGI Bandung in collaboration with MUGI Campus Bandung, MSP Bandung, MUGI Cianjur and Microsoft Indonesia held an event of Visual Studio 2010 Community Launch and Bandung Charity Event on On May 18, 2010, at Wahana Bakti Pos building, Bandung. In this event Visual Studio 2010 is formally launched to the community. In addition, this event is also aimed for charity, which the revenue from ticket sale will be donated to victims of natural disasters in Bandung.

    In this event, we have an honor to have a guest from Redmond. He is Luke Hoban, Microsoft’s Program Manager of F#. In this seminar, he introduced F# as a new comer in Visual Studio 2010 and .NET 4.0 platform.

    Topics and speakers in the seminar:

    • Luke Hoban (Program Manager F# dan Visual Studio 2010, Microsoft Corp) : What's New In Visual Studio 2010 and Introduction to F# and Paralel Programming.
    • Risman Adnan (Senior Developer Advisor, Microsoft Asia Pasific) : TFS 2010 and ALM With Visual Studio 2010.
    • Firstman Marpaung (MVP Windows Mobile) dan Agam FK (MSP Unsur Cianjur) : Introducing Windows Phone 7.
    • Narenda Wicaksono dan Ronald Rajagukguk (Microsoft Indonesia) : Coding For Fun With Visual Studio 2010 and TFS 2010.
    • Rully Yulian MF (MVP Visual Basic.NET) : Migrating From VB 6.0 to VB.NET.
    • Andri Yadi (MVP VSTO) : WCF Data Services and Office 2010 Development.

    As above, I talked about WCF Data Services and use it in office 2010 application. My slide is here:

    Too bad I didn't have photos of me delivering the talk :|

    Share this post: | | | |
  • Talk: Entity Framework v2 Best Practices

    On May 11, 2010, Microsoft Indonesia organized an event entitled "Microsoft Innovation Day". Microsoft used this event to formally announce Visual Studio 2010 and announced Imagine Cup 2010 winners. There are also breakout sessions talking about some new stuffs in .NET 4.0 and Visual Studio 2010, among other topics. I delivered a talk in a breakout session about Entity Framework v2 Best Practices. The presentation slide is attached in this post or can be view below:

    Here're some photos. Sorry for crappy ones, the photographer is not experienced :)

    _MG_7401-r

    _MG_7413
    The audiences

    Share this post: | | | |
  • Three Years, New Plex, New Stuffs

    Now that 2009, a rather complex and unpredictable year has left us for 5 months. It’s 2010, the 2010th year of the Common Era or of Anno Domini; the 10th year of the 3rd millennium and of the 21st century; and the 1st decade of the 2010s.

    According to an article on CNN, 2010 is the year of Digital Distraction, due to more and more distractions coming from push emails, tweets, status updates, instant messaging, and more, that leads to a big question: productivity boon or bust? If in China, 2010 is the year of Tiger, in the tech world, 2010 will be the year of Tablet. A bevy of tech companies have teased, talked, and have not denied rumors that they are working on a fabled tablet computer, let's say some Google-Android-powered and Google Chrome OS tablets, NVIDIA-powered tablet called “iTablet”, and many more. Some are not rumor anymore, we’ve watched a highly rumored Apple tablet since 2001, finally unveiled on Jan 27 named iPad and now become a mainstream. Microsoft and HP partnering in the development of a slate PC which’s announced at CES 2010 and now the effort is rumored to be cancelled, and instead HP is rumored starting to build a webOS-powered tablet codenamed “HP Hurricane” (as HP recently purchased Palm, the creator of webOS).

    2010 is the third year of my company, DyCode. It’s exactly today, May 9, 2010, DyCode is three years old. Happy Birthday again, my child. They say, 3 years will be a turning point for a startup, whether it takes off or taken down. I hope for the best.

    Three years is no way an easy life for DyCode and my self. Both of use are tested over and over again. I’m recently offered to leave DyCode to fill a very prestigious position as a director in a subsidiary company (in Indonesia) of a biggest software company in the world. I’m sure you know what company I refer to, as it’s very close to every INDC members. Fortunately, I’m managed to turn down the temptation (after a long and deep thinking, with a little regret honestly), and stay with DyCode as long as it takes.

    What happened within DyCode recently before its three year, I’ll share below.

    New Plex

    For me and DyCode, we start this decade of 2010s with the new DyPlex. Yes, the new DyCode office. Since founded on May 9, 2007, DyCode stayed at the same home office, it was at Jl. Gemi No. 11A, Bandung.

    “Dynamic” is the first word of DyCode's name. Dynamism is DyCode's paradigm. It's all about the ability to change or to adapt. DyCode is changing and keeps changing. It has more DyCoders, more assets, and more works. To adapt to those changes, there is a most basic thing that need to adapt, a place to work, a nicer and bigger DyPlex. The old DyPlex seems unable to handle the number of DyCoders, assets, and works.

    The search of new DyPlex was no way an easy task. Location, location, location, is the number one criteria. DyCode’s clients are mostly not in Bandung, they are in Jakarta, Cilegon, outside Java, or even abroad, hence the access to highway should be easy and fast. Programming is brain-intensive work and stress-prone, so the access to near cinema and entertainment center is important. But good location is useless when the building itself is not comfortable for working. A homie, spacious, good air circulation, abundant sunlight are must. We still choose a home-office, instead of office building in some business centers. DyCode wants its DyCoders to work comfortably, warm, and able to stay until late night if they have to.

    After 3 months of searching, visiting more than 10 house candidates in varying locations, finally we ended up to this coordinate: -6.876482, 107.584389 or -6 52' 35.34", +107 35' 3.80". It's addressed: Jl. Setrasari Kulon II No. 2, Bandung, 40152. Here's the map:

    map_newdyplex_callout 

    Setrasari is a well known area in Bandung. It’s the housing complex where the big houses located, and has a combination of nice neighborhood, quiet, and as cold as you never need air conditioner anymore.

    This map shows how the new DyPlex is reachable from Pasteur road, after highway exit gate.

    map_newdyplex_from_pasteur

    The route from a well-know and traffic-jam-causer mall in Bandung, Paris Van Java (PVJ).

    map_newdyplex_from_PVJ

     

    Photos

    If you’re wondering how the new DyPlex looks like, I’ll post some photos.

    tampak-depan-2

    The front view

    taman-samping-2  _MG_6779

    The gardens

    _MG_6772

    And another garden…

    The interior

    _MG_6757

    The guest room

    image

    The fingerprint time-attendance machine, next to the door

    _MG_7173

    Developers room. Where the magic happens 

    _MG_7325 _MG_7334

    Team Leads room. Where the technical bosses reside

    _MG_6766 IMG-7138

    Admin guys room and a cute designer and CRO in it. She’s in serious mode. 

    _MG_7358 _MG_7226

    You know whose room and workstation is this, the guy with Apple MacBook Pro, a Cinema Display, and gadgets, who else?

    _MG_6776 _MG_7174

    We even have a dinning room, with free lunch, of course. We hire a chef (sort of) to prepare great lunch.

    It’s nice place to work, isn’t it? We’re really excited about it and love working here everyday. It’s the result of three years hard-works. We’ve come a long way from just a micro ISV with six people and working in a small home-office and limited facility, to this comfy office and good facility. If you’d like to taste it, come and join to DyCode.

     

    New Logo

    For past three years, DyCode has used the same logo. It’s very simple logo, I admit. I recall one day I delivered a training, a trainee asked me, “your company’s logo is just like that, sir?”. “Well, yes”, I answered.

    DyCode Logo Ver 2 - 070508 200px

    Glass effect was a trend at that time, so we adopted it. I’m sure we remember Vista used glass effect all over the place. The simple butterfly-like wireframe in the middle is actually the result of combining characters “D” and “C”, as the first characters of “Dy” and “Code”. Those “D” and “C” characters are not coming form English alphabet, instead, they are Futhorc, a runic alphabet used by Anglo-Saxons. The fusion of those two characters are illustrated below. The fusion result is then skewed and given a glass effect, and there you go, DyCode logo. We deliberately made the logo looked like a butterfly, as some of DyCode’s nature are inspired by butterfly.

    image

    As the time goes by, we realized that the initial logo was not appropriate anymore. Not only because the artwork seems old-fashioned and rigid, but it’s also our need to more express our dynamism and spirit. As implied in DyCode’s name, we need to keep changing and adapt to the change. And here it is, I proudly and officially announce the DyCode’s new logo:

    dycode logo & name-1000

    So, what’s the meaning? I copy-paste the description from its designer (thanks to Ms. Gina):

    • Logo perusahaan PT. Dycode Cominfotech Development menggambarkan kombinasi dari dua huruf yang merupakan inisial dari nama perusahaan, yaitu huruf D dan C, yang menyerupai simbol “infinity” yang memiliki sifat dinamis dan tak terhingga.
    • Segitiga di bagian kanan logo, yang menyerupai tanda panah merepresentasikan sifat dinamis, sesuai dengan slogan perusahaan "Dynamic IT Solution For Optimal Business Value" . 
    • Kemudian sifat tak terhingga / tak berbatas dalam simbol infinity mewakilkan tidak adanya batasan bagi perusahaan dalam terus mengikuti perkembangan teknologi yang terbaru sebagai perusahaan IT (inovatif).  
    • Dua garis yang disatukan sehingga menyerupai simbol tak terhingga dengan ujung-ujung yang melengkung (bulat) dan tak terputus, melambangkan pelayanan (memberi dan menerima), sesuai dengan motto perusahaan: Take Enough, Give More.

    Arti Warna

    Penggunaan warna pada logo PT. Dycode Cominfotech Development  mengandung arti psikologis sebagai berikut :

    • 1. Biru laut (Cyan: 0095ef) melambangkan sifat yang teguh, kokoh, kepercayaan, konservatif, keamanan dan teknologi.
    • 2. Hijau Daun (Green: 77e148) melambangkan pembaruan.
    • 3. Gradasi warna dari biru ke hijau: melambangkan adanya pembauran dan perpaduan dari arti kedua warna tersebut.

    Secara keseluruhan warna-warna pada logo mengandung arti bahwa selalu memberikan pelayanan yang dinamis, matang, dan sesuai kebutuhan solusi TI untuk mengoptimalkan nilai bisnis klien, serta selalu mengutamakan kepercayaan dan keamanan. Hal tersebut akan dicapai dengan pembelajaran secara dinamis, berinovasi, dan terdepan dalam penggunaan teknologi terbaru.

     

    I know what you’re thinking. You may think that the logo is similar to Visual Studio 2010 logo. Well, off course they are different in every aspects, except the “infinity” concept is similar. I don’t know what’s the relation between “infinity” and VS2010, but for DyCode, “infinity” concept is related to DyCode’s main value which is “dynamic”.

    By the way, we’ve registered the logo to Ditjen HKI, Departemen Hukum dan HAM (Law and Human Right Department of Indonesia). Wait for one year or more before it’s legally registered.

     

    So that’s all I can tell in this post. Once again, Happy 3rd Birthday to DyCode. As Vulcan always salutes (and Norman as well :P), “Live long and prosper”.

    There are more new stuffs from DyCode. I’ll tell about them in another posts.

    Share this post: | | | |
  • Stsadm –o restore: Access to the path is denied

    Mungkin ini barang lama dan baru ngalamin barusan. When I try to restore SharePoint 2010 backup file to a site collection, I got an error.

    C:\>stsadm -o restore -url http://MySharePointBox:1234 -filename MyBackup.bak -overwrite 

    Access to the path 'C:\MyBackup.bak' is denied.

    Oopss..what the heck?

    Turns out, the solution is very easy. From Windows Explorer, right click to the backup file, click Properties. Turn off Read-only (as shown below). It works for me!.

    image

    Good luck!

    Share this post: | | | |
  • Larry Ellison, Cameo on Iron Man 2

    Yes, you read it right. Just watched Iron Man 2 tonight, nonton bareng sekantor (jarang-jarang ada kantor yang memfasilitasi nonton bareng sekantor, bareng CEO pula :P). Pas Tony Stark sedang jalan dan turun tangga, dia ketemu Larry Ellison. Yes, that Larry Ellison, CEO of Oracle. Gak lama kemudian Tony ketemu another Larry, Larry King.

    Nama Larry Ellison bahkan muncul di credits film Iron Man 2, read here: http://www.imdb.com/title/tt1228705/fullcredits#cast. Some people even believe that Iron Man persona is inspired by Larry Ellison, as can be read here and here.

    I wish there’re cameos from another techie, Steve Jobs may be…

    Just an "iseng" post after my two serious previous posts :)

    Share this post: | | | |
More Posts Next page »