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..