Posts

Showing posts from April, 2011

linux - Postgresql fails to start -

postgresql fails start when run sudo -u postgres psql following output psql: not connect server: no such file or directory works locally , receives connection via domain socket "/var/run/postgresql/.s.pgsql.5432"? postgresql.conf listen_addresses = '*' pg_hba.conf # database administrative login unix domain socket local postgres trust # type database user address method # "local" unix domain socket connections local all trust # ipv4 local connections: host all 0.0.0.0/32 trust host all 192.168.0.0/24 trust # ipv6 local connections: host all :: 1/128 trust when try manually start server sudo service postgresql start following output [....] starting postgresql 9.1 database server: main [....] postgresql server failed start. please check log output: 2015-06-04 17:44:22 utc ???????: ?? selinux selinux media ipv6: eafnosupport 2015-06-04 17:44:22 utc ???????: ?? selinux ??????????? ? ?????? bin dev etc lib mnt opt ​​run sr...

c# - Difference between Find and FindAsync -

i writing very, simple query gets document collection according unique id. after frusteration (i new mongo , async / await programming model), figured out: imongocollection<tmodel> collection = // ... findoptions<tmodel> options = new findoptions<tmodel> { limit = 1 }; iasynccursor<tmodel> task = await collection.findasync(x => x.id.equals(id), options); list<tmodel> list = await task.tolistasync(); tmodel result = list.firstordefault(); return result; it works, great! keep seeing references "find" method, , worked out: imongocollection<tmodel> collection = // ... ifindfluent<tmodel, tmodel> findfluent = collection.find(x => x.id == id); findfluent = findfluent.limit(1); tmodel result = await findfluent.firstordefaultasync(); return result; as turns out, works, great! i'm sure there's important reason have 2 different ways achieve these results. difference between these methodologies, , why should choose...

selenium webdriver - Easy to use multi browser automation tool for record, parameterize, debug, batch run of suites and results report -

i'm new in tests area. regression team belong has built gui tests web applications complex business logic developers team has produced. until now, have been using selenium ide build regression tests (record, edit, parameterize, debug , playback). tests exported , maintained in html format. used have tool manage tests , iterations (store html scripts/tests suites, run tests in batch mode, run tests in background, detailed test result reports), deprecated because uses selenium rc. additionally, tests made in firefox, our clients ie users. so, have important , strategic decisions make. need urgently start testing in ie , new way tasks doing. an attempt made change code of tests’ manager tool in order work selenium webdriver. tried code tests in ruby beginning, since selenium ide export ruby not satisfactory. figured out huge changes , subsequent tests on manager tool needed. involve programming methods , test them. our regression team quite small , don’t want focus on prog...

excel - Copy row, transpose and paste -

i need simple twist common vba code copy , paste columns/rows trying copy entire row in sheet 2 , transpose , paste them column , sheet1. first row in sheet1 has headings have paste them a2 extends whole column sub transpose2() sheets(2).range("a1", cells(columns.count, "a").end(xlright)).copy sheets(1).range("a2").pastespecial transpose:=true range("a1").clearoutline end sub this doesn't seem work. can me this? thank you! sub transpose2() sheets(2) .range(.range("a1"), .cells(1, .columns.count).end(xltoleft)).copy end sheets(1).range("a2").pastespecial transpose:=true range("a1").clearoutline 'which sheet? end sub

asp.net mvc - Telerik mvc grid, columns.bound to dictionary value. or "dynamic property in model" -

