Stefano Mtangoo 455 Senior Poster

Check this system and familiarize with the techniques

Stefano Mtangoo 455 Senior Poster

Look speak to your hosting company. They are the best to help you. ;)

Voila!

Stefano Mtangoo 455 Senior Poster

try it instead of "not thinking so". PHP Code is ok!

Stefano Mtangoo 455 Senior Poster
Stefano Mtangoo 455 Senior Poster

And whole bunch of guys, very funny!
Who taught you to subscribe?

Stefano Mtangoo 455 Senior Poster

My Last resort on this case would be:
1. Try in another machine that works
2. Clean computer (with CCleaner/Advanced System care et al) and reinstall every PHP thing!
Something is wrong somewhere :)

Stefano Mtangoo 455 Senior Poster

I don't actually get any errors at all, I just don't see the string that's echoed.
$HTTP_SESSION_VAR doesn't work.
I have error reporting enabled and still, no errors.

Did you bother to read post by mschroeder?
He identifies your problem and gives solution. Enable error messages and you will see

Stefano Mtangoo 455 Senior Poster

Tomcat have number of ports configs. Look in server.xml if everything is define there as it is supposed to be. I'm not TC maverick, so I cannot help :)

Stefano Mtangoo 455 Senior Poster

Thank you for telling me. But I think I need a book about datastructure rather than specific language, thanks.

Here we go!

Stefano Mtangoo 455 Senior Poster

@OP

Data Structures using C/C++

That is Achille's heel. He does want Languageless

Stefano Mtangoo 455 Senior Poster

would ever passing a primitive to functions by reference be more efficient ?
Yes, because you avoid passing a copy. So you save memory and execution time

Stefano Mtangoo 455 Senior Poster

I wouldn't put to much focus on it, you'd have to be echoing millions of session variables for it to even begin to make an impact. Spend the time optimizing the more bottleneck prone areas of your code, you'll see a much bigger return.

You are right.
I was saying about "best practices" ;)

Stefano Mtangoo 455 Senior Poster

I need to write code to have a search box that will search a mssql database.

Dig deep and once you have your code and hit a wall come back!

Stefano Mtangoo 455 Senior Poster

But I think I need a book about data structure rather than specific language, thanks.

I can't think of any. all I know use one language or another

Stefano Mtangoo 455 Senior Poster

Post your full code so that one can see.
May be it is hidden it your "hidden" code :)

Stefano Mtangoo 455 Senior Poster

Post your full code so that one can see.
May be it is hidden it your "hidden" code :)

Stefano Mtangoo 455 Senior Poster

[OFFTOPIC]

My apologies for taking this off topic for a second. But this comment struck my interest.

-evstevemd
-richieking

I was reading through this thread and saw this comment and having never heard this before had to do some research. Richieking is absolutely right in terms of setting a global to a local variable being faster to echo out. But, it is only nominally faster and I saw consistent results up over 100,000 echos.

I benchmarked this at 100 cycles of echoing a variable 1000 times:

First result is echoing the $_SESSION value directly.
Second result is echoing $var after $var = $_SESSION.
Third result was setting it to an array item instead of a variable. (Just out of curiosity)

Running Benchmark: Speed Between Accessing A $_SESSION Variable Or Local Rep Of A Session Variable
======================================================================
Running Test: test_Iterate_Session
	Cycles: 	 100
	Mean: 		 0.0004818988 secs.
	Median: 	 0.0004801750 secs.
	Mode: 		 0.0005009174 secs.
	Range: 		 0.0001130104 secs.
	Min: 		 0.0004498959 secs.
	Max: 		 0.0005629063 secs.
======================================================================
Running Test: test_Iterate_Local_Session_Rep
	Cycles: 	 100
	Mean: 		 0.0003332329 secs.
	Median: 	 0.0003280640 secs.
	Mode: 		 0.0003130436 secs.
	Range: 		 0.0000841618 secs.
	Min: 		 0.0003118515 secs.
	Max: 		 0.0003960133 secs.
