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 - http://asciifi.com/
USB Stick Contains Dual-Core Computer, Turns Any Screen Into an Android Station - http://blog.laptopmag.com/usb-stick-contains-dual-core-computer-turns-any-screen-into-an-android-station
Raspberry Pi, An ARM GNU/Linux box for $25 - http://www.raspberrypi.org/
Microsoft DreamSpark (Microsoft professional tools free for students) - https://www.dreamspark.com/

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

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

and

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 +"'");
    }            
}
else 
{
    this.setVariableValue("TriggerNames", "'" + trigger_name_field +"'");
}

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

$P{REPORT_SCRIPTLET}.updateDB($P{REPORT_CONNECTION},$V{TriggerNames})

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

try
{
    if (con.isReadOnly() == true) //make sure update can proceed
    {
        con.setReadOnly(false);
    }
    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();
    s.executeUpdate(sql_final);
    if (con.getAutoCommit() == false) //if autocommit is not set, commit manually
    {
        con.commit();
    }
    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 FileName.java 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-3.7.1.1.jar" FileName.java

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.java 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:

$P{REPORT_SCRIPTLET}.YourMethod()

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