« first day (835 days earlier)      last day (4104 days later) » 

12:16 AM
@VoidWhisperer are you running a home server instead or something?
 
Vps apache server =)
 
Who is the vps with?
 
will i get banned for saying the name for 'advertisement'? D:
 
Oh, I didn't realize that was a rule.
I was about to patronize the company that I work for, simply cause I really do think we are the best lol. Good to know that is a no no here.
 
@VoidWhisperer Glad to see another unsatisfied customer.
You won't get banned for saying your company's name in an on-topic discussion.
@Austin What company is it?
 
12:30 AM
@Austin If that is true how come your site is down?
 
12:41 AM
posted on January 27, 2013 by Alan Knowles

Article originally from rooJSolutions blog As the business is always growing, finding time to write even the shortest of blog posts becomes more difficult, but as we are looking for more staff yet again to help solve our clients growth plans, I thought I cover some of our inventive ways we have dealt with growth, and how we differ from most other software development compani

 
12:53 AM
hello?
 
@PeeHaa It's probably GoDaddy
 
1:13 AM
@PeeHaa LOL
and, @DaveRandom also lol
 
Way too quiet in here today
 
Not down; suspended :)
 
1:47 AM
anybody here
?
want to ask about php <select>
 
1:59 AM
"You don't have to ask whether someone is here or can help. Just tell us your problem."
 
hi
is there any best newsletter script in php
i dont need
tell matic
php list
please help me
 
You mean mailing out a newsletter to a group?
 
yes
 
What problems are you having?
 
I dont need following scripts

1) PHPLIST

2) DADA Mail

3) poMMo

4) TellMatic
the above script are not working
mainly poMMo not working
@LeviMorrison Are u there
 
2:15 AM
Why don't you just write one?
 
i need a ready made script
 
2:27 AM
Why?
And what do you mean 'not working'?
People can't help you when you are this vague.
 
sup
 
@LeviMorrison Hi, which button do I push to have all my problems solved immediately?
 
@GoogleGuy Google Search
 
@LeviMorrison I typed "fix all my problems" and hit I'm feeling lucky but it landed me here... make-everything-ok.com :(
It didn't work
 
@GoogleGuy You see the big red button labelled "Do Not Press This Button"? Press that one.
 
2:36 AM
@DaveRandom Is it normal that a red LED count-down display has popped up and there are red flashing lights?
 
@GoogleGuy Yes, don't worry about it, it's just counting down to when you will no longer have any problems. Actually, that's not entirely true, at that point you'll have one fairly large problem, but it won't last very long.
 
Sounds promosing
 
Right, 2.41am, I should probably go to bed
nite all
 
2:58 AM
Can I enable ZipArchive class using htaccess?
 
3:14 AM
hello
 
@winona What do you mean by enable exactly?
 
hey all, I'm sure you're all busy and probably get a million people coming in here asking for help, but if any of you have a few free minutes and wouldn't mind helping me learn some PHP by answering my question I'd greatly appreciate it :) link is here: stackoverflow.com/questions/14554993/…
 
@Prefix Good question.
You are sure that it is $dom->save('xml/catalog.xml'); that is not working?
As in, have you echo'd the file out or printed it to a different file?
 
@Prefix You have to define a DTD for your XML if you want to search by node attributes.
 
@LeviMorrison thank you -- how would I do that? just echo out the contents of catalog.xml?
@GoogleGuy a DTD? Sorry I'm new to PHP, what is a DTD? Thank you for your help.
 
3:25 AM
@Prefix A DTD is an XML thing, not a PHP thing.
:)
 
@LeviMorrison ahh. I have much learning to do. :) Is there any way to accomplish what I seek with my current XML structure?
 
@GoogleGuy My hosting provider hasn't installed/enable it. And i'm getting this error: Class 'ZipArchive' not found
 
@Prefix I think so. Try using echo $dom->saveXML($root); to see if it properly updated the XML.
 
PS: I'm running in Linux
 
Or, to echo just the updated node: echo $dom->saveXML($item);
Also, DomDocument is really good to learn because the API is similar in pretty much all languages, including JavaScript which is often used in conjunction with PHP.
 
