Saturday, February 18, 2012

How I fixed my new YN565EX flash

Yesterday I have received my brand new YN565EX flash by Yongnuo from Hong Kong. It took almost a month for it to get to Estonia, but shipping was free.

The flash is very similar in specs to a much more expensive Canon 580EX II, with minor exceptions, e.g. no Hi-Speed sync or ETTL Master mode. However, the flash supports ETTL Slave mode of both Canon and Nikon systems, so this was the primary reason for buying it - use as a powerful (guide 58) slave flash unit in automatic TTL mode. As a bonus it can also be a slave in manual mode as well - overall a better option than buying a 430EX from Canon, which is even slightly more expensive, for the same purpose. The reviews on the net were very good and I was impressed with the build quality, which matches flashes made by Canon.

But all would be cool if it worked... There is much scepticism for buying of Chinese flashes, and there seem to be a reason for that. The flash powered on for the first time and then quickly shut down. It completely ignored any presses of the On button afterwards and soon I noticed that the batteries get very hot while they are inserted into the flash unit. Bad, bad, bad. My option would be to pay for return shipping and wait for 2 more months until the new unit is delivered. Not a sexy option.

So I decided to give it a try to fix it myself. Hot batteries suggested there should be a short circuit somewhere and if it is not a major component, it should be fixable.

The flash is very similar in design to Canon 580EX, so searching for its schematics helped to understand how to disassemble it.


1. Unscrew the 4 screws on the bottom of the flash unit to remove hotshoe connectors (contacts can be easily disconnected once the bottom panel is open)

2. Turn the flash head 90 degrees to reveal 2 more screws at the upper part of the body, one is under the sticker, which looks like a 'warranty void' one, but as there are no such words on it - it felt safe to remove it. I suggest making pictures of the screws to be able to assemble everything later - they are all different.

3. Now was the most difficult part with which I struggled for some time. By now you should be able to remove the front cover of the body, but it feels like there is still something holding it at the top - actually there are no more screws, so just try again and again to gently pull it off. No sliding down, etc is necessary, just pull the front panel off the back panel, the position of the head is not important at this time. After you are successful, disconnect the two connectors and put the front cover away.
At this time I put the batteries back inside several times and used a voltmeter to understand where the voltage drop happens. After some tries I was lucky to see some smoke. This might be scary, but I quickly removed the PCB at the bottom of the flash on which the coil and 1000uF capacitor are mounted on the picture. Be careful with touching the parts - you may get an electric shock even if batteries are removed, this is due to a 300V giant capacitor which is hiding at the base of the flash head.
The cause of the smoke most probably was residual soldering agent on the back of the board - see the picture to the right. It was melted and probably was the reason for the short circuit. I used a small screwdriver to clean it off between the two large contacts. Note that checking for it with a multimeter is difficult because there are capacitors mounted here, so probing for resistance can still show some value until the capacitors are charged (and there is a big one there!). After inserting the batteries the flash turned on! The problem was identified, so I have spent some more time cleaning the contacts by gently scratching and wiping off with alcohol.

Now the flash works perfectly both in the hotshoe and as a slave. There are no problems with balance of light with my Canon 580EX II - at least I haven't noticed any difference so far. The only minor problem that I have noticed is the modelling light (when depth-of-field button is pressed) gets darker by the end of the 1 sec interval it is supposed to be visible, but it may depend on how well the batteries are charged.

Overall, I am pretty happy now. Buy yourself one if you have basic disassembling/electronics skills to protect yourself from minor manufacturing defects. I really hope the QC will improve at Yongnuo.


Wednesday, February 1, 2012

Beautiful front-end for Picasa web galleries

Ever wanted to make your Picasaweb gallery look better?

Although I don't use Picasa desktop application, I upload many of my photos to Picasaweb. Partly, this is for historical reasons, partly I like the usage of the existing Google account and very cheap storage (20 Gb for only $5 per year - it's hard to beat that).

However, I am really really not happy about how the Google's gallery looks like - both the original Picasaweb interface, which has the distracting white background as well as the newer Google Plus-integrated interface, which doesn't display my album maps and hides my photo captions too quickly. And the URLs have recently become uglier - Google no longer displays your username in the URL, but has replaced it with a bunch of numbers. Oh well...

So, because there wasn't any better solution, I decided to quickly write a new, more beautiful front-end for Picasaweb during the days off during the last Christmas. I still like the storage space and the direct uploads to Picasaweb from most open-source and commercial photo management software, so there is no need to reinvent the back-end part.

Here is what I came up with:


As Google provides a Java API for accessing to its services, I decided to write a simple Java web app and host it at Google App Engine (for free!).

The web app fetches all the data from Picasaweb, but displays the albums and photos completely in its own interface, which is (surprisingly) quicker than the Google's own and looks more beautiful, with minimal distractions from the photos themselves. See my example photo gallery to check out the transition effects, full screen photo viewer with copy-pasteable URLs, cross-fading between photos, and a search within your photo metadata (captions, labels, etc). It is optimized for mobile browsers as well.

The source code is available on Github and is licensed under GPL. You can just install it to your own Google App Engine account for free (see the instructions on the github) or use the link at the bottom of my photo gallery to display your own photos - the link will be permanent, so you can even send it to your friends!


Tuesday, January 24, 2012

How I resurrected my TomTom GO 920

This stuff probably applies to any hardware TomTom device, including GO 520, 720, 920, ONE, XL, etc

I have owned my TomTom GO 920 since 2007. It worked pretty well, but during the last trip to Spain started failing.

