tisdag 25 december 2012

reload .bashrc after changes

http://askubuntu.com/a/152463

Please place those lines -
export PATH=$PATH:/to/path/play
, in .bashrc file in your user directory and restart the system OR just execute the following command:
source ~/.bashrc

onsdag 5 december 2012

Getting the response header

http://stackoverflow.com/a/2444499/517457


$(document).ready(function() { 
    $("[name='submit']").click(function() { 
        $.ajax({
            type: "POST",
            data: $(".form-signup").serialize(),
            url: "external.asp", 
            success: function(output, status, xhr) { 
              alert(xhr.getResponseHeader("Content-Length"));
            },
            error: function(output) {
              $('.sysMsg').html(output);
            }
        }); 
    }); 
});

söndag 25 november 2012

upgrade or downgrade java version ubuntu/linux

http://www.webupd8.org/2012/01/install-oracle-java-jdk-7-in-ubuntu-via.html

To add our PPA and install the latest Oracle Java 7 in Ubuntu (supports Ubuntu 13.04, 12.10, 12.04, 11.10, 11.04 and 10.04), use the commands below:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer

After the installation finishes, if you wish to see if it was successful, you can run the following command:
java -version
It should return something like this:
java version "1.7.0_04"
Java(TM) SE Runtime Environment (build 1.7.0_04-b20)
Java HotSpot(TM) Server VM (build 23.0-b21, mixed mode)

The package installs all the Java binaries, so you can also try "javac -version" which should return "javac 1.7.0_04" and so on (the "_04" part of the version can be different because I'm constantly updating the PPA with the latest Oracle Java 7 version).

If for some reason, the Java version in use is not 1.7.0, you can try to run the following command:
sudo update-java-alternatives -s java-7-oracle

Update: the Oracle Java 7 (JDK & JRE) PPA is now available for Ubuntu 12.10 Quantal Quetzal and 13.04 Raring Ringtail.

Update 2: the installer now requires you accept the Oracle license before the installation begins. This is only required once. If for some reason you need the installation to be automated, you can run the following command to automatically accept the Oracle license:
sudo echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections



Removing Oracle Java 7


If you don't want to use Oracle Java (JDK) 7 anymore and want to go back to OpenJDK, all you have to do is remove the Oracle JDK7 Installer and the previous Java (OpenJDK, etc.) version will be used:
sudo apt-get remove oracle-java7-installer

tisdag 18 september 2012

TinyMCE in JEditable


$.fn.tinymce = function(options){
   return this.each(function(){
      tinyMCE.execCommand("mceAddControl", true, this.id);
   });
}
function initMCE(){
   tinyMCE.init({
        mode : "textarea",
        theme : "advanced",
        ... // YOUR CUSTOMIZATION
      });
}

initMCE();

$.editable.addInputType('mce', {
   element : function(settings, original) {
      var textarea = $('<textarea id="'+$(original).attr("id")+'_mce"/>');
      if (settings.rows) {
         textarea.attr('rows', settings.rows);
      } else {
         textarea.height(settings.height);
      }
      if (settings.cols) {
         textarea.attr('cols', settings.cols);
      } else {
         textarea.width(settings.width);
      }
      $(this).append(textarea);
         return(textarea);
      },
   plugin : function(settings, original) {
      tinyMCE.execCommand("mceAddControl", true, $(original).attr("id")+'_mce');
      },
   submit : function(settings, original) {
      tinyMCE.triggerSave();
      tinyMCE.execCommand("mceRemoveControl", true, $(original).attr("id")+'_mce');
      },
   reset : function(settings, original) {
      tinyMCE.execCommand("mceRemoveControl", true, $(original).attr("id")+'_mce');
      original.reset(this);
   }
});
 
In your JEditable initiation make it of type mce. So:


    $(".edit").editable('ajax/save.php?editnotetext', {
        type
: 'mce',
       
... // etc
   
});
 





http://stackoverflow.com/a/5969896/517457

söndag 2 september 2012

Sound fix for SKYPE in UBUNTU

http://ubuntuforums.org/showpost.php?p=11086836&postcount=12 

Re: skype can only see pulseaudio, but not alsa devices

there's an easier way to make skype (i'm using 2.2.0.35) not use pulseaudio - there's no need to uninstall or disable pulse:

create an executable file
/usr/bin/skype-wrapper
with the following content:
PULSE_SERVER=127.0.0.1 /usr/bin/skype &

don't forget to also change the desktop file so that the new script will be called when choosing skype from the start menu:
edit file /usr/share/applications/skype.desktop
and change
Exec=skype
to
Exec=skype-wrapper

explanation:
PULSE_SERVER is a way to tell skype to use a pulse instance on a machine other than the local.
invalid values (e.g. empty string) make skype interrupt the startup and quit - so we give the local adress which is valid but obviously pulse runs at user level so it's not reachable via network, even not on the local machine.
skype tries to use pulse but cannot reach/connect to it and falls back to alsa.
the result on ubuntu natty is that pulse continues to work unmodified and skype can be configured to use whatever you want to



HOWEVER
the real problem - at least in my case - wasn't skype. the strange distortion came from somewhere below and was noticeable also in some other programs.
the real solution for my case was not to disable pulseaudio but to fix it: edit file /etc/pulse/default.pa
and change
load-module module-udev-detect
to
load-module module-udev-detect tsched=0

see http://pulseaudio.org/wiki/BrokenSoundDrivers

Last edited by thomas.horner; July 26th, 2011 at 03:11 AM..