<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7743951656450091148</id><updated>2011-09-26T20:52:33.989+02:00</updated><category term='firefox'/><category term='appengine'/><category term='javascript'/><category term='python'/><category term='chrome'/><category term='pylons'/><title type='text'>petrsstuff</title><subtitle type='html'>Python, Firefox programming and Irish Whiskey.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>25</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-880735967225014922</id><published>2011-09-16T21:12:00.000+02:00</published><updated>2011-09-16T21:12:55.593+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>Get the week of the year in javascript</title><content type='html'>For those looking for that particular function and already using &lt;i&gt;jqueryui&lt;/i&gt;: You already have it in &lt;i&gt;datepicker&lt;/i&gt; widget. Just call &lt;tt&gt;$.datepicker.iso8601Week(date_object)&lt;/tt&gt;.&lt;br /&gt;
&lt;br /&gt;
The code is simple (taken from jqueryui, so either MIT or GPL license):&lt;br /&gt;
&lt;script type="syntaxhighlighter" class="brush: javascript"&gt;&lt;![CDATA[
	iso8601Week: function(date) {
		var checkDate = new Date(date.getTime());
		// Find Thursday of this week starting on Monday
		checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
		var time = checkDate.getTime();
		checkDate.setMonth(0); // Compare with Jan 1
		checkDate.setDate(1);
		return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
	};
]]&gt;&lt;/script&gt;&lt;br /&gt;
&lt;br /&gt;
I just have to warn you against the attempt to extend the built-in Date type with a new method, as some suggest. You will find enough explanations around on why it is a bad idea.&lt;br /&gt;
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-880735967225014922?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/880735967225014922/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2011/09/get-week-of-year-in-javascript.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/880735967225014922'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/880735967225014922'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2011/09/get-week-of-year-in-javascript.html' title='Get the week of the year in javascript'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-5077771917321097872</id><published>2011-05-03T21:15:00.004+02:00</published><updated>2011-05-03T21:19:15.049+02:00</updated><title type='text'>ff3sudoku for firefox 4</title><content type='html'>Yesterday I released a new version of my sudoku firefox extension compatible with firefox 4. Before it gets reviewed, you can install it from here:
&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/sudoku/versions/"&gt;https://addons.mozilla.org/en-US/firefox/addon/sudoku/versions/&lt;/a&gt;

There have been no changes, I only made it compatible with firefox 4.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-5077771917321097872?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/5077771917321097872/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2011/05/ff3sudoku-for-firefox-4.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/5077771917321097872'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/5077771917321097872'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2011/05/ff3sudoku-for-firefox-4.html' title='ff3sudoku for firefox 4'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-9053304987545607363</id><published>2010-12-27T20:30:00.002+01:00</published><updated>2010-12-27T20:35:48.649+01:00</updated><title type='text'>Wrong auth logic</title><content type='html'>I generally use authkit in my pylons projects for authentication and authorization. I have recently realized that the logic I use is wrong. The thing is that whenever I encounter a user that is authenticated but not authorized, I redirect to a login screen, practically without a word of explanation. Now, that's wrong. I should be showing the login screen only when the user is not authenticated, otherwise I should only display an explanatory message.

