« first day (788 days earlier)      last day (4166 days later) » 

12:04 AM
I am still lost with this issue of my tabs being removed from the outputted source.
Example
<?php
class template
{
function set($file,$variables){
    $contents = file_get_contents($file);
    print $contents;
|
}
Will return the contents of a file, but remove the tabs. :/
I have also added header("Content-Type:text/html;charset=UTF-8"); before this and the source has not changed
 
@PatrickMurray When you say remove the tabs, do you mean a) when you look at it on a browser (where you normally see a webpage) or b) In the view source from your browser?
 
I mean when I view that source
But when I print something before I print the file contents the tabs show (in the source)
Ex:
$temp = new template:
 
Maybe you have trim somewhere.
 
The thing is, I don't. I have looked through all of my code
The only thing near that is str_replace
and I have that commented out
 
Does it appear if you use Content-Type: text/plain?
 
12:17 AM
Yes :D
 
...are you looking at the source of the page when outputted as text/html? e.g. 'View Source'/'View Page Source'
 
Yes
I am using Google Chrome
 
ok
that's odd
 
I know :/ I haven't been able to find a way around it, I asked my CS teacher and he was stuck
If you would like, I can provide a URL
 
yes please
 
user1125394
12:20 AM
it removes tabs? the one of the browser?
 
Ok give me a min, I will PM it to both of you
 
i don't think there is PM here, but post and delete isn't too bad.
 
user1125394
pastie.org
 
Here
I do not believe it is a browser issue because both Chrome and IE are doing it
Any ideas?
 
@PatrickMurray Do you write your html with echo?
 
12:30 AM
Nope, print. What's the difference?
I am doing "print (string) $file_contents;"
 
@PatrickMurray OK first of all, don't do $var = file_get_contents(); echo $var;, use readfile() instead, secondly try adding while (@ob_end_flush()); before you output the file.
 
What is significant about ob_end_flush?
 
@PatrickMurray I'm wondering if there is some ob callback stripping the tabs to minify the output
 
I would have thought print would be okay. Maybe it is something in your server trimming whitespace.
 
I'll try what you suggested with the readfile()... If that doesn't work, I will contact my host
Doesn't readfile print the file contents?
I need to assign the contents to a variable
 
12:36 AM
@PatrickMurray your code doesn't show a need to do this... it just shows you reading the file and outputting it. What are you doing with the variable?
 
I am replacing keys in an array with their values from the file. Ex: ['title' => 'Hello, World!'] would replace: <!-- TITLE --> with Hello, World!
 
whaaa, why ?
 
Because the file would be the template for a site. And I find this method easier :3
 
Sounds like you are reinventing the templating wheel there
 
:O Don't want to do that
I do not want to use include() for this either
Any ideas?
This is what I asked yesterday... It is the same problem stackoverflow.com/questions/13810456/…
 
12:48 AM
@PatrickMurray This is a bit of a stretch I admit, but I have a sneaking suspicion the answer to why this is happening can be found here
The reason I suspect this is that I have an X-Mod-Pagespeed: 1.1.23.1-2169 header in the response
 
wow, nice find!
 
I did * {white-space:pre} Didn't seem to work
 
user1125394
see Mustache templating
 
^^ wireshark is your friend
 
<pre>
    Hello World</pre>
 
12:52 AM
although to be fair, chrome dev tools would have told you that as well
 
Done
Dave, thanks for that tool. :D
So you are saying that that tabs are being send... but the browser is not showing them?
 
user1125394
it's worth a +100 for daverandom
 
Darn. I like reading my HTML w/ tabs... I guess I can't do that. Thanks guys (and gals)
 
@PatrickMurray If that is the reason (also mod_tidy can do the same thing) then you will need to contact your host, it's an Apache config issue, that they will likely not be able to sort out without affecting the whole server.
They are being "sent" by PHP but Apache is stripping them before they are sent to the client.
 
I do not exactly know what to say (I am new to Apache)... Should I just mention that Apache is removing characters and mod_tidy?
And kindly ask if they could enable it?
 
