« first day (981 days earlier)      last day (3972 days later) » 

TVK
12:01 AM
Keeping it compatible with different versions can be a bitch, but all in all, the SDK is really pleasant to work with. And I've been lucky enough with my last assignment to only have to develop for one (custom) Android ROM.
 
user1125394
Who made the title of the room ;)?
 
Hey @cx What's 9 + 2 ?
 
TVK
Is it B?
 
@TVK yes.
or 10 in base 11?
 
TVK
What base is the base denoted in, though?
 
12:31 AM
@TVK bin !
 
you do realise it is a joke, right? or more like saying "we don't understand". I thought the duck showed it clearly :) — Messer 1 min ago
?
That must be the worst "joke" I have seen this entire year
 
12:56 AM
btw @PeeHaa埽 - maybe change the room back at some point?
 
That can be arranged
room topic changed to PHP: Discussion for all things room PHP - Don't ask whether someone is here to help you. If someone is around and wants to help they will. [php]
 
"all things room PHP"?
 
woops :P
room topic changed to PHP: Discussion for all things PHP - Don't ask whether someone is here to help you. If someone is around and wants to help they will. [php]
 
:)
 
user1125394
1:17 AM
they will. if they refers to someone it should be he
 
1:55 AM
good night
 
user379888
2:51 AM
Where are database tables located in CodeIgniter?
 
3:04 AM
stackoverflow.com/q/17257235/251311 -- see the comments to the answers
that's odd :-)
 
 
1 hour later…
4:15 AM
heylow, anyone here using sockets with php?
 
user652649
4:46 AM
morning
 
hi
 
user652649
5:01 AM
hello mates
 
user652649
that's a newsletter sending script i've just finished: i.imgur.com/D5p3ngc.jpg
 
user652649
the speedo wasn't really necessary, is it? aha /me silly
 
6:06 AM
When I try to connect to my ftp through android, I get the following message
"ftp_connect(): php_network_getaddresses: gethostbyname failed"

I'm using ftp_connect('ftp.domainname.com');
I also tried ftp_connect('<ip address goes here>');
But when I run the same file on a windows or linux machine, the connection is succesfful
 
I get this error with this sql
error : Warning: mysqli_stmt::bind_result() [mysqli-stmt.bind-result]: Number of bind variables doesn't match number of fields in prepared statement
$statement = <<<SQL
INSERT INTO `accdetails` (username, email, accountdetails, apidetails, proxies, status)
VALUES (?, ?, ?, ?, ?, ?)
SQL;
//for updating and inserting, Status will always be 0
$status = 0;
$statement = $db->prepare($statement);
$statement->bind_param('sssssi', $username,$email,$accountdetails,$apidetails,$proxies,$status);
$statement->execute();
$statement->bind_result($result);
}
whats wrong?
 
@asprin "gethostbyname failed" signals a problem resolving the hostname to an IP address.
 
@hakre But i even tried using an IP address
And this happens only when I run the file from android device
on desktop, it works fine
 
@asprin and you get the same error message?
 
yes
 
6:18 AM
@Kishor there is no result to bind with an INSERT query, you only get a return value as result. That is unrelated to binding results.
See mysqli_stmt::execute(); check with the documentation of the description and return value of that method.
@asprin You need to trouble-shoot the network connections on that device. Sounds like it's not online.
 
So I am learning PHP still and I think there is a better way to do this...
 
if($priorety == "very high" or $priorety == "Very high" or $priorety == "High" or $priorety == "high" or $priorety == "Normal" or $priorety == "normal" or $priorety == "Low" or $priorety == "low")
		{ }
 
@BrandonGelfand Yes, the "many or compares in one if" - you can make use of in_array() for example or isset() - both in combination with an array containing the string values to compare against.
0
Q: Grouping ands and ors in a PHP if statement

