Friday, January 7, 2011

Productive Developer Tips - Eclipse

I recently stumbled upon a post from Intertech that I really enjoyed.  Even as an experienced developer, there were tips in this 10 day guide to becoming an Eclipse master, that really helped!


A 10 day Guide to Becoming an Eclipse Guru

JSON deserialization with Jackson

Recently I was trying to deserialize a Java object with Jackson.  I had a specific JSON property name needed so my Java Bean looked like this:



public class RequestInfo
{
    @JsonProperty("first")
    private String firstName;


    @JsonProperty("last")
    private String lastName;


   ...Getters and setters normal.
}

I had a list of RequestInfo in an ArrayList.  When trying to deserialize that ArrayList with the Jackson JSON processor, I had duplicate entries...


[{"first":"Matt","last":"Dimich","firstName":"Matt","lastName":"Dimich"}]


To fix this, I had to use the @JsonIgnoreProperties annotation.

I used it to include a list of properties that Jackson should NOT include when deserializing.  The solution was adding this line to the class file.
@JsonIgnoreProperties({"firstName", "lastName"})

The final result of my Class then looked like this:


@JsonIgnoreProperties({"firstName", "lastName"})
public class RequestInfo
{
    @JsonProperty("first")
    private String firstName;

    @JsonProperty("last")
    private String lastName;

   ...Getters and setters normal.
}

OUTPUT:

[{"first":"Matt","last":"Dimich"}]


Tuesday, September 28, 2010

Scamming the Scammer - A Craigslist Story

You can't make this stuff up.  I was trying to sell a bed on Craigslist.  My second response, from Kay Maxwell...or so I thought.  You'll have to read the email interactions below to get the full effect, but suffice it to say, I knew pretty early on that this was a scammer.  But frustration and curiosity got the best of me.  Instead of just walking away like I should have, I decided to play along.  You'll notice the hints I give in my responses to the effect that, I know your a scammer, but I'm going to keep pulling you along.  So as I was on my way to Western Union  sitting at my computer in the comfort of my own home, I was making up a grand story about my travels to wire the fraudster the money.

Presented here for both your entertainment and awareness, a "scammer" attempting to get $400 from me when I was selling a bed on Craigslist.

For more information, this scam is known across the web. You can see these links for more info:
http://www.419scam.org/419-mail2consultant-com.htm
http://www.craigslist.org/about/scams

Without further ado, the scammer....






Matthew Dimich
myemail@gmail.com



Hospital Bed - great condition! - $800 (Apple Valley)

11 messages





Kay Maxwell
damishell11@gmail.com


Tue, Sep 21, 2010 at 11:10 AM




To: me


** CRAIGSLIST ADVISORY --- AVOID SCAMS BY DEALING LOCALLY

** Avoid:  wiring money, cross-border deals, work-at-home

** Beware: cashier checks, money orders, escrow, shipping

** More Info:  http://www.craigslist.org/about/scams.html



--



Hi,

What's the condition of this item?I want to know if its still for sale..





------------------------------------------------------------------

this message was remailed to you via: sale-zgp2v-1965351927@craigslist.org

------------------------------------------------------------------






Matthew Dimich


Tue, Sep 21, 2010 at 1:34 PM




To:
Kay Maxwell damishell11@gmail.com


Hi Kay,


I have one other person that emailed me before you. So I'm going to schedule a time for him to look at the bed. After that I'll know if it's still available. I can let you know what happens after that if you would like?

Thanks for the email!

Matt






Kay Maxwell
kaymax03@googlemail.com


Tue, Sep 21, 2010 at 8:55 PM




To:
Matthew Dimich 


Hi ,

Thanks for the swift response, just to let you know that am okay with

the condition and price of the item, am ready for its purchase and my

form of payment will be by  PayPal.I would have really love to come

for the viewing but due to my work frame that might not be possible as

am on work inspection to Mexico at the moment and I do not have access to a

phone,but if you have more pictures, might want to have a good look.



I'll be responsible for the pick-up and the pick up money will be

included in your payment to avoid delay and to enable pick up

company to schedule an appropriate time for the pick-up  at your location after

funds has been received as I have other properties to be moved

alongside with yours.

All I will need is your PayPal email address to make the payment and I

will send the

money as a gift so you'll not be charged by PayPal and then I will

make arrangement

for pick up.I will be expecting your email.



Kay...






Matthew Dimich


Wed, Sep 22, 2010 at 9:22 AM




To:
Kay Maxwell <kaymax03@googlemail.com>


Thanks for the info Kay. I appreciate it!


Here's where I'm at. The guy that emailed before you is coming to look at the bed tomorrow night at 6:30. I will know at that time if it is still available or not. I will email you after that visit either way and let you know.

Thanks,
Matt
[Quoted text hidden]
--
Matthew Dimich








Kay Maxwell
<kaymax03@googlemail.com>


Wed, Sep 22, 2010 at 9:23 AM




To:
Matthew Dimich 


OK





Matthew Dimich



Thu, Sep 23, 2010 at 3:29 PM




To:
Kay Maxwell <kaymax03@googlemail.com>


Kay,