12:59 AM
@PatrickMurray I would just describe the problem you are having and see what they say. If they say "it's nothing to do with us" then say "hey, but I notice from the headers that you guys are running mod_pagespeed, could that be it?" - i have found that hosts are often unwilling to admit to things like this being their fault. But at the same time - why do you want this? Is it just for reading your source code while developing?
 
Ok. And Yes for reading my source
 
user1125394
a2enmod / a2dismod
 
What's that cyril?
 
user1125394
type a2dismod then tab (for autosuggestion)
 
user1125394
and show what's printed
 
1:01 AM
In SSH?
 
user1125394
in terminal yes
 
user1125394
for example me:
 
user1125394
alias            authz_default    authz_user       deflate          mime             reqtimeout       status
auth_basic       authz_groupfile  autoindex        dir              negotiation      rewrite
authn_file       authz_host       cgi
 
-bash: a2dismod: command not found
 
user1125394
apache2 command is there at least?
 
1:04 AM
@PatrickMurray well two points about that then, firstly let me introduce you to html tidy (online version) and secondly, why not just set up your own dev server on localhost? It makes a lot of things a lot easier, you get granular control over the environment and you don't have to upload you file every time you change something
 
user1125394
you maybe have to install something for having a2enmod commands
 
@cyril I get the impression (maybe wrongly?) that we are talking about a shared host, they're not going to give you access to apachectl variants, unless they are insane
 
Only have r/w access in my home/ folder (it is a shared server)... so I may not have access to that command
 
user1125394
oho right
 
Yes :P
I'll still send them an email asking
 
1:09 AM
@Paul Interesting point. Any sane tidying lib would leave that intact. I might have to install both of these mods and see what they actually do. Shame I don't have any Apache left in any real use, would be interested to see what kind of a difference it makes.
 
user1125394
but a bit useless
 
@PatrickMurray You can, but I doubt they will be able to do anything about it even if they agree that it is the reason for the problem - it will most likely be server-wide config, and dynamic mass virtual hosting sacrifices a lot of granularity where that sort of thing is concerned. You could always try a .htaccess but I suspect the options would be disabled.
Try creating a .htaccess file with this line in it:
ModPagespeedDisableFilters collapse_whitespace
 
I have the ability to make an .htaccess... so I will do that now
 
It will either work, do nothing or cause a 500 error
 
user1125394
there should be a possibility of rep reward in chat
 
1:14 AM
OMG I LOVE YOU DAVE!
That did it :D
 
user1125394
should post it on Meta
 
I am so excited now :)
 
user1125394
but can't be bothered
 
winner :-)
 
I can't believe such a little thing made me so happy
 
1:15 AM
I'm a little surprised that worked, there was some serious guesswork and clutching at straws going on there
 
user1125394
does he have to put it in all .htaccesses?
 
@PatrickMurray If you've been shouting at your computer for hours, even the very smallest things will make you disproportionately happy
 
I have to put it in the one on the DOCUMENT_ROOT
That is my host's config
 
@cyril .htaccess propagates downwards, so if you put it in docroot it will work everywhere
 
user1125394
kk
 
1:19 AM
Thanks a lot! I spent a few hours trying to figure this out! Good night all!
 
Nighty night :-)
In situations like that ^^ I'm always tempted to contact the host and see if they know their own platform - but I never do it because if they see that you've found the answer and fixed it yourself they might get annoyed with you for trolling them
...but at the same time, if they don't know their own platform you should probably go find another host anyway
 
guys, what is difference between $array[] = array(stuff); and $array = array(stuff); ?
 
@TemporaryNickName The first one is pushing an inner array onto an outer one, the second is just creating the outer array
 
so first one is going to have all inner array stuff inside index 0
 
It's array(array(stuff)) vs just array(stuff)
 
1:31 AM
i see
thank you.
 
posted on December 12, 2012 by Christopher Jones

We're thrilled to have a major update of the free Underground PHP and Oracle Manual released on OTN. The Underground PHP and Oracle Manual is designed to bridge the gap between the many PHP scripting language and the many Oracle Database books available. It contains unique material about PHP's OCI8 extension for Oracle Database, and about other components in the PHP-Oracle ecosystem. It shows

 
user1125394
this syntax $array[] is really misleading
 
With the variable being called $array you mean?
 
user1125394
no the []
 
