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.

A Review Of The ASUS R558UF Budget Gaming Laptop


Author’s Note: While the laptop actually comes with a 4 GB RAM, I have upgraded it to 12GB. Hence, my review will also be based on this 12GB RAM.
Hey Laptop Gamers, wanna buy a new laptop? Here is the ASUS R558UF-XO044D, a budget gaming laptop which can fulfill almost all needs for gaming.
Asus is no new kid on the block as far as laptops and PCs are concerned. And it’s doing a pretty good job while at it. The Taiwanese company has been placed firmly among the top 5 vendors in the world by market share (number of units shipped in 2015) by Gartner. So, that says a lot.
At Rs. 42,999 the R558UF-XO044D is an affordable purchase in the company’s R-series of laptops and comes with hardware that matches that price on paper. If you’re looking for something more enhanced, there are slightly better variants as well. Let’s dig in and find out if the Asus R558UF-XO044D is any good.
PS. At the time of buying, this laptop cost me around Rs. 36,900 and the 8GB RAM cost me Rs. 3300. Hence, I bought this laptop at a price of Rs. 40,000 , unlike the current market value.
Specs: 15.6-inch LED screen (1366×768 pixels) | 2.3GHz quad-core Intel Core i5 6200U processor with turbo boost up to 2.8GHz | 4GB DDR3 RAM | 1TB HDD | 2GB Nvidia GeForce GT 930M graphics | Ethernet, HDMI, VGA, 1xUSB 3.0, 1xUSB 2.0, qxUSB-C 3.1, SD Card reader | Wi-Fi, Bluetooth, SonicMaster Audio | 8x DVD Writer | 2-cell Lithium Polymer battery | Free DOS
DESIGN AND BUILD QUALITY

The first thing you’ll see is its size. It is big, but it feels light. The R558UF weighs 2.3 kilograms on paper which is not so very heavy when you look at rivals like the HP Pavilion 15- n007AX and Lenovo Flex 2 which weigh around the same. Even at 2.3 kilos, this laptop is a great buy when you are on the go everyday.
The R558UF is made entirely of plastic. The lid is made of a glossy dark brown plastic shell. The trackpad is clickable throughout its length, right and left clicks only function from the extreme corners. The chiclet keyboard is well spaced out and offers plenty of gap between each key so typing is fast and feels good.
DISPLAY

The Asus R558UF comes with a 15.6-inch HD LED backlit slim glare display that has 1366 x 768 pixels resolution. The resolution is on the lower side and the screen doesn’t get as bright as say the one on the HP Pavilion 15 which has the same display specifics. There is no compromise in its viewing angles which are really great for a laptop in this price range.
Although the R558UF is pretty good for watching movies and surfing the web, hardcore gamers will be disappointed by its display output more so because the laptop comes with pretty good hardware under the hood. But, watching videos at an angle is straining to the eyes.
SOFTWARE
This laptop comes with the Free DOS Operating System, but we can install any 64-bit OS on this laptop (PS. 32 bit Operating Systems aren’t supported on this laptop), like Windows 10 and Ubuntu 16.04+ .
Windows 10 is the only edition of Windows supported on this laptop. For the Open Source Lovers, Ubuntu 16.04 is the best edition of Linux you can have on this laptop. Go for any other version below this, you’ll have issues with the touchpad (like two finger scrolling not working).
PERFORMANCE
The R558UF is powered by a 2.3GHz quad-core Intel Core i5-5200U processor (with Hyper-Threading) coupled with a NVidia GeForce 930M graphics card (+2GB memory) and 4GB (upgradeable up to 12GB) of DDR3 RAM. The laptop comes with 1TB of SATA hard disk memory.
The core i5 CPU inside is powerful enough to deal with everyday computing, while the dedicated Nvidia graphics card assisted by 12 gigs of RAM is plentiful to run graphical games, although at low to medium settings.
If you’re looking for a decent desktop replacement, the R558UF will have you covered as far as running the basics well is concerned. You can’t expect more for Rs.40,000. A lot of you would instantly say gaming. It’s safe to say that the R558UF can handle all your high-intensity games from 2013 and earlier. On the 12GB RAM, games like Metal Gear Solid V: Phantom Pain, GTA V and Assassin’s Creed Syndicate work like a charm in between medium and high settings. For 4GB RAM, you will be disappointed by the performance. That means you’ll have to upgrade to 12GB to be satisfied with this laptop.
The laptop features bottom firing speakers which vent out a great audio output. These come with Asus’s SonicMaster tech for audio enhancement while its proprietary AudioWizard lets you switch between various audio modes depending on the situation.
If you’re looking for an overall media-centric device, there is not much to complain about in the R558UF. You can watch all your 1080p movies and play a good amount of games on it. Nevertheless, this has the best display and performance for this price.
BATTERY
The R558UF uses a 2-cell Lithium Polymer battery. Surprisingly, battery life is really great, especially when you consider rivals.
On having no background apps opened, this laptop can give you a maximum of 7-8 hrs life on standby. On having performance-heavy apps opened, you still get an average 5 hrs battery. On a 6 hr long journey starting from a 100% battery on Windows 10 (with Battery Saver enabled) and 40% brightness, I had watched a 2.5hr 720p movie, played GTA V for 20-30 mins, listened to song for an hour, and while shutting down the laptop, it still had 2hrs battery remaining at 37%. Come on, this is a real VFM.
THINGS YOU SHOULD KNOW BEFORE BUYING
Well, here are a few things you must know before buying this laptop:
  1. No LED For Power Button
  2. Global On-Site Warranty of Two Years
  3. No LED for Num Lock, Caps Lock, Scroll Lock; one of the basic things that other laptops in this price range actually provide
  4. Start-up time is a bit slow (the ASUS Logo takes time to load), but once your OS is loaded, you get a performance beast
  5. The Last Important thing, You Cannot create a WIFI hotspot using the built-in WIFI device, unlike other laptops which can do this basic functionality.
  6. You will need to have 12GB Of RAM to even start a game like Assassin’s Creed Syndicate. No, 8GB of total RAM won’t work.
SHOULD YOU BUY IT

The R558UF is one of those rare instances where good specifications are delivered with a good experience. The laptop gives great performances on a great battery. No programs seemed to have crashed on this system.
So all-in-all, this laptop is indeed a great VFM for its specs. Just go ahead and buy it if you want a budget laptop, but you want to occasionally game on it as well.

Source: My article at Coffeeetech

Install NVIDIA drivers the right way on Linux




Just a couple of months back I had bought a new laptop with Intel Core i5-6200U processor and NVIDIA GeForce 930M GPU. The first thing I tried to do was to install the graphic drivers.

So, being a Linux noobie at that time, I googled this thing and I ended up here (AskUbuntu being a reputed site, became my first choice among the search results). I did what the solution said, and ended up screwing my distro, it wouldn't proceed past the login screen. I tried doing what a few other sites were telling, all ending up the same road. I tried using Ubuntu's own Software Updater app too, ending on the same note again.

Until one day I discovered that I could directly install the Graphics Driver from the Terminal without any hassles (sigh -_-)

WHAT NOT TO DO

These are what I tried ending up on the same road (not going past the Login screen despite the correct credentials)

  • Trying to update via .run files provided by NVIDIA's official site
  • Trying to update via Ubuntu's very own Software and Updates app.
  • Having the following two repos and installing the driver via terminal
     ppa:xorg-edgers/ppa
    ppa:mamarley/nvidia
  •  Updating the kernel (unless you install the drivers)

WHAT TO DO

Now it's a really simple process on Ubuntu 16.04 (Doing this on 15.10 was hell, checked the X Server Log Files and didn't get anything special to boast about)

Run these steps:
  • $ sudo apt update
  • $ lshw -numeric -C display
    or
    $ lspci -vnn | grep VGA  

     (As a root user). The Output will show your Nvidia Model Number. Example:
    $ lshw -numeric -C display


    *-display      

      description: VGA compatible controller
      product: Sky Lake Integrated Graphics [8086:1916]
      vendor: Intel Corporation [8086]
      physical id: 2
      bus info: pci@0000:00:02.0
      version: 07
      width: 64 bits
      clock: 33MHz
      capabilities: pciexpress msi pm vga_controller bus_master cap_list rom
      configuration: driver=i915_bpo latency=0
      resources: irq:128 memory:dd000000-ddffffff memory:b0000000-bfffffff ioport:f000(size=64)
    *-display
      description: 3D controller
      product: GM108M [GeForce 930M] [10DE:1346]
      vendor: NVIDIA Corporation [10DE]
      physical id: 0
      bus info: pci@0000:01:00.0
      version: a2
      width: 64 bits
      clock: 33MHz
      capabilities: pm msi pciexpress bus_master cap_list rom
      configuration: driver=nvidia latency=0
      resources: irq:131 memory:de000000-deffffff memory:c0000000-cfffffff memory:d0000000-d1ffffff ioport:e000(size=128) memory:df000000-df07ffff

  • The Model used by my system is GeForce 930M. Next, we will find a correct NVIDIA driver within the Ubuntu repos using this info. But before that, navigate here and enter details. Example:


  • After a successful search, take a note of the driver number:
    Version:  361.42
    Release Date: 2016.3.30
    Operating System: Linux 64-bit
    Language: English (US)
    File Size: 82.74 MB

  • Then install the corresponding driver
    $ sudo apt-get install nvidia-361
    ...
    Done.

    nvidia_361:
    Running module version sanity check.
    - Original module
    - No original module exists within this kernel
    - Installation
    - Installing to /lib/modules/4.4.0-18-generic/updates/dkms/

    nvidia_361_modeset.ko:
    Running module version sanity check.
    - Original module
    - No original module exists within this kernel
    - Installation
    - Installing to /lib/modules/4.4.0-18-generic/updates/dkms/

    nvidia_361_uvm.ko:
    Running module version sanity check.
    - Original module
    - No original module exists within this kernel
    - Installation
    - Installing to /lib/modules/4.4.0-18-generic/updates/dkms/

    depmod........

    DKMS: install completed.
    Setting up ocl-icd-libopencl1:amd64 (2.2.8-1) ...
    Setting up nvidia-opencl-icd-361 (361.42-0ubuntu1) ...
    Setting up bbswitch-dkms (0.8-3ubuntu1) ...
    Loading new bbswitch-0.8 DKMS files...
    First Installation: checking all kernels...
    Building only for 4.4.0-18-generic
    Building initial module for 4.4.0-18-generic
    Done.

    bbswitch:
    Running module version sanity check.
    - Original module
    - No original module exists within this kernel
    - Installation
    - Installing to /lib/modules/4.4.0-18-generic/updates/dkms/

    depmod....

    DKMS: install completed.
    Setting up nvidia-prime (0.8.2) ...
    Setting up screen-resolution-extra (0.17.1) ...
    Setting up nvidia-settings (361.42-0ubuntu1) ...
    Setting up vdpau-driver-all:amd64 (1.1.1-3ubuntu1) ...
    Processing triggers for libc-bin (2.23-0ubuntu2) ...
    Processing triggers for initramfs-tools (0.122ubuntu6) ...
    update-initramfs: Generating /boot/initrd.img-4.4.0-18-generic
    Processing triggers for ureadahead (0.100.0-19) ...
    Processing triggers for dbus (1.10.6-1ubuntu3) ...

  • Now you can reboot your system. Then after loading Ubuntu, you can load the X Server Settings app:


CONCLUSION

So that's it, folks. This is the safest and a recommended way to install NVIDIA drivers for Linux. And I repeat, do not install the drivers using the .run file

    Newer Posts Home
    What is next?