Blogger offers now the exciting new feature Mobile Template. Activating this feature under Settings > Email & Mobile you get automatically a mobile version of your blog (which in my opinions looks very clean and nice) without writing a line of code. Here's a preview of my blog in the mobile version:
By clicking here you see a live preview of the mobile version or use the QR-Code below to view it directly on a mobile device. And if you are currently viewing this page on a mobile device, than you should see the mobile style anyway... :)
Tuesday, June 14, 2011
Saturday, May 21, 2011
Escaping Strings for jQuery Selectors
The possibility to get DOM elements via selectors is one of the most powerful features of jQuery. However, it's not so rare that you get problems because the id of the element you want to select or any other attribute, class or value relevant for the selection contains characters that are used by jQuery for the definition of the selector itself. In the jQuery documentation it's clearly defined which characters are considered as meta-characters for selectors and thus have to be escaped with a backslash (or better two backslashes if you're passing the value with a string literal):
Unfortunately, jQuery doesn't offer any function to escape these characters within a string, so that you don't have to care about what characters you must not use when defining attributes of your markup.
So I've spent almost one hour playing (or better fighting) with regular expressions in order to create a general function to escape strings to use in jQuery selectors. So if you're an absolutely RegEx guru or just have the time to figure out the right regular expression to use for this purpose, then you're probably not so interested in the following function. Otherwise, you should really try it out! ;)
The function inserts a backslash before all meta-characters for jQuery selectors within a string.
Here's an example:
I hope you can avoid some headaches with this function. If there's any question or problem with it, leave a comment below and I'll try to help you out.
"If you wish to use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[\]^`{|}~ ) as a literal part of a name, you must escape the character with two backslashes: \\."
Unfortunately, jQuery doesn't offer any function to escape these characters within a string, so that you don't have to care about what characters you must not use when defining attributes of your markup.
So I've spent almost one hour playing (or better fighting) with regular expressions in order to create a general function to escape strings to use in jQuery selectors. So if you're an absolutely RegEx guru or just have the time to figure out the right regular expression to use for this purpose, then you're probably not so interested in the following function. Otherwise, you should really try it out! ;)
function jQuerySelectorEscape(expression) {
return expression.replace(/[!"#$%&'()*+,.\/:;<=>?@\[\\\]^`{|}~]/g, '\\$&');
}
The function inserts a backslash before all meta-characters for jQuery selectors within a string.
Here's an example:
<div id="my#div$has[some]strange*characters">My DIV</div>
<br/>
<script type="text/javascript">
var selector = '#' + jQuerySelectorEscape('my#div$has[some]strange*characters');
document.write('selector = ' + selector);
document.write('<br/><br/>');
document.write('DIV content = ' + jQuery(selector).html());
</script>Output:My DIV selector = #my\#div\$has\[some\]strange\*characters DIV content = My DIV
I hope you can avoid some headaches with this function. If there's any question or problem with it, leave a comment below and I'll try to help you out.
Labels:
Tech
Wednesday, May 11, 2011
Android@Home
Apparently my almost utopian prediction in my last post of controlling everything at home with an Android device could become true sooner than expected.
Google teases Android@Home in the annual Google I/O Conference of 2011. As mentioned in this news article:
So, I'm looking forward to having my breakfast ready when I get up from bed in the more or less near future... :)
Google teases Android@Home in the annual Google I/O Conference of 2011. As mentioned in this news article:
This (Android@Home) is an experimental framework designed to encourage developers to get a headstart on developing apps and software, making the "home an Android accessory". The team demoed a device which could turn lights on and off, control alarm clocks or home appliances such as fridges and cookers via your android device - all of which is planned to be a long-term development, probably end of 2012.
So, I'm looking forward to having my breakfast ready when I get up from bed in the more or less near future... :)
Labels:
Tech
Saturday, May 7, 2011
Android App: Unified Remote
I just wanted to share this amazing new app I've just found: Unified Remote
It basically transforms your Android smartphone into a remote control for any type of computer that has the Unified Remote Server installed. In addition to general input devices like mouse and keyboard, it's possible to control a lot of other stuff in your PC. You can browse your whole file system and open files directly from the device, control Windows Media Player, iTunes or the like and control Power Point and other Slide Show applications. It's also possible to view the Task Manager and kill tasks or even shut down or hibernate your computer!
The app connects to the PC via UDP and TCP. It's also possible to connect via Bluetooth, however I didn't find out how to do it.
Anyway, the possibilities are enormous and for me this is definitely the future of mobile devices. Sooner or later, it won't be necessary to have a remote control for each device at home. Everything (and I don't mean only TV's and HI-FI systems) could be controlled with a smartphone. Imagine you being waked up by your alarm clock in your smartphone, which automatically triggers your toaster and coffee machine, so that your breakfast is ready before you've even stood up from your bed... Well, I think this is the very near future. ;)
Until then check out the app and comment what you think about it...
It basically transforms your Android smartphone into a remote control for any type of computer that has the Unified Remote Server installed. In addition to general input devices like mouse and keyboard, it's possible to control a lot of other stuff in your PC. You can browse your whole file system and open files directly from the device, control Windows Media Player, iTunes or the like and control Power Point and other Slide Show applications. It's also possible to view the Task Manager and kill tasks or even shut down or hibernate your computer!
The app connects to the PC via UDP and TCP. It's also possible to connect via Bluetooth, however I didn't find out how to do it.
Anyway, the possibilities are enormous and for me this is definitely the future of mobile devices. Sooner or later, it won't be necessary to have a remote control for each device at home. Everything (and I don't mean only TV's and HI-FI systems) could be controlled with a smartphone. Imagine you being waked up by your alarm clock in your smartphone, which automatically triggers your toaster and coffee machine, so that your breakfast is ready before you've even stood up from your bed... Well, I think this is the very near future. ;)
Until then check out the app and comment what you think about it...
Labels:
Tech
Thursday, April 14, 2011
10 Ways Microsoft Could Make Us Love IE Again
Referring to my last post about IE9, I've found a blog entry which took the words right out of my mouth. Enjoy this amazingly well written post about IE9 and what Microsoft should do (or haven't done so far) to compete with actual browsers.
10 Ways Microsoft Could Make Us Love IE Again
Don't forget to check the IE9 Review done by the same author which also excellently describes what's missing in IE9.
10 Ways Microsoft Could Make Us Love IE Again
Don't forget to check the IE9 Review done by the same author which also excellently describes what's missing in IE9.
Labels:
Tech
Thursday, March 24, 2011
Microsoft's latest gags
After almost an hour downloading, waiting and rebooting and one or two failures, I've finally finished installing the Service Pack 1 of Windows 7 on my laptop. As expected I don't see anything different, since it's not much more than a bundle of all security updates, which I already have had installed anyway... So I'm wondering if it was really worth to spend so much time installing SP1 only to see this in my systems settings:
Something more remarkable though was the final release of Internet Explorer 9 which I've just installed as well. The first things I'd read about IE9 a while ago made me really wonder if Microsoft finally noticed the importance of following standards for web browsers. I was really optimistic and looking forward to the day where it's not necessary anymore to add ugly hacks and workarounds to webpages in order to render it correctly in Internet Explorer, something that every web developer knows very well.
Unfortunately, the first 5 minutes of IE9 were very disappointing. First of all, the thing that stands out the most: the address bar and the tab bar have been merged into one bar. What's the idea behind of it? Think on people that have a low screen resolution, they will be able to see one, maybe two tabs simultaneously and still will see only a part of the link shown in the address bar. For developers and let's say "advanced users" this is an absolute No-Go.
The performance is OK comparing to older IE versions but still far away from Firefox, Google Chrome and co (Note: I didn't make any performance tests, so I'm only referring to my first impressions!). The absolute show-stopper was though as I wanted to access a web site using NTLM authentication, which is a Microsoft protocol by the way. Instead of popping up the usual login dialog to enter my credentials, this dialog was displayed:
Well, I have no idea where IE was trying to find credentials, anyway it wasn't successful at all! After a while I just gave up and clicked on Cancel. Bad idea! The dialog disappeared though but IE just hung up, so that I had to kill it in the task manager. Ugly!
OK, let's have a little mercy and just assume that almost every new software comes with some teething troubles, although I consider this bug as a really huge one. But what really shocks me about Internet Explorer 9 is that is not available for Windows XP! What was Microsoft thinking about when they decided this? Were they just lazy to provide the compatibility and build different versions as Firefox 4? Or did they really just made the utopian assumption, that when IE9 would be released Windows XP, the most stable and popular operating system Microsoft has ever had, would just be more or less replaced by Windows 7? I don't think so...
My conclusion: spite of all Microsoft's efforts, Internet Explorer 9 will remain the "dummy-browser" for those people that don't even know that other programs exist to access the web and will continue loosing more and more users to Firefox, Chrome and co. Well, good for us developer because maybe one day our dream of not having to do IE-hacks could in fact come true! :)
Something more remarkable though was the final release of Internet Explorer 9 which I've just installed as well. The first things I'd read about IE9 a while ago made me really wonder if Microsoft finally noticed the importance of following standards for web browsers. I was really optimistic and looking forward to the day where it's not necessary anymore to add ugly hacks and workarounds to webpages in order to render it correctly in Internet Explorer, something that every web developer knows very well.
Unfortunately, the first 5 minutes of IE9 were very disappointing. First of all, the thing that stands out the most: the address bar and the tab bar have been merged into one bar. What's the idea behind of it? Think on people that have a low screen resolution, they will be able to see one, maybe two tabs simultaneously and still will see only a part of the link shown in the address bar. For developers and let's say "advanced users" this is an absolute No-Go.
The performance is OK comparing to older IE versions but still far away from Firefox, Google Chrome and co (Note: I didn't make any performance tests, so I'm only referring to my first impressions!). The absolute show-stopper was though as I wanted to access a web site using NTLM authentication, which is a Microsoft protocol by the way. Instead of popping up the usual login dialog to enter my credentials, this dialog was displayed:
Well, I have no idea where IE was trying to find credentials, anyway it wasn't successful at all! After a while I just gave up and clicked on Cancel. Bad idea! The dialog disappeared though but IE just hung up, so that I had to kill it in the task manager. Ugly!
OK, let's have a little mercy and just assume that almost every new software comes with some teething troubles, although I consider this bug as a really huge one. But what really shocks me about Internet Explorer 9 is that is not available for Windows XP! What was Microsoft thinking about when they decided this? Were they just lazy to provide the compatibility and build different versions as Firefox 4? Or did they really just made the utopian assumption, that when IE9 would be released Windows XP, the most stable and popular operating system Microsoft has ever had, would just be more or less replaced by Windows 7? I don't think so...
My conclusion: spite of all Microsoft's efforts, Internet Explorer 9 will remain the "dummy-browser" for those people that don't even know that other programs exist to access the web and will continue loosing more and more users to Firefox, Chrome and co. Well, good for us developer because maybe one day our dream of not having to do IE-hacks could in fact come true! :)
Labels:
Tech
Thursday, March 17, 2011
My blog
Hi, I'm Alexandre Giannini and this is my blog. Welcome! :)
I'm a software developer and hobby drummer at rookie level. I was born in São Paulo, Brazil and live in Switzerland since 1997.
The idea of this blog is to share my programming and drumming experiences with the world. I also intend to post some interesting, funny or curious things I see around. Most of the posts will be probably in English because of it's portability, but there might be some posts in Portuguese or German as well. So stay tuned to see some interesting things about:
I'm a software developer and hobby drummer at rookie level. I was born in São Paulo, Brazil and live in Switzerland since 1997.
The idea of this blog is to share my programming and drumming experiences with the world. I also intend to post some interesting, funny or curious things I see around. Most of the posts will be probably in English because of it's portability, but there might be some posts in Portuguese or German as well. So stay tuned to see some interesting things about:
- Programming:
- Web applications, Java, Oracle PL/SQL, Visual Basic and more...
- Drumming:
- Drum cover videos
- and other stuff.... ;)
Labels:
Other
Wednesday, March 16, 2011
Drum Cover: Muse - Plug In Baby
This is my latest drum cover, one of the few that I could play on real drums. Subscribe to my youtube channel or to this blog to see further covers. I'll be uploading some new stuff soon.
Labels:
Drum Covers
Subscribe to:
Posts (Atom)