1:41 AM
Why? It makes sense to me. You are saying "access this key, that has no index" - so to me that says "create a new key"
 
user1125394
shouldn't be at the left of =
 
user1125394
all other languages use something.push(foo)
 
@cyril isn't that for list?
array is like myArray[index] = something
 
Yes, but they are languages in which arrays are objects that have methods. In PHP an array is just a data structure. That's what @LeviMorrison's datastructures work is about. He doesn't like the idea of the general purpose data structure, and 99.9% of the time I'm inclined to agree
You can always use array_push() if you'd rather...
 
user1125394
prefer to, but even the doc says not to
 
1:47 AM
@cyril Without looking it probably says "because of the overhead in calling a function" or words to that effect. Which is micro-optimisation of the highest order.
 
user1125394
k
 
Personally I never use array_push(), mostly out of habit/typing laziness, but also because the only reason (as I see it) that you would ever use it is when you have more that one element to push onto the array in a single operation, which is pretty much never.
...but Levi was saying the other day (my search skillz are failing me) that he uses it when the thing he is dealing with is explicitly a stack. So basically (IIRC) he was saying that if you are going to array_pop() or array_shift() then you should array_push() for consistency
which I get, and I don't disagree with. I kind of have no opinion really, I can see both sides of it
 
user1125394
k right, not so important, but function duplication -> confusion
 
