• Thickbox Recarregar página ao fechar

    0

    Passei por uma situação hoje aonde a simples ação de abrir uma janela model (thickbox) deveria alterar valores listados na janela.
    Por causa dessa situação um pouco incomum a página precisaria recarregar assim que a modal do thickbox fechasse.

    Procurando pela web encontrei algumas soluções diferentes, a maioria alterando a função tb_remove. Seria uma solução fácil, mas eu não queria produrar cada chamada da tb_remove no meu código para alterar a chamada da função.

    Este pedaço de código jQuery resolveu meu problema:

    <script type="text/javascript">
    $(document).ready(function(){
             //Remove tb_remove
    	$("#TB_imageOff,#TB_closeWindowButton,#btReset").unbind("click");
            //Expected behavior: close, reload and return false.
    	$("#TB_imageOff,#TB_closeWindowButton,#btReset").bind("click", function(){
    		tb_remove();
    		parent.location.reload(1);
    		return false;
    	});
    });
    </script>

    Funcionou perfeitamente ;)

  • Setting up a “web developper” ubuntu

    0

    I recently needed to re-install all my work environment and tough it would be a good idea to put my step-by-step here for future reference.
    If you’re thinking about move from windows to the open-source world, this may show you how simple is that.
    The first step is (off course) install all applications needed.

    Open your terminal and let’s get started!

    Replace open jdk by sun JDK.

    OpenJDK is a alternative to sun’s Java, but sun-java still the best to play with. So lets remove openjdk and replace it by sun JDK to squeeze more juice from our linux machine

    sudo add-apt-repository 'deb http://archive.canonical.com/ lucid partner';
    sudo aptitude update;
    sudo aptitude remove –purge openjdk-6-jre;
    sudo aptitude remove openjdk-6-doc openjdk-6-jre-headless openjdk-6-jre-lib;
    sudo aptitude install sun-java6-jdk sun-java6-jre sun-java6-plugin sun-java6-bin sun-java6-fonts;

    Install Apache2, MySQL, PHP5, Eclipse, SNV and GIT

    After install all the above software, we are making sure mod_rewrite is enabled.

    sudo apt-get install apache2 libapache2-mod-wsgi phpmyadmin php5 php5-common php5-cli subversion git-core git-gui git-doc eclipse;
    sudo a2enmod rewrite;
    sudo service apache2 restart;

    Now you need to give your own user permission to work without needing superuser permissions, replace username and usergroup by your own username.

    sudo chown username:usergroup /var/www

    Install last Django version

    , we will do it in 3 simple steps:

    1 – We will create a folder called “customApps” inside our home folder, and checkout the last varsion of django from subversion

    cd ~/;mkdir customApps;cd customApps;
    svn co http://code.djangoproject.com/svn/django/trunk/ django-trunk

    2- Now we need to discover where to put django in order to make it available for python applications:

    python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"

    This will give you a answer like this:

    /usr/lib/python2.6/site-packages

    3 – Now we will make a symbolic link inside the folder given in last command and make django-admin.py available to use everywhere.
    This simbolic link will point tou our recently downloaded django.
    The advantage of this approach is that you just need a “svn update” inside django folder to ensure the entire system to use last django version

    sudo ln -s `pwd`/django-trunk/django /usr/lib/python2.6/site-packages/django;
    sudo  ln -s `pwd`/django-trunk/django/bin/django-admin.py /usr/local/bin

    Activating Eclipse full powers

    Lets install Aptana plugin inside eclypse. It gives the best html, css and javascript support I’ve found, and also present the easiest way to install PDT and PyDev. (respectively plugins to code in php and python)

    1. From the Help menu, select Install New Software… to open the Install New Software dialog.
    2. Paste “http://download.aptana.com/tools/studio/plugin/install/studio” for the update site into the Work With text box, and hit the Enter (or Return) key.
    3. In the populated table below, check the box next to the name of the plug-in, and then click the Next button.
    4. Click the Next button to go to the license page.
    5. Choose the option to accept the terms of the license agreement, and click the Finish button.
    6. Restart your eclipse.

    You should see a screen like this:

    Eclipse with aptana plugin installed

    eclipse aptana plugin installed

    From this screen is really easy to install PDT, PyDev and support for javascript frameworks, just click in plugins, at right side of “studio”, and than in down tabs choose “featured”. Install PDT and PHP Debugger Support for PDT. In the Ajax tab, choose your preferred javascript framework. For python support choose Aptana PyDev under platform tab.

    Under Utilities tab, choose subversive and Git.

    All done, in next article we will see how to integrate eclipse with github (git) and bettercodes (svn)! See ya!

Page optimized by WP Minify WordPress Plugin