Posts

Showing posts from January, 2014

Scala Typeclasses with generics -

i've been playing typeclass pattern in scala, haven't been able figure out how implement implicit companion object when type i'm working generic. for example, let's i've defined trait typeclass provides functions putting things box es. case class box[a](value: a) trait boxer[a] { def box(instance: a): box[a] def unbox(box: box[a]): } implicit object intboxer extends boxer[int] { def box(instance: int) = box(instance) def unbox(box: box[int]) = box.value } def box[a : boxer](value: a) = implicitly[boxer[a]].box(value) def unbox[a : boxer](box: box[a]) = implicitly[boxer[a]].unbox(box) this works expected, allowing me provide implementations of boxer various types. however, have no idea how when type wish act on generic itself. let's wanted able use boxer on seq[a] . object s in scala cannot include type parameters, i'm @ loss go: // not compile - object cannot have type arguments implicit object seqboxer[a] extends boxer[seq[a]] { ..

c++ - C Struct with uint8 array weird behavior -

i have problem following c struct: typedef struct anchorpixel{ int32 x; int32 y; uint8 ch[5]; } anchorpixel; actually, have problem ch array inside it. cannot manipulate ch array. example, following program anchorpixel a; a.ch[2] = 5; cout << a.ch[2]; gives output: ♣ if change ch type uint8 int32, problem disappears. works: typedef struct anchorpixel{ int32 x; int32 y; int32 ch[5]; } anchorpixel; any ideas? it seems uint8 typedef'ed unsigned char , can see on coliru uint8_t case. cstdint header includes stdint.h , there uint8_t indeed typedef unsigned char : typedef unsigned char uint8_t; the output seeing consistent cout treating a.ch[2] char type,

javascript - $.when().then() not working with nested ajax calls -

i have been trying scroll page dynamic div created ajax call. when #divnotifications div clicked (below), make first ajax call adds post details, within ajax call, ajax call made add related comments div. the part explained far works great. then, use $.when().then() scroll div item created based on ajax calls. however, page not scroll element created loadcommentsforpost ajax call. did logic of $.when().then() wrong? $(document).on('click', '#divnotifications div', function (event) { event.preventdefault(); $.ajax({ //other details success: function (postid) { $.when(displaypostwithfulldetails(postid)).then(function () { //scroll content created //loadcommentsforpost function nested //inside displaypostwithfulldetails }); } }); }

php - 2D array, it is possible with just Javascript? -

Image
i have exercise i'm not sure if can done javascript, i'll write down here: you 3 numbers n, m, k user using prompt dialogs. number n determines dimension of table or 2d array. m determines value first element (with position 0,0) should take. walking diagonally through table or array, should increment value m k. should fill each row , column values 1 less previous element. after filling elements, should output table or array on screen. here example: so question is, have php? in case, me? two dimensional arrays supported trough program languages out there including javascript , php . difference between languages user input , output interface , speed of calculations. so answer exact question - possible both javascript , php . here tutorial how work 2d arrays in javasscript.

AngularJS assign values to items in ng-repeat array using ng-model and retrieve those values -

this turning out lot harder expected. i have 2 arrays: 1 products , 1 options. each product should have own array of options. the problem starts when try give each product own options array own scope, meaning when 1 option selected pertains product's $scope , not other. it suggested add [$index] array, doesn't seem work. can't retrieve specific values in array. the options array has these ids: (name,price,active). before trying setting active boolean true , filtering results... either way fine, in nutshell need retrieve name , price values of chosen option... this wasn't easiest explain bear me... looking. option view html <md-card ng-repeat="item in items.results | filter:true"> <img ng-src="{{item.img}}" class="md-card-image" alt=""> <md-card-content class="content"> <h2 class="md-title">{{ item.name }}</h2> &l

expression - Conditional formatting with multiple parameters -

Image
i'm in microsoft access 2013 , trying conditionally format cell in report. first 2 expressions work well: [house party 2015]=yes (green) [declined]=yes (red) i'm trying add yellow category item has been received (house party 2015 = yes) not yet received [house party donations list].[received]=no) when use "and" expression [house party 2015]=yes , [received]=no , nothing happens. i've tried reordering, creating new field called "not received" [house party donations list].[not received]=yes , nothing seems work. any guess why not working? is sort of output you're looking for? here's conditional formatting applied (i think key move and statement top it's checked first, otherwise @ [donated]=yes rule, show green): edit: per comments below, here's how locate record source property of report (in access 2013).. go in design view report , go design tab, click on property sheet button: the property sheet shou

