Absence of Imagination: Lorem Ipsum Problem Can Go Worse

20 01 2010

Hundreds of posts on the web and dozens of books continuously tells designers and all people in general that “Lorem ipsum dolor…” approach to filling a temporary content is no way the best or even good solution.
If one is mockuping a site page for let’s say a dairy products manufacturer then “Lorem ipsum” or “Item #1″ is not a good choice. The fucker has to place the fucking bottle of milk or brick of a butter and label it “Milk” or “Butter”.
But it seems like most of people do not have enough IQ for a simple “lorem ipsum” even. I was trying to change it few years already here in my company but the evidences tell me more and more this is not educational problem, it’s rather genetic. I can’t fix people’s DNA.

I’m not testing my projects very often in details but today I should have to reproduce one customer issue in my Non-Broadcast application module. That meant I had to create new non-broadcast item in the app’s CRM. This in its turn meant I had to give that item a name, a unit, a description and a product type.

What I saw when opened Add New Item form is the following:

Now I have a question: why the hell I can put the following:

  • Title: Whiteboard Marker
  • Product Type: Office supplies
  • Units: bundles

and people working in my team afford to put something like:

  • Title: adadfa
  • Product Type: rrr
  • Units: ouloupo

This I can’t explain. I doubt people working in this way will ever do something new and something properly.





Keeping Your Mail Threads Short

14 01 2010

My mailing strategy is not that sofisticated as I see in some ppl who are extensively using filters, rules and other stuff to make their life even harder :) Saying that doesn’t mean I am dumb so extremely that I can’t enjoy all the benefits of inbox rules. I tried using all that stuff in the past and have clearly noticed that all you need is Inbox, Trash, Personal Folders and Search.

I would not write this post if people using mailing rules show me a good mailing abilities but for some reasons they continuously “forget” to read that or that mail or can’t find one so I have to spend some time on forwarding them mails that should already by there and be noticed.

To add more pepper to my plate some mails can be easely treated as a masterpieces of getting things funny. People forget to write a subject. So they reply to all and adding a subject and their “sorry for inconvenience”. In 10 minutes I’m getting the same mail with smth like “adding John to this mail as well since he is in charge too”.

In many cases TO and CC lists are really overflow with people who shouldn’t be mailed. That leads to avalanche of stupid questions from those people.

So I will try to give simple advises in hope to make the world better:

  • prefer simple mailbox to rules. Rules are hiding mails from your inbox to some folders/subfolders/etc decreasing the probability you will read those mails in time and react efficiently
  • check twice if you specified the subject. Some mail clients are coded by a good guys and they will remind you of this but some are not.
  • check twice if you added all recipients to CC, BCC and TO lists.  Again different email agents differently handles this. So best way is to add recipients only when the subject and body are done
  • carefully think whom to address the mail
  • Do more talking then mailing. Really. Talk is much faster and better sometimes.

Doing all these simple things your mail threads will be definitely shorter.

UPD: I posted this message just yesterday. Today I am only an hour in the office but already have got 2 mails with “sorry for inconvenience” words. One time a person did not filled in all data and second time a person did not specified a subject :) WTF?

UPD: +1 more today ))





Custom Integration of GWT Widgets into JSPs

11 01 2010

After spending certain time on wep-app development on GAE I came to the point where I wanted more AJAX and more interaction on my pages. Playing with pure “home-made” AJAX development clearly shown me that:

  • it is time consuming
  • it is not ok with cross-browsers compatibility

Logically my first though was to look into GWT. But this time I decided not to eagerly start learning all the GWT controls and there layouting. Instead I wanted to get high-level impression on strengths and weaknesses of this technology.

Soon I figured out its main weakness or let’s say inconvenience which was referenced by many and many blogs/posts online by different people. GWT plays very nice when it concerns browsers support BUT it generates a single host HTML page where all other essential for your business logic UI is built dynamically by javascript. This may be a good option if you want to build you web application from scratch but in real world we often need to mix different parts. Especially I was interested in how I can integrate GWT components, or widgets like they call it, into my already existing JSPs.

Let me describe an example. Suppose I want to have a component called NewsBlock. Suppose also I want to place it in my JSPs by a custom tag and pass a parameter to specify news category for example. So it should be something like:

<div>
<gwt-newsblock category='Politics'/>
</div>

Then I want this custom tag rendered to GWT implementation of the NewsBlock component.

Internet search offered only naive and primitive solutions which required hardcoding ids and presumed NO parametrisation. Namely they proposed to do the next thing:

In HTML:

<div id='containerID'>
</div>

In GWT EntryPoint.onModuleLoaded() method:

RootPanel.get('containerID').add(anyNeededWidget);

