does anyone knows how the ulimit
bash (or whatever shell you like) command works? i’m currently running a few instances of the same program on a big server, and it happened yesterday twice that the programs together ate up all available memory (some of the instances using much more than others). there was a hard ulimit
set on memory, and the result was that all these processed were killed. not just the one violating the memory limit in that moment.
this sucks pretty much, since this destroyed some cpu days of work. does anyone knows why ulimit
is doing this? i assume that the rationale is to stop fork bombs, but in this case this is really, really annoying. killing one of the processes would have been perfectly enough…
so, if anyone has good documentation on how ulimit
works, whether it is possible to change this behaviour, and whether this is actually intended or a bug, i would like to hear about it…
posts about programming. (page 1.)
it’s not the first time i’m annoyed by php, and surely not the last one. i’ve often called php an ad-hoc language, which is changed a lot and contains many inconsistencies. and often tends to break backwards compatibility. for example, i recently upgraded to php 5.3 (while upgrading the server; before, it was running 5.2 if i recall correctly). this instantly broke the openid server i’m using to login to mathoverflow. this was easy to fix, apparently some behaviour changed and i had to replace two or three lines of codes by almost identical ones to make it work again. now i stumbled about something else, while posting something new on blackness. namely, the member function setdate of the datetime object changed a little bit: on success, it no longer returns null, but the object itself. (in case of an error, it still returns false.) well, the blackness editor was expecting null to indicate success, and complained that the data was invalid. great.
i mean, its nicer to return the object (to allow cascadation, at least if one is sure no error occurs – otherwise one is screwed), but why just change this between two versions?! such changes make upgrading php a russian roulette: it might break your programs. and in many cases (like this), it might take you a long time to find out that your program is broken. and when you found out it’s broken, you have to search for the problem, identify it, only to find out that php just changed the rules a little bit. this is just bad. and yet another reason not to use php for anything serious.
(and a programming language not useable for anything serious is, well, to be bluntly: a big pile of crap.)
as you might have noticed, musikwiese has its categories displayed as a tree. i did this using the wp-dtree plugin. this is pretty nice, and i thought that i might also be able to use it for spielwiese‘s archives list – after all, that list contains like 40 entries. so it would be nice to have a tree with the years as top-level nodes, which can be expanded to get a list of months. unfortunately, wp-dtree doesn’t do this. so i started programming myself, creating a small plugin which outputs the code wp-dtree should create to display such an archive. and, it seems to work fine! i also included a noscript fallback for people with disabled javascript; in that case, the “classical” archives will be displayed.
if you are interested in my plugin, ask me, and i will send it to you or maybe also upload it somewhere here.
i programmed a bit to create a mechanism which feeds the photos to the user without giving direct access to the files; now, all photos are stored outside the range of the web server, and retrieved by a php script. this brings me one step closer to my goal of making parts of this blog really private. before, photos appearing in hidden posts were somewhat public in case you knew their url. now, you can only access these photos if you are logged in and have the rights to see the corresponding post. the current authentication solution is kind of a hack, but it works. if you just use the blog, you will note no difference – except that photos in old posts which your feed reader did not update are broken. i’m sorry for that. google reader, for instance, should update at least the more current posts sooner or later.
while talking with a friend about learning programming, i searched for course material for the best programming course i ever had so far, namely dibo‘s “programmierkurs java” (which i praised so often when it comes to this topic). while looking, i found a new website by dibo, called programmierkurs java, which features the lectures (both slides and video recordings!) and exercises. in case you want to learn programming and understand german well enough, take a look there!
ok, so much for advertising. when taking to the friend, another topic was “what is the right programming language to begin with?” in this case, the canidates java and c++ were named. i would definitely go for java, even though i prefer to use c++ myself for most things i program, as java is more allergic to programming errors: if you try to access an array out of the boundaries, it will throw an exception and will not result in unexpected behaviour. moreover, it is widely available (for free!) and easy to set up, there is a huge amount of (good and bad) literature about it, it is not too far off from the real world programming languages which one might use later (in case one wants to learn more than one language, it might also be a good idea to start with something more esoteric, like functional programming). moreover, it can be used both imperatively (which is in particular useful in the beginning) and object oriented (which one shouldn’t touch too early, in my opinion).
today i cleaned up my blog a bit – at least on the technical side. i wrote a plug-in which encapsulates all my changes to wordpress, so the underlying wordpress is now a standard installation, making upgrading way easier.
moreover, as you might have noticed, i added a login box to the right margin. after playing around in the last days a bit, it seems that my goals can be partially resolved using role scoper. well, not perfectly, but at least to some extend. (so there’s still the need to write the optimal blog software.)
while i was searching for a plug-in which allows access control to posts based on users and/or user groups, i stumbled about many different plug-ins, some of them very promising, but either dead, not updated for a long time, or simply not exactly usable by producing a long list of php error messages already in the admin screen after activating them. grrreat. well, of course, i could also try to do it myself, as usual. but hey, that sucks: i’d be better of writing my own blog software.
well, i talked about the problem a bit with kornel, and we concluded that an optimal blog system would be a very slim piece of software, just providing the very basic features, i.e. managing posts, comments and pages, users and user groups/roles/whatever, and access privileges, while everything else—such as galleries, embedding videos, gadgets, comfortable post editors, …—is implemented as plugins.
anyone want’s to do this, and produce a well-documented, slim, bug-free blog system with a good plugin interface, together with a few standard plugins? :)
… my blog really has 100% valid xhtml 1.0 transitional code.
until now, there were some exceptions:
- a wordpress bug which generated invalid xhtml code if you have more than one blogroll category (which will be fixed in the next version; i wrote a quick hack to fix the one i’m using);
- the youtube code snippet was quite a mess, i fixed it using some hints from the w3c validator page and by some tipps by kornel, as wordpress tended to screw up my code by inserting tags and, thus, rendering it invalid; i fixed that by using installing a plugin which allows to format specific posts completely yourself;
- certain small bugs in my posts which were completely my faults (these will probably show up from time to time, but i’m trying to eliminate them asap).
maybe i’ll once try to force wordpress to generate xhtml 1.0 strict code, but that’s probably too much work; probably i can hack something together myself in less time which fits better to my needs and which generates such code :)
every time i plan to start a new project, let it be a web project, a programming job, a latex document (or a combination of those), i’m thinking hard on whether to use something already existing as a base or whether to do everything myself, from the scratch. for latex documents, i usually reuse macros i’ve written myself. for programs, i use libraries like opengl and zlib (two random names coming to my mind, there are of course a lot more), i reuse my own code, and write the rest from scratch. for this blog, i used wordpress, for usage statistics i use phpopentracker. and, of course, i use php and mysql as backends. even though i could implement the whole stuff myself. if i just would have enough time… but i don’t, and so i have to cope with all the restrictions, specialities, whatever these programs and libraries are throwing at me.
the reason why i’m thinking about this at the moment is a new project of mine i’m thinking about, which i’m planning to code more or less from the scratch (using, of course, some backend stuff like php, mysql, phpopentracker, you name it). i just started drawing some sketches, like its logical structure with hints on the physical implementation. sometimes i wonder whether i should spend more time on such things. despite there probably already exists a system which does exactly what i want, making one yourself is way more fun. although its also way more work.
let’s see if i manage to pull this one through… wish me luck.