Sharovatov’s Weblog

link-to-QRCode IE8 accelerator

Posted in browsers, IE8, mobile, nokia-n78, web-development by sharovatov on 20 March 2010

I have Nokia N78 phone and use it a lot for surfing web (with beautiful Opera Mobile 10), reading RSS (with internal webkit-based browser), tweeting (with awesome Gravity client), reading CHMs (with great mobiCHM tool) or using Skype, or doing and many other tasks.

But mostly I use the phone to read something on the internet when I’m on the way to some place (as it takes at least an hour to get somewhere in Moscow using public transport). And usually when I’m browsing web on a PC and find something worthy to save to mobile, I type its URL  on the phone and save it to bookmarks. Which, even with bit.ly or any other url-shortening service, is a kerfuffle, and T9 doesn’t really help here.

So I was trying to find an easier way to get URLs transferred from my PC onto the mobile. Opera 10 Mobile comes with Opera Link bookmarks synchronisation service, but I don’t surf internet in Opera on a PC. There’re some social bookmarking sites, but I’m not adding every link that I want to read on mobile to my bookmarks, be it a web-service or browser bookmarks.

And here comes QRCode scanning to the rescue. I knew that Nokia provided a nice free easy-to-use QRCode scanner for their smartphones, and I gave it a go. Downloaded, installed, tried with some QRCodes I had, everything was fine, scanning and recognition speed was really high – I just pointed the phone camera onto my computer’s screen and the encoded text was momentarily recognised. I decided to try encoding links in QRCodes using Nokia service, and it worked fine as well – the scanner made them active so I could either copy them to use in Opera Mobile or open with default web-browser (handy if it’s a link to RSS feed).

Of course, encoding each link manually and then scanning resulting QRCode is taking much more time than just typing the link in the phone, so the idea of making the browser show QRCode for any link made more sense to me.

The easiest way to integrate some web-service to IE8 is its beautiful Accelerators platform. I did 10 lines of PHP code which shortens any URL with bit.ly service, and then echoes the IMG tag pointing to Nokia QR Code creation service URL. Here’s the code:

<?php
  require_once('bitly.php');
  $sUrl = make_bitly_url($_GET['url']); //shorten the original URL first
  echo '<img src="http://mobilecodes.nokia.com/qr?DATA='.$sUrl.'&MODULE_SIZE=4&name=&MARGIN=2&ENCODING=BYTE&type=link&MODE=TEXT&a=view">';

Bit.ly is used to make QRCode creation faster and easier as only small chunk of data is encoded.

Then I created a very simple XML file which instructs IE8 what to do with the link:

