Is there a NPM package that offers an up-to-date gradient manager generator with steps? - gradient

I am trying to implement some kind of interface that allows me to:
Visualize a gradient with its set breakpoints
Be able to edit those breakpoints, preferrably my moving some kind of bars
Be able to change the color of the breakpoints
Basically, the CSS Gradient Generator website has a component that does exactly what I need, but they do not offer any NPM package.
After searching for a while, in the NPM registry y only found the package Gradient Generator UI, which has some of the features, but it does not seems very maintained.
I searched over 20 gradient packages but I have only found the previously mentioned one. Of course I can implement my own, but I think it is hard to believe that this kind of functionality is not already in an up-to-date NPM package.

Related

How can I search conan for packages by description text?

I've not used Conan before. I've now installed it, and I basically know how to install a package with it, but - I need to find packages.
I've gone here: https://bintray.com/conan/conan-center
and there's a search interface, but it seems to ignore package descriptions and only try to match package names. This is really problematic, for obvious reasons.
My question: Other than scrolling through packages, what can I do to search for packages by matching description text?
There is a new interface, including a new search service, in https://conan.io/center/. The search might be a bit better, but not yet indexing the full description fields.
The packages are now generated from pull requests submitted to the conan-center-index repo, and issues specific to the Web UI, including the search functionality can use the "conan.io/center" label. Some of the current suggestions include navigating by topics. Indexing the descriptions will be done, hopefully soon.
In the meantime, cloning and grepping the conan-center-index repo is a very convenient/pragmatic way to find things including descriptions

How does the "replace" property work with composer?

So how does the "replace" property work with composer? I have read the composer document but still not understand it. Searching for more info hasn't answered my questions.
When I look at the composer.json file on Laravel/Framework on github. I can't see how replace will work. Can someone explain to me how this works? And what the variable "self.version" will equal to?
The Composer documentation gives two basic examples. I'll try to explain:
Lists packages that are replaced by this package. This allows you to fork a package, publish it under a different name with its own version numbers, while packages requiring the original package continue to work with your fork because it replaces the original package.
Suppose your software uses original/library and other/package, which itself also requires original/library.
Now you think that original/library needs to integrate a feature, but the maintainers won't let your suggestion happen in their package. You decide to fork that library under the name better/library, and tag a new release.
Back to your software. Of course it should start using better/library, so you require that instead, but that other/package still requires the original/library - code duplication! How can you make that other package to use your better/library instead without also forking it and only changing the composer.json (you are still compatible to that original/library, so it should work)?
You add a replace key to your composer.json:
"replace": {
"original/library":"1.0.2"
}
Now Composer knows that any package from your better/library is equally good as the original/library when it comes to resolving the dependencies of the other/package.
This is also useful for packages that contain sub-packages, for example the main symfony/symfony package contains all the Symfony Components which are also available as individual packages. If you require the main package it will automatically fulfill any requirement of one of the individual components, since it replaces them.
The same rules, a slightly different angle: Requiring components of a framework is a good approach for any other component that needs some feature. But if you require the full framework in your software, and another library, which subsequently also requires a component of that framework, the replace declaration of the framework allows Composer to not have to install that single component twice, because it is already included in the full framework.
Beware: Placeholders in replaced versions are usually bad
In my original answer I suggested:
"replace": {
"original/library":"1.*"
}
This has consequences: Composer will now treat your library version 1.0.0 to be as good as ANY version 1.x of the original library, even if they fix stuff or add features and release version 1.2.34 some day. This also means that if your other/package some day gets an update and requires original/library:^1.1, the replacement in YOUR library is still active and states that it can replace ANY version 1.*, even without you updating anything inside - which it can not, your old code will never implement new features of the original library without you doing some work, but the replacement states exactly this.
So in essence: Avoid wildcard versions in the replacement version! If you use them, you make a statement about the future that you cannot know or predict (unless you can control original/library, but even then be very careful). Always use a specific version of the original/library that you know and can re-implement completely.
When you create your own package, you define in your composer.json what kind of packages does it provide which basically tells Composer that your package has it already installed, so no need to install it again.
If you use replace property, it tells Composer that your package wants to replace the original package with your own fork, so other packages don't need to install it.
For example if a/a package requires b/b and you tell to replace b/b, it won't be downloaded on Composer install/update.
This is explained in more details in here: How does the “replace” property work in Composer?

