Testing Webhooks Locally for Amazon SNS

Testing Tools

To test the code I wrote for the blog post, I used PHP’s built-in web server (available in PHP 5.4 and later) to serve the code locally. I used another tool called ngrok to expose the locally running PHP server to the public internet. Ngrok does this by creating a tunnel to a specified port on your local machine.

You can use PHP’s built-in web server and ngrok on Windows, Linux, and Mac OS X. If you have PHP 5.4+ installed, then the built-in server is ready to use. To install ngrok, use the simple instructions on the ngrok website. I work primarily in OS X, so you may need to modify the commands I use in the rest of this post if you are using another platform.

Setting Up the PHP Code

First, you’ll need the PHP code that will handle the incoming messages. My post about receiving SNS messages provides a complete code example for doing this.

Let’s create a new folder in your home directly to use for this test. We’ll also install Composer, the AWS SDK for PHP, create a directory for the webroot, and create files for the PHP code and a log.

mkdir ~/sns-message-test && cd ~/sns-message-test
curl -sS https://getcomposer.org/installer | php
php composer.phar require aws/aws-sdk-php:~2.6.0
touch messages.log
mkdir web && touch web/index.php

Now take the PHP code from the other blog post and put it in index.php. Here is that same code, but with the require statement needed to load the SDK with our current file structure. I am also going to update the code to log the incoming messages to a file so we can easily see that the messages are being handled correctly.

<?php

require __DIR__ . '/../vendor/autoload.php';

use AwsSnsMessageValidatorMessage;
use AwsSnsMessageValidatorMessageValidator;
use GuzzleHttpClient;

// Make sure the request is POST
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    http_response_code(405);
    die;
}

try {
    // Create a message from the post data and validate its signature
    $message = Message::fromRawPostData();
    $validator = new MessageValidator();
    $validator->validate($message);
} catch (Exception $e) {
    // Pretend we're not here if the message is invalid
    http_response_code(404);
    die;
}

if ($message->get('Type') === 'SubscriptionConfirmation') {
    // Send a request to the SubscribeURL to complete subscription
    (new Client)->get($message->get('SubscribeURL'))->send();
}

// Log the message
$file = new SplFileObject(__DIR__ . '/../messages.log', 'a');
$file->fwrite($message->get('Type') . ': ' . $message->get('Message') . "n");

Creating an Amazon SNS Topic

Before you can perform any tests, you must set up an Amazon SNS topic. You can do this easily in the AWS Management Console by following the Getting Started with Amazon Simple Notification Service guide. This guide also shows how to subscribe to a topic and publish a message, which you will also need to do in a moment.

Setting Up the Server

OK, we have an Amazon SNS topic ready and all of the files we need in place. Now we need to start up the server and make it accessible to Amazon SNS. To do this, create 3 separate terminal windows or tabs, which we will use for 3 separate long-running processes: the server, ngrok, and tailing the messages log.

Launching the PHP Built-in Server

In the first terminal window, use the following command to start up the PHP built-in web server to serve our little test webhook. (Note: you can use a different port number, just make sure you use the same one with ngrok.)

php -S 127.0.0.1:8000 -t web/

This will create some output that looks something like the following:

PHP 5.4.24 Development Server started at Mon Mar 31 11:02:14 2014
Listening on http://127.0.0.1:8000
Document root is /Users/your-user/sns-message-test/web
Press Ctrl-C to quit.

If you access http://127.0.0.1:8000 from your web browser, you will likely see a blank page, but that request will show up in this terminal window. Since our code is set up to respond only to POST requests, we will see the expected behavior of a 405 HTTP code in the response.

[Mon Mar 31 11:02:44 2014] 127.0.0.1:61409 [405]: /

Creating a Tunnel with ngrok

In the second terminal window, use the following command to create an ngrok tunnel to the PHP server. Use the same port as you did in the previous section.

ngrok 8000

That was easy! The output of this command will contain a publicly accessible URL that forwards to your localhost.

Tunnel Status                 online
Version                       1.6/1.5
Forwarding                    http://58565ed9.ngrok.com -> 127.0.0.1:8000
Forwarding                    https://58565ed9.ngrok.com -> 127.0.0.1:8000
Web Interface                 127.0.0.1:4040
# Conn                        1
Avg Conn Time                 36.06ms

ngrok also provides a small web app running on localhost:4040 that displays all of the incoming requests through the tunnel. It also allows you to click a button to replay a request, which is really helpful for testing and debugging your webhooks.

Tailing the Message Logs

Let’s use the third terminal window to tail the log file that our PHP code writes the incoming messages to.

tail -f messages.log

