samarudge 16 Posting Whiz

Hi,
I know when passing vars to an AS3 movie you can use the query string like
mymovie.swf?Var1=something&Var2=something_else
but what about passing them via the URL?
I know that YouTube does this, there embed SWFs are
http://www.youtube.com/v/v3xYkyw86QM
with the red bit being the video URL. The server is Apache so it isn't something to do with FMS or any other Flash server
and it can't be done with rewrites like you normaly would because its client side
How can I do this with my flash movies?
Thanx,
Sam Rudge

samarudge 16 Posting Whiz
samarudge 16 Posting Whiz

I notice that your net-bios is chrysanthemumwolf-laptop
If you are using a laptop for a testing server rather than a production server try XAMPP. You will find it much easyer
http://www.apachefriends.org/en/xampp-linux.html

samarudge 16 Posting Whiz

Yes but
1) The comment count will be displayed on search pages (So calculating that for each result would slow page load and put the server under even more strain)
2) If thousands of people are viewing the same page there would be a large load on the DB server.

samarudge 16 Posting Whiz

Yes I know I can do that but there are two reasons why I wouldn't:
1) The comment count would be displayed on the search results as well so it would considerably slow search page loading down and the servers would be under grate strain anyway
2)

samarudge 16 Posting Whiz

Hi guys,
So I am developing a website which will allow users to comment on things. As part of this I need to display a comment count and I wanted to know what you thought was the best way of doing this:
The two options are
Every hour/day run a CRON that counts the comments on a certain item and then updates the articles DB entry
Or
As soon as a comment is added +1 to the comment count

I should mention that this will be a highly used site (estimating 1,000,000+ hits per month)

Which is the best way of doing it?
Thanx,
Sam Rudge

samarudge 16 Posting Whiz

When using PHP for blogging, go for Wordpress (The support is much better on that system and its much easier to customize)

samarudge 16 Posting Whiz

You are a genius =D
Thankyou so much for that, have a (virtual) pint on me =P

samarudge 16 Posting Whiz

The sound needs to come from the computer ,so you need to plug something into the computers audio out plug on the computers sound card on the back of the computer,your surround sound speaker plug ,it need to be a mini pin male

Yep...
VGA does not carry sound, you might want to look at a cable like this
http://www.overstock.com/Electronics/Audio-Stereo-Cable/2459246/product.html?cid=133635
to connect your TV

samarudge 16 Posting Whiz

use the % attribute
E.G.

<body>
<div style="margin:auto; width:80%; background-color:#FF0000;">Hello</div>
</body>
samarudge 16 Posting Whiz

Hi,

