Ubuntu 13.04 : Eclipse is missing software sites
I have just updated my Ubuntu box to the latest release ( 13.04 ) and I found out that not only it had broken all my previous plugins installations, but also that I could not install practically anything : the software sites list was empty !
In order to fix this issue you can either run eclipse as administrator and install every single plugin/extension you need using this method, or keep on reading :)
The solution is actually simple ( once you figured it out ) : add the sites manually !
Go to Window->Preferences, open the tree menu entry Install/Update and click on Available Software. If this panel does not contain at least the following sites you need to add them :
- e4 0.11 Updates : http://download.eclipse.org/e4/updates/0.12
- Juno : http://download.eclipse.org/releases/juno
- The Eclipse Project Updates : http://download.eclipse.org/eclipse/updates/4.2
Also, you are likely to not have the very friendly "Eclipse Marketplace ..." entry under "Help" menu; if this is the case, you only need to install it :
- Open Help->Install New Software ...
- Select --All Available Sites--
- In the filter text box type marketplace
- Select Marketplace Client and install it
That shall be it !
The First Level of Super Mario Bros. is Easy with Lexicographic Orderings and Time Travel... after that it gets a little tricky
In the 28 years since Super Mario Bros. was released, and it's obviously been comprehensively beaten, thoroughly, many thousands of times in that time by players around the world. But have you ever made the game beat itself?
That's what computer scientist Tom Murphy has done. At SigBovik 2013, he presented a program that "solves" how to play Super Mario Bros., or any other NES game, like it's just another kind of mathematical problem. And for those who know that SigBovik is an annual computer science conference dedicated to spoof research, hosted on April 1 every year, Murphy stresses that this is "100 percent real."
He outlines his method in a paper, "The First Level of Super Mario Bros. is Easy with Lexicographic Orderings and Time Travel... after that it gets a little tricky", but he also presented the results in the video you can see with this story.
Fixing Liferay 6.0.6 Diff Plugin
Since Liferay 5 there is a very neat diff plugin that works out of the box in the document library. The plugin permits to compare text files but, provided you have activated the Open Office Integration you can compare other kind of files like .doc, .docx and odt. Unfortunately there's a bug in Liferay 6.0.6 that prevents this from working.
The bug
The bug consists in a "wrong" call in the document library portlet's compare document action : the name in the request is actually the document's id and trying to get the extension of the document results in an empty string .
The solution
The solution is quite simple ... provided you can recompile portal-impl.jar :
in com.liferay.portlet.documentlibrary.action.CompareVersionsAction change
protected void compareVersions(RenderRequest renderRequest)
by adding
String title = ParamUtil.getString(renderRequest, "title");
and changing
String extension = FileUtil.getExtension(name)
into
String extension = FileUtil.getExtension(title);
so that the method will look like :
protected void compareVersions(RenderRequest renderRequest) throws Exception { ThemeDisplay themeDisplay = (ThemeDisplay)renderRequest.getAttribute( WebKeys.THEME_DISPLAY); long companyId = themeDisplay.getCompanyId(); long userId = themeDisplay.getUserId(); long fileEntryId = ParamUtil.getLong(renderRequest, "fileEntryId"); long groupId = themeDisplay.getScopeGroupId(); long folderId = ParamUtil.getLong(renderRequest, "folderId"); String name = ParamUtil.getString(renderRequest, "name"); String title = ParamUtil.getString(renderRequest, "title"); DLFileEntryPermission.check( themeDisplay.getPermissionChecker(), groupId, folderId, name, ActionKeys.VIEW); String extension = FileUtil.getExtension(title); String titleWithExtension = ParamUtil.getString( renderRequest, "titleWithExtension"); String sourceVersion = ParamUtil.getString( renderRequest, "sourceVersion"); String targetVersion = ParamUtil.getString( renderRequest, "targetVersion"); InputStream sourceIs = DLFileEntryLocalServiceUtil.getFileAsStream( companyId, userId, groupId, folderId, name, sourceVersion); InputStream targetIs = DLFileEntryLocalServiceUtil.getFileAsStream( companyId, userId, groupId, folderId, name, targetVersion); if (extension.equals("htm") || extension.equals("html") || extension.equals("xml")) { String escapedSource = HtmlUtil.escape(StringUtil.read(sourceIs)); String escapedTarget = HtmlUtil.escape(StringUtil.read(targetIs)); sourceIs = new UnsyncByteArrayInputStream( escapedSource.getBytes(StringPool.UTF8)); targetIs = new UnsyncByteArrayInputStream( escapedTarget.getBytes(StringPool.UTF8)); } if (PrefsPropsUtil.getBoolean( PropsKeys.OPENOFFICE_SERVER_ENABLED, PropsValues.OPENOFFICE_SERVER_ENABLED) && isConvertBeforeCompare(extension)) { String sourceTempFileId = DocumentConversionUtil.getTempFileId( fileEntryId, sourceVersion); String targetTempFileId = DocumentConversionUtil.getTempFileId( fileEntryId, targetVersion); sourceIs = DocumentConversionUtil.convert( sourceTempFileId, sourceIs, extension, "txt"); targetIs = DocumentConversionUtil.convert( targetTempFileId, targetIs, extension, "txt"); } List<DiffResult>[] diffResults = DiffUtil.diff( new InputStreamReader(sourceIs), new InputStreamReader(targetIs)); renderRequest.setAttribute( WebKeys.SOURCE_NAME, titleWithExtension + StringPool.SPACE + sourceVersion); renderRequest.setAttribute( WebKeys.TARGET_NAME, titleWithExtension + StringPool.SPACE + targetVersion); renderRequest.setAttribute(WebKeys.DIFF_RESULTS, diffResults); }
Alternatively, and if you trust me, you can download a patched Attach:portal-impl.jar from this site. The md5sum f223ae66e1bfb93fb0658e215507e6f5 portal-impl.jar
Hope it helps !
ECryptFs has a home
For the first time in the 7 year history of the project, eCryptfs has it's very own, dedicated home on the web at eCryptfs.org.
eCryptfs.org now serves as the project's official portal to numerous resources, including: information about the project, StackExchange questions and answers, mailing list archives, the Google Plus page, package download links for all major Linux OSes, pointers to the kernel and userspace source code repositories, support resources, documentation, and news.
The kernel sources continue to be hosted on git.kernel.org, and the user space sources and bugs hosted on Launchpad.net. We are now using StackExchange.com for questions and answers rather than Launchpad.
A special thanks goes out to the original authors and developers of eCryptfs in the IBM Linux Technology Center Security Team, the Canonical Kernel and Security Team, Red Hat and beyond, as well as all of the contributors to eCryptfs over the last 7 years. Gazzang commissioned the artwork and web design, and is sponsoring the web hosting of eCryptfs.org as a bit of a "thank you" to the eCryptfs community growing far and wide.
Sources
- Dustin Kirkland's blog
- ecryptfs home page
Liferay 6 : something they don't tell you
Today I just realized that Liferay 6 ships with a new filter and a new servlet ... the problem is that they both map to /documents/* ! The problem is that,if you have little fantasy like I do, you will add your document library portlet ( or document library display portlet ) in a page that maps to /documents ! If that worked up to the previous version (5.2.3) you will find that the new version breaks your installation ( if you have a layout like I did ).
Here's what's in web.xml :
the filter
<filter-mapping> <filter-name>Auto Login Filter</filter-name> <url-pattern>/documents/*</url-pattern> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> </filter-mapping>
and the servlet
<servlet-mapping> <servlet-name>Web Server Servlet</servlet-name> <url-pattern>/documents/*</url-pattern> </servlet-mapping>
my page was ( I'll explain later why the past ) served at http://myserver/documents (obviously this is not the real url) and in that page there was the document library portlet.
When I tried to click on a document the url that was called was http://myhost/documents/-/document_library/view/21794
If we analyze what happens in the servlet container, the filter is fired and then the servlet is fired ( I didn't actually debug/test this but that's what I expected to happen ) then everything should have been sent to the document library portlet and the file should have been served... should
That was not the case and, up to this morning, I had no idea that the problem was the page name. To make a long story short, I tested, instead of using the friendly url 'documents', using the canonical liferay path : http://myhost/web/mycommunity/documents/-/document_library/view/21794 and magically the file was served ! What happened ? As far as I can tell : neither the filter nor the servlet was fired. This, to me, looks like a bug : I asked the liferay forum for a confirmation bofore opening a big report but haven't received any reply up to now.
I have, for the moment, resolved my issue by changing the 'friendly url' from documents to document_library so that now the url is http://myhost/documents_library/-/document_library/view/21794 and everything is back to normal .
If you are willing to test/replicate the issue, please update the liferay forum report so that the staff @liferay can actually be aware of the issue an maybe come up with a better solutio/update of the documentation !
Install ZFS on Debian GNU/Linux
This is a post on installing ZFS as a kernel module, not FUSE, on Debian GNU/Linux. Everything you are reading here already exist for getting this going, I just want to spread the word ... in case you are unaware that it exists.
The Lawrence Livermore National Laboratory has been working on porting the native Solaris ZFS source to the Linux kernel as a kernel module. I believe that as long as the project remains under contract with the DoD there will be continuous updates. You can check what's going on at http://zfsonlinux.org.
On Debian
Step 1 : prepare the directories and download the sources :
mkdir ~/src/{spl,zfs} $ cd ~/src/spl $ wget http://github.com/downloads/zfsonlinux/spl/spl-0.6.0-rc8.tar.gz $ cd ~/src/zfs $ wget http://github.com/downloads/zfsonlinux/zfs/zfs-0.6.0-rc8.tar.gz
Step 2 : install the dependencies for SPL, compile and make debs :
$ sudo aptitude install build-essential gawk alien fakeroot linux-headers-$(uname -r) $ cd ~/src/spl $ tar -xf spl-0.6.0-rc8.tar.gz $ cd spl-0.6.0-rc8 $ ./configure $ make deb
Step 3 : install the dependencies for ZFS, compile and make debs :
$ sudo aptitude install zlib1g-dev uuid-dev libblkid-dev libselinux-dev parted lsscsi $ cd ~/src/zfs $ tar -xf zfs-0.6.0-rc8.tar.gz $ cd zfs-0.6.0-rc8 $ ./configure $ make deb
If everything went fine, you have the deb files ready for install :
$ sudo dpkg -i ~/src/{spl,zfs}/*.deb
On Ubuntu
You can, of course, follow the installation path exposed above or you can simply use this PPA https://launchpad.net/~zfs-native.
Note
The manpages get installed to /share/man/. You can modify your $MANPATH variable to include /share/man/man8/ or create symlinks :
# cd /usr/share/man/man8/ # ln -s /share/man/man8/zdb.8 zdb.8 # ln -s /share/man/man8/zfs.8 zfs.8 # ln -s /share/man/man8/zpool.8 zpool.8
Start playing with it
Now, make your zpool:
$ sudo zpool create test raidz sdd sde sdf sdg sdh sdi
It is stable enough to run a ZFS root filesystem on a GNU/Linux installation for your workstation as something to play around with. It is copy-on-write, supports compression, deduplication, file atomicity, off-disk caching, encryption, and much more.
References :
Aaron Toponce's blog
Postgresql : load csv data
One of the most common action that one has to do with a database is to load data into it. Usually the data comes either in a dump/sql file or in csv format. Today I am going to brag about loading the latter format into a PostgreSQL database. The first thing to keep in mind is that PostgreSQL is able to do it without magic . The second thing to put attention on is which is the user who is connecting to the database to load the data.
The easy pattern : you have superuser privileges
In this scenario, the user is superuser ( postgres ) or is inheriting from the superuser role. If that's the case then all you need to do is open a psql shell and issue the command
copy <table> from <file> with delimiter '<delimiter>' ;
where
- <table> is the name of the table that you want to populate with the data
- <file> is the path to the file that contains your csv data
- <delimiter> is the delimiter used in your csv file to separate the fields ( usually ',' or ';' )
The way you open a connection depends on what you are using : if you are using a gui ( such as pgAdmin ) you simply double click on the database that contains the table that you want to populate and then hit the SQL button in the toolbar. If you are using a console then you have to use pql command :
psql -h <servername> -U <username> <databasename>
where
- <servername> is the name or ip address of the PostgreSQL server you are connecting to
- <username> is the username that you are using to connect
- <databasename> is the name of the database that contains the table you want to work on
The not so obvious pattern : you are a regular user
In this scenario you are connecting to the database via a user that has ( at least ) connect and insert privileges on the table that you want to populate. In this situation you cannot "simply" use the copy command telling postgres to get the data from a file because you need superuser privileges in order to import from a file . The work around here is to use stdin since everybody can use it ! This is going to limit the options a little but still ... Open a terminal and issue the commad :
cat <filename> | psql -U <username> -h <servername> <database> -c "copy <table> from stdin ;"
if you are on Windows system replace cat with type
Variation of the problem
- The file contains different number of columns than the table does
copy <table>(field1,field2, ..., fieldn) from ...
- The file contains headers : I don't want to import that too !
copy <table> from [stdin|<filename>] with CSV HEADER;
- The file contains special characters :
\encoding ISO_8859_1 ; copy <table> from [stdin|<filename>] with CSV HEADER;
If you want to deepen your knowledge of the powerful copy command here's the official documentation
LibreOffice Calc collaborative editing prototype
The other day I came across this this post : it's a proof of concept of a real time collaborative spreadsheet that uses just open source technology. The idea is to make two spreadsheets talk to each other via telepathy protocol; this way two or more person can work on the same spreadsheet and share the ongoing modification by only being on each other telepathy list.
This video shows the proof of concept in action.
This proof-of-concept comes to you courtesy of Eike Rathke of Red Hat, Michael Meeks of SUSE, and Will Thompson of Collabora.
What else can I say other than " looking forward to see it in action " on my box !
Install Mondrian demo on linux box
Today we're talking about Pentaho Mondrian and how to deploy and create the demo suite on a linux box.
I think the instructions I found online to be, at best, confusing. The best bet you have is going with the docs that come along the package ... but there are some mistakes there too .
First things first . I would suggest to download a separate tomcat instance for your tests then, when you're ready and satisfied with the configuration of your mondrian demo, deploy into your "production" tomcat/servlet container.
For my tests and for the sake of these mini how-to, I have used tomcat 6, Sun Jdk 6 and MySQL ( installed using apt-get ).The other thing you need is the MySQL jdbc : download it and put it somewhere on your machine - I have a ~/libs/java dir where I store all my java libraries .
Unzip and start tomcat and fire mysql; test that tomcat responds by looking at http://localhost:8080 ( change the port if you modified the server configuration ) then test that mysql is up and running by issuing mysqlshow -u root mysql
.
Once you are sure you have everything installed, up and running you can download Mondrian from SourceForge.
Unzip your mondrian archive file somewhere. For my tests I used ~/devel/ETL. Wherever you unzipped your files you should have a tree that looks like this :
+-- demo | +-- access +-- doc | +-- api | | +-- mondrian | | +-- calc | | | +-- impl | | +-- gui | | | +-- validate | | | +-- impl | | +-- i18n | | +-- mdx | | +-- olap | | | +-- fun | | | | +-- extra | | | | +-- vba | | | +-- type | | +-- olap4j | | +-- parser | | +-- recorder | | +-- resource | | +-- rolap | | | +-- agg | | | +-- aggmatcher | | | +-- cache | | | +-- sql | | +-- server | | +-- spi | | | +-- impl | | +-- test | | | +-- build | | | +-- clearview | | | +-- comp | | | +-- loader | | +-- tui | | +-- udf | | +-- util | | +-- web | | | +-- servlet | | | +-- taglib | | +-- xmla | | +-- impl | | +-- test | +-- images +-- lib
under the lib dir there's what you're looking for : mondrian.war. Now, stop tomcat and unzip mondrian.war into <TOMCAT_HOME>/webapps . At this point you need to create the sample database for your mondrian installation. The Mondrian demo comes with a foodmart database ... in ACCESS ( OMG ! ) format. Thanks God they provided a plain SQL file that you can upload into your mysql ... not ! What they forgot to tell you is that :
- you have to create the schema yourself
- you have to create the user yourself
- the instructions don't work
Let's proceed :
open your mysql console ( as root ) and issue the following :
create database foodmart; grant all privileges on foodmart.* to foodmart@localhost identified by 'foodmart';
the first line creates a schema 'foodmart', the second line creates a user 'foodmart' with password 'foodmart' that can do anything on the 'foodmart' schema when connecting from localhost.
Now, exit the mysql root shell and test your new user :
mysql -u foodmart -p
type 'foodmart' (or whatever password you chose) when promped and see if you can connect. If everything went fine you can now exit the console.
Now it's time to fill the demo database : go to <TOMCAT_HOME>/webapps/mondrian/WEB-INF and issue the command :
java -cp "./lib/mondrian.jar:./lib/olap4j.jar:./lib/log4j-1.2.8.jar:./lib/commons-logging-1.0.4.jar:./lib/eigenbase-xom.jar:./lib/eigenbase-resgen.jar:./lib/eigenbase-properties.jar:<WHERE YOU HAVE UNZIPPED YOUR MYSQL JDBC>/mysql-connector-java-3.1.14-bin.jar" mondrian.test.loader.MondrianFoodMartLoader -verbose -tables -data -indexes -jdbcDrivers=com.mysql.jdbc.Driver -inputFile=<WHERE YOU HAVE UNZIPPED MONDRIAN>/mondrian/demo/FoodMartCreateData.sql -outputJdbcURL="jdbc:mysql://localhost/foodmart?user=foodmart&password=foodmart"
As I said before, I have my mysql jdbc library in ~/libs/java, change
<WHERE YOU HAVE UNZIPPED YOUR MYSQL JDBC>/mysql-connector-java-3.1.14-bin.jar
into whatever suits your configuration. When you get the prompt again you're almost there : your database is created but you still need to configure your mondrian installation to use mysql ( by default it tries a jdbc/odbc bridge connection to the above mentioned Access database ) .
Now, go to <TOMCAT_HOME>/mondrian/WEB-INF/ and change web.xml so that every instance of
<param-value>@mondrian.webapp.connectString@</param-value>
is migrated to
<param-value>Provider=mondrian;Jdbc=jdbc:mysql://localhost/foodmart?user=foodmart&password=foodmart;Catalog=/WEB-INF/queries/FoodMart.xml;JdbcDrivers=com.mysql.jdbc.Driver;</param-value>
Edit mondrian.properties ( same directory ) and change the variable mondrian.test.connectString
mondrian.test.connectString=Provider=mondrian;Jdbc=jdbc:mysql://localhost/foodmart?user=foodmart&password=foodmart;JdbcDrivers=com.mysql.jdbc.Driver;Catalog=/WEB-INF/queries/FoodMart.xml;
now you have to tell the same to the jsp pages : goto queries sub directory and change the following jsps :
- arrows.jsp
- colors.jsp
- fourhier.jsp
- mondrian.jsp
so that the tag jp:mondrianQuery looks like :
<jp:mondrianQuery id="query01" jdbcDriver="com.mysql.jdbc.Driver" jdbcUrl="jdbc:mysql://localhost/foodmart?user=foodmart&password=foodmart" catalogUri="/WEB-INF/queries/FoodMart.xml">
now ... fire tomcat and open mondrian demo page and enjoy !
the references
- I found that the best bits of information for mondrian deployment are shipped together with the zip under <WHERE YOU HAVE UNZIPPED>/doc.
- In order to better understand what the jpivot library ( shipped together with the mondrian demo ) was doing I found this page from ETL-Tools.Info as being of great use
Said that : happy cubing !
A new eye on Einstein ?
The Hebrew University of Jerusalem has released 80,000 ( yes, you read correctly ) Einstein's scanned documents and made them searchable in the Einstein Archive online website they launched.
Don't hold your breath : it's not a collection of unpublished scientific work rather, quoting the site, a collection of an Autograph, Calculation, Transcript or one of many other document types. In other words you can find postcards or letters that have nothing to do with the scientist's work together with proper scientific work ( sorry for the horrible english :) )
Recent Comments