« first day (771 days earlier)      last day (4195 days later) » 

12:00 AM
Ok
Btw, what do you consider big data?
50 records? 1000?
 
@ShaneStebner That's debatable, but for the client side, I'd say 900+
 
ok
I also consider the "forever scroll"
infinite
 
is there a way to add pre defined styles to my wp admin like when editing a page
 
@Baba And what's cooking on your end? Any news?
 
Here's an example of the datatables.net thing
Just so you see why I like it
Try searching
 
12:06 AM
@ShaneStebner Let me guess, bootstrap? ^_^
Uhh. Times up, see you later guys. @ShaneStebner good luck.
 
is it even possible?
 
By the way, HAPPY BIRTHNEXTDAY @NikiC!
 
@mmmshuddup http://
 
is it possible to edit the list of styles in the wp admin when you are on the edit screen of a page
 
1:21 AM
Hey guys I need a hand on getting post on a separate page in WordPress. So I have this code `<?php /*query_posts('test');uncategorized*/
if ( have_posts() ) : while ( have_posts() ) : the_post();
get_template_part( 'content', get_post_format() );
echo "fdas";
endwhile; endif; ?>`
Its the same as in my index.php page, but I don't get any post that come out.
Its a template that I assign to a page I made and I want to make it populate the category post.
 
1:50 AM
Im trying to edit the formats option in the wysiwyg editor
cant seem to
 
 
1 hour later…
posted on November 25, 2012 by Daniel Convissor

This fourth posting in my WordPress plugin / PHPUnit testing series explains how I verify information inserted into database records with auto-increment IDs in my Object Oriented Plugin Template Solution. In order for this post to be a be a self-sustaining entity, I need to re-explain two terms from the earlier posts. First is "parent class." It holds helper properties and methods for use

 
3:30 AM
@Feeds Really? Unit-testing wordpress plugins is like putting lipstick on Jabba the Hutt.
I mean, WordPress. Really?
 
I like how the first example of a test starts with global $wpdb;
 
LOL
user image
2
@Philosoraptor yes.
 
:P
 
I'm fairly bad at coming up with good meme captions.
 
Starred it anyway :D
 
3:38 AM
Is CakePHP annoying or am I just doing it wrong?
 
CakePHP is terrible and shouldn't be used by anyone ever.
Thus, probably the former :)
 
Whew, I was worried.
 
lol
What's your issue? If it's not too framework-centric someone here should be able to figure it out.
 
It seems to be some sort of one-off paradigm where instead of coding what you want it to do, you have to code around what it assumes you want to do, despite it usually being wrong.
 
@mootinator You're just doing it wrong when using cake
 
3:41 AM
I don't have a particular problem I didn't solve.
 
@mootinator Well, actually; everything it does is wrong in that it uses global state for everything it can and uses some-sort of architecture that bears about as much relation to MVC as communism does to capitalism.
 
PeeHaa changes room topic: PHP chat where everybody is allowed to rant against frameworks
 
Meh, I get yelled at for saying it every single time but Symfony [2] really isn't that bad.
 
@Lusitanian Who is yelling about that?
It's... (mostly) decent
 
ME, I AM.
Nah, teresko does.
It's decent if you don't use their silly base Controller class which gives you a service locator
 
3:44 AM
Are there any frameworks that are acceptable to use?
 
buy one get all free
 
lol
 
ASP.NET
;)
hides
 
lol
 
Symfony 2 / Zend 2 are somewhat decent @Query
 
3:44 AM
@mootinator I've been using ASP .NET WebAPI and MVC for a little bit, it's fairly nice; my only complaint is the ridiculous SimpleMembership crap that looks like it was put together as an April Fool's joke.
 
I don't actually dislike ASP.NET MVC, Forms makes me want to pull my hair out though.
Yeah that's a little...
 
I noticed that when using a framework you limit your audience severely when asking questions here
 
@PeeHaa I'd still say you should understand the architecture they intend to implement though. From what I've read ZF2 is actually a little nicer than SF2.
@Query Most people here don't use frameworks. I can generally answer Symfony2 questions since I use it daily and I think there's some Zend users, but that's it.
 
@Lusitanian It has its good parts, but some parts are horrid
 
I've used Grails, ASP.NET MVC and Cake. Now I just need to make a site in django and ruby on rails and I'll have a complete set.
 
