Posts

Showing posts from July, 2020

Fixed: windows 10 no sound without headphones

Please go to control panel -> hardware and sound -> sound

In the playback tab ,  Please enable and set your laptop speakers as the default device

If you cannot set  speakers as the default device, do the following:
go to start search and type cmd search will return cmd.exe right click on this and select 'run as administrator' at the prompt type:-



net localgroup Administrators /add networkservice, press enter then type:net localgroup Administrators /add localservice, press enter then type:exit, press enter  restart your computer

What does 'grep -v' do

-v means "invert the match" in grep, in other words, return all non matching lines.

xargs and kill example

sudo ps -ef | grep java | grep email | awk '{print $2}' | xargs sudo kill -9

How to find Linkedin company page id

From the company page, check Notifications tab, the link of Notifications contains company page id in the URL.

If you cannot find Notifications tab, then you can view page source, and search for "companyid".

How to change Google cloud SQL timezone

Change MySQL Flag default_time_zone to the value you want. For example, to change to Eastern Standard time:

change default_time_zone to -05:00

How to change Google cloud SQL timezone

Change MySQL Flag default_time_zone to the value you want. For example, to change to Eastern Standard time:

change default_time_zone to -05:00

Watch out for LEFT JOIN with additional conditions in SQL

SELECT  *
FROM    a
LEFT JOIN
b
ON      b.a_id = a.id
WHERE   b.column = 'sth'
Return the same result as (but less efficient)

SELECT  *
FROM    a
INNER JOIN
b
ON      b.a_id = a.id
WHERE   b.column = 'sth'
Put additional conditions on left table on left join will actually filter out those rows where b.column is null. Because  NULL in SQL doesn't equal to anything. So the only exception to put extra condition on left table of left join is to check b.column is null or not.

If you actually want to return those  b.column = 'sth' and at the same time with all records of table a, then the condition should be moved into ON clause:

SELECT  *
FROM    a
LEFT JOIN
        b
ON      b.a_id = a.id
AND b.column = 'sth'

Email spamming related to IP address

Waterfalling – is when multiple Email Sending providers ( ESP ) are being used to send email. In this case, each ESP is using it’s own block of IP addresses. Spammers use one ESP to clean their lists, also called scrubbing, and another to send the actual marketing email. This technique is used by spammers and gray mailers.Snowshoe Spamming – is a spamming technique where a wide range of IP addresses are used to spread out the spam send rate and or load. Using a wide range of IP addresses makes it difficult for ISP’s to successfully identify the spam resulting in some of the spam to slip through.IP hopping – is simply using one set of IP addresses today, and next week you use new ones. ISP’s might throw you into the category of Snowshoeing or Waterfalling. If for some reason you have to change your IP’s, make sure they get warmed up properly, by relaying only a few mails per day through them. It takes a very long time to build a proper reputation for IP’s.The complete IP check for send…

Exposing RDP/SSH ports over the Internet isn't desired and is seen as a significant threat surface.

This is often due to protocol vulnerabilities. To contain this threat surface, you can deploy bastion hosts (also known as jump-servers) at the public side of your perimeter network. Bastion host servers are designed and configured to withstand attacks. Bastion servers also provide RDP and SSH connectivity to the workloads sitting behind the bastion, as well as further inside the network.

Watch out for LEFT JOIN with additional conditions in SQL

SELECT  *
FROM    a
LEFT JOIN
b
ON      b.a_id = a.id
WHERE   b.column = 'sth'
Return the same result as (but less efficient)

SELECT  *
FROM    a
INNER JOIN
b
ON      b.a_id = a.id
WHERE   b.column = 'sth'
Put additional conditions on left table on left join will actually filter out those rows where b.column is null. Because  NULL in SQL doesn't equal to anything. So the only exception to put extra condition on left table of left join is to check b.column is null or not.

If you actually want to return those  b.column = 'sth' and at the same time with all records of table a, then the condition should be moved into ON clause:

SELECT  *
FROM    a
LEFT JOIN
        b
ON      b.a_id = a.id
AND b.column = 'sth'

Showing Git Remotes

To see which remote servers you have configured, you can run the git remote command.
You can also specify -v, which shows you the URLs that Git has stored for the shortname to be used when reading and writing to that remote:

$ git remote -v

How to delete many rows from a large table in MySQL

If you want to delete many rows from a large table, you may exceed the lock table size for an InnoDB table. To avoid this problem, or simply to minimize the time that the table remains locked, the following strategy (which does not use DELETE at all) might be helpful: Select the rows not to be deleted into an empty table that has the same structure as the original table: create table t_copy like t; insert into t_copy SELECT * FROM t WHERE ... ;
See also:
How to Copy Table in MySQL

Use RENAME TABLE to atomically move the original table out of the way and rename the copy to the original name: RENAME TABLE t TO t_old, t_copy TO t; Drop the original table:
DROP TABLE t_old; Note that Foreign keys that point to the renamed table are not automatically updated. In such cases, you must drop and re-create the foreign keys in order for them to function properly.
If you need a smaller table for development, to keep the foreign keys:
createtablecontacts_newlike contacts;
insert into contacts_new select*from …

