Posts

Showing posts from 2012

How do I configure global Mercurial options (like extensions) in Cloudbees Jenkins? -

i have cloudbees jenkins instance configured build several mercurial projects. configure global mercurial options go in ~/.hgrc , such as: [extensions] eol = when setting own standalone jenkins instance, log in user running jenkins , set environment. for cloudbees, it's not clear how should handle this. don't see way configure mercurial jenkins plugin use specific configuration file. if that, i'm not sure or when fill in file. can somehow create ~/.hgrc applies entire cloudbees jenkins instance? or need on per-job basis? might able set hgrcpath in pre-build step via envinect , or maybe modify project .hgrc via script build action. however, seems neither of these happen enough in build process take effect when job starts. i feel i'm missing obvious. can suggest proper way accomplish this? go system configuration page , create new mercurial installation. leave installation directory blank , set executable hg , set whatever need in custo...

c# - how to convert bool array to char variable? -

i have boolean array holds values represent ascii value: bool[] myboolreceived = new bool[8]; i try convert char can add list holds chars. myreceivedmessage = new list<char>(); i tried use convert.tochar method not seems work. char contains 2 bytes. can convert bool array byte , convert character using convert class. public byte converttobyte(bool[] arr) { byte val = 0; foreach (bool b in arr) { val <<= 1; if (b) val |= 1; } return val; } reference

javascript - How to increment or dicrement from current index within the total -

