Sunday, July 20, 2014

s3fs "Transport endpoint is not connected" error on ubuntu

So this error can probably be cause by many reasons:

s3fs "Transport endpoint is not connected" error

My issue was caused when I tried mounting my s3 bucket with the s3://mybucket in the name. Then I wasn't actually unmounting it until I ran

sudo fusermount -u /mnt/sshfs

Then when I reran the s3fs command it worked. 

s3fs mybucket /mnt/s3_upload/

use the "d" and "f" flags for the s3fs to give me debugging output. 

Saturday, February 1, 2014

How to accept command line argument with octave

So I am wanting to accept command line arguments and the "octave -help" didn't really show me what I wanted. So like many other languages you can use argv to collect command line, here is an example.

Suppose I want to create a test.m file that will accept 4 command line inputs like so:

octave test.m 1 2 3 4

To do that I would do:

%Accept standard in
n1 = str2num(argv(){1})
n2 = str2num(argv(){2})
n3 = str2num(argv(){3})
n4 = str2num(argv(){4})
t=n1+n2+n3+n4;     %Do calculations

printf("%d\n", t)  %Print standard out...

That way I can do what I wanted.

Friday, January 24, 2014

How to install ctypes on mac

So when I was trying to install ctypes on mac I was getting this compile error:

clang: warning: argument unused during compilation: '-mno-fused-madd'
In file included from source/_ctypes.c:110:
build/temp.macosx-10.9-intel-2.7/libffi/include/ffi.h:161:3: error: unknown type name 'ffi_abi'
  ffi_abi abi;
  ^
build/temp.macosx-10.9-intel-2.7/libffi/include/ffi.h:183:3: error: unknown type name 'ffi_sarg'
  ffi_sarg  sint;
  ^
build/temp.macosx-10.9-intel-2.7/libffi/include/ffi.h:184:3: error: unknown type name 'ffi_arg'
  ffi_arg   uint;
  ^
build/temp.macosx-10.9-intel-2.7/libffi/include/ffi.h:267:4: error: unknown type name 'ffi_abi'
                        ffi_abi abi,
                        ^
In file included from source/_ctypes.c:126:
source/ctypes.h:71:2: error: unknown type name 'ffi_closure'
        ffi_closure *pcl; /* the C callable */
        ^
source/_ctypes.c:162:21: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
        parg->size = self->b_size;
                   ~ ~~~~~~^~~~~~
source/_ctypes.c:304:9: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
                             ctypes_dlerror());
                             ^~~~~~~~~~~~~~~~
source/ctypes_dlfcn.h:19:24: note: expanded from macro 'ctypes_dlerror'
#define ctypes_dlerror dlerror
                       ^
source/_ctypes.c:807:9: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
        size = PyString_GET_SIZE(value);
             ~ ^~~~~~~~~~~~~~~~~~~~~~~~
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/stringobject.h:92:32: note: expanded from macro 'PyString_GET_SIZE'
#define PyString_GET_SIZE(op)  Py_SIZE(op)
                               ^~~~~~~~~~~
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/object.h:116:56: note: expanded from macro 'Py_SIZE'
#define Py_SIZE(ob)             (((PyVarObject*)(ob))->ob_size)
                                 ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
source/_ctypes.c:982:11: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        length = PyInt_AS_LONG(proto);
               ~ ^~~~~~~~~~~~~~~~~~~~

I fixed it by following the info on this thread:
https://trac.macports.org/ticket/22418

Which says to go to line 167 in setup.py and comment out the

 build_ext.build_ext.build_extensions(self)

to

 #build_ext.build_ext.build_extensions(self)

That fixed it so I could finish the install.

Wednesday, January 22, 2014

How to turn on spell check in the vi vim editor

I always forget to spell check in Latex coding projects when I am using vi or vim. You can enter this command while in a vim session:

:setlocal spell spelllang=en_us

Un-closable "Restore Windows" Message mac openOffice (FIX)

This was annoying and I waisted too long trying to figure this out so hopefully this helps someone.

So I was getting this OpenOffice pop-up box that I couldn't close and it was preventing me from using OpenOffice.

So I searched for this file:

find / -name "org.openoffice.script.savedState"

Then I did this:

rm -R "/Users/btaylor/Library/Saved Application State/org.openoffice.script.savedState"

Then I reopened OpenOffice and it was fixed (make sure it is closed completely before you begin)
This is the link that ended up helping me:

https://forum.openoffice.org/en/forum/viewtopic.php?f=74&t=12426#p58403