Saturday, March 7, 2015

Linux Copy Files Remotely Over SFTP

Using ssh between systems running Linux and always in need to transfer files back and force...?
Then you should consider using sftp as you will be able to copy files so easy unless you use a GUI application to click, click, click, which is OK and nothing wrong with that.  But, for me I like to feel the move and be in control...

So, sftp has the same commands almost as ssh that connects you to your remote PC.  However, it also has the commands that can run on your local PC.  So, after you login to your remote session, all sftp commands you type should run on your remote session,

If you type ls, then you are listing all commands in your remote session.
Now, type
lls
and you see list of all files in local folder you started from


If you type

  • mkdir xyz   you created folder in your remote PC

now type

  • lmkdir xyz  and you created folder in your remote PC



If you type:

  • pwd  you will list current working directory on remote PC

now type

  • lpwd  you will see your current working directory on local PC


Here are some useful commands that I need to use all the time


  • put puts files from your local working directory to the remote directory
  • get gets files from your remote directory to local directory





All following commands work on remote PC and when you add l, that is lower case L, you run them on local PC

  • lls, ls
  • lpwd, pwd
  • lmkdir, mkdir


Sunday, February 22, 2015

CMIS102 Class Resources

I thought it would be easier to gather all the resources and links I use in my CMIS102 class and post them on one location.  This will be very useful in keeping track of all these resources, updating them and providing only one link to all my students.

Links to Online Compilers IDEs:
http://www.tutorialspoint.com/compile_c_online.php
http://cpp.sh/
https://ideone.com/


Links to Online Flow Chart applications:
https://www.lucidchart.com
www.draw.io


Links to C Coding Resources and Examples:
http://www.programiz.com/c-programming/c-string-examples    String Examples
http://www.programmingsimplified.com/c-program-examples    More programming examples
http://www.programiz.com/c-programming/c-strings                   MOre reference to String Capture


YouTube list of videos:
Introduction to Flowchart 

Thursday, August 21, 2014

Writing C code on Windows using Geany and GNU

I have to provide a simple instruction to install an IDE "Integrated Development Environment" for  my students to be able to work on the assignments on their computers.
After doing a lot of research I found two options, Monodevelop and Geany. They both work great on Ubuntu Linux and have no issues, but, to use them on Windows I started to deal with the unknown...

Working with Monodevelop: monodevelop
Monodevelop will install fine in windows under different name, the issue is it does not support C programming language. At least out of the box. However, I read some blogs stating that we can somehow get it to compile C...  So, this is not what I am looking for and I can not expect my students to waste their time with these hacks at this time.  NOT AN OPTION.
Note:
it works fine on Ubuntu Linux and Mac, so, you can use it fine if this is what you have for Personal Computer...


Working with Geany:  Geany
Geany is a great simple IDE that works on Ubuntu Linux and Windows, as well as Mac.  but it requires the GCC, GNU C Compiler which will need to be installed on Windows.
I came up with the following instructions to help simplify the process of doing that.

Here is a list of download links that will be needed:

  1. Geany download site  Please select"geany-1.24_setup.exe - Full Installer including GTK 2.16."
  2. MinGW "Minimalist GNU for Windows"  Please select "Looking for the latest version? Download mingw-get-setup.exe (86.5 kB)"
Now that you have all required downloads, run both and install by following the default installations.
You should have the following icons on your desktop now,






Now, we will need to setup and install the gcc compiler to be able to compile your C code programs.





  1. Start MinGW by clicking on MinGW Installer shown on your desktop.
  2. you will get the following screen and notice that your list has no items selected in green boxes like my screen shot
  3. Go a head and select the one I have selected, right click and select "Mark for Installation"


    1. mingw-developer-toolkit
    2. mingw32-base
    3. mingw32-gcc-objc
    4. msys-base
  4. Now go to the menu "Installation" , and click on "Update Catalogue"
  5. after the download of needed files and installing them is done, you now have all you need to work on Geany and write your applications, but we need to add the new MinGW to Windows Path...
  6. You will need to go to Control panel
  7. Select System
  8. On the right list click on Advanced System Settings
  9. Now Click on Environment Variables...
  10. You will get this dialog box
  11. find Path  in the System Variables and double click on it
  12. now click on the Variable Value
  13. make sure you are at the end of the text and add the following text  ";C:\MinGW\bin\"
  14. you will be adding everything inside the double quotes
  15. Now, Click on OK and OK again,
  16. when you start Geany and write your own program at this point everything should be all set to compile your new code.









Monday, February 17, 2014

Biasing a Diode Semiconductors

To talk about a semiconductor, we need to talk about a conductor first.
Conductors: such as copper, silver, gold and iron are good materials that allow the flow of electrons through them.
Insulators: such as wood, plastic, rubber and glass are materials that do not allow electrons to flow through them.

Semiconductors such as silicon and germanium are neither good conductor nor good insulators.
A new material that is based on semiconductors is produced by combining two materials in a certain ratio that will have a controllable behavior different than conduct/insulate.

The Diode is the simplest device that makes use of semiconductors and are the base of a very complicated devices such as transistors, Integrated Circuits, Microprocessors.
The idea behind Diodes is that they can control the flow of electrons through them to one direction only.  This is achieved by process called biasing.


There are two types of diode biasing, forward and reverse.  Forward biasing allow the diode in a circuit to conduct and allow electrons to flow in one direction.
However, when the diode is reverse biased it will work as an insulator and prohibit electrons from flowing through it.

Reverse Biasing a Diode, No Current flow

