Flex Tip: Stop CSS from getting heavy!

November 27th, 2009 by Admin No comments »

Remember friends, if you are using flex builder 3 and trying out various fonts for your widgets, everytime you select a font, it gets embedded into your CSS and that makes your SWF heavier. You would have noticed that with time it takes longer and longer to compile.

To get rid of this problem, ensure that you uncheck the Embedded checkbox right next to your font selection drop down. Everytime you see it checked, just uncheck it if you don’t want the font to be embedded.

Usually there are standard fonts that do not require embedding and usually they suffice for most of the business UIs.

So, if you don’t know what you are doing to make your flex design view become slower in applying style changes, you take a look at the fonts embedded to the CSS, accidentally.

Have fun with Flex and keep it simple!

Flex Video Stream Filtering – B&W, Brightness, Contrast and More…

March 26th, 2009 by Admin No comments »

Dear Dummy Friends,

I am back with some more trivia, just in case you have been struggling with attaching a video stream to your application, capturing images, changing the color (filtering), or manipulating the results of a video stream capture, here are some tips for you.

First things that you need to know in order to begin the video or image filtering are:

  • An image or a video can be thought of as a layer of colors (red, green, blue and opacity).
  • The layers can be transformed using Matrix Transformation (ordinary mathematics)
  • Transparency, Brightness, Contrast and Other properties if an image or a video can be handled by applying these transformations. (This is known as filtering.)
(Courtesy: Tutorial)

It is highly recommended that you visit the following links to know better about the concept of image processing:

I am going to talk more about applying these transformations or filtering on Video and Images in Flex 3.3 programming.

Keep tuned and get yourself ready with the understanding of color matrix.

Project KENAI and Drishta

February 19th, 2009 by Admin No comments »

I have just returned from the Second day of Sun Tech Days 2009, Hyderabad. In the last few hours the first thing I decided to do was to look up Project Kenai, a platform for collaborative, open source product development with a host of Social Networking features and Web 2.0 style website that looks cool and feels cool too (and I am not referring to the color blue that is the theme color for the website). There are various things that might not appear quite user friendly to a Useability expert but for a developer who is trying to build a product in collaboration with the whole community of java developers the features are just about right to get started.

I have registered on the website and have been granted the permission to host my own project called Drishta. I am going to talk more about my project and the idea behind it in the following posts, but for now what I am very excited about is that I have finally decided to reignite this initiative that has been lying dormant in my TODO list for nearly a decade.

I have liked the idea of Kenai so far. It is simple. Straightforward. And easy to use. I would recommend giving it a fair try and making your own impression of this useful platform.

Keep tuned for Drishta!!!

Resource Update: GoF Design Patterns – Only notations, no text!

January 30th, 2009 by Admin No comments »

Sometimes, a picture is indeed worth a thousand words. Especially I always felt that the Design Patterns book was quite verbose and distracting in its approach. It would have been great if the examples had been a little more simplified and did not clutter the space. Also, a bit of comparative study of these patterns could allow one to appreciate the subtle nuances and the differences between these patterns, which look quite alike to a newbie.

Finally, I struck gold when I found this link. Some old site that contains the pictorial or PepperSeed images showcasing the Design Patterns. The notations are quite similar to UML notations. And There is astoundingly no text, whatsoever!

I find this a very essential 5 minute referesher that the Architects should keep handy for reference, whenever a moment of uncertainty, while designing a complex application, renders them actionless.

This is the link to the site. Gang of Four Design Patterns

Here is a sample of Adapter Pattern and Bridge Pattern, when placed side by side once can see the subtle difference so clearly, and without any textual clutter around it.

Adapter Pattern



Bridge Pattern

I hope you appreciate the essence of text less GoF Design Patterns!

P.S. The images were stolen from Gang of Four Design Patterns.

Bulky Data Transfer with Single Hit vs Light Data Transfer with Multiple Hits

