Tag Archives: devenv

Using SETLOCAL and ERRORLEVEL together in Batch

bat-file-icon
Interesting thing about using SETLOCAL and ERRORLEVEL together.
Consider two files:

first.bat

@echo off

echo %ERRORLEVEL% in first bat before setlocal

setlocal

echo Some actions with error finished here...

set ERRORLEVEL=1
echo %ERRORLEVEL% in first bat.

exit /b %ERRORLEVEL%

second.bat

@echo off

echo %ERRORLEVEL% in second bat before setlocal

setlocal

echo %ERRORLEVEL% in second bat after setlocal

Exec in series:

C:\first.bat && second.bat

You’ll see the next output:

0 in first bat before setlocal
Some actions with error finished here...
1 in first bat.
1 in second bat before setlocal
0 in second bat after setlocal

More info http://ss64.com/nt/setlocal.html

Set file and folder permissions in Linux

read-write-permission-attributes-linux
Convenient way to apply permissions in Linux is to save alias in .bashrc file:

Set all permissions for FTP:

alias setftpperm="chown -R _pure-ftpd:_pure-ftpd /usr/serv/ftp/anonymous && \
    chmod -R u+rwX,go+rX,go-w /usr/serv/ftp/anonymous && \
    chmod -R u+rwX,go+rX,go+w /usr/serv/ftp/anonymous/PUBLIC && \
    chmod -R u+rwX,go+rX,go+w /usr/serv/ftp/anonymous/TORRENTS"

Next is permissions for Apache:

alias setapacheperm="chown -R _pure-ftpd:daemon . && \
  chmod 666 . && chmod -R u+rwX,go+rX,go-w ."

alias setapachewperm="chown -R _pure-ftpd:daemon . && \
  chmod 666 . && chmod -R u+rwX,go+rX,go+w ."

Copy files by mask in destination in BATCH

If you want to copy some file from known location to location by mask (unknown), use next:

@echo off
setlocal enableextensions enabledelayedexpansion

set pathFrom=D:\ScriptCopyTest\my1.java
set pathTo=D:\ScriptCopyTest\Test*

set copy_opts=/I /Y /R /V /F /H

for /d %%f in (%pathTo%*) do ( xcopy %pathFrom% %%f %copy_opts% )

pause

Using clipboard via SSH in Linux


To use clipboard on SSH you can install package Parcellite

pacman -S parcellite

Check out sync property!

Connect to DB2 via JDBC in Database Manager

To connect you’d point a URL to databse, a driver and its location.

URL:

  jdbc:db2://somhost.org:50001/SOMEDBNAME

Driver:

  com.ibm.db2.jcc.DB2Driver

Driver location (for Windows OS):

  C:\Program Files\Aqua Data Studio 8.0 - 32bit\lib\drivers\db2jcc.jar

Also, read http://docs.aquafold.com/ads/4.7/docs-jdbcdrivers-db2.html

Eclipse IDE vs others


How many hollywars around development IDE better what. After reading, discussing and trying I’ve released my own opinion. For me, the best dev. env. is ECLIPSE. Cause, it’s free, fast and very convenient. Yes, there is one unpleasant moment: it may close unexpectedly. But you can find the reason in web-search.

Anyway, no better IDE ever.