<?xml version="1.0" encoding="UTF-8"?>
<!-- author: Vitaly Sharovatov (http://sharovatov.ru) -->
<openServiceDescription xmlns="http://www.microsoft.com/schemas/openservicedescription/1.0">
  <homepageUrl>http://sharovatov.ru</homepageUrl>
  <display>
    <name>link QRCode</name>
    <icon>http://sharovatov.ru/qrcode/favicon.ico</icon>
  </display>
  <description>Get the QRCode for selected link</description>
  <activity category="mobile">
    <activityAction context="link">
      <preview action="http://sharovatov.ru/qrcode/createCode.php?url={link}" />
      <execute method="get" action="http://sharovatov.ru/qrcode/createCode.php?url={link}" />
    </activityAction>
  </activity>
</openServiceDescription>

 

And then just uploaded the php script and my accelerator to my site. Dead easy, 10 minutes job.

As wordpress.com doesn’t allow javascript onclick handlers on the links (and accelerator gets added to IE by window.external.addService call), I had to put the install page on my site. Please visit http://sharovatov.ru/current.html for this and few other IE8 accelerators. To get this accelerator installed, just press on “Install now” link in its description.

Now if you right-click on any link, go to Accelerators, and just hover “link to QRCode” accelerator you’ll get the window with QRCode for the current link:

qrcode-accelerator

Then you just run Barcode app on the mobile, get the QRCode scanned and then can do anything with the link – copy it to the clipboard, open right now in the default browser. Seems to be quite handy.

In order to get this accelerator in the main right-click menu, you need to go to Page –> All Accelerators –> Manage accelerators and in the window that appears select “link QRCode” accelerator and press on “Set as default” button.

Here’s some guiding screenshots:

manageaccels manageaddones

Then your link QRCode accelerator will be in the default context menu:

defaultmenu

So now you can get a QRCode for any link, scan it and use it on your mobile.

P.S. There’re QRCode scanners for all mobile platforms, so if you want similar functionality on your phone, google for “QRCode scanner %yourphone%”.

IE9 – sucks much less than other browsers

Posted in browsers, IE9, web-development by sharovatov on 16 March 2010

I won’t repeat everything that’s been said on Mix now, you should read this article and this IEBlog entry and get the IE platform preview. Don’t be afraid that IE9 will spoil your IE8 – IE9 preview doesn’t replace IE8 or anything, it’s got new jscript engine (called “Chakra”), new Trident layout engine version and wininet bundled in one package (31 megabytes installed size!) – first time when Microsoft does it this way – very impressive!

This preview will be updated each few weeks – the work isn’t finished, UI is still in a very “beta” mode:

ie9

Most important changes IE9 has from IE8:

  • JIT-powered js optimisation in jscript engine (Sunspider reports speed faster than Firefox 3.7 alpha2) – looks similar to Apple’s Nitro JIT.
  • new Trident with more CSS3 support – CSS3 Selectors module, CSS3 Borders and Backgrounds module (passes CSS Selectors tests)
  • DOM2 Styles support
  • SVG 1.1 2nd ed support (plus hardware acceleration)
  • XHTML support (with proper namespaces support)
  • complete hardware acceleration support for graphics and text rendering, which makes any animation in IE9 WAY much faster than in other browsers – you should look at videos
  • HTML5 video support with h264 codec with proper hardware acceleration support (kicks Chrome’s ass, allows 2 simultaneous HD 720p video playbacks via HTML5 video on a cheap netbook). Another nail in the OGG coffin :)
  • DOM Events support

And IE9 is ridiculously fast. That’s partly due to the fact that “Chakra” jscript compiles javascript in a separate CPU core in parallel to IE (natural improvement to LCIE), and partly because of hardware optimisation for all rendering and animations.

Unfortunately, IE9 is not available for Windows XP (and it won’t be), the main reason is the security model – basically, XP security model just doesn’t suit for IE9. Quite right, XP is nearly 10 years old! Another reason is that graphical core on Windows XP works in a different way, so IE9 hardware acceleration just cannot work there.

Of course, IE9 follows the same logics IE8 has in terms of backwards compatibility – rules that I described here apply to IE9 – if X-UA-Compatible header/meta is set to Edge, IE9 new engine will run. Of course, it will render sites with correct doctype (but withouth X-UA-Compatible) in IE9 standards mode, and it will continue support for compatibility view lists feature. So old crappy sites designed for IE6 will still work in compatibility mode, and new sites will work in awesome IE9 in the standards mode without any problems. Read the abovementioned post for more details.

Improvements that will be done later:

  • better Ecma262 conformance and as a result, better ACID3 scores (current score is 55), IE team promises to improve this significantly, I think it will pass the test by the time RC ships
  • support for other CSS3 standard modules
  • canvas support – wasn’t announced, but I think this is a natural move when SVG is already done and done properly!

But anyway, the whole feeling after watching IE9 keynote session is IT’S AWESOME!

We’re entering the new era when Microsoft browser is faster than others, more secure (it’s been more secure than others since IE8b1) and provides better level of standards support.

P.S. To see the real speed just run these test on IE9 platform preview  and on any other browser and feel the difference :)

Some links:


Share this post :

Windows Phone 7 Internet Explorer IEMobile 7.0

