Posts

Showing posts from November, 2016

¿Cómo escribir tildes en QT4 Designer?

Image
Uno de los problemas al tratar de desarrollar una aplicación en español, es que QT4 Designer no permite escribir con tildes. Para solucionar este problema de mala ortografía, se debe desactivar los xmodifiers desde el terminal y luego ejecutar la aplicación: #!/bin/bash unset XMODIFIERS designer-qt4 & Problema resuelto!

How to run a Matlab function as a standalone executable

If you have a function, you can compile and run it without Matlab. To do that, just write a .m file like test_cpu.m  and leave it as follows: function [time]= test_cpu(n) if isdeployed      n=str2double(n); end A = rand(n,n); tic; fft(A); time = toc; disp(time); It's important check is the file is deployed (compiled) to convert the argument to double for avoid this error: Error using rand CLASSNAME input must be a class that supports RAND, for example, 'single' or 'double'. Error in test_cpu (line 2) MATLAB:rand:invalidOutputType Now, compile the file with the following command in your matlab cli: mcc -m test_cpu.m -o test_cpu To run the executable, you will get these errors: ./test_cpu: error while loading shared libraries: libmwlaunchermain.so: cannot open shared object file: No such file or directory ./test_cpu: error while loading shared libraries: libmwmclmcrrt.so.9.0.1: cannot open shared object file: No such file or directory

How to use GPU in Matlab scripts

Image
If you have an Nvidia Graphic Card, you must install nvidia drivers to get the best performance. To save an array to your GPU memory, just save it with gpuArray and to return it to your Ram use gather . A simple CPU example is the following: function [time]= cpu(n) A = rand(n,n); tic; B = fft(A); time = toc; If we want use the GPU, just add the bold lines: function [time]= gpu(n) A = rand(n,n); % send A to the GPU A = gpuArray(A); tic; B = fft(A); time = toc % return  B to the CPU B = gather(B) To know how many bytes will need your CPU to storage a gpuArray, before gather it, you can use this equation: numel(B) * 8 for double-precision arrays  or numel(B) * 16 if the array is complex To checkout the variable size, use the command: whos If you choise a large value for n, probably you will see the following message: Out of memory on device. To view more detail about available memory on the GPU, use 'gpuDevice()'. If the problem persists, reset

How to fix "Please enable Flash to use the Spotify web player" on Ubuntu 16.04

Image
This error appears when you try load spotify web player and it doesn't load. If you have this problem, the generic solution is to clear cookies and data from your browser. but it doesn't work... The solution is to install ubuntu-restricted-extras sudo apt-get install ubuntu-restricted-extras Enjoy it!

How to install sublime on Ubuntu 16.04

To install this excellent editor, just add it to your repository: sudo add-apt-repository ppa:webupd8team/sublime-text-3 sudo apt-get update sudo apt-get install sublime-text-installer If you like, you can pay for the license or use this . —– BEGIN LICENSE —– MinBan Single User License EA7E-806395 318133A3 8F202A61 B0DBB8EB 21E17D2E 97D540E6 34079344 54620650 71E47589 9EF87857 345F5042 0D728DD1 8D8C979D 6A4F4DD2 67BB0345 746CA297 515BDA91 6CEAB381 4DB56700 D77DCD14 977BD326 1AC309ED 0EB414B8 4730DA10 99DBD291 FC88E0EF DCC7E3A9 56E4FFED 7629746B E529AECA 92A96B60 72AE8928 8A240AAC —— END LICENSE ——

How to install nvidia drivers on Ubuntu 16.04

