Posts

Showing posts from July, 2015

javascript - How to grab a class name from a specific ID using jQuery -

i have id has class name such as... <div id="nav" class="style"> i have array containing of ids called allids. i'm trying select id , grab class name. here have. var grabclass = $("#"+allids[0]).map(function() { return this.class; }); i expect var grabclass equal style. however, if console log grabclass says... [prevobject: b.fn.b.init[1], context: document] not sure how make grabclass equal id nav's class style. use below class name var grabclass = $("#"+allids[0]).attr("class")

Neo4j documents structure for array typess -

i trying model trading network accounts can trade multiple items in single trade. i'd use neo4j able identify , visualize account behavior, , movement of specific items our mongodb documents this { _id: 1233 // doc id date: isodate("2015-05-01t01:00:00"), trade_id: 21312 account: 'joe' to_account: 'tim' items: [ { name: 'oil',count: '5' }, { name: 'sunscreen', count: 1} ] }, { _id: 1234 // doc id date: isodate("2015-05-01t01:00:00"), trade_id: 21312 account: 'tim' to_account: 'joe' items: [ { name: 'peas',count: '100' }, ] } what best structure within neo4j database? struggling how best deal nature of arrays i'd able ask db, list me accounts have traded 'sunscreen' 'peas'. thanks. an array set of records - in neo4j correspond nodes same label. a candidate desi

sql server - MS SQL 2005 - Increment a number inside a String data -

in 1 of column value , sequence stored together. example country= product= shoe item code us000shoe if same country , same product exists product id us001shoe . as can see, each time product added country have increment number one. how should number string value , increment it? why don't have 3 columns country | an_auto_increment_column | product (in sql-server auto_increment identity column) to product code build on fly select country + right('000' + an_auto_increment_column, 3) + product your_brandnew_productid yourtable when you'd insert table wouldn't have care incrementing yourself.

html - CSS drop down menu is not working on iOS devices -

why css dropdown menu work on android , pc browsers, not ios devices? .mainheaderbtns ul li:hover > ul { display:block; } as of tests, dropdown menus, make sure <a href="#"> element visible , clickable on page, have made simple demo , works fine. .nav > li > ul { display: none; } .nav > li:hover > ul { display: block; } <ul class="nav"> <li> <a href="#">menu item</a> <ul> <li>sub item</li> </ul> </li> </ul> for element, apple 1 recommends add onclick = "void(0)" found onclick="return false;" or onclick="" works. div span { display: none; } div:hover span { display: inline; } <div onclick="void(0)">howdy <span>mates!</span></div> 1 https://developer.apple.com/library/ios/documentation/appleapplications/reference/

cordova - Phonegap 2.8.1 Analytics plugin for iOS -

i'm using this tutorial implementing google analytics plugin in phonegap 2.8.1 project. after following steps, build successfuly , code running, , see in console analytics site returning 200 http status code (ok). i'm still seeing no hits in google analytics website itself. can in figuring out problem? take @ pg google analytic plugin , instruction directly them: https://github.com/phonegap-build/gaplugin remember: use mobile google analytic, have create mobile application tracking on ga account work. otherwise, see alternative solution not using plugin: how use google analytics phonegap without plugin? ========= requirement v2 ga plugin since not on pg 3, not need plugman. have include plugin manually. your app must link following frameworks: coredata.framework systemconfiguration.framework libz.dylib libgoogleanalytics.a include following file: gai.h gaitrackedviewcontroller.h gaitracker.h gaitransaction.h gaitransactionitem.h libgoogleanalyti

web applications - JavaEE 7 and Socket.io -

i have web application uses socket.io connect node.js server. have implementations in java , wants same client communicate java server side. how current socket.io client can connect java end ? you should @ least try before asking kind of question. socket.io support websocket transport, work if , if websocket transport used.

php - Cakephp set default value for multiple checkbox subgroups -

how set default selected checkboxes when using "sub-groups" of checkboxes? can achieve so-called "sub-groups" having nested array 'options' attribute. want have checkboxes selected default. echo $this->form->input('foobar', [ 'type' => 'select', 'multiple' => 'checkbox', 'label' => false, 'class' => 'inlineblock', 'options' => [ 'foo' => [0 => 'yes', 1 => 'no' ] 'bar' => [0 => 'one', 1 => 'two', 2 => 'three'] ]]); i've tried setting 'selected' => [0 => [0, 1], 0 => [0, 1, 2]] and 'checked' => true but no luck. if check them manually , submit form, cakephp generates url parameters if there no "sub-groups", e.g.: 'options' => [0 => 'yes', 1 => 'no' ] w

