Posts

Showing posts from April, 2013

haskell - haskellformac , why use 'runhaskell' command? -

reading http://blog.haskellformac.com/blog/running-command-line-programs : this requires installing haskell mac command line tools outlined in previous article. tools include command named runhaskell, runs haskell program in "script mode" — i.e., being interpreted, instead of compiled (much like, say, python interpreter runs python script). why provide tool run haskell in script mode ? as code being interpreted mean run slower in script mode ? yes, run slower, depending on application may not matter @ all. many interesting tasks don't in fact require lot of computations, wouldn't notice runtime difference between, say, java , ruby, though latter considered have worse performance. for such quick-run applications, what's rather more important startup time . interpreted languages, pretty immediate, whereas recompiling script can take considerable time. so, interpreting can indeed faster compiling, in practise! furthermore, because ...

javascript - Code for select/unselect all checkboxes in an AngularJS Table -

iam confused @ point , need anyone's here. went through various examples nothing help. i have created dynamic table, added checkboxes. whenever row selected id bound array , diplayed @ top of table. what need is:the code functionality of select check box. , whenever rows selected select checkbox, ids has displayed. below code table: <table> <thead> <tr> <th> <input name="all" type="checkbox" ng-click="selectall()" /> </th> <th>id</th> <th>date</th> </tr> </thead> <tbody ng-repeat="x in cons"> <tr> <td> <input type="checkbox" name="selectedids[]" value="{{x.id}}" ng-checked="idselection.indexof(x.id) > -1" ng-click="toggleselection(x.id, idselection)"> </td> <td>{{x.id}}</td> <td...

How do I upload image Podio SDK using Objective-C (iOS)? -