i looping number between 0 total have. thing is, need create currentindex , should not more total same way need dicreement value currentindex not less 0 . i tried nothing come handy. here try: var total = 6; var currentindex = 3; var num = 0; function add(amount) { return num = (num + total - currentindex + amount) % total + 1 } $('a').click(function(e){ var num = e.target.classname == 'prev' ? -1 : 1; var result = add(num)+currentindex; console.log(result); }); jsfiddle you need think simpler, on right track: var total = 6; var currentindex = 3; var num = 0; function add(amount) { currentindex=((currentindex+amount%total)+total)%total; } $('a').click(function(e){ var num = e.target.classname == 'prev' ? -1 : 1; add(num); console.log(currentindex); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <a href=...

swift - Correct way to pass data between objects through middlemen -

my project has myviewcontroller children inside of mywindow , , 1 of children has properties should set through settings located in window. mywindow quite short: class mywindow: nswindow { @iboutlet var viewcontroller:myviewcontroller! var win2 = mysettingswindowcontroller(windownibname: "mysettingswindowcontroller") @ibaction func show(sender:anyobject){ win2.showwindow(sender) win2.storage.body_arr = viewcontroller.getsimulationcurrentparameters() } } i know looks real bad, cannot think of other solution. doesn't work want it, because changes body_arr should applied simulation parameters inside of object inside of myviewcontroller (they should same). how should done? seems there 3 objects between storage , mysimulation

unix - Replacing alternate spaces with newline? -

i trying replace alternate spaces newlines using unix. tried using tr command in unix unable modify replace alternate spaces. sample input: 0 1 2 3 4 5 sample output: 0 1 2 3 4 5 how achieve ? awk might in case: echo "0 1 2 3 4 5" | awk ' { (i=1; i<=nf; i++) { if ((i-1)%2 == 0) { printf "%d ",$i; } else { print $i } } } ' we split space , have 6 items. we, then, looping through fields , outputting each field. every other field output in new line print $i ; otherwise print using printf "%d ",$i; , not create new line.

java - try/catch block not working in actionlistener -

i working on 2 programs school, 1 take contact info , save text file , other read text file. works have add try/catch block program takes input catch non-numeric entries in age text field. have been trying many different ways of doing since yesterday , nothing has been working. below code. if can point me in right direction grateful because feel there fundamental not getting here. thanks private class savedata implements actionlistener{ public void actionperformed(actionevent e){ string age1 = (string)agefield.gettext(); int age = integer.parseint(age1); try{ int = age; } catch(inputmismatchexception e1){ joptionpane.showmessagedialog(null, "please enter integer"); } string name = (string)namefield.gettext(); string email = (string)emailfield.gettext(); string cell = (string)cellfield.gettext(); if(age...

Play a sound when bluetooth is ON : no sound (iOS Swift) -

i programming bluetooth sensor ios swift, , play sound when bluetooth connected , sensor working. example, when temperature high, sound alert should beep. however, reason, sound silent though playsound() function seems working : see println message "playing audio (test line. did line appear in console ?)" console. i wonder whether bluetooth block avaudioplayer working. how make sound ? the code such programmed sound should beep long bluetooth on. noticed interesting phenomenon : at moment when bluetooh turned off, sound beeps once. @ moment when app put background (push iphone home button), sound beeps once. kind of have feeling bluetooth blocked avaudioplayer, therefore, @ moment bluetooth turned off, avaudioplayer grabbed chance work once . thanks bill func playsound(){ println("playing audio (test line. did line appear in console ?)") // set sound file name & extension var alertsound = nsurl(fileurlwithpath: nsbundle.mainbundle()...

scala - Sequence passed as a varargs argument -

this question has answer here: using variable length argument in scala 1 answer i have interface object leaf { def apply(keys: int*): leaf = { new leaf(keys) } } where leaf class defined follows: class leaf(keys: seq[int]) extends node(true, keys, seq()) is possible pass sequence keys parameter? of course create second varargs method, wonder if there method converts sequence varargs paremeter. yes, , think mean varargs not varchar :) leaf(sequence: _*)

Python: Replace integers by floats in string -

i'm looking way, replace every number inside string float number. i'd turn this: "3/1" this: "3.0/1.0" there way this? you can use re.sub : >>> s="3/1" >>> import re >>> re.sub(r'(\d+)',r'\1.0',s) '3.0/1.0' >>> s="334/14" >>> re.sub(r'(\d+)',r'\1.0',s) '334.0/14.0'

PostgreSQL: MD5 Authentication in pg_hba.conf gives me FATAL: Peer authentication failed for user "postgres" -

i'm running ubuntu 14.04 , installed postgresql 9.3. edited /etc/postgresql/9.3/main/pg_hba.conf as: # "local" unix domain socket connections local md5 # ipv4 local connections: host 127.0.0.1/32 md5 # ipv6 local connections: host ::1/128 md5 i restarted server , i'd login postgres postgres : victor@workstation:~$ psql -u postgres psql: fatal: peer authentication failed user "postgres" shouldn't postgres prompt password, i've set authentication method md5 ? i understand if add -h localhost work. does not adding flag causes psql use peer-authentication? you must have local ... peer line above those. error peer authentication failed comes server , , it's server tha picks auth method. other possibilities be: didn't restart server edited wrong pg_hba.conf file if there multiple po...

filesystems - How is a file loaded in the FAT file system? -

i developing bootloader in x86 assembly , have question fat file system. which steps necessary find , load file? there no simple answer, won't delve here. have peek fat (file allocation table) structures on disk: https://en.wikipedia.org/wiki/design_of_the_fat_file_system more, reference: https://en.wikipedia.org/wiki/file_allocation_table

ruby - json files saved with trailing "?" -

i'm saving bunch of data hash , saving json file. code saving: def write_to_file(id, data) dir.chdir(file.dirname(__file__)+"/specs") filename = "./"+id+".json" file.open("#{filename}", 'w') |f2| f2.write(data.to_json) end end i want save id.json, file getting saved "?" @ end. example, 199015806906670?.json original value of "id" 199015806806670. if search 19901580606670 unable use tab autocomplete. know why happening? edit: sample file containing ids: 104184946332304 131321736945390 693134284084652 146974018804301 288608807960773 code these: url = file.open("newapps/curlist.txt","r") url.each_line |line| func1(line) #func1 calls write_to_file, no changes line in func1 end as has been mentioned in comments have newline last character of id field. character (being invalid) being replaced q...

oop - Tell base class function to do different things dependent on the calling subclass -

in base class, have following code: @staticmethod def _split_on_empty_lines(file_contents): """generator yields sections of file separated empty lines""" section = '' line in file_contents: if line.strip(): section += line else: _section_yield_function() section = '' the _section_yield_function() supposed different things in 2 subclasses. in first one, should check whether line after empty line empty before yielding it; in other one, should not perform check. i read calling class of function not known inside function context, way implement kind of behaviour?

Python: Sending Email to Multiple Recipients -

i'm trying send email multiple people using python. def getrecipients(filewithrecipients): recipients = [] f = open(filewithrecipients, 'r') line in f: recipients.append(line) return recipients def test_email(): gmail_user = "csarankings@gmail.com" gmail_pass = getpassword("pass.txt") = "csarankings@gmail.com" = getrecipients("recipients.txt") date = getcurrentdate() subject = "current csa rankings: " + date text = createemailmessagefromfile("rankings.txt") message = """\from: %s\nto: %s\nsubject: %s\n\n%s """ % (from, ", ".join(to), subject, text) try: server = smtplib.smtp("smtp.gmail.com", 587) server.ehlo() server.starttls() server.login(gmail_user, gmail_pass) server.sendmail(from, to, message) server.close() print("it worked")...

django - GeoDjango Converting SRID 4326 to SRID 3857 -

i'm having difficulty converting srid 4326 coordinates geocoder srid 3857 storage within postgres-postgis database. using following code test transforming between srids: from django.contrib.gis.gdal import spatialreference, coordtransform django.contrib.gis.geos import point gcoord = spatialreference(4326) mycoord = spatialreference(3857) trans = coordtransform(gcoord, mycoord) pnt = point(47.61, -122.33, srid=4326) print 'x: %s; y: %s; srid: %s' % (pnt.x, pnt.y, pnt.srid) x: 47.61; y: -122.33; srid: 4326 pnt.transform(trans) print 'x: %s; y: %s; srid: %s' % (pnt.x, pnt.y, pnt.srid) django.contrib.gis.gdal.error.gdalexception: ogr failure. within django, more helpful error message: transform: couldn't project point (47.61 -122.33 0): latitude or longitude exceeded limits (-14) i've performed rudimentary testing , determined lat/long coordinate outside of 0-90 trigger condition. setting point field in django srid=4326 , migrating database s...

c++ - How To Read HID Output Reports Cross Platform -

i have custom atmel chip firmware uses lufa driving usb. can read , write output reports on windows existing software in .net using pinvoke. i want develop cross platform desktop app shared codebase communicating device. i can write output reports device on mac using both hidapi in c++ preferred library hidsharp in c# via mono. however, unable read hid reports. both platforms give me timeout when call equivalent .read() method. my relevant lufa code looks this: bool callback_hid_device_createhidreport(usb_classinfo_hid_device_t* const hidinterfaceinfo, uint8_t* const reportid, const uint8_t reporttype, void* reportdata, uint16_t* const reportsize) { if(reporttype == hid_report_item_in && reportid != null && *reportid != 0) { if(debug) { serial_write_str_p(pstr("usb in packet: "));...

apache - How to 301 redirect URL's with "index.php?" in a path? -

i trying redirect old urls this: mysite.com/index.php?dispatch=products.view&product_id=30176 new url's seo friendly , - mysite.com/category/product i using cs-cart 4.3.1 seo add-on enabled, , when have imported products , categories urls automatically changed. this add-on has 301 redirect functionality in admin, enables me create 301 redirects manually. however, wrong , doesn't work redirects have "index.php?" in path start with. i have tried redirecting old urls without "index.php?" in path - like: "dispatch=products.view&product_id=30176" "mysite.com/category/product" , works, page being redirected. not correct url indexed google , need redirecting. i suspect issue somewhere in rewrite conditions or rewrite rules on htaccess file created system upon activation of seo add-on. this how looks like: <ifmodule mod_rewrite.c> rewriteengine on rewritebase / options -multiviews rewriterule .* - [e=http_authoriza...

json - Ionic - Adding states dynamically -

i developing mobile application using ionic framework. json file containing template , it's controller. server push data once there's data in json format. problem adding states dynamically, , have read it's possible @ config time. please tell me if there's way through controller responsible of receiving , setting new state , receive json , create new state. the highly appreciated! edit i have found ui-router-extras ( http://christopherthielen.github.io/ui-router-extras/#/future ), don't know how make work application. suppose controller gets json using $http json looks like: { 'name':'preview', 'template':'<h1>hello</h2>' } how add state in controller? there simliar q & a: angularjs - ui-router - how configure dynamic views - answer start angular.js route-segment or ui-router after translations loaded angular - dynamically choose starting state which shows, ui-router shippe...

devise - Rails and DocRaptor, override authentication -

i'm using rails 4 , docraptor in order convert html page pdf. problem i'm using devise 3 authentication. devise's log in page root if you're not authenticated. therefore, when docraptor pulls html show page, pulls log in page. is there way ignore authentication call docraptor? thanks! you can skip_before_filter , pass secret token of sort prevent/obscure public access. below answers have couple examples. docraptor employee, happy help! rails 3: using devise authentication, how allow access report page guid instead of login what best way bypass devise authorization specific record marked public

octobercms - October CMS authentication/register form -

i have installed october cms, template , october cms user plugins (front end). the signup/register account page has necessary fields when try register new user and/or signup, no thing happens. plugin developed october cms , should work. the part can come in think of, view file. what doing wrong? october cms view file: title = "register" url = "/register/" layout = "default" == <div class="signin-screen"> <div class="signin-icon"> <img src="{{ 'assets/images/logo.png'|theme }}" alt="welcome blog" /> <h4>sign <small>my blog</small></h4> </div> <div class="signin-form"> <div class="form-group"> <input type="text" class="form-control signin-field" value="" placeholder="enter name" id="signin-n...

jQuery UI Droppable not accepted event -

ui droppable project, detect opposite accepted event. i mean if drag , drop not accepted container action, far haven't found way detect it. found out using revert option draggable event can solve it. $("selector").draggable({ revert : function(droppablecontainer) { if(droppablecontainer) { // drop valid }else { // drop invalid } return(!droppablecontainer) //returns draggable original position } });

excel - Numberformat that allows me to enter formulas but stores values as text? -

is possible set numberformat in cell/column using either excel or vba that: if enter formula (anything starting =) excel calculate formula (and not interpret text) if enter value, example 5.80, excel store text? i'm having problem want user input stored text, users should able enter formulas. if set numberformat text, formulas aren't interpreted. if set numberformat general, values stored numbers. here version. format cells in sheet text . code uses application.evaluate() evaluate formulas , store result text. private sub worksheet_change(byval target range) dim acell range on error goto whoa application.enableevents = false '~~> need in case user copies formula '~~> sheet target.cells.numberformat = "@" '~~> looping though cells in case user '~~> copies formula sheet each acell in target.cells if left(acell.formula, 1) = "=" _ acell.value = applicati...

reactjs - Update through React.render gives strange results -

Image
i'm writing web app using react, , due way ui framework works need use multiple react components mounted divs in thew html. update these divs call react.render again update different components. this works on own machine, deploy minimized version on location http://svdoever.github.io/trainercoach strange behaviour. reproduction steps: navigate http://svdoever.github.io/trainercoach click hamburger menu select item in menu (opens exercises set) at bottom press ">" next button a reload of app seems occur the initial rendered html is: after selecting ">" next button calls renderexercise() , there seems kind of "reload" of whole app within new generated div: the new introduced div is: <div data-title="http://svdoever.github.io/trainercoach/" id="1452577160" class="panel active" data-crc="1452577160" style="z-index: 10;"> and div contains kind of stuff whole rendere...

java - Using comparable to compare different variables -

i'm familiar standard comparisons using comparable interface, although today i'm having trouble when want compare several different variables. i want implement compareto method yields result -1 when following if statement true: if (o.maxx > minx && o.maxy > miny && o.minz < maxz) although, i'm not sure if possible using comparable, or i'm not familiar seems. because when try approach public int compareto(isosprite o) { if (o.maxx > minx && o.maxy > miny && o.minz < maxz){ return -1; }else if(o.maxx < minx && o.maxy < miny && o.minz > maxz){ return 1; } return 0; } i receive error "comparison method violates general contract!" . want clarify don't need understanding error means, because i've read several questions it. although, still can't put mind around particular problem, because solutions other questions i've read have be...

MATLAB how to calculate elongation of a BW image -

Image
i trying extract features leaf recognition application in matlab. need elongation value described following: compute maximum escape distance d max = max x ∈ i d(x,∂i) . elongation obtained 1 - 2d max / d(i) , ranges 0 1. minimum achieved circular region. note ratio 2d max /d(i) quotient between diameter of largest inscribed circle , diameter of smallest circumscribed circle. d(i) diameter of image i . ∂i border of i . pretend circular shaped image. furthest point border of shape center. called maximum escape distance . elongation = 1 - (interior ellipse radius/surrounding ellipse raidus) regionprops result image below: area: 352085 centroid: [311.2075 492.9844] boundingbox: [2.5000 2.5000 586 1139] subarrayidx: {1x2 cell} majoraxislength: 869.2058 minoraxislength: 535.2340 eccentricity: 0.7879 orientation: -85.2073 convexhull: [99x2 double] conveximage: [1139x586 logical] convexarea: 403293 image: [1139x586 logical] filledimage: [1139x586 logic...

osx - Weird Behaviour with New Lines Using grunt-exec -

i using imagemagick , grunt-exec generate favicon website working on using command found in imagemagick documentation . convert image.png -bordercolor white -border 0 \ \( -clone 0 -resize 16x16 \) \ \( -clone 0 -resize 32x32 \) \ \( -clone 0 -resize 48x48 \) \ \( -clone 0 -resize 64x64 \) \ -delete 0 -alpha off -colors 256 favicon.ico however getting issues line breaks think partially because not understand should line breaks. in gruntfile.js using no line breaks , works expected. notice had remove line breaks , double escape parentheses because apparently grunt-exec parses string before executes it. exec: { favicon: 'convert _favicon.svg -bordercolor white -border 0 \\( -clone 0 -resize 16x16 \\) \\( -clone 0 -resize 32x32 \\) \\( -clone 0 -resize 48x48 \\) \\( -clone 0 -resize 64x64 \\) -delete 0 -alpha off -colors 256 favicon.ico' } like said, have working right i able use line breaks readability , because understand going ...

Emacs init.el and Elisp and equivalent of common lisp every-p function -

i working on init.el , setup checks if defined packages installed , if not refresh package contents , install them. i can automate install fine, want refresh package list if there packages not installed. i came works common lisp seems if elisp not have every-p simplest method. (defparameter *my-packages* '(evil evil-leader helm)) (defparmeter *installed-pkgs* '()) ;fake package-installed-p (defun package-installed-p(pkg) (member pkg *installed-pkgs*)) ;fake package-install (defun package-install(pkg) (format t "installing package: ~a~%" pkg)) (defun check-installed-p() (every #'package-installed-p *my-packages*)) (defun mytest() (unless (check-installed-p) (package-refresh-contents) (dolist (pkg *my-packages*) (unless (package-installed-p pkg) (package-install pkg))))) the other method came following using return-from seems not part of elisp. searching looks emulate catch , throw. (defun check-installed-p() (d...

Laravel 5 needs index.php using Apache virtual host -

Image
when load pages not root, page won't load without index.php before route. error get: not found requested url /login not found on server. apache/2.4.7 (ubuntu) server @ mydomain.com port 80 to start have virtual host file containing: //also tried adding directoryindex here before <directory> <directory /var/www/mydomain.com> directoryindex index.php allowoverride </directory> and .htacces in public : <ifmodule mod_rewrite.c> <ifmodule mod_negotiation.c> options -multiviews </ifmodule> rewriteengine on # redirect trailing slashes... rewriterule ^(.*)/$ /$1 [l,r=301] # handle front controller... rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [l] </ifmodule> i have domain same .htaccess , appache config on same server , works fine. did restart apache. if use phpinfo on index.php/route page see @ loaded modules: mod_rewr...

c# - How to handle "Violation of UNIQUE KEY constraint" exception in asp.net web application -

<alternatingrowstyle backcolor="#f7f7f7" horizontalalign="justify" wrap="false" /> <columns> <asp:commandfield showdeletebutton="true" buttontype="image" /> <asp:commandfield showeditbutton ="true" buttontype="image" /> <asp:templatefield headertext="name" sortexpression="name"> <edititemtemplate> <asp:textbox id="textbox1" runat="server" text='<%# bind("name") %>'></asp:textbox> </edititemtemplate> <itemtemplate> <asp:label id="label1" runat="server" text='<%# bind("name") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield head...

jQuery/javascript Plugin for maps that will render borders or parks -

i searching jquery plugin should able implement park border layers google earth or ever can find such data free. looking advice new using kind of map gis plug-in. know if able render layer such on depict perhaps location point, borders (based on category or selection state land or parks boundaries), , allow me raster or inlay image possibly (but not necessarily.) if have suggestions on built in javascript/jquery gis maps please let me know.

Run an App on windows tablet without uploading to store -

i have made windows 8 app , not want upload on store. without uploading app on app store how can share app on windows tablet. should use xap file , run or how can run app on friends window tablet, ideas or suggestions of how can share same. thanks in advance. you can run app via remote debugging monitor . how can described here: remote debugging or can setup beta version app. beta version

cobol - Change display format from character mode to numeric mode -

the value in variable var -1, , when trying write file, gets displayed j(character mode), equivalent -1. the var defined in cobol program copybook below: 10 var pic s9(1). is there way, change display format character "j" -1, in output file. the information found googling below: value +0 character { value -0 character } value +1 character a to convert zoned ascii field results ebcdic ascii character translation leading sign numeric field, inspect last digit in field. if it's "{" replace last digit 0 , make number positive. if it's "a" replace last digit 1 , make number positive, if it's "b" replace last digit 2 , make number positive, etc., etc. if last digit "}" replace last digit 0 , make number negative. if it's "j" replace last digit 1 , make number negative, if it's "k" replace last digit 2 , make number negative, etc., etc. ...

sql - Query syntax on a large inner-joined select query linked to a control giving runtime 3071 error message -

i getting runtime error message 3071 on following query stating query complex. have created queries in past have seemed more complex one. understand generates message: sql_get = "select tblvaluechain01.idmacroprocesso, tblvaluechain02.idmicroprocesso02, tblvaluechain03.id, tbldependencies01.id dependencyid, tblvaluechain02.microprocesso02, tblvaluechain01.macroprocess, tblvaluechain01.teamlead, tblvaluechain01.lastorganisationdate, tblvaluechain01.tempiindeterminati, tblvaluechain01.tempideterminati, tblvaluechain01.interinali, tblvaluechain01.parttime, tblvaluechain01.dailyminutesaverage minutes01, tblvaluechain01.dailyminuteshigh minutes01h, tblvaluechain01.dailyminuteslow minutes01l, tblvaluechain02.microprocesso02, " & _ "tblvaluechain02.dailyminutesaverage minutes02, tblvaluechain02.dailyminuteshigh minutes02h, tblvaluechain02.dailyminuteslow minutes02l, tblvaluechain03.microprocess, tblvaluechain03.minutesperday minutes03, tblvaluechain03.minutesperdayhig...

Where are static final variables used in java? -

i studying java , wanted know what's usage of static final variables in application designing. please provide examples too. uses of static final variable : to define compile time constant value. e.g : integer class defines constant called min_value : public static final int min_value = 0x80000000; to create non modifiable reference can accessed globally : e.g singleton pattern using public static final reference. when mark variable defined in class static , shared across instances of class . when mark variable in class final , can initialized once either on same line declaration of variable or in constructor of class. putting both together, member static final variable shared across instances of class , must initialized declared, , cannot modified once declared.

Jquery Loop appending image element just appends once -

i'm trying append image element multiple times trough loop, appearing once, idea why? here code $(document).ready(function() { var myimage = new image(); myimage.src = 'image.jpg'; for(i=0; < 12; i++) { $('#photos').append(myimage) } }); you should create image object within for loop because if not using same object multiple times see demo change jquery this, $(document).ready(function () { (i = 0; < 12; i++) { var myimage = new image(); myimage.src = 'image.jpg'; $('#photos').append(myimage); } }); update: not affect page load time because browser load image once , cache further use. can see more details here when page loads image, load once, or every time found in markup?

visual studio 2010 - Precision not respected -

i use visual studio (2010 sp1) fortran imsl (2011) , can't right precision reals: program prova use, intrinsic :: iso_fortran_env implicit none integer, parameter :: ikind=selected_real_kind(p=8, r=99) real(kind=ikind) :: a=0.79 real(real64) :: b=0.79 real(kind=16) :: c=0.79 real(8) :: d=0.79 print *, print *, b print *, c print *, d end program prova give me same result: 0.790000021457672 (one more precision, 1 less precision every number different assigned one: 0.79) why willingness not respected? how can set all reals needed precision? nb: problem has nothing "limited nature of computer", roundoff numbers , similar. problem regards type/kind of variable in fortran. you setting variables have desired precision, assign constants default precision. try: program prova use, intrinsic :: iso_fortran_env implicit none integer, parameter :: ikind=selected_real_kind(p=8, r=99) real(kind=ikind) :: a=0.79...

c# - Encog :"The Machine Learning Method has an input length of 7, but the training has 0" error -

i'm having project in use encog(.net) classify emg signal, features extracted, when try train it, gets error title says. here code use : basicnetwork jst = new basicnetwork(); jst.addlayer(new basiclayer(7)); jst.addlayer(new basiclayer(new activationsigmoid(), true, 10)); jst.addlayer(new basiclayer(new activationlinear(), true, 4)); jst.structure.finalizestructure(); jst.reset(); openfiledialog1.title = "open feature file..."; openfiledialog1.filename = ""; openfiledialog1.filter = "csv (comma delimited)|*.csv|all files|*.*"; if (openfiledialog1.showdialog() == dialogresult.cancel) { messagebox.show("choice cancelled"); } else { iversatiledatasource data = new csvdatasource(openfiledialog1.filename, false, csvformat.decimalcomma); var inputjst = new versatilemldataset(data); i...

ios - Tabbarcontroller in objective C -

i have application uses tabbarcontroller. has 2 tabs- tab , tab b. tabs mapped view controllers through navigationcontroller. mapping goes this. tab a-> navigation controllera->tableviewcontrollera. tab b->navigation controllerb->tableviewcontrollerb. tableviewcontrollera-> links to-> tableviewcontroller b. tableviewcontroller b->links -> detail screen. problem when click tab takes me relevant view. click tab b , takes me correct view , detail. when click tab again view loaded remains there. have click tab again load tableviewcontrollera.

search - How can I remove delta-homes.com from browsers? -

whenever open browsers, delta-homes.com tab added browser. try remove delta-homes.com in of browsers(ie,ff,chrome,opera) registry in run > regedit, about:config in firefox, changing home page , search engine defaults , reset internet explorer(and reinstall "turn windows features on or off")....! isn't removed. should do? maybe should try adwcleaner clean system...

laravel - One controller and inserting data into more than one table (Mass Assignment) -

i have website users can send product (like car, mobile, computers) , sell online on website, maybe ebay , amazon. i have ads table store public information 1 thing using mass assignment , , other categories mobile, car , computers have own table , store professional , additional information of category on (for example cars have additional information color, fuel type, guaranty, accidents,insurance) . now know (for mobile) have 2 tables ( ads , ads_mobile ), , forms have controller adscontroller , ads model, form create dynamically , each form has own inputs (for example:mobile , car has different inputs , fields), , send dynamic forms adscontroller@check , check kind of form (is mobile? car? or ...?) , send data model: //adscontroller(this example); class ad extends eloquent { protected $fillable_ads = array('field_one', 'field_two', 'field_three'); } class mobile_ad extends eloquent { //and want use fillable_mobile_ads protected ...

How do you combine columns with conditions in R? -

i have data frame looks in r: d = data.frame(countrycode = c(2, 2, 2, 3, 3, 3), year = c(1980, 1991, 2013, 1980, 1991, 2013), pop90 = c(1, 1, 1, 2, 2, 2), pop00 = c(3, 3, 3, 4, 4, 4), pop10 = c(5, 5, 5, 6, 6, 6)) desired output: res = data.frame(countrycode = c(2, 2, 2, 3, 3, 3), year = c(1980, 1991, 2013, 1980, 1991, 2013), popcombined = c(1, 3, 5, 2, 4, 6)) i combine pop90, pop00 , pop10 1 column years 1980-1990 reflect value of pop90, years 1991-2000 reflect value of pop00 , years 2001-2013 reflect value of pop10. how can this? have tried merge function not set years in place reflect conditions set out above. you can use row/col indexing popcombined <- d[3:5][cbind(1:nrow(d),findinterval(d$year, c(-inf, 1990, 2000, inf)))] cbind(d[1:2], popcombined) # countrycode year popcombined #1 2 1980 1 #2 2 1991 3 #3 2 2013 5 #4 3 1980 ...

autoit - Want AutoIt3 HotKeySet to Emulate AutoHotKey Application Filtering -

objective i building generic solution advanced controlling of arbitrary programs ui using autoit3, invoked pressing various keys, or issuing command. components targetui - program controlled sending clicks , keys mainau3 - autoit program doing sending mainini - file containing control positions , other info in specialized notation, contains hotkey information. info specific particular targetui - ie. 1 mainini each targetui keyhookscript - optional? either autoit or autohotkey script facts hotkeyset() - autoit function allows setting , unsetting of system-wide hotkeys autohotkey - scripting language - allows application filtering hotkeys via #ifwinactive mainau3 designed take command param, provided keyhookscript mainau3 slow invoke, due parsing of mainini on startup, necc. due program goals issues since mainau3 slow invoke, 1 option have run in background , have own keyhooks, or have keyhookscript communicate somehow mainau3 , mainini have more 1 instance...

java - OSGI+CDI: strange behaviour with system printers detecting -

i have cdi+osgi javase application. cdi-weld,osgi-felix , pax-cdi. , have following code in "cdi-main" @applicationscoped public class foo{ public void postcreate(@observes containerinitialized event, bundlecontext ctx) throws exception { printservice[] printservices = printservicelookup.lookupprintservices(null, null); system.out.println("$number of print services: " + printservices.length); (printservice printer : printservices) system.out.println("$printer: " + printer.getname()); } } when run application following output(although have printers right drivers!) $number of print services:0 notice, first sign $; if add following code bundle activator , start it public class activator implements bundleactivator { public void start(bundlecontext context) throws exception { printservice[] printservices = printservicelookup.lookupprintservices(null, null); system.out.println...

javascript - AngularJS / JQuery - form input without an associated label -

i have problem "form input without associated label". appears on [textarea], [select], [select], [input] classes. here code: <div class="panel-body"> <form name="f" data-ng-submit="addtodo()"> nazwa: <textarea class="form-control" name="newtodo" data-ng-model="formdata.newtodo" required></textarea> typ: <select class="form-control" name="type" data-ng-model="formdata.type" data-ng-option="value.name value in categories" required></select> estymowany czas: <select class="form-control" name="estimates" data-ng-model="formdata.estimates" data-ng-option="value + 'h' value in [] | rangetime:9:true" required></select> data: <input class="form-control" type="text" data-ng-model="formdata.date" data-ng-data-picker="" name=...

c++ - Is object std::shared_ptr findable by its std::weak_ptr? -

so have std::vector<std::shared_ptr<t>> mylistoft; , have std::weak_ptr<t> ptrtoonet; created 1 of pointers used fill container (say have inside callback function). std::find on container , weak_ptr give me iterator original shared_ptr (if such 1 exists in collection)? guaranteed somewhere in standard or implementation dependent? we can away without locking weak_ptr using std::weak_ptr::owner_before . i'll use more verbose solution necessary , introduce owner_equal , counterpart std::owner_less : template<typename t> class owner_equal { private: template<typename l, typename r> static bool e(l const& l, r const& r) { return !(l.owner_before(r)) && !(r.owner_before(l)); } public: using s = std::shared_ptr<t>; using w = std::weak_ptr<t>; bool operator()(s const& l, w const& r) const { return e(l, r); } bool operator()(w const& l, s const& r) const { return e(l...

hadoop - What are the different ways to check if the mapreduce program ran successfully -

if need automate mapreduce program or run script, different ways check if mapreduce program ran successfully? 1 way find if _success file created in output directory. command "hadoop jar program.jar hdfs:/input.txt hdfs:/output" return 0 or 1 based on success or failure ? just other command in linux, can check exit status of hadoop jar command using built in variable $? . you can use: echo $? after executing hadoop jar command check status. the exit status value varies 0 255. exit status of 0 implies command executed while non-zero value indicates command failed. edit: see how achieve automation or run script, refer hadoop job fails when invoked cron .

meta boxes - Any way to add metaboxes in custom settings page of custom post type in wordpress? -

hi add metaboxes under custom settings page under custom post type. can create metaboxes custom post types can create theme options. can't find way add metaboxes on custom settings page. post type hierarchy below: products - item - add item - product category - product settings i want add metaboxes & create options page on settings page. can please guide me through one. i've been trying follow gist can't find way. https://github.com/webdevstudios/cmb2-snippet-library/blob/master/options-and-settings-pages/theme-options-cmb.php also can let me know if can achieve tweaking code key|value operates $cmb = new_cmb2_box( array( 'id' => $this->metabox_id, 'hookup' => false, 'show_on' => array( // these important, don't remove 'key' => 'options-page', 'value' => array( $this->key, ) ), ) ); i've created settings page code add_submenu_p...

compiling c code with a c++ compiler -

i attempting use c code did not write myself in tandem own c++ code. when attempt compile c code below error. unsure c code attempting accomplish .xxx format. @ loss appreciated. const bmpfile_header_t bmp_fh = { .filesz = offset + bmp_ih->bmp_bytesz, .creator1 = 0, .creator2 = 0, .bmp_offset = offset }; throws error: missing'}' before '.' the .field = value designated initializers fields of struct , i.e., bmp_fh.bmp_offset set value offset , etc. either give values fields of structure (in order) without designated ( .field ) initializers, or remove const , assign values afterwards. or, unless wish port c code c++ compiler, compile c code c compiler , link c++ program. c++ code can call c functions.

voltrb - How to integrate other javascript library in Volt framework? -

i can't understand how integrate existing javascript libraries volt. volt 0.9.3 opal native object isn't available , use backticks interpolation seems no pratical. you should able use native if want in volt. controllers loaded on client side, required in on server side few reasons, need do: if ruby_platform == 'opal' require 'native' end also, did see these docs? http://docs.voltframework.com/en/getting_help/can_i_use_jquery_or_other_dom_manipulating_js.html

controltemplate - Control style of each individual ToggleButton in Windows Phone 8.1 -

Image
i building windows phone 8.1 (non silverlight) application. want togglebuttons different when toggled, have following code: <page.resources> <!-- custom style windows.ui.xaml.controls.primitives.togglebutton --> <style targettype="togglebutton"> <setter property="background" value="{themeresource togglebuttonbackgroundthemebrush}" /> <setter property="foreground" value="{themeresource togglebuttonforegroundthemebrush}"/> <setter property="borderbrush" value="{themeresource togglebuttonborderthemebrush}" /> <setter property="borderthickness" value="{themeresource togglebuttonborderthemethickness}" /> <setter property="padding" value="12,4,12,5" /> <setter property="horizontalalignment" value="left" /> <setter property="verticalalignment" valu...