Posted in browsers, IE7, IE8, web-development by sharovatov on 15 March 2010

I’ve just watched MIX keynotes and as soon as MSFT announced there was free VS2010 Express for Windows Phone 7 with proper emulator, I downloaded, installed it, created sample app and ran the debugger.

Here’s some screenshots:

VS2010 Express for Windows Phone IDE:

Untitled-2

Windows Phone 7 Emulator running in the debug mode:

Untitled-1

The most interesting thing for me was to find out which IE version Microsoft decided to ship with Windows Phone 7. They said it wouldn’t be IE9, but would be something between IE7 and IE8. They also assured that the Windows Phone emulator (which comes bundled into the VS2010 Express for Windows Phone 7) is a proper virtual machine, a real copy of Windows Phone OS sandboxed in the VM engine.

So bearing this in mind I thought that I’d test the WP7 IE in emulator.

And here’s interesting stuff:

  1. navigator.appVersion on Windows Phone 7 IE returns
    4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0
  2. User-Agent string is
    Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone Os 7.0; Trident/3.1; IEMobile/7.0
  3. @_jscript_version reports 5.8 (as IE8 does)
  4. [if IE 7] conditional comments section gets applied
  5. *+html selector { rules } hack works

So at this moment IEMobile/7.0 seems to be a slightly adjusted Trident (layout engine) of IE7 and jscript of version 5.8. (as it turns out below, some features are either disabled or not accessible now, or will not be supported at all)

To dive deeper into the details, I’ve tested several things and prepared the following table:

Feature Supports
native XMLHttpRequest Yes
XDomainRequest No
Selectors API Yes
clipboardData No
data URI No
maxConnectionsPerServer No
sessionStorage/localStorage No
offscreenBuffering No
native JSON No
DOM Objects prototypes No
getters/setters No

 

So from the CSS prospective Windows Phone IEMobile 7.0 is indistinguishable from desktop IE7, it applies the same conditional comments rules, supports the same subset of CSS selectors, same hacks work and same bugs are there. If you know how to support desktop IE7 Trident, you won’t have a problem with IEMobile 7.0.

Completely different situation is with javascript – jscript version is 5.8 (same that IE8 has), but many features that IE8 supports via COM wrappers do not exist on IEMobile 7.0 (does it have COM at all?). Also it lacks support for some native features of jscript 5.8 (e.g. native JSON, DOM objs prototypes, getters/settters). The only feature I can see from IE8 is Selectors API support, which is great, but really – is that what we really expected?

So from what I see now, Microsoft took IE7 Trident (3.1), took jscript 5.8 and cut off as much as possible (all COM wrappers and some native features), put IE8 icon on top and shipped it to Windows Phone 7.

I really hoped it would have IE9 or at least IE8.

The only hope is that it’s still beta and all the IE8 stuff will be shipped with the final version. Hope it’s not just a wishful thinking.

It’s such a frustration to see a beautiful and free VS2010 Express for Windows Phone 7, awesome SL4 which runs everywhere, and then look at this crippled “IE7.234”. If this is a marketing choice to make web-developers write in Silverlight, then it’s silly because it breaks the most important feature Microsoft provided – backwards compatibility. Old sites and current sites which Windows Phone users will want to visit will break in this browser. Gmail works in html-only mode. Surely, some will adapt. But not all.

And by the way, Apple got it right on iPhone.

P.S. Todd Brix said there will be a Windows Update-like service in Windows Phone 7, so let’s hope that IEMobile will get updated.


Share :

Tagged with: ,

critical IIS vulnerability

Posted in security, web-development by sharovatov on 29 December 2009

Just got a link from our system administratorhttp://securityvulns.ru/Wdocument993.html 

Go read the vulnerability description now!

Basically – if your users upload files to your site and THEY specify file names, you’re vulnerable:

