Posts

Showing posts from April, 2013

postgresql - rails pg_search: which model attribute contained the search term? -

fairly simple question hope has simple answer: i'm using pg_search scopes in rails app: https://github.com/casecommons/pg_search#pg_search_scope how know which columns on model contained relevant search terms? assume i'm searching against :headline , :expertise columns on user model , want know whether it's :headline or :expertise column hit pg_search query such "ruby on rails"? in user model: include pgsearch pg_search_scope :search, against: [:headline, :expertise], thanks!

rest - How to catch DB exception when overriding actionCreate in Yii2 RESTful API? -

i'm using yii2 restful api implementation. start: http://budiirawan.com/setup-restful-api-yii2/ i'm overriding create method own action: public function actioncreate(){ $params = $_request; if (!empty($params["name"]) && !empty($params["code"])) { $model = new $this->modelclass; foreach ($params $key => $value) { if (!$model->hasattribute($key)) { throw new \yii\web\httpexception(400, 'invalid attribute:' . $key); } } $model->attributes=$params; try { $model->save(); } catch (cdbexception $ex) { // ... never reach point :-( throw new \yii\web\httpexception(405, 'error saving model'); } catch (exception $ex) { // ... never reach point :-( throw new \yii\web\httpexception(405, ...

visual c++ - C++/CLI typedef cliext LNK2022 error -

if write c++/cli application, , attempt use stl:clr via cliext , typedef example cliext map find doesn't work due lnk2022 error. i mistaken in original answer on how mitigate link error pointed out hans in comment above. though, recommend using dictionary instead, still possible continue using cliext , solve problem without unusual workarounds. the actual answer templates not allow external linkage. means somewhere using cliext::map outside of namespace. moment eliminated, link error goes away.

javascript - How to get the UserID from other server in Jmeter -

let me explain case got stuck these days. assigned test loading time of 2 files in 1 feature named tracking information. feature used track information (eg: number of user register site) customer site. basically, there 2 files (js file , img file) used. basically, assume have 2 sites named: www.example1.com , www.example2.com . site2 provides tracking code snippet site 1 , requires site 1 paste in source code. when user registers site1, site request file named "tracker.js" site2 , request "img.gif" file site2 method then. "img.gif" file contains tracking information auto filled in site1. now use jmeter record steps , want register other users. however, got stuck "userid" parameter new registered user auto generated site1. is there way kind of parameter in jmeter run other user? attach images observing.! register form: http://postimg.org/image/cdnvsxxd5/ tracking information: http://postimg.org/image/baf5r43xd/ thanks in a...

c# - Byte Array to font from my solution resources folder -

Image
i have specific font in resources folder want use. label label; label.fontfamily=mynamespace.properties.resources. i can see font name return byte[] . how can use font ? try function private system.drawing.font getfontfromresource() { stream fontstream = this.gettype().assembly.getmanifestresourcestream("yourfont.ttf"); byte[] fontdata = new byte[fontstream.length]; fontstream.read(fontdata,0,(int)fontstream.length); fontstream.close(); unsafe { fixed(byte * pfontdata = fontdata) { return new system.drawing.font((system.intptr)pfontdata, 16, fontstyle.regular); } } } how load resource assembly:( yournamespace.file.ttf ):

ios - Swift Thread 1: EXC_BAD_INSTRUCTION when I try to change a uilabel.text -

i know there lot of stack overflow questions out there, none of answers can find work me. using custom uitableviewcell class called chillercell . here code: import uikit class chillercell: uitableviewcell { @iboutlet weak var iconlabel: uilabel! @iboutlet weak var boldlabel: uilabel! @iboutlet weak var italiclabel: uilabel! func configurecellwithevent(event: event){ boldlabel.text = "\(event.eventname)" italiclabel.text = "\(event.eventdescription)" } } i thread 1 runtime error on line boldlabel.text = "\(event.eventname)" i made own event class, , yes, event.eventname , event.eventdescription of type string , not nil . edit: forgot mention, boldlabel , italiclabel not plain text, attributed text. try this, work if event object having eventname & eventdescription string: func configurecellwithevent(event: event){ var attributedstring = nsmutableattributedstring(string:"(event....

c# - Column total on sub report for displayed rows -

i'm working on time sheet report display day day punch records employee , total out hours week. master report list of employees , demographic information. sub report list of each days punch in , out information. when put sum @ end of total time column, sums of time employees sub report records. i want display sum of column employee. what missing make work? the answer turned out to filter dataset 1 employee needed in subreport @ time. apparently ms reporting software doesn't filter based on subreport criteria. used linq query against datatable employeeid comes part of subreport handler. sum calculation correct.

virtualenv - SOLVED - pip installs a django version different from the one specified in requirements.txt -

i'm trying djangocms tutorial. everything fine on laptop (on archlinux), tried continue project on different computer (using mac os x). made git clone , started fresh virtualenv , tried pip install -r requirements.txt . here content of requirements.txt (i got pip freeze output) : dj-database-url==0.3.0 django==1.6.11 django-classy-tags==0.6.2 django-cms==3.1.2 django-reversion==1.8.5 django-sekizai==0.8.2 django-select2==4.3.1 django-treebeard==3.0 djangocms-admin-style==0.2.7 djangocms-column==1.5 djangocms-file==0.1 djangocms-flash==0.2.0 djangocms-googlemap==0.2 djangocms-inherit==0.1 djangocms-installer==0.7.8 djangocms-link==1.6.2 djangocms-picture==0.1 djangocms-style==1.5 djangocms-teaser==0.1 djangocms-text-ckeditor==2.5.2 djangocms-video==0.1 html5lib==0.99999 pillow==2.8.0 -e git+http://git@github.com/divio/django-polls.git@9fb91e49e2e56cf59ab0cfcddb17c35afbdd06da#egg=polls-master pytz==2015.4 six==1.9.0 south==1.0.2 tzlocal==1.2 wheel==0.24.0 but django ve...

SAS PROC Document - Giving Requested function is not supported when creating HTML page -

created test using proc document below: ods listing ; ods document name=test(write); proc report data=sashelp.prdsal3 contents=' country wise product , actual sale'; columns country product actual ; define country / display; define product / display ; run; ods proctitle=on; title 'this simple proc tabulate procedure'; proc tabulate data=sashelp.prdsal3 ; class country product ; var actual; table country * product , actual / contents='sale actuals'; run; ods document close; ods listing; proc document name=test; list / levels=all; run; ods listing close; here listing: ods listing; proc document name=test; list / levels=all; run; ods listing close; listing of: \work.test\ order by: insertion number of levels: obs type 1 dir 2 \report#1 dir 3 \report#1report#\report#1 table 4 dir 5 \tabulate#1report#1 dir 6 \tabulate#1\report#1table#1 table getting error code: ods ht...

flash - Programming a Scratch like Software (in terms of UI / framework) for Hardware Interfacing -

so engineer , working on basic robotic kit (arduino, motors , stuff) kids, based in karachi, pakistan , our target market is. we want provide software along kit - software needs scratch scratch geared more towards learning on computer, want software centered around hardware robot. we have looked @ several implementations of scratch, from mirobot (mirobot.io) - uses snap, scratch software mbot (mblock.cc/mbot) - made scratchbot (app.makeblock.cc/program/scratch/) - not opensource, based on scratch flash mind+ (www.mindplus.cc/index.html) - opensource, looking @ it we looked @ node/flow based programming, electronics engineers , although can desktop applications need know sort of applications called , there framework or tools or libraries can use make snap-able blocks , allow rich colorful programming environment kids - want keep open source want make ourselves have complete grasp on things. modifying/hacking scratch source files not option based on flex/flash , dont want...

batch file - Running commands over Plink from PowerShell fails with "■e: not found" -

thanks help. have problem script. trying convert script batch powershell, try learn new powershell know other languages decent @ programming. script creates kivacommands.txt file used in plink executed on server. batch script works fine plink when converted powershell plink line errors on -m switch. sh:  ■e: not found i error no matter commands in txt file, if file empty. plink line works fine if pass single command execute. code i'm having trouble with. $hostlogin = "myserver" $passwd = "mypassword" $command = "h:\kivacommands.txt" c: cd \ cd "program files (x86)\putty" ./plink.exe -ssh $hostlogin -p 22 -pw $passwd -m $command the cd commands way work. tried other ways of giving whole path , creating variable path plink not execute. so after more troubleshooting, have narrowed down file created. if manually create file works fine script creates file before calling plink. have tried 3 different ways create file "exi...

php - How to do process with for() function and give return true in the last -

i have project, , have 1 problem. can me? have code: for($i=0; $i < $rows; $i++){ if(do_something == true){ return true; }else{ return false; } } if, have 10 data, , want do_something process data. problem is, script stop in first data. so, delete return true; , leave blank. script process data. question is, how can put return true; in end of process, know no error in process. use this: for($i=0; $i < $rows; $i++){ if(do_something == false){ return false; } } return true; it "do something" long successful, , until done, , abort @ first "false" result of "do something".

javascript - Approving via email -

i generate email 2 buttons approve / decline. on clicking buttons in email body , make call web service i have js written uses jsonp send cors request , happy works correctly when embedding html in email body, nothing , don't see button.. text i'm wondering scenario possible or there route should taking ajax requests cannot made email clients. don't support kind of functionality. consider generating 2 separate web site urls approve , decline show action success message either actions respectively. or send url page created through mail , let ajax request take responsibility there.

python - ValueError: too many values to unpack, passing a list as *args -

i have problem passing arguments through list django filter. here code: args = [ "q( title__icontains = 'foo' ) | q( author__icontains = 'foo' )", "q( title__icontains = 'bar' ) | q( author__icontains = 'bar' )" ] entries = book.objects.filter( *args ) but filter returns error: valueerror: many values unpack, your args strings, must q objects. remove quotes around q object definitions.

php - Using parseincludes in Laravel5 Fractal -

struggling using parseincludes in https://github.com/thephpleague/fractal . i have 2 tables, property , weeks. each property has many weeks. using fractal can return property item collection of weeks. want use parseincludes, return of weeks optional. propertytransformer.php <?php namespace app\transformer; use app\models\property; use league\fractal\transformerabstract; class propertytransformer extends transformerabstract { protected $availableincludes = [ 'week' ]; public function transform(property $property) { return [ 'id' => (int) $property['propertyid'], 'propertyname' => $property['propertyname'], 'exactbeds' => (int) $property['exactbeds'], 'weeks' => $property->week ]; } /** * include week * * @return league\fractal\itemresource ...

node.js - Most effective way to poll an Amazon SQS queue using Node -

my question short, think interesting: i've queue amazon sqs service, , i'm polling queue every second. when there's message process message , after processing, go polling queue. is there better way this?, sort of trigger? or approach best in opinion, , why. thanks! yes there is: http://docs.aws.amazon.com/awssimplequeueservice/latest/sqsdeveloperguide/sqs-long-polling.html you can configure sqs queues have "receive message wait time" , long polling. so can set 10 seconds, , call come if have message or after 10 sec timeout expires. can continuously poll queue in scenario.

Connect Android Studio to device via LAN -

i using debian 8.1, android studio 1.2.2 , rooted android tv box android 4.2.2 now trying connect tv box android studio via lan, directly test app developing. my pc , android box in same network. can connect box in linux-console via: adb connect 192.168.50.104 it says: connected 192.168.50.104:5555 i can access android tv box via adb commands in console. but unfortunately android studio not find device... when try compile app, android studio gives me "chooser dialog", can launch emulator, or choose running device. "running devices" says "nothing show" what problem? update 1: device btw: http://www.geniatech.com/pa/atv1200.asp update 2: in windows works perfectly! adb connect 192.168.50.104 , voila! device shown in list in android studio... i found solution problem. on linux system renamed adb came package-manager cd /usr/bin/ sudo mv adb backup_adb then created symlink adb, provided android studio sdk: sudo ln -s ~/...

c# - How to programmatically set NullValue property of DataColumn of ADO.Net DataTable -

Image
i have many new wizard-created datatables in project, need extract data from. there many string columns dbnull values in these tables, want extract empty strings . so went ahead , changed nullvalue property of each datacolumn datatype of system.string (throw exception) (empty) this: i got tired of repetitive work, tried set nullvalue programmatically in data layer of application. i was, however, unable find property. decompiled code of system.data.datacolumn , property nullvalue did not seem exist there. nullvalue may magic feature of microsoft.vsdesigner.data.design.datacolumneditor , that's nothing more mere suspicion @ moment. how can programmatically achieve same effect if did set nullvalue (empty) in property editor)? yes. defaultvalue property of datacolumn not gonna work because have number of prepared datatables. here 1 possible solution => can place tables in 1 dataset (lets ds) first use following code: for (int = 0; < ds.table...

filter - JBOSS AS7 + CAS doesn't redirect after login -

i have jboss as7 cas deployed , test application requires cas login. if go localhost:8443/test redirects me cas login page, after login says login successful, doesn't redirect me aplication. it's stuck @ "login successful". test application web.xml: <?xml version="1.0" encoding="iso-8859-1"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5"> <distributable/> <display-name>java cas client test application</display-name> <security-constraint> <web-resource-collection> <web-resource-name>java cas client test application</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> ...

AngularJS set limitTo to unlimited in ng-repeat -

i need users able change how many entries should see reason need use limitto in ng-repeat need able let them see entries how set unlimited? example: <div ng-repeat="person in people | limitto:limitpeople"> <!--- som entry --> </div> limitto docs if u change value undefined filter should not apply should shown. if limit undefined, input returned unchanged.

mysql - How do I Sort a column based on the has many field in cakephp 2.x -

i have following relationships in models state has many lga. lga has many wards. i displaying paginated list of states , 1 of column contains lga , contains ward. can sort state , lga unable sort ward. cake returs error: sqlstate[42s22]: column not found: 1054 unknown column 'ward.name' in 'order clause' i can see in resulting sql query, cake adding ward.name order clause without being in actual joins query. has experienced this? how did solve it? thanks.

java - Unresponsive actor system: ThreadPoolExecutor dispatcher only creates core thread pool, apparently ignores max thread pool size -

update: i've found program remains responsive if set threadpoolexecutor's core pool size same max pool size (29 threads). however, if set core pool size 11 , max pool size 29 actor system ever creates 11 threads. how can configure actorsystem / threadpoolexecutor continue create threads exceed core thread count , stay within max thread count? prefer not set core thread count max thread count, need threads job cancellation (which should rare event). i have batch program running against oracle database, implemented using java/akka typed actors following actors: batchmanager in charge of talking rest controller. manages queue of uninitialized batch jobs; when uninitialized batch job polled queue turned jobmanager actor , executed. jobmanager maintains queue of stored procedures , pool of workers ; initializes each worker stored procedure, , when worker finishes sends procedure's result jobmanager , , jobmanager sends stored procedure worker . batch t...

How to create a pykcharts instance by retrieving an existing pykcharts chart at page load? -

how create pykcharts instance retrieving table of existing pykcharts page loads? i mean, when load page load saved chart , put in div eg: <div id = "mychart"> <svg ....> pykcharts </ svg> </ div> i instance of pykcharts chart edit it. is possible? currently, achieve this, have clear dom , reinitialise chart , call execute again edited configuration passed chart. there no provision edit existing chart.

python - Define a constructor in full classmethod class -

let's have following class : class context: element_list = [] @classmethod def add(cls, element): cls.element_list.append(element) @classmethod def remove(cls, element): cls.element_list.remove(cls.element_list.index(element)) this class near of singleton class. objective update element_list attribute anywhere in program without passing context instance parameter of functions. pycharm signals me should define __init__ method. not want create 2 different instances of class. thinking creating dummy __init__ method : def __init__(self): raise notimplementederror("this class should not initialized") the question(s) (are) : should define __init__ method ? if yes how ? instead of using classmethod implementation should use singleton class (see: is there simple, elegant way define singletons? ) the __init__ method not mandatory . should define __init__ method if want pass state instance being initialized....

Magento get customer by Tax/VAT number field -

i looking similar 1 (thats works email), instead of customer email, want him tax/vat number. $customer = mage::getmodel('customer/customer')->setwebsiteid($website->getwebsiteid())->loadbyemail($customeremail); i found example doesn't work. $customer = mage::getmodel('customer/customer')->getcollection()->addattributetoselect('*')->addfieldtofilter('taxvat', $ss_5_last)->load(); thank you. if attribute taxvat contains unique values, approach right. result of second try returns collection. think need customer object, try one: $customer = mage::getmodel('customer/customer') ->getcollection() ->addattributetoselect('*') ->addfieldtofilter('taxvat', $ss_5_last) ->getfirstitem(); this returns customer object can work with. caution: if taxvat not contain unique values, method return wrong customer, because returns first ite...

android - Countdown timer not working properly -

i trying use timer ...when call countdowntimer.start() i can see in debugger timeleft variable updated value=120000 want timer doesn't execute ontick method. jumps straight onfinish . if give timeleft literal works. volatile long timeleft=0; countdowntimer countdowntimer=new countdowntimer( timeleft,1000) { @override public void ontick(long timeleft) { textview timeview= (textview)findviewbyid(r.id.timer); long longtime=(timeleft / 1000); integer inttime=(int)longtime;// convert long int timeview.settext(string.valueof(inttime));} @override public void onfinish() {correctdialog("sorry,time up!!");}};} (timeleft not fixed) here first parameter in countdowntimer() constructor millisinfuture . giving value 0. finish whenever start timer. give value how time want execute times 10000 or 20000 etc... so initialize timeleft volatile long ...

linux - How do I pass ESC to stdin? -

how pass esc stdin in shell, esc on keyboard? i have discovered 0x1b or ^[ outputted result of esc how can input esc ? on keyboards, can entered control [ . in shell script, (which part of posix shell): printf '\033' and in gnu echo , may do echo -e '\e' piping either script makes script's standard input ("stdin"): printf '\033' | myscript

Remotely executing a memory intensive exe with powershell -

i'm trying kick off exe (it written in house) using powershell. exe memory intensive, using 12 - 15 gigs @ times (it's overnight job) exe works fine , it's been moved it's own machine 32 gigs of ram. rather use winat or schedule it, i'd use powershell centralize nightly processes run , execute remotely. however, keep running memory issues (from searching around has shown). i'm getting message on calling machine - "the ws man process did not return proper response. provider in host may have behaved improperly." started changing value of maxmemorypershell , exe start sometimes, though i've yet finish. setting i'm referring to: get-item wsman:\localhost\shell\maxmemorypershellmb i've tried setting 15 gigs on target machine , had no luck. have experience calling memory intensive processes powershell? i'm not clear maxmemory should set to, machines needs set on, or if there's other settings i'm not aware of. thanks in advan...

Why the SonarQube server fails to start with following error message "Database relates to a more recent version" -

i'm using sonar 3.7.2 jtds driver mssql database. while starting sonar in windows gives following error: 2015.06.26 02:54:53 info o.s.s.p.serverimpl sonarqube server / 3.7.2 / 1feffde9f95897aa000a7123ba54a8c8757b40d8 2015.06.26 02:54:53 info o.s.c.p.database create jdbc datasource jdbc:jtds:sqlserver://enbuild03/sonar;selectmethod=cursor 2015.06.26 02:54:54 **error o.s.s.p.platform database relates more recent version of sonar. please check settings**. org.sonar.api.utils.messageexception: database relates more recent version of sonar. please check settings. 2015.06.26 02:54:57 info jruby.rack jruby 1.6.8 (ruby-1.8.7-p357) (2012-09-18 1772b40) (java hotspot(tm) 64-bit server vm 1.6.0_43) [windows server 2008 r2-amd64-java] 2015.06.26 02:54:57 info jruby.rack using shared (threadsafe!) runtime i'm stuck here since sonar server not starting because of above bold error... any appreciated ??? it somehow seems newer version of sonar has been run against d...

HTML import relative path -

i'm writing webcomponent. therfore have index.html in import webcomponent: <link rel="import" href="components/test.html"> as see have component in specific folder relative index.html. when want access ressource test.html in components folder. want like: background-image: url("test.gif"); for css or: <img src="test.gif"> but doesn't work. works when change path relative of image index.html like: <img src="components/test.gif"> i know can tricks document.currentscript.baseuri want write plain css , html. there easy way so? you might want take @ how polymer guys it . code in src/standard/resolveurl.html ( snapshot ) , src/lib/resolve-url.html ( snapshot ). it isn't pretty. alone, infer @ time of writing answer question seems "no, isn't easy , there no way without using tricks".

html - jQuery set attribute with .attr() view source not updating -

i new jquery , learning .attr() object method. i have: <!doctype html> <html> <head> <meta charset="utf-8"> <title>demo</title> </head> <body> <a href="http://jquery.com/">jquery</a> <script src="jquery-2.1.4.js"></script> <script> $(document).ready(function() { $('a').attr('href', 'http://www.google.com'); console.log( $('a').attr('href') ); }); </script> </body> </html> the console return expected value of: http://www.google.com when right click window view source anchor element still: <a href="http://jquery.com/">jquery</a> why this? view source shows original source of page when came server. to view generated/modified source, use developer tools (inspect element) this case in chrome @ least.

symfony - How to override register form FosUserBundle? -

i want override of fosuserbundle forms ( registration form ) followed documentation , cant understand why keep getting same error : attempted load class "registrationformtype" namespace "oc\userbundle\form\type". did forget "use" statement "fos\userbundle\form\type\registrationformtype"? 500 internal server error - classnotfoundexception. these files: registrationformtype.php: <?php namespace oc\userbundle\form\type; use symfony\component\form\formbuilder; use fos\userbundle\form\type\registrationformtype basetype; class registrationformtype extends basetype { public function buildform(formbuilder $builder, array $options) { parent::buildform($builder, $options); $builder->add('telephone'); } public function getname() { return 'oc_user_registration'; } } service.yml of ocuserbundle: services: oc_user_registration: class: oc\use...

visual studio 2010 - not able to read a text file in vs2010 using c .. i am new to vs please help me -

i kept text file @ same place .exe existing , not working .. hi code , kept text file @ same place .exe existing , not working .. hi code , kept text file @ same place .exe existing , not working .. int main(int argc, _tchar* argv[]) { int result = 0; char ca, file_name[25]; file *fp; //printf("enter name of file wish see\n"); gets(file_name); fp = fopen("sample.txt","r"); // read mode if( fp == null ) { perror("error while opening file.\n"); //exit(exit_failure); } if( fgets (str, 60, fp)!=null ) { /* writing content stdout */ puts(str); } fclose(fp); } try , work in c & c++ , use code perform file operation int main() { char filename[10];char extension[5]=".txt"; printf("enter name of file wish see\n"); gets(filename); fflush(stdin); filename[10]='\0'; strcat(filename,extension); puts(filename); file...

Remove object from an array in C++? -

here's simplified sample of code : .h class company { public: company(); void addemployee(const employee &emp); void removeemployee(); private: employees *listemployees; }; the .cpp company::company(){ listemployees = new employees[16]; } company::addemployee(const employee &emp) {listemployee[index]=emp;} company::removeemployee(){ ??? } i remove employee stored in array. tried use : delete listemployee[index]; //->"cannot delete expression of type 'employees' listemployee[index]=null; //->"no viable overloaded '='" i didn't find satisfying solution on web. also, i'm not familiar pointer , reference, maybe error cames this. thanks. edit : i'm not allowed use vectors, must use arrays. edit2 : answer. here's solution used : for(int i=indexemp;i<sizearray-1;i++){ listemployees[i]=listemployees[i+1]; } where indexemp index of employee want remove. there no built-in ...

ruby on rails - "Unable to download data from https://rubygems.org/" because "certificate verify failed" -

i added code mydbs_controller.rb instructed on rails tutorial: def create @mydbs = mydb.new(params[:mydb]) @mydb.save redirect_to @mydb end i run database , come error: the controller-level `respond_to' feature has been extracted `responders` gem. add gemfile continue using feature: gem 'responders', '~> 2.0' consult rails upgrade guide details. so added gem 'responders', '~> 2.0' gemfile , tried bundle install. i run error telling me make sure gem install responders -v '2.1.0' succeeds before bundling. after running i'm left yet error error: not find valid gem 'responders' (= 2.1.0), here why: unable download data https://rubygems.org/ - ssl_connect returned=1 errno=0 state =sslv3 read server certificate b: certificate verify failed (https://api.rubygems.org/specs.4.8.gz) i meet same question. change gem source " https://rubygems.org/ " " http:...

Setting to use matlab `integral` with a (only) scalar function? -

i have function cannot written take vector input , return vector output. builtin integral function seems expect this, , evaluating number of locations @ same time. there way turn off? i.e., simplest test case is f = @(x) x * x; % intended univariate integral(f, 0, 1); %i want have call univariate inputs. where purposefully not setting function x .* x in order test univariate input. obviously, function lot more complicated , cannot vectorized. you can use array-valued flag that's mentioned in help : >> f = @(x) x * x; >> integral(f,0,1,'arrayvalued',true) ans = 0.3333 the description bit misleading: array-valued function flag, specified comma-separated pair consisting of 'arrayvalued' , either false , true , 0 , or 1 . set flag true indicate fun function accepts scalar input , returns vector, matrix, or n-d array output. the default value of false indicates fun function accepts vector input , retur...

Connections with the Excel and Access Database are preventing me from getting exclusive database -

i have access database users connecting excel files. have way of managing people logged on using access. however, not have way manage people connected database using excel. front in not worried data want able edit forms , add features. splitting database help... https://support.office.com/en-ca/article/split-an-access-database-3015ad18-a3a1-4e9c-a7f3-51b1d73498cc but can making fe release users mde or accde file. these compile vba code , not allow users enter design mode change these files smaller , more secure. then can make changes regular fe mdb or accdb files have, test changes , when ready release new version, publish them mde or accde files , copy on old version (or make ups first, , replace).

c++ - Pass program output to a DirectShow source filter to be picked up by Lync? -

goal broadly, want accomplish following: generate series of images in real-time program pass images directshow source filter, registered capture source select resulting "virtual webcam" in program lync the image generation written , must leverage existing framework. working on interface between framework , directshow. current implementation passing images described below. interfacing a com interface described in .idl file, , generated .c / .h files included in source filter and, extension, framework module. additional methods allow specifying media format support , tuning parameters based on rate of image generation. the passimage method passes pointer generated image buffer , size of buffer. called framework sink module when receives new data pass. myinterface.idl [ object, uuid("46b4bd3c-cd67-4158-bb83-89ea95306a4d"), ] interface iextlivesrc : iunknown { ... hresult passimage ( [in] unsigned long size, [in, ...

What is the purpose of using "->" on a variable in Swift? -

i following apple's ebook titled "the swift programming language". in it, there code sample creates function. function uses "-> bool" @ end, understand means function have boolean output. to configure function, uses 2 input variables. 1 of variables "int -> bool" (see code below). maybe there better explanation of later in ebook searches not quite explain how , why use "->" nomenclature on variable. func hasanymatches(list: [int], condition: int -> bool) -> bool { item in list { if condition(item) { return true } } return false } func lessthanten(number: int) -> bool { return number < 10 } var numbers = [20, 19, 10, 12] hasanymatches(numbers, lessthanten) since not explained, best way can read code sample "condition" variable not variable function in , of itself. therefore way read code follows: "condition function accepts integer , returns boolean var...

ruby - Questions regarding link_to function within Rails -

executive summary reading api , have working "link_to", through brute force guessing. providing api , description, , attempting figure out how brute force guess worked!? == end i trying learn "how read api documentation within rails". 1 specific function gives me great deal of trouble link_to function. plain , simple, need learn how 'read api functions' , question related that. url: http://apidock.com/rails/v4.0.2/actionview/helpers/urlhelper/link_to the current documentation details following 1. link_to(body, url, html_options = {}) # url string; can use url helpers # posts_path 2. link_to(body, url_options = {}, html_options = {}) # url_options, except :method, passed url_for 3. link_to(options = {}, html_options = {}) # name end 4. link_to(url, html_options = {}) # name end ultimately, wanted to add whole bunch of html styling , leveraging ajax link_to feature using block. this worked, don't understand why option #4...

SQL Server - MyCTE query based on 24 hour period (next day) -

i have bit of code: ;with mycte ( select *, row_number() over(partition carduser order cardtableid) newvariation cardchecker ) update mycte set status = newvariation which updates status column, want happen on 24 hour period, status starts again next day @ 1, , counts again based on carduser specified above: current data , happens: 2 aaa 1 2015-06-25 08:00:00.000 123 1 null 3 ccc 1 2015-06-25 00:00:00.000 124 1 null 4 aaa 1 2015-06-25 17:30:00.000 125 2 null 5 aaa 1 2015-06-26 17:30:00.000 125 *3* null what want happen: 2 aaa 1 2015-06-25 08:00:00.000 123 1 null 3 ccc 1 2015-06-25 00:00:00.000 124 1 null 4 aaa 1 2015-06-25 17:30:00.000 125 2 null 5 aaa 1 2015-06-26 17:30:00.000 125 *1* null im not quite sure how add above query possible point me in right direction? the main problem eventtime field contains both date , time, adding partition means status 1 based on time parameter of field thanks ...

ruby on rails - How to update associated models in gem "devise" account_update action -

i'm new in ruby on rails i use gem "devise" authentication users , have trouble update assosiated models in account update action. @ account update, keys 'user_id' in assosiated records set nil database queries occurs: update "user_information" set "user_id" = ? "user_information"."user_id" = ? [["user_id", nil], ["user_id", 1]] update "user_settings" set "user_id" = ? "user_settings"."user_id" = ? [["user_id", nil], ["user_id", 1]] ie request reset key user_id nil in associated models. doing wrong? my code: migrations create_table(:users) |t| t.string :email, null: false, default: "" t.string :encrypted_password, null: false, default: "" # etc end create_table :user_settings, :id => false |t| t.references :user, null: false, index: true, unique: true # etc end create_table :user...

image processing - Green channel from bitmap c# -

how can extract green channel alone rgb image (bmp) ? tried using channelexrtract (aforge) , analysed data dimensions in mathematica, still 2592x1944x3; 3 representing still not 2d array. 2592x1944x3 x1 red x2 green x3 blue green green channel in 2592x1944 array: int[][] green; for(int = 0; < 2592; i++) { for(int j = 0; j < 1944; j++) { green[i][j] = bitmap[i][j][1]; } }

c - How to optimize malloc() to get full use of your memory? -

i wrote little program handle word searching other day , found that, when keep allocating memory bianry search tree store every 1 word tried analyse, using malloc() , 4g memory quickily consumed up. there no memory leek in program, because allocate memory binary search tree. still, can allocate less 6000 binary search trees in program. structure of binary search tree is: typedef struct bstnode{ char data[20]; struct bstnode* leftchild; struct bstnode* rightchild; int num; }bstnode; so pretty small. according have learned, every 1 of structure cost 80 bytes of memory(the data cost 20 bytes , others because of memory alignment) (right?) so 6000 structure in memory cost 480mb in total. however, program failed when try allocate memory 6000 structrue(it ok when allocate memory 5000 of that).and pc have 4 gb memory in total!! (with 1000mb cached , 2100mb available , 1100mb free (according task manager on windows)). why that? my primary concerns be...