Posts

Showing posts from August, 2019

Digital Marketing

Stop and Start NFS and Related Services

Using restart option (i.e. service nfs restart) may crash / freeze your Linux computer if executed. Stop NFS server:   # service nfslock stop # service nfs stop # service portmap stop # umount /proc/fs/nfsd Start service in following order: # service portmap start # service nfs start # service nfslock start # mount -t nfsd nfsd /proc/fs/nfsd

How to bind / configure NIC teaming/bonding in CentOS / Oracle Linux / RedHat Linux

Following is an example of how to configure NIC teaming/bonding 1) create channel bonding interface $ sudo vim /etc/sysconfig/network-scripts/ifcfg-bond0 DEVICE=bond0 BOOTPROTO=none IPADDR= 192.168 .1 .199 NETMASK= 255.255 .254 .0 GATEWAY= 192.168 .1 .1 ONBOOT=yes USERCTL=no TYPE=Ethernet DNS1= 8.8 .8 .8 DNS1= 8.8 .4 .4 IPV6INIT=no $ sudo vim /etc/sysconfig/network-scripts/ifcfg-em1 (em2, em3 ...) and add/change the values: TYPE=Ethernet BOOTPROTO=none IPV4_FAILURE_FATAL=no NAME=em1 ONBOOT=yes MASTER=bond0 SLAVE=yes USERCTL=no NM_CONTROLLED=no 2)edit /etc/modprobe.d/ $ sudo vim /etc/modprobe.d/bond0.conf alias bond0 bonding 3)config mode=4 #echo "802.3ad 4" > /sys/class/net/bond0/bonding/mode ( If you failed to modify the file content by vim, this echo command can help you ) ( When your bonding is running, you may not be able to modify it, you may need to stop it by systemctl stop network before you can modify it ) (optional, defaults to 'balance-rr 0') If you conf...

How to bind / configure NIC teaming/bonding in CentOS / Oracle Linux / RedHat Linux

Following is an example of how to configure NIC teaming/bonding 1) create channel bonding interface $ sudo vim /etc/sysconfig/network-scripts/ifcfg-bond0 DEVICE=bond0 BOOTPROTO=none IPADDR= 192.168 .1 .199 NETMASK= 255.255 .254 .0 GATEWAY= 192.168 .1 .1 ONBOOT=yes USERCTL=no TYPE=Ethernet DNS1= 8.8 .8 .8 DNS1= 8.8 .4 .4 IPV6INIT=no $ sudo vim /etc/sysconfig/network-scripts/ifcfg-em1 (em2, em3 ...) and add/change the values: TYPE=Ethernet BOOTPROTO=none IPV4_FAILURE_FATAL=no NAME=em1 ONBOOT=yes MASTER=bond0 SLAVE=yes USERCTL=no NM_CONTROLLED=no 2)edit /etc/modprobe.d/ $ sudo vim /etc/modprobe.d/bond0.conf alias bond0 bonding 3)config mode=4 #echo "802.3ad 4" > /sys/class/net/bond0/bonding/mode ( If you failed to modify the file content by vim, this echo command can help you ) ( When your bonding is running, you may not be able to modify it, you may need to stop it by systemctl stop network before you can modify it ) (optional, defaults to 'balance-rr 0') If you conf...

Setting JDK in Eclipse

The list of available compilers are in the Window -> Preferences -> Java -> Installed JRE's tab.

Lambda is a fully managed compute service

Lambda is a fully managed compute service that runs your code in response to events generated by custom code or from various AWS services such as Amazon S3, DynamoDB, Kinesis, Amazon SNS, and Amazon Cognito.

The AWS SAM CLI is a separate command line tool that you can use to manage and test AWS SAM applications.

In addition to commands for uploading artifacts and launching AWS CloudFormation stacks that are also available in the AWS CLI, the SAM CLI provides additional commands for validating templates and running applications locally in a Docker container.

How to suspend and resume Linux processes

You can use kill to stop the process. For a 'polite' stop to the process (prefer this for normal use), send SIGTSTP: kill -TSTP [pid] For a 'hard' stop, send SIGSTOP: kill -STOP [pid] Note that if the process you are trying to stop by PID is in your shell's job table, it may remain visible there, but terminated, until the process is fg'd again. To resume execution of the process, sent SIGCONT: kill -CONT [pid]

You can use AWS CLI to add multiple FQDN in a single command while creating a new ACM certificate.

