How to use angularGrid with Browserify? - grid

I trying to implement angular-gird using Browserify.
I used a configuration like this:
{
"name": "Project",
"description": "Description",
"version": "0.0.1",
"repository": "...",
"license": "License",
"private": true,
"dependencies": {
"angular": "1.3.15",
"angular-ui-router": "0.2.14",
"angular-grid": "1.2.0"
},
"devDependencies": {
"browserify": "9.0.8",
"browserify-shim": "3.8.5",
},
"browserify": {
"transform": [
"browserify-shim"
]
},
"browser": {
"angular": "./client/app/common/angular-lib.js",
},
"browserify-shim": {
"angular-ui-router": {
"depends": "angular"
},
"angular-grid": {
"depends": "angular"
}
}
}
But then I get the error:
"Uncaught TypeError: require.config is not a function" (main.js).
Can someone help me? What is the best way to implement angularGrid with Browserify?

Related

symbols are not loaded with visual studio 2015 in .net core library multi target project

I'm creating a solution with 2 projects. A class library and a console application to have the XUnit project. Both applications target .net 451 and .net core frameworks.
For the library I have
"netstandard1.3"
"net451"
For the xunit project I have
"netcoreapp1.0"
"net451"
I'm having problems when debugging the unit tests inside Visual Studio 2015, using the test explorer, when I try to debug, the symbols are not loaded.
Is there any setup for the projects that I'm missing? Any limitation in Visual Studio 2015 ?
I had this project and tests working fine only targeting .net core version. The problem started after introducing the net451 target.
Everything builds right and the tests also are discovered correctly.
Thanks in advance!
project.json from library project
"version": "1.0.4",
"files": {
"includeFiles": [
"Content/ReleaseNotes.txt"
],
"include": [
"../../README"
]
},
"releaseNotes": "Review ReleaseNotes.txt for details.",
"requireLicenseAcceptance": true
},
"buildOptions": {
},
"frameworks": {
"net451": {
"frameworkAssemblies": {
"System.ComponentModel.DataAnnotations": "",
"System.Data": "",
"System.Drawing": "",
"System.Drawing.Design": "",
"System.Transactions": "",
"System.Configuration": "",
"System.Configuration.Install": "",
"System.Management": "",
"System.Xml": "",
"System.Runtime": {
"type": "build"
}
},
"dependencies": {
"Google.Protobuf": "3.0.0-beta4"
}
},
"netstandard1.3": {
"buildOptions": {
"define": [ "NETCORE10" ],
"warningsAsErrors": false,
"embed": [
"keywords.txt",
"Resources.resx"
],
"resource": [ "**/*.resx" ],
"compile": {
"exclude": [
"Framework/Net451/**/*.*",
],
"includeFiles": [
"Resources.Designer.cs"
],
"excludeFiles": [
"Properties/VersionInfo.cs",
]
}
},
"dependencies": {
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"NETStandard.Library": "1.6.0",
"System.Collections.NonGeneric": "4.0.1",
"System.ComponentModel": "4.0.1",
"System.ComponentModel.Annotations": "4.1.0",
"System.ComponentModel.Primitives": "4.1.0",
"System.ComponentModel.TypeConverter": "4.1.0",
"System.Data.Common": "4.1.0",
"System.Data.SqlClient": "4.1.0",
"System.Diagnostics.Process": "4.1.0",
"System.Diagnostics.TextWriterTraceListener": "4.0.0",
"System.IO.Compression": "4.1.0",
"System.IO.FileSystem.Primitives": "4.0.1",
"System.IO.MemoryMappedFiles": "4.0.0",
"System.IO.Pipes": "4.0.0",
"System.Linq.Expressions": "4.1.0",
"System.Net.NameResolution": "4.0.0",
"System.Net.Security": "4.0.0",
"System.Net.Sockets": "4.1.0",
"System.Reflection": "4.1.0",
"System.Reflection.TypeExtensions": "4.1.0",
"System.Security.Principal.Windows": "4.0.0",
"System.Text.Encoding.CodePages": "4.0.1",
"System.Threading.Timer": "4.0.1",
"System.Threading.ThreadPool": "4.0.10",
"Google.Protobuf": "3.0.0-beta4"
}
}
}
}
project.json from xunit project
{
"version": "7.0.4",
"description": "MyLibrary",
"packOptions": {
"requireLicenseAcceptance": true
},
"buildOptions": {
},
"testRunner": "xunit",
"dependencies": {
"dotnet-test-xunit": "2.2.0-*",
"xunit": "2.2.0-*",
"MyLibrary": {
"target": "project"
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dnxcore50"
],
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-*",
"type": "platform"
}
},
"buildOptions": {
"define": [ "NETCORE10" ],
"copyToOutput": [ "appsettings.json" ],
"compile": {
"include": [ "../*.cs" ],
"exclude": [
"**/._*",
"Framework/Net451/**/*.*"
],
"excludeFiles": [
"TestDataTable.cs"
]
},
"warningsAsErrors": false,
"optimize": true
}
},
"net451": {
"frameworkAssemblies": {
"System.Collections": {
"type": "build"
},
"System.Diagnostics.Debug": {
"type": "build"
},
"System.Linq": {
"type": "build"
},
"System.Reflection": {
"type": "build"
},
"System.Reflection.Extensions": {
"type": "build"
},
"System.Runtime": {
"type": "build"
},
"System.Runtime.Extensions": {
"type": "build"
},
"System.Threading.Tasks": {
"type": "build"
}
},
"buildOptions": {
"compile": {
"exclude": [
"Framework/NetCore10/*.*"
],
"excludeFiles": [
"Framework/Net451/PerfMonTests.cs",
"Framework/Net451/ReplicationTests.cs"
]
}
}
}
}
}
Well, hope this save some time to someone else. I'm sort of new to the xproj projects and also still learning about all the options inside the new project.json file.Which I like so far. That said here's the answer to this particular issue.
I had an optimize = true outside the frameworks section which applies to all the configurations in the project. So the IDE was never generating the debug-able code. A good practice for this is having a configurations section in your project.json file where you define how you want the build to behave for each case.
And here is the configurations section that I added.
"configurations": {
"Debug": {
"buildOptions": {
"define": [ "DEBUG" ],
"optimize": false,
"preserveCompilationContext": true
}
},
"Release": {
"buildOptions": {
"define": [ "RELEASE" ],
"optimize": true,
"preserveCompilationContext": true,
"xmlDoc": true
}
}
And that's it.

Composer install git repo into custom path (Wordpress theme)

I have a custom Wordpress theme hosted on Bitbucket that I'd like installed into the /themes directory in Wordpress when I run composer install.
I've played around with different repo 'types' e.g. vcs, package etc and I get errors for everything I've tried so far.
Here's a sample of my (not working) composer.json file:
{
"authors": [
{
"name": "Joe Bloggs",
"homepage": "http://www.example.com/"
}
],
"keywords": [
"wordpress", "composer", "wp"
],
"config": {
"secure-http": false
},
"repositories": [
{
"type": "composer",
"url": "http://wpackagist.org"
},
{
"type": "package",
"package": {
"name": "wordpress/wordpress",
"version": "4.5.3",
"type": "webroot",
"dist": {
"type": "zip",
"url": "https://wordpress.org/wordpress-4.5.3.zip"
},
"require" : {
"fancyguy/webroot-installer": "1.1.0"
}
}
},
{
"type": "vcs",
"url": "https://bitbucket.org/gurtfrobe/plunderscores.git"
}
],
"require": {
"php": ">=5.3.2",
"wordpress/wordpress": "4.5.3",
"fancyguy/webroot-installer": "1.1.0",
"composer/installers": "v1.0.12",
"gurtfrobe/plunderscores": "1.0.1"
},
"extra": {
"installer-paths": {
"wp/wp-content/plugins/{$name}/": ["type:wordpress-plugin"],
"wp/wp-content/mu-plugins/{$name}/": ["type:wordpress-muplugin"],
"wp/wp-content/themes/{$name}/": ["type:wordpress-theme"]
},
"webroot-dir": "wp",
"webroot-package": "wordpress/wordpress"
}
}
I've also tried the following with no luck:
{
"type": "package",
"package": {
"name": "gurtfrobe/plunderscores.git",
"version": "1.0.1",
"type": "wordpress-theme",
"source": {
"url": "https://bitbucket.org/gurtfrobe/plunderscores.git",
"type": "vcs",
"reference": "master"
}
}
},
Is there a way of achieving this without submitting my theme to wpackagist?
I solved it with this article.
Remember to push the latest version tags after you've updated your composer.json file. Otherwise Composer will still try and download a previous version.

Misplaced glyphicons on angular-schema-form

My angular schema form misplaces the inline glyphicons, they are shown on the upper right corner of the page instead:
pic
This app was built with yeoman, using generator-angular.
html:
<div class="login-container">
<form name="myForm"
sf-schema="schema"
sf-form="form"
sf-model="model"
ng-submit="onSubmit(myForm)"></form>
</div>
ts:
angular.module('playgroundApp')
.controller('FormCtrl', ['$scope', function($scope) {
$scope.schema = {
"type": "object",
"title": "Types",
"properties": {
"string": {
"type": "string",
"minLength": 3
},
"integer": {
"type": "integer"
},
"number": {
"type": "number"
},
"boolean": {
"type": "boolean"
}
},
"required": [
"number"
]
};
$scope.form = [
"*",
{
"type": "submit",
"title": "OK"
}
];
$scope.model = {};
$scope.onSubmit = function(form) {
// First we broadcast an event so all fields validate themselves
$scope.$broadcast('schemaFormValidate');
// Then we check if the form is valid
if (form.$valid) {
// ... do whatever you need to do with your data.
}
}
}]);
I tried to search for conflicts between directives, unfortunately I couldn't reproduce the behaviour in a plunkr.
bower.json:
{
"name": "playground",
"version": "0.0.0",
"dependencies": {
"angular": "^1.5.3",
"bootstrap": "^3.2.0",
"angular-animate": "^1.3.0",
"angular-cookies": "^1.3.0",
"angular-resource": "^1.3.0",
"angular-route": "^1.3.0",
"angular-sanitize": "^1.3.0",
"angular-touch": "^1.3.0",
"angular-ui-grid": "~3.1.1",
"angular-ui-router": "~0.2.15",
"ngstorage": "~0.3.9",
"angular-ui-layout": "~1.3.0",
"angular-bootstrap": "~0.14.3",
"moment": "~2.10.6",
"lodash": "~3.10.1",
"angular-wizard": "~0.5.5",
"ui-select": "angular-ui-select#~0.16.0",
"select2": "~3.4.5",
"angular-flash-alert": "~2.2.5",
"angular-gantt": "^1.2.13",
"angular-strap": "^2.3.7",
"angular-schema-form": "~0.8.13",
"angular-ui-tree": "~2.15.0",
"components-font-awesome": "~4.6.1",
"woodman": "~1.1.0",
"angular-ui-bootstrap": "~1.0.3",
"angular-picklist": "*",
"jquery-ui": "~1.11.4",
"angular-schema-form-bootstrap": "~0.2.0",
"angular-schema-form-datepicker": "~0.4.0",
"jquery": "~3.0.0"
},
"devDependencies": {
"angular-mocks": "^1.3.0",
"ui-select": "angular-ui-select#~0.16.0"
},
"appPath": "app",
"moduleName": "playgroundApp",
"overrides": {
"bootstrap": {
"main": [
"less/bootstrap.less",
"dist/css/bootstrap.css",
"dist/js/bootstrap.js"
]
}
},
"resolutions": {
"lodash": "~3.10.1",
"angular-mocks": "^1.3.0"
}
}
Update: Ignored this problem for 4 months. Facing it today I installed the latest versions of angular-schema-form and angular-schema-form-bootstrap and the problems were gone.
For anyone that still has problems with those icons, is possible to disable them adding to each field in the form definition: 'feedback': false as stated in the docs here.
Maybe not the best solution, but will help if you can live without the icons.

Task “default” not found in Gruntfile.js

I'm spending way too much time finding my error. I bet I'm missing a semicolon.
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
cssbeautifier : {
files : ["css/style.css"],
options : {
indent: ' ',
openbrace: 'end-of-line',
autosemicolon: false
}
}
grunt.loadNpmTasks('grunt-cssbeautifier');
grunt.registerTask('default',["cssbeautifier"]);
})
}
package.json:
{
"name": "zavrsni-php",
"version": "1.0.0",
"description": "Job interview simulator\r Demo: http://interviewsimulator.eu.pn/",
"main": "index.php",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/MarkoIvanetic/zavrsni-PHP.git"
},
"author": "Grad",
"license": "MIT",
"bugs": {
"url": "https://github.com/MarkoIvanetic/zavrsni-PHP/issues"
},
"homepage": "https://github.com/MarkoIvanetic/zavrsni-PHP#readme",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-cssbeautifier": "^0.1.2",
"grunt-jsbeautifier": "^0.2.10"
}
}
Fount it, braces on the wrong place

Symfony - Composer and Payone PHP SDK

I'm trying to use the PHP-SDK and I just can't get it to work. I'm not familiar with the use and namespace statements in PHP and I'm trying to understand it.
{
"repositories": [
{
"type": "package",
"package": {
"name": "payone/php-sdk",
"version": "1.0.0",
"dist": {
"url": "http://github.com/PAYONE/PHP-SDK/archive/master.zip",
"type": "zip"
},
"autoload": {
"psr-0": { "Payone_": "php/" }
}
}
}
],
"require": {
"payone/php-sdk": "1.0.*"
}
}
As far as I understand this tries to load the Autoload.php in my payone/php-sdk/php folder with the class prefix Payone_. This seems fine to me but I can't use $builder = new Payone_Builder(); in my controller now. What am I doing wrong?
You need to add the use statement to your controller.
use Payone_Builder;
as per 2015/03 new zip url
{
"repositories": [
{
"type": "package",
"package": {
"name": "payone/php-sdk",
"version": "1.0.0",
"dist": {
"url": "http://www.payone.de/uploads/media/php-sdk.zip",
"type": "zip"
},
"autoload": {
"psr-0": {"Payone_": "php/"}
}
}
}
]
}

Resources