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

Wednesday, November 9, 2016

Take a better selfie with Lily

Selfie sticks were the must have Xmas gift last year and now a team out of the UC Berkeley robotics lab, who built the first prototype using a Raspberry Pi and an Arduino, have developed the Lily camera drone. Watch the video below to see how it works but basically it flies itself and can take video or stills of its owner. Its on my Christmas list.



from The Universal Machine http://universal-machine.blogspot.com/

IFTTT

Put the internet to work for you.

Delete or edit this Recipe

Read More..

Sunday, November 6, 2016

Calculating Ada The Countess of Computing

With Ada Lovelace Day fast approaching (Oct 13) the BBC has released a timely documentary all about her called "Calculating Ada: The Countess of Computing". This is the first documentary Ive seen dedicated to Ada Lovelace and I learnt a lot. For instance I didnt know that she lost a fortune gambling on horse racing. She believed she could calculate the odds better than the bookmakers - she was wrong. The doco is available on YouTube, though I expect it will be taken down soon; otherwise it can be viewed on the BBc iPlayer.


from The Universal Machine http://universal-machine.blogspot.com/

IFTTT

Put the internet to work for you.

Turn off or edit this Recipe

Read More..

Friday, October 28, 2016

Syrias children learn to code with the Raspberry Pi

Three years ago, when I was looking for an example of social unrest to highlight the use of social media as a communication tool for protestors in my book, I chose the then new uprising in Syria. Im horrified the conflict still continues. However, I just came across a surprisingly good piece of news from that awful conflict; the use of the Raspberry Pi to teach Syrian refugees in Lebanon to code. Read the full article in the Guardian to learn more.

from The Universal Machine http://universal-machine.blogspot.com/

IFTTT

Put the internet to work for you.

Turn off or edit this Recipe

Read More..

Tuesday, October 25, 2016

Collection of SQL queries with Answer and Output Set 2

Here is a collection or a list of 30 SQL Queries with Answers as well as output. You can write your answer at the text box below each query any time you can see the table structure by clicking on Table Structure. And check your Answer by clicking on Answer. You can test your Skill in SQL. You can also go for an online Quiz in SQL in one of my previous posts: Click here for Quiz. More queries will be added to this post within few days, visit again!!!

Happy learning!!!
Carry on....
You can also share your queries in this site. Use this Link to share your part with the visitors like you.

SQL Query collection: Set1 Set2 Set3 Set 4


Below is the Table Structure using which you have to form the queries:


1) Display THE NUMBER OF packages developed in EACH language.

Table Structure

Answer
SELECT DEV_IN AS LANGUAGE,COUNT(TITLE) AS NOOFPACK
FROM SOFTWARE
GROUP BY DEV_IN



2) Display THE NUMBER OF packages developed by EACH person.

Table Structure

Answer
SELECT NAME AS PRNAME,COUNT(TITLE)AS NOOFPACK
FROM SOFTWARE
GROUP BY NAME



3) Display THE NUMBER OF male and female programmer.

Table Structure

Answer
SELECT SEX,COUNT(NAME) AS NAME
FROM PROGRAMMER
GROUP BY SEX



4) Display THE COSTLIEST packages and HIGEST selling developed in EACH language.

Table Structure

Answer
SELECT DEV_IN AS LANGAUGE,MAX(SCOST) AS COSTPACK,MAX(SOLD) AS HIGHPACK
SFROM SOFTWARE
GROUP BY DEV_IN



5) Display THE NUMBER OF people BORN in EACH YEAR.

SELECT TO_CHAR(DOB,YY) AS YEAR,COUNT(NAME) AS PRNO
FROM PROGRAMMER
GROUP BY TO_CHAR(DOB,YY)

Table Structure

Answer


6) Display THE NUMBER OF people JOINED in EACH YEAR.

Table Structure

Answer
SELECT TO_CHAR(DOJ,YY) AS YEAR,COUNT(NAME) AS PRNO
FROM PROGRAMMER
GROUP BY TO_CHAR(DOJ,YY)




7) Display THE NUMBER OF people BORN in EACH MONTH.

