cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I'll tell ya where I have gone when I'm not online - to work and to sleep... Next!

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

You know your a geek when your plan of world domination has worked (eg. Bill Gates and IBM)

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Yeah but i dont want to pollute the islands water supply, plus i would need a boat to come and deliver fuel for it.

Then maybe an electric windmill farm and solar panel farm. Their both environmentally friendly and you would be kept busy maintaining the turbines.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I want to display records from database in this order

1 2 3
4 5 6
........


or


1 4 ....
2 5 ...
3 6.....

pls can anybody help me ........

Not much use putting that info in this solved topic. Try setting up a new topic.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I would take my bass, its amp, and some way to power it to the island

What if to power it you took a nuclear reactor then you could pump the excess power to India where you will receive lots of cash. Then if you had a computer with satellite Internet you could buy whatever you want on ebay and possibly buy a ship to sail away from the island. lol

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

@cwarn23, I think the OP was saying, that it shows only 1 record instead of 2 !

Maybe my explanation was too short. Sometimes people will do the following:

<?php
$connection = mysql_connect("myserver.com","myuser","mypassword") or die ("Couldn't connect to server."); 
$db = mysql_select_db("mydb", $connection) or die ("Couldn't select database."); 

$search=$_POST['search'];

$data = "SELECT firstname, lastname, task FROM inventors WHERE taskdate - curdate() = 1";
  $query = mysql_query($data) or die("Couldn't execute query. ". mysql_error());
$data2 = mysql_fetch_assoc($query)
while($data2 = mysql_fetch_assoc($query)) {
echo $data2['firstname']; 
echo $data2['lastname'];
echo $data2['task']; 
echo '<hr>';
}
?>

However the above is incorrect and therefore should be replaced with the below.

<?php
$connection = mysql_connect("myserver.com","myuser","mypassword") or die ("Couldn't connect to server."); 
$db = mysql_select_db("mydb", $connection) or die ("Couldn't select database."); 

$search=$_POST['search'];

$data = "SELECT firstname, lastname, task FROM inventors WHERE taskdate - curdate() = 1";
  $query = mysql_query($data) or die("Couldn't execute query. ". mysql_error());
while($data2 = mysql_fetch_assoc($query)) {
echo $data2['firstname']; 
echo $data2['lastname'];
echo $data2['task']; 
echo '<hr>';
}
?>

Basically that additional line can chew that first mysql result therefore only the second in this post should be used.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Still returns one row instead of two... :S

So it displayed something... So we know that you were using the right names but the normal cause of this is an extra line of code. Try the following script.

<?php
$connection = mysql_connect("myserver.com","myuser","mypassword") or die ("Couldn't connect to server."); 
$db = mysql_select_db("mydb", $connection) or die ("Couldn't select database."); 

$search=$_POST['search'];

$data = "SELECT firstname, lastname, task FROM inventors WHERE taskdate - curdate() = 1";
  $query = mysql_query($data) or die("Couldn't execute query. ". mysql_error());
while($data2 = mysql_fetch_assoc($query)) {
echo $data2['firstname']; 
echo $data2['lastname'];
echo $data2['task']; 
echo '<hr>';
}
?>

Now what happens?

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

To test if no rows are found try the following:

while( $data2 = mysql_fetch_array($query)) {
echo $data2[0]; 
echo $data2[1];
echo $data2[2]; 
}

The nothing is displayed then that means there are no rows due to the WHERE clause.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Replace lines 11 to 13 with the following

echo $data2['firstname']; 
echo $data2['lastname'];
echo $data2['task'];
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Where's the $? I read that MIS majors average starting salary is $45-$50k/year. I have a B.A. and a Master's in MIS, 3.9 GPA in grad school, VP of MIS Society, many skills, and 25 certifications, including A+, Network+, Server+, MCP, and MCITP-Server Admin. Yet, I can not find a job in IT in Tampa for 8 months. I previously had a tech support job that paid $14/hr. Where are all the great salaries? What am I doing wrong? I feel I'm missing something...

