nonshatter 26 Posting Whiz

Depending on what browser you are using, I'd recommend installing a browser extension so that you can get some sort of log message to show what part of your js code is failing.

I use the developer tools compatible with google chrome. Firebug is another good alternative.

In addition, you can use this great code quality tool called JSLint which will provide you with excellent code analysis and prevent you from falling into bad practices when coding your javascript.

nonshatter 26 Posting Whiz

Look here:

http://api.jquery.com/load/

Depending on how often you want your feed to be updated you could use a Javascript setInterval() function to repeatedly call the .load ajax feed.

Here is something I've used in the past (to update a price of an item every couple of seconds).

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function updateBids() {
	var url="getprice.php?auc=<?php echo $id; ?>";
	jQuery("#priceElement")<strong class="highlight">.load</strong>(url);
}

<strong class="highlight">setInterval</strong>("updateBids()", 1000);
</script>
</head>
<body>
Here is the price: <div id="priceElement"></div>
</body>
</html>

Simple (behind-the-scenes) PHP script to fetch data from db:

<?php

// Anything printed on this page will be loaded into the priceElement <div>

                include ('db.php');

		$id = $_GET['auc'];
		$getprice = mysql_query("SELECT b_currentprice FROM bid WHERE auction_id = '$id' ORDER BY b_timestamp DESC");
		$resultprice = mysql_fetch_assoc($getprice);
		
		$price = $resultprice['b_currentprice'];
		echo $price;
?>
nonshatter 26 Posting Whiz

Well noted JasonHippy. You have provided a very complete description!

nonshatter 26 Posting Whiz

Go to your root directory:

# sudo find . | xargs grep -i 'NameOfFunction'

grep is the tool to use.

nonshatter 26 Posting Whiz

Yup, that wasn't the best idea. Get an original back in place asap. (You shouldn't need to edit it at all to get ldap working).

apache2 -l

Will display the pre-compiled modules.

I have core.c, mod_log_config.x, mod_logio.c, prefork.c, http_core.c, mod_so.c

nonshatter 26 Posting Whiz

I have never seen that problem before. You said you were using ubuntu?

From a bare-metal install, all I ever had to do to enable LDAP was:

# sudo apt-get install apache2
# a2enmod authnz_ldap
# /etc/init.d/apache2 restart

Did you install Apache via apt-get or did you build everything manually?

From my experience, I've never had to configure httpd.conf to enable the modules for me as a2enmod does it for you. You could try removing your edits from this file then re-enabling the mods.

Inside the folder /etc/apache2/mods-enabled/ we will find all the enabled modules. Here we will find symlinks to the files from mods_available for all the enabled modules. Only the modules found in this folder will be enabled at run time.

nonshatter 26 Posting Whiz

Actually, this may be because you're missing the APR Apache/LDAP driver.

sudo apt-get install libapr1 libaprutil1 libaprutil1-ldap

Try these then restart apache.

nonshatter 26 Posting Whiz

There is a syntax error in your configuration file. You should be using /usr/local/apache2/sites-available/default to configure the directives in apache.

But it looks like you have edited httpd.conf. Perhaps you are using a deprecated directive? Can you post lines 60-70 of httpd.conf so I can have a look.

Have you enabled the LDAP modules? This is the one you need:

sudo a2enmod authnz_ldap

Once you enable the module, the module will be available in the the /apache2/mods-enabled/ directory.

nonshatter 26 Posting Whiz

Yes you can symlink them.

Although I'm not sure why you have installed the server in /usr/local/

For next time, I'd recommend using the standard installation paths for your software.

Here's a breakdown of the files/folders used in Apache 2.2 Web Server that I found really helpful:

The new version of Apache 2.2 means that there is a different file structure for its configuration files.

[B]apache2.conf:[/B] the main Apache2 configuration file. Contains settings that are global to Apache2.

[B]conf.d:[/B] contains configuration files which apply globally to Apache2. Other packages that use 
        Apache2 to serve content may add files, or symlinks, to this directory.
[B]
envvars:[/B] file where Apache2 environment variables are set.

[B]httpd.conf:[/B] historically the main Apache2 configuration file, named after the httpd daemon. 
            The file can be used for user specific configuration options that globally effect Apache2.

[B]mods-available:[/B] this directory contains configuration files to both load modules and configure them. 
                Not all modules will have specific configuration files, however.

