« first day (1021 days earlier)      last day (4153 days later) » 

00:00
@user2015338 browser user agent
this one, stackoverflow, I mean on the Questions forum of Stackoverflow
@crypticツ $_SERVER['HTTP_USER_AGENT'] ?
@AlejandrodelRío SO is not a forum, but you can ask any question provided it adheres to the site's topic see stackoverflow.com/questions/how-to-ask If you are referring to posting your question here sure post it once and if someone wants to answer it they will. Don't spam the chatroom though.
@user2015338 yes
@crypticツ That is exacly what I am going to do with the time and challenge question. Thank you!! :)
ok, I would like to know if someone knows a good approach to change the CSS of an iFrame just before it loads, the original questions is this: stackoverflow.com/questions/17990254/…
00:08
@AlejandrodelRío what exactly are you trying to do?
@crypticツ change the CSS of a webpage just before it loads
using an iFrame or not
@AlejandrodelRío but why would you want to do that to an iframe loading Facebook or Twitter?
@crypticツ well those are just examples, it might be any other webpage, the purpose is to change the presentation of the webpages and adapt it for different purposes
@AlejandrodelRío you are not allowed to do such things to websites you do not control. It breaks security in place set by the browser. Otherwise anyone can access the data from any site and grab bank info, login information, etc. It can't be done.
If you DO control the iframe site you can do it, but otherwise no, but then it would defeat the purpose as you can physically set the CSS for the site anyways
@crypticツ yes I know what you mean, the original questions was more oriented to "not using an iFrame", right now I would only like to achieve that on an iFrame and an external website. Does the website that I will change the CSS needs to be on my servers?
00:17
@AlejandrodelRío yeah it has to be a site you own or have control of so you can set the origin policy for it to allow other domains you control to modify and access it's contents. But that would be illogical to do as you could just edit the CSS for that site to begin with.
EWW! Screw iframes!
@cryptic I have one more question if I can. There are to params in login.php: $user and $pass. They supposed to be strings but what if someone sends e.g. array. That will throw an error in my code. I tried for example $user = (string)var_dump($user) But that is obviously not the right way :)
@user2015338 if someone sends an array the application should just exit as it would be an obvious vuln scanner attempt. No legit user would change the request to arrays.
@user2015338 Are you asking how to detect arrays?
I suppose is_string() test would do? and then if it is not string then die?
00:23
@crypticツ ok thanks for your time, I will keep searching for a workaround
@user2015338 That'll do if you're trying to detect strings.
@Jeremy I think that is really all I need
Then you should be fine. ;)
@AlejandrodelRío no problem, but there is no workaround you can't bypass browser security restrictions like that.
Thank you for your kind help gentlemen, have a nice evening/night/morning
:)
user652649
01:23
@Wesツ - Love it haha.
Hey guys, how's everyone doing?
user652649
@Blahwhore you shouldn't. i have an axe
@Wesツ - Isn't it possible for me to run away then. o_O
user652649
@Blahwhore lot of snow outside
@Wesツ - I know i shouldn't have trusted this damn timeshare. -- "It'll be fun" they said. ._____.
user652649
01:29
xD lol
haha.
:)
So... on to a bit more of the business side of things... (sorry to be blunt.)
$url="http://myfconline.com";
$html = file_get_contents($url);

$doc = new DOMDocument();
@$doc->loadHTML($html);

$tags = $doc->getElementsByTagName('img');