I downloaded the open source project Guitar Tuner (http://sourceforge.net/projects/guitartuner/)
Inside it there is an index.html file, a TunerApplet.jar file and a TunerApplet.java file (As well as some images and GPL etc.)
When i open index.html the applet displays as it should however if I try to recompile (Even without making any changes to the code) I get an error.

I am compiling with the command Sam-Rudges-MacBook-Pro:GuitarTuner samarudge$ javac tunerapplet.java then putting it all into a .jar archive using Sam-Rudges-MacBook-Pro:GuitarTuner samarudge$ jar cvf TunerApplet.jar TunerApplet.class But when I open the web page again (After closing FireFox and clearing cache) the applet displays but shows the error
"Error: Unable To Start Acquisition"
If you look in the code (below) the string from the error is on line 111

/*
GuitarTuner : automatic Guitar Tuner on Applet 
Copyright (C) 2005 (Arnault PACHOT)

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., …
samarudge 16 Posting Whiz

Thanx for that, nice to know I can do it before getting started =P

samarudge 16 Posting Whiz

Thanks for the reply. Do you think I could boot up into safe mode and rename the C:\Documents and Settings\stimpy.DOMAIN tree to C:\Documents and Settings\stimpy?

I don't see why not but I sugest rather than renaiming them you copy the files and replace all just so you don't screw anything up by removing WORKGROUP files

samarudge 16 Posting Whiz

Due to domain security you cannot do this. Your preferences can only be accessed over the domain so you will eather have to recconect to the domain or manually copy the files

#microsoftfail =)

samarudge 16 Posting Whiz

I would try

$a = 08;
print($a);

or use a string

$a = '08';
print($a);
samarudge 16 Posting Whiz

use the include(); || require(); functions to reduce your file sizes, split things up. Put functions in there own files etc.

samarudge 16 Posting Whiz

Wow thats a lot of Skype processes lol

To effectively remove viruses you should boot in safe mode
Hold F5 when the windows screen apears and select Safe Mode then run the virus scaner again

samarudge 16 Posting Whiz

Hi,
I'm trying to find a suitable language for developing an RIA to be able to tune an instrument via a website. I.E. what I need is:
1) Live input from a microphone
2) Get the volume level of different frequencies
3) Find the average or loudest frequency
4) Output the results

I know that the last 2 are possible but could I do the first two in Java via an applet online?

Thanx,
Sam Rudge

samarudge 16 Posting Whiz

I have a .phpfile in the xamp/php/www folder but can't get it to work with lofalhost.

Firstly be more specific (Explain your problem more clearly)
Secondly I was under the impression that XAMPP doc root was
/xampp/htdocs/
but I may be wrong

samarudge 16 Posting Whiz

I think my views are summarized in my sig-block =P

samarudge 16 Posting Whiz

Hi,
So I have the following code

m = Microphone.get();
o = attachAudio(m);
m.setUseEchoSuppression(true);
onEnterFrame = function () {
	vol._xscale = m.activityLevel*100;
	soundvol = m.activityLevel;
	inputname = m.name;
	micgain = m.gain+"%";
	outputvolume = m.;
       freqvolume = \\something
};

As you can see, that code starts taking the input from a microhphone and visualizes the volume as a horizontal bar.
I have the variable freqvolume and I want that to be set to the volume/activityLevel of a certain frequency say 256 Hz (Middle C)
Is that possible?
Thanx
Sam Rudge

samarudge 16 Posting Whiz

OK it was a whole lot simpler than I though:
All I have to do is convert to Base32 so my functions are

function id_encode($ID) {
	$Hash = base_convert($ID, 10, 32);
	return $Hash;
}
function id_decode($ID) {
	$Hash = base_convert($ID, 32, 10);
	return $Hash;
}

but thanx for your help =)

samarudge 16 Posting Whiz

My suggestion:

<?php
function encode_num($number) {
switch($number) {

case 1 :
return "a";
break;

case 2 :
return "b";
break;

case 3 :
return "c";
break;

// ... Alot of code...
// ...Here comes all the other options...
// ...Alot of code...

default:
return "Invalid number";
break;
}
}

function decode_num($string) {
switch($string) {

case "a" :
return 1;
break;

case "b" :
return 2;
break;

case "c" :
return 3;
break;

// ... Alot of code...
// ...Here comes all the other options...
// ...Alot of code...

default:
return "Invalid string";
break;
}
}
echo "The letter 'c' decoded: ".decode_num('c')."<br />";
echo "The number '3' encoded: ".encode_num('3')."<br />";
?>

~G

You have the right idea but I need it to convert an possibly infinite number to a string like aYnqW

samarudge 16 Posting Whiz

i dont have to reset it ,net even change the setting but access internet without port 80

The internet (HTTP) runs on port 80 for example Google can only be accessed via port 80

The only way to access the internet without that port would be setting up a dedicated HTTP Tunnle server outside your network but that is extremely complicated and would require a dedicated server as well as at least a few years experience with UNIX/Linux.

The best solution would rather be to reset the router or if that is not an option contact your ISP/Router manufacturer

samarudge 16 Posting Whiz

i have internet connected in all my computers but i have bloced net surfing by blocking port80 from the router.
could anyone suggest a way to change the settings of one computer temporarly to access the net. i can only use internet explorer.(no extra program to be installed)
thankx

What make/model is the router?

If you know the router password you can usualy change this setting on the routers configure page (192.168.0.1 if Netgear, 192.168.0.11 if Belkin, others vary)
If you do not know your password then the router will have to be hard (Factory) reset

samarudge 16 Posting Whiz

Hi,
I need to create a function to shorten a numerical ID to a string of letters
E.G.

echo encode_num('1'); //Outputs a
echo encode_num('3'); //Outputs c
echo encode_num('26'); //Outputs z
echo encode_num('27'); //Outputs A
echo encode_num('52'); //Outputs Z
echo encode_num('53'); //Outputs aa
echo encode_num('54'); //Outputs ab

etc.

But I also need to be able to decode them again like

echo decode_num('a'); //Outputs 1

Is this possible to do?
Thanx,
Sam Rudge

samarudge 16 Posting Whiz

Hello friends
I want to resize a youtube video in my site.
Is it possible?
Please help.
Thanks

Well the basic HTML embed code looks something like

<object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/VID-ID"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/VID-ID" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object>

Replace the VID-ID parameter with the ID of your video and change the values in green to re size the player (Both the top and the bottom values need to be changed)
HTH,
Sam
P.S.
Admins: I didn't use HTML code tags because I couldn't colour them if i did =)

samarudge 16 Posting Whiz

Download the file attached to this post, extract the file and double click it to run it (Click yes or accept or whatever) and that should enable task manager again.

samarudge 16 Posting Whiz

This is a good tutorial on Advanced AJAX with MySQL
http://www.tizag.com/ajaxTutorial/ajax-mysql-database.php

samarudge 16 Posting Whiz

The request URL would have _GET varaibles in, just create the file action.php with the contents

<?php
print_r($_GET);
?>

and view the output in Firebug (XHTML requests section)

samarudge 16 Posting Whiz

ok so i am an avid php developer and i am starting to get into ajax so i can keep file sizes and code down to a minimum.

i am looking in the w3schools ajax examples but i am a little lost at how to send through a variable to the page i am using to process.

what i would like to do is send through an id that is being recalled from the database to tell it what to save over.

any help would be very helpful. thanks in advance

ajax

function action()
{
var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {
  document.myForm.time.value=xmlhttp.responseText;
  }
}
xmlhttp.open("POST","action.php",true);
xmlhttp.send(null);
}

html form

<form action="#" method="post"> 
        <button name="save" type="submit" value="Save" onclick="action();">Save</button>
<input type="text" name="address" />
</form>

Sending data:
The easiest way to send data to your server from the form is using _GET variables
You can take the variables from your form and add them to your string like this

function action()
{
var xmlhttp;
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {
  // code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4)
  {
  document.myForm.time.value=xmlhttp.responseText;
  }
}
var textfielddata = document.getElementByID('a_field').value;
xmlhttp.open("GET","action.php?Value="+textfielddata);
xmlhttp.send(null);
}

And this would be your new HTML

<form action="#" method="post"> 
<input id="a_field" name='SomeField' type='text' />
        <button name="save" type="submit" value="Save" onclick="action();">Save</button>
<input type="text" name="address" /> …
samarudge 16 Posting Whiz

All those players are open-source so you can download the source ActionScript 3 files and edit them to your liking, i managed to edit that to get its souce files from an XML source (Dynamicaly)
If you want help with the ActionScript, start a new thread in this forum
http://www.daniweb.com/forums/forum28.html

samarudge 16 Posting Whiz

It would need to be done in Flash, not Javascript. I am working on a similar project and my player is roughly based on the source of this
http://flash-mp3-player.net/

samarudge 16 Posting Whiz

Hi,
I have just got Google Wave but don't have any contacts (Appart from the person who invited me) I can't figure out how to invite people eather so I was wondering if people would like to post there GMail addresses here I can add you so I can finally start talking 2 ppl =) Just have a DaniWeb Wave
My gmail is samarudge .-[at]-. gmail.com
=)

P.S.
If anyone posts here saying "Can you send me an invitation" I WILL add negative rep points. This is for people who have Wave, not who want it.

samarudge 16 Posting Whiz

OK Thanx, I think I can do a batch convert in Picasa but i can probz do it in Photoshop or Adobe Bridge. The ideal solution would have been to save them as un-editable in the first place but don't tell my friend I said that =)

samarudge 16 Posting Whiz

Hi,
I have some code to dynamically retrieve one of three AJAX files and insert it into a DIV

The Javascript is

function createajax() {
	var Ajax;
	try{
		Ajax = new XMLHttpRequest();
	} catch (e){
		try{
			Ajax = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				Ajax = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				alert("Error!!!");
				return false;
			}
		}
	}
	return Ajax;
}

function basicAjaxSwitch(File, Recipient, Animate) {
	if ( Animate == true ) {
		Animation(document.getElementById(Recipient)).duration(100).from('opacity', 1).to('opacity', 0).go();
	}
	basicAjaxSwitch = createajax();
	basicAjaxSwitch.onreadystatechange = function(){
		if(basicAjaxSwitch.readyState == 4){
			if ( Animate == true ) {
				Animation(document.getElementById(Recipient)).duration(100).checkpoint().duration(100).from('opacity', 0).to('opacity', 1).go();
				setTimeout('document.getElementById("'+Recipient+'").innerHTML = basicAjaxSwitch.responseText;', 100);
			} else {
				document.getElementById(Recipient).innerHTML = basicAjaxSwitch.responseText;
			}
		}
	}
	basicAjaxSwitch.open("GET", "/ajax/"+File, true);
	basicAjaxSwitch.send(null);
}

function changesidebarinfo(changeto) {
	if ( changeto == 'login' ) {
		Animation(document.getElementById('main_layout_accountlinks_background')).to('left', '0px').duration(100).go();
		Animation(document.getElementById('main_layout_accountlinks_login')).duration(100).to('color', '#FFF').go();
		Animation(document.getElementById('main_layout_accountlinks_signup')).duration(100).to('color', '#000').go();
		Animation(document.getElementById('main_layout_accountlinks_about')).duration(100).to('color', '#000').go();
		basicAjaxSwitch('contentinfo/login.php', 'main_layout_rsbinfo_container', true);
	} else if ( changeto == 'join' ) {
		Animation(document.getElementById('main_layout_accountlinks_background')).to('left', '50px').duration(100).go();
		Animation(document.getElementById('main_layout_accountlinks_login')).duration(100).to('color', '#000').go();
		Animation(document.getElementById('main_layout_accountlinks_signup')).duration(100).to('color', '#FFF').go();
		Animation(document.getElementById('main_layout_accountlinks_about')).duration(100).to('color', '#000').go();
		basicAjaxSwitch('contentinfo/join.php', 'main_layout_rsbinfo_container', true);
	} else if ( changeto == 'about' ) {
		Animation(document.getElementById('main_layout_accountlinks_background')).to('left', '100px').duration(100).go();
		Animation(document.getElementById('main_layout_accountlinks_login')).duration(100).to('color', '#000').go();
		Animation(document.getElementById('main_layout_accountlinks_signup')).duration(100).to('color', '#000').go();
		Animation(document.getElementById('main_layout_accountlinks_about')).duration(100).to('color', '#FFF').go();
		basicAjaxSwitch('contentinfo/about.php', 'main_layout_rsbinfo_container', true);
	}
}

And the HTML that triggers the actions is

<div id="main_layout_accountlinks">
        	<div id="main_layout_accountlinks_background">&nbsp;</div>
        	<div id="main_layout_accountlinks_login" onclick="changesidebarinfo('login');">Log In</div>
            <div id="main_layout_accountlinks_signup" onclick="changesidebarinfo('join');">Join</div>
            <div id="main_layout_accountlinks_about" onclick="changesidebarinfo('about');">About</div>
        </div>

When I click one of the 3 buttons (doesn't matter which) the result is exactly as intended. Then when I click another (or the same) button, nothing happens and Firebug gives the error

basicAjaxSwitch is not a function
changesidebarinfo("login")site.js (line 61)
function onclick(event) { changesidebarinfo("login"); …
samarudge 16 Posting Whiz

Not 100% sure what you mean but if you are in the file
/var/www/html/page/index.php (Local/On server)
and you are trying to access a file
/var/www/html/include/page.php (Local)
you can use the "Double Dot" syntax in PHP

include('../include/page.php');

would include the file
Is this what you meant?

samarudge 16 Posting Whiz

Hi,
My friend has designed a website in Fireworks/HTML and has just saved all her images in Fireworks/PNG format. She has about 300 images all designed in Fireworks but they have all been saved in a format where someone can download them and open them in Fireworks and they will be editable (as vectors).
She wanted to know if there is any way to remove all the editable information from the FW images without re-saving them all.
Regards,
Sam Rudge (Oh and Sarah who apologizes for being useless =P)

samarudge 16 Posting Whiz

OK thanx, I think I will stick with my current method of lots of salts (In the actual function I use about 5 different algorithms)

samarudge 16 Posting Whiz

Hi,
On my websites, I encrypt passwords using a combination of hashing algorithm (Which I am obviously not going to post on a forum but its along the lines of md5(substr(whirlpool($Value), 0, 7)); )

What is blowfish, how do I use it and how much more secure is it than a function as shown above?

Regards,
Sam Rudge

samarudge 16 Posting Whiz

Storing files as, well, files is never a good idea, if stored as PHP files and then include/require(ed) the scripts could contain malicious code. There are two options;
1,
Save the file as .htm, .html, .txt (or some other plain text format)
Include the file with

<?php
echo file_get_contents($FileToGet);
?>

This will get the contents of the text file and echo it to the browser without executing any code inside.
2,
BLOB!
There is a field type in MySQL called BLOB (Binary Large Object) which I use for storing my files, it can hold a large amount of data, all you have to do is output it as you would with any other MySQL field

samarudge 16 Posting Whiz

Storing files as, well, files is never a good idea, if stored as PHP files and then include/require(ed) the scripts could contain malicious code. There are two options;
1,
Save the file as .htm, .html, .txt (or some other plain text format)
Include the file with

<?php
echo file_get_contents($FileToGet);
?>

This will get the contents of the text file and echo it to the browser without executing any code inside.
2,
BLOB!
There is a field type in MySQL called BLOB (Binary Large Object) which I use for storing my files, it can hold a large amount of data, all you have to do is output it as you would with any other MySQL field

samarudge 16 Posting Whiz

I think you might have a virus, make sure you are using one of the big 3 (Norton, AVAST or KAPERSKY/KAPERSPY or however its spelled) and they are fully updated then run a boot scan or run a scan from Safe Mode, Make sure you back up as much as you can as soon as possible, if you do have a virus then you wouldn't want it to do any harm to your other files.
Alternatively upgrade to Vista/Windows 7 (Newer and more secure) if you are not upgrading because of compatibility issues look up Vista/Windows 7 compatibility mode but thats a whole other forum post =P

samarudge 16 Posting Whiz

Hi,
I have created a script to upload files

$filename = $_FILES['Filedata']['name'];	

$filetmpname = $_FILES['Filedata']['tmp_name'];	

$fileType = $_FILES["Filedata"]["type"];

$fileSizeMB = ($_FILES["Filedata"]["size"] / 1024 / 1000);

//Irrelevant validation here

move_uploaded_file($_FILES['Filedata']['tmp_name'], $_SERVER['DOCUMENT_ROOT']."/content/songs/file.mp3");

And that returns OK to the browser allong with my success message but the file doesn't exist, when I look in the sites error log i get

[Fri Oct 23 09:53:44 2009] [error] [client 192.168.0.1] PHP Warning:  move_uploaded_file(Photo on 2009-10-09 at 22.51 #2.jpg) [<a href='function.move-uploaded-file'>function.move-uploaded-file</a>]: failed to open stream: Permission denied in /var/www/html/development/scripts/open/signup/uploadtest.php on line 25, referer: http://dev-env-1.samrudge.co.uk/account/main
[Fri Oct 23 09:53:44 2009] [error] [client 192.168.0.1] PHP Warning:  move_uploaded_file() [<a href='function.move-uploaded-file'>function.move-uploaded-file</a>]: Unable to move '/phptemp/phpTxmy2f' to 'Photo on 2009-10-09 at 22.51 #2.jpg' in /var/www/html/development/scripts/open/signup/uploadtest.php on line 25, referer: http://dev-env-1.samrudge.co.uk/account/main

/phptemp/ has CHMOD 777 and apache has read write access to the entire web directory

Whats wrong?
Thanx,
Sam

samarudge 16 Posting Whiz

If you only have basic FTP access I don't think its possible, some admin panels will let you do it (if you have one) but other than that no ideas so sorry =(

samarudge 16 Posting Whiz

Step 1: Get reseller hosting;
90% of reseller hosting services will let you host UNLIMITED WEBSITES with UNLIMITED BANDWIDTH at no extra cost (Although some you have to pay for your domain names but that's about $10 a year)
Most reseller hosting will allow you to completely custom brand your hosting so people will think it is you providing the hosting when it is actually a big company. They can also handle your payments and keep everything secure.
Step 2: Create your own site;
If your clients come on to your site and it is badly designed, buggy, ugly and/or just generally a bit rubish, people won't want you to design there websites.
Step 3: ADVERTISE!!!
Make sure people know who you are, you may need to get involved in some projects that don't pay much at first just to get your name out there. Be active on forums and add your URL to your sig-block so people know who you are.
Step 4: Software;
As for software a good investment would be a good HTML/PHP editor such as Dream-weaver, i know its a bit pricey but it has built in FTP and loads of code hints as well as integration with Flash and Photoshop for really easy editing

Anything I missed anyone???

samarudge 16 Posting Whiz

Not 100% sure what you are trying to do but mysql(i)_insert_id() can get the primary key from the last insert statement
http://php.net/mysql_insert_id
http://php.net/mysqli_insert_id (If using MYSQLI link)

samarudge 16 Posting Whiz

Not 100% sure what you are trying to do but mysql(i)_insert_id() can get the primary key from the last insert statement
http://php.net/mysql_insert_id
http://php.net/mysqli_insert_id (If using MYSQLI link)

samarudge 16 Posting Whiz

Several ways to run a PHP script outside browser:
CLI (Command Line Interface)
Call your script like #php /path/to/your/script.php from terminal/CMD
Telnet/SSH (Same as above)
Crond
On *NIX systems there is something called CROND which allows you to execute scripts according to a schedule E.G. every hour, every day, the first monday of each month etc.
Look up CROND tutorials on Google and use the above CLI example as your script
#!
Not sure if this works but you may be able to run it by adding the line #! /etc/php to the first line of your script then run it by double clicking (Only on Unix/Linux)
If I have not answered your question just say but those are the main ways of running scripts outside browser

samarudge 16 Posting Whiz

Hi,
What is the function/opperator to calculate a power with C#

I tryed

powerof = anumber ^ anothernumber;

and that clearly doesn't work (1^3 is 2, 2^3 is 1 etc.)

How do I do it???

I looked under Math. functions and there was nothing and I spent ages Googleing

Thanx,
Sam