3:29 AM
@LeviMorrison okay I will do that now, thank you :)
should I do that outside the foreach loop?
 
@googleguy Not compiled in my php rather
 
@Prefix If you print just the modified item, do it in a loop. If you print the whole thing, do it outside.
 
is there a command i can replace eregi() with, without changing anything else?
 
@LeviMorrison this is what I got when I tried to echo $dom->saveXML($item);
 
@Prefix The DTD is the part of the XML that defines what an attribute does in the node structure. It's a part of the spec and DOMDocument in PHP just implements the DOM spec. See example at us2.php.net/manual/en/domdocument.getelementbyid.php
 
3:31 AM
Fatal error: Uncaught exception 'DOMException' with message 'Wrong Document Error'
 
Do you have multiple DOMDocuments in your code?
 
@winona No, you can't load extensions into PHP without having superuser access. Those extensions need to be installed.
 
@Prefix Also, can you explain a bit about this loop to me:
foreach( $GLOBALS['catalogItems'] as $item ){
    if( $item->getAttribute('name') == $itemName ){
        // we have a match
        $oldStock = $item->getAttribute("stock");
        $item->setAttribute("stock", $oldStock + $modifier);

        $dom->save('xml/catalog.xml');
    }
}
What is this $GLOBALS['catalogItems']?
How did you select it?
 
@LeviMorrison yeah I have/use $dom (my DOMDocument instance) elsewhere in the code, in an included file, etc.

the global is set with the following line,
$catalogItems = $dom->getElementsByTagName("catalogItems")->item("0")->childNodes;
@LeviMorrison I am still very new to this so I am prob. making horrible mistakes, please feel free to correct me :)
 
@Prefix I'm afraid that code doesn't do what you think it does. DomNodeList::item() returns a NodeList object.
 
Anonymous
3:36 AM
Hi guys
 
Anonymous
any drupal guys here?
 
@GoogleGuy: oh, bother... Any ideas on how to fix the mess I've made? :P
 
@Prefix remove the ->childNodes at the end
 
okay I'll give that a shot.. Originally I didn't have it but my loop seemed to break even more without it
I appreciate you all taking the time to help me. :)
 
Anonymous
anyone?
 
Anonymous
3:38 AM
a bit desperate :(
 
@SkippyChalmers How desperate?
 
Anonymous
desperate enough to fuck a donkey
 
Anonymous
you freelance?
 
@GoogleGuy okay, I removed ->childNodes, but now when I run the loop nothing happens. no errors, warnings, nothing at all.
 
I'd rather not be associated with bestiality.
 
Anonymous
3:39 AM
lol
 
Anonymous
i have this view on drupal
 
@Prefix So, after thinking about this for a bit, I think you need to do two things. First, do as @GoogleGuy suggested and remove ->childNodes. Secondly, run another getElementsByTagName command that filters on items in the context of catalogItems.
 
Anonymous
it has a path associated
 
Anonymous
okay let me one-message this. 2 mins
 
@Prefix var_dump($catalogItems)
You know there is such a thing as DOMXPath
 
3:41 AM
Oh wait, I forgot PHP can't do the context thing.
 
Anonymous
I have this view on drupal, it's got a path associated "/services/". I don't actually want that at all, I want it to be used for all content type = "services_type". I also want a certain tpl to be used for that content type. Any ideas?
 
Anonymous
I have added the content tyep = services type filter
 
Anonymous
but i cant remove the path one
 
@GoogleGuy yes sadly I can only use DOMDocument and or XMLReader for this :/
@GoogleGuy also the var dump seems to spit out the contents of catalogItems twice.. here I'll pasteBin you it
 
@Prefix DOMXPath is a part of the PHP extension you're using, which includes the DOMDocument class.
 
3:44 AM
@GoogleGuy It's part of an assignment for his class.
 
It's like 400 times the work with 50 times less code.
 
Anonymous
Anyone?
 
Anonymous
And yes, agree with @GoogleGuy
 
@GoogleGuy unfortunately what @LeviMorrison pointed out is true, my professor likes making us take the hard road to "build character" -_-
@GoogleGuy: this is what var_dump($catalogItems) produces: pastebin.com/EkB5FybK
 
@Prefix I've figured it out.
 
3:45 AM
@LeviMorrison: REALLY? my hero! :D
Im all ears!
 
I'll try to help you to discover it instead of flat-out giving it to you.
 
thank you, I prefer that. :)
 
First, let's examine the structure of the relevant XML:
<catalogItems count="12">
    <item name="Dell Alienware Laptop 15 inch" price="2500" stock="200" salePrice="0" onSale="no">
        <image>alienwareLaptop.jpg</image>
        <description>sample description here</description>
    </item>
</catalogItems>
 
Anonymous
nobody for good ol drupal?
 
You've already selected catalogItems with $dom->getElementsByTagName("catalogItems")->item(0).
 
3:47 AM
Correct.
 
Now you need to filter through the children for things that are item elements.
How do you do that?
 
would it be:
foreach( $catalogItems as $item ){

}
 
:) No, go ahead and try it though.
 
hmm, yeah if I var_dump $item it seems to spit out the entire contents of catalogItems..
 
First, how do you select the children?
(hint: you were doing it previously)
 
3:51 AM
->childNodes ?
 
okay cool -- now I thought we got rid of that since it turned them into DOMText
 
@Prefix :) Slightly off.
It doesn't turn them into DOMText: rather, catalogItems->childNodes returns all the children, including the text between tags.
 
@LeviMorrison ooooh! hahaha, so much to learn!
 
This means the whitespace between catalogItems and item is a DOMNode.
:)
So the next step is to filter only the children that are items.
Look around in the PHP manual to see if you can find a way to do that.
 
3:53 AM
okay, will do -- any spot I should start at?
 
Too bad DomNode::children is not defined, like a regular DOM :)
 
( thank you very much by the way. you're far more helpful than any of the TA's I've met with. :) )
 
@Prefix Yeah. Every element in childNodes is a subclass of DOMNode
So you can only use the methods/attributes of a DOMNode.
For instance, if you try $item->hasAttribute('name') on a DOMText node you'll get an error because DOMText doesn't have that method.
 
Or rather, I should say DomElement::children.
 
okay so I feel like I need to use the nodeName property of the DOMNode to detect the <item> tags, right?
 
3:57 AM
@Jack No, the real pity is that he isn't allowed to use XPath :)
@Prefix Try it and see :)
 
hmm nope..
unless I'm just doing it wrong
 
Anonymous
so does nobody know drupal views?
 
nodeName: "Returns the most accurate name for the current node type" not very descriptive
I can get them into a DOMNodeList with
$items = $catalogItems->childNodes;
is that what I should do?
 
nodeName should have worked.
 
okay, I probably just wasn't implementing it properly, haha. How should I use nodeName
?
 
4:03 AM
Did you remember to add childNodes back to your selector? eg $dom->getElementsByTagName("catalogItems")->item(0)->childNodes?
 
Oh, No, I didn't
so,
$catalogItems = $dom->getElementsByTagName("catalogItems")->item(0)->childNodes;
 
Sure.
Then loop over that looking for item nodes.
 
and do what with them? Save them to a var?
or just do what I was trying to do in the original question?
 
Yeah, just update them as you were trying to do.
Don't print/save anything inside the loop, though.
 
okay, I'll give it a shot. so something like this?:
foreach( $catalogItems as $item ){
if( $item->nodeName == "item" ){
// handle
}
}
 
4:07 AM
Well, make sure it's the right item to look for, but that's the idea ;)
 
haha right, awesome :) I'll give that a shot right now. Thank you!
Cool! So now I'm grabbing the proper item. Progress! :)
now I just need to figure out how to update the quantity attribute, and save the thing back to the XML file...
@LeviMorrison: any tips for the updating/saving XML part? Or should what I had in the original question work fine?
 
@Prefix Well, you save it in a loop which could potentially cause issues, but as long as each name is unique it will only save once.
This is what I would do in your situation:
$catalogItems = $dom->getElementsByTagName("catalogItems")->item(0);

$itemName = 'Dell Alienware Laptop 15 inch';
$modifier = -1;

foreach ($catalogItems->childNodes as $item) {
    if($item->nodeName == 'item' && $item->getAttribute('name') == $itemName) {
        $oldStock = $item->getAttribute("stock");
        $item->setAttribute("stock", $oldStock + $modifier);
        break; // name is unique, so no need to keep looping
    }
}

$dom->save('catalog.xml');
 
cool! that's almost identical to what I just typed up. I'll give it a go now
 
Keep in mind you could have a race condition if two requests come in really quickly. I'm sure that's not an issue for your assignment, but it would be an issue for a live app.
 
@LeviMorrison okay, so I have it exactly how you demoed above, however it doesn't seem to do anything. the XML file is not updated
 
4:19 AM
@Prefix It assuredly works on my machine. Try combing your code again.
 
the foreach is inside of a switch statement.. not sure if that might be throwing a bug into the system or not
 
Also, your editor might not automatically update when you write to the file. Try closing the file and reopening it. This tripped me up at first.
 
hmm, still no go
here's the function:

    function updateCatalogQuantity($itemName, $modifier= -1, $section){
    $dom = new DOMDocument();
    $dom->load("xml/catalog.xml");
    $catalogItems = $dom->getElementsByTagName("catalogItems")->item(0)->childNodes;

    switch( $section ){
        case "catalog":
            foreach( $catalogItems as $item ){
                if( $item->nodeName == "item" && $item->getAttribute('name') == $itemName ){
                    // we found our item
                    $newStock = $item->getAttribute('stock') + $modifier;
(sorry not sure how to do the code indenting in chat)
 
(hit 'fixed font' which is located to the right of the chat box)
 
there we go, thanks
also I tried the save in both of the spots shown above (but not at the same time). neither worked
 
4:23 AM
Is the value of $section set to catalog?
 
yeah it is, the switch statement is definitely firing
 
Should work.
A few things about general programming practice, though:
updateCatalogQuantity should probably be split into multiple functions, one for each section.
 
yeah thats a good idea, I think I'll do that :)
 
Secondly, the redirection (eg Location: index.php) probably shouldn't happen inside of the function. The redirect is a separate task from updating the catalog.
 
good call. removed
for whatever reason though it just seems to not edit the XML file.. could it be because other parts of the page are accessing the same XML file? basically what fires this all is an "add to cart" button on the index page, however the index page (when it loads) also reads through all the catalog elements to display them for the user.
 
4:28 AM
Hmm. I'm not exactly sure. It works for me in my local test.
 
yeah I am also doing this locally and not on a server, but I'm new to using a local web stack. I don't need to worry about permissions or anything for something local like this?
 
Well, you do need to worry about permissions, but I think it would report an error.
Oh, one thing:
You probably want to know if the save was successful, right?
Could you post your current function so I can see the best way to deal with it?
Basically, save() will return the number of bytes written or FALSE on failure. This means you can do:
$bytesWritten = $dom->save('xml/catalog.xml');
return $bytesWritten;
You don't need to save it to a temporary variable, I just did that to help clarify what was being returned.
If you use that value in an if statement, it will be true if you wrote anything to the file, meaning if it failed to save it will be false or if it wrote nothing to the file it would also be false.
 
hm, if I echo out $bytesWritten I get 4444
 
So it did save the file.
Try closing your editor and reopening the file.
 
I tried closing the file and reopening it and there was no change, do you think I should reopen the entire editor instead?
 
4:41 AM
Perhaps.
Worth a shot, anyway.
Are you on Linux or Windows, btw?
 
OH WOW it worked now! Weird! I didn't even close anything, it just worked this time
 
I am on Windows 7 x64
 
I'll post an answer so you can accept it.
 
I don't understand though.. I just went to the bathroom, came back, tried the exact same thing with your echo statement.. and it worked?
thank you so much
 
4:44 AM
:) You are welcome.
 
 
2 hours later…
6:40 AM
Hey guys!
 
Anonymous
morning
 
morning
I have a question that I just posted about renaming files. I imagine this is a fairly common problem people face and I am aware of the rename function in PHP but the example in the PHP manual only has one file that is being renamed. I wish to rename a bunch of files, but as a newbie to PHP I am not sure how to go about doing this. I am really keen on learning PHP - could someone please shed some light on this for me?
Here is my question along with my current PHP Script stackoverflow.com/q/14556858/1788087
 
7:32 AM
Good morning
 
7:47 AM
mornin'
 
what's the good word?
I'm off, heading to the plane...
 
Hi , I have localhost.sql back up which takes 750 mb in size.....This dump which has more number of database in it. Need to take only one database from that sql file. Is it possible to do that ? do we have tool for that ? I have searched many ways. but could not able to get my db from that . Kindly help.
 
Good morning.
 
@Gordon , is that talk of your's somewhere available ?
 
I am printing amazon, ebay labels. 21 per page. 7 vertical, 3 horizontal. I have created style sheets pages. but when I print . its over lap each other.
does any body work with amazon, ebay lables.
 
7:52 AM
@ircmaxell there are no good words: it's monday morning
 
@tereÅ¡ko only at slideshare. i think you already know it though: de.slideshare.net/go_oh/…
 
I have used this split -l 100000 localhost.sql to split the sql. This splits more txt file.By using these text file How could i get my database ? or suggest best way to get my particular db from sql dump
 
According to the 3rd StackOverflow User Surves jQuery is a programming language now. Interesting blog.stackoverflow.com/wp-content/uploads/survey-final-3.png
 
i think we finally have gathered enough proof that there are drugs i the drinking-waters
 
@Gordon lol
jquery is indeed very powerful but is it a language yet?
 
8:04 AM
@Happyninja will codeigniter ever be a language ?
 
so why would jquery ?
 
but still SO
 
Haha that's funny :)
 
> if('['.((int)$label).']' != '['.$label.']') { .. }
ehh .. ... i'm back at work
 
Mooooornings
 
@Gordon Ha ha. Nice finding. comment it on the blog post.
 
posted on January 28, 2013 by Tobias Schlitt

As promised, I'm explaining my new VIM setup in some more detail, staring with the collection of plugins I use by now to enhance my VIM experience. I already have some in mind which I need to try out, but I would be happy to know which additional plugins you can recommend in relation to PHP programming (and beyond). Please leave a comment!

 
9:16 AM
Mornings
 
Hello =)
 
@DaveRandom heya
 
@PeeHaa Yo dawg
@PeeHaa ever done anything with DOMDocument and DTDs?
(validating, not adding one to a doc)
 
@DaveRandom A long time ago I had to do something with it IIRC
 
excuse me, how do i invite someone with 6 rep to come to chat?
 
9:29 AM
@SalmanA may be you can't if they dont have privilege
 
@SalmanA They will not be able to talk
20 rep is needed
 
oki
 
Wouldn't be too hard to get 20 rep ;)
 
@PeeHaa Just trying to alias a DTD url to a local file on disk. Essentially I don't want to be making a pointless HTTP request, but I also want to use the full URI of the DTD in the document. I'm sure there must be some way to tell libxml which DTD to validate against (essentially, ignore the DTD declared in the document) but I seem to be suffering from epic and incurrable RTFM fail over it.
 
@DaveRandom setup the hosts file on your machine?
 
9:32 AM
Not really that practical, the full URI is on github...
 
@DaveRandom: use regex to remove DTD bwahahaha
 
Plus that's still an HTTP request, ideally I want to (effectively) use file://
@SalmanA :-P
 
@PeeHaa Yeah, that's an old project of mine that is on hold right now. I still have not updated the name servers to point to my staff account rather than my old paid account that I cancelled.
 
@Austin But what is the company your are working for?
 
@Austin also, more importantly, is your surname "Texas"?
 
9:35 AM
@DaveRandom Ah a real local file. Sorry dunno that. :(
 
or maybe "Maestro"
 
Guys, is "Cron job" still in use for most of web development? Or is there already a better alternative
 
@PeeHaa np, I'll come back to it in an hour or two. I'm absolutely certain there must be a way to do it, it would be pretty ridiculous if not, I'm pretty sure this is a function of libxml, not PHP, I can't believe it wouldn't have that functionality. I might badger @hakre again.
 
mornings :)
 
Oh crap I've woken it up. Run for the hills!
 
9:38 AM
If catalogs is too much work for you, there is also a callback function
3
A: Speeding up XML schema validations of a batch of XML files against the same XML schema (XSD)

hakreYou can safely substract 30 seconds from the timing values as overhead. Remote requests to W3C servers are being delayed because most libraries do not reflect caching the documents (even the HTTP headers suggest that). But read your own: The W3C servers are slow to return DTDs. Is the delay ...

 
@TemporaryNickName I wouldn't say it's used for "most" web development, the use cases are actually less that you would think (they certainly get abused), but if you really do need a cron job, then yes, that is the way to go, there isn't a "better alternative" because it's pretty hard to improve on something that simple.
@hakre Nice one, I'm not bothered about "too much work", I'd rather do it properly than quickly
 
XML catalogs require environment variable configuration before PHP starts.
 
hey guys
here is a question
i magine you have a class with a public method
 
@Dracony yeah
 
@PeeHaa HostGator, and lol not it's not Texas
 
9:41 AM
@hakre I can cope with that
 
now in that method you include a php file (template)
now there is a function that you want to be made available for that included file to use
that function will have to have a way to access a public method of your current $this
but you want to omit having '$this' in templates
 
@PeeHaa I do live in Austin Texas though. I also went to Austin HS... and Austin CC.
 
there is of course a way to pass $this using use
but here is my second problem
 
@PeeHaa Lots of Austin in my life lol
 
there are a lot of variables present in the scope of the included file which I want to pass on
ok bad example
I'll explain it on a more concrete ground
I'm trying to implement haml subtemplates
so basically there is HAML class and there is aa render() method that sets the scope for the template and includes it
now I want to have an option to include subtemplates
inside those templates
but if I use a function to do it inside the template the variables in current scope will not pass to that function
 
9:45 AM
@Austin Holy moly you guys are expensive:|
 
how do i manage to execute a template in the current scope?
I must call some sort of a function because the included subtemplate might not exist yet
a workaround would be to have this in haml template:
include get_tpl('subtemplate.haml')
how do i simplify this?
 
0
Q: Arrays concatenating bases on some specific conditions?

VenkatI have an array which is like below. But there is so much of duplicate information in each array. What i am trying to do is to develop a new array in a specific way. $data = Array ( [0] => Array ( [name] => X [client] => C [customer] => c1 [custome...

 
You are asking how to simplify this include get_tpl('subtemplate.haml')?
Yes only 5 to go before [oop] is above [internet-explorer] :P
 
yes
i want it too be just a simple function
 
Considering the fact that I dont (want to) know HAML and that it looks pretty simple to me as is I have no idea :P
 
9:49 AM
current ideas: prerender all templates and just use include
haml has nothing to do with it actually
 
Quick! Everyone retag a bunch of questions @PeeHaa has answered with !
 
:D
 
i can use get_defined_vars and pass on the scope in this way
 
Wow I if want to get about he same config VPS at HostGator as I currently have on my main webserver VPS I have to pay $149.95 :O
@Austin You guys are a scam! :P
 
@PeeHaa Who do you use atm?
 
9:52 AM
@DaveRandom Dutch provider
@DaveRandom cloudvps.nl
 
@PeeHaa Not bad for the most basic level, their traffic is quite overpriced though.
 
@PeeHaa Holy crap that's cheap, what's the customer service like?
 
@PeeHaa IT's cheaper to get 2x VPS 1 with 250GB, than 1x VPS 1 with 500GB
 
@Leigh Actually the traffic is moar FUP, but they don't say that ;)
 
I'm using one from cheapvps.co.uk - but their IPv6 has been quite flakey for me.
good otherwise
 
9:58 AM
@DaveRandom Not total crap like others. That's one the reason I got there. I have been doing business with the at my previous job.
 
I am using linode for my blog.
 
@shiplu.mokadd.im they're expensive
 
@Leigh But I like them.
 
@shiplu.mokadd.im I like fast cars and loose women, but I can't afford them
 
@Leigh The fact that they even give you an IPv6 address is a big improvement over many
 
9:59 AM
@DaveRandom ? really???
v6?
 

« first day (835 days earlier)      last day (4104 days later) »