foreach ($tags as $tag) {
echo "$tag->getAttribute('src')";
Kind of having trouble identifying only a single tag. (Multiple ones are good and all, but for useful for the thing i'm attempting to do.)
user652649
you should identify where the img tag is placed in uniquely... for example
$doc->getElementById("content")->getElementsByTagName("p")->item(0)->getElementsByTagName("img")->item(0)
that's true, although the problem with that is... it's grabbing the code in the general sense. For example, when you visit a website, the ID element might be "content" and in another, it's "body_element" or "myContent" -- Making it nearly impossible to create a script that would identify a specific tag.
I'm using this code as a way for members to share links to a website, and then grab a random (or first img tag) from said website and display it.
@Blahwhore that's a cool idea, but what about pixel-imgs?
i've attempted to do that @DaveChen, but the thing is... it wouldn't work.
Especially for facebook.
hell, it wouldn't even grab the website's title.
user652649
01:39
so you want to download an image that represents the site? why don't you use schema.org / facebook apis or even <link rel="apple-touch-icon" href="blabla.png">
user652649
microdata / microformats / rdf
@Wesツ - Bigger websites might accept that option, however there are tons of websites in this internet (as you're all aware.) and many of them do not include the tags necessary for us to grab it's contents from. -- So relying on their <img> tags would be a lot better.
user652649
don't think so... most of sites implement micro syndacation today
user652649
all blog platforms / scripts have it
user652649
and as a fallback you can pick the <img> tag
01:43
@Wesツ - i'm not entirely sure about microsyndacation. -- For sure, not all include microdata (i've made a few sites in the past as a beginner and i've never included related tags or meta tags.)
@Blahwhore your code works fine, just remember to close the foreach, and remove the quotations
foreach ($tags as $tag) {
    echo $tag->getAttribute('src');
}
@DaveChen - The code works, i'm aware, the thing is... i need for it to display a single image tag. Not multiple ones.
then...$tags->item(0)->getAttribute('src') :D
or put the above in an array, and select a random image
@Wesツ - lunarembassy.com/lunar/… -- that's but a mere example of non working microsydication.
user652649
i would do with microdata/formats
user652649
01:45
yes, but that site was made in 1983 apparently
@DaveChen - tag worked, except it replicated the same image three times.
@Blahwhore is it still within the loop? that one statement should be enough
^ as in, you should just have right after $tags, echo "<img src= --- blah blash blah --- >";
@Wesツ - how would one go about in making these microdata/formats work? (not using meta tags, of course, since facebook and a few others will not use said options.) -- I've tried meta tags and i wasn't able to even grab Facebook's title from it's <title>Facebook</title>
@DaveChen - yeah, it loops the same image.
@Blahwhore your code should look something like:
<?php

$url="http://myfconline.com";
$html = file_get_contents($url);

$doc = new DOMDocument();
@$doc->loadHTML($html);

$tags = $doc->getElementsByTagName('img');

echo '<img src="'.$tags->item(0)->getAttribute('src').'">';
^ in fact, I just tested this, it works fine, showing one image :D
user652649
because facebook is all generated content
user652649
01:50
but with facebook apis you can get all the images you want
user652649
also names
@DaveChen - my mistake, you're correct.
@Wesツ - wait, the Apis are able to replicate the same system as in their website?
the title, description, link and image from a URL?
user652649
not all contents of course, but yes, nearly
@Blahwhore it's a bit more complex if you want private information, (you will need to look at the OAuth/authentication api)
user652649
pretty sure you can get profile/page image and title
01:52
@Wesツ - i'm mainly looking to grab the basics (title, description, and image.)
@DaveChen - that would make sense, kind of a bitch to be frank haha. My mature mind wouldn't be able to handle it and since i'm limited in time. -- i don't think it'll be the best idea... for now.
* amateur
user652649
@Wesツ - is this only for facebook-based URLs?
user652649
yes
crap.
what about non-facebook urls?
user652649
if you are looking for a unique solution for all kind of pages, you can't find one
user652649
01:55
but you have to implement every single possibility
@Blahwhore that's pretty much what google does, they have years of information, which makes scraping data from pure html much easier
user652649
i would do, microdata, microformats, rdf, facebook, gplus api, apple touch icon, meta image_src and as a fallback the first <img> of the page
^ also note, for popular websites such as SO, google probably just contacts the api of SE
you two, make valid points and there's no denying that.
wealp, guess i'm screwed for the time being. -- How can i grab the microdata (as a fallback option)?
user652649
pretty much everything with php's DOM classes
user652649
02:01
except facebook and gplus api... there you need just json_decode
makes sense, thank you @Wesツ and @DaveChen - Much appreciated for all the information. -- I'll be leaving now. Have a great year guys :) You too @Jack
user652649
yw
@Jack pretty much says "not possible" without a solution, while everyone else pads questions marks...
I'm guessing that downvote was from you?
What downvote? whistles
02:09
WTF
Yeah, I didn't flag as NaA ... "it's not possible" is still an answer, so DV :)
stackoverflow.com/posts/9007743/revisions omg formatting python code. Hate people who do this :(
but it's an answer, so I guess it fixed his answer
Do indented # still serve as comments in Python?
not indenting the def, I think, raises an error
@DaveChen Tried it on cmd line, works okay though.
I mean, the edit works.
Not sure about the original lol
Probably right though.
Python and its finicky indentation.
02:15
haha, the original probably fails
hehe
@Jack I'm not going to go into the merits of which looks better...but for every language I've seen, at the end of every file...all I see is:
btw, what timezone are you in?
                }
            }
        }
    }
}
Ugh, that's horrible.
02:16
central time zone
central of the usa? :)
same with lua, if blocks still end with `end` and not `endif`

