الاثنين، 6 سبتمبر 2010

SWFUpload jQuery Plugin رفع الملفات بواسطة الجى قيورى

SWFUpload jQuery Plugin
When I first stumbled across SWFUpload about two years ago I was impressed by how easy it was to implement. However, their example code has always bugged me as being rather crap, having to assign a separate global event handler for each event, and the lack of multiple handlers for a single event.

Using jQuery (the solution to all things painful), I've written a plugin to create a real event dispatcher for SWFUpload without modifying the SWFUpload core!


The SWFUpload jQuery Plugin
This plugin makes working with SWFUpload easier!

Get straight to the source code at my SWFUpload jQuery Plugin repository on GitHub.

And the benefits are...
■Native jQuery event handling using .bind()
■Ability to assign multiple callbacks per event
■Makes multiple SWFUpload instances on a single page easier to manage
■Ability to completely separate SWFUpload object from UI code (callbacks)
■Assign event handlers before SWFUpload instance is even created!
■No global functions or variables needed!
■A nice, chainable solution!
Live Examples
Here are some live examples you can pull apart. Although the UI is not pretty, it demonstrates how you listen to events, and from there you can create whatever UI you want.

Although these examples upload to a PHP script on my server, the uploaded files are not saved.

■Single Uploader
■Multiple Uploaders
How do I use it?
If you know how to use SWFUpload already, the following should be fairly easy to consume.


$(function(){

$('.swfupload-control').swfupload({
// Backend Settings
upload_url: "../upload.php", // Relative to the SWF file (or you can use absolute paths)

// File Upload Settings
file_size_limit : "102400", // 100MB
file_types : "*.*",
file_types_description : "All Files",
file_upload_limit : "10",
file_queue_limit : "0",

// Button Settings
button_image_url : "../multiinstancedemo/XPButtonUploadText_61x22.png", // Relative to the SWF file
button_placeholder_id : "spanButtonPlaceholder",
button_width: 61,
button_height: 22,

// Flash Settings
flash_url : "../swfupload/swfupload.swf"

});


// assign our event handlers
$('.swfupload-control')
.bind('fileQueued', function(event, file){
// start the upload once a file is queued
$(this).swfupload('startUpload');
})
.bind('uploadComplete', function(event, file){
alert('Upload completed - '+file.name+'!');
// start the upload (if more queued) once an upload is complete
$(this).swfupload('startUpload');
});

});


How does it work?
Rather than creating a SWFUpload instance and assigning handlers directly, it associates the SWFUpload instance with an element in the DOM, and all events handlers are bound to that DOM element.

Calling methods on the SWFUpload instance
The following code will execute the startUpload method on all SWFUpload instances that exist within the selector .your-swfupload-control.


$('.your-swfupload-control').swfupload('startUpload');
Getting properties on the SWFUpload instance
Sometimes you just need to get at the SWFUpload instance... easy!


var swfu = $.swfupload.getInstance('.some-selector-for-your-control');
alert(swfu.settings.custom_settings.your_custom_setting);
Additional event handlers
Due to the way SWFUpload works, all event names must be defined before the SWFUpload instance is created. This means if you are using any plugins that define additional events, you'll need to add them to the handler list before the SWFUpload instance is created.


$.swfupload.additionalHandlers('some_plugin_handler');

The source code
If you missed it the first time, you can download all the source code including all support files and example files from my SWFUpload jQuery Plugin repository on GitHub.

Enjoy!


رابط الموضوع : http://github.com/ifunk/swfupload-jquery-plugin/tree/master

ضغط ملفات ال javascript وذلك لتوفير الترافيك وسرعة التصفح

قم بضغط ملفات موقعك الخاصة بال جاف اسكريبت الى احجام اقل بواسطة هذا الموقع
http://compressor.ebiene.de/

حيث سيسرع لك عرض موقعك ويورفر لك الترافيك

jQuery Alert Dialogs رسائل تحذير مع رسائل نجاح بالجى قيورى

jQuery Alert Dialogs
Cory S.N. LaViska (creator of one of my favorite jQuery Plugins – contextMenu.js) released version 1.0 of jQuery Alert Dialogs a few days ago. It looked interesting and worth some investigation. To test things out I decided to try and recreate the dialogs from one of my earlier posts ASP.NET Popup Message Box User Control which was originally based off a post by Janko.

Cory’s new plugin “aims to replace the basic functionality provided by the standard JavaScript alert(), confirm(), and prompt() functions.” I believe he achieved this in a good looking manner that is straightforward and simple to implement. The title and message of the dialog can be set before they are called. The dialog is also draggable when the jquery ui draggable plugin is included. Finally, the dialogs are dismissed in most browsers when the enter or esc key is pressed.

I really wanted to have the four types of alerts from my earlier post though (warning, error, success and info) since I use them all the time. It was pretty easy to tweak Cory’s CSS and the plugin to pass in the type of alert I wanted. You will find my modified version of the plugin in the download.

Live Demo | Download (HTML, CSS and jQuery)


Screenshot of End Product:













To call Cory’s version of the alert dialog the following is used jAlert('This is a custom alert box', 'Alert Dialog'); where the first parameter is the message and the second is the title. In my version jAlert('error', 'This is the error dialog box with some extra text.', 'Error Dialog'); I just pass in the type of alert I want (error, warning, success or info) as the first parameter and then the message and title.

In an upcoming post I will show you an easy way to set these dialogs up to fire after a postback and probably how to use them with Cory’s contextMenu.js plugin.

For more details on the jQuery Alert Dialog plugin, be sure to see Cory’s website. Also be sure to checkout the demo and download.

رابط التحميل http://beckelman.net/file.axd?file=jQueryAlertDialogs.zip
رابط التجربة http://beckelman.net/Demos/jQueryAlertDialogs/Default.aspx

Linux on the WRT54G طريقة تركيب نظام لينكس على الرواتر

Linux on the WRT54G


BatBox wrt54g distribution Version 0.61


This is a mini Linux distribution for the Linksys wrt54g. In about 20 seconds, you can install a small set of Linux tools to your access point's ramdisk. The distribution is geared towards those who are curious about casually exploring the internal workings of this device. The installation is strictly to the ram disk of the box. No permanent changes are made. If you mess something up, power-cycle the box.

Upon completion of the installation, you'll be able to telnet into the box and have a system with basic tools such as syslog, httpd (with cgi-bin support), vi, snort, mount, insmod, rmmod, top, grep, ls, ifconfig, iptables, ssh, iptraf etc.

To install from MS Windows, see the README file. To install from Linux or OSX, do the following : Either modify the script "wrt54g.sh" for the ip address and password of your router, or pass them in as arguments to the script. By default the script uses Java to move files to the wrt54g. If you would prefer wget or curl, uncomment the appropriate lines in the script. I had a problem with older version of wget translating escaped characters before passing the URL on to the server. Your mileage may vary. The WAN port of the box must be configured for the installation to succeed.

The distribution has been tested on Linksys firmware up to version version 4.00.7. I believe it will work on most other versions of official Linksys firmware. My installation has been tested on Linux, OSX, and Windows (with the addition of the Cygwin toolset). I have had reports that my distribution also works on wrt54gs boxes.

Upon successful execution of the script, you will be able to telnet to your box and start exploring its capabilities. Note that there is no login prompt, you telnet directly in as root. Be careful. This is for development use and is not meant to be deployed on the open Internet. You may want to review the iptables commands executed in the install script. They work for my Version 1 wrt54g, but later versions may have different logical ethernet devices. With my Version 1 box, the telnet daemon is not available on the WAN side of the box. A small wrt54g ssh daemon is included ( but not installed by default ) for those that need security.

The alternate web server is installed on port 8000 of the box.

In current versions of the distribution, the tar file "distro.tar" is quite sparse. If you wish to change the files sent to the box, untar distro.tar and add or subtract files from the "options" subdirectory, then recreate the tar file. Normally you should not run the install script more than once for a power-cycle of the box. i.e. if you want to run the install again, reset the wrt54g first.

I have attempted to limit all changes to the ram disk, but there are no guarantees that you will not damage your unit by using these tools.

Not much news on the wrt54g in quite a while. As for me, I've been a bit busy trying my hand at writing an iPhone and iPod touch application. It's a bit of a different endeavor for me, but I had a good time doing it. The application was inspired by the AppleTV that I reviewed a while back. It doesn't make rude noises or calculate your tips for you, but you can check it out here.


For you weather fans, I now have my weather station online being served up through my wrt54g and my NSLU2

روابط مهمة

http://bostonist.com/profile/el3ab

http://sfist.com/profile/el3ab

http://shanghaiist.com/profile/el3ab

http://torontoist.com/profile/el3ab

http://londonist.com/profile/el3ab

http://austinist.com/profile/el3ab

http://bostonist.com/profile/el3ab

http://chicagoist.com/profile/el3ab

http://dcist.com/profile/el3ab

http://gothamist.com/profile/el3ab

http://houstonist.com/profile/el3ab

http://laist.com/profile/el3ab

http://phillyist.com/profile/el3ab