Social Items

Showing posts with label QA. Show all posts
Showing posts with label QA. Show all posts


Clear Memory in Python

  1. 1. Clear Memory in Python Using the gc.collect() Method
  2. 2. Clear Memory in Python Using the del Statement

This tutorial will look into the methods to free or clear memory in Python during the program execution. When a program has to deal with large files, process a large amount of data, or keep the data in the memory. In these types of scenarios, the program can often run out of memory.

To prevent the program from running out of memory, we have to free or clear the memory by clearing the variable or data, which is no more needed in the program. We can clear the memory in Python using the following methods.

Clear Memory in Python Using the gc.collect() Method

The gc.collect(generation=2) method is used to clear or release the unreferenced memory in Python. The unreferenced memory is the memory that is inaccessible and can not be used. The optional argument generation is an integer whose value ranges from 0 to 2. It specifies the generation of the objects to collect using the gc.collect() method.

In Python, the short-lived objects are stored in generation 0 and objects with a longer lifetime are stored in generation 1 or 2. The list maintained by the garbage collector is cleared whenever the gc.collect() with default generation value equal to 2 is called.

The gc.collect() method can help decrease memory usage and clear the unreferenced memory during the program execution. It can prevent the program from running out of memory and crashing by clearing the memory’s inaccessible data.

Clear Memory in Python Using the del Statement

Along with the gc.collect() method, the del statement can be quite useful to clear memory during Python’s program execution. The del statement is used to delete the variable in Python. We can first delete the variable like some large list, or array, etc., about which we are sure that are no more required by the program.

The below example code demonstrates how to use the del statement to delete the variable.

import numpy as np

a= np.array([1,2,3])
del a

Suppose we try to use or access the variable after deleting it. In that case, the program will return the NameError exception as the variable we are trying to access no more exists in the variable namespace.

Example code:

import numpy as np

a= np.array([1,2,3])
del a


NameError: name 'a' is not defined

The del statement removes the variable from the namespace, but it does not necessarily clear it from memory. Therefore, after deleting the variable using the del statement, we can use the gc.collect() method to clear the variable from memory.

The below example code demonstrates how to use the del statement with the gc.collect() method to clear the memory in Python.

import numpy as np
import gc

a = np.array([1,2,3])
del a

Diagnosing and Fixing Memory Leaks in Python

I'M using Browser Sync with webpack-dev-server, And facing the issue while using browser sync..!! only form fill up is working, click, scroll is not working in browser sync, and there is no any compile time error occurring, But above things are not working..!! Here is my "Webpack.dev.js" file, So what is wrong over here..?

const helpers = require('./helpers');
const buildUtils = require('./build-utils');
const webpackMerge = require('webpack-merge'); 
const commonConfig = require('./webpack.common.js');

const LoaderOptionsPlugin = require('webpack/lib/LoaderOptionsPlugin');
const NamedModulesPlugin = require('webpack/lib/NamedModulesPlugin');
const EvalSourceMapDevToolPlugin = require('webpack/lib/EvalSourceMapDevToolPlugin');
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');

