Posts

Showing posts from January, 2010

c++ - Undefined reference to template class destructor -

this question has answer here: what undefined reference/unresolved external symbol error , how fix it? 27 answers i had problem template class queue had been implementing functions in implementation file, saw this answer , resolved implementation in header file: queue.hpp #ifndef queue_hpp #define queue_hpp #include "instruction.hpp" #include "microblazeinstruction.hpp" #include <memory> #include <list> template<typename t> class queue{ public: queue(unsigned int max): maxsize{max} {}; ~queue(); std::list<t> getqueue(){ return queue; }; void push(t obj){ if(queue.size() < maxsize){ queue.push_front(obj); } else{ queue.pop_back(); queue.push_front(obj); } }; private: queue(const queue&); queue& o...

javascript - How to use button reference in jQuery? -

i using simple ajax uploader https://github.com/lpology/simple-ajax-uploader https://www.lpology.com/code/ajaxuploader/docs.php my file upload button <div class="form-group"> <input type="button" id="upload-btn1" class="btn btn-success clearfix" value="choose file"> </div> i trying use onchange callback function of simpleajax uploader onchange( filename, extension, uploadbtn ) this function called when user selects file. the function gets passed 3 arguments: a string containing filename a string containing file extension a reference button triggered upload i facing problem 3rd parameter of onchange function uploadbtn button reference can different digits, wonder how can use reference change upload button text when file selected! thanks. this bug in simple ajax uploader. for more info please see issue #115

How do I compare strings in Java? -

i've been using == operator in program compare strings far. however, ran bug, changed 1 of them .equals() instead, , fixed bug. is == bad? when should , should not used? what's difference? == tests reference equality (whether same object). .equals() tests value equality (whether logically "equal"). objects.equals() checks nulls before calling .equals() don't have (available of jdk7, available in guava ). consequently, if want test whether 2 strings have same value want use objects.equals() . // these 2 have same value new string("test").equals("test") // --> true // ... not same object new string("test") == "test" // --> false // ... neither these new string("test") == new string("test") // --> false // ... these because literals interned // compiler , refer same object "test" == "test" // --> true // ... should call objects.equals() o...

ios - Dots on UIBarButtonItem -

Image
i seeing dots trailing 1 of uibarbuttonitems (see image). don't show up; random. though have noticed opening modal or rotating device tends make them appear or disappear. specific button 1 it. button opens split view controllers master view. i thought icon size big, changed icon , icon size, did not fix it. not setting title, icon. following ios hig specifies icons on navigation bar 22x22, 44x44 , 66x66. has seen this? did around it? did expand button itself. text/icon big , button small.

css - Flex box and percentage width hiding image -