end end end end end end end
or central of aussie land?
Winnipeg, center of Canada
Cool ... I've only been to Canada once, well, we never left Vancouver actually heh
02:18
So where are you right now? Or is your location on your profile it?
yeah, that location is pretty spot on :)
hmm, just did a spot check, most of my files end with } }
Probably because the last few methods are both private and simple :)
two? well makes sense, one for ending a function, and one for ending the class
yep :)
if I have a class structure like

Grandparent
-> Parent (extends grandparent)
-> Child (extends parent)

it's not possible to have a function within the grandparent that only the parent can access right?
Yeah. If you need that behaviour, something else is wrong :)
Either you have to make the grandparent aware of its child class or the parent class should override the function to throw an Exception or something.
02:25
^ bad practice xD, I am doing something wrong then
What are you trying to accomplish?
this chat isnt responsive to android...
@JosephPersie because it's about PHP !
>.<
02:27
I have four classes,

class1.functions
class1 (extends class1.functions)
class2.functions
class2 (extends class2.functions)

There are around 4 functions (private) within class1.functions and class2.functions that are *identical*, I was thinking of having class1.functions/class2.functions extends a general functions class that holds these 4 functions.

^ but then, they wouldn't be private, they would need to be protected, and then class1/class2 would be able to access them (not what I want).
good morning tho
@Jimbo if u c, I frst commented and than I answered because he said that he was referring a video tutorial where cant ask quest, it's often that people r comfy with video tutorials instead of going through manuals, and the question were having 4 doubts whcih cannot be searched using google :-)
@JosephPersie I jus posted a message and I read urs, I tot SO warned me dat dis chat is not responsive to android
I think I have android on my ignore tags list :D
@DaveChen There are other functions besides those 4 private ones right? Otherwise I would just create one class (i.e. merge class1.functions and class2.functions) :)
@Jack haha yeah there are :)
there are like 20 functions, but coincidentally there are 4 functions pretty long that are existent in both classes
02:37
@DaveChen Can you extract a class from those four methods?
In that case, you inject the extracted class as private properties in the two base classes.
reading up it, pretty smart idea. Just a quick skim, but basically, you make a class, and create a new class of what you want, and then store it
so potentially, I could create another class (with the four functions), and have it be instantiated within class1/class2
yeah, or it gets inserted in the constructor, either way.
but then you will probably want to finalize the constructor ;-)
oh well, you can refactor that later if you need to anyway.
thanks, I'll try this out :D
02:57
Hi
(0 => array ( 0 => '5/2/2013', 1 => '9:31:00 AM', 2 => '0.395', 3 => '0.395' ),
1 => array ( 0 => '5/2/2013', 1 => '9:31:00 AM', 2 => '0.383', 3 => '0.383'),
2 => array ( 0 => '5/2/2013', 1 => '9:32:00 AM', 2 => '0.383', 3 => '0.383')) how i can detect element no 2 have same time with no 1 so i can remove all rows on that element. then change element no 3 replace that row.so it become like (0 => array ( 0 => '5/2/2013', 1 => '9:31:00 AM', 2 => '0.395', 3 => '0.395' ),
1=> array ( 0 => '5/2/2013', 1 => '9:32:00 AM', 2 => '0.383', 3 => '0.383'))
i know to check duplicate value we need to use array_unique
but how i can check only time is unique,others value its fine if duplicate.
You want just time in the results?
no..i need all value for the result.
of which one?
the first in a duplicate set or the last or based on some criteria
but check only time if duplicate,i want remove all row of that time
for example on

