Posts

Showing posts from May, 2013

How to get result from background process linux shell script? -

for example let's want count number of lines of 10 big files , print total. for f in files #this creates background process each file wc -l $f | awk '{print $1}' & done i trying like: for f in files #this not work :/ n=$( expr $(wc -l $f | awk '{print $1}') + $n ) & done echo $n you should use gnu parallel: find . -maxdepth 1 -type f | parallel --gnu 'wc -l' | awk 'begin {n=0} {n += $1} end {print n}' or else xargs in parallel mode: find . -maxdepth 1 -type f | xargs -n1 -p4 wc -l | awk 'begin {n=0} {n += $1} end {print n}' another option, if doesn't fit needs, write temp files. if don't want write disk, write /dev/shm. ramdisk on linux systems. #!/bin/bash declare -a temp_files count=0 f in * if [[ -f "$f" ]]; temp_files[$count]="$(mktemp /dev/shm/${f}-xxxxxx)" ((count++)) fi done count=0 f in * if [[ -f "$f" ]]; cat "$f&qu

null - Lua Script:attempt to call global 'tonubmer' (a nil value) -

i new lua,i don't know why,does related environment or libarary?it drive me crazy, being search answer hours. function gradient() local maxstep = 10; local starcolor="41b0f7"; local endcolor ="1622df"; local sb = tonubmer(string.sub(starcolor,1,2),16); return sb; end print(gradient()); there 2 things going on here: lua standard library functions tonumber global variables. if try access global variable not exist (in case, tonu* bm *er) nil ny default. i recommend using linting tool luainspect detect these typos before bite you.

graphics - Fast vertex computation for near skeletal animation -

i building 3d flower mesh through series of extrusions (working in unity 4 environment). each flower there splines define each branch, petals, leaves etc. around each spline there shape being extruded along spline. , thickness curve defines @ each point in spline, how thick shape be. i trying animate mesh using parameters (i.e. towards sun, bend wind). i have been working on 2 months , algorithm boiled down reconstructing flower 'every frame', iterating on shape each spline point, transforming the current space , calculating new vertex positions out of it, version of parallel transport frames. for each vertex: v = p + q * e * w where p = point on path e = vertex position in local space of shape being extruded q = quaternion transform local space of p (by direction towards next path point) w = width @ point p i believe small of step gets extrude model. need once each vertex in model basically. i hit point slow current scene. need have 5-6 flowers total around

ios - Beginner revoked all his certificates trying to fix the "10 apps in 7 days" error -

so background info... my main development machine imac had functioning certificates , provisioning files. @ time, revoked certificates using macbook attempting fix "10 apps in 7 days" error, did not have certificates or profiles downloaded it. began playing xcode account after briefly reading suggestions fix error, well, made few mistakes haha. the day after making these mis-opportune decisions, revoked following: mac installer distribution, ios development, mac app distribution, mac development, , ios distribution certificates macbook (and assume imac well?). with in mind, i'm lost how proceed. contacted apple directly, unfortunately offer administratic support. i've read through number of past questions here re-installing certificiates - process rather automatic because of xcode , other answers suggest deleting , creating new certificates through itunes connect/member center. with in mind, able recommend course of action regarding these certificates

jquery - createdCell not getting created when .draw() is called after data edit -

i'm using datatables jquery plugin. table renders want when datatable created on page load. the problem - when update data row (after editing). createdcell have defined in column 2 not getting created upon redrawing table var sitetable = $('#datagrid').datatable({ ...removed settings not seem relevant problem... columns: [ { data: null, defaultcontent: '', classname: 'select-checkbox', orderable: false }, { data: null, defaultcontent: '', orderable: false, sortable: false, createdcell: function (td, celldata, rowdata, row, col) { $(td).append( $("<button class='btn-edit-row'><i class='glyphicon glyphicon-pencil'></i></button>") ); } }, { data: "site", title: "

c - Ctrl signals fills stdin with EOF? -

i doing parser getting characters until eof , handling signals sigterm , sigint , sigtstp , sigquit . when send signal ctrl + c ( for example to sigint ) signal handler prints ctrl + c , must continue, not continuing. i figured out after each ctrl signal, eof filling buffer, not know how rid of it. tried while(getc(stdin) != eof); inside handler, parser behave normally, "eating" every character typed until eof . how can receive ctrl signal without messing stdin ? #include <stdio.h> #include <unistd.h> #include <signal.h> static void nsh_signal_handler(int code) { char c; switch(code) { case sigquit: c = '\\'; break; } fprintf(stdout, "i nothing ctrl - %c\n", c); } int main(void) { int c; struct sigaction s; s.sa_flags = 0; s.sa_handler = nsh_signal_handler; sigfillset(&s.sa_mask); sigaction(sigquit, &s, null); { c = getc(stdin); print

