ShawnCplus 456 Code Monkey Team Colleague

I'm most familiar with Trac (http://trac.edgewall.org/) which is web (python) based and haven't really run across any SVN source/bug tracking system that is as user-friendly. Whatever you do, stay away from SourceSafe

ShawnCplus 456 Code Monkey Team Colleague

they're called subdomains and it's almost always not page1.domain.com it's subsite.domain.com

You don't want to use subdomains for individual pages and whether it's a subdomain or a normal page has very, very, very little if anything to do with search engine ranking.

ShawnCplus 456 Code Monkey Team Colleague

hey thnx a lot mate! though it's not exactly what i am looking for, but it's surely helping! :)

any more help is appreciated!

That particular PDF doesn't contain everything but it's a good introduction to Magick++ and if you take a gander at the links at the end you'll get pretty much everything you need to know to do image processing in C++

ShawnCplus 456 Code Monkey Team Colleague

You can use mysql_select_db to change the database. And neither PHP or MySQL automatically select a table or a DB. As you can see in the query it's inserting into alien and in the mysql_connect function it's using the aliendb database

ShawnCplus 456 Code Monkey Team Colleague
heroic commented: thnx for the help! +1
ShawnCplus 456 Code Monkey Team Colleague

Might want to show the code so we can point out what to change

ShawnCplus 456 Code Monkey Team Colleague

You can just use file_get_contents to, well, get the contents of the file then when you output it just wrap it in a <pre> tag to keep the original formatting.

ShawnCplus 456 Code Monkey Team Colleague

You're missing a bunch so you either have broken javascript or you didn't copy/paste directly. It should look like:

$('#css-style-def').click(function () {
    var newText = $('console-msgs').html();
});

$ is (in most cases) a jQuery function that finds an element based on the CSS selector passed so that particular code says: Find the element with the id css-style-definition, and when someone clicks on it set the variable newText equal to whatever the element with the id console-msgs contains.

ShawnCplus 456 Code Monkey Team Colleague

What is the expected output? Also, go to where the script is and execute that command by hand, what do you get?

ShawnCplus 456 Code Monkey Team Colleague

Hi,

i am doing an application which make use of JQuery and Cakephp .

In this i am using like the following to retrieve the values from my controller side

var getformid;
  $.getJSON("http://localhost/FormBuilder/index.php/forms/getFormEntry", function(json) {
        getformid=json.forms[0]["id"];
    alert("Form id inside "+getformid);
  });//json

alert("Form id ouside "+getformid);

In the above code, the inner alert that is inside $.getJSON gives me the correct value as 75 But the outer alert showing me the error as getformid not defined..Why so??Can't we make use of the getformid available outside $.getJSON .Please suggest me.SInce i want to make use of that value for saving the Field ..

The most likely case is what's called a race-condition. Your outside alert is actually happening before your inside alert because the AJAX call hasn't finished yet and the variable hasn't been set.

ShawnCplus 456 Code Monkey Team Colleague

http://php.net/exec, your best bet is probably shell_exec

ShawnCplus 456 Code Monkey Team Colleague

Hi..friend.. anybody help me, how to display motherboard serial with php script ? thanks... :)

You can't. PHP is a server-side language, it is not allowed to get anywhere near the end-user's hardware. Hell, it doesn't even touch the user's browser outside of knowing which browser it is.

ShawnCplus 456 Code Monkey Team Colleague

Well you're saving the user ids somewhere so just save a count of logins along with it. If it is above a certain number (in this case, 2) just don't allow them to log in.

ShawnCplus 456 Code Monkey Team Colleague

Quanta Plus, aptana studio(Also bluefish, netbeans)

I'd have to say stay away from Bluefish. It has nice project management but outside of that it isn't a great IDE

ShawnCplus 456 Code Monkey Team Colleague

