jqDialogForms: v1.1 Released And New Samples Posted

by Jon Davis 27. January 2009 23:30

I've updated jqDialogForms to v1.1. Watch this space: http://www.jondavis.net/codeprojects/jqDialogForms/

It is no longer a placeholder URL that points back to my blog post, it's an actual page dedicated to the library, with some basic samples already in place. I still need to add more samples and documentation such as the default options, all of which I plan on doing this weekend, but at least there's finally something there. 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Web Development

Old News: Ajaxian Javascript/AJAX Educational Videos

by Jon Davis 26. January 2009 00:14

Ajaxian has been hosting some conferences, called The AJAX Experience, that are akin to Microsoft’s MIX but for the open source / non-Microsoft crowd, primarily the AJAX crowd.

Some rather advanced videos showed up a while back.

http://ajaxian.com/archives/more-ajax-experience-videos-json-and-javascript

Looks like some really good stuff on hardcore JavaScript.

Then there are Performance and Security bits:

http://ajaxian.com/archives/ajax-experience-videos-performance-and-security

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Fantastic jQuery Tips

by Jon Davis 25. January 2009 23:35

StumbledUpon this list of “25 Excellent Tips” for jQuery.

http://www.tvidesign.co.uk/blog/improve-your-jquery-25-excellent-tips.aspx

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

EntitySpaces 2009 Q1 WCF Demo

by Jon Davis 25. January 2009 16:45

I created a new WCF demo for EntitySpaces, one of the most popular ORM solutions available for .NET which now comes with its own code generator (no longer relies on CodeSmith or myGeneration). The demo is bundled in the Release Candidate for v2009 Q1. (The developer version is released, trial version will be released tomorrow.) This one includes both console and Windows Forms clients, and a console-based service, for showing the barebones basics of what it takes to get EntitySpaces working with WCF. Both full proxies (EntitySpaces runtime libraries referenced on the client) and lightweight proxies/stubs (*no* EntitySpaces runtime libraries referenced on the client) are demonstrated, but the lightweight demo is currently limited to a console app.

Next on my plate will be a WPF demo for the lightweight proxies/stubs. No guarantees...

Anyway, here’s the documentation that went with the demo. It got posted on the EntitySpaces blog.

http://www.entityspaces.net/blog/2009/01/25/EntitySpaces+2009+And+WCF.aspx

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

C# | Cool Tools | Pet Projects | Software Development | SQL Server | WCF

Linux Mint FAIL

by Jon Davis 25. January 2009 14:02

I wanted to see what this Linux Mint (an “elegant” flavor of Ubuntu) was all about. It froze up on me on first boot while setting up. After asking if I wanted a root password it asked if I wanted to enable Fortunes—a “funny quotes” application. This was the first time an OS ever asked me to enable a “funny quotes” application, perhaps because it’s one of the most non-elegant non-trends in computing.

But what’s sad is that when I clicked on Show An Example a couple times, the whole virtual machine froze up.

This is the elegant OS people rave about? This is the best Linux proponents can do? This is sad.

LinuxMint_FAIL
Click to view

Tags: ,

XmlSerialized<T> and BinarySerialized<T>

by Jon Davis 21. January 2009 20:46

Here are a couple classes that I threw together for web services and WCF usage where the client is using the same data class library as the server. Microsoft auto-serializes stuff, but when serializing explicitly I prefer to retain an explicit type reference rather passing and manually deserializing a string or byte array. In other words, if I see a web service API return a string or byte[] as an XML or binary serialization of a complex class, I get cranky, because the client should know, without having to use external documentation, how the deserialization is type-mapped.

I'm sure there are a bunch of other uses for these, like saving an object graph to disk in two lines of code, etc. In fact, I'm also using XmlSerialized<T> to convert one compatible object type (full) to another object type (lightweight) and back again.

Being as these were indeed thrown together, I give no guarantees of anything. They worked for me.

Scenario:

