PushWoosh & Phonegap
Tackled PushWoosh & Phonegap this month
Really like the dashboard on pushwoosh.com
Alisa U Zemlji Chuda

Andulka
trying on a metaphor
Monterey Bay Aquarium

Janaina Medeiros
No title available
PUT YOUR BEARD IN MY MOUTH
Cosmic Funnies
Show & Tell
No title available

@theartofmadeline

No title available
let's talk about Bridgerton tea, my ask is open

Discoholic 🪩

❣ Chile in a Photography ❣
noise dept.
Not today Justin
DEAR READER
wallacepolsom

#extradirty
seen from United States

seen from United States

seen from United States
seen from United States
seen from United States
seen from United States
seen from United States

seen from Singapore

seen from Italy
seen from Malaysia

seen from United Kingdom
seen from Singapore
seen from United States
seen from Malaysia

seen from Malaysia

seen from China
seen from United States
seen from France
seen from Poland
seen from Netherlands
@ericdecoff
PushWoosh & Phonegap
Tackled PushWoosh & Phonegap this month
Really like the dashboard on pushwoosh.com
Node Google Cloud Messaging
var gcm = require('node-gcm'); var message = new gcm.Message(); //API Server Key var sender = new gcm.Sender('GOOGLE_PROJECT_CREDENTIALS'); var registrationIds = []; // Value the payload data to send... message.addData('message',"Phonegap Push Plugin Test"); message.addData('title','Push Notification Test' ); message.addData('msgcnt','1'); // Shows up in the notification in the status bar when you drag it down by the time //message.addData('soundname','beep.wav'); //message.collapseKey = 'demo'; //message.delayWhileIdle = true; //Default is false message.timeToLive = 3000;// Duration in seconds to hold in GCM and retry before timing out. Default 4 weeks (2,419,200 seconds) if not specified. // At least one reg id/token is required registrationIds.push('DEVICE_TOKEN_GOES_HERE'); /** * Parameters: message-literal, registrationIds-array, No. of retries, callback-function */ sender.send(message, registrationIds, 4, function (result) { console.log(result); //null is actually success });
EC2 Nodejs Return Error Codes
The follow is the package.json I used for the follow source
{ "name": "Simple Mean Stack", "version": "0.0.1", "author": "Eric DeCoff", "description": "MongoDB(Mongoose+), Express, Nodejs", "license": "MIT", "dependencies": { "express": "~4.11.1", "mongoose": "~3.8.21", "morgan": "~1.5.1", "body-parser": "~1.10.2", "method-override": "~2.3.1" } }
Copy above to EC2 and use nodejs install
/* * Main App file App.js * @author Eric DeCoff */ // Dependencies requirements, Express 4 var express = require('express'); var morgan = require('morgan'); var bodyParser = require('body-parser'); var methodOverride = require('method-override'); var mongoose = require("mongoose"); var app = express(); app.use(express.static(__dirname + '/public')); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({extended: false})); app.use(morgan('dev')); app.use(methodOverride()); app.listen(8080); console.log('Im listening on port 8080'); // MongoDB configuration mongoose.connect('mongodb://localhost:27000/customers', function(err, res) { if(err) { console.log('error connecting to MongoDB Database. ' + err); } else { console.log('Connected to Database'); } }); // Allow returning of error for unfound locations avoid status 0 angular app.all("/*", function (req, res, next) { res.header("Access-Control-Allow-Origin", "*"); res.header("Access-Control-Allow-Headers", "Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With"); res.header("Access-Control-Allow-Methods", "GET, PUT, POST"); return next(); });
run `nodejs app.js` to start
AWS CONNECT TO YOUR EC2 INSTANCE
Open URL: https://console.aws.amazon.com/ec2
Click ( # Running Instances )
Click ( Connect ) if Java properly install you can use it to connect
Remember to Add you Private Key Path and Filename
Private Key Path: You path and filename goes here
Click ( Launch SSH Client )
On successful connection should see
Adding EBS Volume to EC2 Instance
Connect to AWS EC2 Instance
use `lsblk` to show drives
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda1 202:1 0 8G 0 part / xvdf 202:80 0 8G 0 disk
Find the one without a mount point
$ subo mkfs /dev/xvdf
Now make a mounting point
$ sudo mkdir /data
$ sudo chmod 777 /data
Now lets mount it
$ sudo mount /dev/xvdf /data
Now lets confirm it
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda1 202:1 0 8G 0 part / xvdf 202:80 0 8G 0 disk /data
AWS EC2 enable Public DNS ( HostName )
Open URL: https://console.aws.amazon.com/vpc/home
Click ( Action -> Edit Hostname -> Yes )
Get Instance Public DNS
Connect and run
sudo hostname public_dns_name_goes_here
MMS MongoDB and AWS EC2 ( Free Tier )
*** NOTE ****
Set VPC Hostname to YES
***************
Open URL: http://mms.mongodb.com/setup
Click ( Begin Setup )
Click ( Deploy AWS )
Click ( I will provision )
Click ( StandAlone )
Pick Unique Instance Name
If you want to preserve data between instances
Make sure to use your Elastic Block Storage ( EBS )
See Adding Elastic Block Storage
Click ( Continue )
Click ( Download Agent )
Select Ubuntu
Click ( Continue )
Follow Instructions ( As of this posting )
Step 1 ( Download Agent )
curl -OL https://mms.mongodb.com/download/agent/automation/mongodb-mms-automation-agent-manager_1.4.4.813-1_amd64.deb
Step 2 ( Install the package )
sudo dpkg -i mongodb-mms-automation-agent-manager_1.4.4.813-1_amd64.deb
Step 3 ( Edit automation-agent )
sudo vi /etc/mongodb-mms/automation-agent.config
mmsGroupId=( Enter generated key )
mmsApiKey=( Enter generated key )
( Save and Exit )
Step 4 ( Prepare data directory ( change to your path )
sudo mkdir -p /dev/sda1/data
sudo chown mongodb:mongodb /dev/sda1/data
Step 5 ( Start Agent )
sudo start mongodb-mms-automation-agent
Step 6 ( Click Verify )
If everything goes well you will see. Press ( Continue )
Step 7 ( Review and Deploy )
Success you are now ready to deploy your MMS MongoDB
Create a free tier EC2 ubuntu instance
Sign-In URL: http//aws.amazon.com
Go to your EC2
Got your Instances
You should have a blank screen, possibly a terminated session
*** Remember you only have 750/hours of free tier usage ***
And partial hours count as full hours
Ok click on launch instances
1. Choose AMI ( Be Safe check free instances )
Choose scroll down and choose Ubuntu HVM
2. Choose an Instance Type ( Make sure free tier eligible selected )
Click ( Next: Configure Instance Details )
3. Configure Instance ( Skipping )
Click ( Next: Add Storage )
4. Add Storage ( Add EBS )
Click ( Add New Volume )
Make sure Delete on Termination NOT CHECKED
*** NOTE ***
Adding EBS Volume to EC2 Instance
Click ( Next: Tag Instance )
5. Tag Instance ( Skipping )
Click ( Next: Configure Security Group )
6. Configure Security Group ( Never use in Production )
Change
Security Group Name: development-wide-open-never-use-production
Security Group Description: ( see above )
Type: All Traffic
Source: Anywhere
Click ( Review and Launch ) when above matches below
7. Review
Remember to stop this Instance when not actively developing
Click ( Launch )
8. Lastly Create a Key Pair
Key pair name: Development30303
Click ( Download Key Pair )
Click ( Launch )
Launch Status
Click ( Instance ID to go directly to the Instances Page )
Instances
Click ( Expand Full )
You are now ready to connect to your instance
Connect EC2 Instance
Create a AWS Free Tier Account
Got to URL: https://aws.amazon.com/
Simply follow the steps
*** A Credit Card or Registered Pre-Paid Credit Card will be needed ***
Since city council meeting to investigate charter communication
Speed now at 31.84
Intel XDK ( 0714 ) <!DOCTYPE html> Bug
As of Intel XDK ( 0714 )
Any pages loaded must have a <!DOCTYPE html> at the top of page
even if a snippet of code ( pain to correct if project is large )
PHP Webpage Redirect with Cors Access
<?php header('Access-Control-Allow-Origin: *'); $url = 'http://fbcvr.com/litesite.cfm?id=2048'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, 0); // no headers in the output curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // output to variable $content = curl_exec ( $ch ); $err = curl_errno ( $ch ); $errmsg = curl_error ( $ch ); $header = curl_getinfo ( $ch ); $httpCode = curl_getinfo ( $ch, CURLINFO_HTTP_CODE ); curl_close ( $ch ); $header ['errno'] = $err; $header ['errmsg'] = $errmsg; $header ['content'] = $content; echo $header ['content']; ?>
Restful API ( Slim.php ) - JSONP Wrapper
function show_results($results){ global $app; // get request $request = $app->request(); // get headers $headers = $request->headers(); // Create Response Header $response = $app->response(); $response->status(200); $response['Content-Type'] = 'application/json'; $response['X-Powered-By'] = 'Slim'; $max = count($results ); $response['Content-Range'] = '/ ' . $max; error_log("Content-Range [" . $response['Content-Ranger'] . "]" . chr(10)); $response->body(jsonpWrapper(json_encode($results))); } function jsonpWrapper($jsonp) { global $app; if (($jsonCallback = $app->request()->get('jsoncallback')) !== null) { $jsonp = sprintf("%s(%s);", $jsonCallback, $jsonp); $app->response()->header('Content-type', 'application/javascript'); } return $jsonp; }
Bad Charter ! Speedtest ( 0.98 - 1.47 )
Bad Charter ! Speedtest ( 3.70 - 2.33 )
Bad Charter ! speedtest ( 4.42 - 750kps )
Bad Charter ! Speedtest ( 3.76 - 1.23 )