ShawnCplus 456 Code Monkey Team Colleague

If you know how to set and get data from the cookie I just gave you how to use implode/explode, just put them together. You already did the first part in your original post.

ShawnCplus 456 Code Monkey Team Colleague

Thanks
but I am not sure on how to get the data back out of the cookie.

Then you didn't read the link I posted :)

ShawnCplus 456 Code Monkey Team Colleague

Well you did it in your example. All I did was explain the correct syntax for implode/explode. Also, see www.php.net/cookies

ShawnCplus 456 Code Monkey Team Colleague

Well if you want to implode the values and store it in the cookie then you'd explode it to retrieve it as an array.

$array = array('orange', 'green', 'blue');
$string = implode(',', $array); // 'orange,green,blue'
$second_array = explode(',', $string); // array('orange', 'green', 'blue');
ShawnCplus 456 Code Monkey Team Colleague

Not to be rude but I didn't say print, I said var_dump. That tells you the type along with the value so you would see.
boolean(true)
or
boolean(false)

ShawnCplus 456 Code Monkey Team Colleague

Yes. It should return boolean false. What are you getting instead? What is the output of:

var_dump(EW_IS_WINDOWS);
ShawnCplus 456 Code Monkey Team Colleague

If you're trying to modify an already existing row take a look at
UPDATE which can take a WHERE clause
http://dev.mysql.com/doc/refman/5.0/en/update.html

There is also REPLACE. It acts like INSERT but if a row exists with the same primary key, it will replace it.

IE.,

INSERT INTO sometable (id, name) VALUES (0, 'Shawn');

Will give you the table

ID         Name
0          Shawn
REPLACE INTO someTable (id, name) VALUES (0, 'Tester');

You now have

ID         Name
0          Tester

http://dev.mysql.com/doc/refman/5.0/en/replace.html

ShawnCplus 456 Code Monkey Team Colleague

It's as if what doesn't handle it at all. define doesn't return anything accept true/false whether it successfully declared the constant or not. What exactly are you trying to do?

ShawnCplus 456 Code Monkey Team Colleague

There's no such thing as a conditional insert, it just appends to the end of the table. Do your conditional in PHP.

ShawnCplus 456 Code Monkey Team Colleague

You forgot your closing " on $query

ShawnCplus 456 Code Monkey Team Colleague

That's not actually running the PHP function onchange. It's running a Javascript function onchange. The PHP function only runs once when the page is loaded.

ShawnCplus 456 Code Monkey Team Colleague

Do you understand what these lines do?

*(boardSkin +(row * columns) + column)

You're setting a memory address to a value, that above line is the same thing as saying boardSkin[((rows*columns)+column)] . (I think, its been a LONG, LONG time since I've used *(array + offset) notation, probably because it unnecessarily obfuscates code. So ask yourself, does that index in the char array exist?

ShawnCplus 456 Code Monkey Team Colleague
$keywords = array('value2','value1','value');
$replace = '<a href="webpage.php?view&id=\1">\1</a>';
$search = '/('.join('|',$keywords).')/';
preg_replace($search, $replace, $source);

I've reversed the keywords because the grouping will be non-greedy so if you place 'value' first it will never find value1 or value2

ShawnCplus 456 Code Monkey Team Colleague

okay, talking through it got me searching different terms. Apparently, sed can do this, but I need to insert a "^J" or "ctrl-J". I've not figured out how to do that with my keyboard that doesn't spit me out to a prompt, though.

It seems like this should work (pipes "|" are the separators):

cat tivo.xml | 's|>\<|\>\"ctrl-J"\<|g'

The "tr" command can too, and the other site suggested using octal notation to get that to work, but again, I'm hitting a roadblock...

crop tivo.xml | tr -d '\076\074' '\076\012\074' > tivo.result


gives me the following:

"blank line"
?xml version="1.0" encoding="utf-8"?>
TiVoContainer xmlns="http://www.tivo.com/developer/calypso-protocol-1.6/">
Details>
ContentType>x-tivo-container/tivo-videos
/ContentType>
SourceFormat>x-tivo-container/tivo-dvr
/SourceFormat>
Title>Now Playing
/Title>
LastChangeDate>0x49B7F8FF
/LastChangeDate>
TotalItems>73
/TotalItems>
UniqueId>/NowPlaying
/UniqueId>
/Details>
SortOrder>Type,CaptureDate
/SortOrder>
GlobalSort>Yes
/GlobalSort>
ItemStart>0
/ItemStart>
ItemCount>73
/ItemCount>
Item>
Details>
ContentType>video/x-tivo-raw-pes
/ContentType>
SourceFormat>video/x-tivo-raw-pes
/SourceFormat>
Title>The Daily Show With Jon Stewart
/Title>
SourceSize>783286272
/SourceSize>
Duration>3600000
/Duration>
CaptureDate>0x49B7535F
/CaptureDate>
SourceChannel>48
/SourceChannel>
SourceStation>COMEDYP
/SourceStation>
HighDefinition>No
/HighDefinition>
ProgramId>EP2930531384
/ProgramId>
SeriesId>SH293053
/SeriesId>
EpisodeNumber>14034
/EpisodeNumber>
ByteOffset>0
/ByteOffset>
/Details>
Links>
Content>
Url>http://192.168.1.20:80/download/The%20Daily%20Show%20With%20Jon%20Stewart.TiVo?Container=%2FNowPlaying&amp;id=3207375
/Url>
ContentType>video/x-tivo-raw-pes
/ContentType>
/Content>
TiVoVideoDetails>
Url>https://192.168.1.20:443/TiVoVideoDetails?id=3207375
/Url>