i have model dynamic "propertys" (in db level, similar entity-attribute-value system). properties in field of dictionary<int, string> , , show them columns. model: the model have static array (initalized in static counstractor) of "property" names & keys: public static modelspecialparameter[] specialfields; and dictionary (initalized in model create, , posible keys added) values. public dictionary<int, string> valuesfordynamicprops; the view : @(html.kendo().grid(model) .name("grid") .columns(columns => { //other columns realy propertry //columns.bound(e => ... //columns.bound(e => ... foreach (var item in specialfields) // specialfields static collection. represent name id of dynamic property's. { columns.bound("valuesfordynamicprops[" + item.idproperty + "]").width(140).title(item.displayname); } } i error: {"bound columns require field or ...

datetime - python get rid of default date 1900-01-01 -

i wondering if can rid of 1900-01-01 in outputs without changing of code. know there have been 1 addressing don't understand how apply lines code without changing everything. if giudance appreciate it! import csv datetime import datetime time_difference= open('book1.csv')#it important within csv file times not have spaces before, foramtted military time , these settings saved before code ran time_difference_csv=csv.reader(time_difference) row in time_difference_csv: w = [[datetime.strptime(i[0],'%h:%m:%s')]+ [datetime.strptime(i[1],'%h:%m:%s')] in time_difference_csv] row in w: p= (row[1]-row[0]) row in w: l= (row[1]-row[0]) + row[0] td= open('121times3.csv')#imports csv list of times 1 time source; e.g. scanner times td_csv=csv.reader(td) firstline = true row in td_csv: if firstline: #skip first line firstline = false continue # parse line row in td_csv: k = [[datetime.time.strptime(i[0],'%h:%m:%s...

python - Django rest framework: override create() in ModelSerializer passing an extra parameter -

i looking way ovverride default .create() method of modelserializer serializer in django rest framework dealing parameter. in original django model have overridden default .save() method managing extra param. .save() can called in way: .save(extra = 'foo') . i have create modelserializer mapping on original django model: from originalmodels.models import originalmodel rest_framework import serializers class originalmodelserializer(serializers.modelserializer): # model fields class meta: model = originalmodel but in way can't pass extra param model .save() method. how can override .create() method of originalmodelserializer class take (eventually) extra param account? hmm. might not perfect answer given don't know how want pass "extra" in (ie. field in form normally, etc) what you'd want represent foo field on serializer. present in validated_data in create , can make create following def create(se...

php - Stylesheet not found when link is correct -

i trying link stylesheet php template website. used link: <link rel="stylesheet" type="text/css" href="{{app.request.basepath }}/app/views/templates/style.css"> now, works on localhost server(i use mamp), when upload files web host error: failed load resource: server responded status of 404 (not found) the panel have seems support 5.5, use 5.6 on local server. issue. and gives me link, exact link file, no misspelled or capitalized letters. file trying link stylesheet in same folder stylesheet. rewriting .htaccess file because using slimphp file is: rewriteengine on rewritecond %{request_filename} !-f rewriterule ^ index.php [qsa,l] i think might have being unable link not sure. in advance of help edit: fixed problem linking style sheet public file in directory. there, link images using css, had place them in public directory this how route theme-specific stylesheets in slim , twig. first create new config variable, the...

c# - 'string' does not contain a definition for 'isNullorWhiteSpace' -

i'm not sure how incorporate own method code using isnullorwhitespace, framework isn't 4.0. i've had , suggested using isnullorwhitespace , not preferred method display: 2/20/2014 7:33:10 am, measured velocity: 0.2225 i can't seem find equivalent code work. using system; using system.collections.generic; using system.text; using system.io; using system.collections; namespace conapp { class program { public static class stringextensions { public static bool isnullorwhitespace(string value) { if (value != null) { (int = 0; < value.length; i++) { if (!char.iswhitespace(value[i])) { return false; } } } ...

Sharing memory with Android native app -

i'm trying create shared memory region follows: jniexport jlong jnicall java_com_test_native_getshortbuffer(jnienv* env, jobject thiz, jint channels, jint size) { int bytes = (int)channels * (int)size * 2; int fd = open("/dev/ashmem", o_creat | o_rdwr | o_direct | o_sync, s_irusr | s_iwusr); if (fd < 0) return errno; // 0 = let os choose start address // last param = starting offset char *data = static_cast<char*>(mmap(null, bytes, prot_read | prot_write, map_shared, fd, 0)); if (data == map_failed) { close(fd); return errno; } return (jlong)data; } but err 22, einval, says o_flags incorrect. tried variety of flags, such o_creat | o_rdwr, s_irusr | s_iwusr , no luck. flags see above came managed pull off ( see here ). anyone know i'm doing wrong?

CSS-3 transforms mangle HTML element when i add another sibling element . -

3 , trying understand how css3 properties perspective , transform-style:preserve-3d work , made following 2 demos : demo one: html :: <div class="wrapper"> <div class="inner"></div> </div> css:: .wrapper { perspective:1000px; transform-style: preserve-3d; } .inner { margin: 200px 0 0 200px; height: 400px; width: 400px; background: #444; transform : translatex(-350px) translatez(-200px) rotatey(45deg); } in 1st demo tranform properties behave want them , wanted div move left , move on z-offset backward , rotate 45degs . thats wanted , problem arises when add inner div html , see below : demo two html:: <div class="wrapper"> <div class="inner"></div> <div class="inner"></div> </div> css:: .wrapper { perspective:1000px; transform-style: preserve-3d; } .inner { ...

couldn't get data while connecting mule with linkedin -

i tried integrate linkedin mule. authorize user , profile information. but couldn't change current status.. , couldn't user updates. got following error message : not find transformer transform "simpledatatype{type=java.lang.string, mimetype='*/*'}" "collectiondatatype{type=java.util.list, itemtype=java.lang.object, mimetype='*/*'}". code : mule_error-65237 -------------------------------------------------------------------------------- exception stack is: 1. not find transformer transform "simpledatatype{type=java.lang.string, mimetype='*/*'}" "collectiondatatype{type=java.util.list, itemtype=java.lang.object, mimetype='*/*'}". (org.mule.api.transformer.transformerexception) org.mule.registry.muleregistryhelper:268 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/transformer/transformerexception.html) -------------------------------------------------...

c# - OleDB update command not changing data -

i'm using microsoft access file database. have no problem select , insert queries when try update , record in database not change. below code use run update. there no exceptions or errors in debug log. cnn = new oledbconnection(connetionstring); oledbcommand command = new oledbcommand("update [wpisy] set [wpis]=@wpis, [id_kat]=@id_kat, [tytul]=@tytul [id]=@id_wpis" , cnn); command.parameters.add(new oledbparameter("@wpis", tresc_wpisu.text)); command.parameters.add(new oledbparameter("@id_kat", lista_kategorii.selectedvalue)); command.parameters.add(new oledbparameter("@tytul", tytul_wpisu.text)); command.parameters.add(new oledbparameter("@id_wpis", request["id"].tostring() )); command.connection = cnn; try { if(cnn.state.tostring() != "open") cnn.open(); command.executenonquery(); cnn.close(); } catch (oledbexception ex) ...

javascript - My sounds are not playing in Chrome -

i have small, basic 3d game runs in browsers. issue when runs in chrome can see in console messages sounds "pending" , don't play when should. thing after time have passed sounds play @ same time. doesn't seem happening anywhere else, in chrome. came across article posted did not solve issue. in case running version 43.0.2357.81 m of chrome , using sound manager 2 library (i needed in order have sound work ie 9 , up). can offer suggestions or point me more articles might point me solution? many in advance! turn on logging in chrome (inspect element/console - preserve log) , see code doing. also, try enabling/disabling audio flags sure set them default when done. chrome://flags/#disable-encrypted-media chrome://flags/#disable-prefixed-encrypted-media/ chrome://flags/#try-supported-channel-layouts chrome://flags/#enable-delay-agnostic-aec chrome://flags/#disable-delay-agnostic-aec chrome://flags/#enable-tab-audio-muting in chrome , see if makes di...

plugins - How to find out what type a rustc::middle::ty::Ty represents? -

for writing yet lint in rust, need make sure type of expr option<_> (or pointer one). have walked ptr s , rptr s conclusion , left rustc::middle::ty in test case debugs (manually formatted better readability): tys { sty: ty_enum( defid { krate: 2, node: 117199 }, substs { types: vecperparamspace { typespace: [ tys { sty: ty_int(i32), flags: 0, region_depth: 0 } ], selfspace: [], fnspace: [], }, regions: nonerasedregions( vecperparamspace { typespace: [], selfspace: [], fnspace: [], } ) } ), flags: 0, region_depth: 0 } however, i'm bit lost – how find out if tys option<_> type? you need use with_path on defid. provided iterator on pathelem s must consume. the following rough sketch, should give array of name s if tweak bit. if let ty_enum...

olingo - OData Filter for child and return parent -

i developing search function powered odata service. return 1 or list of header objects results. many fields need search on not in header object. in child objects(navigational properties). right approach able execute odata search against child field , still return parent object list. this similar expect able in standard sql 'exists' query. i using java - apache olingo project believe general odata question. yes possible, include child path in $filter e.g. have header aircraft , child airline /aircraft list aircraft airlines aircraft?$filter=airline/code eq 'ba' list aircraft ba only for 2nd query, return child , filter on parent... not sure returning child - can if resolve single parent key, e.g. aircraft(123)/airline - find aircraft key 123 , return airline child navigation property info to filter , include multiple headers, think option use $expand include child info header info. e.g. aircraft?$filter=bodytype eq 'nb'&$expand=air...

how to properly use ILRepack.exe in bash? -

here try in bash (want create dll called program2, merge program.dll , nunit.framework.dll) ./ilrepack.exe /out:program2.dll program.dll nunit.framework.dll and here error (and if i'm not wrong, have binary file) ilrepack.exe: cannot execute binary file: exec format error or maybe arguments wrong? if you're on linux, may able register wine or mono interpreter such foreign binaries. you'll need have binfmt_misc kernel module; easy way configure install package such wine-binfmt . on debian, mono-runtime-common recommends binfmt_misc , guess knows how configure module.

javascript - Fancytree: Configure my own keyboard navigation -

i know if there way expand on navigation fancytree offers, instance, force delete , cut , copy or paste methods contextmenu occur when press delete , ctrl+x , ctrl+c or ctrl+v on keyboard. i've been studying , using fancytree few weeks , haven't found functionality. the example browser has demo this: http://wwwendt.de/tech/fancytree/demo/#sample-multi-ext.html

java - Reading from excel file with blank cells to 2d array -

i have following code reads logins , passwords xls file starting second row(it skips column names) , writes 2d array. works if sheet doesn't have blank cells in of rows. should make work empty cells? private static object[][] getusersfromxls(string sheetname) { final file excelfile = new file("src//resources//testdata.xls"); fileinputstream fileinputstream; try { fileinputstream = new fileinputstream(excelfile); workbook = new hssfworkbook(fileinputstream); } catch (ioexception e) { e.printstacktrace(); } sheet = workbook.getsheet(sheetname); final int numberofrows = sheet.getlastrownum(); final int numberofcolumns = sheet.getrow(0).getlastcellnum(); final string[][] xlsdata = new string[numberofrows][numberofcolumns]; string cellvalue; (int = 1; <= numberofrows; i++) { final hssfrow row = sheet.getro...

java - Erratic StampedLock.unlock(long) behaviour? -

i'm facing strange behaviour stampedlock . here main problematic lines of code : stampedlock lock = new stampedlock(); long stamp1 = lock.readlock(); system.out.printf("read lock count: %d%n", lock.getreadlockcount()); lock.unlock(stamp1 + 2); system.out.printf("read lock count: %d%n", lock.getreadlockcount()); the strange behaviour how unlock "tolerates" wrong read stamp. seem correct you? for reference here full code: public class stampedlockexample { static stampedlock lock = new stampedlock(); static void println(string message, object... args) { system.out.printf(message, args); system.out.println(); } static void printreadlockcount() { println("lock count=%d", lock.getreadlockcount()); } static long tryreadlock() { long stamp = lock.tryreadlock(); println("gets read lock (%d)", stamp); printreadlockcount(); return stamp; } static long trywritelock() { long stamp...

R language: how to work with dynamically sized vector? -

i'm learning r programming, , trying understand best approach work vector when don't know final size end being. example, in case need build vector inside for loop, iterations, aren't know beforehand. method 1 i run through loop first time determine final vector length, initialize vector correct length, run through loop second time populate vector. ideal memory usage standpoint, since vector memory occupy required amount of memory. method 2 or, use 1 for loop, , append vector needed, inefficient memory allocation standpoint since new block may need assigned each time new element appended vector. if you're working big data, problem. method 3 in c or matlab, initialize vector length largest possible length know final vector occupy, populate subset of elements in for loop. when loop completes, i'll re-size vector length appropriately. since r used lot in data science, thought topic others have encountered , there may best practice recommended. thou...

c - Can I use free() formally in VS2013? -

#define _crt_secure_no_warnings #include <stdio.h> #include <stdlib.h> #include <string.h> #define tsize 45 struct film{ char title[tsize]; int rating; struct film *next; }; int main(void) { struct film *head = null; struct film *prev, *current; char input[tsize]; puts("enter first movie title:"); while (gets(input) != null && input[0] != '\0') { current = (struct film*)malloc(sizeof(struct film)); if (head == null) head = current; else prev->next = current; current->next = null; strcpy(current->title, input); puts("enter rating (0 - 10):"); scanf("%d", &current->rating); while (getchar() != '\n') continue; puts("enter next movie title(empty line stop):"); prev = current; } if (head == null) printf("no data ente...

c++ - OpenCV Dense feature detector -

i using opencv dense feature extraction. example, code densefeaturedetector detector(12.f, 1, 0.1f, 10); i don't understand parameters in above constructor. mean ? reading opencv documentation not either. in documentation arguments are: densefeaturedetector( float initfeaturescale=1.f, int featurescalelevels=1, float featurescalemul=0.1f, int initxystep=6, int initimgbound=0, bool varyxystepwithscale=true, bool varyimgboundwithscale=false ); what supposed ? i.e. meaning of scale, initfeaturescale, featurescalelevels etc ? how know grid or grid spacing etc dense sampling. i'm using opencv dense detector , think can something. i'm not sure i'm going experience learnt me that. when use dense detector pass there gray scale image. detector makes threshold filters opencv uses gray minimum value used transform image. píxels have more gray level thresh...

javascript - "Not a robot" recaptcha without a <form> but AJAX instead -

the traditional way of using "i not robot" recpatcha seems <form> on client-side: <form action="post.php" method="post"> <div class="g-recaptcha" data-sitekey="6lc_0f4saaaaaf9za_d7dxi9qrbpmmnw-tlsvhe6"></div> <button type="submit">sign in</button> </form> <script src='https://www.google.com/recaptcha/api.js'></script> then g-recaptcha-response sent server. however, in code don't use <form> ajax call instead: $('#btn-post').click(function(e) { $.ajax({ type: "post", url: "post.php", data: { action: 'post', text: $("#text").val(), ajaxmode: "true" }, success: function(data) { }, error: function(data) { } }); } }); **how g-recaptcha-response answer solution? you use form, interrupt submissions of form. set form per nor...

bash - using shell in awk snippet -

i have problem shell , awk while using them nested. have shell script code prints processes file want read them awk , when find process special condition (for ex: process' start hour 10:00) want copy file. couldn't make it. here code: #!/bin/sh processes=` ps aux > processes.txt ` awk 'begin {fs = " ";} { if (some statement) { temp = $0 // want copy line file " temp >> anotherfile.txt " // here want use "temp" shell veriable couldn't } } end {}' processes.txt can show me hint maybe can figure out something. thanks. ps aux | awk '$9=="10:00"' >>anotherfile.txt

c# - Nhibernate exception: base {NHibernate.HibernateException} = {"illegal access to loading collection"} -

Image
i working on nhibernate exception :"base {nhibernate.hibernateexception} = {"illegal access loading collection"}" table patref parent table. table patcon sub table. when retrieve data patref patcons @ debuging mode, error message screen shot below. the nhibernate data mapping screenshots below. parent table patref: sub table patcon: the implement patrefmanagerprop.getbyid anytime i've seen has been caused attempt access lazily loaded collection when isession used retrieve object has been disposed or no longer exists. you can fix attaching entity session using isession.lock(entity, lockmode.none) . just note of warning - can't attach transient entity session. (great detail in original question way. +1 that)

How to use ActionMode with "setOnItemClickListener" method in ListView-Android? -

i have listview in project there actionmode shown clicking on each listview's item. i this: public class myactivity extends activity { ... public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); ... listview.setonitemclicklistener(new adapterview.onitemclicklistener() { @override public void onitemclick(adapterview<?> adapterview, view view, int i, long l) { public boolean oncreateactionmode(final actionmode mode, menu menu) { mode.settitle("title"); getmenuinflater().inflate(r.menu.menu, menu); return true; } @override public boolean onprepareactionmode(actionmode mode, menu menu) { return true; } @override public boolean onactionitemclicked(final actionmode mode, menuitem item) { switch (item.getitemid()) {...

arraylist - Android WifiManager: How to store wifi scan results for multiple scans -

i need multiple scans using wifimanager. have following code scan once , store results in access_points, can suggest efficient code store results of multiple scans? wifi = (wifimanager) this.getsystemservice(wifi_service); list<scanresult> access_points = wifi.getscanresults(); this wrong way results. if list<scanresult> access_points = wifi.getscanresults(); it return old results you. to wifi scan results instance of wifimanager in first line , then wifimanager wifimanager = (wifimanager) context.getsystemservice(context.wifi_service); wifimanager.getscanresults(); // above async call , results available system broadcast scan_results_available intent , need set `broadcastreceiver` it. // , when catch intent, results using list<scanresult> results = wifimanager.getscanresults(); to results multiple times or multiple scans need call wifimanager.startscan() multiple times , obtain fresh results using list<scanresult> results = wifimanag...

VBA in Excel to search for string over multiple tabs and return locations -

i have formed code searching problem trying find multiple results. return first location of string on each tab moves on. when implement while loop commented out appears find first result , escape loop. i'm not sure if there quirk vba loops missing or while check not quite right have tried debug breaking down , using message boxes no avail besides narrowing believe issue in while loop code. public function getsearcharray(strsearch string) string dim strresults string dim sht worksheet dim rfnd range dim sfirstaddress range each sht in thisworkbook.worksheets 'msgbox "looping on worksheets" set rfnd = nothing sht.usedrange 'msgbox "searching for" & strsearch set rfnd = .cells.find(what:="*" & strsearch & "*", lookin:=xlvalues, lookat:=xlpart, searchorder:=xlrows, searchdirection:=xlnext, matchcase:=false) if not rfnd nothing 'save first result can exit loop ...

ios - Update AWSS3 with Cocoapods -

in project have 2 frameworks: awsruntime & awss3 , use upload images. - (void)updateawscredentials:(nsdictionary *)awsobject { if(awsobject && [awsobject iskindofclass:[nsdictionary class]]) { self.key = awsobject[@"accesskeyid"]; self.secret = awsobject[@"secretaccesskey"]; self.token = awsobject[@"sessiontoken"]; self.profileimagepath = awsobject[@"fileprefixprofile"]; self.postimagepath = awsobject[@"fileprefixpost"]; self.bucket = awsobject[@"bucketname"]; } } - (nsstring *)uploadimageobject:(haamazonimagecontainer *)imageobject { nsdata *imagedata = uiimagejpegrepresentation(imageobject.image, 1.0); nsstring *imagekey = [nsstring stringwithformat:@"%@_%f", imageobject.userid, [[nsdate date] timeintervalsince1970]]; imagekey = [imagekey stringbyreplacingoccurrencesofstring:@"." withstring:@"0"]; nsstri...

python - ImportError: No module named MySQLdb even when Mysqldb is installed -

so have mysql installed on linux. after installed mysqldb using command sudo apt-get install python-mysqldb. when try import in python error "importerror: no module named mysqldb". rebooted , all. running python 2.7. there else need before getting work? suggestion? in advance !! >>> import mysqldb traceback (most recent call last): file "<stdin>", line 1, in <module> importerror: no module named mysqldb the output of pip freeze is cython==0.21 datashape==0.3.0 flask==0.10.1 jinja2==2.7.3 markupsafe==0.23 pil==1.1.7 pyyaml==3.11 pygments==1.6 sqlalchemy==0.9.7 sphinx==1.2.3 theano==0.6.0 werkzeug==0.9.6 xlsxwriter==0.5.7 abstract-rendering==0.5.1 argcomplete==0.8.1 astropy==0.4.2 atom==0.3.9 backports.ssl-match-hostname==3.4.0.2 beautifulsoup4==4.3.2 binstar==0.7.1 bitarray==0.8.1 blaze==0.6.3 blz==0.6.2 bokeh==0.6.1 boto==2.32.1 casuarius==1.1 cdecimal==2.3 cffi==0.8.6 chaco==4.4.1 colorama==0.3.1 conda==3.7.0 conda-build==1.8.2 config...

java - Create hot observable -

i taking first steps rx. have read bits thought getting hands dirty better way go. started transforming 1 existing codes rx type of code. the goal: trying mock source sends out data specific frequency (say 60/s, video camera or whatever). have footage recorded simulate source while source not available. , need source start sending if no 1 listening because thats real source do. before rx, went , made runnable iterates on 15.000 data items, sends item rabbitmq server , sleeps 1/60s , sends next one. now want turn logic hot observable, playing around. far have this: observable.from(mdataitems) .takewhile(item -> mrunning) .map(mgson::tojson) .doonnext(json -> { try { mchannel.basicpublish(exchange_name, "", null, json.getbytes()); } catch (ioexception e) { logger.error(e, string.format("could not publish %s exchange"...

How do I specify an iOS simulator in Qt Creator? -

in qt creator, when click run button in bottom left corner build , run program in ios simulator, using iphone simulator, want use ipad simulator instead. in xcode, can specify ios simulator run via product...destination. how done qt creator? in qt creator, click "projects" (on left). click "build & run" tab (if not selected). under tab simulator kit, click "run" (assuming added simulator kit). then, under "run" settings, choose "device type" drop down.

java - Is there a risk from sharing Application server (tomcat) between more that web applications -

i want use more 1 copy of similar application in shared tomcat , want increase memory size, there risk of action ?? how can increase performance? session switching, security, integrity, performance issue, threads risk, deadlocks actually there performance impact. in case don't share 1 thread pool between different applications (you can in tomcat) shouldn't receive thread/deadlocks risks. but under performance impact — mean in comparing launching applications on different servers. there no significant performance difference between launching few applications on single tomcat or launching few tomcat sing applications on board. but: there @ least few limitation: you can't use different versions of shared libraries. if looks on ./lib folder in tomcat — there libraries jsp-api, servlet-api, jasper. if applications limited use different specific versions — can issue (it can solved also, addition limitation). to reload/update 1 application in cases need rel...

java - Forward inside tomcat webapp: sessions are not expired -

i have webservice quite simple forward webapp located on same tomcat container. private response forward( @context servletcontext context, @context httpservletrequest request, @context httpservletresponse response){ servletcontext ctx = context.getcontext("/myothewebapp"); requestdispatcher dispatcher=ctx.getrequestdispatcher("/test"); dispatcher.forward(request, response); return response.ok("").build(); } this works desired except fact, sessions of webapp not being expired. in tomcat manager can see, opened sessions accumulated quite fast, several hundreds of them. i not sure why last when response sent. ideas missing in forward-method? why last when response sent. why think session invalidated after response sent. it invalidated if session timeout occurs or forcefully invalidate session using : session#invalidate() method

php - Make Array of Objects from json_encode -

i have object stdclass object ( [reportdate] => 2014-02-02 [shops] => array ( [24] => stdclass object ( [shopid] => 24 [cashiers] => array ( [1] => stdclass object ( [cashierid] => 1 [products] => array ( [moneyin] => 46 [moneyout] => 215.14 ) ) ) ) ) ) and when make json_encode on json string { "reportdate":"2014-02-02", "shops":{ "24":{ "shopid":24, "cashiers":{ "1":{ "cashierid":1, "products":{ "moneyin":"46", "moneyout":"215.14" } } } } } } this result not wanted. want array of objects. so instead of " shops":{ want "shops"...

vb.net - What are some good options for providing help on a form with minimal controls? -

i have few textboxes require user input, , want add user can revert in case forgot proper syntax required input. for example, if in textbox1 input must "bsample" or "bsample2" want show user (i.e., bsample) may see proper syntax required. i know can add button , show messagebox, seems simple, tooltip, i'm not sure if user might hover long enough see example. tips? did quick test on code tooltip method, , works me: 'in form's general declarations: dim tt new tooltip private sub textbox_enter(sender object, e eventargs) handles textbox1.enter, textbox2.enter 'list out text boxes here dim txtbx textbox = sender, disptext string select case txtbx.name case textbox1.name disptext = "how use text box 1" case textbox2.name disptext = "how use text box 2" 'flesh out text each text box end select tt.show(disptext, txtbx) end sub private sub textbox_lea...

ios - UIImagePickerController front camera show mirror image on preview view -

i know many people had asked question, not found correct answer fix issue,my problem : how can make photo on preview view(after user tap capture button,and go preview view let user preview) not mirror, can prossible fix in uiimagepickercontroller , know how rotate photo , in enum in uiimageorientation uiimageorientationup , know mean. try 1: i attend photo after user tap capture button before go preview view , use photo have mirror cover default photo (use cameraoverlayview ), can detect user tap capture button use nsnotificationcenter @"_uiimagepickercontrolleruserdidcaptureitem" , find no way photo. try 2: i use cameraviewtransform , when user take photo (front camera) when home button on bottom or top, image on preview view not mirror, when home button on left or right, image on phone have problem before user tap capture , although image on preview view not mirror.use avcapturedevicedidstartrunningnotification notification. - (void)camerachanged:(nsn...

javascript - implement Nodejs app in already existing website -

Image
i want place chatroom i've crated in node.js existing website. node.js has been installed lamp server , i've tried app uploading root directory , testing works accessing typing address site followed port :3000 inside vpns www/html directory have folder called chat want become chat website. in here have file called index.php serves me login , register page , when logged in redirected home.php , location want nodejs chat placed. my page looks this: the whitespace can see under blue bar place want chat appear. so first of question how node.js application run in target area , question how make node application visible in specific area. to make things simple i've reduced code socket.io example chat code. var app = require('express')(); var http = require('http').server(app); var io = require('socket.io')(http); app.get('/', function(req, res){ res.sendfile(__dirname + '/chat.html'); //behlver itne senda...

ios - Tuple containing an array (and assigned as variable) not working? -

i trying create array of tuples in swift each tuple contains (1)letter , (2)array of custom objects, when try append throws error 'int' not convertible 't'. here simplified code: var tuples : [(letter : character , objects : [myobject])] = [] //this works tuples.append(letter:"test".firstchar(), objects: [myobject(), myobject()]) //gives error => 'int' not convertable 't' on append function var arrayofobjects : [myobject] = [] tuples.append(letter:"test".firstchar(), objects: arrayofobjects) this should work: let arrayofobjects : [myobject] = [] tuples.append(letter:"t", objects: arrayofobjects) as can see, arrayofobjects constant. problem here might stem fact append expects constant parameter t , while passing tuple containing var . imho makes append goes little crazy, , compiler gives crazier error description ;-)

junit - IllegalAccessException: Class BlockJUnit4ClassRunner can not access a member of class Abc with modifiers "private" -

Image
downloaded junit-4.12.jar , hamcrest-core-1.3.jar (both latest time being), when try run unit tests, exception private (or protected) fields attribute parameter . when change fields public, fine. any comments? sorry mistake, parameterized test documentation defines fields public.

c++ - Why can templates only be implemented in the header file? -

quote the c++ standard library: tutorial , handbook : the portable way of using templates @ moment implement them in header files using inline functions. why this? (clarification: header files not only portable solution. convenient portable solution.) it not necessary put implementation in header file, see alternative solution @ end of answer. anyway, reason code failing that, when instantiating template, compiler creates new class given template argument. example: template<typename t> struct foo { t bar; void dosomething(t param) {/* stuff using t */} }; // somewhere in .cpp foo<int> f; when reading line, compiler create new class (let's call fooint ), equivalent following: struct fooint { int bar; void dosomething(int param) {/* stuff using int */} } consequently, compiler needs have access implementation of methods, instantiate them template argument (in case int ). if these implementations not in header, wouldn...

reactjs - How to handle child component from parent -

i looking useful information how handle parent component child , found piece of code, understand in code except 1 moment. here code var app = react.createclass({ getinitialstate:function() { return { items: [1,2,3,4,5,6,7,8] } }, handleclick:function() { var newitem = this.refs.textref.getdomnode().value; var newitems = this.state.items.concat([newitem]); this.setstate({ items: newitems }); this.refs.textref.getdomnode().value = ""; }, deleteitem:function(item) { var index = this.state.items.indexof(item); var newitems = undefined; if (index > -1) { this.state.items.splice(index, 1); newitems = this.state.items; this.setstate({ items: newitems }) }; }, render:function() { var item = this.state.items.map(function(item,i) { return <subitem key={i} sometext={item} ondelete={this.deleteitem}/> }.bind(this)); // dont understand return (<div...

What does this mean? Android Studio logcat: "Couldn't load memtrack module" -

in android studio, after clicking "run", while loading either device or of various android emulator devices, logcat indicates following errors: e/memtrack﹕ couldn't load memtrack module (no such file or directory) e/android.os.debug﹕ failed load memtrack module: -2 the app contain mp3 in /java/res/raw directory not sure if file fails load. app functionality , widgets seem work normally. app seems play mp3 when fired via broadcastreceiver / audiomanager / notificationcompat.builder. any ideas on correcting logcat error? or there need to?

c# - How i will get aspx as popover using jquery -

window.open('proofofinsurance.aspx?clubid=' + clubid, '', 'width=600,height=430,left=230,top=100'); return false; i got popover window using above code have use jquery function? showpopup('mailquote.aspx', 'quote link', 90, 90, 'appno=' + getparameterbyname("id") + '&mode=' + p_mode + '&program=' + getparameterbyname("program")); show popup function defined as: function showpopup(p_url, p_header, p_alertwidth, p_alertheight, p_querystring) { var width = ($(window).width() * p_alertwidth) / 100; var height = ($(window).height() * p_alertheight) / 100; //for smaller screens width , height full screen size if ($(window).width() < 500) { width = $(window).width(); height = $(window).height(); } //background-image: url('../_gfx/popupgrd.jpg') //$("<style>.ui-widget-header { background-color: #5f9dd8 };b...

php - Laravel 4.2: Convert a SQL select statement to Eloquent statement -

i have following db::select statement: db::select("select user_id, count(*) orders_count order_book ob session_id='".$session_id."' group user_id"); which result like: [{ "user_id": 2, "orders_count": 6 }, { "user_id": 340, "orders_count": 83 }, { "user_id": 341, "orders_count": 88 }] what equivalent statement using eloquent model? this have far: order::wheresession_id($session_id)->select('user_id','count(*)')->groupby('user‌​_id')->get(); you can use this: order::select('user_id', db::raw('count(*) orders_count')) ->where('session_id', $session_id) ->groupby('user‌​_id') ->get(); you need use db::raw when using count in query's select, because otherwise quoted pdo.

php - CodeIgniter session issue after sign out browser back button landed to the secured page -

i using codeigniter 2.1.4 in application. if in page require authentication. logout after logout if use browser button me secured page. can view page. if refresh or click on link redirect me login page. i think it's cache issue? not sure. include these headers in constructor function of controller prevent caching of previous page if want code igniter's way of doing it include below code $this->output->set_header('last-modified:'.gmdate('d, d m y h:i:s').'gmt'); $this->output->set_header('cache-control: no-store, no-cache, must-revalidate'); $this->output->set_header('cache-control: post-check=0, pre-check=0',false); $this->output->set_header('pragma: no-cache'); php's way of doing it use below lines of code header("cache-control: no-store, no-cache, must-revalidate"); header("cache-control: post-check=0, pre-check=0", false); header("pragma: no-cache...

javascript - Jquery and Swfupload causing whole website to slow down drastically -

i have been working on website while , encountered problem can't seem figure out. relatively new web developer appreciated. i using swfupload handle audio uploads website. aware swfupload has power handle multiple file uploads @ once through queue. however, when queue long list of audio files, uploading begin slow , slower each file...the php code used handle uploading given below. though code references lot of other helper functions, best explain trying do... essentially fluff aside such user authorization checks..etc, code creates temporary "track" stored in database. tracks stored under album(i refer albums releases) , once temporary track created under album, can upload audio file under database entry. use getid3 parse media file , update track information in database whatever can pull audio. this code works fine if select on (queue up) 15ish tracks upload, tracks after 15th 1 becomes slow , 50th track...uploading take on 10 minutes 1 file. know there can lo...