Table Structure

Answer
SELECT SUBSTR(DOB,4,3) AS MONTHOFBIRTH,COUNT(NAME) AS PRNO FROM PROGRAMMER
GROUP BY SUBSTR(DOB,4,3)



8) Display THE NUMBER OF people JOINED in EACH MONTH.

Table Structure

Answer
SELECT SUBSTR(DOJ,4,3) AS MONTHOFJOIN,COUNT(NAME) AS PRNO
FROM PROGRAMMER
GROUP BY SUBSTR(DOJ,4,3)



9) Display the language wise COUNTS of prof1.

Table Structure

Answer
SELECT PROF1 AS LANGUAGE, COUNT(PROF1) AS PROF1COUNT
FROM PROGRAMMER
GROUP BY PROF1





10) Display the language wise COUNTS of prof2.

Table Structure

Answer
SELECT PROF2 AS LANGUAGE, COUNT(PROF2) AS PROF2COUNT
FROM PROGRAMMER
GROUP BY PROF2



11) Display THE NUMBER OF people in EACH salary group.

Table Structure

Answer
SELECT SALARY,COUNT(NAME) AS PEOPLE
FROM PROGRAMMER
GROUP BY SALARY




12) Display THE NUMBER OF people who studied in EACH institute.

Table Structure

Answer
SELECT SPLACE AS INSTITUTE,COUNT(NAME) AS PEOPLE
FROM STUDIES
GROUP BY SPLACE





13) Display THE NUMBER OF people who studied in EACH course.

Table Structure

Answer
SELECT COURSE AS STUDY,COUNT(NAME) AS PEOPLE
FROM STUDIES GROUP BY COURSE



14) Display the TOTAL development COST of the packages developed in EACH language.

Table Structure

Answer
SELECT DEV_IN AS LANGUAGE,SUM(DCOST) AS TOTCOST
FROM SOFTWARE
GROUP BY DEV_IN




15) Display the selling cost of the package developed in EACH language.

Table Structure

Answer
SELECT DEV_IN AS LANGUAGE,SUM(SCOST) AS SELLCOST
FROM SOFTWARE
GROUP BY DEV_IN





16) Display the cost of the package developed by EACH programmer.

Table Structure

Answer
SELECT NAME AS PRNAME,SUM(DCOST) AS TOTCOST
FROM SOFTWARE
GROUP BY NAME



17) Display the sales values of the package developed in EACH programmer.

Table Structure

Answer
SELECT NAME AS PRNAME, SUM(SCOST*SOLD) AS SALESVAL
FROM SOFTWARE
GROUP BY NAME



18) Display the NUMBER of packages developed by EACH programmer.

Table Structure

Answer
SELECT NAME AS PRNAME,COUNT(TITLE) AS TOTPACK
FROM SOFTWARE
GROUP BY NAME




19) Display the sales COST of packages developed by EACH programmer language wise.

Table Structure

Answer
SELECT SUM(SCOST) AS SELLCOST
FROM SOFTWARE
GROUP BY DEV_IN



20) Display EACH programmers name, costliest package and cheapest packages developed by Him/Her.

Table Structure

Answer
SELECT NAME PRNAME,MIN(DCOST) CHEAPEST,MAX(DCOST) COSTLIEST
FROM SOFTWARE
GROUP BY NAME




21) Display EACH language name with AVERAGE development cost, AVERAGE cost, selling cost and AVERAGE price per copy.

Table Structure

Answer
SELECT DEV_IN AS LANGUAGE,AVG(DCOST) AS AVGDEVCOST,AVG(SCOST) AS AVGSELLCOST,AVG(SCOST) AS PRICEPERCPY
FROM SOFTWARE
GROUP BY DEV_IN





22) Display EACH institute name with NUMBER of courses, AVERAGE cost per course.

Table Structure

Answer
SELECT SPLACE AS INSTITUTE,COUNT(COURSE) AS NOOFCOURS,AVG(CCOST) AS AVGCOSTPERCOUR
FROM STUDIES
GROUP BY SPLACE



23) Display EACH institute name with NUMBER of students.

Table Structure

