Posts

Showing posts from December, 2019

Generate simple java maven project

#generate simple java maven project
mvn archetype:generate -DgroupId=com.yourcompany -DartifactId=myproject -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

Start SSH Agent on Windows/Linux

Windows:

Start a local Administrator PowerShell and run the following commands:

# Make sure you're running as an Administrator
Set-Service ssh-agent -StartupType Automatic
Start-Service ssh-agent
Get-Service ssh-agent

Linux:

First, start the SSH Agent in the background by running the following in a terminal:

eval "$(ssh-agent -s)"
Then add these lines to your ~/.bash_profile so it starts on login:

if [ -z "$SSH_AUTH_SOCK" ]
then
   # Check for a currently running instance of the agent
   RUNNING_AGENT="`ps -ax | grep 'ssh-agent -s' | grep -v grep | wc -l | tr -d '[:space:]'`"
   if [ "$RUNNING_AGENT" = "0" ]
   then
        # Launch a new instance of the agent
        ssh-agent -s &> .ssh/ssh-agent
   fi
   eval `cat .ssh/ssh-agent`
fi

How to turn on/off Dell laptop Keyboard backlit

Make sure the Keyboard backlit option is enabled in the BIOS. 
With the computer completely off, press the power button.
Immediately start pressing the F2 key once a second.
Click the + sign next to System Configuration.
Click Keyboard Illumination

Resolving Git line ending issues in WSL

On Windows you should add a .gitattributes file to your project to force consistent line endings
https://code.visualstudio.com/docs/remote/troubleshooting#_resolving-git-line-ending-issues-in-wsl-resulting-in-many-modified-files

rsync to sync Remote files

The rsync command can be installed using Linux package managers (for example sudo apt install rsync on Debian/Ubuntu). For Windows, you'll need to either use WSL or Cygwin to access the command.

To use the command, navigate to the folder you want to store the synched contents and run the following replacing user@hostname with the remote user and hostname / IP and /remote/source/code/path with the remote source code location.

On macOS, Linux, or inside WSL:

rsync -rlptzv --progress --delete --exclude=.git "user@hostname:/remote/source/code/path" .

Or using WSL from PowerShell on Windows:

wsl rsync -rlptzv --progress --delete --exclude=.git "user@hostname:/remote/source/code/path" "`$(wslpath -a '$PWD')"

Convert your PuTTYGen keys

Reusing a key generated in PuTTYGen
If you used PuTTYGen to set up SSH public key authentication for the host you are connecting to, you need to convert your private key so that other SSH clients can use it. To do this:

Open PuTTYGen locally and load the private key you want to convert.

Select Conversions > Export OpenSSH key from the application menu. Save the converted key to a local location under the.ssh directory in your user profile folder (for example C:\Users\youruser\.ssh).

Validate that the local permissions on the exported key file only grant Full Control to your user, Administrators, and SYSTEM.

GCLI is a Graphical Command Line Interface.

GCLI wants command lines to be discoverable and beautiful in addition to being fast and powerful. GCLI commands are just JavaScript so it is easy to extend.

As part of developer tools, GCLI will enable developers to access a wide range of development and diagnosis tools without a cluttered interface. It will help users enter the correct parameters quickly and without reference to manuals.

Current web developer tools like Firebug and the Webkit Inspector have command lines, however they are largely unused for user interaction because they insist on a pure JavaScript syntax.
https://wiki.mozilla.org/DevTools/Features/GCLI

Never Invest In What You Don’t Understand

Only invest in what you do understand.
Invest in yourself if you have confidence in yourself. Otherwise invest in somebody else who you trust.

Samsung Galaxy Tab: Install Google Play Store (Android Market) Via APK

Some versions of the Samsung Galaxy Tab don’t have the Google Play Store (Android Market) included with it. Here is a way to do it using a Windows PC and the Android SDK. Your alternative choice is to install Amazon Appstore for Android or you can install from F-droid

Amazon.com Widgets
Note: You have to have root access to perform these steps. You can refer this link to root your device.
1. Open Settings and select Applications. 2. Check Unknown sources. 3. Download and install the Android SDK.  4. Download and install the Android USB Drivers. 5. Download and install Root Explorer. (Since you don’t have Android Market, you’ll have to search for a Root Explorer APK file you can install on your device. Google it, and be sure to buy the app to support the developers. It’s totally worth $4.) 6. From your computer, download Vending-3.5.16.apk  (another download link)and GoogleServicesFramework.apk (another download link). 7. Mount the Galaxy Tab to your computer via USB cable and copy the  V…

How to solve: netstat: command not found

netstat has been deprecated in favor of ss
For example:
$ sudo ss -a | grep nfs
tcp    LISTEN     0      64                   *:nfs                   *:*       
tcp    LISTEN     0      64                  :::nfs                  :::*  