I feel the same. High demands few jobs although I live in a low tech area. For example if you search for a PHP developer then maybe in a years time you will find an ongoing job that will last for at least 6 months. I wonder what happen to the days when people could work as part of a company. My guess is that the recession has hit hard and there for companies are not so keen to employ.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster
$get = mysql_query("SELECT * FROM flats LIMIT $start, $per_page");

Replace the above with something like the below.

$get = mysql_query("SELECT * FROM flats ORDER BY date_posted DESC LIMIT $start, $per_page");
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

This code will throw an error at line4 saying "headers already sent"
So no echoes before the header() :)

Just to make it clear - indeed there should be no echos before the header().

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

cwarn23 thanks for the elaboration.But are you trying to say that, the mysql insert will be executed in the below code as there is no exit after the header() -

if(something)
{
header("Location:new_url.php");
mysql_query($insert_query);
}

compared to the code below -

if(something)
{
header("Location:new_url.php");
exit;
mysql_query($insert_query);
}

That is correct from what I have read in the past.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Perhaps this:

<?php
mysql_connect(HOST,USER,PASS);
@mysql_select_db("db303278079") or die( "Unable to select database");
$query="SELECT * FROM restaurants";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
for ($i=0; $i<$num; $i++) {
$rest_name=mysql_result($result,$i,"rest_name");
$address=mysql_result($result,$i,"address");
$telephone=mysql_result($result,$i,"telephone");
$website=mysql_result($result,$i,"website");
$cuisine_type=mysql_result($result,$i,"cuisine_type");
$area=mysql_result($result,$i,"area");
$website=(empty($website))?'':", <A HREF=$website>'Website'</a>";
echo "<strong>$rest_name</strong>, $address, $telephone, ($cuisine_type), $area$website<br >";
}
?>
dmkc commented: helps a lot to show me where I'm going wrong, thanks for the help!! +0
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Well actually the entire page will be process by php unless the exit; statement is placed there. So for example if you have a mysql insert it will insert before redirecting unless the exit; is placed immediatly after the header. And yes it will redirect the user to index.php however it is the browser that redirects the user and not the server. Basically when the browser reads that header the browser will then go to that location.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

No! No! Its just an experiment. I want a bot which enters "0001" in google search text box, then "0002", Then "0003" to "9999" with some time difference. Is that a spam/virus bot?

PHP would be the section if you have a webserver with php installed. Also google has their own api's for this kind of stuff so it is possible to do in a number of languages. If you plan to write it in PHP then post a topic in the PHP section and pm me the link.

If your not sure what PHP is well it's basically a language to write webpages or tell a server what to do and has many features including bot making.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I would bring a nuclear reactor to build a power plant, and a swiss army knife, a few straws, an empty one Liter bottle, a Tent, a large cooking Knife, large quantities of flint, 3 First aid kits and all my computers with a satellite internet connection.

Since I have seen how Macgyver manages in the Jungle, it is possible to find a narrow stream of fresh water then place the straw on the stream with the other end of the straw containing the bottle. That would keep my water supply and as for food, I would make traps from plants in the forest such as digging a hole then placing large pillars/leaves over the whole so that animals will become trap where I can feed on them. Then Also after cutting up the animals, the flint can be used to make fire then the animals can rotate on a stick above the fire to cook.
The swiss army knife can be used for a variety of things such as cutting small leaves or even dissecting useless animal parts in my free time. The first aid kits can be used for both first aid and for things like if the tent needs repairing. So that is how I would survive.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Looks like a bunch of ones and zeros with a few letters to me.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

If you want wildcards then the following contains the wildcards:

$sql = 'SELECT * FROM device WHERE `device_num` LIKE "%'.mysql_real_escape_string($val_d).'%" OR `dib` LIKE "%'.mysql_real_escape_string($val_dp).'%"';
cwarn23 387 Occupation: Genius Team Colleague Featured Poster
<?php
header("Location: http://yoursite.com/index.php");
exit;
//above must be at very top before any browser output
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try adding the following to the top of your php file(s)

setcookie ('PHPSESSID', $_COOKIE['PHPSESSID'], time()+172800);
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