Answer
SELECT SPLACE AS INSTITUTE,COUNT(NAME) AS NOOFSTUD
FROM STUDIES
GROUP BY SPLACE




24) Display names of male and female programmers.

Table Structure

Answer
SELECT NAME AS PRNAME,SEX AS SEX
FROM PROGRAMMER
ORDER BY SEX





25) Display the programmers name and their packages.

Table Structure

Answer
SELECT NAME AS PRNAME,TITLE AS PACKAGE
FROM SOFTWARE
ORDER BY NAME




26) Display the NUMBER of packages in EACH language.

Table Structure

Answer
SELECT COUNT(TITLE) AS NOOFPACK,DEV_IN AS LANGUAGE
FROM SOFTWARE
GROUP BY DEV_IN




27) Display the NUMBER of packages in EACH language for which development cost is less than 1000.

Table Structure

Answer
SELECT COUNT(TITLE) AS NOOFPACK,DEV_IN AS LANGUAGE
FROM SOFTWARE
WHERE DCOST<1000 GROUP BY DEV_IN





28) Display the AVERAGE difference BETWEEN scost and dcost for EACH language.

Table Structure

Answer
SELECT DEV_IN AS LANGUAGE,AVG(DCOST - SCOST) AS DIFF
FROM SOFTWARE
GROUP BY DEV_IN



29) Display the TOTAL scost, dcsot and amount TOBE recovered for EACH programmer for whose dcost HAS NOT YET BEEN recovered.

Table Structure

Answer
SELECT SUM(SCOST), SUM(DCOST), SUM(DCOST-(SOLD*SCOST))
FROM SOFTWARE
GROUP BY NAME
HAVING SUM(DCOST)>SUM(SOLD*SCOST)



30) Display highest, lowest and average salaries for THOSE earning MORE than 2000.

Table Structure

Answer
SELECT MAX(SALARY), MIN(SALARY), AVG(SALARY)
FROM PROGRAMMER
WHERE SALARY > 2000


SQL Query collection: Set1 Set2 Set3 Set 4
Read More..

Sunday, October 23, 2016

Sign in to edx org with Google and Facebook and



Google is passionate about online education. In addition to our own Course Builder project, we’re also partners with edX, a not-for-profit that shares our desire for scalable, quality education for everyone. Their software, Open edX, lets people make educational content and deliver it online to anybody, anytime, anywhere. It powers their own site, edx.org, and is also used by companies and universities worldwide.

Today we’re very pleased to announce that you can now sign in to edx.org with your Google or Facebook account:
Until recently, users who wanted to take advantage of the high quality content on edx.org needed to create a new account first. This is a painful, error prone process?really, who wants to worry about yet another password? So we added the ability to use over 60 external authentication providers to Open edX, with support for everything from open standards like OpenID or OAuth 2.0, to custom university single sign-on systems. For their edx.org site, edX decided to let users pick between Google, Facebook, and a custom username and password.

If you run Open edX, you can also use this feature now. The authentication module is extensible so you can add any third-party provider you want if your favorite is not yet supported. And the feature is completely configurable, so you can pick whatever third-party authentication systems are best for your users, including none at all. It’s totally up to you.

By simultaneously increasing user choice, convenience, and security, we hope to make open online education even easier and safer to use, whether people pick Course Builder or Open edX for authoring and delivering courses. We’re very grateful to our partners at edX for working with us in this exciting field.
Read More..

Friday, October 14, 2016

A step closer to quantum computation with Quantum Error Correction



Computer scientists have dreamt of large-scale quantum computation since at least 1994 -- the hope is that quantum computers will be able to process certain calculations much more quickly than any classical computer, helping to solve problems ranging from complicated physics or chemistry simulations to solving optimization problems to accelerating machine learning tasks.

One of the primary challenges is that quantum memory elements (“qubits”) have always been too prone to errors. They’re fragile and easily disturbed -- any fluctuation or noise from their environment can introduce memory errors, rendering the computations useless. As it turns out, getting even just a small number of qubits together to repeatedly perform the required quantum logic operations and still be nearly error-free is just plain hard. But our team has been developing the quantum logic operations and qubit architectures to do just that.