oracle11g - Oracle 11 variable sensitivity of elapsed time to LINESIZE changes -

i've read documentation tuning sqlplus regarding linesize struggling work out why 1 set of oracle 11 servers seems behave differently set of oracle 11 servers respect linesize running following queries gives me 'strange' elapsed time variation. select object_name dba_objects rownum < 140000; 1.1. sqlplus on sensitive servers 100 00:00:04.28 00:00:04.18 00:00:04.04 1000 00:00:06.48 00:00:06.37 00:00:06.32 10000 00:00:39.98 00:00:40.17 00:00:39.78 1.2. sqlplus on non-sensitive servers 100 00:00:04.90 00:00:04.93 00:00:04.77 1000 00:00:04.91 00:00:05.18 00:00:04.90 10000 00:00:05.79 00:00:05.54 00:00:05.74 select owner, object_name dba_objects rownum < 140000; 2.1. sqlplus on sensitive servers 100 00:00:06.65 00:00:07.53 00:00:06.88 1000 00:00:07.84 00:00:08.27 00:00:08.24 10000 00:00:40.71 00:00:41.54 00:00:40.60 2.2. sqlplus on non-sensitive servers 100 00:00:07.91 00:00:07.15 00:00:07.69 1000 00:00:05.64 00:00:05.59 00:00:05.52

multithreading - Webscrape multithread python 3 -

i have been dong simple webscraping program learn how code , made work wanted see how make faster. wanted ask how implement multi-threading program? program open stock symbols file , searches price stock online. here code import urllib.request import urllib threading import thread symbolsfile = open("stocklist.txt") symbolslist = symbolsfile.read() thesymbolslist = symbolslist.split("\n") i=0 while i<len (thesymbolslist): theurl = "http://www.google.com/finance/getprices?q=" + thesymbolslist[i] + "&i=10&p=25m&f=c" thepage = urllib.request.urlopen(theurl) # read correct character encoding `content-type` request header charset_encoding = thepage.info().get_content_charset() # apply encoding thepage = thepage.read().decode(charset_encoding) print(thesymbolslist[i] + " price " + thepage.split()[len(thepage.split())-1]) i= i+1 if iterate function on list, recommend multipr

c# - Build Process and Powershell - Visual Studio Project -

i trying add script (possibly powershell script) visual studio c# project. goal of script re-create file every time build project. ideally script run before visual studio's build process every time want build project. i new process , don't seem find way (or understand) way of doing this. thank in advance help! edit : powershell script looks like. $file_path = 'c:\users\<username>\desktop\testscripts' $file_name = 'test.xml' $file = $file_path +'\'+ $file_name $file_exist = test-path $file if($file_exist) { remove-item $file } $file_header_comment = '<!-- file auto generated during build process -->' new-item -path $file_path -name $file_name -value $file_header_comment -itemtype file -force in project's properties, on build events tab, invoke script on pre-build event command line. like: powershell.exe -file myscript.ps1

javascript - Creating dynamic links with leaflet onclick event -

im having trouble creating links separate dynamic page, user directed page when click marker created leaflet. code below entirely works; however, when marker clicked instead of going relevant page, markers link last link generated loop //add marker map on results page each result function addmarker(markerarray){ var dynamicname = 'marker'; var dynamicnumb = 'numb'; //create empty list hold each marker var markerlist = []; //for each result creater marker , push markerlist (i = 0; < markerarray.length; i++) { //turn park id integer var toint = parseint(markerarray[i][2]); //generate marker in form l.marker(latitude, longitude, name of park shown on mouse over, link individual item page on click).add marker mymap this[dynamicname+i] = l.marker([markerarray[i][0], markerarray[i][1]], {title: markerarray[i][3]}).on('click', function(e) {markerurl(toint);}).addto(mymap); //place marker in lis

scala - Thrift Debugging: Problems with my finagle server -

