I would like my browser to refresh automatically when I change my ring handler (I'm using Hiccup to generate my html). I'm using the :reload option of serve from boot-http which works fine, but I always have to manually refresh the browser.
Leiningen seems to have an auto-refresh? option, but I couldn't find something similar for boot. There's also ring-refresh, but that's really old and seems incompatible with the latest version of Clojure.
Is there a simple way for boot to refresh the browser after my code changes?
The problem with Ring-Refresh was an outdated dependency on Compojure. Adding the latest version of Compojure as a dependency solves the problem.
Related
Having tested a simple (hello world) app in ember a few months ago, I was really excited because I knew that Google was able to fetch and therefore index it. Another app I built in Angular a few years was also being indexed! So I pressed on with my ember development and now have an application ready to deploy. This uses a PHP/MySQL backend api.
Today, I uploaded the production build to a server and then checked things in webmaster tools using the fetch and render tool. This time, nothing is being rendered !!!! I have double checked and uploaded the hello world app to the same server, which was fetched and rendered without any problem. I have absolutely no idea why this is happening!
I then looked at ember-cli-fastboot (having not really worried about it before because I thought that Google could index single page apps) and when I run
ember fastboot --serve-assets
I get
jQuery is not defined
ReferenceError: jQuery is not defined
So I'm now at a complete standstill after a lot of work!
Any help in resolving this would be much appreciated! Ideally I don't want to have to use fastboot, but if I have to, I'm not sure how to resolve the above issue.
unfortunately, ember-fastboot has some limitations and jQuery is one of them. You could use Phantom-based prerender instead.
I am using Pedestal (pedestal.io) and in development am running the server from inside a repl.
When I make a change to the application code (such as changing the html template) how can I have the repl reflect these changes automatically upon save of file and have them show up on browser refresh?
You might want to refer to the auto-reload-server sample which uses ns-tracker for watching changes in your code.
I'm creating a web app with Clojure using Selmer templates. I'm using Jetty, and I have to restart it to see my changes. I want to see my changes without restarting the server. How can I achieve this?
I suggest you to migrate to http-kit to get hot code reload, it's very easy
Add [http-kit "2.1.18"] to your project.clj and org.httpkit.server to your use block, and just replace run-jetty with run-server. See details in the link above
Recently I have been experimenting with Firebreath and developed a plugin in order to showcase my c++ projects on my portfolio website. I would like to make it easy for users to look at the projects without downloading files if they are new on my website.
The only issue I have at this point is that when users visit my page, they will receive a message indicating the plugin is missing. I would like to have an option for the users to automatically install my plugin without having to manually download and run it.
The plugin is mainly targetted at Windows users, since the applications are as well. I intend to support Google Chrome, Firefox, Internet Explorer. Currently I am using a MSI installer to install the plugin.
I have found a question similar to this, but I still needed to save the MSI installer and run it.
My question is: What would be the best way to implement this?
There isn't any way to "automatically" do what you want to do. The closest that I have heard of would be to use a java applet that would download and install the plugin for them. This can be pretty reliable on Mac but far less reliable on windows (for a number of reasons, among which the fact that many windows users don't have java installed and that Chrome blocks java applets by default without intervention by the user).
Other options include:
Creating a CAB file installer (only works on IE)
Creating a XPI firefox extension that packages the plugin (requires restarting the browser, only works on firefox)
Creating a CRX chrome extension that packages the plugin (only works on Chrome)
Microsoft ClickOnce used to work pretty well for one click installs of MSI files from a web page, but recently I think it doesn't work on many (if any) browsers; haven't seen it used in awhile, anyway.
There is no "automatic" way to install plugins; that would be considered a severe security issue. This is probably the #1 reason that plugins are as uncommon as they are.
do what adobe does,
create a tiny activeX application downloader, sign the activeX from with cheap SSL
when a user, enters your site, he will automatically be downloading this tiny ActiveX, after installation complete, inside the tiny ActiveX, have some type of batch script to download the EXE from remote server and silently install it.
adobe does this, on every reboot in boot.ini or startups
very easy
I'm new to clojure and compojure and I was wondering if there's a way to do a hot reload of code changes as you can with Ruby's Sinatra (with the shotgun gem) or Java's Play!
I'm following along with this Heroku tutorial so if there's a way to do it with the foreman gem that would work too.
thanks!
Take a look at this SOq:
Compojure development without web server restarts
and this tutorial:
http://mmcgrana.github.com/2010/03/clojure-web-development-ring.html
The suggestion is to use ring's reload middleware.
Recent versions of Compojure make it even easier by incorporating all of the middleware into a single function call:
https://github.com/weavejester/compojure/wiki/Getting-Started
In particular...
(require '[compojure.handler as handler])
; define my-routes in here as normal
(handler/site my-routes)
I'm using some of this in my own projects. It works well, but I'll switch back to choosing ring middleware directly if I decide that I need to add or remove anything.