#Vulnerability/Risk Description:
– IIS can execute any extension as an Active Server Page or any other executable extension.
For instance “malicious.asp;.jpg” is executed as an ASP file on the server. Many file
uploaders protect the system by checking only the last section of the filename as its
extension. And by using this vulnerability, an attacker can bypass this protection and upload a dangerous executable file on the server.

There’s an unchecked patch for this vulnerability, but again this shows that you just can’t allow any user input saved to your system without filtering.

So, if you allow file uploads – your script have to specify filenames, not users.


Share :

Beanstalkapp, FogBugz and now Case Tracker

Posted in web-development by sharovatov on 27 November 2009

As a follow-up to my post about free hosted integrated solution for bugtracking and version-control, I’d like to introduce a great tool I accidentally found and then installed – Case Tracker.

It’s a free desktop application which allows you to easily view a list of current bugs, gives you a way to “start working” on the bug – so the time you actually spend on fixing the bug or implementing the feature is carefully calculated. So it’s basically a time-tracking application for a fogbugz – it takes the list of bugs

image

To start working, you need to enter your fogbugz username, password and the URL where you have it installed:

 image

Case Tracker supports both FogBugz On-demand and hosted versions – it simulates all required POST requests as if you’re working with Fogbugz through your browser. As soon as you entered correct username and password, it will show you the list of active bugs:

image

However, by default it shows bugs assigned to anybody, which may be not always desirable. To address this issue, Case Tracker provides a search filter (funnel on the right-hand side of the pause button). For example, I need only those bugs that are assigned to me, so I add assignedto:"Vitaly Sharovatov" as a search filter:

image

Then I press “Go” and get my list populated with only those bugs that I need! Awesome!

For more detailed instructions on the allowed syntax read this.

What’s really great in Case Tracker – it can automatically stop measuring time when you’re away from keyboard for a certain period of time:

image

However, Case Tracker doesn’t allow creating new cases – it opens your fogbugz URL in your default browser so you can enter new case there. But Case Tracker is not a replacement for Fogbugz UI – it’s goal is to simplify time tracking.

So the general flow is:

  1. you choose a bug from a drop-down list
  2. if the estimate hasn’t been set for this bug, Case Tracker prompts you to enter the estimate (using the same syntax rules as in Fogbugz in the browser)
  3. the work is started and time is measured – if you’re afk or just press pause button, it stops measuring the time
  4. when you’re finished – you commit the bug and mark it resolved either by specifying status:resolved in svn comments or using Case Tracker – I prefer to specify it in a submit comment – just got used to it.

So if you use fogbugz – this tool is definitely worth trying!


Share :

Browsers’ developer tools evolution

Posted in browsers, javascript, web-development by sharovatov on 19 November 2009

It’s great to see that better tools for developer start to appear.

As in many other cases, the race started IE5.01 with support for script debugging in an external Script Debugger app. And now the race takes us to the new level with awesome tools built into browsers (like Firebug in Fx or Devtools in IE8) or even better external – let’s welcome dynaTrace Ajax!

dynaTrace Ajax supports IE6, IE7 and IE8, and will soon support Firefox. It’s basically the best tool out there for profiling and debugging javascript and CSS. Here’s what John Resig, creator of JQuery library says about the tool:

I’m very impressed with dynaTrace AJAX Edition’s ability to get at the underlying “magic” that happens inside a browser: page rendering, DOM method execution, browser events, and page layout calculation. Much of this information is completely hidden from developers and I’ve never seen it so easily collected into a single tool. Huge kudos to dynaTrace for revealing this information and especially so for making it happen in Internet Explorer.

And here’s Steve Souders, web perfomance guru, says:

When it comes to analyzing your JavaScript code to find what’s causing performance issues, dynaTrace Ajax Edition has the information to pinpoint the high-level area all the way down to the actual line of code that needs to be improved. I recommend you give it a test run and add it to your performance tool kit.

Must-have for any web-developer, seriously.