Thanks.
I looked at w3schools but when i did things with php, when i ran it on my webpage it didn't do anything. php is very close to javascript accept for that fact that you need $ signs on variables. I know semi the basics, but don't understand how your suppost to create the database or use mySQL, nore do i know how to link it with html. For example I don't even know how to make a button actually do something.
I can't find a free open source one either. I would rather make my own but i may be able to figure a little out if i find one.
Still don't know where i should go. I will check w3schools again out. Anyone else?

Actually PHP is absolutely nothing like Javascript. And if you didn't get PHP running then that would be your first step, long before you go diving head first into creating your own forum and even before connecting to MySQL.

ShawnCplus 456 Code Monkey Team Colleague

If you're on Linux you don't have a whole lot of choices but you're also in luck because of the few choices you have they're all really good. Zend Studio, Eclipse + PDT, gVim (my personal favorite) are probably the 3 biggest/best choices.

ShawnCplus 456 Code Monkey Team Colleague

If you want to write your forum from scratch instead of using one of the umpteen mature open-source forums then what's the point of looking elsewhere on how to do it. If you know the basics of PHP and MySQL then design it yourself. And by design I don't mean how it will look, I mean how it will work. What will the table structure look like, how will the forums work (will they be in hierarchical trees or flat?) Take a look at how other forums work and try to go from there.

Like I said, if you are hell-bent on writing your own then it sort of defeats the purpose if you get spoon-fed the stuff.

(And if you don't know the basics of MySQL and PHP then w3schools.com will help you out with that)

ShawnCplus 456 Code Monkey Team Colleague

It's really up to you, everyone learns differently. For you it may help you learn faster. Personally, I don't know ActionScript so I can't attest to their similarity. With PHP having so many built-in functions and a pretty short learning curve, after you learn the basic syntax you can always refer to php.net for a function.

ShawnCplus 456 Code Monkey Team Colleague

Your PHP can go anywhere since the browser never sees it but the doctype must be the first thing the browser sees followed by the html tag.

OK

<?php
// blahity blah
?>
<!DOCTYPE html blahity blah>
<html>

Not OK

<?php
echo 'Hello'; // this puts text before the doctype
?>
<!DOCTYPE html blahity blah blah>
<html>
ShawnCplus 456 Code Monkey Team Colleague

php is not a programming language it is a scripting language.

Scripting languages are programming languages.

ShawnCplus 456 Code Monkey Team Colleague

Doesn't quite work that way. There are hacks you can do but in general you'll want something along these lines

$var1 = 'yes';
$var2 = 'yes';
$var3 = 'no';
if ($var1 == 'yes' && $var2 == 'yes' && $var3 == 'yes') {
  // do something
} else {
  // do something else
}

The hacky way being

$var1 = 'yes';
$var2 = 'yes';
$var3 = 'no';
$vars = array($var1, $var2, $var3);
if ($vars === array_fill(0, count($vars), 'yes')) {
  // do something
} else {
  // do something else
}
ShawnCplus 456 Code Monkey Team Colleague

OK, I'm not sure where I tried to offend you, if I did I apologize since that was never my goal and I'm not sure why you were reiterating the point about a word game when I already cleared that up. And you can't say that something is a matter of opinion then say the other person is wrong.

I've also said nothing of your skill, I've only made mention of your choice of development principle.

One could say it is a testament to your pride as a developer that you've been a PHP programmer for 9 years and still believe in your development principles which could be considered a good thing.

ShawnCplus 456 Code Monkey Team Colleague

Well if we want to play word games you could dodge like that.
I would rather have a clever script than an elegant script, mainly because clever shows inventiveness and skill while elegant is just saying the script is pretty, graceful, and smooth. I would prefer a script that shows skill than a pretty script; tho these kinda go hand in hand. After all skill usually is accompanied by good security measures.
...
I just disagree with your statement about clever. Not trying to argue with you but this is just a play on words. You seem to be distraught about my statement.

It's not a play on words. There is a VERY large difference. Elegant can be clever but clever isn't always elegant.

And I don't mean elegant as in style like your braces are in alignment and you have consistant tabs/spaces, etc. That's not what I mean by elegant.

What I mean by elegant is the simplest solution possible to solve the problem that is A) maintainable and B) understandable. As I said, clever can be elegant but it rarely is. Cleverness lends itself to code show-boating. When programming you shouldn't be trying to prove you're the best programmer, you should be solving the problem. If you prefer coding in such a way that shows off your skills then I wouldn't want to be on your team.

