Posts

Showing posts from June, 2012

javascript - Infinte Loop - Adding and Removing Event Listeners -

i have syntaxed checked several times, cannot figure out why functions being recursively called: function updatenewclasses() { function addnewclass() { updatenewclasses(); } window.addeventlistener( "hashchange", addnewclass ); // conditionals being skipped; no loops window.removeeventlistener( "hashchange", addnewclass ); location.href = '#'; window.addeventlistener( "hashchange", addnewclass ); } the program keeps calling hash change function recursively calls updatenewclass leading endless loop. since addeventlistener in updatenewclasses called addnewclass triggered addeventlistener keep adding event listener each time triggered. additionally, updatenewclasses creating "new" addnewclass not removed on subsequent call updatenewclasses . want store function want add/remove outside scope of callback can removed. perhaps mean this: var addnewclass = function() { updatenewclasses(); } var

java - Remove fields in embeddable (JPA) -

i'm trying remove list in embeddable removing embeddable entity. isn't working.. entities in list still in de database. code: method starts: //attached entity ship ship = findship(); ship.removeitinerary(); ship: @entity @table(name = "ship") public class ship extends domain { @embedded private itinerary itinerary; public void removeitinerary() { this.itinerary = null; } } itinerary: @embeddable public class itinerary implements serializable { //tried orphanremoval , cascade without luck //(since i'm not removing ship it's logic it's not working..) @onetomany @joincolumn(name = "ship_id", referencedcolumnname = "id") private list<stop> stops = new arraylist<>(); } jpa 2.0 if itinerary saved database, need delete it. eg, like public void removeitinerary() { getentitymanager().remove(this.itinerary); this.itinerary = null; }

Get a two-digit hour when renaming a file with a time stamp in Windows command-line? -

i want make sure renaming command puts hours 2 digits. if 9:30 am, want filename add 0930 @ end. altering code below, how can accommodate this? ren c:\progra~1\tsi\edata\advantis\edisave\dillards\846_temp\001_846_tmp.txt "001_846_tmp_%date:~10,4%-%date:~4,2%-%date:~7,2%_%time:~0,2%%time:~3,2%.txt" ren c:\progra~1\tsi\edata\advantis\edisave\dillards\846_print\001_846_prt.txt "001_846_prt_%date:~10,4%-%date:~4,2%-%date:~7,2%_%time:~0,2%%time:~3,2%.txt"

ios - SKLabelNode Creating Black Rectangle -

Image
i saw this question , did not have definite solution issue, nor exact same. trying add sklabelnode text. have never had issues reason happening: here code using generate node: var announcelabel = sklabelnode(fontnamed: "baskerville") announcelabel.text = "error loading announcement" announcelabel.fontcolor = uicolor.blackcolor() announcelabel.fontsize = 200 announcelabel.setscale(twitterbutton.frame.height / announcelabel.frame.height) announcelabel.position = cgpoint(x: self.frame.midx, y: self.frame.midy) self.addchild(announcelabel) i testing on iphone 6, , have never had happen while creating label node. have attempted different fonts, positions, , scales no effect. appreciated! thanks! just tested more , found answer. font size big , guess caused bug spritekit. changed font size 50 , worked fine (i have used font size 200 on other label nodes , never had issue): var announcelabel = sklabelnode(fontnamed: "baskerville") announcelabe

ruby on rails - Allow users to sign in using their username or email address with Devise -

problem i followed tutorial on devise's wiki page , login page broken. continually error saying 'invalid email or password.' neither user_name nor email work logging in. note: user name field user_name not username in tutorial. did miss something? type wrong? part cut , paste. code application controller: ## app/controllers/application_controller.rb class applicationcontroller < actioncontroller::base protect_from_forgery with: :exception before_action :configure_permitted_parameters, if: :devise_controller? protected def configure_permitted_parameters devise_parameter_sanitizer.for(:sign_up) { |u| u.permit( :email, :birthday, :password,:password_confirmation, :remember_me) } devise_parameter_sanitizer.for(:sign_in) { |u| u.permit( :login, :user_name, :email, :password, :remember_me ) } devise_parameter_sanitizer.for(:account_update) { |u| u.permit( :first_name, :last_na

mysql - Error while partitioning. [Err] 1654 - Partition column values of incorrect type -

what's wrong mysql query? result [err] 1654 - partition column values of incorrect type drop table if exists part; create table `part` ( `id` int(11) not null auto_increment, `cnt` varchar(255) default null, `created` datetime not null, primary key (`id`, `created`) ) engine=innodb default charset=latin1 partition range columns (created)( partition p_2015_01 values less ('2015-01-30') engine=innodb, partition p_2015_02 values less ('2015-02-30') engine=innodb, partition p_2015_03 values less ('2015-03-30') engine=innodb, partition p_catchall values less (maxvalue) engine=innodb ); if matters, version 5.5 it took quite long time see obvious: the date '2015-02-30' not exist. presumably converted null or something, therefore message 'incorrect type'. hopefully helps someday.

swift - Two sprites with same categoryBitMask colliding with third sprite -

this code i'm using: func didbegincontact(contact: skphysicscontact) { var firstbody : skphysicsbody? var secondbody : skphysicsbody? var thirdbody : skphysicsbody? var goodkind : sknode? var badkind : sknode? var bullet : sknode? if (contact.bodya.categorybitmask < contact.bodyb.categorybitmask) { firstbody = contact.bodya secondbody = contact.bodyb goodkind = contact.bodyb.node badkind = contact.bodyb.node bullet = contact.bodya.node } else { firstbody = contact.bodyb secondbody = contact.bodya goodkind = contact.bodya.node badkind = contact.bodya.node bullet = contact.bodyb.node } if (firstbody!.categorybitmask == physicscategory.tooth && secondbody!.categorybitmask == physicscategory.food) { goodkind?.removefromparent() counter++ println("\(counter)") } else

Have PDFs in folders. Need to record the names and locations in Excel -

Image
don't see questions similar looking for. i have 20k+ pdfs stored in various locations on c drive. don't have complete list of available or when created. what looking find names, size , dates file created. these need recorded in excel spreadsheet note: of pdfs buried 6 or 7 folders deep, while 1 folder deep. can suggest way of automatically it? i have tried using code*: sub listallfiles() dim fs filesearch, ws worksheet, long dim r long set fs = application.filesearch fs .searchsubfolders = true ' .filetype = msofiletypeallfiles 'can modify excel files eg msofiletypeexcelworkbooks .lookin = "h:\my desktop" if .execute > 0 set ws = worksheets.add r = 1 = 1 .foundfiles.count if right(.foundfiles(i), 3) = ".pdf" or right(.foundfiles(i), 3) = ".tif" ws.cells(r, 1) = .foundfiles(i) r = r +

r - How to filter a column by multiple, flexible criteria -

i'm writing function aggregate dataframe, , needs applicable wide variety of datasets. 1 step in function dplyr's filter function, used select data ad campaign types relevant task @ hand. since need function flexible, want ad_campaign_types input, makes filtering kind of hairy, so: aggregate_data <- function(ad_campaign_types) { raw_data %>% filter(ad_campaign_type == ad_campaign_types) -> agg_data agg_data } new_data <- aggregate_data(ad_campaign_types = c("campaign_a", "campaign_b", "campaign_c")) i think above work, while runs, oddly enough returns small fraction of filtered dataset should be. there better way this? another tiny example of replaceable code: ad_types <- c("a", "a", "a", "b", "b", "c", "c", "c", "d", "d") revenue <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) data <- as.data.frame(cbind(ad_types, reven

android - Applying dimensions from dimens.xml to text formatted with Html.fromHtml -

i have code setting text of textview: textview txt = new textview(this); txt.settext(html.fromhtml("<b>" + m.gettitle() + "</b>" + "<br />" + "<small>" + m.gettext() + "</small>" + "<br />"); the <small> mark working, i'd set text size according dimensions defined in dimens.xml file, use other text in application. adding textview through xml layout not option since don't know how many textviews i'll adding. dimensions in dimens.xml file set <dimen name="text_size_320dp_small">16sp</dimen> . how can apply these dimensions text formatted html.fromhtml ? thanks lot. you can't directly, small tag creates relativesizespan proportion of .8f , hardcoded implementation of html.fromhtml . leaves 2 options can see, set text size 20sp (which make small work out 16sp). not ideal. the other option use custom tag <mysmall> re

Nginx configure SSL load balancer -

i have docker server have installed gitlab sameersbn/docker-gitlab i have nginx container listen 443:433 , 80:80, use 1 load balance http , https (with signed cert) requests nginx.conf worker_processes auto; events { worker_connections 1024; } http { ## # logging settings ## access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; upstream gitlab { server gitlab:10080; } server { listen 80; listen 443 ssl; server_name www.domain.tld; ssl on; ssl_certificate /usr/local/share/ca-certificates/domain.crt; ssl_certificate_key /usr/local/share/ca-certificates/domain.key; ssl_trusted_certificate /usr/local/share/ca-certificates/gandistandardsslca2.pem; ssl_session_timeout 5m; ssl_protocols tlsv1 tlsv1.1 tlsv1.2; ssl_ciphers "high:!anull:!md5 or high:!anull:!md5:!3des"; ssl_prefer_server_ciphers on;

Should I not use data attributes in html? -

i coding c# forms application lets user add custom html nodes html webpage. have javascript code selects html node execute specific code objects such jquery ui slider. to identify html nodes, need store attribute in tag identifies tag. i new writing html code, , such, ask if there reason why should not use data attributes tags? there limitations disadvantages should aware of? here example code have working: <!doctype html> <html> <head> </head> <body> <div data-customwebpagelayout-name='slider-increments'> <div data-customwebpageobject-name='slider-increments'></div> </div> <p data-customwebpageobject-output-name='slider-increments'>1</p> </body> </html> thank you. the common way identify , select html tags either class or id . if there going 1 of on page, should use id . looks have multiple of same thing want identify, i'd use class so: <!doc

javascript - Getting and Setting CKEditor HTML in a C#.net Winform App -

i trying use ckeditor in winform app load, manipulate, , store html content in sql server database. i found great post on how ckeditor onto winform: can ckeditor used in winforms application (x)html editing? however not detail how load html content or extract once user has manipulated it. i have tried: webbrowser1.document.getelementbyid("editor1").innertext; however returns initial data loaded editor, after manipulated user, still returns same value. if expand on answer in link above code loads editor content , code displays message box in winform application current content, appreciate it. suspicion requires more javascript in html file opened know nothing javascript , i've spent several days trying trip way through no success. thanks in advance. in more research today, able answer own question... blank html setup file load webbrowser control looks this: <html> <head> <script src="http://cdn.ckeditor.com/4

internet explorer 11 - How to make IE11 behave like IE8 -

my application works fine ie8 not in ie11. not in condition make change in code application code huge.so using following code in common top level jsp:- <meta http-equiv="x-ua-compatible" content="ie=emulateie8"> but still application view not same when manually run page in compatible mode.what have notice when manually run page in compatible mode document mode set 5(default) when using meta tag document mode still set edge. thanks you can forcefully emulate ie11 behave similar ie8.add below lines of code web.config file <httpprotocol> <customheaders> <clear/> <add name="x-ua-compatible" value="ie=emulateie8"/> </customheaders> </httpprotocol>

c++ - GLIBCXX_3.4.9 not found when running ffmpeg from php in lampp server -

i've written php program creates video sequence of images using ffmpeg. <?php $res = shell_exec("ffmpeg -framerate 50 -i image/image%d.png -c:v libx264 -r 30 -pix_fmt yuv420p out.mp4 2>&1"); echo "$res"; when run it, it says glibcxx_3.4.15 , glibcxx_3.4.9 , glibcxx_3.4.11 not found . ffmpeg: /opt/lampp/lib/libstdc++.so.6: version `glibcxx_3.4.15' not found (required /usr/lib/i386-linux-gnu/libjack.so.0) ffmpeg: /opt/lampp/lib/libstdc++.so.6: version `glibcxx_3.4.9' not found (required /usr/lib/i386-linux-gnu/libzmq.so.3) ffmpeg: /opt/lampp/lib/libstdc++.so.6: version `glibcxx_3.4.11' not found (required /usr/lib/i386-linux-gnu/libopencv_core.so.2.4) ffmpeg: /opt/lampp/lib/libstdc++.so.6: version `glibcxx_3.4.9' not found (required /usr/lib/i386-linux-gnu/libopencv_core.so.2.4) but terminal, ffmpeg -framerate 50 -i image/image%d.png -c:v libx264 -r 30 -pix_fmt yuv42

django form.as_table form.errors rendering in row, not pop up -

i under impression django form errors have small popup near form field explained error, something this . instead, mine rendering in cell next field , screwing alignment of table causing ugly, like this . there common troubleshooting this. because using as_table shortcut render aren't working? i use django crispy forms library lot of formatting me automatically. if use bootstrap, template pack describe in installation guide helps keep formatting looking good. it doesn't automatically use tooltips show form errors, should pretty job of keeping error messages looking nice on forms.

c++ - In MFC When EndDialog() is called, when does class destructor fire? -

in mfc, typical dialog window, when onok() called mfc, function calls enddialog() function, , somehow class destructor called @ point. suppose have public variable, string named "test", in cdialog's class, , in dialog ok button's onbnclick() event, set "test" variable value. declare instance of dialog, , call domodal() main window's class. can read variable set once domodal() returns, no problem. void dialog1::onbnclickedok() { test = "the test string has been set."; onok(); } void cmainframe::onedittest() { dialog1 dlg; dlg.domodal(); messagebox(dlg.test, l"main frm",0); } this works, if have dialog several fields, , variable each field. how can sure can read of values variables before destructor called? checked msdn, , understanding onok() function calls enddialog(), , @ point, after enddialog(), class destructor called. want able read values variables set onbnclick() event, don't know when mfc ca

css - Is an input field valid while is empty? -

i've been experimenting css pseudo classes , pseudo elements , discover have not been able around. consider following html input field: <input type="number" value="1" min="1" max="1000" step="1" pattern="\d" /><span></span> in order achieve 3 states: empty, valid , invalid. i'm using ::after pseudo element (applied span adjacent input) add checkmark when value of filed valid, , x when value invalid. i'm using pseudo classes :valid , :invalid , seems when input field empty (value="") state valid. the css in question follows: .v3_forms input[value=""] + span::after { content: ""; } .v3_forms input:valid + span::after { content: "\2713"; color: limegreen; } .v3_forms input:invalid + span::after { content: "x"; color: #ce0000; } for i'm able tell, after clearing value in browser, second css rules takes prece

jquery - Is there any way to use JavaScript to do a Ctrl-F5? -

this question has answer here: window.location.reload clear cache [duplicate] 6 answers is there way can ctrl-f5 type of refresh , reload whole browser window? i've tried following code: function showrefresh() { window.location.reload(true); } the page doesn't seem want refresh correctly. if ctrl-f5 on keyboard reloads fine. appreciated. you well: function showrefresh(){ window.location = window.location; }

ios - Iphone Rotate video within current frame -

Image
hi having video of width = 720 height = 1280 so video in portait mode. i want video rotate 90 degree. want rotated video inside same size of video 720,1280. yes video scaled , need type of rotation . please check image before , after : this mine code : cgaffinetransform rotationtransform = cgaffinetransformmakerotation(degrees_to_radians(90.0)); cgaffinetransform rotatetranslate = cgaffinetransformtranslate(rotationtransform,400,320); [layerinst settransform:rotatetranslate attime:kcmtimezero]; you can use scaling, rotation , translation transform , concat each transform original asset transform. please try below code question // here assettransform avassettrack preferred transform cgaffinetransform defaulttransfrom = assettransform; // rotate 90 degree cgaffinetransform rotatetransform = cgaffinetransformmakerotation( m_pi_2); //get scale factor of resized video float scalefactor = videosize.wi

java - getting compile time error in main program itself in spring integration -

i have been using spring integration develop mail box listener using pop 3 protocol listen mailbox , read mails using pop3 protocol have develop main class in getting error error getting on below line inputchannel.subscribe(new messagehandler() { and complie time error indicating the method subscribe(messagehandler) in type abstractsubscribablechannel not applicable arguments (new messagehandler(){}) below main class import org.apache.log4j.logger; import org.springframework.context.applicationcontext; import org.springframework.context.support.classpathxmlapplicationcontext; import org.springframework.messaging.message; import org.springframework.messaging.messagingexception; import org.springframework.integration.channel.directchannel; import org.springframework.messaging.messagehandler; public class gmailinboundpop3adaptertestapp { private static logger logger = logger.getlogger(gmailinboundpop3adaptertestapp.class); public static void main (string[] args) t

gcc - C macro with flexible argument -

i need : #include <stdio.h> #include <stdint.h> #include <stdarg.h> #define incr(count,args...) \ if(args) \ count++; \ void main() { int count =1; int flag =1; incr(count); printf("count %d",count); incr(count,flag); /* flag determines if count incremented or not */ printf("count %d",count); } i following errors: sh-4.3$ gcc -o main*.c main.c: in function 'main': main.c:6:8: error: expected expression before ')' token if(args) \

wpf 4.5 - WPF Window Top property Won't Change -

i upgraded wpf app target framework 3.5 4.5 , code setting top property stopped working, won't change top value: this.top=45; it stay previous value, never changed 45. don't have type of animations. why behaving this? window xaml <window x:class="salesorderlib.salesorderinquiry" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:datepicker="clr-namespace:microsoft.windows.controls;assembly=wpftoolkit" xmlns:ui="clr-namespace:salesorderlib.resources.ui" xmlns:local="clr-namespace:salesorderlib" xmlns:global="clr-namespace:salesorderlib.common" xmlns:validation="clr-namespace:salesorderlib.validationrules" background="{dynamicresource winbackgroundbrush}" icon="resources/images/toolbar/orderinquiry.png" title="sales order - inquiry mode"

jquery - Bootstrap sliding tabs (not tab content) -

Image
i'm developing project , using bootstrap tabs tabs. users able create new tabs, here problem: more n tabs (where n depends on browser's width) result on behaviour: i surf little bootstrap html tabs code, , tabs li elements inside ul . want achieve this: so on right side (and left side) tabs component may have button let users navigate between created tabs (like slider). anyone guide me goal? or other tab component (from other framework example) implements behaviour default? thanks in advance! there nothing in bootstrap ootb, can this: http://codeply.com/go/43artwzuie this solution uses jquery check width in tabs container, , adjust position of tabs accordingly. another option put overflowing tabs dropdown this: http://www.bootply.com/7oali9a9zl#

vagrant - Laravel Homestead error on chown -

Image
i tried install homestead when run vagrant at middle got error my folder structure is c:/hashicorp/vagrant and homestead at c:/homestead i've added line on vagrantfile inside homestead: config.vm.synced_folder ".", "/vagrant" but still no luck. virtual box version: 5.0 vagrant version : 1.7.3 what should make running?

Can't get gnuplot to fill below line -

Image
i'm trying gnuplot 5.0 under os x 10.10.3 fill blue below lower series in plot. i've tried lots of variations line datafileforecast using 1:4 filledcurves above y1=0 linestyle 3 , nothing seems work. here's source: #!/opt/local/bin/gnuplot reset set terminal pngcairo enhanced background "#000000" font "lato-light,20" linewidth 1 rounded size 2048,670 set output "10dayforecast.png" datafileforecast = "10dayforecast.csv" set datafile separator ',' set timefmt "%y-%m-%d" stats datafileforecast using 2:4 nooutput freezewarning = 32. yhigh = stats_max_x + 10. ylow = stats_min_y - 10. unset key set border linetype rgb "#666666" set boxwidth 0.25 relative set style fill transparent solid 0.4 set style line 1 linetype rgb "#0066cc" # freeze line set style line 2 linetype rgb "#ffffff" pointtype 7 pointsize .5 # points both high , low temp set style line 3 linetype rgb "#000077&

eclipse - How to read .EAP file using java -

within enterprise architect file have definition of xml (the definition specify attributes mandatory or not) , goal read definition, , afterwards validate actual xml file. there way read .eap file using java eclipse ? ps: definition might changes , why need programmatically. any appreciated. no. or: not directly. eap files mickeysoft access databases suffix. read them need use ea api. or use odbc driver access.

parse.com - Parse: Send Pushes to logged in users only -

i can send push notifications specific user using parse. want user receive notifications, if logged in using parseuser.logininbackground if user logged out , notification sent him, should buffered , when logs in again, shall receive buffered notifications. is possible parse? you can take care while sending push, send logged in users. parse has session's api, maintains , opens session table contains logged in users , installation id's. can query session table user's whom have send push, , if have session, can send push notification these users.

method that accepts a generic class as argument in c# -

in project have generic class, used store data , pass function: public class sqlcommandparameter<t> { public string parametername { get;private set; } public sqldbtype sqldbtype { get; private set; } public t sqldbvalue { get; private set; } public sqlcommandparameter(string parametername, sqldbtype sqldbtype, t sqldbvalue) { parametername = parametername; sqldbtype = sqldbtype; sqldbvalue = sqldbvalue; } } but when tried pass instances of function, gives error: cannot resolve t . here method declaration: public task<datatable> getdataasync(int? id, string commandtextquery, commandtype commandtype,params sqlcommandparameter<t>[] parameters ) { ... } since number or values stored procedure different, i'm passing params . how can pass generic class function in proper way? can suggest way without error? you can make getdataasync() generic method, getdataasync<t>() all parameters limi

algorithm - Write a program that takes as input numerators and denominators of fractions and determines their repeating cycles -

for example : 76/25 = 3.04(0) 1 = number of digits in repeating cycle 5/43 = 0.(116279069767441860465) 21 = number of digits in repeating cycle 1/397 = 0.(00251889168765743073047858942065491183879093198992...) 99 = number of digits in repeating cycle this might ugly solution, should work: simplify fraction using greatest common divisor (gcd) - optional , used simplify calculations. do paper-and-pencil division. division encounters repeating remainder can break off, since after point numbers repeat. example: 5 / 27 = 0.185... 50 <------------------------------| -27 -> (1) | 230 | -216 -> (8) | 140 | -135 -> (5) | 50 <-------- same remainer here, can break off -27 -> (1) sorry ugly ascii-"art".

angularjs - Track By in ng-repeat throwing "Token 'track' is an unexpected token" -

i've simple ng-repeat track by expression wont work. here's fiddle . <div ng-repeat="n in [1,2,3,4,5,5,5,5] track $index"> {{n}} </div> resulting token 'track' unexpected token @ column 19 of expression [[1,2,3,4,5,5,5,5] track $index] starting @ [track $index]. it's because you're using angular version 1.0.3 in fiddle. change version (minimum of) 1.2 , work, since introduced in version. i'll provide fiddle in comment since there's no code.

r - Evaluating text within a raster calc function -

i evaluate text argument in raster calculate function use parallel processing in r raster package map function. the code below works fine (but not desirable): library(raster) library(snow) library(doparallel) # using rasterstack input r <- raster(ncols=36, nrows=18) r[] <- 1:ncell(r) s <- stack(r, r*2, sqrt(r)) # create raster calculation function f1<-function(x) calc(x, fun=function(x){ rast<-(x[1]/x[2])*x[3];return(rast) }) # map using parallel processing capabilities (via clusterr in raster package) begincluster() pred <- clusterr(s, fun=f1, filename=paste("test.tif",sep=""),format="gtiff",progress="text",overwrite=t) endcluster() i prefer above raster calculation function line of text can evaluated in raster function itself, this: #create equivalent string argument str<-"rast<-(x[1]/x[2])*x[3];return(rast)" #evaluate in raster calculation function using eval , parse commands f1<-function(x)

java - How change MIDI file? -

in www.jsresources.org example, still problems: velocity? beats per minute? why not 120 64? why ticks means not 1.3 millisecond interval 0.5 second? how place shorter note? how read instruments file? sample code synthesizer synthesizer; synthesizer = midisystem.getsynthesizer(); synthesizer.open(); midichannel chan = synthesizer.getchannels()[0]; chan.programchange(1152, 14); reads midichannel system (global?) not file. velocity volume or gain of note. goes 0 127 - higher number, louder note be. 64 chosen because medium level (not loud). to able use shorter notes, have change resolution of sequence - "tempo based" resolution , works in ticks per quarter note: sequence = new sequence(sequence.ppq, 1); increasing second argument, have more ticks per quarter note, , consequently shorter notes. you use: sequence = new sequence(sequence.smpte_30, 1); this give division type of 30 frames per second. second argument giving maximum resolution of 1 no

sprite kit - Running methods inside a block in Swift -

this dumb question, still... i'm calling function inside block this: let makerocks = skaction.sequence([skaction.runblock(self.createmynode),<---- here should () skaction.waitforduration(0.1, withrange: 0.15)]) func createmynode() { // blabla } i don't it. there should parentheses after self.createmynode still compiles. how so? you're not in fact calling function, createmynode called inside skaction.runblock , you're passing argument. take @ type skaction.runblock accepts, skaction documentation : class func runblock(_ block: dispatch_block_t) -> skaction and gcd documentation : typealias dispatch_block_t = () -> void therefore, skaction.runblock accepts function (or closure, they're same thing), takes no arguments , returns void ; you're suppling createmynode . with information it's clear see why don't add parentheses after createmynode - because call function, passing

javascript - JS ajax - load more than one txt file in string - wrong order -

i have ajax request loads text files. path like: media/img/name1/desci.txt media/img/name2/desci.txt url : http://www.domain.com/media/img/"+sorttitles[i]+"/desci.txt that returns txts in 1 div. don't want that. want place them content different divs. e.g. desc1 in div1... here code. -> sorttitles[i] loads correct files. $.ajax({ url: "http://www.domain.de/chat/media/titles.txt", datatype: "text", scriptcharset: "iso-8859-1", success: function(cats) { sorttitles = cats.split('+++'); chatlength = sorttitles.length - 1; (i = 2; < chatlength; i++) { catholder = document.createelement('div'); catholder.setattribute("id", "cat" + + ""); catholder.setattribute("style", att1); element = document.getelementbyid("categories"); element.appendchild(catholder); catheadwr = document.createelement('di

c# - Licensing information GetPropertyValue in advance installer? -

i error "error creating window handle" when getting licensing information advance installer http://www.advancedinstaller.com/user-guide/qa-get-licenensing-property.html when c# application running in trial mode. however when register c# application , run same code mentioned in above link don't error don't value properties mentioned in link . i thankful kind help.

swift - how to import SwiftBond to Xcode? -

i'm trying import swiftbond framework xcode: https://github.com/swiftbond/bond i've never imported 3rd party framework (except parse, easy do), , lost. idea on how it? downloaded zip file don't know there. thanks i recommend setup cocoapods , learn how use this. because there many 3rd party frameworks support cocoapods, because google announced @ year's google i/o use cocoapods main tool distributing ios frameworks (such google maps or google analytics). you can read official cocoapods guide - getting started setup cocoapods on computer. it's quite since it's possible install ruby command: sudo gem install cocoapods afterwards need create podfile in same folder xcode project (the *.xcodeproj file) following content: use_frameworks! pod 'bond' pod 'parse' and run command pod install in terminal when located in same folder.

java - Inserting spaces In between operand and operators, getting String out of Bounds -

i have assignment create program converts infix expressions postfix. needed insert spaces in between operand , operators, keep getting stringindexoutofbounds reason. here's java code process. public class processor { public string addspace(string str){ string finalstr = ""; (int = 0; < str.length(); i++) { if(character.isdigit(str.charat(i))){ int x = i; string temp = ""; do{ temp+=str.charat(x); x++; }while(character.isdigit(str.charat(x))); finalstr+=(temp+" "); system.out.println(temp+" added final"); i=(x-1); system.out.println(x+" x , "+i); } else if(isoperator(str.charat(i))){ finalstr+=(str.charat(i)+" "); } } return finalstr; } public boolean isoperator(char a){ switch(a){ case '+': case '

ruby - View not displaying in rails application -

i had 1 existing rails application , asked add few features in application. so wrote view file,action new feature. but straight away added .html.erb file , action in existing file directories view new feature not coming. is because added files directly rather running command i have modified route file. there no difference between command , manual. check path , name of new view , action.

Rails: how to generate view/action to existing controller? -

when want add custome view existing controller need create custom_page.erb , add def custom_page in controller , , add routes get ... . repetative. is there generate command , can @ once? maybe rails generate customactiontomycontroller action_name ? nope there no direct way this. check out create new action existing controller

javascript - Angular filter with $http response -

i need filter need make $http call , return response . trying use angular promise nothing works . return not waiting response . take below code. returning {} , not waiting $http response. need using filter only. idea keep separate controller , can used anywhere later. .filter('filterxml',['testone','$sce',function(testone, $sce){ return function(url){ return testone.gettest(url).then(function(data){ return data; }); } }]) .factory('testone', ['$http', function($http){ return { gettest: function(url){ return $http.get(url).success(function(data){ console.log(data) return data; }) } } }]) goal : {{ ' http://rss.cnn.com/rss/cnn_topstories.rss ' | filterxml}} so return data rss feed . i don't want use controller . idea make separate module , call anywhere in application . any appreciated . thanks you shouldn't making http calls in filter tha

mapreduce - Check if element is in documents of rdd -

i have such rdd1 in pyspark: (please excuse minor syntax errors): [(id1,(1,2,3)), (id2,(3,4,5))] i have rdd2 holding such: (2,3,4). now want see each element of rdd2 in how many rdd1 sublists occurs, e.g. of expected output rdd (or collected list dont care) (2, [id1]),(3,[id1,id2]),(4,[id2]) this have far (note rdd2 must first item in line/algorithm) rdd2.map(lambda x: (x, x in rdd.map(lambda y:y[1]))) even though me give true/false second item of pair tuple live it, not work. failing when trying perform map on rdd2 inside anonymous function of rdd1 map. any idea how going in right direction? if rrd2 relatively small (fits in memory): pairs1 = rdd1.flatmap(lambda (k, vals): ((v, k) v in vals)) vals_set = sc.broadcast(set(rdd2.collect())) (pairs1 .filter(lambda (k, v): k in vals_set.value) .groupbykey()) if not, can take pairs1 previous part , use join: pairs2 = rdd2.map(lambda x: (x, none)) (pairs2 .leftouterjoin(pairs1) .map(lambda

Sum columns if adjacent columns match if statements in Google Spreadsheets -

i have sum column if adjacent column b within particular range. here's mean: sheet 1 b 1 $2 november 2 $5 november sheet 2 1 each b1:b cell = november, sum adjacent (my result should $7) 2 is there way in google spreadsheets? does formula work want: =sumif(b:b,"november",a:a)

how to fix 'jspm' is not recognized as an internal or external command, operable program or batch file -

i install jspm in https://github.com/jspm/jspm-cli/wiki/getting-started . npm install jspm -g. run. , call it: jspm install, not run,cmd notice "'jspm' not recognized internal or external command, operable program or batch file." me, please! adding %appdata%\npm in environment variables under path worked me.

javascript - error handling in knockout spa using amd and requirejs -

so have large single-page-application based on steve sandersons spa template . custom bindinghandlers, validation etc working fine. we require use of xmlhttprequests, session , local storage other libraries don't have universal support (jquery 2.0 etc). have core module handles identity , exposes few services , both of these reliant on these features. loaded when user first visits page. i have issue older browsers either a) don't support of modules being loaded throw error before hitting onload function, or b) hits onload function don't support browser features need raise exception myself , handle in manner. example: ie8 throws 'object doesn't support property or method 'addeventlistener'' (jquery error) , ie9 doesn't support need throw custom error. define('core', ['jquery', 'browser'], function($, browser) { if(!browser.hasfullsupport) { throw new error('update browser'); } // al

LLVM : Remove back-edges from the loops in a function -

have unrolled loops inside file a.bc using following command: opt -loops -loop-rotate -loop-simplify -loop-unroll -unroll-count=3 -unroll-allow-partial -debug a.bc -o a.loop.bc now, needed remove back-edges loops inside function, f . thought of creating llvm pass find exit block loop(assume 1 exit block) , replace back-edge edge exit block of every loop. is there straight-forward way it? so if not mistaken want have unique exit block loops ? if of loops have constant trip-count there not phi node @ exit blocks , rather connect them, otherwise there exit phi nodes, should reconstruct them preserve dominance property of ssa, might not straight forward, can find different methods of doing in chapter 5 of book (you can download book) : ssa book

jdbc - Retrieve non-sequence value on insert using Java -

i have created table test_detail create table test_detail( test_key bigint default cast(formatdatetime(current_timestamp(), 'yyyymmddhhmmsssss') bigint) primary key, test_no bigint default test_no_seq.nextval,name varchar(40),age decimal(5,2),gender char(1),address varchar(250), mobile_no varchar(20),date_time timestamp default current_timestamp() ); i inserting records table though jdbc .on insertion have retrieve test_key & test_no .i able retrieve test_no sequence using following logic, explained here int insertedrow=statement.executeupdate(ssql); if (insertedrow == 0) { throw new sqlexception("failed!!"); } resultset rs = statement.getgeneratedkeys(); if (rs.next()){ system.out.println(rs.getint(1)); } how retrieve test_key current_timestamp . try using explicit definition of auto generated keys want back: int inse

parse.com - Parse Cloud Code Can't Use new command for Cloud Code Setting -

after installing cloud code , ok parse new command in day. now, parse new command not working well.show me following error . $ parse new mycloudcode unexpected arguments:[mycloudcode] creates new parse app , adds cloud code existing parse app. usage: parse new [flags] global flags: -h, --help=false: new the documentation must out of date. if use command without name, this: $parse new then, prompt email/password , afterwards, can name directory "mycloudcode" or whatever you'd like.

unix - Extract strings with exactly only two dots -

i looking extract strings have 2 dots below. a.b.c $$abc.$$def.123 the relevance dots. so far have tried grep "\\.{2}" file_name.txt. but not giving me result. please me i think regular expression issue. \.{2} match 2 consecutive dots. you'll want like: ^[^\.]*\.[^\.]*\.[^\.]*$ which "start of string, 0 or more not-dots, dot, 0 or more not-dots, dot, 0 or more not-dots, end of string".

grails - Controller variable isn't usable in double render GSP -

i need use list of fxrate. the index gsp load automatically _form gsp , when user send params return final _table gsp something like: (index (_form (_table _/table) _/form) /index) but controller variable fxrate works in te gsp index , _form. not in table. someone can me this? sorry if not explain right.

android - How to set the percentage in screen of each fragment -

Image
i want design divided screen 2 non equal parts in landscape mode of screen. so, thought automatically in using fragments. problem have encountered each fragment match half of screen. , that's not want exactly. want screen 2 parts non equal in width. want this: you can make use of weight parameter. <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" /> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="3" /> </linearlayout> please notice weights used 2 linearlayouts. first 1 has weight of 1 (it can occupy 1/4 th of screen) , second 1 3 (it can o

java - Generic return type - unable to compile -

i'm reading oracle generics tutorial, , i'm having problem getting following code work: import java.util.*; public class genericreturn { public static void main(string[] args){ integer index = 1; arraylist<integer> al = new arraylist<>(); al.add(10); al.add(20); al.add(30); number s = choose(index, al); system.out.println(s); } static <t, u, s> s choose(t a1, u a2) { return a2.get(a1); } } it won't compile errors are: javac genericreturn.java genericreturn.java:12: error: cannot find symbol static <t, u> t choose(t a1, u a2) { return a2.get(a1); } ^ symbol: method get(t) location: variable a2 of type u t,u type-variables: t extends object declared in method <t,u>choose(t,u) u extends object declared in method <t,u>choose(t,u) 1 error can please me out here? someone's wan

PhantomJS + Selenium , How to se user agent for links that open in new window? -

i'm trying click on link opens in new tab (target="_blank") using selenium , phantomjs problem when phantomjs opens link, doesn't set user agent defined using desiredcapabilities. if link opens in current window ok opens in new window, user agent default 1 ! how can set user agent globally ? (btw i'm using python) after doing investigation, found problem seem ghost driver. checked ghost driver github , found issue there 2013 , there temporary solution that. write solution here no result of github issue in google searches ( https://github.com/detro/ghostdriver/issues/273 ) : guaranteed solution links target = "_blank" , window.open - set phantomjs.page.customheaders.user-agent in desiredcapabilities. in case (window.open) may open new window "about:blank" url, find in handles array activate , surf. so while not recommended set useragent in custom headers in selenium documents way set useragent globally doesn't change i

Creating datasets within Macro SAS -

i have following code: %macro msa (data=, code=, msaname=); data &data; set nodup; %if msa = &code %then %do; msa_name = "&msaname"; output &data; %end; run; %mend msa; %msa (data=bakersfield, code=12540, msaname=bakersfield); %msa (data=chico, code=17020, msaname=chico); so 2 datasets want 1 names bakersfield , chico. however, msa column not display correct value (i.e. column of 12540 bakersfield , 17020 chico msa), nor variable named msa_name gives me correct values (bakersfield of msa_name column, , chico). doing wrong? the issues have code mingle macro syntax data step. please try following: %macro msa (data=, code=, msaname=); data &data; set nodup; if msa = &code /*if msa char, need quote "&code"*/ do; msa_name = "&msaname"; output; end; run; %mend msa; %msa (data=bakersfield, code=12540, msaname=bakersfield

Using the GridLayout in NativeScript -

i trying learn nativescript . in process, thought create common screens. first being login screen. in effort, created following xml. login.xml <page xmlns="http://www.nativescript.org/tns.xsd" loaded="pageloaded"> <gridlayout columns="*, *", rows="80, 80, 80, 80, auto"> <label text="username" row="0" col="0" /> <textfield row="1" col="0" /> <label text="password" row="2" col="0" /> <textfield row="3" col="0" /> </gridlayout> </page> when run app, 4 controls (label, textfield, label, textfield) sitting on top of 1 halfway down screen. don't understand why. i'm trying use basic gridlayout . on second line, you've faulty comma between columns , rows declarations. in xml, properties separated whitespace. <gridlayout columns="*, *", rows=

r - Dynamic choropleth, with time slider or auto playing -

i trying replicate this map : http://darkhorseanalytics.com/blog/wp-content/uploads/2014/05/nybreathe.gif which alternates showing housing , employment densities in nyc through day, in r. i have spatial object, s , census small area polygons , 2 variables, inhabitants ( s@data$pop ) , employment ( s@data$emp ), each area. as in example, have 2 "extreme" cases: choropleth of s@data$pop , in blue, dominant @ midnight. choropleth of s@data$emp , in red, dominant @ noon. and 'intermediate' plots make smooth transition between "1." , "2.". and result "auto play", e. i., keep repeating cycle between "1." , "2.". i imagine ggplot2 + shiny, having time slider control time of day. , perhaps somehow automate, or autoplay time variable. doable in shiny (or other r solution)?

Cordova email plugin. Is there a way to set a default sender? -

so trying use cordova email plugin email pdf email address user specifies. there way can set sender's email address? i know read plugin email has configured on phone (as in personal email address through email app on iphone) is there way specify email address coming , not have use email in email application on phone send pdf? couldn't find alternative lets me use email without configuring on mobile device. works long have email configured.

javascript - correct way to use Stripe's stripe_account header from oauth with meteor -

i'm trying build platform based on meteor uses stripe connect. want use "preferred" authentication method stripe (authentication via stripe-account header, https://stripe.com/docs/connect/authentication ) can create plans , subscribe customers on behalf of users. cannot work. tried second params object, similar exemple in documentation: var stripeplancreate = meteor.wrapasync(stripe.plans.create, stripe.plans); var plan = stripeplancreate({ amount: prod.price, interval: prod.interv, name: prod.name, currency: prod.curr, id: prod.id+"-"+prod.price+"-"+prod.curr+"-"+prod.interv, metadata: { prodid: prod._id, orgid: org._id }, statement_descriptor: prod.descr },{stripe_account: org.stripe_user_id}); but "exception while invoking method 'createstripeproduct' error: stripe: unknown arguments ([object object]). did mean pass options object? see https://github.com/stripe/stripe-node/wiki/passing-options ." not