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.comBlogger3125tag: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-70210677744317020972007-08-06T16:30:00.000+01:002007-09-22T10:53:09.140+01:00XUL persist annoyancesXUL Elements have <a href="http://www.xulplanet.com/references/elemref/ref_XULElement.html#attr_persist">a persist attribute</a>, that is documented as<blockquote>A space separated list of attributes that are maintained when the window is closed. When the window is re-opened, the values of persistent attributes are restored. In Mozilla, persistent attributes are stored in the per-profile file localstore.rdf. Persistence can also be stored using the document.persist function. In order for persistence to work, the element must also have an id.</blockquote> I've learned some things about it today:<br /><ul><li>It does not seem to work for the "value" attribute of "textarea" elements</li><li>It is stored as <a href="http://www.xulplanet.com/tutorials/mozsdk/rdfstart.php">RDF</a><br /></li><li>It asks for some quite verbose code if you need to access to it<br /></li></ul><div style="overflow:scroll"><pre><code><br />var rdfService = Components.classes["@mozilla.org/rdf/rdf-service;1"].<br /> getService(Components.interfaces.nsIRDFService);<br />var rdfLocalStoreDS = Components.classes["@mozilla.org/rdf/datasource;1?name=local-store"].<br /> getService(Components.interfaces.nsIRDFDataSource);<br />var rdfRes = rdfService.GetResource("uri of interest after about in localstore.rdf");<br />var screenXRes = rdfService.GetResource("screenX");<br />var screenYRes = rdfService.GetResource("screenY");<br /><br />if (rdfLocalStoreDS.hasArcOut(rdfRes, screenXRes) &&<br />rdfLocalStoreDS.hasArcOut(rdfRes, screenYRes)) {<br />var screenX = rdfLocalStoreDS.GetTarget(rdfRes, screenXRes, true).<br /> QueryInterface(Components.interfaces.nsIRDFLiteral)<br />var screenY = rdfLocalStoreDS.GetTarget(rdfRes, screenYRes, true).<br /> QueryInterface(Components.interfaces.nsIRDFLiteral)<br />window.moveTo(screenX.Value, screenY.Value);<br /></code></pre></div>I failed to call <code>QueryInterface(Components.interfaces.nsIRDFLiteral)</code> for quite a while of wasted time. In <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=391044#c2">another piece of code that I wrote</a>, this was magically called for me by checking <code>if (target instanceof Components.interfaces.nsIRDFLiteral);</code> I need to get a better understanding of Mozilla's component model mechanisms... I also failed to use "Value" with a capital letter, to add up to the waste. :-(-Xvhttp://www.blogger.com/profile/12954073038736466058noreply@blogger.com0tag:blogger.com,1999:blog-9115644605833384138.post-21016931960263236652007-01-10T14:23:00.000+01:002007-10-06T09:38:43.777+01:00Bulk upload to googlepagesA <a href="http://xdexavier.googlepages.com/uploadHowTo.html">tool for batch uploads to googlepages</a>, as anticipated in an <a href="http://xdexavier.blogspot.com/2007/01/my-browser-my-rules-my-chrome.html">earlier post</a>.-Xvhttp://www.blogger.com/profile/12954073038736466058noreply@blogger.com1