Sayhi2ay's Posts
Nairaland Forum › Sayhi2ay's Profile › Sayhi2ay's Posts
1 2 3 4 5 6 7 8 9 10 (of 12 pages)
Goshen360 |
pc guru: @Timileyin i will explain the frameworks ave used and why they are cool'lazy-loads' means a class is instantiated when it is called. anyhow, have used cakePHP extensively, used zend some, played around with yii and symfony ... will still stick with cake.. yii is very fast though, doesnt come with much overhead other framework comes with. |
minimal tolerance for concurrent access? maybe you are using the wrong engine. few inserts would be done at any given day anyways, why are you so worried about concurrent access? if you have your indexing and constraints right , reading from the db isnt bad at all in mysql, i have co-developed web apps with mysql as db , during peak periods, we have about 2000 people accessing it at the same time, and the server doesnt take a hit. am part of a team that manage a web app right now with about 20000 db transactions daily - using mysql, and all is good and dandy. i developed a learning management system(LMS) web app last year and had about 300k test record of users in the mysql Db, i simulated concurrent access and the server didnt drag. maybe you should do some code/data structure review and code refactoring; and try to minimize mysql internal function calls in your query - if you have any. |
i have a school management software i developed, maybe i can send you the source if you can set it up yourself. plan to resume maintenance next January |
Try to avoid using mysql functions if php can easily do it, efficient when building a web app |
i have been using it for 2years now. really fantastic. lemme know if you have any question on it. |
always try to set a default value, and set your return outside your condition. when dealing with numeric, try to test for string > 0 , is_numeric('0') would return false, what do your return then ? function get_date($unix_time) { $read_in = null; if( !empty($unix_time) && is_numeric($unix_time) && $unix_time > 0 )) { $read_in = date("F j, Y, g:i a", $unix_time); } return $read_in; } |
select distinct state_population, state_weather, income from etc etc. distinct will apply only to the state_population column |
use distinct on the username, and pull other columns. |
shouldnt your array keys be quoted? array_unique(array_merge(array_values($arr1), array_values($arr2), array_values($arr3), array_values($arr4), array_values($arr5))); |
seem someone messed with the template |
- make your DB column datetime format - then for your input field, you can merge all the 3, and use the strtotime function to convert it to a single date format. |
what are your input fields? and how is the date appearing currently ? |
do you want to compare against the DB or the file? |
thanks dualcore. my main goal is to check if letters a to z are the first letter of my data array. i have a search function that returns a list of names depending on your search string. so say i search 'ay' in my database, it should return all the names that contains 'ay', then my snippet above will return the list of first letters of my record set. that way, i can make a list of A-Z, and just make the whatever letter i got from my snippet an active link. so you search 'ay', you get your result. then you can click an active link from A-Z. say D is an active link, then the search condition will be , from the search 'ay' result set, find the records that starts with 'D'. if the first search returns this list: Ayo Layo Dayo Tayo Mayo Morayo Tunrayo Desayo then my snippet will return A, D, L, M, T so when i echo letters A - Z, only A,D,L,M and T will be active links. and when you click on D, the search result = 'Dayo', 'Desayo' |
maybe something faster? here's what i have now. thanks. function firstChar($string) { return($string[0]); } $data = array('dayo','tobi','john'); $data = array_map("firstChar", $data); for($letter = ord('a'); $letter <= ord('z'); $letter++) { if (in_array(chr($letter), $data)) { print chr($letter); echo "<br/>"; } } |
anyone has a better way for achieving this ? $data = array('dayo','tobi','john'); $firstChar = array(); for ($i=0; $i < count($data); $i++){ $firstChar[$i] = $data[$i][0]; } for($letter = ord('a'); $letter <= ord('z'); $letter++) { if (in_array(chr($letter), $firstChar)) { print chr($letter); echo "<br/>"; } } just need a better function cos my $data set has more than 100k records, want something faster to look through the array instead of parsing through it and then using in_array |
dyn:I maintain an ASP application, develop using PHP and coldfusion. PHP and ASP are not similar. coldfusion is easy to learn but not free, PHP is also easy too |
Youngichou:though PHP has had it's share of security holes, security fix are applied before they are exploited. most vulnerabilities lie in the PHP application - poor design, XSS, CSRF, injections or lack of variable declaration - which can lead developers inadvertently allow holes in the app. to think PHP is not capable of secure application is wrong |
- put successful registration details on the dashboard, and not the sidebar above the login info, that's not where users expect to find it - on the welcome page: add 'Messages' quick link, and then the number of new messages , e.g Messages (3) or Messages *new - You can have a functionality where users can click that they have interest in a game CD, but they might not have the exchange the original poster is looking for , then the poster can contact whoever is interested for alternate negotiations. - Put the Recent available items available on another page entirely, not after the profile and account section. looks weird . - i shouldn't be able to rate another user, unless we have had a transaction. you might need to implement another rating system though, people should be able to write a short note on feedback. Well done!!! ![]() |
Np. Not tested the functionalities though, checked from iPad. Why not make it open source if you are not developing for a client? |
- put recent games on the dashboard - change timestamp to 12 hours - don't make me confirm that I indeed want to edit a message or save, I know what I clicked! - categorize game types, Ps2, ps3 wii etc etc - aggregate your ratings, you can create a modal box to show rating break down, n I will click it if I care to know |
yea, but number of files is dynamic, |
try featured content gallery, i prefer dynamic content gallery though |
@dhtml: yes o correction: the first loop is necessary as the $xml->nodeType will forever be assigned XMLReader::ELEMENT, and therefore, the other 'if' statements wont be touched. Thanks anyway, solved my challenge. |
btw - my first 'if' statement is not necessary, was trying to loop with it, but not anymore. my xml file would ALWAYS have an element, so the first 'if' statement will ALWAYS be true, meaning $article[$name] is valid at ALL times. thanks again. |
<Document> <PubDate>2010-10-10</PubDate> <Categories><![CDATA[Animals]]></Categories> <Authors><![CDATA[<p>Ay Dot Bleep@yahoo.com</p>]]></Authors> <Headline><![CDATA[<p>This is a 9th headline</p>]]></Headline> <Excerpt><![CDATA[<p>This is a test story. This is a test story. </p>]]></Brief> <Body><![CDATA[<p>This is a test story. </p> <p>This is a test story. </p> <p>This is a test story. </p> <p>This is a test story. </p> ]]></Body> <Files> <File> <FileID>55365</FileID> <FileName><![CDATA[foxy.jpg]]></FileName> <FileDescription><![CDATA[This is a fox]]></FileDescription> <FileType>image/jpeg</FileType> <FileBytes>256</FileBytes> <FileDateTime>2010-10-05 16:32:27</FileDateTime> </File> <File> <FileID>55370</FileID> <FileName><![CDATA[catty.jpg]]></FileName> <FileDescription><![CDATA[This is a cat]]></FileDescription> <FileType>image/jpeg</FileType> <FileBytes>512</FileBytes> <FileDateTime>2010-10-05 16:33:04</FileDateTime> </File> <File> <FileID>55371</FileID> <FileName><![CDATA[doggy.jpg]]></FileName> <FileDescription><![CDATA[This is a dog]]></FileDescription> <FileType>image/jpeg</FileType> <FileBytes>1024</FileBytes> <FileDateTime>2010-10-05 16:33:06</FileDateTime> </File> </Files> </Document> My code: $xml = new XMLReader(); $xml->open('filename.xml'); $article = array(); while($xml->read()) { if($xml->nodeType == XMLReader::ELEMENT) { $name = $xml->name; } else if($xml->nodeType == XMLReader::CDATA) {$article[$name] = $xml->value; } else if($xml->nodeType == XMLReader::TEXT) { $article[$name] = $xml->value;} } print_r ($article); $xml->close(); Result: Array ( [PubDate] => 2010-10-10 [Categories] => Animals [Authors] =>Ay Dot Bleep@yahoo.com [Headline] =>This is a 9th headline [Excerpt] =>This is a test story. This is a test story. This is a test story. [Body] => This is a test story. This is a test story. This is a test story. This is a test story. This is a test story. This is a test story. This is a test story. This is a test story. This is a test story. This is a test story. This is a test story. [FileID] => 55371 [FileName] => doggy.jpg [FileDescription] => This is a dog [FileType] => image/jpeg [FileBytes] => 1024 [FileDateTime] => 2010-10-05 16:33:06 ) Challenge: I am missing the first 2 files. -- fileID, fileName etc etc been a busy week, cant even think straight, any thoughts? thanks. |
I got an 'Access denied for user' error on a web app. investigation further, i found out that the table which the query is trying to select is bad. using CLI at the back end, when i selected the table for view, gave same error : Access denied for user 'username'@'localhost' (using password: YES) so i copied the bad table, and could access the copied table. i noticed that the there was a persistent connection to the bad table been used by the web app, so was wondering if this could be the cause of the bad data ? |
Dual Core:lwkmd |