i have simple thrift server, implemented in scala finagle: import com.twitter.util.{ await, future } import com.jakiku.thriftscala.{ realtimedatabasepageimpressions, pageimpressions } import com.twitter.finagle.thrift import com.twitter.finagle.thrift.thriftserverframedcodec import com.twitter.finagle.builder.{ serverbuilder, server } object thriftserver { def main(args: array[string]) { val server = thrift.serveiface("localhost:9090", new realtimedatabasepageimpressions[future] { def getbytrackidandday(trackid: int, day: int) = { future(seq(pageimpressions.apply(123, 3, 4, 3, 2000l, 2000l))) } }) await.ready(server) } } this thrift file: namespace java com.jakiku.thriftjava #@namespace scala com.jakiku.thriftscala typedef i64 long typedef i32 int struct pageimpressionssum{ 1: required int trackid; 2: required int

python - Browser does not support frames Exception -

i using python + selenium interact webpage frameset , frames. however, error when sth print driver.page_source : <frameset cols="*" border="0" framespacing="0" rows="118,*" frameborder="0" onbeforeunload="unload()"> <frame src="/xxx/frameset/xxx.html" name="entete_win" id="entete_win" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" /> <frame src="/xxx/frameset/bodyframe.html" name="body_win" id="body_win" marginwidth="0" marginheight="0" frameborder="0" scrolling="no" /> <noframes> &lt;body bgcolor="#ffffff"&gt; browser not support frames. &lt;/body&gt; </noframes> </frameset> my selenium version 2.53.2. tried firefox , chrome driver 2.21. if understand que

java - Spring IoC: Conditional Injection in run time -