You will find that by doing that as you have mentions, parts of it such as javascript will not be compatible with some email clients. So best thing to do is to just have a link to something like yoursite.com/email.php?userid=194965 and the user id will allow for existing details to be displayed on the page specifically for each user. Also doing what you have tried to do may also result in the email being marked as spam.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try replacing it with the following:

$sql = 'SELECT * FROM device WHERE `device_num` LIKE "'.mysql_real_escape_string($val_d).'" OR `dib` LIKE "'.mysql_real_escape_string($val_dp).'"';
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try the following:

$user_name = mysql_query('SELECT * FROM users WHERE username ="'.mysql_real_escape_string($Entered_UserName).'" AND password = "'.md5($Entered_PassWord).'"') or die(mysql_error());

         $user_name_password = mysql_fetch_assoc($user_name);

         if($user_name_password === false)
           {
           	echo 'false';
           } else{
           echo 'true';
         }
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

So in other words, it goes through all the possible 6 character combinations of sha1?

Sounds neat, how long does it take to do 6? 7? 8? etc?

Well I have made a set of tickboxes for if you think the original string contained upper case letters, lower case letters, numbers, or symbols. So those are four options and the more that are selected the longer it will take because there will obviously be more hashes to check when including more types of characters. With all 4 tickboxes ticked it can do 2 digits in 50 seconds or 1 digit in less than 1 second. However with some tickboxes disabled it will be faster and you can choose how far in to stop processing.

Just a note: on the previous attachment you will need to select the combo box before anything else otherwise it becomes impossible to select a different number of characters. Have now fixed that in my latest version.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

You need to use java.util.Date, not java.sql.Date.

Found the bug. I used the wrong import method thanks to user javaAddict for pointing out about util instead of sql. Now my application is running perfectly and *solved*

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

no. how is anyone to know in a year

It will be posted on the internet and possibly on daniweb. I'm not sure what else you were thinking about?

Anyways, I have made a dehasher that can dehash up to 6 digits depending on what characters are to be dehashed and time allowed. You can grab a copy of the SHA1 dehasher from the attachment on this post to see how insecure SHA1 is IMO. Enjoy dehashing the >=6 digit hashes.:)

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I have managed to piece together the below code but still it doesn't work. According to my compiler it cannot find symbol and the symbol is the Date() constructor. Also the Date() constructor has a red underline in my compiler meaning there is something wrong with it which I can't exactly get my head around. Can you see what's wrong with the below code?

public static long gettimestamp() {
    Date data = new Date();
    return (data.getTime()/1000);
    }
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi and although I have solved the previous array problem I am struggling to find how to get the current timestamp (seconds since 1970). Below is two scripts I have tried unsuccessfully.

java.sql.Timestamp ts = new java.sql.Timestamp((new java.util.Date()).getTime());
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
Date d = sdf.parse(ts); // parse date
long timestart = d.getTime();

//the above was one script and the below is another

Timestamp timestart = Timestamp.valueOf("ss");

Does anybody know how to get the current timestamp as an integre as I can't find a single site with the answer? Thanks for the great helps so far.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Sadly, this simple a thing becomes pretty clunky to implement when it comes to Java. A sample implementation might be something like:

class YourClass {
   
   private static final List<String> LOWER_CASE_CHARS;
   
   private static final List<String> UPPER_CASE_CHARS;
   
   static {
      LOWER_CASE_CHARS = listFromArray("abcdefgh".toCharArray());
      UPPER_CASE_CHARS = listFromArray("ABCDEFGH".toCharArray());
   }
   
   private static List<String> listFromArray(char[] charArray) {
      List<String> list = new ArrayList<String>(charArray.length);
      for(char ch : charArray) {
         list.add(String.valueOf(ch));
      }
      return list;
   }
   
   public String[] fillResultArray() {
      boolean checkBoxOneChecked = true, checkBoxTwoChecked = true;
      List<String> stringList = new ArrayList<String>();
      if(checkBoxOneChecked) {
         stringList.addAll(LOWER_CASE_CHARS);
      }
      if(checkBoxTwoChecked) {
         stringList.addAll(UPPER_CASE_CHARS);
      }
      return stringList.toArray(new String[] {});
   }
   
}

Does that work out for you?

