Monday, April 13, 2020

Participates in This Google's Coding Contest to Get Internships in Google

April 13, 2020
If you have same dream like million of people alredy have to work in Google, 'CodeJam' will help you to make your dream come true.

This dreams going to be completed soon by participating in CodeJam, CodeJam will help you to convert your immagination or dream into reality, 

 This coding contest is hosted by google and this will help you to get internships in Google.

This coding contest will help you to polish your coding skills & make your programming mind pro active,


Thursday, May 16, 2019

Python List is more than just a List

May 16, 2019
Python is the most popular programming language today, We can understand the growth of Python by it's continuously growing ratio of it's related fields like Data Science, Python Developer, Deep Learning Researcher and many more fields which are related to Python.
So for Now, if you want to engage your career with these technologies, It the first prerequisite that you should know little bit about Python.

So lets talk about today's topic that is Python List. So if you don't know anything about Python List then I will recommend you to check the first tutorial on list
So for Now, I am going to tell you a little bit more about Python List.

Python List is more than just a List :

Python 's List can make your Data Structure easy to implement, So let's try to take a deep dip inside this Python List, when we use a Python data structure that holds many Python objects, It can holds as many object, that's by it's called list, We can create a list of integers as follows.

In[1]: L = list(range(10))
L
Out[1]: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
In[2]: type(L[0])
Out[2]: int

Or, similarly, a list of strings: Which helps you to build a strong basic concept of Python List.

In[3]: L2 = [str(c) for c in L]
L2
Out[3]: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
In[4]: type(L2[0])
Out[4]: str

Because of the Python’s dynamic typing, we can even create Heterogeneous Lists also. Let's see the example of Heterogeneous List.

In[5]: L3 = [True, "2", 3.0, 4]
[type(item) for item in L3]
Out[5]: [bool, str, float, int]


But this flexibility comes at a cost to allow these flexible types, each item in the list must contain its own type info, reference count, and other information—that is, each item is a complete Python object.

Again, the advantage of the list is flexibility: 
because each list element is a full structure containing both data and type information, the list can be filled with data of any desired type.

The difference between a dynamic-type list and a fixed-type (NumPy-style) array is illustrated in the given image below.
Creating an Array's from Python List :
           
             First, we can use np.array to create arrays from Python lists.                                         
In[1]: import numpy as np
In[2]: # integer array:
np.array([1, 4, 2, 5, 3])
Out[2]: array([1, 4, 2, 5, 3])

Remember that : 
Unlike Python lists, NumPy is constrained to arrays that all contain the same type. If types do not match, NumPy will upcast if possible (here, integers are upcast to floating point).

In[1]: np.array([3.14, 4, 2, 3])
Out[1]: array([ 3.14, 4. , 2. , 3. ])

We can also Set the data type of our resulting Array at the initialize time using dtype Keyword.

