Monday, October 17, 2011
ExtJS for webapp frontends
Another little "remember me" note: ExtJS looks like a cool way to build a webapp. http://www.sencha.com/products/extjs/
Friday, September 30, 2011
Pithos -- Gnome Padora Client
One reason that I hadn't used Pandora in a while was that I most want to listen to music when working at the computer, however when I work at the computer I use the processor, hard! Unfortunately Pandora's webclient (flash based) sucks up processor power. Thankfully Kevin Mehall created a native Gnome client called Pithos! I'm just trying it right now but it seems to do the trick!
Tuesday, September 13, 2011
The Joy of For-Loops in Making Figures
I love TikZ, the "vector" graphics package for LaTeX. One of the biggest reasons is that I can programmatically create the drawing. For example the nested foreach loops in this code saved me lots of work:
Tuesday, August 30, 2011
Pretty printing to console
Another little self-reminder, pretty print data structure to console with Data::Format::Pretty::Console
Sunday, August 28, 2011
xdotool for programmatic x events
Just a little self-reminder. I just learned about xdotool, with which one can send keystrokes or other x interactions to programs programmatically.
Saturday, August 20, 2011
Learning Perl from Perldoc
Today I found myself thinking about the best documents in the perldoc collection. I end up thinking that one could learn learn almost all you need of Perl simply by reading perlintro (the basic introduction), perlreftut (the tutorial on references and how to use them) and perltoot (Tom's Object-Oriented Tutorial).
The last could be omitted if you wanted to use Moose OO, however reading it still gives insight into how a hashref-based object works. Moose objects are still constructed in this way even if you don't see it.
Of course there is far more to learn from perldoc and once you include the documentation from modules this pool of knowledge is endless. I know documenting your modules is a pain, but good documentation is one of Perl's great strengths!
The last could be omitted if you wanted to use Moose OO, however reading it still gives insight into how a hashref-based object works. Moose objects are still constructed in this way even if you don't see it.
Of course there is far more to learn from perldoc and once you include the documentation from modules this pool of knowledge is endless. I know documenting your modules is a pain, but good documentation is one of Perl's great strengths!
Sunday, July 31, 2011
Alien::GSL released
Version 0.01 0.02 has been released on CPAN. After some successful tests show up from CPANtesters I hope to upload a new version of Math::GSLx::ODEIV2 which uses it to check for the GSL library and install it on supported platforms.
Please comment and ideas for non-Linux platform support will be welcomed whole-heartedly.
See https://metacpan.org/module/Alien::GSL soon!
UPDATE: Ooops forgot the MANIFEST file and the whole thing fouled up. Version 0.02 has been uploaded to fix that. Version 0.01 will be deleted as soon as PAUSE allows. Sorry about that!
Please comment and ideas for non-Linux platform support will be welcomed whole-heartedly.
See https://metacpan.org/module/Alien::GSL soon!
UPDATE: Ooops forgot the MANIFEST file and the whole thing fouled up. Version 0.02 has been uploaded to fix that. Version 0.01 will be deleted as soon as PAUSE allows. Sorry about that!
Friday, July 29, 2011
Request for comment: on Alien::GSL
dagolden asked recently on his blog for suggestions on which libraries should have Alien:: modules. I recently wrote Math::GSLx::ODEIVE2 which needs not only the GSL libraries but the newest (1.15) version, so these things have been on my mind.
I have started mocking up Alien::GSL at my GitHub repository. Take a look and please let me know ANY thoughts.
Here is what I posted on dagolden.com:
Ok so I have been working on an Alien::GSL module. Since the magic is supposed to go in the Makefile.PL, I worry that I use the functionality without any testing first. However it is a simple module so not much testing is needed perhaps (none is written yet). How do people find the workflow? Suggestions are welcome ...
I close by soliciting comment here. Thanks for any thoughts!
I have started mocking up Alien::GSL at my GitHub repository. Take a look and please let me know ANY thoughts.
Here is what I posted on dagolden.com:
Ok so I have been working on an Alien::GSL module. Since the magic is supposed to go in the Makefile.PL, I worry that I use the functionality without any testing first. However it is a simple module so not much testing is needed perhaps (none is written yet). How do people find the workflow? Suggestions are welcome ...
I close by soliciting comment here. Thanks for any thoughts!
Sunday, July 10, 2011
Solve ODEs with Math::GSLx::ODEIV2
In investigating the GSL library for solving Ordinary Differential Equations (ODEs) I noticed that a new interface (gsl_odeiv2) that hadn't yet been exposed in a Perl module. Further I noticed that some of the existing ODE modules for Perl are a little hard to use.
Along with those considerations I had wanted to make a Perl/XS module in preparation if I ever get my FLI camera module finished I will need this skill.
Put it all together and now I am here to introduce my very Perl-ish (in my opinion) Math::GSLx::ODEIV2. Yes the name is bad, but it is descriptive.
I also learned (hopefully) how to prevent installation when the library is not present in the system. Normally this would have involved Devel::CheckLib but since GSL comes with a utility (gsl-config) I was able to avoid that.
Anyway I hope some people find it useful and I am happy to hear comments and work to improve the module on its github page.
Along with those considerations I had wanted to make a Perl/XS module in preparation if I ever get my FLI camera module finished I will need this skill.
Put it all together and now I am here to introduce my very Perl-ish (in my opinion) Math::GSLx::ODEIV2. Yes the name is bad, but it is descriptive.
I also learned (hopefully) how to prevent installation when the library is not present in the system. Normally this would have involved Devel::CheckLib but since GSL comes with a utility (gsl-config) I was able to avoid that.
Anyway I hope some people find it useful and I am happy to hear comments and work to improve the module on its github page.
Tuesday, June 28, 2011
[Non-Linux] Purchasing Power Parity
A description on why I can buy a hot dog in London for $8 (also what is a New York Style Hot Dog?). Purchasing Power Parity theory.
Also a handy chart featuring the venerable Big-Mac Index.
Also a handy chart featuring the venerable Big-Mac Index.
Tuesday, June 21, 2011
Use strict AND warnings!
StackOverflow has had several questions in the last few days about strict and warnings. Let me say it here definitively:
ALWAYS. USE. STRICT. AND. ALWAYS. USE. WARNINGS.
Until you KNOW when to turn of some fraction of these (e.g. `no warnings 'once'`) and why you are doing it (e.g. `no strict 'refs'), should you do anything except `use strict; use warnings;`!
You really should stop reading here, but if you must, here is some small explaination.
The short reason is, Perl lets you do ANYTHING, and this truly is too much power. These commands save you from the power and from yourself. Don't try to be a hero, you will do something wrong and your code won't work.
ALWAYS. USE. STRICT. AND. ALWAYS. USE. WARNINGS.
ALWAYS. USE. STRICT. AND. ALWAYS. USE. WARNINGS.
Until you KNOW when to turn of some fraction of these (e.g. `no warnings 'once'`) and why you are doing it (e.g. `no strict 'refs'), should you do anything except `use strict; use warnings;`!
You really should stop reading here, but if you must, here is some small explaination.
The short reason is, Perl lets you do ANYTHING, and this truly is too much power. These commands save you from the power and from yourself. Don't try to be a hero, you will do something wrong and your code won't work.
ALWAYS. USE. STRICT. AND. ALWAYS. USE. WARNINGS.
Saturday, June 18, 2011
Canon's hidden Linux support
I know that many companies don't feel that it would be "worth it" to support Linux, however I have now seen a new one: a company that hides its Linux support. I just bought a Canon wireless printer (PIXMA MG5220) and of course saddled up to fight the driver battle. I googled and found that others had already found that Canon provides a driver, but only on their Asian site (all drivers (including scanner) and linux debian package!).
I wrote the Canon support to tell them that they should post these (working!) Linux drivers on their North American site, to which they replied that they do not support any operating systems other than Windows and Mac. Why not tout Linux support WHEN IT IS ALREADY PROVIDED??
I wrote the Canon support to tell them that they should post these (working!) Linux drivers on their North American site, to which they replied that they do not support any operating systems other than Windows and Mac. Why not tout Linux support WHEN IT IS ALREADY PROVIDED??
Monday, June 13, 2011
Regexp::Grammars for more DWIM regexes
Perl is famous for its emphasis on DWIM (do what I mean, otherwise known as the principal of least surprise). Unfortunately one of Perl's other great features is its Regex powers, which are dramatically "Do exactly what I say". Now its not a silver bullet and it still only does what you say, but Regexp::Grammars goes a long way to making regexes look like what you mean.
For example, on SO this post was looking for a way to implement a rather pathological parse on each line of text. The OP didn't seem to understand that the specification was rather odd (though several other posters didn't hesitate to inform him). It appeared to me that the OP trying to recover code that had been serialized to single lines. This is complicated by the fact that it appeared to contain line comments started with a `//` and ended by multiple spaces. To me this seemed to be an excellent time to pull out regexes that are more DWIM.
By defining the types of structure I hoped to match and then having them automatically parsed into a hash structure (%/) the job becomes far less painful and far more readable. Certainly this would have to be expanded and debugged to fully to what the OP probably needs, but it is a nice example of a more modern Perl for more modern Perl programmers.
For example, on SO this post was looking for a way to implement a rather pathological parse on each line of text. The OP didn't seem to understand that the specification was rather odd (though several other posters didn't hesitate to inform him). It appeared to me that the OP trying to recover code that had been serialized to single lines. This is complicated by the fact that it appeared to contain line comments started with a `//` and ended by multiple spaces. To me this seemed to be an excellent time to pull out regexes that are more DWIM.
By defining the types of structure I hoped to match and then having them automatically parsed into a hash structure (%/) the job becomes far less painful and far more readable. Certainly this would have to be expanded and debugged to fully to what the OP probably needs, but it is a nice example of a more modern Perl for more modern Perl programmers.
Wednesday, June 8, 2011
[Non-Linux] WunderMap Weather
Partially because some computer geeks are weather geeks too, partially because it is a cool interface and partially just so I can save this link: wunderground.com has a really cool interactive weather map. I found it from the Tom Skilling / WGN (Chicago) weather blog.
Tuesday, June 7, 2011
2D CAD for Linux
I have long been using QCAD for my 2D drafting, and I am still waiting for FreeCAD to be a little more usable for 3D, but in the meantime I saw an interesting new (commercially developed?) entry into the Linux 2D CAD world: DraftSight.
Friday, May 20, 2011
PDL::IO::Export2D now uses Dist::Zilla
My module (PDL::IO::Export2D) has made the switch to Dist::Zilla and I am impressed with how easy it makes authoring modules for CPAN!
My source tree now only consists of the actual module, the test scripts, the Changes file, (yes, there is the README.pod, but that is generated by D::Z for github's benefit) and the dist.ini file for Dist::Zilla. This file contains the distribution metadata and the plugins / plugin configuation to be used in the build process.
... yep thats all. It makes my other files (meta, readme, etc), it even puts the version number in the module file for me!
Now if I want to make a small change and publish it, all I need to do is make the change, increment the version number in dist.ini then do
and finally upload to PAUSE. Simple, convenient.
My source tree now only consists of the actual module, the test scripts, the Changes file, (yes, there is the README.pod, but that is generated by D::Z for github's benefit) and the dist.ini file for Dist::Zilla. This file contains the distribution metadata and the plugins / plugin configuation to be used in the build process.
name = PDL-IO-Export2D
version = 0.030
author = Joel Berger <joel.a.berger@gxxxx.com>
license = Perl_5
copyright_holder = Joel Berger
abstract = Provides a convenient method for exporting a 2D piddle.
[GatherDir]
[MetaYAML]
[MakeMaker]
[Manifest]
[PruneCruft]
[License]
[Readme]
[PkgVersion]
[AutoPrereqs]
[ReadmeAnyFromPod / pod.root ]
filename = README.pod
type = pod
location = root
... yep thats all. It makes my other files (meta, readme, etc), it even puts the version number in the module file for me!
Now if I want to make a small change and publish it, all I need to do is make the change, increment the version number in dist.ini then do
dzil build
dzil test
and finally upload to PAUSE. Simple, convenient.
Thursday, May 19, 2011
Installing PDL
The PDL wiki has an instruction set to install PDL from CPAN, however I find it is missing a few things so here are my instructions (also my instructions use CPAN when possible):
Step 0) If installing over SSH (if not go to Step 1)
If you are installing over an SSH shell be sure you used the -X (and/or the -Y) flag when connecting (ssh -X host.name.etc). Then execute
to allow OpenGL to work correctly.
Step 1) Install system packages
Step 2) Install Perl modules
I use cpanm, one may also use cpan, but it makes you hit 'y' many more times
I like to use the -v on the graphical modules and PDL because they have tests where it helps to read the output that cpanm suppresses. If you don't need that, you may omit the -v.
Also if it seems that any of those hang, try hitting the enter key to continue. Some of the plotting tests require you click around, do so, sometimes hitting the right mouse button as well. You may need to close the PGPLOT server window at some point as well (black window that doesn't seem like its doing anything).
Step 3) Test the tricky modules
Step 0) If installing over SSH (if not go to Step 1)
If you are installing over an SSH shell be sure you used the -X (and/or the -Y) flag when connecting (ssh -X host.name.etc). Then execute
export LIBGL_ALWAYS_INDIRECT=y
to allow OpenGL to work correctly.
Step 1) Install system packages
sudo apt-get install libxi-dev \
libxmu-dev freeglut3-dev libgsl0-dev \
libnetpbm10-dev libplplot-dev \
pgplot5 build-essential gfortran
Step 2) Install Perl modules
I use cpanm, one may also use cpan, but it makes you hit 'y' many more times
cpanm Term::ReadLine::Perl Inline Astro::FITS::Header ExtUtils::F77
cpanm -v PGPLOT OpenGL
cpanm -v PDL
I like to use the -v on the graphical modules and PDL because they have tests where it helps to read the output that cpanm suppresses. If you don't need that, you may omit the -v.
Also if it seems that any of those hang, try hitting the enter key to continue. Some of the plotting tests require you click around, do so, sometimes hitting the right mouse button as well. You may need to close the PGPLOT server window at some point as well (black window that doesn't seem like its doing anything).
Step 3) Test the tricky modules
perl -e '
use PDL;
use PDL::Graphics::PGPLOT;
use PDL::Graphics::TriD;
print "success\n"'
Wednesday, May 18, 2011
Perl in Go!
I have been meaning to learn a compiled language and Google's Go language has intrigued me. It's a new compiled language with high-level features. Finally though I think I have found a reason to try: Campher, it's Perl in Go! Now I have all the security blanket of a language I know and love in a new one!
Saturday, May 7, 2011
Dynamic vs Static scoping
Finally an explaination I can understand
... from wikipedia
In other words, the dynamically-scoped (local) variable $x is resolved in the environment of execution, rather than the environment of definition (my).
... from wikipedia
Friday, May 6, 2011
On using PERL -- The "Print Evaulate Read Loop"
Anyone who has gotten deep enough into Perl programming has been asked questions about PERL. Supposedly this is another programming language related to Perl, but only used by newcomers.
I submit however that this is the natural course of events with the Perl noob. It is the PERL flow -- Print Evaluate Read Loop.
Many people are familiar with the REPL (Read Evaluate Print Loop) mechanism of program interaction. This simply is a program that Reads a line of code, Evaluates what that line does, and Prints the response, Looping in order to do it all over again.
PERL is very similar. The noob Prints out some Perl code, perhaps amending some totally unrelated and possibly aweful old code found online somewhere, Evaluates it on some poor shmucks on say Stack Overflow, asking why it isn't doing some task (which it had no earthly possibility of doing), Reads what he should have read in the documentation, and finally Loops, doing the cycle over again.
In truth I am happy to help the Perl noobie from PERL to Perl, but every now and again you would think they would learn to capitalize it properly. I cannot figure out how they can all say Python (never PYTHON) but not Perl.
I submit however that this is the natural course of events with the Perl noob. It is the PERL flow -- Print Evaluate Read Loop.
Many people are familiar with the REPL (Read Evaluate Print Loop) mechanism of program interaction. This simply is a program that Reads a line of code, Evaluates what that line does, and Prints the response, Looping in order to do it all over again.
PERL is very similar. The noob Prints out some Perl code, perhaps amending some totally unrelated and possibly aweful old code found online somewhere, Evaluates it on some poor shmucks on say Stack Overflow, asking why it isn't doing some task (which it had no earthly possibility of doing), Reads what he should have read in the documentation, and finally Loops, doing the cycle over again.
In truth I am happy to help the Perl noobie from PERL to Perl, but every now and again you would think they would learn to capitalize it properly. I cannot figure out how they can all say Python (never PYTHON) but not Perl.
Sunday, April 24, 2011
OpenGL over SSH
Just a quick note, if one needs to use OpenGL over an SSH X Forward, you may need to do "export LIBGL_ALWAYS_INDIRECT=y" on the remote computer. FYI
Monday, April 18, 2011
Published my first CPAN module!
Well I have jumped in finally, I have published my first CPAN module, a PDL export tool. Beyond being useful it was a good first opportunity to publishing something simple before doing something more involved, like the Physics modules that I might end up publishing, or the FLI camera Perl module/driver that I have been working on.
I have set up a github repository to host my work. If you want, you can follow the development of this and other future work there.
I have set up a github repository to host my work. If you want, you can follow the development of this and other future work there.
Friday, April 15, 2011
Scientific Data Crunching on Perl (PDL)
A good primer on PDL for those of us who know Perl but find it a little hard to use the PDL documentation.
http://www.perlmonks.org/?node_id=598007
http://www.perlmonks.org/?node_id=598007
Saturday, March 26, 2011
Math font in Beamer
I have always wondered why Beamer messed with my math fonts, turns out its not hard to get it back. \documentclass[mathserif]{beamer} and you're done!
Perl Multiline Comments
The PerlMonks, in their wisdom, have provided several methods to include multi-line comments in your Perl source. I must admit I am still trying to understand Abigail's.
Monday, March 21, 2011
Preview your Perl POD like CPAN does
Want to see what your POD will look like on CPAN? Upload it to http://search.cpan.org/pod2html and see!
Friday, March 11, 2011
Build Perl faster
http://www.effectiveperlprogramming.com/blog/1010
however I can't seem to find out how to do this with perlbrew.
however I can't seem to find out how to do this with perlbrew.
Sunday, March 6, 2011
Stereograms
I know its not Linux related necessarily, but cool nonetheless: make your own stereogram
Friday, March 4, 2011
Impress!ve lists me!
I have just noticed that the latest edition of Impress!ve have listed makebeamerinfo in their documentation. I guess this means I need to get around to uploading mbi2
Monday, January 31, 2011
Perlrun explained!
One more quick thing. I was looking for a good explaination of the perl command-line switches and I found this.
Doc converters
Sunday, January 16, 2011
Explaining Perl Regexes
If you need to figure out what a certain regex is doing you can use YAPE::Regex::Explain but even more convenient is this web interface.
Friday, January 7, 2011
Open source web meetings
Some time ago I was trying to TA via an open source web meeting platform. At the time I was considering dimdim and openmeetings.
While I haven't followed up in a long time, I just got an email that dimdim is being bought and the open source platform is being discontinued (actually it seems that it was abandoned not long after I was looking at it anyway).
Just to update though, it seems that openmeetings is going strong and a poster added a new project to my open source horizon big blue button. I will keep that in mind for the next time I get the web interaction bug, perhaps for my dissertation.
While I haven't followed up in a long time, I just got an email that dimdim is being bought and the open source platform is being discontinued (actually it seems that it was abandoned not long after I was looking at it anyway).
Just to update though, it seems that openmeetings is going strong and a poster added a new project to my open source horizon big blue button. I will keep that in mind for the next time I get the web interaction bug, perhaps for my dissertation.
Subscribe to:
Posts (Atom)