SELECT MAX(age), name FROM man WHERE city='mumbai';
should work?
SELECT MAX(age), name FROM man WHERE city='mumbai';
should work?
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
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>
This should get you started. The code is from this tutorial which I used when I created my first login script. Obviously it will require some editing for connecting to your database and retrieving user information from your tables etc.
I'd also look into using a stronger encryption algorithm for passwords rather than using MD5.
http://www.evolt.org/node/60265
<?
/**
* Checks whether or not the given username is in the
* database, if so it checks if the given password is
* the same password in the database for that user.
* If the user doesn't exist or if the passwords don't
* match up, it returns an error code (1 or 2).
* On success it returns 0.
*/
function confirmUser($username, $password){
global $conn;
/* Add slashes if necessary (for query) */
if(!get_magic_quotes_gpc()) {
$username = addslashes($username);
}
/* Verify that user is in database */
$q = "select password from users where username = '$username'";
$result = mysql_query($q,$conn);
if(!$result || (mysql_numrows($result) < 1)){
return 1; //Indicates username failure
}
/* Retrieve password from result, strip slashes */
$dbarray = mysql_fetch_array($result);
$dbarray['password'] = stripslashes($dbarray['password']);
$password = stripslashes($password);
/* Validate that password is correct */
if($password == $dbarray['password']){
return 0; //Success! Username and password confirmed
}
else{
return 2; //Indicates password failure
}
}
/**
* checkLogin - Checks if the user has already previously
* logged in, and a session with the user has already been
* established. Also checks to see if user has been …
First try creating a symlink to the correct module.
sudo ln -s /etc/apache2/mods-available/include.load /etc/apache2/mods-enabled
Then you can edit your /etc/apache2/sites-enabled/xxxxx file to allow ssi functionality
http://httpd.apache.org/docs/current/mod/mod_include.html
http://steveyoung.wordpress.com/2007/02/
Pretty much any CD/DVD burner will work with a Linux system. You should just double check that there is a linux-supported driver for it.
Depends what OS you're using. Also, I don't think any Linux distro stores 'ALL' network information in one place. It all depends what aspect of the network you want to configure. E.g. DHCP, DNS, NIC.
Tell me what OS you're using and I'll be able to advise further
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.
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
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
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);
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...
First of all, you can't 'convert' or 'rewrite' this as php. Why don't you just put it all in one PHP function?
<?php
function stuff() {
?>
//html and stuff here
<?php
}
?>
"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.
It all depends, but Perl would be a suitable programming language to knock up a quick and dirty script that will pattern match and insert into your database.
See here for opening file handles:
See here for regular expressions - (Formulate these in order to match the strings you are interested in).
See here for a MySQL database interface in Perl:
There is plenty of information out there. Let me know if you need any help.
Cheers,
ns
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
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...
You could start with a really simple distro and hack/mod the crap out of it!
A good starting place is Linux From Scratch Another good distro could be Debian netinst
I assume you're referring to Ubuntu. And yes, as it is a linux OS, of course you can practice using it.
Ubuntu was my first Linux OS... You can get it using a Live CD or install the full OS through VirtualBox
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
You have a couple of options here.
1. Cygwin - a collection of tools which provide a Linux look and feel environment for Windows. This runs on top of windows as a linux OS. (I'd probably start with this).
2. VirtualBox - run a number of virtual machines inside windows.
3. Get a Live CD - depending on what linux distro you want, you can get Live CDs or USBs that run a Linux OS on your system without having to physically install anything to your hard drive.
It all depends on the application. Just to name a few testing procedures:
- CSS/HTML validation
- Performance testing
- Link validation
- Cross-browser compatibility
Here's a link that provides tools you can use to do this: http://www.graphicrating.com/2009/08/11/15-tools-for-testing-your-website/
Great, glad you got it working. If you wanted to omit the null values from the chart, simply make a check using an if statement, something like:
if($transmissionValue != 0)
{
$data = array($transmissionValue);
}
Disabling the microcode update for your machine should stop this error:
/sbin/service microcode_ctl stop
/sbin/chkconfig --del microcode_ctl
Can you get any JPgraph example charts to render? Can you verify that the GD library is installed with your PHP?
This tutorial looks bang on to what you're trying achieve. Have a ganders. Good luck!
Until you get the values into your array then of course you will still get that error code!
I expect that JPGraph expects the input to be something like:
$data = array(40,21,17,14,23);
At the moment, you're trying to put a whole row into an array, rather than the integers that are needed for the graph.
What exactly are the values you are trying to plot? Try hard coding them into your array first to see if jpgraph actually likes/plots them. Then concentrate on getting the values from database->array->jpgraph
Okay, undefined index means you're referring to an array value that doesn't exist. Try putting the data into your $service_area[] array ike this:
$sql_2 = mysql_query("SELECT servicearea FROM additional_cars WHERE servicearea = '$servicearea'");
while($dataplot = mysql_fetch_assoc($sql_2)) //while there are results from your query, put them into the service_used array
{
$service_used[] = $dataplot['servicearea'];
}
Hi there, I have no idea what that error code is referring to. But I'd recommend checking the values within the arrays you're trying to plot from.
I'd use FusionCharts with PHP for really good charts and documentation.
g++ is a C compiler. Use this command through your terminal to install it.
sudo apt-get install build-essential
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?
I'm not sure, but maybe try using if ($choice == 'yes')
The image will be based on database values that are updated when a new piece of equipment is added to the network. The image will need to be re-generated on a page refresh - I'm not too fussed on real-time or AJAX type of stuff, but I guess I don't really mind. It would also be desirable to display information such as ip addresses, connection types, port numbers, storage enclosures etc. The prettier the better, the faster the better ;)
Hi all,
Does anyone know of any software/classes that can be used to generate images of network diagrams? We are using a tool called Graphviz using Perl at the moment but the diagrams are looking a little bit dated! The networks will be pretty small, consisting of 3 or 4 servers along with two or three other types of equipment.
Any ideas or suggestions are much appreciated.
Cheers
I can't give a specific solution based on what you've provided. What are you using to generate your graph? Is your character encoding set to UTF-8?
Have a look into 'Fusion Charts' which is pretty good for graphing in PHP and AJAX.
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 :)
Your php.ini settings are probably incorrect.
You should use include('dbconnect.php'); rather than include=dbconnect.php;
It all depends. What are your requirements? What do you want to achieve?
have you tried
lsusb
or
fdisk -l
Not sure if that will give you the required information though...
It worked using the .load() technique! Thanks for your help mate.
Brilliant, I will try this tomorrow and get back to you with the result.
Thanks again
You can use the isset() function in XXX2.php to check which boxes were or were not selected.
in XXX2.php
//first check the submit was pressed
if (isset($_POST['s']))
{
//then check if a checkbox was selected.
if (isset($_POST['name-of-checkbox1']))
{
echo "checkbox 1 was selected";
// execute database action here
}
if (isset($_POST['name-of-checkbox2']))
{
echo "checkbox 2 was selected";
// execute database action here
}
if (isset($_POST['name-of-checkbox3']))
{
echo "checkbox 3 was selected";
// execute database action here
}
}
You will need to give your checkboxes unique names for this to work properly.
Thanks for your input scrappedcola, It's really helpful. I haven't tried to implement your solution yet, but I just came across this JQuery/AJAX method which may also work:
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js" /></script>
<style type="text/css">
.box {
background-color: #504D6F;
border: 1px solid #FFF;
color: #FFF;
height: 200px;
width: 200px;
padding: 5px;
}
</style>
<script type="text/javascript">
function displayPanel(id)
{
document.getElementById(id).style.display = 'block';
document.getElementById('feeds').style.display = 'block';
updateInfo();
}
function hidePanel(id)
{
document.getElementById(id).style.display = 'none';
document.getElementById('feeds').style.display = 'none';
}
function updateInfo() {
$("#feeds").load("ajax.cgi");
}
</script>
</head>
<body>
<a href="test.com" onMouseOver="displayPanel('box'); return false;" onMouseOut="hidePanel('box');">Link 1</a><br>
<a href="test.com" onMouseOver="displayPanel('box'); return false;" onMouseOut="hidePanel('box');">Link 2</a>
<span id="box" class="box" style="display: none;">
Host Information
<div id="feeds"> </div>
</span>
</body>
</html>
The updateInfo() function will execute the ajax.cgi script and print whatever was returned into the #feeds div. If I could pass the equipment id through the URL e.g. ajax.cgi?equip=$equip_id then I could handle the generation of dynamic content in this file alone. Although then again, I will still have the same problem determining which link was hovered over, right? Which will leave me with exactly the same scenario...
Do you have any suggestions/comments/objections on this?
Hi all, I'm relatively new to JS and I have an issue which I can't seem to get my head around...
I have a perl script which iterates through an array and populates a table with its values. Within the created table I have a link in each row which calls a js function onMouseOver(). I have tried to simplify this as much as possible.
foreach $equipment (@some_array) {
"<a href='some_script' onMouseOver=displayPanel('box'); onMouseOut=hidePanel('box');><b>$equipment</b></a>";
}
print "<span id='box' class='box' style='display: none;'>";
print "<strong><u>Host Information:</u></strong><br>";
// dynamic content to be displayed here depending on which link is hovered over
print "</span>";
These JavaScript functions hide/display the span called 'box' (elementary stuff)
function displayPanel(id) {
document.getElementById(id).style.display = 'block';
}
function hidePanel(id) {
document.getElementById(id).style.display = 'none';
}
My problem is that I want to change the content displayed in the span box depending on which link the user has his/her mouse over. So how can I set a variable that tells me which link is being hovered over?! The only thing I could think of was giving the <a>
a unique ID, but then I'd have to pass a value back to perl and this is where I start to confuse myself with the client/server-side stuff! So maybe some sort of AJAX would do the trick? Any help is much appreciated.
Regards,
ns
If your using a virtual machine, I'd use Orcale VirtualBox instead of VMWare - I think it's far better!
Did you have a read of that link?
Do you have the ntfs-3g driver?
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.
I'll have a look into this tomorrow, but have a read here in the mean time: https://help.ubuntu.com/community/MountingWindowsPartitions
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.
Hi there, Although I've never done drawing using PHP, I've previously carried out research on the available graphing software around for PHP.
I am currently using one called FusionCharts which I feel is one of the best out there. You can plot data using XML, JSON or straight out of a database. There is good support and examples available through their website.
However, if your requirements are strictly based on drawing onto 'this' image then I'm afraid I will be unable to help.
Regards,
ns