This won’t show anything yet, but once we start publishing Amazon SNS messages to our topic, they should be printed out in this window.

Testing the Incoming SNS Messages

Now that everything is running and wired up, head back to the Amazon SNS console and subscribe the URL provided by ngrok as an HTTP endpoint for your SNS topic.

If all goes well, you should see output similar to the following on each of the 3 terminal windows.

PHP Server:

[Tue Apr  1 08:51:13 2014] 127.0.0.1:50190 [200]: /

ngrok:

POST /                        200 OK

Log:

SubscriptionConfirmation: You have chosen to subscribe to the topic arn:aws:sns:us-west-2:01234567890:sdk-test. To confirm the subscription, visit the SubscribeURL included in this message.

Back in the SNS console, you should see that the subscription has been confirmed. Next, publish a message to the topic to test that normal messages are processed correctly. The output should be similar:

PHP Server:

[Tue Apr  1 10:08:14 2014] 127.0.0.1:51235 [200]: /

ngrok:

POST /                        200 OK

Log:

Notification: THIS IS MY TEST MESSAGE!

Nice work!

As well as Amazon Web Services and many more.

Display country, region, city using ip address in php

	$ipaddress = $_SERVER['REMOTE_ADDR'];
		//$ipaddress='203.115.97.180';
		//$json       = file_get_contents("http://ip-api.com/json");
	//$json       = file_get_contents("http://ipinfo.io/{$ipaddress}");
	//$json       = file_get_contents("http://ipinfo.io/{$ipaddress}");
		$json       = file_get_contents("http://ip-api.com/json/".$ipaddress);
		$details    = json_decode($json);
		$data['countryCode']=$details->countryCode;
		$data['region']=$details->region;
		$data['city']=$details->city;

php upgrade to 7.4 apache

Add PPA for PHP 7.4

Add the ondrej/php which has PHP 7.4 package and other required PHP extensions.

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update

Once you have added the PPA you can install PHP 7.4.

Install PHP 7.4 for Apache

Execute the following command to install PHP 7.4

sudo apt install php7.4

Install PHP 7.4 Extensions

Installing PHP extensions are simple with the following syntax.

sudo apt install php7.4-extension_name

Now, install some commonly used php-extensions with the following command.

sudo apt install php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip php7.4-intl -y

After the installation has completed, you can confirm the installation using the following command

php -v

Enable PHP 7.4 for Apache

Now you need to tell Apache to use the installed version of PHP 7.4 by disabling the old PHP module (below I have mentioned php7.0, you need to use your current php version used by Apache) and enabling the new PHP module using the following command.

sudo a2dismod php7.0
sudo a2enmod php7.4

Restart Apache for the changes to take effect.

sudo service apache2 restart

Soa Technology

Android 12 might allow sharing Wi-Fi passwords with Nearby Share

Android 11 is still rolling out to eligible devices around the world months after Google first rolled out the update to the Pixels last September, but the company is already hard at work putting together the next exciting release – Android 12. We’re now seeing tidbits of Google’s planned features for the next version that will land later this year, including improvements to Wi-Fi setup.

Earlier today, we reported that Android 12 will likely include a feature titled Restricted Networking Mode, as part of changes to iptables, the firewall utility for Android and Linux, to allow only certain apps which have the “use restricted network permission” to use the network.

Another feature has now been discovered by XDA, which is essentially an improvement to the ability to share Wi-Fi networks introduced in Android 10. As of today, users running Android 10 or Android 11 could simply share their Wi-Fi networks via an automatically generated QR code, which the recipients would scan to join instead of typing the password.

However, this is not ideal for most situations, such as when you’re hosting a party at home and don’t really want to print the QR code for everyone to see – or have to keep opening your phone’s Wi-Fi settings and hoping the other person has a QR-code scanner. Google is working on an extension to the AirDrop-like Nearby Share feature that was introduced on Android phones last year, to allow secure sharing of Wi-Fi passwords.

The feature should involve a change to the Wi-Fi sharing option to allow sending the code to any compatible device discoverable by Nearby Share in the vicinity. You can even use this to share Wi-Fi passwords while physically separated by a big group of people, like a gathering at home, without alerting anyone else.

While we still don’t know if this feature will actually make it into Android 12 or appear as a feature update to Nearby Services on Google Play Services, one immediate and obvious benefit of using this method is that your recipient doesn’t need to be on the latest version of Android. Since Nearby Share works on all Android devices running Android Marshmallow (6.0) and above, the feature should be supported out of the box when it is released in September.

sourceby:way2infone

is this possible two google-site-verification on website

Verify your site ownership