Evan4623This is probably a simple answer, but I was curious if you have php code like say this: if($_SESSION['id'] == '000001' || $_SESSION['id'] == '000002') { Could those values be grouped somehow? My thoughts would be something like: if($_SESSION['id'] == ('000001' || '000002')) { Not a huge dea...

 
@hakre I see...I guess android room would be the better room to ask this then
 
6:59 AM
@asprin I would really say this is more a network issue than a PHP issue. Like you wrote, the code works on your desktop. And you get an error message that is from the network layer.
 
Yep. That makes sense
Thanks for the help
 
@hakre so I would do this correct?
if (in_array($priorety, array("very high", "Very high", "High", "high", "Normal", "normal", "Low", "low")))
 
yes Brandon
that's right
 
ok, thanks :)
 
You can even optimize it more
 
7:02 AM
@BrandonGelfand It looks nearly perfect. You don't need the duplicate values inside the array for that test. And rename the variable, it reads wrong. Try $priority :)
 
by doing
if(in_array(strtolower($priority), array("very high", "high", "normal", "low")))
 
unfortunately the original creator didn't speak very good english. My friend bought this wordpress plugin and is asking me to make it so that an Admin is emailed no matter what the priority is set to.
 
@BrandonGelfand Some editors will help you renaming a variable. You rename it in one place and all occurrences are renamed. Just FYI if your interested in improving existing code and you're looking for tools or what is possible.
Here is another tip:
/**
 * @param string $priority
 *
 * @return bool
 */
function is_priority($priority)
{
    // define proprity string values
    static $priorities = array(
        "Very high", "very high",
        "High" , "high",
        "Normal", "normal",
        "Low", "low"
    );

    // string context for $priority parameter
    $priority = (string) $priority;

    return in_array($priority, $priorities);
}
 
Do you know how in Sublime Text 2 ?
 
Usage than is self-explaining:
if (is_priority($priority)) {
    ...
}
does work even quite well with wrong named variable names.
@BrandonGelfand there is some binding to the quafoo tools: github.com/hgraca/sublime-text-2-php-refactor
this is commonly called a refactoring. Like "rename variable" or "extract variable" or "rename method" etc.
 
7:12 AM
ok, cool, ty so much
It is a little easier now to ask questions because I actually am beginning to know what everything means
before I tried jumping right into PHP before I even knew HTML, tht was the biggest screw up i think I ever made
 
7:59 AM
is_priority() - that's a horrible name for a function
 
8:19 AM
0
Q: What are the "$ns" and "$is_prefix" parameters about?

hakreThe SimpleXMLElement::__construct() method and the related functions simplexml_load_string() and simplexml_load_file() all have an optional pair of parameters related to XML Namepspaces: $ns and $is_prefix. Despite I can see that those are related to XML namespaces I wonder what they are for and...

 
user652649
how do you prepare queries that require dynamic SQL such as "DELETE FROM x WHERE " . implode(" OR ", $blah) ie for example with ids data coming from an html form?
 
@tereško Depends on use. Here it's one-time and the use is: if (is_priority($priority)) - I'd say it's fine until you change the code and you need it elsewhere, too, then you should wrap it into an object anyway.
 
8:35 AM
@hakre - thanks for the clarification about bind_result! :D solved.
I have yet another question. I am using something which uses curl and an API. I can use proxy to mask the curl calls. But how can I keep my server IP private when doing API?
I mean, something like changing the Server IP to a proxy? something like that?
the API has some rates based on the IP.
 
8:47 AM
@Kishor Easy when you know it, right? Just keep in mind that bind result is for actual results from the database and the rest is common PHP programming like error handling of return values for example.
 
Yeah gotcha! @hakre
 
@Kishor You can't actually. Or maybe you could use a SOCKS proxy which doesn't pass your IP to the API endpoint. Should be easy to find out if curl supports SOCKS proxying or not.
 
I didnt get your properly.
Can I use a proxy when dealing with API?
 
9:04 AM
@Kishor You can use a proxy for UDP and TCP connections in the internets.
However you need to have a proxy that supports that.
If you have such kind of a proxy you can do that.
If not, you can't.
 
Assuming I have the proxies, what functions in PHP should I get into?
 
@hakre => docs
 
and morning :)
 
9:17 AM
@NikiC Did not found that in the docs. You know where that is written?
@NikiC yes, good morning :)
 
@hakre no, i mean put it in the docs :)
In the parameter docs some small note like "This is the namespace SXE iterates over by default"
 
@NikiC Yes, but before I do that I chew a bit on it. Perhaps for example I might do a bug-report or feature request to get support for the same with simplexml_import_dom as that function is missing those parameters.
Also I wonder how I can change that behavior after the object has been created.
 
oki
 
Hey
 