Now, why am I writing this? Why...? Why? Perhaps not to forget and implement it properly in my next project, now with repoze.who though.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-9053304987545607363?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/9053304987545607363/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2010/12/wrong-auth-logic.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/9053304987545607363'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/9053304987545607363'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2010/12/wrong-auth-logic.html' title='Wrong auth logic'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-2700077362849804382</id><published>2010-09-02T21:01:00.001+02:00</published><updated>2010-09-02T21:03:51.427+02:00</updated><title type='text'>seoprofesional toolbar beta</title><content type='html'>Are you interested in test-driving a new seoprofesional toolbar for firefox, now compatible with FF4? Drop me a note to &lt;strong&gt;petrb.feedback&lt;/strong&gt;&lt;b&gt;+&lt;/b&gt;&lt;strong&gt;seop110beta@gmail.com&lt;/strong&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-2700077362849804382?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/2700077362849804382/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2010/09/seoprofesional-toolbar-beta.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/2700077362849804382'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/2700077362849804382'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2010/09/seoprofesional-toolbar-beta.html' title='seoprofesional toolbar beta'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-4316732301295278802</id><published>2010-09-02T20:49:00.006+02:00</published><updated>2010-09-02T21:01:38.751+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><title type='text'>SQLAlchemy Custom Types</title><content type='html'>&lt;p&gt;&lt;a href="http://sqlalchemy.org"&gt;SQLAlchemy&lt;/a&gt; is just ingenious. I must admit I haven't worked with any other ORM before, yet SQLAlchemy is more than that. I have been working with it's query language for years (4-5) and just recently I started to tuck into orm. So easy to use and so comprehensive.&lt;/p&gt;
&lt;p&gt;
If you want to do something related to your database, with SQLAlchemy you probably can. I, for example, need to "modify" a date-time value read from Oracle database backing our ERP. I suspect somebody didn't bother to set-up the timezone information properly. So all I had to do was to subclass &lt;a href="http://www.sqlalchemy.org/docs/05/reference/sqlalchemy/types.html#custom-types"&gt;&lt;tt&gt;types.TypeDecorator&lt;/tt&gt;&lt;/a&gt; and override member function &lt;tt&gt;process_result_value&lt;/tt&gt; to do some magic about my datetime values. That was it (I only read the data so I didn't care about converting back.)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-4316732301295278802?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/4316732301295278802/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2010/09/sqlalchemy-custom-types.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/4316732301295278802'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/4316732301295278802'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2010/09/sqlalchemy-custom-types.html' title='SQLAlchemy Custom Types'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-7162619673100674608</id><published>2010-07-12T22:04:00.007+02:00</published><updated>2010-09-02T20:49:11.313+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='pylons'/><title type='text'>pylons, sqlalchemy, pickles</title><content type='html'>&lt;p&gt;My blog has got Python in the title and yet there hasn't been a serious Python related post. You might have guessed I use &lt;a href="http://pylonshq.com/"&gt;Pylons&lt;/a&gt; because I tried to run Pylons under Google App Engine. I abandoned these efforts ever since and decided to use the setup I am used to for my next projects. Currently I use quite traditional:
&lt;ul&gt;
&lt;li&gt;python 2.5 or 2.6&lt;/li&gt;
&lt;li&gt;pylons, currently 0.9.7 because I started with version 0.9.3 or 0.9.4 and it would be to much work to get rid of webhelpers.rails&lt;/li&gt;
&lt;li&gt;sqlalchemy 0.5 (with MySQL)&lt;/li&gt;
&lt;li&gt;authkit&lt;/li&gt;
&lt;li&gt;formencode&lt;/li&gt;
&lt;li&gt;prototype, because it used to be a part of webhelpers&lt;/li&gt;
&lt;li&gt;simile timeline, flotr and a bunch of other javascript tools&lt;/li&gt;
&lt;li&gt;reportlab for pdf generation&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;&lt;p&gt;
For new projects I will move on to:
&lt;ul&gt;
&lt;li&gt;pylons 1.0&lt;/li&gt;
&lt;li&gt;sqlalchemy 0.6 even though it is not officially supported in pylons&lt;/li&gt;
&lt;li&gt;not sure about an auth... middleware, perhaps repoze, perhaps something else&lt;/li&gt;
&lt;li&gt;not sure about formencode but probably yes&lt;/li&gt;
&lt;li&gt;jquery&lt;/li&gt;
&lt;/ul&gt;&lt;/p&gt;
&lt;p&gt;
I am experimenting with some pickling and unpickling. 
In one project I am saving pickled data directly into the database. Of 
course I don't expect I will be able to use the pickled data as database
keys or even search in them. The keys will stay in their own native sql
colunms. The pickled section will just have some additional info in it.
Using sqlalchemy this is rather easy to do. I defined my model declaratively 
like this&gt;:
&lt;script type="syntaxhighlighter" class="brush: python"&gt;&lt;![CDATA[
class Timedata(Base):
    __tablename__ = "timedata"
    id = Column(Integer, primary_key=True)
    user_id = Column(Integer)
    clazz = Column(String)
    tm = Column(DATETIME)
    data = Column(Text)

    def _set_details(self, data):
        self.data = pickle.dumps(data)
    def _get_details(self):
        return pickle.loads(str(self.data))
    details = property(_get_details, _set_details)

]]&gt;&lt;/script&gt;
And for working with unpickled details:
&lt;script type="syntaxhighlighter" class="brush: python"&gt;&lt;![CDATA[
details = timedata.details
details.doSomething()
timedata.details = details
]]&gt;&lt;/script&gt;
You cannot do:
&lt;script type="syntaxhighlighter" class="brush: python"&gt;&lt;![CDATA[
timedata.details.doSomething()
]]&gt;&lt;/script&gt;
If you look at the declaration, you will probably realize why.
&lt;/p&gt;
&lt;p&gt;
In another project I just pickle an object and send it to a client
through network. There I unpickle it and use it. Strange things were
hapenning. When I have both the server and the client on the same maching
it worked perfectly. But when I moved the server elsewhere, it stopped 
working. It took me a few hours before I realized that on the server I had
old version of the module containing the class for the pickled object, which
was an old-style class. Of course the unpickling didn't work then. 
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-7162619673100674608?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/7162619673100674608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2010/07/pylons-sqlalchemy-pickles.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/7162619673100674608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/7162619673100674608'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2010/07/pylons-sqlalchemy-pickles.html' title='pylons, sqlalchemy, pickles'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-6863418151239839938</id><published>2010-05-22T22:03:00.003+02:00</published><updated>2010-05-22T22:06:42.186+02:00</updated><title type='text'>facebook :-(</title><content type='html'>I am on a facebook too. Nothing to board about though. I just wanted to let you readers know I have just created a group named &lt;a href="http://www.facebook.com/group.php?gid=119274321441000"&gt;I won't join every silly facebook group I am invited into&lt;/a&gt;. Still accepting members. Feel free to join. If anybody at all reads this blog.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-6863418151239839938?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/6863418151239839938/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2010/05/facebook.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/6863418151239839938'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/6863418151239839938'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2010/05/facebook.html' title='facebook :-('/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-2059011462012722182</id><published>2010-04-28T22:13:00.003+02:00</published><updated>2010-04-28T22:29:38.878+02:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='python'/><category scheme='http://www.blogger.com/atom/ns#' term='pylons'/><category scheme='http://www.blogger.com/atom/ns#' term='appengine'/><title type='text'>pylons in appengine</title><content type='html'>Hello again, after more than a month. Sorry you had to wait. So I have got &lt;a href="http://pylonshq.com"&gt;pylons&lt;/a&gt; in google appengine up and running. Haven't done anything yet, just an "empty" application. Anyway, I had to compile my own python, as OpenSUSE 11.2 already contains version 2.6 and doesn't seem to have 2.5 packages in my current set of repositories. 

After I compiled python for the first time (&lt;tt&gt;./configure ; make ; sudo make install)&lt;/tt&gt; and run python2.5, I saw that I could not use commandline properly, so I installed &lt;tt&gt;readline-devel&lt;/tt&gt;. Then I compiled again, tried a bit of the &lt;a href="http://code.google.com/p/appengine-monkey/wiki/Pylons"&gt;appengine-monkey guide&lt;/a&gt;, found out that something wasn't compiled in, installed another devel package and went again. The packages I had to install were:
&lt;ul&gt;
&lt;li&gt;readline-devel&lt;/li&gt;
&lt;li&gt;zlib-devel&lt;/li&gt;
&lt;li&gt;openssl-devel&lt;/li&gt;
&lt;li&gt;sqlite3-devel&lt;/li&gt;
&lt;/ul&gt;
Then I successfully run the bloody thing. After some mistake on my side I decided to go for Pylons-0.9.7 instead of the fresh 1.0-prerelease and I installed an older webob as one of the comments on appengine-monkey wiki advices. That's about it for now. I will keep you posted with updates.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-2059011462012722182?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/2059011462012722182/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2010/04/pylons-in-appengine.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/2059011462012722182'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/2059011462012722182'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2010/04/pylons-in-appengine.html' title='pylons in appengine'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-3876451601781121666</id><published>2010-03-14T20:25:00.002+01:00</published><updated>2010-03-14T20:26:48.599+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='chrome'/><title type='text'>word count for chrome</title><content type='html'>&lt;p&gt;Just a quick note: The approach described in &lt;a href="http://petrsstuff.blogspot.com/2009/11/word-count.html"&gt;word count&lt;/a&gt; and &lt;a href="http://petrsstuff.blogspot.com/2009/11/word-count-ii.html"&gt;word count II&lt;/a&gt; seems to be working well in Google Chrome too. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-3876451601781121666?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/3876451601781121666/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2010/03/word-count-for-chrome.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/3876451601781121666'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/3876451601781121666'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2010/03/word-count-for-chrome.html' title='word count for chrome'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-4492424649124313811</id><published>2010-03-07T20:35:00.007+01:00</published><updated>2010-03-07T20:51:10.928+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='chrome'/><title type='text'>localized html in a chrome extension</title><content type='html'>&lt;p&gt;Google Chrome implements a function to get a localized version of a string. Using it to update HTML can be rather tedious if we use the most naive approach I can think of:&lt;/p&gt;
&lt;script type="syntaxhighlighter" class="brush: javascript"&gt;&lt;![CDATA[
var el = document.getElementById("texttotranslate");
var message = chrome.i18n.getMessage("messageid");
el.innerText = message;
]]&gt;&lt;/script&gt;
&lt;p&gt;Let's do something smarter: We shall mark all tags that contain translatable strings with a class, then we will select all tags of that class, simply take their innerText as the message id, get the message and replace innerText. Done.&lt;/p&gt;
&lt;script type="syntaxhighlighter" class="brush: javascript"&gt;&lt;![CDATA[
function translate() {
  var els = document.querySelectorAll(".trans");
  for (var i = 0;i&lt;els.length;i++) {
    els[i].innerText = chrome.i18n.getMessage(els[i].innerText);
  }
}
]]&gt;&lt;/script&gt;
&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[
&lt;body onload="translate()"&gt;
&lt;h1 class="trans"&gt;seop_options&lt;/h1&gt;
&lt;div id="main"&gt;
  &lt;input type="checkbox" id="enabled"&gt;
  &lt;span class="trans"&gt;seop_enabled&lt;/span&gt;&lt;br&gt;
  &lt;h2 class="trans"&gt;menu_links&lt;/h2&gt;
&lt;/body&gt;
]]&gt;&lt;/script&gt;
Done.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-4492424649124313811?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/4492424649124313811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2010/03/localized-html-in-chrome-extension.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/4492424649124313811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/4492424649124313811'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2010/03/localized-html-in-chrome-extension.html' title='localized html in a chrome extension'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-4517925028446247582</id><published>2010-03-04T20:52:00.002+01:00</published><updated>2010-03-04T20:57:05.075+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='chrome'/><title type='text'>SEO Profesional Toolbar for Google Chrome</title><content type='html'>&lt;p&gt;So it's finally here. I have been working on the Google Chrome port of our "famous" &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/49038"&gt;SEO Profesional Toolbar&lt;/a&gt; for some time and the very first release has been made yesterday. &lt;/p&gt;
&lt;p&gt;You can &lt;a href="https://chrome.google.com/extensions/detail/adecfhccdknoobplgempjhbojlbpahhn"&gt;get it &lt;big&gt;here&lt;/big&gt;&lt;/a&gt;. I will appreciate any comments. Please note that it isn't really finished yet. Developers can look forward to reading some related posts.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-4517925028446247582?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/4517925028446247582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2010/03/seo-profesional-toolbar-for-google.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/4517925028446247582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/4517925028446247582'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2010/03/seo-profesional-toolbar-for-google.html' title='SEO Profesional Toolbar for Google Chrome'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-1613958157727483461</id><published>2010-02-26T21:22:00.004+01:00</published><updated>2010-02-26T21:31:01.346+01:00</updated><title type='text'>better template</title><content type='html'>Great! I have found a template main part of which is wider than some 30% of the page! Wow! That's my second post today.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-1613958157727483461?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/1613958157727483461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2010/02/better-template-template.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/1613958157727483461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/1613958157727483461'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2010/02/better-template-template.html' title='better template'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-9061409642165619430</id><published>2010-02-24T20:48:00.010+01:00</published><updated>2010-02-26T21:22:16.339+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><title type='text'>highlight things in a firefox extension</title><content type='html'>&lt;p&gt;If you did some highlighting in a web application you would have to manipulate DOM to insert tags that would change background color (or style in general) of the area being highlighted. It is not only slow but also rather complicated and limited. Firefox offers a stronger tool, which is used for example for highlighting searched strings. Here we will look into some details. &lt;/p&gt;
&lt;p&gt;We will start with document.createRange. This is not firefox specific yet. This is a pure DOM and should be pretty cross-browser. (I haven't tried it in MSIE8 but according  to &lt;a href="http://www.quirksmode.org/dom/range_intro.html"&gt;quirksmode's Introduction to Range&lt;/a&gt; it does not work in MSIE6/7. Honestly, I haven't tried in anything else than FF3+). Anyway, we have got quite a set of functions for manipulating ranges, and honestly they are not too easy to work with. Try this in your Firebug:&lt;/p&gt;
&lt;script type="syntaxhighlighter" class="brush: javascript"&gt;&lt;![CDATA[
var range = document.createRange();
range.setStartBefore(document.links[0]);
range.setEndAfter(document.links[0]);
console.log(range);
// or an equivalent:
var range = document.createRange();
range.setStart(document.links[0], 0);
range.setEnd(document.links[0], 1);
console.log(range);
]]&gt;&lt;/script&gt;
&lt;p&gt;For description of functions see &lt;a href="https://developer.mozilla.org/en/DOM/range"&gt;DOM/range @ developer.mozilla.org&lt;/a&gt;. So, we have got a range or more  and we would like to highlight them. Here, Firefox comes to our help. We need to obtain a selection controller for the window, add the ranges to desired type of selection and tell the controller to highlight them. There are a few things to remember:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The selection controller can contain something. We should clear it first.&lt;/li&gt;
&lt;li&gt;There are a few types of selection, like SELECTION_FIND and SELECTION_NORMAL.&lt;/li&gt;
&lt;li&gt;You must do all the stuff shown below for all frames in your document separately. This will not be shown here but you can look at &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/49038"&gt;SEO Profesional Toolbar&lt;/a&gt; source code, file &lt;tt&gt;seopsidebar.js&lt;/tt&gt;&lt;/li&gt;
&lt;li&gt;Remember that some windows do not contain DOM. In that case this method will fail&lt;/li&gt;
&lt;/ul&gt;
&lt;script type="syntaxhighlighter" class="brush: javascript"&gt;&lt;![CDATA[
  var docShell = gBrowser.contentWindow
            .QueryInterface(Ci.nsIInterfaceRequestor)
            .getInterface(Ci.nsIWebNavigation)
            .QueryInterface(Ci.nsIDocShell);

  var controller = docShell.QueryInterface(Ci.nsIInterfaceRequestor)
            .getInterface(Ci.nsISelectionDisplay)
            .QueryInterface(Ci.nsISelectionController);
  var find_selection = controller.getSelection(Ci.nsISelectionController.SELECTION_FIND);
  // remove previously inserted ranges:
  find_selection.removeAllRanges();
  // add new ranges
  find_selection.addRange(range1);
  find_selection.addRange(range2);
  find_selection.addRange(range3);
  // highlight the selection
  controller.setDisplaySelection(Ci.nsISelectionController.SELECTION_ON);
]]&gt;&lt;/script&gt;
&lt;p&gt;Just for those curious: In SEO Profesional Toolbar we offer a list of something (links, found texts) in a sidebar and hightlight all these entities using &lt;tt&gt;SELECTION_FIND&lt;/tt&gt; and when one of them is clicked in the sidebar, we will highlight it using &lt;tt&gt;SELECTION_NORMAL&lt;/tt&gt; and scroll to it with &lt;tt&gt;controller.scrollSelectionIntoView(Ci.nsISelectionController.SELECTION_NORMAL, Ci.nsISelectionController.SELECTION_ANCHOR_REGION, false)&lt;/tt&gt;&lt;/p&gt;
&lt;p&gt;The best thing at the end: I have put some examples into my &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/50036"&gt;testbed firefox
extension&lt;/a&gt;, so fire-up your browser, install testbed, look at the source code (&lt;tt&gt;overlay.js&lt;/tt&gt;), sit back and enjoy! Do not forget to uninstall or disabled testbed when you are done.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-9061409642165619430?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/9061409642165619430/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2010/02/highlight-things-in-firefox-extension.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/9061409642165619430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/9061409642165619430'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2010/02/highlight-things-in-firefox-extension.html' title='highlight things in a firefox extension'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-3888409544614212442</id><published>2010-01-18T21:38:00.005+01:00</published><updated>2010-01-18T22:19:06.557+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>The most annoying thing about javascript</title><content type='html'>First some background:
&lt;script type="syntaxhighlighter" class="brush: javascript"&gt;&lt;![CDATA[
var a = [ 1,, 2,3,4,5 ];
]]&gt;&lt;/script&gt;
&lt;p&gt;
Would you believe that the beast above is a valid javascript construct? 
Those two commas are translated into &lt;tt&gt; , undefined , &lt;/tt&gt;, so the 
&lt;tt&gt;a.length==6&lt;/tt&gt; and &lt;tt&gt;a[1]==undefined&lt;/tt&gt;. I would really like
to see an example of a code where this construct is helpful.
But that's not something we cannot live with. Here comes the winner:
&lt;em&gt;The most annoying thing about javascript:&lt;/em&gt;
&lt;/p&gt;
&lt;script type="syntaxhighlighter" class="brush: javascript"&gt;&lt;![CDATA[
var a = [ 1, ];
]]&gt;&lt;/script&gt;
&lt;p&gt;
Here we have hit into one of those browser incompatibilities. Firefox, 
Google Chrome and Opera 9.63 say, quite logically, that &lt;tt&gt;len(a)==1&lt;/tt&gt;.
MSIE 7 on the other hand things the array is 2 elements long. I suspect
MSIE is closer to ECMA script then others because being struct by the 
fact that a variation of this example worked in Firefox
but didn't work in MSIE I read relevant part of EMCA script standard. 
&lt;/p&gt;
&lt;p&gt;
Why is it annoying? In Python I happily jumped at the 
possibility to generate lists with a comma at the end. How natural,
no special handling of the last element. In languages that do not 
support this I at least get a syntax error. Not in javascript.
If I want my code to run in MSIE too (and this stupid comma should 
be no reason not to) I have to remember this little thing and write
more complex code. The worst thing is I cannot even bitch about 
stupid MSIE, because I believe MSIE has got it right according to
standard. Illogical, stupid, but correct.
&lt;/p&gt;
&lt;p&gt;
What is your candidate for the most annoying thing about javascript?
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-3888409544614212442?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/3888409544614212442/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2010/01/most-annoying-thing-about-javascript.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/3888409544614212442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/3888409544614212442'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2010/01/most-annoying-thing-about-javascript.html' title='The most annoying thing about javascript'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-2671855602603116599</id><published>2009-12-27T14:09:00.007+01:00</published><updated>2010-02-07T21:01:32.088+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><title type='text'>favicon service in firefox</title><content type='html'>&lt;p&gt;
That's the &lt;a href="https://developer.mozilla.org/en/Places"&gt;places&lt;/a&gt; 
thing everybody talked so much about when announcing firefox 3.
What we actually see in bookmarks or history is just a top of the iceberg. 
Had I read the places documentation before I started working on 
&lt;a href="https://addons.mozilla.org/en-US/firefox/addon/49038"&gt;seoprofesional toolbar&lt;/a&gt;, I would probably just use the places tagging system
or something to select the sites to remember...
&lt;/p&gt;
&lt;p&gt;Anyway, at the first attempt I just used favicon service as follows:&lt;/p&gt;
&lt;script type="syntaxhighlighter" class="brush: javascript"&gt;&lt;![CDATA[
var ioService = Components.classes["@mozilla.org/network/ioservice;1"].getService(Components.interfaces.nsIIOService);  
var uri = ioService.newURI(url, null, null);  
var iconURL = Cc["@mozilla.org/browser/favicon-service;1"].getService(Ci.nsIFaviconService)
]]&gt;&lt;/script&gt;
&lt;p&gt;
The trouble was, the icon was really the favicon from the site. The original size (whatever it was)
and possibly animated. That I didn't like. So the second attempt looked like this:
&lt;/p&gt;
&lt;script type="syntaxhighlighter" class="brush: javascript"&gt;&lt;![CDATA[
var ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);  
var historyService = Cc["@mozilla.org/browser/nav-history-service;1"].getService(Ci.nsINavHistoryService);

var options = historyService.getNewQueryOptions();
var query = historyService.getNewQuery();

options.resultType = options.RESULTS_AS_URI;
query.uri = ioService.newURI(url, null, null);

var result = historyService.executeQuery(query, options);
result.root.containerOpen = true;

if (result.root.getChild(0).icon.spec) {
 iconURL = result.root.getChild(0).icon.spec;
} else {
 iconURL = result.root.getChild(0).icon;
}

result.root.containerOpen = false;
]]&gt;&lt;/script&gt;
&lt;p&gt;The resulting icon is 16x16 and not animated. Only remember to put try...catch in 
the right places because you must close the container at the end
 (&lt;tt&gt;result.root.containerOpen = false&lt;/tt&gt;)&lt;/p&gt;
