Everything posted by php_penguin
-
Search Me
fancy idea, but when it comes to searching for something quickly, text is faster, both in loading and interpreting the results.
-
New Uk Coin Designs
pound coins neeeeed to be a different color - that is how I spot them in my "bag of change" (a bag which I put all my change in, curently weighs around 3kg) The actual design is ok, but it looks too odd to be the "new currency" rather than just a special run sort of thing...
-
Headcoats
what is the difference between a headcoat and a hat, exactly?
-
Php
this happens to me with Firefox, usually after long periods of use (>4 hours for me). It is nothing to do with your PHP - try using Firefox 3
-
Ecart 4 Anyone
hi, firstly, please explain what your idea is secondly, "really good" and "i'd pay for it" are not the same thing. Google Checkout and so on may provide a similar service for free.
-
Question On Database Extract
oh yes, and MySQL can do it - I can't remember how though, so Google "importing data from a text file into MySQL"
-
Question On Database Extract
ah, i was wrong CSV = comma seperated I was thinking of "DSV" or delimiter seperated, usually just stored as .txt http://en.wikipedia.org/wiki/Delimiter-separated_values http://en.wikipedia.org/wiki/Comma-separated_values
-
Question On Database Extract
<?php // mysql connect, and select database $file = file("data.txt"); $keys = explode("|", $line[0] ); foreach( $keys as $i=>$key ) { $keys[$i] = "`".trim($key)."`"; } unset( $line[0] ); $query = "INSERT INTO `datatable` (".implode(",",$keys).") VALUES "; $dataSet = array(); foreach( $file as $line ) { $data = explode("|", $line); foreach( $data as $i=>$d ) { $data[$i] = "'".trim($d)."'"; } $dataSet[] = "(".implode(",",$data).")"; } $query .= implode( ",", $dataSet ); mysql_query( $query ) or die( "Error<br>$query</br></br>".mysql_error() ); ?> Also, I'm pretty sure "csv" means "character seperated values" rather than "comma seperated values"...
-
Virtual Barbershop - Headphones Required!
wow that is soo cool - I couldn't find headphones so I just put my speakers either side of my head ... only trouble is my "left" speaker is on the right, and vice versa... I hate electric shears too so that was a bit stressful
-
Justice - Excellent Music Video
Is it just me or this song slightly different to the version on the Cross album? Maybe it is just sounds related to the animations... Great video though The one for D.A.N.C.E was great too.
-
Codeigniter
I'm guessing you didnt take too much of a look then Splashtech - it is entirely possible to organise your CI structure exactly as you want to - including renaming the index file, using a different URL structure, moving any of the system > * directories to anywhere else ... however you want to organise it, it is possible to organise it like so.
-
I Do The Back Ground Like On This Site?
1. open up photoshop or your favourite drawing program (GIMP is free). 2. create a canvas which is 1000x1 (yes, height = 1px) 3. select your colour palette 4. select the gradient tool 5. click at on end of the canvas 6. click at the other end of the canvas 7. save as PNG, + GIF, + JPEG - the file size here is a bit of an unknown, so compare them and choose the best trade-off between size and qaulity. Ok, so that is the image created, now to make it work in our HTML+CSS. Assuming your image is located in the same directory as your CSS, and it is called "bg_grad.png" (just guessing here), add this to your CSS: #COLOR must be the right-hand colour of the gradient body { background: #COLOR url(bg_grad.png) repeat-y; }
-
Codeigniter
Right, I am forgetting all my PHP knowledge ... and learning PHP-CI This is a lightweight framework that works in a nice MVC way - if you are used to classes (oop) then check out the video tutorials ... it convinced me... and I then built an FAQ system in about 15 minutes (+15 minutes styling) - i'll put it online in a bit. Anyway: CodeIgniter
-
More New Bbc
The BBC news stories have updated design-wise, so they fit the updated BBC design properly now. Interestingly, the beeb has gone for 1024x768 as the minimum.. if they are doing it I might have to follow suit.
-
Favourite Drink?
Alchohol : Foster's - I really can't handle spirits, one drink and I am throwing up... Soft Drink: Strawberr Frijj (milkshake) - I used to mainline Coca-Cola but it has started giving me really bad stomach pains lately.
-
Hacker Puzzle
yay completed it I used PHP to solve the fibonacci one function fib($n){ if ($n < 2) return $n; else return fib($n - 1) + fib($n - 2); }
-
Hacker Puzzle
ah lol thanks now stuck on 15
-
Hacker Puzzle
grr stuck on the 10 of spades one...
-
Php - Mysql Communication
you may not have the PHP->MySQL library installed, it needs to be installed specifically (it is an Apache Module i think).
-
Php - Mysql Communication
do you know the MySQL username/password? If not, it's probably "root/root" or "root/", so try these two bits of code: <?php print mysql_connect( "localhost", "root", "root" ) or die( mysql_error() ); ?> <?php print mysql_connect( "localhost", "root", "" ) or die( mysql_error() ); ?> one of these will result in "1" being printed. This function also connects you to the MySQL server on your computer (assuming you have the MySQL Server 5.0 installed - you might have MySQL Client by accident - if so, it will say "can't connect on port 1234 or similiar). once you have connected you can then do all the usual SQL queries with mysql_query.
-
Urgent Help Needed!
you need to character encode your things, £ becomes £ - UTF-8 doesn't handle these great... then again the & symbol seems to screw up some XML parsers, so this might make it worse
-
I Just Passed My Driving Test!
Seven words? I got ten (I am glad to tell you that you have passed) Congrats!
-
Classes Vs. Normal Functions
Hi Daniel - I was asking exactly these questions a year ago until I just bit the bullet and started forcing myself to write in classes. The main difference between is a class and normal function is that a class has memory for each of it's instances. Secondly, compartmentalisation helps here (meaning everything is tied together as part of the class namespace, eg ClassName::MethodName()) Classes, from my experience, are just plain better for everything apart from the tiny stuff (eg helper functions which clean a string) ... once you have written the class, and if you write it well, everything will just fall into place. Here is an example of getting the results from two tables, and setting a value from one row into another row from the other table: Serialised (just functions) : // imagine we have a function called dbget( String table ); $table1 = dbget( 'firstTable' ); $table2 = dbget( 'secondTable' ); $row1 = $table1[ '42' ][ 'afield' ]; // swapping this $row2 = $table2[ '17' ][ 'anotherfield' ]; // with this, and vice versa // and a dbwrite( String table, Array where, Array data ) function $write = dbwrite( 'firstTable', array( "id"=>42 ), array( "afield"=>$row2 ) ); $write2= dbwrite( 'secondTable', array( "id"=>17 ), array( "anotherfield"=>$row1 ) ); Because there are some nice helper functions I have imagined there, it took 6 lines of code. Now with a class (using this class) $table1 = new DBEntity( 'table1', 42 ); $table2 = new DBEntity( 'table2', 17 ); $hold = $table1->afield; $table1->afield = $table2->anotherfield; $table2->anotherfield = $hold; $table1->Save(); $table2->Save(); Now it is 7 lines of code - but look how much simpler it is? I have only written the table names once, the words involved are simpler (IMO ->save() is easier than dbwrite( table, where, data )) Finally - don't study classes you boring oaf! Write some of your own! You will quickly learn what works, what went wrong, and without too much luck you won't fall into a pit of despair
-
Google Saves The World
my homepage is iGoogle and it hasn't affected that... Anyway I thought Earth Hour was 8 pm-9pm?
-
How To Make A Div Become Visible On Clicking A Link?
if you don't want to use Javascript, you could try with the (fragile) :active psuedo-class. HTML: <a class="peek-a-boo" href='#'> A Link <div>some hidden text</div></a> CSS: a.peek-a-boo * { display: none; } a.peek-a-boo:active * { display: auto; }