I'm having trouble finding a solution to this. It's quite possible I'm using the wrong terminology so feel free to correct me and put me on the right path.
I'm using to using a plugin called simple-schema with meteor that cleaned, null or "" fields when you used insert to create a document. See below.
Uncleaned document
{
"_id": "f3iujiimjHo4m3Cqj",
"monday": true,
"tuesday": ""
}
Cleaned document
{
"_id": "f3iujiimjHo4m3Cqj",
"monday": true
}
I can't find anything on how this is done. Can someone please tell me what I'm missing.
I use obj-clean to do this.
install
meteor npm install --save obj-clean
Usage
import clean = from 'obj-clean'
const dirty = {
"_id": "f3iujiimjHo4m3Cqj",
"monday": true,
"tuesday": ""
}
const cleaned = clean(dirty)
Thats it, more on the npm package page
Related
I am using Artifactory 4.8.0 (OSS)
I have deployed artifacts to 2 repos: libs-devel and libs-release-candidates.
When I execute
$ curl -u denham:password -X GET https://artifactory.server/artifactory/api/search/artifact?name=MyPackage&repos=libs-devel
The response I receive is:
"results" : [ {
"uri" : "https://artifactory.server/artifactory/api/storage/libs-devel/com/acme/MyPackage/17.10.1-SNAPSHOT/MyPackage-17.10.1-20170908.092803-1.pom"
}, {
"uri" : "https://artifactory.server/artifactory/api/storage/libs-devel/com/acme/MyPackage/17.10.1-SNAPSHOT/MyPackage-17.10.1-20170908.092803-1.war"
}, {
"uri" : "https://artifactory.server/artifactory/api/storage/libs-release-candidates/com/acme/MyPackage/17.10.1-24/MyPackage-17.10.1-24.pom"
}, {
"uri" : "https://artifactory.server/artifactory/api/storage/libs-release-candidates/com/acme/MyPackage/17.10.1-24/MyPackage-17.10.1-24.war"
}, {
"uri" : "https://artifactory.server/artifactory/api/storage/libs-devel/com/acme/MyPackage/17.9.3-SNAPSHOT/MyPackage-17.9.3-20170907.105908-1.pom"
}, {
"uri" : "https://artifactory.server/artifactory/api/storage/libs-devel/com/acme/MyPackage/17.9.3-SNAPSHOT/MyPackage-17.9.3-20170907.105908-1.war"
} ]
}
I would expect that the results would be limited to the the libs-devel repo, as specified in the url.
Have I done something wrong? Is this a bug?
Here's the API reference (for version 4) that I followed:
https://www.jfrog.com/confluence/display/RTF4X/Artifactory+REST+API#ArtifactoryRESTAPI-ArtifactSearch(QuickSearch)
Thanks in advance.
Yes. This is correct.
You will be able to limit the search query to specific repositories by adding the 'repos' parameter on this rest call.
We (JFrog) are not familiar with a bug on this subject and it is working on our side (Artifactory OSS - same version: 4.8.0).
We will be interested to know if the same is working for you using the UI quick search.
If using curl, the full URL needs to be encapsulated in quotes. Otherwise the & is left off the request.
I tried using Postman and it works as expected.
Bested by quote marks. :-(
I am working on the Angular 2.0-Meteor tutorial and on step 20 "Handling Files with CollectionFS" I am getting an error.
"Cannot find module 'meteor/jalik:ufs'." I have tried removing and adding jalik:ufs and calling meteor reset but this error seems to persist.
I get the error when trying to run the sample code included before Step 21 as well.
It is related with typings. Right now I don't think there is an existing typings for this package.
So you can write your own typings.
Or use the temporary way to remove the warning:
Remove import { UploadFS } from 'meteor/jalik:ufs';. Then add declare const UploadFS: any; in any file.
Tutorial was updated in between:
See Point 21.22 Declare meteor/jalik:
Link
declare module "meteor/jalik:ufs" {
interface Uploader {
start: () => void;
}
interface UploadFS {
Uploader: (options: any) => Uploader;
}
export var UploadFS;
}
I got some problems with the QT Installer - already done all tutorials (especially http://doc.qt.io/qtinstallerframework/noninteractive.html) but i am still a real newbie
What i need:
an installer with a language Selection as first page
adding a second (save) path in TargetDirectory
What i have:
an installscript.js (package root)
an ControlScript.js (path in config.xml)
What i tried in the ControlScript.js:
function Controller()
{
QMessageBox.information("DEBUG", "DEBUG", "DEBUG", QMessageBox.Ok);
installer.addWizardPage(component, "Start", QInstaller.Introduction);
QMessageBox.information("TEST", "TEST", "TEST", QMessageBox.Ok);
}
the Start.ui i placed at the config path and package root but nothing happens... the second MessageBox is never shown - the installer seems to be crashed
function Controller()
{
}
Controller.prototype.IntroductionPageCallback = function()
{
installer.addWizardPageItem(component ,"lineEdit",QInstaller.TargetDirectory);
}
same - nothing happens here installer crashed
hope you can help me to fix the code =)
and can someone please tell me how to change the language or setting a new pixmap (form an existing ressource) while the installer is running?
i wrote this incomplete code in installscript.js:
NewLanguageSeted = function()
{
var widget = gui.pageWidgetByObjectName("DynamicLanguageSelection");
QMessageBox.information("DEBUG", "DEBUG", "DEBUG", QMessageBox.Ok);
widget.Icon.setPixmap("");
installer.languageChanged();
QMessageBox.information("LanguageSelec", "LanguageSelec", "LanguageSelec", QMessageBox.Ok);
}
installer.languageChanged();
will Change all texts based on *.qm files - but how can i get / set the actual language?
widget.Icon.setPixmap("");
changes the pixmap - but i need to know what i have to insert in ""
for the ui file i use a resource file:
<property name="pixmap">
<pixmap resource="../../../resource/resource.qrc">:/DuerrPictures/watermark.png</pixmap>
As far as I know, installer pages canno't be added from the controller script. If you run the installer from QtCreator, you will see the corresponding debug output, which says something like component type is not defined.
To add the page you have to do it inside of the component script (e.g. the constructor). This one will be executed immediatly after you selected one of the 3 checkboxes. The .ui-file has to be part of the package, too:
Regarding the second linedit - It is the same problem! The function takes a component as argument - it has to be done inside the installscript.js.
installscript.js:
function Component()
{
QMessageBox.information("DEBUG", "DEBUG", "DEBUG", QMessageBox.Ok);
installer.addWizardPage(component, "Start", QInstaller.Introduction);
installer.addWizardPageItem(component ,"lineEdit",QInstaller.TargetDirectory);
QMessageBox.information("TEST", "TEST", "TEST", QMessageBox.Ok);
}
The pixmap should be settable by using the very same path you used in your .ui-file, i.e. :/DuerrPictures/watermark.png. Have your tried that?
And for your language problem - sorry, but I don't know anything about that. Check out the Scripting API - all script classes are listed there, maybe you can find something.
I'm using grunt-contrib's concat and uglify modules to process some javascript. Currently if src/js/ is empty, they will still create an (empty) concat'd file, along with the minified version and a source map.
I want to task to detect if the src/js/ folder is empty before proceeding, and if it is, then the task should skip (not fail). Any ideas how to do this?
The solution may not be the prettiest, but could give you an idea. You'll need to run something like npm install --save-dev glob first. This is based on part of the Milkshake project you mentioned.
grunt.registerTask('build_js', function(){
// get first task's `src` config property and see
// if any file matches the glob pattern
if (grunt.config('concat').js.src.some(function(src){
return require('glob').sync(src).length;
})) {
// if so, run the task chain
grunt.task.run([
'trimtrailingspaces:js'
, 'concat:js'
, 'uglify:yomama'
]);
}
});
A gist for comparison: https://gist.github.com/kosmotaur/61bff2bc807b28a9fcfa
With this plugin:
https://www.npmjs.org/package/grunt-file-exists
You can check file existence. (I didn't try, but the source looks like supporting grunt expands. (*, ** ...)
For example like this::
grunt.initConfig({
fileExists: {
scripts: ['a.js', 'b.js']
},
});
grunt.registerTask('conditionaltask', [
'fileExists',
'maintask',
]);
But maybe if the file doesn't exist it will fail with error instead of simple skip.
(I didn't test it.)
If this is a problem you can modify a bit the source of this plugin to run the related task if the file exists:
The config:
grunt.initConfig({
fileExists: {
scripts: ['a.js', 'b.js'],
options: {tasks: ['maintask']}
},
});
grunt.registerTask('conditionaltask', [
'fileExists',
]);
And you should add this:
grunt.task.run(options.tasks);
In this file:
https://github.com/alexeiskachykhin/grunt-file-exists/blob/master/tasks/fileExists.js
after this line:
grunt.log.ok();
Maybe this is just a more up-to-date answer as the others are more than a year old, but you don't need a plugin for this; you can use grunt.file.expand to test if files matching a certain globbing pattern exist.
Update of #Kosmotaur's answer (path is just hard-code here though for simplicity):
grunt.registerTask('build_js', function(){
// if any file matches the glob pattern
if (grunt.file.expand("subdir/**/*.js").length) { /** new bit here **/
// if so, run the task chain
grunt.task.run([
'trimtrailingspaces:js'
, 'concat:js'
, 'uglify:yomama'
]);
}
});
I created a migration and ran it. It says it worked fine, but nothing happened. I don't think it is even connecting to my database.
My Migration file:
var util = require("util");
module.exports = {
up : function(migration, DataTypes, done) {
migration.createTable('nameOfTheNewTable', {
attr1 : DataTypes.STRING,
attr2 : DataTypes.INTEGER,
attr3 : {
type : DataTypes.BOOLEAN,
defaultValue : false,
allowNull : false
}
}).success(
function() {
migration.describeTable('nameOfTheNewTable').success(
function(attributes) {
util.puts("nameOfTheNewTable Schema: "
+ JSON.stringify(attributes));
done();
});
});
},
down : function(migration, DataTypes, done) {
// logic for reverting the changes
}
};
My Config.json:
{
"development": {
"username": "user",
"password": "pw",
"database": "my-db",
"dialect" : "sqlite",
"host": "localhost"
}
}
The command:
./node_modules/sequelize/bin/sequelize --migrate --env development
Loaded configuration file "config/config.json".
Using environment "development".
Running migrations...
20130921234513-initial.js
nameOfTheNewTable Schema: {"attr1":{"type":"VARCHAR(255)","allowNull":true,"defaultValue":null},"attr2":{"type":"INTEGER","allowNull":true,"defaultValue":null},"attr3":{"type":"TINYINT(1)","allowNull":false,"defaultValue":false}}
Completed in 8ms
I can run this over and over and the output is always the same. I've tried it on a database which I know to have existing tables and try to describe those tables and still nothing happens.
Am I doing something wrong?
EDIT:
I'm pretty sure I'm not connecting to the db, but try as I might I cannot connect using the migration. I can connect using sqlite3 my-db.sqlite and run commands such as .tables to see tables I have created previously, but I cannot for the life of me get the "nameOfTheNewTable" table created using a migration. (I want to create indexes in the migration too). I have tried using "development", changing values in the config.json like the host, database (my-db, ../my-db, my-db.sqlite), etc.
Here's a good example, in the config.json I put "database" : "bad-db" and the output from the migration is exactly the same. When it is done, there is no bad-db.sqlite file to be found.
You need to specify the 'storage' parameter in your config.json, so that sequelize knows what file to use as the sqlite DB.
Sequelize defaults to using memory storage for sqlite, so it's migrating an in-memory database, then exiting, effectively destroying the DB it just migrated.
you most likely have to wait for migration.createTable to finish:
migration.createTable(/*your options*/).success(function() {
migration.describeTable('nameOfTheNewTable').success(function(attributes) {
util.puts("nameOfTheNewTable Schema: " + JSON.stringify(attributes));
done()
});
})