It’s interesting to see that Google and Apple play a good catch-up – both Chromium 4 and Apple Safari teams invest significant resources in building devtools, Chromium 4 finally has its own CPU & heap profilers now on top of V8. So bearing in mind that Firefox profiling will be supported by dynaTrace Ajax, it’s only Opera that’s left behind the game at the moment.

Come on, Opera team!

P.S. and by the way, Opera, can we get inPrivate browsing mode please?


Share :

Tagged with:

PHP loadHTMLFile and a html file without DOCTYPE

Posted in php, web-development by sharovatov on 1 November 2009

Just noticed that when you parse an html file with DOMDocument’s method loadHTMLFile and there’s no DOCTYPE defined in your html, PHP will silently load an empty DOM document.

Just try saving the following in a test.html file:

<html><body><div id="toc">wtf</div></body></html>

And then run the following php code:

$doc = new DOMDocument();
if ($doc->loadHTMLFile('test.html')) {
  echo 'loadHTMLFile was successfully executed<br>';
  $toc = $doc->getElementById('toc');
  echo 'now trying to var_dump the $toc:<br>';
  var_dump($toc);
}

You’ll get NULL as a result of the var_dump call. As if getElementById couldn’t find the node.

Interesting?

Citing php.net,

The function parses the HTML document in the file named filename. Unlike loading XML, HTML does not have to be well-formed to load.

Does this imply that DOCTYPE may be omitted? I think so. But then the abovementioned code wouldn’t show NULL as a dump of $toc. Unfortunately, experiment shows that DOCTYPE is required, even a HTML5-ish
<!DOCTYPE html> will do the job. 

But why on earth doesn’t loadHTMLFile throw a warning or at least return false as it should according to the documentation? Nobody knows.

So if you notice that your DOM-based php script acts in a weird way, check if you have a DOCTYPE defined on the HTML document you’re trying to parse.

Hope this saves someone some time.

P.S. More bugs to come — if you have a HTML file saved in utf-8 codepage with BOM, loadHTMLFile will throw the following E_WARNING:

Warning: DOMDocument::loadHTMLFile() [function.DOMDocument-loadHTMLFile]: Misplaced DOCTYPE declaration in test-BOM.html, line: 1 in /home/test/www/test-DOMDocument.php on line 3

Remove the BOM and everything works fine. Apparently, loadHTMLFile doesn’t know that BOM usually indicates that the document is saved in UTF8/16/32. Weird.

P.P.S. Another issue. Try pointing loadHTMLFile to an HTML-document saved in UTF-8 with some international characters (Russian words, in my case). Then get a node with international characters and do echo $node->nodeValue. Are you getting corrupted symbols? I was. The whole project is in UTF-8, every single file is saved in UTF-8.

I added <meta http-equiv="Content-type" content="text/html;charset=utf-8" /> to the head section — characters started showing in a correct encoding, but the following WARNING appeared:

Warning: DOMDocument::loadHTMLFile() [function.DOMDocument-loadHTMLFile]: Input is not proper UTF-8, indicate encoding ! in /home/test/www/test-russian.html, line: 65 in /home/test/www/test-DOMDocument.php on line 29

And the only way to properly get rid of this warning is to add

<?xml version="1.0" encoding="UTF-8"?>

to the first line of your html document and it finally worked without any warnings or issues. Awesome. XML header must be used for loadHTMLFile to run properly. Way too buggy to use.


Share: 

Tagged with:

HTTPBis group is awesome!

Posted in Firefox, http, IE8, web-development by sharovatov on 21 October 2009

I’m finally back to blog. Finally started finding time between doing stuff at home, working at my great place of work and studying English :)

As you know, HTTP/1.1 spec said that conforming clients SHOULD NOT open more than 2 concurrent connections to one host. This was defined back in 1997 and at that time it seemed reasonable to have 2 simultaneous connections for a client, and noting that HTTP/1.1 introduced persistent connections concept, people thought that 2 simultaneously opened reusable TCP/IP connections would be enough for general use.

