All Things Techie With Huge, Unstructured, Intuitive Leaps

JdbcOdbcDriver.finalize() line: not available


I was using Eclipse, with a Tomcat Java project, and every time I tried to start the server, I immediately jumped into debug mode, and the issue was:

JdbcOdbcDriver.finalize() line: not available


Google was no help.

I previously thought that this was the answer. I was wrong.

Finally I figured it out. I had some managed beans that were backed by a database. These managed beans were annotated @eager

When the server started the app from eclipse, they were instantiated and the tool went to the database to get the data. I had an exception thrown in the method from the database bean (a null pointer exception), and as a result, the connection to the database was being left open.


Somehow, the .metadata folder was buggered up and corrupted. I exited Eclipse. Then I went to the Eclipse workspace and copied the .metadata folder to my desktop to have a safe copy, then I deleted it in the workspace.

I re-started Eclipse. There were no projects. I imported them back in using Import > File System.

I had to fix the Build Path under the project properties and under the Window > Preferences, I had to reset the Tomcat Home. Voila, got rid of this super annoying problem.




That was the cause of the problem. Hope this helps someone.

Desperate Microsoft -- Internet Explorer 8

How pathetic. I just signed out of Hotmail, and instead of a re-direct to MSN.com, instead I get a re-direct to a page called beautyOfTheWeb. The above is a screenshot. You will notice that the request parameters for the URL in the navigation bar say XP and Google Chrome browser, what I use on my laptop.

Then Microsoft has the temerity to tell me that my browser scores a 2.5 out of 4, and that I should download Internet Explorer 8 along with the Bing search tool and MSN.

I got off Internet Explorer because it is a piece of crap software that is virus prone, and using it, I got a virus that destroyed my desktop computer. Since using Firefox and Chrome, along with Avira, I haven't had a virus ever again.

And they want me to trust them? Ha!! I read that finally the IE browser by Microsoft is no longer dominant in the marketplace, and I say "It's about time". Now they have to resort to scare tactics which are patently untrue, and they have to hijack me when I sign out of Hotmail.

Truly, Microsoft is on the way of the dodo bird.

Javascript: Getting Rid of Unwanted Characters in Number Field


I had a field on a web page where a person would fill in their tax rate as a percentage. Of course, people would put in the percent sign ( % ) along with the number and it would choke the web page. So I needed a quick javascript function to strip out unwanted characters, and leave just numbers and the period if it were a decimal number.

Here is the snippet required. I take the form input. The form name is refForm and taxRate is an input value. The ^ is a negation sign in javascript so I am taking everything out except numbers and decimal.

var si = document.refForm.taxRate.value.replace(/[^\d.]/g, "");
document.refForm.taxRate.value = si;

I assign the original value to a variable and then pass the value back to taxRate after the characters are gone.

Easy way to replace all characters and just leave the numbers using javascript.

A NEw PAraDigm in IT ConsULTing

I have been an IT consultant for over 20 years, and the face of it is changing. I've noticed that in this current economy, it is harder to get consulting gigs, they aren't as long term as they used to be and there is downward pressure on per diems.

In a lot of ways, consultants who became full time employees are starting to look a lot smarter than they did ten years ago. They have benefits, generous stock options, paid holidays and access to company pension plans.

The differential gap between consulting per diems and IT salaries is closing rapidly. Is there a different way that consultants can still enjoy the freedom and diversity of experience in consulting and still be rewarded? I believe that I have found a way.

I would like to fictionalize a recent experience to illustrate perhaps a new paradigm in consulting.

A middling player in a major market decided that they needed a technology boost to compete with the big boys and increase their market share. They decided to increase their presence by using a mobile app that would make the delivery of their products and services less expensive.

Going to a major IT development shop, they were quoted $300,000 to develop their custom app. Approaching a private consultant who was experienced and capable, this consultant offered to develop the app for 10% of the quote ($30,000) and 25% of the net profits that the app generated.

This worked out well. A gig of several months is now providing recurring income two years after the development cycle, and our consultant is on his second project where he is sharing the development costs, the risks and also the profits.

This just might be a new paradigm for IT consultants where they can reclaim the edge that they had over full time IT employees.

