All Things Techie With Huge, Unstructured, Intuitive Leaps

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.