Yared Hufkens | 9 Feb 15:38
Picon
Favicon

PHP-GTK: GladeXML::get_widget() doesn't find some widgets

I have a Glade file with this widget:

        <child>
          <widget class="GtkTextView" id="errLog">
            <property name="visible">True</property>
            <property name="can_focus">True</property>
            <property name="editable">False</property>
            <property name="cursor_visible">False</property>
            <property name="accepts_tab">False</property>
          </widget>
          <packing>
            <property name="expand">True</property>
            <property name="fill">True</property>
            <property name="position">2</property>
          </packing>
        </child>

which is a child of a GtkVBox (errContainer), which is a child of a
GtkWindow (errWindow), and I want to write something into it:

function openErr($message) {
	logError($message);

	$window = glade()->get_widget('errWindow');
	$log = glade()->get_widget('errLog');

	$buf = new GtkTextBuffer();
	$buf->set_text(file_get_contents(LOG_FILE) or "Cannot read file ".LOG_FILE."!");

	$log->set_buffer($buf);
(Continue reading)

Rob Gould | 9 Feb 04:44
Picon
Gravatar
Rob Gould <gouldimg <at> mac.com>

Help! Having trouble getting one XML field from this feed reliably

Can anyone tell me what I'm doing wrong here?  I'm trying to get the VASTAdTagURI field from the XML data at
this url:

http://afe.specificclick.net/?l=32259&t=x&rnd=123456

Here's my code.  (below).  It works maybe 30% of the time, but most of the time it just returns nothing from that
field.  Yet when I go to the above url in Firefox, I always see the data.  This is very strange.

// Lets get the ad!

$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'http://afe.specificclick.net/?l=32259&t=x&rnd=123456');
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);

$vastdata = new SimpleXMLElement($buffer);

$vasturi = $vastdata->Ad->Wrapper->VASTAdTagURI;

echo "If the script works, vasturi = " . $vasturi;

echo "<br><br><br>";

print_r($vastdata);

--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
(Continue reading)

Donovan Brooke | 8 Feb 16:54
Picon
Favicon

sticky checkbox - strpos

Hi guys,

if (!strpos($t_product,$t_p)) {print "checked";}

Would strpos be munged if $t_p contains commas?.. ie ",234,"

Thanks,
Donovan

-- 
D Brooke

--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Tim Streater | 7 Feb 22:02
Picon

Re: Re: [PHP] What's Your Favorite Design Pattern?

On 07 Feb 2012 at 19:34, Daniel Brown <danbrown <at> php.net> wrote: 

> On Tue, Feb 7, 2012 at 13:56, Mike Mackintosh
> <mike.mackintosh <at> angrystatic.com> wrote:
>> I was curious to see what everyones favorite design patterns were, if you use
>> any, and why/when have you used it?
>>
>> Choices include slots and signals (observer), singleton, mvc, hmvc, factory,
>> commander etc..
>
>    Mine is apparently CPSV (Commentless Procedural Spaghetti Vomit),
> as that's what I encounter no less than 80% of the time in the wild.

Since I have no idea what anyone is talking about, I can only conclude that you're playing Mornington
Crescent (q.v.), on a non-standard board.

--
Cheers  --  Tim

--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Micky Hulse | 7 Feb 20:50
Picon

Arrays: Comma at end?

Was there ever a time when having a comma at the end of the last array
element was not acceptable in PHP?

I just did a few quick tests:

<https://gist.github.com/1761490>

... and it looks like having that comma ain't no big deal.

