Posts

Showing posts from May, 2015

c# - How to "extend" query in Lightswitch? -

i need present data 2 tables in same view. when use calculated property performance penalty not acceptable. if have done using sql possible using join. know how using linq , entity framework. the problem lightswitch lets me execute queries results in list of existing entities. i'm creating desktop client. if correct relationships have been set up, possible data items multiple entities displayed concurrently solely using built in queries. question doesn't have enough detail know whether work here, it's best way go if can keep benefit of other automagical lightswitch features. if it's not possible using built in queries or want change shape of data , not return lightswitch entities, use wcf-ria service. sounds approach here leverage linq knowledge too. http://lightswitchhelpwebsite.com/blog/tabid/61/entryid/2226/creating-a-wcf-ria-service-for-visual-studio-2013.aspx covers how in vs2013. it's 1 of things sounds complicated @ first ok if follow

ios - Using Helvetica Neue in WatchKit not working, other custom fonts work -

Image
i wanting use helvetica neue ultra light in watchkit app. have followed of instructions adding custom font (added extension bundle , added in info.plist extension , watchkit app), nothing working , never used. really strange thing is, other ttf fonts have added work, seems strange issue helvetica. where helvetica, , why can't add it? edit: clear things , prevent people think might obvious answers. watchkit includes system font (san francisco), doesn't expose of fonts ios has. (ref: devforums.apple.com/message/1096179#1096179 ) why trying include helvetica. option 1 i had same issue. fixed including - character between font name , name of weight. in ways, xcode recognize font. try changing helveticaneueultralight.ttf helveticaneue-ultralight.ttf wherever possible (info.plist file , in project folder). option 2 open fontbook comes included within mac. install font if haven't , closely @ postscript name of font. if differs na

r - Matching a list of phrases to a corpus of documents and returning phrase frequency -

i have list of phrases , corpus of documents.there 100k+ phrases , 60k+ documents in corpus. phrases might/might not present in corpus. i'm looking forward find term frequency of each phrase present in corpus. an example dataset: phrases <- c("just starting", "several kilometers", "brief stroll", "gradually boost", "5 miles", "dark night", "cold morning") doc1 <- "if you're starting workout, begin slow." doc2 <- "don't jump in brain initial , try operate several kilometers without need of worked out before." doc3 <- "it possible end injuring on own , carrying out more damage good." doc4 <- "instead start brief stroll , gradually boost duration along speed." doc5 <- "before know you'll working 5 miles without problems." i new text analytics in r , have approached problem on lines of tyler rinker's solution r text mining:

Spring WebSocket UserDestinationMessageHandler sending message to unauthenticated user -

i using spring 4.1.6.release. an unauthenticated client subscribing " /user/topic/qqq ". this converted /topic/qqq-user{sessionid} the server sends message user, following: like: .convertandsend("/topic/qqq-user{sessionid}", "message"); and works expected. but, when server tries send message like: .convertandsendtouser({sessionid}, "/topic/qqq", "message"); but not work , , results: userdestinationmessagehandler: - no user destinations found /user/{sessionid}/topic/qqq the question is: is not task of userdestinationmessagehandler converting destination /user/{sessionid}/topic/qqq /topic/qqq-user{sessionid} ? if is, not working because client not authenticated? thank you. have tried just .convertandsendtouser({sessionid},"/qqq", "message"); then client subscribe as: client.subscribe("/user/{sessionid}/qqq", callback)

c++ - What default make tool does NetBeans use -

iv been writing small c program netbeans 8 on linux. uses configuration.xml file compile makefile together. i'v searched little there little information on tool supports file or if netbeans internal tool. how call command line etc. i hoping alternative build tool, far no scons, waf, ninja, cmake, qmake does have experience it? how looks like: <configurationdescriptor version="95"> <logicalfolder name="root" displayname="root" projectfiles="true" kind="root"> <logicalfolder name="headerfiles" ...> what default make tool netbeans use it uses make per default. default c/c++ project types generate makefiles you. can use custom makefiles instead - , other build tools (like cmake, qmake, ...). i'v searched little there little information on tool supports file or if netbeans internal tool. the configurations.xml netbeans internal only. btw. modify file only, if

javascript - Onsen UI pull hook throws error when used in tabbar -

i using pull hook component on page contains ons-list element. page 1 of 3 (also list pages) use tabbar component navigate between. use pull hook on 1 page. when switching pages (via tabbar component) error gets thrown: "error: undefined not function (evaluating 'element.off(:scroll",this._bindedonscroll)')_destroyeventlisteners@www/components/loader.js:1440:53691 _destroy@www/components/loader.js:1440:53771" can pull hook component used tabbar? the error happens when pull hook unloaded. it's issue in destructor. if make tab "persistent" won't experience issue since won't unload pull hook: <ons-tab persistent> the error has been fixed in latest beta version of onsen ui (1.3.0-beta). can install "bower install onsenui#1.3.0-beta" or can wait 1.3.0 release due in couple of days.

c# - Visual Studio's enumeration during debugging (Results View): "Entry point was not found.":"" -