In our paper “State preservation by repetitive error detection in a superconducting quantum circuit”, published in the journal Nature, we describe a superconducting quantum circuit with nine qubits where, for the first time, the qubits are able to detect and effectively protect each other from bit errors. This quantum error correction (QEC) can overcome memory errors by applying a carefully choreographed series of logic operations on the qubits to detect where errors have occurred.
Photograph of the device containing nine quantum bits (qubits). Each qubit interacts with its neighbors to protect them from error.

So how does QEC work? In a classical computer, we can monitor bits directly to detect errors. However, qubits are much more fickle -- measuring a qubit directly will collapse entanglement and superposition states, removing the quantum elements that make it useful for computation.

To get around this, we introduce additional ‘measurement’ qubits, and perform a series of quantum logic operations that look at the measurement and data qubits in combination. By looking at the state of these pairwise combinations (using quantum XOR gates), and performing some careful cross-checking, we can pull out just enough information to detect errors without altering the information in any individual qubit.
The basics of error correction. ‘Measurement’ qubits can detect errors on ‘data’ qubits through the use of quantum XOR gates.

We’ve also shown that storing information in five qubits works better than just storing it in one, and that with nine qubits the error correction works even better. That’s a key result -- it shows that the quantum logic operations are trustworthy enough that by adding more qubits, we can detect more complex errors that otherwise may cause algorithmic failure.

While the basic physical processes behind quantum error correction are feasible, many challenges remain, such as improving the logic operations behind error correction and testing protection from phase-flip errors. We’re excited to tackle these challenges on the way towards making real computations possible.
Read More..

Throwing fireballs with the Kinect and Oculus Rift in Unity 3D

I decided I wanted to make a small game where you were a viking and you threw fireballs at enemy vikings on Unity 3D. The catch is, I wanted to actually throw the fireballs, so I wanted to use the Kinect, and I wanted to actually see if I was the character, so I wanted to use the Oculus Rift.

Here is a quick video of the results before we get on to the discussion:



Basically this started because a colleague at Georgia Tech, Alex Trevor (soon to be Dr,), had an Oculus Rift and mounted a camera on top of it to see the Kinect output with the Oculus Rift. I thought that was really cool and had previously worked on a game that used the Kinect Skeleton to throw fireballs (though I lost all the source code for the first version). I really wanted to combine those ideas and had to start over.

Luckily, Dr. Brian Peasley (now at Microsoft) came to my rescue as always and gifted me an Oculus Rift. 


To explain a bit, the Oculus Rift is an immersive virtual reality headset. The two images are displayed on the screen above because one is projected to the left eye and one to the right eye. As you rotate your head, the images change and it feels like you are looking at a real environment (it is pretty amazing). This is why there are two images in the video (and pretty much all Oculus Rift demos). To appreciate it fully, I recommend wearing an Oculus Rift while watching the video.



The Kinect everyone should know by now. It can yield a really good skeletal estimation of a persons joints from the depth data, which can then be used to represent gestures.

I had some time this week so I grabbed the Unity third person MMO example, added the Kinect scripts provided by CMU here, created my own fireball and fireball related prefabs and scripts, added the Oculus package, changed all the camera stuff to make it first person, and tweaked a lot of stuff. Daniel Castro (also at Georgia Tech) was nice enough to help me film me making a fool of myself.
It was obviously a bit more complicated than that. Lots of tinkering and scripting was involved to get things working but that is the output. Here at RIM, we are working on lots of other cool things and if you are interested, check out some of my other projects.

Ive uploaded the source for public use and you can find it here (just make sure to please cite me):
https://github.com/StevenHickson/UnityKinectOculus