[B]mods-enabled:[/B] holds symlinks to the files in /etc/apache2/mods-available. 
              When a module configuration file is symlinked it will be enabled the next time 
              apache2 is restarted.

[B]ports.conf:[/B] houses the directives that determine which TCP ports Apache2 is listening on.

[B]sites-available:[/B] this directory has configuration files for Apache2 Virtual Hosts. 
                 Virtual Hosts allow Apache2 to be configured for multiple sites that have 
                 separate configurations.

[B]sites-enabled:[/B] like mods-enabled, sites-enabled contains symlinks to the 
               /etc/apache2/sites-available directory.
               Similarly when a configuration file in sites-available is symlinked, 
               the site configured by it will …
nonshatter 26 Posting Whiz

Try using:

sudo apt-get install libapache2-mod-auth-cas

then use the command below to enable the module

a2enmod auth_cas

restart the apache server

/etc/init.d/apache2

and you should be golden

mi.mac.rules commented: Thanks for the tip! +1
nonshatter 26 Posting Whiz

try using the COUNT() function in MySQL. Replace 'record_id' with the name of the column in your table.

$query = mysql_query("SELECT COUNT(record_id) AS counter FROM table");
$result = mysql_fetch_assoc($query);
echo "Sent to $result['counter'] People <br>";
nonshatter 26 Posting Whiz

Have you checked your apache log file for hints/error messages?

The log file should be located at:

C:\xampp\apache\logs\error.log

It usually provides more descriptive error messages and will save endless hours of debugging/smashing your head against the screen.

nonshatter 26 Posting Whiz

Hmm. Looks like it's something to do with the content-type in your page.

I think if you send the following header before outputting your image that will do the trick - you need to tell the browser that you are sending image data and not anything else.

header('Content-Type: Image/JPEG');

This thread may be of some help

nonshatter 26 Posting Whiz

Okay, you will need to apply permissions to the top-level directory to which you wish to write a new folder to.

E.g. If you're attempting to write to C:\xampp\htdocs\1\slides
Then you will need to apply write permissions to the C:\xampp\htdocs directory

nonshatter 26 Posting Whiz

I believe the chmod command will only work on a Linux-type OS's whereas you're using XAMPP for Windows.

