Posts

Showing posts from May, 2013

xml - How do I layout two EditTexts side by side to each other in a GridLayout? -

i have 2 edittexts. i'd each take half of ui screen width. below xml layout file. leftmost edittext ("due date") showing i'm clearing missing here. rightmost edittext should showing "due time". please advise. .... <android.support.design.widget.textinputlayout android:id="@+id/duedate_text_input_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_row="4" android:layout_column="0"> <com.example.jdw.thirdscreen.listeneredittext android:id="@+id/fedittext" android:hint="due date" android:layout_height="wrap_content" android:layout_width="match_parent" android:layout_weight="1" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_gravity="start" android:inputtype="text|t...

ruby - Model with defined attribute returns nil, despite showing a value. Rails 4 Postgres Heroku -

i have set simple rails app, , have deployed heroku. store content displayed on site, have set model content attribute bio , , populate rake task on deploy. in dev, well. can populate model, reference in controller, , display on page. simple, right? however once push heroku, can't model return value, desipite seeing on select. example, console yields: irb(main):006:0> c = content.first => #<content id: 1, bio: "<p class='bio_text'>hunter writer and..."> irb(main):008:0> c.bio => nil the value in db, gives? i'm using rails 4.1.8, hosted on heroku, running postgres 9.8.1. model: class content < activerecord::base end controller: class pagescontroller < applicationcontroller def bio @bio_content = content.last.bio end ... private def content_params params.require(:content).permit(:bio) end end

java - ArrayList repeats the same data from a database? -

Image
this question has answer here: duplicate objects added list [duplicate] 4 answers i have jtable uses arraylist load data database, have issue same data keeps repeating themselves. missing here ? in advance, private void allticketrecords() { try { ticketrecorddao ticketrecdao = new ticketrecorddao(); arraylist<ticketrecord> records = ticketrecdao.getallticketsrecords(); object[] tablecolumnname = new object[7]; tablecolumnname[0] = "date"; tablecolumnname[1] = "h.license"; tablecolumnname[2] = "first name"; tablecolumnname[3] = "last name"; tablecolumnname[4] = "ticket id"; tablecolumnname[5] = "violation"; tablecolumnname[6] = "cost"; defaulttablemodel tbd = new defaulttablemodel(); ...

php - Get data from database and show in view -

i have foreach in controller - method: foreach ($unanswered_questions $un_questions) { //get asker_id , asked_id details $un_questions->asker = $this->get_user_details($un_questions->asker_id); // asker_id can 0 or user id } in my_controller have function public function get_user_details($user_id) { $user = new stdclass(); switch ($user_id) { //if anonimous case 0: $user->?????? = $this->lang->line('anonymous'); //result anonymous text $user->profile_picture = 'assets/images/default50.jpg'; break; default: $user = $this->users->select_details_by_id($user_id); // $user->first_name, $user->last_name, $user->username database (columns) $user->profile_picture = $this->images->get_profile_image($user_id); break; } return $user; } so how can set data display correctly in view? i need anonymous s...

javascript - Canvas incorrectly antialiasing. Is there a way to force correct rendering? -

i having problem rendering canvas ctx.imagesmoothingenabled = true when mixes colours makes them dark. colour should square root of mean of sum of squared input values. mean of sum of inputs. pixels colours values represent square root of actual photons emitted on screen or captured via camera. antialiasing on machines have looked @ seem incorrectly , results in annoying dark artifacts around high contrast parts of image. the code showing correct , incorrect way average rgb value 2 2 pixel area. // 2 2 pixel down 1 pixel // correct way var r = math.sqrt( (r11*r11 + r12*r12 + r21*r21 + r22*r22) / 4); var g = math.sqrt( (g11*g11 + g12*g12 + g21*g21 + g22*g22) / 4); var b = math.sqrt( (b11*b11 + b12*b12 + b21*b21 + b22*b22) / 4); // how canvas render ?? (i assuming) var r = (r11 + r12 + r21 + r22) / 4; var g = (g11 + g12 + g21 + g22) / 4; var b = (b11 + b12 + b21 + b22) / 4; what know is. there way around this, via browser setting (any browser desperate), hardware device set...

java - loop through a serialized file or check for contents -

i learned serialization , practicing it.i wanted check if object i'm serialize in file or not.i think can looping through file , check if contains object or not.but cant found way loop through it. is there way loop through serialized file or check contents ? objectstream not designed out of box, exact solution depends on size of data + exact requirements. 1) if data large, , business requirements expected evolve - i'd consider proper database. e.g. mongodb if you'd write entire complex objects in 1 go (and, post implies, transactions not required). 2) if stick objectoutputstream, consider exact file format - data retrieval depend on that. however, all solutions boil down loading data java object in memory, , searching there. ..: a) small data, keep data in java list/map (or wrapper model object such phonebook), read/write entirely in 1 go . e.g. on application startup: read entire phonebook file (or initialize empty 1 if file missing/corrupt). search: s...

javascript - python selenium send css with !important -

i change css of element follows. works fine when: browser.execute_script( "arguments[0].style.display = 'block';", browser.find_element_by_xpath("//div[@role='main']/div/div/div["+str(d)+"]/div["+str(r)+"]/div/div[2]") ) but when try add "!important", code not updated: browser.execute_script( "arguments[0].style.display = 'block!important';", browser.find_element_by_xpath("//div[@role='main']/div/div/div["+str(d)+"]/div["+str(r)+"]/div/div[2]") ) the statement element.style.display = 'block' work setting value of valid property values. since 'block !important' not recognized, not added. !important declaration. you can use .setproperty() instead, let add more value. use 'important' string , don't add exclamation point. browser.execute_script( "arguments[0].style.setproperty('display'...

unit testing - how to have class return mock on new Class()? -

in phpunit, want test controller. part of need return mock when new class() called. i have tried: $mockentity = $this->getmock( 'vet', array( '__construct', 'setdoctrine', 'setcontainer' ) ); $mockform = $this->getmock( 'vettype', array( 'handlerequest', 'isvalid', 'createview' ) ); $mockentity->expects( $this->once() )->method( '__construct')->willreturn( $this->returnvalue( $mockentity ) ); and simply: $mockentity = $this->getmock( 'vet', array( 'setdoctrine', 'setcontainer' ) ); $mockform = $this->getmock( 'vettype', array( 'handlerequest', 'isvalid', 'createview' ) ); both return "vet" object, not mock. possible phpunit 4.0.20, or need add getnewvet() function? this symfony2 controller

r - Extracting columns from text file -

i load text file (tree.txt) r, below content (copy pasted jweka - j48 command). use following command load text file: data3 <-read.table (file.choose(), header = false,sep = ",") i insert each column separate variables named following format col1, col2 ... col8 (in example since have 8 columns). if load excel delimited separation each row separated in 1 column (this required result). each coln contain relevant characters of tree in example. how can separate , insert text file these columns automatically while ignoring header , footer content of file? here text file content: [[1]] j48 pruned tree ------------------ mstv <= 0.4 | mltv <= 4.1: 3 -2 | mltv > 4....

Android RecyclerTouchListener implements RecyclerView.OnItemTouchListener -

i've faced problem. when updated compile 'com.android.support:recyclerview-v7:22.0.0' v7:23.0.0 , faced onitemtouchlistener problem. works on v7:22.0.0. how can solve it. please answer me. see screenshot: http://itnetbd.com/rec.png http://itnetbd.com/rec.png this new abstract method within recyclerview.onitemtouchlistener . need override method well.

jquery - How to select item from the list of sub menu calling from database using javascript -

i call item list array sub-menu using createelement("li") . want select item list. make them selectable using css. want code when select item enable call function item. how can it? var gamename = ['game one', 'game two', 'game three'] function submenu() { // set variable submenu ul element var submenu = document.getelementbyid('submenu'); // loop - each value in array (var = 0; < gamename.length; i++) { // create new li/list item var item = document.createelement('li'); // set innerhtml element item.innerhtml = '<a href="#">' + gamename[i] + '</a>'; // append new element submenu. submenu.appendchild(item); } <ul> <li><a href="#">games</a> <ul id="submenu"></ul> </li> <li><a href="#">stake</a></li> <li><a href="#">m...

javascript - Running Node.js on iOS as a server and let other device connected in -

i building card game app on ios , android following logic: people download app app store / google play they can play game offline other players within same wifi-network one client act server, while other players act clients the game app node.js, sqlite embedded each player's move saved in server when there's internet access, ios act server send data cloud my approach is the game html5 node.js, player act game holder(server) open port (like port 80) other players use http get/set send , receive json package , game holder my questions is will possible me run node.js on ios, server , open ports let other players connect in? can use json communications between players. if not, best way different device (ios, android, windows phone) communicate? any suggestions , appreciated. thanks. michael my reputation not enough comment suggest use anyway. if make server in node.js, rest of answer tell do. use cfnetwork , corefoundation. assuming sending dat...

excel - Does Macros work on a MHT file? -

i have created drop down menu , button has macro when save file .mht , try see content internet page drop down menu , button not working know if these features available on regular excel formats such xlsm , xlsx unfortunately, suspicion correct. macros work on .xls, .xlsm, .xlsb, , .xlst formats.

c# - Increase size on file storage -

i making api request , response getting xml. , want store xml in file on local storage on windows mobile. if (iswritefile) { byte[] filedata = new byte[8 * 1024]; stream tostream = null; if (file.exists(strxmlresponsefilename)) { file.delete(strxmlresponsefilename); } tostream = file.open(strxmlresponsefilename, filemode.openorcreate, fileaccess.write); int count = 1; while ((count = resstream.read(filedata, 0, filedata.length)) != 0) { tostream.write(filedata, 0, count); } tostream.flush(); tostream.close(); outputxml = xmlreader.create(strxmlresponsefilename); } some times xml response big. file breaks , xml writing partially stopped. is there way increase file size? i.e byte[] filedata = new byte[8 * 1024]; .

c# - Generating IDAutomationHC39M barcode is generating well but need to remove value -

Image
hi using below code , bar code generating how can remove text written down label. public void generatebarcode(string id) { int w = id.length * 55; bitmap obitmap = new bitmap(w, 100); graphics ographics = graphics.fromimage(obitmap); font ofont = new font("idautomationhc39m", 18); pointf opoint = new pointf(2f, 2f); solidbrush obrushwrite = new solidbrush(color.black); solidbrush obrush = new solidbrush(color.white); ographics.fillrectangle(obrush, 0, 0, w, 100); ographics.drawstring("*" + id + "*", ofont, obrushwrite, opoint); system.web.ui.webcontrols.image imgbarcode = new system.web.ui.webcontrols.image(); using (system.io.filestream fs = system.io.file.open(server.mappath("~/img/barcodes/") + id + ".jpg", filemode.create)) { obitmap.save(fs, system.drawing.imaging.imageformat.jpeg); } obitmap.disp...

spring - Cannot create inner bean '(inner bean)' of type [org.springframework.http.converter.json.MappingJacksonHttpMessageConverter] -

it use spring mvc json.i want data in json format.below code. made jsoncontroller.java , shop.java. when run http://localhost:8080/jsonapi/rest/kfc/brands got error.can 1 tell me need modify in code. jsoncontroller.java package com.java; import org.springframework.stereotype.controller; import org.springframework.web.bind.annotation.pathvariable; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.bind.annotation.requestmethod; import org.springframework.web.bind.annotation.responsebody; @controller @requestmapping("/kfc") public class jsoncontroller { @requestmapping(value="{name}", method = requestmethod.get) public @responsebody shop getshopinjson(@pathvariable string name) { shop shop = new shop(); shop.setname(name); shop.setstaffname(new string[]{"mkyong1", "mkyong2"}); return shop; } } shop.java public class shop { string name; ...

mapbox - Specific range of map in android by using mapView -

how show mapbox map view in specific range in android need show asia pacific in mapview ,not display full world in mapview android? you can manually set zoom level of map (radius radius of map in meter): double radius = 500.0; circle circle = map.addcircle(new circleoptions().center(latlng).radius(radius).strokecolor(color.red)); circle.setvisible(false); int zoomlevel = getzoomlevel(circle); map.animatecamera(cameraupdatefactory.newlatlngzoom(latlng, zoomlevel)); private int getzoomlevel(circle circle) { int zoomlevel = 15; if (circle != null) { double radius = circle.getradius(); double scale = radius / 500; zoomlevel = (int) (16 - math.log(scale) / math.log(2)); } return zoomlevel; }

javascript - AngularJS controller function not firing -

i have 3 directives, "parenta", "parentb", , "childb". "parenta" , "parentb" siblings, while "childb" direct child of "parentb". i trying call controller method "parenta", not working. strange reason, trying call method on "childb" controller "parenta" working instead. happening? var mod = angular.module("app", []); mod.directive("parenta", function () { return { template: "<section><div ng-click='vm.a()'>rendered a</div></section>", replace: false, controlleras: "vm", controller: function () { this.a = function () { console.log("a called!"); } } } }) mod.directive("parentb", function () { return { template: "<childb></childb>", replace: false } }) mod.di...

javascript - how to create a custom asynchronous function in node.js -

ii'm trying like. function fun1(){ for(var j=0;j<20;j++) { var n = j; console.log("i= "+n); } } function fun2() { console.log("in callback"); } fun1(); fun2(); its working fine till , got output expected. but, want call function fun1() , fun2() asynchronously means fun2() call before fun1() , b'coz fun1() take time complete execution compare fun2() . how can achieve this, node.js provide asynchronous function, defined function can asynchronous or can make them according our need. there multiple ways achieve in javascript (not node-specific, there modules make life easier): callbacks they continuations , shame developers bothered handling them manually (compilers used themselves). work: function callee(callback) { settimeout(function() { callback(null, 'finished!'); }, 2000); } function caller() { document.write('started!'); callee(function(...

sql server 2008 - Multiple string values parameter passing to SP in SSRS -

Image
i have read , tried of related topics on forum, of them don't have lot of feedback. so using ssrs 2008 r2 report builder 3. i have simple sp follows filters data using in. but reason not passing parameters correctly sp , filter's first option select, hope can assist. --sp @warehouse varchar(max) begin select wbal.warehouse ,wbal.stockcode,((wbal.[current] - wbal.bal1)) cmov,((wbal.bal1 - wbal.bal2)) p1mov,((wbal.bal2 - wbal.bal3)) p2mov ,((wbal.bal3 - wbal.bal4)) p3mov,((wbal.bal4 - wbal.bal5)) p4mov,((wbal.bal5 - wbal.bal6)) p5mov,((wbal.bal6 - wbal.bal7)) p6mov ,((wbal.bal7 - wbal.bal8)) p7mov,((wbal.bal8 - wbal.bal9)) p8mov,((wbal.bal9 - wbal.bal10)) p9mov,((wbal.bal10 - wbal.bal11)) p10mov ,((wbal.bal11 - wbal.bal12)) p11mov ( select [stockcode] ,[warehouse] ,(qtyonhand * unitcost) [current] ,(openbalcost1 * openbalqty1) bal1 ,(openbalcost2 * openbalqty2) bal2 ,(openbalcost3 * openbalqty3) bal3 ,(openbalcost4 * openba...

java - How to connect two different classes -

i properties of customer class booking class without using extend because customer property of booking , not extension. how in best way? public class booking implements serializable{ private string flighttime; private string flightlocation; private string flightfee; private boolean car; private boolean insurance; private customer customer; ... } public class customer extends person implements serializable { private string passportid; private string consultantname; private string consultantsurname; private string consulid; .... } private void savebookingbuttonactionperformed(java.awt.event.actionevent evt) { booking customerbooking = new booking(); try { if (custnametf.gettext().equals("")) { throw new emptyfield("please insert customer"); } else { fileoutputstream fos = new fileoutputstream( "bookings/"...

actionscript 3 - Detect state (over, up, down) of button in AS3 -

i searched document didn't find way detect changing state of button. know way? thanks i'm going hazard guess you're using flash professional , you're in fact trying detect mouse events on movieclip? the code below detect of button hovered on , trigger function: button.addeventlistener(mouseevent.mouse_over, buttoneventlistener); button.addeventlistener(mouseevent.mouse_out, buttoneventlistener); function buttoneventlistener(e:mouseevent):void { switch (e.type) { case mouseevent.mouse_over: //on mouse on break; case mouseevent.mouse_out: //on mouse out break; } } the lack of information means guess apologies if isn't you're looking for.

java user-defined array (and user-defined array size) returning [null, null, null, ...] -

this first question on site, i'm running on netbeans 8.0.2 , trying print out user-defined array keeps returning null values. example if there 2 employees , enter both of names, return [null, null] how fix error? i'm novice. import java.util.scanner; import java.text.decimalformat; import java.util.arrays; class tips_calculation2 { public static void main(string[] args) { scanner scan = new scanner(system.in); system.out.print("how many employees week?: "); int numberofemps = scan.nextint(); // counter if statement should return employees array int counter = numberofemps; int[] noearray = new int[numberofemps]; system.out.println("\nenter names of workers entered amount (" + numberofemps + "):"); for(int = 1; <= numberofemps; i++) { string namecycler = scan.next(); string[] namesarray = new string[i]; if(counter == i) { system.out.println(arrays.tos...

android - How to stick Tabs with Collapsing ToolBar Layout and TabLayout below ToolBar -

i having collapsing toolbarlayout tablayout, working fine except tabs not getting sticked below toolbar on scroll up. below code: <?xml version="1.0" encoding="utf-8"?> <android.support.design.widget.appbarlayout android:id="@+id/appbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/themeoverlay.appcompat.dark.actionbar" android:fitssystemwindows="true"> <android.support.design.widget.collapsingtoolbarlayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_scrollflags="scroll|exituntilcollapsed" android:fitssystemwindows="true" app:contentscrim="?attr/colorprimary" app:expandedtitlemarginend="64dp" app:expandedtitle...

java - Reading barcode from large image -

i reading datamatrix barcode large image consist text also.for reading using zxing library it's not able read barcode in image. while if providing barcode separate image reading barcode. i have done google , found zxing not able read datamatrix barcode large image. want pre-process image before providing zxing . thinking extract barcode part large image. possible? if yes how can extract barcode part image? or other idea this?

android - Reusing ListFragment with ViewPager -

i have 7 tabs , shared fragment data depends on xml received url. problem if set setoffscreenpagelimit(6) , first tab, fine tab number 1 tab number 2 7 shows data url supposed show in last tab. viewpager = (viewpager) findviewbyid(r.id.pager); actionbar = getactionbar(); madapter = new tabspageradapter(getsupportfragmentmanager(), this, negeri); viewpager.setadapter(madapter); viewpager.setoffscreenpagelimit(6); actionbar.sethomebuttonenabled(true); actionbar.setdisplayhomeasupenabled(true); actionbar.settitle("list"); actionbar.setnavigationmode(actionbar.navigation_mode_tabs); // adding tabs (string tab_name : tabs) { actionbar.addtab(actionbar.newtab().settext(tab_name) .settablistener(this)); } /** * on swiping viewpager make respective tab selected * */ viewpager.setonpagechangelistener(new viewpager.onpagechangelistener() { @override public void onp...

sql server - Cascading data insert -

Image
i have these 3 tables: create table tblprimary( id int identity(1,1) not null, sampleid varchar(8) primary key (id) ) create table tblsecondary( primaryid int not null, samplename varchar(50) null ) create table tblsample( sampleid varchar(8) not null, name varchar(50) null primary key (sampleid) ) some sample data tblsample insert tblsample values ('a-1101', 'the cp 1014') insert tblsample values ('a-1102', 'the nt 1014') insert tblsample values ('a-1103', 'the lo 1014') insert tblsample values ('a-1104', 'the ae 1014') insert tblsample values ('a-1105', 'the pw 1014') insert tblsample values ('a-1106', 'the qw 1014') i'm inserting data tblsample tblprimary following query: insert tblprimary select s.sampleid tblsample s left join tblprimary p on s.sampleid = p.sampleid s.sampleid not in (select sampleid tblprimary) now want insert data tblsecondary also, during dat...

php - Foreach loop that loops through $_POST data instead of static isset($_POST["name"]......) -

so here again trying find better ways of doing things. 90% of tutorials things normal way below: if (isset($_post['name']) && isset($_post['password'])) { // stuff... } it fine seem static since prefer far more dynamic. example lets looping through $_post arrays within contact form. way can change name or fields whatever want or add more...my code handle rest. i know foreach loop come in handy but, new world of programming , php thought show me how done. how replace above loop? not sure start. try this: $check=true; if(isset($_post)){ foreach($_post $key=>$value){ if(!isset($_post[$key]){ $check = false; break; } } } based on $check can verify if sent or not. another approach have sort of verification because possible might not key in $_post $keys =array("input1","input2"); $check=true; if(isset($_post)){ foreach($keys $input){ if(!array_key_exists($input,$_post)){ $...

actionscript 3 - How to make angry birds scoring type "three stars rating" in flash? -

i want make scoring system shows star based on points angry birds. if get: 3 points = 3 stars, 1-2 points = 2 stars, 0 = 1 star the stars image. points save after answering of 3 questions. points appear in form of star above. desperately need this. create image 1 "lit" star, , 1 one "dim" star; place instances of them on stage, "lit" stars overlapping "dim" stars, being hidden initially; keep array references "lit" instance images, , turn visible number, proportional score. below more of general solution: public class starsscoring extends sprite { [embed(source = "path/to/dimimage.jpg")] private var _dimstar: class; [embed(source = "path/to/litimage.jpg")] private var _litstar: class; private const gap: uint = 10; private const group_x: uint = 25; private const group_y: uint = 25; private var _litstars: array = []; private var _numstars: uint; ...

c++ - How can I explicitly refer to an enclosing namespace when an inline namespace exists? -

please consider code: #include <iostream> namespace foo{ void ool() // version { std::cout << "foo::ool" << std::endl; } inline namespace bar{ void ool() // version b { std::cout << "foo::bar::ool" << std::endl; } } } int main() { foo::ool(); // <- error } both clang , g++ correctly mark foo::ool ambiguous. can call foo::bar::ool without problem there way call version without changing declaration? i found people in similar position trying understand happens did not see solution case. i in situation because have project includes declaration of std::__1::pair , std::pair , made in different places, std::__1 being inline namespace. need code point std::pair explicitly. there solution that? i don't think possible; cppreference : qualified name lookup examines enclosing namespace include names inline namespaces if same name presen...

objective c - Rounded views not working in iOS 9 -

i have code takes view , rounds corners - turning circle: imageview = [[uiimageview alloc] initwithframe:cgrectmake(0, 0, 8, 8)]; imageview.layer.cornerradius = imageview.frame.size.width/2; imageview.layer.maskstobounds = yes; this works great on ios 7 , ios 8 - doesn't work on ios 9. how can fix it? turns out adding background color imageview fixes issue...

Java: Prime Number Program Not Working -

why int j value 2? doesn't (int)realnum mean must natural number? scanner basicnum = new scanner(system. in ); string insertnum = joptionpane.showinputdialog(null, "insert number\n"); int realnum = integer.parseint(insertnum); int j = realnum = 1; if (realnum < 10000) { while ((realnum / j == (int) realnum)) { j++; } system.out.println(j); if (j > 2) { joptionpane.showmessagedialog(null, "it not prime!!"); } if (j < 2) { joptionpane.showmessagedialog(null, "it prime!"); } } else { joptionpane.showmessagedialog(null, "too large number!"); } in java 8, can this: boolean isprime(final int n) { return intstream.range(2, n / 2+1).nonematch(i -> n % == 0); } on earlier versions, 1 should same work, string insertnum = joptionpane.showinputdialog(null, "insert number\n"); int realnum = integer.parseint(insertnum); boolean prime =...

.net - Don't rollback the transaction on error in Entity Framework -

when error occurs in entity framework operation, ambient transaction aborted , can't use more database work. try open nested transaction scope, example, throws transactionabortedexception saying "the transaction has aborted." what can prevent when expect errors , know how continue? using (var scope = new transactionscope()) { using (var ctx = new mycontext()) { try { var x = ctx.myentities.firstordefault(); } catch { createtable(); // custom ddl command. can't use ef migrations. // should fail or not help, i'm happy see more exceptions later. } // todo: transaction scope aborted! ctx.myentities.add(...); } scope.complete(); } i make new dbcontext instance if helps. sql server not document kinds of exceptions roll transaction. can't make not roll frankly stupid , there no technical reason it. prone continue executi...

javascript - ReactJS checkable list issue -

i'm trying create react component contains long list (~500 items) checkboxes opposite each item. should toggle checked state of each item , toggle checked state of items in list. implemented component, see that. solution has low performance , time lag when toggle checkbox. when integrated in page, work slower jsfiddle example. jsfiddle what i'm doing wrong? should choose way work items data? var hello = react.createclass({ getinitialstate: function () { var db = []; (var = 0, l = 100; < l; i++) { db.push({ name: math.random().tostring(36).replace(/[^a-z]+/g, '').substr(0, 5), value: }); } return { db: db }; }, checkall: function (ev) { var items = this.state.db.slice(); items.foreach(function (v) { v.checked = ev.target.checked; }); this.setstate({db: items}); }, handlecheck: function (ev) { debugger; var id = ev.target.dataset.id; ...

validation - How to detect valueChange event in validator? -

mojarra 2.1 i need write validator h:inputtext performs logic if value input changed. i.e. public class myvalidator implements validator{ public void validate(facescontext context, uicomponent component, object value) throws validatorexception; if(valuechanged(uicomponent component)){ //the method checks if value's changed //do piece of logic } return; } } i dug queuing events of uiinput , found this: validatevalue(context, newvalue); // if our value valid, store new value, erase // "submitted" value, , emit valuechangeevent if appropriate if (isvalid()) { object previous = getvalue(); setvalue(newvalue); setsubmittedvalue(null); if (comparevalues(previous, newvalue)) { queueevent(new valuechangeevent(this, previous, newvalue)); } } this piece of code method, executed validation phase callback. first...

paypal express - DoExpressCheckoutPayment response with PaymentStatus None -

in live environment seeing responses doexpresscheckoutpayment paymentstatus none/null. response has ack set success imply valid payment (combined paymentstatus of completed), these payments declined. using paypal nuget packages under asp.net. my question none/null imply need execute api call in order actual status? call doexpresscheckoutpayment again or call gettransactiondetails? if status cannot determined within checkout pipeline need reject payment. your payment status should not null should completed or pending. other status means payment did not complete or there error. 1 way make transaction completed send gettransactiondetails api call or transactionsearch api call. from paypal developer site here transaction search: how transaction search request ------- endpoint url: https://api-3t.sandbox.paypal.com/nvp http method: post post data: user=merchant_user_name &pwd=merchant_password &signature=merchant_signature &method=transactionsearch &star...

sendmail - How to get Dynamic Data in email newsletter from the website in asp.net c#? -

i have newsletter design in have bind data dynamically , send mail users in asp.net c# through noreply@xyz.com tried getting error of authentication if knows please sort out problem. mailmessage msg = new mailmessage(); mailaddress frommail = new mailaddress("abc@gmail.com"); // sender e-mail address. msg.from = frommail; // recipient e-mail address. msg.to.add(new mailaddress("xyz@gmail.com")); // subject of e-mail msg.subject = "send gridivew in email"; msg.body += "please check below data <br/><br/>"; msg.body += getgridviewdata(gvuserinfo); msg.isbodyhtml = true; string ssmtpserver = ""; ssmtpserver = "smtp.gmail.com"; smtpclient = new smtpclient(); a.host = ssmtpserver; a.enablessl = true; a.port = 587; a.deliverymethod = system.net.mail.smtpdeliverymethod.network; ...

Android create file from drawable -

is there way create file image drawable send via multypartentity ? having error time. fileuri = uri.parse("android.resource://com.wellbread/drawable/placeholder_avatar.png"); mcurrentphotopath = fileuri.tostring(); java.io.filenotfoundexception: android.resource:/com.wellbread/drawable/placeholder_avatar.png: open failed: enoent (no such file or directory) 08-25 12:01:53.134 3663-3684/? w/system.err﹕ @ libcore.io.iobridge.open(iobridge.java:456) try following sample code: drawable drawable = getresources().getdrawable(r.drawable.ic_action_home); if (drawable != null) { bitmap bitmap = ((bitmapdrawable) drawable).getbitmap(); bytearrayoutputstream stream = new bytearrayoutputstream(); bitmap.compress(bitmap.compressformat.png, 100, stream); final byte[] bitmapdata = stream.tobytearray(); string url = "http://10.0.2.2/api/fileupload"; multipartentitybuilder ...

excel - Autoupdating userform for each loop without needing to response to the userform -

i know if possible autoupdate userform in vba? in case: while cells(57, 3) > (cells(47, 3) - cells(46, 3) + 0) cells(52, 3) = cells(52, 3) + 0.5 call foto_2 wend as can see in code above, have loop change value of cell. and value of cell link graphique by calling foto_2 , updating image on userform. here code in userform contain image of foto_2 , private sub userform_initialize() call foto_2 end sub while code foto_2 , sub foto_2() application.screenupdating = false fname = .... sheets(1).chartobjects("foto_2").chart.export filename:=fname, filtername:="gif" userform1.image1.picture = loadpicture(fname) end sub in foto_2 procedure, place doevents after last line: sub foto_2() application.screenupdating = false fname = .... sheets(1).chartobjects("foto_2").chart.export filename:=fname, filtername:="gif" userform1.image1.picture = loadpicture(fname) doevents end ...

java - How to get file path dynamically? -

i write application load other classes other folder : public static void main(string[] args) throws exception { string rootpath = null; rootpath = system.getproperty("user.dir"); //system.out.println(rootpath); file operatorfile = new file(rootpath + "business\\"); url operatorfilepath = operatorfile.tourl(); url[] operatorfilepaths = new url[]{operatorfilepath}; classloader cl = new urlclassloader(operatorfilepaths); // plus , minus,multiply,divide classes in business folder class[] operatorclass = new class[]{ cl.loadclass("plus"), cl.loadclass("minus"),cl.loadclass("multiply") , cl.loadclass("divide") }; i want dynamically business folder path(my main class in myfolder). both myfolder , business folders in drive d:\ . app dose not work because think below statement dose not correct : file operatorfile = new file(rootpath + "business\\"); can me? since hav...

osx - How can two 100% identical files have different sizes? -

Image
i have 2 100% identical empty .sh shell script files on mac: encrypt.sh: 299 bytes decrypt.sh: 13 bytes (actually size correct, since have 13 bytes: 11 character + 2 new line) the contents of encrypt.sh , hexdump: the contents of decrypt.sh , hexdump: the file info window of encrypt.sh : the file info window of decrypt.sh : they have exact same hexdump, how possible have different sizes? mac os x file system implementing forks, larger 1 having specific stored in resource fork . use ls -l@ more details.

javascript - Set the selected index of a dynamic dropdown(DOM) using jQuery -

1)model my index values stored in int array; public int[] mobileid { get; set;} 2)view @for(int i=0;i<3;i++)//now create 3 dropdown same name { <div> @html.dropdownlistfor(model=>model.mobileid ,new selectlist((viewbag.mobileinfo),"value","text"),new {@id="ddl"}) </div> } 3)script mobileid have 3 integer value. values 2, 3 4 how set selected value above 3 dropdown $("#ddl").val('2'); $("#ddl").val('3'); $("#ddl").val('4'); when dropdownload ,this values show 1st position you can't have 3 select boxes same id . it's invalid. id values must unique . instead, either give them different id s, e.g.: @for(int i=0;i<3;i++)//now create 3 dropdown same name { <div> @html.dropdownlistfor(model=>model.mobileid ,new selectlist((viewbag.mobileinfo),"value","text"),new {@id="ddl" + i}) // -------------------------...

Not able to install mysql on Ubuntu 14.2 -

i trying # sudo apt install mysql-server-5.6 executing query showing reading package lists... done building dependency tree reading state information... done might want run 'apt-get -f install' correct these: following packages have unmet dependencies: mysql-server : depends: mysql-server-5.5 not going installed mysql-server-5.6 : depends: mysql-client-5.6 (>= 5.6.19-0ubuntu0.14.04.1) not going installed depends: mysql-server-core-5.6 (= 5.6.19-0ubuntu0.14.04.1) not going installed recommends: mysql-common-5.6 not going installed e: unmet dependencies. try 'apt-get -f install' no packages (or specify solution). i followoing tutorial . how install this??? you have install dependencies, can see below : the following packages have unmet dependencies: mysql-server : depends: mysql-server-5.5 not going installed mysql-server-5.6 : depends: mysql-client-5.6 (>= 5.6.19-0ubuntu0.14.04.1) not going instal...

Regex to match specific, multiline object in JSON list -

i work json lists can following: [ { "accesstype": "*", "principaltype": "role", "principalid": "$unauthenticated", "permission": "deny" }, { "accesstype": "*", "principaltype": "role", "principalid": "$everyone", "permission": "deny" }, { "accesstype": "*", "principaltype": "role", "principalid": "$owner", "permission": "allow" } ] what proper way write regex correctly extracts list item contains word $everyone ? need extract entire object, correct result should be: { "accesstype": "*", "principaltype": "role", "principalid": "$everyone", "permission"...