Check If Binary Representations of Two Numbers Are Anagram in Java

karthikeya Boyini
Updated on 30-Jul-2019 22:30:24

181 Views

The binary representations of two numbers are anagrams if they have the same number of 0’a and 1’s. An example of this is given as follows −Number 1 = 3 Binary representation of Number 1 = 0011 Number 2 = 12 Binary representation of Number 2 = 1100The two numbers are anagram.A program that demonstrates this is given as follows −Example Live Demopublic class Example { public static void main (String[] args) { long x = 12, y = 3; if(Long.bitCount(x) == Long.bitCount(y)) ... Read More

Python Low-Level Threading API

Ankith Reddy
Updated on 30-Jul-2019 22:30:24

669 Views

The '_thread' module in Python library provides a low-level interface for working with light-weight processes having multiple threads sharing a global data space. For synchronization, simple locks (also called mutexes or binary semaphores) are defined in this module. The 'threading' built-in module provides a higher-level threading API built on top of this module.start_new_thread()This module-level function is used to open a new thread in the current process. The function takes a function object as an argument. This function gets invoked on successful creation of the new thread. The span of this function corresponds to the lifespan of the thread. The thread ... Read More

Run Swift in Background to Provide Current Location

Samual Sam
Updated on 30-Jul-2019 22:30:24

734 Views

To get background location in swift we need to go through a few stepsGet the permissions from the user, in your info.plist file add Privacy- Location always andwhen in usage Description, Privacy – When in usage description and add their respective description.After that, you need to import the CoreLocation framework which will enable you to use all the location related libraries and methods. Then you need to get permission from the user to use the location. For that, we need to create a CLLocationManager Object and get authorization.var locationManager: CLLocationManager? override func viewDidLoad() { super.viewDidLoad() ... Read More

Using TYPE=InnoDB in MySQL Throws an Exception

Arjun Thakur
Updated on 30-Jul-2019 22:30:24

440 Views

You can use ENGINE = InnoDB in place of TYPE = InnoDB, since the usage of TYPE became obsolete in MySQL version 5.1.The version we are using for our example is MySQL version 8.0.12. Let us check the MySQL version. The query is as follows −mysql> select version();The following is the output −+-----------+ | version() | +-----------+ | 8.0.12    | +-----------+ 1 row in set (0.00 sec)Here is the example of TYPE = InnoDB. Error is visible in MySQL 8 −mysql> create table Product_Information    -> (    -> ProductId int,    -> ProductName varchar(10),    -> ProductDeliveryDate datetime ... Read More

Trace or Track Python Statement Execution

George John
Updated on 30-Jul-2019 22:30:24

5K+ Views

Function in the 'trace' module in Python library generates trace of program execution, and annotated statement coverage. It also has functions to list functions called during run by generating caller relationships.Following two Python scripts are used as an example to demonstrate features of trace module.#myfunctions.py import math def area(x): a = math.pi*math.pow(x, 2) return a def factorial(x): if x==1: return 1 else: return x*factorial(x-1)#mymain.py import myfunctions def main(): x = 5 print ('area=', myfunctions.area(x)) ... Read More

Best Websites a Developer Should Visit

Madhuparna
Updated on 30-Jul-2019 22:30:24

151 Views

Following are the best websites for a developer:RedditTutorialspoint.comTechCrunchTwitter MomentsCNetTwitter MomentsRedditDotNet KicksFeedlyHighScalability.comHacker News

Find MySQL Data Directory from Command Line in Windows

Ankith Reddy
Updated on 30-Jul-2019 22:30:24

3K+ Views

To find the MySQL data directory, we can simply use the variable datadir. Let us see how to use the variable with select statement.The query is as follows −mysql> select @@datadir;Here is the output+---------------------------------------------+ | @@datadir | +---------------------------------------------+ | C:\ProgramData\MySQL\MySQL Server 8.0\Data\ | +---------------------------------------------+ 1 row in set (0.00 sec)Now we can reach the directory from the above sample output.Here is the snapshot that displays the MySQL data directory.

Set Similar Value for a Column in MySQL Table

Anvi Jain
Updated on 30-Jul-2019 22:30:24

95 Views

You can set value for a column of all records with the help of update command.The syntax is as follows if you want set NULL value for all the records in a column −update yourTableName set yourColumnName = NULL;Or if you want to use empty string, the following is the syntax −update yourTableName set yourColumnName = ’’;To understand the above concept, let us create a table. The query to create a table.mysql> create table StudentDemo    −> (    −> Studentid int,    −> StudentName varchar(100),    −> Age int    −> ); Query OK, 0 rows affected (0.64 sec)The ... Read More

Byte Compile Python Libraries

Chandu yadav
Updated on 30-Jul-2019 22:30:24

914 Views

Python is an interpreter based language. However it internally compiles the source code to byte code when a script (.py extension) is run and afterwards the bytecode version is automatically removed. When a module (apart from the precompiled built-in modules) is first imported, its compiled version is also automatically built but saved with .pyc extension in __pycache__ folder. Subsequent calls to import same module again won't recompile the module instead uses the one already built.However, a Python script file with .py extension can be compiled expilicitly without running it. The 'py_compile' module contains 'compile()' function for that purpose. Name of ... Read More

How Sony Became a Leader in the Tech Industry

Knowledge base
Updated on 30-Jul-2019 22:30:24

642 Views

Sony Corporation is one of Japan's biggest multinational corporations, headquartered in Minato, Tokyo of Japan. It was founded by Akio Morita and Masaru Ibuka on 7th May 1946. It was during the wake of the World War-II. Sony’s first branded product was TR-55 Transistor radio that was launched in 1955, whereas Sony was made to be its official name since January 1958.It was Not-So-EasyEarlier, vacuum tubes were used, whereas, after the invention of transistors, the circuits became shorter and eventually the size of the equipment used got reduced. When TR-55 Transistor radio was launched which was made using a transistor, ... Read More

Advertisements