how can conditionally inject bean externally using framework ( not creating factory class)? in below scenario both childbeans instantiated while injected parent bean in run time based on condition. <bean id=childbean1> <bean id=childbean2> <parentbean name='parentbean' lazy-init="true"> <property name='flag'> <somecondition flag=1/> <property name='child' ref ='childbean1'/> <somecondition flag=2/> <property name='child' ref ='childbean2'/> </parentbean> you can via spring expression language(spel): <bean class="com.example.spring.testbean"> <property name="dependency" value="#{systemproperties['profile'] == 'test' ? dependencya : dependencyb}" /> </bean> also possible using java config below: @bean public hellobean hellobean() { hellobean hellobean = new hellobea

arrays - How to take multiple integers as single input separated by space in java, then break them into integers? -

need take input 1 2 3 or of length separated space break separate integers. have tried array , strings , charat() , string.split() method not working. input can 1 2 3 4 or 1 2 or of length, need separate 1,2,3 integers. i have tried far: class cube{ public static void main(string args[]){ int i,j=0,sum=0; int arr[]=new int[10]; scanner scan=new scanner(system.in); string s=scan.nextline(); int len =s.length(); for(i=0;i<=len;i++){ string[] str=s.split(" "); int i=str[j]; sum+=math.pow(3,i); j++; } } } you not parsing string int. need use integer.parseint() . also, use of bufferedreader preferred. class cube{ public static void main(string args[]){ int i,j=0,sum=0; int arr[]=new int[10]; scanner scan=new scanner(system.in); string s=scan.nextline(); string[] str=s.split(" "); for(i=0;i<=str.length;i++){ int temp = integer.parseint(str[i]);

javascript - How can I use the window.close() inside a href? -

how can use window.close() inside im trying add window.close() inside href. code matter while(mysqli_stmt_fetch($stmt)) { echo "<tr>"; echo "<th>".sprintf("%s", $col2)."</th>"; echo "<th>".sprintf("%s", $col3)."</th>"; echo "<th>".sprintf("%s", $col4)."</th>"; echo "<th>".sprintf("%s", $col18)."</th>"; echo "<th>".sprintf("%s", $col19)."</th>"; echo "<th><a target='_blank' href='review.php?id=$col1'>click</a></th>"; echo '</tr>'; } im trying add window.close() in line echo "<th><a target='_blank' href='review.php?id=$col1'>click</a></th>"; i hope can help. thank you i think looking this. &l

css - Responsive Image Masking compatible with IE -

Image
i achieve above. image clipped, there surrounding border around image, clipped well. have done chrome , firefox using css clip path - http://staging.web2-hk.redantdev.com/plukka-html/about.html the clip path property complex shape isn't supported in ie - http://caniuse.com/#feat=css-clip-path . i know technique make work in ie edge @ least.

javascript - Codeigniter : How to redirect to main page if there is no data to load again? -

i'm on online quiz project, 1 page 1 question. , have problem when there's no question load, don't understand how redirect main page try use redirect method. redirect('controller/action');

python - Finding value in matrix from tuple -

i have matrix: matrix = np.array([[3,3,3,3,3,3,3,3,3,3,3,3], [3,2,2,2,2,2,0,0,0,0,0,3], [3,2,2,2,2,0,0,0,0,0,0,3], [3,2,2,2,0,0,0,0,0,0,0,3], [3,2,2,0,0,0,0,0,0,0,0,3], [3,2,0,0,0,0,0,0,0,0,0,3], [3,0,0,0,0,0,0,0,0,0,1,3], [3,0,0,0,0,0,0,0,0,1,1,3], [3,0,0,0,0,0,0,0,1,1,1,3], [3,0,0,0,0,0,0,1,1,1,1,3], [3,0,0,0,0,0,1,1,1,1,1,3], [3,3,3,3,3,3,3,3,3,3,3,3]]) and list of lists filled tuples these: [[(10, 6), (10, 5), (10, 7), (9, 6), (9, 5), (9, 7)], [(9, 7), (9, 6), (9, 8), (8, 7), (8, 6), (8, 8), (10, 7), (10, 6), (10, 8)], [(10, 7), (10, 6), (10, 8), (9, 7), (9, 6), (9, 8)], [(8, 8), (8, 7), (8, 9), (7, 8), (7, 7), (7, 9), (9, 8), (9, 7), (9, 9)], [(9, 8), (9, 7), (9, 9), (8, 8), (8, 7), (8, 9), (10, 8), (10, 7), (10, 9)], [(10, 8), (10, 7), (10, 9), (9, 8), (9, 7), (9, 9)], [(7, 9), (7, 8), (7, 10), (6, 9), (6, 8), (6, 10),

GWT 2.8 websocket support -

does jetty server in gwt 2.8 support websocket now? know did not support before. if there positive answer, how make work? stripping out jetty-8 , replaceing jetty-9 not idea think. gwt 2.8 has switched jetty 9.2, and supports servlets 3.1 servlets container initializers, think being used setup websockets. haven't tried suppose can have websockets in devmode, provided add required dependencies classpath. you can use separate server rather 1 embedded devmode.

Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.cfg.Environment.verifyProperties(Ljava/util/Map;)V -

am new java programming.i downloaded project website.... i trying run hibernate project in eclipse juno. when running project getting following errors: exception in thread "main" java.lang.nosuchmethoderror: org.hibernate.cfg.environment.verifyproperties(ljava/util/map;)v @ org.hibernate.service.serviceregistrybuilder.buildserviceregistry(serviceregistrybuilder.java:244) @ com.mycompany.contactmanager.main(contactmanager.java:24) you use different hibernate version, project has been written for.

linux - Kubernetes can't start due to too many open files in system -

i trying create bunch of pods, services , deployment using kubernetes, keep hitting following errors when run kubectl describe command. for "pod" runcontainererror: "runcontainer: api error (500): cannot start container bbdb58770a848733bf7130b1b230d809fcec3062b2b16748c5e4a8b12cc0533a: [8] system error: many open files in system\n" i have terminated pods , try restarting machine, doesn't solve issue. not linux expert, wondering how shall find open files , close them? you can confirm process hogging file descriptors running: lsof | awk '{print $2}' | sort | uniq -c | sort -n that give sorted list of open fd counts pid of process. can each process w/ ps -p <pid> if main hogs docker/kubernetes, recommend following along on issue caesarxuchao referenced.

ios - Is there a way to use adobe creative sdk [i want to use only adobe labs magic selection tool] without login? -

i'm using adobe labs magic selection tool, asks user adobe sign in. there way not make user login, still use magic selection tool? heard this, couldn't implement. see link adobe id signin required creative sdk adobe labs tools. there no way turn off.

javascript - How to pass customHeaders as system arguments in PhantomJS script? -

i have started working in small proof of concept using phantomjs take screenshots , i'll necessary configurations system arguments such url, timeout, isscreenshotreqd, isharfilereqd, isheadersreqd, username, password , application related configs. working fine except customheaders . code used if (system.args.length === 1) { console.log('usage: phantom.js <some url>'); phantom.exit(1); } else { assembleid = system.args[2]; page.address = system.args[3]; page.settings.resourcetimeout = system.args[4]; isscreenshotreqd = system.args[5]; isheadersreqd = system.args[6]; isharfilereqd = system.args[7]; page.settings.username = system.args[8]; page.settings.password = system.args[9]; var key = "headerkey";//(or system.args[10]) var value = "headervalue";//(or system.args[11]) page.customheaders = {key : value}; //some operation } this sets customheader "headers": [{"name&q

casperjs - how to use begin() in a subfunction? -

is right way use new begin() feature casperjs dev-1.1-beta? have use new begin() function in thenclick function? correct how used test.done() ? when run test returns dubious: neuen teilnehmer anlegen: 2 tests planned, 1 tests executed . casper.test.begin('neuen teilnehmer anlegen', 2, function(test) { test.assertexists('a[href="/rdgrc/communityservice/new"]'); casper.thenclick('a[href="/rdgrc/communityservice/new"]', function () { casper.test.begin('page found', 1, function(test) { test.asserturlmatch(/rdgrc\/communityservice\/new/, 'redirected index page after login'); test.done(); }); test.done(); }) }); i think can like: casper.test.begin('neuen teilnehmer anlegen', 2, function suite(test) { test.assertexists('a[href="/rdgrc/communityservice/new"]'); casper.thenclick('a[href="/rdgrc/communityser

How to automate drag and drop and click in Canvas Element using Selenium Webdriver? -

i have create automated tests automating click , drag , drop in html canvas. this documentation advanced user actions might useful.

android - Anonymous bug in TextView -

i developing restaurant app. here use cart page view food items user selected checkout. cart items listed using recyclerview having + & - button increase & decrease product count before checkouts. problem @ here. let consider items follows: result textview chocobar rs25 - 4 + = 100 // expected result vennila rs30 - 1 + = 30 while clicking "+" button in chocobar result textview chocobar rs25 - 5 + = 100 ( set 125 within fraction of second changed 100) vennila rs30 - 1 + = 30 but if use gettext, resulttextview nothing in code used holder.cartpricedum resulttextview.gettext().tostring --> returns 125 chocobar's item values. gettext works settext not worked. gettting messup. please me, spent more time fix it.still have not fixed it. mycode follows: holder.ivincrease.setonclicklisten

Refactor PHP legacy arrays -

i have legacy code clear, clean , concise. of legacy logic lies in using arrays. code here: if (isset($statistics[$lowerinstance])) { $statistics[$lowerinstance][$size]['count'] += $items[$lowesttype]['count']; $statistics[$lowerinstance][$size]['amount'] += $items[$lowesttype]['amount'] + (($items[$highesttype]['amount'] / $items[$highesttype]['count']) * $items[$lowesttype]['count']); } else { $statistics[$lowerinstance][$size]['count'] = $items[$lowesttype]['count']; $statistics[$lowerinstance][$size]['amount'] = $items[$lowesttype]['amount'] + (($items[$highesttype]['amount'] / $items[$highesttype]['count']) * $items[$lowesttype]['count']); } if (isset($statistics[$higherinstance])) { $statistics[$higherinstance][$size]['count'] += $items[$highesttype]['count'] - $items[$lowesttype]['count']

Date, day, month and year increment by clicking next & previous button in Appcelerator -

i need change date,day , month clicking next , previous button in appcelerator. if click on previous button date,day , month have decrement , if click on next button date,day , month have increment. appreciated. thank you you use moment js library: var moment = require("moment"); var = moment(); //today now.add(1'days'); //tomorrow now.subtract(1'days'); //yesterday to date formatted: now.format('yyyy-mm-dd hh:mm:ss'); //will return string: 2016-05-25 11:01:32 momentjs documentation: http://momentjs.com/docs/

get xml child node data in php -

any idea how data of node <ns2:profilematchdetailscore> in php have trying code $xml_document = simplexml_load_xml($xml_document); $foo_ns_bar = $xml_document->children(' http://example.com '); echo $foo_ns_bar->bar[0]; // prints 'baz' but thats not working on end. <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:body> <ns2:matchresponse xmlns:ns2="http://xmp.actonomy.com"> <return> <matchcount>1</matchcount> <fromhits>0</fromhits> <maxhits>10</maxhits> <matches> <detailscore> <score>0.41281393</score> <contributedscore>0.41281393</contributedscore> <maxcontributedscore>1.0</maxcontributedscore> <weight>1.0</weight>

typescript - Angular 2 issue with web api calling -

i implement web api , returns data in format. think when try show on client side there thing wrong. because response restapi in 2d. kindly guide me doing wrong thankful. { "total": 134885, "data": [ { "id": 21891, "source": "eventsystem", "logid": 4625, "level": "information", "date": "2016-03-14t10:14:56", "category": "(0)" }, { "id": 21892, "source": "msiinstaller", "logid": 11728, "level": "information", "date": "2016-04-29t12:13:24", "category": "(0)" }, { "id": 21893, "source": "msiinstaller", "logid": 1035, "level": "information", "date": "2016-04-29t12:13:24&q

java - setMovementMethod doesn't work in android textview -

Image
i have textview text coming database. text can normal text or can link or both. this, parsing text in html using html.fromhtml(mytext) . link can detected , display clickable. working fine. displays clickable string links , non-clickable normal text. when click text, doesn't work , nothing happens. this getting server text : dear user: review titled <a href="http://example.com/review/sometext-1069459" target="blank">normal verified negative 1 desktop</a> on product <a href="http://example.com/product-reviews/text-925766045" target="blank">clickable text</a> has been resolved. check corporate response <a target="blank" href="http://example.com/interact.php?add=http://example.com/blog/ejhhspsqmn/please-talk-about-your-companys-products-and-services-onlyplease-present-your-post-in-an-objectiv&session_id=se9qexa6jsy%3d">click here</a> have great day! regards, head - member s

convert HTML file contents into a string in Javascript -

i'm asking users upload , html file, convert contents of html file string. html file: <form action=""> <input type="file" name="pic" accept="html" id = "htmlfile"> </form> javascript function readtextfile(file) //this wrong think { var rawfile = new xmlhttprequest(); rawfile.open("get", file, false); rawfile.onreadystatechange = function () { if(rawfile.readystate === 4) { if(rawfile.status === 200 || rawfile.status == 0) { var alltext = rawfile.responsetext; alert(alltext); } } } rawfile.send(null); } if understand correctly, can read file after input change filereader this: function readsinglefile(evt) { //retrieve first (and only!) file filelist object var f = evt.target.files[0]; if (f) { var r = new filereader(); r.onload = function(e)

scala - File upload using Akka HTTP -

i trying implement file upload functionality in application using akka http. using akka-stream version 2.4.4 . here code (modified akka-doc ) path("fileupload") { post { extractrequestcontext { ctx => { implicit val materializer = ctx.materializer implicit val ec = ctx.executioncontext fileupload("fileupload") { case (metadata, bytesource) => val location = fileutil.getuploadpath(metadata) val updatedfilename = metadata.filename.replaceall(" ", "").replaceall("\"", "") val uniqfilename = uniquefileid.concat(updatedfilename) val fullpath = location + file.separator + uniqfilename val writer = new fileoutputstream(fullpath) val bufferedwriter = new bufferedoutputstream(writer) val result = bytesource.map(s => { bufferedwriter.write(s.

android - spinner cant show data from sd card -

this code add data spinner. first read file name sd card adding spinner. cant work. display first file name. file yourdir = new file(catagoryfilepath); (file f : yourdir.listfiles()) { if (f.isfile()) { mycatagoryfilename = f.getname(); } try { string categoryfilename[] = mycatagoryfilename.split("@"); for(int = 0; i<categoryfilename.length; i++){ string catagorydata = categoryfilename[i]; if (catagorydata.contains("-")) { string data[] = catagorydata.split("-"); string lang = data[0]; string cat = data[1]; } } string catagoryname = categoryfilename[2]; } catch (exception e) { e.printstacktrace(); } catagory = new arraylist<string

C# using my own C++/CLI DLL: Error: 'mytrainOp' is not supported by the language -

my c++ class has 1 method: string mythreadscpp::mythreadscppclass::train(){ double sum = 0.0; long max = 100 * 1000; int perc = 0;; (long n = 0; n < max; n++){ sum += 4.0*pow(-1.0, n) / (2 * n + 1.0); int rem = n % (max/10); if (rem == 0){ perc = 100 * n / max; cout << perc << "%" << endl; } } cout << "100%" << endl; ostringstream oss; oss << "result = " << sum; return oss.str(); } it works fine. c++/cli class library has 1 method: string threadscppwrapper::threadscppwrapperclass::mytrainop(int% i){ i++; return ptr->train(); } it builds fine. c# code consuming dll: namespace threadscsharp { public partial class frmmain : form { private void btntrain_click(object sender, eventargs e) { threadscppwrapperclass obj = new threadscppwrapperclass();

sql - MySQL: Use a single Column to show as multiple select column in single row -

Image
consider these example tables e_id in table1 primary key. , assign_to foreign keys referenced e_id. i want show table this: i not sure how can implement it. please share sql query returns desired table. you join table1 twice: select t2.work_name, t1f.e_name `from`, t1a.e_name `assign_to` table2 t2 inner join table1 t1f on t1f.e_id = t2.`from` inner join table1 t1a on t1a.e_id =t2.assign_to

php - Manage files and directories in browser -

i'm using php based cms called couch ( couchcms ). the interface pretty simple. it's easy edit page content , that's it. i'm trying add functionality. want add tab called "files". tab when activated going display files. example show me "images" folder , other files located in website's folder. is possible somehow php show directories on web page , there add , remove them? try using function: http://php.net/manual/en/function.readdir.php but think can use jquery + php libraries you: https://www.sitepoint.com/10-jquery-file-manager-plugins/

angularjs - Angular filter to initialise first name -

i need make angular filter take full names, , initialise first name, leaving last name, except in cases (e.g. van aanholt). so following: yohan cabaye oscar jordi alba ramos patrick van aanholt hatem ben arfa will shown as: y. cabaye oscar j. ramos p. van aanholt h. ben arfa any appreciated. update: i've tried... angular.module('eurofilters', []) .filter('initialisename', function() { return function(name) { var namearr = name.split(' '); var firstname = namearr[0]; var firstnameinitial = namearr[0][0] + ". "; var lastname = namearr[namearr.length - 1]; var secondarylastname = namearr[namearr.length - 2]; // if 1 name (standard)... if (namearr.length <= 1) { return firstname; } // if more 1 name, , contains "van" or "ben" (exception)... else if (secondarylastname === "van" || secondarylastname === "ben") { return firstnameinitial

Delphi: DateTimeToStr output with zero time (midnight) -

i have found similar question here , unrelated trying do. have done lot of research on internet , have determined delphi working designed or intended, omits time if time zero. have application displays date & time in listview, , when time midnight, doesn't show 00:00:00, , therefore making results uneven , out of place. the way i've gotten around still locale independant add microsecond time, see sample code: program test11; {$apptype console} {$r *.res} uses system.sysutils, winapi.windows; begin try writeln(datetimetostr(44167, tformatsettings.create(getthreadlocale))); writeln(datetimetostr(44167.00000001, tformatsettings.create(getthreadlocale))); readln; except on e: exception writeln(e.classname, ': ', e.message); end; end. and subsequent output: 02/12/2020 02/12/2020 00:00:00 the question - there better, more programatically correct way achieve this? running delphi xe6 you can use formatdatetime fu

html - Umbraco quotation marks -

Image
i have problem when try print out tinymce in umbraco xslt renders fine puts quotation marks around it. can why? <?xml version="1.0" encoding="utf-8"?> <!doctype xsl:stylesheet [ <!entity nbsp "&#x00a0;"> ]> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" xmlns:exslt.exsltcommon="urn:exslt.exsltcommon" xmlns:exslt.exsltdatesandtimes="urn:exslt.exsltdatesandtimes" xmlns:exslt.exsltmath="urn:exslt.exsltmath" xmlns:exslt.exsltregularexpressions="urn:exslt.exsltregularexpressions" xmlns:exslt.exsltstrings="urn:exslt.exsltstrings" xmlns:exslt.exsltsets="urn:exslt.exsltsets" xmlns:examine="urn:examine" xmlns:ucomponents.cms="urn:ucomponents.cms" xmlns:ucomponents.dates="urn:ucomponents.d

swift - AWS Framework and XCode Conundrum -

this question has answer here: submit app store issues: unsupported architecture x86 6 answers i trying upload xcode project app store , running frameworks related issues. project has awscore framework, rather cocoa pods route, has been manually downloaded , added project. has been added both 'build phases' settings of target - 'embedded binaries' , 'linked frameworks , libraries'. these 2 setting combined however, might causing below mentioned issues while uploading project app store: error itms-90087: "unsupported architectures. executable /frameworks/awscore.framework contains unsupported architectures '[x86_64, i386]’." error itms-90209: "invalid segment alignment. /frameworks/awscore.framework/awscore' not have proper segment alignment. try rebuilding app latest xcode version." i have latest version of xc

robotframework - Sending a POST request using Balkan's requests lib with data and files (Robot Framework) -

i'm trying send request (post) using balkan's requests library test case written in robot framework http://bulkan.github.io/robotframework-requests/#post 2 parameters data , file. unfortunatelly, time have same error described below. my test case: x_t_should upload file correctly , http 200 send default file sut , return response *** keywords *** send default file sut , return response [arguments] ${user_login}=${user_login} ${user_password}=${user_password} ${url}= url ${auth}= create list ${user_login} ${user_password} create session rm ${url} auth=${auth} &{headers}= create dictionary content-type=application/x-www-form-urlencoded &{data}= create dictionary name=file filename=${default_file_name} ${file_data}= binary file ${curdir}${/}resources${/}${default_file_name} &{files}= create dictionary file=${file_data} ${resp}= post request rm ${upload_uri}

WCF Restful Service :-Failed to add a service. Service metadata may not be accessible. Make sure your service is running and exposing metadata -

the error is on ctrl+f5 getting following error. failed add service. service metadata may not accessible. make sure service running , exposing metadata. here interface declaration using system; using system.collections.generic; using system.linq; using system.runtime.serialization; using system.servicemodel; using system.text; using system.servicemodel.web; namespace dealerauditwcfservice { // note: can use "rename" command on "refactor" menu change interface name "idealerauditservice" in both code , config file together. [servicecontract] public interface idealerauditservice { [operationcontract] [webinvoke(method = "get", uritemplate = "/getdealerbyregid/{regid}", bodystyle = webmessagebodystyle.wrapped, requestformat = webmessageformat.json, responseformat = webmessageformat.json)] registration getdealerbyregid(string regid); //[operationcontract]

embedded - Adding entry for an i2c device connected on i2c mux in linux device tree -

i using freescale powerpc 85xx processor linux 2.6.32. i2c subsytem mapped @ address 0x03000 inside ccsr registers. want add rtc device ,ds1338 (i2c addr: 0x68 ) connected i2c mux (address: 0x76 ) on channel 5 (selected writing 0xfd on control register). without adding device in dts file, rtc device won't bind driver. have following entry in device tree right now: i2c@3000 { /* i2c 1 */ #address-cells = <1>; #size-cells = <0>; cell-index = <0>; compatible = "fsl-i2c"; reg = <0x3000 0x100>; interrupts = <43 2>; interrupt-parent = <&mpic>; dfsrr; }; what after adding above information. had been device directly on i2c bus , not through mux, have added this: i2c@3000 { /* i2c 1 */ #address-cells = <1>; #size-cells = <0>; cell-index = <0>

etl - Downloading files with pentaho kettle -

i'm trying create job can download several files via http. list of these files in mysql table. create main job these steps in line: start, set variables, filelist (a transformation created), download (a job i've created) , success. the transformation filelist contains following steps: table input , copy rows result (this transformation communicates database , gives list of urls main task). task download contains following steps: start, http, success (this task should download files computer). all doesn't work, why? know better way same thing? i expect have basic knowledge of kettle. so, getting list of db not issue. guess stuck @ having kettle download , save of files - running loop. the step downloading file "http" , available in jobs. trick have job (containing http step download) executed every file - or use kettle-lingo "executed every row". url passed down download-job parameter set field. if didn't you, check out following

Oracle user created more than 6 months ago -

i trying find users created more 6 months ago. trying following must doing wrong. ideas? ... created_timestamp <= trunc(sysdate) - 180); you can use this, letting oracle count months yu: select * all_users created < add_months(sysdate, -6) you can add trunc sysdate avoid problems time, if need.

c# - Image from manually created byte[] -

i want create image byte[] create manually, jit error system.argumentexception: parameter not valid. @ system.drawing.image.fromstream(stream stream, boolean useembeddedcolormanagement, boolean validateimagedata) @ createbitmapfromstream.form1.form1_load(object sender, eventargs e) in c:\data\c#-workspace\createbitmapfromstream\createbitmapfromstream\form1.cs:line 35 @ system.windows.forms.form.onload(eventargs e) ... here code: private void form1_load(object sender, eventargs e) { var data = new byte[20*10]; (int = 0; < data.length; i++) { if (i < 100) data[i] = 0x15; else data[i] = 0x99; } using (var ms = new memorystream(data)) { var img = image.fromstream(ms, true, true); panel1.backgroundimage = img; } } what doing wrong? an image constructed according format. it's not sequence of pixels. if want draw pixels, use bitmap class provided system.drawing bitmap b = new bitmap(1, 1); b.setpixel(0, 0,

python - Error when calling the metaclass bases -

finding difficult wrap around basic problem. i'm using python 2.7.10 follow flask tutorial being delivered using python 3.4. i'm aware of differences between 2 versions, seems knowledge isn't enough overcome situation. have amateur level experience in python. have feeling got class definition, unable nail it. , yes went through solutions similar error wasn't able relate solution problem. traceback (most recent call last): file "manage.py", line 5, in <module> flask_init import app file "/users/sapp/desktop/ude/flask_init/__init__.py", line 12, in <module> author import views file "/users/sapp/desktop/ude/flask_init/author/views.py", line 3, in <module> form import registerform file "/users/sapp/desktop/ude/flask_init/author/form.py", line 5, in <module> class registerform(form): typeerror: error when calling metaclass bases module.__init__() takes @ 2 arguments (3 given)