Javascript: Uncaught SyntaxError: Unexpected token ILLEGAL


Notes to self: If you get this error on your javascript console:

"Uncaught SyntaxError: Unexpected token ILLEGAL"

The first thing to try, is that if you are passing a string as a parameter, put it single quotes.

This drained me for an hour.

The Meta Refresh Tag with JSF, JSP, XHTML and Icefaces Apparently Doesn't Work

I have an application that not only has the Icefaces Ajax push, but certain elements require a client side refresh. I had a heck of a time trying to make the meta refresh tag work.

Tried a whole pile of stuff, then I realized that the tag should be in template and not on the xhtml page. Worked like a charm.

I thought that I would put this up for others who struggle with this and Google is of little help. So if your meta refresh tag doesn't work, put it in the template.

Microsoft Mango Desperate For Developers

It looks like Microsoft is desperate for developers to make apps for the Mango phone. I am a registered Microsoft developer, and I just received the email printed below. (They want $99 from me to develop apps. Amazon just waived the $99 fee for developers to develop on the Android phone). Here is the email:

Mango for everyone Vol 14 | October, 20
It’s been a very exciting couple of weeks in the world of Windows Phone! Over the past two weeks, we have seen an incredible amount of activity surrounding the launch of Windows Phone 7.5 (formerly Mango). It’s actually been somewhat surreal in some ways because people are paying attention to this release and actually think it’s downright cool!

So what exactly did we announce over the past few weeks? I’m glad you asked! The major announcements included:
The Release of Windows Phone 7.5 by carriers to end consumers: Microsoft has begun delivery of the Windows Phone 7.5 update to Windows Phone users by carriers. To find out when your carrier will be ready to send out the update to you, there is a handy little web page here that gives you the status of the update relating to your carrier.

Introducing the Mango App Challenge: Developers, do we have an awesome deal for you. We have introduced a promotion called the Mango App Challenge that in essence will give you a new phone (up to 300 total for the entire promotion) if you build 2 new, quality Windows Phone 7.5 apps (or games). Interested? Then start your PC and begin coding, because the promotion ends on December 15th, 2011!
The Introduction of the Web-Based Marketplace: Last week the web-based version of the Windows Phone Marketplace was launched. This is great because it allows you and potential end users to find and purchase apps you’ve built onto their phones using a non-Zune experience. It’s also great for providing a way for potential users to see your apps that don’t even have the Zune software on their machines.
Windows Phone SDK 7.1 Launches: Also last week, we launched the go-live version of the developer tools for Windows Phone 7.5 and you can download the tools here for free . Even if you’ve built Windows Phone 7 apps already, it’s a good idea for you take a look at your app and update them to take advantage of the Windows Phone 7.5 features that were previously unavailable.
The Marketplace Expands by 19 Countries: When Windows Phone 7 launched, the Marketplace supported 16 countries. With the update of the Marketplace, we have included 19 new countries making it easier for your apps to reach an even larger audience.
In-App Advertising: In the past it was difficult to collect the revenue from in-app advertising using Microsoft’s Advertising Framework as it required you to provide a US non-PO box address for US tax regulations. That requirement is no longer required for Canadian developers using the Microsoft Advertising solution . This gives you a really great new option for monetizing your creations on Windows Phone.
A Change to the Bulk App Policy: One of the things that Microsoft is committed to is providing the end consumer with the best possible experience to find, download and enjoy apps and games. To ensure that experience remains extremely enjoyable, we have made some changes to our bulk app policies . In a nutshell, app publishers will be able to submit up to 10 apps in a day for certification. Likewise, publishers will limited to publishing 10 apps in a single day as well.

That’s just some of the cool stuff that’s been happening on the Windows Phone front. Excited? We certainly hope you are! So since you’re excited (and maybe have a couple of great ideas for apps that you want to build and get a free phone out of it), how do you start? Below are some steps that can get you from idea to published app!

GO DO's:
Download the Windows Phone SDK 7.1 . All the tools you need to start building apps and games are here.
Read the Microsoft Canada Windows Phone Development resource page . This page contains links to everything you need to start learning how to build amazing app and game experiences on Windows Phone.