What is verification?

Verification is the process of proving that you own the property that you claim to own. We need to confirm ownership because once you are verified for a property, you have access to its Google Search data, and can affect its presence on Google Search. Every Search Console property requires at least one verified owner.

VERIFY YOUR PROPERTY

Verify a website

  1. Either add a new property or choose an unverified property from the property selector bar.
  2. Choose one of the verification methods listed below and follow the instructions. Not all verification methods are available for all types of properties; the verification page will list which methods are available and recommended for your site.

Multiple people can add and verify a website property separately, using the same or different verification methods. If you use the same verification method, just be sure that you don’t overwrite the verification tokens of any other owners.

Using multiple verification methods

You can add additional verification methods in your property’s verification settings page. You might want to add more than one verification method in case one of your existing verification methods fails (for example, if you verified using a Google Analytics tracking code, and someone changes a template on your website that omits the tag).

To add an additional verification method, visit the Settings page for the property and click Ownership verification.

How long does verification last?

Google periodically checks if your verification is valid (for example, checking if your HTML verification tag is still present). If verification can no longer be confirmed, your permissions on that property will expire after a certain grace period.

If all verified owners lose access to a property, all delegated owners (owners added by a verified owner), users, and associates of the property will lose access to the Search Console property.

When will I start to see data?

Data is collected for a property from the time that you first add it as a Search Console property. Any gaps in verification do not typically cause a gap in data collection.

We lost our site owner!

If the verified owner of your site leaves, or you’re not sure who the verified owner is, verify another site owner. The new owner will be able to see the list of all owners and users verified to that site, as well as the verification methods for each owner. You can then optionally unverify previous owners by removing their verification token (for example, removing the HTML tag from the site, for HTML-tag-verified owners). See Add or remove owners for more information.

Verification method details

HTML file upload
HTML tag
Domain name provider
Google Analytics tracking code
Google Tag Manager container snippet
Google Sites
Blogger
Google Domains

Common verification errors

In addition to any method-specific verification errors, the following verification errors are possible in most verification methods:

  • Incorrect tag/snippet/file errors
    Be sure to use the exact tag, code snippet, or file provided to you when beginning verification.
  • The connection to your server timed out.
    We were unable to verify your file because we received a server timeout. This could be because your server is down or is busy and responding slowly. Make sure that your server is responding and try again.
  • We encountered an error looking up your site’s domain name.
    We tried to access your verification file, but were unable to access your domain due to a DNS error. This could be because your server is down, or there is an issue with the DNS routing to your domain. Make sure that your domain is resolving correctly and try again.
  • The download request was redirected too many times.
    Check the URL for potential issues, such as an infinite loop.
  • Your server returned an invalid response.
    This can happen if your site is requires password authentication, or if we cannot access it for other reasons.
  • We were unable to connect to your server.
    Make sure that your server is not down, and that your domain is resolving correctly, and try again.
  • An internal error occurred.
    If this problem persists, check the Webmaster Central Help Forum for updates.
  • Timeout
    Either your site or the domain server stopped responding to our requests (depending on the verification method used). Confirm that your site is responding, and then try again.
  • Could not find your domain
    We tried to resolve the site URL that you gave us, but it is unknown to the DNS service. Check that you are providing the correct URL for your property.

Soa Technology

radio button act like button bootstrap 3

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>    
<div class="btn-group" data-toggle="buttons">
      <label class="btn btn-primary">
        <input type="radio" name="options" id="option1"> Option 1
      </label>
      <label class="btn btn-primary">
        <input type="radio" name="options" id="option2"> Option 2
      </label>
      <label class="btn btn-primary">
        <input type="radio" name="options" id="option3"> Option 3
      </label>
</div>

Here’s how you can find PAN Card Number Online

Here’s how you can find PAN Card Number Online

We might have faced some times when you are not carrying your PAN Card with you and need to immediately quote it in some document. Even if you have committed your PAN number to memory, recalling it can be difficult at times. How do you find it? Here are some ways in which you can find your PAN Number quickly:

Netbanking : You can quickly login to your net banking account or app. If you had linked your bank account with your PAN, then you can log in to your account and check the PAN. PAN can be located by accessing the bank account online or through mobile banking. It is mentioned in a Bank Pass Book as well. PAN Details are available under ‘Customer Profile’ or ‘Personal Information’ section online. If the PAN is not showing online but you are sure that you had linked your PAN to this account, then you can call the bank’s customer care and ask them for assistance.

Salary Slips : For salaried individuals, this is the easiest way to find the Permanent Account Number. All companies seek PAN details at the time of on boarding of employees and it is mentioned on the monthly Payslip. Payslips are generally made available online through the company’s internal portal or should be available on mail as well.

