Showing posts with label general. Show all posts
Showing posts with label general. Show all posts

Sunday, March 12, 2017

Fixing textext 0.4.4 in Inkscape 0.91 with OSX

textext is a great Inkscape extension that allows to incrustante LaTeX formulas in the drawings. However, it seems that textext was last updated in 2010 (v0.4.4) and since then some python calls to the md5 package have become deprecated.
This is obviously an issue for recent OS. 
Traceback (most recent call last):
  File "textext.py", line 210, in cb_ok
    self.callback(self.text, self.preamble_file, self.scale_factor)
  File "textext.py", line 369, in
    converter_cls, old_node))
  File "textext.py", line 387, in do_convert
    new_node = converter.convert(text, preamble_file, scale_factor)
  File "textext.py", line 879, in convert
    return PdfConverterBase.convert(self, *a, **kw)
  File "textext.py", line 750, in convert
    self.tex_to_pdf(latex_text, preamble_file)
  File "textext.py", line 727, in tex_to_pdf
    exec_command(['pdflatex', self.tmp('tex')] + latexOpts)
  File "textext.py", line 592, in exec_command
    raise RuntimeError("Command %s failed: %s" % (' '.join(cmd), e))
RuntimeError: Command pdflatex /var/folders/2y/h0000gn/T/tmpUcu75l/tmp.tex -interaction=nonstopmode -halt-on-error failed: [Errno 2] No such file or directory

Monday, December 7, 2015

Hide Matlab Start Bar / Busy Bar / Status Bar

Reclaim precious screen space by disappearing the "Start bar" (in older versions of Matlab) whose main purpose is saying Busy.

com.mathworks.mde.desk.MLDesktop.getInstance.getMainFrame.getStatusBar.getParent.setVisible(0);


Source: http://www.mathworks.com/matlabcentral/newsreader/view_thread/152888

Sunday, January 12, 2014

SMC reset. Random system freezes, and unresponsive keyboard & touchpad after plugging USB device

Lately I had some problems with my macbook air. Random system freezes, and unresponsive keyboard & touchpad after re-opening the lid.

I first tried a memory diagnostic (by booting pressing 'D') to discard a memory fault, but the RAM was OK. After surfing the web I found that I may have been needing to reset the SMC (System Management Controller). So I did, it but in the end the system continued to randomly freeze after plugging some USB devices.

Reset Macbook Air's SMC
  1. Shut down the computer 
  2. Plug in the power adapter if its not already connected.
  3. On the built-in keyboard, press the (left side) Shift-Control-Option keys and the power button at the same time.
  4. Release all the keys and the power button at the same time.
  5. Reboot as usual.
The procedure for other Mac's is slightly different, so it's better to look them up here or here.

Solution to unresponsive keyboard & touchpad after plugging USB device

