Posts

Showing posts from June, 2012

javascript - Value not changing in onchange -

in page i'm having multiviews. when user add button in 1st view, transfers 2nd view. in 2nd view having full of text boxes filling. if enters text , tries go away without saving. prompt should come keep changes or navigate away. functionality had done following code. whenever user onchange of textbox in form i'm changing hiddenfield(taken hidden field indicates whether having dirty data or not) value 0 1. but i'm unable access hidden field value in function. var = 0; $(function() { $("input[type='text']").change(function() { $("#testhidden").val("1"); //changed hidden field value 1 = 1; // changed value console.log("a " + a); console.log("testhidn value " + $("#testhidden").val()); }); }); $(function() { alert(a); //always getting "a" value "0" though changed. if (window.history && window.history.pushstate) { if (a ...

Number of Partitions of Spark Dataframe -

can explain number of partitions created spark dataframe. i know rdd, while creating can mention number of partitions below. val rdd1 = sc.textfile("path" , 6) but spark dataframe while creating looks not have option specify number of partitions rdd. only possibility think is, after creating dataframe can use repartition api. df.repartition(4) so can please let me know if can specify number of partitions while creating dataframe. you cannot, or @ least not in general case not different compared rdd. example textfile example code you've provides sets limit on minimum number of partitions . in general: datasets generated locally using methods range or todf on local collection use spark.default.parallelism . datasets created rdd inherit number of partitions parent. datsets created using data source api: in spark 1.x typically depends on hadoop configuration (min / max split size). in spark 2.x there spark sql specific configuratio...

C application HTTP failing when re-establishing a connection -

i'm developping application run on bosch device - xdk - http://xdk.bosch-connectivity.com/ . at moment, have task implements http client , sends post requests server. however, main purpose of application able move between areas network coverage/no coverage. means i'm suspending/re-starting task implements http client. so i'm having problem http client in following scenario: start application in region coverage, move region no coverage , finally, go again region coverage. that's here i'm getting problems. moment, can't connect anymore http client. i'll post here pieces of code of application can suggest me alterations solve problem. functions such httpclient_initrequest, httpmsg_setrequrl, msg_prependpartfactory, ..., belong api provided xdk. void appinitsystem(xtimerhandle xtimer) { (void) (xtimer); return_t retvalue = failure; retcode_t wlanret = rc_platform_error; wlanret = wlan_init(); if (wlanret != rc_ok){ print...

android - Cordova Ionic App - check for the internet connection -

i've completed newsreader app, works => hurray, apart internet checks. when device not connected internet, app doesn't notify user fact. i have internet check working, want connect every single request, app doesn't break if connection go down while using it. i kind of new async way of doing things in ionic, , have straight question: there way make sure device connected internet before executing request? believe me, i've tried interceptors, , can't seem work. the idea this: if app finds out, device not connected internet (wi-fi turned off, or mobile data turned off, whole extent of internet check), uses $ionicpopup notify user. 2 buttons: "refresh", "close". upon clicking "refresh", internet check performed again, until connection on. during time, request held. clicking "close" closes dialog , request gets rejected ( .reject() ). a perfect solution while() loop , blocking $ionicpopup , $ionicpopup love asynchr...

C# file not being written to until the application finishes running -

i've got set of specflow tests i'm running , i'm trying write results far file after each scenario finishes, , write again @ end of entire test run. if run tests in debug mode code hit after each scenario, file appears in windows explorer after tests finish (or force tests stop). code below, writes file in separate project specflow test project. i not flushing , had in place of streamwriter: using (var file = new fileinfo(filepath).appendtext()) but wasn't working, after looking various examples on internet added flush, close, process.start, changed streamwriter , none of them helped. current code still isn't working is: private string rootfolderpath = directory.getparent(@"..\..\..\..") +@"\"; public void writealltestscenarionames(list<scenarioresult> results, string filename, string directoryname) { results.sort(); directory.createdirectory(rootfolderpath + directoryname); string filepath = ...

javascript - Loading ES6 template string from file -

let me explain actual problem. have template string this: /${name} post /{id} /file-content post the indentation has remain untouched. now if use such template string might this: function test(arr) { let ret = [] arr.foreach( function(name) { return `/${name} post /{id} /file-content post` return ret } ) } looks pretty ridiculous, right? of course put spaces template match code indentation, i'd have perform unnecessary operations on string afterwards normalize again. so idea move template string external file , require file whenever need template string. require can't used problem because it's nothing more text file , don't want read file disk every time need , perform eval on it. i think of several workarounds problem, cannot seem find satisfying solution. how this: // template.js module.exports = name => ` /${name} post /{id...

ASP.NET: Is there a way to serve static html files without programming comments? -