I miss the docs for sendmsg and recvmsg… there's not even an empty manual entry…
 
9:51 AM
1
Q: Stackoverflow layout problem in tab

NullPoiиteяI am using android browser (Android 4.1) on Tab which have 1024 x 600 pixels resolution and today I found that layout is not proper, Its messing below is what I am seeing,

do you guys see same layout ?
 
10:12 AM
Hello Fellas!
 
@MoeedFarooqui hia
 
Share something interesting :)
The Pragmatic Programmer, From Journeyman To Master
has anyone read this book ?
 
10:15 AM
find the link attached
a must read for the programmer :)
to improve your programming skills and manage your work
 
who is programmer here ?
 
@MoeedFarooqui it looks kind of theoretical/philosophy book
 
To improve the skills you just need to program more and read other people sources
 
Sep 29 '12 at 13:58, by Gordon
@hekko if you want to become an expert programmer, google SOLID, buy GOF, buy POEAA, buy Clean Code, learn Refactoring, lookup GRASP, DDD, CQRS, DCI … but dont ask for PHP books. That's the most reasonable suggestion I can give you when you ask for Expert PHP books really.
i also found this helpful to improve skills
 
10:27 AM
"Algorithm Speed"
that book is about everything :-S
and I'm sure it's pirated
 
hello
please help me regarding this question
0
Q: Recursive function with <ul><li>

Sumit Bijvanicurrently I am displaying data in Text format with recursive function like.. Food Fruit Red Apple Yellow Banana Meat Beef Pork and I am using following code to display this text function display_children($parent, $level) { ...

 
@SumitBijvani first build a tree, then output it
 
@zerkms yes it it pirated abebooks.com/servlet/…
 
@SumitBijvani so split it into 2 subtasks and solve them separately
 
10:31 AM
@NullPoiиteя There is one german title that is specific to PHP an I can recommend it reading if you're a PHP developer: en.wikipedia.org/w/…
 
@hakre thankyou .. ill sure read ...:)
 
@zerkms can you please help me to do this? because I am trying this from last 4 hrs and its not working. I think i am in wrong direction
 
@SumitBijvani did you get my point about generic solution?
 
@zerkms no :(
 
@hakre i am trying to learn German language but its quite difficult :(
 
10:33 AM
4
A: How to obtain a nested HTML list from object's array recordset?

hakreFirst of all map the objects onto a new hash (array) in which the index is the id: // map the array onto hash $hash = array(); foreach($array as $object) { $hash[$object->id] = array('object' => $object); } Then transpose this flat hash into a tree-like structure, see this answer for anoth...

 
@SumitBijvani don't output it immediately. At first - create an array of arrays that represents the tree
then output it
 
if possible can you please do this?
 
@NullPoiиteя are you aware of the PDO / PHP error message output you've got on your host? Just asking, if you wish I can send it to you if you're unable to reproduce.
 
Yep
 
thank you very much
:)
 
10:34 AM
@SumitBijvani I generally charge for $35/hr
 
@redbaron76: You're welcome. Don't forget to accept the answer if it helped you: meta.stackoverflow.com/q/5234/147909 . — hakre Nov 5 '11 at 17:02
Answer still not accepted. :(
 
@hakre thankyou... i would love to see reason ... i have got this error first time
 
and it will take how much time to finish?
 
@NullPoiиteя gist.github.com/hakre/0f084fd245df2e045609 - let me know when you've got it so I can remove it.
 
10:36 AM
@SumitBijvani his minimum rate is 4 hours :)
 
@hakre got it
 
too much
if possible help me to do this because i dont have money and its my college project
 
The trick-question:
> Can I make a video-stream not downloadable (by using tricks inside the code)
 
@salathe you can enjoy ... i have already changed hosting ... :P
 
10:38 AM
@salathe Well I can hardly claim copyright for it ... :)
 
@NullPoiиteя s'ok, I'll delete that one too
 
how to solve this error if you have shared hosting ?
 
@NullPoiиteя Contact your hoster and inform them that you need something they have not configured so far.
It's always a good test how much service your hoster actually provides and how fit their admins are.
 
its godaddy and they are slow ... and it will expire 25 (this month) so ..... thinking to try another hosting ...
 
good evening all :)
 