November 24th, 2008 by Admin No comments »

This is a classic dilemma. What is a better model for browser based clients and back-end services to interact? Should there be as little dialogue as possible with maximum data transfer or as much dialogue as possible with minimum data transfer in each exchange of request-response. The problem is not as simple to solve as the problem statement makes it sound.

There are various parameters that need to be considered for answering this question. And the solution varies as per the requirements.

Let’s start with considering a revolutionary example: Gmail!

As we are aware, Google employed the AJAX philosophy and created the first ever AJAX based email application that changed the paradigm of web mails, by increasing the performance of reading, composing and sending emails over the internet. The browsers were same as before, the bandwidth was the same but the application architecture had changed drastically, making more possible with the same set of resources.

However, it was not just about using a new technology but identifying the appropriate problem that this technology could solve. In an email type web application, a user generally performs units of tasks with every click.

  • Open a mail for reading,
  • Compose a mail/reply,
  • Add / Remove the attachments and
  • Send the mail.

It never happens that a user is reading a mail that is being modified by the sender simultaneously. So, there is no real time change in an email’s content.

If at all there is a modification required to the content of an email that was already sent/delivered, one needs to re-send the mail with the modifications. In this scenario, fetching each mail’s content as and when the header of the mail is clicked makes sense, and doing it asynchronously (i.e. without refreshing the whole page) makes the usability far more intuitive and elegant.

On the other hand, is an application that shows data that is highly likely to be modified at the same time when a user is viewing the information, such a model of conversation may not really work.

Say, you have an application that displays data in the grid where rows and columns are collapsible and contain levels of information (something like a hierarchical data set). See the example.

The grid’s cells don’t enjoy absolute independence from the other rows and columns of data surrounding it. In other words, each cell of information is not just an atomic information in itself, but also forms a part of the information that is at a level higher than it. For instance, Physical Supply of 100 could mean there is a PO of 50, POK of 30 and TO of 20, which are all displayed as the child levels of Physical Supply. Now, in case there was a new PO of 20 created by some user, while the data mentioned above is on display in the SCP, by showing an additional 20 for PO i.e. PO of 70 would not be enough to represent the actual state of Supply Chain because, the sum of quantities for different Documents (70+30+20 = 120) would be incosistent with the total being shown for the Physical Supply (50+30+20 = 100).

With this problem at hand the requirement would be to update all the cells in the row and column that contain the modified cell, as part of calculating the summary for that row and column respectively. This requirement in turn requires us to keep a track of all the cells in the grid because the probability of any cell getting modified at any given time is almost equal, therefore any row and column could be required to be refreshed with the latest data.

Essentially, each cell update leads to an update of almost all the cells in that section (sections here refer to the parent rows viz. Demand, Suppply, Recommendations etc.) We could therefore limit the updates of a cell leading to the update of just the section in which it lies. This in turn would lead to a different kind of inconsistency. For instnace, a Demand of 30 and a Supply or 20 leads to a Recommendation of 10 and a Projected Inventory of -10. This means that even the sections within the SCP grid are interdependent therefore any cell that has to show updated data, would require all the other cells in the grid to update the data, directly or indirectly.

So, it is pretty clear that the data in the entire grid has to be treated as a whole in order to view a consistent information in the Supply Chain Profile at any given time. The rendering of data, however, doesn’t need to happen in a single shot because like viewing a section or a particular row or column or a cell in particular, is quite similar to checking one’s inbox for a specific email. And once that email is located, all one cares about is reading the information within. Similarly, a user will only follow a single path for drilling down information about the SCP at any given time. This in turn leads to a simple requirement of rendering data (cells, rows, columns) only for the particular paths.

The conclusion or the solution for our problem is to fetch the entire data in a Single Hit to the server, and then use selective and efficient rendering of the data based on where user clicks on the UI. We can and have tried to make the cell specific information (which is shown in the pop-ups) asynchronous, but that leads to holding the state of the data object that was transported to the client earlier. This leads to additional memory and state management requirements on the back end. Therefore, we chose to send the information in a bulk to the front end. This might be slightly slower but it represents the state of SCP accurately and consistently always and everytime.