I managed to get that example working except for the final array doesn't start with the first value being blank/empty. I have been trying to find a way to get a blank value as the first value on the array but do you know of any quick way of doing it as I am still trying to find how to add that final value. An example of what I tried is as follows:

BLANK_CHAR = listFromArray("".toCharArray());

But the above line doesn't work. :( Please help. Thanks.

[edit]
Just discovered the following code which now seems to work. Hopefully it should be solved soon.

stringList.add("");

[/edit]

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I don't recommend XAMPP, though it is good once you get used to it! I recommend WAMP, it is elegant and Good. Also check your PHPMyAdmin to browse your databases

I would have to say if you managed to get XAMPP working then good, keep it as XAMPP has a few minor additional features that WAMP doesn't have (eg. mailserver) although the installation for XAMPP is buggy. If you have already passed the step of installation then the bug will no-longer affect you although one may argue there is no real difference between XAMPP and WAMP as they are both the same localhost server package.

Anyways to insert into mysql the following is the method I use:

INSERT INTO `table` SET `column name` = "Value"
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Does that work out for you?

It's hard to see how that code works or if it works but although I check some more documentation, is it possible to loop through the contents of two arrays to populate a third array with the combined content?

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

>Is there any specific requirement you are trying to fulfill which can't utilize better data structures?

If you mean is there any better design I could follow without appending then I'm am not exactly sure because basically I have 4 tickboxes in the gui and when one is ticked the variable in the if statements changes to true. The tricky part is that the result is a complete array and the tickboxes selects what parts of the array should exist in other words different tickbox combinations will result in different arrays. Are there any examples on how I can do this?

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Bugga - The Google Go language isn't in the Ubuntu synaptic package manager so tons of commands need to be done to install the Go compiler. And I can tell you now very few people would want to do that so this language will never be popular at this rate with a command line interface to install and an endless installation process depending on the OS. I might just stick with Java.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try the following:

<?php
require_once('config.php');
    
    for ($i=1;$i<11;$i++) {
    $aid='aid'.$i;
    $$aid=$_POST['Question-'.$i];
    
    $qid='qid'.$i;
    $$qid=$_POST['qid'.$i];
	
    $query = 'UPDATE answers SET acount = acount + 1 WHERE aid = "'.mysql_real_escape_string($$qid).'" AND qid = "'.mysql_real_escape_string($$qid).'"';
    mysql_query($query) or die("ERROR: $query. ".mysql_error());    
    }
    mysql_close();
?>

I haven't tested it for bugs and yes those variables with two dollar signs should be correct. Also you can take a look at my loops tutorial as additional reference.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Wow. Imagine how much process a game could save by using this
technique.

There was a game ("Duke Nukem 3D Atomic Edition") that sorta used that technique or at least the users said so which made the First Person Shooter 2.5 dimensional. I don't see how that it is possible as it looks very 3 dimensional (3D) to me.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

This is technology. We can make it do whatever we want

Bill Gates and now look at their Operating System.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Hi and I have been working on a simple problem but can't seem to find any solution and have tried browsing the net. My question is how do I append to an array. Below is the code I tried but still doesn't work.