Image
To check how many frames per second reach your graphic card, you can run glxgears : sudo apt-get install mesa-utils glxgears 2854 frames in 5.0 seconds = 570.636 FPS 2800 frames in 5.0 seconds = 559.996 FPS 2828 frames in 5.0 seconds = 565.470 FPS 2875 frames in 5.0 seconds = 574.286 FPS 2903 frames in 5.0 seconds = 579.824 FPS To show wich driver is using it, put the following sentence on your terminal: glxinfo | grep OpenGL OpenGL vendor string: VMware, Inc. OpenGL renderer string: Gallium 0.4 on llvmpipe (LLVM 3.8, 256 bits) OpenGL core profile version string: 3.3 (Core Profile) Mesa 11.2.0 OpenGL core profile shading language version string: 3.30 OpenGL core profile context flags: (none) OpenGL core profile profile mask: core profile OpenGL core profile extensions: OpenGL version string: 3.0 Mesa 11.2.0 OpenGL shading language version string: 1.30 OpenGL context flags: (none) OpenGL extensions: OpenGL ES profile version string: OpenGL ES 3.0 Mesa 11.2.

How to install Chrome on Ubuntu 16.04 with apt-get

Simply, just put these lines on your terminal: wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -  sudo sh -c 'echo "deb https://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' sudo apt-get update sudo apt-get install google-chrome-stable If you are using a 64 bits architecture, you will get this error: N: Skipping acquire of configured file 'main/binary-i386/Packages' as repository 'http://dl.google.com/linux/chrome/deb stable InRelease' doesn't support architecture 'i386' Just edit /etc/apt/sources.list.d/google.list and add "[arch=amd64]" before: deb http://dl.google.com/linux/chrome/deb/ stable main afet: deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main Now, retry sudo apt-get update sudo apt-get install google-chrome-stable Enjoy it!

How to rotate an external HDMI monitor on Ubuntu 16.04

Image
If you have an external monitor like a DELL 24" IPS P2414H, one problem is that it doesn't recognize when it rotates. I developed on bash an application to rotate the monitor. You need identificate the name and resolution of your monitor. Just run: xrandr | grep " connected" | grep -v primary HDMI1 connected 1920x1080+1366+0 (normal left inverted right x axis y axis) 527mm x 297mm As you see, my second monitor is identified as HDMI1 with 1920x1080 pixels as resolution. This is the script: #!/bin/bash left=`xrandr | grep HDMI1 | grep -o left | wc | awk '{print $1}'` if [ $left -eq 2 ]  then     xrandr --output HDMI1 --mode 1920x1080 --rotate normal else     xrandr --output HDMI1 --mode 1920x1080 --rotate left fi I filtered by left, because when I rotate my monitor always is to left. You can change it to any other direction. You can create a .desktop and use any of these images.   Enjoy it!

How to access a ssh account through ssh multihop

If you have a machineA without open ports to Internet, but you can access to it on your local network, a solution is access throught a DMZ machineB with ssh. Just use this command: ssh -t userB@machineB ssh userA@machineA Also, you can create an alias on your ~/.bashrc file: alias ssh_machineA='ssh -t userB@machineB ssh userA@machineA'  Other option, is to do it throught ProxyCommand. Add to your ~/.ssh/config file these lines: # machineA config file Host machineA Hostname machineA.com port 22 User lala # machineB config file Host machineB Hostname machineB.com port 22 user lala ProxyCommand ssh -q machineA nc -q0 machineB 22 If you run ssh, you probably you will get this message: ssh machineB nc: getaddrinfo: Name or service not known ssh_exchange_identification: Connection closed by remote host To fix it, change the last line by: ProxyCommand ssh -W %h:%p machineB Enjoy it!

How to install Matlab without GUI

If you want to install Matlab in a server, probably you don't have a GUI. To run the installer you need previosly configurate silent mode: ./install -mode silent Preparing installation files ... Installing ... (Nov 03, 2016 10:53:02) ################################################################## (Nov 03, 2016 10:53:02) (Nov 03, 2016 10:53:03) When running the installer with an input file, you must accept the license agreement by setting the agreeToLicense option to yes. (Nov 03, 2016 10:53:03) Exiting with status -2 (Nov 03, 2016 10:53:07) End - Unsuccessful. The previous error is because we need configurate all options, like if you are agree with the license agreement, enter the licence key, etc. To do this, you need to edit  installer_input.txt and  activate.ini files: In activate.ini these are the lines that you need configurate: isSilent=true activateCommand=activateOffline licenseFile=/root/Matlab_R2016a_glnxa64.lic In installer_input.txt these are: