dimanche 7 juin 2009

Comment télécharger un film sur un site Web ?


Direction la page officielle de Home sur Youtube. On peut visionner le film sur son PC mais combien souhaiterait le télécharger ? Assurément, beaucoup et comme Yann a dit qu’on pouvait, alors allons-y !

* Installez l’extension Firebug pour Firefox.
* Lancez le film sur le site Youtube. Optez sur la HD de préférence.
* Lancez Firebug (disponible dans le menu Outils de Firefox).
* Cochez les 3 cases de l’onglet Réseau et cliquez sur “Activer les panneaux…”
* Repérez la ligne avec le plus gros poids (790 MégaOctets environ).
* Clic droit et copiez l’adresse.
* Collez l’adresse dans votre navigateur ou votre gestionnaier de téléchargement préféré.



* Vous récupérerez alors un fichier FLV lisible avec les plus récentes versions du lecteur VLC.

Notez que cette méthode permet de télécharger n’importe quelle vidéo ou tout fichier musical mp3 issu d’un site de streaming. Merci Firebug ! Merci Yann Arthus-Bertrand !

jeudi 4 juin 2009

openAndCenterWindow in JavaScript


Writing Your Own JavaScript Functions

By thau!

Next, notice that I've put the JavaScript declaring the function in the head of the page. You can declare functions in either the head or the body of an HTML page, but I like to declare my functions in the head because that way I don't have to search for them all over the page.

Finally, it's important to remember that the browser reads the page from the top down. When it sees the word function, it remembers the function name and the lines of JavaScript you've associated with that name. However, the JavaScript between the curly brackets doesn't actually execute until the onClick in the link calls the function. When we start putting more than one function on a web page, you'll see why it's important to keep this in mind.

Writing Flexible Functions

The code in Figure 6-3 does a good job of opening and centering a window containing No Starch Press's home page. But what if you wanted another link to open and center a different window with a different URL in it-- Webmonkey's, for example?

One approach would be to write a second function that looks just like the first one, the only difference being that you'd replace the line

_______________________________________________________________________________________
var the_window =
window.open('http://www.nostarch.com','the_window','height=200,
width=200');
_______________________________________________________________________________________

with the line

_______________________________________________________________________________________
var the_window =
window.open('http://www.webmonkey.com','the_window','height=200,
width=200');
_______________________________________________________________________________________

This would work fine, but it's not a good idea to have two functions that do almost exactly the same thing. First of all, it's wasteful. If you could write one function that worked regardless of the URL, you'd save both typing and download time. Even more important, if you want to change how you're doing the centering, you'll have to change two functions instead of just one.

Using Parameters

Luckily, there's a way to make your function more flexible. The trick is to add a parameter. Remember, the alert() function takes one parameter--the words you want to appear in the alert box.
You can write the openAndCenterWindow() function to take a parameter, too. In this case, the parameter would be the URL of the web page you want to appear in the window. In general, a function'sparameter is whatever item of information the function needs in order to do its job--text to be displayed, a URL to link to, or whatever. Many functions use multiple parameters.

The code in Figure 6-4 shows how to add a parameter to your function and how to call the function with this parameter.

________________________________________________________________________________________

< html >
< head >
< title >Getting Centered Functionally< /title >
< script type = "text/javascript" >
< !-- hide me from older browsers
function openAndCenterWindow(the_url){
if ((parseInt(navigator.appVersion) > 3) &&
(navigator.appName == "Netscape")) {
var the_window = window.open(the_url,'the_window',
'height=200,width=200');
var screen_height = window.screen.availHeight;
var screen_width = window.screen.availWidth;
var left_point = parseInt(screen_width / 2) - 100;
var top_point = parseInt(screen_height / 2) - 100;
the_window.moveTo(left_point, top_point);}}
Writing Your Own JavaScript Functions 87
// show me -->
< /script>
< /head>
< body >
< a href= "#"
onClick="openAndCenterWindow('http://www.webmonkey.com/');
return false;">
Click me to put the Webmonkey home page in a small centered
window< /a >


< a href = "#"
onClick = "openAndCenterWindow('http://www.nostarch.com/');
return false;">
Click me to put the No Starch Press home page in a small
centered
window< /a>
< /body>
< /html>


_______________________________________________________________________________________
Figure 6-4: Opening and centering a window with a parameter

Line-by-Line Analysis of Figure 6-4

The tag for Webmonkey,

< a href = "#"
onClick = "openAndCenterWindow('http://www.webmonkey.com/');
return false;">
Click me to put the Webmonkey home page in a small
centered window< /a>

calls the function with the URL for Webmonkey in parentheses
(see the result in Figure 6-5). Here Webmonkey's URL goes into
the function just as the words go into the alert() function,
but instead of any random string, it's a URL.

Similarly, the tag

< a href = "#"
onClick = "openAndCenterWindow('http://www.nostarch.com/');
return false;"> Click me to put the No Starch Press home page
in a small centered window< /a>

calls the function with the URL for No Starch Press.

Now let's look at the function itself. Only two lines differ
from those in Figure 6-3. The first line of the function now looks like this:

function openAndCenterWindow(the_url)

Notice that a word appears inside the parentheses now.
This term is a variable, storing whatever value you'll use
when you call the function. So if the line

openAndCenterWindow("happy happy!");

calls the function, the variable the_url holds the value "happy happy!".
When we call the function in Figure 6-4 as follows, the variable
the_url holds the value "http://www.nostarch.com/":


< a href = "#"
onClick = "openAndCenterWindow('http://www.nostarch.com/');
return false;"> Click me to put the No Starch Press
home page in a small centered window< /a>


The second line in the function that differs from Figure 6-3 is Y,
which opens the window. In Figure 6-3 we opened the window with
a web page:

var the_window = window.open('http://www.nostarch.com/', 'the_window', 'height=200,width=200');

In Figure 6-4 we open the window with the variable that was set when
the function was called:

var the_window =
window.open(the_url, 'the_window', 'height=200,width=200');

JavaScript sees the variable the_url and knows it's a variable
because no quotes surround it. If the function has 'http://www.nostarch.com/'
inside the parentheses, like this

openAndCenterWindow('http://www.nostarch.com/');

the variable the_url has the value http://www.nostarch.com/, so the window opens with the No Starch Press home page. Figure 6-6 shows you graphically what's going on here.


Function Definition
function openAndCenterWindow(the_url)
{
var the_window=
window.open(the_url, ", 'height=200,width=200');
}
Function Call
openAndCenterWindow('http://www.nostarch.com/');


Figure 6-6: Passing parameters

How to redirect browser to https (ssl) in php


Most of the e-commerce website uses payment gateway for online payment. And, those sites uses SSL (secure socket layer) connection to transfer data to and from the payment gateway.

In the common scenario, most of the sites uses “http” protocol and you can see “http” in the browser’s address bar. But in the above scenario,we need to redirect the browser to “https” which means that “Hypertext Transfer Protocol over Secure Socket Layer”.

Ok let’s see a real example, type “http://www.gmail.com” in browser after a while the “http” gets converted to “https” in address bar, which means this site is transferring the data over SSL protocal.
How to redirect the browser to https when site is using http protocal in PHP?

First of all, you should know that SSL must be installed in the server. To redirect the browser to “https” , we must know that the site is using SSL or not at the moment. And for this, there is a server variable in PHP called “HTTPS”. $_SERVER['HTTPS'] returns “on” values when the site is using SSL connection.
Function to redirect the browser to “https” in PHP

function redirectToHTTPS()
{
if ($_SERVER['SERVER_PORT']!=443)
{

$url = "https://".$_SERVER['SERVER_NAME'].":443".
$_SERVER['REQUEST_URI'];
header("Location: $url");

}
}

Above function is quite simple, you can call the function in that page where you’ve to redirect the browser to “https” .This function will preserver you script file name and query string in browser.
Redirecting whole website to “https” using .htaccess

You can call the above function in each and every page to redirect the browser to “https”. But rather than doing so it will be better to write three line of code in .htaccess file to redirect the whole website to use SSL connection throughout the pages.

RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

Just copy and paste the above code in .htaccess file then the whole website will be redirected to “https” when the browser is opened in “http” mode. The browser just get redirected using url rewriting in .htaccess.

Alpha Transparency using the Color Mixer


Flash 8 Tutorial

Tutorial by Jmx from AdobeFlashTutorial.com

Learn how to change the Alpha Transparency using the Color Mixer in flash.

Transparency of Alpha and Mixer color

Tutorial Flash 8. In the following tutorial i going to explain how to use the Mixer color panel, an animation will also be made where the alpha color of a figure will be changed “shape”. All the animation was carried out in the Scene.

1. First, create a new document (Ctrl. + J), of dimensions 250 * 200 pixels.



2. Select the hexagonal figure tool and then click in PolyStarTool.



3. In the panel of Properties select Options.
3.1 In the new panel showed select polygon y Number of sides then write in the blanket the number six.



4. The previous operations were to draw a hexagonal form.
4.1 Place this figure in coordinates X = 125.0 y Y = 100.0.



5. Insert a new keyframe (F6) at Frame # 20.
5.1 Open the palette of Color Mixer (Shift + F9) or Window >> Panels of Design >> Color Mixer.
5.2 Select the drawing of the keyframe # 20 and reduce the Alpha at 0 %.



6. Insert another new keyframe (F6) at Frame # 40.
6.1 Select the drawing of the keyframe # 40 and increase Alpha a 100 %.



7. Select any part among the keyframe 1 and 19.
7.1 Open the panel of Properties and select Tween Shape.



8. Repeat the same operation but now among the keyframe # 20 y 39.
8.1 At the end the time line will have to be like it is shown in the image.

With this step the tutorial is concluded, you see, it is very easy!.
The end.



Press Ctrl. + Enter and see the final animation. Thank you to visit and to support this page Web wich is made for people that want to learn more about this great program Flash 8. :)Until very soon:)









Download FLA File