Coldfusion UserAgent Logs? - coldfusion

Are there any default ways to log what user agents hit your server? I need to compile a list of browsers that visit our website so we know what we best can support.
Thanks!

log CGI.HTTP_USER_AGENT, maybe on Application.cfc's onRequestStart()?
or... use Google Analytics?

Use the web server logs or an analytics tool like Google's. If you do not want to, or cannot use, Google use either of the following to help you:
Microsoft Log Parser and Log Parser Lizard (one relies on the other). Parser is a command line tool that provides SQL syntax for parsing and reporting against IIS logs, and has the ability to work with several other formats as well. Lizard provides a GUI on top of it.
*nix command line grep, sed, sort: if you don't use *nix download Cygwin to have these tools at your disposal anyway. This is the way I'll typically chomp on Apache logs and this will work for any sort of log you can imagine.
As far as doing it with ColdFusion #Henry provided a good answer.

Related

Headless chrome cli in Production

I will be doing some pdf generation for my application. Currently, my plan is to create HTML using templates and convert them to PDF.
The pdf's aren't long. Maximum 3 pages. And approximately we will be making approx 100 docs in a day.
I was happy with the results I got from chrome --headless in my local machine. I called the cli command directly from my clojure code. So far so good. Looking at the number of wrappers available (Browserless, Chromeless, Puppeteer, ...) I'm not sure about the scalability factor in production.
Is it safe to use/call the chrome cli directly in production boxes?
What will I miss if I skip these wrappers?
My server side stack is Clojure/Compojure/Leiningen. Any insights/alternatives are appreciated.
I'm using Athena PDF for pdf generation in combination with Clojure:
https://github.com/arachnys/athenapdf
It has a REST interface. Since it runs in Docker its easy to scale.
Instead of detouring through html and chrome, I'd just use a pdf creating library such as clj-pdf. Here is a nice blog post about it.
p.s. If you dont mind running a third program to generate the pdf, I would have used emacs with org-mode (or heck, even writing it in elisp altogether) ;)

Foswiki: Uploading and downloading topics without FTP

