Posts

Showing posts from April, 2010

Which hostname:port of Bluemix app should be set in acl of Secure Gateway Client -

Image
i make bluemix app access secure gateway client. used "access control list" such following command. acl allow sampleapp.mybluemix.net sampleapp.mybluemix.net bluemix app's fqdn but got error http503 when executed trx. secure gateway client's log "connection #x destination x.x.x.x:xxx refused due access control list" which hostname:port of bluemix app should set in acl of secure gateway client ? secure gateway client interactive command-line interface https://www.ng.bluemix.net/docs/services/securegateway/sg_022.html#sg_009 the hostname use on access control list (acl) allow should actual hostname of on-premises application running, not trying access it. remember acl if allow mutually exclusive, prevent other connections not part of allow acl.

python - Bubble plot or Heatmap in matplotlib -

Image
i trying plot dynamically size able bubble (scatter map). when try plot random data can plot. when trying parse input file not able plot. input: nos,place,way,name,00:00:00,12:00:00 123,london,air,apollo,342,972 123,london,rail,beta,2352,342 123,paris,bus,beta,545,353 345,paris,bus,rava,652,974 345,rome,bus,rava,2325,56 345,london,air,rava,2532,9853 567,paris,air,apollo,545,544 567,rome,rail,apollo,5454,5 876,japan,rail,apollo,644,54 876,japan,bus,beta,45,57 program: import pandas pd pandas import dataframe import pandas.io.data import matplotlib.pyplot plt import numpy np import seaborn sns df=pd.read_csv('text_2.csv') #size of bubbles changes fig = plt.figure() ax = fig.add_subplot(1,1,1) ax.scatter(df['place'],df['name'], s=df['00:00:00']) # added third variable income size of bubble plt.show() i trying put place x axis , name y axis , size taken count(00:00) . sizable bubble not find of examples around. valuable suggestion...

node.js - Is it possible to render another express application from express? -

basically happened have app server running express , routes bunch of spas. great wanted have app runs own node/express script (ghost). can't figure out how set route /ghost go ./webapps/ghost/index.js is not possible? you need redirect incoming requests ghost express instance. have done in personal site adding /blog route primary express instance , forwarding request ghost expresss instance. check out here: https://github.com/evanshortiss/evanshortiss.com/blob/master/server.js the basic gist following: app.use('/blog', function(req, res, next) { // forward request on... return next(); }, ghostserver.rootapp); //...but forward different express instance if you're running both separate processes use apache or nginx redirect requests. if absolutely must use express application forward requests try node-http-proxy module. if need proxy express using http-proxy module nodejitsu: var proxy = require('http-proxy').createproxyserver({}); ap...

outlook - Harmon.ie splash screen keeps on Loading harmon.ie -

when starting outlook 2013, harmon.ie plug in stays on splash screen loading harmon.ie. result outlook.exe cpu raises nothing happens. running outlook 2013 16-bit on windows 8.1 enterprise 64 bit version. it seems facing .net issue. please register following registry key instructs harmon.ie use .net 4.x. windows registry editor version 5.00 [hkey_current_user\software\mainsoft\prefs\preferredclrversion] @="v4.0" ---- jean

scrollpane - How to fire event when scrolling up,javafx -