&lt;p&gt;(The last example was updated on the 7th of Feb 2010 to incorporate changes
in FF3.6)&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-2671855602603116599?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/2671855602603116599/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2009/12/favicon-service-in-firefox.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/2671855602603116599'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/2671855602603116599'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2009/12/favicon-service-in-firefox.html' title='favicon service in firefox'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-9136984447563925002</id><published>2009-12-13T21:37:00.004+01:00</published><updated>2009-12-13T21:46:27.139+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><title type='text'>flot and flotr</title><content type='html'>&lt;p&gt;I promised a few words about flot. I thought a lot about it and instead of writing how good and easy to use it is, I will just point you to it. I must also mention flotr, which is a similar library, but uses prototype instead of jquery. Now the links:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/flot/"&gt;flot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/flotr/"&gt;flotr&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;2 small notes: I like flotr better. It's output seems to me to be a bit more polished. But I picked flot for seoprofesional toolbar, because flotr didn't like interrupted series (a line from 1 to 3, then nothing from 3 to 4, and then a line from 4 to 5 again). On the other hand, flotr does support value labels, for which I had to write my own &lt;a href="http://sites.google.com/site/petrsstuff/projects/flotvallab"&gt;plugin&lt;/a&gt;.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-9136984447563925002?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/9136984447563925002/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2009/12/flot-and-flotr.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/9136984447563925002'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/9136984447563925002'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2009/12/flot-and-flotr.html' title='flot and flotr'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-7846405408519450656</id><published>2009-12-10T20:42:00.002+01:00</published><updated>2009-12-12T21:23:33.970+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='chrome'/><title type='text'>ff3sudoku now for google chrome</title><content type='html'>&lt;p&gt;I have just finished and released &lt;a href="https://chrome.google.com/extensions/detail/lcdocepgkcgakjddfnfockoammdpjidg"&gt;ff3sudoku for google chrome&lt;/a&gt;. It should be roughly the same as the good old 
ff3sudoku for firefox but thanks to the firefox system of approval of add-ons 
by editors you have to wait for the firefox version even though I released it about
a week ago, while you can have it instantly for chrome. Good work google!
&lt;/p&gt;
&lt;p&gt;Now, if there is anybody actually reading this who has installed the extension,
please give me your feedback. The extension has it's rough edges and I need to know
whether I should be polishing them or not...
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-7846405408519450656?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/7846405408519450656/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2009/12/ff3sudoku-now-for-google-chrome.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/7846405408519450656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/7846405408519450656'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2009/12/ff3sudoku-now-for-google-chrome.html' title='ff3sudoku now for google chrome'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-7788428125877959368</id><published>2009-12-10T20:10:00.002+01:00</published><updated>2009-12-12T21:23:21.671+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><title type='text'>firefox personas disappointment</title><content type='html'>&lt;p&gt;I finally got down to getting &lt;a href="http://www.getpersonas.com/"&gt;personas&lt;/a&gt; installed on my machine. Honestly, I do not understand what the hype was about. It's nice, alright, but is that all? Just an image to display on top of the window and another one to display on the bottom? I sort of expected something like skins we all know from X-Window System widget sets, where at least all window backgrounds are changed. &lt;/p&gt;
&lt;p&gt;
Yet, skinning the red panda opens one interesting possibility, that as far as I know hasn't been researched much yet. How about making your web-page follow the mood of your browser? Or the other way round, your browser, following the mood of your webpage? As far as I can say, none of these are implemented in personas. I expect the second one might be considered a security threat, because if I understand correctly the header and the footer image can actually be html with some javascript in it. Or am I wrong?&lt;/p&gt;
&lt;p&gt;
Anyway, I can see personas firing a DOM event to a freshly loaded web-page, telling the page what the currently selected persona is, allowing the page to react. The only problem is that there are too many personas for a web-page to implement. Perhaps there might be a way how to allow a web-page use a local resource - a persona-related background image. Web-page will thus indirectly access the viewer's hard-drive. Here we are back to security threats.&lt;/p&gt;
&lt;br/&gt;
(...might be continued...)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-7788428125877959368?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/7788428125877959368/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2009/12/firefox-personas-disappointment.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/7788428125877959368'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/7788428125877959368'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2009/12/firefox-personas-disappointment.html' title='firefox personas disappointment'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-7455602339340314131</id><published>2009-12-03T21:29:00.005+01:00</published><updated>2009-12-03T21:36:43.326+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><title type='text'>ff3sudoku 1.2.0</title><content type='html'>&lt;p&gt;
I have just released a new version of the sudoku firefox add-on. It finally let's you remove the tooltips some find so annoying. This version hasn't been approved by editors yet, so it is still marked experimental. You must go directly here: &lt;a href="https://addons.mozilla.org/en-US/firefox/addons/versions/8036#version-1.2.0"&gt;https://addons.mozilla.org/en-US/firefox/addons/versions/8036#version-1.2.0&lt;/a&gt; to install it.
&lt;/p&gt;
&lt;p&gt;
I have got some ideas what to do next, but to be honest, I would like to see some 
interest. I mean, if everybody is pretty much satisfied with the status of sudoku, there is probably no need for me to waste time on it. 
&lt;/p&gt;
&lt;p&gt;
Meanwhile, I will look a bit more into turning the bloody thing into a Google Chrome extension.
&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-7455602339340314131?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/7455602339340314131/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2009/12/ff3sudoku-120.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/7455602339340314131'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/7455602339340314131'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2009/12/ff3sudoku-120.html' title='ff3sudoku 1.2.0'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-9016925850952939605</id><published>2009-11-17T13:54:00.012+01:00</published><updated>2009-11-17T15:20:15.412+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><title type='text'>extending pageinfo</title><content type='html'>In our &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/49038"&gt;SEOProfesional 
Toolbar&lt;/a&gt; firefox extension I considered, how I should present some web-page
related information to the user. Of course the easiest but quite stupid way to do it would be to make my own information box with the requested information. But in principle, the info we wanted to show was something about the page, therefore logically belonging to the Page Info dialog. I did not find much information on developer.mozilla.org, so I dived into the source code. 