======================================================================
Running Test: test_Iterate_Local_Session_Rep_Array
	Cycles: 	 100
	Mean: 		 0.0004192019 secs.
	Median: 	 0.0004239082 secs.
	Mode: 		 0.0004279613 secs.
	Range: 		 0.0001230240 secs.
	Min: 		 0.0003850460 secs.
	Max: 		 0.0005080700 secs.
======================================================================

About 1.5x faster local vs $_SESSION

100 cycles 100000 echos

Running Benchmark: Speed Between Accessing A $_SESSION Variable Or Local Rep Of A Session Variable
======================================================================
Running Test: test_Iterate_Session
	Cycles: 	 100
	Mean: 		 0.0448146057 secs.
	Median: 	 0.0447440147 secs.
	Mode: 		 0.0447440147 secs.
	Range: 		 0.0043771267 …
Stefano Mtangoo 455 Senior Poster

look i tried to help you, the best you did was to flag me bad post because of basic platform i asked you.

mmm ;)

May be he did it accidentally!

Post your current code and say what you expect it to do :)

Stefano Mtangoo 455 Senior Poster

Try to learn sorting first

Stefano Mtangoo 455 Senior Poster

Oh fantastic, thanks so much - im always missing the little things, and the things i know, quite embarrassing really lol but i guess i only just started with c++ so im hoping to stop making the silly little mistakes quite soon!

Thanks again!!!

Emily

Glad I helped!

Stefano Mtangoo 455 Senior Poster

Points of correction added as comments

#include <iostream>// Dont use something.h, it is deprecated
#include <string>//see above comment
#include <cstdlib> //MISSING
using namespace std;

#define INVENTORYLIMIT 5

struct itemClass
{
    int itemID;
    string itemName;
};

class characters //name of base class
{
      private:
        int currentLocationID;
        int healthPoints;
        int attackPoints;
        string charName;
        string description;
        itemClass inventory[INVENTORYLIMIT];
        int itemsInInventory;

      public:
        characters(); //A constructor function - must be same name as class itself
        ~characters(); // a destructor function
        int getLocation();
        bool setLocation (int charlocation);
        string getName(); // An accessor function for name
        bool setName(string name); // An mutator function for name
        string getDescription(); // Accessor function for description
        bool setDescription (string chardescription); // A mutator function for description
        bool setHealthPoints(int health); // a mutator function for health points
        int getHealthPoints(); // an accessor function for health points
        bool setAttackPoints(int attack); // a mutator function for attack points
        int getAttackPoints(); // an accessor function for attackpoints
        ///////////////////////////////
        bool addAttackPoints(int newAttackPoints); // a mutator function to subtract attack points
        bool subtractHealthPoints(int subtractHealthPoints); // a mutator function for subtracting Health Points
        bool subtractHitPoints(int subtractHitPoints); // a mutator function for subtracting hit points (attack points)
        //////////////////////////////
        bool addItem(int itemID, string itemName);
        //bool dropItem (int itemID);
        int getinventory();
        int viewallitems();
};
 ////////////////////////////////////////////////////////////////////////////////
class playingCharacterClass: public characters
{
    private:
        int expPoints;
    public:
        bool addExperiencePoints(int points);// a mutator function to add experience points
        bool setPoints(int expPoints); // A mutator function for expPoints
        int getPoints (); // An Accessor for expPoints
};
 ////////////////////////////////////////////////////////////////////////////////
class nonPlayingCharacterClass: public characters
{
    private:
       bool …
Stefano Mtangoo 455 Senior Poster

Points of correction added as comments

#include <iostream>// Dont use something.h, it is deprecated
#include <string>//see above comment
#include <cstdlib> //MISSING
using namespace std;

#define INVENTORYLIMIT 5

struct itemClass
{
    int itemID;
    string itemName;
};

class characters //name of base class
{
      private:
        int currentLocationID;
        int healthPoints;
        int attackPoints;
        string charName;
        string description;
        itemClass inventory[INVENTORYLIMIT];
        int itemsInInventory;