Symptoms included:

  • Doesn't turn on after put to sleep
  • Reset button doesn't work (that hole at the bottom of the device)
  • Hangs during operation, reset turns the screen off, can't turn on anymore

I thought my TomTom was bricked for good - anyway this seems like a hardware problem to me and no solutions on the net helped.

However, after the device was just gathering dust for some months, I have decided to give it another try: I plugged it into the USB and the device turned on again! But only until it hanged again and reset stopped working again.

So, here are the steps I used to resurrect it:
  1. Leave the device laying around without the power source until the battery completely drains
  2. Plug it into USB, turn it on by holding the power button for a few seconds (it should turn on by now if battery indeed was empty - I have tested it several times)
  3. If it asks whether to connect to the computer - choose YES
  4. Start TomTom HOME (yes, that stupid Windoze-only program - I used VirtualBox for running it - doesn't work under Wine)
  5. Go to manage my TomTom
  6. Check The Application (the TomTom GUI interface) and choose to delete it from the device
  7. Close TomTom HOME, restart it
  8. HOME will detect you don't have the Application installed and will offer you to do so
  9. Let it reinstall the Application
  10. Delete and copy the map as well, either with TomTom HOME or just manually

That's it! TomTom will now turn off and turn on again. However, occasionally it still needs the reset button to be pushed after put into sleep - but now the reset button works at least.

I guess the problem was with data corruption: when you turn on or reset the device, the bootloader takes control and tries to run the Application, but it mysteriously corrupted and fails. If the above steps don't help, you can try updating the bootloader as well - there are instructions on the net on how to do it, but you still need the working USB mass storage, so let the battery to drain first.

Hopefully this solution is not too temporary, but it works for 3 days now already!


Thursday, January 12, 2012

Java course IAG0040 in Tallinn Technical University

Now is the time to make an official announcement: I am no longer teaching Java to Master's students in Tallinn Technical University (TTÜ).

I have really enjoyed doing it during the past 6 years, and I definitely learned a lot during this time.
Teaching in a university is not something you would do for money and it also eats up a lot of your spare time - I did it because I know I am good at it and I wanted to share my knowledge and experience in the field, especially considering the fact that most university professors/lecturers have little understanding of how software development really works and how to teach it. I did it for those students each year who really had their eyes shining. Because of them, it was worth it.

However, Java is no longer the coolest programming language out there, it slowly dies due to lack of or very slow development. Its features are outdated, it is not as productive as I would like it to be. It's time to move on. Probably Java still is one of the best programming languages to teach in the universities, but students should understand that world software development field is evolving quickly and they need to keep an eye of what is happening in the industry.

I am still a big fan of JVM - it is well tuned for performance and it is cross-platform. .NET/C# is not nearly an option. I really like Scala, Clojure seems very interesting, as well as Vala, Go and Dart. Kotlin seems very promising as well. Sooner or later there will be another popular language on JVM that most Java developers will be able to shift to. Hopefully there won't be too many of such languages and hopefully they will be statically typed. I recommend every Java developer to check the Play framework for a fresh look at Java. Anyway, the current trend in software development is to merge academic computer science and industrial programming together again - you should pay a lot more attention to functional programming in addition to the good old object oriented programming (OOP) now. The concept of DevOps is also becoming more and more important, meaning that soon you will not be able to survive as a developer, if you don't know how to create a software product from scratch until the end, deploying it yourself to the production system.

However, I am not going to leave the teaching 'business'. I will still give talks at conferences, organize trainings, and hopefully contribute to making IT education better with Codeborne Academia, but more on that later. I am still open to offers from universities and colleges as well, feel free to contact me.

Now the important part

All the code written during the course by me and the students during the past 6 years is now available on the Github:
https://github.com/angryziber/java-course

The lastest (2011) lecture slides are available on Slideshare:
http://www.slideshare.net/antonkeks/presentations

Or go to specific lectures using the links below:

  1. Introduction
  2. Java basics, program flow
  3. OOP in Java
  4. Exceptions and Collections
  5. Generics, Enums, Assertions
  6. Unit testing and Agile software development
  7. Text processing, Charsets & Encodings
  8. I/O, Files, Streams
  9. Networking, Reflection
  10. Threads and Concurrency
  11. Design Patterns
  12. Web, Servlets, XML
  13. JDBC, Logging
  14. Java Beans, Applets, GUI
  15. Advacned: Ant, Scripting, Spring & Hibernate


Wednesday, January 4, 2012

jQuery filters out script elements

Sometimes you want to fetch new HTML content with AJAX. You then parse incoming html and insert it into the document:

$.get('/some-content', function(html) {
  $(html).find('#content').appendTo('body');
});

or just use the load() function as a short-cut:

$('body').load('/some-content #content');

The problem is, this doesn't execute any embedded script tags.
Actually, doing this:

$('<div><script>alert(1)</script></div>')

you will get a jQuery set containing two elements, not one DOMElement as most people would expect!
The set will contain the original div as a DOMElement (with all its content except the script) and a script seprately, also as a DOMElement. If there were more scripts in the original unparsed string, you would get all script elements separately in the parsed set.

The workaround would be to execute all script elements manually if you do any DOM manipulation with the incoming HTML:

$.get('/some-content', function(html) {
  $(html).find('#content').appendTo('body');
  $(html).filter('script').appendTo('body');
});

Sad, but true...

Some more background info from comments on jQuery site:
All of jQuery's insertion methods use a domManip function internally to clean/process elements before and after they are inserted into the DOM. One of the things the domManip function does is pull out any script elements about to be inserted and run them through an "evalScript routine" rather than inject them with the rest of the DOM fragment. It inserts the scripts separately, evaluates them, and then removes them from the DOM.