In the end the culprit of this behavior was the android file transfer tool. What solved my issue was to disable the autostart of this application.



    Saturday, October 15, 2011

    Optimizing Mac OS X for SSD drives (update: Safe Sleep tuning)

    This article: http://poller.se/2010/08/optimizing-mac-os-x-for-ssd-drives/ recommends to reduce the writes on SSD drives to increase their lifespan. The proposed actions go in the direction of reducing un-necessary writes and disable legacy options linked to spinning hard drives.
    I'm using: 1(with modified deepsleepdelay), 2, 3 and 4.

    1. Alter the Sleeping mode 
    By default, when closing the lid on a MacBook, the content of the ram (random-access memory) is saved to disk for safety. The ram is still powered on however, and is used when starting up again. The content saved on disk is only used in case of a power loss.

    • This behavior can be changed so that ram content is not saved to disk.
    $ sudo pmset -a hibernatemode 0 
    This means that the laptop will never enter DeepSleep (or hibernation, that is the ram is always powered and in the event of a power loss the state is lost), and in this case the sleepimage /var/vm/sleepimage can also be removed.

    • The default setting (SafeSleep) can be restored with: 
    $ sudo pmset -a hibernatemode 3

    • There is an intermediate behavior of SafeSleep, which delays the writing of the sleepimage for some time. This is controlled by the deepsleepdelay parameter (or standbydelay), by default set to 4200 seconds, meaning that the seleepimage is written 70 minutes after closing the lid. This may be too short.
    To make it wait 12hs before writing the image to disk run:
    $ sudo pmset -a deepsleepdelay 43200
    or, on systems with OS X ≥ 10.6.8,
    $ sudo pmset -a standbydelay 43200
    during this time only the ram is powered and the wakeup is immediate. After 12 hours of sleep, the memory content is dumped to the sleepimage and the memory is powered off.
    I'm currently trying this setting.

    In conclusion, SafeSleep (hibernatemode 3) combined with deepsleepdelay <seconds> covers a wide range of sleepping/hibernating behaviors. It can even emulate the hibernatemode 0 (never save a sleepimage) just by setting a deepsleepdelay big enough.

    2. Disable Hard drive sleep 
    Putting SSD hard drives to sleep has no benefit. 
    This can be disabled under System Preferences -> Energy Saver

    3. Disable Sudden motion sensor 
    $ sudo pmset -a sms 0

    4. Enable noatime for SSD filesystems 
    Every time a file is accessed its access time is modified to reflect it. This can be disabled to save additional writes. To do this for the local filesystem create the file /Library/LaunchDaemons/com.noatime.root.plist with the following content.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
        <dict>
            <key>Label</key>
            <string>com.noatime.root</string>
            <key>ProgramArguments</key>
            <array>
                <string>mount</string>
                <string>-uwo</string>
                <string>noatime</string>
                <string>/</string>
            </array>
            <key>RunAtLoad</key>
            <true/>
        </dict>
    </plist>
    This will execute mount -uwo noatime / upon system startup,

    5. Disable Spotlight 
    $ sudo mdutil -a -i off

    Sources and resources:
    http://larvecode.tumblr.com/post/9622045759/osx-on-ssd
    http://poller.se/2010/08/optimizing-mac-os-x-for-ssd-drives/
    http://www.macworld.com/article/53471/2006/10/sleepmode.html
    http://www.uponmyshoulder.com/blog/2011/deep-sleep-on-macbook-air-late-2010/
    http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man1/pmset.1.html

    Friday, October 22, 2010

    Disabling Option-Space (and AltGr-Space) key combination for non-breaking space

    Solving “bash: grep: command not found” on OSX and Linux terminals.
    How many times this happened to you?

    $ find .  | grep something
    bash: grep: command not found
    

    This problem affects non US-keyboard users, suffering from sloppy finger.
    Typing the pipe ( | ) in a command line requires the combination with Option or AltGr in most non US keyboard, and after the pipe the use of the space is not mandatory but certainly a touch of distinction.
    The problem is that by the time when the Space key is hit, some sloppy finger is still firmly pressing the Option key resulting in the Option-Space combination (or AltGr-Space). 
    It turns out that the combo produces something that looks exactly like a sp character, but that bash does not recognize as a space. A closer inspection reveals that the Option-Space combination instead of producing the sp byte \040, produces the sequence \302\240 which turns out to be Unicode for non-breakable space.


    While working with OSX my solution for several moths was to remove the spaces from the command, recently I found a simpler solution which was described here.
    Add the following text to the key binding file (it may not exist yet, if so create it) : ~/Library/KeyBindings/DefaultKeyBinding.dict
      {
        "~ " = ("insertText:", " ");
      }
    this file defines the key-sequence mappings for all Cocoa applications. In particular with this line, every time Option-Space is pressed the non-breakable space it is replaced by a regular space. This file can be used for further customizing the behavior of key sequences. The following links provide more information about key binding:
    http://hints.macworld.com/article.php?story=2008031611584277
    http://www.object.com/TechNotes/DefaultKeyBinding.html
    http://www.hcs.harvard.edu/~jrus/site/cocoa-text.html


    The solution for Linux is described here. The non-breakable space can be disabled using a xkb option in xorg.conf, adding the following in the InputDevice section related to your keyboard
      ...
      Option "XkbOptions"    "nbsp:none"
      ...
    or calling
      setxkbmap -option "nbsp:none"
    
    in a console, or initialization file (~/.bash_profile).


    Regarding Unicode, I recommend to read this article: "The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!)", it gives a brief historical overview and tells pretty much everything one should know about Unicode.

    A nice observation from Poul-Henning Kamp, that we don't use of Unicode as part of our programming languages: "Sir, Please Step Away from the ASR-33!".

    Saturday, February 27, 2010

    Create an ITunes account Tunes App Store account without a credit card

    Follow the instructions:

    http://support.apple.com/kb/HT2534

    Tuesday, September 22, 2009

    More resources

    A Guide to “Things Mac OS X” on the Net..

    http://magicpubs.com/mac/macosx.html


    NetBSD/macppc Frequently Asked Questions

    http://www.netbsd.org/ports/macppc/faq.html