// take ..
public string GetMyObject() {
	var myObject = new MyType();
	var sw = new System.IO.StringWriter();
	var serializer = new XmlSerializer(typeof(MyType));
	serializer.Serialize(sw, myObject);
	return sw.ToString();
}
// .. which is a total pain to deserialize, 
// and replace it altogether with ..
public XmlSerialized<MyType> GetMyObject() {
	return new XmlSerialized<MyType>(new MyType());
}
// which can be deserialized either manually or "automagically"
// using .Deserialize().

Usage:

 

var myObject = new MyType();
// serialize to XML
var myXmlSerializedObject = new XmlSerialized<MyType>(myObject);
// preview the serialized value
string serializedValue = myXmlSerializedObject.SerializedValue;
// create it on the client
myXmlSerializedObject = new XmlSerialized<MyType>(serializedValue);
// and deserialized back to POCO
var myObjectAgain = myXmlSerializedObject.Deserialize();

// binary-serialized and compressed (slower CPU, smaller footprint)
var myBinarySerializedObject = new BinarySerialized<MyType>(myObject, true);
byte[] binaryValue = myBinarySerializedObject.SerializedValue;
bool is_it_compressed = myBinarySerializedObject.IsCompressed;
myObjectAgain = myBinarySerializedObject.Deserialize();
// uncompressed (faster CPU, larger footprint)
var myUncompressedSerializedObject = new BinarySerialized<MyType>(myObject, false);
byte[] uncompressedBinaryValue = myUncompressedBinarySerializedObject.SerializedValue;
is_it_compressed = myBinarySerializedObject.IsCompressed;
myObjectAgain = myUncompressedBinarySerializedObject.Deserialize();

 

The classes:

 

[Serializable]
[DataContract]
public class XmlSerialized<T>
{
    public XmlSerialized() { }
    public XmlSerialized(string serializedValue)
    {
        this.SerializedValue = serializedValue;
    }
    public XmlSerialized(T value)
    {
        Stream stream = new MemoryStream();
        Serializer.Serialize(stream, value);
        stream.Seek(0, SeekOrigin.Begin);
        StreamReader sr = new StreamReader(stream);
        this.SerializedValue = sr.ReadToEnd();
        sr.Close();
        stream.Close();
    }

    [System.Xml.Serialization.XmlIgnore]
    private string _serializedValue = null;
    [System.Xml.Serialization.XmlElement]
    [DataMember]
    public string SerializedValue
    {
        get { return _serializedValue; }
        set { _serializedValue = value; }
    }

    public T Deserialize()
    {
        Stream s = new MemoryStream();
        StreamWriter sw = new StreamWriter(s);
        sw.Write(this.SerializedValue);
        sw.Flush();
        s.Seek(0, SeekOrigin.Begin);
        T value = (T)Serializer.Deserialize(s);
        return value;

    }

    private static XmlSerializer _Serializer = null;
    private static XmlSerializer Serializer
    {
        get
        {
            if (_Serializer == null) _Serializer = new XmlSerializer(typeof(T));
            return _Serializer;
        }
    }

    public virtual To_T ConvertTo<To_T>()
    {
        var toObj = new XmlSerialized<To_T>(this.SerializedValue);
        return toObj.Deserialize();
    }

    public virtual T ConvertFrom<FromT>(FromT obj)
    {
        var fromObj = new XmlSerialized<FromT>(obj);
        this.SerializedValue = fromObj.SerializedValue;
        return this.Deserialize();
    }

}

 

 

[Serializable]
[DataContract]
public class BinarySerialized<T>
{
    public bool IsCompressed { get; set; }
    public BinarySerialized(T value, bool compressed)
    {
        this.IsCompressed = compressed;
        var bf = new BinaryFormatter();
        var ms = new MemoryStream();
        bf.Serialize(ms, value);
        byte[] bytes = ms.ToArray();
        SerializedValue = compressed ? Compress(bytes) : bytes;
    }
    public BinarySerialized(T value)
        : this(value, true) {}
    public BinarySerialized(byte[] serializedValue)
    {
        this.SerializedValue = serializedValue;
    }
    public BinarySerialized() { }

    [DataMember]
    public byte[] SerializedValue { get; set; }

