Posts

Showing posts from June, 2015

Create Graph using Highcharts from a CSV File

Demo 1. Add these JavaScript inclusions in the head of your page <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"> </script><script type="text/javascript" src="http://code.highcharts.com/highcharts.js"></script> 2. Add the JavaScript to initialize the chart on document ready $(document).ready(function () { var options = { chart: { renderTo: 'container', type: 'line', width: 800, height: 450 }, title: { text: 'Cabadbaran, Agusan del Norte' }, subtitle: { text: 'Source:CSU Phil-LiDAR 1', x: -20 }, xAxis: { categories: [], minTickInterval: 15, TickInterval: 15, tickmarkPlacement: "on", labels: { padding: 10,

Schedule Loading of Shapefile into a PostgreSQL Database

The code below automatically loads the shapefile found in a certain directory into a PostgreSQL database within a given interval(in this example 2 minutes). Downside (in which I'm trying to figure out): What if the filename of the shapefile changes? Anyway, this suits of what I need right now. __author__ = 'Matt' import os from django.db import connection from django.contrib.gis.utils import LayerMapping from .models import FloodHazard import datetime import time import logging from apscheduler.scheduler import Scheduler logging.basicConfig() # Start the scheduler sched = Scheduler() sched.daemonic = False sched.start() #ogrinspect evidensapp/data/flood_hazard/FloodHazard.shp FloodHazard --srid=32651 --mapping --multi # Auto-generated `LayerMapping` dictionary for FloodHazard model floodhazard_mapping = { 'hazard': 'Hazard', 'date_field': 'Date_', 'geom': 'MULTIPOLYGON' } bound_shape = os.path.abspath(os.

I want to grow up my child like me...

Image
...but minus the immaturity! Well, of course let's have girlfriend first. HAHA We had a short trip today to Carmen, Agusan del Norte to celebrate Father's Day. My father is gone but will always be remembered. Anyway, it was fun. Here are our photos below:

Pantsu on EOS!!!

Image
So, this game is GOOD!!! Why? PANTSU Characters can jump Anime-like characters Skill has cooldown Transportation Pets Lots of Quest (with hints and location indicator) Has 5 Classes and Subclasses Soul System( After each encounter with a monster or an evil spirit, you can receive a Chaos Soul from the fallen creature. ) Dungeon (Solo, Party, Infinite) PVP is FAIR( stats and gear are normalized between all participating players for a fair fight.  ) Lots of skill (cool animation) Downside: Gender lock classes Burns my laptop (HAHA; 4GB RAM, 4GB Graphics, i5) reaches up to 80C Movement Controls Awkward looking Rouge Class (HAHA) Actually, I just played Echo of Soul  today and my character is an Archer -> Huntress and lvl. 15. I'll update this soon. Off-topic: 

"Shame", "For the Watch"

Image
Holy macaroon!!! What just happened?!! HAHA Game of Thrones Season 5 is over!!! To sum it up (Ep.10): 1. Body Count: 6 deaths plus Stannis' army. Winter is coming and the Night's Watch just killed Jon Snow, my sister cries hard and it's funny. Stannis' fate is unexplainable, nonsense (I can't find the right adjective for it). 2. Walk of Atonement I love Cersei's look after the "new" member of Kingsguard lift him.   3. Daenerys being sorrounded by Dothraki warriors. Is she gonna be raped again?  4. Arya's brutality Gruesome!!!! but good job Arya Stark! :) 5. Theon has grown some balls, finally. Yeah! Prevent Sansa from death by pushing Myranda and then jump off the castle. They're at least alive right? :D Next season will be WAR! Hope so. Now the countdown starts.

Something worth posting...

Image
I'm not that religious type of person. I often go to church, in fact I've never been to church this year. Something's wrong with me. But I'm always grateful for all the blessings that God has given me, and also for all the problems and trials. I won't be this type of person today if I did not experience those things.  I'm sharing Owl City's new song "My Everything" because it's a very good song and the lyrics is simple yet  powerful. "My Everything" When my hope is lost  and my strength is gone I run to you and you alone When I can't get up and I can't go on I run to you and you alone 'Cause you're my light in the dark and I sing with all of my heart Hallelujah My almighty God divine Hallelujah I am yours and you are mine This is all I know I will say Hallelujah Hallelujah You're my everything When I'm plagued with pain and filled with fear I run to you and y

Styling Vector Layer Based on Attributes

Image
/*START OF STYLING THE VECTOR LAYER*/ var o = { getColour: function (e) { var t = e.attributes.hazard; return "Low" == t ? "#FFFF00" : "Medium" == t ? "#FFA500" : "#ff0000" } }; var c = { fillOpacity: .3, strokeColor: "${getColour}", strokeWidth: 0, strokeOpacity: 0, fillColor: "${getColour}" }; var b = new OpenLayers.Style(c, { context: o }); var v = new OpenLayers.StyleMap({ "default": b }); /*END OF STYLING THE VECTOR LAYER*/ var GeoJSONLayer = new OpenLayers.Layer.Vector("GeoJSON", { styleMap: v, strategies: [new OpenLayers.Strategy.Fixed(), filterStrategy], renderers: ['Canvas', 'SVG', 'VML'], protocol: new OpenLayers.Protocol.HTTP({ url: "{% static "js/floodmap.txt" %}", format: new OpenLayers.Format.GeoJSON() }) }); Change the attribute name based on your

Divert

Image
First, I was kinda disappointed with myself because I guess my effort is not enough. Anyway, I'll just focus on the things that I have right now which is my work and studies. Let's make ourself better after a sad event that just happened. :) "Some things are just not meant to happen, 'cause some things need hard work and effort." If she's not important to me, I can't possibly write this and it would end up like sh*t. HAHA We had our moments and it ended quite fast. No hard feelings though. Again, I'll wait and be hopeful! It was nice knowing her and I don't have any regrets at all. She's a very fine lady. I can't say anything bad about her. I thank her for her honesty. ~fin