Posts

Showing posts from August, 2013

qt - QML cannot open an image more than once -

in 1 of qml pages, there 1 button , listview containing image , text on each row. use test image both button , listview row item. button can show image listview complains "qml image: cannot open: qrc:/../../../users/jerry/desktop/la.png". both image , qml files under resources. here code. import qtquick 2.0 import qtquick.controls 1.2 rectangle { anchors.fill: parent item { id: advancedbackground anchors.fill: parent button { id: backbutton width: 25 height: 25 anchors.top: parent.top anchors.topmargin: 25 anchors.left: parent.left anchors.leftmargin: 25 opacity: backmousearea.containsmouse ? 0.9 : 0.1 mousearea { id: backmousearea anchors.fill: parent hoverenabled: true onclicked: { leftarrow.visible = true; rightarrow.visible = false; stackview.pop(); } } ima...

regex - Search for any word EXCEPT specific ones? -

i'm trying replace words plurals. know there multiple plural stems doing basic 's'. can make # of word-ending cases. purposes right i'd do: (\w+\b) but have ignore either: specific words words end in specific letter(s) so instance if had ignore \w+dy\b (e.g. study) , ignore words title|body find word except *dy, title, body assuming have lookahead support can use regex: \b(?!(title|\w*?dy)\b)\w+\b regex demo body ends dy no need add in exception list.

create a JSON Array of objects in java android -

i have created class game looks this: public class game{ private string name; private string location; private int participants; public game(string name, string location, int participants){ this.name = name; this.location = location; this. participants = participatns; } //getters , setters of properties and have arraylist looks this: arraylist<game>gamelist = new arraylist<game>(); this arraylist contains 5 games. want send games php script figured smartest way create json array of objects , send php script because games 100 or more @ point. my question is, how create json array of game objects? the best thing gson. gson web site , public class exampleobject { public static final string api_key = "get_response"; private static final string offsets = "offsets"; @serializedname(offsets) private list<integer> moffsets; public exampleobject() { super(); } public string ...

swift - Sliding UIView When Keyboard Appears in iOS -

Image
i know there lot of similar questions on here sliding uiview when keyboard appears on ios. however, seem having issue implementation haven't seen mentioned. when slide animation occurs, doesn't start top of screen expect, rather, starts lower origin , moves top of screen. here's class extension i've created achieve slide-up behavior. public extension uiviewcontroller { private dynamic func keyboardwillshow(sender: nsnotification) { if view.frame.origin.y == 0 { slideviewverticallyforkeyboardheight(sender, directionup: true) } } private dynamic func keyboardwillhide(sender: nsnotification) { if view.frame.origin.y < 0 { slideviewverticallyforkeyboardheight(sender, directionup: false) } } private func slideviewverticallyforkeyboardheight(notification: nsnotification, directionup: bool) { uiview.beginanimations(nil, context: nil) let keyboardheight: cgfloat = (notifi...

mysql - Operand should contain 1 column error -

this question has answer here: operand should contain 1 column - mysql not in 2 answers i have following query select * users id not in ( select user_id `counter` date_sub( curdate( ) , interval 14 day ) <= created ) , id in ( select user_id coupon_used ) , id in ( select user_id accounts ) i need put clause in coupon_used table if user id in coupon useed table code ='xyz'. did id in ( select user_id, code coupon_used code ='xyz' ) but show me error that: operand should contain 1 column. a join better, minimum changes you've written can use fact subquery doesn't need column in clause in select. i.e. instead of id in ( select user_id, code coupon_used code ='xyz' ) you can use id in ( select user_id coupon_used code ='xyz' )

objective c - UIViewController loading a UISplitViewController -

i have uinavigationcontroller rootviewcontroller, contains uiviewcontroller (which call projects sake of discussion). in projects, have button, when clicked, want load uisplitviewcontroller - preferably sliding bottom, although nice-to-have feature. in uisplitviewcontroller, have "close" button want remove uisplitviewcontroller re-showing projects. from have read, uisplitviewcontrollers must rootviewcontrollers. in mind, code far follows. appdelegate - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; ... // load projects panel root view controller window projectslistviewcontroller *projects = [[projectslistviewcontroller alloc] init]; navigationcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:projects]; [window setrootviewcontroller:navigationcontroller]; [window makekeyan...

ios - Change image on select within tableview cell - Swift -

i trying change image within cell when selected. here have in view controller: func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { let cell = self.tableview.dequeuereusablecellwithidentifier("cell", forindexpath: indexpath) as! customtableviewcell cell.bgimage.image = uiimage(named: "second_image") } this set image: func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = self.tableview.dequeuereusablecellwithidentifier("cell", forindexpath: indexpath) as! customtableviewcell cell.bgimage.image = uiimage(named: "first_image") } when select cell, image not update. how work? the issue calling dequeuereusablecellwithidentifier . try using cellforrowatindexpath instead ( documentation here ). give reference current cell, rather reference new reusable cell. so, according code above: let cell = self.tableview.cellf...

html - Keeping <table> that contains jQuery UI elements inside <div>, in a way that scales -

Image
for final project in client-side web development, created page allows somecompany keep track of inventory. mandated, project, use jquery ui library. unfortunately, had submit knowing there existed 1 error: <table> overflowing parent container (s). initially, had no style table, except for: table, th, td { border: 1px solid black; } i took @ this , , tried follow advice, got sexy-looking table still overflowed container (s). table, after rolling back, looks like: i think 1 of reasons problem persists because of (necessary) jquery ui elements in table. html code table, , immediate parent element, this: <div id="tabledivfirsttab"> <h3 class="demoheaders">employees</h3> <table id="employeetable"> <thead class="ui-widget-header"> <tr id="titlerow"> <td>first name</td> <td>last name</td> ...

Jenkins - Pass tar file from Multijob to phase jobs -

i trying find best way tar file running multijob triggered phase jobs. - multijob starts - phase 1 job needs copy tar multijob - phase 2 job needs copy tar multijob - multijob other tasks - end of multijob if can archive build step, can copy in children processes, unfortunately archiving finding post build action. i have looked trying copy file 1 workspace another, seems dead end. can me figure out best way this? if child jobs using same scm source, can use shared workspace plugin . the plan define shared workspace in global jenkins config, , next use workspace in relevant jobs.

Can't seem to get this right (Function call) - Javascript -

so i'm trying write app goes through , selects feat , adds html file. when have looks specific element true, goes through statements accordingly. when say, not make requirement, goes through process again (which should), doesn't add html. in fact, says "undefined". here's code in question. (i've included truncated version of whole code.) function feats(){ var ft = prompt("write feat here."); var feat; switch (ft) { case 'alert': feat = "<b>alert:</b> +5 initative. cannot surprised while conscious. other creatures don't gain advantage on attack rolls against result of being hidden you."; initiative = initiative + 5; break; case 'defensive duelist': if (dex >=13) { feat = "<b>defensive duelist:</b> when wielding finesse weapon proficient , creature hits melee attack, can use reaction add proficiency bonus a...

java - How to print menu again -

how return menu selection code have below? after program gives output, how can go menu again? import java.util.*; import java.util.scanner; public class meme { public static void main(string[] args) { scanner inp= new scanner(system.in); int choose; system.out.println("enter selection:\n1 addition\n2 substraction \n3 multiplication\n4 division"); choose = inp.nextint(); int num1,num2; int ans; system.out.println("enter first number:"); num1 = inp.nextint(); system.out.println("enter second number:"); num2 = inp.nextint(); switch (choose){ case 1: system.out.println(add( num1,num2)); break; case 2: system.out.println(sub( num1,num2)); break; case 3: system.out.println(mult( num1,num2)); break; case 4: system.out.println(div( num1,num...

python - PTVS doesn't inspect class members -

i'm using ptvs 2.2.2, ironpython 2.7, , vs 2015. i'm encountering weird problem i'm assuming user error. cannot mouse on class field (e.g. self.x ) , see value. can mouse on self or local variable without issue. when popup appears after hovering on self , i'm prompted traversing down either __class__ or raw view . i'm able find field name under self -> raw view -> dynamic view doesn't have value, type. any ideas how inspect fields value easily? seems me should "easy" can't find talking on web.

c++ - Why doesn't my OpenCL 3d image lookup work? -

i have been having trouble opencl kernel i've written producing incorrect results (compared reference brute-force cpu implementation). i tracked problem down 3d lookup table i'm using seems returning garbage results, rather values passed in. i have following (simplified) opencl kernel reading precomputed function 3d image type: __constant sampler_t legsampler = clk_normalized_coords_true | clk_address_clamp_to_edge | clk_filter_linear; inline float normalizedlegendre(int n, int m, float z, image3d_t legendrelut) { float ncoord = (((float) n) / get_image_width(legendrelut)); float mcoord = (((float) m) / get_image_height(legendrelut)); float zcoord = ((z + 1.0f) / 2.0f); float4 coord = (float4)(floor(ncoord) + 0.5f, floor(mcoord) + 0.5f, zcoord, 0.0f); return read_imagef(legendrelut, legsampler, coord).x; } _kernel void noisemain(__read_only image3d_t legendrelut, __global float* outlegdump) { //k linear index array. int k = get_global_id(0); if(k...

mysql - Need a simple solutin to slow query -

i have following query.. select avg(h.price) `car_history_optimized` h left join vin_data vd on (concat(substr(h.vin,1,8),'_',substr(h.vin,10,3))=vd.prefix) h.date >='2015-01-01' , h.date <='2015-04-01' , h.dealer_id <> 2389 , vd.prefix in (select concat(substr(h.vin,1,8),'_',substr(h.vin,10,3)) `car_history_optimized` h left join vin_data vd on (concat(substr(h.vin,1,8),'_',substr(h.vin,10,3))=vd.prefix) h.date >='2015-03-01' , h.date <='2015-04-01' , h.dealer_id =2389) it finds average market value of car sold within last 3 months else other (2389) car have same make, model sold (2389) can above query optimized ? it's taking 2 minutes run 11 million records.. thanks how use particular "prefix"? if often, direct toward indexing 'virtual' column. otherwise, need index(date) -- outer query index(dealer_id, date) -- ...

javascript - What are the benefits of using the co library with promises instead of with thunks? -

so i've been reading usage of co library, , general design pattern i've seen in blog posts wrapping functions have callbacks in thunks. using es6 generator yield thunks co object. this: co(function *(){ var = yield read(‘readme.md’); var b = yield read(‘package.json’); console.log(a); console.log(b); }); function read(path) { return function(done){ fs.readfile(path, ‘utf8', done); } } and can understand because brings benefits of promises better readability , better error handling. but what's point of using co if have promises available? co(function* () { var res = yield [ promise.resolve(1), promise.resolve(2), promise.resolve(3), ]; console.log(res); // => [1, 2, 3] }).catch(onerror); why not like promise.all([ promise.resolve(1), promise.resolve(2), promise.resolve(3), ]).then((res) => console.log(res)); // => [1, 2, 3] }).catch(onerror); to me, co makes code more confusing compared promise version...

oracle - Re-using a query result in a PL/SQL package -

i have trouble writing sql queries. inside package function, trying reuse result of query in 2 other queries. here's how goes : my schema stores requests. each request concerns multiple destinations. also, each request detailed in table (request_detail). in addition, requests identified ids. so, using 3 tables. 1 requests, destinations , last 1 details. each 1 of theses tables indexed request_id column. the query want optimize when user wants find requests, plus destinations , commands have been sent between 2 dates. i want query request_table first in order request_ids. then, use request_ids list query command table , destination one. i couldn't find how that... can't use ref cursors can't fetched twice... need array-like or column-like variable store request_ids, use variable twice or more... here's original queries optimize : function extract_request_with_date (ze_from_date date, ze_to_date date, x_request_list out cursor_type, x_destination...

ruby on rails - Comments and Rating section no longer showing up; -

i working on creating test shoe store website 1 of classes. had added comment section , rating system new shoes. reason comment , rating section no longer viewable. here product show page <p id="notice"><%= notice %></p> <div class="show-buttons" id="show1"> <%= link_to 'edit', edit_product_path(@product), class: "btn btn- success btn-xs" %> | <%= link_to 'back', products_path, class: "btn btn-primary btn-xs" %> </div> <div class="pay button"> <%= form_tag "/payments/create" %> <%= render partial: "shared/stripe_checkout_button" %> <%= hidden_field_tag(:product_id, @product.id) %> </div> <p> <strong>name:</strong> <%= @product.name %> </p> <p> <strong>description:</strong> <%= @product.description %> </p> <p>...

c# - Find Out What Variables Are Used Inside A Function? -

i writing open source engineering calculator application in c#. there class called calcvar , represents single calculator variable. added calculator class. on construction of calcvar variable, passed "equation" lambda function (of type func<double> , shown below) body may contain number of calcvar objects (which belong same calculator class), multiplied/added/divided/whatever , return value calcvar object. e.g. class ohmslaw : calculator { calcvar voltage; calcvar current; calcvar resistance; public ohmslaw() : base("ohm's law", "ohm's law calculator.") { this.voltage = new calcvar(() => current.rawval*resistance.rawval); this.current = new calcvar(() => voltage.rawval / resistance.rawval); this.resistance = new calcvar(() => voltage.rawval / current.rawval); } } i want able somehow work out other calcvar variables used inside given calcvar 's equatio...

sockets - How to cleanly establish and destroy half-open TCP connections in c# -

assuming i'm running on windows server 2008 r2, per msdn doesn't have restrictions documented here , how go establishing half-open tcp connection , c# , subsequently closing it. want cleanly possible. of course half-open connections not clean begin non less. i believe need use raw socket other that, i'm not sure. use protocol type of tcp or of ip , build tcp syn packet myself?

Excel - Aggregate Function to Average Reciprocals -

i'm trying use aggregate function take average of reciprocals of array of values. works fine averaging given values doesn't seem working on reciprocals. below function i'm using: works fine: =aggregate(1, 6, aa11:aa16) not working: =aggregate(1, 6, 1/(aa11:aa16)) does know source of error , whether or not there's work-around? clarification i cannot use array formulas because contribute file size. you instead find average of reciprocals using array formula, example: ={average(1 / aa11:aa16)} (ctrl + shift + enter enter array formula) to ignore error values replicate aggregate function have used add if array formula: =average(if(iserror(aa11:aa16), "", 1 / aa11:aa16)) alternative option... =sumproduct(1/aa11:aa16)/count(aa11:aa16)

Spring batch --- DatabaseType not found for product name: [Informix Dynamic Server] -

i want implement spring batch spring boot , since using informix database i'm running following exception when spring boot app starts up. configuration : @bean public datasource datasource() throws sqlexception { basicdatasource datasource = new basicdatasource(); datasource.setdriverclassname(datasourceproperties.getdriverclassname()); datasource.seturl(datasourceproperties.getdburl()); datasource.setusername(datasourceproperties.getdbusername()); datasource.setpassword(datasourceproperties.getdbpassword()) return datasource; } @bean public datasourcetransactionmanager datasourcetransactionmanager(datasource datasource){ datasourcetransactionmanager manager=new datasourcetransactionmanager(datasource); return manager; } @bean public jobrepositoryfactorybean jobrepositoryfactorybean( datasourcetransactionmanager txmanager,datasource datasource ) throws exception{ jobrepositoryfactorybean job=new jobrepositoryfactorybean(); job.setd...

regex - Regular Expression select up to line break -

i trying select after corp act option no until 2 new lines , carriage returns (up safekeeping account in example) my reg expression atm extract info (all of after corp act option) corp act option no\.([\s\s]*) sample dara: corp act reference : 007xs0212069115 sender's reference : 1212070800330001 function of message : new message corp act event : interest payment place of safekeeping : isin : xs0212069115 isin/description : kfw 4.750 071212 gbp method of interest computation : a006 ex-date : 20121207 record date : 20121206 corp act option no. : 001 corporate action option code : cash currency option : gbp resulting amt : gbp617,5 payment date : 20121207 exchange rate : gb...

c# - How to update a table using join in Visual Studio -

Image
what's wrong? sqlcommand cmd = new sqlcommand(@"update perioada p join client c on p.id_client = c.id_client set p.date ='" + datetimepicker1.value.tostring("mm/dd/yyyy") + "' (c.cnp = '" + textbox1.text + "')", con); cmd.executenonquery(); assuming using sql server (because using system.data.sqlclient), below correct syntax update statement: string sqlquery = "update p set p.date =@dt perioada p join client c on p.id_client = c.id_client (c.cnp = @cnp)" using (sqlconnection con = new sqlconnection(connectionstring)) { sqlcommand command = new sqlcommand(sqlquery, con); command.parameters.addwithvalue("@dt", datetimepicker1.value.tostring("mm/dd/yyyy")); command.parameters.addwithvalue("@cnp", textbox1.text); try { con.open(); command.executenonquery(); } catch (exception ex) { console.writeline(ex.mess...

ios - Unable to change $cordovaStatusbar text color -

Image
i'm having issues status bar of ionic app. more i'm not able change bar default color, no matter style apply. i checked ngcordova , cordovastatusbar plugin installed correctly. code snippet app.run(function ($ionicplatform, $cordovastatusbar) { $ionicplatform.ready(function () { // color ios status bar if (window.statusbar) { $cordovastatusbar.overlayswebview(true); $cordovastatusbar.stylehex('#f50'); } }); }); this result in xcode simulator ionic emulate ios command. edit: after many tests think problem more in depth. neither .show() or .hide() methods working. app.run(function ($ionicplatform, $cordovastatusbar) { $ionicplatform.ready(function () { $cordovastatusbar.hide(); //not hiding status bar }); }); from plugin github page on ios 7, when set statusbar.statusbaroverlayswebview false, can set background color of statusbar hex string (#rrggbb). so got...

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot...

javascript - Debugging $Scope Updates using Angular.js 1.x -

i'm ui/js newbie trying learn angular.js through spa project. however, see <variable name> when use {{variable name}}; whereas instead have expected see <variable value> instead. i've verified angular getting loaded spa. i've verified there no error message logs in http server console. i tried print browser console $scope.myvar within controller function after setting it; , index.html after loading controller.js. i installed ng-inspector extension chrome browser. however, nothing getting displayed in either case! here's controllers.js: " angular.module('todoapp.controller', []) .controller('todocontroller', ["$scope", function($scope){ /* check controller function entered */ document.write("* inspecting scope within controller *"); console.log("* inspecting scope within controller *"); $scope.onewayoutput = "whoohoo! howdy world!"; $scope.twowayinput = "update me ...

Highcharts - Dyanmic graph with no initial data -

if open jsfiddle dynamic spline update loads series 20 points before starts updating every second. example i don't want display initial data , let interval add points come in. so change: series: [{ name: 'random data', data: (function() { // generate array of random data var data = [], time = (new date()).gettime(), i; (i = -19; <= 0; i++) { data.push({ x: time + * 1000, y: math.random() }); } return data; })() }] to series: [{ name: 'random data', data: [] }] but doesnt add points. there missing? change load function shift parameter doesn't apply before you've added 20 values, see this jsfiddle load: function() { // set updating of chart eac...

Magento - How to render a page in popup or dialog? -

i want render .phtml file popup or dialog in pages or how convert page loading popup or dialog box. way solve that. i've used in past: <?php require_once('app/mage.php'); umask(0); $layout = mage::app()->getlayout(); $layout->getupdate()->addhandle('default')->load(); $layout->generatexml()->generateblocks(); mage::getdesign()->settheme('mytheme'); $layout->getblock('head')->settitle('regular post delivery details'); echo '<html><head>'; echo $layout->getblock('head')->tohtml(); echo '</head>'; echo '<body><div class="special-content">'; echo $layout ->createblock('cms/block') ->setblockid('estimated-regular-delivery-times') ->tohtml(); echo '</div></body></html>'; ?> just make php file in web root.

php - MySQL join tables and get values that have the same key name -

i trying select of address id's 1 table , join attributes other tables. need join values on tables , c entity_id since tables have same key "value" second join replacing value of first. what doing wrong here? $query = "select a.parent_id, b.value, c.value customer_address_entity left join customer_address_entity_varchar b on a.entity_id = b.entity_id left join customer_address_entity_text c on a.entity_id = c.entity_id limit 100"; var_dump($query); but array of 4. a.value being overwritten c.value array (size=4) 'parent_id' => string '7' (length=1) 'entity_id' => string '6' (length=1) 'value' => string '19 standiford ct' (length=16) 'attribute_id' => string '25' (length=2) perhaps alias 1 column give unique name? i.e. $query = "select a.parent_id, b.value, c.value foobar c...

javascript - Can get information (.get) -

this question has answer here: jquery ajax cross domain 13 answers loading cross-domain endpoint jquery ajax 8 answers i try fetch information public website area. let's want product name , price of only. when try information site giving me error: no 'access-control-allow-origin' header present on requested resource. origin 'http://demo.com' therefore not allowed access. the script use is: $(document).ready(function() { $.get("http://www.ebay.com", function(data) { console.log(data) }); });

Android Gradle finished with non-zero exit value 1 -

i have developed several applications android studio 1.5. few days ago, made new application , started getting error during gradle builds: error:execution failed task ':app:processdebugresources'. > com.android.ide.common.process.processexception: org.gradle.process.internal.execexception: process 'command 'c:\path\android\sdk\build-tools\23.0.2\aapt.exe'' finished non-zero exit value 1 i tried cleaning project , rebuilding, didn't anything. later found out none of working projects compiled anymore. got same error them all. have since tried uninstalling , reinstalling android studio, every time run specific application, none of projects work longer. don't know if did wrong application first caused error, of projects compile way now. appreciated. thanks.

javascript - Issue with capitalizing innerHTML text -

i working on project html class , wasn't able figure out how capitalize first letter of text replaced image during onmouseover event, which, in turn, returned initial picture state during onmouseout event. able make text show up, can't first letter capital. text supposed link (href, not href, in order prevent page going link if "cancel" hit on confirm box popped when clicked). confirm box pops asking if want go link, if not, when hit cancel, page stays. this function: function planetname(x,y,z){ document.getelementbyid(x).innerhtml=y; document.getelementbyid(x).style.backgroundcolor="clear"; document.getelementbyid(x).style.color="white"; document.getelementbyid(z).style.height="172px"; } in case, x href link, y planet name , z table row in. here part of html: <h3>click on 1 of images below learn more planet.</h3> <table height="150px" id="tabl"> <tr id="tr1...

excel - Grouping records whle filling gaps with zero -

Image
1 2280 3 1250 5 1245 9 1258 but need result this: 1 2280 2 0 3 1250 4 0 5 1245 6 0 7 0 8 0 9 1258 10 0 may formula easier. =iferror(vlookup(d1,$a$1:$b$10,2,false),0)

javascript - How can I add a new object in a Angularjs table using ENTER (key from keyboard)? -

i have shopping list app built in angularjs works fine. can add , delete items it. issue want allow app add new items table using (event.which = 13) meaning using "enter" key keyboard. when user on input text field , after typing item , pressing enter want new item added in table. think i'm close accomplish , user need this: type text in input field , press enter , click anywhere outside table in order add new item, wouldnt right way add new item. please on , let me know i'm doing wrong. lot in advance. codepen: http://codepen.io/henrygranados/pen/bjwzkp here's code: $("#keypresser").keypress(function(e){ var codigo = e.which; var item = document.getelementbyid("keypresser").value; if(codigo == 13){ $scope.addnewitem(item); console.log("hello"); } }); use ngkeypress html <input ng-keypress="pressed($event,newitem)" placeholder = "enter item here..."clas...

jquery - Rotate class of div elements every reload -

i have working code right here randomly adds kvdisplay class on list of divs every page load. code below particularly 3 divs only. var classes = ["kvdisplay", " ", " "]; classes.sort(function(){ return math.random() - .5 }); $("#keyvisual .kvwrapper").each(function(){ $(this).addclass(classes.pop()); }); https://jsfiddle.net/m71xc5ty/ instead of adding class randomly, how change in specific order? ex. class kvdisplay added first child div of #keyvisual on first pageload, added second child on next reload, , on. if kvdisplay class on third/last child, class go first child after reload. so can use https://github.com/carhartl/jquery-cookie plugin use cookies jquery. this code achieve it: if ($.cookie("classes")) { var classes = json.parse($.cookie('classes')); } else { var classes = ["kvdisplay1", "kvdisplay2", "kvdisplay3"]; } console.log(classes); $(document)...

jquery - link from table row to new view generating :format => id of clicked row Why? Rails -

i following example of # 9945620, making table row link in rails params being sent controller {"controller"=>"cpe_events", "action"=>"cpe_course_description_live", "format"=>"15"} assume format automatically being generated rails. don't, however, understand why it's adopting row / record's id , why cpe_events params or id aren't being passed. edit: should note table rendered using bootstrap, class="span12 table table-hover table-striped table-bordered" , since it's written in jquery. full code below following notes. here's data-link that's throwing error: <tr data-link="<%= cpe_course_description_live_path(cpe_event) %>" > format used in referenced example. link in network section of console reads cpe_course_description_live_path.15 however, controller, @cpe_event = cpeevent.find(params[:id]) , can't read id if change to: ...

Why in_array doesn't work on array that was created using loop in PHP? -

why in_array not work on array create loop php ? this below code show match found . <?php ($i = 0; $i < 10; ++$i) { $people[] = $i; } if (in_array('test', $people)) { echo "match found"; } else { echo "match not found"; } ?> and below code show match not found . <?php $people = array("0","1","2","3","4","5","6","7","8","9"); if (in_array('test', $people)) { echo "match found"; } else { echo "match not found"; } ?> how solve first code show match not found you change $people[] = $i; ---by--> $people[] = "$i"; then compare strings <?php ($i = 0; $i < 10; ++$i) { $people[] = "$i"; } if (in_array('test', $people)) { echo "match found"; } else { echo "match not found"; } ?>

Form in Django Admin for "notes" or "comments" on models -

Image
basically want way have admins leave comments on model being viewed. let's have model car have registered within admin site , want allow other admins write short note car , have show in admin interface along name , timestamp. essentially want add commenting form in django admin specific model. any suggestions on how without overriding entire view? round 2 (edit) this progress using gordonsbeards answer. it adding 3 "extra" empty notes not deal breaker interesting none less. # in models.py class note(models.model): user = models.foreignkey(user) note = models.textfield() created_on = models.datetimefield(auto_now_add=true) def __unicode__(self): return "created on: {}".format(self.created_on) my user model handles both admin users , want add notes functionality on. how add logged in users name in front of created on date? i don't know mean "overriding entire view", because kind of thing makes dja...

android - Cannot get the EditText to have multiple lines -

i'm trying have multiple lines in edittext . have tried many solutions working none of them seem work. have right this: <edittext android:id="@+id/uf_aboutme_box" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="top|start" android:hint="@string/tellusaboutyourself" android:inputtype="textmultiline" android:lines="8" android:maxlines="10" android:minlines="6" android:scrollbars="vertical"/> although, above code renders correctly in preview, when test on real phone becomes single line! can tell me what's wrong code above? edit: the parent layout is: <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_con...