?
Can you expand on that, I don't quite get what you mean
Also, unrelated, have you had any problems with github today? My push is failing with no error message :-(
 
user1125394
the fact that 2 things do the same, it just brings confusion
 
1:58 AM
Welcome to PHP :-P
<? <?php
 
user1125394
@DaveRandom just pushed 3 hrs ago
 
and depressingly <% and <script language="php">
4 things that do the same thing
also it's littered with old aliases
stream_set_blocking(), socket_set_blocking(), set_socket_blocking() <-- all the same function
@cyril Ahh, it's working now. Temporary hiccup.
 
user1125394
ssh -vT git@github.com
 
Right, it's now officially bedtime in DaveRandomland
nighty night
 
posted on December 12, 2012 by PHP Advent

I recently served as an instructor for an online course teaching the fundamentals of the Web. Before class started, we polled the students in order to learn, among other things, what kinds of skills they hoped to learn by the end of class. More than one student responded with “confidence.” I found this to be incredibly charming, but it gave me pause: teaching tech skills I could do, but confide

2
 
2:10 AM
Another feed?
 
how the github protects from spoofing CNAME file ? As i understand only CNAME needs to point mydomain.com to github page, what if one place same domain to own repo ?
 
user1125394
2:30 AM
cos all userids are different
 
@ShaquinTrifonoff I like that one a lot.
Great advice in there.
 
Yeah, I read it.
 
@cyril not understand, dns pointed to same ip, CNAME shows domain that will be used for page, how github know what repo is authorized to show content for particular custom domain ?
 
3:05 AM
@LeviMorrison php advent rocks
 
3:15 AM
Who here submitted a patch to the PHP docs for the openssl constants?
 
Why do so many people on stackoverflow use the depricated mysql_query function? If so many people use them, it makes me kind of worry about the online purchases I make.
 
@GoogleGuy Not I.
@redelman431 lol
 
Well whoever did can you please email me your name googleguy@php.net if you want credit for the patch?
 
3:31 AM
@redelman431 because there are so many oudated tutorials, like "how to make your own sites for two hours" also ppl love learn by books where outdated info, if you have any hoster friend ask him to run john the ripper for shared hosting passwords, you will be surprised...
 
3:43 AM
I just found a bug in my code. Hooray, unit testing!
 
Unit testing .. hmm, that reminds me of this thing my project does not yet have .. ahem.
 
morning ,,,folks .....
@MadaraUchiha i want to invite me ...for anime and manga
 
4:31 AM
hi,i have a doubt of using italics in php.anyone...
 
its css and not php - font-style: italic;
 
Or, <em> - HTML
 
I mean,is there any function for php to convert php variable in italics
 
@ShaquinTrifonoff isn't that html5 only? or is it a standard all over?
 
@picasa In your IDE/editor?
@ShyamK lol no
It's been around for ages.
Since HTML4
 
4:39 AM
most preferred the <i> that was there... no? like <b> for bold and all that
 
Yeah...
> The HTML <i> Element represents a range of text that is set off from the normal text for some reason, for example, technical terms, foreign language phrases, or fictional character thoughts. It is typically displayed in italic type.
and
> The HTML <em> element (or HTML Emphasis Element) marks text that has stress emphasis. The <em> element can be nested, with each level of nesting indicating a greater degree of emphasis.
 
ex,$recedas=$getcompinfo[cropname].' '.$getcompinfo[sintifcCropname].' '.$getcompinfo[variety];
sry, one sec
ex, $recedas=$getcompinfo[cropname].' '.$getcompinfo[sintifcCropname].' '.$getcompinfo[variety]; I need '$getcompinfo[sintifcCropname]' to display in italics in ma webpage.
 
echo "{$getcompinfo['cropname']} <em>{$getcompinfo['sintifcCropname']}</em> {$getcompinfo['variety']}";
 
ill try .few sec
 
@ShaquinTrifonoff nesting means greater level of emphasis? what does that mean? does it go on slanting the text until its horizontal?
 
4:44 AM
lol
no
it doesn't
You can't tell in a browser.
 
I know... tried it :D
 
But screenreaders maybe
Search engines?
 
aah...
 
Maybe I should write a script to make nested <em>s appear more slanted :D
 
@picasa you do know that php has an echo function, right? and it can output html too... in case you din't know
that would just be css... em>em>em wait... more slanted? how?
 
4:48 AM
Font-rendering in PHP
 
"{$getcompinfo['cropname']} <em>{$getcompinfo['sintifcCropname']}</em> {$getcompinfo['variety']}"; output:seed <em>seed</em> seed but I need seed seed(italics) seed.Help ...
 
@picasa um
 
I have so much to learn... :(
 
@picasa You're outputting it as plain text??
 
ya
 
4:51 AM
lol
You can't get italics in plain text :P
It's just text
 
those three are fetched from database.So i have to display like these in ma page
 
k
 
Are you outputting HTML, or is your page pure text?
@picasa ping
 
am using only php in that page,so that I have to convert php to pdf.So ill display it in pdf
that seed <em>seed</em> seed will be displayed in my pdf
 
4:56 AM
I assume you are outputting HTML, as PHP outputs text or HTML that will be converted into a PDF.
 
s
 
Have you tried converting it to a PDF with the code that I gave you? I doubt you will see <em> in your PDF.
 
ya,I applied ur's in mine and the output I said here is displayed from pdf only
 
@NullPointer your email?
 
Is there a function for displaying it in italics
 
5:10 AM
posted on December 12, 2012 by Larry Garfield

The private variables debate is going around the PHP world again. Brandon Savage posted a pair of articles pointing out the perils of private variables, boiling down mostly to them making extension infesible or impossible. Anthony Ferrara replied with his own article, arguing that the real problem is using inheritance in the first place rather than composition. I figured I'd weigh in on my o

 
reply
 
how are you making this text into a PDF? no built in functionality to italicize in that class?
 
5:27 AM
@picasa How are you converting it to a PDF?
 
with this Private debate going on, let me ask something. Is there a performance difference between private and protected?
 
@andho No, I just tested it.
 
cool
I've had some funny things happen with class attributes. In the base class I had the properties as protected, and i defined them as private in the child class.
Now the value that a method of the parent class set, for `property`, is not accessible to the child class. Because `$this->property` referes to the protected property of the child class. Is this correct behaviour or what? I took a var dump, and it had different values set to two different properties (public and private).
damn, that's a lot of editing
 
5:54 AM
@ShaquinTrifonoff hiya...
r u there
 
Hey @NullPointer
 
@ShaquinTrifonoff hey i tried jsfiddle.net/TRYXk thought exact way but not working than ... after some time removed the main logic and tried jsfiddle.net/swamimayank/GLsaw working but dont know why .... could you tell me ...how this happen
jquery ... thing ...
 
6:09 AM
@NullPointer what is the purpose of hexc()?
 
It converts rgb(1,1,1) into #010101 :)
 
without it you got color in rgb like rgb(208, 218, 253)
 
cool huh?
 
I was asking more on the lines of why he needed it...
but yes its nice...
 
why the correct(imho) way i tried not working ?? and unknown method working
 
6:12 AM
you get an error for delete(parts[0]); can't convert null to object in hexc()
 
@NullPointer hmm, I'm looking at it now
 
also jsfiddle.net/TRYXk has the call to hexc() as hexc(x) instead of hexc(x); Don't know if it makes any difference though...
 
@ShyamK no error
var color = '';


hexc('rgb(208, 218, 253)') ;
function hexc(colorval) {
   var parts = colorval.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
   console.log(parts);
   delete(parts[0]);
   for (var i = 1; i <= 3; ++i) {
       parts[i] = parseInt(parts[i]).toString(16);
       if (parts[i].length == 1) parts[i] = '0' + parts[i];
   }
   color = '#' + parts.join('');
}
console.log(color);
tried in console working fine
 
aha
browsers send rgba
@NullPointer I fixed it!
 
then how come I see the error at the fiddle?
nvm...
 
6:18 AM
b/c that function expects rgb(...), and browsers give it rgba(...)
@NullPointer var parts = colorval.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(,\s*\d+)?\)$/);
 
@ShaquinTrifonoff so how would one account for the alpha value? I mean in the hex... ?
 
@ShyamK Hex doesn't have alpha, you just have to ignore it.
 
I know... but if he had, then? oh... hex doesn't have... I misread
 
@ShaquinTrifonoff thankyou you made my life day ....:)
 
np
@ShyamK Except, of course, IE, with it's gradients. Then, to use half-transparent black: #7f000000 lol
 
6:30 AM
IE just has to go that extra mile to suck, doesn't it
 
Yep
Why couldn't they implement rgba? opacity?
 
so always go to wrong place and so ridiculous thing
 
@NullPointer ya the cops are warning ppl in Australia not to follow Apple maps... its leading them into snake infested deserts
 
lol...haha
 
6:53 AM
I am trying amazon Orders Api Script but giving me problems. do some one have one page script which List Amazon orders.
 
@abdulwakeel well I've used the Amazon products api...
which is horrible by the way...
 
Horrible is signature, and now when using curl
I am trying since last week. I download some script from some sources, but there were signature problem.
 
@abdulwakeel do you have the signature working now?
its easy once you figure out what the signature actually is.
 
$ch = curl_init($url);

curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
now problem in curl
do you have example script
Can you share you sample script for Products. how you fetch.
 
@abdulwakeel yea, now that I think about it, I'm need to put the class on github anyway...
I'll give you the link in a minute
 
7:04 AM
ok thank you.
@twiz You can use some temp url.
 
@abdulwakeel yea sorry I'm gettin distracted ha
 
Dear Valuable Customer,
Your requested site is blocked by PTA. Please consult PTA if you have any query regarding requested site
Visit=?
the site is blocked in our country
 
ha wow...
 
7:15 AM
any way I can use proxy
 
where do you live?
 
Pakistan
ok, open
I use proxy
 
oh, does your government block a lot of sites?
oh by the way, my script is for the product API, so the urls might need changed for yours
not really sure
 
yes, porn sites, and youtube etc.
ok no problem, I will change.
Thanks for your help
There is two files, Both are same I think.
 
@abdulwakeel what do you mean?
ohhh yea, thats just how that site is
 
7:24 AM
@abdulwakeel Is Pastie blocked?
 
I mean, 1 raw paste data and 1 is actuall file.
 
why does Pakistan care if you look at naked people...? haha
 
Its an order of Supreme court
do you have the script where you create instance of AmazonAPI from where you call the methods
 
$params_array=array(
			'IdType' => 'ISBN',
			'Operation' => 'ItemLookup',
			'Condition' => 'All',
			'SearchIndex' => 'Books',
			'ItemId' => $isbn,
			'ResponseGroup' => 'Offers'
		);
		$response = $amazon_api->sendRequest($params_array);
obviously, you'll need to use different parameters though
 
yes, thanks
 
7:40 AM
You would think Amazon would have their shit together a little more than they do
 
yes, exactly. I need just a simple script to test.
 
