Forum poświęcone PHP
Mam taki kod: class A { }; class B : public A { }; Czy da się zrobić tak, aby w programie nie można było utworzyć obiektu klasy A?
Sun,04 Jan 2009 01:42:01 +0100
witam mam banalny problem ale jakos nie potrafie sobie z nim poradzic [glowa] [wstyd] chodzi o to, ze w programie mam wyszukiwanie w czasie rzeczywistym: jak tylko zaczynam cos wpisywac do edita to wyszukiwane sa odp rzeczy. problem w tym, ze jesli wyszukiwanie trwa a ja cos zmienie w edicie to wyszukiwanie ma zostac przerwane a nast rozpoczete na nowo. no i wlasnie z tym mam problem, z zatrzymaniem i jednoczesnym rozpoczeciem nowego. help [glowa] dzieki z gory
Sun,04 Jan 2009 01:23:45 +0100
Witam :) Chciałbym prosić o pomoc w rozpracowaniu kodu programu. Jest to saper napisany poprzez tablice dwuwymiarowe, których wartości ja zdefiniowane globalnie. Program znalazłem w zwykłym C i przerobiłem go na polskie określenia oraz na język c++. Powyrzucałem też nieco zbędnych linijek kodów zastępując łatwiejszymi rozwiązaniami oraz wprowadziłem generator losowych bomb ;) Generalnie rzecz biorąc rozumiem co nieco funkcji, ale chciałbym się upewnić co do moich domysłów. #include "stdafx.h" #include #include #include #include using namespace std; const int lw=7; const int lk=7; const int lb=1; int tab_bomb[lw][lk]; int tab_krycie[lw][lk]; int otoczenie_bomb[lw][lk]; int pozostale_pola; int Zaleznosc(int wiersz, int kolumna) //do sprawdzenia poprawnosci wprowadzonych wspolrzednych { return wiersz>=0 && wiersz=0 && kolumna
Sun,04 Jan 2009 01:14:49 +0100
Mam mały problem, tworzę dynamicznie tablice dwuwymiarowa char i chcę do niej wpisywać wyrazy gdzie w każdym wierszu będzie inny, a gdy wcisnę 0 to się wpisywanie zakończy. Ilości wyrazów jakie zostaną wpisane do tablicy nie znam więc używam zmiennej ilosc_wyrazow jako licznika ich. I mój problem jest następujący nie wiem gdzie wsadzić licznik wyrazów aby je zliczał oraz aby dobrze się tekst kopiował do tablicy dwuwymiarowej z tablicy pomocniczej. #define DLUGOSC_WIERSZA 50 int ilosc_wyrazow = 1 ; char tab_pomocnicza[50] ; tablica = (char**)malloc(DLUGOSC_WIERSZA * sizeof(char*)); for(i = 0; i < DLUGOSC_WIERSZA; ++i) { tablica[i] = (char*)malloc(ilosc_wyrazow * sizeof(char)); scanf("%s", tab_pomocnicza) ; if(tab_pomocnicza[0] == '0') { break ; } strcpy(tablica[i], tab_pomocnicza) ; } Jak narazie doszedłem do tego i kod mi wybucha, w grę wchodzi tylko ANSI C
Sun,04 Jan 2009 01:12:31 +0100
Problem to pewnie wina złych pomysłów... Ale w skrócie, mam klasę bazową będącą teoretycznie robolem oraz klase niby interfejsu wyższego poziomu. Obie te klasy to szablony. Trudno opisać cały ten bałagan, w każdym razie kod przykładowy wygląda tak: template class BaseW { protected: T work(T a, T b) { /*tu żyją smoki*/}; public: BaseW(){/*tu składają jaja smoki*/}; ~BaseW(){/*tu giną smoki*/}; } template Class WHorse: private BaseW { protected: typedef T (BaseW::*wrk)(T,T); map workers; public: WHorse() { workers['a']=BaseW::work; //
Sun,04 Jan 2009 00:00:25 +0100
Rozdział 4. Installation on Unix systems
This section will guide you through the general configuration and installation of PHP on Unix systems. Be sure to investigate any sections specific to your platform or web server before you begin the process.
As our manual outlines in the General Installation Considerations section, we are mainly dealing with web centric setups of PHP in this section, although we will cover setting up PHP for command line usage as well.
There are several ways to install PHP for the Unix platform, either with a compile and configure process, or through various pre-packaged methods. This documentation is mainly focused around the process of compiling and configuring PHP. Many Unix like systems have some sort of package installation system. This can assist in setting up a standard configuration, but if you need to have a different set of features (such as a secure server, or a different database driver), you may need to build PHP and/or your web server. If you are unfamiliar with building and compiling your own software, it is worth checking to see whether somebody has already built a packaged version of PHP with the features you need.
Prerequisite knowledge and software for compiling:
Basic Unix skills (being able to operate "make" and a C compiler)
An ANSI C compiler
flex: Version 2.5.4
bison: Version 1.28 (preferred), 1.35, or 1.75
A web server
Any module specific components (such as gd, pdf libs, etc.)
The initial PHP setup and configuration process is controlled by the use of the command line options of the configure script. You could get a list of all available options along with short explanations running ./configure --help. Our manual documents the different options separately. You will find the core options in the appendix, while the different extension specific options are descibed on the reference pages.
When PHP is configured, you are ready to build the module and/or executables. The command make should take care of this. If it fails and you can't figure out why, see the Problems section.
Apache 1.3.x on Unix systems
This section contains notes and hints specific to Apache installs of PHP on Unix platforms. We also have instructions and notes for Apache 2 on a separate page.
You can select arguments to add to the configure on line 10 below from the list of core configure options and from extension specific options described at the respective places in the manual. The version numbers have been omitted here, to ensure the instructions are not incorrect. You will need to replace the 'xxx' here with the correct values from your files.
Alternatively, to install PHP as a static object:
Przykład 4-2. Installation Instructions (Static Module Installation for Apache) for PHP
|
Notatka: Replace php-5 by php-4 and php5 by php4 in PHP 4.
Depending on your Apache install and Unix variant, there are many possible ways to stop and restart the server. Below are some typical lines used in restarting the server, for different apache/unix installations. You should replace /path/to/ with the path to these applications on your systems.
Przykład 4-3. Example commands for restarting Apache
|
The locations of the apachectl and http(s)dctl binaries often vary. If your system has locate or whereis or which commands, these can assist you in finding your server control programs.
Different examples of compiling PHP for apache are as follows:
This will create a libphp5.so (or libphp4.so in PHP 4) shared library that is loaded into Apache using a LoadModule line in Apache's httpd.conf file. The PostgreSQL support is embedded into this library.
This will create a libphp4.so shared library for Apache, but it will also create a pgsql.so shared library that is loaded into PHP either by using the extension directive in php.ini file or by loading it explicitly in a script using the dl() function.
This will create a libmodphp5.a library, a mod_php5.c and some accompanying files and copy this into the src/modules/php5 directory in the Apache source tree. Then you compile Apache using --activate-module=src/modules/php5/libphp5.a and the Apache build system will create libphp5.a and link it statically into the httpd binary (replace php5 by php4 in PHP 4). The PostgreSQL support is included directly into this httpd binary, so the final result here is a single httpd binary that includes all of Apache and all of PHP.
Same as before, except instead of including PostgreSQL support directly into the final httpd you will get a pgsql.so shared library that you can load into PHP from either the php.ini file or directly using dl().
When choosing to build PHP in different ways, you should consider the advantages and drawbacks of each method. Building as a shared object will mean that you can compile apache separately, and don't have to recompile everything as you add to, or change, PHP. Building PHP into apache (static method) means that PHP will load and run faster. For more information, see the Apache web page on DSO support.
Notatka: Apache's default httpd.conf currently ships with a section that looks like this:
Unless you change that to "Group nogroup" or something like that ("Group daemon" is also very common) PHP will not be able to open files.
Notatka: Make sure you specify the installed version of apxs when using
--with-apxs=/path/to/apxs. You must NOT use the apxs version that is in the apache sources but the one that is actually installed on your system.
| Poprzedni | Spis treści | Następny |
| Ogólnie o instalacji | Początek rozdziału | Apache 2.0 on Unix systems |