module.exports = function (options) {
  const ENV = process.env.ENV = process.env.NODE_ENV = 'development';
  const HOST = process.env.HOST || 'localhost';
  const PORT = process.env.PORT || 3000;

  const METADATA = Object.assign({}, buildUtils.DEFAULT_METADATA, {
    host: HOST,
    port: PORT,
    ENV: ENV,
    HMR: helpers.hasProcessFlag('hot'),
    PUBLIC: process.env.PUBLIC_DEV || HOST + ':' + PORT

  return webpackMerge(commonConfig({ env: ENV, metadata: METADATA  }), {

    output: {

      path: helpers.root('dist'),

      filename: '[name].bundle.js',

      sourceMapFilename: '[file].map',

      chunkFilename: '[id].chunk.js',

      library: 'ac_[name]',
      libraryTarget: 'var',

    module: {

      rules: [

          test: /\.css$/,
          use: ['style-loader', 'css-loader'],
          include: [helpers.root('src', 'styles')]

          test: /\.scss$/,
          use: ['style-loader', 'css-loader', 'sass-loader'],
          include: [helpers.root('src', 'styles')]



    plugins: [
      new EvalSourceMapDevToolPlugin({
        moduleFilenameTemplate: '[resource-path]',
        sourceRoot: 'webpack:///'

      new NamedModulesPlugin(),

      new LoaderOptionsPlugin({
        debug: true,
        options: { }

      new BrowserSyncPlugin({
        // browse to http://localhost:3000/ during development,
        host: 'localhost',
        port: 4000,
        proxy: 'http://localhost:3000'
        reload: false

    devServer: {
      port: METADATA.port,
      host: METADATA.host,
      hot: METADATA.HMR,
      public: METADATA.PUBLIC,
      historyApiFallback: true,
      watchOptions: {

        ignored: /node_modules/

      setup: function(app) {
        // For example, to define custom handlers for some paths:
        // app.get('/some/path', function(req, res) {
        //   res.json({ custom: 'response' });
        // });

    node: {
      global: true,
      crypto: 'empty',
      process: true,
      module: false,
      clearImmediate: false,
      setImmediate: false,
      fs: 'empty'



I had the exact same issue because I was defining 'io' twice. Double check where you are defining io in your code and ensure you are not defining the variable io twice.

Example of what I was doing wrong:

var server = require('http').createServer(app);
var io = require('socket.io')(server);

var io = require('socket.io').listen(server.listen(config.port, config.ip, function () {
    console.log('Express server listening on %d, in %s mode', config.port,     

Example of what fixed the issue:

var server = require('http').createServer(app);
var io = require('socket.io')(server);

server.listen(config.port, config.ip, function () {
    console.log('Express server listening on %d, in %s mode', config.port, 

WebSocket connection to 'ws://localhost:4000/sockjs-node/612/2pdjfv15/websocket' failed: Connection closed before receiving a handshake response error


Phones users in Delhi-NCR who lose their handsets will now have some respite, with the government launching a portal that will enable blocking and tracing of stolen or lost mobile phones. The initiative was launched in Mumbai in September this year and has been rolled out for Delhi-NCR now. It will be extended to other parts of the country in 2020.

The launch of the portal, www.ceir.gov.in, for Delhi-NCR subscribers will facilitate requests for blocking of stolen or lost mobile phones by customers, blocking of such mobile phones across various mobile networks, allowing services to other existing customers having mobile phones with the same International Mobile Equipment Identity (IMEI) number, sharing of traceability data with police authorities, as well as unblocking of recovered phones.

The project is backed by the Central Equipment Identity Register (CEIR) system, which was undertaken by the telecom department for addressing security, theft and other concerns including reprogramming of mobile handsets.

Launching the initiative, Telecom Minister
- Ravi Shankar Prasad

said safety and security of phones are crucial given the country's technological strides and digital prowess.

"While we make optimum use of technology for development, there are equally smart criminals who abuse technology for their own ends," Prasad said. "

The latest initiative is expected to benefit 5 crore mobile subscribers in Delhi and adjoining areas.
"Delhi telecom subscribers whose phones get stolen or those who lose their phones can log into the web portal from today... they can go to the portal and register their complaint, along with which they will also have to upload the police complaint and their own ID proof. Based on this, the lost mobile will be blocked. Also if someone uses it, the same can be traced based on the tower signals so the police can also recover the device," Telecom Secretary Anshu Prakash told reporters. "

Explaining this further, Prakash said the International Mobile Equipment Identity (IMEI) is the unique identity of mobile phone devices.
IMEI number is programmable and miscreants and criminals reprogramme the 15-digit unique number, which results in the cloning of IMEI. The result is multiple phone devices, at times even hundreds of numbers, with the same IMEI number.

If such IMEI is blocked, a large number of mobile phones stand the risk of being blocked (as they are handsets with the same IMEI number) causing inconvenience to genuine customers. The software that has been developed now allows an individual phone to be blocked even if it is on a cloned IMEI number.

Moreover, because of the centralized nature of the register or database, all the operators can block the particular stolen or lost device across the country even though the phone is being serviced by one particular operator.
"This will also reduce the market for stolen phones," Prakash added.

Asked about the progress of the initiative in Mumbai, where it had been announced a few months back, Prakash said as many as 500-600 complaints were logged in Mumbai. "In 50 percent of the cases in Mumbai, traceability information has been handed over to the police. Also remember, much depends on whether the phone is being used after it has been stolen... If someone does not use it, it cannot be traced, but it can certainly be blocked. They won't be able to sell it," he said.

Website to find stolen, lost phones launched


Michael Albert Focia is a 50-year-old from Montgomery, Alabama. He’s sitting in prison for selling firearms without a license and shipping them illegally. Focia used the dark web to sell firearms to people in other states and countries.

Michael Andrew Ryan, a.k.a. “Gunrunner,” was a 35-year old man from Manhattan, Kansas. Ryan was busted for illegally exporting semi-automatic rifles and handguns to Scotland, Ireland, England and Australia. Ryan removed the serial numbers to make them harder to trace.

Both Focia and Ryan were using a website called “Black Market Reloaded.”

GAO and ATF Stings

When you think of the Government Accountability Office (GAO), it conjures up images of budgets, reports, and bean counters. It turns out, though, that some of its investigations involve undercover work and guns.

At the direction of Congress and working with the Bureau of Alcohol, Tobacco, and Firearms (ATF), the GAO set out to gather information on purchasing firearms on the internet. “The relative anonymity of the Internet makes it an ideal means for prohibited individuals to obtain illegal firearms,” according to the ATF. “The more anonymity employed by a firearms purchaser, the greater the likelihood that the transaction violates federal law.”

The GAO report shows undercover agents were able to buy a fully automatic Uzi submachine gun anonymously without any kind of background check on the dark web. They also bought an AR-15 semi-automatic weapon.

The agents, however, had to work hard at the sting operation. Only two of the 74 attempted transactions were concluded.

72 Attempts To Buy Firearms Were Denied By Sellers

In most of the cases, the potential seller refused to complete the sale. Upon hearing from the undercover agent that they were not legally allowed to own the gun, another third of sellers wouldn’t sell. The agents themselves got scammed by others that took the money and never delivered.

Firearms Can Be Bought For Lower Prices

Public policy organization RAND Europe, a non-profit division of the RAND Corporation, looked at the seedy side of the internet to examine black market arms transactions. The report reveals the overwhelming majority of weapons sold on dark web marketplaces originated in the United States. The study showed that “better performing, more recent firearms (are available) for the same, or lower price than would be available on the street or the black market.”

2017 Study Of Organized Crime

The National Crime Agency in The United Kingdom also acknowledges concerns over firearm sales on the dark web.

The agency points towards the use of virtual or crypto-currencies like Bitcoin as a way to conduct transactions anonymously and without using conventional financial methods.

Firearms Sales Represent A Small Portion Of Dark Web Sales

Weapons represent just a small portion of transactions on the dark web, according to Nicolas Christin, a researcher at Carnegie Mellon University. He called the use of the dark web for firearms sales as negligible, especially compared to the number of illegal drugs being bought and sold. Christin estimates firearms sales account for less than 3% of sales.

Still, there is a consistent call from lawmakers in the U.S. in other countries to crack down on illegal firearms sales online.

Thanks & Cheers 

How Easy Is It to Buy Guns on the Dark Web?


60% of the Information for Sale on the Dark Web Can Damage a Business  

Most IT professionals automatically figure Dark Web threats like stolen password files or different kinds of ransomware into their calculations when they’re planning cybersecurity strategies. However, there are many types of information that can hurt businesses that can be easily obtained on the Dark Web including:  

  • Payment Card Information – Stolen or skimmed credit card data (and the software to capture it) is a perennial bestseller.  
  • Research Data – Medical research including information about new drugs and therapies is a hot commodity, especially COVID-19 data. 
  • Trade Secrets & Formulas – Proprietary manufacturing information is both popular and easy to sell. 
  • Blueprints & Security Plans– From buildings to networks, all kinds of schematics and planning data is useful for bad actors. 
  • Medical Records – They’re especially popular for blackmail and spearfishing ammunition. 
  • Financial Records – This multipurpose data is desirable for money laundering, blackmail, spearfishing, and identity theft. 
  • Intelligence Reports – International espionage is a big market that’s high-danger but high-reward. 
  • Government Secrets – Investigations, communication, programs, budgets, documents, and more sell fast. 

As a Service” Offerings Are the New “It” Category 

Why just sell your password when you can keep making money by selling your services? “As a Service” transactions on the Dark Web are proliferating, and that creates big dangers for every company. Malicious insiders with access to specialized data, systems, or institutions can make a fortune by selling their services to facilitate other cybercrimes. 

Insider threats also include things like embezzlement, records tampering, money laundering, crypto mining, deploying malware, stock trading, espionage, and more dastardly deeds. These workers are generally looking for profit instead of revenge, but sometimes that’s a factor – and they’ll keep doing it until they’re caught.   

Dark Web markets aren’t just focused on selling data, passwords, and hacking services. There’s also a booming trade in dangerous, illegal, and disgusting commodities that can’t be sold publicly like weapons, narcotics, stolen goods, looted antiquities, illegal commodities, endangered animals, slave labor, and child pornography – plus harmless yet strange things that you wouldn’t expect.  

Thanks & Cheers

You May Be Surprised By What Really Sells in Dark Web Markets in 2020


  • Buying a phone from customs is like getting only a box because there is no guarantee of getting it.
  • If you are lucky enough then you have chances that the product is yours.
  • If you get any technical issues after use then you can't go to the company and claim a guarantee or warranty on the product.
  • Even if the product is out of warranty, then also you can't just take your product to the company for repair as it is not a registered product for sale.
  • So you need to get your product repaired in some local repair shops.
  • If you buy a product from customs then you will not get a genuine copy of the invoice.
  • Without invoice/ bill you are not the genuine/ original buyer.
  • You also need to pay customs duty/ taxes on phones buying from customs.

Is buying phones from customs illegal? If I buy one, is there any chance that I will be tracked?


Here are a handful of strategies to help you get more eyes on your job posts by driving traffic to job postings:

  1. Include Keywords – Think like a job seeker. What are they going to search for to find your job? These are the words you need to include in your job description.
  2. Add Video – Video is an engaging, visual medium. Short videos about the job, the company, or the employees are a good way to capture a job seeker’s attention.
  3. Post and Share Regularly – The more opportunities that people have to see your job listings the better. Try to post them at different times on different days and through different mediums to cater to the largest audience possible.
  4. Use Niche Job Boards – Take advantage of cool job boards, Spending a bit of money can really increase the number of people who see your job ad.
  5. Implement SEO Strategies – SEO, or Search Engine Optimization, is a smart way to drive traffic. SEO is how search engines find and rank your site. This would include using the right keywords, headings, meta descriptions, URLs, etc.
  6. Tap Into Your Email Subscribers – People who subscribe to your email list want to know what’s going on with your company. Notify them of job openings in your latest newsletter.
  7. Use Proper Job Titles – Everyone wants a creative job title like “Digital Ninja” or “Outdoor Wizard,” but what do these jobs do? While they may be fun, they are not job titles that any job seeker is going to search for. Stick to traditional job titles to attract more traffic.
  8. Utilize Social Media Social media is the ideal way to share your job postings with a loyal and engaged audience. Build your social following and then add job openings to your posting schedule at regular intervals.
  9. Make Your Job Postings Shareable – People love to share things online. Make your job postings shareable so that if a candidate stumbles upon the perfect job opening for their friend, it’s easy to send the info their way.
Thanks & Cheers

How do I drive traffic to my job board?