      public:
        characters(); //A constructor function - must be same name as class itself
        ~characters(); // a destructor function
        int getLocation();
        bool setLocation (int charlocation);
        string getName(); // An accessor function for name
        bool setName(string name); // An mutator function for name
        string getDescription(); // Accessor function for description
        bool setDescription (string chardescription); // A mutator function for description
        bool setHealthPoints(int health); // a mutator function for health points
        int getHealthPoints(); // an accessor function for health points
        bool setAttackPoints(int attack); // a mutator function for attack points
        int getAttackPoints(); // an accessor function for attackpoints
        ///////////////////////////////
        bool addAttackPoints(int newAttackPoints); // a mutator function to subtract attack points
        bool subtractHealthPoints(int subtractHealthPoints); // a mutator function for subtracting Health Points
        bool subtractHitPoints(int subtractHitPoints); // a mutator function for subtracting hit points (attack points)
        //////////////////////////////
        bool addItem(int itemID, string itemName);
        //bool dropItem (int itemID);
        int getinventory();
        int viewallitems();
};
 ////////////////////////////////////////////////////////////////////////////////
class playingCharacterClass: public characters
{
    private:
        int expPoints;
    public:
        bool addExperiencePoints(int points);// a mutator function to add experience points
        bool setPoints(int expPoints); // A mutator function for expPoints
        int getPoints (); // An Accessor for expPoints
};
 ////////////////////////////////////////////////////////////////////////////////
class nonPlayingCharacterClass: public characters
{
    private:
       bool …
Stefano Mtangoo 455 Senior Poster

Can you post your current code as well as errors you currently get?

Stefano Mtangoo 455 Senior Poster

with the inventory, the idea is that each character can hold 5 items, so an array, but the array needs to hold the itemID and the itemName therefore an array wont be any good coz it can only hold one or the other.

Is it not working or just polishing? (I haven't read for now whole story).
But as for above, I would suggest structs and unions as best options IMO

Stefano Mtangoo 455 Senior Poster
Stefano Mtangoo 455 Senior Poster

Use Code Tags and post only relevant code not whole bunch of it.
All I can see is JS code and this is PHP forum (wrong forum?)

Stefano Mtangoo 455 Senior Poster

Let old threads die, and start new ones.
BTW the topic have been coming up each time, so using searchbox will do alot of good and no harm

Stefano Mtangoo 455 Senior Poster

Post full error

Stefano Mtangoo 455 Senior Poster

evstevemd,
Are you on php performance thing.???

I'm interested ;)

Stefano Mtangoo 455 Senior Poster

I cannot see anything saying what you are saying.
Would you quote it? Anyone to comment on this?:-/

Stefano Mtangoo 455 Senior Poster

sudo apt-get remove firefox
sudo apt-get install firefox

Stefano Mtangoo 455 Senior Poster

You are everywhere mmm. evstevemd...!!

:)

go baby go ubuntu..!!

The baby is going and growing daily :)

but fix this bug. dkimproxy. It is killing ubuntu noob.
We need to keep all the noobies. we need numbers for now not quality.

What is that? Something to do with proxies?

Stefano Mtangoo 455 Senior Poster

evstevemd.

Apart from readabilty.... Speed.

Global variable scope is the last result to every pro. language engine. When you keep referring to globals so many times, you compensate on program execution time.

for examble

if(empty($_SESSION['name']) || $_SESSION['name']<3){

$_SESSION['name']= $foo;

}

You called 3 time a super global array. Not even a global variable. Its poor prog. practice.

Php deal with execution time and many programmers code fails to exe. due to this practices.

Assuming calling this 150 times on 400 lines of code. horror!

Explore :)

Any benchmark to substantiate the claims? :)

Stefano Mtangoo 455 Senior Poster

Also try not to use session variable raw like..

echo $_SESSION['username']

dont keep to that.
always put it in a standard variable. eg..

A part from readability what is wrong with that?

Stefano Mtangoo 455 Senior Poster

Look up C++ for dummies..good for basic in C++, it helped me a lot.

Hahaha, I'm not C++ Dummy, so I don't qualify to read it :)
I know we cannot inherit it so I wanted to know the reason. FP Nailed it, Simply because we cannot Inherit Constructor, why should we override it. That makes sense.