ionic framework - Nginx proxy_pass not working for tomcat (404 not found error) -

my angular app running on localhost:3030 through nginx . my rest service running on tomcat localhost:7001 nginx-conf settings : enter code here server { server_name localhost; listen 3030; location / { root d:\ionic_workspace\merigaadi\www; } location /app { proxy_pass http://localhost:7001/; } } i have tried fix...but didn't luck. getting following error: get http://localhost:3030/app/unauth/login/authenticate 404 (not found) proxy_pass not working please me on this.

asp.net mvc - Render string to html in MVC -

a similar question asked here answer did not solve problem below. how can render string html? basically, need pass string view has "a" tag definition in it. want render actual html link clickable. view model (simplified): public class myviewmodel { public string mylink { get; set; } } in controller (simplified): public iactionresult index() { myviewmodel model = new myviewmodel(); model.mylink = "&lt;a href=&quot;http://www.google.com&quot;&gt;http://www.google.com&lt;/a&gt;" return view(model); } in view (at first line): @model mynamespace.viewmodel.myviewmodel then below, these html markups (1st lines after numbers) displays results (2nd lines). none of them actual links can click on. 1 @model.mylink &lt;a href=&quot;http://www.google.com&quot;&gt;http://www.google.com&lt;/a&gt; 2 <pre>@html.raw(@model.mylink)</pre> <a href="http://www.google.com"&

Git way of handling local configuration -

so example have project on git , 1 file responsible various configurations, must change file locally make project build on local machine, @ same time want pull file when global configuration changed. so memorize our local changes, checkout, pull, reapply changes. it nice if git handle portion of file local specific , ignore during pull/push merging. various configuration files have different comment sections, if git check if comment line contains keywords this: ##### git ignore section starts, put local changes here ##### .. add local changes ##### git ignore section ends ##### or this /* git ignore section starts */ .. add local changes here /* git ignore section ends */ so git keyword "git ignore section" , ignore between tags... is there already?

python - Charts are not matching up one is centered the other is left justified in matplotlib -

im trying make stock chart have. candle stick chart of price overlapping moving averg. on button bar chart of vol. the issue candle stick chart , vol chart centered, while moving averg right justified. when moving averg chart overlaps candle stick, not lines on x axes. (update: added 2 more charts @ buttom use plot methed, left justified to, seems al charts using plot left justified while res centered) i use ax2v = ax2.twinx() moving averg on same graph candle stick. ax2 candle stick, ax2v moving averg. i did , stack overflow , saw 1 said add align='center', io tried thatv follows ax2v.plot(bit.slowmacd[macdstart:], align='center') , got error saying typeerror: there no line2d property "align" the code snippet candle stick , moving averg chart # ### set uo candle stick chart x = 0 y = len(bit.listall) ohlc = [] while x < y: append_me = bit.listall[x], bit.openprice[x], bit.biggestprice[x], bit.smallestprice[x], bit.closeprice[x], bi

java - How to use so-linger to keep server connection for some time -

i have tcp gateway built using spring integration. server able process request client , send response. client giving socketexception java.net.socketexception: connection reset @ java.net.socketinputstream.read(socketinputstream.java:168) @ sun.nio.cs.streamdecoder.readbytes(streamdecoder.java:264) @ sun.nio.cs.streamdecoder.implread(streamdecoder.java:306) @ sun.nio.cs.streamdecoder.read(streamdecoder.java:158) @ sun.nio.cs.streamdecoder.read0(streamdecoder.java:107) @ sun.nio.cs.streamdecoder.read(streamdecoder.java:93) @ java.io.inputstreamreader.read(inputstreamreader.java:151) it seems server closing connection before client reads data. hence use so-linger . setsolinger supposed keep server socket open linger time. javadoc setsolinger says enable/disable so_linger specified linger time in seconds. see https://docs.oracle.com/javase/6/docs/api/java/net/socket.html#setsolinger%28boolean,%20int%29 see spring integration document setting so

javascript - filter / sort results with multiple radio buttons with reset button jquery -

i have following fiddle showing filter stands. i have filter working filters based on first radio button clicked out of 1 name group. , second filter filters results within it's name group. where i'm stuck being able reset or 'show all' of 1 name group while preserving second name group. it nice @ stage add more filters i'm not sure code structured correctly take that... any appreciated! here's js var i, boxes, row, classnames = [], reset, results; $('.list').on('click', 'input', function(event){ // set defualt // reset = false; // title of row used later row = $(this).parents('.list').attr('data-attribute'); // hide results $('.results').find('.car').removeclass('active'); if( $(this).attr('value') == ('clear-' + row) ) { console.log('reset button: ' + row); //reset = true; } else

javascript - Sort returning different results in different browsers -

function sort(type) { $("#parentdiv").empty(); $.getjson("raw_data.json", ({ search }) => { search.sort((a, b) => a[type] > b[type]); console.log(`sorted by: ${type}`); ...code different results shown in different browsers, correct 1 showing in firefox devoloper edition , wrong results shown in chrome browser. the sort function should return number, a number less 0 move element a lower index b a number greater 0 move element b lower index a if number 0 leave elements @ same place. more sort function here: https://developer.mozilla.org/en-us/docs/web/javascript/reference/global_objects/array/sort

qt - QtConcurrent reduce with initial value -

i want calculate bunch of pixels , put them qimage using qtconcurrent::mappedreduced . qimage::setpixel: coordinate (636,442) out of range error. presumably because of using default qimage constructor constructs null image. didn't find way in documentation how set constructor arguments or how provide initial value reduction. there way how this? thought reduction requires specify initial value... in js... qt had different idea. skeleton: struct pixel{ qrgb value; qpoint pos; }; void reducer(qimage &result, const pixel &pixel){ result.setpixel(pixel.pos,pixel.value); } i found workaround... code not optimal... because have make check every time reducer runs... void reducer(qimage &result, const pixel &pixel, int width, int height){ if(result.width()==0) result = qimage(width,height, qimage::format_rgb888); result.setpixel(pixel.pos,pixel.value); } ... auto boundreducer = std::bind(reducer,_1,_2,width,height); this che

jquery - Simple chat application not working on live website -

i'am new nodejs. following tutorial online on how make socket.io(chat application). made simple application works offline, in order work, have go command prompt, go project , type : node server : start sever on port 3000. i wanted put small application onto website, did here but when try type in chat box wont display, , giving me bunch of errors in console. know has port. don't know how make work on live website. here server side code: // include of our modules var express = require('express'); // set variable "app" = 'express' variable var app = express(); // set our server variable, , pass in 'app' variable var server = require('http').createserver(app); // include socket.io , listen 'server' variable var io = require('socket.io').listen(server); // * going have 2 arrays // 1 users, other 1 connections users = []; connections = []; // run server, , listen assigned port server.listen(process.env.port

java - Convert file to byte array in reverse order -

byte[] bfile = new byte[(int) file.length()]; fileinputstream fileinputstream = new fileinputstream(file); fileinputstream.read(bfile); fileinputstream.close(); this code let's me convert file byte array, looking reading file end start (in reverse order) edit : dont wan't read entire file. part @ end (example around 1000 bytes) file file = new file(/*file path*/); byte[] bfile = new byte[1000]; randomaccessfile fileinputstream = new randomaccessfile(file, "r"); fileinputstream.seek(fileinputstream.length() - bfile[0].length); fileinputstream.read(bfile, 0, bfile.length); fileinputstream.close(); i figured out, reading last 1000 bytes of file

java - How to get ButtonGroup of JRadioButton -

in project, added itemlistener group of jcheckbox , jradiobuttons. and want when user click on selected jradiobutton, gets deselected. for method know getting corresponding buttongroup , calling clearselection() method. in itemstatechanged() method have jtogglebutton option=(jtogglebutton)event.getsource(); so option refers either jradiobutton or jcheckbox. have searched cannot able find method buttongroup jradiobutton. you can use getsource , check instanceof . if jradiobutton cast jradiobutton , set selected false. same thing jcheckbox if(event.getsource instanceof jradiobutton){ jradiobutton btn=(jradiobutton) event.getsource(); btn.setselected=false; } else if (event.getsource instanceof jcheckbox){ jcheckbox chb= (jcheckbox) event.getsource(); chb.setselected=false; } if want deselect selected 1 can add condition below if(event.getsource instanceof jradiobutton){ jradiobutton btn=(jradiobutton) event.getsource(); if(btn.i

How can i use a button with php? -

how can use button or form php? <button formmethod="get" neme="1" type="button">click</button> <?php if ($_get["1"]) { require_once "0000.php"; $query = mysql_query("select * op"); while ($rwo = mysql_fetch_object($query)) { $rwo-> id; } } ?> an error shown. trying if clicks on button, results show up. typo neme="1" should name="1" i think still need <form> tag wrapped around button you'll want echo $rwo->id; see results use isset avoid undefined index notices use input type="submit" instead of type="button" <form> <button formmethod="get" name="1" type="submit">click</button> </form> <?php if (isset($_get["1"])) { require_once "0000.php"; $query = mysql_query("sele

javascript - != operator not working in while loop condition when combined with || OR -

i have basic while loop executing prompt's input value, running through condition. odd reason when use !== along || in same condition not work. know can add additional parameters compare against using isnan , other logical operators, makes no sense why not work , route working. var number; { number = parseint(prompt('enter 1 or 2')); } while ((number !== 1) || (number !== 2)); if run following code single expression compare against, work no problem, in previous statement not have multiple conditions compare against. var number; { number = parseint(prompt('enter 1 or 2')); } while (number !== 1); thanks! if number 1, lhs false isn't 2 rhs true , overall test true. if number not 1, lhs true , overall test true. you need && there saying if number not 1 , not 2 .

python - Trying to download CSV file from Redmine using Requests -

i've gone through few similar questions , tried suggestions, haven't quite gotten answer. i'm trying download csv file of redmine forum using python. if follow link below within browser (on network can access it), download csv file. http://bugs.internal.com/projects/issues/issues.csv?utf8=%e2%9c%93&columns=all&description=1 and i'm looking same behavior python. here's i've tried far. think should printing whole csv file, prints blank. import csv import requests csv_url = 'http://bugs.internal.com/projects/issues/issues.csv?utf8=%e2%9c%93&columns=all&description=1' requests.session() s: download = s.get(csv_url) decoded_content = download.content.decode('utf-8') cr = csv.reader(decoded_content.splitlines(), delimiter=',') my_list = list(cr) row in my_list: print(row) does have pointers? think it's url, don't know start.

magento - Cannot access modal-popup.html template in Luma theme -

Image
i'm stuck on point. don't know why i'm getting error on fresh magento 2 site. i'm using osx yosemite 10.10.5 mamp. forbidden you don't have permission access /magento/pub/static/frontend/magento/luma/en_us/magento_ui/templates/modal/modal-popup.html on server. from have found has not been answered elsewhere, please don't close unclear or not useful if can't answered. solved finally!!!!! using mac yosemite 10.10.5 easy. step1: goto root folder of magento this: cd applications/mamp/htdocs/magento step2: and 1 one type these php bin/magento setup:static-content:deploy php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento cache:clean and done! if receive fatal error local missing in php bundle bla bla bla ... in php bin/magento setup:static-content:deploy step2. because php 5.5 or other version 1 running on mamp. can check command php -i running on mac and php running on mamp: http

How to get headers from a CSV.read on a CSV file with only a header row in ruby -

so, i've been messing around csv files in ruby, , i've come across issue. in testing, call of x = csv.read(file, headers:true) on file contains header row return table, that, when converted array, returns [[]], , calling x.headers returns []. can circumvent problem setting return_headers:true, don't want file return headers, want headers. when add in fake, second row, x.headers returns headers, , :return_headers not need set true. here code before , after adding row visualize issue. with headers:true, return_headers:true on csv file header row: a = csv.read("june.csv", headers:true, return_headers:true) # <csv::table mode:col_or_row row_count:1> a[0] # <csv::row "day":"day" "time":"time"> a.headers # => ["day", "time"] with headers:true on csv file header row: b = csv.read("june.csv", headers:true) #<csv::table mode:col_or_row row_count:1> b[0] # => nil b.he

hadoop - Hive How to get non-grouped columns for each group of grouped results? -

i have table similar following. |name | grp | dt ------------------------------ |foo | | 2016-01-01 |bar | | 2016-01-02 |hai | b | 2016-01-01 |bai | b | 2016-01-02 |baz | c | 2016-01-01 for each group, want find name dt recent. in other words, max(dt), group grp, , associate name dt max of group output: |name | grp | dt ------------------------------ |bar | | 2016-01-02 |bai | b | 2016-01-02 |baz | c | 2016-01-01 in oracle, following query works , clean (taken here ): select o.name, o.grp, o.dt tab o left join tab b on o.grp = b.grp , o.dt < b.dt b.dt null however fails [error 10017]: line 4:43 both left , right aliases encountered in join 'service_effective_from' question quoting documentation , learn cannot use inequality operator in join statement: only equality joins, outer joins, , left semi joins supported in hive. hive not support join co

python - Sort a list of cdef objects by attribute in a cdef class -

i sort list inner of class. list contains objects of cdef class called edge . edge class contains member variable called savings . sort list variable. cdef class alist: def __init__(self): self.inner = [] cdef list inner cdef void append(self, edge a): self.inner.append(a) cdef void pop(self, int a): self.inner.pop(a) cdef void insert(self,int pos,edge a): self.inner.insert(pos,a) cdef int index(self,edge a): if in self.inner: return self.inner.index(a) return -1 cdef edge get(self, int i): return <edge> self.inner[i] cdef void sort(self): self.inner.sort(key = lambda c : c.savings) #self.inner.sort() def __len__(self): return len(self.inner) def __richcmp__(edge self, edge other,int op): if op == 0: if self.inner.savings < other.inner.savings: return true return false in order that, created me

yii - besides default endpoint create custom endpoints -

i following tutorial http://learncooltech.com/yii2-angular-how-to-create-single-page-application-in-minutes/ i got tutorial work , can see /books: list books page page; however, want create endpoints , in controller added method test 404. here controller namespace app\controllers; use yii\rest\activecontroller; class bookcontroller extends activecontroller { public $modelclass = 'app\models\book'; public function behaviors() { return \yii\helpers\arrayhelper::merge(parent::behaviors(), [ 'corsfilter' => [ 'class' => \yii\filters\cors::classname(), ], ]); } public function actiontest(){ return json_encode(array("name"=>"john doe")); } } i have urlrule 'urlmanager' => [ 'enableprettyurl' => true, 'enablestrictparsing' => true, 'showscriptname'

excel - Matching booking data to opportunity data -

i need matching data. have 2 files. 1 data set off accounts have , second booking file accounts have booked. need match booking data opportunity file shows me accounts have booked. there unique identifier in each file (an account number example) need match all appreciated many thanks

class - Creating classes for geometric shapes (points, lines, square, triangle, etc) (ruby) -

i'm studying in code-school right , mentor give home work, don't it. can me? so, asked create geometric shapes via classes: first of must create class point then must create class line (line - when 2 points connected) and next step, example want create square and i've started code, , created class point, accessible coordinates (2d): class point attr_accessor :x, :y def initialize @x = 10 @y = 10 end def x=(value) @x = value end def x() @x end def y=(value) @y = value end def y() @y end end and example want create new point class. so: p = point.new p.x = 1 p.y = 5 print p # -> #<point:0x007f9463089cc0> and result have thing this: #<point:0x007f9463089cc0> what mean? but if ask print p.x , p.y - have understandable result: print p.x, ", ", p.y # -> 1, 5 am doing wrong or how can understand result on screen? please, need understand this... thanks help! and que

android - Is WAKELOCK set per application or activity -

when setting wake lock flag using flag_keep_screen_on set wakelock whole application or activity. example have set in main activity, place it's required, , in onpause() of activity removed it. need remove in onpause() of every activity in app or on set. all find in documentation should ever set in activity not service etc doesn't seem effects. it appear wakelock set per application. tested setting, opening different activity , leaving time out - didn't.

vala - undefined reference to `soup_session_new' -

i trying make request in vala following this: https://wiki.gnome.org/vala/libsoupsample . says , compiler throws this: connection.vala.c:(.text+0x76): undefined reference `soup_session_new' collect2: ld returned 1 exit status error: cc exited status 256 compilation failed: 1 error(s), 0 warning(s) and result pkg-config --libs --cflags libsoup-2.4 -pthread -i/usr/include/libsoup-2.4 -i/usr/include/libxml2 -i/usr/include/glib-2.0 -i/usr/lib/x86_64-linux-gnu/glib-2.0/include -lsoup-2.4 -lgio-2.0 -lgobject-2.0 -lglib-2.0 i have vala 0.20.1. runing on elementaryos (the newest stable version). ideas? i had same issue earlier today. seems example out of date. it's no longer called soup_session_new , reference soup_session_sync_new . use new soup.sessionsync () , should work. here's working example: using soup; int main (string[] args) { string url = "http://google.com"; stdout.printf ("getting data %s\n", url); var ses

javascript - Problems Adding Commas To Numbers -

i have implemented comma roundnum of display total being moved; $.fn.digits = function(){ return this.each(function(){ $(this).text( $(this).text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,") ); }); }; $('.total').text(roundnum).digits(); however cannot seem same actual counter. $.fn.countto = function(options) { // merge default plugin settings custom options options = $.extend({}, $.fn.countto.defaults, options || {}); // how many times update value, , how increment value on each update var loops = math.ceil(options.speed / options.refreshinterval), increment = (options.to - options.from) / loops; return $(this).each(function() { var _this = this, loopcount = 0, value = options.from, interval = setinterval(updatetimer, options.refreshinterval); function updatetimer() { value += increment; loopcount++;

index 0 in the second level javascript arrays -

can please know why if second level entry in multidimensional javascript array returned undefined if level length equal 1 ? example : arr = array( array(1) ) the following return unlikely result : undefined , while it's suppose 1 (or @ least that's expect be) console.log(arr[0][0]) but when have more record in level ( length>1 ) : arr = array( array(1,2) ) and try : console.log(arr[0][0]) , returns 1 time. explanation issue or why happening appreciated thanks you should consult documentation of array constructor : arraylength if argument passed array constructor integer between 0 , 232-1 (inclusive), returns new javascript array length set number. array(1) not create array element 1 , creates array of length 1 one element: undefined . to have less ambiguous constructor, use array literal: [[1]] this 1 array contains 1 array contains value 1 .

How to apply CORS to a specific rest endpoint -

i not sure whether have right understanding cors, possible apply cors specific rest endpoint under domain. example: there 2 rest endpoints , b under domain https://www.example.com/ , can apply cors rest endpoint a. i think cors applied @ domain level, not @ endpoint level. yes can enable cors access without while keeping disabled b. the mechanism cors interaction browsers through http headers. can choose return cors headers in responses requests while choosing not return them in responses requests b.

Number formatting in R -

i have r vector a = c(.45652356112, .0000063983562) . , want format numbers in vector such resulting vector c(.46, 6.4e-06) . when do format(a, digits=2, nsmall=2) then result c(4.6e-01, 6.4e-06) rather want. apparently, each of elements should passed format() function separately desired result. however, since length of original a 50000, loop calls format() each element way slow. how can desired formatting without loop? you can put format inside ifelse condition ifelse(a < 0.001, format(a, digits = 2, nsmall = 2), round(a, 2)) # [1] "0.46" "6.4e-06"

restrict access on public folder in laravel 4.2 -

im new laravel , im working on project needs store files in server. im doing store under public/docs problem files under directory accessible time given know url file. example if logged out if know url http://localhost/dummy/public/uploads/docs/2016-06-02-10-52-43-oth-content-inventory-and-planning-spreadsheet.pdf able access im thinking in routes route::any('uploads/docs/' , 'go controller check if user can acces'); is possible? in advance! it's called public reason... you should use storage instead (laravel 5) in storage dont restrict access, actualy opposite, grant access file . try laravel 4.2 (move file after upload storage folder) input::file('file')->move(__dir__.'/storage/',input::file('file')->getclientoriginalname()); }); anyway ,the conclusion can't restrict access (you shouldn't if there way) because it's meant public ! should use storage folder(or whatever called in laravel 4)

How to display extra components in view on Button press in react-native? -

this ideal methodology question. new react-native , developing app in asking people enter list of cars own. when arrive @ app screen, see fields enter 1 car's information. but when press 'add car' button below above input fields, on same page, should able see 1 more set of fields add information car. what ideal way this, i have done following, i have 1 set of car information fields displayed default in render function after that, have 'add car' touchable highlight when touchable highlight clicked, function called returns , new set of fields added (textinput>, etc. ) how add information returned on page? should update state variable "" @ start , contain "textinput etc." later? this sounds ideal use case map : updatecar (index, name) { let cars = this.state.cars // update value cars[index].name = name this.setstate({ cars: cars }) } addcar () { let cars = this.state.cars // add new car car

css transitions - Working off a CSS3 animated background tutorial -

i'm working off of great css3 animated background tutorial can found here the problem won't work. unfortunately, tutorial blog post code, , there's no specific name it, i've been having trouble finding support issue. it uses simple html markup: <ul class="cb-slideshow"> <li> <span>image 01</span> <div> <h3></h3> </div> </li> <li> <span>image 02</span> <div> <h3></h3> </div> </li> <li> <span>image 03</span> <div> <h3></h3> </div> </li> <li> <span>image 04</span> <div> <h3></h3> </div> </li> <li> <span>image 05</span> <div> <h3></h3> </div> </li> <li> <span>image 06</span> <div> <h3></h3> </d

php - how to retrieve image from database using mysqli prepare? -

i'm trying convert codes mysqli prepare , i'm having trouble retrieving images database particular data. let example, id 1 post image of in tha same page. can please check codes guys? i'm trying view image particular data. can me guys? thank you, code: this code in form: <form action="upload_photo.php" method="post" enctype="multipart/form-data"> <div class="col-md-6"> <div class="alert alert-info" role="alert"><span class="glyphicon glyphicon-user" aria-hidden="true"></span>&nbsp;&nbsp;add/update photo</div> <input type="hidden" name="id" value="<?= $id; ?>" /> <input type="file" name="image"><br> <input type="submit" value="upload image" name="submit"> </div> <div class="ro

reactjs - When and where to separate a React component into a separate file? When to do it in the same file? -

now let's have output select field in form. have set select options based on data passed component. when using es6 classes, can use method in same file display : selectform() { <input ....> this.props.data.map((data) => { option... }) } render() { return ( <div> {this.selectform()} </div> ) } we can add separate file, import separate component , use in file : render() { return ( <div> <selectfield data={this.props.data}> </div> ) } out of 2 options, recommended way of doing things? if want reuse component (in select case surely would) write in separate file , import it. if it's app specific component in app component (method 1 in example). read more reusable components here: https://facebook.github.io/react/docs/reusable-components.html

javascript - Reusing react/redux component on different routes connected to different part of state -

i running problem because have complex component renders list of items. list of items taken directly redux state tree. want have 2 separate routes reuse same component, each of them connect different list state tree. here simplified example: starting state tree: state = { fruits: ['apple', 'banana', 'grape', 'pear'], vegetables: ['celery', 'carrot', 'cucumber'] } and simple listing component class listview extends component { render() { return ( <div> {this.props.items.map((item, index) => <div key={index}>{item}</div> )} </div> ) } } function mapstatetoprops(state) { return { items: state.fruits } } export default connect(mapstatetoprops)(listview) the higher level app component looks this: class app extends component { render() { return ( <div> {this.props.children} </div> )

node.js - When use istanbul, is there any way to dynamic require config.js? -

Image
the logenable write in config.js , there way change value during testing? can improve branch coverage. you ignore parts of code testing: https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md skip if or else path /* istanbul ignore if */ or /* istanbul ignore else */ respectively. for other cases, skip next 'thing' in source with: /* istanbul ignore next */ or add single test checks logging functions both logging enabled , disabled (you can override required modules, config, example proxyquire: https://github.com/thlorenz/proxyquire ).

javascript - setinterval on load json object one by one -

i have array objects , have display 1 one equal interval of time, code displays json need each comment added 1 one. <script> $(document).ready(function() { $('div.comment-container').comment({ title: 'comments', url_get: 'articles/id/1/comments/list', limit: 10, auto_refresh: false, refresh: 10000, transition: 'slidetoggle', }); }); </script> my array has { "results": { "comments": [ { "comment_id": "1", "parent_id": "0", "in_reply_to": null, "element_id": "134", "created_by": "1", "fullname": "administrator admin", "picture"

software setup for php web application with mysql database -

i have been developing application in php mysql database. know whether possible create setup install php application in lamp? know whether possible create setup install lamp , application through single setup? i think bitnami lamp stack looking for

ios - How to create an unwind segue programatically -

this question has answer here: how perform unwind segue programmatically? 8 answers i have force user go home screen when app becomes foreground background. in case i'll have create unwind segue in each , every view controller. instead i'm trying is, create parent class view controllers , perform segue. doing can avoid adding unwind segues every view controller storyboard. i need way create unwind segue code instead of creating storyboard. thanks in advance. since, need go home screen, suppose should root controller of uinavigationcontroller. for use: //this pop navigation controller root controller navigationcontroller?.poptorootviewcontrolleranimated(true)

SDL/OpenGL commands not set in scope? -

i'm trying write simple sdl , gl program on mac create triangle, not working. (in c++) #include <iostream> #include "sdl/sdl.h" #include <opengl/gl.h> #include <opengl/glu.h> /*initialize*/ void init() { glclearcolor(0.0,0.0,0.0,1.0); glmatrixmode(gl_projection); glloadidentity(); gluperspective(45,640.0/480.0,1.0,500.0); glmatrixmode(gl_modelview); glloadidentity(); } /*display*/ void display() // drawing { glclear(gl_color_buffer_bit); glbegin(gl_triangles); glvertex3f(0.0,2.0,-5.0); glvertex3f(-2.0,-2.0,-5.0); glvertex3f(2.0,-2.0,-5.0); glend(); } /*main*/ int main(int argc, char** argv) // arguments required { sdl_init(sdl_init_everything); // initialize , setup sdl sdl_surface* screen = sdl_setvideomode(640,480,32,sdl_swsurface|sdl_opengl); bool running = true; uint32 start; sdl_event event; init(); while (running) { start = sdl_getticks();

azure - How to Send a Remote Notification on a Button Click? Xamarin.Android C# -

i need send gcm notification on button click in android application made through xamarin. i have followed tutorial https://developer.xamarin.com/guides/cross-platform/application_fundamentals/notifications/android/remote_notifications_in_android/ button btnclick = findviewbyid<button>(resource.id.btnclikc); btnclick.click += btnclick_click; void btnclick_click (object sender, system.eventargs e) { // here need send notification. not able it. } i use messagesender.exe send notification cant make application. using system; using system.net.http; using system.net.http.headers; using system.text; using system.threading.tasks; using newtonsoft.json.linq; namespace messagesender { class program { public const string api_key = "api_key"; public const string message = "message"; static void main(string[] args) { var jgcmdata = new jobject(); var jdata = new jobject(); jdata.add("message", message);

model view controller - Can somebody post a good example of MVC Pattern in Swift? -

a simple project has implemented mvc pattern. far,i have brief understanding of how want see practical implementation. this typical example of model view controller in swift: class article { var title: string var body: string var date: nsdate var thumbnail: nsurl var saved: bool } class articleviewcontroller: uiviewcontroller { var bodytextview: uitextview var titlelabel: uilabel var datelabel: uilabel var article: article { didset { titlelabel.text = article.title bodytextview.text = article.body let dateformatter = nsdateformatter() dateformatter.datestyle = nsdateformatterstyle.shortstyle datelabel.text = dateformatter.stringfromdate(article.date) } } }

c++ - Validity of std::prev and std::next for std::list -

i storing iterator list: list<int> l; l.push_back(21); l.push_back(1); l.push_back(31); l.push_back(41); auto = l.find(21); in algorithm, whenever delete node, need add adjoining elements. this: auto prev = std::prev(it); auto next = std::next(it); *prev = *prev + *next; l.erase(it); as see, need ensure boundary conditions. values std::prev() , std::next() return if: they first , last elements; or if it has become invalid @ point? what values std::prev() , std::next() return... they return n th (where n defaults 1) predecessor or successor of iterator it . see here [iterator.operations] /6 , /7. ... if first , last elements; or if it has become invalid @ point? the iterator needs valid before call made. return value invalid iterator if it 1 of corresponding boundary iterators; i.e. it == begin() prev(it) , it == end() next(it) . the validity of it needs established before used argument prev() or next() . std::prev() , std:

Can we prevent deadlocks and timeouts on ReliableQueue's in Service Fabric? -

we have stateful service in service fabric both runasync method , couple of service calls. one service calls allows enqueue in reliablequeue using(itransaction tx = statemanager.createtransaction()) { await queue.enqueueasync(tx, message); queuelength = await queue.getcountasync(tx); await tx.commitasync(); } the runasync on other hand tries dequeue things: using(itransaction tx = statemanager.createtransaction()) { await queue.trydequeueasync(tx); queuelength = await queue.getcountasync(tx); await tx.commitasync(); } the getcountasync seems cause deadlocks, because 2 transactions block each other. if switch order: first counting , dequeue/enqueue? this due fact reliablequeue today strict fifo , allows 1 reader or writer @ time. you're not seeing deadlocks, you're seeing timeouts (please correct me if not case). there's no real way prevent timeouts other to: ensure transactions not long lived - longer need , you're blocking other wo