Maybe I'm jaded from professional development but there is one quote that has always stuck …

ShawnCplus 456 Code Monkey Team Colleague

Saying, "Clever may be fun but it's usually not the correct solution." is just plain wrong.

Clever is usually wrong, elegant is usually right. It's when you dont know the difference when things go bad. And if you think clever is the correct answer more often than elegant then I don't want to be anywhere near your code :)

You mentioned using a whitelist, he doesn't. Like I said, there's a reason register_globals is going away.

ShawnCplus 456 Code Monkey Team Colleague

Well it looks like you're trying to input duplicate records. The fix is to not do that and to turn error_reporting off in a live environment

ShawnCplus 456 Code Monkey Team Colleague

If you don't want it instantiated then throw an exception if the constructor is called. An abstract exists to be extended, that's why you can't instantiate them.

As for the public conn, you can make it private, just add getConn/setConn methods.

EDIT: Forgot to mention, what is all this stuff?

destruct::add('database','close');
destruct::priority('database','after','session');
ShawnCplus 456 Code Monkey Team Colleague

Any reason why it's defined as abstract, do you plan on extending it later to support different DBs? Also, as a style thing, usually classes start with a capital letter and the names are CamelCased. Secondly, you might want to make _conn private given that you have public functions to open and close a connection.

ShawnCplus 456 Code Monkey Team Colleague

The correct method, using $_GET, $_POST, $_SESSION, $_COOKIE , etc. You may think it's a clever fix but it is a huge security hole. Clever may be fun but it's usually not the correct solution.

ShawnCplus 456 Code Monkey Team Colleague

Yeah, never do that. It's why register globals are deprecated and soon to be removed from the language. I repeat: DON'T DO THAT

ShawnCplus 456 Code Monkey Team Colleague

Because the Javascript gods are angry at you for reviving a 2 year old thread. On a more serious note, two things: 1) You're in onclick so you don't need javascript: , 2) You have to give something to alert() or it wont' do anything ( alert('Hello World!'); )

ShawnCplus 456 Code Monkey Team Colleague

You do realize that the error says ze1 as in z - e - one, and yours says zel as in z - e - L

ShawnCplus 456 Code Monkey Team Colleague

I am using xampp and windows.... I need to call java classes from php. How to use php java bridge... I am using php 5.2.6

Check http://php.net/manual/ before asking your questions here.

ShawnCplus 456 Code Monkey Team Colleague

D) There is any way to accomplish that? Any standard?

Can you give me a suggestion to improve search (line 67), I feel it is not powerful is just a simple query.

Optimally you want absolutely ZERO HTML in your PHP unless absolutely necessary (simple loops, conditions, etc.), having application logic (handling GET/POST, executing queries, working with files) in your "view" which is in your case HTML is bad practice whether you're using an MVC or not (I'll let you Google that).

There is a lot you could do to make it more accurate like implementing wildcards, using more than just %string% , etc. Look at the MySQL documentation for WHERE clauses and you'll get some ideas.

ShawnCplus 456 Code Monkey Team Colleague

As for B, no, it's not good to suppress error messages. If you don't want to display errors in a live environment then use the error_reporting 0 ini setting.

As for C, exactly, you got it from somewhere else, do you understand how it works and why it works?

And finally, for D: You just randomly have PHP and HTML mixed together in no particularly organized way. It makes it hard to follow, hard to maintain and just plain ugly.

