drupal hit counter
Jerry Huang | All posts by jerry

Jerry Huang apps and developing apps

Smart Dial Agent update

18. April 2011 01:51 by Jerry in Smart Dial

For today's update, the Import function supports directly download all contacts from Gmail, no longer need to export to CSV file.Laughing

Working on direct export Live's contacts...looks like much harderInnocent

Smart Dial published

16. April 2011 10:31 by Jerry in Smart Dial

- search contacts by numbers, names and even Pinyin for Chinese characters;
- define the candidate keyword of each contact by yourself
- numbers in each result contact are sorted by best match
- edit before call/SMS and pre-stored prefix
- sync your contacts between your phone and computers

go here for details: http://www.jerryhuang.net/page/Smart-Dial.aspx

How to export contacts from Gmail

16. April 2011 00:08 by Jerry in Smart Dial

1) logon with your gmail ID on www.gmail.com, and click "Contacts"

2)click "More actions" and select "Export"

3) Choose "All contacts" and "Outlook CSV" format. It's not a must, but if you choose Outlook format you will able to use the default "Windows Live" srouce type for data conversion later on. Then click "Export"

 

4) click "Save", done.

How to export your Live contacts

15. April 2011 23:52 by Jerry in Smart Dial

1) login www.hotmail.com with your Live ID, and then click "Contacts"

 

2) click "Manage" and choose "Export"

3) input the urgly stupid 8 digit characters as it shown, then click "Export"

 

4) wait for a while (sometimes it needs a few minutes if you have many contacts and your network connection happed to be slow), you will see a download dialog, click "Save" to store the folder to your computer, "My documents" would be a nice choice. Sorry for the screenshot has to be Chinese. I don't have an english Windows on hand. Probably a good start for learning Chinese, lol

Serializing image in WP7

15. April 2011 03:23 by Jerry in Windows Phone Development

This post is to celebrate my 2nd app - Smart Dial has been approved in marketplace.

None of the build in imaging classes in Windows Phone or Silverlight is serializable, that's why I have to build my own class.Cool

To serialize a custom object, the class need to implement IXmlSerializable interface. So my class inherits BitmapSource and then implement IXmlSerializable.

The idea of the whole thing is actually pretty simple. Just covert the image into byte array, and then transform to Base64 string, and backward for deserialization. With such approach, we are able to ship the image within XML(i.e. pure text). This is how my app (Smart Dial) to transfer contact photos between WP7 and server.

 Since my Smart Dial solution consists 2 client programs in handset device and desktop computer, I made the class compatible with both silverlight (WP7) and Winform (base on .Net 3.5). However, somehow I can't load the image source to itself in winform version. The BitmapSource in winform doesn't contain the SetSource method, I have use a stupid property (Source).

Simply copy and paste and compile and enjoyLaughing