i'm serving static html, , want them sent client without <!-- comment --> comments, can compromise security. is there way this? something similar razor's @* comment *@ html... you write comments in between razor's comment tags instead of html comment tags. won't visible on front-end. besides this, printing put in html file text (server-side scripts razor , php excluded). there no way take comments out of static html unless minify them on server through tool. since state static html pages, i'm guessing aren't using tools @ all? you use tools http://www.willpeavy.com/minifier/ , example. the security risks of leaving comments in shouldn't bad. shouldn't putting valuable information in html comments in first place. nowadays used showing element starts and/or ends when other programmers take over. your javascript visible on website well. let's work ajax calls , database. create more risk html comments. obviously, have ma...

ms word - Win32 OLE (perl) - resize table column width to text -

i have perl script adds rows text existing table in word document using win32::ole. now, have resize table's columns match text size (just double-clicking on vertical line between 2 columns) know how set column specific width, can't seem find api resizing column match text size. can tell me for? for reference, here code snippet script: my $tbl = $document->tables(1); $row = $tbl->rows->add(); $row->cells(1)->range()->insertafter($timestamp); $row->cells(2)->range()->insertafter($comment); $row->cells(3)->range()->insertafter($username); # todo: resize columns match content have tried cells.autofit() method? e.g. columns.autofit it seems supported excel 2010 , newer, though. https://msdn.microsoft.com/en-us/library/office/ff837476.aspx

java - set margin between Drawer icon and title -

Image
i'm creating persian app , drawerlayout there space between drawer icons , titles how can decrease ? i've tried use custom style didn't worked by way used code make app rtl @targetapi(build.version_codes.jelly_bean_mr1) private void forcertlifsupported(){ if(build.version.sdk_int >= build.version_codes.jelly_bean_mr1){ getwindow().getdecorview.setlayoutdirection(view.layout_direction_rtl); }} layout code : <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" tools:opendrawer="start"> <include layout="@layout/a...

.net - Create TCP socket from unmanaged file descriptor in C# -

i'm using unmanaged c library, libusbmuxd , create tunnel phone though usb cable. connects device , returns file descriptor socket of connection. /** * request proxy connect * * @param handle returned 'usbmuxd_scan()' * * @param tcp_port tcp port number on device, in range 0-65535. * common values 62078 lockdown, , 22 ssh. * * @return file descriptor socket of connection, or -1 on error */ int usbmuxd_connect(const int handle, const unsigned short tcp_port); i want send ssh commands through using ssh.net, ssh.net supports communication through tcp port. how can make listening tcp socket file descriptor can use ssh.net (e.g. var connectioninfo = new connectioninfo("127.0.0.1", "22", "mobile", authenticationmethod) )? i know can make filestream object unmanaged file descriptor. can maybe use c# object create socket though ssh.net communicate?

java - compare treeset for equality -

