Showing posts with label by Jordan Beck. Show all posts
Showing posts with label by Jordan Beck. Show all posts

iPad Revolution?

Those who know me know that I have been a strong convert to the world of Mac. Over the past two years, I have had a personal Mac overhaul for all of my tech needs (except my phone, which I recently purchased the DROID and have enjoyed it thoroughly). So, when it came time for the fabled Apple tablet, I was extremely excited about the next piece of Mac-ness that I was going to be enjoying. But I was a little disappointed in the iPad initially. Where was the wow? Where was the pizazz? I was troubled.

But since that fabled day, I have picked up the pieces of my shattered dreams and started to reevaluate all of the potential that exists with the iPad. I initially fell into the trap of looking at this new piece of technology from the definitions of "nerd-dom". What I failed to see was this product from the point of view of the person who uses their computer to check email, browse the internet, look at photos, and that is it.

Here is an article and an essay that I thought were very interesting in seeing what could be the iPad revolution:

http://www.macworld.com/article/146040/2010/02/ipad.html
http://northtemple.com/2010/02/01/on-ipads-grandmas-and-gam

Let me know what you think!


As an Amazon Associate I earn from qualifying purchases.

Great Analytics Tool

If you are looking for a great analytics tool for your website, check out Woopra. It is now out of beta. I have seen it used a little and it looks pretty impressive. The basic plan is free, but if you are needing a little bit more information, here are the plans offered (http://www.woopra.com/plans/)


As an Amazon Associate I earn from qualifying purchases.

Color Palette Generator

Here is a very nice color palette generator that creates both a dull and vibrant color palette based off of a photo url.

http://www.degraeve.com/color-palette/


As an Amazon Associate I earn from qualifying purchases.

The Meaning of Open

Here is a great blog post written by Jonathan Rosenberg, Senior Vice President, Product Management at Google on what it means to be "open" and how Google is actively seeking that goal. I would love to hear people's comments.

http://googleblog.blogspot.com/2009/12/meaning-of-open.html


As an Amazon Associate I earn from qualifying purchases.

maven-compiler-plugin memory management

Here is how you give more memory to maven-compiler-plugin:

http://maven.apache.org/plugins/maven-compiler-plugin/examples/compile-with-memory-enhancements.html


As an Amazon Associate I earn from qualifying purchases.

Fixing MySQL after upgrading to Snow Leopard

After upgrading to Snow Leopard, I found that MySQL would not start for me. I found this link that walked me through getting it up and running again.

http://planet-geek.com/archives/2009/09/osx-snow-leopar.html

I haven't had the time to figure out what exactly was messed up in the installation of Snow Leopard. If anyone knows, I would be interested in that nugget of information.


As an Amazon Associate I earn from qualifying purchases.

More GWT Date woes

So, as we all know, working with dates in GWT is not much fun given the lack of a Calendar class to do any sort of date manipulation. Incrementing and decrementing dates must now be done by adding and subtracting from the milliseconds that have elapsed since epoch.

So we have a method that does the calculating for you and it has been working fine, until I stumbled upon a very interesting bug. Apparently, there is some issue revolving around November 1, 2009. Here some some code to replicate my results:
public void onModuleLoad()
{
DateTimeFormat format = DateTimeFormat.getFormat("dd/MM/yyyy H:mm:ss");
String dateString = "01/11/2009 1:30:30";

Date originalDate = format.parse(dateString);
Date date = new Date();

for (int i = -7; i < 8; i++)
{
date = incrementDays(originalDate, i);
System.out.println("DateUtil.incrementDay(" + i + ") = " + date.toString());
}
}

private static Date incrementDays(Date date, int xdays)
{
long time = date.getTime();
time = time + (xdays * 24 * 60 * 60 * 1000);

Date newDate = new Date(time);
return newDate;
}
Here is the output from this test:
DateUtil.incrementDay(-7) = Sun Oct 25 02:30:30 CDT 2009
DateUtil.incrementDay(-6) = Mon Oct 26 02:30:30 CDT 2009
DateUtil.incrementDay(-5) = Tue Oct 27 02:30:30 CDT 2009
DateUtil.incrementDay(-4) = Wed Oct 28 02:30:30 CDT 2009
DateUtil.incrementDay(-3) = Thu Oct 29 02:30:30 CDT 2009
DateUtil.incrementDay(-2) = Fri Oct 30 02:30:30 CDT 2009
DateUtil.incrementDay(-1) = Sat Oct 31 02:30:30 CDT 2009
DateUtil.incrementDay(0) = Sun Nov 01 01:30:30 CST 2009
DateUtil.incrementDay(1) = Mon Nov 02 01:30:30 CST 2009
DateUtil.incrementDay(2) = Tue Nov 03 01:30:30 CST 2009
DateUtil.incrementDay(3) = Wed Nov 04 01:30:30 CST 2009
DateUtil.incrementDay(4) = Thu Nov 05 01:30:30 CST 2009
DateUtil.incrementDay(5) = Fri Nov 06 01:30:30 CST 2009
DateUtil.incrementDay(6) = Sat Nov 07 01:30:30 CST 2009
DateUtil.incrementDay(7) = Sun Nov 08 01:30:30 CST 2009
As you can see, at November 1, the time gets decremented by one hour. I have not been able to figure out what exactly is causing this. I have run a ton of tests and have not been able to come up with any answers. All other dates in 2009 appear to work (although, I did not test them all). Also, November 1, 2010 does work, but it is off again on November 8.

Just another reason why we need a Calendar class for GWT.

If anyone has any ideas what is causing this, please let us know.


UPDATE:
Day light savings time did not cross my mind, and is seems to be the culprit in this issue. If anyone has any other ways of calculating the date on the client side in GWT, let us know. Thanks.


UPDATE #2:

Here is the new incrementDays() method to deal with this issue:

private static Date incrementDays(Date date, int xdays)
{
long time = date.getTime();
time = time - (xdays * 24 * 60 * 60 * 1000);

Date newDate = new Date(time);

Integer dateHour = new Integer(DateTimeFormat.getFormat("H").format(date));
Integer newDateHour = new Integer(DateTimeFormat.getFormat("H").format(newDate));
if (!dateHour.equals(newDateHour))
{
if (dateHour > newDateHour || (dateHour.equals(0) && newDateHour.equals(23)))
{
time = time + (60 * 60 * 1000);
newDate.setTime(time);
} else if (dateHour < newDateHour)
{
time = time - (60 * 60 * 1000);
newDate.setTime(time);
}
}

return newDate;
}


As an Amazon Associate I earn from qualifying purchases.

Downgrading Safari for Mac OS X

Today I ran into an issue running my GWT application. The problem came from updating to Safari 4.0.4 (to read on this issue click here).

The obvious solution was to downgrade back to Safari 4.0.3. I have needed to do this before and it was not an easy task (I'm running Mac OS X 10.5.8) Finally, I found an easy way to accomplish this task.

First, you need to download an application called Pacifist. Then you need to find the dmg image for the version of Safari you want to downgrade to. In my case, 4.0.3 can be found here. Once you have the package downloaded, you will need to open it in Pacifist. Select the pkg and hit "Install". Once it starts the install process, it will tell you that the file(s) already exist. For all files / applications, tell it to "Replace" the existing file.


As an Amazon Associate I earn from qualifying purchases.

Hibernate: Case Insensitive Query

We ran into a situation where we needed to match a string from our application to a string in the database. A very common task. But this time we needed it to be a case insensitive match. In order to do that using Hibernate annotations, we ended up using Restrictions.ilike().

Here is some example code:

public List fetchByCountry(String country)

{

DetachedCriteria criteria = DetachedCriteria.forClass(MobileCarrier.class);

criteria.add(Restrictions.ilike("country", country, MatchMode.EXACT));

return getHibernateTemplate().findByCriteria(criteria);

}


The ilike method is a case insensitive like statement, and when combined with a MatchMode.EXACT, it accomplishes the task of an exact string case insensitive match.


As an Amazon Associate I earn from qualifying purchases.

Cloud Computing

Here is a link to a site that has cloud computing offerings:


The video at the bottom of the screen is a very good high level introduction to what cloud computing is.


As an Amazon Associate I earn from qualifying purchases.

10GUI

http://10gui.com/video/

This is a concept video of how to effectively incorporate multi-touch into a desktop computer. That part of the video is interesting, but I think the even more revolutionary idea in this video is how they suggest changing the "windowed" approach to the desktop. I can see some pitfalls in what they call "con10uum", but I think it is a great starting point.

I would love to hear anyones thoughts on the topic or if anyone else has links to new types of UI. New UI concepts are very exciting!


As an Amazon Associate I earn from qualifying purchases.

GTUG Meeting - GWT Optimization

Here are the slides from my presentation on GWT Optimization:
Presentation Slides

Also, here are the resources that I mentioned in my talk:

(The "Measure In Milliseconds" video is really informative.)

Thanks to everyone who made it out last night. It was a great meeting!


As an Amazon Associate I earn from qualifying purchases.

Google Maps with GWT

Here is a link for the library needed to create Google Maps in GWT:


Here is a small (very small) demo that I did in App Engine using gwt-maps-1.0.4:



As an Amazon Associate I earn from qualifying purchases.

Mouse Button Click

If you need to determine which button is clicked on a mouse with a ClickHandler, you can use the NativeEvent class. Here is code that determines whether or not the ClickHandler was trigger by a right click or not (event is ClickEvent):

if(event.getNativeEvent().getButton() == NativeEvent.BUTTON_RIGHT)

{

GWT.log("Right Click", null);

}

else

{

GWT.log("Left Click", null);

}



As an Amazon Associate I earn from qualifying purchases.

GWT 1.6: "removeClickHandler" solution

GWT 1.6 changed all Listeners to Handlers and in the process setup a few different practices. One possibility with GWT before 1.6 was to add a ClickListener to a FocusPanel and then remove it by calling the method removeClickListener(ClickListener listener). But, in 1.6 this is not an option with Handlers. There is no removeClickHandler(). Instead, when you add a handler to a widget, it returns an instance of HandlerRegistration. This can then be used to remove that handler. Here is an example of a handler being adding then removed:

FocusPanel focus = new FocusPanel();

HandlerRegistration registration = focus.addClickHandler(new ClickHandler()

{

public void onClick(ClickEvent event)

{

// Panel has been clicked

}

});

registration.removeHandler();



As an Amazon Associate I earn from qualifying purchases.

KeyPressEvent: Getting the key code

There is a new way to get what keys are pressed in GWT 1.6. Now KeyPressHandler is used to listen to a TextBox:

TextBox box = new TextBox();
box.addKeyPressHandler(new KeyPressHandler()
{
public void onKeyPress(KeyPressEvent event)
{
// Listen to key event
}
});


You can use event.getCharCode() to get the character that was pressed, but in order to get the key code (int) that was pressed you need to use the following method:

event.getNativeEvent().getKeyCode()


So here is code to listen to when the "Enter" key is pressed:

TextBox box = new TextBox();
box.addKeyPressHandler(new KeyPressHandler()
{
public void onKeyPress(KeyPressEvent event)
{
if (KeyCodes.KEY_ENTER == event.getNativeEvent().getKeyCode())
{
System.out.println("Enter key has been pressed");
}
}
});


As an Amazon Associate I earn from qualifying purchases.

App Engine Presentation

I didn't put my presentation up, but here is a link to the app engine home page

http://code.google.com/appengine/

The video on that page was the first video I watch on App Engine and goes over the exact same thing I went over in my talk. It was a great first meeting. I'm looking forward to meeting more people and exchanging more ideas. Enjoy!


As an Amazon Associate I earn from qualifying purchases.

Great Site for CSS and Javascript Creativity

Here is a great site by Stu Nicholls in which he uses CSS to create menus and widgets:

http://www.cssplay.co.uk/

Also, here is his Javascript site:

http://www.stunicholls.com/


As an Amazon Associate I earn from qualifying purchases.

Workaround for Safari 4 and GWT Issue

Here is a temporary workaround for this issue with opening GWT projects in Safari 4:

1. Compile the project in PRETTY mode (see previous post).
2. Find the files used by Safari. To do this, run this script in the compiled directory(~/Documents/workspace/MyProjectName/www/com.MyProjectName):
grep 'safari' *.nocache.js

This will find one or more files. The only difference between the files (as far as I can tell) is language settings.

3. Copy the 'default' file to another location. This will be used later.
4. Recompile in OBFUSCATED mode instead of PRETTY (see previous post) and deploy to the server.
5. Open the project in Safari 4.
6. Open the Error Console in Safari 4 (Develop --> Show Error Console)
7. You will see an error saying "SyntaxError: Expression too deep". Parallel to that, there will be a file name. Rename the file that you saved earlier to this file name.
8. Take this renamed file and replace the existing file on the server.
9. Restart the server.


There is also another workaround I have found and tested:

1. Compile and deploy in OBFUSCATED mode.
2. Open the application in Safari 4.
3. Open the Error Console in Safari 4 (Develop --> Show Error Console)
4. Find the offending file that is creating the error and open it in an editor (*Note: do to the large size of these files, some editors will not be able to open it. I use BBEdit (for Mac).)
5. Once the file is open, you will see a very long line of variables (ie: var ..., ..., ...). This is the offensive line. Insert new line characters every several hundred characters. (I believe the computable threshold is a thousand characters, but I have not run appropriate test to find the limit.)
6. Save the file and restart the server.


As an Amazon Associate I earn from qualifying purchases.

Compiling GWT in PRETTY mode with Ant

Here is how we are currently compiling our GWT project (version 1.5.3):

< java taskname="GWT compile" classpathref="class_path"
classname="com.google.gwt.dev.GWTCompiler" fork="true"
maxmemory="512m">
   < jvmarg line="-verbose ${JVM_ARG_START}">
   < arg line="-logLevel WARN -XdisableAggressiveOptimization -out www com.ucc.csd.CSD">
< /java>
In order to compile in PRETTY (or any other mode) is to add the -style argument to the arg tag followed by PRETTY.

< java taskname="GWT compile" classpathref="class_path"
classname="com.google.gwt.dev.GWTCompiler" fork="true"
maxmemory="512m">
   < jvmarg line="-verbose ${JVM_ARG_START}">
   < arg line="-logLevel WARN -XdisableAggressiveOptimization -out www com.ucc.csd.CSD -style PRETTY">
< /java>


As an Amazon Associate I earn from qualifying purchases.

apt quotation..