    public T Deserialize()
    {
        byte[] bytes = IsCompressed 
            ? Decompress(SerializedValue) 
            : SerializedValue;
        var ms = new MemoryStream(bytes);
        ms.Position = 0;
        var bf = new BinaryFormatter();
        T retval = (T)bf.Deserialize(ms);
        return retval;
    }

    protected virtual byte[] Compress(byte[] byteArray)
    {
        //Prepare for compress
        System.IO.MemoryStream ms = new System.IO.MemoryStream();
        System.IO.Compression.GZipStream sw = new System.IO.Compression.GZipStream(ms,
            System.IO.Compression.CompressionMode.Compress);

        //Compress
        sw.Write(byteArray, 0, byteArray.Length);
        sw.Flush();
        sw.Close();

        return ms.ToArray();
    }


    protected virtual byte[] Decompress(byte[] byteArray)
    {
        //Prepare for decompress
        var ms = new System.IO.MemoryStream(byteArray);
        ms.Position = 0;
        var sr = new System.IO.Compression.GZipStream(ms,
            System.IO.Compression.CompressionMode.Decompress);

        //Reset variable to collect uncompressed result
        int buffer_length = 100;
        byteArray = new byte[buffer_length];

        //Decompress
        int offset = 0;
        while (true)
        {
            if (offset + buffer_length > byteArray.Length)
            {
                byte[] newArray = new byte[offset + buffer_length];
                Array.Copy(byteArray, newArray, byteArray.Length);
                byteArray = newArray;
            }
            int rByte = sr.Read(byteArray, offset, buffer_length);
            if (rByte == 0)
            {
                byte[] retval = new byte[offset];
                Array.Copy(byteArray, retval, offset);
                byteArray = retval;
                break;
            }
            offset += rByte;
        }

        return byteArray;
    }
}

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

C# | Software Development

Two More Things About Windows 7

by Jon Davis 17. January 2009 04:44

I wanted to add two more early comments on my experience with Windows 7 so far.

  1. My favorite new feature of Windows 7 is the ability to take a normal / restored window and maximize it by just dragging it to the top of the screen and letting it dock. I can restore it in the same way, just drag the title bar off the top of the screen and it becomes restored again. And if I want it to fill the right half of the screen, I can dock it to the right, and likewise for the left side. WAY too handy, it's one of those things that makes you wonder, why haven't we been doing it that way for years?
  2. My new big fat pet peeve that makes me think someone at Microsoft is a little nutty and insane is the Virtual Store security "feature" that was implemented in Windows Server 2008 has ended up in Windows 7 as well. I cannot express enough how much I ABSOLUTELY HATE THIS HORRIBLE FEATURE.
    • To fix it now you need to open "Security Configuration Management" where you'll find Local Policies -> Security Options -> "Virtualize file and registry write failures to per-user locations" and disable the thing.

On a side note, in a previous blog entry I told a "story" about how I had to use an external USB-based DVD drive to install Windows because the IDE drive wasn't detected. Well, with everything installed I was still unable to use my built-in drive. I could dual-boot to Vista and use the same drive all day, so this is clearly a driver issue. And I know I'm not the only one with the problem; as Google reveals, it's one of the big well-known let-downs of the Windows 7 beta.

Windows 7 Beta first Impressions

by Jon Davis 14. January 2009 04:47

Everyone has already made Windows 7 first impression comments, but I had to see Windows 7 for myself, as I always do wth Windows pre-releases. So here are my first experiences. I tried the earlier PDC release, downloaded from a torrent, but I got an error after booting from the DVD saying that it could not locate an installer file.

Windows could not collect information for [OSImage] since the specified image file [install.wim] does not exist.

I chalked it up to a bad torrent download and tossed the copy.

Then Microsoft released Beta 1 this month. I tried downloading this torrent again, and the download was inturrupted. I tried to restore the download process and no seeds were found after hours. I found another torrent, and after about half a day and half-downloaded I realized Microsoft had actually released this version to the open public for anyone to download, so deleted that torrent and started download again, this time straight from Microsoft.

