Default Apache2 installation in Snow Leopard shows this error when you try to start:
/usr/sbin/apachectl: line 82: ulimit: open files: cannot modify limit: Invalid argument
This error is caused by:
ULIMIT_MAX_FILES="ulimit -S -n `ulimit -H -n`"
In /usr/sbin/apachectl file.
You can fix it changing the line to this one:
ULIMIT_MAX_FILES="ulimit -S -n"
Hu-ha!
Still not ready for HTML5?
Here is a new round of HTML5 support test. All browsers (and OS) updated except for Safari:
Total points has been raised to 400 instead of 300.
Tests with Ubuntu 11.04 and Snow Leopard.
I know Safari has a better support of HTML5 in newer versions, Can anyone send a test? Thanks in advance.
Check yourself at: http://html5test.com/
First test: http://okham.blogspot.com/2010/09/are-you-ready-for-html5.html
- Chromium [110.696]: 278 + 13 / 400
- Opera [11.10]: 258 + 7 / 400
- Safari [5.0.2]: 228 +7 / 400
- Firefox [4.0.1]: 240 +9 / 400
Total points has been raised to 400 instead of 300.
Tests with Ubuntu 11.04 and Snow Leopard.
I know Safari has a better support of HTML5 in newer versions, Can anyone send a test? Thanks in advance.
Check yourself at: http://html5test.com/
First test: http://okham.blogspot.com/2010/09/are-you-ready-for-html5.html
How to change GDM theme without extra tools
An easy way to change GDM's theme is putting gnome-appearance-properties.desktop as an autostart app:
sudo cp /usr/share/applications/gnome-appearance-properties.desktop /usr/share/gdm/autostart/LoginWindow/
After this move to System > Close session > Change user.
Select a new theme. Log in again and remove gnome-appearance-properties from autostart apps:
sudo rm /usr/share/gdm/autostart/LoginWindow/gnome-appearance-properties.desktop
Good luck.
sudo cp /usr/share/applications/gnome-appearance-properties.desktop /usr/share/gdm/autostart/LoginWindow/
After this move to System > Close session > Change user.
Select a new theme. Log in again and remove gnome-appearance-properties from autostart apps:
sudo rm /usr/share/gdm/autostart/LoginWindow/gnome-appearance-properties.desktop
Good luck.
Adding RSS/microblogging to a webpage
This is a snippet from a future version of Hispavox/Vikuit.
Step one: Import jquery.min.js (tested on 1.5.0) and microblogging.js (reduced version, to check a full version visit vikuit):
Step two: Add a div to your page:
Step three: Create an instance of microblogging:
And a possible result is here (depends on your CSS):
Vikuit is a Social app developed with Python, Django, Jinja2 and AppEngine.
And Hispavox is...umm wait, visit and you'll see.
Step one: Import jquery.min.js (tested on 1.5.0) and microblogging.js (reduced version, to check a full version visit vikuit):
(function($){
var maxItems=0;
var labelComment = 'Comments';
var labelBy = 'By';
var labelRead = 'Read more';
var current = "";
var standard = true;
$.fn.microblogging = function(j){
var k=$.extend({
targeturl:"http://www.hispavox.org/",
loadingImg:'/static/images/throbber.gif',
maxItems:1,
standard:true,
current:"",
labelComment:'Comments',
labelBy:'By',
labelRead:'Read more'},j);
if(!j.targeturl)
return false;
var l=$.extend(k,j);
var n="xml";
var divid=guid();
this.append('<div id="'+divid+'newsfeed"><div class="atomloader" style="position:absolute;text-align:center;z-index:99;"><img src="'+l.loadingImg+'"/></div></div>');
$('#'+divid+'newsfeed .atomloader').width(this.width());
$('#'+divid+'newsfeed .atomloader').height(this.height());
$('#'+divid+'newsfeed .atomloader img').height(this.height()/4);
var toplocal=(this.height()/2)-($('#'+divid+'newsfeed .atomloader img').height()/2)
$('#'+divid+'newsfeed .atomloader img').css('margin-top',toplocal+'px');
var path=l.targeturl;
maxItems=l.maxItems;
standard = l.standard;
labelComment = l.labelComment;
labelBy = l.labelBy;
labelRead = l.labelRead;
current = l.current;
requestRSS(path,function(results){
$('#'+divid+'newsfeed').append(results);
$('#'+divid+'newsfeed .atomloader').remove();
});
};
function S4(){
return(((1+Math.random())*0x10000)|0).toString(16).substring(1);
}
function guid(){
return(S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
}
function requestRSS(site,callback){
if(!site){
alert('No site was passed.');
return false;
}
new Ajax.Request(site, {
method: 'get',
parameters: "",
onSuccess: cbFunc,
onFailure: function() {
alert(' There was an error :(');
}
});
function cbFunc(data){
if(window.DOMParser){
parser=new DOMParser();
xmlDoc=parser.parseFromString(data.responseText,"text/xml");
} else {
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async="false";
xmlDoc.loadXML(data.responseText);
}
var items =xmlDoc.getElementsByTagName("item");
if(items[0]){
var datalength=items.length;
if(datalength>maxItems){
datalength=maxItems
};
var i;
var feedHTML="";
for(i=0;i<datalength;i++) {
var author = items[i].getElementsByTagName("author")[0].childNodes[0].nodeValue;
feedHTML=feedHTML+"<div class='entry'>"
feedHTML+="<div class='title'>"+items[i].getElementsByTagName("title")[0].childNodes[0].nodeValue+"</div>";
try {
feedHTML+="<div>"+labelBy+": <span class='author'>"+author +"</span>"
feedHTML += "</div>";
} catch(e) {}
try {
var pub = new Date(items[i].getElementsByTagName("pubDate")[0].childNodes[0].nodeValue);
feedHTML+="<div class='date'>"+ pub.toLocaleDateString()+" "+pub.toLocaleTimeString()+"</div>"
} catch(e) {}
feedHTML+="</div>";
}
if(typeof callback==='function'){
callback(feedHTML);
}
} else throw new Error('Nothing returned from getJSON.');
}
}//RSS
})(jQuery);
Step two: Add a div to your page:
<div id="littleRss"></div>Step three: Create an instance of microblogging:
<script>
function loadLittleRss() {
document.getElementById('littleRss').innerHTML = "";
$('#littleRss').microblogging({
targeturl: "/feed/mblog",
maxItems:5,
standard:false,
labelComments: "Comments",
labelBy: "Written by"
});
}
loadLittleRss();
</script>And a possible result is here (depends on your CSS):
Vikuit is a Social app developed with Python, Django, Jinja2 and AppEngine.
And Hispavox is...umm wait, visit and you'll see.
Snippet: validating xml with xsd in Java
import java.io.Reader;
import java.io.StringReader;
import javax.xml.XMLConstants;
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;
import org.springframework.core.io.ClassPathResource;
import org.testng.Assert;
import org.testng.annotations.Test;
import org.xml.sax.SAXException;
....
String xmlFormated = "
SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
ClassPathResource cpr = new ClassPathResource("my_xsd_file.xsd");
Source schemaFile = new StreamSource( cpr.getFile() );
Schema schema = factory.newSchema(schemaFile);
Validator validator = schema.newValidator();
Reader reader = new StringReader(xmlFormated);
Source source = new StreamSource(reader);
try {
validator.validate(source);
} catch (SAXException e) {
log.error(e);
}
...
How to see maven modules as projects in Eclipse Package Explorer
When a user, not project's creator, downloads a maven project with modules inside. He/She sees a project that contains all modules. To get all modules as projects you can follow these tutorial:
1.- Download parent project
2.- On File menu, select import > Maven > Existing Maven Projects
3.- Push next
4.- Browse to downloaded project in Root Directory select list.
5.- Check pom.xml files listed below
6.- Push Finish
Now you can see the parent maven project and all modules as projects. All modules are synchronized with parent project.
1.- Download parent project
2.- On File menu, select import > Maven > Existing Maven Projects
3.- Push next
4.- Browse to downloaded project in Root Directory select list.
5.- Check pom.xml files listed below
6.- Push Finish
Now you can see the parent maven project and all modules as projects. All modules are synchronized with parent project.
Jasypt: Encryption on Java
Jasypt is a java library which allows the developer to add basic encryption capabilities to his/her projects with minimum effort, and without the need of having deep knowledge on how cryptography works.
Copied from: http://www.jasypt.org
Adrià, I hope this help you in near future. And is Licensed under Apache Software License.
- High-security, standards-based encryption techniques, both for unidirectional and bidirectional encryption. Encrypt passwords, texts, numbers, binaries...
- Transparent integration with Hibernate.
- Suitable for integration into Spring-based applications and also transparently integrable with Spring Security.
- Integrated capabilities for encrypting the configuration of applications (i.e. datasources).
- Specific features for high-performance encryption in multi-processor/multi-core systems.
- Open API for use with any JCE provider.
Copied from: http://www.jasypt.org
Adrià, I hope this help you in near future. And is Licensed under Apache Software License.
Changing Admin user in Alfresco 3.2 +...
...when you have no other administrator.
This is one of the ways to change Alfresco administrator, but there are another using groups.
This is one of the ways to change Alfresco administrator, but there are another using groups.
Locate tomcat/shared/classes/ alfresco/alfresco-global. properties
Add this property:
alfresco_user_store. adminusername=admin
And replace admin identifier by other user identifier.
Reboot Alfresco and login with new "admin" user.
How to transform all docs to PDF/A-1 format in Alfresco
Look for alfresco\WEB-INF\classes\alfresco\mimetype\openoffice-document-formats.xml file.
<document-format>
<name>Portable Document Format</name>
<mime-type>application/pdf</mime-type>
<file-extension>pdf</file-extension>
<export-filters>
<entry>
<family>Presentation</family>
<string>impress_pdf_Export</string>
</entry>
<entry>
<family>Spreadsheet</family>
<string>calc_pdf_Export</string>
</entry>
<entry>
<family>Text</family>
<string>writer_pdf_Export</string>
</entry>
</export-filters>
<!-- ADDED TO TRANSFORM TO PDF/A-1 -->
<export-options>
<entry>
<string>SelectPdfVersion</string>
<int>1</int>
</entry>
</export-options>
<!-- ADDED TO TRANSFORM TO PDF/A-1 -->
</document-format>
With this change, all transformation to PDF will be exported to format PDF/A-1.
Thanks to: http://forums.alfresco.com/en/viewtopic.php?t=6336
OpenOffice Parameters: http://wiki.services.openoffice.org/wiki/API/Tutorials/PDF_export
<document-format>
<name>Portable Document Format</name>
<mime-type>application/pdf</mime-type>
<file-extension>pdf</file-extension>
<export-filters>
<entry>
<family>Presentation</family>
<string>impress_pdf_Export</string>
</entry>
<entry>
<family>Spreadsheet</family>
<string>calc_pdf_Export</string>
</entry>
<entry>
<family>Text</family>
<string>writer_pdf_Export</string>
</entry>
</export-filters>
<!-- ADDED TO TRANSFORM TO PDF/A-1 -->
<export-options>
<entry>
<string>SelectPdfVersion</string>
<int>1</int>
</entry>
</export-options>
<!-- ADDED TO TRANSFORM TO PDF/A-1 -->
</document-format>
With this change, all transformation to PDF will be exported to format PDF/A-1.
Thanks to: http://forums.alfresco.com/en/viewtopic.php?t=6336
OpenOffice Parameters: http://wiki.services.openoffice.org/wiki/API/Tutorials/PDF_export
How to move window buttons to right side in Gnome
Open Configuration Editor (Alt+F2 and type in gconf-editor) and navigate to apps>metacity>general.
Look for button_layout on the right hand pane and edit it.
Look for button_layout on the right hand pane and edit it.
menu:minimize,maximize,close
Now buttons must be on right side
How to add twitter to a web page
First of all, we don't need a Twitter account to use widget in a page.
1.- Go to www.twitter.com
2.- At the bottom of the page press extras
3.- Select widgets
4.- Select My web
5.- Select 'Profile Widget'
6.- Introduce a profile and check configuration
7.- Copy and paste the code in your page:
PD: This post is a gift for my friend Juan Carlos ( a twitter addict ).
OpenSolaris, Postgresql, OpenOffice... what's next OpenJDK? (updated: Oracle + IBM)
"Is it time to consider replacing Java? Java pundit and former Editor-in-Chief of TheServerSide.com, Joseph Ottinger, steps into the fray by proposing some options, alternatives, and more to the point, a reality check."
http://www.theserverside.com/news/thread.tss?thread_id=61039
Update:
Oracle and IBM Collaborate to Accelerate Java Innovation Through OpenJDK
http://www.oracle.com/us/corporate/press/176988
Update:
Oracle and IBM Collaborate to Accelerate Java Innovation Through OpenJDK
http://www.oracle.com/us/corporate/press/176988
How to enable full repository access on Alfresco Share
In a tomcat installation, edit tomcat/shared/classes/alfresco/web-extension/share-config-custom.xml file.
Look for RepositoryLibrary condition:
<config evaluator="string-compare" condition="RepositoryLibrary" replace="true">
<!--
Whether the link to the Repository Library appears in the header component or not.
-->
<visible>false</visible>
<!--
Root nodeRef for top-level folder.
-->
<root-node>alfresco://company/home</root-node>
<!--
Whether the folder Tree component should enumerate child folders or not.
This is a relatively expensive operation, so should be set to "false" for Repositories with broad folder structures.
-->
<tree>
<evaluate-child-folders>false</evaluate-child-folders>
</tree>
</config>
And modify visibility to true:
<visible>true</visible>
This works on Alfresco Enterprise 3.2R and above.
Look for RepositoryLibrary condition:
<config evaluator="string-compare" condition="RepositoryLibrary" replace="true">
<!--
Whether the link to the Repository Library appears in the header component or not.
-->
<visible>false</visible>
<!--
Root nodeRef for top-level folder.
-->
<root-node>alfresco://company/home</root-node>
<!--
Whether the folder Tree component should enumerate child folders or not.
This is a relatively expensive operation, so should be set to "false" for Repositories with broad folder structures.
-->
<tree>
<evaluate-child-folders>false</evaluate-child-folders>
</tree>
</config>
And modify visibility to true:
<visible>true</visible>
This works on Alfresco Enterprise 3.2R and above.
Are you ready for HTML5?
Here are results of browsers installed in my computer:
- Opera 10.70: 159 / 300 + 7 bonus points - 3rd - Opera can do it better
- Firefox 3.6.10: 139 / 300 + 4 bonus points - 4th - Mozilla where are you?
All test over Ubuntu linux 10.04
- Safari 5.0.1: 208 / 300 + 7 - hu-ha!! 2nd !!
Tested over MacOS X Snow Leopard (Ok, it's no my computer)
Check yourself at: http://html5test.com/
All test contain a detailed section explaining which points must improve.
What about IE8 / Windows7 ?
How to know your most used commands
There is an easy way to know how you spend your time on linux terminal:
history | awk '{print $2}' | sort | uniq -c | sort -rn | head -10
In my entries Alfresco appears on top 5. I think i need a shortcut.
Java Architecture for XML Binding
First of all we need to download and install JAXB in your pc. (See below for links)
After install, we can proceed defining a XSD file. An example jb.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:jb="urn:org:jblanco:example:expedient:1.0:schema"
xmlns:cmn="urn:org:jblanco:common:1.0:schema"
targetNamespace="urn:org:jblanco:example:expedient:1.0:schema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:annotation>
<xs:documentation xml:lang="en">
Expedient.
</xs:documentation>
</xs:annotation>
<xs:import id="cmn" namespace="urn:org:jblanco:common:1.0:schema" schemaLocation="common.xsd" />
<xs:element name="expediente" type="jb:expedienteType" />
<xs:complexType name="expedienteType">
<xs:complexContent>
<xs:extension base="cmn:generalType" >
<xs:sequence>
<xs:element name="numero_expediente" minOccurs="1" maxOccurs="1" type="xs:string" />
<xs:element name="fecha_apertura" minOccurs="1" maxOccurs="1" type="xs:date" />
<xs:element name="fecha_cierre" minOccurs="1" maxOccurs="1" type="xs:date" />
<xs:element name="volumen" minOccurs="1" maxOccurs="1" type="xs:string" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>
Don't forget namespaces, inheritance... ;)
Finally, execute XJC command to generate java classes:
xjc -p org.jblanco.example.bean jb.xsd
xjc -p <package> xsd_file.xsd
Output:
jblanco@in2:/opt/tmp$ xjc -p org.jblanco.example.bean jb.xsd
parsing a schema...
compiling a schema...
org/jblanco/example/bean/ExpedienteType.java
org/jblanco/example/bean/ObjectFactory.java
org/jblanco/example/bean/package-info.java
To use multiple xsd files add an import, for every xsd you want, in the main file.
Hint:
To create an object with multiple inheritance, we can use group tag. An example:
<xs:complexType name="complex1Type">
<xs:sequence>
<xs:group ref="cmn:metaGrp1Group" />
<xs:group ref="cmn:metaGrp2Group" />
</xs:sequence>
</xs:complexType>
<xs:group name="metaGrp1Group">
<xs:sequence>
<xs:element name="identificador" minOccurs="1" maxOccurs="1" type="xs:string" />
<xs:element name="fecha" minOccurs="1" maxOccurs="1" type="xs:date" />
<xs:group ref="cmn:metaSubgrp1Group" />
</xs:sequence>
</xs:group>
<xs:group name="metaSubgrp1Group">
<xs:sequence>
<xs:element name="nivel" minOccurs="1" maxOccurs="1" type="cmn:nivelType" />
</xs:sequence>
</xs:group>
<xs:group name="metaGrp2Group">
<xs:sequence>
<xs:element name="codigo" type="xs:string" minOccurs="1" maxOccurs="1" />
<xs:element name="serie" type="xs:string" minOccurs="1" maxOccurs="1" />
</xs:sequence>
</xs:group>
<xs:simpleType name="nivelType">
<xs:restriction base="xs:string">
<xs:enumeration value="Unidad" />
<xs:enumeration value="Expediente" />
<xs:enumeration value="Compuesta" />
</xs:restriction>
</xs:simpleType>
Links used in this note:
Some fun: vrms
For those who use linux... test it!
These are my results:
10 non-free packages, 0.7% of 1500 installed packages.
1 contrib packages, 0.1% of 1500 installed packages.
I'm 99,2% OS.
http://es.wikipedia.org/wiki/Vrms
These are my results:
10 non-free packages, 0.7% of 1500 installed packages.
1 contrib packages, 0.1% of 1500 installed packages.
I'm 99,2% OS.
http://es.wikipedia.org/wiki/Vrms
Problema de Compiz con Intel GM965
Una de las sorpresa al actualizar Ubuntu a la versión 9.04 ha sido que los efectos de Compiz han dejado de funcionar.
El problema se produce con la targeta de Intel Corporation Mobile GM965/GL960 Integrated
Graphics Controller y la solución temporal es la siguiente:
Comentar en el archivo /usr/bin/compiz:
# See http://wiki.compiz-fusion.org/Hardware/Blacklist for details
#T=" 1002:5954 1002:5854 1002:5955" # ati rs480
#T="$T 1002:4153" # ATI Rv350
#T="$T 8086:2982 8086:2992 8086:29a2 8086:2a02 8086:2a12" # intel 965
#T="$T 8086:2a02 " # Intel GM965 <<<< t="$T 8086:3577 8086:2562 " blacklist_pciids="$T">
En algunos foros indican que puede bloquear la máquina si usas los efectos al máximo, pero tras un juego de pruebas no he observado ningún problema.
El problema se produce con la targeta de Intel Corporation Mobile GM965/GL960 Integrated
Graphics Controller y la solución temporal es la siguiente:
Comentar en el archivo /usr/bin/compiz:
(code)
# See http://wiki.compiz-fusion.org/Hardware/Blacklist for details
#T=" 1002:5954 1002:5854 1002:5955" # ati rs480
#T="$T 1002:4153" # ATI Rv350
#T="$T 8086:2982 8086:2992 8086:29a2 8086:2a02 8086:2a12" # intel 965
#T="$T 8086:2a02 " # Intel GM965 <<<< t="$T 8086:3577 8086:2562 " blacklist_pciids="$T">
(code)
En algunos foros indican que puede bloquear la máquina si usas los efectos al máximo, pero tras un juego de pruebas no he observado ningún problema.
http://wiki.compiz-fusion.org/Hardware/Blacklist
Suscribirse a:
Entradas (Atom)



