Adam Zastawski

My Personal Blog

Cute Little LINQ Trick

Posted by Adam

My friend Jesse showed me a cool little technique for introspecting a string array using Linq. Of course I realize that there a ton more fascinating Linq tutorials out there but this one showed me just how sweeping the effects of Linq are.

I first thought that Linq was just a neat way of generating a provider based Data Access Layer. Now I know that Linq can come in handy in a much broader array of solutions.

   1:  string[] textKeys = { "str1", "str2", "str3", "str4", "str5"};
   2:   
   3:  if (textKeys.Contains("str1"))
   4:  {
   5:       //do something here 
   6:  }

As I learn more about LINQ I will try to add some posts that actually provide more real-world value.

 

P.S. You will need to have "using System.Linq;"  in your 'using' statements.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 4/21/2008 at 8:47 PM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (1) | Post RSSRSS comment feed

Office Style Menus in TIBCO General Interface

Posted by Adam

Recently I got into a 'Usability' debate about what sort of menus where better; 'Office Like' menus or basic drop-down fly-out menus with tool tips.  I was thinking about it and I started to wonder if it was even possible in my favorite AJAX web UI development environment (General Interface).

The answer is yes, of course, and there are a number of ways in which it could be accomplished.  I chose to try it by re-writing the XSL that is used to render the Menu GUI component. You will have to realize that GI is alien technology reverse engineered by time traveling browser ninjas and the XSL method is the one that I felt was the most elegant. It is not the easiest way I can think of.

I have to admit that this example is incomplete for two reasons:

  1. I don't have any real business case for implementing this at this time.  I am perfectly happy with the default menus for now.
  2. I am feeling very lazy tonight.

In the image below you will see an example of some of the menus in Office that I am talking about. They have a large graphical icon and two types of text, a bolded title and a non-bolded description.

image

Here is an example of the menus that I made by altering the default XSL for the menu component in GI.

image

  1. Copy the default XSL file from the GI runtime folder..(/JSX/xsl/jsxmenu.xsl) to the XSL folder under your current project.
  2. Alter the XSL file to show the menus the way you want them to.
  3. Then create an XML document using the GI 'Common Data Format' or CDF
    <data jsxid="jsxroot">
    <record jsxid="1" jsxtext="New" jsxtip="Tool Tip Here" jsxkeycode="ctrl+e" jsximg="images/paint_24.png" jsxexecute="alert('New Clicked');"/>
    <record jsxid="2" jsxtext="Open" jsxtip="Tool Tip Here also" jsximg="images/flag_24.png" jsxexecute="alert('Open Clicked');">
        <record jsxid="21" jsxtext="Open Sub 1" jsxtip="SubTip Here" jsxexecute="alert('Open Sub Clicked');"/>
    </record>
    <record jsxid="3" jsxtext="Save" jsxtip="Another Tool Tip here and this one is really lot of text." jsximg="images/foldr_24.png" jsxkeycode="ctrl+q" jsxexecute="alert('Save Clicked');"/>
    </data>

    Pay special attention to the 'jsximg', 'jsxexecute', 'jsxkeycode', and 'jsxtip' attributes. I chose to use the tool tip data as the description text. I could have used a custom attribute but I got lazy again.
  4. Apply the contents of this XML file to the 'XML String' property of the menu. You can also apply the path to this document in the 'XML URL' property but I am finding that the HOT KEYs (see jsxkeycode attribute) are not working when I do that. I have brought this up in the forum.
  5. I then copied some random icons into my local project and made sure the 'jsximg' attribute in the XML document was correct.

You can download the project and see what all was done to the XSL. Enjoy....

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 2/29/2008 at 11:41 PM
Tags: , ,
Categories: AJAX | RIA | Tibco - GI
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (2) | Post RSSRSS comment feed

Discovery BlogEngine Theme fixed

Posted by Adam

Thanks to Bert de Jager for pointing out a bug in the Discovery Theme. I just uploaded a fix for it. It was due to a collision between two portions of the page using the same CSS style. It was an easy fix, I am only sorry it took me so long to get to it.

You can download the theme here.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 2/3/2008 at 12:28 PM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

O'Reilly Maker is a blast.

Posted by Adam

This is a great little Internet toy. I had a go at Silverlight cuz it's annoying me right now.

http://www.oreillymaker.com/link/6852/silverlight/

http://www.oreillymaker.com/link/6856/web-20/

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 1/29/2008 at 12:18 AM
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Wild New Blog Engine Theme: Discovery

Posted by Adam

I found this Discovery theme on www.freecsstemplates.org and I thought it would make a great BlogEngine theme. I think I am going to take a break from BlogEngine themes for a while (not too long ;-). I am really not a designer and I fear that I just don't have the patience to monkey around in CSS for a few hours just to find out my work only looks good in IE and not in FireFox.

image

I have decided to put this theme out and then customize it for my blog. Here are some interesting notes about this theme:

  1. I thought it was too narrow so I widened it. To do so I needed to make the Cheetah picture longer. My Photoshop skillz are definitely lacking. I recommend you replace that picture with one of your own.
  2. The menu was originally styled incorrectly when viewed in FireFox so I noodled with the CSS until it worked. In doing so I learned two really interesting things about the IE Developer Toolbar witch I will share in a subsequent post.

You can download the theme here.

