ShawnCplus 456 Code Monkey Team Colleague

You haven't shown any code so the best I can do is give a short example:

class someClassA
{
  public function someMethodA()
  {
    throw new Exception("Error");
  }
}

class someClassB
{
  public function someMethodB()
  {
    $someInstA = new someClassA();
    try
    {
      $someInstA->someMethodA();
    }
    catch (Exception $e)
    {
      echo $e->getMessage();
    }
  }
}
ShawnCplus 456 Code Monkey Team Colleague

I think I understand what you were trying to say:

var ids = [];
$('#rightList > li').each(function(el) {
  ids.push(el.id);
});
peter_budo commented: Very helpful reply +12
Atli commented: Perfect answer :) +3
ShawnCplus 456 Code Monkey Team Colleague

Just remove the surrounding click event ie.,

$(".run").click(function(){ ... });
ShawnCplus 456 Code Monkey Team Colleague

Ahh, add a space before your WHERE, right now you have SELECT * FROM myTableWHERE...

ShawnCplus 456 Code Monkey Team Colleague

Try

"WHERE ho_uniqueid='".$_SESSION['uid']."'";
ShawnCplus 456 Code Monkey Team Colleague

m not student.. m professional..and this is required for my proj..
dnt worry i solved it now...no need to waste ur time..

Evn f ur prfsnal u nd 2 shw efrt. <--- This is hard to read
Even if you're a professional you need to show effort before we help you.

ShawnCplus 456 Code Monkey Team Colleague
ShawnCplus 456 Code Monkey Team Colleague

Exactly, like I said. You would have one file say image.php generate the image and in the file you wanted to show the image you'd do

<img src="image.php?someparam=somevalue" />
ShawnCplus 456 Code Monkey Team Colleague

If you want to place it dynamically inside another page you would have one PHP file generate the image and then point to that in an <img> tag.

But to set the content-type just use:

header('Content-Type: image/png');
ShawnCplus 456 Code Monkey Team Colleague

As much as I try and aviod overposting more experienced and respected posters, if you remove the [] that will only let you select 1 of the checkboxes and not multiple. If you want multiple You need to loop through them. Try

<?php
  $engineers = $_POST['Prefered_Engineers'];
  foreach($engineers as $engineer) {
     echo $engineer;
  }
?>

Hope that helps

What he said, it's been a long day :)

ShawnCplus 456 Code Monkey Team Colleague

Remove [] from the name of the field, PHP sees that and tries to turn it into an array.

ShawnCplus 456 Code Monkey Team Colleague

time BETWEEN '$endDateTime' AND '$startDateTime' Put quotes around the dates

ShawnCplus 456 Code Monkey Team Colleague

do you mind passing on a quick example? Would they be auto?

ul#navigation {
  position: fixed;
  top: 10px;
  left: 10px;
}
/* place the ul with the ID navigation 10px from the top-left corner of the screen */
ShawnCplus 456 Code Monkey Team Colleague

I have tried using position: relative; within the ul.sidenav portion, but it's still stuck in the left corner.....any other ideas? Should I use the relative position in all portions?

Also, I don't know if it makes a distance, but I am using IE 7...

When you use position:fixed you have to use the left and top CSS properties to position it on the page.

ShawnCplus 456 Code Monkey Team Colleague

Use position:fixed which will keep the element in the same place on the screen even if the user scrolls the page. Also, Java != Javascript

ShawnCplus 456 Code Monkey Team Colleague

You could use a <span> tag or (this may not be cross-browser compatible) you can use the first-line pseudo-selector on the div like so

div#someID { font-size: 1.8em; }
div#someID:first-line { font-size: 3.5em; }
ShawnCplus 456 Code Monkey Team Colleague

Your first place you should go for any question related to PHP is the PHP documentation: http://php.net/for

ShawnCplus 456 Code Monkey Team Colleague

