Posts

Showing posts from March, 2012

How do I grant myself sysadmin-role to a local SQL Server instance? -

this question identical one: how grant myself admin access local sql server instance? , except... question sql-server 2012, not 2008. answers above question not work, since, seems, not have enough rights. the problem: have sql-server instance (sql-server express 2012), original owner killed (the account killed, not person himself), no 1 sysadmin anymore. i local administrator on machine , want grant myself sysadmin-role on sql-server, without reinstalling it. how?

Tesseract on OSX: dyld: Library not loaded: /usr/local/lib/libtiff.5.dylib -

i installed tesseract locally on mac , installed leptonia . xaamp use utility server . i have following problem , when launch command tesseract terminal successful, however, if launch tesseract command php script gives me error : dyld: library not loaded: /usr/local/lib/libtiff.5.dylib referenced from: /usr/local/opt/leptonica/lib/liblept.4.dylib reason: incompatible library version: liblept.4.dylib requires version 8.0.0 or later, libtiff.5.dylib provides version 6.0.0 can me? thank you i have problem similar, not same. can try this: brew install tesseract if not symlink, /usr/local/bin not writable, use command: sudo chown -r $(whoami) /usr/local after install autoconf, automake, , libtool command: brew install autoconf automake libtool i think need use 1 well: brew install leptonica --with-libtiff use link command link libs: brew link tesseract, brew link automake, brew link libtool, etc... i hope helps you.

Sharepoint 2013 Hosted App execute javascript on all pages load -

i know if it's possible have sp 2013 hosted app injects piece of javascript gets executed on every page load. for sake of simplicity, imagine want create app on every page load of sp site displays alert('hello world!'); i don't want have remote web, pure , simple hosted app can added picking sp store. is possible? thanks! you can inject javascript using custom action script link @alexcode suggests app require web - full control permissions. can't remember adapted code while looking add-in development. poc should make more robust before using in live environment. app.js contents (function(undefined) { "use strict"; var actions, web, context, hostcontext, actiondescription; console.log('running function'); // getquerystringparameter: method retrieve query string parameter values var getquerystringparameter = function(param) { var params = document.url.split('?')[1].split('&

c# - The Namespace X already contains a definition for XX? -

i don't understand error getting. have tried clean , build project several times. can me? program.cs using system; using system.collections.generic; using system.net.networkinformation; using system.net.sockets; using system.io; using system.threading.tasks; namespace httprequestapp { class program { static void main(string[] args) { var lstwebsites = new list<string> { "www.mearstransportation.com", "www.amazon.com", "www.ebay.com", "www.att.com", "www.verizon.com", "www.sprint.com", "www.centurylink.com", "www.yahoo.com" }; string filename = @"requestlog.txt"; { using (var writer = new streamwriter(filename, true)) { fo

r - RStudio Exporting Issues -

i have never needed export rstudio specific dimensions. producing graphs publication strict width of 2400 pixels. major problem have not used singular traditional plot have done. have customised graph various plots , segments. evaluate plot have been making it, have been looking @ zoomed in plot in rstudio. so asking whether there way export zoomed in plot on rstudio png specified width (height, flexible with). i have tried dev.copy2pdf(device = "pdf", file = "test.pdf") which didn't work had hoped. if using ggplot, can use ggsave: qplot(rating, data=movies, geom="histogram") ggsave("test.pdf", height=8, width=8) the default dpi 300 300 dpi x 8 inches = 2400. this should same in base plotting system: pdf("boxplot.pdf", height=8, width=8) boxplot(mtcars$mpg) dev.off()

date - php get last day of given month -

i want output of last , first date of given month of current year. using code not works $month='02'; $first_day_this_month = date('y-'.$month.'-01'); // hard-coded '01' first day $last_day_this_month = date('y-'.$month.'-t'); echo $first_day_this_month;print'<->';echo $last_day_this_month; my output shows 2015-02-01<->2015-02-31 but 2015-02-01<->2015-02-28 i have had problem php before, try following way: $datetotest = "2015-02-01"; $lastday = date('t',strtotime($datetotest));

excel vba - Delete all rows with criterias -

