moody tech blog

Saturday, September 17, 2011

Speed Up Your Windows PC

After having your Windows PC for a while it can begin to get bogged down with unused programs, a fragmented hard drive, spyware, adware, and clutter in the file system among other things. There are some actions that you can take to try to speed up your PC. There are a lot of options and here are a few.

CCleaner is a nice program for not only cleaning up temporary files, but also your registry. When you install many programs, an entry is created in the registry. When you uninstall that entry may not be removed and in some cases can lead to annoying but harmless error messages and warnings. CCleaner can help identify registry entries that can be removed. It is definitely recommended that you back up your registry before completing this.

Adding memory (RAM) can often have an impact depending on your current setup. Your PC does have a maximum and if you are not there yet, you might consider getting there. It’s often quick and relatively inexpensive to upgrade RAM. If you are uncomfortable installing it yourself most places that sell it will also install. Sites like crucial.com can help you determine what the maximum available memory is for your computer.

Check for adware and spyware. Some virus scanners may or may not catch all of this, so if you don’t have a dual purpose program, there are a lot of programs available to help, often for free. Some of these include Spybot, Adaware, and Malwarebytes. Be sure to read reviews and check the credibility of the program you do choose. If you think you are already infected, consider booting in Safe Mode to clean things up.

Many people will also recommend defragmenting your hard drive. This is definitely something to look into and Windows will tell you whether you should consider it.

These are just a few tips to try if your PC is running slow. There are plenty of other options out there.

Saturday, August 27, 2011

ManyToOne Update When Child Delete JPA

Using JPA, if you have 2 entities, one with a many-to-one relationship, you probably need to update the "many" side when the other side is deleted. The only method I could find for this was to set all the entities on the "many" side in the method to delete the child.

Example:

Player {

@ManyToOne
Team team;

}

When the Team is deleted, an update statement needs to be run to set all Team to null for all players on that team.


Saturday, May 14, 2011

Trying to update a child collection the entire collection was wiped out

Problem: Trying to update a child collection the entire collection was wiped out

Solution: Call the EntityManager’s refresh() method before calling flush()

Environment Notes: Google App Engine, Datanucleus JPA, Spring MVC 3

Summary: I as working with a detached copy of the Parent entity. When I called EntityManager’s merge(Obj o) function it essentially wiped out the list because it copied in an empty list. Calling flush() essentially set the empty list in the database. Calling refresh(Obj o) before calling flush() refreshed the object with its corresponding database entries.

References:

Forum Post

http://stackoverflow.com/questions/5244238/jpa-what-is-the-behaviour-of-merge-with-lazy-initialized-collection

EntityManager API Documentation

http://download.oracle.com/javaee/6/api/javax/persistence/EntityManager.html

Tuesday, October 12, 2010

Monday, July 5, 2010

JSF java.lang.IllegalStateException: Component javax.faces.component.UIViewRoot

java.lang.IllegalStateException: Component javax.faces.component.UIViewRoot

This error can probably be resolved by adding the <f:view> tags around the <html>tags.

Monday, May 10, 2010

datagridviewcomboboxcell value is not valid C#

datagridviewcomboboxcell value is not valid

Fixed this error by changing the datatype in my DataTable (source) column to System.Decimal. I believe the database datatype Numeric wanted this.


DataTable table = new DataTable();
DataColumn idColumn = new DataColumn();
idColumn.ColumnName = "id";
idColumn.DataType = Type.GetType("System.Decimal");
table.Columns.Add(idColumn);

Monday, February 8, 2010

JavaFX Ecslipe Plugin

Had some issues with Eclipse (Galileo on Windows) not locating my JavaFX SDK when trying to create a project. After some digging it seems that it currently requires the 1.2.1 JavaFX SDK which is not the most current.

Previous versions are available here:

http://java.sun.com/javafx/downloads/previous.jsp