consider following html <menu class="main"> <menuitem><img src="blah" class="foo"></menuitem> </menu> these elements styled using flexbox menu { display: flex; margin: 0; align-items: stretch; } menuitem { flex: 1 0 auto; align-items: center } .foo { display: flex; flex: 0 0 25%; max-width: 25%; margin-left: auto; //align far right } this works expected except if flex , width percentages, when resize screen, rather staying on right edge of menu bar begins disappear. there way image stay pushed right screen resized? please note i'm using chrome test, have observed same behavior on safari. i'm using autoprefixer take care of vendor prefixes. edit here plunk. http://plnkr.co/edit/bnupwqnbdx9jm2e7zvna?p=preview when resize viewport, playstation logo moves off screen instead of moving fit available space. just add flex-direction:column menu and change: .foo { max-widt...

ruby - rails - Find objects with duplicate attributes -

if have array of object foo how can find , return objects duplicate values specific attributes? instance, want return objects have duplicate values both foo.x , foo.y i using rails 3.2 , ruby 1.9 i looking like: one = foo.create!(:x => 1, :y => 2, :z => 3) 2 = foo.create!(:x => 1, :y => 2, :z => 6) 3 = foo.create!(:x => 4, :y => 2, :z => 3) arr = [one, two, three] arr.return_duplicates_for_columns(foo.x, foo.y) = [one, two] i'm not sure solution or how work you, should work. foos = foo.some_ar_query_that_returns_some_foos grouped_foos = foo.group_by {|f| [f.x, f.y]} grouped_foos hash. keys array of x , y values. values array of foo instances same values. element of hash size of value more 1 has duplicates.

javascript - Scrollbar directive not working in Angularjs -

i'm trying use ng-scrollbar in project implementing scrollbar somehow it's not working me. have included following files in index.html: <link rel="stylesheet" href="bower_components/ng-scrollbar/dist/ng-scrollbar.css" /> <script src="bower_components/ng-scrollbar/dist/ng-scrollbar.js"></script> also, jade template looks this: <li id="notification-button" class="dropdown notifications-menu"><a href="#notifications" data-toggle="dropdown" aria-expanded="false" class="dropdown-toggle"><i class="fa fa-bell-o"></i><span class="label label-warning">{{user.notifications.count}}</span></a> <ul class="dropdown-menu"> <li class="header">{{user.notifications.count}} notifications.</li> <li> <div ng-scrollbar="ng-scrollbar"> <...

linux - docker run a shell script in the background without exiting the container -

i trying run shell script in docker container. problem shell script spawns process , should continue run unless shutdown script used terminate processes spawned startup script. when run below command, docker run image:tag /bin/sh /root/my_script.sh and then, docker ps -a i see command has exited. not want. question how let command run in background without exiting? you haven't explained why want see container running after script has exited, or whether or not expect script exit. a docker container exits container's cmd exits. if want container continue running, need process keep running. 1 option put while loop @ end of script: while :; sleep 300 done your script never exit container keep running. if container hosts network service (a web server, database server, etc), typically process runs life of container. if instead script exiting unexpectedly, need take @ container logs ( docker logs <container> ) , possibly add debugging script...

angularjs - Dynamic Select List Default Selected Item - Angular JS -

i have code listed below works fine, when attempt add ng-model , related ng-change select, empty option added. understanding why, because on init selectedoption ng-model empty. what want set default value when can use ng-change set options isselected value true when user selects it. i'm not sure how go this, have no issues doing when i'm working static generated select list, reason can't figure out dynamic generated list. any input appreciated! <div ng-repeat="optiontype in productdetailmodel.optiontypes"> <select name="{{optiontype.optiontypename}}"> <option ng-repeat="option in optiontype.options" value="{{option.optionvalue}}">{{option.optionvalue}} </option> </select> </div> here's plunkr mocked give basic idea of have in mind: http://plnkr.co/edit/xbdfc0xzdwsf0mbifzov?p=preview the initial option blank beca...

c# - What is a NullReferenceException, and how do I fix it? -

i have code , when executes, throws nullreferenceexception , saying: object reference not set instance of object. what mean, , can fix error? what cause? bottom line you trying use null (or nothing in vb.net). means either set null , or never set @ all. like else, null gets passed around. if null in method "a", method "b" passed null to method "a". the rest of article goes more detail , shows mistakes many programmers make can lead nullreferenceexception . more specifically the runtime throwing nullreferenceexception always means same thing: trying use reference, , reference not initialized (or once initialized, no longer initialized). this means reference null , , cannot access members (such methods) through null reference. simplest case: string foo = null; foo.toupper(); this throw nullreferenceexception @ second line because can't call instance method toupper() on string reference pointing null ....

android - Event on fragment replace? -

i saw when execute fragmenttransaction fragmenttransaction = fragmentmanager.begintransaction(); myfragment myfragment = new myfragment(); fragmenttransaction.replace(r.id.parent, myfragment, "myfragment"); fragmenttransaction.addtobackstack(null); fragmenttransaction.commit(); there no method called on old fragment. tried with: onstop(); onpause(); ondestroy(); ondetach(); no 1 called, why? maybe there typing error in post or big misunderstanding. first there no fragmentmanager.replace() , perhaps meant fragmenttransaction.replace() . if so, try ondetach () , ondestroy () again. example, make sure have @override attribute: @override public void ondetach() { ... }

sql - Creating and using a temporary table to return a specific row, instead of running the query repeatedly -

i have program query being run repeatedly single row number (here called "partition"). declare @partition int = {0} ;with candidates ( select column1, column2, row_number() on (order table1.column1) rownumber, ... ) select c.column1, c.column2, candidates c c.rownumber - 1 = @partition instead of running query every time want specific row, i'd query write temporary table , return first row if partition zero, , return row temporary table if partition not zero. how go doing that? can done in single query? i not stated question why not select column1, column2, ... order column1 offset @partition rows fetch next 1 rows only; is complex query want cache? ok cache declare @partition int = {0} if @partition = 0 begin truncate table tablecache; insert tablecache (column1, column2, rownumber) select column1, column2, row_number() on (order table1.column1, column2) rownumber ......; end select column1, column2 ...

php - Convert mysql_result to mysqli_result -

i need help. convert mysql_result mysqli_result. function user_exists($username) { $username = sanitize($username); return (mysql_result(mysql_query("select count(`user_id`) `users` `username` = '$username'"), 0) == 1) ? true : false; } function user_exists($username) { $username = sanitize($username); return (mysqli_result(mysqli_query($con7,"select count(`user_id`) `users` `username` = '$username'"), 0) == 1) ? true : false; } i tried adding code. still not working. function mysqli_result($res, $row, $field=0) { $res->data_seek($row); $datarow = $res->fetch_array(); return $datarow[$field]; } edited. $con7 such $con7 = mysqli_connect('localhost','root', '', 'database') or exit($connect_error);

javascript - Meteor Accessing a single item in a collection -

i new not meteor script in general. having issues program. have collection storing times. want display each time in it's own div. have collection set this. timeslots = new mongo.collection('times'); timeslots.insert({time: "8:00am"}); timeslots.insert({time: "8:30am"}); timeslots.insert({time: "9:00am"}); timeslots.insert({time: "9:30am"}); a helper function template.available.helpers({ 'newtime': function(){ return timeslots.find() } }); i want access each time put in own div. div 8:00am 1 8:30 etc. my template html is <div class="col-sm-2 available open" id="opentime"> <h2 class="time"> {{#each newtime}} <p>{{time}</p> {{/each}} </h2> <p class="text"></p><br> <p class="text"></p><br> </div> h...

android - What is an Admob Session? -

Image
on admob console ( https://apps.admob.com/#home ), there section called "analyse" session information. what information? , why of app have session information? did not add special codes these apps. also number of impressions same (for apps , without session information) sessions represent durations users spend interacting app. according the docs : sessions: total number of sessions of linked apps. session period of time user interacts app. usage data (screen views, events, ecommerce, etc.) associated session. avg. session duration: average duration of sessions of linked apps. users: sum of active users of each of linked apps during requested time period. hope helps

Automate Excel Reports from Mysql workbench -

i work small start up, have mysql database. boss wants reports on consistent basis , i'm trying figure out how automate these reports created every few days. boss likes see reports in excel format. i have been doing research , came across mysql excel. using excel 2013. my first question is is mysql excel best tool job? i tried downloading mysql excel told me install visual studio tool runtime, install? any guidance helpful you can run query using script create .csv file alternate xls can open file in xls , rename it. select * outfile '/tmp/result.csv' fields terminated ',' optionally enclosed '"' lines terminated '\n' table; then rename file .csv xls. or https://www.mysql.com/why-mysql/windows/excel/import/ http://www.w3resource.com/mysql/exporting-and-importing-data-between-mysql-and-microsoft-excel.php

javascript - How to change where jQuery input is displayed -

the problem is: http://trulydesigns.com/horoscope/ when press submit after entering form, value displayed in input box below in separate div. for example: http://whatismysign.net/ function sunsign() { document.form1.date.selectedindex; document.form1.month.selectedindex; document.form1.sign.value; if (document.form1.month.selectedindex == 1 && document.form1.date.selectedindex <=19) {document.form1.sign.value = "capricorn";} if (document.form1.month.selectedindex == 1 && document.form1.date.selectedindex >=20) {document.form1.sign.value = "aquarius";} if (document.form1.month.selectedindex == 2 && document.form1.date.selectedindex <=18) {document.form1.sign.value = "aquarius";} if (document.form1.month.selectedindex == 2 && document.form1.date.selectedindex >=19) {document.form1.sign.value = "pisces";} if (document.form1.month.selectedindex == 3 && document.form1.date.selectedindex ...

google analytics api - Why is my redirect to the Terms Of Service page no longer working? -

i have program automatically creates analytics account using provisioning api. program creates accountticket, grabs accountticketid, redirects user terms of service page, per analytics provisioning api guidelines, using url " https://www.google.com/analytics/web/#management/termsofservice//?api.accountticketid= " when working, redirect me tos, scroll down , hit accept, , program continue on merry way. now, redirecting me url: " https://www.google.com/analytics/web/?et=&authuser=#provision/signup/ ". programs workflow: 1) log clients email address. 2) oauth code email. 3) using oauth code, generate temp oauth token. 4) create analytics account posting https://www.googleapis.com/analytics/v3/provisioning/createaccountticket using oauth token , necessary postdata. 5) accountticketid response , redirect user tos page. know why happening? i using .net program. i not using client library. accountticket creation working. i verified program grabb...

