Just use: Window.Location.getHostName().toString();
Easy, isn't it?
Just use: Window.Location.getHostName().toString();
Easy, isn't it?
Today i was looking for a nice tutorial about how to use Zend_Acl to check on every page request if the user has the right to access the controller/action. Now, there are some infos about that out there, but either they're outdated, or not useable, cause the code is incomplete, or doesnt work at all.
So this is the solution i came up with during the day. I will start at the entry point, the Bootstrap.php.
Thats basically it, my user table consists of at least 3 entries: role, loginname, passwort, where role is an enum of all the available roles in the Zend_Acl.
This is a very basic example, of course you can get that all cached, read the roles und rules from db, etc. but for small projects, thats most of the times to much overhaul ![]()
Ah, and not to forget, i wont paste the Zend_Auth class here, cause thats pretty standard, something that can be found everywhere ![]()
For everybody using the function createRow() from Zend_Db_Table_Abstract and wondering why new columns in any db - table dont arise in the returned row. He shall be advised to read the phpdoc of createRow where it says:
Fetches a new blank row (not from the database).
Yep, thats important, as it reads from the metadatacache, and you have to delete it everytime you add a new column to a certain table.
This took me 30 minutes to figure it out ![]()
At my current business we are developing a nice web application for a limited user base, based on the Zend engine (only partial), and right around christmas time we met the question of how to cache and what to cache.
What to cache was fast resolved, we decided to cache our models, and the object entities they return. For that we do use the Pet model library, a small, but very effective, caching library: https://github.com/cyberpet/ZFP.
Then, the next question was how, so, what follows is a short write up of what we came to, and the possibilities we still have:
Current State
We right now use the Zend_Cache_Backend_Twolevels with APC as its fast backend and sqlite as its slow backend. The sqlite db sits in a ramdisk to execute the writing into the cache fast enough.
How it came to this decision
Zend offers several caching backends, namely:
Whereas these both lie on the filesystem.
Because of their backends, there are two great differences, File access, is, especially while writing into the cache, much slower than memory acces, so, you of cause think, uhm, lets cache into the fast backends, like apc or memcache, but wait, theres more to come.
The fast backends dont support tags, tags are important? You may think? Then, dont take the fast backend.
There was a lot of discussion going on about using tags in the RAM backends, but basically the zend developers came down to avoid them, cause nobody can guaranty when some pages in the RAM get dropped, or not, and then there may be tag data lossed, maybe resulting in wrong data retrieval.
The pet model, relies on tags, so we have to take the slow backends that support tags.
But using them is really a showstopper if you have to cache a lot of entries from time to time, its like 20-30 times slower.
Two Levels for the rescue
But wait, there is a solution already there, called Zend_Cache_Backend_Two_Levels, at least it seems like that, Two levels reads and writes from two backends, one slow, and fast the other one. It stores both the tags and the cached data to the slow backend, and then only the cached data to the fast backend.
But, the problem remains, using sqlite as slow backend means, you still have file access for the slow backend, which, especially for many thousand cached objects means, poooooor performance.
And this is where the ram disk comes into the game, mount a ramfs partition and store the sqlite DB there, the db will handle eventual data losses for you and report errors, but you still have a fast slow backend.
Cache data in slow backend? Not only tags?
I also measured if there is a performance gain when only storing the tags in the sqlite DB and not the tags + cached data, on my system i came down to 17%, what didnt seem enough for us, to change a proved caching mechanism from zend to something untested. But maybe later, when 17% seem to be system critical, we even may come and catch the last remaining percent too.
File backend?
Then why not using the file backend in the ram disk? Cause if you have a lot of small files you still have the time consuming fopen, fwrite, fclose for every file, which takes the performance down, compared to sqlite.
Mysql memory table?
I even tried that one as store for the tags, but it also performs very slow, even slower then the file backend in the ram disk.
Slow/Fast? Read/Write?
Everything i said above about the performance was meant for writing into the cache, as that seems to be our greatest problem right now.
Regarding the reads from the backends they all come down to the same as long as you use a Two Level or a slow backend, page generation for our test page takes from 2 to 3.5 seconds, depending on the chosen backend.
Pure fast - RAM backends are still faster, i came down to like 1 second reading for the test page, so there may be options to get more performance, but right now we dont depend on the last second.
Testcase
Our testcase was an overview page which lists all our suppliers with a lot of information, spread over 10 tables in the database.
Views? Database anyone?
There still are some queries left, which cannot be cached, due to dependency hell under the mappers (the only big disadvantage right now of the pet model
), they will basically brought down, with their logic, into the database, and then the results will lie there as a view, waiting to deliver its last data, until the and of days.
Conclusion
A mix of Caching, database views, and the use of all the ram our server can give us boils down to a developer friendly (use of application layer logic for development) environment with an acceptable performance at least.
The last thing that comes to my mind is that Cache is like Security, its not a state, its a process, and who knows where it takes us next ![]()
Nachdem ich nun lustig im Krankenhaus liege hab ich mir folgenden Vortrag angeschaut http://chaosradio.ccc.de/24c3_m4v_2294.htm hab und mal wieder mehr Lust aufs bloggen bekommen, deswegen hier also gleich der Link zu dieser vorzüglichen, kurzen und unterhaltsamen Einleitung wie man auch mit wenig Zeitaufwendig ein wenig bewegen kann, oder zumindest das Gefühl hat jeniges zu tun ![]()
Anstatt "Schneeregen" gibts da heute für Leipzig "Schneefegen", was, in Anbetracht der Wetterlage nicht zutreffender sein könnte:
If you're fiddling around with django and advanced admin interfaces it can happen that you get an error like:
Model foobar is already registered at ...
with an link to .../contrib/admin.py.
It took me a while to figure out what happened, however, the solution is to import all related models projectlike. So that you have import statements like that:
from project.app.models import Class.
The same is valid for the settings.py Apps section.
I setup Adempiere Virtual Appliance for Virtualbox under arch linux today, just out of curiosity: http://www.adempiere.com/index.php/ADempiere_Virtual_Appliance_Install#Latest_Version
Despite the very good installation manual, there were three things which bugged me, but could be solved fast:
Looking to try out git i followed some tutorials in the web, specifically: http://pthree.org/2008/11/28/setup-a-git-repository/ which looks nice and clean and things and worked up to a certain point. Until it comes to the push. Following this tutorial i always got the message:
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'ssh://
Now, this is some kind of disturbing, cause it didnt come to a satisfactionary end for me, however: http://vmlinux.org/jocke/blog/programming got the answer prepared for me. You have to add the remote repository to be know to the local one, with the following steps:
Thats it, now you can use git push, like you'd do with mercurial for instance. I wonder how the guy from the first tutorial got around it, maybe its a version thing or something like that, however, i almost know nothing about git, but maybe i can provide the answer sometime in the future.git remote add origin ssh://login@example.com/pub/git/projextX
git push origin master
Today i wondered how to add the description to the order report. What has to be done is find a link from the object which gets looped ([[repeatIn(o.order_line,'line')]]) to the description field. Here comes the general step-by-step approach on how to do that in openerp. I assume you use the gtk client.
And this is the result: line.product_id.product_tmpl_id.description
And to get it working in our report template we use it like that:
[[ line.product_id.product_tmpl_id.description or removeParentNode('tr') ]] or
[[ line.product_id.product_tmpl_id.description or '' ]] or
[[ line.product_id.product_tmpl_id.description or removeParentNode('para') ]]
Thats it.
Special thanks go to alex_joni from the #openobject irc channel who guided me through the tour and showed me the simplicity of openerp. I hope this helps some people.
I am trialing some Open Source ERP Software right now and got stuck with Openerp right now. It is very modular, flexible and adaptable i think, however, its strength is its weakness too and i had a hard time finding out how to translate some strings that are not translated yet. What i needed was "Ordered Date" translated into its German "Angebotsdatum" in the report from the sales module.
Now, this was easy, wasnt it?
But, if you adapted the report with the openoffice and base_report_designer plugin, the changes in order.rml dont get recognized.
So you have to open your .sxw template and change :
[[o.state=='draft' and 'Quotation Date' or 'Date Ordered']]
To:
[[o.state <> 'draft' and removeParentNode('para') ]] QuotationThat should get you going basically.
Date
[[o.state=='draft' and removeParentNode('para') ]] Ordered Date
If you set up postfix on your server and cannot receive any message and mail.err shows:
postfix ... fatal: no SASL authentication mechanisms
you probably forgot to install: libsasl2-modules.
Nun ist auch die Piratenpartei in der Relität angekommen. Aaron König hat heute in einem Blogpost die vernichtung der iranischen Nuklearanlagen (http://aaron-koenig.blogspot.com/2010/02/zum-jahrestag-der-iranischen-diktatur.html) gefordert. Dieser Könist ein Vorstand der Piratenpartei, und wenn er so eine Aussage äußert, dann hat das für mich auch offiziellen Charakter.
Und die Bombardierung von fremden Ländern war für mich auch ein Grund andere etablierte Parteien nicht zu wählen. Anscheinend gehört die Piratenpartei auch so langsam dazu, leider...
Siehe auch:
http://blog.fefe.de/?ts=b58ac810
http://nicsbloghaus.org/archives/1212-Schluss-mit-lustig,-Herr-Koenig!.html
Recently i wrote a post about syncevolution with horde and finally a rant about it (http://blog.sveri.de/index.php?/archives/136-Setting-up-syncevolution-with-horde.html / http://blog.sveri.de/index.php?/archives/142-Opensource-yeah,-synchronization-baeh,-a-plea.html). However, over the time, things have changed. I got accostumed to egroupware and using it, and after i moved to a new Virtual Server i finally managed to setup up everything to my needs. So this is what i got:
What works out of the box is the following (after turning xmlrpc on in egroupware settings):
And finally a cool guy patched egroupware 1.6 + minor versions to make it work with sync ml (and with that you can sync with syncevolution and things) . You can find his page and a short guide (its really easy to get it running) here: http://k.noc.de/index.php?option=com_content&view=article&id=6&Itemid=8.
So egroupware now works even with evolution and a lot of other apps, which is a great thing for all the users out there waiting for such a solution, and i know, there are many of them. I have no experiences with phones and things, but i am pretty sure that a lot of things will be done in future to make that work fine too.
Here is my config for syncevolution:
server/config.ini:
syncURL = http://sveri.de/egroupware/rpc.php
username = diezahnfee@default
password = ichwillhierweg
server/sources/calendar/config.ini
type = text/calendarSettings for addressbook and tasks are similar, i didnt try them specifically, but you find a lot of docs out there, or in my old blog post (link at top of this posting
uri = ./calendar
For everybody who thinks about using satchmo (the webshop for django: http://www.satchmoproject.com/
). There are some differences between 0.9 and trunk (which gets closer to 1.0 release). And the differences are not documented yet at all. For instance in the docs it is said that custom payment modules have to get announced in
SATCHMO_SETTINGS with the option CUSTOM_PAYMENT_MODULES like:
SATCHMO_SETTINGS = {
CUSTOM_PAYMENT_MODULES : ['custom.module']
}
However, in trunk (and later 1.0) they told me on the irc channel you have to add the custom module simply to the insalled apps.
|
January '12 |
|
||||
|---|---|---|---|---|---|---|
| Mo | Tu | We | Th | Fr | Sa | Su |
| Sat January 28 2012 | ||||||
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 | 31 | |||||