In[9]: np.array([1, 2, 3, 4], dtype='float32')
Out[9]: array([ 1., 2., 3., 4.], dtype=float32

Here is the  one way of initializing a multidimensional array using a list of lists :

In[7]: # nested lists result in multidimensional arrays
np.array([range(i, i + 3) for i in [2, 4, 6]])
Out[7]: array([[2, 3, 4],
[4, 5, 6],
[6, 7, 8]])

At Last Thanks for Reading...


Thursday, February 7, 2019

Some Useful Java Programs for Technical Interview Part 2

February 07, 2019
Q6 : Why string is immutable or final in java ?

Answer
Answer : 
String objects are cached in string pool and shared between multiple thread, So it will lead to risk of value changed by one thread will affect value of other thread.

Example :

// find "abc" in string pool or create new object.

String str = "abc";

//It is available in string pool, This will point the same value in String pool.

String str1 = "abc";

// find  "abcxyz" in string pool or create new object.

str = str + "xyz";

// Now str is pointing only "abcxyz" in string pool and str1 is pointing "abc".


Q7 : Difference between name.equals("Syntaxios") and "Syntaxios".equals(name) ?

Answer
Answer : 
name.equals("Syntaxios") = compare unknown value(that means 'name') with known value (that means 'Syntaxios') and "Syntaxios".equals(name) = compare known value (that is "Syntaxios") with the unknown value (that is 'name') and it is null safe, This is used to avoid java.lang.NullPointerException.

Q8 : How to convert string to char [] array and char [] array to string ?

Answer
Answer : 
String str = "Syntaxios";

char []CharArray = str.toCharArray();

String strfromCharArray = String.valueOf(CharArray);

String.toCharArray(); // string to char[]

String.valueOf(char[]Data); // char[] to string


Q9 : Can we write try without catch ?

Answer
Answer : 
Yes, we can write try without catch, But we must write finally.
try{
        }
finally{
             }

Q10 : What is finally Block ?

Answer
Answer : 
Finally Block used to close resources used in try. Finally Block will be executed even If exception occurs try block. Finally Block will be executed even you write return variable from try block. Finally block will not be executed when System.exit(exitcode) executed in try block.

Example : 

try{
      int a = 1/0; // finally will be execute
      return a;
      System.exit(0); // finally will not execute
}    
    finally{
                System.out.println("Finally Block");
}



Monday, January 14, 2019

Learn Python from Zero to Hero

January 14, 2019

This is the 6 part of Python tutorial series, Learn Python from Zero to Hero. If you want to learn Python from scratch you can check our previous tutorials on Python. If you want to read from starting click the given link below.

Learn Python from Zero to Hero Part 1.

Learn Python from Zero to Hero Part 2.

Learn Python from Zero to Hero Part 3.

Learn Python from Zero to Hero Part 4.

and the Last one Learn Python from Zero to Hero Part 5.



We all know Python is the rich programming language for data science, If have dream like many of others to become a data scientist in future or want to learn data science, Python is the best way to start with, Python have many libraries which makes Python most popular programming language for data science, Python's libraries makes data science easy to learn.

In this part we will learn What is list or tuples in Python ?, Python support four type of collections List, Tuples, Set and Dictionary, Now you are exited to know what are these collections ?, If you are exited it means you love programming like me. But if you are NOT exited than you are Lazy Person.


 Don't be sad i have a little bit Motivation for You. #Hahahaha.

I will always choose a lazy person to do a difficult job because a lazy person will find an easy way to do it.
Whenever there is a hard job to be done I assign it to a lazy man; he is sure to find an easy way of doing it.

                                                  Bill Gates.
So if you are exited to know what is List, Tuples, Set or Dictionary ?, than Stay with me and keep calm, We will learn all of them one by one, So let me start with List or Tuples in this post we will cover remains Set or Dictionary in next post.

So Let's Begin

List :

                      As I told you before list is a part of collections, This List is ordered or unchangeable in Python, This List is also allow the duplicate members, In Python List written around the square bracket, This list in Python is very important to understand.

If you do programming before than you already know about what is array ?, These array's are very important in programming. Because Python does not support data type than python have this List feature, This List works similar to array's.

Example :

list = [ 'Apple', 'Banana', 'Mango', 'Papaya', 'Orange' ]
print ( list )

List also contains list or tuple inside list and List able to contains all kind of data types in a single list, You can better understand it by the given example below.


list = [ 'Hello', 'First List', [ 'Hey', 'Second List' ], 3, 66.78, 'A',99.12, 'C' ]
print ( list )
list [4] = "Syntaxios"        # you can change list at any time, Because list is changeable.
print ( list )

Tuples :

                                Tuples are also the part of collections, Tuples are ordered or unchangeable, and Tuples also allow the duplicate member, Tuples should be written around the brackets that is rounded bracket.

Example

tuple = ( 'Apple', 'Banana', 'Mango' )
print ( tuple )

Tuple also contains the tuples or list inside the tuple, Let's understand tuple by the given example below.


tuple = ( 'Tuple', 56, 66.7, [ 'list', 7, 11.7 ], 'A', 75, ( 'Another', 'Tuple', 'G', 77 ), 'End' )
print ( tuple )
tuple [3] = " Integer 56 "       # you can not do this because tuples are Unchangeable.
print ( tuple )         # error

As you can see the given example of List and Tuples. The list and Tuple both are able to contains each others. List is Changeable or Tuples are Unchangeable in Python.


Saturday, January 5, 2019

How to Add Google Translator Button on Your Webpage ?

January 05, 2019
Sometimes we have some kind of articles or webpage in any other languages like Spanish , French, Greek, Urdu, Chinese etc. Its very hard to understand these languages if we are from any other country. At this time we need a translator to translate these languages into our mother tongue.

                   Suppose we are from India and we are trying to access some useful information that is very important for us and at that time we find that information in a website, But the problem is that this website is a french website in french language, So we are from India  we can not understand French So we have to translate this website into our mother tongue that is Hindi, We can do that using Google Translator.

So Let's See

How to Use Google Translator On Our Website ?

Basically you have to follow the basic Three Step's to  add a google translator on your webpage, Let's See these basic steps.

Step : 1 - Create a basic webpage and add a " div " element which we create later.

<div id="google_translator"> </div>

Step : 2 - In this step you have to add a google translator API.

<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

Step : 3 - In this last step we will add  a JavaScript function.

<script type="text/javascript">
       function googleTranslateElementInit(){
             new google.translate.TranslateElement({pageLanguage: 'en'},'google_translator');
}
</script>

If you face any kind of problem in above steps please check the Example code to find the error in your code.

Example Code
<!DOCTYPE html>
    <html>
         <body>
<h1>Welcome to Syntaxios, Spread the love among Programmers.</h1>

    <h3>Translate this Webpage in your preferred language.</h3>

         <div id="google_translator"> <div>

<script type="text/javascript">

       function googleTranslateElementInit(){
             new google.translate.TranslateElement({pageLanguage: 'en'},'google_translator');
}

</script>

<script type="text/javascriptsrc="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

<p>you can translate this content in your preferred language, Select your preferred language.</p>

    </body>
</html>

At Last Thanks for Reading...
If you have any doubt don't forget to leave comment in comment box.

Thursday, January 3, 2019

JavaScript's window.history object

January 03, 2019
Did you know something about JavaScript window.history object ? If don't Then you are on the right place to learn this window.history object.

                           As we all know JavaScript is most popular programming or scripting language among programmers, without JavaScript you can't develop a creative website, But if you want to develop such a creative website then you must have some basic knowledge about JavaScript like methods in JavaScript, keywords in JavaScript & JavaScript function, one of them i am gonna tell you in this post, So Let's See.

                                  Here in this post we talk about JavaScript's window.history object, This object will contain browser history and It also contains an array of URL's visited by the user, You can also count the length of the URL visited by the user using length property of window.history object. So Lets See.
                                           Every Website developer should have basic knowledge of JavaScript, Because without JavaScript you can't imagine validation in your website or without validations your website like a man without head, So if you don't wanna look like this so please use JavaScript for validation in your website.

window.history object's Methods :
window.history.go().
window.history.back().
window.history.forward().

Note :  You can also use only history object instead of window.history object It alone works fine, Because window part can be removed from window.history, If history object does't work alone then you should try window.history object. 
window.history.go() - :  This method will loads the given page number, The history.go(distance) function works as same as back and forward button and the one another thing is it also specify the exact page which you want to load.

<!DOCTYPE html>
     <html>
<body>
      <button onclick="goFunction()">Go To Selected Page</button>
            <script>
                       function goFunction(){
                                 window.history.go(3);
                              }
            </script>
      </body>
</html>

Note :  The window.history.go(3) will not works when next 3 page does not exist in history list, This go function works as same as you press forward button 3 times.
window.history.back() - : This method will loads the previous page as same as clicking on the back button of browser.

<!DOCTYPE html>
     <html>
<body>
      <button onclick="backFunction()">Go Back</button>
            <script>
                       function backFunction(){
                                 window.history.back();
                              }
            </script>
      </body>
</html>

Note :  This window.history.back() function will not work if previous page does not exist in the history list. When you click on the Go Back button this button will redirect you on the previous page.
window.history.forward() - : This history.forward method will loads the next page as same as forward button of browser.

<!DOCTYPE html>
     <html>
<body>
      <button onclick="forwardFunction()">Next Page</button>
            <script>
                       function forwardFunction(){
                                 window.history.forward();
                              }
            </script>
      </body>
</html>

Note :  This window.history.forward() function will not work, If the next page does not exist in the history list, When you click on the Next Page button this button will open a next page. Both function exactly work same as our browser's back and forward button works.

Friday, December 28, 2018

What is immutable String ?

December 28, 2018
Hello World,
                                          The word immutable can confuse you in Python, What does this immutable meaning in Python ?, It looks strange for you, Don't worry Never loose your SMILE, in this post i am gonna make it clear, We all know about strings, what is strings ? and where to use these strings ?, We are unaware of the word immutable, what exactly does it mean ?. So Let's Start.

What is Immutable String in Python ? :

                                                       The String is immutable which means that once created than it can not be changed, The object created as a String is stored in the constant String Pool.

Python VS Java's Immutable String :

                                                                         Every immutable object in java is thread safe, that implies string is also thread safe, Strings can not be used by two threads simultaneously string once assigned can not be changed.
                                      
                                                As the name immutable stands for unchangeable, The immutable meaning is, it is unchangeable it will create the same copy of variable, But no-one can update the same variable in Python, As we all know that We need this update concept in programming, sometimes we need to update our variables in our program,we simply update our variable like int a = 1, than a = 7, this kind of thing.

We can update our variables in Python too, Now the term string, As we talk about in this post what is immutable string ?, As now you know what is immutable string ?.

In Python we can not update our string variable, we can update integer, float etc. each type of variable in Python But not String we can not update string variables in Python, Because Strings are immutable in Python.

So Let's See the Example of immutable string in Python :

# Immutable String in Python.
                     name = "Syntaxios"
                           print(name)
                                  name[0] = "B"          # Here it gives error. Because strings are immutable in Python
                          print(name)

But what if you want to change something in the given string, You can do that using replace() method. Let's See the example of replace() method.

# replace() method example.
           print(name)
                  print(name.replace("S", "B"))

At Last Thanks for Reading, Share with others if think it is useful thing to know.