OpenCV as a web service

i am looking into facial recognitions using Local Binary Pattern Histogram have came across OpenCV. Within OpenCV, the Local Binary Pattern Histogram has a function which compares histograms "compareHist". How can i perform this function on a web server?. Is it possible to run OpenCV on a web server? (i am thinking about writing the whole function myself however it is based on multiple custom created classes and its rather troublesome - what language should i use? - this would be my last resort).
OpenCV comes with cv::FaceRecognizer, which includes Eigenfaces, Fisherfaces and Local Binary Patterns Histograms. It comes with a very detailed documentation, please see:
http://docs.opencv.org/trunk/modules/contrib/doc/facerec/index.html
No need to implement it yourself. If you want to do this in another language, then you can easily look up the implementation in the contrib module of OpenCV. I am sure you can get some impression there.
As for the webserver. If you have a real server, then sure you could put OpenCV up there and interface with it. If you want to get something going real quick, have a look at the OpenCV Python bindings for cv::FaceRecognizer. I did a post on the OpenCV QA page just yesterday:
http://answers.opencv.org/question/253/broken-python-bindings-with/?answer=255#post-id-255
However, it's a bit complicated due to an error on my side. There was a bug in the official OpenCV 2.4.2 release, so for the Python bindings to work you'll need the trunk version. Note, that the source code is now hosted with git, so you can get it with:
git clone git://code.opencv.org/opencv.git
for example. Then if you are in Linux, you can follow this tutorial on how to install OpenCV:
http://docs.opencv.org/trunk/doc/tutorials/introduction/linux_install/linux_install.html
or if you are in Windows, then:
http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html
might help. Make sure you have python-dev and python-numpy installed, so the Python bindings are compiled. If you are in Windows, simply install Python2.7 and NumPy (http://www.numpy.org).
You might be interested in my Guide to Face Recognition with Python also, which is available at:
https://github.com/bytefish/facerecognition_guide
That shows a really lightweight implementation of two algorithms.
Disclaimer I am a founder.
Algorithmia provides OpenCV as a service through our API.
http://algorithmia.com/users/opencv

What are best practices for making Erlang releases?

I've been checking out Faxien+Sinan and Rebar, and the basic philosophy of Erlang OTP seems to be, install applications and releases on a single Erlang image instance. What are the best practices for keeping releases self contained? Is there a way to package releases such that you don't have to modify the site for machines that you're deploying to? How about gathering all dependencies into the codebase for management?
Perhaps I'm going against the grain... I come from a Java background and the philosophy of "nothing pre-installed but the JVM" seems very different.
IMHO this can't be answered in a few sentences. You should have to read some parts of the included documentation, especially "Erlang/OTP System Documentation" (otp-system-documentation-X.Y.Z.pdf, with X.Y.Z being the version number), or have a look at the book "Erlang and OTP in Action" because throughout this book there is "one" example of a "service" with different "parts" from the first steps, using Erlang/OTP concepts and finally building a "release".
IMHO this is currently the best book around, because it not only introduces Erlang, but also shows what OTP is and how OTP is used for a project. And it is not just a collection of loose samples, but everything is build around a single project.
I'll describe the approach that currently works for me for regular (often daily) releases to a small number of instances on EC2:
I set up my project with rebar and check it into github.
All of my dependencies are listed in my rebar.config file (they too are on github).
My Makefile looks similar to what I described here.
My EC2 image only has a regular build of erlang and no other libs installed by default.
To create a new node, I spin up an instance, clone my git repository, and run make. This will fetch my dependencies and build everything.
To update my code I do a git pull and a rebar update-deps. Depending on what changed I may restart the node or, quite often, I'll attach to the running node and reload the updated modules. It helps to have start and attach scripts as part of your project.
It may be helpful to look at how a project like webmachine is packaged.
I don't know much about the standard OTP release management system, other than it looks like a lot of work. Because this seems counter to rapid deployment, I never gave it a serious try - though I'm certain it makes sense for other projects.

how-to: programmatic install on windows?

Can anyone list the steps needed to programatically install an application on Windows. Aside from copying the files where they need to be, what are the additional steps needed so that your app will be a first-class citizen in Windows (i.e. show up in the programs list, uninstall list...etc.)
I tried to google this, but had no luck.
BTW: This is for an unmanaged c++ application (developed in Qt), so I'd rather not involve the .net framework if I don't have to.
I highly recommend NSIS. Open Source, very active development, and it's hard to match/beat its extensibility.
To add your program to the Add/Remove Programs (or Programs and Features) list, add the following reg keys:
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\PROGRAM_NAME]
"DisplayName"="PROGRAM_NAME"
"Publisher"="COMPANY_NAME"
"UninstallString"="PATH_TO_UNINSTALL_PROGRAM"
"DisplayIcon"="PATH_TO_ICON_FILE"
"DisplayVersion"="VERSION"
"InstallLocation"="PATH_TO_INSTALLATION_LOCATION"
I think the theme to the answers you'll see here is that you should use an installation program and that you should not write the installer yourself. Use one of the many installer-makers, such as Inno Setup, InstallSheild, or anything else someone recommends.
If you try to write the installer yourself, you'll probably do it wrong. This isn't a slight against you personally. It's just that there are a lot of little details that an installer should consider, and a lot of things that can go wrong, and if you want to write the installer yourself, you're just going to have to get all those things right. That means lots of research and lots of testing on your part. Save yourself the trouble.
Besides copying files, installation tasks vary quite a bit depending on what your program needs. Maybe you need to put an icon on the Start menu; an installer tool should have a way to make that happen very easily, automatically filling in the install location that the customer chose earlier in the installation, and maybe even choosing the right local language for the shortcut's label.
You might need to create registry entries, such as for file associations or licensing. Your installer tool should already have an easy way to specify what keys and values to create or modify.
You might need to register a COM server. That's a common enough action that your installer tool probably has a way of specifying that as part of the post-file-copy operation.
If there are some actions that your chosen installer tool doesn't already provide for, the tool will probably offer a way to add custom actions, perhaps through a scripting language, or perhaps through linking external code from a DLL you would write that gets included with your installer. Custom actions might include downloading an update from a specific Web site, sending e-mail, or taking an inventory of what other products from your company are already installed.
A couple of final things that an installer tool should provide are ways to apply upgrades to an existing installation, and a way to uninstall the program, undoing all those installation tasks (deleting files, restoring backups, unregistering COM servers, etc.).
I've used Inno Setup to package my software for C++. It's very simple compared to heavy duty solutions such at InstallShield. Everything can be contained in a single setup.exe without creating all these crazy batch scripts and so on.
Check it out here: http://www.jrsoftware.org/isinfo.php
It sounds like you need to check out the Windows Installer system. If you need the nitty-gritty, see the official documentation. For news, read the installer team's blog. Finally, since you're a programmer, you probably want to build the installer as a programmer would. WiX 3.0 is my tool of choice - open source code, from Microsoft to boot. Start with this tutorial on WiX. It's good.
The GUI for innosetup (highly recommended) is Istool
You can also use the MSI installer built into Visual Studio, it's a steeper learning curve (ie is a pain) but is useful if you are installing software in a corporate environment.
To have your program show up in the Start program menu,
You would need to create folder
C:\Documents and Settings\All Users\Start Menu\Programs
and added a short cut to the program you want to launch.
(If you want your application be listed
directly in the Start menu, or in the programs submenu,
you would put your short cut in the respective directory)
To programically create a short cut you can use IShellLink
(See MSDN article).
Since you want to uninstall, that gets a lot more involved because you don't want to simply go deleting DLLs or other common files without checking dependencies.
I would recommend using a setup/installation generator, especially nowadays with Vista being so persnickety, it is getting rather complicated to roll your own installation
if you need anything more than a single executable and a start menu shortcut.
I have been using Paquet Builder setup generator for several years now.
(The registered version includes uninstall).
You've already got the main steps. One you left out is to install on the Start Menu and provide an option to create a desktop and/or quick launch icon.
I would encourage you to look into using a setup program, as suggested by Jeremy.