Sunday, August 01, 2010

» Shell trick: CRLF to LF

I do this again and again in RPM .spec files, so just in case: a little trick to remove the CR from CRLF ;) (Windows uses two bytes for end-of-line markers, namely CR and LF, while Linux and Unix only use one: LF) You might of course use dos2unix or recode, but this one works in-place, which means that you don't need to make a copy, work on the copy and then copy (heh) that file back onto the original -- here is how to do it with dos2unix:
cp file file.orig && dos2unix file
And here the shorter version, using sed and its in-place editing feature:
sed -i 's/\r$//' file
Might as well do it with Perl, which also supports in-place editing:
perl -pi 's/\r$//' file
Update: as _Marcus_ just told me, recode actually does in-place editing by default, my bad :)

Labels: , , , ,

» openSUSE package index and search

I've been busy working on a new implementation of our beloved "webpin", which is actually a service for searching for packages in the insane amount of repositories and packages we have, in the distribution, in all openSUSE Build Service repositories, as well as on Packman. The thing is, it's a bit dated now, and its features are limited by the fact that it's using a relational database to perform search operations. I've been digging into Apache Solr quite a bit over the last few months (did I already mention that it totally rocks? :)) and I thought.. hmm.. why not use that for indexing packages/repositories ? So I just started out on a quick prototype, to see how well it suits the job as well as how well it performs. The results are quite stunning, to say the least, both in terms of performance (results just take a couple of milliseconds on a search index that includes openSUSE 11.1, 11.2, 11.3, all non-home: repositories in the OBS, as well as Packman for 11.1, 11.2 and 11.3.. that's.. quite a lot) as well as in terms of the quality of results -- but the latter is hardly a surprise, as Solr really excels at that. It's what it has specifically been designed and implemented for, after all. So there it is, it's already completely functional, and consists of a Solr schema definition as well as a bunch of Perl scripts to crawl, index, verify and query. The next items on the TODO list are as follows: After that, I shall probably implement an additional REST API that supports more features, as a wealth of more precise and/or complex search options are provided by Solr. I will implement those (REST API and web user interface) in Java, given that there is a faster, native format to send queries and fetch results to/from Solr. That being said, applications and web frontends that interact with Solr can be written in quite a lot of programming languages. Once I'll have a prototype of the above, I'll let you know, and will ask for testing and feedback :) If you're already interested in more information or want to help developing, please let me know (or just poke me on IRC).

Labels: , ,

» Please test NX 3.4.0

On a request, I updated the openSUSE NX packages to the latest release, 3.4.0. If you're an NX user, please test the packages and report whether they work for you or not. As I don't use NX myself, I'd prefer to have a bit of feedback before pushing the changes to the X11:RemoteDesktop repository. The command-line snippet to do so is as follows (must be done as root, for obvious reasons):
zypper ar -r \ && \
zypper dup --repo home:pbleser:branches:X11:RemoteDesktop
For reporting success and failure, please send me an email or let me know on IRC. Thanks! :)

Labels: ,

» pastebinit with susepaste support

Michal Hrusecky recently blogged about his openSUSE paste site. I just added support for it in pastebinit, a nice command-line tool to paste files (or stdin) to various paste sites. You can grab it (with support :)) from the network:utilities repository