0 => array ( 0 => '5/2/2013', 1 => '9:31:00 AM', 2 => '0.395', 3 => '0.395' ),
1 => array ( 0 => '5/2/2013', 1 => '9:31:00 AM', 2 => '0.383', 3 => '0.383'),

Which should go into the results?
03:08
i just want the result to be like this                                                                           (0 => array ( 0 => '5/2/2013', 1 => '9:31:00 AM', 2 => '0.395', 3 => '0.395' ),
1=> array ( 0 => '5/2/2013', 1 => '9:32:00 AM', 2 => '0.383', 3 => '0.383'))
first one
0 => array ( 0 => '5/2/2013', 1 => '9:31:00 AM', 2 => '0.395', 3 => '0.395' ) only
$results = array();
foreach ($array as $v){
    if (!array_key_exists($v[1], $results)){
        $results[$v[1]] = $v;
    }
}
$results = array_values($results);
that should work for you
$v[1] it means 1 refer to column number 1?
yep... setting up as the key in the result array..
that's the mechanism that I am using to ensure uniqueness
how can i write to check specific row and column?can i write as $v[1][4] let say for column 1 and row no 4?
In this code $v refers to only one of the arrays at any given time
if you wanted to check against a particular value you want to use $array[4][1]; (forth row, first col)
03:20
hmm ... I'm thinking of a one-liner ;-)
@jack array reduce?
it'd be an ugly one-liner :)
Yeah, I wasn't thinking of that ...
But as I started writing I soon found it's not possible as a true one-liner :)
It would be nice if array_unique() could accept a mapping function ;-)
agreed
or rather, a custom sort method.
"could accept a mapping function" -- it would be too easy
03:26
array_unique_callback($array, function($a, $b) {
    return strcmp($a[1], $b[1]);
});
@Jack following php "conventions" it should be array_unique_callback
hehe
 array_reduce($array, function(&$arr, $v) {if(!isset($arr[$v][0]) $arr[$v[0]] = $v}, array());
@Orangepill Hmm, I don't think that would work ... the return value is wrong.
Eh
Yeah, return $arr; would be necessary I think.
stackoverflow.com/questions/18008191/… <- I might consider cv-as-duplicate :)
03:31
tq @Orangepill. mapping means can check any rows or column number to set unique?
@DaveChen "It's not racy." - ehm, that doesn't sound quite right :)
haha what :P what's wrong with that statement?
@DaveChen What did I just read real_escape_string
Have you looked up what racy means? :)
It couldn't be further away from race conditions hehe
^ lolz
hey guys, sorry a quick question, how can i send a string back to a html header from php?
html doesn't have headers.
http headers? send a http header? xD
by that i mean <h1> string </h1>
ohhhh, so you want to dynamically change what's inside <h1>?
03:36
one liner
 $a = array_values(array_reduce($array,function(&$arr, $v) {if(!isset($arr[$v[1]])){$arr[$v[1]] = $v;}return $arr;}, array()));