10:54 AM
(the last two are a pair of self-referencing questions due to OP being a self-duplicator - in case you wonder about the alter boxes that pop up if you vote for deletion)
 
> You've reached the maximum of 12 Deletion votes per day; come back in 12 hours >>GRRR
 
@NullPoiиteя You haven't yet rep-whored enough on SO :)
 
11:11 AM
now i dont love rep anymore ... ... :) but yes i want to reach at 20k
 
Oh gosh, how do I hate these "not working" or "not working as expected" or "does XYZ has a bug" questions. If you're a programmer and you're asking this yourself, you verify if it's so or not. Grml. :)
4
23 rep user pwns ExpertUser ^^:
I just was reminded yesterday that we should not be serial downvoting users only because they constantly ask low quality questions. Instead those should be flagged to moderators.
Oh, here it is: stackoverflow.com/questions/16723700/… - I now stop downvoting your low quality questions and place close/deletion votes. You seem to like this help-vampire stuff so I directly flag you with the moderators. — hakre 3 mins ago
 
11:42 AM
php -r 'session_start(); $_SESSION = new stdClass; $_SESSION->val = 1; session_write_close(); var_dump(file_get_contents((session_save_path()?:"/var/tmp")."/sess_".session_id()));'

// outputs
string(0) ""

// why doesn't this store the object?!
and what can I do to store $_SESSION if it's an object (in my own SessionHandler if needed)
 
@bwoebi check the directory that you're looking for the right filename. This depends on configuration (even if files are used after all).
 
@hakre I'm using the right filename (else false would be returned)
 
hi
 
Ah okay, now I see what your issue is. It's an array: $_SESSION['obj']->val = 1; - always. It's a superglobal.
 
@hakre Grml?
 
11:46 AM
$_SESSION remains superglobal when we assign something to it?
 
(at least this works: php -r '$_SESSION = new stdClass; $_SESSION->prop = "val"; function a () { var_dump($_SESSION); } a();')
 
@bwoebi yes, but then what is your $_SESSION variable ain't that one any longer PHP uses as the session superglobal - even the name is the same.
It's like if you would make $GLOBALS an object. Try it, you will notice that not all your global variables suddenly disappeared.
 
php -r 'session_start(); $_SESSION = array(); $_SESSION["val"] = 1; session_write_close(); var_dump(file_get_contents((session_save_path()?:"/var/tmp")."/sess_".session_id()));'
string(8) "val|i:1;"
nope, if I reassign $_SESSION with an array, it still works.
@hakre if I reassign a fresh object, $GLOBALS also loose it's functionality
 
@bwoebi But the global variables are still there, aren't they?
 
11:50 AM
yes.
 
So that's basically what I wanted to tell about. So you treat these superglobals with a grain of salt, they are not normal variables.
 
because $GLOBALS is internally only a reference to the main variables table.
 
Yes it might be even more special than $_SESSION
 
but $_SESSION isn't a reference.
 
@bwoebi It sort of is. If you use unset() on it for example, you're lost with it.
 
11:53 AM
@hakre if I unset superglobals, the variables only loose their superglobals functionality
 
@bwoebi For $_SESSION it's even the session functionality. If you start a second one for example, you're not able to deal with the session values any longer IIRC.
 
@hakre because the internal session handler accesses the super global.
 
@bwoebi But how to access the superglobal? :)
 
* searching in lxr *
 
@hakre Ah, yes I very much agree with you :P
 
Morning
 
@Eugene looks like a perfect dupe.
 
@hakre Then it gets -dix points :)
 
12:12 PM
Reviewing the let's me find real pearls of questions *gg*.
 
@hakre when you unset a superglobal you don't write anymore to a global symbol table, but to a local one. So it isn't superglobal anymore after unsetting.
 
@bwoebi yes, it get's sort of disconnected.
In the past other crazy things did happen :)
 
yeah. And when you only reassign a superglobal, you still write to the global symtable
so, there's no reason why session saving with $_SESSION an object should fail?!
 
@bwoebi there is.
it's because of the session save handler
it expects an array, one that contains the session variable names as keys.
 
you mean array?
...
 
12:19 PM
@bwoebi yes, array.
 
@hakre amateurs
 
then: and what can I do to store $_SESSION if it's an object (in my own SessionHandler if needed)
 