Let's start with chrome.manifest of our testbed add-on:
&lt;script type="syntaxhighlighter" class="brush: javascript"&gt;&lt;![CDATA[
content	testbed	content/
overlay chrome://browser/content/pageinfo/pageInfo.xul chrome://testbed/content/pageInfoOverlay.xul
]]&gt;&lt;/script&gt;
which simply says that the browser's &lt;tt&gt;pageInfo.xul&lt;/tt&gt; should be overlayed with our &lt;tt&gt;pageInfoOverlay.xul&lt;/tt&gt;.
The overlay should look like this:
&lt;script type="syntaxhighlighter" class="brush: xml"&gt;&lt;![CDATA[
&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;?xml-stylesheet href="chrome://testbed/skin/overlay.css" type="text/css"?&gt;
&lt;overlay id="test-pi-overlay"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
	&gt;
&lt;script type="application/x-javascript" src="chrome://browser/content/pageinfo/pageInfo.js"/&gt;
&lt;script type="application/x-javascript" src="pageinfo.js"/&gt;

&lt;radiogroup id="viewGroup"&gt;
  &lt;radio id="testTab" label="test tab" oncommand="showTab('test');"/&gt;
&lt;/radiogroup&gt;

&lt;deck id="mainDeck"&gt;
  &lt;vbox id="testPanel"&gt;
    &lt;listbox id="info" flex="1"&gt;
    &lt;/listbox&gt;
  &lt;/vbox&gt;
&lt;/deck&gt;
&lt;/overlay&gt;
]]&gt;&lt;/script&gt;
The important parts are:&lt;ul&gt;
&lt;li&gt;The radiogroup overlay with an item with id &lt;tt&gt;&lt;b&gt;something&lt;/b&gt;Tab&lt;/tt&gt; and the &lt;tt&gt;oncommand="showTab('&lt;b&gt;something&lt;/b&gt;');"&lt;/tt&gt;&lt;/li&gt;
&lt;li&gt;The deck overlay with a vbox called again &lt;tt&gt;&lt;b&gt;something&lt;/b&gt;Panel&lt;/tt&gt;&lt;/li&gt;
&lt;/ul&gt;
Now you should see your page in the pageinfo. The real fun hasn't started yet. We need to add some 
functionality. You have probably noticed the link to &lt;tt&gt;pageinfo.js&lt;/tt&gt; in our xul. Until now we expected
it was empty. Let's start filling it with stuff. If you look into &lt;tt&gt;chrome://browser/content/pageinfo/pageInfo.js&lt;/tt&gt; you will see that Firefox developers have helped us with building a framework for extending page info. There is a bunch of callbacks to help us set the contents of our page. Following are javascript arrays of functions to be called for certain events.
&lt;ul&gt;
&lt;li&gt;onLoadRegistry&lt;/li&gt;
&lt;li&gt;onResetRegistry&lt;/li&gt;
&lt;li&gt;onProcessFrame&lt;/li&gt;
&lt;li&gt;onProcessElement&lt;/li&gt;
&lt;li&gt;onFinished&lt;/li&gt;
&lt;li&gt;onUnloadRegistry&lt;/li&gt;
&lt;/ul&gt;
We will just look at &lt;tt&gt;onLoadRegistry&lt;/tt&gt; and &lt;tt&gt;onProcessFrame&lt;/tt&gt; here as they are the only 2 I have
used. 

