Windows Phone 10: Your account settings are out of date

Today I started my with a cheerful notice from my Windows Phone 10 mentioning that my Outlook account settings are out of date. A bit annoyed I ignored it until the afternoon when a second (hotmail) account started annoying me with the same message.

Letting Windows Phone “repair” the issue resulted in nothing but an 0x80070426 error. A suggestion from the Microsoft fora was to manually enter the go to the outlook site and login there, but this didn’t work. The only thing left was removing and re-adding the account, but I didn’t feel like doing so because Windows Phone already has the annoying habit of forgetting my settings.

At this point the PIN code of my phone went missing and when I tried to re-enable the PIN code I got another error saying I had to “try it again on a later time”.

In the end I fixed it with rule number one in IT:

1.PNG

 

So instead of removing your accounts, maybe you can try to restart your WP10 device ;)

No inserts using Hibernate and Spring

I was setting up a simple side-project with Spring, Spring Data and Hibernate. My repositories are generated using Spring Data’s jpa:repositories to save on development time and the database schema is generated using Hibernate, based on my JPA and JSR-303 annotated entities.

However, one of the issues I encountered was that my repositories did not insert anything in the database. After searching the web I followed a suggestion on Stackoverflow to add an entityManager.flush() to the repository to see if a transaction was running or not. There was indeed no transaction running but I had yet to find out why.

Exception in thread "main" javax.persistence.TransactionRequiredException: no transaction is in progress
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.checkTransactionNeeded(AbstractEntityManagerImpl.java:1136)
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:1297)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:344)
at com.sun.proxy.$Proxy31.flush(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:293)
at com.sun.proxy.$Proxy31.flush(Unknown Source)
at be.pw999.photocol.service.PhotoColServiceImpl.makeImage(PhotoColServiceImpl.java:45)
...

At that point my code looked like this:

@Service
public class PhotoColServiceImpl implements PhotoColService {

// My Injected beans

@Autowired
private EntityManager em;

@Transactional(readOnly = false)
@Override
public MakeImageResponse makeImage(MakeImageRequest request) {
em.flush();
}
}

 

 

public class Backend {

 public static void main(String[] args) {
  ClassPathXmlApplicationContext ac = new ClassPathXmlApplicationContext("classpath:/META-INF/webapp/WEB-INF/application-context.xml");
  
  PhotoColService service = ac.getBean(PhotoColService.class);
  
  MakeImageRequest r = new MakeImageRequest("DSC0012.JPG", "/home/phillip/Pictures", "12345678901234567890123456789012");
  MakeImageResponse resp = service.makeImage(r);
  
  ac.close();
 }
}

 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.8.xsd">

 <context:component-scan base-package="be.pw999.photocol.service"></context:component-scan>
 <!-- Define your application beans here. They will be available to the
beans defined in your web-context because it is a sub-context. Beans defined
in the web-context will not be available in the application context. -->
 <context:property-placeholder location="classpath:persistence-h2.properties" />

 <bean id="sessionFactory"
class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
  <property name="dataSource" ref="dataSource" />
  <property name="packagesToScan" value="be.pw999.photocol.model" />
  <property name="hibernateProperties">
   <props>
    <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
    <prop key="hibernate.dialect">${hibernate.dialect}</prop>
   </props>
  </property>
 </bean>

 <bean id="dataSource" class="org.apache.tomcat.dbcp.dbcp.BasicDataSource">
  <property name="driverClassName" value="${jdbc.driverClassName}" />
  <property name="url" value="${jdbc.url}" />
  <property name="username" value="${jdbc.user}" />
  <property name="password" value="${jdbc.pass}" />
 </bean>

 <bean id="transactionManager"
class="org.springframework.orm.hibernate5.HibernateTransactionManager">
  <property name="sessionFactory" ref="sessionFactory" />
 </bean>

 <bean id="persistenceExceptionTranslationPostProcessor"
class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />

 <bean id="jpaVendorAdapter"
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
  <property name="showSql" value="true" />
  <property name="generateDdl" value="true" />
  <property name="database" value="H2" />
 </bean>

 <bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
  <property name="dataSource" ref="dataSource" />
  <property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
  <!-- spring based scanning for entity classes> -->
  <property name="packagesToScan" value="be.pw999.photocol.model" />