Image
in cases, when trying expand results view of ienumerable in visual studio might cause error: entry point not found.":" . so decided test little, , found out happens when class has generic parameter (which call t ) , implements ienumerable[bar[t]] (something doesn't directly uses t ) or doesn't uses t @ all, ienumerable[string] (these may not cases). here's example class visual studio cannot expand results view properly: class foo<t> : ienumerable<list<t>> { readonly list<list<t>> l; public foo() { l = new list<list<t>>(); } public void add(list<t> l) { this.l.add(l); } public ienumerator<list<t>> getenumerator() { return l.getenumerator(); } ienumerator ienumerable.getenumerator() { return getenumerator(); } } and here's example class visual studio enumerates: class foo<t> : ienumerable<t> { rea

c - How do I print the binarys of a hex? -

for example 0x19 00011001 in binary. tried using printf %08x, gives me 00000019 output. how print 00011001 instead? for (i=0; i<32; i++) putchar((x&(1<<(31-i)))?'1':'0');

c++ - pthread_cleanup_pop error on Windows- make it compilable -

code: void clean(void *message) { cout<<"exiting "<<(char*)message<<endl; } void *func2(void* arg) { char *message = "func2"; pthread_cleanup_push(clean,(void*)message); int status; int count=0; pthread_setcancelstate(pthread_cancel_enable,&status); for(;;){ if(count%3467==0) { sleep(3); pthread_testcancel(); } else if(count%67==0) { cout<<"func 2 running"<<endl; } else {} count++; } pthread_cleanup_pop(0);//error pointing here } when try compile , getting error cancel.cpp:45:5: error: second operand conditional operator of type 'v oid', third operand neither throw-expression nor of type 'void' pthread_cleanup_pop(cleanup_pop_arg); i not able find what's problem code. c

java - QuickBlox get presence of user which isn't in the contacts -

i'm developing android chat application using quickblox.. app : user logs in , chooses user chat with.. (not in roster).. managed users using following code : retrieveallusersfrompage(1); private void retrieveallusersfrompage(int page){ qbpagedrequestbuilder pagedrequestbuilder = new qbpagedrequestbuilder(); pagedrequestbuilder.setpage(page); pagedrequestbuilder.setperpage(100); qbusers.getusers(pagedrequestbuilder, this); } int usernumber = 1; @override public void onsuccess(arraylist<qbuser> users, bundle params) { for(qbuser user : users){ this.users.add(user); usernumber ++; } int currentpage = params.getint(consts.curr_page); int totalentries = params.getint(consts.total_entries); if(usernumber < totalentries){ retrieveallusersfrompage(currentpage+1); } } but wanna filter them add available(online) users.. can't find way that.. idea ? with no roster can use next trick user.las

Permission directive in AngularJS -

let's want have directive checks permission. coud this: <a permissions="something.delete">delete</a> if "something.delete" in list of allowed permissions nothing rendered. having code: link: function (scope, element, attrs) { var permissionspromise = permissionservice.checkforpermissions(attrs.permissions); permissionspromise.then(function(result) { if (result=== false) { element.remove(); } }) } but because permissionservice.checkforpermissions() returns promise, may take time figure out permissions, meanwhile link function render a-element before knowing result of permission-check. what proper solution fix issue? reverse logic , hide element default , show based on promise value. something along lines of elem[0].style.display = 'none' -> elem[0].style.display = 'block' ask real goal, aren't implementing permissions checking on client-side (or shouldn't be). should m

Python Splinter Library ImportError: cannot import name Browser -

i'm trying use splinter library in python. when use from splinter import browser in code gives me: file "d:\users\user\desktop\splinter.py", line 1, in importerror: cannot import name browser i trying run file desktop. why looking on desktop splinter.py? there no splinter.py on desktop. fixed: there file named 'splinter.pyc' on desktop before file named correctly. deleting fixed problem.

c# - Close WPF User Control Popup in MVVM -

i showing user control dialog in wpf-mvvm application. here code. var productview = new product(); var productviewmodel = new productviewmodel(); productview.datacontext = productviewmodel; this.showdialogwindow("add product", productview); and showdialogwindow method this protected void showdialogwindow(string header, usercontrol control) { radwindow window = new radwindow(); window.owner = app.current.mainwindow; window.windowstartuplocation = system.windows.windowstartuplocation.centerowner; window.content = control; window.header = header; window.canclose = true; window.resizemode = resizemode.noresize; window.showdialog(); } now, have button "close" in dialogwindow user control. how can close window using button ? note: wpf user control not window. want close using mvvm only consider leveraging messaging parameters pass around data between objects. you

grails 3.0.0 I can not create an application -

i downloaded grails 3.0.0 (hoping see problems cas magically disappearing ;) ) installed under windows , then: d:\grailsprojects> grails -version | grails version: 3.0.0 | groovy version: 2.4.3 | jvm version: 1.7.0_51 and then: d:\intellijprojects>grails create-app helloworld | error command not found create-app did mean: create-script or create-taglib or create-unit-test? also clean , compile don't work what missing? ok trivial (and rather stupid). in "project directory" among other projects there directory called grails-app, leftover of porting. caused create-app fail. removed directory works fine.

python - Why is os.rename program not sorting directory -

i have program trying write take large directory (10,000+files inside) , create new sub directories break large directory smaller chunks (of approximately 100 files each).the program have raises no errors when call in terminal, not sort large file... think problem os.rename() dont understand why tried shutil.move() , still had same problem. sorry couldent make code appear in color new site #!/usr/bin/python import os import glob import sys functools import partial sys.setrecursionlimit(1000) def mk_osdict(a): #os.chdir(a) #grouping files .mol2 endings os_list =glob.glob("*.mol2") #making dictionary list of files in directory os_dict = dict([i,n] i,n in zip(range(len(os_list)),os_list)) return os_dict dict_os = mk_osdict("decoys") #function sort files new directories specific size. def init_path(f): block = (len(f)/100)+1 #i_lst gives list of number of entries i_lst = [str(i) in range(block)] '''paths

function - Error instantiating a class in Python -

i'm attempting instantiate class: class customer(object): def __init__(self, name, money, ownership): self.name = name self.money = money self.ownership = ownership def can_afford(self): x = false bike in bikes.values(): if self.money >= bike.money * margin: print "customer {} can afford {}".format(self.name, bike) x = true if not x: print "customer {} cannot afford bikes @ time.".format(self.name) shoppers = { # initial condition of shopper1 "jane": customer("jane", 200, false), # initial condition of shopper2 "alfred": customer("alfred", 500, false), # initial condition of shopper3 "taylor": customer("taylor", 1000, false) } buyer = customer(name, money, ownership) but buyer = customer(name, money, ownership) keeps getting errored: undefined

How would this C struct be translated into Cobol -

i'm pretty new cobol , i'm having difficulty figuring out how use structs. c structs below when converted cobol? these structs have: struct datat { int m; }; struct stack { int top; struct datat items[stacksize]; } st; how statement represented in cobol? st.items[st.top].m this stab in dark since i've never written line of cobol before today 1 . however, after little googling 2 , playing around in ideone , think i've @ least captured flavor of code like, if not actual solution: identification division. program-id. ideone. environment division. data division. working-storage section. 01 ws-stack. 05 ws-top pic 9 value 0. 05 ws-items occurs 10 times indexed i. 10 ws-m pic 9 value 0. procedure division. add 1 ws-top. move 9 ws-m(ws-top). add 1 ws-top. move 8 ws-m(ws-top). display "ws-stack :" ws-stack. display "ws-top :" ws-top. display "ws-items[ws-stack.ws-top]

PHP MVC Delete Function Controller -

i have made mvc site displaying databases records, each record printed on own line delete button beside it. having issues delete button. when click delete button trying sending controller handle. the issues having are i cant send row id button.php controller (have strong suspicion code wrong) the delet function in controller doesnt work, in code below have hard coded in row id want delete when click delete button following error syntax error in sql statement.you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'id=27' @ line 1 button.php <?php $result=$itemsdao->getitems(); foreach ($result $row) { $uid = $row['id']; ?> <form action="index.php" method="post"> <fieldset> <input id='action' type='hidden' name='action' value='deleteitem' /> <p> <div class="form-group"> <div class="controls">

How to deploy SharePoint 2013 Provider hosted app on Microsoft Azure and SharePoint 2013 On Premise? -

i need deploy sharepoint 2013 provider hosted app on microsoft azure , sharepoint 2013 on premise. same app works when deployed on microsoft azure , sharepoint 2013 online, sharepoint context error in case of sharepoint on premise. app correctly redirects azure site. in regard highly appreciated. for on premise, need setup high trust app , generate client context using windows authentication since there no token available on premise. please find below steps setup on premise app , troubleshooting steps http://blogs.msdn.com/b/shariq/archive/2013/05/07/how-to-set-up-high-trust-apps-for-sharepoint-2013-amp-troubleshooting-tips.aspx please provide error message

integral - Matlab partial area under the curve -

i want plot area above , below particular value in x axis. the problem facing discrete values. code below instance has explicit x=10 have written in such way can find index , calculate values above , below particular value if want find area under curve above , below 4 program work. though in plot matlab spline fitting(or sort of fitting connecting discrete values) there value y corresponding x=4 matlab computes cant seem store or access it. %example area under curve , partial area under curve using trapezoidal rule of integration clc; close all; clear all; x=[0,5,10,15,20];% domain y=[0,25,50,25,0];% values lp=log2(y); plot(x,y); full = trapz(x,y);% plot of total area i=find(x==10);% in our case distance value want half = trapz(x(1:i),y(1:i));%plot of partial area how can find area under curve value of ie x = 2 or 3 or 4 or 6 or 7 or ... this elaboration of patrik's comment, "first interpolate , integrate". for purpose of answer i'll assume

Convert unicode list into python list -

this question has answer here: convert string representation of list list in python 8 answers s = u"['1', '2', '2', '1', '2']" print type(s) # <type 'unicode'> how can convert list here: s = [1,2,2,1,2] you use ast.literal_eval function. >>> import ast >>> s = u"['1', '2', '2', '1', '2']" >>> list(map(int, ast.literal_eval(s))) [1, 2, 2, 1, 2] or >>> [int(i) in ast.literal_eval(s)] [1, 2, 2, 1, 2]

html - CSS Hover works locally, but not on dev server -

the hover effect i'm trying achieve works wonderful locally, doesn't thing when uploaded our dev. environment. here html... <a class="circle" href="/portfolio">portfolio</a> now, css... .circle{ display:inline-block; width: 380px; height: 380px; line-height: 360px; text-align: center; background-color: #02193b; border-radius: 50%; font-size: 54px; box-shadow: inset 0 0 0 0 rgba(0,0,0,0.6), inset 0 0 0 10px #a09176, 0 0 10px rgba(0,0,0,0.3); transition: box-shadow 400ms ease-in-out; -ms-transition: box-shadow 400ms ease-in-out; -moz-transition: box-shadow 400ms ease-in-out; -webkit-transition: box-shadow 400ms ease-in-out; -o-transition: box-shadow 400ms ease-in-out; color: white; text-decoration: none !important; text-transform: capitalize; } .circle:hover { box-shadow: inset 0 0 0 0 rgba(0,0,0,0.6), inset 0 0 0 20px #a09176, 0 0 20px rgba(0,0,0,0.3); transition: box-shadow 400ms ease-in-out; -ms-transition: box-shadow 400ms ease

interface - C++ compile-time un-implmented check -

we have several c++ functions implemented in phase 2 of our project part of public interface or respective classes , modules. because part of public interface, think should present, @ least in headers, during phase 1 still thinking them implement rest of classes. however, since unimplemented, want no 1 call them. check occur @ compile time, ensure correctness. my desires are: compile time (could error or warning; warnings better because more flexible - can selectively turn them off) works on g++4.8.1 , doesn't kill build under visual studio 2013 (we use visual studio/visualassistx editor refactoring tools don't work without building) not hard understand done , why functions present in class documentation (we can include \warning not implemented in phase 1 notation doxygen pick up) i considering 3 options: a belt , suspenders approach of marking them deprecated (which generate warning) , throwing custom exception - want except compiler warning "deprecate

java - Spring MVC configuration enable -

i'm setting project scratches, i'm on step of configuring spring mvc 4.1.5 using java config. whole app beeing run on tomcat gradle plugin. can explain me why need make following call class defaultservlethandlerconfigurer in order make requests map controllers ? @override public void configuredefaultservlethandling(defaultservlethandlerconfigurer configurer) { configurer.enable(); } without enabling requests beeing rejected , server says there no mapping particular request. i read spring doc find out, description doesn't tell me much. enable forwarding "default" servlet. when method used defaultservlethttprequesthandler try auto-detect "default" servlet name. alternatively, can specify name of default servlet via enable(string). it's explained in spring mvc section documentation here . this allows mapping dispatcherservlet "/" (thus overriding mapping of container’s default servlet), while stil

java - Intellij show warnings a errors -

a feature in eclipse shows me errors , warnings in code (in list) also - each file there mark whether file has warnings/errors in intellij found rather challenging... intellij experts out there - is there way show warnings in list (i saw similar in messages toolbar dissapears when there no compilation errors) how can see if file has warnings without looking it's contents? thanks! also error/warning list appears when trying commit file subversion. if errors or warnings present in file, idea shows popup window review button. button opens message sub-window handy , good-looking errors/warnings list. p.s. may helpful build -> rebuild project p.s.2. see displaying warnings here: warnings in intellij idea v12

php - Setting default value as empty on custom meta box when no value input? -

i have series of custom meta boxes configured per code below. works fine, when value hasn't been entered user, default value in boxes ". of course issue prints out on front end. if default blank nothing output on front end. any ideas? $video_url_1 = isset( $values['cf_private_meta_box_video_url_1'] ) ? esc_attr( $values['cf_private_meta_box_video_url_1'][0] ) : ”; $video_caption_1 = isset( $values['cf_private_meta_box_video_caption_1'] ) ? esc_attr( $values['cf_private_meta_box_video_caption_1'][0] ) : ”; <label for="cf_private_meta_box_video_url">video url 1</label> <input type="text" class="widefat" name="cf_private_meta_box_video_url_1" id="cf_private_meta_box_video_url_1" value="<?php echo $video_url_1; ?>" /> <label for="cf_private_meta_box_video_caption">video caption 1</label> <input type="text" class="wid

sql server - Import Excel To SQL -

hello have little issue i'm unable resolve. here context: i have 64-bits sql server 2014 instance on computer , 32-bits office installation (on component installed excel, no word, no office tools, no office shared features...). try import data stored in .xls file on network drive on daily basis, i'm unable find right way it. here's why: i try command: insert bbimport select * opendatasource('microsoft.jet.oledb.4.0','data source=w:\..\aaa.xls;extended properties=''''excel 8.0;hdr=yes''''')...[sheet5] after resolving permission issues, got error: "the 32-bit ole db provider "microsoft.jet.oledb.12.0" cannot loaded in-process on 64-bit sql server." note: tried microsoft.ace.oledb.12.0, same error. i try install microsoft ace 64-bits, not compatible 32-bits office installation -_-... however succeed import data using import wizard of sql specifying followings: data sourc

javascript - How do I change the installation path in an OS X installer built with pkgbuild/productbuild? -

we have application installs custom folder , have create installer application extension (plugin). installer of host application created cross-platform tool, permits user choose installation folder , permits install multiple versions on same system. host application not "app", in case of many mac programs, directory contains several files + "app". plugin installer should: 1. pkgbuild/productbuild based, because doesn't want use cross-platform installer because java based , had troubles it 2. query installed host applications cfbundleidentifier , choose 1 install 3. install content of payload directory of chosen host application managed find solutions first 2 requirements, don't know how proceed third. is there solution change installation path distribution.xml? played choice.customlocation attribute, didn't managed modify javascript. there "elegant" solution it? thanks.

ios - Is implementing the UITableViewDataSource protocol required for table functionality -

ive created class declaration class lessondetailsviewcontroller: uiviewcontroller { @iboutlet var detailstable: uitableview! i can populate contents in table , provide operations implementing proper tableview functions. but did not implement uitableviewdatasource protocol these functions defined. can please explain me key concept i'm missing makes possible? how ios know call these methods of class doesn't implement uitableviewdatasource protocol? you must need implement required method of uitableview datasource , delegate method. (nsinteger)numberofsectionsintableview:(uitableview *)tableview (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath

javascript - Get all xml files from a certain folder with AJAX -

i have following question: know how load xml file folder ajax. can load xml files folder without naming them specifically? tried won't work. $.ajax({ type: "get", url: "xml/*.xml", datatype: "xml", success: xmlparser }); i pretty sure url property of ajax needs point particular file. in: url: "xml/myxmlfile.xml,

arrays - Matlab: Sum corresponding values if index is within a range -

i have been going crazy trying figure way speed up. right current code talks ~200 sec looping on 77000 events. hoping might able me speed because have 500 of these. problem: have arrays (both 200000x1) correspond energy , position of hit on 77000 events. have range of each event separated 2 arrays, event_start , event_end. first thing position in specific range, put correspond energy in own array. need out of information, loop through each event , corresponding start/end sum energies each hit. code below: indx_pos = find(pos>0.7 & pos<2.0); energy = hitenergy(indx_pos); i=1:n_events etotal(i) = sum(energy(find(indx_pos>=event_start(i) … & indx_pos<=event_end(i)))); end sample input & output: % sample input % pos , energy same length n_events = 3; event_start = [1 3 7]'; event_end = [2 6 8]'; pos = [0.75 0.8 2.1 3.6 1.9 0.5 21.0 3.1]'; hitenergy = [0.002 0.004 0.01 0.0005 0.08 0.1 1.7 0.007

Jsp code with mysql -

i facing problem in mysql query. query working fine in php admin.whenever implementing through jsp code showing string literal not closed error. here code string query="select * ( (select supplierticketid supplierticketid, tickettype tickettype, supplierticketstatus supplierticketstatus, createdby createdby, suppliertype suppliertype supplierticket) union (select factoryticketid, tickettype, factoryticketstatus, factoryticketcreatedby, suppliertype factoryticket) )t"; plz me..what problem in query..thanks in advance use below query :- string query ="select *

Checking if date is blank in R? -

an easy 1 sure knows how this... in r, looking is.blank error trap in function user can specify date or can blank , default use today's date (i.e. sys.date() ) i tried date.end <- "" # in function if (date.end == "" || is.null(date.end)) { message("end date not specified , setting today") date.end <- sys.date() } else { # use date.end passed in date class } but check freaks out chartodate(), i.e. test.end == "" error in chartodate(x) : character string not in standard unambiguous format please advise how 1 check blank dates in base r? (and other wisdom error trapping dates...) adding clarify: most times function dates, e.g. date.end <- as.date("31/03/2015", "%d/%m/%y") so not want change class. however, how handle odd case want default today if user not specify date? be aware sys.date() returns object of date class. see class(sys.date()) . hence == comparison

Restrict Sharepoint List Items -

i have web part on home page sharepoint announcements. on announcements have public / private option. i want web part show private options users member of permission group. how this? you have 2 web parts on same page , set audience targeting on web part cover 2 groups. user should see web part if they're member of whichever group. example (with made group names) web part might target members of 'managers' other target 'employees'. each see 1 web part. if 2 groups aren't separate presently, you'd have go through central admin create missing audiences include or exclude users necessary.

c# - How to enable lazy loading of relations after INSERT in NHibernate -

i have 1 many relationship between 2 entities in nhibernate: public class application { public string taskid { get; set; } // foreign key reference public task task { get; set; } // relation/navigation property } the db.web.applications.create method calls "saveorupdate" method of nhibernate session inside transaction. the relavant mappings: internal class applicationmap : classmap<application> { public applicationmap() : base() { schema(...); table(...); compositeid() .keyproperty(app => app.userid, "...") .keyproperty(app => app.taskid, "task_id") .keyproperty(app => app.transactionid, "..."); // relations references(app => app.task, "task_id") .foreignkey("taskid") .unique() .not.insert() .cascade.persist(); } } internal class taskmap : classma

sails.js: download file in assets directory -

i create .xls file in assets/xls directory : fs.writefilesync('./assets/xls/data.xls', xls, 'binary'); and want download file : to file url : var downloadlink = req.headers.host+'/xls/data.xls'; i not understant why have 404 error on url : localhost:1337/xls/data.xls this isn't recommended practice storing generated or user-uploaded files. assets folder intended site's front-end assets. if want provide download links in app, you're encouraged save them in separate location , add controller action streams requested file client. allows add policies protect files, , avoids issues source control , grunt. see how authenticate access assets folder in sails.js example of such controller action.

sql - Using dbms_application_info.set_module before running a long query in Oracle -

i trying figure out how set module name in v$session before running long query can track progress. possible? not quite work. how change will? begin dbms_session.set_identifier(client_id=>'abc'); dbms_application_info.set_client_info(client_info=>'abc test'); -- dbms_application_info.set_module(module_name=>'some name', action_name=>'some action'); -- select * tablename ..... -- dbms_application_info.set_module(module_name=>'',action_name=>''); end; it must this: begin dbms_application_info.set_module('my procedure', 'starting'); dbms_application_info.set_action('running'); select * tablename ..... dbms_application_info.set_module(null, null); end; while query executing can select (at session of course) v$session

javascript - PHP: getting variables for many rows in a databse -

i trying send php variable id thats saved in database page displaying google map markers using javascript. have created list display displayed when map marker clicked in php/html: $result = mysqli_query($con,"select * places"); while($row = mysqli_fetch_array($result)) { echo "<div class='place-details' id='place-details' style='display: none'>"; echo "<table class='table'>"; echo "<tr><th>name: </th><td>" . $row['name'] . "</td></tr>"; echo "<tr><th>details: </th><td>" . $row['description'] . "</td></tr>"; echo"</table>"; echo "<td><a href='details.php?id=".$row['id']."' class='btn btn-warning btn-sm'>view</a></td>&

How to remove attribute directives from element directive in AngularJS? -

i have element directive , attribute directive: <my-element my-attribute="value"></my-element> my-attribute directive require ngmodel: app.directive('myattribute', [ function() { var definition = { restrict: 'a', require: 'ngmodel', link: function ($scope, $element, $attrs, ctrl) {...} } return definition; my-element can used without ng-model template of my-element contains input has ng-model. my-attribute should removed my-element , added input inside my-element. in compile function in my-element directive have: var value = element.attr('my-attribute'); element.remove('my-attribute'); element.find('input').attr('my-attribute', value); it works ok when attribute directive doesn't have require: 'ngmodel'. if have ngmodel required get: error: [$compile:ctreq] controller 'ngmodel', required directive 'myattribute&#

SAS and line pointers in a loop -

data test; infile datalines; input k1 k2 k3 k4 k5 k6 k7 k8 k9 k10; array a(*) k1-k10; i=1 10; if a(i) eq . stop; line=a(i); input #line k1 k2 k3 k4 k5 k6 k7 k8 k9 k10; output; end; stop; datalines; 5 9 2 4 6 3 . . . . 29 57 32 9 2 29 2 0 23 1 83 34 28 1 43 3 24 2 6 2 0 84 62 75 3 52 65 1 5 2 0 2 12 45 92 3 60 24 6 2 47 24 87 2 52 36 1 17 3 1 90 93 2 1 40 20 75 2 5 14 78 27 27 2 4 1 12 21 4 2 21 40 3 21 3 19 3 2 4 2 84 2 5 3 13 6 23 98 1 2 ; run; i want read observations numbers in first row. expected result: 0 2 12 45 92 3 60 24 6 2 21 40 3 21 3 19 3 2 4 2 29 57 32 9 2 29 2 0 23 1 0 84 62 75 3 52 65 1 5 2 47 24 87 2 52 36 1 17 3 1 83 34 28 1 43 3 24 2 6 2 the error after running code: error: old line 3387 wanted sas @ line 3391. use: infile n=x; , suitable value of x. rule: ----+----1----+----2-

vectorization - How to vectorize/group together many signals generated from Qsys to Altera Quartus -

in altera qsys, using ten input parallel ports (lets name them pio1 pio10), each port 12 bits. these parallel ports obtain values vhdl block in quartus schematic. in schematic bdf, can see pio1 pio10 nios ii system symbol can connect these pios other blocks in bdf. my question is, how vectorize these pio1 pio10? instead of seeing ten pios 1 line 1 line coming out nios system symbol, should in order group these ten pios see 1 instead of ten? 1 pio see, can name pio[1..10][1..12], first bracket means pio1 pio10, second bracket means bit1 bit 12 because each parallel port has 12 bits. could please let me know how that?

java - What is the correct way to pass arguments to the JavascriptExecutor? -

i'm trying use javascriptexecutor code, involved passing in webelement , info it. getting errors, simplified down find problem. string test = ((javascriptexecutor)driver).executescript("return arguments[0];", "macon").tostring(); that code won't run. it'll throw nullpointerexception . can avoid not trying access passed variable. doesn't seem matter pass; int, string, webelement , etc etc. so what's wrong? can't see discrepancies between online examples , code, there's something. i'm using firefox webdriver, , selenium version 2.44.0 you need cast results string : javascriptexecutor js = (javascriptexecutor) driver; string test = (string) js.executescript("return arguments[0];", "macon"); also, there compatibility issues between selenium 2.44 , firefox 35/36 affected javascript code execution: firefox 35: passing arguments executescript isn't working

javascript - Unexpected behavior with mouseup -

when click on menu, menu shows up, when pointer moved away menu, hides after 2-5 seconds. i want menu toggle when clicked, , explicitly hide when click anywhere else on page, seen on this demo. this fiddle code follows: $(document).ready(function() { $(".myaccount").click(function() { var x = $(this).attr('id'); if (x == 1) { $(".submenu").hide(); $(this).attr('id', '0'); } else { $(".submenu").show(); $(this).attr('id', '1'); } }); //mouseup textarea false $(".submenu").mouseup(function() { return false }); $(".myaccount").mouseup(function() { return false }); //textarea without editing. $(document).mouseup(function() { $(".submenu").hide(); $(".myaccount").attr('id', ''); }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.

javascript - Karma, PhantomJS and es6 Promises -

i writing javascript library uses new es6 promises. can test library in firefox because promises defined. however, when try test code karma , phantomjs, error can't find variable: promise. . guessing because phantomjs browser doesn't support es6 promises yet. how can configure karma bring in polyfill promises? you can pull in babel polyfill installing babel polyfill : npm install --save-dev babel-polyfill and include polyfill file before source , test files within files section of karma.conf.js : files: [ 'node_modules/babel-polyfill/dist/polyfill.js', 'index.js', //could /src/**/*.js 'index.spec.js' //could /test/**/*.spec.js ], unless know target browsers support promises, want apply polyfill released build too. if you're feeling adventurous can use browserify pull files in make testing more modular, , use babelify transpile es6 es5. i've created sample project these , working test involving promise (running on

sql - Select result from multi tables with joins -

i have query. want select surgery type surgery details modality id am on right path atleast? the link table middle of everything addmission 1tom on link surgery mto1 on link modality mto1 on link my problem add in modality.id result. skip modality, , query works 100% updated (dropped multi alias) select surg.srg_details, surg.type, modd.id surgery surg join link lnk on lnk.lnk_id = surg.srg_lnkid join modality modd on modd.mod_lnkid = lnk.lnk_id join admission adm on adm.adm_id = lnk.lnk_admid adm.adm_id = 192100042 try use in case: select surg.srg_details, surg.type, mod.id surgery surg, modality mod join link lnk on lnk.lnk_id = surg.srg_lnkid join admission adm on adm.adm_id = lnk.lnk_admid adm.adm_id = 192100042 , surg.srg_lnkid = mod.mod_lnkid

oracle - Extract text from CLOB PL/SQL NameSpace -

i trying extract data clob column , see in separate column. query using: select xmltype(t.detailbericht).extract('//tekst_reden_afwikkeling/text()').getstringval() ozg_if.mtwk_abcdef t the colum t.detailbericht contains clob text following contents: <ns0:zaak xmlns:ns0="http://www.xxxxx.xx/xxx_xxx_xxxxxxxxxxxx/text_text_v002"> <ns0:code_reden_afwikkeling>d99</ns0:code_reden_afwikkeling> <ns0:tekst_reden_afwikkeling>volledig betaald</ns0:tekst_reden_afwikkeling> <ns0:code_koptekst>490</ns0:code_koptekst> <ns0:omschrijving_koptekst>volledig voldaan.</ns0:omschrijving_koptekst> </ns0:zaak> anybody got ideas? hmm apparently seems work when replace ns0: nothing code using: xmltype(replace(t.detailbericht,'ns0:','')).extract('//tekst_reden_afwikkeling/text()').getstringval() tekst_reden_afwikkeling

How to send c++ lists via sockets to a remote server and write those info to a file using PHP -

i want achieve following: send data above c++ source php script (that create) on remote server via sockets (can wether winhttp or regular sockets, no curl or other 3rd party libraries) the php parse data , write file. there can multiple files, files need numbered. #include <windows.h> #include <stdio.h> #include <tchar.h> #include <psapi.h> #include <dirent.h> #include <iostream> #include <string> #pragma comment( lib, "psapi.lib" ) using namespace std; void printprocessnameandid( dword processid ) // list of running processes { tchar szprocessname[max_path] = text("<unknown>"); handle hprocess = openprocess( process_query_information | process_vm_read, false, processid ); if (null != hprocess ) { hmodule hmod; dword cbneeded; if ( enumprocessmodules( hprocess, &hmod, sizeof(hmod), &cbneeded) ) { getmodulebasename(

android - Unable to open symbol file. Error (20): Not a directory -

i using ffmpeg library on android stream live video feed. have complied ffmpeg android following roman10 instructions . application working correctly - connects server, download feed, transcode it, rescale , displays on device's screen. after random moment app crashes fatal signal 11 (sigsegv), code 1 . have used ndk-stack find source of problem. here crash dump: ********** crash dump: ********** build fingerprint: 'google/hammerhead/hammerhead:5.0.1/lrx22c/1602158:user/release-keys' pid: 25241, tid: 25317, name: asynctask #5 >>> com.grzebyk.streamapp <<< signal 11 (sigsegv), code 1 (segv_maperr), fault addr 0x98e74c9c stack frame #00 pc 00047924 /data/app/com.grzebyk.streamapp-1/lib/arm/libswscale-3.so: unable open symbol file /users/grzebyk/documents/new_eclipse_projects/streamapp/libs/armeabi/libstreamapp.so/libswscale-3.so. error (20): not directory stack frame #01 pc 00034be8 /data/app/com.grzebyk.streamapp-1/lib/arm/libswscale-3.so (sws_sca

javascript - Salesforce API insert adds special characters -

i using salesforce php toolkit in order insert values of javascript functions (just in order document functions using, not execution in salesforce) inside custom object have. in php function saving string like: (function(d,f){var b={src:(d.location.protocol=="https:"?"https:":"http:")... after insert string using sf api, result see in field is: (function(d,f){var b={src:(d.location.protocol==&quot;https:&quot;?&quot;... as can see, salesforce has added special characters string. haven't found anyway pass that. any idea's? the solution remove htmlspecialchars string. didn't think sf accept string without because not echo string without (due special characters in string). seems pass parameter without issue. i'd happy understand if understands.

java - in JTable, How can I disable to edit a specified colunm or row? -

i have trouble , looking solution. but now, can't do. i ask guys issue jtable. this code makes me disable edit cells. final jtable table = new jtable(data, columnnames){ public boolean iscelleditable(int row, int col) { return true; } }; but, want code me not edit specified colunm or row. so, if me, appreciate ! if - else out : public boolean iscelleditable(int row, int col) { if(yourconditionmet) <--- can apply check return true; else return false; }

java - How to show a 'running total' of test successes and failures in maven? -

i have bunch of junit tests i'm running maven using following plugin : <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-plugin</artifactid> <version>2.17</version> when run them, take 20 minutes run. test 2 minutes in fail, whole thing keep running. i'd kill know test has failed. my question is: how show 'running total' of test successes , failures in maven?

string - PHP how to count the length of each word in the text file -

i need help. how count length of each word in text file using php. for example. there test.txt. , contain " hello everyone, need help." how output text , count length of each word,like: array hello => 5 => 8 => 1 need => 4 => 4 => 4 i start learn php. please explain detail code write. many thanks if don't need process words' length later, try this: // file contents $text = file_get_contents('path/to/file.txt'); // break text array of words $words = str_word_count($text, 1); // display text echo $text, '<br><br>'; // , every word it's length foreach ($words $word) { echo $word, ' => ', mb_strlen($word), '<br>'; } but noticed, str_word_count() function has many issues utf-8 string (f.e. polish, czech , similar characters). if need those, suggest filtering out commas, dots , other non-word characters , using explode() $words array.

math - Java : how to get correct result? -

this question has answer here: integer division: how produce double? 10 answers in java: double b = 1234 / (1234+1500); result is: 0.0 why? how correct result? just make 1 of operand double / float - double b = (double) 1234.0/(1235+1500); here casting not required. the rules benind : if 1 of operand double / float (here 1234.0) other promoted double / float .

java - JUnit Mockito Request and Response -

i trying create test login page using junit need mock out dev controller. as used httpservlet in dev environment, testing environment asking httprequest... i went mock request file not getting i'm using controller not servlet. can me on this? below junit controller package com.atoc.test.controller; import java.io.printwriter; import javax.servlet.http.httpservletrequest; import javax.servlet.http.httpservletresponse; import org.junit.before; import org.junit.test; import org.junit.runner.runwith; import org.mockito.injectmocks; import org.mockito.mock; import org.mockito.mockito; import org.mockito.mockitoannotations; import org.springframework.mock.web.mockhttpservletrequest; import org.springframework.mock.web.mockhttpservletresponse; import org.springframework.test.context.contextconfiguration; import org.springframework.test.context.junit4.springjunit4classrunner; import org.springframework.test.context.web.webappconfiguration; import org.springframework.test.w

java - Check for Broken Pipe only when IOException is thrown -

when writing outputstream throw ioexception exception if remote machine down, or has disconnected. now, want call specific method when (and only) pipe broken. problem ioexception not have code or errno property check error. , way able achieve by try { stream.write(message.getbytes("utf8")); stream.flush(); } catch (ioexception e) { if (e.getmessage().equals("sendto failed: epipe (broken pipe)")) { // perform specific action } else { e.printstacktrace(); } } obviously not perfect way achieve such thing. suggestion efficient solution? as mentioned here in java, there no brokenpipeexception specifically. type of error found wrapped in different exception, such socketexception or ioexception . so can achieve same using string#contains() method if(e.getmessage().contains("broken pipe")){ // whatever want }