Set Drupal user as 'leader' of other users - drupal-6

I am looking for a solution outside of Organic Groups (I think it's too heavy for this purpose).
I suspect this will require a programmatic solution so I am open to any suggestions

Without using Organic Groups, I think you would have to either write a custom module that does exactly what you want, or you could try to "piece it all together" with other contributed modules such as Rules, CCK, etc.
You could try to use nodereference to link the employees/managers together from their profile (if using content profile), but then to handle permissions for those managers I think you would need a custom module anyway. I have a feeling that you will have to write your own module as piecing something together like that would be a real mess, not flexible, and more trouble than it's worth in the end.

Related

Custom log processing/parsing

I have such log format:
[26830431.7966868][4][0.013590574264526367][30398][api][1374829886.320353][init]
GET /foo
{"controller"=>"foo", "action"=>"index"}
[26830431.7966868][666][2.1876697540283203][30398][api][1374829888.4944339][request_end]
200 OK
The entry is constracted using such pattern:
[request_id][user_id][time_from_request_started][process_id][app][timestamp][tagline]
payload
Durring request I have many point where I log something - app basically has complex behaviour. This helps me debug a lot the user behaviour.
The way I would like to parse it is that I would like to make have directory structure like this:
req_id
|
|----[time_from_request_started][process_id][timestamp][tagline]
|
etc
Basically each directory will have name based on req_id, with files wchich names are rest of tagline. These files will include payload.
And also I will have other directory, with users ids, which will contain symlinks to request done by this user.
First question: Is this structure correct? In my opinion it will make easy fast log access. The reason I want to use directories and files is that I like unix approach, and try it (feel by myself its drawbacks and advantages)
Second question: I will have no problem to use ruby for creating this. But I would like to learn some new tool, which is better suited for this. I am thinking about using just unix tools (pipe, awk etc) to achieve this, or write parser in golang which I am learning right now (even have time to implement simple map reduce). What tool is best suited for this?
I would not store logs in a directory to see how the users behave.
Depending on what behaviour you want to keep track of you could use different tools. One of these could be mixpanel or keen.io.
Instead of logging what the user did in a log file you would sent an event to either of those (they are pretty similar, pick the one you think has better docs / lib), then you would graph those events to better understand the behaviour of your users. I've done this a lot recently, to display data in a nice way I've used rickshaw.
The key point why I'm suggesting this is that if you go the file route you will still have to find a way to understand your data, something that graphs will help you a lot at. Also, visualization is something keen.io does by default, you may still want to do your graphs but it's a good start.
Hope this helped.
Is this structure correct?
Only you can know that, it depends directly on how the data needs be accessed and used.
What tool is best suited for this?
You could probably use UNIX tools to achieve this but it may as well be a good exercise to practice your Go skills by writing this. It would also be more extensible.

Is there ever a good reason to use PHP inside ExpressionEngine templates?

I've heard mixed things about this. I know it's easy when you're stuck to simply enable PHP in the template and hack your way around a problem. However, it almost always introduces potential security issues, and makes a mess of your template to boot.
In most cases where PHP is used, it would be cleaner to write a simple plugin in PHP to achieve what you need.
My question is this: Is it ever acceptable to use PHP inside ExpressionEngine templates? Or is this considered bad practice? If you were a developer who inherited a site I coded, would you cringe if you saw PHP inside templates?
This could just as easily be a question on the merits of eval() and whether it should ever be used. Most of the answers to questions along those lines are equally applicable here.
My view is that enabling PHP in templates is always a Bad Idea. At best, it's not a terrible idea, but there's always a better option. A custom addon will invariably be a better approach, even with seemingly harmless code snippets. I think it's also most likely to be used by those least qualified to use it. Personally, when I started building sites with EE my PHP skills ranged somewhere between 'totally inept' and 'knows enough to be dangerous'. At that time, if I came across a limitation in EE's code I'd often implement a solution via some inline PHP, partly because the idea of developing a custom addon seemed too daunting and partly because clicking a little 'enable PHP' radio button was so simple. Years later, whenever I need to update one of these sites, I definitely do cringe. Here are some of the side effects of PHP in templates:
Potentially introducing serious security vulnerabilities.
Increasing load times, potentially by a lot.
Debugging code becomes harder (good luck figuring out which file/line number has that error).
With tools like Pkg.io you can have the groundwork for an addon in place in 30 seconds. It requires a tiny amount of extra effort, but the gains are well worth it.
Let's imagine I'm answering this question as part of the 80% of people building websites with ExpressionEngine who may consider themselves as designers and or people who have little to no PHP experience:
Is it ever acceptable to use PHP inside ExpressionEngine templates?
No it's not acceptable, please don't do it!
Or is this considered bad practice?
Yup, pretty much.
If you were a developer who inherited a site I coded, would you cringe
if you saw PHP inside templates?
Definitely would cringe and maybe even curse a little.
Okay, now let's imagine I'm answering as part of the 20% who would consider themselves as an EE developer and or who have most experience programming over say designer all day:
Is it ever acceptable to use PHP inside ExpressionEngine templates?
Once in a while it's acceptable. For example you might find a need to turn on PHP for this Stash setup. It really depends on the complexity of what you are trying to achieve. Most things should go into an add-on whenever possible and being "lazy" doesn't count as a time when PHP is acceptable in templates.
Or is this considered bad practice?
ExpressionEngine and Codeigniter for that matter provide a great base to build add-ons and best practices include proper separation when ever possible. This includes separation from PHP and Templates; more often than not.
If it can go into an add-on it should as mentioned before. With that said, there isn't really anything limiting you from using PHP in templates except knowing that this may have security implications, cause future headaches for clients and other devs/designers etc.
If you were a developer who inherited a site I coded, would you cringe
if you saw PHP inside templates?
Definitely wouldn't cringed (unless your PHP was a disaster right from the start) though, would probably question why such simple and even complex code wasn't where it belonged; in an add-on.
Note: I pulled the percents out of thin air though, they quite possibly could be close to reality.
Also note: I realize the use of designer/developer in my answer could be seen as stereotyping though, wasn't quite sure how to avoid it. Hope no one takes offense.
I would consider using something like the phpstringfun add-on. This splits the different, but you're still working in EE tags.
I wouldn't sweat using small amounts of well-documented PHP in templates, but keep it as simple and abstracted as you can.

Best Solution for Website (Joomla, etc.)

I'm in the process of quoting out a website build for a law firm.
I was hoping you could give me your opinions on what the best CMS system would be to easily achieve what they want.
It's a basic informational website. News, About Us, List of Attorneys, Attorney Bios, etc. They would like to be able to easily edit all of these sections.
I was looking into Joomla as a CMS solution to allow them to do this, but I am unsure that it will get the job done (keep in mind I don't have much experience with it however). Joomla seems to revolve around "Articles". This would be fine for the News section, but when it comes to the List of Attorneys (which would have name, location, contact) and would need to be sortable, etc. I don't get the feeling it would get the job done. This could easily be my lack of understanding however.
With a site like this, what do you think the best back-end system would be for them to update this type of content?
This sounds like a rather standard website.
Most CMS-es, open source or proprietary, will solve your usecase rather easily. It really boils down to what tools you are familiar with and if you have special needs.
Of open source CMS-es Plone will easily solve your challenges, and if you prefer php-based solutions, joomla, drupal or wordpress will probably do so as well.
There is a comparisation of their respective strengths and disadvantages available here:
http://www.idealware.org/reports/2010-os-cms
As a developer who's made more than a couple very successful Joomla websites I can definitely say you're misunderstanding 'articles' in this case.
You can have an 'About Us' page, a 'Contact Us' Page, any page you want. Each 'page' is just listed as an 'article' in the backend to make it easy for someone who doesn't know the system to have an idea where to look to edit that 'page'.
In terms of 'lists' of things - there are so many great extensions already written for Joomla you would be really hard pressed to find a better CMS that will allow you to get exactly what you're looking for as quickly or as easily. K2 is great for certain situations but I don't think it would fit the bill for this project.
What you mentioned seems like a standard Joomla install honestly, straight out of the box. A few pages and a list of attorneys? No sweat. You might even look into the Sobi2 component for Joomla - a fully customizable component originally designed as a 'business index' that would probably fit the bill almost perfectly for a 'list of attorneys' and could be as large, or as small as you want. I use it on one of my sites and in that 'list' of providers we have probably 250+ listings from all over the US. However, I'd only recommend it if it's going to get some use - otherwise you're probably fine just using the Joomla system without any plugin.
It sounds like you read a quick overview of Joomla and made a decision without having actually looked into what it can do, or looked at the demo sites created with it. Check it out again, and take a deeper look.
In fact, I had an attorney contact me relating to a Joomla site, and I had him a site up and running within about 4 hours. He had a template he wanted used, so I just installed the template, put in the text he wanted in the particular pages (i.e. articles) and it was done!
Have a look at the content component K2 for Joomla : http://getk2.org/
It allows you to easily create some kind of "pattern of articles", with additional informations, fields,..., then cou can sort them,...
Look here: http://php.opensourcecms.com/ There is a big list of great OpenSource CMS Software, choose the one which has the features which you need.
I don't have a lot of Joomla experience, so can't speak to that; but SharePoint "revolves" around lists, so it will fit your requirements pretty well.

Terms for modern system

This may not be for this forum, but...
We write new system and people are used to older system where components are called "modules". So they talk about the accounting module and the auditing module, etc...
This feels very old, like cobol/mainframe talk. What would be better term for functional components in a modern-distributed java system? Would you say the accounting component? The accounting service? Not sure. They refer to the function in the system (and all components behind it) that allow you to perform accounting functions.
If it ain't broke, don't fix it.
The fact that you are asking SO for advice on this suggests that you don't have a better nomenclature ready to use. Spend your time doing something more productive than fretting about this.
I think that "module" is a perfectly reasonable way to refer to a set of functionality. It's still widely used in many languages and frameworks. If it sounds "old" it's only because of your own frame of reference.
Besides, the customer is always right. You should be adopting their verbiage instead of trying to force them to use yours. Do what you want internally but stick with "modules" for the customers' sakes.
Python, a thoroughly modern programming language, has "modules." I don't think there is anything archaic about the word.
If users are used to calling things in the old system "modules," then it will make the new system easier to learn if you use the same terminology.
bundle is the new term ;-) ofcourse coined by OSGI. But when you say bundle then lot of assumptions are made on your code. So whether you want to use this or not is left to you.

Good image gallery engines

What are the best open source image gallery engines? Both stand-alone, and for existing frameworks such as Wordpress or Drupal.
Hopefully we can build a good list here over time.
Gallery is the classic choice. It has skins, security layers, heaps of plugins, etc, but can be run with the default settings easily if you want to. I've used it for years.
GOOD QUESTION, lots of people ask this in many web forums so hopefully we will get some good responses to this, and have a good list of solutions.
Personally I always used to say something like Gallery or some other OS script, but recently I have found myself using more and more something like a simple php script which just spits our a list of images (maybe 7 a page) but relying on a Javascript library such as mootools or Ext to provide all the functionality, particularly for small or individual galleries. Im particularly loving the noobslide mootools class at the moment which has some lovely gallery effects.
Noobslide
I suppose at the end of the day its all down to what you need, there will be no one answer that fits all but a number of different solutions will hopefully show up here that will suit different peoples needs.

Resources