$ ss --help
Usage: ss [ OPTIONS ]
       ss [ OPTIONS ] [ FILTER ]
   -h, --helpthis message
   -V, --versionoutput version information
   -n, --numericdon't resolve service names
   -r, --resolve       resolve host names
   -a, --alldisplay all sockets
   -l, --listeningdisplay listening sockets
   -o, --options       show timer information
   -e, --extended      show detailed socket information
   -m, --memory        show socket memory usage
   -p, --processesshow process using socket
   -i, --infoshow internal TCP information
   -s, --summaryshow socket usage summary
   -b, --bpf           show bpf filter socket information

   -4, --ipv4          display only IP version 4 sockets
   -6, --ipv6          display only IP version 6 sockets
   -0, --pa…

How to fix: MySQL-WorkBench: Error communicating with gnome-keyring-daemon

In
/usr/bin/mysql-workbench
uncomment or add the line

export WB_NO_GNOME_KEYRING=1

How to fix "Remember logins for sites" checkbox in options is greyed out in FireFox

Start Firefox in Safe Mode to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance). Do not click the Reset button on the Safe mode start window or otherwise make changes.https://support.mozilla.org/kb/Safe+Modehttps://support.mozilla.org/kb/Troubleshooting+extensions+and+themes You can also inspect the signon.rememberSignons pref on the about:config page to see if you can toggle the value to true.
You can also fix it by How to create a new Firefox profile

What is the difference between 1.x and 2.x of jquery

Versions of 2.x leave behind the older Internet Explorer 6, 7, and 8 browsers. In return they are smaller, faster, and can be used in JavaScript environments where the code needed for old-IE compatibility often causes problems of its own. The jQuery team still supports the 1.x branch which does run on IE 6/7/8. You can (and should) continue to use jQuery 1.x on web sites that need to accommodate older browsers.

How to fix: df shows no file systems processed on Linux

If you run df command and get the following output:

df: no file systems processed

At the same time you have no problem with "du" or "ls" commands.

One possible reason is that your disk run out of space. You need to delete some files to recover. You cannot fix it if it is caused by other reason. But this is the first thing you want to do when it happens.

See also:

Solution to Disk Full in production serverFind and delete Files depends on modify days on Linux

How to install system table for mysql

# mysql_install_db --user=mysql

How to fix: Can't find Maven installation EMBEDDED in appengine-maven-plugin

If you encounter the following error:

[ERROR] Failed to execute goal com.google.appengine:appengine-maven-plugin:1.8.3:devserver (default-cli) on project mavengaetestproject: The plugin com.google.appengine:appengine-maven-plugin:1.8.3 requires Maven version 3.1.0 -> [Help 1]

Eclipse Kepler is running Maven 3.0.4 internally. On the Maven Installations configuration dialog it says “Note: Embedded runtime always used for dependency resolution…”.  Basically, by default, any Run As, Maven command is using Eclipse’s embedded Maven configuration.

This can be fixed by going into the Run As, Run Configurations… dialog and searching for DevAppServer, click on it. At the bottom there is a Maven Runtime combobox, select the external Maven entry.  Apply and then run.

How to hide description from mobile version of blogger

Search for the following block of code (It will be present inside the header widget)

<b:includableid='description'>
<divclass='descriptionwrapper'>
<pclass='description'><span><data:description/></span></p>
</div>
</b:includable>
Now replace this with 

<b:includableid='description'>
<b:ifcond='data:blog.isMobile'>
<b:else/>
<divclass='descriptionwrapper'>
<pclass='description'><span><data:description/></span></p>
</div>
</b:if>
</b:includable>

How to solve: mysql Error Code: 1406. Data too long for column

You need to get rid of MySQL "strict" mode.

SELECT @@global.sql_mode;SELECT @@SESSION.sql_mode;SETglobal sql_mode='';SETsession sql_mode=''; Or some other mode without "strict".

See also:
How to get rid of STRICT SQL mode in MySQL

How to fix Google Apps Script: Script function not found: doGet

Every webapp in Google Apps Script must have a main function called doGet() which is the entry point of the app, the function that your app will start with when you type the webapp url.

This is true for every application deployed as a standalone app and called by its url - with a user interface or not.

If you read the documentation you'll see that all the standalone apps examples for HTMLService or UiApp have a doGet function.

Only container embedded ui scripts or scripts that run on triggers are not concerned by this rule.

Networking modes in VirtualBox

Not attached
In this mode, VirtualBox reports to the guest that a network card is present, but that there is no connection -- as if no Ethernet cable was plugged into the card. This way it is possible to "pull" the virtual Ethernet cable and disrupt the connection, which can be useful to inform a guest operating system that no network connection is available and enforce a reconfiguration.

Network Address Translation (NAT)
If all you want is to browse the Web, download files and view e-mail inside the guest, then this default mode should be sufficient for you, and you can safely skip the rest of this section. Please note that there are certain limitations when using Windows file sharing

Bridged networking
This is for more advanced networking needs such as network simulations and running servers in a guest. When enabled, VirtualBox connects to one of your installed network cards and exchanges network packets directly, circumventing your host operating system's network sta…

