tag:blogger.com,1999:blog-11219268339381648302024-03-05T20:00:19.479+02:00Demosten's Blog (English)A Blog targeting various subjects. Software development, politics and some thought sharingdemostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.comBlogger21125tag:blogger.com,1999:blog-1121926833938164830.post-6136283297427735582013-09-14T19:44:00.000+03:002013-09-14T19:48:10.057+03:00Apple - ahead of the competition, again<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7cM6RDrxl1uCBAwFRDkA39qzmhsnRVg6rF301l1FFY-RJUMi9Hjp2aXFiyY_JqbrGPnRiZrvkCuNSSBuLgxyWGtuvjBCrQ5dKehVCNLwrQj5mDxH_azvWEQCnj28zV01LVkt8tW3s73M/s1600/iphone5s-processor-64-bit.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="277" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7cM6RDrxl1uCBAwFRDkA39qzmhsnRVg6rF301l1FFY-RJUMi9Hjp2aXFiyY_JqbrGPnRiZrvkCuNSSBuLgxyWGtuvjBCrQ5dKehVCNLwrQj5mDxH_azvWEQCnj28zV01LVkt8tW3s73M/s400/iphone5s-processor-64-bit.jpg" width="400" /></a></div>
<br />
<i>5 days have passed since Apple presented the best iPhone yet - iPhone 5s. The only great feature I see there is the 64-bit processor inside. Let me tell you why I believe this is a brilliant move and why I do think Apple's users will not be the first to take advantage of this.</i><br />
<br />
<h4>
Why is it brilliant move?</h4>
<br />
Apple is a great vertically integrated company. They make both hardware and software, then pack it into great products. While they do not make all the hardware, they control the most important parts of it and work on helper chips like M7 to add additional functionality to their devices. All this makes possible for innovation to happen quicker compared to other vendors. On 10th of September they prove it once again by showing the first 64-bit smartphone. This makes them way ahead of the competition on that field.<br />
<br />
<h3>
What will it cost to the rest of the smartphone industry to match that?</h3>
<br />
Several companies need to work together, or in turns, to make the same thing happen.<br />
<ul>
<li>ARM should produce a final specification of the instruction set (this is probably done or almost done)</li>
<li>ARM certified companies should create 64-bit processors working with the new instruction set. I can only hope this is in the works too. </li>
<li>Whoever makes the C/C++ compiler (gcc, arm, microsoft) should add support for that new 64-bit instruction set. I guess that someone is working on that. This will produce all the needed tools (compilers, linkers, other developer stuff called "toolchain"), which will make the next step possible</li>
<li>Google and Microsoft should port Android and Windows Phone/RT/etc. to be built with the new 64-bit toolchain. They should also provide support for the new 64-bit versions to run old 32-bit programs.</li>
<li>With all previous steps done - Samsung, HTC, Nokia and others can build the new generation of devices.</li>
</ul>
As you can see this is a big set of complex tasks. Though some of them can be done in parallel, others have dependencies and cannot. It will take time for the rest of the smartphone industry to catch up! <br />
<br />
<h4>
Why I do believe, Apple users won't be the first to take real advantage of this 64-bit thing?</h4>
<br />
Apple made a great marketing message out of it. They reminded the world they have not lost their innovation edge and I really love that! But what does 64-bit really means to the end users? Well - it does lead to minor performance boost in some specific tasks involving 64 bit integer calculations. Probably memory transfers will be faster too. It will also lead to bigger code size (that's more data to transfer when you download apps). The most important gain from 64-bit transition is support for more than 4GB of RAM inside your device. To be honest, if it wasn't for that last advantage, I don't think switching is needed at all, but it is there and the smartphone future is 64-bit for sure. To me unless you put more than 4GB of RAM inside that device, 64-bit architecture is just a nice marketing message, another line in specification wars, showing a potential - but nothing substantial.<br />
<br />
Having all that said and taking into account current specifications history, I expect Samsung, Sony or HTC to be the first to release a smartphone with more than 4GB of RAM, not Apple. That's how it might be Android, not iOS users be the first to enjoy the true 64-bit advantages.demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.com0tag:blogger.com,1999:blog-1121926833938164830.post-89484140288325104722013-09-01T17:36:00.001+03:002013-09-14T19:45:24.694+03:00Apple "cable" adventures<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEim7JMMPqm2wTM7qwwycPsKDBngsSfNqvFleA-Ew9E3YgPN1HIlls1wJFp5vPE6QIHcHStU_dvfdGNEBGDYbQRfFahnPviMrmYz1xCWI1sV78_DlRwnct_E4hwZMmbB0Iv7OkWvVtBLsxY/s1600/IMG_0011+1.PNG" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEim7JMMPqm2wTM7qwwycPsKDBngsSfNqvFleA-Ew9E3YgPN1HIlls1wJFp5vPE6QIHcHStU_dvfdGNEBGDYbQRfFahnPviMrmYz1xCWI1sV78_DlRwnct_E4hwZMmbB0Iv7OkWvVtBLsxY/s400/IMG_0011+1.PNG" width="225" /></a></div>
<i>Several weeks ago I found out I need a long lightning cable. Since Apple provides only 1 meter cables for $19 I decided to buy a 2 meters cable from eBay for $3 (delivery included) instead. Today it arrived from China and this is the welcoming message to see when I plugged it in. (<= look at the picture now!) ... </i><br />
<br />
<i>"It's a bloody cable" I yelled at the screen, but Siri remained silent. </i><br />
<br />
Of course I know this is not a cable. Cables are used to transfer electricity only. Apple call it a cable, it looks like cable to the users, but it a contains electronics, which makes it a <i>convertor</i>. Convertors are more complex and tend to break more often. In general using convertors for cables is bad for users. Here are several examples when those convertors got me in trouble:<br />
<br />
The last two devices we bough for development used a lightning cable. We used cables that came with them for development and one of those cables just stopped working about 1 week later. Looking from outside it was a perfectly new cable. Just electronics inside were broken. We put it in the trash and bought two new cables from Apple. You know ... just in case ... <br />
<br />
The second story is older and is about the older 30 pin Apple "cables". Since the principle is the same I guess same things can happen with the new cables.<br />
<br />
I bought my iPad 3 and found out that not only the cables are the same, but chargers also look exactly the same as those of my old iPhone 3GS. I got worried because the new charger had 2.1A output, while iPhone's charger was 1A output. If I put 2.1A into iPhone it could fry it. If I put 1.0A into iPad it will charge it more than twice slower! It turned out the "cables" take care of this. They know they are connected to iPhone and they make it charge with the proper power. However my original iPhone 3GS cable knew nothing about iPad 3 and even with iPad's charger it charged it at iPhone's rate! Now I have two "cables" which look exactly the same and both work on iPhone, but only one of them charges properly my iPad. <b>It SHOULD be a bloody cable, NOT a converter!</b> Electronics should be inside the devices not inside the cables!demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.com0tag:blogger.com,1999:blog-1121926833938164830.post-54221454988685869242013-08-18T15:30:00.000+03:002013-09-14T19:46:06.532+03:00Why I decided NOT to buy Windows Phone<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfy55IobOIxPWVYoSSoT8NCf0A_3HNF0-eQasLvUBDYrcT3AsJwo1py3i0VkCBe8gZ79uxP6t8HT9a3KHvljNJc0FMk3_fph4WzUCU39avMCAr_PTLIaBcjU0gX-vvgy2Oyia2sHZS0Kg/s1600/windowsphone8.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfy55IobOIxPWVYoSSoT8NCf0A_3HNF0-eQasLvUBDYrcT3AsJwo1py3i0VkCBe8gZ79uxP6t8HT9a3KHvljNJc0FMk3_fph4WzUCU39avMCAr_PTLIaBcjU0gX-vvgy2Oyia2sHZS0Kg/s400/windowsphone8.jpg" width="400" /></a></div>
<br />
Recently my old HD2 (running Android) died and I decided to go for a Windows Phone 8 device. I thought it would be a nice change. Since I like experimenting and love having as much control over my own device as possible, I went to <a href="http://forum.xda-developers.com/" target="_blank">http://forum.xda-developers.com/</a>. I always do so in order to check out, how my device of choice handle custom ROMs and other updates. To my surprise it turned out, the device does not support custom ROMs. At this point no Windows Phone 8 device does! So the decision was obvious and now I'm a proud owner of Samsung Galaxy S4, rooted and tuned to my liking in its first 24 hours.<br />
<br />
I don't understand Microsoft's logic here. Here are the facts as I see them, both good and bad:<br />
<br />
<ul>
<li>Windows Phone as an OS is good. Lags about an year behind iOS and Android but is catching up.</li>
<li>Devices are good. Again lag about an year, year and a half behind. Kind of catching up at least with Apple in terms of some hardware. At this point only one device (Nokia Lumia 1020) with its 41MP camera has competitive edge in hardware.</li>
<li>Visual Studio IDE, the tool for building apps is on par with Xcode and Eclipse ADT. <i>(I also tried Android Studio. It's too early to mention it here)</i></li>
<li>Windows Phone and its devices are not a market leader. In fact they are not even close to being such.</li>
<li>The above results in many developer not considering Windows Phone as a primary target. This leads to chicken and egg problems. <i>Not enough apps, because there are not enough users, because there are not enough apps.</i></li>
</ul>
<br />
What does all this have to do with no custom ROM support? Everything! Yes, I know. People like me willing to play with their phones, build and try custom ROMs and other great stuff are minority. We are not marketing target and should not be. However we are the ones who show how cool a phone can be. People like me inspire others to use this or that product. We explore and find new ways to show the real potential behind a device.<br />
<br />
<br />
Dear Microsoft,<br />
<br />
Why would you lock your devices when all you need at this point are early adopters to help you <a href="http://www.amazon.com/Crossing-Chasm-Marketing-Disruptive-Mainstream/dp/0060517123" target="_blank">Crossing the Chasm</a>? If you don't believe me look at the Xbox ONE DRM reactions. Please fix this! It would be nice to have another good mobile OS to play around for the years to come.<br />
<br />
Best Regards,<br />
demosten<br />
<br />demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.com0tag:blogger.com,1999:blog-1121926833938164830.post-50789796259776663292011-09-15T06:36:00.000+03:002013-09-14T19:46:39.344+03:00Compiling Your Own Version of SQLite for iOS and applying some fixesAdding your own version of sqlite for iOS is fairly easy task.<br />
<ol>
<li>Go to <a href="http://www.sqlite.org/">http://www.sqlite.org/</a> and download the latest sqlite amalgamation archive</li>
<li>Extract it somewhere and add it to your Xcode project. You have several options here. You could copy it to your project folder, or link to it. You could also decide, to put it as a static library target and link it to your main target. It's up to you. You will need only sqlite.c and sqlite.h files.</li>
<li>Apply some #defines you might need. For example:</li>
</ol>
<pre class="c" name="code">#define SQLITE_ENABLE_FTS3
#define SQLITE_DISABLE_LFS
#define SQLITE_THREADSAFE 0</pre>
Then you can compile!<br />
<br />
If you need more detail about this part of the process, you can find more detailed description <a href="http://longweekendmobile.com/2010/06/16/sqlite-full-text-search-for-iphone-ipadyour-own-sqlite-for-iphone-and-ipad/">here</a> and <a href="http://mobileorchard.com/compiling-your-own-version-of-sqlite-for-ios/">here</a>. <br />
<br />
And then I hit a problem. I was testing on different simulator versions and found out that for some reason SQLite functions returned strange errors ( SQLITE_CORRUPT with number code 11 ) with some versions of the simulator, while with others, everything worked perfectly fine. After hours of debugging, I've found that the problem is in wrong file size, returned by a function called unixFileSize. Here is how it looks in my sqlite version:<br />
<pre class="c" name="code">/*
** Determine the current size of a file in bytes
*/
static int unixFileSize(sqlite3_file *id, i64 *pSize){
int rc;
struct stat buf;
assert( id );
rc = osFstat(((unixFile*)id)->h, &buf);
SimulateIOError( rc=1 );
if( rc!=0 ){
((unixFile*)id)->lastErrno = errno;
return SQLITE_IOERR_FSTAT;
}
*pSize = buf.st_size;
/* When opening a zero-size database, the findInodeInfo() procedure
** writes a single byte into that file in order to work around a bug
** in the OS-X msdos filesystem. In order to avoid problems with upper
** layers, we need to report this file size as zero even though it is
** really 1. Ticket #3260.
*/
if( *pSize==1 ) *pSize = 0;
return SQLITE_OK;
}</pre>
Here after a successful call to osFstat, buf.st_size contained wrong file size. This is clearly not a bug in SQLite. There might be several reasons for this to happen. Probably struct stat is different in terms of packaging or field sizes from the one compiled with some of the simulators. I don't know and since I cannot fix it in iOS Simulator (the power of closed source in action), I don't really care. What I can fix, is not to use fstat() and struct stat in this function. Here is how I changed the function using other Unix ways and do the job:<br />
<pre class="c" name="code">/*
** Determine the current size of a file in bytes
*/
static int unixFileSize(sqlite3_file *id, i64 *pSize){
off_t pos, size;
pos = lseek(((unixFile*)id)->h, 0L, SEEK_CUR);
if (-1 == pos){
((unixFile*)id)->lastErrno = errno;
return SQLITE_IOERR_SEEK;
}
size = lseek(((unixFile*)id)->h, 0L, SEEK_END);
if (-1 == size) {
((unixFile*)id)->lastErrno = errno;
return SQLITE_IOERR_SEEK;
}
if (-1 == lseek(((unixFile*)id)->h, pos, SEEK_SET)) {
((unixFile*)id)->lastErrno = errno;
return SQLITE_IOERR_SEEK;
}
*pSize = size;
/* When opening a zero-size database, the findInodeInfo() procedure
** writes a single byte into that file in order to work around a bug
** in the OS-X msdos filesystem. In order to avoid problems with upper
** layers, we need to report this file size as zero even though it is
** really 1. Ticket #3260.
*/
if( *pSize==1 ) *pSize = 0;
return SQLITE_OK;
}</pre>
As you can see I'm using lseek to get the file size and thus avoid the struct stat and fstat() usage. This fixed the problem for me and I hope this could spare some time to others too. Note that this fix is not portable and will not work in non Unix environment.demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.com0tag:blogger.com,1999:blog-1121926833938164830.post-29325236244946358992011-08-29T22:46:00.000+03:002011-08-29T22:46:02.324+03:00How to have great wait cursor animations for free<br />
<div style="text-align: left;">While searching for a "trivial" wait animation for one of my AJAX projects I've found a great online solution for the problem. It has been around for years now, but it's new for me and I decided to share it.</div><div style="text-align: left;"></div><div style="text-align: left;"></div><div style="text-align: left;"></div><div style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em; text-align: left;"></div><div style="text-align: left;"><br />
</div><div style="text-align: left;">Introducing <a href="http://ajaxload.info/">http://ajaxload.info/</a> a free AJAX load animation generator. It's great to have it around.</div><div style="text-align: left;"><br />
</div><div class="" style="clear: both; text-align: left;">Here are some images I've created briefly as a showcase ..... well I guess they already have your attention :)</div><div class="" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixx48y7QRDpKPQQKiPvQWaLaNnzRpFkM4ae7Hs4FaAp70AoyPgzIEiT052BR3_upSiOxwQj9KZBAtrW3FSkHHgQ5n1jqMbo42IDgVWJyaWTG8x5LAQIbFMHkQfDRARAuBpD8zzJmDk0kw/s1600/10.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixx48y7QRDpKPQQKiPvQWaLaNnzRpFkM4ae7Hs4FaAp70AoyPgzIEiT052BR3_upSiOxwQj9KZBAtrW3FSkHHgQ5n1jqMbo42IDgVWJyaWTG8x5LAQIbFMHkQfDRARAuBpD8zzJmDk0kw/s1600/10.gif" /></a></div><br />
<br />
<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeIl50uCzKz1Ne27KPpWU-wumPj4sTMgyniFeBsxTycJzYBIWjRxkZY3_URVHiPCUf2sGGDUuoyjrHxyUipWsvCWOaly7gSuj_dhOhSyUJgR6g-EySMEWXozAMQGptOjAQtaSatsTx4-Y/s1600/11.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeIl50uCzKz1Ne27KPpWU-wumPj4sTMgyniFeBsxTycJzYBIWjRxkZY3_URVHiPCUf2sGGDUuoyjrHxyUipWsvCWOaly7gSuj_dhOhSyUJgR6g-EySMEWXozAMQGptOjAQtaSatsTx4-Y/s1600/11.gif" /></a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG1CsdQlcrAnDM_3LWsDu5QvR25vYrqzXdQpnVPF2Ad3UMJC3MPpFQvHv_uumVIzrC5RZ7TcwzBY5s13wLbUIoDmmzHzR43tAwL43xMjVkdhea78pOjeIRuYFs1h1BQtxlOkOSF_BsGNU/s1600/13.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgk1_QKphuHjD8oQJdtcbzD5yZURqw8hyWahNcqgkMOJMC0ptiXoQyMPD_XrvpHHrtBcr_vV9an1aTwyeYw6OmTNHKTOL07PNrP1yTVX5eUAHoryJzydGZgVsqifTNFASJFUh0mkVg-oVY/s1600/12.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgk1_QKphuHjD8oQJdtcbzD5yZURqw8hyWahNcqgkMOJMC0ptiXoQyMPD_XrvpHHrtBcr_vV9an1aTwyeYw6OmTNHKTOL07PNrP1yTVX5eUAHoryJzydGZgVsqifTNFASJFUh0mkVg-oVY/s1600/12.gif" /></a><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG1CsdQlcrAnDM_3LWsDu5QvR25vYrqzXdQpnVPF2Ad3UMJC3MPpFQvHv_uumVIzrC5RZ7TcwzBY5s13wLbUIoDmmzHzR43tAwL43xMjVkdhea78pOjeIRuYFs1h1BQtxlOkOSF_BsGNU/s1600/13.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG1CsdQlcrAnDM_3LWsDu5QvR25vYrqzXdQpnVPF2Ad3UMJC3MPpFQvHv_uumVIzrC5RZ7TcwzBY5s13wLbUIoDmmzHzR43tAwL43xMjVkdhea78pOjeIRuYFs1h1BQtxlOkOSF_BsGNU/s1600/13.gif" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAx3A9WpoQXgYA01j5qpAUbiy7TAKU0vMEsE_QS7lakdUzDbmoXz_gCO-f5Esvr7HQpux9WnfMCumIhD9PYpnfJATRyYd3qMnjYuxGEd36jXatBMG4jAWHYn7MWmxyyl3oLJbh7YryFZQ/s1600/15.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAx3A9WpoQXgYA01j5qpAUbiy7TAKU0vMEsE_QS7lakdUzDbmoXz_gCO-f5Esvr7HQpux9WnfMCumIhD9PYpnfJATRyYd3qMnjYuxGEd36jXatBMG4jAWHYn7MWmxyyl3oLJbh7YryFZQ/s1600/15.gif" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAx3A9WpoQXgYA01j5qpAUbiy7TAKU0vMEsE_QS7lakdUzDbmoXz_gCO-f5Esvr7HQpux9WnfMCumIhD9PYpnfJATRyYd3qMnjYuxGEd36jXatBMG4jAWHYn7MWmxyyl3oLJbh7YryFZQ/s1600/15.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzsYyoLAhgFB6tQVIme5qdmUshs3sKK4cCSPaRC17WYyWLcY235aJnCUuue3B-Njp1mencXFq7AX9cNpYbp-sdK0GIGjscccCdfwlBz7C09DH7B9NBUZN9iNTN8Z58xPrCCJ3loGniJ4I/s1600/14.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzsYyoLAhgFB6tQVIme5qdmUshs3sKK4cCSPaRC17WYyWLcY235aJnCUuue3B-Njp1mencXFq7AX9cNpYbp-sdK0GIGjscccCdfwlBz7C09DH7B9NBUZN9iNTN8Z58xPrCCJ3loGniJ4I/s1600/14.gif" /></a></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG1CsdQlcrAnDM_3LWsDu5QvR25vYrqzXdQpnVPF2Ad3UMJC3MPpFQvHv_uumVIzrC5RZ7TcwzBY5s13wLbUIoDmmzHzR43tAwL43xMjVkdhea78pOjeIRuYFs1h1BQtxlOkOSF_BsGNU/s1600/13.gif" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a></div>demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.com0tag:blogger.com,1999:blog-1121926833938164830.post-73533579235942600592011-08-25T14:51:00.002+03:002011-08-25T15:13:37.757+03:00Linking to Android Market applications on the webWhile working on web version of <a href="http://dadictionary.com/">Da Dictionary</a> I've decided to add link to Android version. Web links to Android Market looks like this <a href="http://market.android.com/details?id=com.demosten.android.dadict">http://market.android.com/details?id=com.demosten.android.dadict</a> where 'com.demosten.android.dadict' is the package name which is unique for Android Market. This seams to work well when opened from PC browser. However opening this link from Android is a different story. The best way to open it is directly in Android Market application which works with different URI scheme. It looks like <a href="market://details?id=com.demosten.android.dadict">market://details?id=com.demosten.android.dadict</a> where again we see the same package name mentioned. While built-in Android browser plays it smart and open the link in directly in Market Application alternative browsers like Firefox does not do so and viewing web version of Android Market on an Android phone is far form what users expected to see.<br />
<br />
<span style="font-size: large;">My solution</span><br />
<pre class="javascript" name="code"><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
updateAndroidMarketLinks();
// some more core here ...
function updateAndroidMarketLinks()
{
var ua = navigator.userAgent.toLowerCase();
if (0 <= ua.indexOf("android")) {
// we have android
$("a[href^='http://market.android.com/']").each(function() {
this.href = this.href.replace(/^http:\/\/market\.android\.com\//,
"market://");
});
}
}
});
</script>
</head>
<body>
<a href="http://market.android.com/details?id=com.demosten.android.dadict" target="_blank">Download for Android</a>
</body>
</html>
</pre>As you can see my solution is based on JavaScript and <a href="http://jquery.com/">jQuery</a>. The idea is to search for 'android' sub-string inside browser's UserAgent and if that is the case - replace HTTP URI part with Android Market URI part, inside all links.<br />
<br />
I believe a JavaScript only version is not hard to do, but I prefer to use jQuery.demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.com1tag:blogger.com,1999:blog-1121926833938164830.post-66130696668101302592011-03-17T02:50:00.000+02:002011-03-17T02:50:56.011+02:00iPad 2 launch event impressionsI've finally found some time to watch Apple's iPad 2 launch event. I liked it. It looks like a great product and as usual, Steve and company presented it very smoothly. Someone should write a book "How to present like Apple" here!<br />
<br />
One thing that puzzles me is why did they mentioned the competition so many times? If you are so convinced, you have the greatest product around, why should you bother even mentioning any competition? The history will probably repeat itself. The first phones that caught up with iPhone appeared 2 years later and the first which were (in my opinion) better, after 3. I believe the same will happen with tablets. Saying that, it looks to me like Apple are starting to feel the pressure now, but I don't think they'll be matched this year. Meanwhile I'm adding iPad 2 to my wish list.demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.com0tag:blogger.com,1999:blog-1121926833938164830.post-14725228480986797092010-10-10T15:14:00.004+03:002010-10-12T23:25:49.401+03:00Stages of adopting open source mind-set<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHecZqFEKlHOj9JR3PhCGoFEc5SMiYF8TfT7phKgJCx1TZl3Knnz9XfjR9xwot_SXg6iZajeV3AGPkpf8ocTYx9F0tq_77XhwM4GuLh3Z8LyGYd8Udb5CiHLO_D5FUaoIzN92g04M9_co/s1600/opensource_logo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHecZqFEKlHOj9JR3PhCGoFEc5SMiYF8TfT7phKgJCx1TZl3Knnz9XfjR9xwot_SXg6iZajeV3AGPkpf8ocTYx9F0tq_77XhwM4GuLh3Z8LyGYd8Udb5CiHLO_D5FUaoIzN92g04M9_co/s1600/opensource_logo.png" /></a></div><br />
These are stages I observed for years from both people and organizations. I might miss something here, but before you think <i>"this is not me/us"</i> think again. I'll use person's perspective, because it always comes to a person. Be it your friend or some big corporate CTO or architect.<br />
<br />
<ol><li> <b>Ignorance</b>: open source doesn't exist. If anyone mentions it, you tell yourself <i>"there are dragons there"</i>, <i>"it is not secure"</i>, <i>"licensing is viral"</i>, <i>"I know this guy that once used open source and got sued"</i> etc. Also you think, you can do better on your own.<br />
<br />
</li>
<li><b>Waking up</b>: you are doing this great PNG display library for months now and you have only 20 more known bugs to fix before you can start working on your great SSL implementation then some friend comes by and asks <i>"have you tried libPNG and OpenSSL?"</i>. You try them and they seams to work. You start reading licenses.<br />
<br />
</li>
<li> <b>It's a wonderful world v1.0</b>: The sun shines again. Now you know much about open source licenses. You are using as much open source as you can. In fact it's something like a big well and you can take as much as you like right? You start to understand some of the ideas behind. You also have a strong opinion about how those projects should be managed and what needs to be done next there.<br />
<br />
</li>
<li><b>Open your heart</b>: It's a big well but wouldn't it be great if you add something to it? You are looking at your own projects and start thinking - "should I open them?". You decide to try with caution. You open couple of your most unimportant projects. You select them because no one have time for them in hope that "it's a big community, there should be someone willing to add improvements". Now you consider yourself a full grown open source citizen and so is your company.<br />
<br />
</li>
<li><b>No love for me</b>: No one wants to work on your open projects. In fact no one cares. You are wondering what's wrong with the community. Looking at other open projects and comparing them to your own, you can see some differences. Maintaining an open source is not an easy task. Getting support from community comes with a price. And if you don't like and care for your projects, others won't too.<br />
<br />
</li>
<li><b>It's a wonderful world v2.0</b>: You start opening only your significant projects. Selecting those you are sure many people will find useful. It is important for those projects to have some unique features and/or be clearly better than similar open source projects. They need to be well documented, with clear license and build instructions. Some samples are useful too. Once you have that you will get community support. You understand that open source doesn't necessarily mean nobody gets paid to work on it. It just means it is open for others to look at the code and use it, and they might contribute. Now you can decide should you be the main contributor or just step out and leave it to the world to handle from now on.<br />
</li>
</ol>demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.com0tag:blogger.com,1999:blog-1121926833938164830.post-24923519709903039732010-06-24T21:22:00.001+03:002010-06-24T21:26:03.831+03:00A smart phone dream of mineI'm in a smart phone world for 2 years now, changing several phones and platforms, but this dream of mine is older. It's not a smart phone dream, it's a personal computing dream. I dream of having my PC with me wherever I go and a smart phone is a way to achieve it. In my dream there are peripheral stations (PS) consisting of bigger display (monitor, beamer ...), input devices (keyboard, mouse, joystick ...) and some power supply. You come to your home, plug your smart phone to your home peripheral station and work with your PC. You go to work plug your smart phone to your workplace's peripheral station, switch to work profile and work with your work PC. The device is one and the same you could switch profiles and even operating systems if this is needed. In my dream there are also public peripheral stations, where you could plug your smart phone/PC to work more comfortably, while recharging it at the same time. Those stations cannot harm your PC in any way as they don't have any storage to store viruses or any personal data. All storage is with you. Network connection can be provided by your mobile operator or by the station, it is your choice. At some point, when wireless connections become fast enough and power supply is taken from the sun or from your body heat and movement (for example), you could connect to the peripheral station without a wire. And of course you could always use the smart phone screen and keyboard to work with, in case there is no (free) peripheral station around.<br />
<br />
The good news is this is coming closer to reality. Here <a href="http://sven.killig.de/android/N1/2.2/usb_host/">http://sven.killig.de/android/N1/2.2/usb_host/</a> you can find a sample of taking the first steps in this direction.<br />
<br />
<object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/3-bLOc1qnMM&hl=en_US&fs=1&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/3-bLOc1qnMM&hl=en_US&fs=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object>demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.com1tag:blogger.com,1999:blog-1121926833938164830.post-1226793753830679172010-05-19T02:45:00.003+03:002010-06-28T01:11:26.098+03:00A development learning story...So here I am - trying to learn programming, surrounded by several of my university colleagues who know more about it than I do. I want to be better and I am getting better. Bit by bit. I start creating simple programs from scratch. No internet yet, no google. I’m searching inside several help systems I can get my hands on and I improve myself day after day. Time passes; I start to skip some of my university classes. Instead, I’m staying at home creating from scratch more and more complex programs. My colleagues are helping me. Sometimes with information, sometimes showing off, making me want to be that good and sometimes with words like “I’ve listened to you for the past 30 minutes and didn’t laugh because I know you don’t know things … but you are not right”. And this makes me want to be better again and again. I’m starting to isolate parts of my code making “libraries” of reusable code. Then get better at making libraries. I know how to make it extendable, how to document it and how to reuse it. Now I’m better than most of my colleagues and equal to the rest of them. They accept me, but I accept no one. No one’s code is good enough to be used. I’m creating everything I need and I’m good at it. I believe I can create something like Windows 3.11 for about 3-6 months all by myself and I believe myself. Slowly I’m starting to realize that things are deeper than they look and I have to start trusting other people’s code in order to create complex programs. I’m also starting to understand that more complex doesn’t make it better and now I’m creating simpler code. Make methods and functions smaller, make code blocks as clear as possible and always strive to keep it simple (but not stupid!). Somewhere in between I’ve started switching programming languages. Going from Pascal to Assembly, mixing it back with Pascal, then C, then C++, a little bit of Delphi, then Java, some Perl and the list goes on. With time I’ve switched programming APIs and concepts too: DOS, Windows, Embed development, POSIX. All of them came with their own charms and specifics. At this time better programming books got published, explaining concepts like design patterns. Too late, I’ve already discovered all these patterns by myself. <i>It was funny someone spent time to collect those obvious ideas and give them odd names. I still believe design patterns book made more harm then it helped. People need to discover those things by themselves or they won’t truly understand them and know where to use them and more important when NOT to use them and why.</i> Then I’m discovering next “library” level – modularity. It is dynamic, it can be switched on and off on the fly, it can be replaced with fixed/newer version without recompiling the rest of the code. After some concept polishing and learning how others do it, I’m starting my own product based on my own modular concept. It is small, it is clean, it is clear. It is a great piece of technology and none of my clients cares about this. Slowly I start realizing, that though modularity is great, it took at least 50% of my development time to plan it, make it that great and support it in the future development. This time doesn’t pay back – really! I also start understanding that I seldom use any piece of my code twice. I’m learning as I go and I almost always know a better way to do it after several months. The way sometimes involves using a new library and sometimes it’s just me knowing more. In either case I get my old code and rip a good part of it creating something new, instead of reusing it.<br />
<br />
So here I am - creating more and more complex software, using the best I can find pieces of other people’s code and creating the rest on my own. Always try to keep it simple (and not stupid). Keep it small and clear. Don’t make a block of code do more than one thing and don’t make it bigger than one screen can display. Use comments sparingly and describe your context, reasons and ideas there. Don’t make reusable code unless you’re creating a library on purpose. And programming languages - they are just a way to express yourself. Programming concepts like functional and object oriented programming too. They don’t really matter. What matters is to understand the core idea behind them in order to use them effectively. Once you understand it, you understand that it is possible to create a complex solution with plain C as easy as you create it using Java, C#, C++ or whatever.demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.com1tag:blogger.com,1999:blog-1121926833938164830.post-56611316596677860622010-03-31T03:12:00.013+03:002010-06-24T21:33:07.172+03:00GWT GroupBox implementation<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcXe4x6gWaT0tXu665L3iThS_IusFEySK2qYpAAqrzX_6JF0Fmd4HrX1wfaTEH49JLGW7qDsRa9iFOQjwzkVdz6fdT2bu15WT8fFz4cWfTfY2qGmzm1fuxT_MJk1xdLA5_mdHNpAJdcro/s1600/groupboxpanel.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="110" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhcXe4x6gWaT0tXu665L3iThS_IusFEySK2qYpAAqrzX_6JF0Fmd4HrX1wfaTEH49JLGW7qDsRa9iFOQjwzkVdz6fdT2bu15WT8fFz4cWfTfY2qGmzm1fuxT_MJk1xdLA5_mdHNpAJdcro/s320/groupboxpanel.png" width="320" /></a></div>I was looking for a group box implementation for GWT recently and the only solution I've found was implemented by <a href="http://www.nakov.com/blog/2007/08/23/gwt-groupbox-panel-widget/">Svetlin Nakov</a>. However it didn't work out of the box and I had to modify it, to make it compatible with GWT 2.0 (I guess it worked fine with older versions). I've used the same idea, plus most of his code and extended it to work with GWT 2.0. Here is my implementation:<br />
<pre class="java" name="code">package com.demosten.client;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.InsertPanel;
import com.google.gwt.user.client.ui.Widget;
public class GroupBoxPanel extends ComplexPanel implements InsertPanel
{
private Element legend;
public GroupBoxPanel()
{
Element fieldset = DOM.createFieldSet();
this.legend = DOM.createLegend();
DOM.appendChild(fieldset, legend);
setElement(fieldset);
}
@Override
public void add(Widget w)
{
add(w, getElement());
}
public void insert(Widget w, int beforeIndex)
{
insert(w, getElement(), beforeIndex, true);
}
public String getText()
{
return DOM.getInnerText(this.legend);
}
public void setText(String text)
{
DOM.setInnerText(this.legend, text);
}
}
</pre><br />
it can be used in UiBinder Templates:<br />
<pre class="xml" name="code"><!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:g='urn:import:com.google.gwt.user.client.ui'
xmlns:d='urn:import:com.demosten.client'>
<g:VerticalPanel>
<d:GroupBoxPanel text="Account data">
<g:HorizontalPanel>
<g:Label>e-mail:</g:Label>
<g:TextBox />
</g:HorizontalPanel>
<g:HorizontalPanel>
<g:Label>password:</g:Label>
<g:PasswordTextBox />
</g:HorizontalPanel>
</d:GroupBoxPanel>
<g:HorizontalPanel>
<g:Button text='Sign in' />
<g:Button text='Register' />
</g:HorizontalPanel>
</g:VerticalPanel>
</ui:UiBinder></pre><br />
Use it as you like :)demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.com4tag:blogger.com,1999:blog-1121926833938164830.post-88215982646746600022010-02-17T01:50:00.002+02:002010-02-18T11:21:43.179+02:00HTC Sync wondersRecently I've installed HTC Sync v2.0.18 (PC sync software for Android based phones) and got quite surprised to find out how it works. It runs a process called something like FsynSrvStarter.exe. However here is how it works. It starts the executable mentioned above every few seconds (like every 3-5 seconds). The executable checks something - probably for Android connected device and quits. The version info of HTC Sync manager files, show "Teleca AB" as a company. It's strange HTC, whose products I use and love, is providing such poorly designed software to its users. This is a classical example of how the things should NOT be done. So here is what I have to say to those Teleca AB guys: "Do you have any idea how expensive is for the OS is to run a new process? Did you heard about the wonderful world of <a href="http://en.wikipedia.org/wiki/Inter-process_communication">inter-process communications</a> (known also as IPC)? How about using some named <a href="http://msdn.microsoft.com/en-us/library/ms682411%28VS.85%29.aspx">mutexes</a> and/or <a href="http://msdn.microsoft.com/en-us/library/ms682396%28VS.85%29.aspx">events</a> for a change? Please have some time to do things right and don't get you poor users pay for your lack of knowledge!"<br />
<br />
<i>Update: I've checked it on my work computer. The time between FsynSrvStarter.exe starts there is more like 30 seconds. Still not the right way to do it!</i>demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.comtag:blogger.com,1999:blog-1121926833938164830.post-76785838654764363952010-02-14T19:09:00.002+02:002010-06-24T21:30:28.079+03:00How to transfer contact between different flavors of smart-phones<div class="separator" style="clear: both; text-align: left;"><a href="http://www.google.com/mobile/images/mgc3/sync48.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" src="http://www.google.com/mobile/images/mgc3/sync48.png" /></a></div>I was having this problem lately when I needed to transfer my contacts between Windows Mobile and <a href="http://forum.xda-developers.com/showthread.php?t=601751">XANDROID for HTC Touch Diamond</a>. After a quick search I've found a solution and it appears that this could help others too. It's called <a href="http://www.google.com/mobile/sync/">Google Sync</a> and can be used not only for synchronizing, but for transferring contacts and other data between smart-phones too. The good thing is that it support many smart-phone OSes. At the time of writing these are: BlackBerry, iPhone, Nokia S60, SyncML, Windows Mobile. The bad thing is, google now have my name, my contacts, my blog. Now I can only hope that "do no evil" policy is intact and will stay that way!demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.comtag:blogger.com,1999:blog-1121926833938164830.post-30784906783947975532010-01-29T14:10:00.006+02:002010-06-24T21:31:14.448+03:00iPad as an e-book reader? Why?<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipdzmTJHhQ16AY06deOxXidCVV2Wgrv5YiMyJUWkZj4F5_vYn6pjOluOYJKjOfN57GjROQ_fZfVS_oS-6bWuWwiewUWzUPgtgEmUKKHIbY9noa8S4KsfF2iO8E3pJZFUA_oeDaiOvd_-s/s1600-h/lbook.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipdzmTJHhQ16AY06deOxXidCVV2Wgrv5YiMyJUWkZj4F5_vYn6pjOluOYJKjOfN57GjROQ_fZfVS_oS-6bWuWwiewUWzUPgtgEmUKKHIbY9noa8S4KsfF2iO8E3pJZFUA_oeDaiOvd_-s/s320/lbook.jpg" /></a></div><span id="goog_1264758652872"></span><span id="goog_1264758652873"></span><span id="goog_1264758652881"></span><span id="goog_1264758652882"></span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDE1g_llp09WgNZLRbED2tF0wCbob684Ap9Ae1NFZhMO6ud01Q76hLVnO__edxBMH1Nr4dF7dte-yopw4dtB59zg5DN7KIEmZ7G2Sbzxao05-y5YtRtd-76tGeC8fbDuPvTiaGVZgM-Hc/s1600-h/ibooks_20100127.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDE1g_llp09WgNZLRbED2tF0wCbob684Ap9Ae1NFZhMO6ud01Q76hLVnO__edxBMH1Nr4dF7dte-yopw4dtB59zg5DN7KIEmZ7G2Sbzxao05-y5YtRtd-76tGeC8fbDuPvTiaGVZgM-Hc/s320/ibooks_20100127.jpg" /></a></div>Just after Apple presented their iPad device, there had been a lot of posts about how this device will revolutionize the e-book reading. Apple are great in making their product simple to use and great looking. They are also great in making fashion out of it. But how many of you will replace an e-book reader for an iPad? I definitely won't. So I just decided to drop here a simple reminder about the advantages of modern e-book readers. If you never used one before, it's tempting to grab this beautiful colorful multitouch display as your first e-book reading device. Well, there are things you need to know before you do so:<br />
<ul><li>Displays: e-ink and e-paper displays are much more gentle to your eyes. They don't have back light. Their look and feel is very close to normal paper. It would be like comparing reading from a laptop or other similar display to reading from paper. Reading from e-ink or e-paper display requires additional light just as reading from a normal book does. And believe me this is good for your eyes! Also since none of them is touch capable, you won't read through the tracks of your fingers.</li>
<li>Battery life of e-ink and e-paper based displays is much better. Depending on usage, I recharge my lBook e-reader from once a month to once per 3 months. I know that for other e-book readers this time is more like once per week (my device don't have WiFi and/or 3G), but it is still far better than 10 hours which iPad promises.</li>
</ul>If you're planning to use iPad primary as an e-book reader, think carefully before you do so. Otherwise I like the iPad idea. It might be useful.demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.com3tag:blogger.com,1999:blog-1121926833938164830.post-16665201173131946902009-12-30T22:36:00.007+02:002010-06-24T21:34:24.962+03:00Security by denial<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJgxqCbDQro7rHKTr9FHEUya71yhviH2msDgde-WQXFEOwOGzrc1ecbP8O4p4D6w3znHDEf-R9u5JQruzp5n8-k_3v2ILuTMkLmjmgcf8sPz4PQjxXfVWmQ1I6qapXecIxfQGixpRhlpY/s1600-h/enigma.png"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 152px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJgxqCbDQro7rHKTr9FHEUya71yhviH2msDgde-WQXFEOwOGzrc1ecbP8O4p4D6w3znHDEf-R9u5JQruzp5n8-k_3v2ILuTMkLmjmgcf8sPz4PQjxXfVWmQ1I6qapXecIxfQGixpRhlpY/s200/enigma.png" alt="" id="BLOGGER_PHOTO_ID_5421141180027013890" border="0" /></a>Recently I've stumbled upon the following news <a href="http://www.nytimes.com/2009/12/29/technology/29hack.html?_r=3">Cellphone Encryption Code Is Divulged</a>. Look at the great authorities response:<br />
<p></p><blockquote><p>The G.S.M. Association, the industry group based in London that devised the algorithm and represents wireless companies, called Mr. Nohl’s efforts illegal and said they overstated the security threat to wireless calls.</p><p>“This is theoretically possible but practically unlikely,” said Claire Cranton, an association spokeswoman. She said no one else had broken the code since its adoption. “What he is doing would be illegal in Britain and the United States. To do this while supposedly being concerned about privacy is beyond me.”</p></blockquote>This looks like a classic sample of Security by denial to me. I should feel relieved knowing that this kind of research is illegal in several countries and that we know only one person that managed to break this encryption. Sigh!<br />
<br />
A question to the reader: Do you think it is a good practice for some countries to make illegal the efforts to break those kinds of encryption?<br />
<br />
I believe this leads to false sense of security and give advantage to those, who do not hesitate to break the law over those who do obey it. It also leaves all of us, who uses this technology every day, in the dark.demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.com0tag:blogger.com,1999:blog-1121926833938164830.post-32453860974179163002009-12-30T17:38:00.007+02:002009-12-31T01:43:15.544+02:00Old story: funny bug in Windows 9x/MEIt's been a while since I've last posted here, but today I'm in a blogging mood and decided to share an old story. It happened around the year of 2002 or 2003 I don't remember exactly.<br /><br />I was working together with Georgi Georgiev on a small program called "Visual ISO" (can be found on my site). We've found a serious bug. After the user quits the program ALL windows icons (those on desktop, start menu, windows explorer etc.) disappear. I've started to search for the problem. Several hours and a dozen restarts later I've finally found it. It appears that when you get the System icon list handle with Win32 API call - you could successfully call the corresponding API method to FREE IT! This worked on Windows 9x/ME but did not work on Windows NT and above. You have no idea how fast Windows becomes, when there are no icons to display!<br /><br />Being a good network citizen I've created a small program to reproduce the problem and decided to contact Microsoft about it. However this appeared to be a problem. No contact info could be found on their site. I did several web searches, but still no luck. So I contacted a person known as a security expert, to help me. He replied he is using "security@microsoft.com". I wrote an e-mail with something like: <span style="font-style: italic;">"I've found a problem in Windows API, but I don't think it is security related. Please point me to non security related e-mail"</span>. I've got a kind automated reply and the waiting began. More than a month later I've got a reply from some support center in Germany stating something like: <span style="font-style: italic;">"If you have problems programming please contact ...."</span><br /><br />... and that's how the problem was never reported ...<br /><br />That was my story :) and here is my proof of concept code (not tested lately, it's a miracle I've found it at all)<br /><br /><pre name="code" class="cpp"><br />#include <windows.h><br />#include <shellapi.h><br /><br />int APIENTRY WinMain(HINSTANCE hinst, HINSTANCE hinstPrev, LPSTR lpCmdLine, int nCmdShow)<br />{<br /> SHFILEINFO shFinfo;<br /> HIMAGELIST hImgList = (HIMAGELIST)SHGetFileInfo("", 0, &shFinfo, sizeof(shFinfo), <br /> SHGFI_ICON | SHGFI_SMALLICON | SHGFI_SYSICONINDEX);<br /> if (NULL == hImgList)<br /> MessageBox(NULL, "Cannot retrieve the Handle of SystemImageList!",<br /> "Error", MB_OK | MB_ICONSTOP);<br /> else {<br /> if (ImageList_Destroy(hImgList))<br /> MessageBox(NULL, "SystemImageList destroyed!", "Success", MB_OK | MB_ICONINFORMATION);<br /> else<br /> MessageBox(NULL, "Cannot destroy SystemImageList!", "Error", MB_OK | MB_ICONSTOP);<br /> }<br /> return 0;<br />}<br /></pre>demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.com0tag:blogger.com,1999:blog-1121926833938164830.post-13998441286662954332009-06-15T22:37:00.007+03:002010-06-24T21:31:52.569+03:00Concept: Corner and side click in desktop environmentsThere is functionality I always use when working with my desktop. I use them so often, I consider them granted. If the OS takes them away in the next version, I won't be upgrading until I have them back (one way or another).<br />
<div style="text-align: justify;"><br />
Example of such a feature is when I throw the mouse in the upper right corner and click to close the current maximized application without aiming at the cross icon there. This feature got me thinking - "why don't we use this 'throw cursor at the end of the screen and click' functionality in other places too?". To illustrate my point I'll show a simple idea. It's about removing the "Start" button (or the "K" button in KDE) and use the space there for something more beneficial.<br />
</div><br />
<div style="text-align: center;"><div style="text-align: center;"><div style="text-align: center;">Here is what we have now (in Windows XP):<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEij7wNChhbwLyqjorSvrNth3MVgy2g1kXCdJSQ3AR-dhv01C9qIJhY7b_uCAlf3LH1hbl5u-f-DiQm94F3TVK4f8WoGO4vIjyPR-cjNPyIWS8O8r1SwmGS6bxoT7aBqlwHjTo68hpucdwM/s1600-h/start_menu_now.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 239px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEij7wNChhbwLyqjorSvrNth3MVgy2g1kXCdJSQ3AR-dhv01C9qIJhY7b_uCAlf3LH1hbl5u-f-DiQm94F3TVK4f8WoGO4vIjyPR-cjNPyIWS8O8r1SwmGS6bxoT7aBqlwHjTo68hpucdwM/s320/start_menu_now.png" alt="" id="BLOGGER_PHOTO_ID_5347647425497643746" border="0" /></a></div><div style="text-align: justify;"><div style="text-align: justify;">But why do we need a button taking so much space just to say "Start" or "K"? Here is how a new version might look:<br />
</div><br />
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZm3RNi5wO0LP9T_9tB7TDCb5akl_Tppe4tfKKb3pU67SnqTXpyV6Ym4FGtyoQWsHUcC4Mn-dOdWIwCAYeGgJN5PdbFNWU9J56XSTXLwH3ZPoj4HZOqZMwVDOxGecXdTXIh2i8o6se8mM/s1600-h/start_menu_idea.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 239px; height: 320px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZm3RNi5wO0LP9T_9tB7TDCb5akl_Tppe4tfKKb3pU67SnqTXpyV6Ym4FGtyoQWsHUcC4Mn-dOdWIwCAYeGgJN5PdbFNWU9J56XSTXLwH3ZPoj4HZOqZMwVDOxGecXdTXIh2i8o6se8mM/s320/start_menu_idea.png" alt="" id="BLOGGER_PHOTO_ID_5347650312474868962" border="0" /></a>Note the barely visible green triangle in the lower left corner. This is where you need to click to open the start menu. Even if you are new to this desktop environment, it should not take you more than 2-3 minutes to learn and remember where it is. The benefit is that this way you have more space for your task bar and when you need the start menu just throw the mouse pointer to the lower left corner and click.<br />
<br />
This was just an illustration of this concept. It is not limited just to corners or to single click. Here are some more examples:<br />
<ul><li>Single click in the upper left corner starts your favorite application</li>
<li>Single click somewhere in the first upper screen line (where your mouse stops) minimizes the current application</li>
<li>Single click to the lower right corner (where the clock is) does "Show desktop". I have this as a proof of concept application!</li>
<li>Double click somewhere in the most left screen column starts another application</li>
</ul>All those are examples of the 'throw mouse cursor and click' concept. The click is important, because it eliminates the nagging of things showing by themselves when all you wanted is to remove the cursor from your desktop.<br />
<br />
<div style="text-align: justify;"><span style="font-style: italic;">Note about my concepts: You are free to use the ideas represented in my concepts as you like as long as you don't present them as yours. Keep in mind that though those are my ideas, I don't claim (and did not checked), that someone else didn't come with the same ideas first. If you decide to use some of the concept ideas presented here, it's up to you to check for prior art, patents and so on.</span><br />
</div></div></div></div>demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.com0tag:blogger.com,1999:blog-1121926833938164830.post-37420985548157291712009-01-11T23:09:00.008+02:002010-10-10T15:16:47.022+03:00Announcing: Diamond SensorScroll<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEil5JWjA90eNnnmE5OXwmz1aywouZigtdNXL44pv1PwiR_iH4LRsEZLTXFtq3-HAUkfpKPRVUIdcgH3qrjR21EfDGmlzlKOnXlBJfqar90lTXgpT7iCnhoAurOw_4hDIjLaglJf1q7-CJE/s1600-h/sensorscroll.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5290146525580595426" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEil5JWjA90eNnnmE5OXwmz1aywouZigtdNXL44pv1PwiR_iH4LRsEZLTXFtq3-HAUkfpKPRVUIdcgH3qrjR21EfDGmlzlKOnXlBJfqar90lTXgpT7iCnhoAurOw_4hDIjLaglJf1q7-CJE/s320/sensorscroll.jpg" style="cursor: pointer; float: left; height: 300px; margin: 0pt 10px 10px 0pt; width: 177px;" /></a>This Christmas I gave myself a new <a href="http://www.htc.com/www/product/touchdiamond/overview.html">HTC Touch Diamond</a> as a present. To be honest I made the present a month earlier, but who needs patience when it comes to hi tech gadgets?<br />
<br />
I played around with it and found some missing features. The most obvious for me was, the phone has a great sensor control which is used only by several HTC applications and Opera (custom version made for HTC). I decided to fix this and that's how I met Windows Mobile 6.1.<br />
<br />
I spent some time in research and writing simple test applications and found, that though it is "Mobile", it is "Windows" only around 50% (the other 50% came from the Microsoft's marketing department I guess). Don't get me wrong here. It doesn't mean I don't like it. It's just quite different from PC Windows. API is same - but not quite, internal architecture is totally different and this left useless almost half of my Win32 API knowledge. After a month of research and a week of codding I finally brought my idea to life.<br />
<br />
<span style="font-weight: bold;">Announcing: Diamond SensorScroll</span><br />
This is my latest free application. There are several things that happen for the first time because of it.<br />
<ul><li>It is my first application running on Windows Mobile.</li>
<li>It is my first application published first outside <a href="http://www.demosten.com/">my site</a> and then on it.<br />
</li>
<li>It is my first application, about which people wrote comments and blog posts just hours after the initial release (on 1.1.2009).<br />
</li>
</ul>All of this happened because I stepped into the great community of the <a href="http://forum.xda-developers.com/">http://forum.xda-developers.com/</a> site! The guys there got me unprepared! All I expected was several downloads and some bug reports. Unstead I got many thanks, Near a 1000 downloads in first 10 days (I released 3 bugfixing versions in that time and the application doesn't have a 1000 users just yet). Greatly described bug reports with aditional analysis what went wrong. More thanks. Cool feature ideas. Links to blog posts for "spreading the word". Idea to add donations link. And more! All this, made me feel really happy to be part of this community. THANK YOU GUYS!<br />
<br />
Now you know why the primary site for Diamond SensorScroll is <a href="http://forum.xda-developers.com/showthread.php?t=466377">http://forum.xda-developers.com/showthread.php?t=466377</a> :)<br />
<br />
Have fun!<br />
<br />
P.S. The picture you see in this post is from <a href="http://gadgetmix.com/index/?p=2314">another blog post</a>. I liked it, asked the author, and got a permission to use it from now on. I hope this illustrates my point one more time :)demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.com1tag:blogger.com,1999:blog-1121926833938164830.post-60437532190387381212008-09-05T11:50:00.006+03:002010-10-10T15:17:19.715+03:00Announcing Demosten's Perl distribution for Win32<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7TPdkes_Ereyjj25da8XtctDRb_HMXRyhHcxo0ihIvdSBt-IHvx4JFdV70XRwRGDTZ2QsWZwDfyHZMMs7iDPcnvUhT_FTNeyJgwNa4G8O-vpRg2FXVTeMK6cY7yWfcraQXeDvUu3UdwA/s1600-h/perl-logo.gif" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5242493935298903314" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7TPdkes_Ereyjj25da8XtctDRb_HMXRyhHcxo0ihIvdSBt-IHvx4JFdV70XRwRGDTZ2QsWZwDfyHZMMs7iDPcnvUhT_FTNeyJgwNa4G8O-vpRg2FXVTeMK6cY7yWfcraQXeDvUu3UdwA/s200/perl-logo.gif" style="cursor: pointer; float: left; margin: 0pt 10px 10px 0pt;" /></a>Today I published the first version of my Perl distribution for Windows. My idea was to create a distribution which could fully take advantage of CPAN. This means that you need a C/C++ compiler and make program together with some Unix tools like gzip, tar, less etc. I've added a Perl Scripting Engine (thanks to Atanas Kolev). The distribution also contains several simple scripts to provide a documentation with TOC and to add and remove directories to/from path environment. There is also a simple program written to relocate perl and the compiler to specified directories. The distribution has no additional license limitations and all our code is distributed with the same license as Perl itself.<br />
<br />
Links:<br />
Official homepage: <a href="http://dnperl.sf.net/">http://dnperl.sf.net/</a><br />
Downloads at project home page: <a href="http://sourceforge.net/projects/dnperl/">http://sourceforge.net/projects/dnperl/</a>demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.com0tag:blogger.com,1999:blog-1121926833938164830.post-73073095161352420242008-08-17T13:30:00.007+03:002010-10-10T15:19:27.060+03:00Designing the next generation of CDRfe<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggUSf6IKuU_IluqpspoKl_-tAgeAgIZ9KPIJ4GWcezUaMbJp7_zTUvrUQZzSH06PgdBPNl8ImwJ7qbZsUsG_wgn0U6p4E8Xp3hAQR1IsVjeLfxB2f0exIsyCHgwj8IH3zjCNgvwEuY2QU/s1600-h/CDrecord(2).jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5235448036380093842" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggUSf6IKuU_IluqpspoKl_-tAgeAgIZ9KPIJ4GWcezUaMbJp7_zTUvrUQZzSH06PgdBPNl8ImwJ7qbZsUsG_wgn0U6p4E8Xp3hAQR1IsVjeLfxB2f0exIsyCHgwj8IH3zjCNgvwEuY2QU/s200/CDrecord(2).jpg" style="cursor: pointer; float: left; margin: 0pt 10px 10px 0pt;" /></a><span style="font-style: italic;">(last updated 17.August.2008)</span><br />
<br />
I've finally found some free time to think about the next version of <a href="http://www.demosten.com/cdrfe/">CDRfe</a>. This is one of my favorite own programs, but in time I realized that this way of creating C++ closed source software will lead us nowhere. So I'm thinking about designing the next generation of CDRtools frontend. The planning is on really early stage (like some thoughts on a single sheet of paper) and I decide this time to involve the community. I realize this will take much more time than designing it by myself, but I believe the outcome worth it! So here are my general ideas about it:<br />
<ul><li>We'll start codding from scratch (will use only knowledge gathered in CDRfe development, but not a single line of code)</li>
<li>We'll use some platform independent language like Java which will allow using CDRfe on other OS-es too.</li>
<li>Next generation version will combine VisualISO with CDRfe into a single program.</li>
<li>I'm planning to include remote recording functionality. This is when you have a single recorder and many clients<br />
</li>
<li>The new project will be an open source and I'll be very careful with licenses this time when it comes to using external source code and/or libraries</li>
<li>We might also select a better name of the project. If you have an idea please post a comment or send me an e-mail.<br />
</li>
</ul><span style="font-weight: bold;">Now I'll go deeper into the technical part:</span><br />
<br />
I'm planning to use a Rich client platform instead of doing everything on my own. The best candidates are: <a href="http://www.eclipse.org/">Eclipse</a>, <a href="http://www.netbeans.org/">Netbeans</a> and <a href="http://www.mozilla.org/">Mozilla</a>. If you have other ideas, please post a comment or drop me an e-mail at demosten@gmail.com. At the moment my favorite is Eclipse. Advantages of using such a platform are: you have much work done and tested and we could concentrate on the actual functionality instead of for example user interface. So the software could be delivered faster and better tested. Disadvantage I can think of is that it will be much bigger and in general slower.<br />
<br />
<span style="font-weight: bold;">I need your help! I'm looking for:</span><br />
<ul><li>Fresh ideas what to include inside the next generation version as functionality, usability, code libraries etc.<br />
</li>
<li>Codding help. I'll need it at moment a concrete Rich client platform and programming language is selected and the work could start. The project will be hosted probably on sourseforge.net and will have a repository and so on.<br />
</li>
<li>Designer's help: this version should look great :)</li>
</ul>If you can help please do it! Post a comment here or drop me an e-mail at demosten@gmail.com. I'll update this post in time so come and check it from time to time.demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.com5tag:blogger.com,1999:blog-1121926833938164830.post-66668833131080381142008-08-10T20:49:00.011+03:002009-12-30T22:23:15.320+02:00MinGW and Unicode support?<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieUs2uJwXK0NdCeUQoinqJTfcP5Bhl8oH_zIpZvzy_oqCRgY-iW1tel_TlU-Fw8bRKmlca81P_BEI26B2M4_1ieQrA8awqDCepJb7rOhF5uunHeqrRnpgEdwGy9Epy3nS62bdYiLwPLww/s1600-h/cplusplus.png"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEieUs2uJwXK0NdCeUQoinqJTfcP5Bhl8oH_zIpZvzy_oqCRgY-iW1tel_TlU-Fw8bRKmlca81P_BEI26B2M4_1ieQrA8awqDCepJb7rOhF5uunHeqrRnpgEdwGy9Epy3nS62bdYiLwPLww/s200/cplusplus.png" alt="" id="BLOGGER_PHOTO_ID_5232993747116737378" border="0" /></a>Recently I've been working on a program called <a href="http://www.demosten.com/download.shtml">RuntimeTester</a>. And since it is a small and simple C++ program working in Win32 environment, I decided to port it to different C++ compilers. The original was written using Microsoft Visual C++ 2008, it has a <a href="http://www.microsoft.com/express/vc/">free version</a> which I believe is using the same optimizing compiler, but my idea was to give a chance to some free compilers and check the results. So I tried the following compilers: <a href="http://www.mingw.org/">MinGW</a> (compiler version 3.4.5), <a href="http://www.openwatcom.org/">OpenWatcom</a> 1.7a and <a href="http://www.digitalmars.com/">Digital Mars C++</a> 8.42n. I've created simple batch files to run the compilers and convert a single source file to a single executable file. All went without problems. And then I remembered my idea was to make it Unicode (I've used "tchar.h" functionality in the source code). I made a copy of my batch files and added both _UNICODE and UNICODE macros, then ran the compilers. Open Watcom and Digital Mars C++ went without a problem but MinGW gave me a strange message stating: "undefined reference to `WinMain@16'". Since I'm using "_tmain(...)" a quick check at MinGW's tchar.h showed the following code when _UNICODE is defined:<pre name="code" class="cpp"><br />/* for porting from other Windows compilers */<br />#if 0 /* no wide startup module */<br />#define _tmain wmain<br />#define _tWinMain wWinMain<br />#define _tenviron _wenviron<br />#define __targv __wargv<br />#endif</pre>I did some Google around and found some ideas about how to fix it. I also found some solutions that worked in the past but not working with the new versions so I did a quick and dirty fix to my code using ANSI startup for MinGW in all environments. Here is how the main(...) function looks like:<pre name="code" class="cpp"><br />#ifdef __GNUC__<br />int main(int argc, char **a_argv)<br />#else // !__GNUC__<br />int _tmain(int argc, TCHAR **argv)<br />#endif // __GNUC__<br /><br />{<br />// some variables defined here<br />// ...<br /><br />#ifdef __GNUC__<br />TCHAR **argv;<br />#ifdef UNICODE<br /> // MinGW doesn't support wmain() directly (shame on its CRT!)<br /> int a_argc;<br /> argv = CommandLineToArgvW(GetCommandLineW(), &a_argc);<br />#else // !UNICODE<br /> argv = a_argv;<br />#endif // UNICODE<br />#endif // __GNUC__</pre>This is quite strange. Why there is no support for Unicode startup code in MinGW? I don't believe this is too hard to achieve! Here is a patch done in 2003. Looks like it never made it to the official build: <a href="http://osdir.com/ml/gnu.mingw.patches/2003-05/msg00001.html">http://osdir.com/ml/gnu.mingw.patches/2003-05/msg00001.html</a> .<br /><br />You can <a href="http://www.demosten.com/download.shtml">get the program</a> and play with it if you like. There is more info about it inside the readme.txt file.demostenhttp://www.blogger.com/profile/02216714190261854671noreply@blogger.com0