Hash one way, your thinking in terms of 1998 technology. Today we have supercomputers with millions of cpus with petaflops whatever that means. So when the performance of the average computer increasing every month it makes it possible for the computer to hash every combination until there is a matching hash. And with today's average home pc, it is possible to crack a hash where the original string was ONLY 3 digits long and that takes about 40 seconds. However with a supercomputer perhaps something like 7 digits could be cracked in that time. Keep up with the technology dude.

It doesn't matter what year you're talking about a hash is by definition impossible to reverse. A hash is ONE WAY. You may be able to use a supercomputer to calculate hash collisions which result in the source string but you can't reverse a hash. Yes, an average home computer can do it, hell I have a set of rainbow tables myself, but this doesn't change the fact that a hash is ONE WAY and a hash can't be reversed. You might have noticed I was repeating myself there because it was necessary. I'm not saying that a hash cannot be resolved to the eventual string, I'm saying that it isn't done the way encryption is done. There are decryptors, there are no dehashers, only lookup tables which, as mentioned before, you provide a hash and it does a lookup by hashing every possible string and comparing that hash to …

ShawnCplus 456 Code Monkey Team Colleague

OK, I gotta throw my 2 cents in here. There is no such thing as a de-hasher. A hash is ONE WAY. The only thing that can be done is to produce every possible string against the salt using the same algorithm to produce the same hash. It's not possible to reverse a hash, that's why it's a hash.

ShawnCplus 456 Code Monkey Team Colleague

What do you find wrong in my way of communication and typing??Could you please tell me ??:?:

There's nothing in that one, but this

Hi frnds...
I am doing ma collg 1st yr and i am of CSE department(comp sci engg) and i want to do some additionals course on

seems to be missing some vowels, consonants and words in general.

thanks for your reply but could you please tell me what is clojure??.As this is the first time i am hearing about it..some basic infos about clojure

Google is your friend, along with Wikipedia or essentially anything that exists that you could use to help yourself find the information before begging for it.

ShawnCplus 456 Code Monkey Team Colleague

Inside the function basicAjaxSwitch you are defining a variable basicAjaxSwitch so it's being overwritten. Just use a different variable name inside the function.

ShawnCplus 456 Code Monkey Team Colleague

What do you mean by calling the table? Also, why're you using PDO for the connection then just completely ignoring it and using mysql_query anyway? http://php.net/pdo

ShawnCplus 456 Code Monkey Team Colleague

Alright. I think I get it. So, if I were to try and echo the contents of http://www.example.com/ , I would use this for my code right? Cause, at the moment I'm not seeing anything.

<?php
$source = file_get_contents("http://www.example.com/");
echo $source;
?>

Sidenote: We have to use a variable and echo it. I know this could be a one line code.

If you see absolutely nothing then you may be getting an error. On the line before $source = ... put ini_set('display_errors', 'On'); error_reporting(E_ALL); If you're getting an error that will show it

ShawnCplus 456 Code Monkey Team Colleague

Alright, so what would be the proper way to get information from a web path then?

The above code was what I was told in class yet it produced nothing when I tried to echo the teachers example page. My original code was to use a web path but since it wasn't producing any output, I decided to see what the issue was.

If the file is on the same server as the script then use the absolute path. If it's a remote file use the URL.

ShawnCplus 456 Code Monkey Team Colleague

You're not giving a full path, you're giving a web path. In the first example it is making a web request to fetch the file, in the second example it is directly accessing the filesystem. Make sure your path is correct or use an absolute path like /path/to/your/webroot/page.html

ShawnCplus 456 Code Monkey Team Colleague

Excuse me for beeing persistent; maybe I have not given enough information ...

The data has the shape of six files. They are very small, seen as computer files, but seen as figure tables to fill by hand, a couple of them could seem a bit scarey. You do not want to fill them in every time you want to repeat a simulation with some minor change ... or simulate a quite different case.
Is it really so that PHP does not provide a standard method for upload and download files?

If you want to save simulations for future use just use a damn database. Don't try to go against the grain when working with PHP. There are plenty of tools as your disposal for working with stuff like this. Instead of having the simulation parameters saved on the user's machine just have them saved in your database.

ShawnCplus 456 Code Monkey Team Colleague