The fireball script just takes two Game objects (the Vikings left hand normalized by your hip) and uses a velocity measurement to determine if you want to throw the fireball, then it creates a fireball and sets its velocity to your hands velocity whenever you throw. This can be done easily with a small amount of code as below:
void Update () {
Vector3 norm_hand = HandPosition.transform.position - HipPosition.transform.position;
Vector3 velocity = (norm_hand - lastPos) / Time.deltaTime;
float dist = velocity.magnitude;
if (Input.GetButtonDown("Fire1") || (dist > THRESH && dist < MAX_THRESH)) {
                        Rigidbody clone;
Vector3 pos = HandPosition.transform.position;
pos.z += 1;
                        clone = (Rigidbody)Instantiate(Projectile, pos, transform.rotation);
clone.velocity = velocity * SPEED;
                }
lastPos = norm_hand;
}

And thats it for the fireball. Then there are some scripts destroying the fireball and vikings when they collide.
For the mapping of the joints to the main Viking, each joint position of the Viking is mapped to the corresponding Kinect Skeleton joints with GameObjects in the KinectControllerScript.
Then the Oculus SDK is used to create the camera and player control mapped to the main viking.
For all the code, see the Github project

Im using a friends version of Unity Pro because Im a poor graduate student. So please donate if you liked this work so I can continue doing it. All of these gadgets are expensive and I do all this and post it for free.

So please consider donating to further my tinkering!!



Places you can find me
Read More..

Thursday, October 6, 2016

Classifying everything using your RPi Camera Deep Learning with the Pi

For those who dont want to read, the code can be found on my github with a readme:
https://github.com/StevenHickson/RPi_CaffeQuery
You can also read about it on my Hackaday io page here.

What is object classification?

Object classification has been a very popular topic the past couple years. Given an image, we want a computer to be able to tell us what that image is showing. The newest trend has been using convolutional neural networks in order to classify networks trained with a large amount of data.

One of the bigger frameworks for this is the Caffe framework. For more on this see the Caffe home page.
You can test out there web demo here. It isnt great at people but it is very good at cats, dogs, objects, and activities.


Why is this useful?

There are all kinds of autonomous tasks you can do with the RPi camera. Perhaps you want to know if your dog is in your living room, so the Pi can take his/her picture or tell him/her they are a good dog. Perhaps you want your RPi to recognize whether there is fruit in your fruit drawer so it can order you more when it is empty. The possibilities are endless.

How do convolutional neural networks work (a VERY simple overview)?

Convolutional neural networks are based loosely off how the human brain works. They are built of layers of many neurons that are "activated" by certain inputs. The input layer is connected in a network through a series of interconnected neurons in hidden layers like so:
[1]

Each neuron sends its signal to any other neuron it is connected to which is then multiplied by the connection weight and run through a sigmoid function. The training of the network is done by changing the weights in order to minimize the error function based on a set of inputs with a known set of outputs using back propagation.

How do we get this on the Pi?

Well I went ahead and compiled Caffe on the RPi. Unfortunately since it doesnt have code to optimize the network with its GPU, the classification takes ~20-25s per image, which is far too much.
Note: I did find a different optimized CNN network for the RPi by Pete Warden here. It looks great but it still takes about 3 seconds per image, which still doesnt seem fast  enough. 

You will also need the Raspberry Pi camera which you can get from here:
Raspberry PI 5MP Camera Board Module

A better option: Using the web demo with python

So we can take advantage of the Caffe web demo and use that to reduce the processing time even further. With this method, the image classification takes ~1.5s, which is usable for a system.

How does the code work?

We make a symbolic link from /dev/shm/images/ to our /var/www for apache and forward our router port 5050 to the Pi port 80. 
Then we use raspistill to take an image and save it to memory as /dev/shm/images/test.jpg. Since this is symlinked in /var/www, we should be able to see it at http://YOUR-EXTERNAL-IP:5005/images/test.jpg.
Then we use grab to qull up the Caffe demo framework with our image and get the classification results. This is done in queryCNN.py which gets the results.

What does the output look like?

Given a picture of some of my Pi components, I get this, which is pretty accurate:

Where can I get the code?

https://github.com/StevenHickson/RPi_CaffeQuery

[1] http://white.stanford.edu/teach/index.php/An_Introduction_to_Convolutional_Neural_Networks

Consider donating to further my tinkering since I do all this and help people out for free.



Places you can find me
Read More..
 
Copyright 2009 Information Blog
Powered By Blogger