Posts

Next Scripting Framework

Next Scripting Framework  # How to invoke current class method:   package require nx nx::Class create Greeter {     :property name:required     :public method "hello" {} {         puts "Welcome ${:name}!"         :bye     }     :public method "bye" {} {         puts "Goodbye ${:name}!"     } } Greeter create g -name Anna g hello   # Inheritance Example:   # Inheritance Example package require nx nx::Class create Animal { :property name:required :public method "hello" {} { puts "Hello cute animal with the name ${:name}!" } } nx::Class create Dog -superclass Animal { :public method "bark" {} { puts "${:name} bark! bark! bark!" } } Dog create d -name Snoopy d bark Dog create d1 -name "Bobby" d1 bark d1 hello 

Postgres select columns names without default value

 PostgreSQL select column names where there is no default value :   SELECT column_name, column_default FROM information_schema.columns WHERE (table_schema, table_name) = ('public', 'test') AND column_default IS NULL ORDER BY ordinal_position;  

TomCat Windows Login Problem

 I have installed TomCat server, added username: admin password: admin and every time I was trying to login I was back to login screen. All forums online are saying delete spaces etc. in tomcat-users.xml but the problem actually was in XML encoding. Just change this in tomcat-users.xml file: <?xml version='1.0' encoding='cp65001'?> To this: <?xml version='1.0' encoding='UTF-8'?>

Excel CANCAT date and time to POSTGRESQL timestamp

Image
 Formula example:   =TEXT(E3;"yyyy-mm-dd")&" "&TEXT(G3;"hh:mm:ss")

C++ Linking Chilkat Linux

Create project folder, for example ~cktest: cd cktest Download C++ GCC Chilkat Library: wget https://chilkatdownload.com/9.5.0.84/chilkat-9.5.0-x86_64-linux-gcc.tar.gz tar xfz ./*.gz Move include and lib folder to cktest Create your .cpp program, for example my.cpp #include <CkJsonObject.h> #include <iostream> int ChilkatSample() { CkJsonObject json;      bool success; int index = -1; success = json.AddStringAt(-1,"Title","Pan's Labyrinth"); success = json.AddStringAt(-1,"Director","Guillermo del Toro"); success = json.AddStringAt(-1,"Original_Title","El laberinto del fauno"); success = json.AddIntAt(-1,"Year_Released",2006); json.put_EmitCompact(false); std::cout << json.emit() << "\r\n"; exit(EXIT_SUCCESS); } static int s = ChilkatSample(); int main() { std::cout << "Inside main() - dummy things"; } To compile: g++ my.cpp -I./include -L./lib -lc

Fail2ban cheat codes

Show all rules: fail2ban-client status Show banned IP's specific rule: fail2ban-client status sshd  Unban some IP: fail2ban-client set yourjailname unbanip youripaddress  

BOOST C++ Compile VS2019

1. Download and unzip boost from https://www.boost.org/ 2. Lets say, boost unzipped to c:\downloads 3. Run "x64 Native Tools Command Prompt for VS 2019" (its important to run this one instead of power shell or normal cmd) 4. cd c:\downloads 5. .\bootstrap 6. b2 --prefix=c:\boost_libs --toolset=msvc-14.2 --address-model=64 --architecture=x86 --runtime-link=static,shared --link=static threading=multi install 7. boost will be installed in c:\boost_libs 8. In VS2019 --> Solution Explorer --> "Project" --> Properties --> C++ --> Additional Include Directories --> Add c:\boost_libs\include 9. In VS2019 --> Solution Explorer --> "Project" --> Properties --> Linker --> General --> Additional Library Directories --> Add c:\boost_libs\lib Since VS2010 there is no global directories, you need to specify per project options.