ShawnCplus 456 Code Monkey Team Colleague

Use parenthesis for grouping just like math

SELECT * FROM sometable WHERE somefield = 1 AND (anotherfield = 1 OR anotherfield = 12)
ShawnCplus 456 Code Monkey Team Colleague

There's no doubt that this one has me confused but wouldn't that work for only one column of data?

I intentionally made my query vague so you can modify it to suit your needs. I was just showing you the concept of "IS NOT NULL". All of that COALESCE crap is unnecessary if you're working with single fields

ShawnCplus 456 Code Monkey Team Colleague
$query = 'SELECT somevalue FROM sometable WHERE somevalue IS NOT NULL';
$res = mysql_query($query);
if (!$res) {
  die(mysql_error());
}
$count = mysql_num_rows($res);
$total = 0;
while($row = mysql_fetch_assoc($res)) {
  $total += intval($row['somevalue']);
}
$avg = ($count === 0) ? 0 : $total / $count;
ShawnCplus 456 Code Monkey Team Colleague

You're asking how a business benefits from not having to pay for hundreds/thousands of dollars in licensing fees?

ShawnCplus 456 Code Monkey Team Colleague

Elevators shouldn't be a child of Building, they aren't buildings. You could make it public instead of going about all the hackery or adding getFloors/setFloors methods.

ShawnCplus 456 Code Monkey Team Colleague

Nope, you have to use a server-side language. Javascript lives in the browser so it can't directly touch either your server or your client's machine. You can have Javascript make a request to the server which provides a listing but Javascript itself can't.

ShawnCplus 456 Code Monkey Team Colleague

They can't. A private member can only be access from the direct parent. Even child classes can't get access to it, that's what protected is for.

http://www.parashift.com/c++-faq-lite/friends.html

ShawnCplus 456 Code Monkey Team Colleague

Start here, it answers all of your questions http://www.php.net/manual/

ShawnCplus 456 Code Monkey Team Colleague

This is a CSS issue, it should be there but you can get rid of it with this

a > img { border: none }
ShawnCplus 456 Code Monkey Team Colleague

Open up the CSS file and edit it?

ShawnCplus 456 Code Monkey Team Colleague

OK, you don't have any divs inside your CSS so I'm not entirely sure what you want to do. If you want to add more stylesheets just use

<link type="text/css" href="yourstylesheethere.css" rel="stylesheet"/>
ShawnCplus 456 Code Monkey Team Colleague

Well there should never be any HTML inside a stylesheet so you might want to show us some of your code.

ShawnCplus 456 Code Monkey Team Colleague

A) Stop using PHP4 or if you're using PHP5 STOP USING ereg
B) Stop using @, it's slow and its sole purpose is to hide errors (BAD)
C) Don't use/abuse regular expression before you understand them (Case in point "^[A-z0-9+. -]*[']?[A-z0-9+. -]*$" D) DON'T MIX LOGIC WITH HTML

ShawnCplus 456 Code Monkey Team Colleague

I'd be willing to bet the error isn't in that function. And what the heck is the point of using AJAX if you're just going to rewrite the response to your own static HTML anyway? You're completely defeating the purpose of AJAX.

ShawnCplus 456 Code Monkey Team Colleague

Try just returning false from the function. Also, in your onkeypress attribute you don't need "javascript:" it knows what you're trying to do if you just put typed(event);

ShawnCplus 456 Code Monkey Team Colleague

No, that means you're using PHP4 which is quite unfortunate.

if (!function_exists('scandir')) {
  function scandir($path, $sort = 0)
  {
    if (!$dir = opendir($path)) {
      return array();
    }
    $files = array();
    while (false !== ($file = readdir($dir))) {
      if ($file != '.' && $file != '..') {
        $files[] = $file;
      }
    }
    closedir($dir);
    return $files;
  }
}