I have a Foswiki wiki on a server. Is it possible to script the following without FTP access (for various reasons I can't use it):
Download a topic's wikitext, modify it locally, then upload it again (overwriting the topic)
Upload wikitext to a new topic
I've been doing these tasks manually, but I'd like to automate them. I've looked into the Foswiki API and a few plugins, but nothing seems capable of doing this.
Is there a way? (any programming language)
If you have web access, you could drive the bin/view and bin/save scripts remotely from a script.
Take a look at our BuildContrib upload target for an example. It gets a strikeone key and downloads the original topic to recover any form data. It then uploads the topic text, creating a new version. It's written in perl, and uses LWP.
https://github.com/foswiki/distro/blob/master/BuildContrib/lib/Foswiki/Contrib/BuildContrib/Targets/upload.pm
The following isn't(!) the right solution (sure exists an nice Foswiki-way approach), but if you know perl, you can do anything with the:
Install Firefox
install MozRepl addon into it
Install the WWW::Mechanize::Firefox perl module
Now, you can script anything what you can do directly from the browser, e.g. logging into the Foswiki, click buttons, save topics, etc..etc. Drawback - it isn't an easy way - you need to know many details.
Myself using this technique for testing.

Web API (like github REST API) for a personal Git server repo to enable "git log"?

I probably end up re-inventing parts of the github REST API for my own repo server. But maybe there is some server script to do that already out there? Or maybe you have other suggestions?
This is my use case:
I am developing a Firefox Extension, that shall display the data of a
git log -- <path>
I always could write a little server script that implements the well developed JGit and does the "git log" command there. But then, the FF extension depends on that server script ;(
I was wondering, if there exists something like the github REST API for "not-github"-repos that would be more standard as my little server script?
I also thought about a Git JS Client, like Git.JS (apparently the only JS Client; workes with node.js; Unfortunatly the project is no more active and has no documentation.) . However, I don't need a full client. I just want to retrieve some information Read Only from the remote master repo.
Although I am late to the party I have noticed a few a might contribute to the answer.
Orion Git API Orion is an Eclipse project
RESTFul Git from Hulu on github
If you haven't tried it, GitBlit is a VERY cool option. I have multiple installations on a few windows dedicated servers that I pull together using a REST API. I had it up and running in 5 minutes, in Windows, using the "GO: Single-Stack Solution".
Gitblit GO is an integrated, single-stack solution based on Jetty.
You do not need Apache httpd, Perl, Git, or Gitweb. Should you want to use some or all of those, you still can; Gitblit plays nice with the other kids on the block.
This is what you should download if you want to go from zero to Git in less than 5 mins.
I would say you definitely need to implement some kind of server-side code by your own.
You can choose any server-side language you like. I believe ruby or python will work fine. Than create simple web-site with one page embedding output of git log according to the parameters given.
All other options will not work for you, I believe. You cannot remotely access git repository's history due to distributed nature of git — you can read history of your local repository only.
Reading that web-page by your extension and parsing output will give you what you need.

Cruise control with C++

Is it possible to use the CruiseControl tool with a C++ (Mingw) project on Windows? I need to be able to download the latest sources from XVN, build them, send reports by mail. The application is using http server (lightpd) for work.
So main question is have to use it for email notifications?
Problem is I dont see any destination field in email tag.
I am interested in sending email notifications after build which executes in batch file.
E. g. in my config file I call batch file which executes build, after that I need to send email notification, how can I do it ?
Of course it is possible. There is a Java for Windows, a command line SVN clients, you can invoke gmake or any other build system you are using along with Cygwin, there is even a support for a Visual Studio projects if you need it. There are a lot of people using Cruise Control for C++ projects, thus a lot of documentation, tutorials and examples available online.
Perhaps not exactly what you're asking for, but is there anything preventing you from using Jenkins? People I've talked to that maintains the continuous integration for a living that have used both Jenkins as well as cruise control prefers Jenkins. Of course the bonus with Jenkins is that it's free.
If you can create a script that checks out and builds your project from the command line (in Cygwin's bash, for example), then you can certainly integrate the build into cruise control or Jenkins.
I don't know much about cruise control, but we use Jenkins a lot, and even though it has bugs that need to be worked around overall we find it extremely useful for CI and nightly build jobs.
Regarding the email aspect, Jenkins can be configured to watch the SVN log and when a build fails it can send an email to the people that committed changes since the last successful build. This functionality can be enabled with minimal configuration. There are add-ons that allow you to configure the content of the emails as well.

File Extension to MIME Type Web Service?

Are there any web services which will allow me to provide a file extension and it would return a list of possible MIME types?
For example:
http://mimetype.com/getMime/doc
Which could return:
application/msword,application/docappl/text,application/vnd.msword,application/vnd.ms-word,application/winword,application/word,application/x-msw6,application/x-msword
I don't want to use Urlmon.dll and I would prefer not having to keep my own list up-to-date.
Thanks
I just created this as part of my mimetype <-> icon service
http://stdicon.com/
For example :
http://stdicon.com/ext/html
It runs on appengine so it should have high availability.
The only thing I could imagine would be parsing the list which comes with the apache server
mime.types. The list is maintained by The Apache Software Foundation and depends on www.iana.org
Though its not exactly what you are asking for, this information is available via search by format in the PRONOM registry. The result is more fine-grained than MIME types, but you can get MIME info if available for the results (e.g. here, in the 'identifiers' section). There is also the DROID tool available to access this information via GUI, Java API or command line interface.
Sorry that I don't have a webservice for the task on hand, but you could use the fileext page and maybe parse the response if you can query the extension programmatically. Maybe a first step in the right direction.
This webservice could be very simple, a small DB / in memory store which could be as simple as a Dictionary<String, String> and just do a key lookup and return the result.
The first dataset could be (for example) based on http://www.webmaster-toolkit.com/mime-types.shtml.
The problem would probably be the hosting of such a webservice.
I don't know if there is a web service that would do this, but the libmagic library (http://en.wikipedia.org/wiki/Libmagic) is used for identifying filetypes and might be helpful for you.
The only thing that comes to mind is to parse output from http://www.file-extensions.org/
It won't give you the MIME type, but the good olde' Microsoft File Association Web Service could still help you. You access it this way:
http://shell.windows.com/fileassoc/0409/xml/redir.asp?Ext=xls
where 0409 means English (US) and xls is the file extension. On the plus side, it will be there and constantly updated... well, until Microsoft decides to pull the plug. Which can happen any time.