Tuesday, December 23, 2008

Resizing an image on mouseover with Flex 2

I was updating my personal site created from Flex 2 MXML and ActionScript and needed to create hyperlinks from thumbnail images. The html markup for the image is created from content from an XML file. In the past, one had to escape html markup contained in XML elements and create a link to a larger size of the same image. In short, I was hoping to avoid that unpleasantness.

Enter the mx.effects.Resize class. Using this object you can control the resizing of an image when the user passes their mouse over the image. For example, you have a thumbnail image that you are displaying that is 150 by 150 pixels in your MXML file:
<mx:Image source="yourImgPath/imgName.jpg"
height="150"
width="150"
/>
You want to enlarge the image to a size of 450 by 450 pixels based on the action of a user. Instead of a link to a larger image, we will enlarge the image when the user passes their mouse over the image. To do this you can utilize the mx.effects.Resize class. Enter the following into your MXML file:
<mx:Resize id="resizeBig"
widthFrom="150" widthTo="450"
heightFrom="150" heightTo="450"
/>
<mx:Resize id="resizeSmall"
widthFrom="450" widthTo="150"
heightFrom="450" heightTo="150"
/>
Then, within the Image instance, modify it with the following:
<mx:Image source="yourImgPath/imgName.jpg"
height="150"
width="150"
rollOverEffect="{resizeBig}"
rollOutEffect="{resizeSmall}"
/>
Finally, recompile and you will see that when the user passes their mouse over the image it enlarges without the use of links to the larger image.

Thursday, November 20, 2008

Genetic Algorithm for Network Intrusion Detection Rule Sets

This term (Fall 2008) at Northern Kentucky University (NKU), in the Data Communications & Networking class, I conducted some research for a project dealing with the use of machine learning applications for network security. Specifically, I created a genetic algorithm (GA), with the JGAP Framework, which can be used to produce Network Intrusion Detection Rule Sets.

Special thanks to Dr. Frank Braun, class professor, Dr. Richard Fox, Professor and Graduate Program Director in the Department of Computer Science at NKU, and Mr. Klaus Meffert (soon to be Dr. Klaus Meffert) the primary author of the JGAP framework, for their assistance.

Here are the paper, presentation, and related files:
Paper
Presentation
GA Output
XML Output

Thursday, November 06, 2008

Graffiti CMS C# Extended Link List

I have setup a site for a customer that utilizes the free version of Graffiti Content Management System (CMS ). The framework is great and runs pretty much out of the box on Microsoft's ASP.NET 2.0 framework software and runs on Windows Server with Internet Information Services (IIS). In fact, Intelligent, the creators of Graffiti state that their goal was to create an environment where users would not have to understand programming, design, and or system administration. I think they have come pretty close to achieving it.

What it meant for this client was that the setup and intial labor of the site was greatly reduced, thereby saving them money. In any event, I setup an account for the client and placed then in a manager role (which were setup and ready to go), that allows them to publish content via a handy WYSIWYG editor. One thing that the role is not able to do is to use the many widgets that are available for the site.

I posted a question on the Graffiti forum that asked is there a way to allow users in the manager role access to the Link widget where they could create links in a special area of the site where the widget is placed. I found that to date you can not. While looking I did find a widget that extends Graffiti's Widget class called an Extended Link List, that was developed in VB.Net. To better learn how to create extended widgets I ported the project to C# and posted it on CodePlex, Microsoft's open source project hosting web site.

If interested, here it is.

Friday, August 22, 2008

IT's About Business Objectives Stupid

Last term I was contacted by a professor, Dr. Kevin Gallagher, as he was questioned by a reporter who was working on a story about IT (Information Technology) programs, their variations, and how and why students pick their chosen degree program. Upon his request, I provided a short list of answers and that was that. Dr. Gallagher recently notified me about the article.

In short, the article is spot on concerning IT programs and the need of those enrolling in them to consider broader aspects of business objectives and not just technical knowledge.

Check it out.

Saturday, August 02, 2008

Please skim this.