The next day, the download having been completed while I was sleeping, I burned it to DVD-RW and gave it a run. Guess what?

Windows could not collect information for [OSImage] since the specified image file [install.wim] does not exist.

Oh, poop. So the original download wasn't any more flawed on this part than this one is, it's something else.

I tried booting the DVD in VMWare on another PC, and it worked! Aha! It's a hardware problem, perhaps a DVD driver problem. My computer is only about one and a half years old, but the DVD drive is about four years old. I Googled around a bit for more information on this ridiculous error, and the only advice I could find were two suggestions:

  1. Some commented, "You probably found an old DVD-RW from behind a sofa. Use a new DVD-R and that'll fix it right up." Hm. Doubtful. I burned another DVD-RW (same brand, roughly the same condition) and this time I checked off the "Verify" option on my burner software, and it checked out. Still got the error. It was at this point that I tried it on VMWare, and it got past this error, so no, it's not a bad disc. I suppose it could have to do with the failure of the other drive, on the other PC, to read the disc, though. In other words, the drive might have failed, not the disc.
  2. Someone said, "I was using an old USB-attached DVD drive that the BIOS enabled me to boot the disc from, but after installing an IDE-based DVD drive in the actual computer the error went away." Well that stinks, because I'm using an IDE-based DVD drive, it's never given me any problems except that it often refuses to burn discs.

So I pondered, I'm leaning towards the #2 scenario as a clue, I know Microsoft was trying to thin down the core surface area in Windows 7 and I bet this is a lack of some drivers for my drive. But I wonder if "new" is the keyword here, not the form (IDE vs USB).

I just happened to have a external USB-based DVD drive I recently purchased at Amazon. USB, but new. Could it work? I ran to the back room and grabbed it, brought it back in, stretched it across the room to the outlet, configured the BIOS to boot from USB, and booted the Windows 7 DVD. I went to install and....... yes!! It got past the error.

So here's the first first impression: While I greatly appreciate Microsoft's attempt to slim down the core dependency set of Windows and its drivers set, in this area (CD/DVD drive support) they chopped off WAY too much. Perhaps driver support isn't the issue here, but if it is, this IS a bug. There are a LOT of people who were power users 4 years ago, who invested in the latest and greatest back then, and had no Windows version but XP, and were reluctant to switch to Vista because of the corners that Windows 7 rounded out. These years-old systems are more than adequate, surely, for Windows 7 performance-wise, but the CD/DVD drivers are right there along with USB subsystem and SATA as being most needed for success. Fix this, guys, this is a BUG, not a mere risky compromise (intentional droppage of legacy hardware support). Microsoft can't afford to lose THIS hardware.

I experienced no other hardware glitches, fortunately, and even my audio hardware was working, and the Aero experience working right from post-setup first boot. There was only one other hardware-related annoyance, and that is that my two monitors were backwards.. I had to mouse far to the right to access the left monitor. Yes, this is configurable with the Control Panel, but I got annoyed watching setup and dealing with dialog boxes, etc., while everything was backwards and the setup didn't have the Control Panel available to me. It would've been nice, I suppose, if there was one optional button during setup that brought up the Monitors dialog, but at least the Monitors dialog isn't accessed through the wholly inappropriately named (in Vista's time) "Personalization" dialog, which was SO ridiculously placed since monitor setup (resolution, monitor placement monitor drivers, color depth, etc) has little to nothing to do with personalization. Might as well rename Control Panel to "Personalizations".. but they got it, I'm glad.

