tag:blogger.com,1999:blog-35847302659866407432024-03-13T20:14:43.002+01:00Java and motorcycles :)A mix of Java and motorcycles :) Currently strong focus on Android developmentUlf Hergehttp://www.blogger.com/profile/00157114206039050526noreply@blogger.comBlogger16125tag:blogger.com,1999:blog-3584730265986640743.post-8034048388089694232010-02-09T21:18:00.003+01:002010-02-09T21:21:57.059+01:00Fordonsjägaren 2.0A new updated version of Fordonsjägaren is released. It's not a final version since it's still not using the intended webservices.<br /><br />Search for stolen cars and motorcycles, just search for "Fordonsjägaren" on Android Market.<br /><br />Soon you can find more info on <a href="http://www.jeyspot.com">www.jeyspot.com</a><br /><br />It would be nice to be able to offer this service to more countries!Ulf Hergehttp://www.blogger.com/profile/00157114206039050526noreply@blogger.com0tag:blogger.com,1999:blog-3584730265986640743.post-88228254001610799032009-10-28T09:18:00.004+01:002009-10-28T09:30:43.148+01:00Using Map and List in the same activityOne of Javas problems (not correct to call it a problem maybe) is the lack of support for multiple inheritance. This means that you cannot extend both for instance MapActivity and ListActivity from the same class. So how do you implement a map with a list then? It's easy!<br /><br />The ListActivity is nothing more than a wrapper around the ListView. What it does is only making it slightly easier to use a listView but it doesn't give you any extra value. <br /><br />Instead of using the getListView() of ListActivity you simply fetch your own declared ListView exactly the same way as you fetch any other view<br /><br />ListView lv = (ListView) findViewById(R.id.my_list_view);<br /><br />You can then use this in any way you prefer. Put an adapter to it by using setAdapter() instead for ListActivity.setListAdapter() (it does the same thing). <br /><br />This actually took me a while to figure out since almost all tutorials and the examples always extends the ListActivity instead of using the raw view.Ulf Hergehttp://www.blogger.com/profile/00157114206039050526noreply@blogger.com0tag:blogger.com,1999:blog-3584730265986640743.post-67644950474891141932009-10-02T10:30:00.004+02:002009-10-02T10:42:46.272+02:00Localhost settings for Android emulatorRecently I stumbled upon a problem when trying to connect to a local webservice through the Android emulator. Everytime I tried to connect it ended up with a "Connect refused" exception.<br /><br />The answer to the problem and the solution is simple. What I was trying to do was to connect to "http://localhost:7001/myWebservice". The emulator interprets this as a connect to itself because it sees itself as localhost (of course :) ). <br /><br />The solution? As Google states in their Android documenatation, <a href="http://developer.android.com/guide/developing/tools/emulator.html#emulatornetworking">http://developer.android.com/guide/developing/tools/emulator.html#emulatornetworking</a> , the emulator runs behind a virtual router/firewall and you can reach the host loopback interface (127.0.0.1) by using the adress 10.0.2.2.Ulf Hergehttp://www.blogger.com/profile/00157114206039050526noreply@blogger.com0tag:blogger.com,1999:blog-3584730265986640743.post-78434181253389976552009-10-01T11:49:00.002+02:002009-10-01T11:53:04.890+02:00SOAP webservices on AndroidTo be able to consume SOAP ws on your Android phone please follow the simple steps in this blog http://android.amberfog.com/?p=45 .<br /><br />You also may need to rename HttpConnectionSE to HttpConnection or update the code using your *HttpConnectionSE class instead.Ulf Hergehttp://www.blogger.com/profile/00157114206039050526noreply@blogger.com0tag:blogger.com,1999:blog-3584730265986640743.post-48566697136004534202009-09-11T19:23:00.004+02:002009-09-11T19:39:28.553+02:00New version of Fordonjägaren coming upI just got some time over to continue on the project Fordonsjägaren.<br /><br />Next update will primary fix some bugs and it will also switch over to use a much more reliable data source instead of the old "less good" one :)<br /><br />The stolen vehicle data is updated once every 24h from police and insurance compaines and there will be a possibility to search not for only registered vehicles but also for boats!<br /><br />I expect the new version to be launched by mid october. Hopefully there will also be some more features added like geotaging of locations, search history and maybe maybe maybe a first sample of number plate recognition via taken photos.Ulf Hergehttp://www.blogger.com/profile/00157114206039050526noreply@blogger.com0tag:blogger.com,1999:blog-3584730265986640743.post-84645573840860404682009-08-25T18:19:00.004+02:002009-08-26T11:00:34.623+02:00Fordonsjägaren beta released on android market<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvw0cNVKJJJZFauzisxZnIKXHm2Au_LDcgA0kXStXBPaj8z927KIjJdAYF2S4zuMItNSRiCEdpDRJIDY3uffGFhyzNYtO2Og8LzGRTytwAI6nYI_nrysMcnM3a34typ-q9msLMU8-_dPQ/s1600-h/s%C3%B6kningen.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 166px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvw0cNVKJJJZFauzisxZnIKXHm2Au_LDcgA0kXStXBPaj8z927KIjJdAYF2S4zuMItNSRiCEdpDRJIDY3uffGFhyzNYtO2Og8LzGRTytwAI6nYI_nrysMcnM3a34typ-q9msLMU8-_dPQ/s320/s%C3%B6kningen.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5374194763721998690" /></a><br />Yesterday I released the very first version of Fordonsjägaren. This application is meant to assist people in the hunt for stolen vehicles and with the help of the easy to use gui one can enter a registration number from a car or motorcycle and easily get hold of information wheter it was stolen or not. In the case of a theft you will also see details about the vehicle such as date it was stolen, location, brand, color etc.<br /><br />This first version is of very simple nature just to show the concept. Later versions will have support for reporting geographical locations, fast dial to the police and so on, there are many cool features to add! However it turned out to have a couple of bugs, making it hard to use on some phones :( Will look in to that next week.<br /><br />You can find the program via Android Market under the name "Fordonsjägaren".<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvSqN_aTCTDp6NA1U9aG447N9zhR9xzPkeYn-WLKaOR_goJaClepAkl20v5rWtNyIk0xpaF2Mdj52zt75K4NfyhMBrd1xKeSPeBGx34TuHOurAtAO3iE8YjmL5MIhQxjf_5IGdFNUH4y4/s1600-h/start.JPG"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 164px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvSqN_aTCTDp6NA1U9aG447N9zhR9xzPkeYn-WLKaOR_goJaClepAkl20v5rWtNyIk0xpaF2Mdj52zt75K4NfyhMBrd1xKeSPeBGx34TuHOurAtAO3iE8YjmL5MIhQxjf_5IGdFNUH4y4/s320/start.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5374194562306616402" /></a>Ulf Hergehttp://www.blogger.com/profile/00157114206039050526noreply@blogger.com0tag:blogger.com,1999:blog-3584730265986640743.post-19229181125144709022009-08-25T08:30:00.002+02:002009-08-25T18:16:55.413+02:00Hooked on Android!Recently I understood the power of Googles new Android so now I am proud to announce my self to the family of android developers. Yesterday I realeased my first application, more of that in the post!<br /><br />To all of you who haven't tried Android out yet, please do, it's possible to do all sorts of crazy stuff like using the GPS and map support for creating new mind bending applications!Ulf Hergehttp://www.blogger.com/profile/00157114206039050526noreply@blogger.com0tag:blogger.com,1999:blog-3584730265986640743.post-47215677338075850112009-01-19T21:43:00.004+01:002009-01-19T22:08:24.126+01:00Nice util to copy properties!Have you ever used for instance JPA over EJB and got frustrated when you manually need to set your getters and setters of the DTO manually? I certainly have and in my current project we developed our own tool to handle these kind of problems.<br /><br />Database (entity obejct) <-> DTO (transfer object) <-> EJB cloud <-> UI that uses DTO.<br /><br />This is probably a common way to implement an application that takes advantage of Javas EJB but it also means A LOT of set and get between the DTO and the database entitys when you need to transfer data from backend to frontend.<br /><br />Our first solution was a simple one, we used reflections to find getters and setter and then just transferred the values. However problem arised when we had lists with complex types i.e. DTO's in DTO's. Our copy properties class util just grow bigger and the performance was terrible!<br /><br />One day we found this lovely tool on sourceforge called Dozer, <a href="http://dozer.sourceforge.net/">Dozer homepage</a>. Out of the box it handles all of these problems without any problem and it perform great! I made a quick benchmark with 10000 entitys and found it 8.6 times faster than our own implentation :)<br /><br />It works like this. Lets say we have our entity object DogEO and our transfer object DogDTO:<br /><br /><div style="background-color:#00FFFF; font-family:courier,'courier new',sans-serif"><br /><br />DogDTO dto = new DogDTO();<br />dto.setHeight = 2;<br />dto.setWeigth = 23;<br /><br />DogEO dogEo = new DogEO();<br /><br />MapperIF mapper = new DozerBeanMapper();<br />dogEo = (DogEO) mapper.map(dto, DogEO.class);<br /><br /></div><br /><br />This maybe seems like a small problem but trust me when you have 30+ DTO's with complex structure and content that are subject to constant change, then this is the shit!Ulf Hergehttp://www.blogger.com/profile/00157114206039050526noreply@blogger.com0tag:blogger.com,1999:blog-3584730265986640743.post-45382729170014553212009-01-07T14:32:00.002+01:002009-01-07T14:42:25.000+01:00JPA Query cacheOk i'll take this one in english since it doesn't touch any motorcycle stuff :)<br /><br />I've recently had some cacheing problem with JPA when working with detached entities that we later on had to re-attache due to the fact that we are using EJB and hence have 2 separated domains.<br /><br />In our case we actually don't want any cacheing under many circumstances since this put alot of old information into the entitymanager that is later fetched by other threads and hence they get old information. However it seems like many entitymanger providers have cacheing turned on by default.<br /><br />I found an interesting blog article java.net which explains this problem pretty well, http://weblogs.java.net/blog/guruwons/archive/2006/09/understanding_t.html . This one is for those of you who are using toplink essentials, if you insted are using Kodo (BEA/ORACLE) as we do, please take a peek at http://edocs.bea.com/kodo/docs40/full/html/ref_guide_caching.html for more info on how to turn of the cache.<br /><br />This seems to work very well but unfortunely you turn of ALL cacheing using this one, maybe not a wanted behaviour.<br /><br />JPA XML Style:<br /><br />>property name="kodo.QueryCache" value="false"/<Ulf Hergehttp://www.blogger.com/profile/00157114206039050526noreply@blogger.com0tag:blogger.com,1999:blog-3584730265986640743.post-71204403567350415902008-12-29T23:19:00.002+01:002008-12-29T23:21:15.935+01:00Ny hoj i garaget<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigwEu6KCRTOmnn8A28VnzwUzNY94oSWt9lhIF7EDY9Wfo1_YiK8agBZYaCsrCo2CCXJhDze9cq0BKzhPS20sNk46nkMZDqFROWHZ41jvmPBHCWcoOfRXb-aGbDMItKC8wmWnlU2jzieDU/s1600-h/DSC_1880-small.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 320px; height: 215px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigwEu6KCRTOmnn8A28VnzwUzNY94oSWt9lhIF7EDY9Wfo1_YiK8agBZYaCsrCo2CCXJhDze9cq0BKzhPS20sNk46nkMZDqFROWHZ41jvmPBHCWcoOfRXb-aGbDMItKC8wmWnlU2jzieDU/s320/DSC_1880-small.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5285340646289876386" /></a><br />Jaha så var det dags för ny hoj då. Denna gången föll jag för en Suzuki GSX-R 750 K6, en kanonhoj på alla sätt.Ulf Hergehttp://www.blogger.com/profile/00157114206039050526noreply@blogger.com0tag:blogger.com,1999:blog-3584730265986640743.post-87162700254355534442008-07-01T11:26:00.002+02:002008-07-01T11:27:06.314+02:00Bluffen, ett faktumMikaels Bilförmedling, en firma med onda avsikter, akta er. <br /><br />Mer info kommer senare efter polisanmälan är klarUlf Hergehttp://www.blogger.com/profile/00157114206039050526noreply@blogger.com0tag:blogger.com,1999:blog-3584730265986640743.post-88659648165709413632008-06-23T21:58:00.002+02:002008-06-23T22:03:07.375+02:00Ny hoj på ingång<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkrWSBDU3SpH42OpHA_dwcuse64KFCSVjZfoB4PCBxzJLk7wmpHz3aNQnlM3QKMPVXEwbv8wIy15yeQSMRNzajNWS7FLliYtSEpLIdZSrh1ci43SHKzHD_5ttisiYM83SeuuMpEmFdzS4/s1600-h/Yamaha-YZF-R1-2004.jpg"><img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkrWSBDU3SpH42OpHA_dwcuse64KFCSVjZfoB4PCBxzJLk7wmpHz3aNQnlM3QKMPVXEwbv8wIy15yeQSMRNzajNWS7FLliYtSEpLIdZSrh1ci43SHKzHD_5ttisiYM83SeuuMpEmFdzS4/s320/Yamaha-YZF-R1-2004.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5215169942267246354" /></a><br />Jaha då har man hittat en ny motorcykel! <br /><br />Det lutar helt åt att det blir en Yamaha R1 2004, blå/vit, sjukt snygg och mycket extrem hoj!<br /><br />Till det roliga hör att mannen jag ska köpa den av driver en bilförmedling. Denna bilförmedling sålde motorcykeln RIKTIGT billigt och har även haft andra motorcyklar inne på lager till liknande priser vilket får en att bli lite misstänksam. Jag har i dagsläget lagt en vässentlig summa pengar i handpenning och har blivit lovad hojen besiktigad och klar (import ej reggad i dagsläget) inom 14 dagar, detta har jag ett avtal på. <br /><br />Jag kan ju säga att jag sover inte speciellt gott om nätterna och kommer nog inte göra det förrän dess att jag har nycklarna i hand...<br /><br />Hur som haver här nedan kommer en liten bild på skönheten!Ulf Hergehttp://www.blogger.com/profile/00157114206039050526noreply@blogger.com1tag:blogger.com,1999:blog-3584730265986640743.post-51257338933038869632008-06-16T09:14:00.000+02:002008-06-16T09:24:14.191+02:00Blocket RSS feed v 0.1 betaI och med att hojen är såld och en ny ska införskaffas så uppstod ett enormt behov av att ha ständig tillgång till blocket.se. Att hela tiden bevaka vid datorn blir både stressigt och stjäl mycket tid av andra aktiviteter så en alternativ lösning behövdes.<br /><br />Lösningen är lika simpel som genial! Med hjälp av lite fina utvecklarkunskaper har jag nu skapat en applikation som rippar blocket och förser mig med en RSS-feed av utvalda blocketdelar. Detta betyder att jag slipper sitta och refresha blocket för att se om det kommit något nytt, jag kan helt enkelt låta min webläsare eller ännu bättre, min mobil fixa det hela! Detta betyder att jag kan ligga på beachen utan dator och hela tiden få alla blocketuppdateringar direkt till telefonen, kanonsmidigt. Hittar jag något jag gillar så ringer jag bara med en gång eftersom all info om annonserna finns med i RSS-feeden.<br /><br />Mer info och lite kodsnuttar kommer! Om det blir en publik release av RSS-strömmarna är mycket skeptiskt då jag misstänker att blocket inte skulle gilla det. Kommande tillägg inkluderar notifikation om uppdateringar via MSN, mail och SMS.Ulf Hergehttp://www.blogger.com/profile/00157114206039050526noreply@blogger.com0tag:blogger.com,1999:blog-3584730265986640743.post-53140337815588188962008-06-13T21:37:00.001+02:002008-06-13T21:42:22.781+02:00R.I.P du gamle gixxer<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-jFmLqwm8JBEofGXH9EwDhtDM0uM95E7LxQfh53hGqL0X9s-kF3IE6e5wRrrUnzjJUtSVA2khgiig15llg8FahnvrqgrpEew3cILnazRIyhvItSHG9QtD2ztB4wi2rdawO4BaKsqWZVI/s1600-h/hoj3.JPG"><img id="BLOGGER_PHOTO_ID_5211453605529627250" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-jFmLqwm8JBEofGXH9EwDhtDM0uM95E7LxQfh53hGqL0X9s-kF3IE6e5wRrrUnzjJUtSVA2khgiig15llg8FahnvrqgrpEew3cILnazRIyhvItSHG9QtD2ztB4wi2rdawO4BaKsqWZVI/s320/hoj3.JPG" border="0" /></a><br /><div>Jaha då var det gjort, hojen är såld! Fick ett ryck häromdagen och satte ut henne på blocket och idag kom alltså den ny ägaren. Snubben hade inget körkort och skulle köra den hem till helsingborg iklädd endast en tunn tröja och hjälm på huvet. Jag ifrågasatte honom inte utan han sa att allt var lugnt men tro mig jag kommer varken läsa tidningen eller lyssna på radion under helgen för att slippa höra om 21-åringen som körde ihjäl sig på en vit/blå Suzuki GSX-R 750.</div><br /><div></div><br /><div>Så R.I.P. du gamle gixxer, hoppas din nya ägare är snäll mot dig men det är mindre troligt ;)</div>Ulf Hergehttp://www.blogger.com/profile/00157114206039050526noreply@blogger.com0tag:blogger.com,1999:blog-3584730265986640743.post-79185384496036594872008-06-13T17:34:00.000+02:002008-06-13T20:03:04.864+02:00Ring Knutstorp<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiy8Thd-9E0_Tk7Xoh9xaERkyUwtmKU9eJAO2FPnslcf_L8orUBYTn0goHAOBkJIBsZi_S22M-sTysELuGIfrmcJ6_b7j97o8c1gdCrw5TNGWctYkRgYS9j3c-JJDoD8BNLm9eqLcNzVsE/s1600-h/0235.jpg"><img id="BLOGGER_PHOTO_ID_5211428028999379522" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiy8Thd-9E0_Tk7Xoh9xaERkyUwtmKU9eJAO2FPnslcf_L8orUBYTn0goHAOBkJIBsZi_S22M-sTysELuGIfrmcJ6_b7j97o8c1gdCrw5TNGWctYkRgYS9j3c-JJDoD8BNLm9eqLcNzVsE/s320/0235.jpg" border="0" /></a><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPxMDJJlflv6xq8GtdrbOSvAYJ2R9IQqSWb9oWnfdJUoLNDMhs3didlZInrzVdTcxfHONmaPXCdf2R7z-aVZvCZ3dnvP3E2U0UBSJXrdUOoN77Mj9ogqc2nGtIQvnpz661Q_tTwuwYdA8/s1600-h/DSC_1024.JPG"><img id="BLOGGER_PHOTO_ID_5211428033294346834" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPxMDJJlflv6xq8GtdrbOSvAYJ2R9IQqSWb9oWnfdJUoLNDMhs3didlZInrzVdTcxfHONmaPXCdf2R7z-aVZvCZ3dnvP3E2U0UBSJXrdUOoN77Mj9ogqc2nGtIQvnpz661Q_tTwuwYdA8/s320/DSC_1024.JPG" border="0" /></a><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5Jd6ZFa8mJRAv4ODbZ2WNoFybZHTKPKDAysZ24arb0W4mIa_sNB_cz7VxmK6gTOD_pWNFFcvw2DdjJPg8OWzsphc3fCk5khHaGrsNuT7yd-XyNqy66QXFdv43aLfyjhf8NnMHbOHN85k/s1600-h/DSC_1027.JPG"><img id="BLOGGER_PHOTO_ID_5211428037589314146" style="FLOAT: left; MARGIN: 0px 10px 10px 0px; CURSOR: hand" alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5Jd6ZFa8mJRAv4ODbZ2WNoFybZHTKPKDAysZ24arb0W4mIa_sNB_cz7VxmK6gTOD_pWNFFcvw2DdjJPg8OWzsphc3fCk5khHaGrsNuT7yd-XyNqy66QXFdv43aLfyjhf8NnMHbOHN85k/s320/DSC_1027.JPG" border="0" /></a><br /><div>Höll nästan på att glömma bort detta evenemang! Den 5/6 höll SMC en BKK-kurs, d.v.s en kurs där man lär sig hantera sin hoj på bana.<br /><br />Extremt fint väder och en underbar bana gjorde denna dagen till något att minnas! Jag har redan bokat in en körning till den 11/8</div>Ulf Hergehttp://www.blogger.com/profile/00157114206039050526noreply@blogger.com0tag:blogger.com,1999:blog-3584730265986640743.post-19543157057012337202008-06-07T10:17:00.000+02:002008-06-07T10:20:38.860+02:00Säsong 2008 har startatOk här kommer den, första bloggen någonsin :)<br /><br />Hojsäsongen 2008 har förvisso varit igång ett bra tag nu men i och med det fina vädret har den kommit igång på allvar.<br /><br />Mina förhoppningar på 2008 är mer åkande och framförallt mer åkande på bana vilket är bra mycket tryggare än att tokgasa ute på vägarna.<br /><br />Redan nu har det hänt allt för många olyckor och dödsfall i Sverige så det gäller att ta det lugnt där ute och aldrig sätta sitt liv på spel.Ulf Hergehttp://www.blogger.com/profile/00157114206039050526noreply@blogger.com0