mi.mac.rules commented: Thanks for the tip! +1
d5e5 commented: I don't know the answer but, good question. +8
I don't understand
Look here: http://jqueryui.com/demos/datepicker/
They have written the code for you. You need a copy of jquery and the jquery UI. See here for how to get them: http://jqueryui.com/docs/Getting_Started
<!DOCTYPE html>
<html>
<head>
<link type="text/css" href="css/themename/jquery-ui-1.8.16.custom.css" rel="Stylesheet" />
<script type="text/javascript" src="js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.16.custom.min.js"></script>
<script>
$(function() {
$( "#datepicker1, #datepicker2" ).datepicker();
});
</script>
</head>
<body>
<div class="demo">
<p>Date1: <input type="text" id="datepicker1"></p>
<p>Date2: <input type="text" id="datepicker2"></p>
</div>
</body>
</html>
I think you could use chown to set apache as the owner/group of /var/www
This post seems to answer your question rather well:
http://serverfault.com/questions/6895/whats-the-best-way-of-handling-permissions-for-apache2s-user-www-data-in-var-w
Don't worry, I solved it about 5 minutes after I raised the post!
I checked the apache2 modules on both systems and it seems mod deflate was enabled on the production server:
root@prod~ a2dismod deflate
root@prod~ /etc/init.d/apache2 restart
All,
I have an issue with my web server, relatively minor but something that has been bugging me:
I have two systems, both running the same spec OS, software etc... I use one as a dev server and the other as a production server.
The webpage I am rendering on the servers is holding a relatively large table (with a lot of data). (The code on both systems is exactly the same).
The problem is that on the production system, the webpage sits there for 10 seconds loading the large amount of data, then bang. It outputs the whole table.
Whereas the development system outputs the table on a row-by-row basis, giving the user an 'impression' that the page is loading much quicker. I'd like to production server to do the same.
I have no idea what the reason for this difference is. I've had a quick look at the apache config and verified that it is the same across both machines. Not really sure how to debug this...
If anyone has an idea or a hint as to what the is causing the difference in the way the page is output, please give me a shout.
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.
By default, the original HTML you posted:
<html>
<a href="http://www.daniweb.com">daniweb</a>
<a href="http://www.daniweb.com">daniweb 2</a>
</html>
Does display:
Daniweb daniweb 2
Where in the line of text do you need the space?
Can you provide some example text.
A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests a page with a browser, it will send the cookie too. With PHP, you can both create and retrieve cookie values.
There is mounds of information on this available on the web. Here's a good start... http://www.tuxradar.com/practicalphp/10/0/0 Just google it ;)
Cookies are available on the client-side, so they can be seen from the browser.
Sessions are stored on the server, and are never sent to the client (except if you write some cludge to do that). If sessions were stored on the client-side, I don't believe your PHP code would be able to access them as PHP is a server-side language. It is best to store sensitive information in a session rather than a cookie so that it cannot easily be accessed or manipulated.
The only thing is that the session cookie contains the session identifier which php uses to retrieve the proper session data.
Hope that helps.
ns
Can you not change the 'ID' attribute to a 'Class' attribute?
Look here:
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;
?>
The following links may be of interest (If you are using Apache web server):
http://evolt.org/node/22880/
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html
Well noted JasonHippy. You have provided a very complete description!
All,
I have two tables.
TABLE A TABLE B
1 1
2 2
3 3
4 4
These tables have links in the database. I.e. Table A id 4 can be linked with table B id 2. Or table B id can be linked with an id in table A)
I have added drag/drop functionality between tables to make these (many-to-many) links.
What I now need to investigate is how I could draw a visual link between the tables which illustrates which links have been established. E.g:
If anyone knows of such a tool, or anything similar which could illustrate links (colors/3D tables/graphs etc.) then please let me know.
Cheers,
ns
Make sure you have the relevant driver for your dongle/wifi card. Also make sure that the card manufacturer has driver support for your distro. You can usually find out on the manufacturers website.
Here are some helpful pointers:
With your computer turned off, insert your wireless adapter into a suitable port/slot.
Turn on your computer and log-in if/when prompted.
Open a terminal window and enter the following command:
nm-tool
This program will output the information Network Manager has collected about your card, much of which will assist in setting-up wireless networking .
If the output contains:
State: connected
(and you are not on a wired connection) then your wireless adpater is working and connected to a network.
Left-click on the panel applet (four vertical bars in 9.10 or older; 4 concentric arcs in 10.04). If you can see wireless networks, then your wireless works; you need to connect to a network. See below on network connection.
1.3. Troubleshooting Steps
Troubleshooting wireless networks in Ubuntu can be approached in three steps in order:
Check that your wireless adapter is enabled and that Ubuntu recognizes it: see Device Recognition and Operation.
Check if drivers are available for your wireless adapter; install them and check them: see Device Drivers.
Check your connection to the Internet: see Wireless Connections.
If it still does not work, ask a question at Launchpad, Ubuntu's official help: instructions.
Go to your root directory:
# sudo find . | xargs grep -i 'NameOfFunction'
grep is the tool to use.
Got it...
function myHelper( event ) {
var id = this.getAttribute("req_id");
var div = "<div class='draggableHelper'>"+ id +"</div>";
return div;
}
<tr class='draggable' class='ui-widget-content' req_id='$req_id' req='$req_tag' onChange='myHelper(this);'><td>$req_id</td><td>$req_tag</td></tr>
Hi there,
I am in the process of implementing draggable/droppable interaction using the JQuery UI. This is something that I have very little experience with so please be gentle.
I can drag and drop using <tr> elements which looks great, but I need to get the <tr> attributes (perl variables) into jquery so that I can pass some variables to AJAX to process the data.
Previously, I would use the onClick event handler and use the 'this' keyword to get the element attributes. However, with JQuery, the function is called when I start dragging the rows:
<script>
$(function() {
$( ".draggable" ).draggable({
cursor: 'move',
containment: 'document',
helper: myHelper
});
$( ".droppable" ).droppable({
drop: function( event, ui ) {
$( this )
.addClass( "ui-state-highlight" )
.find( "p" )
.html( "Dropped!" );
}
});
});
function myHelper( event ) {
return '<div id="draggableHelper">Want to display the ID and Title here</div>';
}
</script>
and the <TR> elements are populated using Perl/DBI in a loop:
while (scalar @q > 0)
{
print "<tr class='draggable' class='ui-widget-content' req_id='$req_id' req='$req_tag'><td>$req_id</td><td>$req_tag</td></tr>";
}
So my question is how to pass the req_id and req_tag variables into the jquery helper function.
Thanks,
ns
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
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.
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.
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.
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 …
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
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>";
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.
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
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
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
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)
The answer:
"Straight FTP is, by nature, quite insecure, since neither the
authentication nor the traffic are in any way encrypted."
I'd use SSH/SCP or SFTP instead:
MobaXterm is one of my personal favourites. Or you could try WinSCP which allows you to select which protocol you want to connect over.
Fantastic, thanks very much
Have you tried
sudo iwlist scan
Or if not, there may be some gui options available in network-manager?
All, I have a simple question.
What is the standard procedure for retrieving form values via POST method in a web form? Perl can be extremely awkward for web programming, I'd normally use something else, but in this case I need to use Perl for the CPAN module.
Anyway, back to the point, If I have a basic html form, how do I get the values out in verify_login?
<form name="login" action="$cgidir?action=verify_login" method="POST">
<input type="text" name="user">
<input type="password" name="pass">
<input type="submit" name="login" value="Login">
</form>
Your post isn't too clear. If POST works, then why are you changing it to GET?
Can you include your html form as this would make things clearer?
<form name="user" action="page.php" method="POST">
<input type="text" name="textfield">
<input type="submit" name="sub" value="Login">
</form>
<?php
if(isset($_POST['sub']))
{
if(isset($_POST['textfield']))
{
$q = mysql_query("SELECT codas FROM t WHERE user = '$_POST['textfield']'") or die(mysql_error());
}
else
{
echo "can't retrieve the form value";
}
}
?>
There's no command that I know of that will do this. Unless you can find a tool/log analyser to do the leg work, you'd have to write some scripts yourself to achieve what you want, and it may require a considerable amount of work to implement.
This maybe of some help (Taken from this thread):
"Another option would be to set up BIND (DNS server) on the Linux system. Internal to BIND, you can turn on logging for all DNS querries. In a typical environment, most of the DNS querries are for web pages, so most of what you would see would be the web sites visited. However, if they were accessing news servers, chat rooms, etc., you will see that too.
In my case, I have 4 PCs at home in a network. 3/4 run WinXP, and the 4th runs SUSE v9. The SUSE system runs BIND, and is set up as the primary DNS server for the other 3 PCs, and has full logging turned on. 2/4 of the WinXP machines belong to my teenagers. Since the SUSE system is the primary DNS, and has logging enabled, I can see everything they do, without them knowing that I'm watching. I use Norton Internet Security on all of the WinXP systems, and have parental controls enabled, so the kids aren't able to get to much in the way of "bad" stuff, but I can still see what they are doing any time I need …
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;'
I have added a png image to a table in the database as a BLOB. Adding the image into the database is trivial. However, being able to display the BLOB back to the .png image format is bewildering me.
Examples are hard to come by... How to display the BLOB back to the image?
This simple example only displays the raw binary data:
my (@images) = query("SELECT name FROM test_file WHERE id='$id'");
foreach my $img(@images)
{
print $img; # Displays the blob gobble de gook
}
I have heard people using BINMODE but again, I can't get that to do anything useful:
open(IMAGE, ">/tmp/file.png");
binmode IMAGE;
print IMAGE $img;
close(IMAGE);
Any examples are much appreciated.
Regards,
ns
For those who may be interested,
I never found out the cause of the problem, but I uninstalled MySQL 5.1 and went back to 5.0 which sprung it into life again.
All,
I have been trying to debug this problem all weekend but I haven't been able to get any closer to the solution...
I have just upgraded Mysql to 5.1 from 4.1 on a Red Hat 4 box. Everything is fine. I can connect to the database using the shell, I can connect to the database using a Perl script using DBI (also from the shell), However I cannot connect to the database using a Perl/CGI (inside Apache).
All I get is this error:
Bad handshake at line 123
That line is actually referring to the DBI->connect function.
my $dbh = DBI->connect('DBI:mysql:test:'.get_db(), 'root', '') or die $DBI::errstr;
I have scoured the internet looking for solutions, but I haven't found anything of much help. My original thought was that it was something to do with the DBD::mysql driver. But usually the mysql-shared-compat rpm takes care of that for me... Does anyone know any of the modules/packages I'd need to recompile?
Any help is greatly appreciated.
I'm not 100% sure what you're trying to do, but this old thread may help with parsing your html:
Issuing a command prefixed with sudo means that you're issuing the command as the 'root' user. (Which gives you the proper privileges to invoke the command.)
E.g. You won't be able to write to any files in the root file system '/' /(/etc /usr) unless you have root access. This is what makes linux so secure compared to windows.
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
Ah yes, I just found the 'variable variables' man page. I shall try and implement this properly tomorrow.
Many thanks
ns
I have a foreach loop, within which I would like to create x number of unique variables.
E.g. Upon each iteration I'd like to create a new variable like:
$strDisk1 = ...
$strDisk2 = ...
$strDisk3 = ...
I have tried the following but this does not work:
<?php
$count=1;
foreach ($disk as $device)
{
$strDisk.$count = "<dataset seriesName='$device'>";
$count++;
}
?>
Is there something which will enable me to do this?
-Click YouTube Video Download
If you're using Mozilla Firefox, then you can install this add-on https://addons.mozilla.org/en-US/firefox/addon/1-click-youtube-video-download/
Yep, my vote goes to Git
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