Calendar getDisplayName() JDK 6.0 vs JDK 1.5.0

November 5th, 2008 by Admin No comments »

If you have somehow used jdk6.0 while developing your application that uses Calendar API of java.util.Calendar, and have used getDisplayName method to extract the display names for fields of the calendar, specific to your desired style and locale, and then had to compile your application with jdk1.5.0 only to realize that compiler spits swear words at you…Here is quick fix for you!

This is what you did in jdk6.0:

//get your application locale
Locale userLocale = getContext().getLocale();

//define a calendar
Calendar calendarInstance = Calendar.getInstance();

//Extract the month name in SHORT format (viz. "Jan","Feb" etc.) for the context locale.
calendarInstance.getDisplayName(calendarInstance.get(Calendar.MONTH),Calendar.SHORT,userLocale);

Here is what you can do to achieve the same getDisplayName functionality in jdk 5.0:

//import the following class
import java.text.DateFormatSymbols;

//declare variable.
DateFormatSymbols dateFormatSymbols = new DateFormatSymbols();

//Get the short names for months in a Calendar
String[] months = dateFormatSymbols.getShortMonths();

//Use the month field of Calendar to fetch the short name of month for cell label.
months[calendarInstance.get(Calendar.MONTH)];

Once you acquire the SHORT name for the field, you can use it for your labels, or column headers etc. based on where you require it.

Ideally, you shouldn’t have to fall back on the previous version of jdk, yet sometimes the project requirements can’t be altered even for better things in life.

Hope this tip helps!

Flex Builder 3 – LiveCycle Data Services – Libs

April 23rd, 2008 by Admin 10 comments »

I would never have been writing this post in addition to so many others that are already there talking about how to build, compile, deploy, run your flex applications that use Live Cycle Data Service, had I not spent last five days trying to figure out why my application wouldn’t compile when I was following all the steps mentioned everywhere.

I might be dumb for not having known something that was obvious; that one must know in order to build applications in flex, so I concede. However, there might be my other dumb brethren out there who might be struggling with the same things, so this one is for you fellas!

After migrating the flex app that was built on Flex Builder 2 by my associate, some time last year, around October/November, I was facing a few issues in getting the application to compile.

Some of the errors were as follows:

Type 1:
1172: Definition mx.data.utils:Managed could not be found.
or
1172: Definition mx.data:IManaged could not be found.

Type 2:
Unable to resolve resource bundle “data” for locale “en_US”.

Now first of all when you start Googling, you come across the following links (that are relevant):

http://bugs.adobe.com/jira/browse/ASC-2815

http://www.mail-archive.com/flexcoders@yahoogroups.com/msg38973.html

http://www.mail-archive.com/flexcoders@yahoogroups.com/msg66002.html

And even though these have been written with the intention to help out the newbies in the flex world, they don’t really shed light on what might be the cause of this problem and/or how to fix it. The problem is indeed far simpler than the complicated discussions on the “Known Issues” and “Hot Fixes”.

All I need to know is, where is that goddamn missing library that I could include in my build path to resolve these issues.

If you have been following the instructions elsewhere, you probably already have gone through all the treacheries that I have gone through so you can relate to the frustration I am talking out of.

Well having said and done all that I have, here is what you need to do in order to get those libraries into your classpath.

The location where you installed your Live Cycle Data Services, let’s call it [lcds-install-path].

Under [lcds-install-path] you will find a war file called samples.war. If you can’t see it, download the Data Services afresh from an authentic source and install it.

Now the reason I referred to this samples guy was because I wanted to make sure if anybody had ever tried to accomplish what I had set out for with the Flex SDK3.0 and Data Services. (I realized later that what I was trying to do was not something that was rarely used, but something that is used so often that it is taken for granted that people who can’t get it right, like me, are just too dumb to work on Flex Applications.)