i developing chat application on java , want use function used facebook retrieve chat history when user scroll up. tried "on scroll" action fire event whenever scroll reach top or down of scroll bar. want fire action event when scroll bar reach top in facbook chat box. here example of want. hope you. import javafx.application.application; import javafx.beans.value.changelistener; import javafx.beans.value.observablevalue; import javafx.event.actionevent; import javafx.event.eventhandler; import javafx.geometry.pos; import javafx.scene.scene; import javafx.scene.control.button; import javafx.scene.control.label; import javafx.scene.control.scrollpane; import javafx.scene.layout.vbox; import javafx.stage.stage; public class scrollutil extends application { private boolean scrolltobottom = false; private boolean scrolltotop = false; public static void main(string[] args) { launch(args); } @override public void start(final ...

How to get multiple values from a single <select> variable in HTML/PHP Codeigniter? -

<select id="selecterror" data-rel="chosen" name="emp_id" > <?php foreach ($all_data $v) { ?> <option value="<?= $v->emp_name."x".$v->emp_id; ?>"> <?= $v->emp_id; ?> </option> <?php } ?> </select> how send 2 values separated x in value database using codeigniter? as there's lack of code controller, assuming mean pass data left of 'x' in value database @ same time data right of 'x', separate piece of data, , not including 'x'. in controller, can do $data_parts = explode('x', $this->input->post('emp_id'); this make $data_parts array, , can use information $data_parts[0] , $data_parts[1] pass database. this work if first , last parts of data don't contain x. urge reconsider you're trying regards splitting of 'x', if means adding column database value of 2 i...

java - String to String mapping using Spring? -

from external system receive string representation of abbreviations , have make transformation(conversion) string example: "o" -> open "c" -> closed "e" -> exit for object object conversion using spring custom converter import org.springframework.core.convert.converter.converter; public class converter<source, target> implements converter<source, target> public final target convert(@nonnull source source) { ... } but can't create string string converter. not want use external mapping library spring capabilities. can't this. simplest thing can switch string input = "o"; string result = null; switch(input){ case "o": result ="open" break; case "c": result ="close" break; .... in matter of fact have on 100 mapings. can spring offer better solution? when don't have logic execute in switch-case, can use static hashmap<string,string> stati...

gradle - How to change artifactory runtime scope to compile scope? -

i working on project uses gradle , jfrog plugin publish artifactory. important code fragments these: plugins { id "java" id "idea" id "groovy" id "pmd" id "findbugs" id "maven-publish" id "com.jfrog.artifactory" version "3.1.1" } dependencies { compile 'com.google.guava:guava:18.0' compile 'com.mashape.unirest:unirest-java:1.4.5' compile 'log4j:log4j:1.2.14' } artifactory { contexturl = "https://some_server/artifactory" publish { repository { repokey = 'libs-snapshot-local' username = artifactory_username password = artifactory_password maven = true } defaults { publications ('mavenjava') } } } publishing { publications { mavenjava(mavenpublication) { components.java } } } when gradle artifactory...

c# - Draw and fill a signal -

Image
i draw , fill signal using graphics.drawcurve , graphics.fillclosedcurve following: graphics gx = drawpanel.creategraphics(); pen pen1 = new pen(color.black); brush = new solidbrush(color.gray); gx.drawcurve(pen1, pointarray1, 0.01f); gx.fillclosedcurve(be, pointarray1); although there no minus in plotted data got filled curved @ minus side of curve (due interpolation?) following: how can rid of these artifacts? thanks in advance! do not use drawcurves plot real data! they nice , useful when creating freehand plot of mouse movements. but when plotting data not tend overdraw esp. when direction changes quickly. see here instructive example of overdrawing! setting tension way limit problem; limit smoothness of lines.. the solution there uses beziers , not should do! with great number of dara points seem have suggest stick drawlines & fillpolygon instead; still should rather smooth..

redhat - rpm build for different os.version -

i rhel6 build machine construct rhel5 compatible rpm using maven rpm build plugin. see how modify arch (amd64 vs i386) , os.name (linux vs. ...) not rhel5 vs. rhel5. your best bet create chroot (or perhaps run vm or docker image, or use mock) contains rhel5 on rhel6 host, , use building packages. there specific ways configure rpm use zlib rather xz, , use md5 rather sha256, change labeling of rhel6 vs rhel5. there no 1 magic switch achieve building rhel5 on rhel6 (without using mock etc isolation) because rhel5 , rhel6 distinct operating systems different api's , versions block success trivial packages.

c# - SmtpException while sending Email -

i trying send email through c# code getting smtpexception a connection attempt failed because connected party did not respond after period of time, or established connection failed because connected host has failed respond 173.194.67.109:587 here how sending email: string hostaddress = "smtp.gmail.com"; mailmessage msg = new mailmessage(); msg.from = new mailaddress(fromemail); msg.subject = "test email"; msg.body = "hi testing invoice"; msg.isbodyhtml = true; msg.to.add(new mailaddress("ramshaafaq2012@gmail.com")); smtpclient client = new smtpclient(); client.host = hostaddress; client.enablessl = true; networkcredential creadit = new networkcredential(); creadit.username = msg.from.address; creadit.password = password; client.usedefaultcredentials = true; client.credentials = creadit; client.port = 587; client.send(msg); your problem here: client.usedefaultcredentials = true; client.credentials = creadit; you specify...

angularjs - How to use SAML authentication in a mobile application? -

i'm trying understand how saml authentication flow work in mobile environment client (angularjs based), api server (node & passport based), , idp exist on different domains. from i've gathered general practice have server return 401 client if there's no authentication present (i.e. client didn't include bearer token in request). client understands 401 response indicates open login endpoint on server. when login endpoint opened makes passport call auth provider (which redirects user auth provider's site) , supplies callback url. when user authenticates, auth provider redirects provided callback url, allows server retrieve information auth provider's response , construct token of sort (e.g. jwt) can used client (i.e. included in headers) when making rest calls identify itself. my question is: how client token server? because we're in redirect-based authentication flow, can't return token callback function; display token in browser without hand...

excel - How to display subtotals for a main and sub category of a PivotTable? -

Image
i have following data: i want calculate occurrence of each color given shape. using pivottables, got this: however, output want: how achieve in excel? possible using pivottable? thanks! solution: yes, is. (1) structure selected fields this: (2) right click "shape" in row labels , in "layout & print" tab, select "show item labels in tabular form". result:

javascript - Creating labels on STACKED GROUP bar chart in d3.js -

i have stacked group bar chart. every bar in group having stacked columns . need print labels(text) on every bar in chart. able print 1 label per group. code looks this, svg.append("g") .attr("class", "y axis") .call(yaxis); var project_stackedbar = svg.selectall(".project_stackedbar") .data(data) .enter().append("g") .attr("class", "g") .attr("transform", function (d) { return "translate(" + x0(d.month) + ",0)"; }); project_stackedbar.selectall("rect") .data(function (d) { return d.columndetails; }) .enter() .append("rect") .attr("width", x1.rangeband()) .attr("x", function (d) { return x1(d.column); }) .attr("y", function (d) { return y(d.yend); }) .attr("height", function (d) { return y(d.ybegin) - y(d.yend); }) .style("fil...

objective c - Snapshotting a view that has not been rendered results in an empty snapshot in iOS 7 -

in ios 8, when click open camera ipad mini gives warning "snapshotting view has not been rendered results in empty snapshot" i using below code open camera device. - (ibaction)takephotograph:(uibutton *)sender { uiimagepickercontroller *picker = [[uiimagepickercontroller alloc] init]; picker.delegate = self; picker.allowsediting = yes; picker.sourcetype = uiimagepickercontrollersourcetypecamera; [self presentviewcontroller:picker animated:yes completion:null]; } - (void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info { uiimage *chosenimage = info[uiimagepickercontrollereditedimage]; [self.cmdtakephotograph setimage:chosenimage forstate:uicontrolstatenormal]; [picker dismissviewcontrolleranimated:yes completion:null]; imagetaken = 1; compress = 1; self.lblerrmsg.hidden = yes; } - (void)imagepickercontrollerdidcancel:(uiimag...

spl - It is okay to implement \Countable in a PHP class that is not meant to be iterable? -

i have multipleexception class collects exceptions (e.g. multiple errors in form fields) , implements countable, don't want iterable list, cause exception (you never throw list). is okay in terms of software design? or misusing spl countable interface? which right way? thanks it okay. countable there of classes can customise value returned calling count() instance. completely separate class being iterable.

Where is my database stored in Slick? [Scala][Slick 3.0] -

i'm not particularly sure if valid question, wondering data base stored in slick for example, if follow example @ http://slick.typesafe.com/doc/3.0.0/gettingstarted.html they create tables : // definition of suppliers table class suppliers(tag: tag) extends table[(int, string, string, string, string, string)](tag, "suppliers") { def id = column[int]("sup_id", o.primarykey) // primary key column def name = column[string]("sup_name") def street = column[string]("street") def city = column[string]("city") def state = column[string]("state") def zip = column[string]("zip") // every table needs * projection same type table's type parameter def * = (id, name, street, city, state, zip) } val suppliers = tablequery[suppliers] // definition of coffees table class coffees(tag: tag) extends table[(string, int, double, int, int)](tag, "coffees") { def name = column[string]("cof...

linux - Initializing a Mininet topology from a bash script -

i'd automate process of setting mininet virtual machine, sshing vm, starting mininet within vm, , initializing topology. need session remain open can issue commands mininet using created network. works, including initializing network, once bash script ends, mininet tears down topology , exits virtual machine. relevant parts of code follows: vboxmanage startvm "mininet-vm_1" --type=headless ssh -t -y -l mininet -p 2222 localhost << herpderp # start network sudo mn --controller=remote,ip=$ip --custom /home/mininet/sf_mininet_vm/mininet/topo_basic.py --topo clos_tree --switch ovsk --link tc herpderp things i've tried: ending here document s0 bash ; ending s0 $shell ; removing delimiter @ end of here document (shot in dark). (1) , (2) exited mininet , left me prompt in vm, reason can't issue commands it. (3) nothing. if have python topo in file can run topo using sudo -e python <nameofthefile> for example, if have...

ruby on rails - Find out if table has ever had records in it, even deleted -

i want show view users if notes column record doesn't have entry previously. i.e ideally first time users. if user deletes note after creating (i.e 0 entries) want show same thing if there records in table. for can't counts like @notes_list = current_user.notes and in view <% if @notes_list.count == 0 %> <%# view 1 %> <% else %> <%# view 2 %> <% end %> so can please me out on or there other better way if check? you can add new column user model named note_created boolean default false value. whenever new user creates field remain false . if user creates post you'll make true rest of time. if user deletes notes field remain true. , can swap views based on field. it may lame solution. don't have better solution right now. :d def create @new_note = note.new(notes_params) if @new_note.save unless @new_note.user.note_created @new_note.user.note_created = true @new_note.user.save ...

Reverse Queryset Order in Django -

this question has answer here: how can tell django orm reverse order of query results? 1 answer i guess question super simple , short but... is there simple way reverse order of queryset in django? example: li = [1,2,3] queryset = collection.objects.filter(pk__in = li) you can use queryset = reversed(collection.objects.filter(pk__in = li)) or queryset = collection.objects.filter(pk__in = li).reverse()

java - Comparison of two-dimensional data structures - simplify and faster? -

how can following code simplified , made faster? this comparison of two-dimensional data structures. several folders, each folder contains files, compared other folders. arraylist<foldergroup> userfolders = commonfunctions.getuserfolders(); if (!userfolders.isempty()) { (foldergroup userfoldersgroup : userfolders) { (foldergroup publicfoldersgroup : publicgroupslist) { if (userfoldersgroup.getname().equals(publicfoldersgroup.getname())) { (file publicfile : publicfoldersgroup.getfiles()) { (file userfile : userfoldersgroup.getfiles()) { if (publicfile.contains(userfile)) { publicfile.setisdownloaded(true); userfoldersgroup.setdownloadedcount(); } } } } } } } the out-most if futile, out-most loop terminate without iterating when userfolders e...

Need to Restart an Excel VBA Do...Until Loop -

here's code seek assistance: for = 1 numplayers replacementdone = 0 until replacementdone <> 0 replacecards = inputbox("blah...blah") if replacecards <> 0 replace100 = application.round((replacecards / 100), 0) if replace100 < 5 players(i, replace100) = deck(deckindex) deckindex = deckindex + 1 else msgbox "invalid entry - try again." end if replace10 = application.round(application.mod(replacecards, 100) / 10, 0) if replace10 < 5 , replace10 > replace100 players(i, replace10) = deck(deckindex) deckindex = deckindex + 1 else msgbox "invalid entry - try again." end if replace1 = application.round(application.mod(replacecards, 10), 0) if replace1 < 5 , replace1 > replace10 ...

ios - Swift cannot assign immutable value of type [CLLocationCoordinate2D] -

can explain why receive error "cannot assign immutable value of type [cllocationcoordinate2d]" give 2 scenarios. reason want second 1 work because in loop , need pass drawshape func each time. this code works: func drawshape() { var coordinates = [ cllocationcoordinate2d(latitude: 40.96156150486786, longitude: -100.24319656647276), cllocationcoordinate2d(latitude: 40.96456685906742, longitude: -100.25021235388704), cllocationcoordinate2d(latitude: 40.96528813790064, longitude: -100.25022315443493), cllocationcoordinate2d(latitude: 40.96570116316434, longitude: -100.24954721762333), cllocationcoordinate2d(latitude: 40.96553915028926, longitude: -100.24721925915219), cllocationcoordinate2d(latitude: 40.96540144388564, longitude: -100.24319644831121), cllocationcoordinate2d(latitude: 40.96156150486786, longitude: -100.24319656647276), ] var shape = mglpolygon(coordinates: &coordinates, count: uint(co...

ios - Using the UIDocumentPickerViewController, is it possible to show a default service (Dropbox, Google Drive, etc) on first open like in Slack? -

Image
normally, behavior uidocumentpicker present, user must use "locations" menu on top right switch between services. possible display either "dropbox" or "google drive" first default? if we're "deeplinking" uidocumentpicker service. it seems slack app able , mymail app wasn't able find api it. ideas? instead of using uidocumentpickerviewcontroller, try using uidocumentmenuviewcontroller. here relevant documentation . uidocumentmenuviewcontroller *documentprovidermenu = [[uidocumentmenuviewcontroller alloc] initwithdocumenttypes:[self utis] inmode:uidocumentpickermodeimport]; documentprovidermenu.delegate = self; [self presentviewcontroller:documentprovidermenu animated:yes completion:nil]; by default, display apps include document provider extension (such dropbox, google drive, icloud, etc.). if user has dropbox or google drive installed on device, these options show ...

php - Hide formulas in PHPExcel -

ok here problem. have following code: $excel = phpexcel_iofactory::createreader('excel2007'); $objphpexcel = $excel->load($template); $objphpexcel->setactivesheetindex(0); $sheet = $objphpexcel->getactivesheet(); //filling sheet tons of info $sheet->getprotection()->setpassword('youwishuknew'); $sheet->getprotection()->setsheet(true); $objwriter = phpexcel_iofactory::createwriter($objphpexcel, 'excel2007'); $objwriter->save('php://output'); it loads template stored in $template (duh) , populates data. here problem. template had formulas locked, in cells weren't selectable. after re-population lock gone (so set again, no problem here) when open re-populated sheet can see formulas! my question is: there way lock cells (make them unselectable) or hide formulas (like excel option in format cells -> protection -> hidden)? ps: checked other questions , didn't find answer question. you should ...

html - Can't get horizontal columns to work -

so i'm trying span list across 4 horizontal columns. set each div 25% still not luck. here's got going <div class="listed"> <div class="section-one" style="display: inline-block;width: 25%;"> <h3>all rooms</h3> <ul> <li>dust furniture</li> <li>polish furniture</li> <li>dust misc. items</li> <li>dust windowsills</li> <li>dust ceiling fans</li> <li>remove trash</li> <li>vacuum carpets</li> <li...

python - How to search for rows with same column value and insert row if it is not present? -

i have following dataset: cvso band period pvalue 1 4 r 1.063372 5.383864e-03 2 4 v 1.652512 1.543246e-17 3 27 v 6.114795 2.174296e-12 4 24 7.163776 1.014593e-17 5 24 r 7.164236 0.000000e+00 6 24 v 7.171452 3.342914e-14 for each value in first column, search whether band i, r , v exist. example, in dataset, 4 has band r , v, whereas 24 has 3 bands. if 1 or more of bands not exist, add na row such following output: cvso band period pvalue 1 4 na na 2 4 r 1.063372 5.383864e-03 3 4 v 1.652512 1.543246e-17 4 27 na na 5 27 r na na 6 27 v 6.114795 2.174296e-12 7 24 7.163776 1.014593e-17 8 24 r 7.164236 0.000000e+00 9 24 v 7.171452 3.342914e-14 (using r) here's possible data.table solution library(data.table) lookup <- c("i", "r", "v") res <- setdt(df)[, .sd[match(lookup, band)] , = cvs...

Sort JSON data by datetime from MySQL data in PHP -

i've got mysql database populated data received youtube api v3. i've managed output data json file below code, want have data outputted descending order of date , time. json string named "publishedat" , format "2015-03-26 15:59:35". i've tried various other similar answers , cannot seem work usort function, wondering if help. i'm new php try , specific possible, please. thanks. <?php //open connection mysql db $connection = mysqli_connect("host","username","password","dbname") or die("error " . mysqli_error($connection)); //fetch table rows mysql db $sql = "select * database"; $result = mysqli_query($connection, $sql) or die("error in selecting " . mysqli_error($connection)); // perform query , store result $result = $connection->query($sql); //create array $songarray = array(); while($row =mysqli_fetch_object($result)) { $songarray[] = $row; } echo json_encod...

php - Dynamically created form not posting ajax in laravel 5 -

i working on ecommerce web application in laravel 5. i have products table , product_options table, both have one-to-many relationship established. in admin panel, have provided provision of dynamically adding product options form on click of button, works fine. but when posting form using jquery ajax on click of button, methodnotallowedhttpexception . here's route : route::post('/admin/products/options', 'productscontroller@storeoptions'); the controller: public function storeoptions(request $request) { $this->validate($request, [ 'p_option_item_code' => 'required|alpha_dash|unique:product_options', 'p_option_details' => 'string', 'p_option_price' => 'required|regex:/^\d*(\.\d{2})?$/', 'p_option_quantity' => 'required|integer', ]); if ( $request->ajax() ) { $request['product_id'] = session::ge...

sql - Postgresql regular expression matching function: regexp_matches -

given string want extract expression matching regexp (e.g. email) array. here actual code, using postgresql 9.4 : select regexp_matches('user1@gml.com lorem ipsum user2@yho.com', '([a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4})', 'g') the output 2 records: regexp_matches ----------------- {user1@gml.com} {user2@yho.com} (2 rows) what want have matches in 1 array e.g.: regexp_matches ----------------- {user1@gml.com, user2@yho.com} (1 row) how achieve that? you can unnest each result array, array_agg lot of them together. it's bit ugly: select array_agg(x) ( select unnest( regexp_matches('user1@gml.com lorem ipsum user2@yho.com', '([a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,4})', 'g') ) ) a(x);

performance - Javascript forEach loop order of operations and execution -

this such beginner question have concern how global object updated. i'll show i'm doing , talk concern. (function() { var obj = {}; var observer = new mutationobserver(function(mutations) { mutations.foreach(function(mutation) { //do whatever mutation //update obj variable }); }); observer.observe(target, config); })(); my concern when mutations coming in back rapidly, guaranteed first mutations finish process before proceeding next batch? think understand how closures work don't think that's need here. thinking passing each batch of mutations function, maybe creating queue , processing way...is better way ensure processed in order came in? creating kind of callback when each mutation process completed, moving on next? or foreach loop handle me? also while processing these mutations, think i'm blocking thread since done synchronously, correct? should use iife around each mutation , use settimeo...

javascript - zoomcharts 1.5.1 - how to display multiple colors/multiple hover on a single link -

i want know if zoomcharts has following features in latest update (1.5.1): i want 1 single link between 2 nodes able colored 2 colors (left-half red , right-half black). also, want able hover on these 2 different colored single-split-link differently?? if copy paste following code here , can see can't done right now... <script> var data = { "nodes":[ {"id":"n1", "loaded":true, "style":{"label":"node1"}}, {"id":"n2", "loaded":true, "style":{"label":"node2"}} ], "links":[ {"id":"l1","from":"n1", "to":"n2", "style":{"fillcolor":"red", "todecoration":"arrow"}} ] }; var t = new netchart({ container: document.getelementbyid("demo...

javascript - node js websock process -

i trying process data got in port. code : var websocketserver = require('ws').server, wss = new websocketserver({ port: 5678 }); wss.on('connection', function connection(ws) { ws.on('message', function incoming(message) { function time_m() { var my_month=new date() var month_name=new array(12); month_name[0]="jan" month_name[1]="feb" month_name[2]="mar" month_name[3]="apr" month_name[4]="may" month_name[5]="jun" month_name[6]="jul" month_name[7]="aug" month_name[8]="sep" month_name[9]="oct" month_name[10]="nov" month_name[11]="dec" return month_name[my_month.getmonth()]; } function acc_array (n) { var arr_acc = new...

JavaScript/jQuery not loading correctly automatically -

when page first loads shows prices until click option. cannot java run @ start monthly price. if want see it. http://www.infinityhost.net/web-hosting-plans.htm i attached 3 parts of code. i have looked on million times , can't find makes load 1 month section automatically. // ______________ price switch $(window).load(function() { $(".price-per-period .per1").click(function() { $(".per1a").show(); $(".per3a").hide(); $(".per6a").hide(); $(".per12a").hide(); $(".per24a").hide(); $(".price-per-period .per1").addclass("btn-shared-checked"); $(".price-per-period .per1").removeclass("btn-default"); $(".price-per-period .per3").removeclass("btn-shared-checked"); $(".price-per-period .per3").addclass("btn-default"); ...

Ruby/Selenium value into array -

i need in ruby/selenium i have few elements on page this: <a class="name" title="migel" href="/profiles/users/_1324567980000000c/">migel</a> i'd give href string value array. when use "find_element" - ok: profile = driver.find_element(:xpath, "****").attribute ('href') but page contains lot of such elements, , try use profile_array = driver.find_elements(:xpath, "lbuh-bluh").attribute ('href') naturally attribute ('href') dont work array. how can in case? in general, task in implementing "random click" on page , want collect "href" elements need array, , realize this: array[srtring1, string2....stringn].sample.click (schematically) would mapping on elements , href attribute sufficient? profile_array = driver .find_elements(:xpath, "lbuh-bluh") .map { |el| el.attribute('href') }

java - Create New String with Several Random New Line -

i have string: string text = "nothing right in brain. nothing left in brain" i want create new string text2 has 2-4 random new line previous, such as: "nothing \n right \n in brain. \n nothing left in brain" or "nothing right in \n brain. nothing left in \n brain" how create new string random new line between words? thinking index of whitespace, in order insert new line after random whitespace. keep getting first whitespace index. know better approach solve this? thank you. there 3 stages problem, splitting string , inserting randomness , using them together... splitting string break words string.split() , creates array of strings (in case words) spaces. string[] words = text.split(" "); //split spaces then rebuild string newlines added instance:- stringbuiler sb = new stringbuilder(); (string word : words) { sb.append(word + "\n"); } string text2 = sb.tostring(); in case insert newlin...

c++ - d3d9 client area getting erased if window is moved out of viewable rect -

i using directx 9 making ui (windowed). move window out off screen (i.e. drag till part of window not visible , drag back) part not visible gets erased. tried making same using directx 10 , works fine. why directx 9 has problem , how solve it?

.net - How to use DoubleAnimation for changing "Tint"? -

i'm used cocos2d apply tint animation of object , hoping find same in wpf since opacity similar between cocos2d , wpf shown below: bitmapimage image = new bitmapimage(); image.begininit(); image.urisource = new uri(longresourcespath + item.imagefile); image.endinit(); imgprofile.source = image; imgprofile.opacity = 0; doubleanimation anin = new doubleanimation(); anin.from = 0; anin.to = 1; anin.duration = new duration(timespan.frommilliseconds(250)); imgprofile.beginanimation(image.opacityproperty, anin); how can change code change tint 100% white 0 (image normal tint) thanks

search - Searching HTML with XQuery and returning the parent node -

i've inherited xquery app running in exist-db , i've been able learn enough xquery tidy bit, i'm struggling final change need do. the app has html file stored in collection in following format: <html> <head>...</head> <body> <div class="part"> <div class="chapter"> <div class="section"> <p>text 1</p> <p>text 2</p> <p>text 3</p> </div> <div class="section"> <p>text 4</p> <p>text 5</p> <p>text 6</p> </div> </div> </div> ... <div class="part"> <div class="chapter"> <div class="s...

php - Warning with, fopen, feof and fgetcsv -

Image
i'm in trouble, failing understand why error happening. so when run code, function getclientproject($cliente) { $file = fopen("projetos.csv","r"); $arraycount = 0; $bool = false; while(! feof($file)) { $data = fgetcsv($file); if($data[0] != '') { if(substr_compare($data[0],$cliente, 0, 3) == 0) { if($arraycount > 0) { $total = count($openproject); for($i=0;$i<$total;$i++) { if($openproject[$i] == $data[0]) $bool = true; } if($bool == false) { $openproject[$arraycount] = $data[0]; $arraycount++; } }else { $openproject[$arraycount] = $data[0]; ...

python - AttributeError when serializing relationship with 'through' table -

i'm trying make django rest framework return me to-many relationship constructed through keyword. however, i'm getting error , have no idea what's wrong. the error i'm getting is: got attributeerror when attempting value field step_number on serializer stepinfoserializer . serializer field might named incorrectly , not match attribute or key on step instance. original exception text was: 'step' object has no attribute 'step_number'. here model: class step(basemodel): description = models.textfield(null=false, blank=false) class stepinfo(basemodel): recipe = models.foreignkey('recipe') step = models.foreignkey(step) step_number = models.integerfield() class recipe(basemodel): title = models.charfield(max_length=100) steps = models.manytomanyfield(step, through='stepinfo') and implementation of serializers: class stepinfoserializer(serializers.hyperlinkedmodelserializer): des...

HTML/PHP: How can we insert PHP variable into anchor tag of html? -

i have .php page has lot of html parts in it. running loop , each value in loop, want pass php variable in anchor tag inside loop. i have tried this: for($i =0; $i<5 ; $i++) { <a href = "test.html?id= <?php $i ?> > sample text </a> } but isn't working. any number of ways. point not mix html php, keep them separately parse-able. this: for($i =0; $i<5 ; $i++) { echo '<a href="test.html?id=' . $i . '"> sample text </a>'; } (in example of code php, , html string that's echo -ed output.) or this: for($i =0; $i<5 ; $i++) { ?> <a href="test.html?id=<?php echo $i; ?>"> sample text </a> <?php } (in example php code wrapped in <?php ?> tags , html kept outside tags.) as long keep php code in <?php ?> tags , html out of tags, parsers know difference.

Visual Studio - 2 projects in Solution - working directory -

Image
i have 1 c++ solution in visual studio 2013. solution contains 2 projects. 1 game engine project, other game project. the default project launches game (it .exe), project depends on game engine project(which .lib game project uses). the problem is, gameengine project uses $(projectdir) or working directory of game, not want. if says in properties use path gameengine folder, wont. i want gameengine project code use working directory of gameengine project file (when load files or images it`s folders). please can me issue? that's not how project references work. idea produce complete working folder in $(outdir) of default project - in example c:\folder\game\bin\x64\release or similar - can later package installer , distribute. presumably, want gameengine project code run in gameengine's projectdir - in example c:\folder\gameengine\bin\x64\release or similar - because want code access additional files in directory. if that's case, should add files game...

Background image shows when referenced in HTML but not when referenced in CSS -

my css file in same directory html file, , background image file exists in images directory. shows if put directly body tag, not if reference in css file. directory structure root - images, html & css in root, picture in images. html: <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html> <head> <title> title </title> <meta name="author" content="me"> <meta name="description" content="description."> <meta name="keywords" content="blah blah"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="style.css" type="text/css"> <link href='http://fonts.googleapis.com/css?family=playfair+display|lobster+two:700' rel='stylesheet' type='text/css'> </head> <body> ...and, of course, rest of file, finis...

javascript - Export Resized Image In Canvas To New JSZip Package -

i can load image canvas element , resize it, i'm having trouble grabbing resized image..... var logo = $(".logo"), loader = $(".load"), canvas = $(".holder"), ctx = canvas[0].getcontext("2d"); function displaypreview(file) { var reader = new filereader(); reader.onload = function(e) { var img = new image(); img.src = e.target.result; img.onload = function() { // x, y, width, height ctx.drawimage(img, 0, 0, 128, 128); var dataurl = canvas[0].todataurl("image/png"); var logo = $(".logo"); var imgurl = dataurl; var imgz = $("<img>"); imgz.attr("src", imgurl); logo.html(""); logo.append(imgz); }; }; reader.readasdataurl(file); } into download package function jszip. // download zip $(".download").on("click", function(imgurl) { var zip = new jszip(); zip.file("l...