July 8, 2009 at 16:47
· Filed under Browsers, Science
I’ve been using MathML for a while now for some of my documentation work on 3D graphics. Unfortunately the only way at the moment is to use XHTML 1.1 modular doctype to include either or both of MathML and SVG. In HTML 5 these have become embedded content parts of the specification. So for example, using MathML would be as simple as doing:
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>MathML test</title>
</head>
<body>
<math>
<mrow>
<mi>y</mi>
<mo>=</mo>
<msup>
<mi>x</mi>
<mn>2</mn>
</msup>
</mrow>
</math>
</body>
</html>
Unfortunately the only browser to support either MathML or (parts of) HTML 5 at this moment is Firefox 3.5. However, the MathML or SVG embedded content did not render under 3.5. After reading John Resig’s post about a new HTML parsing engine in Mozilla’s Gecko engine I set out to test this engine’s support by downloading the latest nightly and setting html5.enable to true in about:config and ‘lo and behold, it renders as expected.
Tags:
firefox,
html,
html5,
mathml,
svg,
xhtml
Permalink
June 29, 2009 at 14:54
· Filed under Browsers, Science
I discovered FireMath today, an addon for Firefox that makes editing MathML much, much easier. Give it a spin. I just wish more browsers than Firefox supported MathML out of the box.
Tags:
chrome,
firefox,
firemath,
ie,
mathml,
opera,
safari
Permalink
April 3, 2009 at 15:07
· Filed under Browsers, Programming, Python, Security
So I had implemented a simple JSON data server with Werkzeug for a classroom experiment. Unfortunately in my haste to get everything up and running I totally forgot about the fact that, since we cannot allow uploads to this server of various custom made webpages, using jQuery’s $.ajax() everything just fails since it will then be a cross-site scripting request.
So, normally you would do something like the following in order to return JSON data:
Which would be used with the $.ajax() call in a way like the following:
$.ajax({
type: "POST",
url: "http://example.com/json/something",
data: "parameter=value",
dataType: "json",
error: function(XMLHttpRequest, textStatus, errorThrown){},
success: function(data, msg){}
});
Which is perfectly fine for scripts getting and using the data on the same host/domain. But, as said before, this will fail with warnings similar to: "Access to restricted URI denied" code: "1012" nsresult: "0xdeadc0de (NS_ERROR_DOM_BAD_URI)".
One way out of this is using JSONP. jQuery has a $.getJSON() function, which loads JSON data using a HTTP GET request. Now, the simplistic way to convert your code would be to change it as such:
$.getJSON("http://example.com/json/something",
function(data){}
);
But this causes another issue. Since $.getJSON() GETs the JSON data, but doesn’t use eval() on it, but instead pulls the result into script tags, it somehow causes,on Firefox at least, an invalid label error. In order to fix this you need to set up the JSON data server to properly support a callback argument, to use $.getJSON() how it is meant to be used:
$.getJSON("http://example.com/json/something?jsoncallback=?",
function(data){}
);
In the code above the additional parameter jsoncallback will, thanks to jQuery, get the question mark replaced by an alphanumeric string (typically in the form of jsonp followed by a timestamp). This value should be used to wrap the resulting JSON data with. This means you would have to change the initial Python code to something like this:
return request.args.get('jsoncallback') + '(' + json.dumps(data) + ')'
Of course this causes problems when you want to reuse the code for both AJAX use on the same host/domain and use it from outside. So in order to make both work you can test on whether or not the callback parameter is available and return the appropriate data. I came up with this little snippet for that:
def jsonwrapper(self, request, data):
callback = request.args.get('jsoncallback')
if callback:
return callback + '(' + json.dumps(data) + ')'
else:
return json.dumps(data)
Tags:
ajax,
jquery,
json,
jsonp,
Python,
werkzeug
Permalink
February 25, 2009 at 13:49
· Filed under Browsers, Operating Systems, Programming
As I said in http://www.in-nomine.org/2009/02/22/tinymce-in-wordpress-271-not-working-on-freebsd/ I had problems making TinyMCE work.
After some digging I discovered that the tiny_mce.js file was being oddly truncated and repeated when fetched. Subsequent tests showed that md5 hashes differed every single time with the original file.
During these fetch tests my kernel crashed twice in the network stack. Since my lighttpd configuration uses kqueue and the likes I suspected that perhaps something was not right in lighttpd 1.4.21, which was only released a couple of days ago. So I downgraded to 1.4.20. ‘Lo and behold, the problems disappeared. To be absolutely sure, I recompiled lighttpd 1.4.21 as well. And at first it seemed to work, but then the corruption kicked in again. After talking about it on the #lighttpd channel on FreeNode I found out it was a problem with lighttpd 1.4.21’s handling of sendfile() on FreeBSD.
The fix is now also in the lighttpd port of FreeBSD, so other people should not encounter this problem.
Tags:
bug,
freebsd,
lighttpd,
sendfile,
wordpress
Permalink
February 22, 2009 at 13:44
· Filed under Browsers, Operating Systems, Programming
Discovered today that with both Firefox 3.0 and Opera 9.63 on FreeBSD, TinyMCE within Wordpress 2.7.1 is not allowing me to use the visual editing mode. I tried the example of TinyMCE and it works without problems. Based on this and the fact it works on Windows, there must be something weird in either Wordpress or its included version of TinyMCE with FreeBSD. I logged a post over at the Wordpress forums.
Tags:
firefox,
freebsd,
opera,
tinymce,
wordpress
Permalink
February 22, 2009 at 13:27
· Filed under Browsers, Operating Systems, Research
For a while now I have been using Zotero on Firefox to handle researching topics. It also allows PDF indexing, but for this you need to set some things up first. Start by installing xpdf from ports, it’s located under graphics/xpdf. This will install pdfinfo and pdftotext amongst others. Next go to your Zotero data directory, by default this is the zotero directory under your profile directory in $HOME/.mozilla/firefox, and create two symbolic links pdfinfo-`uname -s`-`uname -m` and pdftotext-`uname -s`-`uname -m` which will point to /usr/local/bin/pdfinfo and /usr/local/bin/pdftotext, respectively.
Now, when you restart Firefox, Zotero should be able to pick up the files. Check by going into Zotero’s preferences and navigate to the Search tab. It should state something to the effect of pdftotext version UNKNOWN is installed.
Tags:
firefox,
freebsd,
indexing,
pdf,
zotero
Permalink
February 16, 2009 at 12:15
· Filed under Browsers, Email, Languages, Operating Systems
I use mutt on my FreeBSD system to read my mail. To read HTML mail I simply use a .mailcap file with an entry such as
text/html; w3m -dump %s; nametemplate=%s.html; copiousoutput
This in effect dumps the HTML using w3m to a text file in order to safely display it. The problem that I had is that, because some emails that I receive are from a Japanese translators list, they are in Shift_JIS. When dumped w3m doesn’t properly detect the Shift_JIS encoding and as such the resulting output becomes garbled.
When I looked at the attachments in the mail with mutt’s ‘v’ command I saw that mutt at least knows the encoding of the attachment, so I figured that there should be a way of using this information with my mailcap. Turns out that there is indeed a way to do so, namely the charset variable. It turns out the mailcap format is a full RFC. RFC 1524 to be exact. Mutt furthermore uses the Content-Type headers to pull any specific settings into mailcap variables. So a Content-Type: text/html; charset=shift_jis means that %{charset} in the mailcap file will be expanded to shift_jis. We can use this with w3m’s -I flag to set a proper encoding prior to dumping.
text/html; w3m -I %{charset} -dump %s; nametemplate=%s.html; copiousoutput
As such you can be relatively sure that the dumped text will be in the appropriate encoding. Of course it depends on a properly set Content-Type header, but if you cannot depend on that one you need to dig out the recovery tools already.
Tags:
encoding,
freebsd,
japanese,
mailcap,
mutt,
shift_jis,
sjis,
utf-8,
w3m
Permalink
May 7, 2008 at 22:18
· Filed under Browsers, Weblog
The website should now look a bit better again, especially on the reading side.
Tags:
css
Permalink
April 9, 2008 at 13:39
· Filed under Browsers, Email
For those of you using Thunderbird and want a calendaring option inside of Thunderbird to communicate properly with people using Outlook or Lotus Notes that send you invitations for meetings and the like: Mozilla’s Lightning is now at version 0.8. Lightning is an add-on for Thunderbird based on Sunbird.
If you then also use the Provider for Google Calendar you can synchronise your Google Calendar with your Lightning setup.
Tags:
calendar,
google,
lightning,
thunderbird
Permalink
December 13, 2007 at 12:30
· Filed under Browsers
An acquaintance of mine who works for Opera forwarded me a link to an Opera press release today. In this press release we find that yesterday, Wednesday the 12th, 2007, Opera filed an anti-trust claim with the European Union against Microsoft. In this claim Opera describes:
“[...] how Microsoft is abusing its dominant position by tying its browser, Internet Explorer, to the Windows operating system and by hindering interoperability by not following accepted Web standards. Opera has requested the Commission to take the necessary actions to compel Microsoft to give consumers a real choice and to support open Web standards in Internet Explorer.”
“Opera requests the Commission to implement two remedies to Microsoft’s abusive actions. First, it requests the Commission to obligate Microsoft to unbundle Internet Explorer from Windows and/or carry alternative browsers pre-installed on the desktop. Second, it asks the European Commission to require Microsoft to follow fundamental and open Web standards accepted by the Web-authoring communities. The complaint calls on Microsoft to adhere to its own public pronouncements to support these standards, instead of stifling them with its notorious “Embrace, Extend and Extinguish” strategy. Microsoft’s unilateral control over standards in some markets creates a de facto standard that is more costly to support, harder to maintain, and technologically inferior and that can even expose users to security risks.”
The funny thing is that Apple bundles Safari with Mac OS X and no one complains about that. I think that’s mainly because the Apple guys are working hard to ensure it supports the standards well. So from the two points above in the Opera press release I find the requirement for Microsoft to follow the standards the most important.
Tags:
internet,
internet explorer,
opera,
safari
Permalink