@twiz Muslim country, that is why... its against their faith... porn is banned in the Gulf too...
 
@ShyamK I just find it a bit odd. It seems like if it is against the faith of most citizens then most wouldn't be watching it anyway...
 
new so ... fiddle ... tracking sucks ... like anything ....
 
say what?
 
7:54 AM
good morning , you horde of damned
 
@tereško That's me! horray!
at least it doesn't snow in hell...
 
@twiz thank you, but the order api is far different from the product api. any way I got an an idea thanks.
 
@abdulwakeel Well at least maybe the signature part will be of use to you...?
 
@tereško morning.
 
8:03 AM
169
Q: Best way to use PHP to encrypt and decrypt passwords?

jiexi Possible Duplicate: PHP 2-way encryption: I need to store passwords that can be retrieved I plan to store foreign account information for my users on my website, aka rapidshare username and passwords, etc... I want to keep information secure, but I know that if I hash their information...

the question has been marked as protected by the owner of top voted answer
basically ,
 
@tereško yesterday there were discussion on that question ... and decide to not delete instead ask mod to show message like chat.stackoverflow.com/transcript/message/6650158#6650158 ... but if you want you can .. its up to you
 
Morning
 
@PeeHaa morning
 
hmm
well , inserting that notice would work too
but i suspect that it would get removed by owners of the answers in original post
 
if same thing done by mod .. wont be removed ... imho..
 
8:15 AM
okay, needs another 8 delvotes :)
There's another question linked to it btw.
3
Q: Exactly how do I use blowfish in PHP?

sharf Possible Duplicate: Best way to use PHP to encrypt and decrypt passwords? I'm new here so forgive me if I don't make this perfect. I've been doing a lot with PHP recently and want to make my first login/registration system. As such I've been doing a lot of reading online to figure out...

Though, imho, that's not the same topic to begin with.
So it should probably receive a better duplicate.
 
8:28 AM
@Jack thats why deleting this question not a good option since it has 127k view ..and may linked to many question ...
14 hours ago, by NikiC
> **BEWARE! All the answers given to this question have various security issues. Do NOT use the code samples presented here.**
>
> For a proper encryption scheme implemented in PHP see this question:
>
> [**PHP 2-way encryption: I need to store passwords that can be retrieved**](http://stackoverflow.com/questions/5089841/php-2-way-encryption-i-need-to-store-passwords-that-can-be-retrieved)
>
> This question is only preserved to prevent breaking links to this page.
is better option ..imho
 
Go for it :)
 
22 mins ago, by tereško
but i suspect that it would get removed by owners of the answers in original post
@Jack ...^^^^^^^^^^^^^^.....
 
Not sure if it would make a difference, it would just mean there's one post less in the search results :)
Or you could pursue the populist badge and write an answer in there that will top the accepted one and whack some bounties onto it :)
 
Morning
 
@DaveRandom morning ....
 
8:40 AM
@MadaraUchiha I am now.
 
is any php export here ?
?
 
@NiravRanpara there are only expert in ..... football ... lol...its php chatroom...
 
hiya guys need help I have two arrays here is a sample http://pastebin.com/xss0Hwxj
i need to get the all the elements on the first array that is not selected on the second array. . typically we could use a foreach to sort out the keys. but before i do that is there other way to do this without a foreach??
loop :D
 
@NullPointer :I have create image upload demo
 
@LeviMorrison What's that supposed to mean exactly? :x
 
8:41 AM
that working fine
now when I check on android device
and upload image , it take full path in database instead of only name
using android mobile > <img src==http://demo.com/km_test/uploads/1354779515323_1355300984.jpg>
simple web site >1354779515323_1355300984.jpg
 
@tomexsans array_filter ?
 
@NiravRanpara
 
@tomexsans array_diff? IDK
 
it show warning ...
 
@NullPointer lol
demo.com == example.com
Not a real site :-P
 
8:49 AM
@NiravRanpara Can you post a code sample ?
 
@ShaquinTrifonoff hahah...lol
@ShaquinTrifonoff but demo.com is real site
but not ssl enabled
 
@NullPointer I meant, not the site that the OP was talking about
 
i know that i am just kidding ..
 

« first day (788 days earlier)      last day (4166 days later) »