&lt;tt&gt;onLoadRegistry&lt;/tt&gt; functions will be called whenever page info is displayed. That's the good place 
to decide whether we want to display our page or not. The code of our &lt;tt&gt;pageinfo.js&lt;/tt&gt; 
could look like this:
&lt;script type="syntaxhighlighter" class="brush: javascript"&gt;&lt;![CDATA[
piLoad = function() {
	if (0==gDocument.baseURIObject.spec.indexOf("https://")) {
		var el = document.getElementById("testTab");
		el.hidden = true;
	}
}
onLoadRegistry.push(piLoad)
]]&gt;&lt;/script&gt;
That will hide our page for pages retrieved through https.

The second one, &lt;tt&gt;onProcessFrame&lt;/tt&gt;, gets all the frames the page consists of. If we want to enumerate them, we can do something like this:
&lt;script type="syntaxhighlighter" class="brush: javascript"&gt;&lt;![CDATA[
piFrame = function(doc) {
	var el = document.getElementById("framesinfo");
	var uri = doc.baseURIObject.spec;
	el.appendItem(uri, uri);
}

onProcessFrame.push(piFrame)
]]&gt;&lt;/script&gt;

2 last pieces of the puzzle are missing. The first one: how to assign a headline image for our
page. Easy! Through css. You have noticed link to &lt;tt&gt;chrome://testbed/skin/overlay.css&lt;/tt&gt; in our xul.
&lt;script type="syntaxhighlighter" class="brush: css"&gt;&lt;![CDATA[
#testTab {
  list-style-image: url("pl1.png") !important;
}

#testTab:hover, #testTab[selected="true"] {
  list-style-image: url("hl1.png") !important;
}
]]&gt;&lt;/script&gt;
Those 2 images should be 32x32px.