As always, if you have any problems, questions, or kudos, pass them along.

kick it on DotNetKicks.com

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 1/27/2008 at 11:42 AM
Tags:
Categories: BlogEngine.net
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (6) | Post RSSRSS comment feed

New Blog Engine Theme: MarketPlace 1.0

Posted by Adam

My friends Jason and Jesse and I are having a blast converting different themes for BlogEngine.Net. I think it would be fun to write some extensions as well. I took the original version of this theme from www.styleshout.com.  This is my first pass at this so I expect there to be some issues. If you have any problems or questions about this theme please let me know. You can download it here.

image

I am always browsing through the various free CSS templates out there and I have a whole list of themes I want to convert as time and patience allows.  I am particularly impressed with Jason's 'StarGazer' theme.

kick it on DotNetKicks.com

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Currently rated 3.5 by 2 people

  • Currently 3.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 1/21/2008 at 11:52 PM
Tags:
Categories: .Net | BlogEngine.net
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (3) | Post RSSRSS comment feed

Thanks for the 'Gluttony' Jesse!

Posted by Adam

Thanks to Jesse Foster for converting the 'Gluttony' Wordpress theme for use with Blogengine.net. I imagine there will be a flood of themes converted for/by the blogengine.net community in the days to come. I think I'll leave the cube for a while as small token of thanks. ;-)

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 1/3/2008 at 8:52 PM
Tags: , ,
Categories: Miscellaneous
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (1) | Post RSSRSS comment feed

Recommended Reading (Part 1)

Posted by Adam

I am currently reading or have read the following books. I was struggling over what to post for the first time on this blog and I looked over at my stack of books. I hope you will check them out.

Parallel Worlds is a fascinating book by Michio Kaku. By far he is my favorite Theoretical Physicist. :-) He has a gift for explaining very complex concepts in a way that I can understand them. If, like me, you find yourself glued to the cable science channels I think you will love this explanation of the Universe.

 

SOA: Principles of Service Design reads like a text book so be ready to skim to the parts that interest you. I have found this book to be a great aid in explaining the concepts of SOA to new developers and to business leaders. The diagrams are illuminating. I found the comparison between Service-Orientation and Object-Orientation particularly interesting. Be warned, this is not for the faint of heart.

Founders at Work: Stories of Start-ups' Early Days is a great break from technical reading. It was both inspirational and great fodder for trivia when talking to my fellow IT geeks. There is definitely something to be said for learning from those entrepreneurs that have succeeded in building technological empires. If you ever thought it would be nice to spend time with the founders of companies like Flickr, PayPal, Hotmail, GMAIL, Blogger, and Yahoo and ask them how they did it, this is the book for you.

Amazon.com Mashups is another in a series of 'mashups' books by Wrox. Amazon never ceases to amaze me with their commitment to SOA and the concepts of Software as a Service (SaaS). I found this book to be a useful introduction to Amazon Web Services (AWS) and the examples are in C#.Net which is good too.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 12/30/2007 at 12:09 AM
Tags:
Categories: Books
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Capture [Enter] key press

Posted by Adam

With Tibco's General Interface (GI) you can capture the fact that user has pressed the [Enter] key while the focus is within any textbox. By placing the javascript below in the Execute event for the textbox you can change the focus of the form when the user presses Enter.

 

image

jsx3.sleep(function() { ProjectNamespace.getJSXByName("[TextBoxNameHere]").focus(); });

replace 'ProjectNamespace' with the namespace in your project settings.

replace '[TextBoxNameHere]' with the name of the textbox that should receive focus next.

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 11/24/2007 at 1:27 AM
Categories: AJAX | Tibco - GI
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed

Simple Auto-Focus script in Tibco GI 3.5.1

Posted by Adam

I realize that what I post regarding General Interface is not going to be rocket science any time soon. Despite that, I figure I had better start posting the things that other developers that are new to GI might find useful.

I was recently developing a sample application as a 'proof of concept' in General Interface and it occurred to my that it would be nice if the form would automatically move focus when all the allowed characters had been entered. This is useful when the user is entering a social security number of telephone number. The cursor automatically jumps to the next textbox saving the user from having to click 'Tab' or clicking over. Here's how I accomplished this.

It all revolves around a convenient feature built into the GI framework called the 'Inc. Change' event on all textboxes. This event only fires when a letter has been added or deleted from the value of the text box.

The following JavaScript is called when capturing the Inc. Change event.

image

Create a form like the one below.

image

Set the maximum characters on the textboxes and set the validation type as well. I've set mine in the sample to 'Number' so that I can make use of another convenient GI feature called 'doValidate()'. You may notice in the JavaScript above that if the user has entered values that cause 'doValidate()' to return false, the background is set to red and the auto-focus behavior does not fire.

Here is the javascript that calls the function above.

autoFocusNext(this, 'tbPhone1');

Happy coding in GI!

AutoFocusNextSample.zip (4.63 kb)

Digg It!DZone It!StumbleUponTechnoratiRedditDel.icio.usNewsVineFurlBlinkList

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5
Posted on: 11/23/2007 at 1:39 AM
Categories: AJAX | Tibco - GI
Actions: E-mail | Kick it! | DZone it! | del.icio.us
Post Information: Permalink | Comments (0) | Post RSSRSS comment feed