However, everything changes. Broadband internet came to mass market and people started thinking that better parallel download could benefit the whole website or a webapp perfomance. The history started with IE5.01, which was opening two connections by default, but there was a way to configure the number. So if you had a really good internet connection, you could make websites load significantly faster.

By the time IE8 development started, broadband connections became a standard for home internet, so IE8 started opening 6 connections (if the bandwidth allowed – on the dialup or behind a proxy it will still open 2). So IE8 engineers did a smart move and introduced the world with a browser that seemed to load sites faster.

Needless to say, Firefox 3 decided to change the value as well, so now Firefox 3 has 6 as a default value for network.http.max-persistent-connections-per-server configuration setting. Good for Mozilla for copying stuff from IE again!

And now HTTPBis team (Julian Reschke) commits the change which states that in the forthcoming HTTP standard the maximum amount of concurrent requests is not limited even with “SHOULD NOT” clause :)

Thanks HTTPBis team!

Skype blocking 80 and 443 ports

Posted in web-development by sharovatov on 8 June 2009

When trying to start an IIS7 website, you can get the following message: “The process cannot access the file because it is being used by another process. (Exception from HRESULT: 0x80070020)”:

image

It’s saying it can’t access the file, but actually IIS can’t bind the ports you’ve configured in Bindings configuration. But which port?

Usually I use the following procedure to find out which application occupies the port:

  1. run netstat –ano –p tcp to get the list of opened ports, find the port that’s been taken and see which PID the port is bound to
  2. run tasklist /FI "PID eq XXX" where XXX is the found PID

So in my case the 80 and 443 ports were taken by Skype. Whenever you start Skype, it tries to bind 80 and 443 ports, and so if you start your web server later, it won’t be able to work as ports are occupied. This Skype behaviour can be turned off by deselecting “Use port 80 and 443 as alternatives for incoming connections” here:

image

Hope this saves somebody some time :)


Share :

Tagged with: , , ,

HTML5 video tag and Internet Explorer

Posted in browsers, web-development by sharovatov on 5 June 2009

It’s interesting to see how popular <video> and <audio> tags are getting now. Every browser tries to implement it as soon as it can and shout about it as loud as possible. And now people are even starting blaming IE for being old and not supporting inline video and audio.

The whole situation reminds me of AJAX where original concept was invented by Microsoft (actual ActiveX was shipped with IE5 in 1999), then it was standardised by W3C (in a different way), then implemented by other browsers, and then people started accusing IE for not supporting this new W3C standard.

The same thing is now happening with inline video/audio playback concept, which has been introduced in IE2 in 1995, almost 15 years ago. Yes, 15 years ago, when W3C has been just founded and was still asking MIT/CSAIL to join. And now this functionality is being spec’ed in HTML5 as <video> and <audio> tags. Opera, Firefox, Safari and Google Chrome start supporting <video> and <audio> and are making a loud marketing message of it.

The original concept that was introduced in IE2 (and supported in following versions) was adding a DYNSRC attribute to IMG element:

<img src="cover.gif" dynsrc="clock.avi" controls>

When IE saw dynsrc attribute, it tried loading the movie and playing it. “Controls” attribute made IE show simple playback controls.

This is how it looked like in IE3:

ie3

However, in future versions the support for DYNSRC was limited to make developers to switch to other ways (<object>/<embed>/SMIL video). In IE5 no controls were shown, in IE7 DYNSRC ceased at all.

World changes, and now the functionality that nobody’s been using for a decade seems really new and interesting. It’s great that WHATWG is spending time on defining clear standard on how this should work and it’s really cool that Chrome, Firefox, Opera and Safari already support this draft. Of course, Silverlight supports greater level of RIA, but giving that IE Team is now really focused on following public standards, I hope that in IE9 we’ll have native support for <video>/<audio> as we had native support for XMLHttpRequest in IE7.

But my point is – credit for inline video playback functionality invention should be definitely given to IE2.


Share :

Tagged with: , , ,