3:48 AM
@mootinator Rails is awful and that's understating it.
What's even worse is the countless fanboys in skinny jeans, ironic t-shirts or sweaters and scarves proclaiming its superiority to anything else ever.
Not that I'm not countering arrogance with arrogance a little bit -- but for the life of me I cannot figure out what is so attractive about that poorly-documented cluster.
 
I second ZF - puts hair on your chest :)
 
There's a reason Twitter ran away from it, and I have no idea how they manage to maintain Github.
/rant (:
SO WRONG.
 
Hmmm :/
Firefox is the real view there :P
 
hey guys, curious if anyone can help me understand namespacing and folder name case sensitivity in php
 
@treeface What is the question?
 
4:00 AM
you see i have namespace Admin\Libraries;
then in another area of the code, i do:
use Admin\Libraries\ModelHelper;
now i do development on windows boxes
so i haven't had an issue in development
but also notice that the directory is called lowercase libraries
 
Are you doing autoloading?
 
yes i am
 
Linux (and any other OS besides windows I know) uses a case sensitive filesystem
So you either have to make sure the casing matches (I would go for this option) or you have to change your autoloader to look for lowercase
 
ahh ok
thanks PeeHaa
 
@treeface One other thing? Do you really need all those statics in your code?
 
4:04 AM
;)
2.1 i get rid of them
but do you mean the functions too?
anyway gotta run
thanks for your help
 
Yes of course also for the methods. For example: How are you going to unit test that class without also testing the Config, Column, Column, DB etc classes
Input Field etc
If you are going to unit test that you are testing your entire application
 
4:35 AM
If I saw the code behind half of the sites that request billing information I'd probably never go near them with any information that needs to be kept securely again.
@PeeHaa Nah, just use NTFS :)
 
:D
 
Hey, does anyone know if there is an advantage to using fwrite vs. file_put_contents?
 
4:56 AM
@twiz Depends on situation, I'd say.
But I've never really liked file_put_contents and friends.
file_put_contents could work on a URI but fwrite works on a file descriptor, so you'd need a socket.
 
@LeviMorrison I'm not sure I entirely understand. Do you just mean you have to deal with the whole fopen/fclose stuff?
 
5:32 AM
I'm thinking of learning python. I feel the language is better written than PHP.
Is django the best solution for web?
 