And the last thing: what if we also want to invoke the page info dialog from our UI and switch directly to our page? Again, that's something Firefox developers thought about. Very basic:
&lt;script type="syntaxhighlighter" class="brush: javascript"&gt;&lt;![CDATA[
	window.openDialog("chrome://browser/content/pageinfo/pageInfo.xul",
			"_blank",
			"chrome,toolbar,dialog=no,resizable",
			{initialTab: "testTab"});
]]&gt;&lt;/script&gt;
Not ideal though. There is a possibility, that the page info for this page has already been opened.
Therefore it is better to look and in such case, focus the existing window:
&lt;script type="syntaxhighlighter" class="brush: javascript"&gt;&lt;![CDATA[
	var windowManager = Cc['@mozilla.org/appshell/window-mediator;1'].getService();
	var windowManagerInterface = windowManager.QueryInterface(Ci.nsIWindowMediator);
	var windows = windowManagerInterface.getEnumerator("Browser:page-info");

	var uri = gBrowser.selectedBrowser.contentDocument.baseURIObject.spec;

	// Check for windows matching the url
	while (windows.hasMoreElements()) {
		var currentWindow = windows.getNext();
		if (uri==currentWindow.document.documentElement.getAttribute("relatedUrl")) {
			currentWindow.focus();
			return;
		}
	}
	
	window.openDialog("chrome://browser/content/pageinfo/pageInfo.xul",
			"_blank",
			"chrome,toolbar,dialog=no,resizable",
			{initialTab: "testTab"});
]]&gt;&lt;/script&gt;

