Robert Collins: LCA 2010 videos are showing up
Not all the videos are there yet, but they are starting to show up . Yay. See http://mirror.internode.on.net/pub/linux.conf.au/2010/index.html or your local LA mirror.
Versions 0.7.7 to 0.7.9 of Rcpp contained a
bug: protecting paths with quotes was supposed to help with Windows builds, but did the
opposite at least in 'backticks mode' for getting path and/or library
information. Using the shQuote() function instead helped. Our
thanks to the tireless R-on-Windows maintainer Uwe Ligges for an earlier
heads-up about the problem. So another quick bug-fix release 0.7.10 is now in
Debian and should be on CRAN some time tomorrow.
We also put two small improvements in, see the full NEWS entry for this release:
0.7.10 2010-03-15
o new class Rcpp::S4 whose constructor checks if the object is an S4 object
o maximum number of templated arguments to the pairlist function,
the DottedPair constructor, the Language constructor and the
Pairlist constructor has been updated to 20 (was 5) and a script has been
added to the source tree should we want to change it again
o use shQuotes() to protect Windows path names (which may contain spaces)
As always, even fuller details are in
Rcpp Changelog page and the
Rcpp page which also
leads to the downloads, the
browseable
doxygen docs and zip files of doxygen output for the standard formats.
A local directory has
source and documentation too.
Questions, comments etc should go to the
rcpp-devel mailing list
off the R-Forge page
I'm afraid that in the end I failed the challenge. As the last minutes of Saturday night ticked down, I was still mired in the minutiae of C++ Run-Time Type Identification (RTTI.) Sunday was my 12th wedding anniversary and I know from past experience that this is one day when it is advisable to step away from the computer. So I have to concede defeat for now. But I only actually spent about 48 hours on this project this week so if you really think about it, I still have 120 hours available. That's what I choose to believe anyway.
The galling thing is in theory I know how this is supposed to work. A.L.F.s model (in the model-view-controller design pattern) is a class called World. World has an array of Rooms which represent rooms in the dungeon. In my original almost working version of a few days back, this Room class had all manner of verious members for different objects in the dungeon but I decided to redesign it the right way by consolidating all the redundant bits into an abstract base class called Item which would have concrete subclasses: Potion, Treasure, Monster etc. Room now only has to hold a pointer to the Item associated with that room. (Later on I will consider allowing multiple items per room but for now there can only be one.) A factory function creates Items and assigns them to each Room (or leaves them empty) It returns a pointer to an object of the appropriate class but we can access that object through the Item* because they are derived from Item.
So far so good. The fun part happens when we want to know what the Item* really is. For example, combat makes sense for Monsters but not for Treasure. I only want to activate combat if the Item* is a Monster*. It's easy in theory:
if(dynamic_cast<Monster*>(contents))
return FIGHT;
...but it didn't work. Problem number 1. C++ RTTI only works on polymorphous classes. (Ones that contain atleast one virtual member.) So a little redesign of my classes was necessary. Problem #2, once you start slinging pointers around, segfaults soon follow. I had to go back and make absolutely sure I wasn't double-deleting objects and things of that nature. As I write this, I think I have finally got it all sorted out. So I am going to persevere and finish this game, its just going to take a bit longer than 7 days.
While writing the post about performance, I got interested in Template Haskell, specially in the $(lift) construction. Investigating a little bit about it, I got to the following code:
-# LANGUAGE TemplateHaskell #-
import Language.Haskell.TH.Syntax
import X
main :: IO ()
main = print $(lift $ x)
With X.hs:
module X where
import System.IO.Unsafe
x :: Int
x = read $ unsafePerformIO $ putStr "Number: " >> getLine
The result was a surprise to me. It asked for the number in compilation time.
$ ghc --make main
[2 of 2] Compiling Main ( main.hs, main.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.3.0.0 ... linking ... done.
Loading package containers-0.3.0.0 ... linking ... done.
Loading package pretty-1.0.1.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
Number: 5
Linking main ...
marcot@zezinho:~/codigo/haskell$ ./main
5
I ve tried to see how slower can ghc be compared to gcc in compiling a simple
/* loop.c */
#include
int
main(int argc, char **argv)
int i, j, k, t = 0;
for(i = 0; i < 1000; i++)
for(j = 0; j < 1000; j++)
for(k = 0; k < 1000; k++)
if(i * i + j * j + k * k % 7 == 0)
t++;
printf("%d\n", t);
return 0;
And a similar version in imperative Haskell, being as similar as possible to
-- loop.hs
import Control.Applicative
import Control.Monad
import Data.IORef
main :: IO ()
main
= do
i <- int
j <- int
k <- int
t <- int
for (i =: 0) (i <: 1000) (inc i)
$ for (j =: 0) (j <: 1000) (inc j)
$ for (k =: 0) (k <: 1000) (inc k)
$ do
i_ <- readIORef i
j_ <- readIORef j
k_ a -> IO ()
(=:) = writeIORef
( IORef a -> a -> IO Bool
i <: v = (< v) readIORef i
inc :: Enum a => IORef a -> IO ()
inc i = modifyIORef i succ
for :: IO () -> IO Bool -> IO () -> IO () -> IO ()
for preface condition step code
= preface >> for_ condition step code
for_ :: IO Bool -> IO () -> IO () -> IO ()
for_ condition step code
= condition >>= flip when (code >> step >> for_ condition step code)
A functional version:
-- functional.hs
main :: IO ()
main
= print
$ length
[i
i <- [0 :: Int .. 999]
, j <- [0 .. 999]
, k <- [0 .. 999]
, i * i + j * j + k * k mod 7 == 0]
And a version using Template Haskell.
-# LANGUAGE TemplateHaskell #-
import Language.Haskell.TH.Syntax
main :: IO ()
main
= print
$ $(lift $ length
[i
i <- [0 :: Int .. 999]
, j <- [0 .. 999]
, k <- [0 .. 999]
, i * i + j * j + k * k mod 7 == 0])
The results:
$ time gcc -O3 -o loop -Wall loop.c
real 0m0.256s
user 0m0.148s
sys 0m0.040s
$ time ./loop
143
real 0m13.652s
user 0m11.629s
sys 0m0.052s
$ time ghc --make -O3 loop.hs
real 0m0.209s
user 0m0.160s
sys 0m0.020s
$ time ./loop
143
real 3m46.834s
user 3m24.313s
sys 0m0.712s
$ time ghc --make -O3 functional.hs
[1 of 1] Compiling Main ( functional.hs, functional.o )
Linking functional ...
real 0m1.420s
user 0m1.016s
sys 0m0.220s
$ time ./functional
143
real 1m29.057s
user 1m25.809s
sys 0m0.224s
$ time ghc --make -O3 th.hs
[1 of 1] Compiling Main ( th.hs, th.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package array-0.3.0.0 ... linking ... done.
Loading package containers-0.3.0.0 ... linking ... done.
Loading package pretty-1.0.1.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
real 90m54.226s
user 87m32.024s
sys 0m14.785s
marcot@zezinho:~/codigo/haskell$ time ./th
143
real 0m0.005s
user 0m0.000s
sys 0m0.004s
The time to build the code with TH is not the best, but the execution time
surely is. Maybe we could use this technic to improve the execution time of all
of the codes, interpreting a part of the code in build time automaticly,
without user indication.
The results in a table:
Version
Build time (s)
Execution time (s)
C
0.256
13.652
Imperative Haskell (IORefs)
0.209
136.834
Functional Haskell
1.420
89.057
Template Haskell
5454.226
0.005

Lenny Backports
After a couple of days I've spotted a few things that don't work so well on Lenny:blog spam
- gtk-gnutella
- gtk-gnutella is a client for a peer-to-peer filesharing system. Unfortunately the version of the client in Lenny dies on startup "This version is too old to connect".
- gimp
- The graphics program, The Gimp, doesn't show a live preview when carrying out things such as colour desaturation. Although not an insurmountable problem it is moderately annoying if you do such things often.
So I've placed backported packages online. I expected to have to backport KVM, and I guess I realised I needed a new kernel to match too. So they're available in the kvm-hosting repository; take the kernel with "birthday" in its name - the other is more minimal and has no USB support, etc.
Since I last reset the statistics the blog spam detector has reported, rejected, and refused just over half a million bogus comments. It can and should do better. I've been planning on overhauling this for some time; even to the extent of wondering if I can move the XML::RPC service into a C daemon with embedded lua/perl to do the actual analysis. (Right now the whole service is Perl, but I'm a little suspicious of the XML::RPC library - my daemon dies at times and I don't understand why.) I'd say "test suggestions welcome", but then I'd have to explain what is already done. If you're curious take a look at the code...ObSubject: Hot Fuzz
Version 0.7.8 of Rcpp,
released just a few days ago
contained a nasty bug or two which we noticed when trying to built the
initial release of RcppArmadillo
on 64-bit platforms.
So a quick bug-fix release 0.7.9 is now
in Debian and should be on CRAN shortly.
The full NEWS entry for this release follows:
0.7.9 2010-03-12
o Another small improvement to Windows build flags
o bugfix on 64 bit platforms. The traits classes (wrap_type_traits, etc)
used size_t when they needed to actually use unsigned int
o fixed pre gcc 4.3 compatibility. The trait class that was used to
identify if a type is convertible to another had too many false positives
on pre gcc 4.3 (no tr1 or c++0x features). fixed by implementing the
section 2.7 of "Modern C++ Design" book.
As always, even fuller details are in
Rcpp Changelog page and the
Rcpp page which also
leads to the downloads, the
browseable
doxygen docs and zip files of doxygen output for the standard formats.
A local directory has
source and documentation too.
Questions, comments etc should go to the
rcpp-devel mailing list
off the R-Forge page
Update: First version number corrected to 0.7.8.
Besides the new RcppExamples,
another new package RcppArmadillo got spun out of
Rcpp
with the
recent release 0.7.8 of Rcpp.
Romain and I already had
an example of a simple but fast linear model fit using the (very clever)
Armadillo C++ library by Conrad Sanderson.
In fact, I had used this as a motivational example of why
Rcpp
rocks in a
recent talk to the ACM chapter at U of Chicago which,
thanks to David Smith at REvo,
got some further exposure.
Now this example is more refined as further glue got added. Given
that both Armadillo and
Rcpp make use of
C++ templates, the actual amount of code in RcppArmadillo is not that large:
just over 200 lines in a header file, and a little less for some testing accessor
and example functions in a source file. And this makes for some really nice
example code: the 'fast regression' example becomes this (where I simply
removed two blocks with conditional on the Armadillo version):
#include <RcppArmadillo.h> extern "C" SEXP fastLm(SEXP ys, SEXP Xs) Rcpp::NumericVector yr(ys); // creates Rcpp vector from SEXP Rcpp::NumericMatrix Xr(Xs); // creates Rcpp matrix from SEXP int n = Xr.nrow(), k = Xr.ncol(); arma::mat X(Xr.begin(), n, k, false); // reuses memory and avoids extra copy arma::colvec y(yr.begin(), yr.size(), false); arma::colvec coef = solve(X, y); // fit model y ~ X arma::colvec resid = y - X*coef; // residuals double sig2 = arma::as_scalar( trans(resid)*resid/(n-k) ); // std.error of estimate arma::colvec stderrest = sqrt( sig2 * diagvec( arma::inv(arma::trans(X)*X)) ); Rcpp::Pairlist res(Rcpp::Named( "coefficients", coef), Rcpp::Named( "stderr", stderrest)); return res;No extra copies! Armadillo instantiates directly from the underlying R objects for the vector and matrix, solves the regression equations, computes the standard error of the estimates and returns the two vectors. Leaving us to write about eleven lines of code. Moreover, as Armadillo is well designed and uses template meta-programming to avoid extra copies (see these lecture notes for details), it is about as efficient as it can be (and will use Atlas or other BLAS where available). And, this is just one example. Rcpp should be suitable for other C++ libraries, and provides an easy to use seamless interface between C++ and R. However, we should note that (at about the last minute) we found out about some unit test failures in OS X as well as some issues in a Debian chroot -- cran2deb ran into some build issues on i386 and amd64 in the testing chroot even this 'it all works' swimmingly on our Debian, Ubuntu and Fedora build environments. A follow-up with fixes for either Rcpp and/or RcppArmadillo appears likely.
Update: The build issues seems to be with 64-bit systems and everything appears cool in 32-bit.
Version 0.1.0 of RcppExamples, a simple demo package for
Rcpp
should appear on CRAN some time tomorrow.
As mentioned in the
post about release 0.7.8 of Rcpp,
Romain and I carved this
out of Rcpp
itself to provide a cleaner separation of code that implements our
R / C++ interfaces (which remain in
Rcpp)
and code that illustrates how to use it --- which is now in RcppExamples.
This also provides an easier template for people wanting to use
Rcpp
in their packages as it will be easier to wrap one's head around the much
smaller RcppExamples package.
A simple example (using the newer API) may illustrate this:
#include <Rcpp.h> RcppExport SEXP newRcppVectorExample(SEXP vector) Rcpp::NumericVector orig(vector); // keep a copy (as the classic version does) Rcpp::NumericVector vec(orig.size()); // create a target vector of the same size // we could query size via // int n = vec.size(); // and loop over the vector, but using the STL is so much nicer // so we use a STL transform() algorithm on each element std::transform(orig.begin(), orig.end(), vec.begin(), sqrt); Rcpp::Pairlist res(Rcpp::Named( "result", vec), Rcpp::Named( "original", orig)); return res;With essentially five lines of code, we provide a function that takes any numeric vector and returns both the original vector and a tranformed version---here by applying a square root operation. Even the looping along the vector is implicit thanks to the generic programming idioms of the Standard Template Library. Nicer still, even on misuse, exceptions get caught cleanly and we get returned to the R prompt without any explicit coding on the part of the user:
R> library(RcppExamples) Loading required package: Rcpp R> print(RcppVectorExample( 1:5, "new" )) # select new API $result [1] 1.000 1.414 1.732 2.000 2.236 $original [1] 1 2 3 4 5 R> RcppVectorExample( c("foo", "bar"), "new" ) Error in RcppVectorExample(c("foo", "bar"), "new") : not compatible with INTSXP R>There is also analogous code for the older API in the package, but it is about three times as long, has to loop over the vector and needs to set up the execption handling explicitly. As of right now, RcppExamples does not document every class but it should already provide a fairly decent start for using Rcpp. And many more actual usage examples are ... in the over two-hundred unit tests in Rcpp.
Update: Now actually showing new rather than classic API.
Version 0.7.8 of the Rcpp
R / C++ interface classes is now on CRAN and
in Debian. As of right now. Debian has
already built packages for eight more architectures; and CRAN has built the
Windows binary. Oh, and cran2deb
had Debian packages for 'testing' before I was done with the blog entry.
This is a minor feature release based on a over three weeks of changes that
are summarised below in the extract from the NEWS file. Some noteworthy
highlights are
0.7.8 2010-03-09
o All vector classes are now generated from the same template class
Rcpp::Vector<int rtype="RTYPE"> where RTYPE is one of LGLSXP, RAWSXP, STRSXP,
INTSXP, REALSXP, CPLXSXP, VECSXP and EXPRSXP. typedef are still
available : IntegerVector, ... All vector classes gain methods
inspired from the std::vector template : push_back, push_front,
erase, insert
o New template class Rcpp::Matrix<rtype> deriving from
Rcpp::Vector<rtype>. These classes have the same functionality
as Vector but have a different set of constructors which checks
that the input SEXP is a matrix. Matrix<rtype> however does/can not
guarantee that the object will allways be a matrix. typedef
are defined for convenience: Matrix<intsxp> is IntegerMatrix, etc...
o New class Rcpp::Row<int rtype="RTYPE"> that represents a row of a matrix
of the same type. Row contains a reference to the underlying
Vector and exposes a nested iterator type that allows use of
STL algorithms on each element of a matrix row. The Vector class
gains a row(int) method that returns a Row instance. Usage
examples are available in the runit.Row.R unit test file
o New class Rcpp::Column<int rtype="RTYPE"> that represents a column of a
matrix. (similar to Rcpp::Row<int rtype="RTYPE">). Usage examples are
available in the runit.Column.R unit test file
o The Rcpp::as template function has been reworked to be more
generic. It now handles more STL containers, such as deque and
list, and the genericity can be used to implement as for more
types. The package RcppArmadillo has examples of this
o new template class Rcpp::fixed_call that can be used in STL algorithms
such as std::generate.
o RcppExample et al have been moved to a new package RcppExamples;
src/Makevars and src/Makevars.win simplified accordingly
o New class Rcpp::StringTransformer and helper function
Rcpp::make_string_transformer that can be used to create a function
that transforms a string character by character. For example
Rcpp::make_string_transformer(tolower) transforms each character
using tolower. The RcppExamples package has an example of this.
o Improved src/Makevars.win thanks to Brian Ripley
o New examples for 'fast lm' using compiled code:
- using GNU GSL and a C interface
- using Armadillo (http://arma.sf.net) and a C++ interface
Armadillo is seen as faster for lack of extra copying
o A new package RcppArmadillo (to be released shortly) now serves
as a concrete example on how to extend Rcpp to work with a modern
C++ library such as the heavily-templated Armadillo library
o Added a new vignette 'Rcpp-introduction' based on a just-submitted
overview article on Rcpp
As always, even fuller details are in the ChangeLog on the
Rcpp page which also
leads to the downloads, the
browseable
doxygen docs and zip files of doxygen output for the standard formats.
A local directory has
source and documentation too.
Questions, comments etc should go to the
rcpp-devel mailing list
off the R-Forge page
Update: Two links corrected.
Just a kind thank you note to the gThumb authors for completely breaking my workflow by re-inventing the paradigm used to save imported pictures. Until now, all my pictures landed in a predictable location, using a predictable filename pattern that was easily searchable. Not anymore. Now, files land into my home directory, according to some recursive folder pattern that further complicates searching for files and requires a few more clicks to accomplish. Dammit! Couldn't you at least make this configurable, so that those of us who prefer to retain the old paradigm can?!
Note: re-inventing an application's paradigms is always a very bad idea. If you're a software developer who is reading this, please keep it in mind and go scratch your itch to change the world somewhere else. Thank you.
Post Scriptum
Many thanks to Damon Lynch for pointing me to his own professional picture importer called Rapid. This is an extremely configurable importing tool and, lo and behold, Damon even offers builds for Ubuntu via his PPA!
Still, the consequence of this mess is that migrating to Rapid means that I'll be loosing gThumb's simple but extremely efficient editing tools. To me, one strength of gTthumb was this unique combination of picture importing with basic editing tools. Now, I'm forced to split these interconnected tasks, simply because someone chose to completely rethink gThumb's paradigms. I'm of course aware of Gimp's existence, but repeated attempts at mastering it made me conclude that it's entirely the wrong software for my needs and essentially overkill. By contrast, gThumb offers just enough tools to enable someone to crop images to useful sizes and to adjust color balances in easy steps; it does the job without hassle, which is not the case with Gimp.
Thinking out loud, it is precisely on days like these that the urge to create my own Linux distribution keeps on coming to mind. Retaining consistent paradigms in the desktop environment and applications that I use, not to mention maintaining the number of duplicate libraries to a bare minimal, has been a constant struggle and, noticing how some developers' urge to re-invent the wheel every other day, using whatever new programming language of the day, persistently takes precedence over keeping system resource consumption to a bare minimum and over preserving user sanity, I'm slowly coming to the conclusion that Free Software has veered way too far into the bazaar and urgently needs a copious amount of cathedral to make it usable for mere mortals again.
Some dpkg-based distribution where the only scripting language allowed is Bourne shell and the only programming languages C or C++ comes to mind. Of course, this would also require porting popular application from e.g. Java, Python, etc. which would be a colossal amount of work. Still, I think that the time has come for this to happen. As an added bonus, this would make applications usable again on embedded devices with spartan CPU, RAM and storage resources, so this project could generate huge benefits to the embedded Linux industry. Based on my experience at my previous jobs, I have a rather clear picture (pun intended) of what needs to be done and of who I would hire to make it happen. What I'm missing are investors. Who's with me?
I and Rafael Cunha de Almeida got together today with the purpose of closing as much RC-bugs in Debian as we could. I must say it was better than what I d expect.
We started with #570348 . This bug was introduce with an upload that tried to fix #569586 which, in turn, was related to a change in libc6. It would be easy to introduce an ifdef in the code but, as we tried to read and understand the code, we didn t see the need of the function that was causing the problem. It seems to make the same thing as alphasort from dirent.h, with the disadavantage that it was not locale-sensitive. So we removed the customized alphasort and made it use the library one.
Then we headed to the strange #504947. As the maintainer didn t seem satisfied with the new patch system introduced by the last NMU, we simply made a patch that removes the patch system and applies the patch directly in .diff.gz. Hope it helps.
Searching for another thing to work, we noticed that #571791 was not happening in my box, and asked if anyone could reproduce it.
So we found #571748. The first thing about this bug we noticed is that its package causes a division by 0 error in popcon, which made us report a bug about it. We thought that this was a sign that the package was not widely used. Anyway, we decided to fix this bug, which was very fun indeed! After a lot of trials, some succesful, some not, we got to a very simple and nice patch, which was submitted. We also submited other bugs to the same package, that we found while using it. It s a cool package, you should try it out to avoid that division by 0 in popcon.
Nathanael Boehm wrote a nice essay last month called The Future of
Employment?, about a disconnect between workers' and employers' views of
social networks. (This post is based partly on my comment in the ensuing
Hacker News thread.) Boehm wrote:
When I need help with a challenge at work or need to run some ideas past people I don t turn to my co-workers, I look to my network of colleagues beyond the walls of my workplace. Whilst my co-workers might be competent at their job they can t hope to compete with the hundreds of people I have access to through my social networks...The late Sun Microsystems taught us that the network is the computer. It's true: we still use non-networked computers for specialized tasks, but nobody wants one on their desk it's just so useless compared to one that talks to the entire world. Boehm could have titled his essay The Network is the Employee. There are still tasks that people do in isolation, but the ability to contact a network of peers and experts makes the difference in my job, and many others. Alone together The lone computer programmer in a small business has thousands of colleagues on Stack Overflow, Reddit, and so on. It's a chaotic and messy way to find answers, but it's better than the days when your only choice was to call tech support or smack the box with your fist, whichever seemed more useful. I can't begin to list all the problems I've solved and things I've learned by Googling for others with relevant experiences, and getting help from a different expert for every problem. Decades before the web, computer geeks had virtual communities for on mailing lists, Usenet, and IRC. Now any job in the world has an online forum. Even the night clerk at the gas station has Not Always Right. Teaching has long been a solitary profession. Despite working in a crowded classroom, teachers are isolated; they rarely have colleagues observing or participating directly in their work. This has such an impact that teacher education sometimes includes training in meditation or reflection, to compensate for lack of external feedback. So I'm really curious what happens when teachers start to work together remotely the way programmers do. You will be assimilated Boehm's essay reminded me of a vague sci-fi-like idea I've been kicking around: the first group minds will evolve from the intersection of Mechanical Turk, virtual assistants, social networking, and augmented reality. Starting around the 1990s, it was possible to instantly "know" any fact that was published online. Since then, we've increased the amount of content online, our tools for searching it, and ways of connecting to the network. Today we have instant access to almost any published knowledge, anywhere. The number of people on the net has grown too, and the number of ways to find and talk to them. Most of us can contact dozens of friends at any given moment, plus friends-of-friends, co-workers, fellow members of communites like Hacker News or MetaFilter, and also complete strangers. Along with raw facts, we now have access to vast amounts of human judgement, experience, and skill. One result of this is the "virtual assistant," who provides a service that was once available only to high-powered executives. The new personal assistant can work remotely (often overseas), spread costs by serving many masters, and leverage the internet superpowers listed above. Today their services are targeted at small business owners and the Tim Ferriss crowd, but I'm sure someone soon will start marketing virtual personal assistance to all sorts of other creative workers, teachers, even stay-at-home parents. So, how long before I can simply touch a button to let a remote assistant see what I'm seeing in real-time and help me make transportation plans, translate foreign signs and speech, look up emails related to whatever I'm doing or thinking, or even advise me on what to say? Some of these queries will go to my circle of friends, others to the general public, and some to a personal assistant who is paid well to keep up with my specific needs. And that assistant of course will sub-contract out portions of each job as needed to computer programs, legions of cheap anonymous Turkers, or to his or her own network of assistants. At that point, I'm augmenting my own perception, memory, and judgement with a whole network of brains that I carry around ready to engage with any situation I meet. If nothing else, I hope someone writes a good sci-fi thriller story in which a rogue virtual assistant subtly manipulates the actions of unknowing clients, leading them to some unseen end.
Christian Robert
blogged
about a particularly heavy-handed solution to last Sunday's Sudoku puzzle in
Le Monde. That had my symapthy as I like evolutionary computing
methods, and his chart is rather pretty. From there, this spread on to the
REvolutions blogs
where David Smith riffed on it, and showed the acual puzzle. That didn't
stop things as Christian blogged
once more about it, this time welcoming
his post-doc Robin Ryder who
posts a heavy analysis
on all this that is a little much for me at this time of day.
But what everybody seems to be forgetting is that
R has had a Sudoku solver for years,
thanks to the sudoku
package by David Brahm and Greg Snow which was first posted four years
ago. What comes around, goes around.
With that, and about one minute of Emacs editing to get the Le Monde
puzzle into the required ascii-art form, all we need to do is this:
That took all of five seconds while my computer was also compiling a particularly resource-hungry C++ package.... Just in case we needed another illustration that it is hard to navigate the riches and wonders that is CRAN...R> library(sudoku) R> s <- readSudoku("/tmp/sudoku.txt") R> s [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 8 0 0 0 0 1 2 0 0 [2,] 0 7 5 0 0 0 0 0 0 [3,] 0 0 0 0 5 0 0 6 4 [4,] 0 0 7 0 0 0 0 0 6 [5,] 9 0 0 7 0 0 0 0 0 [6,] 5 2 0 0 0 9 0 4 7 [7,] 2 3 1 0 0 0 0 0 0 [8,] 0 0 6 0 2 0 1 0 9 [9,] 0 0 0 0 0 0 0 0 0 R> system.time(solveSudoku(s)) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 8 4 9 6 7 1 2 5 3 [2,] 6 7 5 2 4 3 9 1 8 [3,] 3 1 2 9 5 8 7 6 4 [4,] 1 8 7 4 3 2 5 9 6 [5,] 9 6 4 7 8 5 3 2 1 [6,] 5 2 3 1 6 9 8 4 7 [7,] 2 3 1 8 9 4 6 7 5 [8,] 4 5 6 3 2 7 1 8 9 [9,] 7 9 8 5 1 6 4 3 2 user system elapsed 5.288 0.004 5.951 R>
Let's assume you're part of a project X that uses git for version control on a server host.it. Due to historical reasons your login on machine host.it is 'eddyp'. You're also part of another project Y which is hosted on server host.me. In this project you have always used 'eddy' as your ssh login for the git push.Next.