c++ - std::function vs std::function& as a function argument -

this question has answer here: should pass std::function const-reference? 3 answers should copy std::function or can take reference it? 5 answers consider 3 functions below, func1(std::function<size_t(...) > f, ...); func2(std::function<size_t(...) >& f ); func3(const std::function<size_t(...)> &f); for other type of argument passing value/copy-constructor, passing reference , passing const reference have clear context , use cases known. for case of function<> objects, e.g. passing const reference save time (from e.g. calling potential copy constructor) or space (no need pass whole function object stack)? how big function object in first place make worth passing passing const reference? guess would size of pointer - correct?

windows installer - Create all directories in specified path -

i using install shield 2014. on 1 step user specify path files. he/she can set path consist of folders not exist. for example: f://folder1/folder2/folder3 but folder1 , folder2 , folder3 not exist on disk f. is possible tell installshield create all (folder1, folder2, folder3) directories not exist on disk? this happens automatically time. example given installer typically gets set c:\program files\company\product , files , folders added product. msi automatically create parent folder company (and program files if somehow didn't work ) it's implicitly required create product folder.

actionscript 3 - Flash object cannot connect to remote server -

Image
my company design digital signage solutions companies. animated widgets typically produced in flash. in current project i'm experiencing bit of odd issue. screen split 3 areas: video, rss ticker, , weather. rss , weather objects created using flash. each object it's own flash file. both flash object utilize same method connect remote servers: function loadweatherfromurl():void { var urlrequest:urlrequest = new urlrequest("my url"); var urlloader:urlloader = new urlloader(); urlloader.addeventlistener(event.complete, completehandler); try{ urlloader.load(urlrequest); } catch (error:error) { trace("cannot load : " + error.message); } } function completehandler(event:event):void { var loader:urlloader = urlloader(event.target); //do stuff data... } when testing in ide, both weather object , rss object work fine, seen below: once deployed signage software doesn't work anymore. however, weath

Declaring CSS class attribute with " - "? -

why attributes declared regularly while others require hyphen? .box { width: 500px; margin: 20px; border: solid black 5px; -box-sizing: border-box; } while css isn't technically correct, you're seeing vendor-prefixing. vendor prefixing used non-standard-compliant or not implemented specs of w3c recommendation. these apparent in css3 specs browsers still in process of implementing. some examples box-sizing , transform , transition . some common prefixes -moz- firefox/mozilla -webkit- safari/chrome -ms- ie/edge -o- opera -khtml- konqueror you may want see mozilla developer network has vendor prefixes. quote: browser vendors add prefixes experimental or nonstandard css properties, developers can experiment changes in browser behavior don't break code during standards process. developers should wait include unprefixed property until browser behavior standardized.

php - Conditional does not seem to be working in Controller -

my goal to, upon clicking button, redirect practice_test_view main controller's function setuptask, passing in variable $test_id. part seems work. however, once function called, no matter test_id variable is, seems running through main else clause, because calls getkey function model, when should not. causes following errors appear in browser tools: <p>severity: notice</p> <p>message: undefined variable: test_name</p> <p>filename: models/main_model.php</p> <p>line number: 45</p> <p>severity: warning</p> <p>message: file_get_contents(files/_key.json): failed open stream: no such file or directory</p> <p>filename: models/main_model.php</p> <p>line number: 45</p> practice_test_view (relevant portion): <div style='position: relative; width: 595px; margin: 20px auto;'> <input style='text-align:center; width:220px;' type="button" id='r

scala - How to compare every element in the RDD with every other element in the RDD ? -

i'm trying perform k nearest neighbor search using spark. i have rdd[seq[double]] , i'm planing return rdd[(seq[double],seq[seq[double]])] actual row , list of neighbors val out = data.map(row => { val neighbours = data.top(num = 3)(new ordering[seq[double]] { override def compare(a:seq[double],b:seq[double]) = { euclideandistance(a,row).compare(euclideandistance(b,row))*(-1) } }) (row,neighbours.toseq) }) and gives following error on spark submit 15/04/29 21:15:39 warn tasksetmanager: lost task 0.0 in stage 1.0 (tid 2, 192.168.1.7): org.apache.spark.sparkexception: rdd transformations , actions can invoked driver, not inside of other transformations; example, rdd1.map(x => rdd2.values.count() * x) invalid because values transformation , count action cannot performed inside of rdd1.map transformation. more information, see spark-5063. i understand nesting rdd not possible how perform such operations can compare every element in

fractals - extending mandelbrot to generate julia -

working on project requiring me use same code ,note in same file generate mandelbrot set , julia sets ,i hav working mandelbrot set can see how extend julia set using same code. maybe not getting differences between ? can elaborate import numpy np import matplotlib.pyplot plt import math def mandelbrot(zmin, zmax, m, n, tmax=256): xs = np.linspace(zmin, zmax, n) ys = np.linspace(zmin, zmax, m) x, y = np.meshgrid(xs, ys) z = x + 1j * y c = np.copy(z) m = np.ones(z.shape) * tmax t in xrange(tmax): mask = np.abs(z) <= 2. z[ mask] = z[mask]**2 + c[mask] m[-mask] -= 1. return m list=mandelbrot(-2,2,500,500) plt.imshow(list.t, extent=[-2, 1, -1.5, 1.5]) plt.gray() plt.savefig('mandelbrot.png') the mandelbrot set special set in terms of julia sets, documentation writes mandelbrot set index set of julia sets (there 1 , 1 index set - mandelbrot - , there infinite number of julia sets.) when calculate po

algorithm - Render local DEM on NASA world wind -

i trying render local elevation data on world wind. , use world wind's tessellation algorithm tessellate data , render on globe. know localelevationmodel. , able store dem file using this: localelevationmodel localelevationmodel = new localelevationmodel(); string filepath = ""; localelevationmodel.addelevations(filepath); i can access model using lookupelevation method on max,min lat log localelevation data. don't know how proceed forward. have looked rectangulartessellator class couldn't understand how use it. clues on how can this? ps:i looking @ source code couldn't understand make scene out of it. wanted know more it. pps: if not possible can guide me easy implement , optimized algorithm rendering of terrain. supports various lods of generated mess. thanks,

r - Locale error while deploying in Shiny -

i have same problem asked in this post . problem wasn't solved decided ask same question again here (i don't know if way or if comment in original question have been more appropriate). i have made shiny application , following error while deploying: preparing deploy application...done uploading application bundle...detecting system locale ... error in read.table(file = file, header = header, sep = sep, quote = quote, : incomplete final line found readtableheader on 'system("systeminfo /fo csv", intern = true, wait = true)' calls: <anonymous> ... systemlocale -> systeminfo -> read.csv -> read.table execution halted i have tried change locale piece of code problem persists: sys.setlocale("lc_all","english")

c# - XAML Style Won't Apply Until EventTrigger Command Completes -

i have listbox defines custom controltemplate. selected item has style changes background , foreground, , style works. however, want introduce behaviour displays modal message box on selection changed, asking user if want select different item. i've implemented icommand in code below shown areyousurecommand. the problem whilst modal message box shown, background style selected item changed foreground not. dismiss modal message box, foreground colour changes. haven't included code icommand because it's bit convoluted sufficient window opened showdialog when executed. can shed light on why background colour changes not foreground colour? <listbox x:name="submenu" itemssource="{binding myitems}"> <listbox.itemtemplate> <datatemplate> <textblock text="{binding path=displayname}" foreground="{binding foreground, relativesource={relativesource ancestortype=contentcont

Android Camera2 API - Detect when we have focus -

so, managed create functionality wanted old camera way wanted it. with mcamera.autofocus(autofocuscallback); detect when have focus , run required code while in preview-mode. now have hard time grasping how same in camera2 api. first idea i'd use private void process(captureresult result) { switch (mstate) { case state_preview: { // have nothing when camera preview working normally. int afstate = result.get(captureresult.control_af_state); //if (captureresult.control_af_state == afstate) { log.d("some kind of focus", "we have"); //} break; } } but fail find kind of state tells me have gotten focus. have idea how can done camera2 api? you've got it. list of states can check , transitions can found here . it depends on control_af_mode using, check focused_locked or perhaps passive_focused , though

excel - copy cell background color and past it corresponding cell of another sheet -

Image
i have been trying write macro copy cell background color , past corresponding cell of sheet.i have lots of values on sheet 1 , gave background color using conditional formatting ,after want copy color , past corresponding cell of sheet 2 without pasting value.example if sheet 1 cell a1 has red color specific value ,i want transfer color sheet 2 a1. giving picture of excel sheet 1 , code. sub copycolor() dim introw integer dim rngcopy range dim rngpaste range introw = 1 20 set rngcopy = sheet1.range("a" & introw + 0) set rngpaste = sheet2.range("b" & introw) 'test see if rows 500+ have value if rngcopy.value <> "" 'since has value, copy value , color rngpaste.value = rngcopy.value rngpaste.interior.color = rngcopy.interior.color end if next introw end sub i use conditional formatting giving color , here use 2 color.o

javascript - Input file upload multiple files not working on Mobile device -

Image
i have generic file loader looks this: <span class="input-group-btn"> <span class="btn btn-default btn-fill btn-file"> browse<input type="file" id="fileinputs" multiple accept="image/*" onclick="resetprogresss()"> </span> </span> i can upload multiple files desktop no problems, when try , use same functionality on mobile device, cannot seem select multiple files. here javascript: var filenames; function generateuuid() { var d = new date().gettime(); var uuid = 'xxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = (d + math.random() * 16) % 16 | 0; d = math.floor(d / 16); return (c == 'x' ? r : (r & 0x3 | 0x8)).tostring(16); }); return uuid; }; var mainpath = generateuuid(); var names = []; function uploadfiles() { var setdir = mainpath; var fileinputs = document.getelementbyid("fileinputs")

android - java.lang.InstantiationException: class has no zero argument constructor -

i trying use broadcastreceiver inner class track network state got exception in title. should fix problem? public class networkchangereceiver extends broadcastreceiver { public networkchangereceiver() { } @override public void onreceive(context context, intent intent) { final connectivitymanager connmgr = (connectivitymanager) context .getsystemservice(context.connectivity_service); final android.net.networkinfo wifi = connmgr.getnetworkinfo(connectivitymanager.type_wifi); final android.net.networkinfo mobile = connmgr.getnetworkinfo(connectivitymanager.type_mobile); if (wifi.isavailable() || mobile.isavailable()) { setupdata(); log.d("netowk available ", "flag no 1"); } } } your inner broadcast receiver must static ( registered through manifest) or non-static broadcast receiver must registered , unregistered inside parent class

python 3.x - QT Designer how to assign 2 hotkeys to a QPushButton (python3) -

i created simple gui , assigned "enter" qpushbutton ("begin"). line it: self.begin.setshortcut(_translate("form", "enter")) evrything works perfectly, how assign 2 variants of hotkey same button? want button react 2 hotkeys: enter , return (usual "big enter" , "small enter" on numpad) thanks in advance. there several ways this. simplest use qshortcut : qshortcut(qt.key_enter, self.begin, self.handlebegin) qshortcut(qt.key_return, self.begin, self.handlebegin) to button animation behaviour, try instead: qshortcut(qt.key_enter, self.begin, self.begin.animateclick) qshortcut(qt.key_return, self.begin, self.begin.animateclick)

spring security - grails springsecurity's LoginController throws NotSerializableException -

i have nicely working grails 2.5.0 project (called lss) spring-security-core:2.0-rc4 plugged in. created dev war file of project, ran in on server on tomcat8.0 , accessed using url http://localhost:8080/lss/login/auth . works fine - able login in credentials provided in bootstrap. then, switched localhost name server name , tried access using url http://devserver.prods.ca:8080/lss/login/auth . again, project alive , see login page no problem, when enter credentials consumed, username , password fields reset clean, , no redirection whatsoever, stay on login page! looking @ stacktrace.log file, see following exception: java.io.writeabortedexception: writing aborted; java.io.notserializableexception: grails.plugin.springsecurity.logincontroller @ java.io.objectinputstream.readobject0(objectinputstream.java:1355) @ java.io.objectinputstream.defaultreadfields(objectinputstream.java:1993) ... caused by: java.io.notserializableexception: grails.plugin.springsecurity.logincontroller

ios - UIWebView sizeThatsFit works incorrect with 64bit -

i have got strange behaviour in app webview. have string html code. put webview. in webviewdidfinishload resize webview. works fine long time. convert app 64bit. webview works still fine 32bit iphones (iphone4 example). 64bit iphone (iphone6 or simulators) in majority of cases calculated height ok, 1, everytime same content. -(void) webviewdidfinishload:(uiwebview *)awebview{ [awebview stringbyevaluatingjavascriptfromstring:@"document.body.style.webkittouchcallout='none'; document.body.style.khtmluserselect='none'"]; cgrect frame = awebview.frame; frame.size.height = 1; frame.size.width = awebview.superview.frame.size.width-frame.origin.x*2; awebview.frame = frame; cgsize fittingsize = [awebview sizethatfits:frame.size]; fittingsize.width = awebview.superview.frame.size.width-frame.origin.x*2; frame.size = fittingsize; awebview.frame = frame; } can me why sizethatfits not working correct?

javascript - Submit a form from a link and get $_Post value -

i have following problem. have form containing several links. links should assign hidden field , submit form using javascript. i'm using php 5.4. when submit form using button, $_post containts data. when form submitter javascript, $_post empty. any clue? <head> <script language="text/javascript"> function affect(nummet) { document.forms['frmdemo'].num_met_choose.value = nummet; document.forms['frmdemo'].submit(); } </script> </head> <body> <?php var_dump($_post); ?> <form name="frmdemo" enctype="multipart/form-data" method="post"> <input name="num_met_choose" id="num_met_choose"> <a href="" onclick="javascript:affect('22');" >test 1</a> <a href="" onclick="javascript:affect('12');" >test 2</a> <button id=&

html - How can i display form data in echo php? -

this question has answer here: how echo php code inside html inside php code in situation? [duplicate] 2 answers how can display form data in echo php ? my code is: <?php echo "<td align='center' style='vertical-align:middle;'> bust: <?php echo $_post["bust"]; ?> <br> waist: <?php echo $_post["waist"]; ?> <br> </td>"; ?> but doesn't work, please guide me correct steps. there lot of problems code. you're using " in $_post["bust"] opened echo " well, causing conflict. you're using <?php instead echo... php. there's no need this. it best isolate variable printing code. use string concatenation . such: echo "<td align='center' style='vertical-align:midd

Changing Legend in the Future of Dynamic Data Display wpf -

i have been using future d3 can not figure out how change series legend. in older builds legend changed like: graf = plotter.addlinegraph(new compositedatasource(xsrc, plot), new pen(brush, 4), new pendescription("mytext" )); but here function call addlinegraph takes object argument , hence 1 can not specify pendescription... please know how this? question asked before here did not answers. highly appreciated. have spend lot of time on , dont want change other library because of small issue... the above doesn't work recent (2016) v0.4.0. v0.4.0 uses following syntax: // access legend class using microsoft.research.dynamicdatadisplay.charts; ... snip ... linegraph linegraph = new linegraph(datasource); linegraph.linepen = new pen(brushed.green, 1.0); legend.setdescription(linegraph, "the line label"); plotter.children.add(linegraph); ... snip ... v0.3.0 used following syntax: plotter.addlinegraph(

sql server - Filter report by date to show users registered this week through email in SSRS -

i have report startdate , stopdate parameters. configured smtp settings etc send report through email on specified time working fine. getting stopdate today() function dont know how keep startdate monday of week. need automatically send report through email containing number of users registered in week i.e. monday monday on monday, monday tuesday on tuesday , monday friday on friday. same patterns in next week. thanks. please try expression below: =iif(weekday(today())=1,dateadd("d",-6,today()),dateadd("d",2-weekday(today()),today()))

qt5 - fstream doesn't work in Qt -

i have code working when compile code blocks, want use in qt5, copied it. , doing nothing. can run application, can not read data out of .txt file. included fstream, string, iostream , qcoreapplication. fstream data; data.open("datenbank.txt",ios::in); //variables database string dbname,servername,username,password,rolename,charset,parameters; string newforename ="alex"; // reading txt data data>>dbname; data>>servername; data>>username; data>>password; data>>rolename; data>>charset; data>>parameters; cout<<"test"<<endl; data.close(); cout<<dbname<<endl; cout<<servername<<endl; cout<<username<<endl; cout<<password<<endl; cout<<"test2"<<endl; what doing wrong? when compile project folder project name , build rules should appear, has "release" , "debug" sub folders. copy txt folder, not in sub fol

ng-init not initialize data in pagination, angularjs -

i'm using angularjs , angular pagination show users detail. here, use ng-init initialize age of users. if there age in user's detail show otherwise show default age 10. please see plunker ng-init works fine first time when move next page not showing default age i.e.10. example: in page 3, name name30 , there no age. so, age should come default age. nginit directive allows evaluate expression in current scope. problem approach nginit called once when scope created - works page 1. also check out says in angularjs documentation : the appropriate use of nginit aliasing special properties of ngrepeat, seen in demo below. besides case, should use controllers rather nginit initialize values on scope. so based on recommendation better set default age value in controller like: // assign value on page change. $scope.loadrecord = function(page) { $scope.user = $scope.users[page-1]; if (!$scope.user.age) { $scope.user.age = 10; }

wpf - why Dispatcher.invoke() not working? -

whenever change occured changes call set_filelist_inventory(). , send new list function ui not upadating. public partial class inventory : usercontrol { public list<string> file_list = new list<string>(); public void set_filelist_inventory(list<string> x) { if (file_list.sequenceequal(x)) { } else { file_list = x; dispatcher.invoke(() => { listview1.itemssource = file_list; }); } } public inventory() { initializecomponent(); file_list = general.getfilelist(); discover d = new discover(); d.send(d); listview1.itemssource = file_list; } } i tried removing if else block. still didn't worked.

python - can I compare the keys of two dictionaries that are not in the same order? -

i apologize must basic question using dictionaries. i'm learning python, , objective have compare 2 dictionaries , recover key , value entries both entries identical. understand order in dictionaries not relevant if 1 working list. adopted code compare dictionaries , wanted make sure order of dictionaries not matter. the code have written far is: def compare_dict(first,second): open('common_hits_python.txt', 'w') file: keyone in first: keytwo in second: if keytwo == keyone: if first[keyone] == second[keytwo]: file.write(keyone + "\t" + first[keyone] + "\n") any recommendations appreciated. apologize redundany in code above. if confirm comparing 2 dictionaries way not require key in same order great. other ways of writing function appreciated well. since loop on both dictionaries , compare combinations, no, order doesn&

Episerver - Why BlockData doesn't implement IContent -

does knows why blockdata class doesn't directly implement icontent? know during blockdata being retrieve database, proxy created castle implements icontent. if stackoverflow isn't suitable place kind of question, please move it. johan björnfot @ episerver explains of details in post . excerpt: "in previous versions of cms pages (pagedata) content type content repository (traditionally datafactory) handled. in cms7 has changed content repository (icontentrepository) handles icontent instances. means requirement .net type possible save/load content repository implements interface episerver.core.icontent. there implementations of icontent built cms pagedata , contentfolder (used group shared block instances) , possible register custom icontent implementations.if @ blockdata though notice doesn’t implement icontent, how shared block instances handled? the answer during runtime when shared block instance created (e.g. through call icontentrepository.getde

javascript - How to remove the default border radius ,Select2 -

Image
i'mm using https://select2.github.io/examples.html don't want border radius. how can remove border radius make search box sliding area ? you can add css : [class^='select2'] { border-radius: 0px !important; } fiddle : http://jsfiddle.net/jeadr/1537/

bpmn - BPM Engine vs BPM Engine Server -

i'm doing research on workflow concepts , bpmn standard. , i'm interested in available software on subject. i've studied software activiti , jbpm, both of implemented in java. great are, i'm looking else. though such software call bpm engine rather name them bpm engine servers . stand alone servers (with web based gui) makes hard embed them in other servers. now question is: there concept bpm engine in manner executes given bpm given data, 1 step? without gui or direct user interaction (something library)? should search for? named? expectations valid? [update] i've spent last hours studying activiti's user guide. i'm still not sure if can use way want to! , i'll grateful if can confirm it. i'm interested in console-like application can run whenever like, give running process (most serialized string). engine should construct process based on given history. once process reconstructed, move forward 1 step telling has happened. should i

sql - Atomic increment of counter column using simple update -

i trying understand how safely increment counter column, may incremented simultaneously many users (it's web api mobile app). i've read popular questions in strategies dealing issue can't seem figure what's wrong using simple: update table set counter = counter + 1 i've built following code sample try , inconsistent values , prove myself using simple update statement not practice: class program { static void main(string[] args) { list<task> tasks = new list<task>(); (int = 0; < 100; i++) { task t = task.factory.startnew(() => { writetocounter(); }); tasks.add(t); } task.waitall(tasks.toarray()); } static void writetocounter() { string connstring = configurationmanager.connectionstrings["defaultconnection"].connectionstring;

c - Linking and assigning struct elements to random nodes -

this problem: basically, given large file (think 20000+ lines of text) contains following: line 1: <number_of_nodes> <number of edges> rest: <source> <destination> <cost> goal figure out memory efficient way create structure(s) allow associate nodes connected nodes. these connections bidirectional. the user should allowed input location/node , program must output neighbors of node , corresponding cost input node each of neighbors. *note: |large files| contain 25000 lines of text in format integer integer integer here's supposed output: number of nodes 25000 enter node examine: 0 neighbors of node 0 are: node 1 cost 450 node 100 cost 1130 enter node examine:0 neighbors of node 0 are: node 4 cost 850 node 91 cost 304 enter node examine: 0 neighbors of node 0 are: node 3 cost 230 node 11 cost 330 enter node examine: exit and here's i've tried: #include <stdio.h> #include <stdlib.h> struct graph

sql - Compare Part of String 1 with the Second string -

i have 2 string columns below column01 column02 abc school system worked in private school. i want match these columns such if single word columns available in column b gives match result. in case word "school" present in both columns should considered match. a single word column can defined string of letters length of more 3 , having spaces @ both sides or having space @ either of 1 side , nothing on other side (to cater starting , closing word). how can in sql server? you create xml using space token , using .nodes() words xml column , compare them together. this with table1 ( select 1 id,'abc school system' col1, 'worked in private school' col2 ), cte2 ( select m.id,c.value('text()[1]','varchar(100)') collate latin1_general_ci_as col1val,c2.value('text()[1]','varchar(100)') collate latin1_general_ci_as col2val ( select id, convert(xml,'<

c# - Cannot find the interop type'Microsoft.Internal.VisualStudio.Shell.Interop.SVsColorThemeService' -

Image
i building visual studio package/extension using visual studio 2013 update 4 community edition. using standard project template comes visual studio sdk under extensibility projects group. what need svscolorthemeservice when add following line in initialize method var svc = getglobalservice(typeof(svscolorthemeservice)) ivscolorthemeservice; i 2 build errors: cannot find interop type matches embedded interop type 'microsoft.internal.visualstudio.shell.interop.svscolorthemeservice'. missing assembly reference? cannot find interop type matches embedded interop type 'microsoft.internal.visualstudio.shell.interop.ivscolorthemeservice'. missing assembly reference? the referenced assemblies not touched @ all. so looking svscolorthemeservice decompiler finds in // decompiled jetbrains decompiler // type: microsoft.internal.visualstudio.shell.interop.svscolorthemeservice // assembly: microsoft.visualstudio.shell.12.0, version=12.0.0.0, culture=neutral, pu

Displaying values from a character vector as italic labels in boxplot in R -

Image
i want use character vector boxplot names, how can these displayed italic? # data x <- rnorm(1000) # want this: labels <- c(expression(italic("one"), italic("two"))) labels boxplot(split(x, cut(x,breaks = c(-inf, 0, inf))), names = labels) but using character vector, such snames <- c("one", "two") i've tried bquote() , expression() ... labels <- bquote(expression(italic(.(snames)))) labels # length 1, not 2 ... , sapply() labels <- sapply(snames, function(x) bquote(expression(italic(.(x))))) labels boxplot(split(x, cut(x,breaks = c(-inf, 0, inf))), names = labels) but doesn't seem interpreted expression. thanks help. create following function , use shown: make.italic <- function(x) as.expression(lapply(x, function(y) bquote(italic(.(y))))) boxplot(split(x, cut(x,breaks = c(-inf, 0, inf))), names = make.italic(snames)) which gives:

Is there a list somewhere of all the tools MVVM light toolkit provide you with? -

so have been using mvvm-light toolkit on project working on , it. i have used viewmodellocator, simpleioc, design time data , relay commands, curious if there else have missed. looking list of core tools toolkit provide can google learn more them. i tried find decent documentation, know pluralsight doc( http://www.pluralsight.com/courses/mvvm-light-toolkit-fundamentals ), don't have subscription , explains why there isn't free 1 where documentation mvvm light? . i hope isn't stupid question. thanks browse of galasoft.mvvmlight.* classes in visual studio's object browser , make sure know purpose of each of them. in case of doubt @ http://www.mvvmlight.net/help/ or ask question on so.

Excel Sumifs with reference to a cell -

i want use sumifs formula sum date range variable date reference cell ie along lines of =sumifs(database[daily commission],database[date],>e2) so want sum daily commission date greater date in e2. have ideas? =sumifs(database[daily commission],database[date],">"&e2)

asp.net mvc - How can I remove filter operators from kendo mvc grid -

i have kendo mvc grid datetime column. the filters "is greater than" or "is smaller than" work on datetime cell values not "is equal to" filter. i want remove isequal filter therefore. how can this? you can use filterable.operators.string option <div id="grid"></div> <script> $("#grid").kendogrid({ columns: [ { field: "name" } ], datasource: [ { name: "jane doe" }, { name: "john doe" } ], filterable: { operators: { string: { eq: "equal to", neq: "not equal to" } } } }); </script> using mvc wrapper can use: .filterable(filterable => filterable .extra(false) .operators(operators => operators .forstring(str => str.clear() .startswith("starts with") .isequalto("is equal to") .isnotequalto("is not

java - JPA - Redirect one entity Update/Delete statements to a mirror table -

i working java ee 7 on wildfly server. have strange scenario, client has 2 tables - "employees" , "employees_modified". second table has same structure first 1 , servers modification storage. if employee changes name "john" "john-1", write employees_modified insert employees_modified(first_name) values("john") please note other fields in table "employees_modified" empty. the question is: there way somehow map 2 tables , overwrite values employees in employees_modified present. i looked @ @inheritance(strategy = inheritancetype.table_per_class) , @attributeoverrides solutions don't seem fit scenario. look @ hibernate envers , solves problem simply. attach envers project. place first table under audit annotation @audited , @audittable(value = "employees_modified"). pointed @predrag maric important leave other fields of second table empty, can use @postpersist (or listener in pure hibernate) met

encryption - Encrypting datagridview values C# -

i'm working on winforms application let user fill in account , password information in datagridview, datasource datatable connected mysql server using .net mysql connector. when user saves datatable data needs encrypted mysql database, incase hacks mysql server data useless. for encrypting , decrypting use class called simpleaes ( simple insecure two-way "obfuscation" c# ) this works great textboxes , such, how can loop thru datagridview encrypt values given user? i tried following. private void encryptaccounts() { simpleaes simpleaes1 = new simpleaes(); string password; password= datagridviewaccounts[4,0].value.tostring(); datagridviewaccounts[4,0].value = simpleaes1.encrypttostring(password); } this encrypt password first row, how can create loop every row how can create loop every row private void encryptaccounts() { simpleaes simpleaes1 = new simpleaes(); // iterate on dg

Xcode 6 running custom shell scripts -

Image
when build target, in information tab can see scheme building , target building. @ end of process runs 2 custom shell scripts. i can't find target or project running these 2 custom shell scrips. i've looked @ target > build phases , it's not being set run there. looked @ project > build settings can't locate there. i don't want run these scripts don' know how remove them! great! thanks yup know pods project or targets not set run scripts. i've inherited project on our jenkins runs 2 scripts @ end of build. i've removed jenkins not sure how remove project. pods run scripts. here's 2 scripts being run: if don't want use pods anymore, use pods-deintegrate plugin remove traces of pods.

Can I deploy multiple ears or wars files in Webshpere portal only one time -

i have more 20 ears files , take lot of time deploy each ear alone using websphere portal, i'm looking solution deploy ears 1 time. you can try wsadmin scripting http://www-01.ibm.com/support/knowledgecenter/ssaw57_8.0.0/com.ibm.websphere.nd.multiplatform.doc/info/ae/ae/trun_app_set_dragdrop.html i never tried it, seems can create special directory, copy ears , ears deployed automatically

python - scipy.optimize.linprog unable to find a feasible starting point despite a feasible answer clearly exists -

the vector k seems satisfy constraints. there i'm missing here? thanks. import numpy np scipy.optimize import linprog a_ub=[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,