But you see here a hardcoding of the container ID in my GWT code which DOES NOT allow to isolate components from outer world (HTML/JSP).

Next research revealed me that GWT creators provided a very powerfull tool that may give me some more space for experiment: JSNI.

JSNI builds a bridge between your outer context javascript and the javascript that lives inside GWT. It also allows you to add in GWT Java code native functions (i.e. inject pure javascript code into not-yet-compiled Java).

The main idea is to expose part of the GWT module API to the outer javascript world. If I could have in my GWT Java code base a method like public void addNewsBlock(String category); that actually adds a widget and which is callable from my JSP-generated javascript then the problem would be solved.

API can be exported in the following way:

public class Refucktoring implements EntryPoint {

 private native void exportAPI()
 /*-{
 $wnd.addNewsBlock = @com.refucktoring.client.Refucktoring::addNewsBlock(Ljava/lang/String;);
 }-*/;

 public void onModuleLoad() {
 exportAPI();
 }

 private static void addNewsBlock(String containerId, String newsCategory)
 {
 RootPanel.get(containerId).add(new NewsBlock(newsCategory));
 }
}

Here 2 things are done:

  1. addNewsBlock(String, String) method is made visible to external javascript.
  2. containerId parameter is added to resolve IDs hardcoding problem. I will use this parameter at the point where my JSP custom tag will inject the GWT widget into some DIV element for example.

The nex step is integration in HTML. The very rude form to express it is:

<div id='containerId'>
<script type='text/javascript'>addNewsBlock('containerId', 'Politics');</script>
</div>

But there is a hidden obstacle: bootsrap sequence of the GWT module DOES NOT guarantee you that at the time when this HTML block evaluation will occur the GWT module is already loaded. So it may happen that when this short script will try to call addNewsBlock() method the onModuleLoaded() and its inner exportAPI() methos are not yet called and thus nothing will be added to your DIV.

So we need to add one more thing to allow GWT execute all this little outer javascrips itself after the module is loaded. Naturally would be good to handle this in the onModuleLoaded() method. Thus we add following to our EntryPoint class implementation:

public class Refucktoring implements EntryPoint {

 private native void exportAPI()
 /*-{
 $wnd.addNewsBlock = @com.refucktoring.client.Refucktoring::addNewsBlock(Ljava/lang/String;);
 }-*/;

 private native void executeExternalInjections()
 /*-{
 $wnd.executeInjections();
 }-*/;

 public void onModuleLoad() {
 exportAPI();
 executeExternalInjections();
 }

 private static void addNewsBlock(String containerId, String newsCategory)
 {
 RootPanel.get(containerId).add(new NewsBlock(newsCategory));
 }
}

Native method executeExternalInjections() is called automatically after exportAPI() to guarantee the proper sequence. That method calls external javascript function executeInjections() that should be added, as you already thought, by our JSP and is responsible for execution of all those widget-injections small scripts.

The last piece of the puzzle is actually implementation of that javascript method and nicely collecting this all together. Your JSP/HTML should add the following script to the HEAD of the document:

<script type="text/javascript">
 var injectorsHolder = new Object();
 function executeInjections()
 {
 for (var i in injectorsHolder)
 {
 injectorsHolder[i]();
 }
 }
 </script>
 <script type="text/javascript" language="javascript" src="refucktoring/refucktoring.nocache.js"></script>

As you see the sequence is important here: first preparatory script and only then GWT module loader script. Finally in places of injection (that can be generated by your custom JSP tags) you have this for example:

<div id="NewsContainer1">
 <script type="text/javascript">
 injectorsHolder['NewsContainer1'] = function() {addNewsBlock('NewsContainer1', 'Politics'');};
 </script>
 </div>

 <div id="NewsContainer2">
 <script type="text/javascript">
 injectorsHolder['NewsContainer2'] = function() {addNewsBlock('NewsContainer2', 'Sport'');};
 </script>    
 </div>

The framework is ready and you can do now with GWT literally what you want :)
In the next post I will add an update to show the JSP custom tag implementation and show the overall solution working example.





Hangry

5 01 2010

I’m hangry.

This means I’m hungry + angry.

Add this word to your dictionary. Sometimes usefull :)





Basics of Painting: a Beginning of a Masterpiece

24 12 2009

Today my friend Max taught me basic things necessary to know if you decided to paint.

This post is a step by step illustrated guide that gives you an impression of how this works.

We started from deploying an easel:

Then we needed a pallet. We decided to make one by ourselves. Very easy one, you can “recharge” it many times quickly:

Then goes all the stuff: paints, brushes, medium, some paper to clean your hands from time to time, etc.

Don’t forget to fix your canvas in the easel.

Then it’s a time to put a bit of each basic colors onto the pallet:

That’s it :)

Now take your never-yet-used brush and prepare it:

And make your first touch

If you like it – go on

So we got smth like a sky. Not very nice as for the first try but nobody expected that it would be incredible painting :)