@Query 1. Python might be written better than PHP, but don't be fooled: programmer skill outweighs language choice.
2. Django is a popular (and old) solution for the web, but I've seen MANY others used as well.
3. This is the PHP room; why don't you ask Python people for this kind of advice?
@salathe @Gordon @NikiC @rdlowrey @PeeHaa @Lusitanian ; I know that's a long list, but I know you guys might be interested in what I'm about to ask. I have a LinkedList that maintains a pointer to a position inside the list (like an iterator; not sure if I'll fully expose iterator). Names for methods to insert/delete at current position?
I move the pointer for certain operations so that likely actions can be implemented in constant time. For instance, performing an indexOf search means you'll likely do something with that index, so the pointer is stored there. A call to remove that index or insert after/before it would be significantly faster.
Maybe just use the normal offsetUnset method and add insertAfter and insertBefore and?
Also, I'm exposing a seek method that allows you to move the pointer yourself.
 
6:01 AM
@LeviMorrison Most people who use PHP are also experienced in a lot of other languages. That's why I asked here.
 
@Query I disagree with that statement, but it doesn't really matter. In any case, you asked during a lull in the chatroom.
 
@LeviMorrison Hmm, I'm not sure how I'd name it.
 
@Lusitanian What about:
20 mins ago, by Levi Morrison
Maybe just use the normal offsetUnset method and add insertAfter and insertBefore and?
 
Yeah that might be the best bet --- it maintains consistency
 
As long as users know that the lookup cost won't exist if they're at the current position I think it might be okay.
 
6:13 AM
Articulate that via a docblock and within any other documentation on the class and you should be okay.
Just to clarify, the only difference between offsetUnset in the implementation of the LinkedList and anything else that implements ArrayAccess is that if you've already looked up the index of x , the internal pointer is already directed at x when you call offsetUnset on its index eliminating redundant look-up time.
And re-reading above that's the case (sorry, half-asleep)
 
@Lusitanian Basically you remove the lookup time, yes.
// So if you did:
$i = $list->indexOf($value);
unset($list[$i]);
It's the same algorithmic cost as a normal array.
 
Nice
 
 
1 hour later…
7:27 AM
Initial implementation that is 100% untested is pushed.
 
nice
 
Note that for now it doesn't implement Iterator because that conflicts with IteratorAggregate which I feel it should implement.
Additionally, deleting/inserting in a foreach loop is complicated in all structures. In this one I just make a copy so iteration works fine when deleting/adding.
I might change how this stuff works based on feedback and whatnot, but for now this seemed like the best.
Going to start working on unit tests now.
 
7:58 AM
Anyone have any idea what this bot is? It identifies itself as MOExplorer/1.0, the hostname is host-219-235-5-94.iphost.gotonets.com and the IP address is 219.235.5.94.
I can't find any information about it.
Oh, and it didn't crawl my robots.txt file.
 
8:17 AM
@ShaquinTrifonoff It's a Shanghai IP address.
The UA isn't in any database I found, but it is in various people's [public] logs if you google it
 
@Lusitanian I know, I did Google it.
 
interestingly there's a website running on that ip address
it's a web design firm -- not sure what they are doing with a crawler
 
I think I'll block it, solely on the basis that it ignores my robots.txt.
 
heh
 
@Lusitanian What's funny..?
 
8:21 AM
Meh; it's kind of an idle response, that's all.
But I guess it's kind of a "why bother"? It's probably not doing any harm.
 
Dunno. I've had a EMail Exractor bot crawl my site before (note the missing t) :P
 
lol
that's fairly amusing
why make it so obvious?
here, i found what moexplorer is
there's one version i found of it written in classic ASP, as well
so it's some sort of weird framework for making http requests
 
@ShaquinTrifonoff how do you block an IP address without using an .htaccess or re-starting the web server?
 
@It'sYourFault I use .htaccess, but you could auto-prepend a PHP file to check for bad IPs.
 
makes sense.....thanks
 
8:29 AM
class Firewall { private $blocked; public function __construct(array $blocked) { $this->blocked = $blocked; } public function shouldRequestContinue(Request $request) { return !in_array($request->getClientIPAddress(), $this->blocked); } }
thur
alright i'm going to sleep
night @ShaquinTrifonoff
 
@Lusitanian bye
 
have a good afternoon/day/can't remember your timezone :(
 
8:47 AM
hello
 
Hi @Jocelyn
 
@Lusitanian I think this is the "kiwi timezone" (many hours before or after GMT/UTC) :-p
It's almost 10pm for you, Shaquin now?
 
@Jocelyn Yes
 
exactly 12 hours later than it is for me :-D
 
@hakre $readability--; :-P Also, doesn't work for leading/trailing longest zero group, only comes out as a single :
 
9:05 AM
mornin'
 
Have a good time, don't get too mad at new SO users ;-)
See you later
 
9:43 AM
@LeviMorrison any naming suggestions from other languages?
 
I want to know: inside a function when we create a global variable with the same name as the variable that already exist in an outer scope, it actually global-izes the variable in outer scope instead of creating a new global variable (with null value). Is it like that? And if yes isn't that different from other languages? So is there any reason behind such distinct behavior?
 
not really , when you use global keyword , you get access to outer scope , said outer scope already is global
also , please don't use global variables
ever
 
@Mahesha999 not outer scope. it's from the global scope only. and you can easily test it yourself ;)
 
well sorry am putting code here
$a = "a";
fun();
echo $a; //var1

function fun()
{
global $a; //so here we are actually making var1 global - kinda modifying its scope?
echo $a;
echo "<br />";
$a = "b";
echo $a;
echo "<br />";
}

it prints
a
b
b
 
well .. please don't do this
 
9:59 AM
arhh sorry
 
Is there a way to do this answer in one line?
I want instead of onclick="myfunction(this.value)", it should be onclick="location.href='this.value'";
Anyone?
 
@Shimmy this is neither a room for javascript nor one for asp.net mvc
 
my question is def not about asp
its pure js, but whatever as you wish
i thought i was talking to web guys
Anyway you can meet me at the JS chatroom
 
10:17 AM
 
 
1 hour later…
11:26 AM
morning
 
Hi @NikiC
Am I allowed to ask CSS thing here? :/
 
try and see what happens :)
 
+-------------------------+
| L:0  |     | L:20  |    |
| W:20 |     | W:20  |    |
+-------------------------+
       ^-----^
         20px

+-------------------------+
| L:0  | L:20 |           |
| W:20 | W:20 |           |
+-------------------------+
       ^------^
         20px
I'm trying to achive this. The parent has position:relative and childs absolute. I need to specify position relative to the parent. But if 2nd child has left:20 it gives 20px margin to 1st child. Fig.2 Is my target.
 