Procedure for alleviation:

  1. Create the following directory [lcds-install-path]/flex/libs
  2. Create the following directory [lcds-install-path]/flex/locale
  3. Create the following directory [lcds-install-path]/flex/jars **
  4. Expand or explode (suit yourself) [lcds-install-path] /samples.war to [lcds-install-path]/samples
  5. Go to [lcds-install-path]/samples/WEB-INF/flex/libs and copy everything.
  6. Paste the files copied into [lcds-install-path]/flex/libs
  7. Go to [lcds-install-path]/samples/WEB-INF/flex/locale and copy everything.
  8. Past the files copied into [lcds-install-path]/flex/locale
  9. Go to [lcds-install-path]/samples/WEB-INF/flex/jars and copy everything. **
  10. Past the files copied into [lcds-install-path]/flex/jars **
  11. Go to flex builder, and edit the build-path.
  12. Add [lcds-install-path]/flex/libs as an SWC folder.
  13. Add [lcds-install-path]/flex/locale as an SWC folder.
  14. Add [lcds-install-path]/flex/locale/en_US/fds_rb.swc as an SWC
  15. And now your application should compile!

** – optional for now, may be needed for something in future, who knows?

If this doesn’t work still, you need to take a break and hire someone smarter to help you out.

The reason I copied all the files to a custom location was that it will keep me aware of where I need to make changes in future and also might give some hint to Adobe Team to include a separate folder in the LCDS distribution that contains all the mandatory libraries.

Hope that help you my dumb-friends. If it doesn’t you can mail me at remotemethod@gmail.com and I will try to help you out with some more “Flex for Dummies” tips if I can.

Here are some related links that might help:
http://www.adobe.com/devnet/coldfusion/articles/data_app.html

Pitfalls In Java Development and More

April 16th, 2008 by Admin No comments »

Hi guys, here is a super cool blog recently launched by my friends and colleagues at Pramati.

http://pitfalls.wordpress.com

The blog is named as Pitfalls in Java Development, but it doesn’t limit the content or the description to just the pitfalls; there are amazingly new and refreshing facts about Java Technology and all its associated open source technologies.

You will also find quite a few interesting debates on DOs and NOT TO DOs in the Application Development world of Open Source and Java/J2EE. All of the authors on the blog are experts in their respective domains and technologies and share the most recent issues they encounter while working on their current assignments.

In less than two weeks since it was launched, it has reached a hit count of 3000 approx. Which in itself is an indication of how techies about the value of information shared by this blog. And to those of you for whom it matters, the CTO at Spring Source Adrian Colyer has already commented on one of the posts on this blog.

I am sure you are going to learn a lot from this single link. So check it out now!

JavaScript 2.0 – A New Avatar

June 23rd, 2007 by Admin 1 comment »

Java Script for objects: Brought to you by ECMA.

Now this is something that was pending for a long time now. Twelve years since the birth of JavaScript and no major or minor updates to the language. Imagine how much of value it must have offered to the entire web developer community to have survived in the software world without changing for twelve years.

As the creator of JavaScript and currently the CTO of Mozilla Foundation , Brendan Eich said,”It is not a revolution, just an evolution of existing capabilities.” It sure has been long due now. Especially, with the AJAX and Web2.0 taking WWW to a different paradigm altogether. Making it essential that the foundation of the new web be stronger and reinforced with as much steel as possible.

I would be looking forward to see how it evolves. The primary challenges would be to keep it as simple as it has been and still provide an OO environment for building RIA.

Packaging and scoping are some of the mandatory requirements for the JavaScript 2.0 to keep it rolling. And another challenge is the ascertain that the JavaScript loaded on the browser is not a security risk for the computer, because the internet browsers, as we know them today, don’t provide proper sandbox environment like a JVMs do.