i need vba code delete rows column equal "xxx" if column b equal "yyy". example: have spreadsheet looks this: column has multiple rows same value value in column b different every row. want delete records same value in column if column b has specific value. this easy create using macro record feature of excel , modify code fit specifics needing.

c++ - Template meta programming inside template class -

i'm trying pre create template member functions in array, , index array using run time determined values. array array of pointers template functions within manager specialize. call 1 of these functions process::send function. example. template<typename matcht> class manager { public: template <int p> void do(); template<int p, int ...ps> struct table : table<p-1, p-1, ps... >{}; template<int... ps> struct table <0, ps...> { static constexpr void(*fns[])()={do<ps>...}; }; }; template <typename matcht> template<int... ps> constexpr void(*manager<matcht>::table<0,ps...>::fns[sizeof...(ps)])(); //process.h #include "manager.h" template<typename matcht> class process { public: void send(manager<matcht>& mgr ); private: typename manager<matcht>::template table<5> _processtable; }; //proce

split a data.table in R by key -

i have data.table object in r split along keys. >mytable[1:11] id length hash 1: 2578 52.5 26566273 2: 4066 52.5 26566273 3: 2578 53.5 26566273 4: 4066 53.5 26566273 5: 2207 29.5 54352910 6: 3719 29.5 54352910 7: 5166 9.5 613353882 8: 5167 9.5 613353882 9: 5169 9.5 613353882 10:5170 9.5 613353882 11:5171 9.5 613353882 first_hash , length 2 keys output list each key of id column so looks like first_hash length id_list 26566273 52.5 [1] 2578 4066 26566273 53.5 [1] 2578 4066 54352910 29.5 [1] 2207 3719 613353882 9.5 [1] 5166 5167 5168 5169 5170 5171 or kind of list... i think plyr can give answers this, prefer data.table way the ultimate goal create pairs of id having same key aware of function expand.grid thanks we group 'hash' , 'length' , place 'id' in list . dt <- mytable[,list(id_list=list(id)) , =.(first_hash=hash, length)] dt # first_hash length

sql - over partition by without an aggregate function, avoiding group by -