The new Windows 7 is all about rounding off the corners and adding the polishing touches that Windows Vista only touched on and inspired.

  1. More ever-present Aero Glass experience, with lots of smooth animations and roll-overs.
  2. Explorer.exe got a huge overhaul with Aero and usability enhancements.
    • As is very well known, the ubiquitous taskbar that has been around through Windows 95, Windows NT 4, Windows 98, Windows ME, Windows NT, Windows 2000, Windows XP, Windows Server 2003, Windows Vista, and Windows Server 2008 (did I miss one somewhere? surely I did ..) is now no more. There is no longer a taskbar. There is a bar down there, but it's more like a "smartbar"; the Quick Launch toolbar and the taskbar have sorta merged. It's all very much inspired, no doubt, by the Mac OS X's dock, which frankly disgusts me. But so far I don't have a hatred of the Windows 7 smartbar thingmajig. I do very strongly believe that someone (i.e. Stardock), if not Microsoft themselves, will be pushing a "Windows Vista taskbar" as an add-on accessory to Windows 7, for those people who preferred it, as there is now a rather obvious market for it.
    • The awesome feature in the Windows Vista desktop compositing system that enabled Direct3D and high definition video to be managed in an already D3D desktop environment, advantages of which were only slightly touched upon by Windows key + Tab and taskbar mouseover tooltip previews, both showing these windows re-displayed in distorted, small form in realtime with no performance loss, has been expanded upon in Windows 7. I'm still discovering these, but the most obvious feature is the smartbar mouseover with Internet Explorer showing each tab and letting you pick a tab as it is rendered in real-time. I hope to find a lot more such scenarios
  3. Paint, Calculator, and Wordpad have finally been rewritten with an Office 2007 feel. We no longer have to puke on the Windows 95 versions. I didn't see if Notepad was replaced with something anywhere near the simplicity yet completeness of Notepad2. But I doubt Notepad was touched, which if not is a shame. But at least there's always Notepad2. *cough*
  4. In general, the things in Windows such as in the Control Panel that got moved around a lot in Vista and that everyone complained about, such as me complaining about Monitor settings showing up under stupid Personalization, have been rearranged again. Generally, things are just better and more thought out. Vista was a trial run in this matter, Windows 7 beta is just more thought through. There are still quirky "features" but nothing I've found so far that is just blaringly wrong. I do think that the personalization bits are now too broken apart but this might just be a style issue that needs some getting used to. Microsoft seems to be leaning more than before towards the Apple/Mozilla approach of pursuing minimalist options while burying advanced features down in an obvious "Advanced" click-trail. Themes are consolidated sets now, a little more like Win95 Plus! themes in the sense of consolidation, and not so much isolated background, color, and sound options. But those options as individual settings are still there. In fact, Sounds is now (finally) a personalization configuration, as it should be.
  5. You start off with a big fish. Literally. It's a nice painting (of a fish). But come on. It's a fish! I went to choose a different background image, and, while I could very possibly be mistaken, I think the number of background images you can choose from has been slashed by half since Vista, and the new offerings in the theme picker don't look as good. Boooo!
  6. Other people ran the numbers so I didnt do any testing, but the general consensus is that Windows 7 performs closer to Windows XP's performance than Windows Vista's performance. (Read: It's very performant.)
  7. The max system rating has been nudged up from 5.9 to 7.9. My score of 5.7 on Windows Vista went up to 5.9 in Windows 7... but given the max of 7.9 my year-and-a-half old PC is no longer 0.2 from ceiling. *sob*
  8. I was impressed that the color palettes across all themes, just like IE 8 beta on Vista, are way too bright. It's ugly and uncomfortable. It's not easily configurable to make darker, either.
  9. I haven't stressed Windows 7 yet with software to see how stable it is, but one of the first apps I downloaded was Google Chrome and that puked. All of Windows froze up while I was doing something else, too, but I don't remember what it was, and that sort of thing is something I'd expect from a Beta. 

I have one other complaint. Windows Vista and Office 2007 introduced some really nice glow animations on buttons. Windows 7 pushes the Office 2007 glow animations and transition animations everywhere. The new smartbar (taskbar replacement) has a really, really cool "you just clicked me!" gradient animation that is almost magical. It's nice, but the animations are so slow they're actually rather obnoxious. For example, in the new Calculator, if you simply hover over and click on a button, yeah, blue-gray turns amber, but mouse-away and it seems to take a full three or four seconds for it to animate back to the original color. It's artistically nice, but it's just too long, and I think it will be too distracting. It might actually produce some serious usability issues, fast-moving users are going to be forced to slow down because their "feedback loop" they're getting on the screen is going to all be just a big blur. I really don't like that. It's already making me a little nauseous. Weird huh.

I think Vista's close/maximize/minimize effects the animation timings just right in this matter. Office 2007 ribbon buttons were just over the edge in my taste (too slow), and I could be wrong but Windows 7 in various places feels like it tripled the Office 2007 animation timings (very, very slow).

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Computers and Internet | General Technology | Operating Systems

2 Corrections: LINQ *Can* Use POCO/SQL, and VB.NET *Doesn't* Suck

by Jon Davis 8. January 2009 21:17

Just a couple observations here.

1. LINQ *can* work with POCO/SQL.

A few (two or three?) posts ago, I complained that LINQ-to-SQL doesn't really "speak" SQL / ADO.NET, you're forced to use generated classes and a designer to work with the provider. Thus, if you want to avoid the designer and generated classes, you're forced to using plain old ADO.NET.

I am VERY happy to say that I need to go do more homework. LINQ-to-SQL does have POCO support, and in fact when reading this blog entry I realized that a week's worth of work on my pet project is garbage because it is exactly to detail what this blog seems to show that LINQ already designed it.

http://linqinaction.net/blogs/jwooley/archive/2008/06/11/linq-to-sql-s-support-for-poco.aspx 

Why does this matter? Because I believe that a business object should be database / provider / ORM agnostic. It should NEVER implement database code within itself, and it shouldn't even inherit an ORM library object. I would be willing to tack on attributes/markers that don't do anything except provide mapping cues for an external ORM.

But even attributes can be avoided, and in the above-linked article's case, avoiding them is suggested. (I don't agree with that, though, because some members are database-bound, sometimes they are not, sometimes they are named differently from the database table columns, etc.)  