The best news at the end: I have created a test-bed for my experiments. You can
install &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/50036"&gt;this
add-on&lt;/a&gt; and see pretty much everything I have been writing about today...
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-9016925850952939605?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/9016925850952939605/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2009/11/extending-pageinfo.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/9016925850952939605'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/9016925850952939605'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2009/11/extending-pageinfo.html' title='extending pageinfo'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-6476070015819409174</id><published>2009-11-15T14:21:00.007+01:00</published><updated>2009-11-16T20:05:44.142+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><title type='text'>seoprofesional toolbar</title><content type='html'>&lt;a href="http://www.seo-profesional.cz/"&gt;Seo-Profesional's&lt;/a&gt; and my joint project is nearing to release. It is a Firefox extension called &lt;a href="http://www.seo-profesional.cz/toolbar/"&gt;SEO Profesional Toolbar&lt;/a&gt;, which is in a way similar to other seo firefox extension, yet, it is superior. Similarly to its competitors it displays page rank and s-rank (for Czech search engine &lt;a href="http://seznam.cz"&gt;Seznam&lt;/a&gt;), but unlike them, it remembers history and displays it in nice colorful charts. After all, everybody likes colors. Go and see &lt;a href="http://www.youtube.com/seoprofesional"&gt;YouTube SEOProfesional's Channel&lt;/a&gt; to learn more.