1. Navigate to this directory $mapbeschrijving/$slides 1/slides or whatever it is (The directory you are attempting to write the file to),
2. Right click on directory -> select properties -> you should be able to edit the permission settings of this directory. (I am using Windows 7, there's a tab called 'Security' where I can change the write permissions of that directory)
3. Enable write permissions
4. Retest and post back the result

nonshatter 26 Posting Whiz

I think it's because your db connection code is only being called in the first else condition.

Move include('db.php'); near the top of the file (outside of any if/else condition)

nonshatter 26 Posting Whiz

Have you tried

sudo iwlist scan

Or if not, there may be some gui options available in network-manager?

nonshatter 26 Posting Whiz

unexpected T_CASE means you have a case statement that has somehow become disconnected from it's switch.

Are you showing the whole switch statement in the code you posted?

A switch statement should be formed as follows (Taken from the PHP manual):

switch ($i) {
    case 0:
        echo "i equals 0";
        break;
    case 1:
        echo "i equals 1";
        break;
    case 2:
        echo "i equals 2";
        break;
}
?>

Check whether your statement follows this structure. Also, I notice that you have an unmatched closing brace after the last 'break;'

nonshatter 26 Posting Whiz

It depends on your directory structure.

Issue this command to find your base directory:

~# cat /etc/apache2/sites-available/default | grep DocumentRoot

For example, if your document root is set as /var/www/htdocs

Then the URL localhost/phpmyadmin would mean that the phpmyadmin folder is located in /var/www/htdocs. If the phhpmyadmin folder isn't in there, then your path is wrong.

Hope that makes sense,
Regards,
ns

nonshatter 26 Posting Whiz

Hi to all,
i created following table in SQL.
===================================

create table employee(name varchar(20), dob date)

===================================

But, when i ran the query, i got the massage that 'SQL can not find data type 'date''.
How should i include 'date' in to table definition.

You have a number of options. DATETIME, DATE, TIMESTAMP etc. Depending on what format you want to store your dates as. See here for definitions: http://dev.mysql.com/doc/refman/5.0/en/datetime.html

nonshatter 26 Posting Whiz
SELECT MAX(age), name FROM man WHERE city='mumbai';

should work?

nonshatter 26 Posting Whiz

use dd for creating a large backup, otherwise just use a simple cp command,

Copy /homedirectory/filename to /yourflashdrive/filename:

cp /home/filename /media/sdb1/filename
nonshatter 26 Posting Whiz

Hi there, I'd use FusionCharts.

They have great documentation

Your code would be something like this:

<?php
      //We've included ../Includes/FusionCharts.php, which contains functions
      //to help us easily embed the charts.
      include("../Includes/FusionCharts.php");
      ?>
      <HTML>
         <HEAD>
        <TITLE> FusionCharts - Array Example using Single Series Column 3D Chart</TITLE>
        <SCRIPT LANGUAGE="Javascript" SRC="../../FusionCharts/FusionCharts.js"></SCRIPT>
     </HEAD>
     <BODY>
     <?php
         // YOU COULD RETRIEVE DATABASE VALUES, THEN PUT THEM INTO THESE ARRAYS:

         //In this example, we plot a single series chart from data contained
   //in an array. The array will have two columns - first one for data label
   //and the next one for data values.
   //Let's store the sales data for 6 products in our array). We also store
   //the name of products. 
         //Store Name of Products
         $arrData[0][1] = "Product A";
         $arrData[1][1] = "Product B";
         $arrData[2][1] = "Product C";
         $arrData[3][1] = "Product D";
         $arrData[4][1] = "Product E";
         $arrData[5][1] = "Product F";
         //Store sales data
         $arrData[0][2] = 567500;
         $arrData[1][2] = 815300;
         $arrData[2][2] = 556800;
         $arrData[3][2] = 734500;
         $arrData[4][2] = 676800;
         $arrData[5][2] = 648500;
         //Now, we need to convert this data into XML. We convert using string concatenation.
         //Initialize <chart> element
         $strXML = "<chart caption='Sales by Product' numberPrefix='$' formatNumberScale='0'>";
         //Convert data to XML and append
         foreach ($arrData as $arSubData)
         $strXML .= "<set label='" . $arSubData[1] . "' value='" . $arSubData[2] . "' />";
         //Close <chart> element
         $strXML .= "</chart>";
         //Create the chart - Column 3D Chart with data contained in strXML
         echo renderChart("../../FusionCharts/Column3D.swf", "", $strXML, "productSales", 600, 300, false, true);
        ?>
  </BODY>
</HTML>
nonshatter 26 Posting Whiz

Yes it's possible. Although it may take some time to code (and render) each graph.
I'd look at fusioncharts. They provide a free trial which have the best PHP-driven charts.
Alternatively, if you can generate images of these graphs (or if they don't need to be dynamic) then simply display the image. This would save you a lot of time.

nonshatter 26 Posting Whiz

1. I use Gnome, but KDE is just as good. I personally don't prefer one over the other.
2. The partitioning software on disk will work fine. Just make sure you know a bit about the partitioning formats to use for linux and windows as some provide more benefits over others. Fedora partition will probs use ext3. Decide how much space you want for each partition. Windows (NTFS/FAT), Linux(EXT3), Linux Swap Space. You could even use a FAT32 partition for sharing data between Windows and Linux.
3. Pretty much any linux distro will run faster than windows. I wouldn't be too concerned about this.
4. Here's a good link to read if you want to know more...
http://www.thpc.info/dual/win7/dualboot_win7+fedora11_grub_on_win7.html

nonshatter 26 Posting Whiz

I presume you're using a wireless card for the connection? If so, make sure that Ubuntu has the driver support for you wireless card. I remember being stuck for days with this problem...

You should check this with your wireless card manufacturer website

nonshatter 26 Posting Whiz

I generally tend to use a Unix timestamp, but I'm not really sure what the 'best' format is. This link explains mysql date formats

You can convert a unix timestamp to a human-readable format using the date() function. You can format the date format to your liking:

$timestamp = 1296143233;
$formattedtime = date("d/m/y", $timestamp)

Or to turn a date back into a timestamp, use strtotime():

$date = "01/01/1970";
$date2timestamp = strtotime($date);
nonshatter 26 Posting Whiz

The $_SERVER superglobals provide a load of useful information.

$ip = $_SERVER['REMOTE_ADDR'];     // The IP address from which the user is viewing the current page.
$time = $_SERVER['REQUEST_TIME'];  // The timestamp of the start of the request.     
$port = $_SERVER['REMOTE_PORT'];   // The port being used on the user's machine to communicate with the web server.   
$browser = $_SERVER['HTTP_USER_AGENT']; // Contents of the User-Agent (Web browser): header from the current request

// etc...

See here

nonshatter 26 Posting Whiz

"the return() statement immediately ends execution of the current function". See here
Therefore, the first line of code being executed in your function is returning the session variable and returning back to the area of code that the function was originally called from.

nonshatter 26 Posting Whiz

Either:
1 - PHP isn't installed correctly:
create a script like this, save it as info.php or something and test it in the same way you have been doing

<?php
   phpinfo();
?>

2 - You haven't placed <?php ?> tags around your script.
3 - Could be some other content-type problem with apache

Post your code if you're still having problems

nonshatter 26 Posting Whiz

Have you tried replacing the underscores with its html entity code?
In this case underscore is:

& # 9 5 ;

(without the spaces) See here
Might be worth a try...

nonshatter 26 Posting Whiz

Does that command run in your terminal? If it does then all you need to do is to to edit crontab and add the format to schedule the backup. How often do you want to run the command?
See here for the format to use for scheduling tasks in crontab

nonshatter 26 Posting Whiz

The thumbnails you're creating don't have the correct permissions to be written/read from your web server. Are you using a local server or a web hosting service?

nonshatter 26 Posting Whiz

I'm not sure, but maybe try using if ($choice == 'yes')

nonshatter 26 Posting Whiz

It looks like your DNS configuration may need changing as your URL isn't being resolved across the LAN. Check your named.conf file and set up your forward and reverse lookup zones.

This link seems to answer what you're asking :)

nonshatter 26 Posting Whiz

Yes you're correct. A lot of old school programmers love vi, and that's all I use in work. It's because we use Subversion for version control, and it's good to keep everyone using the same editor for consistencies in the team.

If I was working alone, then I'd most likely use a graphical editor like gedit.

nonshatter 26 Posting Whiz

you probably don't have vim, as this is an extension of Vi (although essentially it is the same thing). try this to get vim (if you're using debian os):

sudo apt-get install vim

I have a great cheat sheet for vi, but it will take practice to learn how to use it effectively.

Here are some of my most used commands for vi/vim:

i - enter input mode
esc - escape input mode
del - delete text
:q - quit
:wq - write and quit
:q! - quit without saving
dd - deletes a whole line
shift+a - goes to the end of a line and enter input mode

As for the ex command, I'm not sure what that does without being able to test it.

nonshatter 26 Posting Whiz

Cool, I'm glad you got it working!
Please mark the thread as solved if the solution was adequate.
Regards,
ns

nonshatter 26 Posting Whiz

Isn't ereg_replace() deprecated now? Take a look into using preg_quote() instead.

Here's an example:

<?php
// In this example, preg_quote($word) is used to keep the
// asterisks from having special meaning to the regular
// expression.

$textbody = "This book is *very* difficult to find.";
$word = "*very*";
$textbody = preg_replace ("/" . preg_quote($word) . "/",
                          "<i>" . $word . "</i>",
                          $textbody);
?>

This should work the same with asterisks as it does for double quotes

nonshatter 26 Posting Whiz

Hmm, that's strange. Are you running in sudo mode?

sudo apt-get install emacs

If that still fails, try creating a new sources.list file. And save your original one as sources.list.1 so you don't lose it. Here's what mine has (I'm using the same version of Ubuntu (I am in the UK)):

#deb cdrom:[Ubuntu 10.04.1 LTS _Lucid Lynx_ - Release i386 (20100816.1)]/ lucid main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb http://gb.archive.ubuntu.com/ubuntu/ lucid main restricted
deb-src http://gb.archive.ubuntu.com/ubuntu/ lucid main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://gb.archive.ubuntu.com/ubuntu/ lucid-updates main restricted
deb-src http://gb.archive.ubuntu.com/ubuntu/ lucid-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://gb.archive.ubuntu.com/ubuntu/ lucid universe
deb-src http://gb.archive.ubuntu.com/ubuntu/ lucid universe
deb http://gb.archive.ubuntu.com/ubuntu/ lucid-updates universe
deb-src http://gb.archive.ubuntu.com/ubuntu/ lucid-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://gb.archive.ubuntu.com/ubuntu/ lucid multiverse
deb-src http://gb.archive.ubuntu.com/ubuntu/ lucid multiverse
deb 
       
nonshatter 26 Posting Whiz

And the name of the package you're trying to download?

nonshatter 26 Posting Whiz

Okay, What package are you trying to install exactly?

Can you post the output of the following:

cat /etc/apt/sources.list

and

uname -a

Another idea is to use 'Synaptic package manager' to download the package. This is found in system >> administration >> synaptic (if you're using the Gnome desktop environment)

nonshatter 26 Posting Whiz

Okay, it's good that you're interested!

Let's take an example:
You have a file which is 1Gb in size. You know that opening the file in the shell (e.g using 'cat') is going to be inefficient, as you'll have to scroll through a lot of lines to get to where you want to look. So less and more are basically alternatives to save resources and/or to only select the information that you're interested in.

The default behaviour of more is that the file content scrolls up one screen height at a time, and the space bar is used to advance to the next page. The command less is a more sophisticated version of more. Less can scroll backwards and has many more options over more. (There is plenty of information about this on the web).

If you're viewing a large log file and are only interested in what's happened most recently, then I would usually recommend using 'tail -f file.log' which would display the last 'x' number of lines of that file.

nonshatter 26 Posting Whiz

Shama,
You'll need to be a bit more specific. What Linux are you running? What command are you issuing to get that error? I guess you're using Ubuntu?

You could try

sudo apt-get update               // This will update your repository

and then

sudo apt-get install < name of package >
nonshatter 26 Posting Whiz

Yes this is possible. But the solution will depend on whether the $from variable always starts with INTERVAL, or whether it changes...

If it is always going to start with INTERVAL, then you could use a simple substr() function to cut off the first word. This simply says to print everything after the 8th character, counting I as 0, N as 1, T as 2 etc.

<?php
    $new_from = substr($from, 8);
    echo $new_from;
?>

The syntax for substr is

string substr ( string $string , int $start [, int $length ] )

Alternatively, if the first word changes you could look into using explode() (using space as the delimiter)

<?php
// Example
$pizza  = "piece1 piece2 piece3 piece4 piece5 piece6";
$pieces = explode(" ", $pizza);
echo $pieces[0]; // piece1
echo $pieces[1]; // piece2 
?>
nonshatter 26 Posting Whiz

You get this error message because you're trying to retrieve $_GET from the URL when it doesn't exist. Why not check whether the variable exists before deciding what to do with its value.

E.g.

<?php
    if (isset($_GET['start'])) { $start = $_GET['start']; } 
    else { $start = 0; }  
?>

Alternatively, add the start variable in the URL that links to the first page, then you wouldn't have this problem.

<a href="/VIEW_in_STEPS5b.php?start=0"
nonshatter 26 Posting Whiz

I developed an online auction website for my final yr project. It's a pretty good project to do - lots of potential for interactive and business-like features.

And to add to that - in my opinion, for a final year project it shouldn't really matter if a jQuery feature doesn't work with a certain version of a web browser... So long as you can explain why it may not work, perhaps providing an alternative feature or workaround for older/incompatible browsers!

nonshatter 26 Posting Whiz

where's the code

nonshatter 26 Posting Whiz

The query will still work even if there isn't a space between the asterisk and the 'FROM'
The query looks fine. The issue is most likely with the variable not being set.
Try this and post the result:

<?php
    $show = $_GET['id'];

    if (isset($show))
    {
        $news_sql = mysql_query("SELECT *FROM latestnews WHERE id='$show'") or die("MySQL syntax error: ". mysql_error());
    }
    else { die ('$show isn't set! the $_get didn't work...'); }
?>

Note:- The $_GET must mean that the URL has a variable called 'id' (www.site.com/script.php?id=2)
And say I used $_GET then the url should be something like (www.site.com/script.php?foo=bar)

nonshatter 26 Posting Whiz

You can still use the $_GET method to grab variables from your URL using form method="post", but you'd have to append the Id variable to the form action like this:

<form action="<?php 'process.php?id=$id' ?>" method="post">

(that's if you're actually using a form, you haven't stated whether you are).

Can you be a bit more specific with what you're trying to do?