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
Friday, January 7, 2011
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:
I had a list of
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:
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....
Hospital Bed - great condition! - $800 (Apple Valley)
11 messages
AND THE POST WHERE I DISCOVERED THE SCAM....
****************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.
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 | ||
|
Matthew Dimich | Tue, Sep 21, 2010 at 1:34 PM | |
To: Kay Maxwell damishell11@gmail.com | ||
|
Kay Maxwell kaymax03@googlemail.com | Tue, Sep 21, 2010 at 8:55 PM | |
To: Matthew Dimich | ||
|
Matthew Dimich | Wed, Sep 22, 2010 at 9:22 AM | |
To: Kay Maxwell <kaymax03@googlemail.com> | ||
|
Kay Maxwell <kaymax03@googlemail.com> | Wed, Sep 22, 2010 at 9:23 AM | |
To: Matthew Dimich | ||
|
Matthew Dimich | Thu, Sep 23, 2010 at 3:29 PM | |
To: Kay Maxwell <kaymax03@googlemail.com> | ||
|
Matthew Dimich | Fri, Sep 24, 2010 at 10:55 AM | |
To: Kay Maxwell <kaymax03@googlemail.com> | ||
|
Kay Maxwell <kaymax03@googlemail.com> | Fri, Sep 24, 2010 at 11:04 AM | |
To: Matthew Dimich | ||
|
Matthew Dimich | Fri, Sep 24, 2010 at 11:05 AM | |
To: Kay Maxwell <kaymax03@googlemail.com> | ||
|
AND THE POST WHERE I DISCOVERED THE SCAM....
Kay Maxwell <kaymax03@googlemail.com> | Fri, Sep 24, 2010 at 11:48 AM | |
To: Matthew Dimich | ||
|
Kay Maxwell <kaymax03@googlemail.com> | Fri, Sep 24, 2010 at 1:02 PM | |
To: Matthew Dimich | ||
|
****************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 | ||
|
Matthew Dimich | Fri, Sep 24, 2010 at 1:57 PM | |
To: Kay Maxwell <kaymax03@googlemail.com> | ||
|
Kay Maxwell <kaymax03@googlemail.com> | Fri, Sep 24, 2010 at 2:18 PM | |
To: Matthew Dimich | ||
|
Matthew Dimich | Fri, Sep 24, 2010 at 2:52 PM | |
To: Kay Maxwell <kaymax03@googlemail.com> | ||
|
Kay Maxwell <kaymax03@googlemail.com> | Fri, Sep 24, 2010 at 3:25 PM | |
To: Matthew Dimich | ||
|
Matthew Dimich | Fri, Sep 24, 2010 at 3:31 PM | |
To: Kay Maxwell <kaymax03@googlemail.com> | ||
|
Kay Maxwell <kaymax03@googlemail.com> | Fri, Sep 24, 2010 at 3:36 PM | |
To: Matthew Dimich | ||
|
Matthew Dimich | Fri, Sep 24, 2010 at 3:41 PM | |
To: Kay Maxwell <kaymax03@googlemail.com> | ||
|
Matthew Dimich | Sat, Sep 25, 2010 at 12:23 PM | |
To: Kay Maxwell <kaymax03@googlemail.com> | ||
|
Matthew Dimich | Tue, Sep 28, 2010 at 9:16 AM | |
To: Kay Maxwell <kaymax03@googlemail.com> | ||
|
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.
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.
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!
Subscribe to:
Posts (Atom)