Posts

Showing posts from February, 2011

doctrine2 - symfony batch only first flush is working -

in code below. first flush() working. subsequent flushes being reached , called, having no effect. if remove flush() , clear() loop, records updated (but need limit search prevent memory issues). $processedentries = 0; $advertquery = $entitymanager->createquery( "select mybundle:advert left join mybundle:history prh prh.id null" ); $advertquery->setfirstresult(0); $advertresults = $advertquery->getresult(); foreach ($advertresults $advertentity) { $advertentity->settimemodified(new \datetime()); try { $processedentries++; if (($processedentries % self::commit_batch_size) === 0) { $entitymanager->flush(); // executes updates. $entitymanager->clear(); // detaches objects doctrine! } } catch(\exception $ex) { $this->getcontainer()->get('doctrine')->resetentitymanager(); echo $ex->getmessage(); } } $entitymanager->flush()

c++ - Control the position of the icon in a QLineEdit -

i've subclassed qstyle control aspect of app. after customizing aspect of qlineedits , need add icon inside qlineedit , has clickable user. i've seen can use method qlineedit::addaction add action , icon in qlineedit . problem arises position in draws icon because have customized qlineedit , icon draws near edge of qlineedit . need separate more icon qlineedit edge. know how control position of icon in qlineedit ?

python - Parse Beautifulsoup output to csv file for download -

this question has answer here: create , download csv file flask view 1 answer i've gone through questions on site , googled struggling take beautifulsoup output (which appear lists) , return in csv format user of flask app can download in browser. here's code: html = col_result.__html__() bs = beautifulsoup(html) table = bs.find(lambda tag: tag.name == 'table') headers = table.findall(lambda tag: tag.name == 'th') rows = table.findall(lambda tag: tag.name == 'tr') open('export_file.csv', 'w+', newline='') f: file = csv.writer(f) file.writerow(headers) file.writerows(rows) rfile = csv.reader(open('export_file.csv', newline='')) return response( rfile, mimetype="text/csv", headers={"content-disposition": "attachment; filename=export

php - automaticall updating the records every day -

i using code $q = mysql_query("select `time` `table`"); $row = mysql_fetch_assoc($q); $timediff = time() - $row['time']; if ($timediff >= 86400){ //run code } but getting error in second line can please me this. here go: $datetime = new datetime("+1 days"); $date = $datetime->format("y-m-d h:i:s"); $timediff = time() - $row['time']; if($timediff >= '$date) { //code here } edit: you can update code in your_file.php , run this: 0 0 1 * * php /var/www/vhosts/your_somain.com/httpdocs/scripts/your_file.php this run once month, on first day of month @ midnight (i.e. january 1st 12:00am, february 1st 12:00am etc.): for further explanation: reference: tutsplus.com hope you.

java - Convert List<Object> in Map<attributeA,List<attributeB> -

public class test { public void foo() { arraylist<person> persons = new arraylist<>(); persons.add(new person("marco", "bianchi")); persons.add(new person("marco", "rossi")); persons.add(new person("marco", "verdi")); persons.add(new person("giacomo", "bianchi")); persons.add(new person("giacomo", "rossi")); persons.add(new person("giacomo", "verdi")); map<string, list<string>> map = ?? } class person { string name; string surname; public string getname() { return name; } public string getsurname() { return surname; } i need have map<name, list<surname>> when name equal , surname in list. expected result: { marco=[bianchi, rossi, verdi], giacomo=[bianchi, rossi, verdi] } can me? i need lambda function solution. if using java 8 take @ stream api.

Download PDF file in android web view -

i using jspdf convert html pdf file. in websites works fine in android webview when clicking button reloads page. searched nothing works fine. i added below code in main activity: mwebview.setdownloadlistener(new downloadlistener() { public void ondownloadstart(string url, string useragent, string contentdisposition, string mimetype, long contentlength) { intent = new intent(intent.action_view); i.setdata(uri.parse(url)); startactivity(i); } }); new android. please me find it. in advance.

ios - How to upload a live photo to the server? -

how upload live photos server? using afnetworking upload of images, videos, , slow motion videos. upload of images , videos straightforward. upload of images , videos //physical location i.e. url video phvideorequestoptions *options = [phvideorequestoptions new]; options.networkaccessallowed = yes; [[phimagemanager defaultmanager] requestavassetforvideo:asset options:options resulthandler:^(avasset *asset, avaudiomix *audiomix, nsdictionary *info) { if ([asset iskindofclass:[avurlasset class]]) { nslog(@"%@",((avurlasset *)asset).url); } }]; //physical location i.e. url image [asset requestcontenteditinginputwithoptions:nil completionhandler:^(phcontenteditinginput *contenteditinginput, nsdictionary *info) { nsurl *imageurl = contenteditinginput.fullsizeimageurl; }]; these urls used upload of images , video files.

jquery - Flip Images on Radio Button Change -

i have radio list buttons have been replaced 2 image. when unchecked, imgfront visible, when checked, imgback visible. aim flip image using css transform reveal other imagine on check. how done? html: <div class="switch"> <input id="cmn-toggle-1" class="cmn-toggle cmn-toggle-yes-no" value="1" type="radio" name="category" /> <label id="label1" for="cmn-toggle-1"> <img id="imgfront1" src="~/content/img/categories/refuse.png" width="65" height="65"/> <img id="imgback1" src="~/content/img/categories/refuselabel.png" width="65" height="65" class="hidden"/> </label> </div> <div class="switch"> <input id="cmn-toggle-2" class="cmn-toggle cmn-toggle-yes-no" value="2" type="radio" name=&qu

c++ - std::make_pair <const char*,int > -

i have function called of 'main' method same arguments main called (int main (int argc, char* argv[])) std::pair<const char *, int> mtd1 (int argc, char * argv[]){ . . . } since argv[1] pointer string (assume atleast 1 program argument except argv[0]), not constant pointer, still possible (not error) pass argv[1] in return statement inside mtd1 return std::make_pair <argv[1],99999 > or need inside mtd1 method const char *abc = arg[1] before returning return std::make_pair (abc,99999 ) <- edited how doing safe way? std::pair<std::string, int> mtd1 (int argc, char * argv[]) { . . . } and return std::make_pair (std::string(argv[1]),99999); if insist on returning std::pair<char*,int> , should work: return std::make_pair (argv[1],99999);

c# - Reference correct dll file at realeas? -

i have reference 32 bit dll file in windows service application . i'm using any cpu during debug , @ point regular 32 bit version of dll file works fine. but, when built in 64 bits , installed on 64 windows service bad image when using method dll file . i have 64 bit version of dll file not work in debug mode. how make use 64 @ release , 32 in debug without manually remove , add reference? you can't. have compile 1 or other. if reference 32-bit dll, must set application target x86 both debugging , release. if want run in full 64-bit mode, need reference 64-bit dll , set application target x64 in debug mode , in release mode well.

python - How to insert strings and slashes in a path? -

i'm trying extract tar.gz files situated in diffent files named srm01, srm02 , srm03. file's name must in input (a string) run code. i'm trying : import tarfile import glob thirdbloc = 'srm01' #then, must 'srm02', or 'srm03' f in glob.glob('c://users//asediri//downloads/srm/'+thirdbloc+'/'+'*.tar.gz'): tar = tarfile.open(f) tar.extractall('c://users//asediri//downloads/srm/'+thirdbloc) i have error message: ioerror: crc check failed 0x182518 != 0x7a1780e1l i want first sure code find .tar.gz files. tried print paths after glob: thirdbloc = 'srm01' #then, must 'srm02', or 'srm03' f in glob.glob('c://users//asediri//downloads/srm/'+thirdbloc+'/'+'*.tar.gz'): print f that gives : c://users//asediri//downloads/srm/srm01\20160707000001-server.log.1.tar.gz c://users//asediri//downloads/srm/srm01\20160707003501-server.log.1.tar.gz the os.path.exi

Python webbrowser - Check if browser is available (nothing happens when opening webpage over an SSH connection) -

is there way detect whether there browser available on system on script run? nothing happens when running following code on server: try: webbrowser.open("file://" + os.path.realpath(path)) except webbrowser.error: print "something went wrong when opening webbrowser" it's weird there's no caught exception, , no open browser. i'm running script command line on ssh-connection, , i'm not proficient in server-related stuff, there may way of detecting missing. thanks! checkout documentation : webbrowser. get ([name]) return controller object browser type name. if name empty, return controller default browser appropriate caller’s environment. this works me: try: # not interested in return value webbrowser.get() webbrowser.open("file://" + os.path.realpath(path)) except exception e: print "webbrowser error: " % e output: webbrowser error: not locate runnable browser

android - Web API 2 cannot read byte[] sent via Retrofit 2 -

i'm trying upload objects form client sq-lite database mssql using retrofit 2 & web api 2. the app working without issue if assign null or new byte[1000] visit. image, whenever assigned value retrieved sq-lite database error response code 400 { "message": "the request invalid.", "modelstate": { "visit.image[0]": [ "an error has occurred." ], "visit.image[1]": [ "an error has occurred." ] } } here model in android: public class visit { public int visitid; public string dealermid; public byte[] image; // read image database (blob data type) } this code how retrieve values database , making visit object public visit getvisitbyvisitid(long visitid) { sqlitedatabase db = this.getreadabledatabase(); string selectquery = "select * " + table_visit + " " + key_id + " = " + visitid; cu

adb - can't mount android system partition as read/write -

i have android marshmallow running in emulator , executed following commands: adb root adb mount -o remount,rw /system adb push file /system/file and output adb: error: failed copy 'file' '/system/file': read-only file system the weird thing is, before remounting system partition mounted as /dev/block/vda /system ext4 ro,seclabel,relatime,data=ordered 0 0 and after remounting mounted as /dev/block/vda /system ext4 rw,seclabel,relatime,data=ordered 0 0 which seems read/writeable. after pushing /dev/block/vda /system ext4 ro,seclabel,relatime,data=ordered 0 0 again. weirder, system seems writable once: root@generic_x86:/system # mount | grep system /dev/block/vda /system ext4 rw,seclabel,relatime,data=ordered 0 0 root@generic_x86:/system # touch foo root@generic_x86:/system # touch foo2 touch: 'foo2': read-only file system root@generic_x86:/system # mount | grep sy

python - Combine list of numpy arrays and reshape -

i'm hoping me following. have 2 lists of arrays, should linked each-other. each list stands object. arr1 , arr2 attributes of object. example: import numpy np arr1 = [np.array([1, 2, 3]), np.array([1, 2]), np.array([2, 3])] arr2 = [np.array([20, 50, 30]), np.array([50, 50]), np.array([75, 25])] the arrays linked each other in 1 in arr1 , first array belongs 20 in arr2 first array. result i'm looking in example numpy array size 3,4. 'columns' stand 0, 1, 2, 3 (the numbers in arr1, plus 0) , rows filled corresponding values of arr2. when there no corresponding values cell should 0. example: array([[ 0, 20, 50, 30], [ 0, 50, 50, 0], [ 0, 0, 75, 25]]) how link these 2 list of arrays , reshape them in desired format shown in above example? many thanks! here's almost* vectorized approach - lens = np.array([len(i) in arr1]) n = len(arr1) row_idx = np.repeat(np.arange(n),lens) col_idx = np.concatenate(arr1) m = col_idx.max(

security - Secure API calls from partner website -

at company i'm working we're building system needs allow api calls users website. this have thought far: the user register website our system. the system generates token put in file on user server (or similar) in order verify website owned user. the user presses verify button make our system check token present @ predefined location. if token matches 1 saved in our database website verified , server informations such ip , domain name saved in database in order allow requests system api. what alternatives in order allow api calls user's website in easy way user? can done improve , secure flow? the workflow ended using following: the user registers website on our platform , ip address fetched , saved. the app generates website api user , verification code. from moment website allowed log in website api user using authorization code should copied , saved on client server. the client server, once logged in, receives jwt can used make additional req

.net - NullReferenceException When attempting to update XML C# -

this question has answer here: what nullreferenceexception, , how fix it? 32 answers i have windows form application contains list view updated user. when list view updated populates , creates xml items , stores in hidden text box until save request sent. when save request sent call function writes external config file updated denoted property. in total i'm updating 7 settings, 1 fails nullreferenceexception when try update list view , save xml //the values i'm passing in path config file, setting updating (in case requireddocuments), , string value update. public static void updateconfigfiles(string p_spath, string p_ssettingname, string p_svalue) { bool blnapplychanges = false; system.xml.xmldocument xmldoc = new system.xml.xmldocument(); xmldoc.load(p_spath); int icurrentnode = 0; (icurrentnode = 0; icurrentnode <= xmldoc.

web scraping - How to execute scrapy from php on Parallel? -

i have 90 urls in array [url1,url2,url3, ... , url90] i want have 3 spiders works @ same time , pass 1 url each one, so, first instance of scrapy gets url1, second 1 gets url2 , third 1 gets url3, , when first 1 finish job url4. i used gnu parallel if there software better use that. i tried 1 in php because should launch scrapy php exec (for url in urlstab | parallel -j 3 scrapy crawl myspider -a url {}) you want (untested): $parallel = popen("parallel -j 3 scrapy crawl myspider","w"); foreach($urlstab $url) { fwrite($parallel,$url+"\n"); } close $parallel;

java - Eclipse Gradle adding a classpath entry -

i'm adding classpath entry .classpath file in eclipse avoid having add manually each time run .eclipse task while add number of dependencies. need resources on path run locally. this works, eclipse.classpath.file { withxml { def node = it.asnode() node.appendnode('classpathentry', [kind: 'lib', path: '/some/path']) } } this doesn't, eclipse.classpath.file { whenmerged { classpath -> classpath.entries.add { entry -> kind: 'lib', path: '/some/path' } } } the error is, startup failed: build.gradle': 75: unexpected token: lib @ line 75, column 48. .entries.add { entry -> kind: 'lib', pat ^ for future reference, wrong second example?

c# - HttpModule vs DelegatingHandler - advantages/disadvantages? -

i'm trying log entire incoming requests , outgoing responses in asp.net webapi project. while i'm agreed delegatinghandler , employer insists on using httpmodule . how explain her, why should use delegatinghandler , not httpmodule ? or wrong? i use delegatinghandler . delegatinghandler part of web api pipeline , can run under host. httpmodule not part of web api , requires iis. though not directly related question, i'm going quote following msdn article highlights 2 including differences: http module option web apis running on iis. http modules allow security code execute part of iis pipeline. principal established http module available components, including iis components running later in pipeline. example, when principal established http module in response authenticaterequest event, username of principal gets logged correctly in cs-username field in iis logs. biggest drawback http modules lack of granularity. http modules run reques

vba - Trying as assign a SQL string to the record source property of Access report -

Image
i have form pictured below. 3 sort buttons, 1 preview report button. when sort buttons clicked, publicly declared variable called strsql updated. i have code @ top of form option compare database public strsql string option explicit strsql updated , used populate list area. one of buttons click events private sub cmdreturndate_click() strsql = strsql1 & strsql2 & me!cbodistricts.value & weekendsort me!teacherslist.rowsource = strsql me!teacherslist.requery end sub i trying use strsql recordsource report being called on preview report button. i have line of code in event open function report , can see correct sql in variable strsql private sub btnpreviewreport_click() msgbox (strsql) rem assign sql string reports data property. docmd.openreport "reportname", acviewpreview end sub i either need pass sql report or reference variable in reports recordsource property. attempt reference in report open event private sub

rxjs - Angular 2 - Inject authorization token before each Http request -

i need check token not expired before send every http request. i'm trying make injection using http interceptor this: class httpinterceptor extends http { constructor(backend: connectionbackend, defaultoptions: requestoptions, private _router: router) { super(backend, defaultoptions); } get(url: string, options?: requestoptionsargs): observable<response> { const keycloak$: observable = keycloakservice.updatetoken(); return keycloak$.map((options) => { return super.get(url, this.getrequestoptionargs(options)); }); // -> observable<observable<response>> } getrequestoptionargs(options?: requestoptionsargs) : requestoptionsargs { if (options == null) { options = new requestoptions(); } if (options.headers == null) { options.headers = new headers(); } options.headers.append('content-type', 'application/json'); return options; } } how can implement observable

fwrite - PHP - Trying to re-write a file and it's leaving blank spaces -

hello have issue when re-writting file: static function remove($plate){ $_parkedlist=parking::read(); $_remove = false; $_stillparkedlist = array(); foreach($_parkedlist $_car){ if($_car[0] == $plate){ $_firsttime = $_car[1]; $_now = date('y-m-d h:i:s'); $_timelapse = strtotime($_now) - strtotime($_firsttime); $_topay = $_timelapse * 10; echo "$_topay <br>"; $_remove = true; } else { $_stillparkedlist [] = $_car; } } if ($_remove == true){ $mifile = fopen('parked.txt',"w"); foreach($_stillparkedlist $_car){ if($_car[0]!=""){ $_line = $_car[0]."=>".$_car[1]."\n"; fwrite($mifile,$_line); } } fclose($mifile); } } the original file this: 234fsc=>

c# - Finding Microsoft.SqlServer.Management.Smo and ConnectionInfo References that are Compatible -

i'm trying use using microsoft.sqlserver.management.common using microsoft.sqlserver.management.smo and found .dll files on c: drive in usual place, c:\program files\microsoft sql server\ the problem apparently 2 aren't compatible. .smo comes \130\sdk\assemblies , .common comes referencing .connectioninfo.dll \110\sdk\assemblies so wonder since they're not in same \number\sdk\assemblies that's why aren't same version. when run application message visual studio "found conflicts between different versions of same dependent assembly not resolved. these reference conflicts listed in build log when log verbosity set detailed." and "assembly 'microsoft.sqlserver.smo, version=13.0.0.0, culture=neutral, publickeytoken=89845dcd8080cc91' uses 'microsoft.sqlserver.connectioninfo, version=13.0.0.0, culture=neutral, publickeytoken=89845dcd8080cc91' has higher version referenced assembly 'microsoft.sq

Tensorflow: Recurrent neural network training pairs & the effect on the loss function -

i looking @ code rnn language model. confused 1) how training pairs (x,y) constructed , subsequently 2) how loss computed. code borrows tensorflow rnn tutorial ( reader module ). within reader module, generator, ptb_iterator , defined. takes in data 1 sequence , yields x,y pairs in accordance batch size , number of steps wish 'unroll' rnn. best @ entire definition first part confused me this: for in range(epoch_size): x = data[:, i*num_steps:(i+1)*num_steps] y = data[:, i*num_steps+1:(i+1)*num_steps+1] yield (x, y) which documented as: *yields: pairs of batched data, each matrix of shape [batch_size, num_steps]. second element of tuple same data time-shifted right one.* so if understand correctly, data sequence [1 2 3 4 5 6] , num_steps = 2 stochastic gradient descent(i.e. batch_size=1) following pairs generated: x=[1,2] , y=[2,3] x=[3,4] , y=[5,6] 1) correct way this? should not done pairs are: x=[1,2] , y=[2,3] x=[2,3] , y=[3,4] ... #

javascript - Simple math but its not working? -

Image
this question has answer here: how force js math instead of putting 2 strings together 7 answers how add 2 strings if numbers? 15 answers i have table users can enter part number, part price , quantity. multiple's price , quantity total. got part , running. now have taxes on part , grand total im getting: function calculateit() { var mybox1 = $( 'input[name=tax2]:checked' ).val(); //taxes value var mybox2 = document.getelementbyid('partstotalvalue').value; //parts total value var result = document.getelementbyid('partstax'); // input field total of taxes * parts var myresult = mybox1 * mybox2; //result = taxes * parts total result.value = myresult; // display results var result2 = document.getelementbyid('partstotalwi

elasticsearch - Adding a condition to query -

i have query works grate. how ever need add 1 condition. want documents have field "marked" :"true" this query. { "from": 0, "size": 100, "min_score": 0.6, "query": { "bool": { "should": [ { "multi_match" : { "fields" : ["_all"], "query" : " test " , "fuzziness" : "1.5" , "prefix_length" : "2" } } ], "must": { "bool": { "must": [ { "terms": { "language.id":["1"] }}, { "term": { "forbidden":"false" }} ] }}} }, "sort": [{ "_score": { "order": "desc"}} ] } i have been trying ti ad

vba - submit button and email - excel -

i have button , macro set allows sheet save folder , close sheet. there way can add macro email out message outlook saying along lines of "machine checklist submitted" test123@outlook.com example. below code have works treat. sub saveworkbook() application.displayalerts = false dim sheet1 worksheet dim dname$, vname$, sname$ dname = range("b8") vname = activeworkbook.fullname sname = activeworkbook.activesheet.name each sheet1 in activeworkbook.sheets if not sheet1.name = sname sheet1.delete end if next sheet1 activeworkbook.saveas "\\filestore\it$\forms , templates\completed checklists\" & dname & "_" & environ("username") & "_" & format(now, "ddmmyy") activeworkbook.close application.displayalerts = true end sub thanks in advance sam add below code dim olapp object, olmail object set olapp = createobject("outlook.application"

javascript - How do I conditionally perform a second task using Promises? -

i'm using bookshelf.js, promise-based orm module, perform couple database lookups. given key user provides, need determine if key matches record in 1 of 2 tables. if find in first table, need return record. however, if don't find in first table, need in second table. basically, need conditionally execute then block. how accomplish using promises? here's have, messy, and, in fact, i'm little unclear happens if call resolve in first school lookup -- second then block execute well? exports.findtargetrecord = function(code){ return new promise(function(resolve, reject){ schools .query({ where: { code: code }}) .fetchone() .then(school => { if(school) return resolve(school); return organizations .query({ where: { code: code }}) .fetchone(); }) .then(org => { if(org) return resolve(org); resolve(null); })

objective c - Swift classes not found in iOS app when importing a mixed framework -

i have framework objective-c , swift mixed together. compiles alone when import in objective-c ios app, swift classes not found objective-c classes found. swift classes found inside framework when importing myframework-swift.h ios app , framework 2 different projects in same workspace. defines module , embedded content contains swift code set yes targets , swift classes public @objc i tried use @import myframework , #import <myframework/myframework-swift.h> no success. i don't see myframework-swift.h header file in framework's headers directory projects. not sure if normal. generated in deriveddata edit: managed reproduce problem simple workspace in xcode 8 (but same in 7.3): create new cocoa touch framework testframework in objective-c create a.h file @class b; @interface : nsobject -(void)print:(b*)caller; @end create a.m file #import <foundation/foundation.h> #import "testframework-swift.h" #import "a.h

java - Why do I get an incorrect value for MQIACF_OBJECT_TYPE in Authority Record query response? -

i have following code querying authority records mq. pcfmessageagent agent = new pcfmessageagent(queuemanager); agent.setcheckresponses(false); pcfmessage[] responses; pcfmessage request = new pcfmessage(mqconstants.mqcmd_inquire_auth_recs); request.addparameter(mqconstants.mqiacf_auth_options, mqconstants.mqauthopt_name_all_matching + mqconstants.mqauthopt_entity_explicit + mqconstants.mqauthopt_name_as_wildcard); request.addparameter(mqconstants.mqcacf_auth_profile_name, "*"); request.addparameter(mqconstants.mqiacf_object_type, mqconstants.mqot_all); responses = agent.send(request); when process response value of 1017 parameter mqiacf_object_type . documentation show following values mqiacf_object_type mqot_alias_q 1002 mqot_all 1001 mqot_auth_info 7 mqot_cf_struc 10 mqot_channel 6 mqot_clntconn_channel 1014 mqot_current_channel 1011 mqot_local_q 1004 mqot_model_q 1003 mqot_namelist 2 mqot_process 3 mqot_q 1 mqot_q_mgr 5 mqot_recei

java - How to get current SpringApplication instance in spring-boot programmatically? -

how current springapplication instance in spring-boot programmatically? spring docs says : springapplication has method called iswebenvironment() . don't know how tell if application web or non-web application programmtically , can applicationcontext.getenvironment() ? way , don't want solve searching xxservlet httpservletrequest ... etc. what applicationcontext instanceof webapplicationcontext ? if you're trying determine whether or not application running in web context, can use fact when spring application started in web context, applicationcontext object have access instance of webapplicationcontext interface. therefore can write iswebenvironment = (applicationcontext instanceof webapplicationcontext); there no real reason springapplication object class, sole purpose build applicationcontext .

Unable to attach pdf to email in php -

i've tried follow examples given in forum, example given freestate here - error php mail(): . below code copied revised example. emails fine. , attachment shown in email when received. cannot opened , 125k in size. i have verified file size returned "$file_size = filesize($file);". "fopen" open stream. in fact before added multipart header, see content in body of text (albeit not readable). i'm trying attach basic pdf file, on window's platform (windows 10), apache 2.4, php 5.6.16.0. what cause attachment fail attach properly? emailer('//servername/path/', 'documentname.pdf'); function emailer($path, $filename) { $eol = php_eol; $to = "xxxx@yyyyyyyy.com"; $subject = "file name: ".$filename; $body = "the written content of body"; $file = $path.$filename; $file_size = filesize($file); $handle = fopen($file, "r")

sequelize.js - Node.js, sequelize and Unknown column -

i read similar question: sequelize unknown column '*.createdat' in 'field list' but solution doesn't work me! why? code: var user = sequelize.define("user", { id: { type: datatypes.uuid, primarykey: true }, cognome: datatypes.string, nome: datatypes.string, email: datatypes.string, password: datatypes.text, stato: datatypes.integer, ruolo: datatypes.integer }, { freezetablename: true }, { timestamps: false }); the error is: executing (default): select `id`, `cognome`, `nome`, `email`, `data_nascita`, `password`, `cellulare`, `stato`, `blacklist`, `createdat`, `updatedat` `candidato` `candidato`; unhandled rejection sequelizedatabaseerror: er_bad_field_error: unknown column 'createdat' in 'field list' instead of passing { timestamps: false } additional param of sequelize.define call, should extend existing (third) 1 corresponding property: var user = sequel

apache camel - Dynamic HTTP URI with recipientList returns 404 on the second call -

i have 2 step camel route workflow - both steps make post call same host, url , body different. first call returns part of url second call. here code: // register converter different request types getcontext().gettypeconverterregistry().addtypeconverters(new requestconverter()); from("direct:two-step-flow") .setheader("paramid", body().method("getparamid") .setheader("url", "http://localhost:8080/api/${header.paramid} .convertbodyto(step1request.class) .to("direct:call-remote-service") .convertbodyto(step2request.class) // converter sets newparamfromresponse .setheader("url", "http://localhost:8080/api/${header.paramid}/${body.newparamfromresponse} .to("direct:call-remote-service") .end(); from("direct:call-remote-service") .marshal().json(jsonlibrary.jackson) .recipientlist(header("url")) .unmarshal().json(jsonlibrary.jackson, genericresponse.class) .end();

legacy - how to run old IE browser in android? -

i have run legacy web system in android, new browsers not compatible system, ie compatible system. please let me know how use old ie in android? maybe can run ie in windows emulator, https://sourceforge.net/projects/limbopcemulator/ this joke ... in first place don't think emulator enough make work. if would, winxp , old ie security hole plus android+emulator doesn't sound stable environment, overall either not work, or extremely vulnerable attack kid around. drop legacy web system, it's on (like 5+ years over).

java - Guice service dependencies -

i have 3 guava service s started guava servicemanager asynchronously. the first service database connection pool needs start before second/third service can process incoming messages. these being started asynchronously, database may not have started before second/third service starts process message, lead exceptions. what desired pattern here? i can inject database service other services , call awaitrunning() method in service startup, suffer same issue when servicemanager shutdown. i believe guice not have out-of-the-box mechanism this. spring e.g. has depends-on attribute can define ordering. there frameworks give guice (e.g. dropwizard guicey implements order annotation). simple solve. the approach use multibindings define manager dependency classes. call managed (adopted jetty). interface implement ordering. use manager starts services 1 one in defined order (can used shutdown if wanted). see code example here: public class executionorder { public s

java - More than one "one to many" association using Detached Criteria (XML Based Hibernate Configuration) -

i trying join 3 tables using detached criteria class of hibernate. i have 3 tables student,student_correspond,student_courses primary keys of tables **table names** **primary keys** student inqry_id student_correspond student_crsp_id student_courses course_cd select *from db01.student inner join db01.student_correspond on db01.student.inqry_id =db01.student_correspond.inqry_id inner join db01.student_courses on db01.student_courses.course_cd=db01.student.course_cd actual db results above query 250 in database. i want achieve above query using detached criteria. in studentdo.hbm.xml,i have added following code when ran application it's not displaying results.i.e the results count zero. studentdo.hbm.xml <set name="studentids" lazy="true" inverse="true" cascade="none" sort="unsorted" batch-size="10"> <key><column name="inqry

r - geom_dotplot dot layout with groups -

Image
the dotplot trying create shown below. dots have been laid out using couple of different options. require(data.table) require(ggplot2) set.seed(10000) n <- 300 dt <- data.table(duration=sample(100:800,n,replace=t), endtype=round(runif(n,min=.4)), group=sample(c("grpa","grpb"),n,replace=t)) dt <- rbind(dt, dt[, -c("group"), with=f][, group:="all"]) dt[, ":="(group=factor(group, levels=c("all","grpa","grpb"), ordered=t), endtype=factor(endtype, levels=c(0,1)))] #option 1 - creates space between dots filled , not filled g <- ggplot(dt, aes_string(x="group", y="duration")) + coord_flip() + geom_boxplot(aes(ymin=..lower.., ymax=..upper..), fatten=1.1, lwd=.1, outlier.shape=na) + geom_dotplot(aes(fill=endtype), binaxis="y", stackdir="center", stackgroups=t, method="histodot", binwidth=15, dotsize=.5) + scale_fill_manual(values=c(

Is it safe to remove android system images? -

i have android studo installed on ubuntu 14.04 machine , android system images use lot of space: 5771 ./android-23 4200 ./android-21 3146 ./android-22 13116 . do need of them or safe remove older ones? , if, how remove them (which menu/action use in android studio ?) yes can delete don't want use anymore delete system image before jelly bean (api 16) because same reason yours taking space keep use testing , running app android studio yes can delete via sdk or delete directly not make issue

oracle - Accessing XML using XQuery (within XQJ code) from a column in database table -

i have created following table in locally installed oracle database :- create table "system"."warehouses" ( "warehouse_id" number not null enable, "warehouse_spec" clob, constraint "warehouses_pk" primary key ("warehouse_id"); it 4 rows primary keys 1,2,3 , 4. now have written following java code access "warehouse_spec" column (which contains xml file every row) :- import oracle.xml.xquery.xqjdb.oxqddatasource; import javax.xml.xquery.xqitemtype; import javax.xml.xquery.xqresultsequence; import javax.xml.xquery.xqconnection; import javax.xml.xquery.xqpreparedexpression; import javax.xml.namespace.qname; public class accessdata { public static void main(string argv[]) { try { oxqddatasource oxqds = new oxqddatasource(); oxqds.setproperty("driver", "jdbc:oracle:thin"); oxqds.setproperty("dbusername"

python - Compute all ways to bin a series of integers into N bins, where each bin only contains contiguous numbers -

i want find possible ways map series of (contiguous) integers m = {0,1,2,...,m} series of integers n = {0,1,2,...,n} m > n, subject constraint contiguous integers in m map same integer in n. the following piece of python code comes close ( start corresponds first element in m, stop -1 corresponds last element in m, , nbins corresponds |n|): import itertools def find_bins(start, stop, nbins): if (nbins > 1): return list(list(itertools.product([range(start, ii)], find_bins(ii, stop, nbins-1))) ii in range(start+1, stop-nbins+2)) else: return [range(start, stop)] e.g in [20]: find_bins(start=0, stop=5, nbins=3) out[20]: [[([0], [([1], [2, 3, 4])]), ([0], [([1, 2], [3, 4])]), ([0], [([1, 2, 3], [4])])], [([0, 1], [([2], [3, 4])]), ([0, 1], [([2, 3], [4])])], [([0, 1, 2], [([3], [4])])]] however, can see output nested, , life of me, cant find way amend code without breaking it. the desired output this: in [20]: find_bins(start=0, stop=5,

java - How to make my own warnings appear in the Eclipse Problems view? -

Image
i developing cdt plug-in eclipse ide. want own warning appear in problems view. furthermore, warning message important , must seen user, problems view may not shown, show message box. how can add warning problems view , preferred way deal warnings must seen in eclipse ide? preferred way deal warnings must seen in eclipse ide? make them errors instead of warnings. then, when next state in workflow needs output of problematic code, when appropriate pop-up. when coding , making changes, normal have "temporary" errors/warning in code. pop-ups @ time inconvenient. when proceed launch code or similar want warned off. consider case of doing java launch. if there errors in code there pop-up this:

c++ - Scaling and moving 3d object with openGL -

i'm trying load 3d object .obj file, scale size to move coordinate (i prefer changing matrix scaling , moving each vector). .obj parsing function, know width, height, depth , center of object's bounding box. to make clear, have map of tiles (-1.0, 0, 1.0) (1.0, 0, -1.0) , modeling thing use obj file of cube (with length of 40.0). clearly, had scale cube before printing it. my problem keep failing on moving cube correctly on z axis. scaling done way: model.scale(xn * x_unit / model.getwidth(), yn * y_unit / model.getheight(), zn * z_unit / model.getdepth()); where xn, yn , zn amount of tiles cube stretch on in each axis , x_unit, y_unit , z_unit length of each tile in axis (this function works perfectly) in order move cube desired place calculated translation amount in each axis (assuming cube's center @ 0, 0, 0): x_trans = (((xn - (2.0f / x_unit)) / 2.0f) * model.getoriginalwidth()) / xn; y_trans = (0.5f * model.getoriginalheight()); z_trans = ((zn - (2.0f /