</bean>


 <jpa:repositories base-package="be.pw999.photocol.repository"
transaction-manager-ref="transactionManager"
entity-manager-factory-ref="entityManagerFactory"></jpa:repositories>
</beans>

There were actually a couple of issues with this configuration.

Mistake 1

Using the wrong @Transaction annotation. There are two @Transaction annotations: @javax.persistence.Transaction and @org.springframework.transaction.annotation.Transactional. Only the latter will add transaction management to your Spring services and I had used the first one (because I trust autocomplete too much).

Mistake 2

Second mistake was that I had forgotten to add <tx:annotation-driven /> to my configuration. Stupid, stupid, stupid !

Mistake 3

After solving the first two mistakes I still had no transaction and no inserts in my H2 database. I quickly realized that my transaction manager was an instance of org.springframework.orm.hibernate5.HibernateTransactionManager and even though I use Hibernate, I’m not using it directly. My repositories are generated with Spring’s jpa:repositories and they use a JPA EntityManager instead of the Hibernate SessionFactory. So even though my configuration looked great, the JPA repositories did not use the Hibernate managed transactions.

So instead of using the HibernateTransactionManager, I used the org.springframework.orm.jpa.JpaTransactionManager and this did solve the no-inserts problem.

So this is now my configuration that works:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.8.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.2.xsd">

 <context:component-scan base-package="be.pw999.photocol.service"></context:component-scan>
 <!-- Define your application beans here. They will be available to the
beans defined in your web-context because it is a sub-context. Beans defined
in the web-context will not be available in the application context. -->
 <context:property-placeholder location="classpath:persistence-h2.properties" />
 <tx:annotation-driven transaction-manager="jpaTransactionManager" />

 <bean id="sessionFactory"
class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
  <property name="dataSource" ref="dataSource" />
  <property name="packagesToScan" value="be.pw999.photocol.model" />
  <property name="hibernateProperties">
   <props>
    <prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
    <prop key="hibernate.dialect">${hibernate.dialect}</prop>
   </props>
  </property>
 </bean>

 <bean id="dataSource" class="org.apache.tomcat.dbcp.dbcp.BasicDataSource">
  <property name="driverClassName" value="${jdbc.driverClassName}" />
  <property name="url" value="${jdbc.url}" />
  <property name="username" value="${jdbc.user}" />
  <property name="password" value="${jdbc.pass}" />
 </bean>

 <bean id="transactionManager"
class="org.springframework.orm.hibernate5.HibernateTransactionManager">
  <property name="sessionFactory" ref="sessionFactory" />
 </bean>

 <bean id="persistenceExceptionTranslationPostProcessor"
class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />

 <bean id="jpaVendorAdapter"
class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
  <property name="showSql" value="true" />
  <property name="generateDdl" value="true" />
  <property name="database" value="H2" />
 </bean>

 <bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
  <property name="dataSource" ref="dataSource" />
  <property name="jpaVendorAdapter" ref="jpaVendorAdapter" />
  <!-- spring based scanning for entity classes> -->
  <property name="packagesToScan" value="be.pw999.photocol.model" />
 </bean>

 <bean id="jpaTransactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
  <property name="entityManagerFactory" ref="entityManagerFactory"></property>
 </bean>

 <jpa:repositories base-package="be.pw999.photocol.repository"
transaction-manager-ref="jpaTransactionManager"
entity-manager-factory-ref="entityManagerFactory"></jpa:repositories>
</beans>

Google Talk fat client refuses to start

A while ago I noticed that my Google Talk fat client didn’t want to start anymore, in fact, it did absolutely nothing. Even after reinstalling and completely removing all the caches, remaining files and registry keys, the application still wouldn’t start at all.

Google’ing for some help only resulted in more people having the same problem without a solution at all. In this post I got my first clue about the problem: FAST IO DISALLOWED.

These three words actually tell everything:
FAST IO: Google Talk is doing something special with it’s I/O’s
DISALLOWD: Windows doesn’t like Google doing this and thus refuses this action

So we have to digg a bit deeper in the (new) security features of Windows 7. As you may or may not know, Windows 7 comes with some additional security features like Address Space Layout Randomization and Structured Exception Hanlder Overwrite Protection. However, by default, these security features are not enforced to ensure a certain backwards compatibility with older applications.

