Jump to content
php.lv forumi

GedroX

Reģistrētie lietotāji
  • Posts

    373
  • Joined

  • Last visited

Posts posted by GedroX

  1. PostgreSQL-am ir tāda lieta kā VACUUM. Domāju, ka tas pats vien ir, tikai citādi nosaukts. =)

     

    Running VACUUM recommended
    
    The estimated rowcount on the table "access" deviates significantly from the actual rowcount. You should run VACUUM ANALYZE on this table. 
    Instead of issuing a manual VACUUM ANALYZE command on this table (you can use the pgAdmin III maintenance menu for this), running VACUUM ANALYZE on a regular or automated basis should be considered. This can be achieved using a scheduler. PostgreSQL also supplies the pg_autovacuum daemon, which will track changes made to the database and issue vacuum commands as required automatically. In most cases, pg_autovacuum will be the best choice. 
    
    What is VACUUM good for? 
    
    The PostgreSQL query planner makes its decision based on assumptions, taken from the estimated rowcount. If the actual rowcount is too different from the estimated rowcount, the planner might take a wrong decision, resulting in a query plan that is not optimal. This might result in poor performance. 
    The PostgreSQL storage needs VACUUM to have transaction IDs in tables fixed. Additionally, outdated rows from updates and deletes are not cleaned up until the VACUUM command has been issued on that table. In-depth information can be found in the online documentation, just press the help button.

     

    Un vēl ir tāda lieta, kā Reindex.

  2. Uztaisi caur AJAX. Neesmu īpaši ņēmies, bet iedomājos, ka varētu būt kautkā tā:

     

    Pirmais rekvests - parastais. Pienāk html ar javascriptu, kurā rakstīts, ka jāgriežas uz to pašu adresi, tikai pieliekot klāt kādu GET parametru. Caur HTTPRequest sūti pieprasījumu kopā ar GET-u, PHP ievērtē, ka tika padots šis GET parametrs un sūta jau pilno lapas versiju. JS saņemot to ielādē lapā.

     

    Cik tas ir reāli? Varbūt arī tā ir mana utopija... :p

     

    Javaskripa nav, lapas arī nebūs... (chuckle)

  3. Nav vienu } aizverošo iekavu, komentārs sākas ar '/ *' nevis '/*' (starpā atstarpe), funkcija function get_float32($fourchars) {} ļoti aizdomīga (tukša). Pēc argumenta $fourchars var spriest, ka tai būtu jāaizverās pēc return 0.0;.

  4. Tu domā šo:

     

    #
    # Customizable error responses come in three flavors:
    # 1) plain text 2) local redirects 3) external redirects
    #
    # Some examples:
    #ErrorDocument 500 "The server made a boo boo."
    #ErrorDocument 404 /missing.html
    #ErrorDocument 404 "/cgi-bin/missing_handler.pl"
    #ErrorDocument 402 http://www.example.com/subscription_info.html
    #
    
    #
    # Putting this all together, we can internationalize error responses.
    #
    # We use Alias to redirect any /error/HTTP_<error>.html.var response to
    # our collection of by-error message multi-language collections.  We use 
    # includes to substitute the appropriate text.
    #
    # You can modify the messages' appearance without changing any of the
    # default HTTP_<error>.html.var files by adding the line:
    #
    #   Alias /error/include/ "/your/include/path/"
    #
    # which allows you to create your own set of files by starting with the
    # @exp_errordir@/include/ files and copying them to /your/include/path/, 
    # even on a per-VirtualHost basis.  The default include files will display
    # your Apache version number and your ServerAdmin email address regardless
    # of the setting of ServerSignature.
    #
    # The internationalized error documents require mod_alias, mod_include
    # and mod_negotiation.  To activate them, uncomment the following 30 lines.
    
    #	Alias /error/ "@exp_errordir@/"
    #
    #	<Directory "@exp_errordir@">
    #		AllowOverride None
    #		Options IncludesNoExec
    #		AddOutputFilter Includes html
    #		AddHandler type-map var
    #		Order allow,deny
    #		Allow from all
    #		LanguagePriority en cs de es fr it ja ko nl pl pt-br ro sv tr
    #		ForceLanguagePriority Prefer Fallback
    #	</Directory>
    #
    #	ErrorDocument 400 /error/HTTP_BAD_REQUEST.html.var
    #	ErrorDocument 401 /error/HTTP_UNAUTHORIZED.html.var
    #	ErrorDocument 403 /error/HTTP_FORBIDDEN.html.var
    #	ErrorDocument 404 /error/HTTP_NOT_FOUND.html.var
    #	ErrorDocument 405 /error/HTTP_METHOD_NOT_ALLOWED.html.var
    #	ErrorDocument 408 /error/HTTP_REQUEST_TIME_OUT.html.var
    #	ErrorDocument 410 /error/HTTP_GONE.html.var
    #	ErrorDocument 411 /error/HTTP_LENGTH_REQUIRED.html.var
    #	ErrorDocument 412 /error/HTTP_PRECONDITION_FAILED.html.var
    #	ErrorDocument 413 /error/HTTP_REQUEST_ENTITY_TOO_LARGE.html.var
    #	ErrorDocument 414 /error/HTTP_REQUEST_URI_TOO_LARGE.html.var
    #	ErrorDocument 415 /error/HTTP_UNSUPPORTED_MEDIA_TYPE.html.var
    #	ErrorDocument 500 /error/HTTP_INTERNAL_SERVER_ERROR.html.var
    #	ErrorDocument 501 /error/HTTP_NOT_IMPLEMENTED.html.var
    #	ErrorDocument 502 /error/HTTP_BAD_GATEWAY.html.var
    #	ErrorDocument 503 /error/HTTP_SERVICE_UNAVAILABLE.html.var
    #	ErrorDocument 506 /error/HTTP_VARIANT_ALSO_VARIES.html.var

     

    ?

  5. GedroX--> ne tikai lai njem lielos burtus preti bet lai njem pretii TIKAI a_z

    lai ciparus ignoree ;)

    nav 1 limenja domeena 1 vai 99 ;)

    SkyD--> jepkuraa gadiijumaa ar JS ir tikai primaaraa paarbaude ... peec tam ar PHP parbaudiit vai dotais domeens vispaar eksistee :)

    Tādā veidā var to regulāro izteiksmi līdz 5 lapām attīstīt. ;) Tā jau tikai pamata pārbaude. Labāk tomēr kļūdaini uzskatīt par pareizu kādu nekorektu adresi nekā otrādi. Iedomājies situāciju - tu raksti savu e-pasta adresi, bet serveris neņem pretī.. Sviesc, ne? (:

  6. Par skaitļiem ir šāds skripts (daudz vispusīgāks par to, ko uzrādīji - arī reāliem skaitļiem).

     

    Epastam -

    <script type="text/javascript">
    <!--
    email="[email protected]";
    if (email.match(/^[!#$%&\'\*\+\/=?^_`{|}~a-z0-9-]+(\.[!#$%&\'\*\+\/=?^_`{|}~a-z0-9-]+)*@[!#$%&\'\*\+\/=?^_`{|}~a-z0-9-]+(\.[!#$%&\'\*\+\/=?^_`{|}~a-z0-9-]{2,})+$/)) {
    alert('Pareizs');
    } else {
    alert('Nepareizs');
    }
    //-->
    </script>

     

    P.S. Tam email skripta regulārajai izteiksmei laikam prasītos beigās i, lai arī lielos burtus ņem pretī... Slinkums pārbaudīt.

  7. CSS liek alpha caurspīdīgumu visam elementam (tavam div-am un visiem viņa 'bērniem'). Kā saprotu, atsevišķiem apgabaliem to nevar izmainīt.

     

    Rīkoties var šādi - div-am kā background-image uzlikt png ar 80% caurspīdīgumu.

     

    .transp
    {
    filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=tavs_png_sheit.png, sizingMethod=scale); 
    }
    
    .transp[class]
    {
    background-image: url(tavs_png_sheit.png');
    }

     

    P.S. Pirmā daļa priekš IE, otrā - FF.

  8. function convert2columns_ag($colcontent, $columns, $column_spacing, $colW) {
    $res = '<table border="0" cellspacing="' . $column_spacing . '" width="' . $colW . ' px">';
    $content = array_chunk(explode('<br/>', $colcontent), $columns);
    if (empty($content)) {
    	$res .= '<tr><td></td></tr>';
    } else {
    	foreach ($content as $row) {
    		$res .= '<tr>';
    		foreach ($row as $value) {
    			$res .= '<td>' . $value . '</td>';
    		}
    		$res .= '</tr>';
    	}
    }
    $res .= '</table>';
     return $res;
    }

     

    Kā izskatās? Vienkāršota funkcija, bet īsti nesapratu tavu jautājumu... Un labāk tomēr padot tās garšas kā masīvu, citādi explode ar <br/> ir diezgan nekorekti. A ja nu tiek padots ar <br /> vai nu <br>?

     

    P.S. Silti iesaku kādreiz izlasīt manuālī visas string, array funkcijas, citādi tādi brīnumi tiek rakstīti, kā vietā pietiktu ar vienu funkciju.

  9. 1) latviešu valodā ir tikai 2 dzimtes, un tās nav nosauktas skaitļa vārdos.

    2) suns un vēl pāris vārdi nav 6., bet 2. deklinācija.

     

    :)

    Nemaz nesaku, ka suns ir 6tā dzimte [deklinācija].

     

    Bet nu vārds Zibens (vai arī uzvārds) pilnīgi varētu būt... :P

  10. Tīri ar CSS nekas neiznāks. Ja gribi ļoti automatizēti, nāksies vien likt klāt javascript. Skripts izskrien caur visu docu, atrod visas tabulas ar tavu klasi, sagrūž vajadzīgās klases tabulu šūnām.

     

    Cilvēki mīļie! Tagad nesāciet lamāt mani un stāstīt, cik tas ir stulbi! Diemžēl šajā forumā tā bieži notiek... Zinu, ka, jo mazāk js, jo labāk (visbiežāk), bet ja nu cilvēkam vajaga...

  11. Slikti, tu piekop nelabu programmēšanas stilu - tu visus mainīgos definē kā globālus.

    Paldies! Godīgi sakot pats nezināju atšķirību.. o_O

     

    Nekā nesapratu.
    Žēl...

     

    Tieši tā jau arī jādara - jāpārbauda uzrakstītais. Un ar regexpiem tas ir ļoti vienkārši, pats tā visulaiku daru. A nevis n-tos if nosacījumus rakstu.

    Tagad arī ir uz RegExp. Un viss skaisti, tīri, nekādas kursora lēkāšanas pie nekorektas ievades.

     

    Kodu tak padebugo, nevis kursoru pārvieto.
    Tā arī darīju, starp citu. Kāpēc te visi brauc augumā. Za*** totāli. Bet kad šiem prasa kautko (ko pats neesmu nekad īsti darījis), šie mēmi un saka, lai paši tiekot galā. Funking stulbi! Iesakiet kādu ārzemju PHP forumu. Tinos prom.

     

    Pie tam - labais GUI veidošanas stils (usability) saka, ka vajag atļaut visu ko lietotājam ievadīt datu ievades lauciņos lauciņā, bet sākt bļaustīties un uzrādīt kļūdas tikai tad, kad tiek apstiprināts datu ievads (webā piemēram pie formas submitošanas).

    A ja nu klients pieprasa? ;) Nu tomēr laukā `cena` nevajadzētu rakstīt kkādas muļķības.

×
×
  • Create New...