Karaf - running thread status after bundle restart -

i'm using karaf 3.0.2. let's suppose bundle b (id 100) has launched threads. happens these threads when execute karaf@root()> restart bundle 100 ...when running threads of bundle b still active? these threads terminated? if start threads in osgi bundle need take care of threads. if don't stop them keep on going. make sure stop threads in activator. to precise, no threads don't terminated! start them, stop them.

java - Setting instance variables in a loop -

i trying make minesweeper in java , created box class, instance variable ismine determines whether or not box mine. use setter set variable, although problem exists when use constructor instead. in main method when create , fill arraylist containing arraylists of boxes, use random number generator set ismine variables. inside same loop use fill arraylists. arraylist<arraylist<box>> boxlist = new arraylist<arraylist<box>>(); for(int i=0; i<10; i++){ boxlist.add(new arraylist<box>()); } for(int i=0; i<boxlist.size(); i++){ for(int j=0; j<10; j++){ double rand = math.random(); boxlist.get(i).add(new box()); boxlist.get(i).get(j).drawbox(i,j); rand = math.random(); if(rand>.2){ boxlist.get(i).get(j).setmine(false); } else{ boxlist.get(i).get(j).setmine(true); } } } howeve...

VBA : Open XML file with XSL in Excel -

i open xml file vba language on excel, when it, xsl ignored. here code : sub openfile() ' ' openfile macro ' name_file = application.getopenfilename("xml files (*.xml), *.xml") if name_file <> false workbooks.open filename:=name_file end if ' end sub thank answers you need use openxml method instead: workbooks.openxml filename:=name_file, stylesheets:=array(1)

