What is feature?
What is New?

How to create a Weather App on Android

Hello peeps,

Time for another Blog Post this year. Well, last month I had attended an "Android Internship" Workshop at our college, which is actually a CS With Android course offered by Google. Since many of my colleagues didn't know Java, we were given a tour of Java programming for the first three days, followed by a session on AI2 App inventor by MIT. Later did we started doing the actual beast : Developing Apps with Android Studio.

First of All, I would Like to thank Chandru etta, for teaching us all the amazing things during these 12 days.

After the workshop ended, we were given the assignment to build an app under an incentive that the best ones would be sent to Google. I finished building one yesterday. It's a weather app called Simple Weather. The app was made by concepts which were not taught to us in the class.

FINDING THE SOURCE CODE

Yeah, folks, my app is completely open source and hosted on GitHub. The source of my app can be found here

HOW I DID IT?

Now, folks, you might have entered an address on your mobile browser, and it loads up the webpage. But here's the thing, there are various steps running within the browser just to display the page, you just don't see that happening (apart from the loading spinner or the progress bar). My app is no different. There are various processes underlying just to display the weather data of the current City.

Implementation

Here's how I made my app working:

  1. Created a URL object, which has the web address to retrieve the input (The city is retrieved from a SharedPreferences File).
  2. Opened connection to the URL Objects, thereby successfully connecting to the internet.
  3. Created a BufferedReader Object, which reads the output we get from the URL (in JSON format)
  4. The output from the URL is converted to a StringBuffer. BufferedReader reads every line of the output and then appends it to the StringBuffer
  5. Then this output is converted to a JSONObject by converting the StringBuffer to a String.
  6. This JSONObject is then returned to my main Fragment (not Activity)
  7. This JSONObject is rendered by the renderWeather method in my main Fragment.
  8. This method does the job of displaying all the data on the main Screen.
  9. The onCreateView() method of this fragment maps the Resources from the Java file (should be a class instead) to the Resources in the Layout.xml file

CODE

So okay, here's my code:

1. WeatherActivity.java
2. WeatherFragment.java
3. CityPreference.java
4. RemoteFetch.java
5. fragment_weather.xml
6. activity_weather.xml

Read two numbers from a .xlsx spreadsheet and add them using python

Hello Everyone ,

I remember when I had joined the FOSS Club in the 2nd Semester in my university for the first time , the first week we were told to do the course on python at codecademy.com .
The very next week , we were given a task to be completed . The task was to read two numbers stored in two different cells in an Excel sheet , read them using python and add them to print their value (also using Python) . We were not allowed to do anything else with the original excel sheet.

So today I'll be sharing the details on how I tackled the problem

I've got a few things out for today:
  • Import a worksheet in Python
  • Read data from it
  • Manipulate data


A Few Excel Definitions :

  • Workbook : An Excel Document is called a workbook . It has a .xlsx extension (or .xls if you're using MS Office 2003 or .odp if you're using LibreOffice or OpenOffice) . In this article , we'll be mainly dealing with .xlsx workbooks
  • Worksheet : Each worksheet Contains multiple sheets called Worksheets. The sheet that a viewer is viewing is called an active worksheet.
  • Each sheet has many Columns and Rows .
  • A box at a particular row and column is called a cell. A cell can contain any value. A grid of cells makes up a sheet.


Import OpenPyXL module in Python

By default , Python does not have the OpenPyXL module pre-installed . So you'll need to install this module in order to work with spreadsheets in Python . You can download this module by reading its full documentation from here .

On a fresh install of Ubuntu or Debian or any other Debian based Linux OS , you'll have to install the pip package manager first . To install pip , use the following command
$ sudo apt-get install python-pip

Then , to install the OpenPyXL module in Python , you need to use the following command :
$ pip install openpyxl

To check whether OpenPyXL was installed or not , use the following command after entering python in Terminal or any other Command Prompt:
>>> import openpyxl

Working with a Spreadsheet




This is how your spreadsheet will look like . I'm right now active on "Sheet3" of my workbook.
Now type a number , (eg. 30) into the cell A1 . Then type another number , (eg. 50) into the cell B1.
So your workbook in Sheet3 must look like :



Opening Excel Documents with OpenPyXL

Now navigate to a Terminal , enter python , which will open python inside the terminal. Now I assume you saved the file as example.xlsx in your user folder. Now enter these commands One by one :

>>> import openpyxl
>>> wb = openpyxl.load_workbook("example.xlsx")

Now , to check whether our worksheet example.xlsx (Or any other spreadsheet) was loaded , use this command

>>> type(wb)

This should show <class 'openpyxl.workbook.workbook.Workbook'>

Getting Spreadsheets from your Workbook

>>> import openpyxl
>>> wb = openpyxl.load_workbook('example.xlsx')
>>> sheet = wb.get_sheet_by_name('Sheet3')

>>> sheet['A1']
<Cell Sheet1.A1>


>>> sheet['A1'].value

30

>>> a = sheet['A1']
>>> b = sheet['B1']
>>> c = a.value + b.value
>>> print c

80

So this is how I tackled the problem .


In a nutshell

These are the commands I entered in the python shell , one after the other (won't be writing the output here) :

>>> import openpyxl 
>>> wb = openpyxl.load_workbook("example.xlsx")
>>> sheet = wb.get_sheet_by_name('Sheet3')
>>> a = sheet['A1']
>>> b = sheet['B1']
>>> c = a.value + b.value
>>> print c

Okay , so thank you, everyone, for taking your precious time in reading my first blog..I'll write again soon.

ASUS Launches STRIX GeForce GTX 1080 Card

At Computex 2016, ASUS, a long time GPU collaborator and a NVIDIA partner for a long time, has unveiled its ROG Strix GeForce GTX 1080.
It pushes well past what NVIDIA’s board can do. The regular Strix runs at a 1.76GHz base clock speed (with a boost to 1.9GHz) versus the reference model’s 1.6GHz, and an overclocked version bumps that to 1.78GHz (boosting to 1.94GHz). Both cards have 8 GB of GDDR5X memory, a 256-bit memory interface, single DVI-D output, HDMI 2.0 outputs and DisplayPort outputs.

You get customizable lighting that includes color-shifting and patterns — you can even have the lights pulse to your music if you want your PC to serve as a tiny disco. ASUS’ mix of heatpipes and custom-shaped fans also promises a card that’s 30 percent cooler and three times quieter than NVIDIA’s stock hardware.
The high speeds of the Asus Strix cards can cause overheating issues, but the company has addressed the problem. Asus suggests that the gaming cards benefits from “direct-GPU-contact” heatpipes, which pulls away the heat from the card via surface transference.
“The Wing-Blade fans are carefully shaped to maximize static pressure over the heatsink, contributing to a 30 percent improvement in cooling performance over the Founders Edition,”says Asus.
The company claims that the Strix is also quieter when compared to the GTX 1080 Founders Edition.
And here’s the deal breaker, while NVIDIA’s own GTX 1080 costs $699, the standard Strix will sell for $620; even the higher-clocked version costs $640. You could buy a brand new game with the price difference, folks. You’ll likely have to wait until June 4th to get ASUS’ card, but it’ll probably be worth the wait.
What is next?