This works, but the output deletes the "<" off of each tag. I mean, I'm not complaining. Technically, it is what I want, but I guess I just wanted to know why it does this...

Regards,
Bryan

I just posted the way to do it correctly

ShawnCplus 456 Code Monkey Team Colleague

replace test.html with the name of your file

sed -r "s/<Url>([^<]+)<\/Url>/\nURL: \1\n/g" test.html | grep ^URL: | sed -r "s/^URL: //g"

This will give you a newline delimited list of the URLs

Also, in the future you can use the following command to clean the XML (requires Tidy)

tidy -xml -i -q <file>
ShawnCplus 456 Code Monkey Team Colleague

C++ does not have anonymous functions. However, C++0x standard does using the following syntax (using a std::for_each as an example)

std::map<int, int> someMap;
// ... ...
std::for_each(someMap.begin(), someMap.end(), []( std::pair<int, int> map_entry ) {
  // ... lambda body
});

The initial [] leading the arguments defined what should be passed to the lamda, [&] says pass everything by reference, [=] says pass everything by value, you can also pass variables individually which default to being passed by reference (Deference with * obviously)

But take note that this is only an initial standard and as far as I known there hasn't been a definite date nailed down.

ShawnCplus 456 Code Monkey Team Colleague

Honestly, you have been given the proper solutions. Sending (and therefore, reading) your forms with the POST method sends variables through the headers sent. For this purpose, however, I would recommend SESSIONs as people could potentially look at the header information. SESSION variables are contained solely on the server (aside from the associated client COOKIE which only contains the SESSION ID).

Well that's a good approach except for the fact that you somehow have to get the data to the PHP script first so the data can be placed in the session :)

ShawnCplus 456 Code Monkey Team Colleague

Exactly, that's why most people here probably wont and shouldn't help you with this.

ShawnCplus 456 Code Monkey Team Colleague

You could just use form method POST

ShawnCplus 456 Code Monkey Team Colleague

Careful about misleading people. A hash is not encryption. There is no way to decrypt a hash. There is also no such thing as a "dehasher", the only way to "reverse" a hash is to create huge libraries (called rainbow tables) of pre-created hashes and check against them. MD5, SHA1/256/etc are hashes, Vigenere, WEP, etc. are encryption.

ShawnCplus 456 Code Monkey Team Colleague

Firstly, this should be in the HTML forum, secondly

<img height="32" width="32" src="blah.jpg />

... ...

ShawnCplus 456 Code Monkey Team Colleague

A) Don't iterate through POST variables if you're doing any sort of key/value assignment. I (as a user) can put anything I want into POST and given that you're eval ing the code you immediately just opened yourself up to every attack under the sun

B) Why the heck are you using eval?

ShawnCplus 456 Code Monkey Team Colleague

There's no need to use a regular expression for that

$string =  'Name: Bob, Age: 20, Details: Likes chocolate';
  $properties = explode(",", $string);
  $result = array();
  foreach($properties as $property) {
    $split = explode(":", $property);
    $result[$split[0]] = $split[1];
  }
  print_r($result);
  /*
    Array
      (
        [Name] => ' Bob',
        [Age]  => ' 20',
        [Details] => ' Likes chocolate'
      )
  */
ShawnCplus 456 Code Monkey Team Colleague

It's also not doubling in the variable, you're just outputing the variable twice. You have a cout inside the if, and a cout before the return.

ShawnCplus 456 Code Monkey Team Colleague

All of those str_replace 's are unnecessary. There is a built in PHP function.

$formatted_text = nl2br($text);
ShawnCplus 456 Code Monkey Team Colleague

He already solved it with adding the ; on the end inside quotes.

ShawnCplus 456 Code Monkey Team Colleague

If you're inside a PHP script you can open and close your PHP tags as much as you want. Anything not inside the tags will be rendered to the browser as text just as if it were in an HTML file.
The code <?php echo $xyzimage ?> in the CSS is what puts the background image in the CSS

ShawnCplus 456 Code Monkey Team Colleague

heh, the style tags can't show up in PHP code.
For future reference echoing out HTML in PHP can create some serious spaghetti code so you should avoid it if possible.
So instead of echoing you would close your PHP tag, then put in those style tags, then re-open your PHP tags

