Posts

angularjs - Getting a 404 on angular.js on a MEAN app using gulp -

i attempting setup new mean app using gulp , bower keep getting 404 errors on bower dependencies when start app. used express-generator folder structure, wanted use gulp inject frontend dependencies bower , javascript files index file. folder structure: . +-- bin | +-- www +-- lib (bower_components) | +-- angular | +-- angular-ui-router +-- node_modules | +-- ... +-- public | +-- javascripts | | +-- angularapp.js +-- routes | +-- index.js | +-- users.js +-- views | +-- index.ejs +-- app.js +-- gulpfile.js +-- bower.json +-- package.json and gulpfile: 'use strict'; var gulp = require('gulp'), browsersync = require('browser-sync'), inject = require('gulp-inject'), nodemon = require('gulp-nodemon'), wiredep = require('wiredep').stream, reload = browsersync.reload; var paths = { scripts: ['public/javascripts/**/*.js'] }; var nodemonoptions = { script: 'bin/www', ...

swift - Segmentation fault: 11 when assigning label value from array -

having hard time figuring out. can print value of array , can assign label string, can't assign label value array. print(self.items[0]["username"]) // prints username fine cell.usernamelabel.text = "test" // works expected cell.usernamelabel.text = self.items[0]["username"] // throws segmentation fault:11 on compilation i managed work downcasting: cell.usernamelabel.text = self.items[0]["username"] as? string

Via Ansible to get the most recent war file from A nexus repo -

i have, in nexus, bunch of versions of .war files in snapshot repo. part of automated pipeline grab newest version of these .war files via ansible. when there no .war file on machine grab newest version. (code below). - name: deploy war file maven_artifact: group_id=com.company artifact_id=sales-ui extension=war repository_url=http://ddnexusrepo:8081/nexus/content/repositories/{{repo}} username={{ nexus_user }} password={{ nexus_password }} dest=/usr/share/tomcat/webapps/sales-ui.war when on system not updated when newer version in nexus. how can grab latest? the way can think download (via same maven_artifact module) .war.md5 , compare .war's md5 on server see if there change. want state=latest functionality present or absent. ideas appreciated. thanks you can use version=latest tag available in ansible 2.2.1.0

Generate a python parser for a particular JSON format -

i'm using file format. format is, effectively, json particular structure. format comes validator, great, , gives helpful error messages. however, validator fails when error causes input invalid json, , gives poor error message. i can use normal json validator, want able put json structure tool, , (python) parser out of other end. there various ways of doing this, question is: there ways of defining json format let me avoid writing parser json itself? the use case this: build 'proper' validator format, user can upload file , have checked. can write bnf, i'd write bnf tool understand bnf-within-json. the appropriate way assert json file follows particular format use json schema . supported across many languages , has libraries in python. there's helpful online tools generate, validate, , test schema.

Python/MySQL "Insert into" with variables -

i have problem inserting new rows mysql table. name of table change, must variable , have trouble. how can change name of table "second" variable? idea? add_word = ("insert second " "(name, surname) " "values (%s, %s)") data_word = (name1, surname1) cursor.execute(add_word, data_word) you this: add_word = "insert %s (name, surname) values ('%s', '%s')"%('table_name','name','surname1') and don't need data_word: cursor.execute(add_word, params=none, multi=false)

c# - Linq to SQL - Getting the last know history entry for each divice, prior to a certain date -

i have question similar entry: how-do-i-query-sql-for-a-latest-record-date-for-each-user ... need in linq. in short people not care read other link: i have history table devices. need latest entry each device before given date. not need specific value, whole row. example data: id | deviceid | state | lastupdateddate 0 | 1 | online | 2016-01-05 10:23:45 1 | 2 | offline | 2016-01-04 00:05:33 2 | 1 | offline | 2016-01-01 06:13:25 3 | 1 | online | 2016-01-07 11:02:06 4 | 3 | offline | 2016-01-03 18:00:25 5 | 4 | online | 2016-01-08 03:00:05 4 | 3 | offline | 2016-01-08 04:27:21 so, if have last known states before 2016-01-05, expect following result: id | deviceid | state | lastupdateddate 1 | 2 | offline | 2016-01-04 00:05:33 2 | 1 | offline | 2016-01-01 06:13:25 4 | 3 | offline | 2016-01-03 18:00:25 null | 4 | null | null the null entry not required, ad...

xml - xdmp:eval and Update transactions -

i have test case here: let $s := 'xquery version "1.0-ml"; $doc in xdmp:directory("/test/") return xdmp:node-insert-child(doc(xdmp:node-uri($doc))/a, <b>bbb</b>) return (xdmp:eval($s, (), <options xmlns="xdmp:eval"> <isolation>different-transaction</isolation> <prevent-deadlocks>true</prevent-deadlocks> </options>), xdmp:directory("/test/")) my main goal here add new element each document in "/test/" , return results in same transaction. xdmp:eval() , "different-transaction" option thought eval-ed code executed in separate transaction updates available subsequent calls... 2nd , last xdmp:directory("/test/") should returning updated documents <b> element, yet returns non-updated documents. were there caveats here xdmp:eval , i'm trying achieve in single transaction? marklogic 8 in cas...