Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Pages: [1] 2

Author Topic: Announcing: sNooze-IC  (Read 11667 times)

Joost

  • Guest
Announcing: sNooze-IC
« on: January 17, 2009, 08:31:32 PM »

sNooze-IC, what the f**k is sNooze-IC?

Project sNooze-IC is a private project, based upon sNews, but almost written from scratch: Cleaning and modifying sNews code is simply to much work.
It is a three level system, less than 60kb. The package is a snap-shot of an ongoing, never-ending process, taken a few months back.

Why is sNooze-IC posted in "Looking towards 2.0" ?

It is posted here for a reason. Until now, there has been a lot of talking about sNews 2.0 and even more about a plugin system.
I think it is about time to discuss core code, discussing internals. Therefore we need code and that's why I decided to publish the project.
sNooze-IC as a whole, might not be what sNews (the sNews community) wants or needs.
Pay attention to the database structure and the php code responsible for updating/inserting the database. That's the code of which I think is of interest for sNews 2.x.
The php code that manages the database is quite flexible. Changing, adding or removing columns is fairly simple (on developers level). You can find more information in this developers document, which is also included in the package.

What's with the license ?? !!

If you haven't read it yet:

/*
sNooze-IC version 0.1
copyright 2009 J.A.Kerkelaan
LICENCE: This software is licensed to you for evaluation only,
The licence expires on April 1 2009
*/


Of course, it addresses code that is written by me and hasn't been published before on the forum.
Additional, I hereby declare that all code, that is included in an official sNews > 2 distribution, is automatically licensed under Creative Commons License, unconditionally.
 
Reason is: It is a private project and I am not fond of ccl. So it will become ccl only when necessary.
Neither do I want to see code end up in another MU, MEMU, LULU or light version. I don't think all these sNews versions are good for the community. This way I prevent that to happen. ;)

This thread, is not meant for discussing features.
It is about code, architecture and strategy.
It is about ideas, how to develop the next generation. If my view doesn't fit sNews, that's just as good. Then we know what we don't want.

Oh, eh,.. . the package: sNooze-IC. :)
« Last Edit: January 17, 2009, 08:37:13 PM by Joost »
Logged

Patric Ahlqvist

  • Nobodys perfect, but Im pretty effing close
  • ULTIMATE member
  • ******
  • Karma: 65
  • Posts: 4867
  • I'm a self-made man and worships my creator.
    • p-ahlqvist.com
Re: Announcing: sNooze-IC
« Reply #1 on: January 17, 2009, 08:51:07 PM »

Damn, this aughta be cool ;)
Logged
"It's only dead fish that goes with the flow... "
Updated

philmoz

  • High flyer
  • ULTIMATE member
  • ******
  • Karma: 161
  • Posts: 1988
    • fiddle 'n fly
Re: Announcing: sNooze-IC
« Reply #2 on: January 18, 2009, 02:38:28 AM »

thoughts...
Intuitive
Easy to manage .. at this stage ;)

errata...
# Upload and delete files. Change directory
function files(){

$root = dirname(realpath('.')).$where;  $where should be $directory :D
Logged
Of all the things I have lost, it is my mind that I miss the most.

Joost

  • Guest
Re: Announcing: sNooze-IC
« Reply #3 on: January 18, 2009, 04:07:26 AM »

 ??? I thought I was responding to a post that was here a few hours ago.  ???

Anyway, these questions might rise again, so here is some additional information:

- I started using mysql instead of mysqli  for a practical reason. When I began the project, I didn't have the mysqli library installed correctly. Changing it is futile, so I postponed it.... and forgot about it.
-  MyISAM engine is used: Foreign key constraints is handled on application level, making the system easier to port (sqlite).  So there is no important reason to use InnoDB.
-  Javascript: I have little knowledge about that. I fixed some issues, that's all.
- Plugin system etc: For sure, sNooze-IC will be broken down into a bunch of small files, which will be included on demand (dynamically). Index.php will have to take care of that and will probably be used to administer addons and such. Hardcoded links in the template, pointing to contact.php (for instance), that is fine with me.
Where sNews is gonna go, that's not up to me.


thoughts...
Intuitive
Easy to manage .. at this stage ;)