Stefano Mtangoo 455 Senior Poster

1. Overview
2. Features

Waiting for 10.10 :)

Stefano Mtangoo 455 Senior Poster

Dont give a gun to a mad man. And when he says he is not mad, still dont give him. Give him when he admit that he is mad. its a sign of healing.

:)

Stefano Mtangoo 455 Senior Poster

prgm? What is that?
The reason no body answered your thread is that you have encoded your own question in your own code.
Decode it for people to help you

Stefano Mtangoo 455 Senior Poster

I don't even have WAMP/LAMPP

So where do you run your PHP? Do you use Windows IIS?

Stefano Mtangoo 455 Senior Poster

Normally your admin would also login and that would set a session variable to show that this user has admin privileges. On any page that only an admin can access, you need to check that session variable to see if this is an admin user or not.

<?php 
    $_SESSION['user_role']= $user_role; //this should be a field in DB for each user
    //============Add other codes that needs no Admin rights==========
    //If this page needs admin access then put this code
    if( $_SESSION['user_role']=='admin'){
        echo "Karibu Mr. Admin!";
    }
    else{
        echo "Acess denied: Hauruhusiwi Kuingia eneo hili!";
    }
?>

Due to DW rule:
Karibu == Welcome
Hauruhusiwi Kuingia eneo hili== You are not allowed to enter this zone

Stefano Mtangoo 455 Senior Poster

Why not just use MS-Word or Open Office to modify the doc file?

This is the best I can say, heed to AD's advice :)

If you are still stubborn about it, learn MS word format and know how to manipulate me, which to me is as useless as useless itself ;)

Stefano Mtangoo 455 Senior Poster

After some testing, I still couldn't figure out my this was happening, but I did find out something weird as well. When I used an Alter statement in mysqli_multi_query() it did not work, but when I used the Alter statement in mysqli_real_query / mysqli_query it worked fine.

fyi, I did test my connection and query/multi query, and they were both working fine.

IMHO, alter statement is taken with many (I included) as bad design, so it much of the time, not thought to be of frequent use. So I guess that is why it isn't supported: Afterall we run the query when we mess up with design don't we? :)
Just run it as separate Query. I will check to see if my guess is so.

qazplm114477 commented: thanks for clearing up +1
Stefano Mtangoo 455 Senior Poster
Stefano Mtangoo 455 Senior Poster

Laziness? :icon_eek:
You have showed no effort. Show your relevant codes

Stefano Mtangoo 455 Senior Poster

What is that?

Stefano Mtangoo 455 Senior Poster

I haven't noticed this until I tried it today and boom! Compiler complained:
error: constructors cannot be declared virtual

Why then Constructor is not okay while destructor is, in such as class as this?
Thanks

class MyAbstractClass{
	public:
		virtual MyAbstractClass(std::string username, std::string password)=0;
		virtual ~MyAbstractClass(std::string username, std::string password)=0;
		virtual void someOtherMethodsHere()=0;
	
}
Stefano Mtangoo 455 Senior Poster

At the bottom you will find:

Has this thread been answered?
If this thread has been successfully resolved, please Mark this Thread as Solved so that it can be added to our Knowledge Base and help others. Also, posters who replied appreciate knowing that they were helpful.

Click link contained and voila.

Stefano Mtangoo 455 Senior Poster

Mark it then solved :)

Stefano Mtangoo 455 Senior Poster

i failed :)
I put the SDL Enable Unicode call in the object initialization not the program initialization so that's why it didnt work. now it does.
(also changed the typecasted character values to integers, that might've helped.)
stupid me

Glad you resolved it :)

Stefano Mtangoo 455 Senior Poster

Still doesn't work :( .

I would suggests couple of probing techniques:
1. Try on different browser in same machine
2. Reinstall WAMP/LAMPP
3. Check browser settings

If you are using IE, M$ have its bad ways of blocking things (most of times is JS) so check using option 3. If it doesn't work, try it on another machine to confirm that you have give problem. Also turn on error reporting.