In a recent IT Conversations Interviews with Innovators podcast, the discussion centered on removing clutter from the visual field of students when training. That same morning I also listened to Scott Hanselmans’s podcast which dealt with micro-blogging. Here, the discussion utilized the metaphor of information as a river and how one deals with the torrent of news and data, specifically how one organizes it to be useful with tools such as twitter and RSS Feeds.

In both podcasts the talk touched on the issue of how possibly this instant information has made us less tolerant to large amounts of text in mediums such as books. There was also a mention of an excellent article in Atlantic Monthly by Nicholas Carr that asked the question, "Is Google making us stupid?" The question in my mind, along the same thought, is, "Does micro-blogging technologies such as twitter, IM clients, or text messaging foster a culture that lacks the ability to maintain a sustained period of attention to the formation of ideas and thoughts?"

Ironically, I used Google to find more information on the topic searching with the words, "google learning sustained thought." What I found an interesting article from the New York Times by Motoko Rich entitled, "Literacy Debate: Online, R U Really Reading?"

For those with diminishing attention spans I will get to the crux: some purport that digital text is read by those who otherwise would turn to the television or electronic gaming, and is therefore a gateway to more sustained reading. While that may be true, my concern is along the lines of Rich’s article:

Critics of reading on the Internet say they see no evidence that increased Web activity improves reading achievement. "What we are losing in this country and presumably around the world is the sustained, focused, linear attention developed by reading," said Mr. Gioia of the N.E.A. "I would believe people who tell me that the Internet develops reading if I did not see such a universal decline in reading ability and reading comprehension on virtually all tests."

Then, Rich’s article refers to Carr’s Atlantic Monthly piece:

Nicholas Carr sounded a similar note in "Is Google Making Us Stupid?" in the current issue of the Atlantic magazine. Warning that the Web was changing the way he — and others — think, he suggested that the effects of Internet reading extended beyond the falling test scores of adolescence. "What the Net seems to be doing is chipping away my capacity for concentration and contemplation," he wrote, confessing that he now found it difficult to read long books.

In summary, I think that any technology that helps present, streamline, and make information accessible is good. However, what are the side effects? Good question, but now my attention is distracted and I must move on to something else.

Tuesday, July 29, 2008

Programming: A Social Activity

I have been listening to a weekly podcast, Stackoverflow with Joel Spolsky and Jeff Atwood. Podcast 15 features a question that asks what the most effective code review methods are. On the podcast site, the show notes state,
Joel and I both agree: one of the most effective coding practices you can adopt on your team is interactive, sit-down-with-your-coworker code review. 90% of the things you will learn have nothing to do with the code. I believe programming is a far more social activity than most realize. If you write code, and nobody but you ever sees that code — did you really extract all the benefit from writing that code?
HEAR, HEAR!

Friday, July 25, 2008

Notepad2: A light-weight ABAP external editor

(a.k.a. Look Dr. Raghavan, no SAP environment!)

OK. It has been awhile since I have posted anything. Reason: I am heavily involved in church and family, working full-time, and going to school part-time. Enough said. Anyway, I have been taking a few SAP classes this summer as part of the Business Informatics graduate program I am in at NKU. One of the classes is an ABAP programming class.

I have to admit that after being skeptical at first, I like ABAP and its development environment. However, while still in the course, I want an external editor that I could use that color codes the syntax to make it easier to read and edit. Granted I will not be able to debug the code but it is nice to have an editor to drop code into, as I do not have to login to SAP, for a quick look.

My favorite light-weight editor is Notepad2 from Florian Balmer. Since it is open source, and I saw where others have added different language-syntax highlighting capabilities, I thought I would give it a go.

First, I downloaded the Notepad2 source from Flo’s Freeware Page and opened the C++ project in Visual Studio 2005. Then, after bombing on my first build, I read the readme file which stated to include the source from the editor that inspired notepad2, Scintilla and tweak one of the source files. After another bomb on the rebuild I set the project property to NOT embed the manifest. Then, it built.

Next, I wanted to get an ABAP lexer working for Notepad2. A quick look on Google and I found another build of Scintilla, SciTE Ru-Board Edition. Now is when the fun begins. What I essentially did was to dig into the SciTE Ru-Board source code, grab what I thought was the needed to implement the Notepad2 ABAP lexer, and then attempt a rebuild. With each attempted build I find various sections that I needed to modify within the Scintilla source code. Finally after about a dozen attempts, I had the Notepad2 project building.

Then, I wanted to update the Notepad2 Styles header and program files (Styles.h and Styles.c ) so that the color coding will work for ABAP files in Notepad2. Once this was completed, I had a light-weight ABAP editor that provided syntax highlighting for files with an ".abap" or ."abp" extension.

Finally, if you pull down the Notepad2 source from Flo’s Freeware Page, do a "diff" on the /src/Styles.c and /src/Styles.h files to see the updates. Also, to see where the Scintilla source was modified diffs should be done comparing the following files: /include/PropSet.h, /include/SciLexer.h, /src/KeyWords.cxx, /src/PropSet.cxx, and /src/StyleContext.h. I also added the /src/LexABAP.cxx file to the Scintilla source (thanks to VladVro [one of the SciTE Ru-Board Edition project owners]) as that is needed by Notepad2.

NOTE: The Visual Studio 2005 Notepad2 project and binary downloads were updated 9/18/2008 with more Object Oriented ABAP keywords.
Click here to get the Visual Studio 2005 Notepad2 project.
Click here to get the binary Notepad2 files.

NOTE: By the way, I added Scott Hanselman’s Ruby lexer to this project for Ruby file edits.

Wednesday, April 23, 2008

JavaScript HashMap

Okay, this is not new nor exciting but I was looking to create something like a Java HashMap or a C# Dictionary object in JavaScript. What I did find was that you can use a JavaScript Array to function as a hashmap or dictionary object. I would then use it to iterate through to do some quick client-side validation for a web page. Here is the code:

function formFieldArray(){
var myArray = new Array(10);
myArray['myname'] = "Name";
myArray['myaddress'] = "Address";
myArray['mycity'] = "City";
myArray['mystate'] = "State";
myArray['myzip'] = "Zip Code";
myArray['myPhone'] = "Phone Number";
myArray['myEmail'] = "Email Address";
myArray['cardname'] = "Name as it appears on the Card";
myArray['cardNumber'] = "Card Number";
myArray['expDate'] = "Expiration Date";
myArray['cardCode'] = "Card Security Code";

return myArray;
}

function validateForm(){
var theFormFieldArray = formFieldArray();

//iterate thru array and clear values
for (key in theFormFieldArray) {
if(eval('document.myForm.' + key + '.value.length == 0')){
alert('Please enter the value for the ' + theFormFieldArray[key] + ' field.');
eval('document.myForm.' + key + '.focus()');
return false;
}
}

document.myForm.action = "yourNextPage.php";
document.myForm.submit();
}

Sunday, March 02, 2008

Want to be influenced?

Caught this interesting post by Valdis Krebs on social networks and how ideas are spread within them. There has been much discussion about the "influential elite" and how, if they champion an idea, it is more probable that it will grow and gain acceptance. However, this post points to the thought that it is not so much the influencing elite who control what ideas gain intellectual and social traction, but rather the willingness to be influenced by those adjacent, in the social network graph, to the elite.

Saturday, February 16, 2008

Narrative Thinking

I was doing a few days coding for a client and informed them that I only had a few more free days before starting back into a new term at grad school and that I would probably not get much done given I was still learning the e-commerce package that they were using. But in order to provide them with a deliverable I decided to record my steps and thoughts in a document in narrative form for their future information and use.

There is much discussion about narrative verses symbolic code and moving computer languages more toward a natural language. Such is the discussion about Domain Specific Languages. However, when I say narrative form I am not speaking of actually writing code but rather simple prose mixed with code as needed, to record thought processes, research findings, and general steps in a discovery process.

Here is an example layout of what I did:

Saturday, January 05, 2008
Login Test
Current Steps Planned:
I would describe the steps/tasks that I planned on taking for this date. It could include a list of items, a brief description of what is planned, etc.

Actual steps:
  1. Here I would describe actual steps that I took, thoughts in the process, rationale for decisions, etc.
  2. I added a check to the Customer.Authenticate method.