Forward Biasing a Diode, Current Flows in Circuit


The behavior of a diode in a circuit is very similar to a one way valve placed to connect two water pipes.  The valve is a control system that will allow the flow of water through the pipes in one direction only.
This behavior reminds me with the valves in the human hart.  Human heart has four valves that allow the flow of blood ONLY in one direction and never the opposite direction.














References:
http://www.st-andrews.ac.uk/~www_pa/Scots_Guide/info/comp/passive/diode/diode.htm

http://www.allaboutcircuits.com/vol_3/chpt_3/1.html
http://www.chipshow.com/blog/?cat=1
http://www.youtube.com/watch?v=JBtEckh3L9Q

http://www.youtube.com/watch?v=W6QUEq0nUH8

Monday, November 11, 2013

Debian on ODROID-x2

Edit 12/7/2013:
Thanks to mdrjr Mr. Mauro Ribeiro work and help he was able to edit the kernel build and enable the SPI.

So, here are my notes on this work

OFFICIAL Debian Wheezy for X2

www.mdrjr.net/odroid/debian-wheezy

root/odroid
odroid/odroid

network is configured in
/etc/network/interfaces
####################################################
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
#your static IP
address 192.168.1.50
#your gateway IP
gateway 192.168.1.1
dns-domain example.com
dns-nameservers 192.168.11.1
netmask 255.255.255.0
#your network address "family"
network 192.168.1.0
broadcast 192.168.1.255
####################################################

You might need to add:
sudo apt-get install libncurses5-dev

Update Date on ODROID-X2 board
data -s "Dec 16 00:00:00 EST 2013"


I did the following steps:
  1. I created a folder in my root home
  2. got the web and get:
  3. wget --no-check-certificate https://github.com/hardkernel/linux/archive/odroid-3.8.y.zip
  4. 7z x -y odroid-3.8.y.zip
  5. cd odroid-3.8.y
  6. sync                    This will sync your SD card
  7. make mrproper
  8. make odroidx2_defconfig
  9. make menuconfig  >>>  this one needed to install sudo apt-get install libncurses5-dev  
  10. now which one I used? odroidx2_ubuntu_defconfig  odroidx2_defconfig
  11. had to install bc first, apt-get install bc
  12. make -j8
  13. sync
  14. make -j8 modules
  15. make  modules_install
  16. sync
  17. kernelversion=`cat ./include/config/kernel.release`
  18. sudo mkinitramfs -c gzip -o ./initramfs-$kernelversion $kernelversion
  19. mkimage -A arm -O linux -T ramdisk -C none -a 0 -e 0 -n initramfs -d ./initramfs-$kernelversion ./uInitrd
  20. cp /boot/zImage /boot/zImage.prevc
  21. cp /boot/uInitrd /boot/uInitrd.prev
  22. cp uInitrd /boot
  23. cp arch/arm/boot/zImage /boot
  24. cp .config /boot/config-$kernelversion
  25. cp System.map /boot/System.map-$kernelversion
  26. sync
  27. shutdown -h 0

And it worked, I am running now using my built kernel...

Edit 12/15/2013:
After the last edit to the kernel to enable spidev1.0 I was able to build the kernel and booting to see the /dev/spidev1.0
the problem is the bottom 1/3 of the monitor is not showing that area and only showing garbage!



Reference:

If you need to use your Odroid as a WiFi Hotspot...
http://forum.odroid.com/viewtopic.php?f=52&t=6282


Sunday, September 22, 2013

Read and Write to ttyS0 serial ports in Linux


Two ways to interface to the ttyS0 serial port:

1)  via terminal command line:

echo "ABCDEF" > /dev/ttyS0
cat /dev/ttyS0


To configure the port:
stty -F /dev/ttyS0 speed 9600 cs8
stty -F /dev/ttyS0 speed 9600 cs8 -cstopb -parenb




2) via C Program: minicom
sudo apt-get install minicom
when done use
sudo minicom -s


3) By writing your own app in C++ or C# or any other preferred Programming language:
I will have some sample working programs here soon.

Saturday, September 14, 2013

Installing Eclipse from the website on Ubuntu 13.04

I found these instructions on one of the websites discussions:

If you've downloaded Eclipse from their official website, follow these steps for the installation.
  1. Extract the eclipse.XX.YY.tar.gz using
    tar -zxvf eclipse.XX.YY.tar.gz
    
  2. Become root.
    sudo -i
    
  3. Copy the extracted folder to /opt
    cp -r eclipse.XX.YY /opt
    
  4. Create a desktop file and install it:
    gedit eclipse.desktop
    
    and copy the following to the eclipse.desktop file.
    [Desktop Entry]
    Name=Eclipse 
    Type=Application
    Exec=eclipse
    Terminal=false
    Icon=eclipse
    Comment=Integrated Development Environment
    NoDisplay=false
    Categories=Development;IDE;
    Name[en]=Eclipse
    
    then execute the following command to automatically install it in the unity:
    desktop-file-install eclipse.desktop
    
  5. Create a symlink in /usr/local/bin using
    cd /usr/local/bin
    ln -s /opt/eclipse/eclipse
    
  6. For eclipse icon to be displayed in dash, eclipse icon can be added as
    cp /opt/eclipse/icon.xpm /usr/share/pixmaps/eclipse.xpm
Notice:
I found out that I need to install Java RTE or JDK from Java.com

I wanted to make sure I do not lose it again...

reference:
http://askubuntu.com/questions/26632/how-to-install-eclipse
http://www.eclipse.org/downloads/?osType=linux