I can't believe that I always thought that having the trailing comma
was a no-no in PHP (maybe I picked that up from my C++ classes in
college? I just don't remember where I picked up this (bad) habit).

I would prefer to have the trailing comma... I just can't believe I
have avoided using it for all these years.

Thanks!
Micky

--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Mike Mackintosh | 7 Feb 19:56

What's Your Favorite Design Pattern?

I was curious to see what everyones favorite design patterns were, if you use any, and why/when have you used it?

Choices include slots and signals (observer), singleton, mvc, hmvc, factory, commander etc..

Thanks,

--
Mike Mackintosh
PHP, the drug of choice - www.highonphp.com

admin | 7 Feb 15:11

syntax question

I have been struggling with this issue for an hour and honestly I am not
sure why.

I consider myself to be pretty savvy with MySQL but I am running into an
syntax error that is just flat out eluding me.

$query = "SELECT `table2`.`name` from `table1` ,`table2` WHERE
`table2`.`user_id`=`table1`.`seller_id` AND IF(`table2`.`name`='juice','No
Juice for YOU', `table2`.`name`=`table2`.`name`) LIMIT 1";

This query works!!

But If I try to add a GROUP BY to the query, complete failure.

$query = "SELECT `table2`.`name`  FROM `table1` ,`table2` WHERE
`table2`.`user_id`=`table1`.`seller_id` AND IF(`table2`.`name`='juice','No
Juice for YOU', `table2`.`name`=`table2`.`name`) GROUP BY `table1`.`ID`
LIMIT 1";

The main goal here is to get only 1 return but MySQL is returning the same
row 2 times.

Before I beat my head in anymore I will toss this out to you guys and beat
myself up later for not drinking enough coffee or something .

Michelle Konzack | 7 Feb 09:37

How to detect languages from (=> LTR vs RTL)

Hi colleges and gurus,

I coding a whole "web office" and one of my problems is "LTR vs RTL".
If I have for exanple an E-Mail I use a

    <div style="direction:$DIRECTION">
      $SOME_TEXT
    </div>

but HOW can I detect the type of $SOME_TEXT  from  within  PHP,  to  set
$DIRECTION? (RTL or LTR) correctly?

And how can I do this with mixed Text (by  line  or  entired  paragraph)
like:

   german       <- must be LTR
   persian      <------------------- must be RTL
   english      <- must be LTR
   arabic       <------------------- must be RTL
   french       <- must be LTR
   jidisch      <------------------- must be RTL

Ayn Iranian (Moxhtar?), Arabs (Jasin?) or Jews (Dotan?) here  which  can
help me please?

Thanks, Greetings and nice Day/Evening
    Michelle Konzack

--

-- 
##################### Debian GNU/Linux Consultant ######################
(Continue reading)

Picon
Gravatar

How can I debug wsf/php in eclipse?

Hi.
I'm developing a wsf/php web service. I'm using doc/lit messaging format
and every thing is OK.
But I don't know how i can debug my web services using eclipse.
Although I can directly run my web service in debug mode, Unfortunately
when I debug my client it never jump into web service code and I only can
see if that service has returned a correct value or not!
I'd be glad to know if it's possible or not to do something like this in
eclipse.
Thanks for any help.
Adam Richardson | 6 Feb 18:38
Picon
Gravatar

Re: Re: Long Live GOTO

On Mon, Feb 6, 2012 at 11:58 AM, Tim Streater <tim <at> clothears.org.uk> wrote:

> On 06 Feb 2012 at 09:48, Adam Richardson <simpleshot <at> gmail.com> wrote:
>
> > On Mon, Feb 6, 2012 at 4:25 AM, Adam Richardson <simpleshot <at> gmail.com
> >wrote:
> >
> >> On Mon, Feb 6, 2012 at 4:07 AM, Tim Streater <tim <at> clothears.org.uk>
> wrote:
>
> >> I disagree that the nested function is a straw-man. I (just as the other
> >> authors I'd linked to describing the "arrow" pattern of code) have seen
> >> plenty of examples of similar code.
>
> I guess what I meant was, that I'd never have written it that way in the
> first place, so as an example it felt contrived. Amateurs or people with no
> training (in particular physicists at CERN 40 years ago) should be kept
> well clear of the goto. I'd probably write your function like this:
>
> function val_nested ($name = null, $value = null, $is_mutable = false)
>      {
>
>      static $values   = array();
>      static $mutables = array();
>
>      if  ($name===null)  return $values;
>
>     if  ($value===null)  return isset($values[$name]) ? $values[$name] :
> null;
>
(Continue reading)

Tim Streater | 6 Feb 10:07
Picon

Re: [PHP] Long Live GOTO

On 06 Feb 2012 at 07:47, Adam Richardson <simpleshot <at> gmail.com> wrote: 

> While not purely focused on PHP, I toss this out to the group because I
> believe there are some novel, interesting points regarding the potential
> benefits of using the goto construct as implemented in PHP:
>
> http://adamjonrichardson.com/2012/02/06/long-live-the-goto-statement/


Your val_nested() function looks like a straw-man to me. I've not used a goto since I stopped writing in
FORTRAN in 1978, and not missed it [1]. Neither do I ever have deeply nested if-then-else - these are a good
source of bugs. I suppose the rest of your article might have been dealing with simplifying val_nested()
but TBH I wasn't interested enough to find out.

[1] Not quite true - a Pascal compiler I once had to use in 1983 lacked a return statement, so I had to fake it by
putting a 999: label at the end of the function and goto-ing to that.

--
Cheers  --  Tim

--

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Gmane