if (customer.ID[0].Status != Customer.Validated){
throw new CustomerException(CustomerExceptionType.NotValidated, "Customer Not Validated");
}
  1. This resulted in an error when attempting to login with the userid and password.
  2. ......
Next Steps:
Here I would describe the steps/tasks that I planned on taking the time.

What I found was this forced me to be more precise in my thinking which naturally resulted in a more precise research and coding process. I have always known that writing makes one organize their thoughts more orderly in order to communicate more clearly. However, I must say I enjoyed the controlling aspect of thinking in a narrative format. It somewhat reminded me of the Test Driven Development in which you are controlled by getting the current test you are working on to pass with the simplest code. You do not have the opportunity to thrash around or run down this rabbit trail or that. You record your processes, organizing and analyzing your thoughts as you go, making sure you are focused and productive.

Tuesday, January 08, 2008

Dynamic and Domain Specific Languages in a Language Tiered Structure?

In a recent post I linked to a paper that I composed for a graduate class on Dynamic Languages in software development. Today, at InfoQ there was an interesting review of a post by JRuby developer Ola Bini. In a similar view to n-tier layered architecture, Bini describes language types of static, dynamic, and domain specific in a layered fashion.

For example, in an n-tiered layered architecture you would have a presentation tier on top of a business logic tier which is over a data layer. Bini states:
The first layer is what I called the stable layer. It's not a very large part of the application in terms of functionality. But it's the part that everything else builds on top off, and is as such a very important part of it. This layer is the layer where static type safety will really help. Currently, Java is really the only choice for this layer.
This layer corresponds to the data layer mentioned above.

The next tier Bini mentions is the dynamic language layer:
This is where maybe half the application code resides. The language types here are predominantly dynamic, strongly typed languages running on the JVM, like JRuby, Rhino and Jython. This is also the layer where I have spent most of my time lately, with JRuby and so on. It's a nice and productive place to be, and obviously, with my fascination for JVM languages, I believe that it's the interplay between this layer and the stable layer that is really powerful.
In my paper that I referenced above, I discussed that Groovy has great potential given it is designed for the JVM. Here I see this corresponding to the business logic layer.

The last tier mentioned is the Domain Specific Language (DSL) layer. For a discussion on that, go here. Bini states:
The third layer is the domain layer. It should be implemented in DSL's, one or many depending on the needs of the system. In most cases it's probably enough to implement it as an internal DSL within the dynamic layer, and in those cases the second and third layer are not as easily distinguishable.
Finally, in my view, this tier corresponds to the presentation layer. In a similar manner, the business logic and presentation tiers in many applications are often tightly coupled and "are not as easily distinguishable" as they should be. In any event, Bini’s post is an interesting perspective on the use and place for both dynamic and DSL languages.

Saturday, January 05, 2008

MIT’s new Open Courseware (OWC) web site

I was listening to IT Conversations earlier this week while jogging and heard the mention of MIT’s new Open Courseware (OWC) web site. After checking it out I found that OCW is a free publication of course materials used at MIT. The site provides access to course lecture notes and audio and video files, labs, and resources on a variety of subjects.

Of late, I have been diving into the business aspects of development. I must say to my shame I should have had this perspective much earlier in my career. Do not misunderstand me, I have always developed to solve a business need, but I am looking further up the value chain to explore how software applications in particular and technology in general can enhance innovation. With that said, I find OWC’s link to the Sloan School of Management providing helpful resources. For example, the reading list from the Management Information Systems: Generating Business Value from Information Technology provides a list of resources to read. One of the resources listed is an article from Harvard Business Review, October 2002, entitled Six IT Decisions Your IT People Shouldn't Make. A quote from the article states:
Our center runs a seminar called "IT for the Non-IT Executive," and the refrain among the more than 1,000 senior managers who have taken the course runs something like this: "What can I do? I don't understand IT well enough to manage it in detail. And my IT people - although they work hard - don't seem to understand the very real business problems I face."

I want to better understand real business problems and more effectively utilize software to solve them.

Finally, while this does not present an MIT education, it does provide supplemental materials for one’s academic and professional pursuits.