The bed is yours. Would you like to come take a look at it?

Thanks for your patience.
Matt




On Wed, Sep 22, 2010 at 9:23 AM, Kay Maxwell <kaymax03@googlemail.com> wrote:
OK











Matthew Dimich



Fri, Sep 24, 2010 at 10:55 AM




To:
Kay Maxwell <kaymax03@googlemail.com>


Hey Kay,


I missed your last question before...my paypal email address is ******@gmail.com. As soon as you transfer $800 to it, we can plan a pick up. Do you pay the moving company that you mentioned in advance?

Thanks,
Matt








Kay Maxwell
<kaymax03@googlemail.com>


Fri, Sep 24, 2010 at 11:04 AM




To:
Matthew Dimich 


Thanks I am actually going to include the movers fee in your payment as I am not in te states to take care of things.I will email you as soon as the payment is made.





Kay





Matthew Dimich


Fri, Sep 24, 2010 at 11:05 AM




To:
Kay Maxwell <kaymax03@googlemail.com>


Sounds great. Thanks.


Matt









AND THE POST WHERE I DISCOVERED THE SCAM....



Kay Maxwell
<kaymax03@googlemail.com>


Fri, Sep 24, 2010 at 11:48 AM




To:
Matthew Dimich





I have just made the payment now and I expect PayPal to have emailed by now.I sent
$1250 in all,PayPal said they would be holding the funds and it will not be
credited into your account because of the excess payments of $450 I added meant for
pick up and delivery.They said they have emailed you to this effect, I will need you
to please send an upfront payment of $400 out of your pocket to my pickup agent via
Western Union Money Transfer which you can do online at www.westernunion.com, or go
to any of their stores around you.You will have to email them the Wire transfer
details(senders name and MTCN) so your account can be credited.I added an extra $50
to cover the western union charges. Here is the pick up agent info needed to get wire the money

Here is the info to wire the money to;

Reciever's name; Kathleen M. Davis
Address; 1948 South Broad Street,Taylors SC 29687

Please get back to me with your address as it will be needed at Western Union to
pick up the money.
Hope to read from you soon.




Kay





Kay Maxwell
<kaymax03@googlemail.com>


Fri, Sep 24, 2010 at 1:02 PM




To:
Matthew Dimich 





I have not heard from you since I made the payment.the funds has been deducted from
my PayPal account.please go ahead and send the funds to the movers info I gave you
via Western Union and get the wire details sent to PayPal so your account can be credited.




Kay




****************Missing conversation***********************************
I don't know where this response from me went.  I think gmail frowned on me sending more email to someone who I had marked as "spam".  So I think it deleted it.  But the main point is, I asked what her real name was.









Kay Maxwell
<kaymax03@googlemail.com>


Fri, Sep 24, 2010 at 1:54 PM




To:
Matthew Dimich 


My name is Kay Maxwell.Send the $400 via western union to the name I provided in the payment.


Receiver's Name: Kathleen M Davis
Address: 1948 South Broad Street
Taylors SC 29687








Matthew Dimich


Fri, Sep 24, 2010 at 1:57 PM




To:
Kay Maxwell <kaymax03@googlemail.com>


Kay,


Who's Kathleen? Can I call and talk to her on the phone? I'm on my way to western union.

Are you from apple valley? Just curious where my hospital bed is going.

Matt
--








Kay Maxwell
<kaymax03@googlemail.com>


Fri, Sep 24, 2010 at 2:18 PM




To:
Matthew Dimich


Kathleen is the mover in charge of the pick up.I dont have her direct line. Get back to me with the transfer details.
the sender's name and address with the 10 digits MTCN. I'm looking forward to your email so i can forward to paypal immediately to effect payment into your account.

[Quoted text hidden]





Matthew Dimich



Fri, Sep 24, 2010 at 2:52 PM




To:
Kay Maxwell <kaymax03@googlemail.com>


If you could pick your favorite country in the world, which one would you pick?



I'm almost to western union. Traffic is bad.



Matt






Kay Maxwell
<kaymax03@googlemail.com>


Fri, Sep 24, 2010 at 3:25 PM




To:
Matthew Dimich 


UNITED STATES of course.I need your address as it will be needed for pick up.






Matthew Dimich


Fri, Sep 24, 2010 at 3:31 PM




To:
Kay Maxwell <kaymax03@googlemail.com>


Still in traffic. Bad car crash so I'm pretty much sitting still.


You don't need my address yet. I haven't wired the money yet.

So how many things do you buy from craigslist? Do you buy often? How are you able to do that with your'e busy schedule? You said you were travelling to Brazil for work? That must be exciting. What company do you work for?

Thanks for emailing me back while I wait in traffic!

Matt








Kay Maxwell
<kaymax03@googlemail.com>


Fri, Sep 24, 2010 at 3:36 PM




To:
Matthew Dimich 


Mexico i said not Brazil.This is my second transaction oc

craigslist.When do I expect to read from you?






Matthew Dimich


Fri, Sep 24, 2010 at 3:41 PM




To:
Kay Maxwell <kaymax03@googlemail.com>


"When do I expect to read from you?" That doesn't make sense. It's not even a sentence.