@NetInfo Those are called headings :)
oh sorry, kinda new to html and php, im just used javascript vb c#
@NetInfo <h1><?php echo $mystring ?></h1> ?
@crypticツ y u no do html escaping?
ok, so i assume that goes in the php file?
sorry, have no idea what that is
03:37
@Jack how ? Need some regex lol
@crypticツ y u no semicolon? :c
@Orangepill Lol
@Jack yeah I should, assumed it would not be user input
@Jack Ugly as sin but it works
@DaveChen What semi-colon?
03:38
sorry wrong ping
Прислали вот родственники конфеток #почтароссии http://t.co/k0uO7MHvUF
2
our relatives sent us some sweets
^^ what he said
@Orangepill would be a pain to debug, but nice to show off :P
(the demonstration of how russian post works)
(sorry for cyrillic)
^ lol
03:39
I can see the word bot :) that's about it
@zerkms Wow, even the hash tags are Russian :)
2
@crypticツ thanks man that is still in the html
@Hamza Jack threw down the oneliner challenge :)
@Orangepill haha I see
@NetInfo Then I don't know what you are trying to do
03:40
@zerkms font looks cool .. btw i have no idea what that mean :P
@NetInfo is it a .php file?
@NetInfo FYI she's a woman :)
@NullPoiиteя it's a marshmallow-alike candies in chocolate
all im trying to do is submit a form to a php file, then whether it is a success or fail, show that result on my html page in a specified heading
@NetInfo cool!
03:41
@NullPoiиteя haha I thought you meant zerkmsfont looks cool -- and I was about to say, what the heck is zerk microsoft font?
Google says the candy sounds like "pochtarossii" :)
FYI its an email sending thing
@Jack that's #postofrussia
heh
@HamZa I gave up correcting people =oP Apparently there are many men who use pink cats as their avatars that I did not know of.
03:42
sounds tasty \o/
@crypticツ hahaha
actually it's a legendary organization
I've sent a christmas gift to a friend
in Dec
it wasn't received by russia since there was alcohol inside (small wine bottle was included, who knew it's denied)
and they mailed him that the parcel is sent back
nothing is recieved yet
8 months passed
oookey then, thanks guys
ciao
@zerkms lol ... may be they are planning to send it on next Christmas
and that's how parcels are unloaded off the train
03:46
omg ... this is ridiculous ....
that is sparta
2
is that ups?
... through all the parcels xD
haha
@zira if you want a breakdown on what that code I posted did here it is:
$results = array();     // create an array to hold results
foreach ($array as $v){   // walk each of the values in the array
    if (!array_key_exists($v[1], $results)){ // check to see if the time exists
                                             // as a key in the results
        $results[$v[1]] = $v; // if not... stuff it in the array
    }
}
$results = array_values($results); // get rid of the keys we set
03:49
bye guys ... .cant survive more on desk ..
@NullPoiиteя are you in office?
I'm going to call it a night as well
04:13
So ZipArchive::extractTo has a 2nd argument which takes a list of files to extract. How can I get it to extract only a specific folder and its contents? I have tried pathtofolder/folder, pathtofolder/folder/, pathtofolder/folder/* none work. The trailing slash one extracts just the empty folder though.
04:23
@crypticツ Yeah, glob patterns don't work for that :)
You would have to iterate the contents.
@Jack NOOOOOOOOOOO
I'm better of just doing exec('unzip -q myfile.zip pathtofolder/folder/*'); This zip extensions sucks in PHP
I'm sure the same process is done by unzip, it's just that you don't see it :)
why array slice does not work after array_values?
$results = array_values($results);
$DataWind3_slice = array_slice($results, 0, 3);
but still get all array in $results
It doesn't modify the original array.
even i write like this? $sub_array1 = array_values($results);

$DataWind3_slice = array_slice($sub_array1, 0, 3);
04:36
What are you trying to do?
i want to remove last element in each row
array_slice($row, 0, -1) should do that.
but its work before i write array_values
array_slice($row, 0, -1) also does not work
It should work either way.
If it doesn't, you haven't shown enough code.
$results = array();
foreach ($DataWind3 as $v){
if (!array_key_exists($v[1], $results)){ //remove duplicate minute
$results[$v[1]] = $v;
}
}
$sub_array1 = array_values($results);

$DataWind3_slice = array_slice($sub_array1, 0, -1);
04:41
Morning everybody
$DataWind3 = (0 => array ( 0 => '5/2/2013', 1 => '9:31:00 AM', 2 => '0.395', 3 => '0.395' ),
1 => array ( 0 => '5/2/2013', 1 => '9:31:00 AM', 2 => '0.383', 3 => '0.383'),
2 => array ( 0 => '5/2/2013', 1 => '9:32:00 AM', 2 => '0.383', 3 => '0.383'))
i need the result as (0 => array ( 0 => '5/2/2013', 1 => '9:31:00 AM', 2 => '0.395'),
1=> array ( 0 => '5/2/2013', 1 => '9:32:00 AM', 2 => '0.383'))
$results[$v[1]] = array_slice($v, 0, -1);
LOL ANSWER
0
A: How to make attractive dropdown menu using css3?

rjf0909I think you want li:hover { background-color: New Color; }

Can anyone help me with the error in the bottom, cant send the header? pastebin.com/JETJD8ip
@Jacta remove die die(mysql_error());
header("location: /nfolder/new/");
04:56
@Mr.Alien removed all or die in the document, same error, same line
@Jacta damn don't use short open tags, use <?php ?>
tq @Jack. more understand now.
@Jacta Do you have any spaces before <? ? (or data/html) ?
@Mr.Alien Good Morning
@HamZa No spaces, no html - its the start of the document you'll see
05:03
@Jacta this happens when you output any html or there's white space before u use header
@Abhi heya ;)
@HamZa morning bro
525
A: Headers already sent by PHP

marioNo output before sending headers! Functions that send/modify HTTP headers must be invoked before any output is made. Otherwise the call fails: Warning: Cannot modify header information - headers already sent (output started at file:line) Some functions modifying the HTTP header are: head...

^ check this answer
@Mr.Alien I'm are of that, but there aint no - im 100% sure
@Mr.Alien morning
@Jacta wait, let me see that again
@Jacta encoding ... ?
05:05
wait wait, how can you pass this without any param? mysql_error()?
mysql_error dont need any params - but also removed em - have to dig deeper
checking the enconding soon
I feel like I forgot mysql api completely :p
@Jacta I guess it needs param, php.net/manual/en/function.mysql-error.php
guys, that you have exp with this error---> Fatal error: Out of memory (allocated 1742471168) (tried to allocate 36 bytes) in
i already set in php.ini memory_limit =-1
my code $f = fopen('php://memory', 'w');
@zira you shouldn't do that
@zira yeah setting php's memory limit to negative one bytes isn't going to do any good :(
05:12
It's simple, if you're using more memory than you allocate, you have nothing else to do than:
1- tweaking your script to consume less memory
2- increase the memory limit
I would go with the first option first
To get the correct diff origin/live after git pull origin live I have to do git remote update origin, why is it that? As far as I know git pull origin live === git fetch origin/live && git merge origin/live
^ but if you're working with the GD library, it can't be helped. (unless you generate the image in blobs)
i'm generating large data into csv file
how can i tweaking the script?
So, is it too slow? What's the issue with the script you have right now?
so in my case it does not because of script right?
05:23
@zira where do you use the variable $f?
i'm generating data base on every min.let say user choose to from 1/1/2013 - 30/1/2013. so i will generate 43200 rows of data in one csv file.and the number of the columns also can be 100-200.
$f = fopen('php://memory', 'w');

	 fputcsv($f, $header, ',', '"');
    // loop over the input array
    foreach ($array as $line) {
        // generate csv lines from the inner arrays
        fputcsv($f, $line, ',', '"');
    }
    // rewrind the "file" with the csv lines
    fseek($f, 0);
    // tell the browser it's going to be a csv file
	header("Content-Type: text/csv");
    // tell the browser we want to save it instead of displaying it
    header('Content-Disposition: attachement; filename="'.$filename.'"');
@zira what's the value of $header?
string
125 string for 125 column
@zira fputcsv expects the second parameter ($header), to be an array.
owh, sorry, yes, i put the string in array
05:32
@zira silly, but did you remember to *re-*start apache after changing php.ini?
0
Q: How to return hierarchical tree in array?

darshanI want to display category sub-category in my view form, i have array($tree) which is in format [child-id] => parent-id and i passed this $tree to my function recurse_uls, $result = $this->recurse_uls( $tree,$parent = 0,$abc); $this->load->view('product_displey',$result); function recurse...

can anyone help to solve this problem?
yes, already restart
@ I think problem can be solved by using physical csv file instead of fopen('php://memory', 'w');
@zira You should not open php://memory, instead use STDOUT as the file handle.
then write the headers before you start output
05:41
$f = fopen('php://memory', 'w'); just change to $f = fopen('php://stdout', 'w');
? http://php.net/manual/en/features.commandline.io-streams.php
No.
fputcsv(STDOUT, ...)
@Gordon Sir Good Morning :)
@Abhi hello sir
@Gordon :) I am not sir , But you are
05:48
@Abhi why am I and you are not?
cv-votes rising by around 1k daily, so I guess soon it's going to reach 100k...and then SO will crash :(
@Gordon Simply Moderator is Sir.
@Gordon and your name is blue :o
@Abhi ah ok. thanks. you don't need to sir me though. I am not a knight ;)
@Gordon :D . Ok Deleting Sir
Oh you are celebrating it today?
@Abhi I celebrate it every day ;)
just kidding
Haha.
@Gordon It seems that I have missed your ordination of knighthood? ;-)

« first day (1021 days earlier)      last day (4153 days later) »