i integrating podio sdk. getting data item values , updating also, images won't upload. idea? don't know how upload image on podio sdk. nsdata *data = uiimagejpegrepresentation(self.imgview_sign.image, 0.8f); [[[pktfile uploadwithdata:data filename:@"mobi.jpg"] pipe:^pktasynctask *(pktfile *file){ pktitem *item = [pktitem itemforappwithid:431525395]; item[@"title"] = @"chekri"; item[@"signautre"] = file; return [item save]; }] onsuccess:^(pktitem *item){ nslog(@"pkt file %@",item); } onerror:^(nserror *error){ nslog(@"error file %@",error); }]; please use below code might work you. uiimage *image = [uiimage imagenamed:@"some-image.jpg"]; nsdata *data = uiimagejpegrepresentation(image, 0.8f); pktasynctask *uploadtask = [pktfile uploadwithdata:data filename:@"image.jpg"]; [uploadtask oncomplete:^(pktfile *file, nserror *error) { if (!error) { nslo...

php - Converting a text file into CSV or storing each value in mysql? -

sampnum acc_x acc_y acc_z 1 0.89304 0.00366 -0.247416 2 0.89304 0.00366 -0.247416 3 0.887184 0.008052 -0.240096 i have log file , need convert csv file or pick every field , save mysql table columns name sampnum, etc along corresponding values. how can php? please: don't use deprecated ext/mysql, when can use ext/mysqli or pdo. don't read entire csv file php variable. happens when file 500mb? don't write custom php code parse csv data, when can use builtin function fgetcsv(). don't create new sql statement every row in data, when can use prepared statements. don't interpolate data external file sql statements. risks sql injection vulnerabilities, when interpolate untrusted user input. don't parse , insert csv data row row, when can use mysql's load data infile command. it's 2...

html - Gmail ignoring media query? - create a mobile-only div -

i trying make <div> visible on mobile. inside <head> tag have: <style> @media screen , (min-device-width: 481px) { div[class="mobile-only"] { height: 0px !important; overflow: hidden !important; } } @media screen , (max-device-width: 480px) { div[class="mobile-only"] { height: auto !important; overflow: auto !important; } </style> and in html: <div class="mobile-only"> <table...> </div> i have tried gazillion (roughly) different ways of getting work, such display: none; gmail seems totally ignore media query , show <div> regardless. is there trick this? works in outlook client. you can try following: html: <div class="mobile-only" style="overflow:hidden; float:left; display:none; line-height:0px;"><br/>this hidden on desktop!</div> css: @media screen , (max-device-width: 480px) { *[class="mobile-o...

sql - How to Pivot multiple columns into rows -

Image
i having sample query data table: i want output table like: i tried using pivot operator not possible sum them all. select * ( select * woddb.citystock_unpivot ) tblcity unpivot ( outputvalue [outputfieldname] in (sales, stock, [target]) ) unpvt pivot ( sum(outputvalue) category in (panel,ac,ref) ) pvt

Is a single exit at the bottom of a batch file redundant? -

i'm working on windows .bat files have been around long time. on last line, have single exit statement without arguments. this appears redundant me. there valid reason presence? an exit withoput /b option exit batch file and cmd.exe instance. when start batch file starting explorer, there not difference, when start batch file cmd window, window closes when batch file executes exit . normally should avoid this, it's annoying behaviour, can't build batch file calling type of files, exit cancels calling batch file. call myannoyingbatch.bat echo won't displayed anymore i know 1 reason using exit @ end of script. when build drag&drop script should bullet proof , need exit avoid problems filenames cat&dog.png

What are the file extensions does Apache solr 6.1 support? -

i try apache solr 6.1 index document , extract contents accepts .doc extension files not support .docx or .ppt extension files. shows error " connection solr lost please check solr instance. " error mean? no , wrong . solr accepts .docx , .ppt files without doubt . error getting because of network connection . connection not persisitent enough perform operations . has nothing file extensions .

Android. issue with logcat with shell and from app -

Image
if adb shell: logcat -d -v time incall:i *:s i : but in android app: public static stringbuilder getlog() { stringbuilder builder = new stringbuilder(); try { string[] command = new string[] { "logcat", "-d", "-v", "time", "incall:i *:s" }; process process = runtime.getruntime().exec(command); bufferedreader bufferedreader = new bufferedreader( new inputstreamreader(process.getinputstream())); string line; while ((line = bufferedreader.readline()) != null) { //if (line.contains(processid)) { builder.append(line); //code here log.e(tag, line); //} } } catch (ioexception ex) { log.e(tag, "getlog failed", ex); } return builder; } i only: --------- beginning of system ----...

Issue passing array as argument [to InvokeArg()] in php - var_dump are the same but only one works? -

backstory: creating function handle mysqli , binding data. code in scope of single function. using reflectionclass programmatically invoke mysqli_stmt_bind_param function (as number of arguments vary). problem: having issue passing array built programmatically ($refarr). when compare var_dump of array (with sample array created directly), 2 arrays identical. invokearg() method runs sample array ($refarr_sample) not $refarr. here output code shown below: array(3) { [0]=> string(2) "si" [1]=> string(5) "user1" [2]=> int(0) } - output of refarr array(3) { [0]=> string(2) "si" [1]=> string(5) "user1" [2]=> int(0) } - output of refarr_sample $refarr_sample = array("si", "user1", 0); // var_dump equal in type , length var_dump($refarr); var_dump($refarr_sample); $ref = new reflectionclass('mysqli_stmt'); $method = $ref->getmethod("bind_param"); $method->invokeargs...

docker - How to get kubernetes cluster view? -

i have kubernetes cluster in replicationcontroller, service, endpoints, pods etc running. want overall view of kubernetes cluster block diagram. can 1 complete requirement? check out kubernetes dashboard . isn't quite block diagram, provides view going on in cluster. there kubernetes ui , doesn't have active development, @ 1 point able show cool graph of kubernetes internals.

javascript - How to use radio buttons to change variable values -

i'm new coding , trying use html5 & javascript create educational simulation user input. to limit input sensible values i'd use 3 radio buttons choose between air, water & oil. each of these needs associated viscosity value & density value used later on in simulation. i've seen far how use "value" attribute of radio button output, seeing need 2 outputs tied each button how acheive (outputs sent 2 spans innerhtml taken getelementbyid().innerhtml later in script. <div class="radio"> <p><b>fluid type</b></p> <form id="fluidform"> <p> <label>air: <input type="radio" name="fluid" value="air" /></label> <label>water: <input type="radio" name="fluid" value="water" /></label> <label>oil: <input type="radio" name="fluid" value=...

stored procedures - MySQL Function getting Syntax Error -

i trying create below function in mysql getting syntax error. not able find solution, grateful help create function `test`.`pro`(depart_id int) returns varchar begin declare title varchar; if depart_id = 1 set title='it department'; else if depart_id = 2 set title='hr department'; else set title='admin'; end if; return title; end$$ delimiter ; you have several syntax errors in script: varchar must have length you should define delimiter $$ first it's not else if , elseif try this;) delimiter $$ create function `test`.`pro`(depart_id int) returns varchar(10) begin declare title varchar(10); if depart_id = 1 set title='it department'; elseif depart_id = 2 set title='hr department'; else set title='admin'; end if; return title; end $$ delimiter ;

PHP if / if else statement not working as expected (Probably Simple) -

ok, trying if / else if statement doesn't act expect. trying check url address enters things. way have done crap not @ programming. all if parts work except bit if (strpos($urlcheck, "http://") == false) it supposed check if url has http:// in it. whether or doesn't still acts same way. i tried forcing http:// url stripping of http:// or https://. when echo variable ($urlcheck) , shows url http://.....so why doesn't code work? thanks $url = htmlspecialchars($_post["url"]); $urlremovesarray = array('https//:', 'http//:'); $urlhttp = str_replace($urlremovesarray, "", $url); $urlcheck = "http://" . $urlhttp; $urlsearchcheck2 = 'property-profile/'; $urlsearchcheckdomain = "domain"; if (strpos($url, $urlsearchcheck2) !== false) { echo "test 1"; } else if (strpos($urlcheck, "http://") == false) { echo "test 2"; ec...

Wcf Tcp duplex service unreachable -

i create wcf service using net.tcp binding , put in server , going right( can browse it, call , getting answer etc.. i implemented heartbeat method in service called application. after while (half day or may more) when try reach service : "a connection attempt failed because connected party did not respond after period of time, or established connection failed because connected host has failed respond" what weird old client (just one) still connected service , work cannot call wcf service other clients i activated wcf tracing there no errors. when recycle apppool service start working , after while same weird behaviour.. any idea or solution please? start working on issue week ago , untill no progress

javascript - JSONP not working with Jersey and JQuery -

i have restful server , jquery script calling data. not able data via jsonp . java method:- @get @path("search") @jsonp(queryparam="callback") @produces({"application/x-javascript"}) public response getalltestdata(@queryparam("callback") string callback) { system.out.println("i got executed!"); string result="{\"id\":1}"; //return response.status(200).entity("{ foo: 'bar' }").build(); //return result; return response.ok("{status: 'success'}").header("access-control-allow-origin", "*").build(); } jquery script:- $("button").click(function() { var surl = "http://localhost:8080/wikirating/engine/employee/search"; $.ajax({ type: 'get', url: surl, data: {"name": 1}, datatype: "jsonp", jsonp : "callback", j...

javascript - Moving single-letter word to new line -

is there way move single-letter word next line javascript? code database can't edit manually. i've found function finds these words, have no idea how put these new line. <div id="flop" class="foobar">lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex commodo consequat. duis aute irure dolor in reprehenderit in volue v esse cillum dolore eu fugiat nulla p</div><br> <button value="go" onclick="foo();">go</button> function foo(){ var d = document.getelementbyid('flop'); var t = d.innerhtml; var w = t.split(' '); d.innerhtml = w[0]; var height = d.clientheight; for(var = 1; < w.length; i++){ d.innerhtml = d.innerhtml + ' ' + w[i]; if(d.clientheight > hei...

Excel VBA function - add "+" to every word in a cell with exception -

i found topic here same question. @kazimierzjawor posted solution (sub). want turn solution function work single value passed in: function addplus(word string) string dim tmpwords variant dim skipwords variant skipwords = array("в", "от", "под", "над", "за", "перед") dim integer, j integer dim final string, boexclude boolean tmpwords = split(word.value, " ") = 0 ubound(tmpwords) j = 0 ubound(skipwords) if ucase(skipwords(j)) = ucase(tmpwords(i)) boexclude = true exit end if next j if boexclude = false final = final & "+" & tmpwords(i) & " " else final = final & tmpwords(i) & " " end if boexclude = false next word = left(final, len(final) - 1) final = "" end function however function throws error "invalid qualifier" in line tmpwords = split(word.value, " ") i know has easy, i'm new vba...

android - RecyclerLayout inside CoordinatorLayout scrollToPosition visibility -

i using coordinatorlayout appbarlayout inside , element try able scroll when recyclerview being scrolled. until that, working suposed to, problems comes when try programatically scrolltoposition of lasts positions of recyclerview . recyclerviews scroll, position tell scroll not visible (in fact, if scroll manually, visible once other element inside appbarlayout has scrolled out of screen). this code: <android.support.design.widget.coordinatorlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.design.widget.appbarlayout android:id="@+id/app_bar_layout" android:layout_width="match_parent" android:layout_height="wrap_content" app:elevation="...

camera - How to dismiss imagePicker when user don't allow access in iOS -

Image
i checking camera , photo permission on app when user select or capture image. using code. -(void)choosephotofromexistingimages { alauthorizationstatus status = [alassetslibrary authorizationstatus]; if (status == alauthorizationstatusdenied || status == alauthorizationstatusrestricted) { [appdelegate showalertviewforphotos]; //show alert asking user give permission } else{ if ([uiimagepickercontroller issourcetypeavailable: uiimagepickercontrollersourcetypephotolibrary]) { uiimagepickercontroller *controller = [[uiimagepickercontroller alloc] init]; controller.sourcetype = uiimagepickercontrollersourcetypesavedphotosalbum; controller.allowsediting = yes; controller.mediatypes = [[nsarray alloc] initwithobjects: (nsstring *) kuttypeimage, nil] ; controller.delegate = self; [self presentviewcontroller: controller animated: yes completion: nil]; }...

c# - Wait until string.contains() condition is met -

i'm reading file c# application , decompressing tile_data blob using gzip stream. i'm accessing blob data through method: sqlitecommand command = new sqlitecommand(query, dbconn); sqlitedatareader reader = command.executereader(); bool ismet = false; while (reader.read()) { using (var file = reader.getstream(0)) using (var unzip = new gzipstream(file, compressionmode.decompress)) using (var filereader = new streamreader(unzip)) { var line = filereader.readline(); while (!filereader.endofstream) { } console.writeline("end of tile_data"); } } reader.close(); console.writeline("reader closed"); console.readkey(); } catch (exception e) { console.write(e.stacktrace); console.readkey(); } i'm looking wait until filereader detects "tertiary" (string) , prints data afterwards. attempted use bool , nested while loop came infinite loop, hence question. the code used (and ...

python 3.x - Django slow autoreload due to check_url_config system check -

my load , autoreload on python manage.py runserver taking lot of time. (25seconds+). did bit of digging , seems stuck on "performing system checks..". investigate more, added timer on each of check functions. c:\programs\python35-32\python.exe manage.py runserver performing system checks... self.check: check_default_cache_is_configured 0.0 self.check: check_duplicate_template_settings 0.0 self.check: check_all_models 0.028018712997436523 self.check: check_model_signals 0.0 self.check: check_setting_app_dirs_loaders 0.0 self.check: check_url_config 25.260559558868408 self.check: check_admin_app 0.0 self.check: check_user_model 0.0 self.check: check_generic_foreign_keys 0.0010006427764892578 system check identified no issues (0 silenced). self.check: 25.289578914642334 self.check_migrations: 0.08856558799743652 june 28, 2016 - 15:43:08 django version 1.9.6, using settings 'mar16_cookifi_com.settings' starting development server @ http://127.0.0.1:8000/ quit serve...

Bash read file line by line, split by tab, send to java application -

i want read file line line, construct args string , use string start java application. the file test.txt contains example lines, columns tab separated: abc def ghj kln asd ss fdf twe #!/bin/bash ifs=$'\n' while read k d m s echo java -jar test.jar -k $k -d $d -a $a -m $m -s $s done < test.txt unfortunatly not work. bash output broken: -k abc def ghj kln -d -a -m -s you columns tab separated, should use \t ifs instead of \n means newline: ifs=$'\t' (assuming each line of input contains values k , d , a , m , s separated tabs).

mysql - How to ORDER BY a person's first_name but ALSO insert nicknames ASC -

here example data: nickname first_name last_name ======= ======= ======= charlie smith beta jones alpha chris anderson delta nick andrews this result want (first letters a, b, c, d) " a lpha" chris anderson b eta jones c harlie smith " d elta" nick andrews my problem when run usual order nickname asc, first_name asc (b, c, a, d): b eta jones c harlie smith " a lpha" chris anderson " d elta" nick andrews any ideas? you want coalesce() : order coalesce(nickname, first_name) this assumes blank values null . if empty strings, then: order coalesce(nullif(nickname, ''), first_name)

vhdl - dual port RAM write data -

i little bit confused dual port ram,my target write , read data.i want write data.like on address 128 , on rest adresses 0.is works correctly,because im not sure case statements useful? how write correctly data in ram? reading this article , think need true dual port ram.i have next code. library ieee; use ieee.std_logic_1164.all; entity true_dual_port_ram_single_clock generic ( data_width : natural := 8; addr_width : natural := 6 ); port ( clk : in std_logic; addr_a : in natural range 0 2**addr_width - 1; addr_b : in natural range 0 2**addr_width - 1; data_a : in std_logic_vector((data_width-1) downto 0); data_b : in std_logic_vector((data_width-1) downto 0); we_a : in std_logic := '1'; we_b : in std_logic := '1'; q_a : out std_logic_vector((data_width -1) downto 0); q_b : out std_logic_vector((data_width -1) downto 0) ); end true_dual_port_ram_single_clock; architecture rtl of true_dual_port_ram_single_clock -- build 2-d array type...

javascript - Understanding observables in angular 2 -

i new angular 2 , observables. i have html template has text box. gets cleared when observables don't return data when data exists gets filled first data item. i don't know how happens though have read tutorials observables. html <form class="clearfix" role="form" [ngformmodel]="basicdetailsform"> <div class="form-group col-md-6 no-padding"> <label for="assignedto" class="text-muted">assigned to</label> <input class="form-control bold" id="assignedto" type="text" [ngformcontrol]="ctrlassignedto" (change)="assignedtochanged($event)" [(ngmodel)]="activeitem.assignee.name" /> </div> </form> and component .ts file has .component.ts public ngoninit(): void { // subscribe users observabl...

android - How FCM knows who will receive upstream message? -

i developing app using firebase cloud messaging. , want send notification message device other device in topic group "teamandroid". read on firebase official site code send upstream messages: firebasemessaging fm = firebasemessaging.getinstance(); fm.send(new remotemessage.builder(sender_id + "@gcm.googleapis.com") .setmessageid(integer.tostring(msgid.incrementandget())) .adddata("my_message", "hello world") .adddata("my_action","say_hello") .build()); but in code put information user want send message? how fcm knows send message sent me? fcm not offer direct device-to-device messaging facility. "upstream message" here means message being sent phone app server, have implement. see docs more details. to send message 1 device another, send app server device 1, in turn sends downstream message device 2.

Sharing UICollectionView data from 3 view controllers using MVC iOS -

this scenario.i working on app there 3 view controllers(say "child1","child2","child3") each collectionview on it.now of them have same functionality.the difference data coming 3 different apis.now have created parent view controller(say "parentvc") , 3 viewcontrollers inherit "parentvc". now suppose arrive on "child1",api hits , collectionview reloaded. push "child2",api hits , collectionview reloaded. similar case "child3". now when pop "child3",the api on "child2" should not hit again. similar case when pop "child2". now have managed that,but here problem. problem: i trying use mvc pattern,and have separate data model class takes data api.now how can use mvc in scenario,as data model needs updated everytime switch between view controllers , therefore reload operation needs done? you have 2 options solve problem 1- try call api in viewwillappear inste...

mysql - SQL query to find rows between now and time in long -

i need run sql query find rows of data falls between particular interval of 1 hour, 1 day, 1 month , on. here time of hour or month passing in millis i.e long value of time duration below query between (now() - interval " + timeduration + ") , now() - used pass time duration in string (1 hour) while using query , worked awesome is of no me can between query long time duration can 1 hour, 1 day , 1 week i.e. 3600000,86400000 , on use timestampadd like;) between timestampadd(hour, -1, now()) , now() and day: between timestampadd(day, -1, now()) , now()

php - phpstorm problems and issues in laravel method not found, route note found, pdo exception -

hi every 1 used phpstorm 9 laravel , best 4 days first had error route not found. update composer added dependencies told on link https://confluence.jetbrains.com/display/phpstorm/laravel+development+using+phpstorm then worked fine day again 'find' method not found 'string', 'integer' not found. i installed new window , whole thing again did not worked. updated phpstorm newest version updated plugin etc. same problem continues , wasted 4 days. can body explain why that, php storm has issues or what. the second thing is, there ide laravel phpstorm don't have such problems except sublimetext. @ijaz khan did try install package laravel-ide-helper this solve 90% of method not found packages this packages generates file ide can understand, can provide accurate autocompletion. generation done, based on files in project, alway up-to-date more here .

list - Haskell's head tail init and last in GHCi -

i have question head , tail , init , last . following works in ghci: prelude data.list data.char> let n = [1..10] in (head n : tail n) [1,2,3,4,5,6,7,8,9,10] as expected, whole list. should work init , last too, right? prelude data.list data.char> let n = [1..10] in (init n : last n) <interactive>:39:1: non type-variable argument in constraint: enum [[a]] (use flexiblecontexts permit this) when checking ‘it’ has inferred type :: forall a. (enum a, enum [[a]], num a, num [[a]]) => [[a]] if @ type signatures functions, head , last same -- both return element. init , tail same, because both return lists. prelude data.list data.char> :info head head :: [a] -> -- defined in ‘ghc.list’ prelude data.list data.char> :info tail tail :: [a] -> [a] -- defined in ‘ghc.list’ prelude data.list data.char> :info init init :: [a] -> [a] -- defined in ‘ghc.list’ prelude data.list data.char> :info last last :: [a...

java - Hibernate: OneToMany relationship WITHOUTH cyclic dependency -

Image
i have onetomany data model 2 entities. 1 machine contains many characteristics. problem: trying create entities without cyclic dependency. but issue: exception sending context initialized event listener instance of class org.springframework.web.context.contextloaderlistener org.springframework.beans.factory.beancreationexception: error creating bean name 'entitymanagerfactory' defined in servletcontext resource [/web-inf/spring-config.xml]: invocation of init method failed; nested exception javax.persistence.persistenceexception: [persistenceunit: default] unable build hibernate sessionfactory @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1574) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.docreatebean(abstractautowirecapablebeanfactory.java:539) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.createbe...

arguments - Getopt not parsing well bash -

i wrote script in bash serving template several monitors. choose getopt in order able use long options on cli. however, have problems implementing correctly. the whole script lot longer, relevant part: #!/bin/bash # # function # main # description # main function. called here # args # nothing # # return code # nothing # # main function. called here main() { # parse options , arguments parse_options "${@}" # check if interval set valid number check_interval } # # function # check_interval # description # checks if number valid # args # 1: number checked # return code # 0: valid # 1: invalid # check_interval() { # don't have worry if interval set @ all, because getopt doing if ( ! check_number_pos ${arginterval} ); echo "error: invalid interval: ${arginterval}" show_usage exit 2 fi } # # function # show_usage # description # usage section. showing usage according docopt standards # args # nothing # retur...

c# - Exception when referencing a resource dictionary -

my solution consists of following projects: servicetools.com servicetools.ui (startup) servicetools.ui.controls servicetools.ui.themes in ui.controls i've created custom button control derives button. custom button should use resourcedictionary located in servicetools.ui.themes.buttons.default.xaml so servicetools.ui.controls references servicetools.ui.themes , uses <resourcedictionary> <resourcedictionary.mergeddictionaries> <resourcedictionary source="pack://application:,,,/servicetools.ui.themes;component/buttons/default.xaml" /> </resourcedictionary.mergeddictionaries> </resourcedictionary> if try use dictionary intellisense suggesting brushes (at least outside triggers section). when start debugging application crashes system.windows.markup.xamlparseexception ( inner exception: not load file or assembly 'servicetools.ui.themes, culture=neutral' or 1 of dependencies. system canno...

javascript - Objects in div connected dynamically using div ID -

the first input creates loop called enter # of circles creates multiple divs. each div contains circle , input object. the input color supposed change color of circle within same div using id pulled out of divid. the id pulled out of loop yet doesn't seem working because of event listener nothing seems work. any clue of being done wrong? <!doctype html> <head> <title>bins status</title> <style> div { width: 120px; height: 120px; display: inline-block; margin-left: 1px; } </style> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0; target-densitydpi=device-dpi" /> <link rel="stylesheet" type="text/css" href="style.css"/> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"> </scrip...

activerecord - How to retrieve all related objects from an existing selection set in Rails -

in rails app have 2 models related via has_many , belongs_to associations: class entity < activerecord::base has_many :applicants end class applicant < activerecord::base belongs_to :entity end i'm using searchkick first select entities - details of don't matter, given existing collection of entity objects, how can retrieve of related applicant objects ? # select entities (in app i'm using searchkick run search) entities = entity.search params[:query] # find applicants related selected entities applicants = entities.??? this works, slow given large selection: # retrieve applicants related selected entities applicants = [] entities.each |entity| applicants += entity.applicants end is there rails short-hand retrieve applicants related selected entities? other things i've tried: entities.class => entity::activerecord_relation entities.applicants => #error entities.applicant_ids => #error like this? applicant.joins(:en...

javascript - Header name issue is coming in jquery export html data table downloaded excel sheet in internet explorer -

i exporting excel sheet in ie. header name not coming through correctly in downloaded sheet. in other browsers it's working fine. excel sheet header name spanish word. please on this. $(document).ready(function() { console.log("hello") function exporttabletocsv($table, filename) { var $headers = $table.find('tr:has(th)'), $rows = $table.find('tr:has(td)'), // temporary delimiter characters unlikely typed keyboard // avoid accidentally splitting actual contents tmpcoldelim = string.fromcharcode(11), // vertical tab character tmprowdelim = string.fromcharcode(0), // null character // actual delimiter characters csv format coldelim = '","', rowdelim = '"\r\n"'; // grab text table csv formatted string var csv = '"'; csv += formatrows($headers.map(grabrow)); csv += rowdelim; csv += formatrows($rows.map(grabrow)) + ...

Merge two image created using php -

how can merge 2 image created url 2 url like: merge these 2 images: `$url1= https://imageare.com/nc/aud/tr.php?track=426413219-.wav&ignorable_duration=1.0 $url2=https://imageare.com/nc/aud/tr.phptrack=426413219_chan1.wav&ignorable_duration=1.0 not same possible duplicate: image not fetched to merge 2 images shown here , assuming images in png .you might need use following code: $url1=https://imageare.com/nc/aud/tr.php?track=426413219-.wav&ignorable_duration=1.0 $url2=https://imageare.com/nc/aud/tr.phptrack=426413219_chan1.wav&ignorable_duration=1.0 $dest = imagecreatefrompng($url1); $src = imagecreatefrompng($url2); imagecopymerge($dest, $src, 0, 0, 0, 0, 500, 100, 90); the following can used output image browser header('content-type: image/png'); imagepng($dest);

sapui5 - How to create a Smart Field control with ValueHelp feld -

i need implement smart field control value in form. getting json response odata service. , setting jsonmodel. have tried sample code refering link don't know how bindelement. please refer jsbin smartcontrols rely on odata! however, using jsonmodel! also, @matbtt mentioned binding single field array, should way mentioned above... jsbin correction still jsonmodel instead of odatamodel. , this 1 uses odata , works fine. is there specific reason why call odata service , wrap response jsonmodel? know how use odatamodel in ui5? and thank using single file template!

android - CommandInvokationFailure error when building APK? -

i'm getting following error when build apk: commandinvokationfailure: failed re-package resources. see console details. c:\users\me\appdata\local\android\sdk\build-tools\24.0.0\aapt.exe package --auto-add-overlay -v -f -m -j gen -m androidmanifest.xml -s "res" -i "c:/users/me/appdata/local/android/sdk\platforms\android-24\android.jar" -f bin/resources.ap_ --extra-packages i wish integrate "leaderboards" in app using google play services. should fix this? what i've tried: reinstalling google play services plugin. updating sdk: see here . (tell me if did properly). made sure have latest versions of "extras/android support repository" , "extras/google repository". installed in sdk manager. see here . updating unity. restarting. few minor changes. this absolutely fix problem. download google_play_services link below : https://dl-ssl.google.com/android/repository/google_play_services_8298000_r28.z...

javascript - Cannot read property 'then' of undefined in MdDataTable -

i'm using mddatatable display data want retrieve server. want use pagination. angular code: $scope.paginatorcallback = function(page, pagesize){ var offset = (page-1) * pagesize; mysrv.getdata.get( { offset: offset, pagesize: pagesize }, function (data) { return { results: data.list, totalresultcount: data.totalresults } }, function (error) { alert(error); } ) } this html code: <mdt-table paginated-rows="{isenabled: true, rowsperpagevalues: [5,10,20,50]}" mdt-row-paginator="paginatorcallback(page, pagesize)" mdt-row-paginator-error-message="error happened during loading nutritions." mdt-row="{ 'table-row-id-key': 'fields.item_id', 'column-keys': [ ...

r - Horizontal barplot for comparison two data - based on ratio -

Image
i create horizontal barplot compare 2 of tables. did comparison , created table ratio. that's how data looks like: > dput(data) structure(list(name=c('mazda rx4','mazda rx4 wag','datsun 710','hornet 4 drive', 'hornet sportabout','valiant','duster 360','merc 240d','merc 230','merc 280','merc 280c', 'merc 450se','merc 450sl','merc 450slc','cadillac fleetwood','lincoln continental', 'chrysler imperial','fiat 128','honda civic','toyota corolla'),ratio=c(1.393319198903125, 0.374762569687951,0.258112791829808,0.250298480396529,1.272180366473129,0.318000456484454, 0.264074483447591,0.350798965144559,2.310541690719624,1.314300844213157,1.18061486696761, 0.281581177092538,0.270164442687919,2.335578882236703,2.362339701969396,1.307731925943769, 0.347550384302281,0.232276047899868,0.125643566969327,0.281209747680576),freq=c(...