Register as a developer on the Marketplace. Once you’ve developed your app, you’ll need to submit it to the Marketplace for certification and publication which requires you to be registered on the Marketplace (it’s a $99 annual subscription).
Build a second app or game, and submit both of your new apps/games to the Mango App Challenge !
Paul Laberge
Developer Advisor, Microsoft Canada Inc.

UIX and UX Tip -- A Note To CNN as Well

Above is a screen shot of the new CNN beta video player. The reason that you don't see any video (yet) is because I got a screen shot of it while the video was loading. It was slow.

But slow loading is not my issue today. The issue is an all black screen. I have been using my laptop on the balcony all week long outdoors, and when you have an all black screen outdoors, it acts more like mirror than an all white background on a web page.

More and more people are viewing web pages on mobile devices while outdoors. It you want them to have a good User Experience, you will not use an all black screen like CNN is doing -- unless you want your web page to be used for a make-up mirror.

And yeah -- I know ... I know .... this blog is an all black screen. My excuse is that I used a Google template and this was the only one that fit my theme.

Java - Convert Gregorian Calender to DateTime

When programming in Java, I like java.util.GregorianCalendar a lot. It makes date and time manipulation easy peasy. For example, I have an application where I have to get the current datetime and add twenty minutes. It happens in a couple of lines:

GregorianCalendar gc = (GregorianCalendar) GregorianCalendar.getInstance();
gc.set(GregorianCalendar.MINUTE, +20);

Piece of cake. But when I wanted to take the manipulated time and cache it back to the database (mysql), I was stymied for a moment. The database field was a datetime entity, and for a few minutes I wondered how to convert Gregorian Calendar to DateTime.

I didn't realize the relationship between DateTime and TimeStamp, so it took me a few minutes longer to figure out. The piece of code that eventually worked was:

GregorianCalendar gc = (GregorianCalendar) GregorianCalendar.getInstance();
gc.set(GregorianCalendar.MINUTE, +20);
java.sql.Timestamp javaSqlTS = new java.sql.Timestamp(gc.getTimeInMillis());

Hope this helps someone Googling how to convert Gregorian Calendar into DateTime for SQL.


The Future of Computer Gaming

One of the reasons that computer gaming is so popular and addictive, is that it offers some real excitement in the boring moments of a person's life. If one has a normal life, it can get pretty mundane. Playing a computer game stimulates the production of brain chemicals like dopamine and other endorphins like adrenaline. One can get used to the chemical rush produced by playing video games.

So computer games will push the envelope further and further to produce larger highs and more excitement for their players (and line their pockets with the profits). The ultimate computer game is casino gambling, but that has negative social connotations and it is dangerous in the fact that the odds are stacked against the player and one can lose all of your money.

Video games will get more and more realistic, until they cross the line into reality. We have already seen that with foursquare.com. However foursquare is too much reality in the fact that it misses the instant gratification of say a computer game.

So the new genre of computer games will ultimately combine reality, excitement, suspense, competition and a bit of gambling thrown in. That is the ultimate formula. I think that I have a recipe. Thank goodness that I am a coder.

Escape The Ampersand

I just spent several hours pulling out my hair trying to escape the ampersand character in an .aspx URL with parameters. The URL was a third party URL which needed to be encoded. I was working in JSP, JavaScript, XHTML, JSF, and JSTL.

It went something like this:

www.mydomain.com/login.aspx?name=Username&Password=password&accountNo=AcctNo

I constructed the string and tried to escape it with a "\". Of course, I quickly realized that it was illegal. There are only a few things that work with that escape character.

Then I tried the '& amp;' thing. That didn't work.

Then I tried the '% 26' thing. That didn't work.

I imported the URLEncoder and fed the string into that. It didn't work.

I tried using the URI constructor with the 5 input elements. I have more than 5 inputs and it kept throwing a path exception. Nothing seemed to work.

I tried most things and they didn't work.

What finally worked was the \u0026 thing.

In the JSP the URL looks like this:

String url = "www.mydomain.com/login.aspx?name=Username\u0026Password=password\u0026accountNo=AcctNo";

Hope this helps somebody.

This Caught My Eye -- Investigating Jurors Over the Web



Check out how Facebook and social media is being used to investigate jurors.

Yahoo Mail is Down?

I haven't been able to access Yahoo mail today. That includes all permutations and combinations of Yahoo mail such as rocketmail. It started out very slow, but eventually a message showed up when you clicked on it in the in box. Then it started timing out. Finally, I got the server hangup message.

Java Server Faces Redirect

I have been created a JSP/JSF web application and a certain aspect of it was coded in XHTML using JSF and Facelets. It has been giving me no end of grief. On every page, I do a check of a session attribute to see if the person is logged in or not. It is a simple check. I have a page that is included with every JSP page that contains a little scriplet that queries the session attribute. If an attribute called "Access Granted" is true, then the person is logged in and gets to view the page. If not, they are re-directed to the index page which is the login page.

Here is the normal code that works great as a scriplet:

<%

//If a user bookmarks a page, then this check is performed to see
// if they are properly logged in. If not they get re-directed
// to the login page.

// The way that it is done, is that the login validation sets an
// Access Granted attribute.

String accessGranted = (String) session.getAttribute("AccessGranted");
if(accessGranted == null)
accessGranted = "false";
if(accessGranted.equalsIgnoreCase("false"))
response.sendRedirect("index.jsp?NotLoggedIn=True");
%>

Simple stuff. Then I had a page coded in XHTML and I used the ui:include tag:


The tag worked, but the page didn't. The scriptlet tag <% some code ... %> fails because it is not well formed html. It is not closed like a regular tag "/>".

So I rewrote the page in well-formed XML. I added the JSTL jar so that I would have access to the c:if conditional tag and the c:redirect tag. One can always get a session attribute with the following syntax:

"#{sessionScope['attribute_name']}"

OK, so I use the conditional tag in the jstl core to see if the session attribute was true, and if not, then re-direct to the index page. Piece of cake, right? Wrong.

After dicking around for a long time, I had an error message that said something like the tag was defined in "http://java.sun.com/jsp/jstl/core", but no class could be found. It was after a bit of hair pulling that I found out that the c:redirect tag was not supported by facelets.

A lot more dicking around ensued until I found this javascript work-around that enables a JSF redirect. Here is the code in its entirety:




Having a problem as this blog wants to parse the tags in the code. Replace '<' with < and '>' with >.




'<'ui:composition
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" '>'

'<'c:if test="#{!sessionScope['AccessGranted']}" '>'

'<'form jsfc="h:form" id="redirect"'>'
'<'a jsfc="h:outputLink" value="#{'index.jsp'}" id="path" '>''<'/a'>'
'<'script type="text/javascript"'>'
var link = document.getElementById("redirect:path");
location.replace(link);
'<'/script'>'
'<'/form'>'
'<'/c:if'>'

'<'/ui:composition'>'



It works perfectly. However, JSF is supposed to uncomplicate your coding life. It just did the opposite for me.

Website Traffic Faking


There is a new trend in town, and its traffic faking. It happens two ways. The first traffic-faking scenario is when a website has Google Adsense on it, and Google pays per page impressions. The pay for click is pretty good, but Google has ways of detecting fraudulent clicks. However they pay a penny or two for a certain number of page views, and this is what traffic faking targets. It is relatively easy to spoof unique page views, but a heck of a lot harder to spoof the controls that Google puts in for fraudulent clicks. So this type of traffic-faking hits as many times per hour as programmed, and the pennies add up for page views.

The other type of traffic faker is aimed at people who check their web analytics. For example, I have a blog based on philosophy, and I noticed that I was getting referrals from an ad-laden website peddling tooth-whitening products. It appeared that they had a referring link to my blog. As it turns out, I went to the page, and there was no link. They generate traffic to their pages through sheer curiosity.

On another one of my blogs, a company selling colored toilet paper used a traffic faker. I usually go to their websites, and hit the contact button, and used terms related to lower anatomy and sphincter muscles, and tell them forcefully to stop traffic faking. I don't know if my scatological references really work, but it makes me feel better.

One would think that the smart people at Google would work out a traffic faking filter. I think that I will go and ask them to do so. I will let you know what they say.