Microsoft EMET

As I am and always will be a geek I have installed the Microsoft Enhanced Mitigation Experience Toolkit (EMET) which allows us to change this “opt-in behaviour” to an “opt-out behaviour”. As I’m also a bit paranoia I had configured EMET to force the “opt-out behaviour”.

Just to test it I had reverted the settings to default and after a reboot I quickly got the Google Talk window on my screen.

So, if your Google Talk fat client doesn’t start on Windows 7 then you should definately check your EMET settings.

This post was originally posted on my My.Opera blog on Thursday, February 16, 2012 6:26:15 PM. This post has been copied to my WordPress blog since the My.Opera blogging service will be discontinued.

Unable to delete executables on Windows 7

A long time ago I started to experience problems with updates from Steam. The updater deletes steam.exe before replacing it with a new version, but deleting steam.exe failed (steam.exe was deleted, but the file is still there) and the file would still be there, inaccessible to anyone and anything. The file would eventually disappear after 10 minutes, but this was kinda annoying as this also translated itself in delays when doing copy/cut-paste operations and this would also prevent me from building or re-building applications in Visual Studio.

I kinda got used to this problem and left it as it was, thinking it might be related to a driver issue or something, until last week I discoverd this was only related to executables; Windows 7 just couldn’t delete executables without a delay of 10 minutes. This bit of info was of great help because I wasn’t the only on having this problem !

The problem, unfortunately, wasn’t cause by Windows itself, but by me ! For some reason, I had disabled the “Application Experience” service. The fix is very easy (and as usual, you do everything at your own risk):
Right click Computer (on desktop or Start menu) > Manage , then under “Services and Applications”, choose “Services” . In the list you’ll find the “Application Experience” service:
Service Management

Double click on this service and change the “Startup type” from “Disabled” to “Manual”. There is no need to choose automatic, the default startup type is manual and Microsoft did choose this for a reason (I guess :P ). Just starting the service didn’t solve the problem immediately so I suggest you to restart Windows (or kill explorer.exe :mrgreen: ).
manual_startup_type

Steam updater works perfectly now and so does Visual Studio 2010 !

This post was originally posted on my My.Opera blog on Thursday, November 4, 2010 7:11:07 AM. This post has been copied to my WordPress blog since the My.Opera blogging service will be discontinued.

Fixing “Devices and Printers” in Windows 7

A few week ago some things stopped working on my Windows 7 installation. The most annoying thing was that I could not safely remove my hardware anymore, no matter how often I clicked the icon, no pop-up menu would appear.
Opening the “Devices and Printers” window resulted in nothing but an empty window and an address-bar that kept indication that it was looking for something.
Since Bluetooth was relying on this Devices and Printers window, it of course stopped working too.

First I thought it was caused by VirtualBox, since it installed a driver to overtake USB devices, but removing VirtualBox and any remaining drivers didn’t resolve the problem. After looking for solutions and trying some things I decided to do something drastic: uninstall most devices and see how Windows reacts on it :P .
And it reacted pretty well to it. After rebooting the Devices and Printers window worked again until Windows started installing and configure my Bluetooth dongle, logic reaction: bluetooth isn’t fucked up by a faulty driver, Bluetooth is the fucked up device.
After checking my services list I noticed that I had set the “Bluetooth Support” startup type to manual. Started the service and all the problems are resolved.

This actually proves some things:
Windows 7 is not ready, or at least a troubleshoot pack should be made to fix this problem
OS’es become more complex, all components are interconnected and if one fails, everything fails
Don’t mess around with Vista/7 services, they became to sensitive and a change easily renders windows unbootable

//edit:
Condy posted an interesting method, curious if it works :)

condy writes: Want to see back your printer in the devices and printers? Just start your computer in safe mode and open the devices and printers there. Right click on the window. Set View to Large icon; Set sort by – name; Set group by – classification; then exit and restart your computer to normal mode. Open your devices and printer tab and all the devices including printers show up. Operating system Windows 7. Hope this helps because I experienced it.

This post was originally posted on my My.Opera blog on Sunday, August 2, 2009 11:03:49 AM. This post has been copied to my WordPress blog since the My.Opera blogging service will be discontinued.