I am not a SEO person. I am a programmer. I wrote, or I should rather say put together the code and I can say, there are a few nice ideas. In next few posts you will learn how to do a few things in javascript/firefox. 
&lt;ul&gt;
&lt;li&gt;How to extend PageInfo&lt;/li&gt;
&lt;li&gt;How to high-light words or other stuff in the html page&lt;/li&gt;
&lt;li&gt;How to make charts with &lt;a href="http://code.google.com/p/flot/"&gt;flot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;How to access fav-icons&lt;/li&gt;
&lt;li&gt;Bits about a xul tree&lt;/li&gt;
&lt;li&gt;You might have already read about &lt;a href="http://petrsstuff.blogspot.com/2009/11/word-count.html"&gt;word count&lt;/a&gt; (&lt;a href="http://petrsstuff.blogspot.com/2009/11/word-count-ii.html"&gt;II&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;

You English speakers will probably need &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/49038"&gt;this link to install it...&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-6476070015819409174?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/6476070015819409174/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2009/11/seoprofesional-toolbar.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/6476070015819409174'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/6476070015819409174'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2009/11/seoprofesional-toolbar.html' title='seoprofesional toolbar'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-461134163098812390</id><published>2009-11-15T14:14:00.003+01:00</published><updated>2009-11-15T14:26:01.907+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><title type='text'>word count II</title><content type='html'>In the course of time I found out that the approach I described in &lt;a href="http://petrsstuff.blogspot.com/2009/11/word-count.html"&gt;here&lt;/a&gt; is not ideal. Namely, getting the words from scripts didn't work when there were more scripts in the page. It looks like 
&lt;script type="syntaxhighlighter" class="brush: javascript"&gt;&lt;![CDATA[
var scripts = doc.evaluate(
        "normalize-space(//script)",
        doc,
        null,
        XPathResult.STRING_TYPE,
        null
).stringValue
]]&gt;&lt;/script&gt;
returns the string value of the first script only. So what we have to do is to take each script one by one and process them separately:
&lt;script type="syntaxhighlighter" class="brush: javascript"&gt;&lt;![CDATA[
var q = doc.evaluate("//script", doc, null, XPathResult.ANY_TYPE, null);
var t = q.iterateNext();
while (t) {
    words = t.textContent.toLowerCase()
        .split(/[ \~\t\r\n!@#\$%\^\&amp;amp;\*\.\+\(\)\?\!\[\]\/\|"',;:{}=-]+/);
    t = q.iterateNext();
    // substract the words from the original list.
}
]]&gt;&lt;/script&gt;
&lt;br&gt;&lt;br&gt;
Originally &lt;a href="http://petrsstuff.wordpress.com/2009/11/08/wordcount-ii/"&gt;at wordpress, 2009-11-08&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-461134163098812390?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/461134163098812390/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2009/11/word-count-ii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/461134163098812390'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/461134163098812390'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2009/11/word-count-ii.html' title='word count II'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-8030517346747010254</id><published>2009-11-15T14:05:00.005+01:00</published><updated>2010-03-14T20:29:39.104+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><title type='text'>word count</title><content type='html'>How do you count words in a html document? In javascript? When you have got the HTML's DOM, javascript and whole Firefox at your disposal? Of course, there is a bruteforce method of going through all DOM nodes, but that's rather silly. I found this: 
&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[
javascript:alert(“Wordcount: “+ 
        document.evaluate(
                “normalize-space(/*)”, 
                document,
                null,
                XPathResult.STRING_TYPE,
                null
        ).stringValue.split(" ").length)
]]&gt;&lt;/script&gt;
(&lt;a href="http://virtuelvis.com/archives/2007/04/word_count_for_html_documents#cid6124"&gt;source&lt;/a&gt;)&lt;br&gt;
Nice, but it has got 2 problems. It doesn't split words well, e.g. if you have something like word1,word2,word3, it is considered to be a single word. So let us not split by spaces but by something more complex:
&lt;script type="syntaxhighlighter" class="brush: javascript"&gt;&lt;![CDATA[
var words = doc.evaluate(
        "normalize-space(/*)",
        doc,
        null,
        XPathResult.STRING_TYPE,
        null
).stringValue.toLowerCase()
.split(/[ \~\t\r\n!@#\$%\^\&amp;amp;\*\.\+\(\)\?\!\[\]\/"',;:{}=-]+/);
]]&gt;&lt;/script&gt;
Unfortunately this is still not enough for it will include words from between the &lt;tt&gt;script&lt;/tt&gt; tags. What now? Let's simply substract the scripts and we are done.
&lt;script type="syntaxhighlighter" class="brush: javascript"&gt;&lt;![CDATA[
var scripts = doc.evaluate(
        "normalize-space(//script)",
        doc,
        null,
        XPathResult.STRING_TYPE,
        null
).stringValue.toLowerCase()
.split(/[ \~\t\r\n!@#\$%\^\&amp;amp;\*\.\+\(\)\?\!\[\]\/"',;:{}=-]+/);
]]&gt;&lt;/script&gt;
Now, the trouble is, this lot can also contain spaces now. But it does not bother me much as I need to go through all words one by one and I can remove unsuitables then.
&lt;br&gt;&lt;br&gt;
Originally &lt;a href="http://petrsstuff.wordpress.com/2009/10/06/word-count/"&gt;at wordpress, 2009-10-06&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-8030517346747010254?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/8030517346747010254/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2009/11/word-count.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/8030517346747010254'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/8030517346747010254'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2009/11/word-count.html' title='word count'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-8157958258050161808</id><published>2009-11-15T13:59:00.003+01:00</published><updated>2009-11-15T14:25:43.866+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='firefox'/><title type='text'>ff3sudoku plans</title><content type='html'>I always wanted to keep the &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/8036"&gt; ff3sudoku firefox add-on&lt;/a&gt; as simple as possible. Now, that's quite a difficult thing, if you want to make everyone happy. So options are comming up! The first thing I'll to is I'll make it possible to turn off the tooltips. Any more ideas? Share them in the comments please...
Lately I have been busy with another project which I am not at liberty to disclose yet, and which probably won't be of any interest of you, sudoku gamers. That's just to explain, why the updates are not rolling in as often as they used to. Anyway, when my schedule allows for it, I want to make a complete write of the underlying algorithms to allow players invoke various types of hints, like: find all naked pairs, ... Also the generator deserves some care. I should at least be able to differentiate between easy and medium puzzles.
&lt;br&gt;&lt;br&gt;
Originally published &lt;a href="http://petrsstuff.wordpress.com/2009/10/05/ff3sudoku-options/"&gt;at wordpress, 2009-10-5&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-8157958258050161808?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/8157958258050161808/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2009/11/ff3sudoku-plans.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/8157958258050161808'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/8157958258050161808'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2009/11/ff3sudoku-plans.html' title='ff3sudoku plans'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7743951656450091148.post-5895859886706114063</id><published>2009-11-15T13:38:00.000+01:00</published><updated>2009-11-15T13:55:03.859+01:00</updated><title type='text'>Testing the syntax highlighting</title><content type='html'>So it looks like I am ditching wordpress and coming back to Google for one simple reason: I cannot make wordpress decently display source code. This post is just to test that it can be done:

&lt;script type="syntaxhighlighter" class="brush: html"&gt;&lt;![CDATA[
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Carter Tomorrow Fund Donations&lt;/title&gt;
&lt;meta name="title" content="Help Give to the Carter Tomorrow Fund" /&gt;
&lt;meta name="description" content="Show your support and help out with a small gift"
]]&gt;&lt;/script&gt;

What about some python?
&lt;script type="syntaxhighlighter" class="brush: python"&gt;&lt;![CDATA[
from pdom import PDOM

def walk(node):
    if node:
        for i in node.sub:
            walk(i)
]]&gt;&lt;/script&gt;

Now I would like to give credit to 
&lt;a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter"&gt;Alex Gorbatchev&lt;/a&gt; for his Syntax Highlighter and Carter Cole for his &lt;a  href="http://blog.cartercole.com/2009/10/awesome-syntax-highlighting-made-easy.html"&gt;explanation how to use it in blogger&lt;/a&gt;.
&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7743951656450091148-5895859886706114063?l=petrsstuff.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://petrsstuff.blogspot.com/feeds/5895859886706114063/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://petrsstuff.blogspot.com/2009/11/testing-syntax-highlighting.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/5895859886706114063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7743951656450091148/posts/default/5895859886706114063'/><link rel='alternate' type='text/html' href='http://petrsstuff.blogspot.com/2009/11/testing-syntax-highlighting.html' title='Testing the syntax highlighting'/><author><name>Petr</name><uri>http://www.blogger.com/profile/00772995607657599072</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>