i have 2 sets of hashset converted treeset sort ease of comparison. after converting hashset treeset . when compare these 2 treeset using 'equals' function, says different. debug it, shows same content same order. can not understand wrong ? public class testproductbundle { @suppresswarnings("unused") public static void main(string args[]) { // hashset set<classa> hashseta = new hashset<classa>() { { add(new classa("name", 1, "desc")); add(new classa("name", 2, "desc")); add(new classa("name", 3, "desc")); } }; set<classa> hashsetb = new hashset<classa>() { { add(new classa("name", 1, "desc")); add(new classa("name", 2, "desc")); add(new classa("name", 3,...

cakephp 2.0 - PHPExcel works in one view but thows errors in all others -

i have view generates excel sheet , works fine. when go other view within model, error: missing helper error: phpexcelhelper not found. error: create class phpexcelhelper below in file: app_myapp/view/helper/phpexcelhelper.php <?php class phpexcelhelper extends apphelper { } my controller: app::import('vendor', 'phpexcel', array('file' => 'phpexcel.php')); class invoicescontroller extends appcontroller { public $components = array('requesthandler','phpexcel'); public $helpers = array('html', 'form', 'js'=>array("jquery") ,'phpexcel' ); i tried putting app::import line in function generating excel sheet still same error on other page in model. help/direction appreciated! i fixed removing phpexcel helpers line...changing: public $helpers = array('html', 'form', 'js'=>array("jquery...

appcelerator - Is there a way to force the camera orientation to stay in portrait? -

my app's orientation set portrait mode in tiapp.xml , the window's orientation mode set portrait. when open camera, orientation not locked portrait, still rotates. there way lock because need capture photos in portrait mode? in cameraoptionstype dictionary pass options ti.media.showcamera can set autorotate boolean property: false locks camera preview rotation.

google compute engine - How to handle the load spikes and queue the requests? -

is there configuration in kubernetes in can specify minimum number of requests queued before new instance gets spawned? this context: have got powerful high cpu machines set our use case , every request levies high amount of load on server. works perfect until reach specific number say... 300 requests ramp-up time of 100 milliseconds. , point receiving connection refused error time , server starts handle them once new machine spawned. best way handle load spikes? looking "pending latency" config in app engine. application deployed on google compute engine , orchestrated kubernetes. you can use readinessprobe (see container probes ) indicate container ready service requests, , use horizontalpodautoscaler automatically scale apps up/down based on observed cpu utilization. hope helps.

SharePoint 2013 workflow in Project server 2013 send email functionality gives '500' error -

Image
whenever start workflow automatically gets cancelled , gives '500' error. , here screen shots of error. i using send email functionality in workflow, , gives below error. please me out on this. my suggestion validate log files on web server see actual error is. can say, experience, issue either value entered workflow email in "to:" address or user profile missing information, namely field internal name "email" field (which may renamed such "work email".) you can view user information list users blank "email" column following url: https://yourpwaserver/_catalogs/users/detail.aspx?filterfield1=email&filtervalue1= in environment, had several users actual value of "undefined" iun "email" column able view following url: https://yourpwaserver/_catalogs/users/detail.aspx?filterfield1=email&filtervalue1=undefined

r - ggplot2: Why are my text annotations not aligned right? -

Image
i trying label straight line segment using annotate . however, setting angle of annotation slope of line not align annotation line segment. library(ggplot2) ggplot(data.frame(x = seq(0, 14, 0.1)), aes(x = x)) + stat_function(fun = function(x) { 14 - x }, geom = "line") + theme_bw() + annotate( geom = "text", x = 7.5, y = 7.5, label = "x + y = 14", angle = -45) # nistunits::nistradiantodeg(atan(-1)) this gives: can explain phenomenon, , how fix this, i.e., align annotation have same angle line segment? i believe should give want. see answer reference get width of plot area in ggplot2 . #plot can reference viewport ggplot(data.frame(x = seq(0, 14, 0.1)), aes(x = x)) + stat_function(fun = function(x) { 14 - x }, geom = "line") #get currentvptree , convert vp's height/width inches current.vptree() <- convertwidth(unit(1,'npc'), 'inch', true) b <- convertheigh...

hadoop - aggregate ordered rows in hive table -

i have table in hive 4 columns this: row_id| user_id|product_id| duration 1 1 product1 3 2 1 product1 1 3 1 product2 6 4 1 product3 2 5 1 product1 4 6 1 product4 3 7 1 product4 5 8 1 product4 7 9 2 product4 3 10 2 product4 6 i want aggregate rows of same product each user, sum duration , count clicks if consequent in order row_id| user_id|product_id |duration_per_product |clicks_per_product 1 1 product1 4 2 2 1 product2 6 1 3 1 product3 2 1 4 1 product1 4 1 5 1 product4 15 3 6 2 product4 9 2 any ideas how in hive 1.1.0? group doesn't work because don't want group products if consequent , have trie...

drop down menu - How to use select (dropdown) tag in Elm lang -

i want render simple dropdown within elm app following code it's not working expected. want keep union type role in place , avoid using strings if it's possible. what's best way work dropdown in elm? didn't find example yet. import html exposing (..) import html.app exposing (beginnerprogram) import html.events exposing (..) import html.attributes exposing (..) import json.decode main = beginnerprogram { model = initialmodel , view = view , update = update } initialmodel = { role = none } type role = none | admin | user type alias model = { role: role } type msg = selectrole role update msg model = case msg of selectrole role -> { model | role = role } view : model -> html msg view model = div [] [ select [ ] [ viewoption none , viewoption admin , viewoption user ] , pre [] [ text <| tostring model ] ] viewoption : role -> html msg vie...

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot...

asp.net - How to use short urls for categories in MVC -

short urls containing product categories like http://example.com/computers should used in asp.net mvc 4 shopping cart. if there no controller, home index method id parameter computers should called. i tried add id parameter home controller using public class homecontroller : mycontrollerbase { public actionresult index(string id) { if (!string.isnullorwhitespace(id)) { return redirecttoaction("browse", "store", new { id = id, }); } return view("index", new homeindexviewmodel()); } but http://example.com/computers causes 404 error server error in '/' application. the resource cannot found. description: http 404. resource looking (or 1 of dependencies) have been removed, had name changed, or temporarily unavailable. please review following url , make sure spelled correctly. requested url: /computers ...

protractor integration with jenkins -

i need in integrating protractor code jenkins. new jenkins not sure if jenkins or cruise control right have builds in cruise control okay migrate jenkins if better. can please me tutorials link protractor task jenkins or cruise control? using gulp wrapper on javascript code execution. running command gulp test --site folder name should specify command in execute shell script option of jenkins? yes, running protractor tests ci tool not complicated step 1:just configure cruise control/jenkins job "execute shell" build step step 2: depending on choice of running tests .. create bat file echo protractor execution protractor protractor.conf.js // in case running protractor npm run --e2etests // in case running npm run config in package.json gulp test --site folder name // in case echo on , out. step 3: point job build step trigger batch file

bash command(sed) to remove XML Node -

i'm trying create bash command delete particular node in xml if contains string starting particular few characters for e.g. if xml this: <x> <y> abc... </y> <y> trf... </y> <y> abc... </y> </x> then i've remove such y nodes have values starting abc... string in end, should remain below: <x> <y> trf... </y> </x> i searching , found, 'sed' commmand similar of regular expressions. trying read various other similar questions on site , tutorials getting overwhelmed i know, asking kind-of spoon feeding please suggest if can done i've next few hours available before i've start associated activity! also there easy tutorial on 'sed' finding learning , understanding little complex ..whatever found till on net. thanks ! if open use awk , following command can used print line not contains abc in it. awk '!/<y> abc/' xml <x>...

javascript - what does it mean to wrap an in place function with a jquery selector? -

i confused happening here: $("a[class='delete']").click(function(e) { $( function() { $( "#dialog" ).dialog({}); } ); }); i see @ first link element selected , when click event on link happens function executed. function says select (i guess because of $ sign) whatever output of function is. next function selects element dialog class , runs dialog function on it. practically happens html element has class dialog comes on screen dialog box. question why function selects dialog box element inside of selector? i know when delete selector wrapping function() there syntax error (which don't quite understand) why not use code: $("a[class='delete']").click(function(e) { $( "#dialog" ).dialog({ }); }); passing function $() same thing as $(document).ready(function() { /* */ }); in case, looks code written confused person. there's no reason set code "ready" handler in r...

python - Wget command "Post" with --no-check-certificate failed :Certificate common name doesnt match -

i'm running on windows>visual studio>python , using wget in code. i'm trying call api (post). this code: apiwget = [wgetinstallationfolder,'--no-check-certificate',"--post-data="% postfile,"--output-file="+tempreadwritepath + 'tempreadwritefile' + timenow + '.txt',"--wait=2","--content-on-error","--header="+header, "--output-document="+tempreadwritepath + 'tempreadwritefile' + timenow + '.txt',"--timeout=3","--tries=3", "--save-headers", "https://" +apigwip +"xxxxxxxx/"] call(apiwget) and getting certificate common name doesn't match.. mention when call same api "get" works ok.

ios - Attempt to dismiss from view controller (UIModalViewController) while a presentation or dismiss is in progress -

i have started working on ios. created modalviewcontroller (vc1) , presented modalviewcontroller (vc2) . there button (dismiss) on vc2 have dismiss both viewcontrollers. the way know call :- [self dismissviewcontrolleranimated:yes completion:nil]; in vc2 call same in vc1 so created delegate tells me if dismiss clicked in vc2. when dismiss clicked:- i call [self dismissviewcontrolleranimated:yes completion:nil]; in vc2 delegate method takes me vc1 again call [self dismissviewcontrolleranimated:yes completion:nil]; this method working till using app in ios9 when shifted ios7 started getting warning , vc1 not getting dismissed. please let me know why happening. so part works me told in comments. [self.presentedviewcontroller dismissviewcontrolleranimated:yes completion:^{ [self dismissviewcontrolleranimated:yes completion:nil]; }]; so, error tells happened. trying dismiss vc1, while vc2 dismissing. putting dismissviewcontrolleranimated d...

java - Is this recursive linear search code correct? -

public class recursivelinearsearch { public static void linearsearch(int[] a,int l,int x,int i) { if (l==1) { if (a[i]==x) { system.out.println("number at:"+i); return; } else return; } else { if (a[i]==x) { system.out.println("number at:"+i); return; } else { i=i+1; l=l-1; linearsearch(a,l,x,i); } } } public static void main(string[] args) { int[] a={1,2,3,4,6}; int l = 5; int x = 6; int i=0; linearsearch(a,l,x,i); } } is recursive linear search code correct? new java wanted make sure on right track.how can code improved? ...

c# - text/plain Media Type not being accepted for WebApi v2 -

this problem started off ie9, post requests, contenttype has text/plain , , application/json not work. i've added moonscript , proceeded use contenttype: text/plain . i've added custom media type api, shown on numerous forms below: http://www.stormbase.net/2015/09/21/webapi-post-plaintext/ how post plain text asp.net web api endpoint? and added insertion of text/plain media type webapiconfig config.formatters.jsonformatter.supportedmediatypes.add(new mediatypeheadervalue("text/html")); config.formatters.jsonformatter.serializersettings.referenceloophandling = newtonsoft.json.referenceloophandling.ignore; config.formatters.jsonformatter.serializersettings.formatting = newtonsoft.json.formatting.indented; // allows 'text/plain' supported media type config.formatters.add(new textmediatypeformatter()); however, when posting in ie9 (using emulation), still receiving 415 unsupported media type key value response http/1.1 415 unsup...

javascript - f.className.indexOf is not a function - highlighter.js -

Image
i building app ionic , in console getting following error highlighter.js in chrome : it not big issue, since app working correctly understand why getting such error. did searches, not find proper solution problem. have idea on cause of issue? thanks in advance replies! i have found issue is: connected chrome extension called multi-highlight , re-installing have solved problem.

How to increment address of the register in the Ruby language? -

i trying increment address of register using increment operator in ruby throwing error "can't convert fixnum string". can use increment operator increment address of register? error: test_write_memory_value(testremotesalad): typeerror: can't convert fixnum string d:/vidyanath/sc_165/fruit-salad/src/targets/remotesalad.rb:1649:in `+' d:/vidyanath/sc_165/fruit-salad/src/targets/remotesalad.rb:1649:in `block in write_memory_value' d:/vidyanath/sc_165/fruit-salad/src/targets/remotesalad.rb:1647:in `each' d:/vidyanath/sc_165/fruit-salad/src/targets/remotesalad.rb:1647:in `write_memory_value' test/test_remote_salad.rb:150:in `test_write_memory_value' finished in 2.557483 seconds.

javascript - FabricJS weird line animation with pageSnap -

i using fabricjs create js line animation , use pagesnapjs create snapping sections. however, line animation behavior quite random. if slowly scroll color pages, you'll see red line animation. page 1 2 fine, page 2 3 fails. calculation incorrect? how correct it? here code (jsfiddle @ end of question): var canvas; var current_page = 1; var is_animating = false; var line_options = { stroke: 'red', strokewidth: 3 }; $(document).ready(function() { canvas = new fabric.canvas('line_effect'); canvas.setheight($('.indicator').height()); canvas.setwidth(50); canvas.renderall(); var section_h = $('.section').height(); var startpts = [ {x: 48, y: 0}, {x: 48, y: $('.section').height()} ]; var endpts = [ {x: 48, y: $('.section').height() * 2}, {x: 48, y: $('.section').height()} ]; var line = new fabric.polyline(startpts, line_options); canvas.add...

sql - Inserting multiple rows with one single query -

this question has answer here: best way multi-row insert in oracle? 5 answers i able insert 2 rows following query. should insert more rows it? insert friend_name( friend_id, first_name, middle_name, last_name) select 3, 'rich', 'mond', 'hill' dual union select 4, 'monunica', 'bellu', 'cia' dual you can try well: insert demo_table values (1, 'one', 'x' ) demo_table values (2, 'two', 'y' ) demo_table values (3, 'three', 'z' ) select * dual; @kiranavula..incase need insert records few column of table use below: inserting record 1 column of table. insert demo_table(a) values ('one') demo_table(a) values ('two') demo_table(a) values ('three') s...

javascript - replace method works without html formatting but with formatting -

i trying replace color of text when user clicks on cell value. seems when try use formatting in html, stopped working, however, works totally fine without formatting. jsfiddles in understanding taking about. before that, mention few things: when not formatting, using <div id='jqxpanel' style=" font-size: 13px; font-family: verdana;"> content here </div> , var text = panel.text(); when using formatting, using <div id='jqxpanel' style=" font-size: 13px; font-family: verdana;"><div style="margin: 10px;"><pre>my content here </pre></div></div> , var text = panel.html(); here working jsfiddle without formatting , non working jsfiddle formatting feature. how can make non working jsfiddle work can see highlighted text? i updated jsfiddle $("#jqxgrid").on("cellclick", function (event) { var value = event.args.value; var col...

jquery - How to create an array in javascript with element at specific position only? -

i need create array in javascript 1 (or more) given element @ given position. see following snippet: params = []; params[5] = "my value" params[14] = "my other value"; console.log(params); all elements don't initialize (as expected) undefined. can delete these undefined elements, before or after array created? also, happens if set array post data jquery $.ajax() call? why don't use object then? params = {}; params[5] = "my value" params[14] = "my other value"; console.log(params);

python - Pandas: Can you access rolling window items -

can access pandas rolling window object. rs = pd.series(range(10)) rs.rolling(window = 3) #print's rolling [window=3,center=false,axis=0] can groups?: [0,1,2] [1,2,3] [2,3,4] i start off saying reaching in internal impl. if really wanted compute indexers same way pandas. you need v0.19.0rc1 (just released), can conda install -c pandas pandas=0.19.0rc1 in [41]: rs = pd.series(range(10)) in [42]: rs out[42]: 0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9 dtype: int64 # reaches internal implementation # first 3 window, second minimum periods # need in [43]: start, end, _, _, _, _ = pandas._window.get_window_indexer(rs.values,3,3,none,use_mock=false) # starting index in [44]: start out[44]: array([0, 0, 0, 1, 2, 3, 4, 5, 6, 7]) # ending index in [45]: end out[45]: array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) # windo size in [3]: end-start out[3]: array([1, 2, 3, 3, 3, 3, 3, 3, 3, 3]) # indexers in [47]: [np.arange(s, e) s, e...

javascript - Build view with new child views in regions -

i use marionette 3.0. i have blockview have variable number of regions. these regions filled blockregionviews collectionviews (they in 2.x) , these views render further blockviews. write function create blockview it's regions filled (empty) blockregionviews, , return blockview. so i've written code: var blockview = new blockview({model: blockmodel}); var regions = blockmodel.get('regions') for(var in regions) { var blockregionmodel = regions[i]; var blockregionview = new blockregionview({model: blockregionmodel}); blockview.addregion(blockregionmodel.get('position'), '...regiondefinition...'); var region = blockview.getregion(blockregionmodel.get('position')); // line error. region.show(blockregionview); } return blockview; of course code bad. show function's name suggests it's not right function me (since don't want show views @ time), can't find in documentation. so question is: how should b...

entity framework - DropCreateDatabaseIfModelChanges -

i trying set initializer used in test environment. read, dropcreatedatabaseifmodelchanges need. times database gets out of sync model, , need start on fresh. so here how went setting context constructor public applicationcontext(int dbid, string username) : base(dbid, username) { database.setinitializer<applicationcontext>(new dropcreatedatabaseifmodelchanges<applicationcontext>()); database.initialize(true); } however, when have initializer set up, still error: "the model backing "applicationcontext" has changed since database created. consider using code first migrations update database" some other things note: i have tried setting automicmigrationsenabled = false true in migrations config file. i have tried , without forcing initialization anybody run same issue or have ideas? update able through source code system.data.entity here: https://github.com/hallco978/entityframework/tree/master/src/entityframew...

Is it Possible to get the multiple set result into single set of result in SQL Server? -

Image
my sql table looks this create table [contents].[id] ( [id] nvarchar (20) not null, [name] nvarchar (max) not null, [content] nvarchar (max) null, [parent_id] nvarchar (20) not null, [type] int not null, [shared] int not null, [created] datetime null, [icon] varbinary (max) null, [updated] datetime null ); every item has parent item except major items. need required item parent, parent of parent, until item having no parent.. i used following query declare @id nvarchar(max)='12843686753443770653'; way: set @id = (select parent_id contents.id (id = @id)) select * contents.id (id = @id) if @id!='jkparthiban' goto way i got result: i need results in single set instead of multiple sets. you can use recursive cte results declare @id nvarchar(max)='12843686753443770653'; ;with cte ( select id, name contentsid id = @id union...

arduino - Contour position with "findcontour" opencv on processing -

i'm working on project have use webcam, arduino, raspberry , ir proximity sensor. arrived of google. have big problem that's think. i'm using opencv library on processing , i'd contours webcam in center of sketch. arrived move video , not contours here's code. hope you'll me :) all best alexandre //////////////////////////////////////////// ////////////////////////////////// libraries //////////////////////////////////////////// import processing.serial.*; import gab.opencv.*; import processing.video.*; ///////////////////////////////////////////////// ////////////////////////////////// initialization ///////////////////////////////////////////////// movie mymovie; capture video; opencv opencv; contour contour; //////////////////////////////////////////// ////////////////////////////////// variables //////////////////////////////////////////// int lf = 10; // linefeed in ascii string mystring = null; serial myport; // serial port int...

java - Android Studio. Emulator works. App does not run -

i'm using androiod studio 2.1.3. i've made app. no errors, emulator comes up, works, acts phone. problem app not run. cleared errors except saw one: error while waiting device: emulator process avd nexus_5_api_23 also, tried rebuilding app , got following : exception in thread "png-cruncher_62" java.lang.runtimeexception: timed out while waiting slave aapt process, make sure aapt execute @ c:\users\owner\appdata\local\android\sdk\build-tools\24.0.2\aapt.exe can run (some anti-virus may block it) or try setting environment variable slave_aapt_timeout value bigger 5 seconds @ com.android.builder.png.aaptprocess.waitforready(aaptprocess.java:108) @ com.android.builder.png.queuedcruncher$1.creation(queuedcruncher.java:110) @ com.android.builder.tasks.workqueue.run(workqueue.java:203) @ java.lang.thread.run(thread.java:745) and that's repeated several times different number on png-cruncher. ideas? i saw...

gmail - What is the standard way to get a list of bounced emails to remove it from mailing list through API or otherwise -

i running marketing campaign through amazon ses , other few services. email providers zoho , gmail. what need know how can list of emails have bounced , remove mailing list keep list cleaned. need on daily basis. gmail or zoho give provides way list through api or other way? afaik ses not provide api list directly of bounced emails. gmail or zoho provide api? i think, can collected through scraping inbox. doing manually not feasible option. what missing. standard way handle problem? what need scrape inboxes bounced emails subject. read imap. also, check out imaplib package , email package python. https://docs.python.org/3/library/imaplib.html https://docs.python.org/3/library/email-examples.html this blog can helpful: https://yuji.wordpress.com/2011/06/22/python-imaplib-imap-example-with-gmail/

ios - Swift: Generic Type conform Protocol -

i have problem generic type. want check if generic type conform protocol , after pass generic function. example have function: func requestsignal<t:mappable>(target:api) -> signalproducer<[t], nserror> and want this: func request<t>(target:api, withobjecttype type: t.type) { if let mappabletype = type as? mappable.type { let requestsignal: signalproducer<[?????], nserror> = self.requestsignal(target) } but if tried pass t - doesn't conform mappable. if pass mappabletype - not type you can define t mappable, in first function. func request<t: mappable>

oracle - What is the meaning of the dot in SQL from statement -

let's have simple query select name_before_dot.name_after_dot what meaning of dot in clause? is kind of separator or table name dot in it? mind you, have searched so, threads talking dot in select or where, know related aliases, dot in still mystery me. this database schema. full three-part name of table is: databasename.schemaname.tablename for default schema of user, can omit schema name: databasename..tablename you can specify linked server name: servername.databasename.schemaname.tablename you can read more using identifiers table names on msdn : the server, database, , owner names known qualifiers of object name. when refer object, not have specify server, database, , owner. qualifiers can omitted marking positions period. valid forms of object names include following: server_name.database_name.schema_name.object_name server_name.database_name..object_name server_name..schema_name.object_name server_name...object_name ...

css - Rails 5, Sass::SyntaxError cannot precompile assets -

i have started new project ( rails 5.0.0.1 && ruby 2.3.1p112 ) , can't seem assets precompile. current structure looks this. app/assets/config/manifest.js //= link_tree ../images //= link_directory ../javascripts .js //= link_directory ../stylesheets .css app/assets/stylesheets/application.scss * *= require_tree . *= require font-awesome *= require style *= require_self */ app/assets/stylesheets/style.scss @import "bootstrap-sprockets"; @import "bootstrap"; // shared styling @import 'shared/variables'; @import 'shared/content'; ... ... app/views/layout/application.html.haml ... = stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' ... inside app/assets/stylesheets/helpers/_varibles.scss file have set varibles $font-family-standard: 'arial', sans-serif; $font-family-default: 'open sans', 'arial', sans-serif; $color-primary: #f...

How to Pass Data OR communicate Between Two Dependent Gulp tasks? -

i want run task in sequence, want pass data 1 task another. here code. gulp task 1 -> compile html gulp.task('compile:html', function () { return gulp.src(['src/templates/*.html', 'src/templates/*.template']) .pipe(plumber()) .pipe(nunjucksrender({ data: templateconfig, //in templateconfig environment saved path: ['src/templates/'] })) .pipe(gulp.dest('src/')); }); gulp task 2 -> generate build gulp.task('build:production', function (callback) { var temp = templateconfig.env; templateconfig.env = 'production'; gulp.start('compile:html'); settimeout(function () { //gulp.src('./src/assets/**/*.*').pipe(gulp.dest('./generated/dist/production/assets')); gulp.src('src/*.html') .pipe(userref()) .pipe(gulpif('*.js', uglify())) .pipe(gulpif('*.css', minifycss())) .pipe(gulp.dest('./dist/producti...

Xaml strange behavior: textbox changed flowdirection -

i have question - have textbox in application. 1 minute other, changed flow direction lefttorigt righttoleft. of course checked it's style , (because other textboxes, inheriting same style, behave in normal way. i can't explain myself - there can make behave again? tried setting flow direction explicitly nothing changed.... unfortunately can't find answers on net... update xaml looks this: <textbox x:name="m_tbmaschine" margin="0 15 10 15" grid.row="2" materialdesign:textfieldassist.hint="maschine" materialdesign:textfieldassist.hintopacity=".3" verticalalignment="bottom" text="{binding path=aktuellemaschine.maschinebezeichnung, validatesondataerrors=true, updatesourcetrigger=propertychange...

How can I make maven fail on Windows if it is not running as Administrator -

i have maven project builds installer, part of process needs running in administrator cmd shell. bad thing run 15 minutes , happily produce wrong output if not running admin. make maven exit error if not running admin. easy way this? i approach problem executing batch @ start of build, , fail build if batch not detect admin mode (and returns specific failure code). to more precise: executing batch can done maven-exec-plugin . have bind validate phase in order execute right @ start of build ( https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html ). the content of batch you. mean admin ? can try create file in c:\ example , return error code if fails. finally can use successcodes of maven-exec-plugin make build fail if not admin. parameter documented here: http://www.mojohaus.org/exec-maven-plugin/exec-mojo.html#successcodes

java - Find and set onClickListener on Buttons using a for loop [Android] -

i have created 10 buttons in layout file , want "find" them , store them in array. want want put different onclicklistener on each of them every button press else. (in case want them submit value 0-9, first button submits 0, second 1, etc). here code have far: package de.lucbe.tilt; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.widget.button; public class mainactivity extends appcompatactivity{ button[] buttons = new button[10]; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); for(int = 0;i < buttons.length; i++ ){ string buttonid = "button" + i; int resid = getresources().getidentifier(buttonid, "id", getpackagename()); buttons[i] = ((button) findviewbyid(resid)); } } } thank in advance. for(int = 0;i<buttons.length;i++){ ...

android - QML application displays black screen -

i beginner in qml dont think doing in project still getting black screen when run application on android device. main.qml import qtquick 2.6 import qtquick.window 2.2 rectangle { visible: true width: 640 height: 480 mousearea { anchors.fill: parent onclicked: { qt.quit() } } text { text: qstr("hello world") anchors.centerin: parent } } button .qml import qtquick 2.0 rectangle { id: mainbtn property alias text: lable.text width: 165 height: 50 radius: 2 border.width: 2 text { id: lable font.bold: true font.pointsize: 17 width: parent.width wrapmode: text.wordwrap horizontalalignment: text.alignhcenter anchors.centerin: parent } mousearea { anchors.fill: parent onclicked: { console.log("1") } } } try use applicationwindow root compone...

Alter CSS dynamically using JQuery (or simple Javascript) based on date comparison -

i hand-coding small calendar of events. wish display basic event information (date, time, location, link learn more). since page have more 10-20 events listed @ given time (and once or twice per year), i'm not over-engineering using calendar plugin or anything. all wish compare current date against html5 <time date=""></time> attribute , alter css on parent element if date specified in past (by @ least 1 day). by default background color of <li> element class .event white ( #fff ). if date in past, want background color on <li class='event'> class change grey ( #ddd ) when page loads. <doctype html> <html> <head> <title>events</title> <style> .event { background-color: #fff; } </style> <script> </script> </head> <body> <ul class="row block-grid events"> <li class="small-12 medium-6 large-4 column event">...

regex - AWK: Using a variable as part of a regular expression -

this question has answer here: how use shell variables in awk script? 6 answers i have text file similar 1 containing username, description , 2 time range values german date format: user###@###description###@###1. august - 8. august 2016###@###1. september - 7. september 2016 each field gets separated using ###@### delimiter. check if field (e.g. $3) contains 2 identical month names. if there 2 month names in specified field, first month name should removed, output of awk is: user###@###description###@###1. - 8. august 2016###@###1. - 7. september 2016 then got idea create for-loop bash script (with awk commands), increments i in order read out month name predefined variable. here can more detailed script.sh: m1=january; m2=february; m3=march; m4=april; m5=may; m6=june; m7=july; m8=august; m9=september; m10=october; m11=november; m12=december awk...

python - How to recode line so an exact sentence must be in the list for it to match -

x = ["cookie flavored water yummy 6", "coding complicated 16", "help 7"] in x: if "flavored" in x: print ("yes") else: print ("no") i want exact string "cookie flavored water yummy" in list acceptable don't want 6 part included. i'm befuddled on how accomplish this. objective might change first element different element. you're iterating on x i check if string belongs list, not element, false. to check if element of x contains "cookie flavored water yummy" x = ["cookie flavored water yummy 6", "coding complicated 16", "help 7"] in x: print ("yes" if "cookie flavored water yummy" in else "no") on other hand, exact string match use in without loop, loop being made on x in operator: print ("yes" if "cookie flavored water yummy" in x else "no") if need...