Translator

Visualizzazione post con etichetta alternative. Mostra tutti i post
Visualizzazione post con etichetta alternative. Mostra tutti i post

2010-08-21

Aptana (and Eclipse?) upload_current_file_on_save.js adapted

I'm just getting familiar with Aptana (a variation of the Eclipse IDE) for PHP development and I got really intrigued by the Scripts available to run custom macros within Aptana.
One I really wanted to use is "Upload current file on Save", which is coded within the file: upload_current_file_on_save.js

The problem with this file is that it comes disabled. If you get into it you'll see explicit comments that explains it.

Seems it's disabled because it is not "toggleable" like other scripts, so if enabled from within the script code, it would be always enabled in *ANY* Aptana projects, and this could be an undesired feature.
Aptana support staff say to use that script as project-specific script to avoid the previously explained issue.

Being everything scripted in javascript, a language known to me, I've tried to edit the code and obtained (at least in my case) a version of the feature that can be turned on and off just like other scripts.
Of course there could be better ways to fix the script, but I didn't wanted to spend a lot of time with it and got in the following working solution in few minutes, which is ok for me:
upload_current_file_on_save_dubrox.js

Feel free to use this script if you like. And in case you do anything better, then please comment this post with a link to your solution :)

2010-07-24

Tweetmeme iframe with transparent background

I had to add Tweetmeme button to Aviso Oportuno so that any ad could be promoted thru twitter.


As always, I had problems with IE to display that button correctly using W3C standards. In this particular case I needed the iFrame of the button to be transparent.


Unfortunately Tweetmeme itself is not helping making things easier, but after searching on Google, I found out that IE requires an extra attribute to allow an iFrame to display transparent content: allowTransparency.


The Tweetmeme button is generated by a JavaScript code, so I can't actually hard-code that attribute in the iFrame generated, so the solution is to have another JavaScript piece of code that adds the needed attribute after page loading.


To avoid too many explanations, you could simply grab this piece of code and past within the <head></head> tags in your html page:

<!--[if IE]>
<script type="text/javascript">
var previousOnload = window.onload;
window.onload = function() {
var theframes = document.getElementsByTagName('iframe');
for(var i = 0; i < theframes.length; i++) {
theframes[i].setAttribute("allowTransparency","true");
}
setTimeout("if(previousOnload) previousOnload();", 1000);
}
</script>
<![endif]-->

The "previousOnload" stuff it is there to avoid overwriting any other onload function previously declared. In fact, if there is one, it is executed one second (1k miliseconds) after this "iFrame hack".


One last tip: allowTransparency literally allows the iFrame to display transparent content, but doesn't make the content transparent if it is declared to be opaque. This means that the background color of the html and body tags in the iframed page, must be declared as transparent (or at least you should not declare any backgrounds for those elements, so it will be defaulted as transparent).


Hope it helps.

2008-02-08

La guida per usare open office in italiano

Ecco qua un incentivo per passare a software gratuito e aperto.
Vabé, io il video lo avrei fatto meglio (naturalmente :P) ma dato che non ho tempo intanto ci si accontenta ^_^