Changelog file: YAML vs JSON vs CSV [closed] - php

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I am creating a simple Changelog lib in CodeIgniter that will basically log a message everytime someone adds, deletes, changes or publish a blog post. I will log messages in files by batches of 300. So every 301st message will go in a new file. At first I wanted to write the logs to simple .log files but then I got the idea to actually style the thing and I had to seperate each "attribute" of each message (ie: the user, the message, the type of the log, etc.). So .log files are out of the question since extracting the info would be a pain.
What is the most appropriate format for such a task? I already ruled out MySQL and XML because they are too heavy (especially considering that the log files won't exceed (about) 300 lines). I suggested YAML vs JSON vs CSV in the title, but is there yet a better alternative?

I'd say it all depends on what you need/want to do with those files :
CSV has one advantage : it can be imported to Excel and such applications -- which might be usefull in some situations, to do reporting to a superior, for instance
JSON is readable in many languages, including Javascript ; but not easy to read by a human being ; and harder to modify "by hand"
And YAML is quite easy to read ; not hard to modify by hand ; but not sure about the availability of libraries to read it in several languages.
If you are in none of these situations :
must be readable
by a human being
in several programming languages
easy to modify
same notes
Then I guess all three formats will be OK ^^
Without knowing more, I would go with either CSV (for the import to Excel stuff), or JSON (for the portability reason).

I guess CSV would be easier because of a couple of reasons:
count how many logs are already in the list (just count number of lines)
adding stuff to a JSON object can't be done by just appending data
Of course, I you choose to create a separate JSON object for each log item and put each on a separate line, this isn't an issue.

Related

Php code protection libraries [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
There are many code protection libraries in php, however they require installation of additional php modules, which I can not afford because the application will be running on servers I do not own. So I thought I could make my own.
What I want to do:
$source = file_get_contents("encryptedPhpFile.php");
$source = decrypt($source, "mySecretKey");
//$source now contains decrypted source code which needs to be included
//I cant use eval($source); because that code also contains
//html/css/opening and closing php tags ... which eval() does
//not know how to render
//I cant write the source into temporary file and then include
//that file because as soon as I write decrypted source to a disk,
//it is exposed and it can be copyed
What can I do? Any suggestions?
These libraries are modules for a reason. You will not be able to fully simulate them in "code space". Your attempts will be clumsy (not your fault) and make your codebase far less pleasing/maintainable.
You should instead focus your efforts on obtaining permission to install them, migrating to a host that lets you control your server to a useful degree, or getting your own server up and running.
Again and again.
We cannot protect PHP source code. PHP was not meant to be 'protected'. Even compiling code to binary is prone to reverse engineering. In your example, when you decrypt source with secret key (how secret - there he is) you do what? Eval it? Replace eval with echo.
Write license & do legal job with lawyer. Organize business model so your customers would want to pay you so they could get updates & support.
Regarding code protection libraries (paid ones): there are free online services that automatically decode them for you...

Looking for a Q&D PHP SQLite editing solution [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Here's what I need: I have a table in a SQLite file, that contains items - descriptions, dimensions, image and thumbnail.
I need to allow someone from outside the company to edit this table through an "admin interface". I need a simple login mechanism to authenticate said user, and I need a form that shows all available rows in the table applicable to him/her, and allow editing the values. That may include uploading images.
Now, I've developed tons of these interfaces before, in several languages. What I'd like to ask is: is there a shortcut? Since this needs to be quick and dirty (i.e., this wasn't in the original plan, I'm not being paid for this, but I may lose a client if I don't have it in place) and be up as soon as possible, is there some open source solution, or any previous PHP code, that I can customize and use in this and future cases?
Any solution that will save me time is welcome.
Thanks for YOUR time :)
Guy
Well if you can use a framework you could use an auto generated admin interface or scaffolding from a framework. Symfony and Cake both have this. Of course thats a lot of dead weight to have if the whole app/site isnt using the framework. But it would make it relatively painless to create. IF you can run this interface on a subdomain that would make it even esier since you dont have to worry about integrating it with anything existing except the DB and shared folder for the uploaded files.

Custom forums and design [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
Nukewarz
What would you think needs to be added to improve this site (design wise).
There has been a lot of work put into it and now im really wanting it to be semi perfect.
Any recommendations for a nice simple php forum seeing as i already have a users database.
Are you looking for ready made php forum? I may suggest MyBB which is really simple to manage and edit and it's quite extensible. Or you could try phpBB, which is tougher in personalization but very solid and powerful. If I dint' get the 'question' wrong..
I think you may have forgotten to post the link?
Regarding the forums, what format is your users database already in. For example, do you have some sort of CMS functionality where you have captured user's data, do you have an Excel spreadsheet, Facebook fan page etc.? In other words, how is your user data currently stored?
EDIT - sorry, this was too long to go in the comment field
Data is stored in a mysql database when a user register
So it's some sort of custom form which captures the user info into a database? If you have less than a couple of thousand users and you only need to do this once, probably the easiest thing to do would be to export your users out from the database into a CSV file - see How to output MySQL query results in CSV format? or just use PHPMyAdmin depending on your level of file access.
Many open-source forum softwares (e.g. PHPBB and Phorum) have the ability to import a CSV file, so all you'd have to do then is get a template for your import CSV file, and copy your user data with the correct formatting into this. MyBB (mentioned by Damien) seems fine, and already has some merge functionality - see http://www.mybb.com/downloads/merge-system - I'm not sure if this would suit you though since you haven't identified an existing software (i.e. you might need to write a custom importer).
One trick I have learned is to create a user in any given database driven software (e.g. PHPBB), and export the appropriate user table to CSV using the technique I just mentioned (or using the built in functions in PHPMyAdmin). You can then use this as the template, and then read the data back ito the database, see Import CSV to MySQL . This can be a hit-and-miss technique depending on how many dependant tables there are for the user table.

Good open source analytics/stats software in PHP? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
The url shortening service I'm building needs to display some basic click stats to users: # of clicks, conversions, referring domains, and country (filterable by a date range). I'll possibly want more advanced stats in the future.
Is there existing open source software that will allow me to pass events to it and then easily display a bar or line graph of that event (for example, a line graph of "conversions" between two specified dates). It seems like something like this should exist and would be much easier then building the whole thing from scratch.
I know there are graphing scripts, but that still requires me to format the data (usually as an xml file) and then pass it to the graph. I'm looking for something a bit more complete, which I can just feed the events and then it does everything else.
There are a large number of packages that do what you want. The most popular ones are:
Cobub Razor (Redis supported for high performance)
Piwik
Open Web Analytics
TraceWatch
They all require a database connection (mostly MySQL) to collect and store the data, which can be a performance problem when your service becomes popular.
One of the simpler packages that is file-based is
BBClone
The features of file-based solutions are generally more limited.
Every kind of software I can image will need you to generate the data you want to plot.
At this point, you have two possibilities:
Use a third party solution for your stats (such as Google Analytics)
Use a library to show your data graphically
The first solution will be easy to use, but it won't be flexible.
The second one will be a bit harder (not too much), but you'll decide what to plot and how.
I've recently started an open source project to make the highcharts plotting easier from php. You might want to have a look to it.
AWStats is the best open source analytics/stats software I have used. Recently we have moved away AWStats and we are using Google Analytics, but that is because we are also using Google Adwords. AWStats is a great program.

looking for a db abstraction/substitute that actually works [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
i am looking for a form of data storage that will answer a few requirements. i realize these requirements are non-standard, and for now i'm using activerecord and ORM solutions like everyone else, but this is my "holy grail" - if you know of anything like this, i would be eternally grateful:
pure PHP
multiple repositories, preferably file based for portability, where i can instantiate by telling it "use repository [X]" - i don't want to pre-create repository [X], if i reference it, it exists.
zero database configuration - i don't want to create tables or export SQL dumps, if it's referenced in my code, it needs to be in the database, auto-created without any fuss, my code is my schema
hierarchical, not relational, ideal structure would be just a freeform, schema-less XML, but since XML performs horribly with large trees, it can't simply be an XML file.
i have experimented with flat XML storage (with xpath and xquery) but it gags on a mid-sized repository, and cripples the application.
i have also experimented with key=>value pairs dropped into a SQLite database with a single generic table, but that gags even faster, and re-forming even the simplest record from key=>value pairs is a performance decimator.
finally, i experimented with lucene as implemented in the zend framework, which was pretty close to ideal, apart from the no-update part.
any ideas, anyone?
I've been having great fun with RedBean, it's not quite designed for flatfiles, but runs on PDO, so it should be relatively easy to write a sqlite module for it. Not sure if it will work for your needs, but definitely worth taking a look at.
Here are some links you may find useful:
txtSQL
Gladius DB
Also, have you considered using Berkeley DB?
Some of the DB extensions listed in the PHP Manual are intended to be used on flat-file like databases.
From your description it seems like PHP arrays should work perfectly:
pure PHP
multiple arrays, file or memory based
your code is your schema
hierarchical
You could use serialize() or var_export() functions to enable file storage.

Categories