[geeklog-devtalk] geeklog-devel digest, Vol 1 #458 - 12 msgs

geeklog-devel-request at lists.geeklog.net geeklog-devel-request at lists.geeklog.net
Fri Dec 17 12:17:04 EST 2004


Send geeklog-devel mailing list submissions to
geeklog-devel at lists.geeklog.net

To subscribe or unsubscribe via the World Wide Web, visit
http://lists.geeklog.net/listinfo/geeklog-devel
or, via email, send a message with subject or body 'help' to
geeklog-devel-request at lists.geeklog.net

You can reach the person managing the list at
geeklog-devel-admin at lists.geeklog.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of geeklog-devel digest..."


Today's Topics:

1. Re: Actual Working Schema for GL2 (Dirk Haun)
2. Re: Actual Working Schema for GL2 (Tony Bibbs)
3. Article throttle. (Justin Carlson)
4. Re: Article throttle. (Justin Carlson)
5. Re: Actual Working Schema for GL2 (Vincent Furia)
6. Re: Actual Working Schema for GL2 (Justin Carlson)
7. Re: Actual Working Schema for GL2 (Vincent Furia)
8. Re: Actual Working Schema for GL2 (Tony Bibbs)
9. Re: Actual Working Schema for GL2 (Justin Carlson)
10. GL2 and CVS (Tony Bibbs)
11. [Fwd: Re: [propel] Multiple DBMS's and date/time] (Tony Bibbs)
12. Re: [Fwd: Re: [propel] Multiple DBMS's and date/time] (Vincent Furia)

--__--__--

Message: 1
From: "Dirk Haun" <dirk at haun-online.de>
To: <geeklog-devel at lists.geeklog.net>
Subject: Re: [geeklog-devel] Actual Working Schema for GL2
Date: Thu, 16 Dec 2004 23:00:17 +0100
Organization: Terra Software Systems
Reply-To: geeklog-devel at lists.geeklog.net

Tony wrote:


>CREATE TABLE gl2_user (


Time zone?

bye, Dirk


--
http://www.haun-online.de/
http://mypod.de/


--__--__--

Message: 2
Date: Thu, 16 Dec 2004 16:33:53 -0600
From: Tony Bibbs <tony at tonybibbs.com>
To: geeklog-devel at lists.geeklog.net
Subject: Re: [geeklog-devel] Actual Working Schema for GL2
Reply-To: geeklog-devel at lists.geeklog.net

oops. I'll add it.

Dirk Haun wrote:


>Tony wrote:

>

>

>

>>CREATE TABLE gl2_user (

>>

>>

>

>Time zone?

>

>bye, Dirk

>

>

>

>



--__--__--

Message: 3
Date: Thu, 16 Dec 2004 16:41:16 -0600
From: Justin Carlson <justin.carlson at gmail.com>
To: geeklog-devel at lists.geeklog.net
Subject: [geeklog-devel] Article throttle.
Reply-To: geeklog-devel at lists.geeklog.net

Some sites get nailed, by links from slashdot, or other similar sites.
An example would be GrokLaw.

I've got what I think is an incredibly simple solution.
I've taken the current version of Geeklog, and added these lines: to
the conf file:



// Article
// This will allow you to setup a throttle based on guests and direct links to
// stories. For example, if you set the throttle to 300, and there are 300 guest
// users online, any story or article linked from another site will only display
// the text of the item, no layout or general site graphics. This very
simplistic
// method of bandwidth protection could save your site in the event of a
// sudden surge of activity.
$_CONF['throttle'] = '0';
// A value of '0' will shut the throttle off. (default)



Then in public_html/article.php, I've added the following code at or
near line 73 ( after the if (isset ($HTTP_POST_VARS['mode'])) { }
block.



// Throttle
$rs = DB_query( "SELECT DISTINCT uid,remote_ip FROM
{$_TABLES['sessions']} WHERE uid = 1" );
if($_CONF['throttle']>0 && DB_numRows($rs)>=$_CONF['throttle'] &&
!eregi($_CONF['site_url'],$_SERVER['HTTP_REFERER'])) $mode='print';




What this does is extremely simple. The owner of the website sets a
throttle, which is a number of guest users. Once this number is
reached, any article accessed from an external link or directly
accessed will display in print mode. This should greatly reduce the
number of database queries, as well as the number of GET requests to
the server. ( No site graphics, only story graphics ).

For GL2, I'd like to build more into the site, to allow any page to be
throttled, but for the current release I feel is pretty decent.

I have not contributed before. I am looking for thoughts and, I guess,
someone to place this into the test site for including in the next
version.

--__--__--

Message: 4
Date: Thu, 16 Dec 2004 16:46:51 -0600
From: Justin Carlson <justin.carlson at gmail.com>
To: geeklog-devel at lists.geeklog.net
Subject: [geeklog-devel] Re: Article throttle.
Reply-To: geeklog-devel at lists.geeklog.net

I should probably clean this a little for read-ability, and so it does
not query if the throttle is not on:

// Throttle
if($_CONF['throttle']>0){
$rs = DB_query( "SELECT DISTINCT uid,remote_ip FROM
{$_TABLES['sessions']} WHERE uid = 1" );
if(DB_numRows($rs)>=$_CONF['throttle'])}{
if(!eregi($_CONF['site_url'],$_SERVER['HTTP_REFERER'])){
$mode='print';
}
}
}



On Thu, 16 Dec 2004 16:41:16 -0600, Justin Carlson
<justin.carlson at gmail.com> wrote:

> Some sites get nailed, by links from slashdot, or other similar sites.

> An example would be GrokLaw.

>

> I've got what I think is an incredibly simple solution.

> I've taken the current version of Geeklog, and added these lines: to

> the conf file:

>

> // Article

> // This will allow you to setup a throttle based on guests and direct links to

> // stories. For example, if you set the throttle to 300, and there are 300 guest

> // users online, any story or article linked from another site will only display

> // the text of the item, no layout or general site graphics. This very

> simplistic

> // method of bandwidth protection could save your site in the event of a

> // sudden surge of activity.

> $_CONF['throttle'] = '0';

> // A value of '0' will shut the throttle off. (default)

>

> Then in public_html/article.php, I've added the following code at or

> near line 73 ( after the if (isset ($HTTP_POST_VARS['mode'])) { }

> block.

>

> // Throttle

> $rs = DB_query( "SELECT DISTINCT uid,remote_ip FROM

> {$_TABLES['sessions']} WHERE uid = 1" );

> if($_CONF['throttle']>0 && DB_numRows($rs)>=$_CONF['throttle'] &&

> !eregi($_CONF['site_url'],$_SERVER['HTTP_REFERER'])) $mode='print';

>

> What this does is extremely simple. The owner of the website sets a

> throttle, which is a number of guest users. Once this number is

> reached, any article accessed from an external link or directly

> accessed will display in print mode. This should greatly reduce the

> number of database queries, as well as the number of GET requests to

> the server. ( No site graphics, only story graphics ).

>

> For GL2, I'd like to build more into the site, to allow any page to be

> throttled, but for the current release I feel is pretty decent.

>

> I have not contributed before. I am looking for thoughts and, I guess,

> someone to place this into the test site for including in the next

> version.

>


--__--__--

Message: 5
Date: Thu, 16 Dec 2004 23:36:21 -0500
From: Vincent Furia <vfuria at gmail.com>
To: geeklog-devel at lists.geeklog.net
Subject: Re: [geeklog-devel] Actual Working Schema for GL2
Reply-To: geeklog-devel at lists.geeklog.net

Tony,

A couple more things:

1. You don't need the left_index or right_index in gl_category since
it has 1-1 relationship with the item table which already has those.

2. Why are you using INTs for dates? Why not TIMESTAMPs or DATETIMEs?

3. Don't forget you want indexes on columns on which you plan to sort.

4. In gl2_group change the display_name column to group_name to be consistent.

5. I think we should standardize on just a couple lengths of varchar
fields (all URLs should be 256, all _names should be 40 or 50).
- the homepage varchar in gl2_user is way too short, presumably
this is a URL

6. gl2_item_type_state seems redundant. Just use the LOV Table, where
the group_name indicates type and the lov_id/short_name indicate that
state. Or am I missing something?

-Vinny


On Thu, 16 Dec 2004 15:43:51 -0600, Tony Bibbs <tony at tonybibbs.com> wrote:

> Ok, I've attached a working version of the schema. Worth noting, is

> anywhere in the old schema where we had parent_id fields I replaced them

> with the left_index, right_index. Seems to me that if it is good enough

> for comment performance, it's good enough for everyone else.

>

> Next up is to build the first set of Propel classes from this schema.

> Cross your fingers.

>

> --Tony


--__--__--

Message: 6
Date: Fri, 17 Dec 2004 02:38:15 -0600
From: Justin Carlson <justin.carlson at gmail.com>
To: geeklog-devel at lists.geeklog.net
Subject: Re: [geeklog-devel] Actual Working Schema for GL2
Reply-To: geeklog-devel at lists.geeklog.net


> 2. Why are you using INTs for dates? Why not TIMESTAMPs or DATETIMEs?


For mktime() or time() stamps, at least, that's what I like to use.
Then users can choose whatever they want via a dropdown, allowing them
to easily set zone and date format.

--__--__--

Message: 7
Date: Fri, 17 Dec 2004 08:27:34 -0500
From: Vincent Furia <vfuria at gmail.com>
To: geeklog-devel at lists.geeklog.net
Subject: Re: [geeklog-devel] Actual Working Schema for GL2
Reply-To: geeklog-devel at lists.geeklog.net

Then why not use TIMESTAMPs or DATETIMEs? Changing the format of a
date/time string is a trivial and fast operation. Plus using
DATETIMEs allows you to use any date from 1-1-0000 to 12-21-9999 as
opposed to just ~1970 to ~2037. Both have the same flexibility as
using a timestamp stored as an int, in addition they give you more
flexibility to do calculations on the server using mysql's time
functions.

-Vinny


On Fri, 17 Dec 2004 02:38:15 -0600, Justin Carlson
<justin.carlson at gmail.com> wrote:

> > 2. Why are you using INTs for dates? Why not TIMESTAMPs or DATETIMEs?

>

> For mktime() or time() stamps, at least, that's what I like to use.

> Then users can choose whatever they want via a dropdown, allowing them

> to easily set zone and date format.

> _______________________________________________

> geeklog-devel mailing list

> geeklog-devel at lists.geeklog.net

> http://lists.geeklog.net/listinfo/geeklog-devel

>


--__--__--

Message: 8
Date: Fri, 17 Dec 2004 09:34:14 -0600
From: Tony Bibbs <tony at tonybibbs.com>
To: geeklog-devel at lists.geeklog.net
Subject: Re: [geeklog-devel] Actual Working Schema for GL2
Reply-To: geeklog-devel at lists.geeklog.net

Vincent Furia wrote:


>Tony,

>

>A couple more things:

>

>1. You don't need the left_index or right_index in gl_category since

>it has 1-1 relationship with the item table which already has those.

>

>

Right you are


>2. Why are you using INTs for dates? Why not TIMESTAMPs or DATETIMEs?

>

>

Well, we need to discuss the issue of dates. Date handling, even with
an ORM can be a PITA with the native types from a DBMS. I need to play
with Propel more with this before we make a decision. Long and short is
I want to be sure the code that works with dates works across DBMS's


>3. Don't forget you want indexes on columns on which you plan to sort.

>

>

I'll double check. If there are some you think I missed send them over
for verification.


>4. In gl2_group change the display_name column to group_name to be consistent.

>

>

Right


>5. I think we should standardize on just a couple lengths of varchar

>fields (all URLs should be 256, all _names should be 40 or 50).

> - the homepage varchar in gl2_user is way too short, presumably

>this is a URL

>

>

Yeah, I was thinking the same thing. I'm betting Dwight might have some
good standards to start with. I was simply pulling the length out of my
backside (if you can't tell)


>6. gl2_item_type_state seems redundant. Just use the LOV Table, where

>the group_name indicates type and the lov_id/short_name indicate that

>state. Or am I missing something?

>

>

Yeah, made the change.


>-Vinny

>

>

>On Thu, 16 Dec 2004 15:43:51 -0600, Tony Bibbs <tony at tonybibbs.com> wrote:

>

>

>>Ok, I've attached a working version of the schema. Worth noting, is

>>anywhere in the old schema where we had parent_id fields I replaced them

>>with the left_index, right_index. Seems to me that if it is good enough

>>for comment performance, it's good enough for everyone else.

>>

>>Next up is to build the first set of Propel classes from this schema.

>>Cross your fingers.

>>

>>--Tony

>>

>>

>_______________________________________________

>geeklog-devel mailing list

>geeklog-devel at lists.geeklog.net

>http://lists.geeklog.net/listinfo/geeklog-devel

>

>



--__--__--

Message: 9
Date: Fri, 17 Dec 2004 10:04:56 -0600
From: Justin Carlson <justin.carlson at gmail.com>
To: geeklog-devel at lists.geeklog.net
Subject: Re: [geeklog-devel] Actual Working Schema for GL2
Reply-To: geeklog-devel at lists.geeklog.net

That's fine and all, just offering my thoughts. It is true that it
limits you to 1970 - 2037 or so, and that is a drawback if you are
working with dates in that range. ( If you plan on storing people's
birthdays or whatever ). I've just seen: $example =
date($userPref,$dbdatedata); and think it's pretty simple. It's also
sort-easy, of course YYYY-MM-DD HH:II:SS would sort and that point is
moot

Tony's point is very valid.


On Fri, 17 Dec 2004 08:27:34 -0500, Vincent Furia <vfuria at gmail.com> wrote:

> Then why not use TIMESTAMPs or DATETIMEs? Changing the format of a

> date/time string is a trivial and fast operation. Plus using

> DATETIMEs allows you to use any date from 1-1-0000 to 12-21-9999 as

> opposed to just ~1970 to ~2037. Both have the same flexibility as

> using a timestamp stored as an int, in addition they give you more

> flexibility to do calculations on the server using mysql's time

> functions.

>

> -Vinny

>

> On Fri, 17 Dec 2004 02:38:15 -0600, Justin Carlson

> <justin.carlson at gmail.com> wrote:

> > > 2. Why are you using INTs for dates? Why not TIMESTAMPs or DATETIMEs?

> >

> > For mktime() or time() stamps, at least, that's what I like to use.

> > Then users can choose whatever they want via a dropdown, allowing them

> > to easily set zone and date format.

> > _______________________________________________

> > geeklog-devel mailing list

> > geeklog-devel at lists.geeklog.net

> > http://lists.geeklog.net/listinfo/geeklog-devel

> >

> _______________________________________________

> geeklog-devel mailing list

> geeklog-devel at lists.geeklog.net

> http://lists.geeklog.net/listinfo/geeklog-devel

>


--__--__--

Message: 10
Date: Fri, 17 Dec 2004 10:25:22 -0600
From: Tony Bibbs <tony at tonybibbs.com>
To: geeklog-devel at lists.geeklog.net
Subject: [geeklog-devel] GL2 and CVS
Reply-To: geeklog-devel at lists.geeklog.net

At what point should I start checking stuff into CVS? I've yet another
modified database schema that I added timezone stuff too along with
changes per Vinny's suggestions in his last email. I didn't touch the
date/time fields yet.

Anyway, my point is I have a Propel build so do you want me to CVS this
as the first version or simply wait until we iron all the outstanding
database issues?

--Tony

--__--__--

Message: 11
Date: Fri, 17 Dec 2004 10:45:50 -0600
From: Tony Bibbs <tony at tonybibbs.com>
To: geeklog-devel at lists.geeklog.net
Subject: [geeklog-devel] [Fwd: Re: [propel] Multiple DBMS's and date/time]
Reply-To: geeklog-devel at lists.geeklog.net

Seems like we should go with the timestamp data type. Read below.

--Tony

-------- Original Message --------
Subject: Re: [propel] Multiple DBMS's and date/time
Date: Fri, 17 Dec 2004 11:36:17 -0500 (EST)
From: Hans Lellelid <hans at velum.net>
Reply-To: users at propel.tigris.org
To: users at propel.tigris.org
References: <41C304F4.7020205 at tonybibbs.com>
<15195.69.17.56.162.1103300475.spork at webmail.hozn.net>
<41C308F8.2090905 at tonybibbs.com>



Yeah, I'm quite sure you can set it at runtime, though you may need to set
it before opening the connection. I used to set it in Creole
MSSQLConnection class, but there was some reason that this wasn't always a
good idea. ... perhaps it was breaking when using freetds instead of MS
libs or something.

-Hans


> Cool. Is the MSSQL option you refer to in php.ini something I can set

> at runtime via ini_set()?

>

> --Tony

>

> Hans Lellelid wrote:

>

>>>I have a project that will be supported under multiple DBMS's (MySQL,

>>>Postgres and MS SQL). We are doing the general database design and we

>>>are to the topic of how to formate date/time values. All our values

>>>will be after 1970 so timestamps are an options. My question is whether

>>>or not to use the native date/time types in the DBMS via Propel. Does

>>>Propel handle this well or am I better of using a timestamp datatype or

>>>int?

>>>

>>>

>>>

>>

>>Propel handles this well and I would advise you to use TIMESTAMP rather

>>than INT.

>>

>>TIMESTAMP will be converted to the best representation (e.g. for MySQL it

>>will use DATETIME) for the RDBMS. The only thing you'll probably want to

>>fix is the MSSQL ini option (in php.ini) to have it use standard ISO date

>>formats.

>>

>>The getter methods that are generated by Propel will actually allow you

>> to

>>specify date/time formatters:

>>

>>$myobj->getTimeCol("Y-m-d"); // date()-formatting

>>

>>or

>>

>>$myobj->getTimeCol("%c"); // strftime()-formatting

>>

>>or

>>

>>$myobj->getTimeCol(null); // native unix timestamp

>>

>>or

>>

>>$myobj->getTimeCol(); // default is ISO: Y-m-d H:i:s

>>

>>Hope that helps.

>>

>>-Hans

>>

>>---------------------------------------------------------------------

>>To unsubscribe, e-mail: users-unsubscribe at propel.tigris.org

>>For additional commands, e-mail: users-help at propel.tigris.org

>>

>>

>

>

> ---------------------------------------------------------------------

> To unsubscribe, e-mail: users-unsubscribe at propel.tigris.org

> For additional commands, e-mail: users-help at propel.tigris.org

>

>







---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe at propel.tigris.org
For additional commands, e-mail: users-help at propel.tigris.org


--__--__--

Message: 12
Date: Fri, 17 Dec 2004 12:16:53 -0500
From: Vincent Furia <vfuria at gmail.com>
To: geeklog-devel at lists.geeklog.net
Subject: Re: [geeklog-devel] [Fwd: Re: [propel] Multiple DBMS's and date/time]
Reply-To: geeklog-devel at lists.geeklog.net

TIMESTAMP in Propel == DATETIME in MySQL. So in mysql DDL you'd want
to use DATETIME.

-Vinny


On Fri, 17 Dec 2004 10:45:50 -0600, Tony Bibbs <tony at tonybibbs.com> wrote:

> Seems like we should go with the timestamp data type. Read below.

>

> --Tony

>

> -------- Original Message --------

> Subject: Re: [propel] Multiple DBMS's and date/time

> Date: Fri, 17 Dec 2004 11:36:17 -0500 (EST)

> From: Hans Lellelid <hans at velum.net>

> Reply-To: users at propel.tigris.org

> To: users at propel.tigris.org

> References: <41C304F4.7020205 at tonybibbs.com>

> <15195.69.17.56.162.1103300475.spork at webmail.hozn.net>

> <41C308F8.2090905 at tonybibbs.com>

>

> Yeah, I'm quite sure you can set it at runtime, though you may need to set

> it before opening the connection. I used to set it in Creole

> MSSQLConnection class, but there was some reason that this wasn't always a

> good idea. ... perhaps it was breaking when using freetds instead of MS

> libs or something.

>

> -Hans

>

> > Cool. Is the MSSQL option you refer to in php.ini something I can set

> > at runtime via ini_set()?

> >

> > --Tony

> >

> > Hans Lellelid wrote:

> >

> >>>I have a project that will be supported under multiple DBMS's (MySQL,

> >>>Postgres and MS SQL). We are doing the general database design and we

> >>>are to the topic of how to formate date/time values. All our values

> >>>will be after 1970 so timestamps are an options. My question is whether

> >>>or not to use the native date/time types in the DBMS via Propel. Does

> >>>Propel handle this well or am I better of using a timestamp datatype or

> >>>int?

> >>>

> >>>

> >>>

> >>

> >>Propel handles this well and I would advise you to use TIMESTAMP rather

> >>than INT.

> >>

> >>TIMESTAMP will be converted to the best representation (e.g. for MySQL it

> >>will use DATETIME) for the RDBMS. The only thing you'll probably want to

> >>fix is the MSSQL ini option (in php.ini) to have it use standard ISO date

> >>formats.

> >>

> >>The getter methods that are generated by Propel will actually allow you

> >> to

> >>specify date/time formatters:

> >>

> >>$myobj->getTimeCol("Y-m-d"); // date()-formatting

> >>

> >>or

> >>

> >>$myobj->getTimeCol("%c"); // strftime()-formatting

> >>

> >>or

> >>

> >>$myobj->getTimeCol(null); // native unix timestamp

> >>

> >>or

> >>

> >>$myobj->getTimeCol(); // default is ISO: Y-m-d H:i:s

> >>

> >>Hope that helps.

> >>

> >>-Hans

> >>

> >>---------------------------------------------------------------------

> >>To unsubscribe, e-mail: users-unsubscribe at propel.tigris.org

> >>For additional commands, e-mail: users-help at propel.tigris.org

> >>

> >>

> >

> >

> > ---------------------------------------------------------------------

> > To unsubscribe, e-mail: users-unsubscribe at propel.tigris.org

> > For additional commands, e-mail: users-help at propel.tigris.org

> >

> >

>

> ---------------------------------------------------------------------

> To unsubscribe, e-mail: users-unsubscribe at propel.tigris.org

> For additional commands, e-mail: users-help at propel.tigris.org

>

> _______________________________________________

> geeklog-devel mailing list

> geeklog-devel at lists.geeklog.net

> http://lists.geeklog.net/listinfo/geeklog-devel

>



--__--__--

_______________________________________________
geeklog-devel mailing list
geeklog-devel at lists.geeklog.net
http://lists.geeklog.net/listinfo/geeklog-devel


End of geeklog-devel Digest



More information about the geeklog-devtalk mailing list