2. VB.NET Actually Doesn't Suck

While I think the syntax of VB.NET is painful to look at, to say nothing of writing, I must say that I greatly admire the features that set it apart from C#. Before v2008 I didn't think they were enough. ("My"?! Come on! Even the Windows Vista team was smart enough to eliminate "My" verbiage from Windows. You're going the wrong way!)

But at a .NET users group meeting I attended a couple months ago, I noticed the profound value of v2008's integrated XML support. I'm not talking about just Dim xx = <myxml>..</myxml>. That in itself is incredibly impressive, no doubt. But what impresses me more is how you can bury such XML expressions in LINQ statements. Add on top of that the ASP-style templating that is supported with it; you can do this: Dim xx = <myxml><%=myXmlValue%></myxml> And even this: 

Dim xx = <myxml>
<% For Each x In y %>
    <x><%=x.stuff%></x>
<% Next %>
</myxml> 

I haven't validated that but that's what I understand it to offer. That demonstration doesn't say much until you see it in action... 

The blog link I mentioned above (under #1) has at the bottom of it a "crosspost" link, the recent article of which reminded me of this VB.NET functionality and made me realize that this really is something worth blogging about. And if I have to work with VB.NET in the future, so long as it is with .NET 3.5 / Visual Studio 2008, I shouldn't pass it up anymore. 

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Software Development | VB.NET

Javascript: Blur Technique

by Jon Davis 8. January 2009 11:10

Nevermind.

Ehm, click to see what I neverminded and then view comments

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Web Development


 

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

About the author

Jon Davis (aka "stimpy77") has been a programmer, developer, and consultant for web and Windows software solutions professionally since 1997, with experience ranging from OS and hardware support to DHTML programming to IIS/ASP web apps to Java network programming to Visual Basic applications to C# desktop apps.
 
Software in all forms is also his sole hobby, whether playing PC games or tinkering with programming them. "I was playing Defender on the Commodore 64," he reminisces, "when I decided at the age of 12 or so that I want to be a computer programmer when I grow up."

Jon was previously employed as a senior .NET developer at a very well-known Internet services company whom you're more likely than not to have directly done business with. However, this blog and all of jondavis.net have no affiliation with, and are not representative of, his former employer in any way.

Contact Me 


Tag cloud

Calendar

<<  May 2018  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

View posts in large calendar