// some code
?>
<style type="text/css">
 ...
</style>
<?php
 // rest of your code
ShawnCplus 456 Code Monkey Team Colleague

Well it could be because the "BACKGROUND" attribute hasn't been used in about 10 years.

<style type="text/css">
  background-image:url('<?php echo $xyzimage ?>');
</style>
ShawnCplus 456 Code Monkey Team Colleague

You need the ; for the htmlentity to be parsed so it's.

echo "&deg;";
ShawnCplus 456 Code Monkey Team Colleague

Aside from what they've said about validation just remove the quotes around the variable. Variables inside '' aren't parsed out so you won't get anything but that string. Either use "" or none at all when only echoing a variable.

Kavitha Butchi commented: thnx fr the valuable info +1
ShawnCplus 456 Code Monkey Team Colleague

If you're thinking large scale you might want to start thinking about an ORM to handle your object model and connections. Doctrine, Propel and Creole are 3 of the bigger ORMs in PHP.

ShawnCplus 456 Code Monkey Team Colleague

Well there are better ways around protecting your code such as licensing and NDAs that allow developers to work on your code and still have it be yours.

ShawnCplus 456 Code Monkey Team Colleague

Well for starters you wont be able to have a cohesive, trusting set of developers by hiding your code from them. It will make the code less compatible than it could be. Modularity is good to a point, then all it does is serve to obfuscate code, frustrate developers and make debugging more difficult. I would wholly recommend against that methodology. Is there a particular reason you don't want them to see your code?

ShawnCplus 456 Code Monkey Team Colleague

Built-in function for php http://php.net/wordwrap

PomonaGrange commented: Very Helpful, Thanks +1
ShawnCplus 456 Code Monkey Team Colleague

I read the URL you provided and especially the user contributed notes that followed. It appears to me that the folks that designed the process control portion of PHP (pcntl) were rank amateurs with little real world experience.

Using pcntl_exec after forking really misses the mark. It has no way to pass anything back to the parent, not even a return code. :(

Excellent, then write your own extension to PHP to implement process control the way it should be handled. It's open source, don't complain unless you have something meaningful to contribute as a retort.

ShawnCplus 456 Code Monkey Team Colleague

The only current way to do anything of that sort is on execution of a child process with http://us.php.net/manual/en/function.pcntl-exec.php

ShawnCplus 456 Code Monkey Team Colleague

Of course not. If I knew how to pass info from one process to another, I would not have asked the question!

The reason to post code was to clarify your question. It was incredibly vague. In what context are you passing information between processes?

ShawnCplus 456 Code Monkey Team Colleague

Actually that code does nothing. It should be

<?php echo $_POST['txt'] ?>

Anyway, the reason that it would have been in there is if there was validation happening on that page then the forms would be repopulated so a user would not have to re-type.

ShawnCplus 456 Code Monkey Team Colleague

If you are on a shared provider and don't have access to the server's php.ini file you can use the http://us2.php.net/iniset function to manipulate settings at runtime

ShawnCplus 456 Code Monkey Team Colleague

Just in case you hadn't fixed it yet, (\d{2}\-){2}\d{4} is the correct regular expression. for 12-34-5678 format. To correctly write a regular expression you have to know exactly what your input must look like. If you post what you want in your fields it would be easier.

jackakos commented: good +1
ShawnCplus 456 Code Monkey Team Colleague

Quick solution, use reCAPTCHA

ShawnCplus 456 Code Monkey Team Colleague

Well to clarify a bit, both of those languages have the capability of being used as web development languages but neither were made specifically for that purpose. .NET itself is a framework, ASP.NET is the web language in the framework.

ShawnCplus 456 Code Monkey Team Colleague

There aren't any Javascript animation studios because there are so many quirks between the different browsers they'd be doing N times more work, where N is the number of current browsers. Believe it or not people still use IE5.5 and if you're going to do business you have to support those people whether you like it or not.
To answer your second question, it's both Javascript and CSS and HTML and pretty much everything else that is rendered in the browser is rendered differently unless they use the same rendering engine (Chrome uses Webkit)

ShawnCplus 456 Code Monkey Team Colleague

You don't have the close brace } on the function

ShawnCplus 456 Code Monkey Team Colleague

My biggest recommendation would be to use a prebuilt syntax highlighter and just add a syntax extension. GeSHi is one my my favorites.

ShawnCplus 456 Code Monkey Team Colleague

The super keyword, to my understanding would be used with this syntax in php

parent::someFunc();
ShawnCplus 456 Code Monkey Team Colleague

Well, the short answer is No, the long answer is to force them to enable javascript for your page.

ShawnCplus 456 Code Monkey Team Colleague

It doesn't work because script tags can never be short-tags i.e., <tagname />, they must be explicitly closed i.e., <tagname></tagname>

ShawnCplus 456 Code Monkey Team Colleague

Well the error is generated when you try to get an element that doesn't exist so the simple question is, does the element with the ID "content" exist on the page before you make that call?