How to delete many rows from a large table in MySQL

If you want to delete many rows from a large table, you may exceed the lock table size for an InnoDB table. To avoid this problem, or simply to minimize the time that the table remains locked, the following strategy (which does not use DELETE at all) might be helpful: Select the rows not to be deleted into an empty table that has the same structure as the original table: create table t_copy like t; insert into t_copy SELECT * FROM t WHERE ... ;
See also:
How to Copy Table in MySQL

Use RENAME TABLE to atomically move the original table out of the way and rename the copy to the original name: RENAME TABLE t TO t_old, t_copy TO t; Drop the original table:
DROP TABLE t_old; Note that Foreign keys that point to the renamed table are not automatically updated. In such cases, you must drop and re-create the foreign keys in order for them to function properly.
If you need a smaller table for development, to keep the foreign keys:
createtablecontacts_newlike contacts;
insert into contacts_new select*from …

MySQL Sandbox with the Sakila sample database

You can go to https://www.katacoda.com/mysql-db-sandbox/scenarios/mysql-sandbox to access the MySQL Sandbox, which has the Sakila sample database loaded in a MySQL instance.
You’ll have to set up a (free) Katacoda account. Then, click the Start Scenario button.

See also:
https://dev.mysql.com/doc/index-other.html

The AWS Toolkit is an open source plug-in for popular IDEs that uses the SAM CLI to build and deploy serverless applications on AWS

If you prefer to use an integrated development environment (IDE) to build and test your application, you can use the AWS Toolkit.
The AWS Toolkit also adds a simplified step-through debugging experience for Lambda function code. See the following links to get started.

* [PyCharm](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html)
* [IntelliJ](https://docs.aws.amazon.com/toolkit-for-jetbrains/latest/userguide/welcome.html)
* [VS Code](https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/welcome.html)
* [Visual Studio](https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/welcome.html)

Java Http Client

Although the java.net package provides basic functionality for accessing resources via HTTP, it doesn't provide the full flexibility or functionality needed by many applications. HttpClient seeks to fill this void by providing an efficient, up-to-date, and feature-rich package implementing the client side of the most recent HTTP standards and recommendations.

Designed for extension while providing robust support for the base HTTP protocol, HttpClient may be of interest to anyone building HTTP-aware client applications such as web browsers, web service clients, or systems that leverage or extend the HTTP protocol for distributed communication.

(Apache Commons HttpClient is an old project which  is now deprecated that produced HttpClient 3.1. The project was subsumed by the larger Apache HttpComponents project, which produced HttpClient 4.x.)

Restful implementation Jersey provides ApacheHttpClient Class which is a Client that utilizes the Apache HTTP client to send and receive HTTP req…

One-time job on Linux

at utility is very simple to use, and you can fire off a one-time job without a lot of fuss. Run at time < script.sh and at will run the script and then exit. For example:

at 8am -f script.sh

Will run the script at 8 a.m. -- if it's past 8 a.m., then it will run the job tomorrow. And that's it; the job will run once.
If you want to see what's scheduled, just use the atq command to see what you will be running.  Note that the -f option specifies a file for the command input, whereas you can also just provide the commands via standard input (such as using the < script.sh method).

How to Install Oracle Java JDK in Ubuntu Linux

Copy and decompress oracle Java to /usr/local/java

$ sudo mv jdk1.8.0_05/ /usr/local/java

Edit profile:

$ sudo gedit /etc/profile &

Scroll down to the end of the file using your arrow keys and add the following lines below to the end of your /etc/profile file:

JAVA_HOME=/usr/local/java/
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH

Inform your Ubuntu Linux system where your Oracle Java JDK/JRE is located. This will tell the system that the new Oracle Java version is available for use.
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/bin/java" 1 $ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/bin/javac" 1 $ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/bin/javaws" 1
Inform your Ubuntu Linux system that Oracle Java JDK/JRE must be the default Java.
$ sudo update-alternatives --set java /usr/local/ja…

HTML Element Reference

HTML5 - Tags ReferenceTagDescription<!--...-->Specifies a comment<!DOCTYPE>Specifies the document type<a>Specifies an anchor<abbr>Specifies an abbreviation<acronym>Deprecated:Specifies an acronym<address>Specifies an address element<applet>Deprecated: Specifies an applet<area>Specifies an area inside an image map<article>New Tag: Specifies an independent piece of content of a document, such as a blog entry or newspaper article<aside>New Tag:Specifies a piece of content that is only slightly related to the rest of the page.<audio>New Tag:Specifies an audio file.<base>Specifies a base URL for all the links in a page<basefont>Deprecated: Specifies a base font<bdo>Specifies the direction of text display<bgsound>Specifies the background music<blink>Specifies a text which blinks<blockquote>Specifies a long quotation<body>Specifies the body element<br>Inserts a single line break&…