Form 16 – Form 16 is a certificate issued by the employer (online and/or hard copy) with details about tax deducted for the FY and amount received by employee from employer during the Financial Year. Apart from other details, it has the employee PAN as well.

From Income Tax Department’s e-filing website – The PAN number can be accessed through Income Tax website by Registration – it is an easy one time process and on registration, details like PAN Number, Name, Date of Birth and Address can be obtained and verified.

IT Returns : You can check your past IT returns as they would have your PAN number mentioned on them.

Other methods :-

Do you recall submitting your PAN Card to any private entity as a proof of identity? If yes, then you might want to try talking to them and get your PAN Number from them.

Almost all Demat accounts have a Pan number on record. If you hold a Demat account, then talk to the provider who might help you after verifying your identity.

Do you remember purchasing foreign currency exceeding INR50k? If yes, then you would have provided your PAN details to the firm/agency/bank from where you purchased the same. That can be a good place to check too.

If you have applied for a credit card recently, then your application form will have your PAN number. Talk to customer service and request them to share your PAN number with you after verifying your identity.

All motor vehicle purchases and sales (except two-wheelers) need to quote PAN number on the invoice. If you have made such a sale/purchase, check the invoice.

If you have paid a life insurance premium of more than INR50k in a financial year, then the insurer will have your PAN number on record. Talk to the insurer to get the number.

source : techiyogiz

can i remove secondary domain and add second secondary domain in google legacy

Google is a company which is mostly renowned for its moto “Don’t be evil” but in past few years Google has become very serious about generating money and blocking out all loopholes which tech nerds used to use for getting stuffs for free. If you have an old Google Apps a.k.a G Suite legacy account you might have free user limit starting from 10 to 2,000. I’ve seen many Google Apps a.k.a G Suite legacy account that has around 200 free user limit but the owner of that account can barely use it for his current business.

The reason behind this is that having a Google Apps legacy account with 200 or more free users means it is a really old Google Apps free account which Google later renamed as Google Apps legacy account and removed many cool features from those legacy accounts, like Migration, adding Secondary Domain etc. to encourage users to opt for their paid plan i.e. $5/user/month.

How To Change Primary Domain for Google Apps Legacy Account

Now Google officially stopped allowing the secondary domain addition for Google Apps legacy accounts back in 2012 and legacy users are only been allowed to add domain alias instead of a complete secondary domain name. But till 28th August 2015 I was able to add secondary domain to Google Apps legacy accounts by doing a simple and popular upgradation trick as follows:

  • Click on upgrade to trial of Google Apps for Business
  • Go to Domains section, add & verify your domain name
  • Downgrade back to your legacy free account before you run out of your trial period

But now, IT’S NO MORE POSSIBLE. That’s right. I’ve tried to do the same thing a few weeks back in September and now you cannot downgrade back to your legacy account unless you remove your secondary domain name that you have added after the upgradation.

I know that the only reason people was able to perform the trick for all this time is because there was a minor loophole/bug which was present in Google Apps down-gradation service and never actually gets fixed by Google. But now it seems Google has fixed the loophole and those legacy free Google Apps account are completely out of work if you still don’t use the primary domain.

What about Domain Alias? What’s the difference?

Domain alias is nothing but a new name to the same email address. This is really important if you have same domain name with various TLDs. Let’s say you have a multinational company and you use Google Apps for your business needs. Now though www.example.com might be your primary company domain but for different countries you may also have the following domain names:

Now obviously you do not want to create separate email id for same person with different domain TLDs, right? Because it will be impossible for that person to manage all those email account. This is where Domain Alias kicks in. If you have an employee email as jhon@example.com and if you add all your different country domains as Domain Alias, even if someone email to jhon@example.in it will be delivered to jhon@example.com automatically but the address will still show the .in domain name. Cool right? I know, this is the actual implementation of domain alias. So, in short domain alias won’t give you a new email address.

So, what’s the way then?

Well, Google has covered all of its loopholes (thanks to the internet for sharing them publicly) and made sure that you cannot access your Google Apps legacy account lifelong by keep adding new secondary domain, unless you have access to Google Apps for Education or Google Apps for Non-Profit or Google Apps for Government. For these three Google Apps category the general legacy rule doesn’t apply. That’s right.

So, I guess now you have only 2 ways either you get and of those above three mentioned accounts (which is really hard to get, really hard) or you pay $5/user/month to Google if you are happy with 25GB Google Storage and if you want unlimited, well pay $10/user/month. That’s the end of the story.

