Author Topic: BBG Framework Project v0.1.2 [17-July-2009]  (Read 3959 times)

Offline travo

  • Level 18
  • *
  • Posts: 186
  • Reputation: +2/-0
    • View Profile
Re: BBG Framework Project (Initial Release)
« Reply #25 on: July 08, 2009, 05:04:26 AM »
I saw on php.net that pre incrementation is 3 times faster than post incrmentation, but I just am not seeing it... As Zeggy said, ++$i increments then returns, $i++ creates a copy of the vaiable then increments the variable then returns the copy, but this couldnt be that slow could it?

I wanted to d some tsts, here are some results. Performed on intel dual core 2.5ghz 2gig ram windows xp pro sp3, apache2triad, php5.1.2 (yeah I know I have to upgrade it lol)

Test results:
Average pre incrementation: 2.93731689453E-005
Average post incrementation: 3.08036804199E-005

Test results:
Average pre incrementation: 3.29494476318E-005
Average post incrementation: 3.02314758301E-005

Test results:
Average pre incrementation: 3.16143035889E-005
Average post incrementation: 3.16619873047E-005

Both only had the one increment between the start and stop times. Both had a 3 second cool down period before each trial was conducted. Both were tried 10 times each per test. All variables were unset at the end of each trial, before the cooldown period.

I dont see any real need to use ++$i over $i++. According to that, I will need to use $i++ over ++$i 10000 times before it even clocks up a second. As for 3 times faster, thats crap.


Correct me Im wrong, Karnedge wants the variable incremented only once rather than twice, and probably doesnt give a rats about that 1x10^-4 second time loss, so lets get back on topic.

Offline karnedge

  • Level 17
  • *
  • Posts: 170
  • Reputation: +4/-0
  • ctrlHack provides the server, you bring the skill.
    • View Profile
    • ctrl://Hack.game
Re: BBG Framework Project (Initial Release)
« Reply #26 on: July 08, 2009, 07:58:36 AM »
There is a simple fix for this. Supply a settings file that is configurable by the end user. Create an entry that allows them to specify a sub directory that the framework resides in. Then you simply supply this with a base tag in the document header:
Code: (html) [Select]
<base href="/[sub-directory]/" />

Actually I do have a settings option for that just not in the config.php, so I'll change that. I didn't know about the base tag though, thank you.

Correct me Im wrong, Karnedge wants the variable incremented only once rather than twice, and probably doesnt give a rats about that 1x10^-4 second time loss, so lets get back on topic.

Yeah, I do appreciate the suggestions and such but I am only trying to figure out why it's doing it twice. If you use an echo statement in any of the object classes throughout the framework, it will not repeat itself. If you use a $variable, they will not go up by 2;however, using a presistant $_SESSION variable it will go up by 2.
ctrlHack - Hacking simulation RPG in development.
Latest blog: Back on Track
bbgFramework v0.1.3

Offline JGadrow

  • Level 35
  • **
  • Posts: 1,133
  • Reputation: +23/-2
    • View Profile
Re: BBG Framework Project (Initial Release)
« Reply #27 on: July 08, 2009, 08:41:45 AM »
I ran a test to be certain, but you're incrementing the variable properly (no glitch because of order of operations). The only thing that I can think of is either you've accidentally duplicated a variable in the same scope and that variable is being incremented as well?

Or, are you incrementing inside of some sort of looking / iteration construct? Perhaps it's performing 1 additional iteration than you believe it to be (causing the value to be incremented twice).

This sounds like a case where a line of code is silently being executed twice in the case that you have a $_SESSION and are accessing by $_GET id.
Idiocy - Never underestimate the power of stupid people in large groups.


Offline karnedge

  • Level 17
  • *
  • Posts: 170
  • Reputation: +4/-0
  • ctrlHack provides the server, you bring the skill.
    • View Profile
    • ctrl://Hack.game
Re: BBG Framework Project v0.1.1 [9-July-2009]
« Reply #28 on: July 09, 2009, 10:16:39 AM »
Last night I released version 0.1.1 which includes the ability to actually use the <base> tag and simplify the URI parsing a little bit. Also fixed the static method errors when used in a PHP6 environment which includes the redeclaration problem in the authenticate class.

Special thanks to JGadrow and Qwerty.
ctrlHack - Hacking simulation RPG in development.
Latest blog: Back on Track
bbgFramework v0.1.3

Offline Ongor the Republican

  • Level 3
  • *
  • Posts: 8
  • Reputation: +0/-0
    • View Profile
Re: BBG Framework Project v0.1.1 [9-July-2009]
« Reply #29 on: July 15, 2009, 03:35:47 PM »
I'm getting the following error when attempting to view the end result of installation:
 
Quote
Fatal error: Constructor Database::__construct() cannot be static in [edit: path crap]/includes/database.php on line 136

Any advice? I'm barely out of the poke-and-tinker phase of my dealings with PHP, so I have no doubt whatsoever that I made a mistake somewhere.

« Last Edit: July 15, 2009, 03:37:23 PM by Ongor the Republican »

Offline karnedge

  • Level 17
  • *
  • Posts: 170
  • Reputation: +4/-0
  • ctrlHack provides the server, you bring the skill.
    • View Profile
    • ctrl://Hack.game
Re: BBG Framework Project v0.1.1 [9-July-2009]
« Reply #30 on: July 15, 2009, 04:25:00 PM »
Wow I don't know how I missed that but delete the static part from __construct and __destruct functions in database.php.
ctrlHack - Hacking simulation RPG in development.
Latest blog: Back on Track
bbgFramework v0.1.3

Offline Ongor the Republican

  • Level 3
  • *
  • Posts: 8
  • Reputation: +0/-0
    • View Profile