[code language=C#]   

using System;
using System.Windows;
using System.Xml.Serialization;
using System.IO;
using System.Windows.Media.Imaging;
using System.Xml.Schema;
using System.Xml;
 #if !SILVERLIGHT
using System.Drawing;
#endif
namespace SmartDial.Data
{

    public class SerializableImage : BitmapSource, IXmlSerializable
    {
 #if SILVERLIGHT
        private string ImageToString(BitmapSource image)
#else
        private string ImageToString(Bitmap image)
#endif
        {
           
            byte[] byteArray;

            using (MemoryStream stream = new MemoryStream())
            {
 #if SILVERLIGHT
                WriteableBitmap bmp = new WriteableBitmap((BitmapSource)image);
                bmp.SaveJpeg(stream, bmp.PixelWidth, bmp.PixelHeight, 0, 100);
                byteArray = stream.ToArray();
#else
                image.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);
                stream.Flush();
                byteArray = stream.ToArray();
#endif
              
            }

            return Convert.ToBase64String(byteArray);
        }
        public SerializableImage() { }
 #if SILVERLIGHT
       
        public SerializableImage(Uri uri)
        {

            using (Stream stream = Application.GetResourceStream(uri).Stream)
            {
                this.SetSource(stream);
            }
        }

#else
        public SerializableImage(Image image)
        {
            this.Source = (Bitmap)image;
        }
        protected override Freezable CreateInstanceCore() { return new SerializableImage(); }
        public Bitmap Source { get;  set; }
#endif

        private void StringToImage(string imageString)
        {
            if (imageString == null)
                throw new ArgumentNullException("imageString");

            byte[] array = Convert.FromBase64String(imageString);
 #if SILVERLIGHT
            this.SetSource (new MemoryStream(array));
#else
            Source = (Bitmap)Image.FromStream(new MemoryStream(array));
#endif
          

        }


        #region IXmlSerializable Members

        public XmlSchema GetSchema()
        {
            throw new NotImplementedException();
        }

        public void ReadXml(XmlReader reader)
        {


            if (reader.IsEmptyElement || !reader.Read())
            {
                return;
            }
            XmlSerializer imgSerializer = new XmlSerializer(typeof(string));
            while (reader.NodeType != XmlNodeType.EndElement)
            {
                reader.ReadStartElement("SerializedImage");

                string img = (string)imgSerializer.Deserialize(reader);
                reader.ReadEndElement();

                reader.MoveToContent();

                StringToImage(img);
            }
            reader.ReadEndElement();
        }

        public void WriteXml(XmlWriter writer)
        {
            XmlSerializer imgSerializer = new XmlSerializer(typeof(string));

            writer.WriteStartElement("SerializedImage");
 #if SILVERLIGHT
            string img = ImageToString( this);
#else
            string img = ImageToString(this.Source);
#endif
            imgSerializer.Serialize(writer, img);
            writer.WriteEndElement();

        }

        #endregion
    }
}

[/code]

HD2: a tour to TOILET

9. April 2011 12:10 by Jerry in

the victim, naked...

the murderer, he is keep committing to crimes afterward BTW

still alive...yea, I knew, thanks to DFT...

coming back...

faith regained.

new feature in v1.4

6. April 2011 03:03 by Jerry in IP CAM

The new 1.4 version ships with a feature: upload / download your camera config files to/from server.

In the Setup screen, click the expand button at application bar (the "..." at right down corner), then click the "upload/download camera", enjoy! Laughing

My first app on Windows Marketplace now

17. March 2011 20:21 by Jerry in IP CAM

Finally, my first Windows Phone 7 application published!Laughing 

Search "ip cam control" in the Marketplace with your Windows Phone device!!

At the end of below page, I provided a windows version to test if my app compatible with your camera. Please have a try if you are interested.

more detail...

 

DbMoto comments and experience

3. September 2010 13:00 by Jerry in Product Experience

The previous blog I wrote last night is something about DbMoto. Today I found that my feeling is a bit more than that, so I list out the summary how I feel after using this product.

  1. It’s basically a good tool for syncalizing data from DB2 to SQL, in my case. Easy to setup and use comparing with some jumbo products. It provides a nice GUI tool to setup and manage replications.
  2. Not very good for real time change data capture, currently we set the interval to 30 minutes, i.e. data will sync from DB2 to SQL every 30 minutes. There was a time we set to 5 minute but it seems there were some problems. I am not sure about the detail (I'm not in the AS400 team), what I heard fromt my colleague is that the receiver in AS400 caused the CPU overran.
  3. The product and the company have a long history and the market share is growing. The support is ok; so far they solved all problems we hit, as I can remember.
  4. I believe the engine is base on .Net framework 2.0, so it needs to run on a Windows server. This is ok for us but some people insist the performance is better if a product is base on non-Microsoft server.
  5. Very good extensibility, we can write our own script into the replication. We are using VB.NET as script language, but I guess it also supports other .NET languages. The script will be compiled to .NET binary code so the efficiency will be better than those dynamically compile.
  6. Scripting is good but also brings the biggest problem – there is no way to debug the script in development. What we are doing now, is to write log for debugging. For development, ideally we hope the dbmoto engine somehow can call into Visual Studio so that we may set breakpoint, watch the value of local variables, etc. Due to this, we avoid to put something too complicated in the scripts.

Overall, I will say dbmoto is a light-weight to medium change data capture engine, to keep 2 different databases identical. If your requirement is not about some sort of comprehensive ETL solution, just to sync data from one place to another, DbMoto should be a good tool for that. However, it might not suit for you if require extremely low latency (i.e real time) syncalization. Hmmm, but real-time is a big challenge for all products.