Amazon Cognito - Add user sign-up, sign-in, and data synchronization to your apps

Amazon Cognito lets you easily add user sign-up and sign-in to your mobile and web apps.  With Amazon Cognito, you also have the options to authenticate users through social identity providers such as Facebook, Twitter, or Amazon, with SAML identity solutions, or by using your own identity system.

In addition, Amazon Cognito enables you to save data locally on users devices, allowing your applications to work even when the devices are offline. You can then synchronize data across users devices so that their app experience remains consistent regardless of the device they use.

With Amazon Cognito, you can focus on creating great app experiences instead of worrying about building, securing, and scaling a solution to handle user management, authentication, and sync across devices.

Initial Server Setup with CentOS

adduser i88
passwd

visudo

i88    ALL=(ALL:ALL) ALL

sudo vi /etc/ssh/sshd_config


PermitRootLogin no
UseDNS no
AllowUsers i88

/etc/init.d/sshd reload

Test you can login with the new user i88 before logout.

You may then go ahead with 

Programming / coding competition / practice

International Olympiad in Informatics, a similar competition for secondary school students.Information - ACM International Collegiate Programming ContestGoogle Code Jam, another programming competitionFacebook Hacker Cup, another programming competitionICFP Programming Contest, another programming competitionInternet Problem Solving Contest, another programming competitionOnline judge, a type of service to practice for programming contests and run them online (Wikipedia article includes links to several apps/systems)ShareCode ACM Online Judge, The ACM Online Judge and Social Network for acm lovers.PC², the Programming Contest Control System in support of Computer Programming Contest activities (used at ICPC World Finals until 2008)Kattis, KTH automated teaching tool (used at ICPC World Finals since 2009)SPOJ, an online judge systemTopCoder, a company that administers programming competitionsUVa Online Judge, an online judge systemProject Euler, a websited dedicated to computationa…

How to validate fstab syntax without rebooting Linux

You can simple run: mount -a

-a Mount all filesystems (of the given types) mentioned in fstab.

This command will mount all (not-yet-mounted) file systems mentioned in /etc/fstab and is used in system script startup during booting.

How to solve: java.lang.SecurityException: Missing required Permissions manifest attribute in main jar

You either need to lower your Java security to medium (you can bring security of Java back to high after that)


Or

You add Java to Exception Site List:

The Exception Site List feature allows end users to run Java applets and Java Web Start applications that do not meet the latest security requirements. Rich Internet Applications that are hosted on a site in the exception site list are allowed to run with the applicable security prompts.

Backup Jenkins Server

Setting up a backup process for Jenkins configuration.
Script a Jenkins job to use the thinBackup plugin or S3 plugin to send the Jenkins configuration to an Amazon S3 (cloud storage).

How to find out what Linux distribution is

cat /etc/*release Most distributions put a release file in /etc/ (like /etc/redhat-release, /etc/gentoo-release, etc.) which usually has the version number of your distribution in it.
$ cat /etc/*release Oracle Linux Server release 7.7 NAME="Oracle Linux Server" VERSION="7.7" ID="ol" ID_LIKE="fedora" VARIANT="Server" VARIANT_ID="server" VERSION_ID="7.7" PRETTY_NAME="Oracle Linux Server 7.7" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:oracle:linux:7:7:server" HOME_URL="https://linux.oracle.com/" BUG_REPORT_URL="https://bugzilla.oracle.com/"
ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7" ORACLE_BUGZILLA_PRODUCT_VERSION=7.7 ORACLE_SUPPORT_PRODUCT="Oracle Linux" ORACLE_SUPPORT_PRODUCT_VERSION=7.7 Red Hat Enterprise Linux Server release 7.7 (Maipo) Oracle Linux Server release 7.7

Browser-Based Games

Boardgame3D Hartwing Chess Set - 3D chess game done in HTML/CSS/JS.Desperate Gods - Free online board game that was designed to be played just like a board game in real-life: no rules are enforced by the computer. Play it now!Green Mahjong - Solitaire mahjong game done in HTML/CSS/JS.Lichess - Free chess game using HTML5 & websockets, built with Scala, Play 2.1, MongoDB and Elasticsearch. Play it now!ArcadeAlge's Escapade - HTML5, JavaScript, GameJs arcade game where you control an Algae. Play it now!Alien Invasion - Demo Game for Mobile HTML5 Game Development. Play it now!Arashi - Arashi is a clone of the Arcade game Tempest. Play it now!Asteroids - Pure JavaScript asteroids. Play it now!Avabranch - GitHub Game Off 2012 entry. Play it now!Ball And Wall - Pure JavaScript arkanoid style game. Play it now!Captain Rogers - Captain Rogers: Asteroid Belt of Sirius - HTML5 mobile game created using ImpactJS. Play it now!Cell Mates - Game made in 48 hours for the 2013 Global Game Jam…