String[] names={""};
            if (charcheck1==true) {
                String[] chartmp={"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
                for (int j=0;j<chartmp.length;j++) {
                    names[names.length]=chartmp[j];
                }
            }
            if (charcheck2==true) {
                String[] chartmp={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
                for (int j=0;j<chartmp.length;j++) {
                    names[names.length]=chartmp[j];
                }
            }
            if (charcheck3==true) {
                String[] chartmp={"1","2","3","4","5","6","7","8","9","0"};
                for (int j=0;j<chartmp.length;j++) {
                    names[names.length]=chartmp[j];
                }
            }
            if (charcheck4==true) {
                String[] chartmp={"`","~","!","@","#","$","%","^","&","*","(",")","-","_","+","=","|","\\","[","{","]","}",";",":","'","\"",",","<",".",">","?","/"," "};
                for (int j=0;j<chartmp.length;j++) {
                    names[names.length]=chartmp[j];
                }
            }

According to several sites I was browsing the above code should work but for some reason doesn't and reports a java.lang.ArrayIndexOutOfBoundsException: 1 error. Does anybody know how I can append to the array and please keep it simple as I am just beginning to learn Java? Thanks.

peter_budo commented: Interesting question +11
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

how is anyone to know cwarn?

What do you mean. How is anyone to know weather I'm correct? Could you expand that question as it has little detail.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

You know you are complete computer geek when you like Google's new language Go.

Done that and only works on Linux and Mac although it's hard enough to get working on Ubuntu since it's not in the Synaptic Package Manager. - Lazy Google making things hard.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I've already made my point and don't see any point in explaining it any further but I will say in the coming years we will see who makes the worlds best hash cracker.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try replacing the count section of the code with this:

// count record

$record_count = mysql_num_rows (mysql_query("SELECT * FROM flats")); 

//count max pages

$max_pages = ceil($record_count / $per_page); // may come out as a decimal

That should fix a major bug.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Are you a scientologist? That kinda of sounds like their odd thetan rant -- ooh ooh - you could be a Urantian, now that would be out of site - those guys write the weird crap on those boxes of herbal tea.

I'm not sure what an Urantian is but I am Australian and I would have to say if you are going to believe in a religion you minus well make it something worth while. ;)

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

I did a simple script and found that was not the case.

<?php
$a=5;
$b=$a;
echo $$b;
?>

Found that $$b will be blank because it will search for the variable $5 and it is impossible to make a variable with that name.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

This is impossible to do on most hosts unless you have root access or you use a wildcard subdomain. Htaccess files are not able to do this so to accomplish the creation of a subdomain there are two ways of doing it. First way is to create a subdomain just called the single character *
So for example it would be *.mydomain.com then direct your subdomain to a special php script that will sort what each subdomain links to. The other option is if you have root access, to make a php script that modifies the apache httpd.conf file although it is highly unrecommended. Hope that theory helps.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Try this.

<?php

define("HOMEPAGE_CONTENT",'<div align="justify" class="homepageContent"><p><h1> Buy Legal & Bodybuilding Supplements Online - The Labs Difference </h1></p><p>Welcome to Labs. Here you can find legal and muscle building supplements to increase your muscle size and strength. For the last six years, Labs has been a leading supplier of high-quality, affordable alternatives (aka legal) and bodybuilding supplements.</p>
<p>Our quality selection of discount bodybuilding supplements will enhance your workout performance beyond your current level assuring you get the consistent results that serious bodybuilders need. Whether you are trying to cut up (harden your muscles) or bulk up, we have the muscle products you need. The Labs line of superior bulking and cutting muscle supplements have been well received by our customers nationwide because of their affordable prices and the outstanding, high-quality results they help provide.</p>
<p>All of our legal, fat burners, and bodybuilding supplements are made with the safest and most effective ingredients modern science has to offer. Our products have been designed by biochemical engineers with the input of professional athletes and serious body builders. They have been put through rigorous testing and have been found to be completely safe and free of harmful side effects. Labs bodybuilding supplements contain NO artificial ingredients, sweeteners or additives.</p> 
<p>Buying online from Labs has never been easier. Our user friendly website is easy to navigate. We assure the security of your online transaction. You can shop for legal, bodybuilding supplements, amino acids, creatine, fat burners and more. Just choose the category that best fits your …
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Could you please post the first 12 lines so I can see what I am changing?

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

That l@@ks like lines 1-3 but below is the corrected version of you copied correctly.

<?php

define("HOMEPAGE_CONTENT",'<div align="justify" class="homepageContent"><p><h1> Buy Legal Steroids & Bodybuilding Supplements Online - The Labs Difference </h1></p><p>Welcome to StackLabs. Here you can find muscle building supplements to increase your muscle size and strength. For the last six years, Labs has been a leading supplier of high-quality, affordable bodybuilding supplements.</p>');
cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Can you post lines 1 to 6 so we can see the true error.

cwarn23 387 Occupation: Genius Team Colleague Featured Poster

Can you guys refer to people and not 'you' I assumed you guys were talking to me at first since I was the last both, didnt realize you had an argument between each other :D

Well when I say the word "you" I refer to the reader. Sorry if it was a bit confusing as many things in this topic are confusing to the untrained eye.