in

dotnet.org.za

South African .NET Developer Portal

The Bumpy Blog

Bumpy's Bedside Story
  • Microsoft Remote Differential Compression - RDC with Server 2003

    The RDC Service has been introduced since Server 2003 according Microsoft.
    Now to explain myself.  I always try to sort problems out myself, but I must admit.  I am really stumped and seriously running out of time.
    This is where I call on the developer community for anyone that can help me.

    I started at this company taking over some applications that I would have done very differently.  But, I need some way out.
    The one application needs to update clients with new versions of data files.  These files contains data dating back to 1995.
    Now these files total to about 5GB of data.
    Each client has specific software that reads these datafiles and reports can be generated from this.

    My little application has to query the server, find out if the user has permissions to get the specific files and then start download any new versions of these files.
    I say new versions, because the server application that generates these files, do so by creating the new version file and then also by creating a binary difference between the new and older version of the file.

    These difference files are then normally very small in comparison with the original file.  Now this sort of works, but the requirements has changed to now deliver even bigger files.
    One specific file is a access db to about 100Mb in size.  This is where this is not feasible anymore.

    After searching for a more appropriate method, I found this article on MSDN and think this is my answer.

    Now, as far as I can see, it is only really incorporated into Vista and Server 2008, but has been introduced to Server 2003.
    My question is this.  Can it be used on Server 2003 and can I write a client application that incorporates this to run on Windows XP and beyond.

    And above all...  Is there anyone that can provide some sample code on this if it is possible.

    Oh, BTW.  The ONLY reason I am trying to cut corners is because I am totally out of time.

  • Google's Deal with Dell a Blow to Microsoft

    I found this article and it makes one think whether or not google is small fry or actually being opposition for microsoft.

    While Yahoo! was busy putting the finishing touches to its new co-operation with eBay, Google has not been idle, but has clinched a spectacular deal of its own.

    As announced last Thursday, Google and Dell have agreed to a trial that will see Dell pre-install a suite of Google software onto each PC before it leaves their factories. The software package will include the Google toolbar, a pre-set Dell-Google co-branded homepage and search applications for desktop and email search.

    Google's CEO Eric Schmidt indicated that this was only the start of the co-operation between Dell and Google, with more agreements still to come.

    For Microsoft, this could be a significant blow. The company knows exactly how effective pre-installation of software is in increasing market share - they did exactly the same when they bundled Internet Explorer with the Microsoft Office packages and crushed Netscape in the now legendary browser wars. The strategy is effective because computer users tend to be fairly passive and leave pre-installed desktop preferences exactly as they are when they unpack their new computer or laptop.

    The Dell deal means that Google is able to influence user habits even before they go online for the first time, which is something they haven't been able to do up to now. And with how many users can Google get a foot in the door early? Well, industry speculation has it that the deal could cover up to 100 million computers!

    powered by IMHO 1.3

    Posted May 31 2006, 12:40 PM by deonvs with no comments
    Filed under:
  • Creating Thumbnails on the fly

    Haven't been blogging now for awhile.  Been doing a few websites for pocket money and some free ones.
    The last free one I did was for the Christian Motorcyclists Association.  They gave me photo's (by the hundreds) of sizes ranging from 1Mb to 5Mb in size.  I needed to create a gallery and I wasn't feeling up to creating thumbnails for every image. 

    I looked around for some code and found a way to resize the images to 300px width and about 300kb in size.  That was still way to big for a way too little pixel size / quality.  After some time of playing around I got to this.  It works great. 
    Have a look at it http://www.cmasa.org.za/gallery.aspx?IF=events/memorialrun/2005/images.

    So...  Whats the code:
    To get the thumbnails, I just set a parameter "IF" - Image Folder, when calling gallery.aspx:

            private void Page_Load(object sender, System.EventArgs e)
            {
                System.Text.StringBuilder sb = 
    new System.Text.StringBuilder();
                
    if (!this.IsPostBack)
                {
                    
    string imagefolder = "images/";
                    
    int _page = 1;

                    
    if (Request["IF"] != null)
                        imagefolder = Request["IF"].ToString();
                    
    if (Request["P"] != null)
                        _page = Convert.ToInt32(Request["P"]);

                    
    string[] files =
    System.IO.Directory.GetFiles(Server.MapPath(imagefolder));
                    sb.Append("<br>&nbsp;&nbsp;");
                    
    int cnt = 0;

                    
    int interval = 25;
                    
    int start = (_page - 1) * interval;
                    
    int stop = start + interval;
                    
    if (start >= files.Length) start = 0;
                    
    if (stop >= files.Length) stop = files.Length - 1;

                    
    for (int lp = start; lp < stop; lp++)
                    {
                        
    if (files[lp].ToLower().IndexOf(".lck") == -1)
                            
    if ((files[lp].ToLower().IndexOf(".jpg") > -1)
    || (files[lp].ToLower().IndexOf(".jpeg") > -1) || (files[lp].ToLower().IndexOf(".gif") > -1)
    || (files[lp].ToLower().IndexOf(".bmp") > -1))
                            {
                                
    // Calling getimage.aspx with Thumbnail width of 100px
                                
    sb.Append("<img src=\"getimage.aspx?f=" + imagefolder + "/"
    + files[lp].Substring(files[lp].LastIndexOf("\\") + 1)
     + "&w=100\" alt=\"Click image to enlarge\" border=\"0\" onClick=\"return enlarge('"
    + imagefolder + "/" + files[lp].Substring(files[lp].LastIndexOf("\\")
     + 1) + "',event,'center',500,453)\">&nbsp;&nbsp;");
                                cnt++;

                                
    if (cnt == 5)
                                {
                                    cnt = 0;
                                    sb.Append("<br>&nbsp;&nbsp;");
                                }
                            }
                    }
                    Double validator = (Double)files.Length / (Double)interval;

                    sb.Append("<br><strong>Page: [</strong>");
                    
    if (_page > 1)
                        sb.Append("&nbsp<a href=\"gallery.aspx?IF="
    + imagefolder + "&amp;P=" + Convert.ToString(_page - 1) + "\">&lt;&lt;</a>");
                    
    else
                        
    sb.Append("&nbsp&lt;&lt;");
                    
    for (int lp = 0; lp < Math.Ceiling(validator); lp++)
                    {
                        
    if (_page == lp + 1)
                            sb.Append("&nbsp" + Convert.ToString(lp + 1));
                        
    else
                            
    sb.Append("&nbsp<a href=\"gallery.aspx?IF="
    + imagefolder + "&amp;P="
    + Convert.ToString(lp + 1) + "\">" + Convert.ToString(lp + 1) + "</a>");
                    }
                    
    if (_page < Math.Ceiling(validator))
                        sb.Append("&nbsp<a href=\"gallery.aspx?IF="
    + imagefolder + "&amp;P="
    + Convert.ToString(_page + 1) + "\">&gt;&gt;</a>");
                    
    else
                        
    sb.Append("&nbsp&gt;&gt;");

                    sb.Append("<strong>]</strong><br><br>");
                    litImages.Text = sb.ToString();
                }
            }

            
    private System.Drawing.Image ResizeImage(string file, int width)
            {
                
    int factor = 2;
                System.Drawing.Image original = System.Drawing.Image.FromFile(file);
                factor = original.Width / width;

                Size nSize = 
    new Size(original.Width / factor, original.Height / factor);
                
    return ResizeImage(file, nSize);

            }
            
    private System.Drawing.Image ResizeImage(string file, Size nSize)
            {
                System.Drawing.Image original = System.Drawing.Image.FromFile(file);
                System.Drawing.Image gdi = 
    new Bitmap(nSize.Width, nSize.Height);
                Graphics grfx = Graphics.FromImage(gdi);

                grfx.InterpolationMode = InterpolationMode.HighQualityBicubic;
                grfx.DrawImage(original,
                    
    new Rectangle(new Point(0, 0), nSize),
    new 
    Rectangle(new Point(0, 0), original.Size),
                    GraphicsUnit.Pixel);

                grfx.Dispose();
                
    return gdi;
            }

    This then calls the getimage.aspx with a W param to indicate the width of the thumbnail.

            private void Page_Load(object sender, System.EventArgs e)
            {
                
    string file = Request["f"];
                
    int width = int.Parse(Request["w"]);

                Response.ContentType = "image/jpeg";

                FileStream fs = File.OpenRead(Server.MapPath(file));
                BinaryReader br = 
    new BinaryReader(fs);
                                
                
    byte[] imgbytes = new byte[fs.Length];
                imgbytes = br.ReadBytes(imgbytes.Length);

                ImageConverter ic = 
    new ImageConverter();
                System.Drawing.Image img = (System.Drawing.Image)ic.ConvertFrom(imgbytes);

                
                Decimal picwidth = img.Width;
                Decimal finalwidth = width;
                Decimal tmp = finalwidth / picwidth;
                                
                
    int picHeight = (int)((Decimal)img.Height * tmp);

                
    if (picHeight > finalwidth)
                {
                    
    // Image is Portrait
                    
    img.RotateFlip(RotateFlipType.Rotate90FlipNone);

                    picwidth = img.Width;
                    finalwidth = width;
                    tmp = finalwidth / picwidth;
                                
                    picHeight = (
    int)((Decimal)img.Height * tmp);
                }

                System.Drawing.Image thumbnailImage = img.GetThumbnailImage((
    int)finalwidth, picHeight,
    new 
    System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero);

                Graphics oGraphic =  Graphics.FromImage(thumbnailImage);

                oGraphic.CompositingQuality = CompositingQuality.HighQuality ;

                oGraphic.SmoothingMode = SmoothingMode.HighQuality ;

                oGraphic.InterpolationMode = InterpolationMode.HighQualityBicubic ;

                Rectangle oRectangle = 
    new Rectangle(0, 0, (int)finalwidth, picHeight);

                oGraphic.DrawImage(img, oRectangle);

                MemoryStream imageStream = 
    new MemoryStream();
                thumbnailImage.Save(imageStream, System.Drawing.Imaging.ImageFormat.Jpeg);
                
    // make byte array the same size as the image
                
    byte[] imageContent = new Byte[imageStream.Length];
                
    // rewind the memory stream
                
    imageStream.Position = 0;
                
    // load the byte array with the image
                
    imageStream.Read(imageContent, 0, (int)imageStream.Length);


                br.Close();
                
    //byte[] bytes = System.Text.ASCIIEncoding.ASCII.GetBytes(DATA);
                
    Response.BinaryWrite(imageContent);
                
            }

    I think it works pretty nice.  The major breakthrough came when I did this:

                System.Drawing.Image thumbnailImage = img.GetThumbnailImage((int)finalwidth, picHeight,
    new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero);

                Graphics oGraphic =  Graphics.FromImage(thumbnailImage);

                oGraphic.CompositingQuality = CompositingQuality.HighQuality ;

                oGraphic.SmoothingMode = SmoothingMode.HighQuality ;

                oGraphic.InterpolationMode = InterpolationMode.HighQualityBicubic ;

                Rectangle oRectangle = 
    new Rectangle(0, 0, (int)finalwidth, picHeight);

                oGraphic.DrawImage(img, oRectangle);

    This made the same image go from the 2Mb image to a 700px width image with a filesize of 50Kb.
    I then take this 50kb file and make a thumbnail with the same code and get a 1 - 3 kb file to display.

    powered by IMHO 1.3

  • Mobile content sites!!!

    There are so many different sites out there to get mobile content from.  But the question is which one is the best?
    I would like to find out what others think?

    Here is a list of different sites to look at, what do you think?
    www.exposure.co.za
    www.polyphonic-ringtones.co.za
    www.funkyphone.co.za
    www.funkyfone.co.za
    www.eggmobile.co.za

    There are plenty of sites out there...  Comment on speed, ease off use, price and whatever else bothers you.

    Posted Jul 19 2005, 01:25 PM by deonvs with 5 comment(s)
    Filed under:
  • What is happening with the SNO (Second National Operator) and ADSL Broadband?

    "Recent DOC (Department of Communication) discussions on lowering telecommunication costs in South Africa has failed to convince broadband users on the MyADSL website that they will indeed be able to reduce prices."

    Also read this previous post:
    http://mybroadband.co.za/nephp/?m=show&id=477

    Taken from MyADSL.  Interesting read. Makes you wonder what is going on?!?

    Posted Jul 19 2005, 07:30 AM by deonvs with no comments
    Filed under:
  • Help out a friend???

    My friend Rolf sent me this!  How about you click here.  I'll bet you that you will even enter  the competition:

    "Heya,

    Please click on this link as it increases my chance of getting drawn.  You don’t have to sign up or anything – just a counter.

    http://www.eaplay.com/newzealand/promotions/nzlaunchpromotion/?entry_id=7089

    Thanks for that.  See if you can send it to some other friends who would be willing to help out.

    Cheers
    Rolf"

    powered by IMHO

    Posted Mar 20 2005, 09:56 AM by deonvs with no comments
    Filed under:
  • The history of South Africa is Unchangeble

    My partner and I had a discussion today about how patriotic the Americans are.  Too be totally honest, I envy them.  I then started to think about things that we can be patriotic about.  I live in Pretoria and therefor I immediately started to think about the Voortrekker Monument.  This is truly an amazing building.

    Then I started to think about time that has come and gone and how young our country really are.  I started looking at some sites about this magnificent Monument and read about what it stands for.

    I found an article that really made me wonder how anyone can publish such a load of rubbish about the history of our country.  Finally I came to the part where the author's name was mentioned and...  ALAS!!!  The answer to this question came to mind...   It is one of the poor sods of either FAR-LEFT or FAR-RIGHT wing dingbats that still try to clamp on things that happened in the times of my great-grand parents.

    Come on people.  Isn't it just about time to recover from all the crap that our fore-fathers dropped in our heads.  Isn't it just about time to move on...

    powered by IMHO

    Posted Feb 18 2005, 01:58 PM by deonvs with 2 comment(s)
    Filed under:
  • I am proud to announce!!!!

    Well. 
    If anyone wanted to know where I was the last few weeks.  I WAS BUSY!!!!  :)

    I was creating my latest site!   www.holidaytraveler.co.za .  I really enjoyed creating it and would like to know what you think about it?
    Let me know

  • Nerd Score!

    Well, I suppose this has to mean something!!!

    I am nerdier than 35% of all people. Are you nerdier? Click here to find out!

    Not that I really care or anything, :(

      powered by IMHO

    Posted Jan 06 2005, 10:59 AM by deonvs with no comments
    Filed under:
  • IMHO - Whaaaooooo!!!!

    Just tried it myself...  I must say, this makes life a lot easier.
    Hopefully now I will blog a bit more.  The biggest reason I never blog is because I have to log in and click around a few times before actually typing anything.

    Thanks Armand for blogging about this.

    powered by IMHO

    Posted Jan 04 2005, 11:36 PM by deonvs with no comments
    Filed under:
  • Unbelievable!!! What will they think of next?

    I cannot believe there are games like these on the internet.  Can anybody explain to me why???

    But my best is 801 mph...  :)  Check it out!

     

    Posted Nov 19 2004, 02:37 PM by deonvs with 2 comment(s)
    Filed under:
  • Prawns... ?? Anyone?

    A colleague of mine brought in to the office the first “Parkie” for the rainy season.  The was just to show the Pretoria guys what it looks like.  Luckily I did stay in the northern suburbs before, so I wasn't entirely surprised, but I have to admit...

    It is still one of the more UGLY insects alive,  but truly a Jo'Burg trademark.

    Enjoy!!!

    Posted Nov 19 2004, 10:49 AM by deonvs with no comments
    Filed under:
  • ASP.NET 2.0 UPDATE - Amazing

    I read this from Scotts blog.  I am glad that I am not working on such a use project.  Take a look at what they go through to do some tests.

  • 6 GMail accounts available

    I have 6 GMail accounts available.  First 6 requests gets it.
    Posted Oct 11 2004, 03:39 PM by deonvs with 9 comment(s)
    Filed under:
  • JetBrains Omea is best

    Anyone still in doubt??  Read this review.  Still on the BETA, but you get the idea.  Try it.
    Posted Oct 07 2004, 03:16 PM by deonvs with no comments
    Filed under:
More Posts Next page »
Powered by Community Server (Commercial Edition), by Telligent Systems