He is asking for a built-in function to do that and of course there is one: max($a, $b) will give you the longer of the two arrays
 
@bwoebi $_SESSION['my_own_session_object] = ...; ...
 
no, $_SESSION is an object with arrayaccess…
or do you mean I should temporarily change $_SESSION before the session_write?!
but there's no point where I could change the session first before it gets serialized??!
 
@ircmaxell opcache total mess
 
part of me wants to bring it up, but the rational part of me knows it will do no good
so I won't
 
@bwoebi ArrayAccess =/= array. You need it to be array, not ArrayObject or an ArrayAccess.
@NikiC well, max does a little more if both have the same count of values, but I couldn't find the dupe so far, it's probably better to leave that somewhere.
@NikiC also answering those users questions only lead to the next question ;) ... stackoverflow.com/questions/15556020/…
 
@hakre I don't find any such thing in the docs? … or it should be maybe changed to accept also objects?
 
@bwoebi well that $_SESSION is a superglobal array should be documented. For your feature request, I don't think this will go anywhere when you suggest it. And also I think that you should not limit the session memory storage in PHP to a single object. I don't think an array is that wrong there. For your own application create your own session object and proxy the superglobal then you don't have any such issue.
@bwoebi in reference to stackoverflow.com/a/17124697/367456 it's sometimes better to tell those users where they find the error message because they will just ask again when the next (same) thing "does not work" and again they ask "what am I doing wrong", see stackoverflow.com/q/17126726/367456 - just showing what can happen, no critique in specific.
 
1:04 PM
0
Q: Looping through days

user1170330I want to return all days between a specific range. My idea was to convert the start and end date to unix timestamp and loop through them adding 86400 (seconds of a day): <?php $start = strtotime('2013-01-01'); $end = strtotime('2013-02-01'); for($i=$start; $i<=$end; $i+86400) { ec...

This makes me sad. :(
 
1:14 PM
Can anyone point me towards a decent design for a complete cache key naming convention i.e. for uniquely naming everything I could possibly want to cache in an application e.g. DB data, generate internal data, external resources, etc.
 
1:27 PM
@Danack you could introuce a grouping character (like underscore) that does allow you to create a hierarchy / circles with your keys. But generally I don't think such a question can be answered.
@salathe it does not make me sad, it's just sad :)
 
1:53 PM
Hi I am developing a customizable login script for php users, I would like to know what do you expect it to have? So that I can add those as functions.
 
@venkat I want to be able to login with a contact-free keycard that I only need to lay next to my keyboard for a short period of time to login.
 
Morning yall!
 
@PeeHaa Eve here!
 
It's also kinda late in the afternoon here. But morning for me nonetheless
 
@hakre Better contact intel to manufacture one :P
 
1:58 PM
@venkat damn, It sounded to me you meant that question seriously and would implement it right away ;)
 
@PeeHaa I am developing a customizable login script for php users, I would like to know what do you expect it to have?
 
@venkat I would like to see an iris scan
 
@hakre Lol, now can we get serious about it.
 
@venka: creating an API based on "expected to have things" is always a bad idea see the old Membership API in ASP.NET
 
P.S. I hate contactless shit for security\
 
2:02 PM
@PeeHaa P.P.S. I hate contactless shit for sex.
 
:D
 
If I have a cronjob set at 5 mins delay, and the process takes more than 5 minutes to finish, will there be multiple instances?
 
@hakre :D
@PeterKiss Ok man, I will work with it all alone. I will update them in Github, so that any one can constribute for it's development/ use it
 
@Kishor Yes, normally there will be unless your program takes care to not allow that.
@venkat That sounds like a plan. You probably should offer different backends where to store users or against what to authenticate against.
You can also take a look for similar libraries that do exists and what they offer so you don't need to re-invent the wheel and such.
 
2:05 PM
@venkat maybe openid support would also be nice
 
@hakre - how to not allow multiple instances? :O
I am coding up a site where each users data is processed once in a day. Whats in my mind is to make a script which will pick user datas, verify them and put to a queue table. and a script which does the work initiated by cron job every 24 hours.
is there a better way to do it than what I am doing? any inputs are appreciated
 
@Kishor If you only are going to run it every 24 hours it shouldn't be a problem right?
Otherwise if it's going to be a problem instead of directly executing the cron. First add the running task to a db and check whether the task is already / stillll running
 
@hakre Sounds good, for initial release I will not go for full functionality but will do much more in future
 
@PeeHaa - Ah yeah. well, it was 2 questions actually :D The worker runs every 24 hours, but I think the queuer needs to run every hour or so. Technically, it isnt needed though. well, with more users, the timedelays are going to be short.
@PeeHaa - How to check if the task is running? like setting a field called active and updating its values?
 
@Kishor Yeah and for example also add a timestamp. Just in case a task gets stuck
And bonus points for also saving progress. So you can see what the task is doing
 
2:12 PM
@PeeHaa - How do I check if there is another instance of the same script running? I dont need to check, I just want it to not happen.
 
@PeeHaa Sure will consider about OpenID
 
@Kishor Either store it in the db as I said or store it somewhere else (a temporary file)
If the file exists the taks is probanly still running
 
ok, got it! :D
Thanks! :D
 
@Kishor that depends. An easy way is to use a lockfile as the file-system has atomicity. Just as @PeeHaa suggested (lol).
 
atomicity aha
 
2:31 PM
In computer science, a lock is a synchronization mechanism for enforcing limits on access to a resource in an environment where there are many threads of execution. A lock is designed to enforce a mutual exclusion concurrency control policy. Types Generally, locks are advisory locks, where each thread cooperates by acquiring the lock before accessing the corresponding data. Some systems also implement mandatory locks, where attempting unauthorized access to a locked resource will force an exception in the entity attempting to make the access. A (binary) semaphore is the simplest type of l...
 
3:00 PM
@hakre can you make me a favicon by any chance?
 
TVK
I wouldn't mind either. What do you need?
 
@TVK I am looking into php's opcache. So I built a GUI to see what it does and how to correctly set it up and invalidate scripts etc. So I want something that has the php logo in it and something that shows it is about caching if possible :)
 
TVK
Hmm, tricky in a 16x16 space. I'll let you know if I think of anything clever.
 
@TVK cool
 
TVK
3:22 PM
@PeeHaa Not too sure how to express 'cache' within a favicon since there's no real logo for it and insufficient room to write it without it looking like dicks, but perhaps something like this might refer to PHP and opcache enough. tvkdevelopment.com/other/opcache.ico
 
@TVK Works for me!
Do you have a github or how do you want to be attributed?
 
Yeah, just got an error in Unknown on line 0!
 
TVK
@PeeHaa I haven't got github, no. But credits aren't needed. Thanks though.
 
@bwoebi Those pesky extensions are annoying you again? :)P
 