There is a lot that would be expected out JS2.0 and I am sure, like before, it is going to deliver.

You can track the progress of JavaScript 2.0 or as the project Code name says ECMAScript from this link. ECMAScript

Torrent over RIA…Cascading Revolution!

June 21st, 2007 by Admin No comments »

Can Do: A New Paradigm for content sharing

A year and a half back a friend of mine, who is doing his research on biotechnology, explained to me a new way of sharing files that was taking heat and that could actually make things far more quicker in spite of the bandwidth variations across the internet.

Bit Torrent is a very innovative protocol designed to make file sharing over internet much easier and less bandwidth-intensive. Amazing technological advancement in the area of content distribution with shared bandwidth.

The concept of fragmenting the target files across a host of computers connected to the internet makes the entire idea of “high load on single server” obsolete. The connected computers distribute the fragments by downloading them from other computers and then making them available for upload for those computers that don’t already have the fragment.

This enables sharing between a large number of peers possible without increasing the load drastically on any single machine. And thus making it far more faster than a normal download over an FTP or HTTP would take for the same file size.

The downloads and uploads however still remain bandwidth dependent as everything else is on internet but in this case the dependency never leads to a bottle neck. The flow is constant and the load shared therefore reducing the chances of having single point of failure. Bit Torrent also enables non-continuous downloads inherently because the continuity can never be assured over internet given the fluctuating nature of the bandwidth.

Desire: Ease of Usage and Friendliness

To avail the power of Bit Torrent based file sharing, you would normally require a client side application that helps you in performing download management tasks viz. Bandwith Allocation per download, prioritizing downloads, pausing and resuming, seeding etc.

And to those of you who use internet extensively, installing yet another application sounds to be an encumbrance. Organizing all the applications on your desktop, then updating versions, re-installation, firewall limitations etc. are some of the common problems one faces while using tools like Torrent clients.

How one wishes there was a way of putting all these applications on top of another layer of organization within your desktop that would manage all these issues, instead of your having to sit once every week and arrange stuff on your desktop manually.

Alternative: Desktop Rich Internet Application Platform

Having a RIA platform opens a great deal of opportunities for both developers and end-users. Developers find it easy to experiment with their ideas and offer their services over a customizable application development platform. End-users on the other hand benefit from a constantly growing community effort in bringing out function rich applications.

The RIA platforms and the desktop web has caught interest of major software vendors in the industry, to name a few Google and Adobe and they are in a race to offer these platforms out of their angelic desires to make the end user ever more equipped and enabled to leverage the strength of internet and web technologies.

Pramati, a relatively small fish in the huge ocean, on the other hand has already arrived with a solution that is simple, elegant and as powerful as your imagination. Dekoh in it’s entirety has altogether different view about how the world to come will use internet.

As I have been talking about Dekoh in my previous posts, so I won’t bother you with what Dekoh is. However, Dekoh can be used in places where no one could have ever imagined. Dekoh has evolved considerably in the past few months and its capabilities are growing by the day.

For a torrent service and client application all you need is a basic web server with trackers and clients that can communicate over the internet. Dekoh provides you with a personal webserver and there is a Central Application Server, both of these combined can add broader tracking facilities for Bit-Torrent files.

Dekoh architecture also enables you to work from behind the firewalls which means that it is possible that your IM services may be interrupted or your access to the internet may be limited but your downloads will never stop as long as you have Dekoh with you.

Wondering on these possibilities, the day is not far when you might actually hear about Torrent being available over Dekoh platform, making end-users’ lives much more simpler and organized.

Torrent over a Desktop based RIA platform, in my opinion will make a killer combination and I will be following up on it more. You keep tuned in to know more.


Fatal error: Call to undefined function spa_default_options() in /home/rishikd1/public_html/accidentalpatterns/wp-content/plugins/snap-shots-for-wordpressorg/ald-snapshots.php on line 97