Re: BBG Framework Project v0.1.1 [9-July-2009]
« Reply #31 on: July 15, 2009, 09:21:15 PM »
Wow I don't know how I missed that but delete the static part from __construct and __destruct functions in database.php.

Thank you. After doing that, the home page came up, but only with no styling what so ever.  Checking my error log, I  noticed this:

(Note: I replaced the site I am using with an obvious stand in, and trumand is the subdirectory the framework is in)
Code: [Select]
File does not exist: [edit: path crap]/public_html/templates, referer: http://www.mysite.com/trumand/

Also, when I attempted to log in under the default admin account,  I got a message stating that the account was invalid, and the web address in the address bar started to gain another "account/" any time I clicked anything. Checking my error log again, I noticed this:

Code: [Select]
File does not exist: [edit: path crap]/public_html/account, referer: http://www.mysite.com/trumand/account/account/account/activate

Offline karnedge

  • Level 17
  • *
  • Posts: 170
  • Reputation: +4/-0
  • ctrlHack provides the server, you bring the skill.
    • View Profile
    • ctrl://Hack.game
Re: BBG Framework Project v0.1.1 [9-July-2009]
« Reply #32 on: July 16, 2009, 08:19:02 AM »
Well if anything, did you place
define('BASE_HREF','/trumand/') in config.php?

And, could you post your .htaccess code?

As for the styling, there isn't suppose to be any. Its just a framework and suppose to get you started so the template is blank.
ctrlHack - Hacking simulation RPG in development.
Latest blog: Back on Track
bbgFramework v0.1.3

Offline Ongor the Republican

  • Level 3
  • *
  • Posts: 8
  • Reputation: +0/-0
    • View Profile
Re: BBG Framework Project v0.1.1 [9-July-2009]
« Reply #33 on: July 16, 2009, 10:35:54 AM »
Well if anything, did you place
define('BASE_HREF','/trumand/') in config.php?

It seems I forgot the trailing slash. Feh. However, once I fixed that, I am now getting the following error when I click login:

Code: [Select]
Fatal Error: Could not find: [Edit: Path Crap]/trumand/modules/login/login.php
And, could you post your .htaccess code?

Sure.

Code: [Select]
Options +FollowSymLinks
Options +Indexes
RewriteEngine On
### If using framework in a subdirectory, use /path2framework/
RewriteBase /trumand/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
### /path2framework/index.php
RewriteRule . /trumand/index.php [L]

Offline karnedge

  • Level 17
  • *
  • Posts: 170
  • Reputation: +4/-0
  • ctrlHack provides the server, you bring the skill.
    • View Profile
    • ctrl://Hack.game
Re: BBG Framework Project v0.1.1 [9-July-2009]
« Reply #34 on: July 16, 2009, 12:16:01 PM »
Doh actually I don't think its suppose to have a trailing slash for base_href. When you hover over the links do they point to the correct location?

Ie; login should point to domain.com/trumand/account/login

I think that's without a trailing slash. Sorry, I'm at work trying to remember while using my blackberry ha.

Anyway, if all else fails make sure that link above, if you type it manually, actually goes to the login module.

Ill check it out more when I get home.
ctrlHack - Hacking simulation RPG in development.
Latest blog: Back on Track
bbgFramework v0.1.3

Offline Ongor the Republican

  • Level 3
  • *
  • Posts: 8
  • Reputation: +0/-0
    • View Profile
Re: BBG Framework Project v0.1.1 [9-July-2009]
« Reply #35 on: July 16, 2009, 12:50:14 PM »
Doh actually I don't think its suppose to have a trailing slash for base_href. When you hover over the links do they point to the correct location?

Ie; login should point to domain.com/trumand/account/login

I think that's without a trailing slash. Sorry, I'm at work trying to remember while using my blackberry ha.

Anyway, if all else fails make sure that link above, if you type it manually, actually goes to the login module.
In the config file, there's a comment saying that the trailing slash is required.

All the links are correct when going to domain.com/trumand/

Typing it in by hand does send me to the correct module, however, all the links have an additional "/account/" in them(i.e. "/account/account/login" instead of "account/login".)  Clicking those links takes me to a page where the links have "/account/account/" added in, clicking those links takes me...you get the idea.


Ill check it out more when I get home.

Thank you, sir.

Offline karnedge

  • Level 17
  • *
  • Posts: 170
  • Reputation: +4/-0
  • ctrlHack provides the server, you bring the skill.
    • View Profile
    • ctrl://Hack.game
Re: BBG Framework Project v0.1.2 [17-July-2009]
« Reply #36 on: July 17, 2009, 08:24:54 PM »
Alright, sorry about the wait. Took me a bit longer to get to it than I wanted.

The problem was because the URI parsing was still using the 2nd key in the array which if you were in a subdirectory would be the 1st key. So I simplified the URI parsing which makes it a tiny bit faster in execution to fix it but also ran into the issue with the double "account" links which deals with the BASE tag I added. Just using a directory doesn't seem to work very well even though somehow in testing, it worked before (?). I changed the BASE_HREF in config.php to require the full URL to the framework. This is for the sake of the template links. None of the templates changed. All that changed is the index.php and what you put in BASE_HREF.

So, if you want you can just grab index.php from the SVN and replace yours, change BASE_HREF to include the entire URL, and you'll be good to go (hopefully).

I released version 0.1.2 to reflect these changes including the database.php fix.

Note: I also updated Smarty from 2.6.22 to 2.6.26. Apparently I never updated it since December. (if you want to do this manually, just pull the contents of the Lib directory in the Smarty download and dump it into /includes/plugins/Smarty/)
ctrlHack - Hacking simulation RPG in development.
Latest blog: Back on Track
bbgFramework v0.1.3

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal