I'm wondering how I can push desktop Growl notifications from my web application to the user of my web application. I would like to use javascript, if possible, otherwise a language like Ruby or PHP would be my second choice.
Have you implemented something like this before? How can it be done?
I figured out how to use Ruby to push Growl notifications. I would still like to find a JavaScript solution, but if there is no way to use JavaScript, then here is a Ruby solution:
Use the ruby-growl gem:
gem install ruby-growl
Then in your Ruby script:
require 'ruby-growl'
g = Growl.new "localhost", "ruby-growl", ["ruby-growl Notification"]
g.notify "ruby-growl Notification", "It Came From Ruby-Growl", "Greetings!"
Also, in order for this to work, you have to enable "Listen for incoming notifications" and "Allow remote application registration" on the Network tab of the Growl Preference Pane
You can send Growl notifications from Javascript (with a bit of Flash as a helper, but that part is behind the scenes). Here is a test page: http://www.growlforwindows.com/gfw/examples/js/
Note that this only currently works on Windows - the Javascript/Flash support in Growl on the Mac is currently broken as noted here: https://groups.google.com/forum/?fromgroups=#!topic/growl-development/BNF8tcUE1kM
Related
I've been thinking about learning how to make simple Mac OS X applications based on web-technology and I came across node-webkit which seems compelling. However, I've recently invested in learning the basics of Sinatra/Ruby and I wanted to stay on that course.
Is there a "node-webkit equivalent" for developers who use Sinatra? Or, is there a recommended way to use the Sinatra framework (or Ruby) to build OS X apps that are essentially web wrappers?
Sinatra is a server-side framework.
Contrary to Node-webkit which is on client side.
If you need to interact with a server, you can still use sinatra (as well as node.js, php, ...) on your server.
But if you are looking for a framework like sinatra on node.js, you should look into Express.js : https://npmjs.org/package/express
Node-webkit can use file or http, and which to use depends on your needs. The majority of the time you shouldn't need to, Node-webkit runs completely client-side using only HTML, javascript, and css. You certainly can initialize a local webserver when Node-webkit loads, but first try making a basic "Hello World" application to learn how it works.
If you still think you need to spin up a web server, then the code might look something like this (I'm using Express.js):
// Retrieve libraries...
var expressPort = 6014
var NodeWebkit = require('nw.gui');
// Call focus to application...
NodeWebkit.Window.get().focus();
// Instantiate the Express Server...
var spawn = require("child_process").spawn;
spawn("node", ['./server/server', expressPort]);
// Request director page...
window.location.replace('http://localhost:'+expressPort);
In order to use the Node-webkit features from a page on localhost you will also need to add the following line beneath the root of your package.json:
node-remote": "<local>
Note: While this does work, you must really consider whether it makes sense. In other words, is you application fully self-contained? If nothing will access that content except the application then you don't need it.
For my application I am using Node-webkit as an admin console for creating/managing broadcasts. (hence the local webserver)
Nw is not a web framework. Nw does not use a http protocol; it does use a file protocol.
Nw is composed of chromium and nodejs, which allows you to run both DOM and node.js stuff -- without setting up a web server.
I'd like to access Heroku logs for an app without using the command line. Is this possible?
Yes, you can. It's a simple REST API. There aren't any JavaScript wrappers for the API, but you can use these as reference implementations, or use them directly:
https://github.com/heroku/heroku.jar
https://github.com/heroku/heroku.rb
https://github.com/heroku/heroku.py
Currently No. If you're looking to use this from within a Ruby based app you can embed the heroku gem and use it programatically which might help.
I know that with watir-WebDriver, I can make use of RubyBindings to have the browser load specific profiles or Firefox add-ons when I create a new browser instance. However, can I use Watir to actually use the add-on(s) I open?
The reason I ask is that I am trying to implement a web scraper to navigate to websites and record HTTP interactions. However, since Tamper Data already does the HTTP request/response logging I require, I'd rather use its functionality instead of having to redo it myself.
If this is not possible, I'm wondering if anyone knows a unit tester that will allow me to:
Open a Firefox browser & load Tamper Data
Navigate to specified pages
Click a button on Tamper Data's UI
You can't interact with extensions using bare watir/webdriver as far as i know, need to find a workaround ... Try something like rautomation - https://github.com/jarmo/RAutomation or autoit - http://www.autoitscript.com/site/
This works for me to launch firebug:
Win 7 & XP:
require 'watir-webdriver'
default = Watir::WebDriver::Firefox::Profile.new
If you are admin on your machine it will be the following... otherwise search and provide path:
default.add_extension("/Users/Administrator/AppData/Roaming/Mozilla/Firefox/Profiles/krqve9uc.firebug/extensions/firebug#software.joehewitt.com.xpi")
b = Watir::Browser.new(:firefox, :profile => default)
I'm developing an addon using Firefox Add-on SDK. I am using cfx to run my addons when testing.
The app posts some text when highlighted to twitter.
The problem is each time I modify the code I have to log back into twitter. Is there any way to ensure cookies are saved whilst testing/debugging? Similar to what happens when you open and close Firefox normally?
What are your parameters for calling cfx? By default, cxf executes in a new profile.
You need to use -p PROFILEDIR or --profiledir=PROFILEDIR param to use a specific profile, and associated settings.
From notes # https://jetpack.mozillalabs.com/sdk/1.0b5/docs/dev-guide/addon-development/cfx-tool.html
I am developing a ruby project, not rails project. Is there any exception notification gem for this case? thanks!
Although quite young, the following is an intentionally non-Rails exception notification gem: https://github.com/Moove-it/rusen
The simpliest solution depends from wich method did you like to send mails.
If you have for example already installed sendmail - in this case to send the mail with notification log you can call it with params. It depend on your system settings.