Ahh yes! Mexico! Good stuff. Sorry, I was confusing you with my friend that was in Brazil for business.

Have you ever been to Nigeria?

The accident is clearing now...should be another 30 minutes or so for the police to get me through to Western Union.

Matt




NO RESPONSE ...hmmm was it the Nigeria question?  (FYI> I asked this specific question because a scam on their mail service providers website was called the Nigerian scam. See: http://www.419scam.org/419-mail2consultant-com.htm





Matthew Dimich


Sat, Sep 25, 2010 at 12:23 PM




To:
Kay Maxwell <kaymax03@googlemail.com>


Hey Kay,


Didn't hear back from you on whether or not you've ever been to Nigeria? Just a random question.

Anyway, sorry I didn't get back to you last night. My phone died so I couldn't email anymore, and by the time I got to Western Union they were closed. So I'll have to wait until monday. Are you still ok with that?

Thanks,
Matt






Matthew Dimich


Tue, Sep 28, 2010 at 9:16 AM




To:
Kay Maxwell <kaymax03@googlemail.com>


So Kay, (or whatever your real name is)


Now that we both know you were trying to scam me, and you know that I knew from very early on, level with me. You're not going to get caught...but seriously, what country are you from? Do you do this full time? Do you actually get some people to wire you money?

Matt

Wednesday, June 23, 2010

Top 5 Developer Productivity Tools

I've been a software developer for over 4 years now, and have found these 5 tools to be indispensable in my daily development role.

5. Notepad++ - http://notepad-plus-plus.org/
A much more powerful, yet easy to use and low overhead text editor that will give you syntax highlighting for most languages, formatting for xml, html, and a bunch of plugins.  I see this program on more and more blogs about tools developers shouldn't live without.  This is one of the first programs I install on a new computer!

4. Fiddler - http://www.fiddler2.com/fiddler2/
A very easy to use http analytic tool.  I can look at, and create http requests using any HTTP verb you can imagine.  It's easy to save requests that you've created making it an invaluable end to end testing tool.

3. WinSCP - http://winscp.net/eng/index.php
Need I say more?  An excellent FTP/SFTP and more tool that seamlessly can turn into a putty session allowing you to have a ssh session with the server. Simple, clean, quick.

2. Ditto - http://ditto-cp.sourceforge.net/index.php
I'm continually surprised that every developer (or even person who works on a computer for any amount every day) doesn't already have their own clip-board manager.  I use ditto because it's simple, yet keeps my clips organized.  It get's out of the way when I don't want to see it, and it can pop back up in an instant when I do.  Searching old clips have saved me many times when a reference to "something" would have been lost.  I can't stress enough how much of a productivity increase you get with a clip board manager.

1. Launchy - http://www.launchy.net/
Even more than a clipboard manager, no-one should have to browse every program installed on their computer in order to open one of them ever again.  Launchy is an incredibly easy to configure/install application that does precisely what it sounds like....Launches applications, urls, or whatever command you tell it to.  The plugins that come standard allow you to create any command you would run on a command line.  A lot of launcher applications require manual configuration for every program you want to run, but Launchy automatically indexes your programs and adds them to a list.  It's intelligent so programs you use more often will appear towards the top.  With a quick keystroke I can launch any program on my computer.

Monday, February 22, 2010

Oracle String Literal Too Long Solution

I recently ran into a problem when trying to insert more than 4000 characters into a CLOB field (Character Large Object) in an Oracle database. The issue previously was my system was building the SQL from scratch... concatenating strings and such. The solution was to use "Bind Variables" and Java Prepared Statements, instead of the Statement object.

This was done using Java 5. You'll also need the latest (compatible version with your DB) copy of the oracle JDBC driver. The download page is here: Oracle JDBC Driver

This code when used with MSSQL and DB2 databases still worked the same.


String connectionUrl = "jdbc:oracle:thin:.....etc....etc....";
String user = "user";
String pass = "password";
String sql = "INSERT INTO SCHEMA.TABLENAME (UUID,TEST_FIELD_NAME) VALUES (?,?)";

Connection connection = null;
try
{
Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();

connection = DriverManager.getConnection(connectionUrl, user, pass);
PreparedStatement pstate = connection.prepareStatement(sql);

String testVar = "test root id";

pstate.setString(1, "testmatt12345");
pstate.setString(2, testVar);

boolean success = pstate.execute();

}catch(SQLException e)
{
[handle exception]
} catch (IllegalAccessException e) {
[handle exception]
} catch (InstantiationException e) {
[handle exception]
} catch (ClassNotFoundException e) {
[handle exception]
}finally
{
try {
connection.close();
} catch (SQLException e) {
[handle exception]
}
}

Friday, February 27, 2009

The power of RSS

Lately I've really been getting into using Google Reader to read feeds from everywhere.  It turns out that it has been very beneficial to me and others as well.  It is so much easier to keep track of news, current technology news, well...just about anything that I have been able to learn much I probably would have missed.  I've also made it a point to share anything I find extremely useful. If you want to track the things I find useful, you can see them here.  I believe you can even subscribe my shared items!