Sunday, September 16, 2012

No message body writer has been found for response class

No message body writer has been found for response class
You need to add the following in maven:



<dependency>
        <groupId>org.codehaus.jackson</groupId>
        <artifactId>jackson-jaxrs</artifactId>
        <version>1.3.0</version>
</dependency>



Error serializing the response, please check the server logs, response class

Add the following:

              <dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>1.9.9</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-xc</artifactId>
<version>1.9.9</version>
</dependency>

Tuesday, September 11, 2012

Unit test



 [TestMethod]
        public void can_save_and_read_pbentity2()
        {
            object id;

            // Save to database using PbPlatsannonsEntity
            using ( var tx = CurrentSession.BeginTransaction())
            {
                id =
                    CurrentSession.Save(
                        new PbPlatsannonsEntity
                            {   Annonsrubrik = "Rubrik annons",
                                AnnonstextXml = "XML annonstext",
                                AntalPlatser = 12
                               
                            });
                    tx.Commit();
            }
            CurrentSession.Clear();

            //Read from database
            using ( var tx = CurrentSession.BeginTransaction() )
            {
                var pbPlatsannonsEntity = CurrentSession.Get<PbPlatsannonsEntity>(id);
                Assert.Equals("Rubrik annons", pbPlatsannonsEntity.Annonsrubrik);
                Assert.Equals("XML annonstext", pbPlatsannonsEntity.AnnonstextXml);
                Assert.Equals(12, pbPlatsannonsEntity.AntalPlatser);
                //Assert.Equals(new DateTime(2000, 1, 1), pbPlatsannonsEntity.Created);
                tx.Commit();

            }

        }

Tuesday, September 4, 2012

Collections.sort java: sorting java object




//Sort aktlist
final Comparator< aktlist > DATE_ORDER =
                            new Comparator< aktlist >() {
@Override
public int compare( aktlist a1,  aktlist a2) {
   return a2.getDatum().compareTo(a1.getDatum());
}
};
Collections.sort( aktlist , DATE_ORDER);

More information:
http://docs.oracle.com/javase/tutorial/collections/interfaces/order.html

Saturday, August 25, 2012

Android: Preventing destroying the activity when changes made by rotation of the device

Preventing destroying the activity when changes made by rotation of the device, use
android:configChanges="orientation"

Example:


<activity
            android:configChanges="orientation"
            android:name=".QuizStartActivity"
            android:label="@string/title_activity_quiz_start" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

Thursday, July 12, 2012

Polic virus with fine payment

If your computer is hacked by a Police Virus requiring you to pay a fine , your computer most likely is infected.
You can remove the virus folowing the steps below:
1) Log in in Safe mode by restarting and klick on F8
2) Open regedit and search for HKLM\Software\Wow6432Node\Micxrosoft\Windows\CurrentVersion\Run
3) Remove the entry with infected program. Most likely your program is installed in
C:\User\Your log name\AppData\Roaming\*.exe


You can also use free Microsoft Safty Scanner to remove this Police Virus if the above mentioned action did not help to remove the Police Virus.

You find the scanner at: http://www.microsoft.com/security/scanner/en-gb/default.aspx

Tuesday, July 10, 2012

"Updating Maven Project". Unsupported IClasspathEntry kind=4



This occure if you are upgrading to maven 3.

Make sure that the version of the m2e(clipse) plugin that you're running is at least 1.1.0. The update site is here: https://repository.sonatype.org/content/repositories/forge-sites/m2e/1.1.0/N/LATEST/

and run:
mvn eclipse:clean