groovyScript in Live Template for WebStorm - webstorm

Is that possible to use (custom) groovyScript in Live Template in WebStorm IDE? I've seen that in Intellij IDEA, but it does not even appear in WebStorm docs. What I want to achieve is have something like:
groovyScript("def uuid=\"uuid\".execute().text; return uuid")
This always returns an empty string for the variable :(

AFAIK groovyScript is not available in PhpStorm/WebStorm (WI-19413 -- status "Declined") as it requires some extra modules (from Java world AFAIK) that only available in full IntelliJ IDEA.
But they have plans to implement JavaScript support in Live templates instead -- https://youtrack.jetbrains.com/issue/WI-29141 -- star/vote/comment this ticket to get notified on any progress.
Unfortunately this ticket is not very specific where we can expect this to be implemented as "Fix versions: x.x pool" means very broad "in one of the future versions". Definitely worth asking in the ticket.

Related

Start my program at login in MacOSX

I am developing a program in C++ in MacOSX, and I want to add an option to start my program at login. I investigated some possible solutions in MacOSX, but I did not understand well which is the best/the official suggested one nowadays. Some of them are easy, some more complicated, and it seems that the easier ones are not the suggested ones for the future.
Here a resume of what I found:
using OsaScript: it seems the simplest one, but I really would like a C/C++ API, and not using the osascript command
From the official documentation, I can see the 'Service Management framework', but I want the user be able to see my app started at login in the preference, and I would not like to create another helper bundle...
Again from the official documentation, I can see Launch Services Reference, but I am not sure it is what I need. I did not find any example in C/C++, and if I search for the 'Login' keyword, I just see two deprecated functions therein...
Technical Note TN2228 it seems a complete guide and with also some example therein, but it speaks about creating a 'authorization plug-in'. Do I really need that to start my app at login?
Creating Launch Daemons and Agents it seems the preferred way to launch a Daemon, but my app is not really a daemon...
So, what do you suggest me to do?
Do you know some other way to make my programm running at login?
Which one do you think is the easiest but not deprecated solution?
Do you have some example in C/C++? All the example I found are in other languages...
Thanks everybody
PS:
At the end I chose the OsaScript solution (one line of code...)
From this example you can see that you can set the property "name" when you add your item so that you can delete it later.
I am still looking for a easy C++ solution...

How to control output from Twisted-trial tests?

How to control output from Twisted-trial tests?
I have looked up for different solutions, but I'm quite new to testing, so I can't find a fitting solution or can't use it correctly.
In general, I try to make autotesting system for my project like BuildBot. But BuildBot doesn't fit me because it reacts only to "On change sources" hook from Mercurial and I want to use other hooks too.
On THIS page from BuildBot documentation I found this information:
One advantage of trial is that the Buildbot happens to know how to
parse trial output, letting it identify which tests passed and which
ones failed. The Buildbot can then provide fine-grained reports about
how many tests have failed, when individual tests fail when they had
been passing previously, etc.
Does it mean that there is no way but to parse information from test-output?
Other possible solutions?
Besides, I looked up in Twisted documentation and found this class IReporter.
Is it a solution and if it is, how can I use it?
If it isn't, are there any other solutions?
P.S. Please, note, that tests have already been written, so I can only start them and can't modify source code.
You can format output from trial arbitrarily by writing a reporter plugin. You found the interface for that plugin already - IReporter.
Once you write such a plugin, you'll be able to use it by adding --reporter=yourplugin to your trial command line arguments.
You can see the list of reporter plugins that are already available on your system using trial --help-reporters. If you have python-subunit installed then you'll see subunit which is a machine-parseable format that might already satisfy your requirements. Unfortunately it's still a subunit v1 reporter and subunit v2 is better in a number of ways. Still, it might suffice.

Is there a standard way to colorize the output of boost::test

I am working on a set of C++ unit tests in boost::test. After working with the Google test framework, I really appreciate the ability to quickly visually parse colorized output in order to tighten the development cycle. Currently, I'm considering looking into using the gnu source-highlight to create a new language definition, but if there is a way of doing it inside of boost::test, that would be preferable.
Is there a standard way of colorizing boost::test output?
ETA
It looks like the author added support for color:
http://boost.2283326.n4.nabble.com/test-new-feature-colored-output-td2660465.html
However, it is disabled by default. I assume this is managed at compile time. How can this feature be enabled?
ETA2
Another possible option, haven't investigated yet: https://pypi.python.org/pypi/pyrg
The parameters that can be passed to the unit test framework seem to be in this file:
boost\test\impl\unit_test_parameters.ipp
however, I cannot see any *color* related variable in there (boost 1.50 or 1.54). So I guess the feature is still in somewhere in a repository. I join your to say that color output is a nice feature (logs/summaries of GTest are also better).
EDIT:
The feature is in trunk:
http://svn.boost.org/svn/boost/trunk/boost/test/impl/unit_test_parameters.ipp

Django A/B Split Testing Packages (None I've found are well-documented and up-to-date.)

There are two main schools of thought for doing A/B (Split) Testing:
Javascript-based solutions such as Optimizely, Google Analytics Content Experiments.
Server-side solutions such as Django-AB, Splango, and django-lean. (Also, writing your own.)
My understanding is that Javascript-based solutions are spectacular for "which color button converts better," but not so great for switching out entire page layouts, and completely unworkable for trying out large functional changes such as the sequence of pages in a funnel.
That leads me towards a server-side solution. I'm not crazy about coding my own, and will do so only if there is no other option. I'm trying to add value by improving the core functionality of my site, not by creating a better split-testing framework.
The Django apps I've found for split testing are various mixtures of unmaintained, undocumented, documented incorrectly, and incompatible with Django 1.5. This surprises me, because the Django and Python communities seem to have a strong focus on good documentation. I'm also very surprised that none of the testing frameworks I've tried has been compatible with Django 1.5 -- is testing not as core a part of the philosophy in the Django/Python world as it is in Rails?
Here's what I've found:
Splango https://github.com/shimon/Splango -- Not compatible with Django 1.5 (although most compatibility bugs I found were trivial to fix). Largely un-touched since October 2010, except for a fix August 2012 which claims to make sure templates get included in the install. Since templates don't get included in the install when Splango is installed via PyPI, either the fix didn't work or didn't get submitted to PyPI. Documentation is largely accurate, but doesn't completely cover how to set up tests and get reports. It tells you how to configure the template to gather the data, but there appears to be additional steps required in the admin interface which are completely undocumented, and I'm not sure I've done them properly.
Django-lean. Original at https://bitbucket.org/akoha/django-lean has not been updated since July 2010. There is an apparently "blessed" fork at https://github.com/anandhenry2002/django-lean which has not been changed since May 2012, when it was copied over from the original. The original's documentation is incorrect in ways that make following the examples impossible. (Though you can probably muddle your way through, as I did.) The new version's documentation has formatting problems that make it difficult to read on github. (This appears to be because it's the unchanged documentation from the old project, and BitBucket syntax doesn't work on Github.) The django-lean Google Group has not had a message since July 2012.
django-mini-lean https://github.com/DanAncona/django-mini-lean -- Updated as recently as February 2013, but undocumented.
Leaner - https://bitbucket.org/brianjinwright/leaner -- Last updated July 2012, and no docs.
Django-AB -- Last updated May 2009. Is not a package, and can't be installed via PIP or PyPI. After placing the checkout in my django app folder (and renaming the folder to ab) and following the installation instructions, I get an error loading the template loader that I have not tracked down further.
So far Splango appears to be the winner, as I've actually been able to get it more-or-less working (by manually installing the templates, and then editing them to fix Django 1.5 incompatibilities).
Can anyone point me to anything I've missed?
You have missed this app : https://github.com/mixcloud/django-experiments + https://github.com/disqus/gargoyle/
And then there's waffle: http://waffle.readthedocs.org/
It's simple, updated, maintained, but not very feature rich, it doesn't have any analytics/reporting stuff integrated. But then again, google analytics or mixpanel type of service is better for this.
I first looked at Django-AB and that is almost what I wanted, but I couldn't get it to work either. After looking at django-experiments and deciding I didn't want to mess around with redis yet, I decided to roll my own. I've tried to package it up nicely and make it easy to use for the beginner. It's super basic.
https://github.com/crobertsbmw/RobertsAB
You can swap out entirely different page layouts with Google Analytics Experiments (their default experiment setup will redirect users to a different URL for each variation you have), although in general its much easier to interpret why something is more successful if you test smaller things against each other.
You are right that testing different funnels and user flows against each other using Google Analytics would require a lot of manual setup; although theoretically you could do it by swapping out different links and tracking your users with UTM campaigns.
For smaller A/B tests within the same page, I ended up using Google Analytics Experiments and writing a custom Django CMS plugin for adding a few variant options to a template, which queries the Google Analytics API and displays the correct variant using Javascript.

Spell checker for comments, strings, maybe more

I am looking for a spell checker for c++ source code. Unfortunately all I can find is Visual Studio specific. I would like something which works on Linux.
Edit:
Ultimately I want to automate it in some way. I am not very proficient in spell checking, but what I am thinking of is a not-interactive console tool which prints error messages, or something like that.
Personally I use vim, but not everyone on the project does of course.
Currently we are using svn so it is possible to integrate it into the pre-commit-hook maybe?
Don't you guys do something similar?
Eclipse (Java based so will do mac, linux etc.) has spellcheckers built in. With the CDT plugin you can edit and build C++ code.
Vim also supports spell checking.
See the other question for more.
Emacs too has spell checking, flyspell-prog-mode, is the one I use, it is a (very!) personal preference which one works best for you.
The automating the spell check idea is a much trickier one. The best you can hope for is one that will tell you if there are spelling errors. That's trickier than it sounds, especially with code comments which may have all sorts of valid abbreviations which are not real words.
Having a company policy that whatever people have their EDITOR environment variable set to has a spell check enabled, should cut down on the spelling errors in commit messages, for example.
I found something!
svn co svn://anonsvn.kde.org/home/kde/trunk/quality/krazy2 krazy2
this is part of the quality management of KDE.
Besides a multitude of checks (KDE-specific, qt-specific, cpp-specific, ...) there is automated spell checking.
hope this helps
Which editors do you use? Many of them have spell checking abilities. E.g., gedit just needs to have the spellcheck plugin enabled.
You can check out some alpha code I just whipped up for a similar purpose: pyspellcode. It's Zlib licensed and uses clang and hunspell.
No idea how pyspellcode compares to what KDE does/provides but am happy to receive comparisons and will prioritize its development more if there's interest it.
At just over 200 lines, I'm guessing pyspellcode is at least lighter weight than KDE's solution though KDE's solution I imagine is way more tested.