Following is the command you can use to achieve this, aws acm request-certificate --domain-name example.com  --validation-method DNS --subject-alternative-names b.example.com   c.example.com   d.example.com

A Gradle plugin that provides Maven-like dependency management functionality

A Gradle plugin that provides Maven-like dependency management functionality https://github.com/spring-gradle-plugins/dependency-management-plugin

Build Your Java Project with Apache Maven

Once you set up your project, you can build it using Maven's package command. mvn package This creates your .jar file in the target directory.

SQL server Express vs developer

Developer Edition supports more features and larger databases. For example, if you want to restore a 88gb database from your production server onto your workstation to do testing, you'll need Developer Edition. If you're working with Enterprise-only features like partitioning, compression or the Resource Governor. Those features aren't available in Express, but they are available in Developer Edition. And SQL Express is quite capable of handling fair loads. SQL Server Express does not require licensing but has a smaller set of features. Developing against full SQL Server (and Developer Edition matches Enterprise Edition) always leaves the chance that you rely on some feature that is not in the production edition.

By default, Postfix configuration files are in /etc/postfix.

The two most important Postfix configuration files are main.cf and master.cf; these files must be owned by root. Giving someone else write permission to main.cf or master.cf (or to their parent directories) means giving root privileges to that person.

Open source client for AnyConnect

"network-manager-openconnect-gnome" package in the Ubuntu Repository. It uses OpenConnect which is an open source client for AnyConnect. You can find the package in the Ubuntu Software Center or Synaptic by searching for "OpenConnect." If you wish to install it via the command-line, you can do so with: sudo apt install network-manager-openconnect-gnome

Run Unix commands from within Vim

:shell :sh[ell] start a shell :! :!{command} execute {command} with a shell

Create a basic Maven package

mvn -B archetype:generate \   -DarchetypeGroupId=org.apache.maven.archetypes \   -DgroupId=org.example.basicapp \   -DartifactId=myapp

Resources for preparing technical interviews

LeetCode  is a social platform for preparing IT technical interviews. It strives to provide you with the best learning experience in preparing interviews for companies in the IT industry. ProgrammerInterview.com is to help programmers successfully prepare for technical interviews. It does this by presenting a variety of questions, grouped by subject matter. This site is a great resource for any level of programmer – whether you are an entry level “fresher” just starting out your career, or an experienced senior level programmer who is looking for more advanced questions, it presents a wide variety of real interview questions.

AWS SDK Eclipse Toolkit provides an Eclipse plugin for you to both create a deployment package and also upload it to create a Lambda function.

AWS SDK Eclipse Toolkit plugin enables you to author Java code, create and upload a deployment package, and create your Lambda function. 

Install docker on AWS EC2

 sudo amazon-linux-extras install docker

SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits on most Unix-based systems.

Example: $ sdk install gradle 5.6.1

Build Anything by Gradle Build Tool

Write in Java, C++, Python or your language of choice. Package for deployment on any platform. Go monorepo or multi-repo. And rely on Gradle's unparalleled versatility to build it all. https://gradle.org/

Shell script to identify duplicate Java classes.

mkdir -p expanded unzip path/to/my/i88ca.jar -d expanded find ./expanded/lib -name ' *.jar ' | xargs -n1 zipinfo -1 | grep ' .*.class ' | sort | uniq -c | sort

Executable JAR by maven