is there way in use window function over (partition column) without using aggregate function? i have lots of columns , i don't want use group by since i'll have specify both in select , in group by. i giving syntax example, needs somehow corrected (by guys cause it's not working when adapt on real query(real query long , time consuming explain go example)). let's assume works: select *, ( select sum (column1) on (partition column2) sumcol1 mytable column20 = column21 ) mytable ok, want same thing 2 changes: 1: no aggregate function 2: column1 time date (i wouldn't able use aggregate function date far know, trying eliminate aggregate, shouldn't matter.) what want should somehow (query not correct, since i'm trying achieve) select *, ( select column1 on (partition column2) col1new mytable column20 = column21 ) mytable sql server 2012 thanks edit: sample data: rn rd rnc

angularjs - IE 9 change url javascript -

i want change url on button click, now: $scope.onclick = function(url) { document.location=url; $scope.ispopoveropen = false; } when url=workspace/#/ the page url becomes: localhost:8080/workspace/#/dashboard . problem in ie 9 page url becomes: localhost:8080/workspace/workspace/#/dashboard page not found error. maybe knows why , solution this? i use angular, maybe can give right functionality. use $location.path("/folder/" + url); include service angular.module('app') .controller('myapp',[$location, function(...

c++ - Initialization during construction? -

i wrote following code: struct a{ int a; int b; a(int c): a(c), b(a){ } }; int main() { b(10); } now, i'm not sure initializing b a a(c), b(a) . ok or may cause ub? yes, okay. members initialized in order declared in class. note order of initializers doesn't matter, work (but not practice): struct a{ int a; int b; a(int c): b(a), a(c) { } }; but not work: struct a{ int b; int a; a(int c) : a(c), b(a) { } }; some compilers can give warning if initializer order doesn't match declaration order.

Error in ASP.NET 5 application: System.IO.FileNotFoundException Could not find file 'CustomLibrary.resources' -

i referencing standard .net 4.5 library asp.net 5 mvc 6 project. code in library works .net 4.6 application, when use mvc 6 project shows error: system.io.filenotfoundexception not find file 'customlibrary.resources'. the reference library strings embeded resx file. the stack trace error is: at system.reflection.runtimeassembly.internalgetsatelliteassembly(string name, cultureinfo culture, version version, boolean throwonfilenotfound, stackcrawlmark& stackmark) @ system.resources.manifestbasedresourcegroveler.getsatelliteassembly(cultureinfo lookforculture, stackcrawlmark& stackmark) @ system.resources.manifestbasedresourcegroveler.grovelforresourceset(cultureinfo culture, dictionary`2 localresourcesets, boolean tryparents, boolean createifnotexists, stackcrawlmark& stackmark) @ system.resources.resourcemanager.internalgetresourceset(cultureinfo requestedculture, boolean createifnotexists, boolean tryparents, stackcrawlmark& stackmark) @ system.resou

python - PYCHARM import caffe error -

Image
i have tried several ideas make caffe work on pycharm. i have added path pycharm well. import caffe doesnt work in pycharm works in terminal. the caffe folder in pythonpath. fixed issue. had edit /etc/ld.so.conf file , add lib dir of cuda libraries. in case added: /usr/local/cuda-7.5/lib64 then run sudo ldconfig in terminal , restart pycharm. should work.

android - Top/Bottom Padding for Spinner -

Image
how specify spinner in android padding on top/bottom of first/last item? see sample of goolge below (8 dp spacing). spinner not support multiple view types. issue . i suggested using dialog showing list. edited according comment resolved problem question

java - SQL error or missing database(no such table:Employeeinfo) using sqlite and net beans -

this project in systems analysis , design class, new java, have taken basic course, , databases,never taken course. first time posting on site, apologize if code format little messy. here code class load db. import java.sql.*; import javax.swing.*; public class javaconnect { connection conn=null; public static connection connecrdb() { try{ class.forname("org.sqlite.jdbc").newinstance(); connection conn=drivermanager.getconnection ("jdbc:sqlite:macintosh hd\\users\\matthewslauson\\documents\\workspace\\schedulesystem.sqlite" ); joptionpane.showmessagedialog(null, "connection successful"); return conn; }catch(exception e) { joptionpane.showmessagedialog(null, e); return null; } } } the connection database works fine, when try input username , password error. here code login screen. assure table employeeinfo exist in schedulesystem.sqlite. import j

Storing dates as integers in CouchDB/Cloudant -

i'm using ibm's cloudant (couchdb) data store. i'm planning on storing dates integers in format yyyymmdd instead of javascript dates. there couchdb functionality i'd missing out on not storing them javascript dates? other reason shouldn't this? i've read q&a: what's best way store datetimes (timestamps) in couchdb? , there appears no objections storing dates in format. doesn't answer built-in functionality might lost. you wouldn't losing functionality make date useful processing in map function either secondary index/view, search index or part of cloudant query. the downside formatting them such, make more difficult on use javascript date functions modify date needs within map function.

iOS UITableView : clear section button -

Image
i need add clear button in table view section header. same 1 in notification center. when user clicks it, 'x' change 'clear'. if s/he clicks again, app perform action. click outside button, 'clear' 'x' how can make this? in advance unfortunately not come out of box. have create own custom section header view. custom header view contains uilabel on left side. on right side put uibutton has title "x". when user taps on button, change title "clear" , state .selected . clear table view section when button tapped , state .selected : func setupbutton() { let button = uibutton() button.settitle("x", forstate: .normal) button.addtarget(self, action: selector("didpressbutton:"), forcontrolevents: .touchupinside) addsubview(button) } func didpressbutton(button: uibutton) { if button.selected { // clear table view section } button.settitle("clear", forstate: .

asp.net - server side code not executing after returning true on jquery -

i trying upload files using upload file control asp.net. now wired button click on jquery , return true if passes validation. here jquery code: $("#button1").click(function () { var empty = checkempty(); if (!empty) { var accepttype = determintype(); if (accepttype) { var acceptsize = determinesize(); if (acceptsize) { alert('im here'); return true; } else { $.ambiance({ message: "file big check mugshot size size should not exceed 100kb!", title: "file type restriction!", type: "error", timeout: 10, fade: true }); return false; } } else { $.ambiance({ message: "file type restricted jpeg!", title: "file type restriction!", type: "error", timeout: 10, fade: true }); return false; } } else { $.ambiance({

matlab - How to use mexsh to link non-.o object files into a mex executable? -

i'm using matlab 2015b on ubuntu 14.04, gcc 4.8.4. i'm trying manage c , c++ code in 1 makefile. the c , c++ code need use different compiler flags. solve problem i'm trying compile .cpp files .xo object files , .c files .o object files, can use different recipe .xo , .o respectively. here's sample of makefile: cc=gcc cxx=g++ mex=/usr/local/matlab/r2015b/bin/mexsh cflags=-wall -fpic -std=gnu99 cxxflags=-wall -fpic -std=gnu++11 includes=/usr/include/boost lflags=-lm -l/usr/lib -lboost_system -lboost_regex all: hello asio hello: hello.o # hello world example, c code, works fine $(cc) -o $@ $^ $(lflags) asio:asio.xo # boost asio example, c++ code, works file $(cxx) -o $@ $^ $(lflags) mexasio:asio.xo $(mex) $^ $(lflags) ############ here, .xo files input ############ mex gives "no input file" error clean: rm -f *.o rm -f *.xo %.o: %.c $(cc) -c -o $@ $< $(cflags) -i

android - GreenDao select in range with BETWEEN operator -

i use greendao , have entity defined class: dot { string name; float value; } and want extract database dots have value in between value - 1 , value + 1 . sql query should lik this: select * dot value between(value-1, value+1) can same in greendao, maybe: querybuilder<dot> query = dotdao.querybuilder(); query.where(dotdao.properties.value.between(dotdao.properties.value-1, dotdao.properties.value+1)); list<range> rangelist = query.list(); is possible or have use raw queries? you can use , operator. for example: querybuilder<dot> query = dotdao.querybuilder(); list<range> rangelist = query.where(dotdao.properties.value.ge(value - 1), dotdao.properties.value.le(value + 1)) .list(); details http://greendao-orm.com/documentation/queries/

php - Share website content on facebook -

i design website using html , php , mysql , use open graph meta tag share website on facebook <meta property="og:title" content="" /> <meta property="og:type" content="" /> <meta property="og:image" content="" /> <meta property="og:url" content="" /> <meta property="fb:admins" content="" /> i use meta tag in page news , essay , problem example want share 1 of website news on facebook , want share correct content , when try share , share content used in meta tag , want share news title, image , content.. my website work dynamically mysql , of website content image , text saved in database . my question how dynamically change share content of separate page using open graph meta tag or thing . i don't understand exacly want us. can vary depending on how site script work. must set og meta content how show page content. example: <met

ios - settings values of viewDidLoad from XCTest -

i writing unit test cases project of mine , having many issues first time writing test cases. app typical login , navigationcontroller based application. writing test case viewcontroller setting values in viewdidload. these values fetched nsuserdefaults , previous viewcontroller. have created object of viewcontroller in setup() method of xunit following: let storyboard: uistoryboard = uistoryboard(name: "main", bundle: nsbundle(forclass: self.dynamictype)) viewcontroller = storyboard.instantiateviewcontrollerwithidentifier("alertdetailsviewcontroller") as! alertdetailsviewcontroller now when run setup there crash there no object should have received class before loading. there way can set values viewcontroller before loading of viewdidload()? how should test nsuserdefaults. need save/retrieve values nsuserdefault. there way mock it? regards pankaj i know late reply..but new viewers... var alertdetailviewcontroller: uiviewcontroller? weak v

Error loading shapefile in Arcobject c# : Exception from HRESULT: 0x80040228 -

i want read shapefile arcobject , c#. used arcgis snippet , write follow code: esri.arcgis.runtimemanager.bind(esri.arcgis.productcode.desktop); iworkspacefactory wsf = new shapefileworkspacefactory(); iworkspace ws = wsf.openfromfile(@"e:\data\shap file iran\irn_adm\", 0); ifeatureworkspace fws = ws ifeatureworkspace; ifeatureclass fc = fws.openfeatureclass("province.shp"); but in line 3 returned error: exception hresult: 0x80040228 whats matter?

php - URL string from database -

i have foreach loop running all records database , displaying them in list on page. i'm trying have clickable button load page show information list item. so lists records view button on each one, when click view button load 2nd view , display item clicked, if makes sense the first view list items: <div class="row"> <div class="col-md-12" style="height: 225px;"> <?php foreach ($posts $webstore): ?> <div class="col-md-4 text-center thumbnail1234"> <?php foreach($webstore['images'] $image) : ?> <img class="img-responsive" src="<?php echo $image ?>"/> <?php endforeach; ?> <h3><?php echo $webstore['title']; ?></h3> <p>date added: <?php echo date('d-m-y', strtotime($webstore['crea

hadoop - invoice, colour, type, count -

i have table below: invoice| colour | type in_001 | red | d in_001 | red | d in_001 | yellow | e in_002 | red | h my desired result sort out invoice has more 2 items purchased , show count. see below, desired result: invoice | colour | type | count in_001 | red | d | 2 in_001 | yellow | e | 1 remark: in_002 not included due fact that, has 1 item purchased. i tried following command: select invoice, colour, type, count(invoice) t group invoice,colour,type having count(invoice)>1; the result is: invoice | colour | type | count in_001 | red | d | 2 please help. the group 3 invoice,colour , type. result only. can try below query achieve it:- select invoice,colour,type,count(invoice) t invoice in (select invoice t group invoice having count(invoice) >1) group invoice,colour,type

jquery - Change tag on hover - replace image with text -

i have image value , want able hover on image , change text (to show image means, because image rather small) i've tried using replacewith doesn't work when stop hovering. $(document).ready(function(){ $("#apples").hover(function(){ $(this).replacewith("<span id=\"apples\">apples: 10</span>"); }, function(){ $(this).replacewith("<span id=\"apples\"><img src=\"images/apples.png\" alt=\"apples\"/> 10</span>"); }); }); hopefully explained correctly. want switch out image of apple text says apples when user hovers on it. you need replace inner html of element, otherwise original element (which has hover event listener) ceases exist: $("#apples").hover(function(){ $(this).html("apples: 10"); }, function(){ $(this).html("<img src=\"images/apples.png\&q

Android: XML LayerList not showing correctly on API 10 device -

Image
so create arrow facing right popup window using wonderful example arrow have problem using api 10 devices. tried on api 16 , upwards , showing correctly. <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape> <solid android:color="@android:color/transparent"/> <size android:width="2dp" android:height="50dp"/> </shape> </item> <item android:bottom="20dp"> <rotate android:fromdegrees="-45" android:todegrees="45"> <shape android:shape="rectangle"> <solid android:color="@android:color/black"/> <corners android:radius="1dp" android:bottomrightradius="0dp" android:bottomleftradius="0dp&

html - :hover on a div with a border radius -

i'm having issue hovering , div border radius. when div has images inside , border radius, "hitbox" incorrect. hovering on of corners of div (where corners if didn't have border radius) causes hover style show. expect style show when mouse within circle. if there nothing in div, div's "hitbox" correct, surpasses border when there elements within it. i background image in div, i'd prefer not accessibility reasons. #test-wrapper { background-color: #eee; border: 4px dashed #999; display: inline-block; } #switcher { border-radius: 50%; overflow: hidden; position: relative; } #switcher, #switcher .first, #switcher .second { width: 100px; height: 100px; } #switcher .first, #switcher .second { position: absolute; top: 0; left: 0; } #switcher:hover .first { display: none; } <!-- used show "hitbox" switcher , has no effect on switcher --> <div id="test-wrappe

Can i achieve single sign on with openid -

i have been reading lot on single sign on , openid have checked documentation openid , single sign on on below link single sign on http://rashidi.zin.my/geek-talks/2009/06/30/php-mysql-curl-single-sign-on-with-multiple-domains.html http://www.opengroup.org/security/sso/sso_intro.htm http://www.authenticationworld.com/single-sign-on-authentication/ http://merbist.com/2012/04/04/building-and-implementing-a-single-sign-on-solution/ https://wiki.queensu.ca/display/itsd/single+sign-on https://github.com/jasny/sso#readme https://lw.microstrategy.com/msdz/msdl/940/docs/mergedprojects/websdk/topics/sso/sso_single_sign-on.htm openid http://openidexplained.com/ http://openid.net/pres/protocolflow-1.1.png -- flow diagram http://wiki.openid.net/w/page/12995226/run%20your%20own%20identity%20server simple concept understood on single sign on can explained below user hits domain1.com. domain1.com sees there's no session cookie. domain1.com redirects sso.com sso.com pre

ruby - rails routing list filter from html -

so want dropdown, able select or filter, drawings based on workcategory at. both models (drawings , workcategories) connected has_many drawings , belongs_to workcategories. drawing holds workcategory.id foreign key, , want filter it.this i've tried build <% @workcategories.each |workcategory| %> <li><%= link_to workcategory.name, workcategory_list_path(workcategory.id) %></li> <% end %> while in drawings controller i've added these : before_filter :list def list @drawingsz = drawing.order("drawings.id asc").where(:workcategory_id => @workcategory.try(:id)) end the problem is, whenever press 1 of workcategories inserted, shows me drawings. i've tried basic variation others, including routings. oh , talk routings, have : resources :workcategories :list, :controller => :drawings resources :drawings end resources :drawings any ideas ? i've browsed forums lot last night, , routes pages on

PHP - use method chaining to extends previous method -

this question has answer here: php method chaining? 7 answers how can additional method(such laravel), extends previous in chaining ? example: $page->loadfooter()->withextension("script_name") withextension() additional method, affect result of loadfooter() method ? in function return object, typically $this class page { public $footer; public function loadfooter() { $this->footer = file_get_contents("footer.html"); return $this; } public function withextension($script) { $this->footer = str_replace($this->footer, "</body>", "<script src='{$script}'></script></body>"); } } $page = new page(); $page->loadfooter()->withextension("script name");

r - Is ezPerm (of ez Package) an alternative for aovp (of lmPerm package)? -

i wondering if ezperm function (of ez package) appropiate alternative aovp (of orphaned , unsopported lmperm package)? the aovp function has been thepreferred option because works aov . ezperm faily easy use not sure if equivalent. , there coin package supposedly able permutation tests, have failed finding explanation.

javascript - How to optimize the ajax requests in Jquery? -

i building mobile app using jquery mobile, jquery , php back-end. problem in pages sending , receiving multiple ajax requests visibly slowing down performance , causes memory leaks leads crashing of app in low network connections what possible ways of optimizing ajax requests? note:- sending ajax requests periodically(like once in second) ajax sent based on events first off, correctly written ajax code not leak memory. so, if have leak, caused incorrectly written code, not using ajax. then, there number of optimizations can consider. combine multiple requests server 1 larger request. saves roundtrips server, saves bandwidth, saves battery , increases performance. don't poll every second. smarter how poll server. lengthen polling interval vary based on activity, switch "long polling" or switch websocket can server push no polling. analyze causing excessive memory consumption , fix bugs or redesign curtail that. there no reason lots of a

php - understanding the parameters passed to the array_reduce method -

i going through this online tutorial, , see below script: <?php include_once 'renderer.php'; class page { protected $renderers; public function add($renderer) { $this->renderers[] = $renderer; } public function render() { $content = ''; $content .= "--start of page--\n"; $content .= array_reduce($this->renderers , function($output , $r){ return $output .= $r->render()."\n"; } , ''); $content .= "--end of page--\n"; return $content; } } $page = new page(); $page->add(new blogrenderer()); $page->add(new articlerenderer()); echo $page->render(); lets zoom in the call array_reduce() call, $content .= array_reduce($this->renderers , function($output , $r){ return $output .= $r->render()."\n"; } , ''); i have 2 funcdamental questions here, there 2 paramete

javascript - How to single bind in ui-sref? -

i doing ng-repeat of list this: <div ng-repeat="x in myctrl.data" ui-sref="app.detail({id: x.id})"> <img ng-src="{{::x.image}}"> <h2>{{::x.name | characters:35}}</h2> </div> when monitor watcher, found watcher increases when list getting longer. if remove {id: x.id} ui-sref , no matter how long list is, number of watcher remains same. so, question how can single binding in ui-sref ? yes, if @ api come know that, adds watcher this line & can't avoid that. you rid of watcher redirection state thing own, have ng-click="redirect('app.detail', {id: x.id})" event there instead of having ui-sref directive, , redirect method redirect state using $state.go . code $scope.redirect = function(statename, param){ $state.go(statename, param) }

Couchbase with Spring data using spring config example -

i newbie couchbase. using spring in application through trying connect couchbase in local. trying create couchbase template(similar done in mongo template) in configurations below: spring configuration repository using couchbase template but when start application, autowiring errors , unable fetch anything. can please above issue? or if can share sample code extract data couchbase using sprin-data & spring configuration? please help! so using spring data couchbase 1.4? framework offers dedicated namespace spring xml configuration should use instead of attempting call constructors: xml configuration <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:couchbase="http://www.springframework.org/schema/data/couchbase" xmlns:context="http://www.springframework.org/schema/context" x

java - Spring MVC RestController scope -

i have following spring controller: package hello; import java.util.concurrent.atomic.atomiclong; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.bind.annotation.requestparam; import org.springframework.web.bind.annotation.restcontroller; @restcontroller public class testcontroller { private final atomiclong counter = new atomiclong(); @requestmapping("/test") public string test() { long val = counter.incrementandget(); return string.valueof(val); } } each time access rest api, returns incremented value. learning java , wondering why not return 1 new instance of atomiclong must have been created each time request comes. no, testcontroller bean singleton. @restcontroller annotation declares spring @component scope default singleton . documented in @scope annotation: defaults empty string ("") implies scope_singleton. this means same instance of testcontro

android - gson read same field with different structure -

note : can achieved creating 2 different gson models, i'm looking workaround. i have model work multiple json responses. there response : items: [ { kind: "youtube#playlistitem", etag: ""fpj9onby0rl_lqylg6rocj9h9n8/jqbctlu8tym8b1fxgo14gnzrfg4"", id: "pluq7i1jjqkb4ljargcpwsp62l7ic06ike2lde0bxle18", that conflict 1 (notice same id field different type. above id string , other class ) : items: [ { kind: "youtube#searchresult", etag: ""fpj9onby0rl_lqylg6rocj9h9n8/hdiu49vmd5aphkun5yz9gtljg9a"", id: { kind: "youtube#playlist", playlistid: "plh6xqivlqjsf3ynkvec1axub1dqwvgwfo" }, is possible use single gson model can read both responses? thanks lot time update this inside model , changed id variable string class : private id id; public class id { private string id; private string kind; private string playlistid; public string getid() { return id;

ios - Swift if statement in CellForRowAtIndexPath -

i have tableview want display different cells depending on variable segueddisplaymonth set to. possible , if can hint on how this? i've tried following doesn't seem work. func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("income cell", forindexpath: indexpath) let income = myincomearray[indexpath.row] if segueddisplaymonth == "all" { var text = "\(income.money) kr" cell.textlabel?.text = text cell.detailtextlabel?.text = income.name } return cell } i thought maybe need reload data after changing segueddisplaymonth gets changed different tableview , through segue . call mctableswag.reloaddata() once segueddisplaymonth changed. (likely call in function changes segueddisplaymonth . alternatively reload certian cells method reloadvisiblecellsatindexpath(...) (im not sure

php - Laravel updateOrCreate And Increment Value -

in app, i'm saving customer interests depending on viewing products, adding carts, orders , category viewing. now here customerinterestcontroller $customerinterest = [ 'user_id' => auth::user()->id, 'interest' => $category_id, ]; $data = [ 'cart_interest' => ($column == 'cart') ? 1 : 0, 'order_interest' => ($column == 'order') ? 1 : 0, 'category_interest' => ($column == 'category') ? 1 : 0, 'view_interest' => ($column == 'view') ? 1 : 0, ]; try{ (new customerinterest)->insertcustomerinterest($customerinterest, $data); }catch(exception $e){ dd($e); } and here customerinterest model public function insertcustomerinterest($customerinterest = [], $data = []){ return $this->updateorcreate($customerinterest, $data); } there no problem inserting database. works. my

c# - How to add datasource to textbox in visual studio 2015 -

in form have drop down list displays products and textbox should display price selected product my question how can add datasource textbox ? you can add event-handler drop-down list gets called, when user selects different value in drop-down list. then change value of textbox in event-handler method. hope helps, please comment if need more information.

mysql - Business Objects: Comparing Rows -

i have file containing several rows of data. column called 'description' contains data duplicated , in alphabetical order matching rows together. data can in 4s, 6s etc, but, number of rows (see row 20 23). i need create record count (number of records match) , movement count (number of movements each record count). language in excel easy (see diagram), i'm not sure how replicate using business objects. i've tried using 'previous()', so: =if([description]=previous([description])) then~ but whatever try after 'then' seems create circular reference error because keep trying increase variable one. hope makes sense. can help, column w. image link to column "movements" can create fowling function , select delimiter // create function rownr (s char(64)) returns int deterministic begin if s = @rownr_oldval set @rownr_nr:=@rownr_nr+1; else set @rownr_nr:=1; end if; set @rownr_oldval:=s;

javascript - access ng-resource in function through $scope causes infinite loop -

i have rails app , access 2 models through json api using ng-resource. in template display list of first model "orders": <li ng-repeat="order in orders"> order {{order.id}}: product: {{showproduct(order.product_id)}} </li> each "order" contains product_id . access second model ("products") , display inside ng-repeat correct "product" id product_id of corresponding "order". to achieve thought of using function showproduct() , use order.product_id argument. when causes infinite loop keeps making requests database. here important part of app.js var app = angular.module('shop', ['ngresource']); app.factory('models', ['$resource', function($resource){ var orders_model = $resource("/orders/:id.json", {id: "@id"}, {update: {method: "put"}}); var products_model = $resource("/products/:id.json", {id: "@id"}, {upda

what is the differences in the different pre-build spark edition -

i don't know differences in different pre-built edition spark.such as,pre-built 2.4 hadoop , later , 2.3 hadoop. difference tell whether spark edition need designated kind of hadoop edition,such 2.4 , 2.3 . sorry,my english poor.if don't understand question,wish tell me. think you. i think pre-build apache spark distribution hadoop 2.4 , later using own hadoop hdfs file system.this file system in file.but choices doesn't have hadoop file system use use hadoop file system in computer. hope use understand , if use testing should install pre-build. have nice days :)

amazon web services - wurfl on elastic beanstalk -

i have setup php environment on elastic beanstalk , uploading code through eb deploy command. ec2 instance created auto-scaling group , can connect using putty. want install wurfl on ec2, want know : 1) if install wurfl on current running ec2 instance, installed on other instance created auto-scale group ? 2) if not, how can install wurfl on beanstalk no, not modify elastic beanstalk instances manually. not replicate (existing/new) instances. if want customize instances, can create .ebextensions scripts. please take http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html .

text to speech - Watson TTS doesn't allow to choose voice -

created bluemix app proper credentials , using fiddler text speech(tts) record prompts. recordings use default "michael" voice. want allison. if try passing in "voice", following error, when specify "michael" choice: { "code_description": "bad request", "code": 400, "error": "the argument(s) [u'voice'} not allowed." } this payload: { "text": "hello,, dora. how today?", "voice": "en-us_allisonvoice" } i have developer account, need sign use "voice"? if pass in default "michael"? i think problem in way specifing voice parameter. voice , text parameters can send query parameters in get. examples 1. curl curl -u "{username}":"{password}" "https://stream.watsonplatform.net/text-to-speech/api/v1/synthesize?voice=en-us_allisonvoice&text=hello%2c%20this%20is%20dora.%20how%20are%20y

linux - Where do my Python prints got with Flask deployed under nginx with uWSGI? -

following this tutorial i've setup nginx uwsgi serve website built in flask , , things work fine now. i want debug use basic print statements in code. unfortunately have no idea result of these print's go? i've tailed following log files, don't see print's in there: /var/log/uwsgi/emperor.log /var/log/uwsgi/myapp_uwsgi.log /var/log/nginx/access.log /var/log/nginx/error.log does know can see result of prints? normal print goes on stdout , nginx log stderr. you should use app.logger module of flask instead. have @ http://flask.pocoo.org/docs/0.10/errorhandling/