Posts

Showing posts from September, 2015

c# - How can I have the VS Debugger break in the correct location for exceptions thrown in Async methods in a Console App? -

i'm writing console app uses lots of async methods; i've made async main method can await in: static void main(string[] args) { mainasync(args).wait(); } static async task mainasync(string[] args) { // can use await here } however, when exception occurs; debugger break me on .wait() call. not experience. is there can debugger breaks exception occurs rather here? i'm using vs2015 , targeting .net 4.6 if influences answer.

php - Issues outputting data after prepared statement with loops -

i having major difficulties figuring out doing wrong in while , foreach loops in code below. having tendency mix object-oriented , procedural mqsqli, everytime think have right, error. what doing wrong in loops have in code? right error warning: mysqli::query() expects parameter 1 string, full code try { $con = new mysqli("localhost", "", "", ""); if (mysqli_connect_errno()) { throw new exception("connect failed: %s\n", mysqli_connect_error()); exit(); } $cid = $_get['cid']; $tid = $_get['tid']; $userid = ( isset( $_session['user'] ) ? $_session['user'] : "" ); echo $cid . "<br>"; echo $tid; //prepare if ($stmt = $con->prepare("select * forum_topics `category_id`=? , `id`=? limit 1")) { $stmt->bind_param("ii", $cid, $tid); //$stmt->fetch(); if (!$stmt) { throw new exception($con->error); } } ...

c# - Why Does .NET 4.6 Specific Code Compile When Targeting Older Versions of the Framework? -

this question has answer here: does c# 6.0 work .net 4.0? 3 answers i have project targets older versions of .net framework (.net 4.5.2). installed visual studio 2015 (and therefore .net 4.6 on machine). noticed if use c# language features released in .net 4.6/c# 6, still compiles. if project's target framework < .net 4.6, shouldn't not compile: public string myexpressionbodyproperty => "1"; //auto properties new in c# 6 public string myautoproperty { get; } = "1"; private static void methodthatusesnameof(string filename) { if (filename == null) { //nameof released in c# 6 throw new argumentexception("the file not exist.", nameof(filename)); } } how can ensure i'm using .net language features work framework version i'm targeting? ...

javascript - How to pass a property by reference -

is there way pass object property function reference instead of value? es5 properties can have getters , setters. how pass variable uses getters , setters instead of result of getter? right have pass reference whole object, not single property want. is there way pass object property function reference instead of value? no. in fact doesn't make lot of sense "pass object property", notion of "property" doesn't exist without entity property of. if matter of encapsulation , not wanting leak full control, can creative. e.g., var obj = { sensitive: 'do not share me!', public: 'hi there', setpublic: function(val) { this.public = val; } }; function somefunction(setter) { setter('new value'); } somefunction(obj.setpublic.bind(obj));

computer vision - How to match orientation and scale of two different image of the same object in OpenCV? -

i have 2 images of printed circuit boards (pcb) both showing same pcb. differences between them lighting, scale , orientation (because take pcb images phone camera). now want use 1 image of pcb check if components of circuit assembled on identical pcb. is there convenient way check differences between 2 images of 2 identical pcb? btw, can add marks on pcb in opencv can correct orientation , scale of image. pcb = printed circuit board, right?!? you compute projective projective transformation or homography between matched points in both images. transformation can used match planes (like pcbs) , considers scale, rotation, shear , projective changes between images. it's simple method: select @ least 4 points , solve system of linear equations. take @ answer question on math se explains that. this opencv example uses (automatic) feature matching find corresponding image points , computes homography. the interesting derivation of transformation can found ...

html - Add copy button in Javascript -

i'm trying add button copy text textarea using zeroclipboard, however, when click button, nothing happens , when paste nothing has been added clipboard. var clip = new zeroclipboard( document.getelementbyid("btn4"), { moviepath: "https://rawgit.com/zeroclipboard/zeroclipboard/master/dist/zeroclipboard.swf" } ); clip.on( "load", function(client) { // alert( "movie loaded" ); client.on( "complete", function(client, args) { // `this` element clicked this.style.display = "none"; } ); } ); <div id ="right" style = "float:left; width: 10%; margin-left:185px; margin-top:35px"> <button id="btn4" data-clipboard-target="block2" name ="btn4" type="button" class="btn btn-success"><i class="icon-white icon-file"></i> copy</button> <script src="https://rawgit.com/zeroclipboard/zeroclipboard...

How to make Wordpress custom field input text translatable with qTranslate X? -

i have wordpress custom fields (i'm not using acf or other plugin this) , need translate them using qtranslate x in wp-admin. the fields created wp_editor working, don't know how make work default <input type="text"> other custom fields have. below, piece of code i'm using set variable , show field: $services = isset( $values['services'] ) ? esc_attr( $values['services'][0] ) : ''; wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' ); ?> <table> <tr> <td> <input type="text" name="services_title" value="<?php echo !empty($services_title) ? $services_title : ''; ?>" style="width: 100%" /> </td> </tr> </table> then, i'm saving with: add_action( 'save_post', 'hotelsavedata' ); function hotelsavedata( $post_id ) { // bail if we're doing a...

ios - Put a value out of a http request in swift -

to create uitableview have initialize number of rows, , in case depends on httprequest (sent framework httpswift). problem can't output number on return of request request.get("/media/", parameters: nil, completionhandler:{ (response: httpresponse) in if let err = response.error { println("error: \(err.localizeddescription)") return //also notify app of failure needed } if let data = response.responseobject as? nsdata { let str = nsstring(data: data, encoding: nsutf8stringencoding) var user = medias(jsondecoder(data)) var nbrows:int = user.medias.count } }) println(nbrows) //nbrows don't have value out of request func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return nbrows } the problem request performed in background thread , execution continues sequentially. when println(nbrows) nbrows variable not u...

Printing "\" to system with C not work? -

i have coded little app following: sprintf(command, "......sending string system......{} \;" printf("%s\n",command); system(command); break; the problem not whole string sent system, appears in shell apart '\' doesn't reason? sure silly mistake really, novice. thank you the \ escape character (you used print newline using \n ), if want print literal backslash, need use \\ : sprintf(command, "......sending string system......{} \\;" // ^^ // take note here

android - linking ViewModel to view using MvvmCross -

i using mvvmcross framework in xamarin android application , viewmodel inheriting mvxactivity , view inhering fragmentactivity . how link viewmodel view ? you can use generics connect viewmodel view. public myactivity : mvxactivity<myviewmodel> { //do stuff in here. setting content } a full example available here: https://github.com/mvvmcross/mvvmcross-androidsupport/tree/master/samples

c++ - Virtual Alloc failing with code 87 - Invalid parameter -

following code working on pcs, while on other giving error 87 - invalid parameter, can wrong? filesize = dwdllsize; buffer = virtualalloc ( null, filesize, mem_commit | mem_reserve, page_readwrite ); if ( !buffer ) { qmessagebox::warning(null,qstring("virtualalloc failed!"),qstring::number(getlasterror())); return -1; } i'm checking size 0, , file not bigger ~200kb.

Fast Algorithm for Multiple Projections in Matlab -

my problem of performing many low-dimension projections in matlab . have array z has dimensions (n,l,d) ; these parameters obtained follows. take input array of size n, n = [200, 200] , , n = prod(n) = 200*200 = 40,000 , d = numel(n) = 2 ; is, n number of points in discretisation grid , d dimension of input array (eg image, or plane height map). discretise possible heights (that program output - note height map mention above) l points, l = 32 . for each i = 1:n , j = 1:l , want project vector z(i,j,:) onto unit ball.* @ moment, have following naive code: z = reshape(z,[n,l,d]); z_norms = norms(z,2,3); = 1:n j = 1:l z(i,j,:) = z(i,j,:)/max(1,z_norms(i,j)); end end the function norms(v,p,dim) takes p norm of matrix v along dimension dim (in case outputting (n,l) matrix). i have various ideas how improved. 1 idea following: for = 1:n j = 1:l normsquared = sum(z(i,j,:).^2) if normsquared > 1 z(i,j,:) = z(i,j,:)/sqrt(normsquared) end end end note normsquared...

vb.net - Parse String to Date from a filename variable -

purpose move files in specified folders, in if date @ least day old today. i'm having trouble moving file since don't see archived. i'm assuming it's parsing date filename. vs2005 .net 2.0 sub copytoarchive(byval mydirpath) 'mydirpath = "c:\utresults\" 't:\utresults\press3\sv70206655\data07012015.txt example of txtfilelist dim txtfilelist string() = directory.getfiles(mydirpath, "*.txt", searchoption.alldirectories) 'search files in given path .txt type each txtname string in txtfilelist dim pressname string = txtname.substring(0, txtname.lastindexof("\")) 'take out file extension pressname = pressname.substring(0, pressname.lastindexof("\")) 'take out folder after press folder clean "press" pressname = pressname.remove(0, 13) dim folderexists string = path.combine("c:\writetest\", pressname) dim filename = txtname.remove(0, 4)...

android studio - Intellij Extract Inner Class -

how 1 using intellij or android studio extract public static inner class create new top level class? thank you. select class name. refactor > move or press f6 select "move inner class foo upper level"

node.js - deployed Nodejs REST API on AWS using elastic beanstalk - Error cannot find custom module -

i wrote first nodejs application. works fine on macbook when try deploy on aws elastic beanstalk,i below error . /var/log/nodejs/nodejs.log at function.module._load (module.js:310:12) @ module.require (module.js:365:17) module.js:338 throw err; ^ error: cannot find module '**./routes/userprofile**' @ function.module._resolvefilename (module.js:336:15) @ function.module._load (module.js:278:25) @ module.require (module.js:365:17) @ require (module.js:384:17) @ object.<anonymous> (/var/app/current/main.js:7:18) @ module._compile (module.js:460:26) @ object.module._extensions..js (module.js:478:10) @ module.load (module.js:355:32) @ function.module._load (module.js:310:12) @ module.require (module.js:365:17) it seems nodejs not able resolve path custom module userprofile resides under routes directory.i have tried moving userprofile.js root, can still not resolve that. this code in main.js loads modules / load our modules var express = require('express...

r - How to prevent data.table to force numeric variables into character variables without manually specifying these? -

consider following dataset: dt <- structure(list(lllocatie = structure(c(1l, 6l, 2l, 4l, 3l), .label = c("assen", "oosterwijtwerd", "startenhuizen", "t-zandt", "tjuchem", "winneweer"), class = "factor"), lat = c(52.992, 53.32, 53.336, 53.363, 53.368), lon = c(6.548, 6.74, 6.808, 6.765, 6.675), mag.cat = c(3l, 2l, 1l, 2l, 2l), places = structure(c(2l, 4l, 5l, 6l, 3l), .label = c("", "amen,assen,deurze,ekehaar,eleveld,geelbroek,taarlo,ubbena", "eppenhuizen,garsthuizen,huizinge,kantens,middelstum,oldenzijl,rottum,startenhuizen,toornwerd,westeremden,zandeweer", "loppersum,winneweer", "oosterwijtwerd", "t-zandt,zeerijp"), class = "factor")), .names = c("lllocatie", "lat", "lon", "mag.cat", "places"), ...

Cant find wireshark's init.lua on my CentOS machine -

so i'm trying script working tshark on centos 7 server, i'm having problems. script works fine on windows laptop, put in plugins folder in appdata, can't find similar location on linux. used yum download wireshark, , have program in of folders, can't find either of init.lua files or plugins folder. when use tshark -v tells me built "with lua 5.1" know that's not problem, have no idea go here. suggestions? sadly centos, fedora, oracle linux, , rhel (as of today) not include init.lua in packaging of wireshark. "init.lua" must reside in wireshark directory (e.g. /usr/share/wireshark) before wireshark active lua scripts.

Adplus stop debugging process -

i have stupid question - how can stop debugging? i run adplus -crash -0 path -pid number -mss symbols .. then got message attached process. saw logs , mini dumbs in folder, want stop it. should do? not see commands in adplus detach process. how can it? can close cdb.exe command window or not? thanks you can break debugger (in cdb window, hit ctrl+c) , detach using qd command. you might want consider using procdump capture crash dumps -- more flexible, easy use, , supports both x86 , x64 processes in single package.

c# - asp.net Microsoft.Office.Interop.Word -

i trying rid of empty pages merge when users views , prints document. using dev express editor user inserts text make page on flow other page (rtf) , creats empty space. way stop happening>? here code: using system; using system.collections.generic; using system.drawing.imaging; using system.linq; using system.io; using system.text; using system.text.regularexpressions; using system.threading.tasks; using system.xml; using system.xml.linq; using documentformat.openxml.packaging; using microsoft.office.interop.word; using wordapplication = microsoft.office.interop.word.application; namespace documentmapper { public class xmldocumentmapper { /// <summary> /// use replace text elements included in template text. /// </summary> /// <param name="mergedocinfo"></param> /// <param name="html"></param> /// <return...

c# - SSIS 2012 - Impossible to use a custom dll -

i'm trying use custom .net dll i've developed using visual studio 2012. i've installed dll in gac folder no issue. i'm using script task object. when i'm trying instantiate class dll, i'm getting error saying it's impossible load script... here's blocking line : amadeuswebservices.queries q = new amadeuswebservices.queries(); i don't understand should do... version of .net framework used dll 4.0 version think there not issue that... please help! ! edit : error message generic ... : ssis dts script task has encountered exception in user code cannot load script execution nothing more.

android - How to call arm assembly from C source files? -

i have found number of tutorials on compiling assembly code android ndk. not have information on how call assembly instructions c source files, believe possible. think have seen similar tutorials online. question if can have c source file, issues assembly calls. want able compile ndk. avoid using android studio , jni; 1 reason being not have java code. , have validated can compile , run c source files using ndk. know how compile c source files, , assembly files using ndk. have validated c code runs fine on phone. not sure how go calling assembly instructions c source files arm architecture. keep getting following error message when try compile simple source file: /tmp/ccwua4gd.s: assembler messages: /tmp/ccwua4gd.s:18: error: selected processor not support thumb mode `smc #0' here file: #include <stdio.h> __asm__(" smc #0"); int main(void) { /*do something*/ return 0; } the issue, way, not seem thumb vs. arm related. did try local_arm_mode := arm ...

python - For Django Rest Framework, what is the difference in use case for HyperLinkedRelatedField and HyperLinkedIdentityField? -

i've of course reviewed docs, wondering if more succinctly explain difference in use case , application between these fields. why 1 use 1 field on other? there difference between these fields onetoone relationship? you use hyperlinkedidentityfield link object being serialized , hyperlinkedrelatedfield link objects related 1 being serialized . so one-to-one relationship, foreign key relationship, many-to-many relationship , else involving relationships (in django models), want use hyperlinkedrelatedfield . time hyperlinkedrelatedfield used url field can include on serializer point current object. in django rest framework 3.0.0, there only 2 differences between hyperlinkedrelatedfield , hyperlinkedidentityfield . the source automatically set * (the current object) it set read_only=true , can't changed which means setting hyperlinkedrelatedfield properties exactly same having hyperlinkedidentityfield . in older versions of django rest frame...

Calling an Array in PowerShell -

i have string array $exclude want put filter in get-wmiobject cmdlet. have added @ end not work. how can filter out services listed in array? $servicestoexclude = "remoteregistry,cpqnicmgmt" $exclude = $servicestoexclude.split(",") $services = get-wmiobject -class win32_service -filter {state != 'running' , startmode = 'auto' , name -ne $exclude} $result = foreach ($service in $services.name) { get-itemproperty -path "hklm:\system\currentcontrolset\services\$service" | where-object {$_.start -eq 2 -and $_.delayedautostart -ne 1}| select-object -property @{label='servicename';expression={$_.pschildname}} | get-service } if ($result.count -gt 0){ $displayname = $result.displayname [string] $line = "`n-----------------------------------------" $api.logscriptevent( 'stopped_auto_services.ps1',1234,4,"`nstopped automatic services$l...

c++ - What is meant by map/set iterator not decrementable? How to make map.rbegin()->first work? -

i trying last element in map of map_of_bit_to_parent map<long long, long long> ::reverse_iterator itr_rel = map_of_bit_to_parent.rbegin(); long long total_parent_rels = itr_rel->first; but assignment caused run time error " map/set iterator not decrementable" how make such assignments? always test validity of iterator before accessing data through it. map<long long, long long> ::reverse_iterator itr_rel = map_of_bit_to_parent.rbegin(); long long total_parent_rels = 0; if ( itr_rel != map_of_bit_to_parent.rend() ) { total_parent_rels = itr_rel->first; }

unity3d - Playscape Publishing Kit. Failed to apply patch to the .jar file -

unable build project playscape publishing kit v1.11 on mac. an error occured while applying post-build logic: failed apply patch .jar file log file https://www.dropbox.com/s/plz5aneqgbj4mf7/log_jar.txt?dl=0 bugs exceptions thrown have titles file:line top stack, e.g., "somefile.java:243" if don't find exception below in bug, please add new bug @ http://bugs.eclipse.org/bugs/enter_bug.cgi?product=aspectj make bug priority, please include test program can reproduce exception. org.aspectj.weaver.missingresolvedtypewithknownsignature cannot cast org.aspectj.weaver.referencetype when weaving type com.startapp.android.publish.h.b$4 when weaving classes when weaving when batch building buildconfig[null] #files=0 aopxmls=#0 org.aspectj.weaver.missingresolvedtypewithknownsignature cannot cast org.aspectj.weaver.referencetype java.lang.classcastexception: org.aspectj.weaver.missingresolvedtypewithknownsignature cannot cast org.aspectj.weaver.referencetype @ org.a...

cordova - Ionic app fails to run with error options must be an object -

i have ionic app fails following error. idea how resolve or tips how debug? (cordova 5.1.1 + ionic 1.4.3) i/chromium(13497): [info:console(20434)] "error: "options" must object! i/chromium(13497): @ object.n._ (file:///android_asset/www/lib/js-data.min.js:11:26882) i/chromium(13497): @ file:///android_asset/www/lib/js-data.min.js:10:23334 i/chromium(13497): @ new (file:///android_asset/www/lib/js-data-angular.min.js:10:1479) i/chromium(13497): @ g.d [as findall] (file:///android_asset/www/lib/js-data.min.js:10:23262) i/chromium(13497): @ function._this.(anonymous function).defineresource.def.(anonymous function) (file:///android_asset/www/lib/js-data.min.js:11:6366) i/chromium(13497): @ f.service.findall (file:///android_asset/www/js/application.js:4795:24) i/chromium(13497): @ loadtasks (file:///android_asset/www/js/application.js:2314:19) i/chromium(13497): @ file:///android_asset/www/js/application.js:2375:18 i/chromium(13497): @ processqueue (file:///android_as...

java - How do I prevent the removal of a slash from an input String? -

the user inputs string corresponding file path. however, since java automatically removes \, have put 2 \'s. how can make them input string c:\path\filename.txt without needing worry adding apostrophes or additional slashes or whatever? public string getdescriptorpath(){ return this.textfield.gettext(); } allow me clarify: user types textfield. let's types: "c:\users\daniel.bak\box sync\descriptor analyzer\analyzeme.xml" that comes out "c:usersdaniel.bakbox syncdescriptor analyzeranalyzeme.xml" i adding slashes here because stackoverflow same thing. i'm little confused mean, when take jtextfield , print it's contents gives me exact same see on screen. contents of jtextfield: "c:\path\file.txt" terminal output: "c:\path\file.txt" this string should valid make file out of it, or want process it.

c# - invalidate aspx authentification cookie -

i have asp.net web form. when user authenticate, create secured cookie called .aspxauth uppon logout, call these 2 methods formsauthentication.signout(); session.abandon() problem had penetration test , if steal cookie, logout , manually reinsert cookie, become loggued in again. .aspauth isn't invalidated server side. i've googled , can't find answer security breach. read article session fixation , how rid of once , all: http://www.dotnetfunda.com/articles/show/1395/how-to-avoid-the-session-fixation-vulnerability-in-aspnet

ios - UIView outlet is nil when testing on device but works fine in the simulator -

Image
my setup simple. there viewcontroller (set initial in storyboard) loaded nib (the vc has no view, , nib contains view). view in nib has view. the code looks this: import foundation import uikit class myviewcontroller : uiviewcontroller { @iboutlet weak var outputview: uiview! //ctrl-dragged interfacebuilder override func viewdidload() { super.viewdidload() self.outputview.backgroundcolor = uicolor.bluecolor() } } here's nib: https://s17.postimg.org/dt3ivctkf/screen_shot_2015_07_22_at_15_59_54.png everything works fine in simulator (iphone 6). white view turns blue expected. when running on actual device (iphone 6 8.4 - target 8.4) xcode throws brick @ me yelling outputview unexpectedly nil. what do now? update apparently bug in xcode 7. i've tried creating new project on computer , testing on different iphone , result same. i'll report bugreport.

python - Creating half hour averages of a list -

i have calculate, 0 upcrossing period, averaged on half hour, dataset. the time measurement utc-timestamp (# of seconds since 01.0.1970). every second there 2-3 measurements. measurements each day stored in own file. the data acquisition unfortunately didn't start @ same time. started 6s after midnight, 10s , on. leads irregular numbers of measurements in during specific time periods. (there not same number of measurements in e.g. half hour) so have load data file, somehow find measurements in interval of 30min (1800s). find 0 upcrossings (the values go <0 >0) , find corresponding time steps calculate period of upcrossings , calculate average of those. has iterate 48 times. so far have made 2 attempts. 1 def get_t_z(filename): #zero uprcossing period heave=load_data_2(filename,2) timestamp=load_data_2(filename,0) zero_up_ind=[] # index of 0 upcrossings zero_up=[] #zero_upcrossing periods each half hour i=0 initial_time=0 day_len=int(timestamp...

php - Error parsing data org.json.JSONException: Value 403 of type java.lang.Integer cannot be converted to JSONArray -

i following tutorial learn connecting database android app ( https://www.youtube.com/watch?v=smvidyck3-k).i followed steps in tutorial.but @ end error on running app (error parsing data org.json.jsonexception: value 403 of type java.lang.integer cannot converted jsonarray) mainactivity.java looks this @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); fetch= (button) findviewbyid(r.id.fetch); text = (textview) findviewbyid(r.id.text); et = (edittext) findviewbyid(r.id.et); fetch.setonclicklistener(this); } class task extends asynctask<string, string, void> { private progressdialog progressdialog = new progressdialog(mainactivity.this); inputstream = null ; string result = ""; protected void onpreexecute() { progressdialog.setmessage("fetching data..."); progressdialog.show(); progressdialog.setoncanc...

authentication - Websocket Security -

i looking implement web (angular) , iphone apps using websockets communicate our server. in past using http requests have used hashes using request data, url, timestamp etc authenticate , secure requests. as far aware can't send headers websockets requests therefore wondering how can secure each request. does have ideas or practices? having secure communication server includes authenticating both parties each other. if need channel different users different authentication credentials through 1 communication channel (which rare idea nowadays), you'll need separate authentication. otherwise, need come key distribution scheme (so apps know public keys of server , server has protocol of getting acquanted public keys of clients, there plenty of patterns this). to that, there choice gradient bit wider ssl or own crypto (try avoid writing own crypto @ cost). for webserver-to-browser part of stack, ssl choice, shouldn't considered safety measure, each year unfo...

c - Issue finding last digits of the nth term in the Fibonacci sequence -

i wrote code determine nth fibonacci number using nice blog post given in accepted answer question: finding out nth fibonacci number large 'n' . doing way of practising more difficult recursion problem given on projecteuler not relevant. method relies on changing problem small linear algebra problem of form fn = t^n f1 where f1 = (1 1)^t , fn contains nth , (n-1)th fibonacci number. term t^n can determined in o(log n) time. implemented succesfully , seems work fine. when perform matrix exponentiation use %10000 last 4 digits only, seems work (i checked against large fibonacci numbers). however, wanted try more last digits increasing number 10000. doesn't seem work however. no longer correct answer. here code #include<stdio.h> #include<math.h> #include<stdlib.h> const unsigned long m = 10000; unsigned long int * matprod(unsigned long int * a, unsigned long int * b){ unsigned long int * c; c = malloc(4*sizeof(unsigned long int)); c[0] = ((a...

php - Upload video from dropbox to vimeo using vimeo API -

hello everyone, i trying upload video on vimeo using 'jquery api`. it's proper working, want upload video "dropbox" "vimeo". there jquery or php api uploading video dropbox vimeo. thanks in advance if looking more programmatical way, need following steps: set dropbox app , check out their libraries . you need vimeo app needs permission vimeo staff (write short description , send via email). vimeo has a library well . you need user tokens dropbox , vimeo respectively. the simplest way send pull request vimeo. see here more details. if complicated, there webservice that.

c# - The model backing the 'EFDbContextProxy' context has changed - Testing cache? -

i made change entity, ran migration , updated database. re-ran test , it's throwing error: the model backing 'efdbcontextproxy' context has changed since database created. consider using code first migrations update database if run application, not error. seems efdbcontextproxy (whatever hell is) using old cache of data structure. any ideas how resolve this? this how prepare db context in test: public class effieldviewerrepository_setup { protected datetime now; protected mock<efdbcontext> mockdbcontext; protected effieldviewerrepository fieldviewerrepository; protected idbset<fieldviewer> fieldviewerdbset; public effieldviewerrepository_setup() { this.now = datetime.now; this.mockdbcontext = new mock<efdbcontext>() { callbase = true }; this.fieldviewerrepository = new effieldviewerrepository( this.mockdbcontext.object ); ... } here stack trace: http://pastebin.com/kaumhi3j ...

mysql - SQL query to insert same value 1000 times without loop -

for example, if have string 'sunday', want insert same value in 1000 rows using sql only; without using loops. if don't want use table can use: insert some_table (some_column) select 'sunday' ( select 1 (select 1 union select 2) d1 join (select 1 union select 2) d2 join (select 1 union select 2) d3 join (select 1 union select 2) d4 join (select 1 union select 2) d5 join (select 1 union select 2) d6 join (select 1 union select 2) d7 join (select 1 union select 2) d8 join (select 1 union select 2) d9 join (select 1 union select 2) d10 ) t limit 1000 you can adjust amount of join's depending on limit want.

Tm4c nested uart interrupts- does each com finishes it's run before the next one executed? -

board: tiva™ c series tm4c1294 ek-tm4c1294xl my program listening 2 uarts ports(uart  3 , 7) i encounter of problem im loosing bytes received , im suspecting issue relate uarts interrupts. i understand uarts have nested interrupts both of them serial? for example: im inside uart 3 interrupt function , while uart 3 didnt finish interrupt(just copy bytes buffer) uart 7 interrupts arrives, system moves uart 7 or first finish uart 3 , moves uart 7? currently im suffering error bytes 45-400 bytes file size in 12 mbytes im suspecting above issue cause issues p.s if 1 uart sending data have binary same files on both host , pc  thanks  idan depends on interrupt priorities of uartx. uart3 relinquish control uart7 if uart7 priority higher. fact single uart works in copying file on target & pc, fails 45+ bytes in 12mb file when 2 uarts in operation, need excerpts of code implementation analyze. in case copying same single pc-file through 2 different uarts, fil...

windows - How to record echo mssage displayed on command prompt using C#? -

i using below function call ear_encrypt_ftp.bat in c#. there way trace echo messages dispayed in cmd.exe while running batch file?? i need process echo messages displayed on command prompt screen log process. private static short batchfileinvoke(string ftpfilename, string headerfile) { short value = 0; process p = null; try { p = new process(); processstartinfo startinfo = new system.diagnostics.processstartinfo(); startinfo.filename = "cmd.exe"; string argument1 = "ear_encrypt_ftp.bat"; string test = "\"" + ftpfilename + "\""; string argument2 = test; string test1 = "\"" + headerfile + "\""; string argument3 = test1; p.startinfo.workingdirectory = path.getdirectoryname(argument1); startinfo.arguments = "/c earencryptftp.bat " + argument2 + " " + argument3; p.startinfo = starti...

php - Expand ini settings for zend -

i'm having following ini setting file, named networks.ini: [networks1] networks[] = 'twitter' networks[] = 'facebook' networks[] = 'google' [networks2 : networks1] networks[] = 'linkedin' is there way array include networks2 both networks1 , networks2 values in same array? when try $cfgnetworks = new zend_config_ini(path_to_ini .'networks.ini', 'networks2'); print_r($cfgnetworks->networks->toarray()); it returns linkedin network name only. i don't think can merge arrays way. can try explicitly add array keys [networks1] networks.twitter = 'twitter' networks.facebook = 'facebook' networks.google = 'google' [networks2 : networks1] networks.linkedin = 'linkedin'

mysql - php, using a SELECT statement in prepare, how do I get the fetch_assoc array? -

i have been playing around prepare , bind_param in php. trying work select statement , display results. when try statement here 0 results search. if use query, works fine , results displayed. not possible using prepare? or logic wrong using $result = $stmt->execute(); result? <?php $dbhost = 'localhost'; //default $dbuser = 'root'; $dbpass = 'somepassword'; //create connection object $conn = new mysqli($dbhost, $dbuser, $dbpass); if($conn->connect_error ) { die('could not connect: %s' . $conn->connect_error); } echo "connected successfully<br>"; //select database call method out conn object $conn->select_db("tutorial"); $stmt=$conn->prepare("select tutorial_author tutorial_info tutorial_title=?;"); $stmt->bind_param("s",$tutorial_title); $tutorial_title="math"; $result = $stmt->execute(); //we false if fails if($result===false) { echo "select failed <...

setCoords of all objects in group in fabricjs -

im developing editor customizing signs , ran problem positioning text element after increase of font size. text objects in group possible set font-size of each individual object. when increasing font size need setcoords full group, otherwise end-user not able move properly. can use setcoords on group object or need loop through objects in group , set coords on each individually, if case, suggestions how that? thanks i have written editor seat reservation system using of fabric.js. 1 of features cloning selected objects. selected objects cloned, moved right , bottom , new group of objects marked active group. after clonning , shifting using group.setcoords() , group.savecoords() , works fine. check example here .

c++ - FileStorage.read() occurred an error:The sequence element is not a numerical scalar? -

guys~ i'm not @ english, i'll try best describe question. i'm using opencv2.4.9 filestorage in opencv store mat in ".yml" file. , file 2.91g the write code this: fs.open(temppath, filestorage::write); fs << "tf" << wordsfreq; fs.release(); wordsfreq mat but when use followed code read back. sprintf(tmpfilename,"%s/tf.yml",trainingresultsdir.c_str()); filestorage fs(tmpfilename, filestorage::read); fs["tf"] >> wordsfreq; fs.release(); it occurred error : opencv error: unspecified error (the sequence element not numerical scalar) in cvreadrawdataslice, file /users/xuhuaiyu/development/opencv-2.4.9/modules/core/src/persistence.cpp, line 3362 libc++abi.dylib: terminating uncaught exception of type cv::exception: /users/xuhuaiyu/development/opencv-2.4.9/modules/core/src/persistence.cpp:3362: error: (-2) sequence element not numerical scalar in function cvreadrawdataslice

sql server - Query inside CASE statement with SUM -

i have nestled query need use in case statement. need use max(agedate) correctly retrieved in select statement in case statement not see max(agedate) in select statement in case statement. please help... select inv.invoicenumber, fact_fininvoice.invoiceid, dbo.dim_date.fulldate invoicedate, pra.practicename, pra.practicelogonname, pat.accno, pat.fileno, pmai.medicalaidnumber, per.title + ' ' + per.initials + ' ' + per.surname patientname, sch.schemes5, sch.schemeoption, (select max(b.agedate) fact_fininvoice b fact_fininvoice.invoiceid = b.invoiceid , fact_fininvoice.practiceidkey = b.practiceidkey) maxagedate, sum(fact_fininvoice.amount) amount, sum(fact_fininvoice.amountfunder) amountfunder, sum(fact_fininvoice.amountpatient) amountpatient, sum(case when datediff(dd, maxagedate, getdate()) between 0 , 29 , amountfunder != 0 amountfunder else 0 en...

javascript - Is it ok to do the $http get request on ui.router's resolve in angularjs? -

i have following code (below), work me , need @ least. im kind of skeptical this, im having feeling true. since im struggling $http 's async behavior helped me lot use response object $http request globally on controller. i want know if right way or @ least acceptable 1 or should use conventional way of using $http 1 on angularjs' documentation before move on project. answers me lot. thank you. $stateprovider $stateprovider .state('test', { url: '/test', templateurl: 'partial.template.html', resolve : { foo : function($http) { return $http({ method: 'get', url: '/api/something' }); }, bar : function($http) { return $http({ method: 'get', url: '/api/something' }); }, }, controlle...

javascript - CKEditor Icon Paths not URLEncoded -

i using ckeditor 4 desktop application , issue icons toolbar not display. reason when toolbar elements generated finds path folder icons , puts style tag set background on each button. 1 of folders in path contains parentheses, results in invalid css (ex: background-image: url(file///c:/programfiles(x86).../icons/; ). question is, know html being generated can url encode , avoid problem? skin.js file needs edited. line 18 path icons generated, , @ point can add .replace("(","%28").replace(")","%29"); end of line , escape parentheses.

csv - Matlab csvread() creating wrong matrix -

i want import matrix .csv matlab , find matlab acting differently wrt length of row in csv. : first, read file of 2 rows 50000 columns , matlab correctly shows 2*50000 matrix in workspace. now, if file consists of 2 rows 100000 columns, matlab identifies 200000*1 matrix. what has gone wrong there? what command using? csvread('filename.csv') ? i prefer use data = importdata( 'filename.csv','\t');

java - MySql - How to query multiple boolean columns? -

i have 15 boolean columns in sql table. want query in efficient way withot using : "bool1 = bool1val , bool2=bool2val , bool3=bool3val....." is there way better? thanks lot you can combine these columns single string column of 0's , 1's , read them @ single query 0011 means false false true true. have char 16 store this. (just database optimisation) // courtesy @amitmahajan comment string selecttablesql = "select user_flags dbuser"; statement statement = dbconnection.createstatement(); resultset rs = statement.executequery(selecttablesql); while (rs.next()) { string userflags = rs.getstring("user_flags”); boolean isuserenabled = userflags.charat(0)==1?true:false; }

How do we detect issues with installs of our chrome extension? -

we run popular chrome extension 200k+ installs , 70-90k active users (according chrome webstore reports) we have noticed our numbers have started dipping in past 2 months, despite steady stream of hundreds of new daily installs. these numbers different broadly correlate our google analytics numbers. we suspect fraction of our installs not being working, either because of browser version-specific bugs or because being blocked anti-virus. how know sure? there doesn't seem easy error reporting can rely on , other option seems involve trying different versions , anti-viruses see if true. there better method? provide after-uninstall form (using chrome.runtime.setuninstallurl - since chrome 41) user can select reason uninstalling. extensions (zenmate, example) it.

sql - Split the given date into days -

i writing stored procedure. need take year , month information user , doing something. problem don't detect given month has how many days. let me explain example; user give me year , month said; @year = 2015 @month = 07 so must create rows like; 2015-07-01 2015-07-02 ..... 2015-07-31 my plan adding these rows 1 one temp table. last status of sp is; alter procedure [dbo].[usp_createstats] ( @year varchar (40), @month varchar (40) ) begin declare @starttime varchar (10) declare @endtime varchar (10) set @starttime = '00:00:00' set @endtime = '23:59:59' declare @peoples table (name varchar(50)) insert @peoples (name) select distinct name userinfo declare @dates table (date varchar(50)) end i hope explained correctly. i've changed year , month variables int data type, name of date column dates_date , , used convert , while loop dateadd function populate @dates table: alter procedure [dbo].[usp_createstats] ( @year in...

d3.js - crossfilter and dc.js line chart to plot every data point in ascending/descending order -

Image
my data consists of simple information contracts. simplified each 1 looks this: { "id": 1234567890, "district": "districtname", "city": "cityname", "test": "testnumber", "date": "2015-03-15", "score": 0.0 - 1.0 } i have simple dc.barchart number of tests per day , dc.rowchart districts , 1 cities filter displayed data crossfilter. what need line chart plots every score of every contract in ascending or descending order. mean not want group data score plot every score on y-axis , have nothing on x-axis. assuming data plotted in ascending order resulting picture ever increasing graph. see below: how do data lives inside crossfilter instance, dc.js , d3.js?

Inheritance getter and toString() - java -

i'm practicing inheritance in java , got stuck on getter method in subclass. here point class: package oop.linepoint; public class point { private int x; private int y; public point(int x, int y){ this.x = x; this.y = y; } public string tostring() { return "point: (" + x + "," + y + ")"; } public int getx() { return x; } public void setx(int x) { this.x = x; } public int gety() { return y; } public void sety(int y) { this.y = y; } } here linesub class: package oop.linepoint; public class linesub extends point{ point end; public linesub(int beginx, int beginy, int endx, int endy){ super(beginx, beginy); this.end = new point(endx, endy); } public linesub(point begin, point end){ super(begin.getx(),begin.gety()); this.end = end; } @override public string tostring() ...