Close look shows that my hand definitely has a talent. Now I just need to develop it.





Your-Day: Activities Commenting Feature

3 12 2009

For those who have not yet visited Your-Day site, its URL: http://your-day.appspot.com/home.jsp

I’ve added a new feature that allows to add text comments to the activities.

It looks like this:

The feature works under all browsers except for the IE. I was thinking a lot should I support this rusty piece of can and decided that it is not worthy, simply have no time for this.

Commenting works with help of Ajax so when you add a comment it does not refresh a page.

Try it and have a fun :)





Open Space Offices

17 11 2009

Well, I was changing my mind about whether open space offices are good or bad few times already.

But now as I tried this, that and that my opinion established into solid idea.

Open space in no way helps to gain the pick of productivity. You can argue with this but I don’t give a fuck to this.

I am not about to state that each employee (developer) should take its own room. That’s would not be productive as well.

Small rooms for small teams seems to be the best.

But separate room seems the best choice for me personally. Just I am able to do the most during a day.

For those not able to use their brain efficiently I will use figurative language: working in an open space is like living in a hostel. Wanna work in open space ? – sell your house and go live in the hostel.





YoDay Application

8 11 2009

The very first version of my site: http://your-day.appspot.com/home.jsp

It’s like a Twitter but pictorial.

You can log in there with your gmail account.

Current set of features is very basic now:

- search for users (search by “Alex” to find me)
- follow/unfollow a user
- simple statistics
- filling your timeline

I will work on it further on but it is really interesting to know your feedback.

It looks like this:

yoday

Ah, and please use FF browser for now since I have not yet tested it under anything else. Myabe it works under IE/Chrome/etc. as well, just don’t know :)

Any feedback in comments would be great to have.





Stupid Funny HTML Thing: “option” tag’s “selected” attribute usage

4 11 2009

I do know that the HTML is no longer interesting for the major half of the developers but still sometimes you need to use it. Yesterday I’ve encountered one thing that after reading specs made me laugh a lot. I’m talking about “selected” attribute of the “option” tag.
In any programming language (any general language for logical people) normal usage of attributes that are meant by their nature to bee boolean is having 2 possible values to be set: true or false.

“selected” attribute in HTML is a bit different :) To not write a lot here is a receipt:

Specifies that this option will be pre-selected when the user first loads the page.

This is a boolean attribute. If the attribute is present, its value must either be the empty string or a value that is an ASCII case-insensitive match for the attribute's canonical name, with no leading or trailing whitespace (i.e. either selected or selected="selected").

Possible values:

    * [Empty string]
    * selected

So you either specify

<option value="fuck" selected="selected">it</option>

if you want this option to be selected or you should miss the attribute at all. I think this should have been a joke from the dude who created this ))

UPDATE:

I would not post this if this inconvenience did not impact the thing I am doing. It imapcts so I decided to write a little JSP custom tag that fixes the problem in a nice way:

@SuppressWarnings("serial")
public class OptionsTag extends TagSupport {

	public void setDataProvider(List value)
	{
		this.dataProvider = value;
	}

	public void setItemToSelect(DataItem value)
	{
		this.itemToSelect = value;
	}

	public int doStartTag()
	{
		try
		{
			JspWriter out = pageContext.getOut();
			String selected;
			for(DataItem item: dataProvider)
			{
				if (itemToSelect != null)
				{
					selected = itemToSelect.isEqual(item)?"selected='selected'":"";
				}
				else
				{
					selected = "";
				}
				out.println("" + item.getName() + "");
			}
		}
		catch (IOException ioe)
		{
			ioe.printStackTrace();
		}
		return Tag.SKIP_BODY;
	}

	private List dataProvider;
	private DataItem itemToSelect;
}

The usage of the tag in JSPs is straightforward:

<c:if test=”<%=activityCategories!=null%>”>
<select name=”categoryId”>
<components:options dataProvider=”<%=activityCategories%>” itemToSelect=”<%=currentActivityCategory%>”/>
</select>
</c:if>





Emotions

2 11 2009

Наскільки сильно людина може зрадіти чомусь гарному?

[5:53:06 PM] Bubusik says: такий….слой шоколадного тіста….крем…слой ванільного…крем….ванільного…..крем….крем….вишні…крем…..слой ванільного…крем…..слой шоколадного…..шоколадний крем…кокоссс
[5:53:10 PM] Bubusik says: няяяяяяям)

 

Аж самому захотілось схавати кусочок ))))