bio photo

Email

Data Personalization

Coding Mid-term part 3

With thanks to S.Slover, my code now parses geoLocation and gives user location on the task card. Next steps are two fix HTML/CSS and look up Sentiment analysis when we get to the Node stage. Sentiment analysis when giving tasks is helpful to determine urgency (priority of tasks). This is subject to fair bit of testing of course.

Coding Mid-term part 2

Okay so this is where we are: we can take in text from out chat window, and parse for certain tasks (#buy, #call etc). The next natural steps are to (i) display the task in html card like task bubbles (ii) have them show up on another window - for the tasker to do (iii) counting type of #'tag and generating json object. I'm not particular about order of (ii) and (iii).
On to (i), these are the parameters I'll be passing to the card: (i) task text (ii) time stamp (iii) current location of user sending task. Location so tasker can provide localized results, time stamp, because it's important to track it now - will help determine turn around times in the future.
45 minutes of using the Date.now() function for Javascript, I went for this code:

    /** * Return a timestamp with the format "m/d/yy h:MM:ss TT" * @type {Date} **/ function timeStamp() { // Create a date object with the current time var now = new Date(); // Create an array with the current month, day and time var date = [ now.getMonth() + 1, now.getDate(), now.getFullYear() ]; // Create an array with the current hour, minute and second var time = [ now.getHours(), now.getMinutes(), now.getSeconds() ]; // Determine AM or PM suffix based on the hour var suffix = ( time[0] < 12 ) ? "AM" : "PM"; // Convert hour from military time time[0] = ( time[0] < 12 ) ? time[0] : time[0] - 12; // If hour is 0, set it to 12 time[0] = time[0] || 12; // If seconds and minutes are less than 10, add a zero for ( var i = 1; i < 3; i++ ) { if ( time[i] < 10 ) { time[i] = "0" + time[i]; } } // Return the formatted string return date.join("/") + " " + time.join(":") + " " + suffix; }

    Getting somewhere with the task card, notice timeNow in console

    taskCard

    Getting user location

    This worked,

    http://stackoverflow.com/questions/2577305/get-gps-location-from-the-web-browser navigator.geolocation.getCurrentPosition(function(location) { console.log(location.coords.latitude); console.log(location.coords.longitude); console.log(location.coords.accuracy); }); But we want the city name, not co-ordinates. After a fair bit of Googling this is the solution I want to try first (and not the, use Google maps library in reverse) <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Geo City Locator</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> </head> <body > <div>Country: <span id="country"></span></div> <div>State: <span id="state"></spa></div> <div>City: <span id="city"></span></div> <div>Latitude: <span id="latitude"></span></div> <div>Longitude: <span id="longitude"></span></div> <div>IP: <span id="ip"></span></div> <script> $.getJSON('https://geoip-db.com/json/geoip.php?jsonp=?') .done (function(location) { $('#country').html(location.country_name); $('#state').html(location.state); $('#city').html(location.city); $('#latitude').html(location.latitude); $('#longitude').html(location.longitude); $('#ip').html(location.IPv4); }); </script> </body> </html>

    I need help: getting getJSON jQuery object to work in main.js and not be in index.html

    Coding Mid-term

    Documenting coding process
      Calling project Teagle (TaskEagle)
      Selecting week3, weather-dashboard-inclass code as boiler plate for front end and copying over
      Editing main.js; eventlistener to input tag calls getWeather, which checks if valid input added. Renaming that to getTask(). Renaming geoCodeIt() function to taskParse() which looks for #'tag task category.
      removing API calls
      Removed ajax object as it seemed challenging at this time
      focusing on parsing #'tag from task using regular expression
      Searching for regex helper
      Using https://regex101.com/
      Here are the imp regex references
      https://regex101.com/r/pJ4wC5/1 http://stackoverflow.com/questions/21421526/javascript-jquery-parse-hashtags-in-a-string-using-regex-except-for-anchors-i http://stackoverflow.com/questions/10208694/regex-to-parse-string-with-escaped-characters
      Turns out I may not need regex, as I found from my regex code in witness
      http://www.w3schools.com/jsref/jsref_includes.asp
      testing that...oh, it returns a boolean only. Will need regex
      Savior? https://www.tjvantoll.com/2013/03/14/better-ways-of-comparing-a-javascript-string-to-multiple-values/

    Yes, yes it did work! Above link (and it's regex solution) was a savior. I am able to parse all defined #'tags in a sentence, not just the first #tag but all. Here's the code:

    var taskType = task.match(/^#find|#buy|#transcribe|#call^/); if(taskType){ findTask = task.match(/#find/g); buyTask = task.match(/#buy/g); transcribeTask = task.match(/#transcribe/g); callTask = task.match(/#call/g); console.log(findTask); console.log(buyTask); } else { var warningDiv = document.getElementById('warning'); warningDiv.style.display = 'block'; return setTimeout(function(){ $("#warning").fadeOut(); }, 6000); }

    And the screenshot:

    findbuy console screenshot

    Using < xmp > tags to embed code in html since this post is being written in html:

      Mid-term Objective

      I mentioned I'm big on personal automation through outsourcing small, digital tasks to humans working remotely for money. I'm finding this class incredibly useful for building on this concept. My focus is to:
        (i) Build an instant messenger'ish interface for taking in a task - like the input field for Weather search
        (ii) Designating #'tags as task categories
        (iii) Parsing tasks as #'tags, counting them and generating json objects
        (iv) visualizing that data to draw conclusions on what type of automation can a person perform

      Purpose

      I am doing this to:
        (i) develop an intuitive interface inviting people to delegate tasks regularly
        (ii) a mobile UI is to make the virtual assistant always on always available
        (iii) get users to think about their tasks and #'tags as categories they internalize and starting thinking about their work as such
        (iv) Automate delgation and pass that on to the right person for the right job
        (v) Observe the supply and demand of task-outsourcing and task-working

      Fitbit - a Data Personalization Device & app

      I’m not using a Fitbit right now but I’ve used one for over four years. I could not be a bigger fan. I was a heavy user, slept with it, showered with it on, wore it every where and would check my steps and stair often. I used it to tell my time and was really excited to find out that new releases would do phone notifications. I liked Fitbit because it gave just enough interactivity, there wasn’t a whole lot going on there, neither was it super accurate but it was just enough to get you moving, hitting a target, track your weight (I bought the Aria too). Looking back, badges, goals, milestones and fake email praise were more of a nuisance. And it was never a social thing for me, I never got competitive by looking at somebody else doing more or less steps than me. My use-case for sharing was only with my partner as we’d talk about our weight goals with each other often.
      An improvement (I don’t know if it’s already in the new versions - Surge, Charge) I would suggest is to focus on automating activating sleep tracking. There could be different scenarios to do it best (in case motion or heart rate sensing isn’t accurate enough to differentiate resting from sleeping) such as, tying activation with setting your alarm on the phone, or predicting around what time somebody goes to sleep and prompting user to activate it.
      I see the Fitbit going from a wearable to embedded or biodegradable device.