Posts

Placements: SQL Advance join (Hackerrank Problem)

Image
Problem: You are given three tables:  Students , Friends and Packages.   Students contains two columns: ID  and Name . Friends contains two columns: ID and Friend_ID ( ID of the ONLY best friend). Packages  contains two columns: ID and Salary (offered salary in $ thousands per month). Write a query to output the names of those students whose best friends got offered a higher salary than them. Names must be ordered by the salary amount offered to the best friends. It is guaranteed that no two students got same salary offer. Solution: select temp1.sn from (select S.ID si,S.Name sn,P.Salary ps from Students S join Packages P on S.ID=P.ID) temp1 join (select FF.ID fi,FF.Friend_ID fd,PP.Salary pps from Friends FF join Packages PP on FF.Friend_ID=pp.ID) temp2 on temp1.si=temp2.fi and temp1.ps<temp2.pps order by temp2.pps asc ; Explanation: As the problem states that we have to select the name of the friend whose salary is lesser than what his/her friend is ha

Contest Leaderboard: hackerrank problem (Level medium)

Problem Statement: You did such a great job helping Julia with her last coding contest challenge that she wants you to work on this one, too! The total score of a hacker is the sum of their maximum scores for all of the challenges. Write a query to print the hacker_id , name , and total score of the hackers ordered by the descending score. If more than one hacker achieved the same total score, then sort the result by ascending hacker_id . Exclude all hackers with a total score of from your result. Tables: Hackers: The hacker_id is the id of the hacker, and name is the name of the hacker.  Submissions: The submission_id is the id of the submission, hacker_id is the id of the hacker who made the submission, challenge_id is the id of the challenge for which the submission belongs to, and score is the score of the submission.   Solutions: select h.hacker_id,h.name,sum(sscore) from Hackers h inner join (select s.hacker_id,max(score) as sscore from Submissions s g

changing purple background on ubuntu 18.04 and fixing issues

Image
This is the default purple background while login on my ubuntu 18.04...                                    Default ubunut 18.04 login background This blog is going to show you how to change the purple login screen background on your ubuntu 18.04. After getting into lots of trouble and almost breaking my OS i was able to change it to something spidery which you can see in the video below. Links for the wallpapers that i've used are given at the end of this blog, you can download them if you want the same feel as shown in the video or be ready with your own png format images that you wanna see behind login screen. NOTE: sorry for the folks who won't be able to play the clip in their firefox browser..i suggest to use google chrome for that. if you're on windows, firefox uses the Media Foundation to decode MP4 videos and you may not be getting update for Media foundation.. while the Ubuntu user facing issues in firefox playing videos from the blog, can run the following

Bypassing Gmail Virus Scanner ::"VIRUS DETECTED", error message

Now most of the time when you are going to share the files over mail to your friend or someone. you face the issue that gmail can't attach the file with mail because it may contain virus or spam or something...you will be given the option for sending the mail without attachment. why basically it happens because google has automated its own email checking bot type virus scanner, which scans for the threats in the files that you are sending and if it finds any malicious content that can harm the users system environment it will block it from sending. in order send your mail without getting it detected by gmail Virus scanner. what to do bypass scanner is just follow the steps..  1. Open the file in winzip or gzip file compressor.  2. Compress it with the password. (even with the password one time compressed file can be detected by gmail scanner..)  3. Take the compressed file and compress it again. (just to be sure...)  4. now attach the double compressed file in attachmen

Connecting WIFI from terminal or Recovery on Debian system

Connecting to the wifi:- Here in this post we are going to talk about how one can connect their system to the wireless network available in their vicinity. To do so, start the network manager that will cofigure the /etc/resolv.conf file for dns, Most of the people face the issue of can not find resolv.conf or can not resolve the host about which we are going to talk in the post later. provided, follow the steps to connect to wifi and PING google.com just to be sure that your packets are getting transmitted and being recieved at the other side. write the following commands at the terminal in the sequence... STEPS:-   term@terminal:~$ sudo ifconfig -a        //this will give you all the NIC           //available for your pc. lets say your wireless adapter is 'wlp0' term@terminal:~$ sudo ifconfig wlp0 up //setting the adapter to up and listening term@terminal:~$ sudo iwlist wlp0 scanning //this will give you the list of the available wifi networks select the one your want

Upgrading to Ubuntu 18.04 (Bionic Beaver)

Image
Note: To upgrade your os to Bionic Beaver(18.04) you must have prior version of ubuntu 17.10 or the last long time support(LTS) version 16.04 . error "Target configured multiple times" fixed. scroll down to see the solution. UBUNTU 18.04 Bionic Beaver         To upgrade to the latest version you must have the root privileges or you can use sudo command with the administrator password. For ubuntu 18.04 LTS the support will be provided till  2023 . steps to upgrade to 18.04:-   $sudo apt update $sudo apt upgrade  Now that you are upgraded to 18.04 you should remove the duplicate packages using following command:   -$sudo apt dist-upgrade   dist-upgrade in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages; apt-get has a "smart" conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if n

Passing Data from Fragment to Activity

For passing the data from the fragment to the activity we can define "interface" in the fragment class which should be implemented it the activity class in which you want to transfer the data. for this, here is an small example which will show you how to pass the data the to the activity class. interface is the collection of abstract methods that are implemented by the class. A class that implements an interface must implement all of the non-default methods described in the interface , or be an abstract class. inside myfragment.java class:  //define the interface as shown below and call it in the fragment wher you want // to pass the data to the activity..in this case for example we will be passing //sample strings. public interface myInterface{  public void addData(ArrayList<String> lst) ; //here we can pass the data using Bundle also.  } inside myActivity.java class: //Activity in which you are recieving your data must look like the