Forum poświęcone PHP
Zdaje sobie sprawę z tego że mój problem jest zapewne trywialny ale proszę o pomoc bo naprawde skonczyły mi się pomysly gdzie moge miec błąd: [błąd-podczas zapisu "program wykonuje nieprawidlową operacje"] [???] [całość jest w klasie,kompilator DevC++] Defincje: struct Point2d{ int x,y; }; struct sPoint{ Point2d pos; bool marked; }sPoint points[100]; struct sWall{ int pt[2]; DWORD size; }sWall walls[100];//sciany Funkcja zapisu: bool Save(char *filename) { FILE* plik = fopen(filename,"wb"); if(!plik) return false; fwrite(&num_pts, sizeof(int), 1, plik); fwrite(points, sizeof(sPoint), num_pts, plik); fwrite(&num_walls,sizeof(int), 1, plik); fwrite(walls, sizeof(sWall), num_walls, plik); fclose(plik); return true; } Analogiczna Funkcja odczytu: bool Open(char *filename) { FILE* plik = fopen(filename,"rb"); if(!plik) return false; fread(&num_pts, sizeof(int), 1, plik); fread(points, sizeof(sPoint), num_pts, plik); fread(&num_walls,sizeof(int), 1, plik); fread(walls, sizeof(sWall), num_walls, plik); fclose(plik); return true; } bardzo proszę o pomoc i ewentualną lekturę
Wed,19 Nov 2008 02:28:05 +0100
Witam wszystkich forumowiczow. Mam taki problem z zadaniem. Dopiero ucze sie JAVY i mam do zrobienia pewien program. W sumie wiekszosc juz mam, ale nie wiem jak zrobic jedna rzecz. A mianowicie jak w ponizszym fragmencie kodu zrobic tak, aby wybor case2 realizowal funkcje UstawMiasto(). Chodzi mi o to, aby wybierajac case2 (auto w drodze) byla realizowana metoda wyboru miasta, do ktorego toretycznie jedzie auto. void RuchSamochod() { String m_polozenie; System.out.println("Czy Samochod aktualnie jest:n"); System.out.println("1- zaparkowanyn"); System.out.println("2- w drodzen"); switch(m_polozenie) { case 1: System.out.println("Samochod odpoczywa na parkingu.n"); case 2: void UstamMiasto(); } void UstamMiasto() { InputStreamReader czytacz_strumienia = new InputStreamReader(System.in); BufferedReader czytacz = new BufferedReader(czytacz_strumienia); try { System.out.println("Podaj gdzie jedzie samochod: "); String polozenie = czytacz.readLine(); m_polozenie = polozenie; } catch(IOException e) { System.out.println("Blad podczas odczytu danych"); } } } Po realizacji tej funkcji tworzone sa obiekty, gdzie na ekranie beda podawane ich parametry, a takze info o polozeniu samochodu. Z góry dziękuję. Pozdro
Wed,19 Nov 2008 02:01:45 +0100
Witam wszystkich Moglby ktos w latwy i przejrzysty sposob wytlomaczyc na czym polega przeciążanie operatorów. Podac kilka latwych przykladów!!! Z góry
Wed,19 Nov 2008 01:53:27 +0100
Witam Mam taki problem, w moim programie chciałbym aby przy zmianie zakladki w JTabbedPane zostało wysłane zapytanie SQL do bazy a rezultat pokazany np w jtable znajdującym sie w tej zakladce. W klasie obslugujacej baze jest funkcja: public boolean pokazZajeciaPoDniach(int dzien) { try { PreparedStatement pstmt = con.prepareStatement("SELECT * FROM lista_zajec WHERE dzien = ?"); pstmt.setInt(1, dzien); ResultSet rs = pstmt.executeQuery(); while (rs.next()){ int rok = rs.getInt("rocznik"); int przedmiot = rs.getInt("przedmiot"); int rodz_zajec = rs.getInt("rodz_zajec"); int grupa = rs.getInt("grupa"); int sala = rs.getInt("sala"); String czas_rozp = rs.getString("czas_rozp"); String czas_zak = rs.getString("czas_zak"); int _dzien = rs.getInt("dzien"); System.out.println(rok + " " + przedmiot + " " + rodz_zajec + " " +grupa+ " "+sala+" "+czas_rozp+" "+czas_zak+" "+ _dzien ); } } catch(SQLException e) { System.out.println("Błąd SQL: "+ e.getMessage()); return false; } return true; } Chciałbym ją wywołać z klasy głównej tak aby została wywolana przy zmianie zakladki jtabbedpane: ChangeListener changeListener = new ChangeListener() { public void stateChanged(ChangeEvent changeEvent) { JTabbedPane sourceTabbedPane = (JTabbedPane) changeEvent.getSource(); int index = sourceTabbedPane.getSelectedIndex(); System.out.println("Tab changed to: " + sourceTabbedPane.getSelectedIndex()); int i =sourceTabbedPane.getSelectedIndex(); i++; System.out.println("Index odpowiadający w bazie to " + i); baza.pokazZajeciaPoDniach(i); } }; próba wywyłania metody dla obiektu baza kończy się Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException Dlaczego? Pozdrawiam
Wed,19 Nov 2008 00:37:24 +0100
Tak powiem krótko i na temat :P. Mianowicie robię gierke, w której odtwarzana jest muzyka w komponencie TMediaPlayer. I jest opcja, że muzyka jest odtwarzana losowo. Ale gdy wylosowal następną piosenke jak ją puszcza to jest takie jakby 'zacięcie programu' na chwile. dzieje się to przez funkcje MediaPlayer->Open(); A jeżeli jej nie użyje, to nie odczyta nastepnej piosenki, tylko bedzie powtarzał tą co byla wczytana na początku. I czy jest jakiś sposób, aby te takie zacięcie programu zlikwidowac? bo bardzo przeszkadza w grze... I SZUKALEM JUZ NA GOOGLE.! Prosze o pomoc....
Wed,19 Nov 2008 00:27:57 +0100
XXXVII. Forms Data Format Functions
Wstęp
Forms Data Format (FDF) is a format for handling forms within PDF documents. You should read the documentation at http://partners.adobe.com/asn/acrobat/forms.jsp for more information on what FDF is and how it is used in general.
The general idea of FDF is similar to HTML forms. The difference is basically the format how data is transmitted to the server when the submit button is pressed (this is actually the Form Data Format) and the format of the form itself (which is the Portable Document Format, PDF). Processing the FDF data is one of the features provided by the fdf functions. But there is more. One may as well take an existing PDF form and populated the input fields with data without modifying the form itself. In such a case one would create a FDF document (fdf_create()) set the values of each input field (fdf_set_value()) and associate it with a PDF form (fdf_set_file()). Finally it has to be sent to the browser with MimeType application/vnd.fdf. The Acrobat reader plugin of your browser recognizes the MimeType, reads the associated PDF form and fills in the data from the FDF document.
If you look at an FDF-document with a text editor you will find a catalogue object with the name FDF. Such an object may contain a number of entries like Fields, F, Status etc.. The most commonly used entries are Fields which points to a list of input fields, and F which contains the filename of the PDF-document this data belongs to. Those entries are referred to in the FDF documentation as /F-Key or /Status-Key. Modifying this entries is done by functions like fdf_set_file() and fdf_set_status(). Fields are modified with fdf_set_value(), fdf_set_opt() etc..
Wymagania
You need the FDF toolkit SDK available from http://partners.adobe.com/asn/acrobat/forms.jsp. As of PHP 4.3.0 you need at least SDK version 5.0. The FDF toolkit library is available in binary form only, platforms supported by Adobe are Win32, Linux, Solaris and AIX.
Instalacja
You must compile PHP with
--with-fdftk[=DIR].
Notatka: If you run into problems configuring PHP with fdftk support, check whether the header file fdftk.h and the library libfdftk.so are at the right place. The configure script supports both the directory structure of the FDF SDK distribution and the usual DIR/include / DIR/lib layout, so you can point it either directly to the unpacked distribution directory or put the header file and the appropriate library for your platform into e.g. /usr/local/include and /usr/local/lib and configure with
--with-fdftk=/usr/local.
Note to Win32 Users: In order to enable this module on a Windows environment, you must copy fdftk.dll from the DLL folder of the PHP/Win32 binary package to the SYSTEM32 folder of your Windows machine. (Ex: C:\WINNT\SYSTEM32 or C:\WINDOWS\SYSTEM32)
Konfiguracja uruchomieniowa
To rozszerzenie nie definiuje posiada żadnych dyrektyw konfiguracyjnych w pliku php.ini.
Typy zasobów
fdf
Most fdf functions require a fdf resource
as their first parameter. A fdf resource
is a handle to an opened fdf file. fdf
resources may be obtained using fdf_create(),
fdf_open() and fdf_open_string().
Stałe predefiniowane
Poniższe stałe są zdefiniowane w tym rozszerzeniu i stają się dostępne, gdy rozszerzenie jest dokompilowane do PHP, lub załadowane dynamicznie przy starcie.
- FDFValue (integer)
- FDFStatus (integer)
- FDFFile (integer)
- FDFID (integer)
- FDFFf (integer)
- FDFSetFf (integer)
- FDFClearFf (integer)
- FDFFlags (integer)
- FDFSetF (integer)
- FDFClrF (integer)
- FDFAP (integer)
- FDFAS (integer)
- FDFAction (integer)
- FDFAA (integer)
- FDFAPRef (integer)
- FDFIF (integer)
- FDFEnter (integer)
- FDFExit (integer)
- FDFDown (integer)
- FDFUp (integer)
- FDFFormat (integer)
- FDFValidate (integer)
- FDFKeystroke (integer)
- FDFCalculate (integer)
- FDFNormalAP (integer)
- FDFRolloverAP (integer)
- FDFDownAP (integer)
Przykłady
The following examples shows just the evaluation of form data.
- Spis treści
- fdf_add_doc_javascript -- Adds javascript code to the FDF document
- fdf_add_template -- Adds a template into the FDF document
- fdf_close -- Close an FDF document
- fdf_create -- Create a new FDF document
- fdf_enum_values -- Call a user defined function for each document value
- fdf_errno -- Return error code for last fdf operation
- fdf_error -- Return error description for FDF error code
- fdf_get_ap -- Get the appearance of a field
- fdf_get_attachment -- Extracts uploaded file embedded in the FDF
- fdf_get_encoding -- Get the value of the /Encoding key
- fdf_get_file -- Get the value of the /F key
- fdf_get_flags -- Gets the flags of a field
- fdf_get_opt -- Gets a value from the opt array of a field
- fdf_get_status -- Get the value of the /STATUS key
- fdf_get_value -- Get the value of a field
- fdf_get_version -- Gets version number for FDF API or file
- fdf_header -- Sets FDF-specific output headers
- fdf_next_field_name -- Get the next field name
- fdf_open_string -- Read a FDF document from a string
- fdf_open -- Open a FDF document
- fdf_remove_item -- Sets target frame for form
- fdf_save_string -- Returns the FDF document as a string
- fdf_save -- Save a FDF document
- fdf_set_ap -- Set the appearance of a field
- fdf_set_encoding -- Sets FDF character encoding
- fdf_set_file -- Set PDF document to display FDF data in
- fdf_set_flags -- Sets a flag of a field
- fdf_set_javascript_action -- Sets an javascript action of a field
- fdf_set_on_import_javascript -- Adds javascript code to be executed when Acrobat opens the FDF
- fdf_set_opt -- Sets an option of a field
- fdf_set_status -- Set the value of the /STATUS key
- fdf_set_submit_form_action -- Sets a submit form action of a field
- fdf_set_target_frame -- Set target frame for form display
- fdf_set_value -- Set the value of a field
- fdf_set_version -- Sets version number for a FDF file
| Poprzedni | Spis treści | Następny |
| fam_suspend_monitor | Początek rozdziału | fdf_add_doc_javascript |