You can simply use java -cp path -to-your-jar: path -to-your-lib your-full- main - class - name   to run the jar. For example: java -cp /i88/ca/example.jar:/i88/ca/lib/* it.goyun.info.example.App If you encounter "Failed to load Main-Class manifest attribute" problem, this is probably because you have no Main-Class attribute specified in the manifest file. To create an executable JAR, one simply needs to set the main class that serves as the application entry point. < properties > < project .build.sourceEncoding>UTF-8</ project .build.sourceEncoding> </ properties > < build > < plugins > < plugin > < groupId >org.apache.maven.plugins</ groupId > < artifactId >maven-jar-plugin</ artifactId > < version >2.6</ version > < configuration > < archive > ...

Executable JAR by maven

You can simply use java -cp path -to-your-jar: path -to-your-lib your-full- main - class - name   to run the jar. For example: java -cp /i88/ca/example.jar:/i88/ca/lib/* it.i88.ca.example.App If you encounter "Failed to load Main-Class manifest attribute" problem, this is probably because you have no Main-Class attribute specified in the manifest file. To create an executable JAR, one simply needs to set the main class that serves as the application entry point. < properties > < project .build.sourceEncoding>UTF-8</ project .build.sourceEncoding> </ properties > < build > < plugins > < plugin > < groupId >org.apache.maven.plugins</ groupId > < artifactId >maven-jar-plugin</ artifactId > < version >2.6</ version > < configuration > < archive > < ...

Solution: Unable to locate package on Ubuntu

Updating the package index: sudo apt update Next, install Maven by typing the following command: sudo apt install maven

What version of Java is being used by Maven

mvn -version will output which java it's using. $ mvn -version Apache Maven 3.0.5 (Red Hat 3.0.5-17) Maven home: /usr/share/maven Java version: 1.8.0_222-ea, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.222.b03-1.amzn2.0.1.x86_64/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "4.14.114-105.126.amzn2.x86_64", arch: "amd64", family: "unix"

How to solve: "ERROR: Maven JVM terminated unexpectedly with exit code 137"

In case your Jenkins CI fails to complete building your project but only logging the following: ERROR: Maven JVM terminated unexpectedly with exit code 137 It means maven does NOT have enough memory available. To solve this, simply increase your MAVEN_OPTS memory. Or you may need to increase your system's memory. This is very likely if you run your Jenkins on a virtual machine and you are stingy of memory.

shade is bound to the package phase and is used to create a shaded jar.

Apache Maven Shade Plugin provides the capability to package the artifact in an uber-jar, including its dependencies and to shade - i.e. rename - the packages of some of the dependencies. https://maven.apache.org/plugins/maven-shade-plugin/

The federal telecom regulator significantly lowered the wholesale rates

The federal telecom regulator significantly lowered the wholesale rates that smaller internet resellers pay to access broadband network infrastructure built by major providers like Bell Canada, Rogers. The CRTC said it did so to increase choice, affordability and ensure a competitive marketplace across Canada.

Intel Project Athena machines

Intel unveiled the new Comet Lake 10th-gen chips that will power all sorts of notebooks later this year.  Comet Lake chips will bring support for more cores, more RAM of the faster and more efficient variety, as well as faster Wi-Fi 6 support.  These chips will power a special set of laptops that Intel certifies under the “Project Athena” program. Project Athena machines are supposed to be ultraslim, light devices that feature all-day battery life, always-on internet, and AI support.  Project Athena machines also have to deliver increased performance and responsiveness, and that includes the ability to turn on instantly.

Get the list of event source mappings while using AWS Lambda with Amazon Simple Queue Service

You can get the list of event source mappings by running the following command. $ aws lambda list-event-source-mappings --function-name ProcessSQSRecord \ --event-source SQS-queue-arn The list returns all of the event source mappings you created, and for each mapping it shows the LastProcessingResult, among other things. This field is used to provide an informative message if there are any problems. Values such as No records processed (indicates that AWS Lambda has not started polling or that there are no records in the queue) and OK (indicates AWS Lambda successfully read records from the queue and invoked your Lambda function) indicate that there no issues. If there are issues, you receive an error message.

Get Dell Service Tag from the command line

Get your Dell Service Tag from the command line Windows: From a command prompt, type: wmic bios get serialnumber Linux: From a terminal, type: sudo -i dmidecode -s system-serial-number

MySQL uses DATEDIFF to compare two date type values.

DATEDIFF() returns expr1 − expr2 expressed as a value in days from one date to the other. expr1 and expr2 are date or date-and-time expressions. Only the date parts of the values are used in the calculation. mysql> SELECT DATEDIFF('2007-12-31 23:59:59','2007-12-30');         -> 1 mysql> SELECT DATEDIFF('2010-11-30 23:59:59','2010-12-31');         -> -31

Integrate API Gateway with SQS

Image
1. Create SQS queue Open AWS console in services, navigate to Simple Queue Service. Click on “Create New Queue” Give queue a name, in our case it is “beaches” and hit “Create Queue” 2. Create IAM Policy for AWS API Gateway to push Request Message to Queue. Select IAM, Navigate to “policies” and click on “Create Policy”. Open JSON editor and add the following policy, click on “Review Policy”, name policy as beaches-policy and hit “Create Policy”. { " Version " : " 2012-10-17 " , " Statement " : [ { " Sid " : " VisualEditor0 " , " Effect " : " Allow " , " Action " : " sqs:SendMessage " , " Resource " : " arn:aws:sqs:your-sqs-arn:123456789:beaches " } ] } Both send and receive permissions: { " Version " : " 2012-10-17 " , " Statement " : [ { "...

Integrate API Gateway with SQS

Image
1. Create SQS queue Open AWS console in services, navigate to Simple Queue Service. Click on “Create New Queue” Give queue a name, in our case it is “beaches” and hit “Create Queue” 2. Create IAM Policy for AWS API Gateway to push Request Message to Queue. Select IAM, Navigate to “policies” and click on “Create Policy”. Open JSON editor and add the following policy, click on “Review Policy”, name policy as beaches-policy and hit “Create Policy”. { " Version " : " 2012-10-17 " , " Statement " : [ { " Sid " : " VisualEditor0 " , " Effect " : " Allow " , " Action " : " sqs:SendMessage " , " Resource " : " arn:aws:sqs:your-sqs-arn:123456789:beaches " } ] } Both send and receive permissions: { " Version " : " 2012-10-17 " , " Statement " : [ { "...

How to find all watching JIRA issues

watcher = currentUser()

How to temporarily disable an account on Windows 10

How to disable a Windows 10 account using Computer Management On Windows 10 Pro or Enterprise, you can use Computer Management to manage various aspects of an account, including the ability to restrict access to an account. Open Start. Search for Computer Management and click the top result to open the console. Quick tip: You can also use the Windows key + X keyboard shortcut and selecting Computer Management. Browse the following path: System Tools > Local Users and Groups > Users Double-click the account you want to disable. (If the user account is using a Microsoft account, note that the name will only use the first five letters of the email address. If you want the account to use a custom name, you can refer to this guide.) Under the "General" tab, check the Account is disabled option. Click Apply. How to disable a Windows 10 account using Command Prompt If your device is running Windows 10 Home, you can use Command Prompt to disable or enable a Windows 10 account. ...

VMware bought Pivotal Software Inc in a $2.7 billion deal.

VMware to pay $5 billion for firms offering cloud security, developers platform

Get HttpServletRequest object in restful web service

@POST public Response post( @Context HttpServletRequest request, @Context HttpServletResponse response){ return Response .ok( " pong2 " ) .build(); }

Testing Rest APIs using Spring 5 WebTestClient

WebTestClient contains request methods that are similar to WebClient.  In addition, it contains methods to check the response status, header and body.  You can also use assertion libraries like AssertJ with WebTestClient.

WebClient is part of Spring 5’s reactive web framework called Spring WebFlux.

 To use WebClient, you need to include the spring-webflux module in your project. Add Dependency in an existing Spring Boot project If you have an existing Spring Boot project, you can add the spring-webflux module by adding the following dependency in the pom.xml file - <dependency>     <groupId>org.springframework.boot</groupId>     <artifactId>spring-boot-starter-webflux</artifactId> </dependency> Spring Boot version 2.x.x is needed for using the Spring WebFlux module.

WebClient vs RestTemplate in Spring

Starting with Spring 5, the non-blocking and reactive WebClient offers a modern alternative to RestTemplate. WebClient offers support for both synchronous and asynchronous HTTP requests and streaming scenarios. Therefore, RestTemplate will be marked as deprecated in a future version of the Spring Framework and will not contain any new functionalities.

strace is a diagnostic, debugging and instructional userspace utility for Linux.

strace is a powerful command line tool for debugging and trouble shooting programs in Unix-like operating systems such as Linux. It captures and records all system calls made by a process and the signals received by the process. strace is used to monitor and tamper with interactions between processes and the Linux kernel, which include system calls, signal deliveries, and changes of process state. The operation of strace is made possible by the kernel feature known as ptrace. Some Unix-like systems provide other diagnostic tools similar to strace, such as truss.

MySQL Warning | 1681 | 'INFORMATION_SCHEMA.INNODB_LOCK_WAITS' is deprecated and will be removed in a future release

For MySQL 8, use  performance_schema SELECT r . trx_id waiting_trx_id, r . trx_mysql_thread_id waiting_thread, r . trx_query waiting_query, b . trx_id blocking_trx_id, b . trx_mysql_thread_id blocking_thread, b . trx_query blocking_query FROM performance_schema . data_lock_waits w INNER JOIN information_schema . innodb_trx b ON b . trx_id = w . blocking_engine_transaction_id INNER JOIN information_schema . innodb_trx r ON r . trx_id = w . requesting_engine_transaction_id ;