Friday, December 30, 2011

Useful Stuff - 12/30/2011

Send Google Calendar Alerts to Any Cell Phone
Windows Freezes at Login Screen: Hardware Problem or Windows Problem?
Online Odd Jobs: How Startups Let You Fund Yourself

Wednesday, November 30, 2011

Useful Stuff - 11/30/2011

ASCIIFI Picture to ASCII Converter -
USB Stick Contains Dual-Core Computer, Turns Any Screen Into an Android Station -
Raspberry Pi, An ARM GNU/Linux box for $25 -
Microsoft DreamSpark (Microsoft professional tools free for students) -

Monday, November 14, 2011

Some Useful Quotes, etc.

Well done is better than well said. - Benjamin Franklin #quotes
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is. #quotes
There is nothing more ugly than the code you wrote last year. #lessonsivelearned
Posting anonymously almost never works when you sign your name in the post content. #lessonsivelearned

Today's Useful Stuff

So twitter is lame about tracking/searching historical tweets.  That means I'll be posting future useful stuff here.  Here is the list of twitter links that are not yet here to catch up:

10 More Stubborn Food Myths That Just Won't Die, Debunked by Science - 
Tantrum Tamer: New Ways Parents Can Stop Bad Behavior - 
Keep sensitive info out of your chat logs & email - 
Hands-on with GarageBand for iPhone: 8-track studio in your pocket - 
The power of big free data - 
Over 21,000 sign petition seeking "vapid response," cookies - 
Troy Hunt: Aye, pirates be the reason IE6 just won't die - 
BASIC Computer Games (also recoded for Small Basic) - 
Don't Call Yourself A Programmer - 
Microsoft's vision of everyday future tech (video) 
When passwords attack: the problem with aggressive password policies - 
Life in a Day crowdsourced documentary hits YouTube - 
European wars, famine, and plagues driven by changing climate - 
When did the giant impact that formed the Moon take place? - 
Massive 15-year study finds no link between cell phones, cancer - 
"Living fossil" has been populating the coast of Africa - 
Mad -- or Just Angry? - Inside Higher Ed: 
22 miles straight up in 90 seconds - 
Why Do Some People Learn Faster? - 
Facebook Is Tracking Your Every Move on the Web; Here's How to Stop It - 
Unwatchable: dial R for rape. How much does your handset really cost? - 
Syma S107/S107G R/C Helicopter - 
Do users change their settings? - 
Trying Linux for Windows Users – A visual tutorial - 
Tricky Programming Concepts Aren't - (contains inappropriate language, beware) 
Tinkering - Inside Higher Ed - 
The Art of Automation (using a Lego robot) - 
Orbit the Earth in One Minute Via Fascinating ISS Time-Lapse Video - 
Thoughts on 'Pinched' - Inside Higher Ed - 
Announcing increased moderation of trolls in discussion threads - 
Pulaski Academy scores 29 points before opponent touches football - Scorecasting - - 
Web service aims for farm-fresh produce at big-box prices - 
Is Windows vulnerable to attack by stolen digital certificates? 
Easy Facebook Scripting in Python - 
Can't resist that marshmallow? Self-control doesn't get easier with age - 
Why Time Goes Faster as You Get Older | Psychology Today - 
Ten Things Everyone Should Know About Time - 
Finding Sleep - 
Status Anxiety - Inside Higher Ed: 
The Frequency of War - 
When computers talk to each other, conversationally - 
Selfish Tech - 
Academic Earth: Online courses from the world's top scholars - 
Can you tell a real Facebook e-mail from a phishing attempt? - 
Raspberry Pi: A $25 ultra-low-cost computer that can run Quake 3 - 
HP TouchPad: Everything you want to know - 
Password Policies are Getting Out of Control - 
We Didn't Have Zeros (Dilbert) - 
Mindset List, Class of 1915 - 
The Mindset List, Class of 2015 - 
Bats navigate with visual map, additional unknown cues - 
Mother Nature as Engineer: 9 Design Tricks Borrowed From Biology - 
How To Remove Yourself from People Search Websites - 
Can we believe our eyes? (Unicode character hacking) - 
Scripting Languages: PHP, Perl, Python, Ruby - a side-by-side reference sheet - 
How to put your logo in a QR code - 
On the front line of the riots with the police - Telegraph - 
'The Edupunks Guide' Offers DIY Path to a Credential - 
One day in the robot house - 
Password Strength (xkcd) - 
Am I Under a Shady RAT Attack? - 
Ken Robinson says schools kill creativity (TED Video) - 
Confessions of an Edu-Traitor - 
Basic Animatronics Tutorial: PIC Based Servo Eyebrows - 
How to Make a Wi Fi Booster Using Only a Beer Can - 
Build your own gadget with Microsoft's Lego for adults - 
Top 20 Highly Useful Google APIs For Developers And Designers - 
Programmable, Wrist Watch / Computer - Aug 04, 2011 
Your New Campus Guide: A Small Patterned Square That Talks to Your Smartphone - 
10 habits of highly organized people - 
Black Hat: 10 can't-miss hacks and presentations - 
Dead British gamer's father warns of blood clot risks - 
Tablets are for people who hate computers - 
'War texting' lets hackers unlock car doors via SMS - 
10 Apps for Web Developers on an iPad | Think Vitamin - 
The 10 Best Investments in the Event of U.S. Default or Downgrade - 
How to build your own quadcopter, step by step - 
Apps vs the Web » Matt Legend Gemmell - 
Expert hacks car system, says problems reach to SCADA systems - 
If I Could Get Away With It... - (Empirical evidence v. folk wisdom) 
Best USB microphones for high-quality Skype audio - 
The 3 Most Common Uses of Irony (The Oatmeal) - 
YouTube film 'Life in a Day' coming to theaters - 
The @-symbol, part 1 of 2 - 
Time Travel Impossible, Say Scientists - 
The Principles of Good Programming - 
20 Database Design Best Practices - 
How to survive an iPhone liquid submersion (hint: it's not rice) - 
All About Accelerometers - 
Unleash the Power of Open Source R, the World's Most Sophisticated Data Analysis Software - 
I hate computers, but I love what you can do with them - 
Dunning-Kruger effect (how people tend to incorrectly assess their own competence) - 
Dual-boot your Nook Color with Android using a micro-SD card, $35 - 
Does Not Compute: 10 PC Myths from Movies and Television - 
More Coffee, Less MRSA Risk... But Why? 
The Singularity is Far: A Neuroscientist's View - Boing Boing - 
First Demonstration of Time Cloaking - 
What Ails Us (Baumol's cost disease) - 
Ask the Administrator: How to Spot Bloat? - Inside Higher Ed: 
Why McAfee is still at the top of my Not Recommended list - 
HackNotifier (check to see if your email is included in recent hacktivity) 
How to find out if your personal info has been leaked in a security breach - 
Spammers' new favorite delivery model: Your compromised email account - 
Web proxy add-on Cocoon goes free - 
View all your tweets on one page with All My Tweets - 
Turn your iPad into a laptop with the KeyCase iPad Folio Deluxe - 
CoPilot Live launches next generation iOS clients with launch special pricing -  
DHS: Imported Consumer Tech Contains Hidden Hacker Attack Tools - 
How to Build Your Own Pulsed Laser Pistol - 
Let me google that for you - 
Letter Frequencies and Keyboard Layouts - 
Why Google+ Business Profiles Will Trump Facebook Pages - 
Stay safe online: 5 secrets every PC (and Mac) owner should know 
Kevin Mitnick shows how easy it is to hack a phone - 
User Testing in the Wild: Joe's First Computer Encounter - 
Archive your tweets with Twapper Keeper - 
My Summer at an Indian Call Center (fascinating) - 
Royalty-free, perpetual, irrevocable, non-exclusive, transferable licenses - 
Maintain Security / Anonymity on the Internet - 
Researchers cast doubt on cell phone cancer risk 
Email Charter - 
Time (programming, not the magazine) - 
Physicist: Programs run the universe 
10 Ways to Archive Your Tweets - RSS, python scripts) 
Is there anyway to extract our tweets? - 
Back Up your Twitterings! - 
Using Google Spreadsheets to extract Twitter data - 
Tech Organizational Charts - 
Developers: just a few lines of JavaScript connects your site to Hotmail, Messenger, and SkyDrive 
Peek inside a hand-cranked Civil War submarine - 
Google's Swiffy makes Flash files HTML5 friendly - 
The First World Problems Rap - 
Tor (prevent internet surveillance) - 
Another freelance website - 
How to Check If LulzSec Leaked Your Password One Last Time - 
LulzSec disbands: Final cache includes AT&T internal data and 750,000 user accounts 
Toddlers get difference between faulty hardware, operator error 
City dwellers more sensitive to social stress than country folk - 
How Hitler Could Have Won - 
The Sun Is the Best Optometrist - 
Trojans, viruses, worms: How does malware get on PCs and Macs? - 
Why humans (and other primates) lend a helping hand - 
Passpack Blog » Why Masked Passwords Are a Serious Security Hole - 
Google releases Chrome-based Web security scrutinizer - 
IBM and the Holocaust - 
Man politely robs bank for $1, lands free healthcare in prison 
Supercomputers Challenge Human Brain - 
10 Ways To Access Blocked WebSites - 
Virtual currency: Bits and bob For gadget buyers, timing is everything - 
LulzSec Email Check (Gizmodo) - 
LulzSec Leaked Email Widget - 
LulzSec leaks 62,000 emails and passwords, also targets CIA 
Make money online, part 1: Introduction to Google AdSense 
5 Tips About Time Management - 
GPU Password Cracking – Bruteforceing a Windows Password Using a Graphic Card: 
'You Look Great' and Other Lies -  
Is the cryptocurrency Bitcoin a good idea? - 
Lulz Security (LulzSec) Releases - 
Asciiflow - Ascii Flow Diagram Tool -  
xkcd: Security - #Comics 
Digging Into Data, Day 2: Making Tools and Using Them - 
How to become a proficient Python programmer - 
Free WebMatrix e-book -  
Console2 - A Better Windows Command Prompt - 
Nook Touch Rooting Directions Posted -  
Risk, probability, and how our brains are easily misled - 
TKP Tips: Making a SmallBasic runnable flash drive - 
Java tutorial for beginners - Introduction - 
So You Want To Teach Your Kids To Program? - 
Free for All: National Academies Press Puts All 4,000 Books Online at No Charge - 
Microsoft ships free malware cleaner that boots from CD or USB -  
Raising Graduation Rates, and Questions - 
Killer tips for mastering Google Chrome - 
Test IE6, IE7, IE8, IE9, and IE10 in Windows 7 - 
Beyond simple rooting: Turning the Nook Color into a complete tablet - 
How to hack the $250 Nook Color into a full Android tablet - 
Resign Patterns - (the 'Simpleton' says it all) 
Amazon Mechanical Turk -  
Hands-Off Training: Google's Self-Driving Car Holds Tantalizing Promise, but Major Roadblocks Remain - 
A Thorough Examination of "Disabling the Back Button.", Part 2 - (see javascript method) 
Virgin Mobile offers $20/month for 500 MB of data, or 1 GB if you refill at Walmart - 
Macrium Reflect (disk imaging s/w) - 
CloneZilla (disk imaging s/w) - 
The Chilling Story of Genius in a Land of Chronic Unemployment - 
The Myth of the Three Laws of Robotics – Why We Can't Control Intelligence - 
Tiny $25 Computer for Kids Who Want to Learn Real Computing - 
$99 CMU robot is computer science learning tool - 
Self-assembling rafts: how fire ants survive floods - 
Telnet - SMTP Commands (sending mail using telnet) - 

Thursday, June 16, 2011

Create Java Scriptlets for Jasper Reports (part 2)

In part 1, we addressed the basics of creating Java scriptlets.  Now, we'll look at a specific example that updates a database based on report content.  In this example, we're using the underlying Jasperserver database and writing back to it.

Let's look at the Java code first:

import java.sql.*;
import net.sf.jasperreports.engine.JRDefaultScriptlet;
import net.sf.jasperreports.engine.JRScriptletException;

We're combining both the default Jasper scriptlet method and java.sql.* for the database update.  

public class UpdateQrtzTriggers extends JRDefaultScriptlet {}

This is the overall class.  

There are two objects within the overall class:

public void afterDetailEval() throws JRScriptletException


public String updateDB(Connection con, String trigger_names) throws SQLException

For the database update, we pass in the connection and a list of triggers to include in the update.  

After processing every report row (afterDetailEval), we collect the value of a field within the report and append it to a master list:

String trigger_name_list = (String)this.getVariableValue("TriggerNames");
String trigger_name_field = (String)this.getFieldValue("trigger_name");

if (trigger_name_list != null) //if trigger name list already contains values, treat as append
    if (trigger_name_list.indexOf(trigger_name_field) == -1) //only append value if trigger name is not already in list
        this.setVariableValue("TriggerNames", trigger_name_list + ",'" + trigger_name_field +"'");
    this.setVariableValue("TriggerNames", "'" + trigger_name_field +"'");

In the summary section of the report, we call the database update specifically as follows:


This gives updateDB its parameters.  It then does this with them:

    if (con.isReadOnly() == true) //make sure update can proceed
    String sql_1 = "UPDATE qrtz_triggers q SET next_fire_time = next_fire_time-(next_fire_time-(UNIX_TIMESTAMP()*1000))+(DATE_FORMAT(FROM_UNIXTIME(next_fire_time/1000),'%i')*60000)+2000 WHERE q.trigger_name IN ("; 
    String sql_final = sql_1 + trigger_names + ");";  //include list of triggers to update and closing parenthesis   
    Statement s = con.createStatement();
    if (con.getAutoCommit() == false) //if autocommit is not set, commit manually
    return "Update Succeeded";
catch (SQLException e)
    return e.toString();

This sets the trigger for a scheduled report to a time in the immediate future - thus re-running a scheduled report whose execution time has already passed.  

Have fun!

Create Java Scriptlets for Jasper Reports (part 1)

This post is aimed at report developers who use iReport and/or Jasperserver and would like to create Java scriptlets to enhance report functionality.  Part 1 will discuss the basics of creating the Java code and .jar file.  Part 2 will discuss the specifics of creating a scriptlet that will write back to the database.

Step 1: Learn Java

If you already know Java, great!  If you're familiar with programming, something like this tutorial will probably be enough to get you started.

Step 2: Code

There are two different methods (not mutually exclusive) for creating scriptlets.  One is to piggyback on the default scriptlet class provided by Jaspersoft.  The methods within this class correspond to events within report processing, and they will run automatically with the report you attach the scriptlet to.

The second strategy is to create your own methods using any existing Java functionality (part 2 covers java.sql.*).  You have to call these specifically from the report if you want them to run.

Either way you go, you need to do the following:

  • Create your .java code file.  The file name must match your class name (so must contain public class FileName ...)
  • Include the external classes you need in your file.  For example:
import net.sf.jasperreports.engine.JRDefaultScriptlet;
import net.sf.jasperreports.engine.JRScriptletException;
  • Create your program.  
Step 3: Compile

Jasperserver comes with a compiler (located in <Jasper Home>\java\bin), so it's easiest just to use that.  It's even easier if you add this to your system path variable so you can call javac from anywhere.  If you want to use the standard JDK, that is fine, but there will be problems if you try to run the report on a server with a prior version of java from what you developed in.

To use Jasperserver-specific classes (as in the example above) you need to include the Jasper Reports library when you run javac.  For example:

javac -classpath "C:\Program Files\jasperserver-ce-3.7.1\apache-tomcat\webapps\jasperserver\WEB-INF\lib\jasperreports-"

Step 4: Create the JAR

Once you have compiled your code successfully, you can create the jar file with a simple command:

jar cvf JarFileName.jar FileName.class

Step 5: Add Scriptlet to Report

First, add your jar file to the iReport classpath (Tools>Options>Classpath>Add JAR).

Once you've done this, just go to your (iReport) report inspector, right-click 'Scriptlets' and 'Add Scriptlet'.  If you are only extending the default jasper scriptlet class, that's all you have to do - just compile your report and run it.

If you want to call your own method(s) within the report, you'll need to change the scriptlet class in your report properties to match your scriptlet rather than the default.  You can then call the method from a text field using something like this:


Once you are ready to run this from Jasperserver, you'll need to upload the jar file as a resource when you create the report.

That's it!  In part 2, we'll look at a specific scriptlet that uses all of this to write back to the database based on information contained within the report.

Thursday, April 21, 2011