Posts

Showing posts from January, 2011

MySQL Cluster - When rebooting a data node machine on a 4 machine cluster it hangs SQL nodes -

i have mysql cluster 4 machines such (example ip's): [ndbd(ndb)] 2 node(s) id=1 @1.1.1.1 (mysql-5.6.23 ndb-7.4.5, nodegroup: 0) id=2 @1.1.1.2 (mysql-5.6.23 ndb-7.4.5, nodegroup: 0, *) [ndb_mgmd(mgm)] 2 node(s) id=49 @1.1.1.51 (mysql-5.6.23 ndb-7.4.5) id=52 @1.1.1.52 (mysql-5.6.23 ndb-7.4.5) [mysqld(api)] 3 node(s) id=50 (not connected, accepting connect 1.1.1.51) id=55 @1.1.1.51 (mysql-5.6.23 ndb-7.4.5) id=56 @1.1.1.52 (mysql-5.6.23 ndb-7.4.5) if cold reboot on either data node machine (id=1 or id=2) cannot run sql queries (on nodes 55 or 56) until data node machine comes online reboot. here errors: error 1297 (hy000): got temporary error 4028 'node failure caused abort of transaction' ndbcluster error 1205 (hy000): lock wait timeout exceeded; try restarting transaction if stop data node first in ndb_mgm such 1 stop or 2 stop , reboot machine there no issue. is correct behavior? if data node machine crashes or pulls plug on cluster inopera...

xml - VBA DOM Variable in XPath Attribute -

i have program searches , gathers (via array) specific author , 'booktype' , 'booktitle' trying learn how use author's name - i've stored in array - variable in xpath 'store location'. like: "/catalog/book/misc/publisherauthor id="myvar"/storelocation" three things confusing me: 1. how declare variable in xpath if it's array (if possible)? 2. bad idea declare statement inside loop? 3. xpath/dom logic correct? <?xml version="1.0"?> <catalog> <book id="adventure"> <author>gambardella, matthew</author> <title>xml developer's guide</title> <price>44.95</price> <misc> <publisher id="5691"> <publisherlocation>los angeles</publisherlocation> </publisher> <publishedauthor id="gambardella, matthew"> <storelocation>store b</storeloca...

angularjs - Why are watchers not firing when ui-router state data is changed on parent? -

i unable $scope.$watch or $scope.$watchcollection trigger when updating $state.current.data parent view. i've created plunker demonstrate: http://plnkr.co/edit/d4hblq9qvnmolqkxo9jc?p=preview use, navigate /main/1 path , click 'change' button. see $state.data updated, yet watchers never notification. here script.js source: var app = angular .module('myapp', [ 'ui.router' ]) .config(['$stateprovider', '$urlrouterprovider', function ($stateprovider, $urlrouterprovider) { $urlrouterprovider.otherwise('/main'); $stateprovider // states .state("main", { data: {hello:'hello'}, controller:'maincontroller', url:"/main", templateurl: "main_init.html" }) .state("main.1", { controller:'childcontroller', parent: 'main', url:"/1", ...

r - For a stats class assignment I have to show that the anova will pick up significance in cases where the t-test does not? -

how can run holm-sidak test on repeated measures anova in r? meansep voltag potential result of paper have recreate statistical testing in class. looking significant difference between conditions; baseline, abcd, dcba, , 300. here far i've gotten: control1 = data.frame( c("m1","m2","m3","m4"), c(129.43,152.48,118.79,156.02), c(180.85,228.72,257.09,278.37), c(198.58,230.5,235.82,304.96), c(134.75,159.57,223.4,255.32)) colnames(control1) = c("subject","control","abcd","dcba","300") control=stack(control1) subject = rep(control1$subject,4) # create "subject" variable control[3] = subject # add new data frame rm(subject) # clean workspace colnames(control) = c("meansep", "condition", "subject") testc= aov(meansep ~ condition + error(subject/condition), data=control) summary(testc)...

Slow query in SQL server when using microseconds -

if run query filters on date, if run exact same query twice, first time my_date_field = '2015-01-01 00:00:00' , second my_date_field = '2015-01-01 00:00:00.000', first 1 (without microseconds) runs faster. normal? i'm using sql server 2008 r2. some more background, execution plans same when run queries in ssms. i'm not sure if i'd slowness there. see slowness in php application using native sql server driver. noticed slowness because there's loop runs query more once (yeah, know, avoid if possible, hard avoid here) , more records get, more notice slowness. 100 records, process runs fast without microseconds , upwards of 40 seconds them. update thanks comments got me digging deeper. changing microseconds mad things faster, it's coincidence. after debugging, discovered absolutely change in way query results in faster query. in, can add space somewhere or remove carriage return , it's fast. guess there's flawed execution plan that'...

How can I make things I copy in my browser added to my Vim registers? -

i want able copy things in browser , have available in vim register can paste them @ will. currently, paste browser need right click on vim window , select 'paste' option. messes textual alignment , kind of defeats whole purpose of using vim. how can make things copy in browser added vim registers? you should able use * and/or + registers. :help registers : 7. selection , drop registers "*, "+ , "~ use these registers storing , retrieving selected text gui. see |quotestar| , |quoteplus|. when clipboard not available or not working, unnamed register used instead. unix systems clipboard available when |+xterm_clipboard| feature present. {not in vi} note there distinction between "* , "+ x11 systems. explanation of difference, see |x11-selection|. under ms-windows, use of "* , "+ synonymous , refers |gui-clipboard|. if require pasting during insert mode, use :set paste before pasting , :set nopaste after no longer need ...

python - How to update a column in Pandas Dataframe -

in pandas , trying add new column / update existing column data frame (df2) value data frame (df1). can think of how in sql update df2 set df2['column'] = df1['column'] df2 join df1 on df1['nonindexcolumn'] = df2['nonindexcolumn'] data example: d =[{'customerid': 1, 'signupdate': '2014-01-01'}, {'customerid': 2, 'signupdate': '2014-02-01'}, {'customerid': 3, 'signupdate': '2014-03-01'}, {'customerid': 4, 'signupdate': '2014-04-01'}] df1 = pd.dataframe(data=d) d2 = [{'orderid': 1, 'customerid': 1, 'orderdate': '2014-01-15'}, {'orderid': 2, 'customerid': 1, 'orderdate': '2014-01-15'}, {'orderid': 3, 'customerid': 2, 'orderdate': '2014-03-28'}, {'orderid': 4, 'customerid': 1, 'orderdate': '2014-03-29'}, {'orderid': 5,...

Cordova/Ionic app, prevent redirecting the main WebView -

i have cordova/ionic app uses 3rd party js lib used customer feedback chat window. when chat opened, redirects whole app's webview, want avoid this. the js lib injected page through dynamic <script> tag. can't mess -- or don't want to. chat window can opened api-call. there's no api function url opened. the api call redirects whole browser app. want show new page in external browser or preferably in <iframe> the page works differently in chrome dev , in mobile, e.g. safari. might partially because of lib too. i have tried: <iframe> . not works, redirects whole page. how can prevent it? window.onbeforeunload : ain't fires in ios. <preference name="stay-in-webview" value="true/false" /> in config.xml what suggestions? there must i'm missing...

ios - Scroll a node in constant distances-SWIFT -

i want know how scroll node in given distance, example 100 px . have done this: override func touchesended(touches: set<nsobject>, withevent event: uievent) { fingerisonscroll = false } func roundto(value: int) -> int{ var fractionnum = double(value) / 100.0 let roundednum = int(ceil(fractionnum)) return roundednum * 100 } override func touchesmoved(touches: set<nsobject>, withevent event: uievent) { if fingerisonscroll{ touch: anyobject in touches { let touchloc = touch.locationinnode(self) let prevtouchloc = touch.previouslocationinnode(self) var jump = touchloc.x - prevtouchloc.x var myintvalue:int = int(jump) myintvalue = roundto(myintvalue) var jumpcgfloat = cgfloat(myintvalue) simple.position=cgpointmake(simple.position.x + (jumpcgfloat), simple.position.y) } } } the problem when scroll left moves right , if scroll right doesn't move. thanks.

javascript - Pixel perfect scaling of images while zooming the canvas with fabric.js -

Image
my software kind of pixel art paint program brushes, fabric.js heavily modified in order have pixel rounded translation (the position integer) fabric.js objects, resizing images , making pixels fit canvas in 1:1 ratio still issue. right now, fabric.js zoomtopoint function used able zoom on canvas mouse wheel, when images aren't scaled, pixels fit canvas when scale objects down (or up), pixels not fit anymore canvas pixels of object smaller or bigger canvas pixel. screenshots of problem zoom level of 8 : original image dimensions (no problems, each pixels fit canvas pixels) resized image, pixels of image not fit canvas pixels anymore how can pixels of images fit canvas pixels in 1:1 ratio when scaling them? by nature, resizing involves resampling original image , interpolating/convoluting existing pixels resized space. resulting image meant visually appealing @ new size. image resized x , resulting pixels not have x:1 relationship anymore. to zoom-in ne...

Embedded fonts in PDF: copy and paste problems -

when trying copy , paste ms word document pdf document has sets of fonts embedded, result illegible. several symbols changed or disappear. using adobe acrobat can check specific fonts embedded. would installing such fonts in microsoft word work out? if so, can or create subsets of fonts need? if not, how solve problem? you should check pdf document's fonts first of pdffonts utility. part of xpdf package windows , can used without installing, dos box. in order extract text (or copy'n'paste it) pdf, font should either use standard encoding (not custom one), , should have /tounicode table associated inside pdf. pdffonts returns few basic information items fonts used pdf. example output: $ pdffonts -f 3 -l 5 sample.pdf name type encoding emb sub uni object id ------------------------- ------------- ------------ --- --- --- --------- iadkrb+arial-boldmt cid truetype identity-h yes yes yes 1...

nullpointerexception - Android Location Manager returning NULL -

i have simple location manager works, when android device has been turned off , turned on, android location manager returns null when have requesting updates. aware getlastknownlocation can return null, believe handling in code. suggestions appreciated. apparently lon = location.getlongitude(); crashing it. locationmanager lm = (locationmanager) getsystemservice(context.location_service); location location = lm.getlastknownlocation(locationmanager.gps_provider); if (location == null) { // request location update!! lm.requestlocationupdates(locationmanager.gps_provider, 0, 0, this); lon = location.getlongitude(); lat = location.getlatitude(); } mlocationmanager = (locationmanager) getsystemservice(context.location_service); //get last known location location = mlocationmanager.getlastknownlocation(locationmanager.gps_provider); //update if not null if (locat...

multithreading - Need help interacting with Python GUI while there is a process being run -

i developing application run batch of test when press start button on gui. problem once subprocess run test called, python gui freezes until subprocess finished executing. using python 2.7 way. i interact gui while test running, have different buttons can pressed, etc. without interrupting test. here excerpt of have part: import tkinter import tkmessagebox import subprocess top = tkinter.tk() def batchstartcallback(): tkmessagebox.showinfo("batch application", "batch started!") x in range(0, 3): p = subprocess.call('batch path', stdout = none, stderr = none, shell=false) def batchstopcallback(): tkmessagebox.showinfo("batch application", "batch stopped!") # stop batch startbutton = tkinter.button(top, text = "start batch", command = batchstartcallback, width = 8, height = 2) stopbutton = tkinter.button(top, text = "stop batch", command = batchstopcallback, width = 8, height = 2) ...

dictionary - Python reverse / inverse a mapping (but with multiple values for each key) -

this variation on question, not duplicate: python reverse / invert mapping given dictionary so: mydict= { 'a': ['b', 'c'], 'd': ['e', 'f'] } how can 1 invert dict get: inv_mydict = { 'b':'a', 'c':'a', 'e':'d', 'f':'d' } note values span uniquely under each key. note : had syntax map = ... , dict = ... reminder not use map , dict built-in functions, see excellent comments , answers below :) tl;dr use dictionary comprehension, this >>> my_map = { 'a': ['b', 'c'], 'd': ['e', 'f'] } >>> {value: key key in my_map value in my_map[key]} {'c': 'a', 'f': 'd', 'b': 'a', 'e': 'd'} the above seen dictionary comprehension functionally equivalent following looping structure populates empty dictionary >>> inv_map ...

javascript - How can I detect which browser is used with feature detection? -

i wish detect various browsers feature detection in javascript ie7-11, chrome , firefox. how can this> as @dandavis said, objects specific browser need. example: if (!document.characterset || !document.doctype || !document.defaultview) { /** * if browser not have these properties on document, * ie8 or lower... maybe. */ }

javascript - jQuery AJAX not entering "success" -

$(function(){ $(document).ready(function(){ $.ajax({ url: "src/cookiecheck.php", type: "post", async: true, success: function(json){ if(json.visitedbefore!="true"){ $("#cookiepolicy").fadein(); } } }); window.alert(5); $.ajax({ url: "src/lessons.php", type: "post", async: true, success: function(json){ window.alert(1); } }); }); }); so jquery part of application executes first ajax call , display 5 "window.alert(5);" second call made reason success not triggered. here how output "lessons.php" looks like {"id":"5"} {"name":["111","2","3","4","5","123123"]} {"location":[...

javascript - Loading dynamic contents when a div is clicked -

i hope can me this. use dynamic call server content needs loaded div. there fixed menu @ bottom of page when tag clicked calls function , tells frame update, , in function generates xmlhttprequest (or use activex in case of old ie versions etc.), request navigate predefined location on server php snippet lies needs included, , set innerhtml of corresponding output section. i array outside of function keeps track of pages have been loaded, doesn't load page again because user clicks on link second time. html: <div id="fixedmenu"> <input type="radio" name="radio-set" checked="checked" id="main"/> <a href="#1">main</a> <input type="radio" name="radio-set" id="2nd"/> <a href="#2">2nd</a> <input type="radio" name="radio-set" id="3rd"/> <a href="#3">3rd</a> <input...

html - Changing position of anchor <a> in css not working -

on worpdress website have anchor point on of pages , link external page. problem when link page top of content hidden fixed header. try fix added in css: .anchor{ position:relative; top: -50px; } i know position of anchor has changed because can see using inspect element, link still takes me exact same place(covering header)! i'm using the genesis framework , own custom child theme based on genesis sample theme if makes difference. appreciated. i had similar problem on 1 of online training websites. had fixed header overlapped content linking to. solution problem use few lines of custom smooth scrolling script. can find implementation here. $(".scroll").click(function(event){ event.preventdefault(); //calculate destination place var dest=0; if($(this.hash).offset().top > $(document).height()-$(window).height()){ dest=$(document).height()-$(window).height(); }else{ ...

ios - How to export "fat" Cocoa Touch Framework (for Simulator and Device)? -

Image
with xcode 6 ability create own dynamic cocoa frameworks . because of: simulator still use 32-bit library beginning june 1, 2015 app updates submitted app store must include 64-bit support , built ios 8 sdk ( developer.apple.com ) we have make fat library run project on devices , simulators. i.e. support both 32 , 64 bit in frameworks. but didn't find manuals, how export universal fat framework future integration other projects (and share library someone). here steps reproduce: set only_active_arch=no in build settings add support armv7 armv7s arm64 i386 x86_64 architectures (for sure) build framework , open in finder: add framework project actual result: but in end still have problem running project framework on devices , simulator @ once. if take framework debug-iphoneos folder - works on devices , gets error on simulators: ld: symbol(s) not found architecture i386 xcrun lipo -info coreactionsheetpicker architectur...

mint - Xen dom0 cannot connect to the internet -

i configured linux mint 17 host o/s install xen per following guide xen project beginner's guide now, after configuring network interfaces instructed, rebooted machine. can see bridge has ip assigned via dhcp, cannot connect internet. i can ping gateway, not other address. what doing wrong? this /etc/network/interfaces file auto lo iface lo inet loopback auto eth0 iface eth0 inet manual auto xenbr0 iface xenbr0 inet dhcp bridge_ports eth0 in case, added eth0 , eth1 interfaces bridge bridge name bridge id stp enabled interfaces br0 8000.00259e1c426c no eth0 eth1 but there interface called vif3.0 has included bridge interface. so, did this brctl addif br0 vif3.0 everything works fine.

php - Restful API Design Content Output -

i got api output ready great of so-members answering questions. thank way. but wonder 1 thing in output. when call url receive api content this: [ { "data": [ { "incidentreference": "r-20150405-887f93", "latitude": 48.259698, "longitude": 11.434679, "archived": false }, (...) ] } ] i read book "build apis won't hate" , great resource lot of stuff. don't think, output see right. mean, namespacing have. shouldn't this? { "data": [ { "incidentreference": "r-20150405-887f93", "latitude": 48.259698, "longitude": 11.434679, "archived": false }, (...) ] } so shouldn't whole thing json only? in case return additionally within array. functions doing job these: public function index() { $incidents = incident::all(); ...

objective c - Potential leak IPhone App -

harrisannotation *harrisannotation = [[harrisannotation alloc] init]; [self.mapannotations insertobject:harrisannotation atindex:0]; [harrisannotation release]; running analyze on project show potential leak of object for harrisannotation never mind, i'm not used using xcode. line below.

jQuery: How to change the size of a css block? -

working on assignment, , don't think part we're supposed having trouble (we're supposed working on scroll buttons, have idea on): "--create page displays paragraphs using css block style. block size should small display text in entirety." i've got bunch of text in div id="story" , have inside script tags: $("#story").css("display", "block"); however nothing appears change. layout remains same , can't life of me figure out how change size of css block . find box-size. so 2 questions: 1. why display not changing when use .css() apply 'block' , 2. how specify size of css block? edit: i've tried adding: $("#story").css("height", "20px"); but shows no change. edit: thank all! spot on , feel incredibly silly. didn't realize overflow had set before apply size setting. put in: overflow: scroll; it started displaying correctly. guess that's trying...

django - Error when running a python script - invalid syntax -

i keep getting error when running python script sudo python net-creds.py file "net-creds.py", line 75 ipr = popen([‘/usr/local/bin/ip’, 'route'], stdout=pipe, stderr=dn) ^ syntaxerror: invalid syntax you using " ` " instead of ' .so try this ipr = popen(['/usr/local/bin/ip', 'route'], stdout=pipe, stderr=dn)

javascript - Socket.io tutorial not printing connection to console -

var app = require('express')(); var http = require('http').server(app); var io = require('socket.io')(http); app.get('/', function(req, res){ res.sendfile(__dirname + "/index.html"); }); http.listen(3000, function() { console.log('listening on 3000'); }); io.on('connection', function(socket){ console.log('a user connected'); socket.on('disconnect', function(){ console.log('user disconnected'); }); }); i don't understand why won't print "a user connected" when refresh page , wondering why is. below index.html file. following get-started tutorial ( http://socket.io/get-started/chat/ ) <!doctype html> <html> <head> <title>socket.io chat</title> <style type="text/css"> * { margin: 0; padding: 0; box-sizing: border-box; } body { font: 13px helvetica, arial; } ...

sql server - Can I turn a "with" query into a create procedure? -

pincounts ( select gameid, tb.bowlerid, tb.firstname, frame, bowlingball1, bowlingball2, bowlingball3 ,framestatus = case when bowlingball1 = 10 2 when bowlingball1 + bowlingball2 = 10 1 else 0 end ,next1 = lead(bowlingball1, 1 ,case when frame = 10 , bowlingball1 = 10 isnull(nullif(bowlingball2, 10), bowlingball3) when frame = 10 , bowlingball1 + bowlingball2 = 10 bowlingball3 end ) on ( partition gameid, tb.bowlerid order frame ) ,next2 = lead(bowlingball2, 1 ,bowlingball3 ) on ...

c++ - minko - cannot compile dev branch -

i trying compile dev branch of minko biggest api change (from master branch) math api. the few examples compile linux64 don't run (example assimp opens window , closes immediately). nevertheless, managed modify code use new api , compiles fine, on launch crashes segmentation fault @ : sceneman->assets()->loader()->load(); any idea might wrong ? (same asset folder works non dev branch). this lot of things, file loader parsers. try handle error signal loader see error ?

python - Pyxero invoice filter doesn't work -

i'm using pyxero download invoices, following code pulls out invoices before datetime: import xero ckey = 'xxxxxxxxxxxxxxxxxxxxxxx' #link private rsa key open('privatekey.pem') keyfile: rsa_key = keyfile.read() credentials = privatecredentials(ckey, rsa_key) xero = xero(credentials) invoices = xero.invoices.filter(since=datetime.datetime(2015,4,1)) has used pyxero invoice filter in request? our company has many invoices , doing request no filter causes segmentation fault . thanks that filter returning invoices last modified since specified date (it uses if-modified-since http header). have tested code , works me, perhaps might filtering on wrong date field?

search - elasticsearch query issue with ngram -

i have data in index https://gist.github.com/bitgandtter/6794d9b48ae914a3ac7c if notice in mapping im using ngram 3 tokens 20. when execute query: get /my_index/user/_search?search_type=dfs_query_then_fetch { "query": { "filtered": { "query":{ "multi_match":{ "query": "f", "fields": ["username","firstname","middlename","lastname"], "analyzer": "custom_search_analyzer" } } } } } i should 8 documents have indexed 6 leaving out 2 names franz , francis. expect have 2 because f included in data. reason not working. when execute: get /my_index/user/_search?search_type=dfs_query_then_fetch { "query": { "filtered": { "query":{ "multi_match":{ "query": "fran", "fields": ...

qt - Suitable disposition between QML and C++ -

i constructing custom ui qt 5 mvc using qml/c++ , wondering how structure code in regard put in c++ , put in qml. purely visual parts (view) put in qml , data (model) in c++, parts aren't clear? should lean towards putting things in c++ , try reduce qml code somewhat, or better lean in other direction, i.e increasing qml code , reduce c++ parts? have not worked enough qt/qml able know best way this. both parts feasible imho, take lot of effort if need change afterwards , therefore want @ least right before begin create lot of code. what experiences in when designing qtquick interfaces? design components in c++ thin qml interface on top or other way around? pros/cons each solution? preferred way structure code when designing ui in qtquick? here's 2 cents worth. applies qt version 5.1 (ish) qml designed implement ui. i've designed parts visual implementation in qml. ui elements can't done in javascript "helpers" or views in c++. i'm usin...

c - Compare position of a string with an integer -

per example: string: 1 2 3 4 5 i want make loop compare each of string positions int provided user. tried if(atoi(string[i]) == value) but didn't seem work, need change other way around? (the int string, strcmp?) in advance i'm assuming you're doing in c++. atoi takes const char* argument, you're passing char. need this: std::string str(1, string[i]); if(atoi(str.c_str()) == value) ... or skip atoi altogether , do if(string[i]-48 == value) ... this works because numerals start @ ascii value of 48 , you're checking 1 character @ time. disclaimer: i'm assuming string char[] , therefore string[i] char

url mapping - Grails, different url for same controller and action -

i have urlmappings in grails "/"(controller: 'home', action: 'index') "/$id"(controller: 'home', action: 'index') is there better way write this, without duplicate code? if use one, other urlmapping won't work. thanks in advance if want combine 2 url mappings can making id parameter optional this: "/$id?"(controller: 'home', action: 'index')

java - how to implement timer the right way in JFrame -

i struggling find out how point in program change every second or 2 timer. have tried combinations, have been unsuccessful. believe there in actionlistener might have failed on. arraylist<point> punkter = new arraylist<point>(); int = 0; int n = 0; public point[] point = null; private timer timer; random rg = new random(); public timer(){ this.settitle("draw"); this.setdefaultcloseoperation(jframe.exit_on_close); this.setsize(1010, 710); this.setlayout(null); this.setlocationrelativeto(null); point = new point[100]; this.setvisible(true); timer = new timer(500,this); timer.start(); } public void paint(graphics g){ super.paint(g); (int = 0; < punkter.size(); i++) { point = punkter.get(i); point b = punkter.get((i+1)%punkter.size()); g.filloval(a.x, a.y, 5, 5); g.drawline(a.x, a.y, b.x, b.y); } } @override public void actionperformed(actionevent e) { // todo auto-...

c# - Can I execute a stored procedure many time in a for loop? -

i have web service executes stored procedure. web service function returns string[]. need call web service many times. for optimization reasons, thought adding function web service executes stored procedure many times, in for loop . way web service called once instead of several times. 1-is thinking correct ? 2-below code, part specific problem described above. 3-is not possible using loop ? my problem: if use code call stored procedure once, works, more (for loop iterates second time), catch block accessed. if can explain me why happening and/or suggest solution/workaround appreciate. try { (int = 0; < number; i++) { connection.open(); cmd = new sqlcommand(); //sqltransaction transaction; transaction = connection.begintransaction(); cmd.transaction = transaction; cmd.connection = connection; cmd.parameters.clear(); cmd.commandtext = "inse...

request - Integrate DynamoDb in Sails js -

actually tried start project sailsjs dynamodb data base. searching internet found package https://github.com/dohzoh/sails-dynamodb , found have complete documentation initial setup. i installed package project , proceeded set project follows: config/connections.js : dynamodb: { adapter: "sails-dynamodb" }, and config/models.js: connection: 'dynamodb' i put amazon keys in node_modules/sails-dynamodb/credentials.json i create next model: module.exports = { attributes: { idfacebook : { type : 'string', unique: true }, emailuser : { type : 'string', required : true }, nameuser : { type: 'string', required : true }, lastnameuser : { type: 'string', required : true } } }; and when sails lift, throw next error: /home/uppersky01/proyectos/gam...

javascript - If label contains this and not this prepend * -

i trying add * if label contains city, state, , zip. want happen if * not exist in label already. not sure if can concatenate contains , not contains together. - cannot edit forms , fields have * randomly put in. here 2 ways failed me. here fiddle- https://jsfiddle.net/4o24kylw/2/ here jquery //$("label:contains('city'):not(:contains('*'),label:contains('address'),label:contains('state'),label:contains('zip')").prepend( "* " ); $("label:contains('city'):not(:contains('*'),label:contains('address'),label:contains('state'),label:contains('zip')").prepend( "* " ); got answer... maybe can take in different direction... can simplify contains. similar label:contains('city', 'state', 'etc...'):not(:contains('*')).prepend( "* " ) or maybe way works :] this way if cannot simplified - $("label:contains('cit...

java - Aligning right in android only work for last view added -

Image
i'm trying align right dynamically several imageviews last 1 aligned. in order best understanding here picture: the activity layout set way: <scrollview android:layout_width="match_parent" android:layout_height="match_parent" android:fillviewport="true" android:id="@+id/scrollview" android:layout_below="@+id/button"> <linearlayout android:id="@+id/imagem" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" > </linearlayout> </scrollview> and in code within linearlayout called imagem add more layouts in order give me final result, here code adding single line: linearlayout layout = (linearlayout)findviewbyid(r.id.imagem); linearlayout llay = new linearlayout(this); linearl...

dynamics crm - How to Create a Timeout In a CRM Workflow That Uses a Static Attribute Value -

i'm specifying timeout in workflow within crm against particular contact attribute (next time run): timeout until "contact:next time run" this works great, until updates "next time run" attribute. when happens, crm re-evaluates timeout , adjusts new "next time run" value. don't want. want timeout use value of "next time run" when workflow triggered (static). don't want timeout dynamically update based on attribute changing. how do this? i tried solution , believe solves problem: i added field ("hidden time run") entity, date field doesn't appear on form. workflow steps: when workflow triggered, copy date "next time run" "hidden time run". timeout until "contact: hidden time run" thus, changing "next time run" attribute won't have effect on when workflow expected run.

python - MaxDoubleSliceSum Algorithm -

i'm trying solve problem of finding maxdoubleslicesum value. simply, it's maximum sum of slice minus 1 element within slice (you have drop 1 element, , first , last element excluded also). so, technically first , last element of array cannot included in slice sum. here's full description: a non-empty zero-indexed array a consisting of n integers given. triplet (x, y, z) , such 0 ≤ x < y < z < n , called double slice. sum of double slice (x, y, z) total of a[x + 1] + a[x + 2] + ... + a[y − 1] + a[y + 1] + a[y + 2] + ... + a[z − 1] . for example, array a such that: a[0] = 3 a[1] = 2 a[2] = 6 a[3] = -1 a[4] = 4 a[5] = 5 a[6] = -1 a[7] = 2 contains following example double slices: double slice (0, 3, 6) , sum 2 + 6 + 4 + 5 = 17 , double slice (0, 3, 7) , sum 2 + 6 + 4 + 5 − 1 = 16 , double slice (3, 4, 5) , sum 0 . the goal find maximal sum of double slice. write function: def solution(a) that, given non-empty zero-indexed array a consis...

Google Chrome Mobile Emulator: How to show on screen keyboard -

Image
i'm debugging mobile version of our website through chrome's mobile emulation tool, cannot figure out how have on-screen keyboard pop when selecting text field. i have clicked on text box, no keyboard pops up. if on mobile device, default input method (keyboard) pops , allows me type. is there way replicate this? latest chrome developer tools have added support emulating different device states: default browser ui with chrome navigation bar with opened keyboard according documentation , such feature available when emulating “supported devices nexus 5x” . the complete list of emulated devices support feature can found @ chromium source-code . currently, supported by: nexus 5 nexus 5x note emulated keyboard , navigation bar static pictures (as can see @ source-code directory ) , don't contain interactive behavior. enough way simulate screen size, not perfect emulation.

jquery - Mulitple divs/same class with different css -

i need change style of div has same class other divs. site built umbraco , don't have access html add id div trying change. structure of html looks this <header>...</header> <div class="container">...</div> <div class="container">...</div> <div class="container">...</div> i need add background image 3rd div. not sure of proper way rather can done css or if it's best use javascript. tried using jquery select div index wasn't getting anywhere that. started with. <script> $( ".container:eq( 2 )" ).css( "background", "url(/media/9165540/happy-female.jpg)" ); </script> i need add background-size: cover; but wasn't sure how add well. appreciated. thanks in jquery can use: $('.container').eq(2).css({'background':'url(/media/9165540/happy-female.jpg)', 'background-size': 'cover'}); or add spe...