Not sure why the VIEW does't work: Rails 4 nested attributes and has_many :through associaton in a form -

i followed page build app: rails 4 nested attributes , has_many :through associaton in form but shows nothing in view: (the weird thing when typed "f.fields_for :questionnaire_surverys |ff|" instead of right one, showed me ocrrect page. any suggestions appreciated. here models: questionnaire.rb class questionnaire < activerecord::base has_many :questionnaire_surveys has_many :surveys, through: :questionnaire_surveys accepts_nested_attributes_for :questionnaire_surveys end questionnaire_survey.rb class questionnairesurvey < activerecord::base belongs_to :questionnaire belongs_to :survey accepts_nested_attributes_for :survey end survey.rb class survey < activerecord::base has_many :questions, :dependent => :destroy accepts_nested_attributes_for :questions, :reject_if => lambda { |a| a[:content].blank? }, :allow_destroy => true has_many :questionnaire_surveys has_many :questionnaires, through: :question...

bitmap - wallpaper scrolling on android 4x and above -

another wallpaper question, setting using wallpaper manager found wallpaper doesnt scroll, tried different launchers same thing happening, after alot of research found android version issue , nobody has answered other question found 1 answer gets screen dimensions , bitmaps dimensions on android hive scales bitmap accordingly. bitmapwidth = (bitmapwidth * screenheight) / bitmapheight; this works! image scrolling image overstrectched im using method , playing screen height , width , bitmap height , width try , sit nicely want image scaled on device , scroll suggestions? so after playing alot found rather simple after getting dimensions screen height, , bitmap height , width , using bitmapwidth = (bitmapwidth * screenheight) / bitmapheight; i can pass new dimension bitmap height bitmapheight = bitmap_width; im new if bad solution please correct me tried on 2 different phones , 2 different tablets , works case, here full method call; private void setwal...

java - How to call WebApp with premain -

i have webapplication in java has 3 threads sends data program calls application , saves data (log files log4j) h2 database. now don't want have 3 threads more or less same. i'm trying inject code javassist , agent after tries think result want! if code right( i'll post later nice if take look) bytecode inserted 3 thread methods before called but.... i used tutorial http://appcrawler.com/wordpress/2013/01/02/simple-byte-code-injection-example-with-javassist/ and if want call application need write java -javaagent:myagent.jar foo says tutorial webapplication gets called other java program can call , agent inserts bytecode work? not, think. nice if tell me how or maybe how advance code don't need it. code: transform class (bytecode gets inserted) public class mytransformer implements classfiletransformer { @override public byte[] transform(classloader loader, string classname, class redefiningclass, protectiondomain protectiondomain, byte[] byt...

c# - Multiple applications using Oculus Rift -

is possible run 2 applications using oculus rift? first application used normal oculus rift application , display desktop ( www.vrdesktop.net ) , second 1 ask rift tracking information (such orientation) 1 doesn't use display. using win 8.1 x64, second application programmed in c#. yes. many applications want can access tracking information @ once. believe multiple applications can access display, although 1 has focus show anything.

spring - Interceptor for http outbound gateway -

has sprint integration http outbound gateway has configuration property add interceptor org.springframework.web.client.resttemplate ? i want intercept httprequest adding security information in request (like interceptor property in ws-ouboundgatewy) ,but not see interceptor configuration option in http outbound gateway?. do have other option achieve functionality ? you can inject <int-http:outbound-gateway> custom resttemplate bean using rest-template attribute on first one. but other side don't see mentions interceptor logic in resttemplate ...

service - Android Updating notification text causes memory usage -

so have service foreground notification launched when user navigates away activity. i update notification consistently every second string has time, every update causes memory usage go @ least 0.01 mb. here's code i'm using: mnotibuilder.setcontenttext(mbuilder.tostring()); mnotimanager.notify(notificationid, mnotibuilder.build()); i've tested string builder i'm using not causing it. i don't know why happening, should worried @ all? i'm stickler when comes resource usage i'm trying right. well wouldn't worry much. each time build new notification, take memory. android doesn't run garbage collection cycle long have enough memory, meaning old notification stay around while.

xmlbeans - Gradle plugin for XML Beans -

i trying write gradle plugin xml beans. have started 1 of 'hello gradle' plugin examples, , plugin published r. artavia here . plugin went straight jar - trying generate source. generated source must compiled other project source , included in single jar. other goals include - full plugin - should need "apply plugin: 'xmlbean'" - can configure source/code gen location , features if want - detects whether needs rebuilt. (well, eventually!!!) i off pretty start, blocked defining new sourceset. getting error "no such property 'srcdirs'" (or 'srcdir'). seems there have define someplace make new sourceset work cannot find it. have tried several different syntaxes (with/without equal sign, brackets, srcdir/srcdirs, etc. - nothing working... what need inside plugin make new sourceset entry recognized? thank you! jke file: xmlbean.gradle (includes greeting plugin moment debugging) apply plugin: xmlbean apply plugin: '...

c# - Error when creating a user {"odata.error":{"code":"Request_BadRequest" -

i trying create azure active directory user using adal , error: {"odata.error":{"code":"request_badrequest","message":{"lang":"en","value":"property value required empty or missing."},"values":null}} stack trace: @ system.data.services.client.saveresult.handleresponse() @ system.data.services.client.basesaveresult.endrequest() @ system.data.services.client.dataservicecontext.endsavechanges(iasyncresult asyncresult) @ system.threading.tasks.taskfactory`1.fromasynccorelogic(iasyncresult iar, func`2 endfunction, action`1 endaction, task`1 promise, boolean requiressynchronization) --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) @ system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) @ microsoft.azure.activedirectory.graphclient.extensions.da...

python - uwsgi is hanging under high pressure -

i trying uwsgi: to so, created python virtual envionment , installed uwsgi in it. i created foobar.py sample file documentation : def application(env, start_response): start_response('200 ok', [('content-type','text/html')]) return [b"hello world"] and started uwsgi proposed in documentation : uwsgi --http :9090 --wsgi-file foobar.py --master --processes 4 --threads 2 --logto /tmp/uwsgi.log then used 'ab' make small benchmark, after 7000 requests, bench hung, no reason (no message in logs) : $ ab -n 10000 -c 100 http://127.0.0.1:9090/ apachebench, version 2.3 <$revision: 655654 $> copyright 1996 adam twiss, zeus technology ltd, http://www.zeustech.net/ licensed apache software foundation, http://www.apache.org/ benchmarking 127.0.0.1 (be patient) completed 1000 requests completed 2000 requests completed 3000 requests completed 4000 requests completed 5000 requests completed 6000 requests completed 7000 requests ...

javascript - Calling another html template from a django template. (Database used is mongoDb) -

i starter django. i creating login page if username/password exists in database(mongodb). takes page. my template follows: <html> <head> <title>login page</title> </head> <body> <h1>simple login page</h1> <form name="login"> username<input type="text" name="userid"/> password<input type="password" name="pswrd"/> <input type="button" onclick="check(this.form)" value="login"/> <input type="reset" value="cancel"/> </form> <ul> {% item in employee %} {% if item.name == form.userid.value && item.password == form.paswd.value %} ***"""""one more check item.field ::: if(field =="a") take page:1.html else take page2.html"""*** {% else %} **wrong password pop up**{% en...

objective c - Is there any drawback in creating a framework with swift -

can framework created swift support objective-c projects? yes, framework written in swift can imported , used in objective-c projects. however it's more convenient write frameworks in objective-c need 1 version. people using both swift , objective-c can import framework without problems. if write framework in swift , wants install project written in incompatible swift version - won't work! you need set branches , have project framework compiled under many version of swift incompatible. using swift 1.0 can't rung swift 1.2 or 2.0, using 2.0 can't use 1.2 or 1.0.

mfc - How can I show the computers operating system in C++? -

i making mfc dialog based application , function read data project , pc , copy data clipboard. have code needed transfer data external project, little stuck on how going operating system data , copy data clipboard. this code have far. void cbugsdlg::onbnclickedbtncopy() { cversiontranslatomatic ver(::getdesktopwindow()); cstring version = ver.getmajorminorversionstring() + " " + ver.getversiontype() + " " + ver.getbuildnumber() + " " + ver.getservicepack(); hglobal hglbcopy; if( openclipboard()){ emptyclipboard(); wchar_t *wcbuffer = 0; hglbcopy = globalalloc(gmem_moveable, (version.getlength() + 1)*sizeof(wchar_t)); wcbuffer = (wchar_t*)globallock(hglbcopy); lstrcpy(wcbuffer, version); globalunlock(hglbcopy); setclipboarddata(cf_unicodetext, hglbcopy); closeclipboard(); } } any appreciated. using window...

r - Changing column names and values -

given following data frame: > df a1 a2 a2.1 a2.2 a3 b1 b2 b2.1 b2.2 b3 [1,] 0 0 0 0 0 0 0 0 0 0 [2,] 0 0 0 0 0 0 0 0 0 0 i seek replace "2.1" column names " aa" , replace values columns number 1. that: a1 a2 aa a2.2 a3 b1 b2 b aa b2.2 b3 [1,] 0 0 1 0 0 0 0 1 0 0 [2,] 0 0 1 0 0 0 0 1 0 0 how can achieve this? many in advance. you can try grep , gsub x = c(0,3,5) y = c(4,1,7) z = c(1,2,3) df = data.frame(x,y, z) names(df) = c("a1","a2.1", "a2.1") index <- grep("2.1",colnames(df)) df[, index] <- 1 colnames(df) <- gsub("2.1", "aa", colnames(df)) # > df # a1 aaa aaa # 1 0 1 1 # 2 3 1 1 # 3 5 1 1

windows - How to get the day of year in a batch file -

how can day of year current date in windows batch file? i have tried set /a dayofyear=(%date:~0,2%*30.5)+%date:~3,2% but not work leap years, , off few days. not use third-party executables. if want julian day number, may use method posted in my accepted answer given @ previous link. however, "day of year" number between 1 , 365 (366 leap years). batch file below correctly calculate it: @echo off setlocal enabledelayedexpansion set /a i=0, sum=0 %%a in (31 28 31 30 31 30 31 31 30 31 30 31) ( set /a i+=1 set /a accum[!i!]=sum, sum+=%%a ) set /a month=1%date:~0,2%-100, day=1%date:~3,2%-100, yearmod4=%date:~6,4% %% 4 set /a dayofyear=!accum[%month%]!+day if %yearmod4% equ 0 if %month% gtr 2 set /a dayofyear+=1 echo %dayofyear% note: relies on date format mm/dd/yyyy .

imresize error using OpenCV 2.4.10 and Python 2.7.10 -

i'm trying resize image opencv 2.4.10 , python 2.7.10. this works: resized_patch = cv2.resize(patch, (3, 50, 50)) however, i'm interested in using inter_area interpolation. following documentation python , tried: dst = numpy.zeros((3, 50, 50)) resized_patch = cv2.resize(patch, (3, 50, 50), dst=dst, fx=0, fy=0, interpolation=cv2.inter_area) however, error i'm getting cv2.resize line is: typeerror: 'function takes 2 arguments (3 given)' any clues? you need use 2d size dst.size() not 3d : resized_patch = cv2.resize(patch, (3, 50, 50), dst=dst, fx=0, fy=0, interpolation=cv2.inter_area) ^^^ #here

c++ - can't read tag with TagLib -

downloaded taglib 1.9 https://taglib.github.io/ , compiled instructions provided in install file. the code below crashes error "the program has unexpectedly finished." #include "mainwindow.h" #include <qapplication> #include <qdebug> #include <taglib/mp4file.h> #include <taglib/mpegfile.h> #include <taglib/fileref.h> #include <taglib/taglib.h> #include <taglib/tag.h> int main(int argc, char *argv[]) { qapplication a(argc, argv); taglib::filename fn(qstring("c:/users/bill/desktop/02 wrong.mp3").tostdstring().c_str()); taglib::fileref ref(fn); qdebug() << qstring::fromstdstring(std::string(ref.tag()->artist().tocstring())); return a.exec(); } running in debug mode show me null dereference fileref.cpp @ bool fileref::isnull() const { return !d->file || !d->file->isvalid(); } running windows 10 insider preview static built qt 5.0.2 i've toiled , toiled ,...

javascript - How to exclude response validation of swagger API for images? -

Image
i have swagger yaml function such : /acitem/image: x-swagger-router-controller: image_send get: description: returns 'image' caller operationid: imagesend parameters: - name: name in: query description: image sent required: false type: string responses: "200": description: success schema: # $ref: "#/definitions/imageresponse" type: string default: description: error schema: $ref: "#/definitions/errorresponse" i have content type produces : produces: - application/json - text/plain - text/html - image/png but after have swagger validation error my question - there optimized method write image response or there way exclude image response validation ??? thanks in advance. you have error here: responses: ...

javascript - FB SDK Version 2.4 not returning value for /me/groups -

i trying user's groups list following code: $(document).ready(function() { $("#fetchbutton").click(function() { console.log('fetch button'); fb.getloginstatus(function(res){ if( res.status == "connected" ){ // check if logged in // user data first, handled anonymours fucntion passed inline fb.api('/me', function(meresponse) { //console.log(meresponse); uid = meresponse.id; getgroups(); console.log(meresponse); }); } else { // if not logged in, call login procedure fb.login(function(){ $("#fetchbutton").click(); }, {scope: 'publish_actions, publish_actions, read_stream, user_group...

regex - What does this BASH shell script excerpt do? -

can explain following code please (assume host contains string): host=${host//$'\n'/} if above line declared inside function, variable "host" available other functions in same script? according substring replacement subchapter abs guide : host=${host//$'\n'/} removes all occurrences of newline character $'\n' in host variable. if above line declared inside function, variable host available other functions in same script? yes, assuming host wasn't declared using bash local keyword.

osx - How to start a mongodb service on mac OS X? -

i have installed mongodb on mac process not running. how start mongodb service can start using commands? try following steps in terminal: which mongod this output path mongod , if not in $path command output empty. need find executable: find / -name 'mongod' in output of command, see many lines, 1 of bin/mongod , e.g. /usr/local/mongodb/bin/mongod . in case take whole absolute path , following: echo "path=/usr/local/mongodb/bin/:$path" >> ~/.bash_profile . ~/.bash_profile then try again: mongod --dbpath /your/path

Validation in drop downs on submit button click using javascript -

i have 3 drop-down fields. want validate them using javascript when submit button clicked see if of values in 3 drop-down fields not selected. on click of submit button should display warning message indicating 1 of 3 drop-downs have not been filled. based on information in comments previous answer, should work you. have tested can refine javascript if statement test each individually , report different message each long you return false; make sure submission gets halted function validateform() { if (document.getelementbyid("ddone").value == "" || document.getelementbyid("ddtwo").value == "" || document.getelementbyid("ddthree").value == "") { alert("you need fill in 3 dropboxes , not some"); return false; } } <!doctype html> <html> <head> </head> <body> <form name="myform" onsubmit="return validateform()" meth...

java - Creating A Custom Shape For a JTextPane Border -

Image
i designing chat application. for chat box jtextpane , used custom shape other default rectangle shape shown in first image. when window jinternalframe hovered on window( jinternalframe ), border line of custom jtextpane show dragged lines shown in second image. please why happening? what did write set jtextpane 's border subclass of abstractborder . attached subclass of abstractborder used. i've noticed when remove graphic.setclip(area) , graphic.setclip(null) under if(parent != null) block of paintborder() method, problem goes away. how solve line problem , still have fancy text box? import java.awt.basicstroke; import java.awt.color; import java.awt.component; import java.awt.graphics; import java.awt.graphics2d; import java.awt.insets; import java.awt.polygon; import java.awt.rectangle; import java.awt.renderinghints; import java.awt.geom.area; import java.awt.geom.roundrectangle2d; import javax.swing.jpanel; import javax.swing.border.abstractborder...