tag:blogger.com,1999:blog-91156446058333841382024-03-13T21:16:17.380+01:00X de XavierUnos y ceros. A veces, en el orden adecuado.-Xvhttp://www.blogger.com/profile/12954073038736466058noreply@blogger.comBlogger4125tag:blogger.com,1999:blog-9115644605833384138.post-56874112632067671062007-09-22T11:21:00.000+01:002007-09-22T10:58:04.407+01:00XUL templates and tabs<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.xulplanet.com/"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://www.xulplanet.com/images/xulplanet.png" alt="" border="0" /></a><br />I had some problems using <a href="http://www.xulplanet.com/tutorials/xultu/templates.html">XUL templates</a> to populate <a href="http://www.xulplanet.com/tutorials/xultu/tabpanel.html">a tabbox</a> using a RDF data source: the tabs were created, but switching tabs did not work. Avoiding the use of inline templates and <a href="http://www.xulplanet.com/ndeakin/archive/2003/10/1/">moving the template outside of the tabbox element</a> solved this. Looks like the tabbox was confused by the <tabs> and <tabpanels> elements inside the <template> node.<br /><div style="overflow:scroll"><pre><code><br /><template id="tabTemplate"><br /> <tabs><br /> <tab uri="rdf:*" label="rdf:http://multirunner.blah/rdf#name"/><br /> </tabs><br /> <tabpanels><br /> <tabpanel uri="rdf:*"><br /> <label value="rdf:http://multirunner.blah/rdf#name"/><br /> </tabpanel><br /> </tabpanels><br /></template> <br /><tabbox id="rdftabbox" <br /> datasources="rdftabs.rdf" <br /> ref="http://multirunner.blah/tabs" <br /> template="tabTemplate" /> <br /></code></pre></div>-Xvhttp://www.blogger.com/profile/12954073038736466058noreply@blogger.com1tag:blogger.com,1999:blog-9115644605833384138.post-63059799618048678252007-08-04T01:04:00.000+01:002007-08-04T17:55:03.219+01:00SendTo Clipboard coolness (TiddlyWiki links to your files)The SendTo folder is a simple and powerful tool to customize Windows Explorer to simplify some recurring tasks. If you often want to link to files in your PC from your TiddlyWikis, you'll like this hack. It creates two new items in the "Send To" menu:<br /><ul><li><span style="font-family:courier new;">clipboard - file url</span>: Copies to the clipboard the file: url of the file or folder that was showing the "Send To" menu</li><li><span style="font-family:courier new;">clipboard - new tiddler javascript url</span>: Copies to the clipboard a javascript: url that, when pasted into the address bar of a Firefox tab showing a TiddlyWiki, will create a tiddler with the contents of the file that was showing the "Send To" menu<br /></li></ul><br />You can jump and just download and run the thing, <a href="http://xdexavier.googlepages.com/path2twlink.hta">a small .hta file</a>, or take less than three minutes watching it in action in one of the lamest screencasts ever:<br /><object type="application/x-shockwave-flash" data="http://vimeo.com/moogaloop.swf?clip_id=261215&server=vimeo.com&fullscreen=1&show_title=1&show_byline=1&show_portrait=0&color=00ADEF" height="300" width="400"> <param name="quality" value="best"> <param name="allowfullscreen" value="true"> <param name="scale" value="showAll"> <param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=261215&server=vimeo.com&fullscreen=1&show_title=1&show_byline=1&show_portrait=0&color=00ADEF"></object><br /><span style="font-size:78%;"><a href="http://vimeo.com/261215">SendTo Clipboard Screencast</a> from <a href="http://vimeo.com/xdexavier">Xavier Vergés</a> and <a href="http://vimeo.com/">Vimeo</a></span><br /><br /><span style="font-weight: bold;">Using it<br /></span><ul><li>Just download the .hta file and open it. No, wait! Never open .hta files unless you trust its author or you have taken a look at the code.</li><li>Provided that you trust me or that you have checked the code, you can now open it. Maybe a double click will be enough (your Windows associates .hta files to <span style="font-family:courier new;">mshta.exe</span>, a version of IE with high security privileges in your machine). Maybe you need to use the command line and type <span style="font-family:courier new;">mshta path2twlink.hta</span>.</li><li>Follow the simple steps described in the .hta file, and you can start using your new shinny Send To menu items.</li><li>You are expected to edit the file to customize what gets copied into the clipboard. It should be easy. You may get ideas to push the sendto+clipboard+javascript urls concept further; adding them to the tool should not be too hard.</li><li>You are also expected to do some dancing, since this is <a href="http://xdexavier.blogspot.com/2007/08/upcoming-dancelikematthardingware-half.html">DanceLikeMattHardingWare</a>.<br /></li></ul><span style="font-weight: bold;">Lessons learned while hacking<br /></span><ul><li>I initially wanted to use just a .js file. Getting access to the clipboard from a .js file is hard, so I went for an .hta. It turned out to be a good thing, because it ended up providing a way to avoid to the users the trouble of creating the shortcuts by hand and to me the trouble of documenting the recipe.</li><li>The problem of using an .hta file is that I found no way to keep it invisible, that it has an unusual way to receive its params, and that I had to warn you about its dangerousness.</li><li>I think that I've spent more time recording the lousy screencast and comparing video hosting services that coding. The number of times that I rerecorded the #@%! thing will remain undisclosed; I have my pride. Regarding the hosting services, after reading <a href="http://pascal.vanhecke.info/2006/10/31/screencasting-online-video-sharing-sites-compared-2">about</a> <a href="http://209.85.135.104/search?q=cache:a5H_UzfisBsJ:www.gnurou.org/blog/gnurou/2007/07/30/comparing_google_video_vimeo_and_blip_tv&hl=en&amp;amp;amp;amp;amp;amp;amp;amp;amp;ct=clnk&cd=10" title="sorry, cached version">them</a>, I posted the video to <a href="http://video.google.es/videoplay?docid=1620076739328504497">google</a>, <a href="http://blip.tv/file/327653/">blip.tv</a> and <a href="http://www.vimeo.com/261215">vimeo</a>. <del><br />I still have no winner, but google's video quality was awfull, so I had to drop it despite its super cool feature of letting you link to a specific point of the video.</del> <span style="font-weight: bold;">Update</span>: looks like the winner is <a href="http://viddler.com">http://viddler.com</a>: links, comments and tags on specific points of the video, plus the best player of all (in full screen mode, showing the original size, the quality was just perfect): <a href="http://www.viddler.com/explore/xdexavier/videos/1">http://www.viddler.com/explore/xdexavier/videos/1</a><br /></li></ul>-Xvhttp://www.blogger.com/profile/12954073038736466058noreply@blogger.com2tag:blogger.com,1999:blog-9115644605833384138.post-16162012660920317632007-01-09T23:44:00.000+01:002007-01-10T10:35:10.857+01:00My browser, my rules, my chrome<span style="font-weight: bold;">Summary:</span> there are times when Firefox security gets in your way. Having a directory where you can place xul, html and scripts to run with chrome privileges enables you to shoot yourself in the foot and to create nice and handy hacks.<br /><br /><span style="font-weight: bold;">The itch that called for scratching:</span> I wanted to hack something to let me upload several files at once to <a href="http://googlepages.com/">googlepages</a> [1]. The problem is that, for very good reasons, you can not use JavaScript to change the value of input fields of type file: you usualy don't want scripts reading files in your disk. So, a bookmarklet, that to the browser looks as if it were part of the page, wouldn't cut it. Greasemonkey userscripts do <a href="http://diveintogreasemonkey.org/etech2006/#slide31">run sandboxed, but not under chrome privilege</a> [2], so I did not try that. I tried to give the page <a href="http://citebite.com/q6m6j4u5uvqh">UniversalFileRead privilege</a> [3][4], but failed.<br /><br /><span style="font-weight: bold;">A chrome folder.</span> From <a href="http://xulblog.de/xul/archives/7-Under-chromes-influence.html">Under chrome's influence</a>, slightly modified,<br /><blockquote><br />In the browser's installation directory, create a new file <code>chrome/mychrome.manifest</code> and put a single line into it:<br /><pre>content mychrome file:///D:/whatever/mychrome/<br /></pre>Note that the trailing slash is significant. Then create the file <code>D:\whatever\mychrome\hello.txt</code> and add some text:<br /><pre>hello world!<br /></pre>After a complete restart of your browser, you can open that file using <code>chrome://mychrome/content/hello.txt</code>.<br /></blockquote>You need to keep in mind that chrome is catched, so you may not see the changes you make immediately. Setting <a href="http://kb.mozillazine.org/Nglayout.debug.disable_xul_cache"><code>nglayout.debug.disable_xul_cache</code></a> to <code>true</code> [5] or the <a href="http://ted.mielczarek.org/code/mozilla/extensiondev/">Extension Developer's Extension</a> ability to reload chrome without restarting the browser are helpful here.<br /><br /><span style="font-weight: bold;">Future plans:</span><br /><ul><li>the bulk upload to googlepages is working nicely; needs some docu before uploading it.</li><li>I want to have a browser window with chrome privileges so that I can have more freedom of what I can do with some file: urls. Specifically<br /></li><ul><li>have known tiddlywikis granted <code>UniversalXPConnect</code> privilege <a href="http://groups-beta.google.com/group/TiddlyWikiDev/browse_frm/thread/5a8ddb015a6e738/97a25887d760a7d3?hl=en#97a25887d760a7d3">without having to grant it to everything from file:</a> and without having to mess with the <code>capability.principal.codebase</code> annoyance.</li><li>have local files use a script loaded from the web, or have a remote file load a script from my disk, so that I don't have to upload files while writing/debugging javascript.<br /></li></ul></ul><span style="font-weight: bold;">Footnotes:</span><br /><span style="font-size:85%;"><span style="font-weight: bold;">[1]</span> googlepages: yeah, I know, I'm cheap!<br /><span style="font-weight: bold;">[2]</span> Mark Pilgrim's slides on sandboxing greasemonkey have a wonderful <a href="http://diveintogreasemonkey.org/etech2006/#slide10">"how to become an expert" detour</a>. Don't miss it.<br />And, just in case you are a powerpoint author, consider <a href="http://meyerweb.com/eric/tools/s5/">S5</a> (a Simple Standards-Based Slide Show System), the tool used for Mark's slides.<br /><span style="font-weight: bold;">[3]</span> UniversalFileRead: I added to my <a href="http://kb.mozillazine.org/User.js_file">user.js</a><br /><pre>user_pref("capability.principal.codebase.googlepages1.granted", "UniversalFileRead");<br />user_pref("capability.principal.codebase.googlepages1.id", "http://pages.google.com/");<br /></pre>but still got a security exception.<br /><span style="font-weight: bold;">[4]</span> Highlighted link thanks to <a href="http://citebite.com/">http://citebite.com</a>.<br /><span style="font-weight: bold;">[5]</span> <code>nglayout.debug.disable_xul_cache</code>: I haven't tried it. As I write this,I realize that my <code>user.js</code> sets it to <code>true</code> while my <code>prefs.js</code> ignores it and keeps it to <code>false</code>. <del>I'm clueless here.</del> <span style="font-weight: bold;">Update:</span> A ";" was missing at the end of its user_pref line. Life is much better with this setting enabled!<br /></span>-Xvhttp://www.blogger.com/profile/12954073038736466058noreply@blogger.com2tag:blogger.com,1999:blog-9115644605833384138.post-52376862091731804912006-12-05T00:50:00.000+01:002006-12-05T00:54:27.726+01:00dW chats: Making the move to AjaxIBM Rational's <a href="http://www-03.ibm.com/developerworks/blogs/page/BillHiggins">Bill Higgins</a> will be the moderator of a <a href="http://www-03.ibm.com/developerworks/blogs/page/BillHiggins?entry=ajax_chat_with_me_wed">developerWorks chat on Ajax</a>. to be held on Wednesday December 6th at <a href="http://www.timeanddate.com/worldclock/fixedtime.html?month=12&day=6&amp;amp;year=2006&hour=13&min=0&sec=0&p1=179">1pm his time or 7pm my time</a>. I was not aware of these dW chats going on (this is the second one, <a href="http://www-128.ibm.com/developerworks/java/chat/glover.html">as far as I've seen</a>).-Xvhttp://www.blogger.com/profile/12954073038736466058noreply@blogger.com0