There is no way you can add new secondary domain to Google Apps legacy account anymore. The most shocking thing is Google has release this patch so quietly that almost no one have noticed this change unless they tried to do it on their account. Google just added a new link to their “Downgrade to legacy Free edition” help article. See the screenshot below for more.

IBM launches Power10 processor

IBM today revealed the next generation of  POWER CPU  –  the POWER10 (pictured).

It expects an improvement of up to 3x greater processor energy efficiency, workload capacity, and container density than the POWER9.

Designed over five years with hundreds of new and pending patents, it is expected to be available in the second half of 2021.

Some of the new processor innovations include:

Support for Multi-Petabyte Memory Clusters< with a new technology called Memory Inception, designed to improve cloud capacity and economics for memory-intensive workloads from ISVs like SAP, the SAS Institute, and others as well as large-model AI inference.

New Hardware-Enabled Security Capabilities including transparent memory encryption designed to support end-to-end security. The IBM POWER10 processor is engineered to achieve significantly faster encryption performance with quadruple the number of AES encryption engines per core compared to IBM POWER9 for today’s most demanding standards and anticipated future cryptographic standards like quantum-safe cryptography and fully homomorphic encryption. It also brings new enhancements to container security.

New Processor Core Architectures with an embedded Matrix Math Accelerator which is extrapolated to provide 10x, 15x and 20x faster AI inference for FP32, BFloat16 and INT8 calculations per socket respectively than the IBM POWER9 processor to infuse AI into business applications and drive greater insights.

“Enterprise-grade hybrid clouds require a robust on-premises and off-site architecture inclusive of hardware and co-optimized software,” said Stephen Leonard, GM of IBM Cognitive Systems. “With IBM POWER10 we’ve designed the premier processor for enterprise hybrid cloud, delivering the performance and security that clients expect from IBM. With our stated goal of making Red Hat OpenShift the default choice for hybrid cloud, IBM POWER10 brings hardware-based capacity and security enhancements for containers to the IT infrastructure level.”

POWER10-based systems can to support up to 3x increases in users, workloads and OpenShift container density for hybrid cloud workloads as compared to POWER9-based systems.

This can affect multiple datacentre attributes to drive greater efficiency and reduce costs, such as space and energy use, while also allowing hybrid cloud users to achieve more work in a smaller footprint.

Further, to address new security considerations associated with the higher density of containers, POWER10 is designed to deliver new hardware-enforced container protection and isolation capabilities co-developed with the POWER10 firmware. If a container were to be compromised, the POWER10 processor is designed to be able to prevent other containers in the same Virtual Machine (VM) from being affected by the same intrusion.

Cyberattacks are continuing to evolve, and newly discovered vulnerabilities can cause disruptions as organizations wait for fixes. To better enable clients to proactively defend against certain new application vulnerabilities in real-time, POWER10 is designed to give users dynamic execution register control, meaning users could design applications that are more resistant to attacks with minimal performance loss.

The POWER family has long been a leader in supporting a wide range of flexible deployments for hybrid cloud and on-premises workloads through a combination of hardware and software capabilities. The POWER10 processor is designed to elevate this with the ability to pool or cluster physical memory across POWER10-based systems, once available, in a variety of configurations. In a breakthrough new technology called Memory Inception, the POWER10 processor is designed to allow any of the POWER10 processor-based systems in a cluster to access and share each other’s memory, creating multi-Petabyte sized memory clusters.

For both cloud users and providers, Memory Inception offers the potential to drive cost and energy savings, as cloud providers can offer more capability using fewer servers, while cloud users can lease fewer resources to meet their IT needs.

As AI continues to be more and more embedded into business applications in transactional and analytical workflows, AI inferencing is becoming central to enterprise applications. The POWER10 processor is designed to enhance in-core AI inferencing capability without requiring additional specialized hardware.

With an embedded Matrix Math Accelerator, the POWER10 processor is expected to achieve 10x, 15x, and 20x faster AI inference for FP32, BFloat16 and INT8 calculations respectively to improve performance for enterprise AI inference workloads as compared to POWER9, helping enterprises take the AI models they trained and put them to work in the field. With IBM’s broad portfolio of AI software, IBM POWER10 is expected to help infuse AI workloads into typical enterprise applications to glean more impactful insights from data.

With hardware co-optimized for Red Hat OpenShift, IBM POWER10-based servers will deliver the future of the hybrid cloud when they become available in the second half of 2021. Samsung Electronics will manufacture the POWER10 processor, combining Samsung’s industry-leading semiconductor manufacturing technology with IBM’s CPU designs
source:electronicsweekly