You can't, use a database. It's that simple.

ShawnCplus 456 Code Monkey Team Colleague

someone needs to write a decent tutorial on profiles that are user editable, people want to try recreate facebook/myspace to see how it works, its not about reinventing anything.

thanks, enzo

As for this, if you're just using it as a learning experience then it should be just that. It's not a very good learning experience if you just follow someone else's tutorial. The point of recreating something is to learn from the reverse engineering of it.

"Hmm, they have user profiles what is a user profile though. Let's see, a user has a name, and a phone number and an email address. But, oh, look a user has an ID too, that's probably the unique key."

"User's have friends but how do they do that? Ahh, I see, it's really just a list of user ids that they are friends with. But... I know that just storing a list of IDs breaks normalization so they probably have a many-to-many relationship of users. That makes more sense..."

Stuff like that.


(As an aside, echo doesn't need () it's not a function it's a language construct)

ShawnCplus 456 Code Monkey Team Colleague
echo '<a href="profile.php?id="$id">Enzo's Profile</a>';
?>

ive spotted the " after the = sign, wasnt supposed to be there but $id doesnt seem to contain anything?

If you're trying to get the value of $id in that string then you have to concatenate because you're using single quotes.

echo '<a href="profile.php?id=' . $id . '">Enzo's Profile</a>';
ShawnCplus 456 Code Monkey Team Colleague

Alright thanks for the quick answer!

And does the PHP need to run the socket server or are the C++ app supposed to do that?

Based on what you needed it would make sense for the C++ app to listen (be the server) and PHP to send the data to the server (client)

realchamp commented: Fast replies! +0
ShawnCplus 456 Code Monkey Team Colleague

Hmm the first one sounds like something I'd like to have, do you have any tutorials for that? (Both PHP and C++)

http://php.net/sockets

For C++ you might want to look around for forums, there's bound to be a link to a good one. If not, just google C++ sockets there is a veritable shit-ton

ShawnCplus 456 Code Monkey Team Colleague

There are a couple of ways to do it that pretty easy. If you're using the socket approach you can just have PHP open a client socket and send data to the C++ app. The other way is just to have C++ poll a file that PHP writes to. The latter is quite expensive but easier to implement.

ShawnCplus 456 Code Monkey Team Colleague

You can do something like this

<form action="delete.php or whatever" onsubmit="return confirm('Are you sure?');">

That will pop open a box that says "Are you sure?" with yes and no buttons, if the user clicks no then the form won't submit and nothing will happen, if they click yes the form submits as it should.

Roebuc commented: Thanks! Sorry for the long wait on it though. +3
ShawnCplus 456 Code Monkey Team Colleague

ok
i've installed php5-cli
now what?

Now do the same thing, type php -v and paste the output here. If it says something like

PHP 5.2.6 (cli) (built: sometime)
Copyright (c) 1997-2009 The PHP Group
Zend Engine blah blah

Then you have it installed correctly and try what I said in my first post to get your script working on the command line

ShawnCplus 456 Code Monkey Team Colleague

oh, hahaha, did you also do sudo apt-get install php5-cli ?

ShawnCplus 456 Code Monkey Team Colleague

i have nothing on /usr/local/bin
i did sudo apt-get autoremove php5
then sudo apt-get install php5
still nothing...

type php -v on the command line and paste the output here.

ShawnCplus 456 Code Monkey Team Colleague

i am using ubuntu
and i've installed it like u said...
and still
nothing...
any idea?

type ls /usr/local/bin and if php isn't in that list then reinstall it.

ShawnCplus 456 Code Monkey Team Colleague

hi
thanks for your help!
is it

#!/usr/bin/env php

or

#!/usr/bin/env

because the first one doesnt work...

It's #!/usr/bin/env php and if that doesn't work then you didn't install php correctly. If you're using ubuntu or any debian distro it is just sudo apt-get install php5 .

ShawnCplus 456 Code Monkey Team Colleague

This will find the php interpreter for you and use it, don't directly link to it.

#!/usr/bin/env php
ShawnCplus 456 Code Monkey Team Colleague

Thanks to ShawnCplus. Solved.

<script type="text/javascript">
function submitForm(val) {
document.getElementById('submittedName').form.submit();
}
</script>

<form action="process.php" method="post">
<input type="hidden" name="hiddenName" id="submittedName" value="Jolly" />
<a href="#" onclick="submitForm('this.hiddenName');">SUBMIT</a>
</form>
<?php
echo $_POST["hiddenName"];
?>

That won't actually get you the value of the hiddenName element though. You would have to do document.getElementById('submittedName').value . But since you're not really setting the value anyway you can just remove the val argument altogether and remove 'this.hiddenName' from submitForm()

ShawnCplus 456 Code Monkey Team Colleague
ShawnCplus 456 Code Monkey Team Colleague

If you get no errors and no exception is through but it's still a white page that means the query returned no results. Execute the query directly in MySQL or phpmyadmin or whatever you're using to directly access the database and see if it returns any rows.

ShawnCplus 456 Code Monkey Team Colleague
foreach $_POST as $key -> $value {
if ($value == 'Exit')
$echo $_POST['hiddename'];
}

Holy crap no. Just no. A thousand times no.

ShawnCplus 456 Code Monkey Team Colleague

It should be noted, however, that you can hack around it by not using an array but using an object like so

for ( i in ['key1', 'key2'])
  alert(i); // 1, and 2 respectively

// BUT

for ( i in {key1:0, key2:0})
  alert(i); // key1, and key2 respectively
ShawnCplus 456 Code Monkey Team Colleague

Hi,

We can code this way to print something if Exit button is clicked.

<form action="process.php" method="POST">
<input type="hidden" name="hiddenName" value="Jolly" />
<input type="submit" name="submit" value="Exit" />
</form>

if($_POST["submit"] == "Exit") {
   echo $_POST["hiddenName"];
}

What about if we use this way. How do i check if Exit button was clicked or not?

<form name="formExit" action="process.php" method="POST">
<input type="hidden" name="hiddenName" value="Jolly" />
<a href="#" onclick="document.formExit.submit()" title="Exit">EXIT</a>
</form>

if( ???????????? == "Exit") {
   echo $_POST["hiddenName"];
}

Thanks in advance

<script type="text/javascript">
function submitForm(val)
{
  document.getElementById('submitted').value = val;
  document.getElementById('submitted').form.submit();
}
</script>
<form action="process.php" method="post">
  <input type="hidden" name="submitted" id="submitted" value="" />
  <a href="#" onclick="submitForm('EXIT');">EXIT</a>
</form>
ShawnCplus 456 Code Monkey Team Colleague

No you can't. i in your scenario is the key for each value so the only way to get the actual value would to do ['val1', 'val2', 'val3'][i] which would defeat the purpose :)

ShawnCplus 456 Code Monkey Team Colleague

I was using num as an example. Forget about num, you're using num for your menu. You want to do it for each of your operations like this

else if (num == 1)
{
  int rad = -1;
  double pie = 3.14159;
  while (rad < 0) {
    cout << "Please enter in the Radius of the Circle ";
    cin >> rad;
  }
  double area = pie * (rad * rad);
  cout << "The Area of the Cirle is " << area << endl;
}
ShawnCplus 456 Code Monkey Team Colleague

Well here

if (num < 1 || num > 4)

You're already checking if user input input is negative for the menu so just use that logic when you get input for the user's other values, for example

if (base < 0)
ShawnCplus 456 Code Monkey Team Colleague

Hello all.
I have a string that will contain the username, for the security reasons i want it to be checked it if its diferent from the specific charset.
I think it could be done by looping the check 1 character from the username at a time till the end of it, but is there any faster way to do it?
For example:
$charset="abcd1234";
$string1="312";
$string2="5abc";
It should return that $string2 is not contained in the charset.
Thanks in advance.

http://php.net/preg_match That is all

ShawnCplus 456 Code Monkey Team Colleague

What's the error? (also, your code doesn't have an ending brace for the outer if)