errata...
# Upload and delete files. Change directory
function files(){

$root = dirname(realpath('.')).$where;  $where should be $directory :D

Yep, that mistake is one of my infamous "last minute changes". I probably have to redo function files anyway. :-\
« Last Edit: January 18, 2009, 04:13:13 AM by Joost »
Logged

centered

  • Guest
Re: Announcing: sNooze-IC
« Reply #4 on: January 18, 2009, 06:24:46 AM »

??? I thought I was responding to a post that was here a few hours ago.  ???

Ya, I mistakenly removed my post and forgot what I wrote.  Either way, let me refresh what I noted before:

First, thanks for this as it get's into your thinking more. Many of your techniques are new and not so new to me (as in I have seen them but didn't know fully how they work).

Second, not sure if it was done intentionally, but I chuckled at the license end date ( any reason for that date? Not sure about other countries, but in the states April 1 is known as April Fools Day, a day of jokes and mischief.  Not sure if that's what you meant ) and the "tit" and "showtit" columns.  Additionally at the code ending up a certain "light" version running around somewhere (wonders where) - Don't worry, I can go to the strip club for `showtits` (meaning, I respect your license and no code will end up in snLite.  TBH the rewrite planning is akin to your thoughts so it will be a different animal than both if I complete it)

 - side note.  Some sNews Dudes support Forks of sNews.  While I may agree with you on your statement, it is desired by the sNews community (You could recall my beef with the modded packages during 1.6 days).  In addition, the code structure of sNews fully supports this.  I am sure no two sNews core files are alike (from 1.3 to the current version). Hence the 2.0 discussion.  Hopefully there will be no more forks after 2.0, as the sNews core should never be modified - This should be the resounding line for developing 2.0.  (anyone mod other core CMS files? Why does it seem only for sNews?)

What you have here is a step in the right direction.  I still think elements can be removed further to make your system (if you choose, or if the sNews Dudes want to go in this direction)  leaner and more "pluggable".  I noted a few times removing archives, sitemap, and contact functions and code to make the overall script clean.  I used that as a example, but I noted that I could of stated inline javascript as an example as well.

I do have further question on your db structure now that I am viewing it, but I will come back to that at a later time.

I also wanted to go off on a tangent about phrases you and I state here and there but I will hold off for another thread.
« Last Edit: January 18, 2009, 06:31:17 AM by equilni »
Logged

funlw65

  • Hero Member
  • *****
  • Karma: 96
  • Posts: 771
    • Country Lab
Re: Announcing: sNooze-IC
« Reply #5 on: January 19, 2009, 06:14:09 AM »

Joost, if blog functionality can be easy made as module, then, let it be "classic" (anyway, is a very advanced classic with subpages).
I saw "developer's documentation" and I like the project and I will try to learn. Thank you, I will respect the license (no sLulu from my part ;D ).
Logged

centered

  • Guest
Re: Announcing: sNooze-IC
« Reply #6 on: January 19, 2009, 04:52:15 PM »

Joost,

You could have abstracted the db further or did you find it be too complex writing the queries at that point? extra and front still have text columns.  Descrip and keyw from the seting table could of went into the meta table, and so on. May I ask why you didn't go with more lookup tables?

Good point on InnoDB's functionality in relationship to porting to Sqlite. Which I am glad it is still a glimmer in some's eyes.  I forgot FKs and constraints are not supported.

Oh I love the concat function, never knew it existed in mysql (I use the concatenate feature in spreadsheets all the time at work =a1&"-"&b1).  Genius!

About enum, I found out recently how memory consumption is bad using YES|NO when you can use TINYINT for 0/1.

Joost, if blog functionality can be easy made as module, then, let it be "classic" (anyway, is a very advanced classic with subpages).

Exactly my opinions as well (it was how I initially envisioned a "light" version out to be), *but* then it will not be sNews anymore would it? 

An important choice to make: What type of cms is sNews (going to be)? Is it a blog, a magazine or a traditional (static) cms? By defining that, we also know which functions will be part of the core, which features will be prominent. Of course, as long as functionality live happily alongside in the core, let it be. In cases where one might obstruct the other, we know which one has to go.
sNooze-IC reveals my preference for that matter: The blog system is not prominent (even lacking comment functionality) and is designed in such a way, that making it an addon is simple. I think sNews should basically be classic cms by default, not a blog system. While a blog system is mainly suitable for personal use, a classic cms can serve as company website as well. Considered the fact, that sNews is very flexible (easy), when it comes to styling, sNews should be the tool for xhtml/css designers; both hobbyists and professionals.
To serve the professional, focus must be on the admin section (enhancements, addons).

Serving developers is, how strange it might sound, highest priority. If they're not able to help themselves, they won't be able help others by building nifty features. So we have to find a way to keep the system maintanable and extensible.
Basically it is about code quality. You can read the article and a thousand more books, but I think we can reduce that to these coding rules and the following:
- Clean up absolete code.
- Distinguise between hacking, modding and developing.

Couldn't have this better myself.  Actually, I may have said similar things in public and in private.

sNews is... I don't know myself.  A tool I spend way to much time on developing on lol!  Really I think sNews should be a page site first (simialr to sNooze and snLite), then have the News/Blog portion secondary).  Why?  Joost stated it best, but in addition, not everyone needs a blog
sNews also is currently NOT a developers tool. At least not compared to the current tools out there (won't name drop here).  Copying and Pasting functionality is not time well spent developing sites for clients.  What the sNews community is doing now is hacking. (BTW most of the community are not php developers, so who is benefiting?)

Sorry Joost that last part wasn't directed at you nor may not be in total response to your thread - sorry!!
« Last Edit: January 20, 2009, 01:27:29 PM by equilni »
Logged

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6019
  • Semantically Challenged
    • snews.ca
Re: Announcing: sNooze-IC
« Reply #7 on: January 20, 2009, 05:37:58 AM »

This is an excellent birth announcement Joost. I am envious. All this time I thought you were just hanging out at the jam room in your bar.  ;D
I hope I can try this out soon. I hope I can remember that it's here.

Life has been hectic lately for me...
Mother-in-law with serious health problems 2,500 miles away in Calgary, wife on expensive plane trips every month.
Sister also with serious health problems, too many 20-hour round-trips (by Jeep) for visits.
Snow keeps coming down, and arthritis is attacking my right shoulder & left knee with a vengence.
Our 17 year-old dog's dementia sent her around the bend this weekend, so we had to put her to sleep today (another $450).
And too many client demands, making me wish I didn't have any clients.
I need a breather... maybe a trip to a far-off place... Sven's new home in the country of France looks nice.  ;D

@ Jason... I hope you get over your cold soon. I hate colds.
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

Joost

  • Guest
Re: Announcing: sNooze-IC
« Reply #8 on: January 20, 2009, 06:12:26 AM »

I need a breather... maybe a trip to a far-off place... Sven's new home in the country of France looks nice.  ;D

Yes, let's surprise him with a housewarming party. I'll arrange keyboard, amplifiers and drum-kit, Philippe arranges the booze, the rest bring their good mood.
"Get your kicks on avenue soixante-six !"  ;D
Logged

centered

  • Guest
Re: Announcing: sNooze-IC
« Reply #9 on: January 20, 2009, 01:28:23 PM »

I will just keep taking my meds... and more of them..... i have to show my face into work today.  I will try and smile...  and spread my disease or whatever I have
Logged

Joost

  • Guest
Re: Announcing: sNooze-IC
« Reply #10 on: January 28, 2009, 01:05:23 AM »

You could have abstracted the db further or did you find it be too complex writing the queries at that point? extra and front still have text columns.  Descrip and keyw from the seting table could of went into the meta table, and so on. May I ask why you didn't go with more lookup tables?

The term "abstraction" in context of database tables I don't really understand, but I try to explain why this design.
I need to keep table `cs` (content settings) small, because it is accessed many times:
 call 1 - To verify the existence/ access permission of content (uri='/do/i/exist/' ) and retrieve id
 call 2 - Create menu section
 call 3 - Create side menu
 call 4 - Create third level content
 call n - Additional calls might be wanted (mods) for "latest articles", "archive", "most popular articles" etc
In all those calls, we don't need any text, it is dead weight called to the server's memory if it had been stored in the same table. Here are some numbers coming from a test database:

Table  cs: 2,000 record         311.2 KiB
Table txt: 2,000 record             8.9 MiB

Both table `front` and `extra` are only accessed to retrieve text. So there is no need to store it in a separate table.

Having metadata of `front`, stored in table settings is quite convenient: function s retrieves all settings at once, it is allways there and is used, if the administrator forgets to insert metadata when creating a new page.

About addons

Sitemap, archive and contact can be added in three steps:
1 - Upload the file (which includes the function).
2 - Find the following code and add the name of the function (line 45).
Code: (snooze.php) [Select]
<?php
if (
in_array($URI[0], array('contact','archive','funnypage') ) && empty($URI[1]) ) { 
include "./addon/$URI[0].php";
$center $URI[0]; break; }
?>

(Of course, it is wise to place that array somewhere else (config.php), making it more convenient to edit.)

3 - add an link to index.php (or template) OR create a section in the database (that way, it can have its own metadata (another seo issue solved) ).

With these functions/addons in a separate folder, we have gained:
- Easy removing / adding
- Easy replacing ( with a modded version)
- smaller memory footprint (only code that is going to be used, is called to memory )


The blog system is a bit more complicated. 'blog' is called twice, I think the same method can be used, as it can be called in the included file. Blog is also managed in the adminsection. Therefore, the blog setting needs to be removed  from page '?admin=settings'. I haven't got an idea yet how to add a blog-settings-page to administration


A thought: Make blog a standalone, which is from my point of view (looking for simplicity) very tempting.The addon needs:
- function blogform 1kb
- function blog 1.6 kb
- function paginator 0.9 kb
- function mysql_connect etc.
- a template .6kb
- config settings and some dependencies (lang ?)

So even in a worst-case scenario (lot of redundancy), a standalone won't exceed 7 or 8kb
For a google sitemap.xml generator, I would always suggest a standalone.


Something completely different (css-talk): When looking at index.php (the template), I noticed that most classes and id  are generated by the engine instead of being in the template. xhtml/css designers should have more control.
So instead of:
Code: (template) [Select]
<?php Section();?>
it should be:

Code: (template) [Select]
<ul id="horizontal_menu"><?php Section();?></ul>
Logged

Rui Mendes

  • Development,Testing, Support
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1009
  • sNews1.7
    • Comunidade Portuguesa
Re: Announcing: sNooze-IC
« Reply #11 on: January 31, 2009, 01:41:03 AM »

Very, VERY GOOD Job my friend.

I start see your work, and I have one question:
In function positionIntegrity($id){
$cat = (int)$_POST['cat'];

This give error, and is new for me (int)$_POST['cat']; or is error

Logged
Need a Job on Europe. Linkdin - Facebook / Group

Joost

  • Guest
Re: Announcing: sNooze-IC
« Reply #12 on: January 31, 2009, 02:13:59 AM »

(int) forces a variable to be an integer.
I use it to trim AND sanitize user input at the same time.


What kind of error does it return under which circumstances?
Logged

Rui Mendes

  • Development,Testing, Support
  • Hero Member
  • *****
  • Karma: 195
  • Posts: 1009
  • sNews1.7
    • Comunidade Portuguesa
Re: Announcing: sNooze-IC
« Reply #13 on: January 31, 2009, 02:24:40 AM »

In localhost give this error creating a new section

Quote
Notice: Undefined index: cat in D:\xampp\htdocs\joost\snooze-ic.php on line 572

Warning: Cannot modify header information - headers already sent by (output started at D:\xampp\htdocs\joost\snooze-ic.php:572) in D:\xampp\htdocs\joost\snooze-ic.php on line 736
Logged
Need a Job on Europe. Linkdin - Facebook / Group

Joost

  • Guest
Re: Announcing: sNooze-IC
« Reply #14 on: January 31, 2009, 02:49:33 AM »

I see where the problem is: It is in the form.
That's going to be a design decision. I can insert


Code: [Select]
echo '<input type="hidden" name="cat" id ="cat" value="%d" />'- In function SelectOption
- In function content (somewhere after  if($new ==='newcat')  )
- Or change the process flow in function proces_content

Thanks for the feedback Rui.  :)
ps: This isn't a file I am going to update regularly

Logged
Pages: [1] 2