@PeeHaa if you consider the session module as a pesky extension, yes ;-)
 
3:26 PM
@PeeHaa what do you want?
 
@PeeHaa Warning: Unknown: Parent session handler is not open in Unknown on line 0
any reason why this is in Unknown on line 0?
 
@TVK eh kewl, so I'm off to swimming then, cu l8ters.
 
@hakre Thanks anyway :)
@TVK Thanks!
@bwoebi hmmmm no idea. Never seen that one before
Maybe unwritable temp dir?
 
TVK
@PeeHaa You're welcome.
See you hakre.
 
Good evening. Infidels...
 
3:30 PM
lol yo
 
No, I returned false in my SessionHandler::open() (in a class extending SessionHandler)
I tried somehow to not permit the execution of session_start(); so that $_SESSION won't be overwritten.
 
@TVK yay :)
 
but I have no idea how ...
 
Me neither :(
 
to trigger the warning: php -r 'class CustomSessionHandler extends SessionHandler { public function open($a, $b) { return false; } } session_set_save_handler(new CustomSessionHandler); @session_start();'
 
3:40 PM
@bwoebi No idea :|
 
o.o i just realized that i can access return values of a function in a string. I thought that was not possible except using return value as name of a variable.
 
@PeeHaa You're doing a gui for OPCache?
 
@Danack yes
 
@Danack yes. His aim is to provide a simple one file gui. My aim is to make something nicer and see what you can do with opcache
 
3:46 PM
cool.
 
That reminds me that I wanted to put that project into the readme and forgot
 
@Danack Also
22 hours ago, by PeeHaa 埽
rasmus really should refrain from anything related to actual webdevelopment :P
 
:p
 

« first day (981 days earlier)      last day (3972 days later) »