@DaveRandom For me it does work for 0, 0, 0, 0, 0, 0, 0, 0 (::) and 0, 0, 0, 0, 0, 0, 0, 1 (::1) well. Yes readibility ain't that fine, however, put it under test, do all edge cases, it's rather straight forward. It's a leaf function.
 
I'm lost :(
 
11:39 AM
Use absolute positioning instead, left is to the parent left then.
 
Childs have postion absolute.
 
So take the width of the 1st child in pixels and add 20 to it and that is the left value in pixels for the 2nd child.
Good mornings btw.
 
Oh, it doesn't even work in FF
 
I hate iterators
I hate recursive iterators
I can never see through wtf is actually happening
 
11:43 AM
Ohhh, what's hurting?
And why can't you see?
 
@hakre I'm iterating over a RII(RAI($array), RII::LEAVES_ONLY) but it somehow doesn't give me all of the leaves :(
I think the reason is that the leaves are IteratorAggregates
 
@NikiC RAI only takes child array values and standard public object property values for leaves IIRC.
However for your array you can create your own RecursiveIterator that provides these leaves to RII.
 
@hakre And why the f does it do that?
 
@NikiC Because it's a recursive array iterator and not a recursive aggregate iterator?
 
So a non-stdClass object cannot be a leaf?
 
11:49 AM
@NikiC Normally only an array can be a leaf. Already by the name of the iterator.
 
@hakre An array is never a leaf of a RAI
 
@NikiC Yes, only it's values. But you're looking to traverse the children I assume.
 
@hakre I don't want the aggregates to be traversed, I only want them to be returned as leaves
The fact that they are aggregates doesn't really matter. They are also not returned if they are just plain non-stdClass objects
 
Let me check.
 
I think I now got it
RAI is not really RAI but rather RecursiveArrayAndObjectIterator
For objects it also tries to traverse the object properties
And in my case (actually in virtually any case) the objects don't have public properties so they are not considered leaves :/
 
11:55 AM
@NikiC eval.in/3894 - no public ones: eval.in/3895
 
@hakre That's exactly the issue
 
@NikiC Yes, exactly the case. PHP does this stdClass / array are close friends thingy here.
 
@hakre Which makes RAI totally useless for object oriented settings, doesn't it?
 
So you have objects in there that implement IteratorAggregate?
@NikiC Well, those are just the prebuild itertors. For your own objects you normally write your own iterators.
 
because I totally want to write my own recursive iterators for everything...
In this case a class SaneIterator extends RecursiveArrayIterator { public function hasChildren() { return parent::hasChildren() && !is_object($this->current()); } } should suffice
 
12:04 PM
Well if you have public properties. But as you wrote you don't have them, so you should not need the SaneIterator for the case.
 
@hakre not sure i follow
if i don't have public properties it just won't show up at all
 
Yes, because of RII::LEAVES_ONLY.
 
@hakre yes
that's why i'm just using SELF_FIRST now
it's a bit dirty but at least it works
 
Anyone can please help with javascript: jsfiddle.net/MQXCt/101 thanks
 
I somehow smell this is related to ArrayObject. If you need to create your own RecursiveIterator it's normally best to extend from IteratorIterator and adding your own get/hasChildren() methods.
That is normally more straight forward.
@NikiC: This is probably the kind of iteration you're looking for: eval.in/3898
ArrayObject doesn't stand in your way than any longer.
 
1:22 PM
hi there I just tried defining two constructors in a class Printme(): Printme() and __construct(). Both accept single variable and echos it. When I run it, it first gives error as I cannot define two constructor and then it outputs "u". s19.postimage.org/5m6mthnub/php.png I think it should either respond with compile time error or if there is no error it should print the desired output how it is doing both?
 
@Mahesha999 That is a strict standard warning, not a fatal error. It's a friendly reminder telling you something is wrong. PHP is backwards compatible, so it does not kill the script so far.
 
great you mean all such compatibility issues are reported but yet executed?
 
Not necessarily. If you prefer this more strict, throw an exception on each of the strict standard warnings: php.net/manual/en/class.errorexception.php
 
1:43 PM
@Mahesha999 you should be using __construct() as the constructor for the class in PHP
also , running echo in constructor is considered to be a bad practice ... FYI, for when you start writing something you want to publish
 
yeah was just experimenting
 
1:59 PM
@hakre should copying that error handler class and setting it as an error handler result in some break in code, I copied the class and set it as an error handler and it yet showed the same output
 
@Mahesha999 Not copying the class - it is built-in in PHP. See the example #1 given on the page. If done properly, any error/warning/notice will cause an ErrorException and bring the code to halt if not caught.
And just do as @tereško wrote, use __construct() for the constructor function.
 
sorry my mistake I meant copying function exception_error_handler and calling set_error_handler as in example there, I think that warning is not getting caught when I run step through
not copying class but function
 
@Mahesha999 Okay, it needs to be initialized before the rest of your script runs to have that working.
 
user50049
I just realized that what I started off with on a large project (CI), is not CI any more. I have changed it quite drastically. Figuring out what I'm going to do with it
 
@hakre initialized?
 
2:08 PM
@Mahesha999 php.net/manual/en/function.set-error-handler.php - you need initialize (set) the error handler callback to have it working.
 
@TimPost clean it up and release as your own framework
 
hello together. i have a html5 geolocation getCurrentPosition in my <head><script> and want to pass the variables of lat- and longtitude to my php variable. which options do i have?
 
@TimPost you could remove the CI from your custom code
 
this is my code, in this i created a input button, problem is how to show data when click on this button: echo '<tr>' . '<td>' ."<input type=button name='tod' value=" . date( 'Y-m-d' )." >" . '</td>' . '<td>' . $adinit->get_req_data( $_POST['req_pn'], date( 'Y-m-d' ) ) . '</td>' . '</tr>';
 
user50049
@Gordon Thinking about it. A lot of the changes I made were also submitted later by the larger contributors in the CI community .. for instance, no more singleton - which Phil did later. So I'm kind of matching a lot of what's going into the next release of CI, while maintaining the BSD license.
 
user50049
2:18 PM
Not sure if that's ... nice ... to release, and not sure if I want to maintain it.
 
@ycelik mostly XHR (also known as ajax). Alternatively you could set the values in cookie , and then in next request the PHP side will get it
 
@te
 
user1125394
done sorry
 
@tereško thanks
 
user1125394
I have this:
 
user1125394
2:23 PM
$file = 'test.txt';
$current = file_get_contents($file);
$current .= $_SESSION['user']->id." ".strlen($_SESSION['user']->id)."\n";
$current .= trim($_SESSION['user']->id)." ".strlen(trim($_SESSION['user']->id))."\n";
$current .= trim(trim($_SESSION['user']->id))." ".strlen(trim(trim($_SESSION['user']->id)))."\n";
file_put_contents($file, $current);
 
trim(trim(...)) ?
 
user1125394
outputs:
 
user1125394
foo.bar@gmail.com
foo.bar@gmail.com 17
foo.bar@gmail.com 17
 
user1125394
actually if I copy paste it
 
user1125394
foo.bar@gmail.com
 
user1125394
2:25 PM
^ just this (there's a null character, apparently)
 
user1125394
 
how can i check if($_GET) in js ?
 
user1125394
you can't
 
@cyril thanks
 
user1125394
 
user1125394
2:31 PM
with putting the strlen first
 
user1125394
it's bugging my app since $_SESSION['user']->id !== trim($_SESSION['user']->id)
 
knock knock...
 
for a school project i have to add a canvas html5. the project is about a seaside resort / coastal resort. i dont have a idea witch functionality i could use together with the canvas. i dont want to add something to the project just to play with. any ideas for something that make sense?
 
user1125394
2:56 PM
if you don't have answers here try js room
 
ok I'll try it there thanks @cyril
 
user1125394
 
user1125394
3:33 PM
better way to write this: if (trim($data['id']) == trim($_SESSION['user']->id) ?
 
@cyril what's with all the trimming
 
Maybe writing a helper function? if (0 === strtrimcmp($data['id'], $_SESSION['user']->id)) { ...
 
Morning people
 
Good morning @PeeHaa.
 
hiya
 
3:52 PM
Howdy @PeeHaa
 
I'm so destroyed because of last night. That's really heavy.
 
user1125394
@MikeB I have null characters at the end of strings, no idea why
 
user1125394
from db I get foo.bar@gmail\u0000\u0000
 
@cyril Do you need it? Can you clean it when you pull it from the database? Seeing code with trims() around everything is unsettling :p
 
user1125394
3:58 PM
@PeeHaa there should be a meta debate instead of chat
 
user1125394
@MikeB yes I can array_map('trim', $array_fromdb) would look less ugly if done in Model
 
@LeviMorrison You are allowed to ping us all :)
 

« first day (771 days earlier)      last day (4195 days later) »