Posts

Showing posts from January, 2012

iOS Can't update XCode 7.1 -

Image
so i've updated xcode via mac appstore version 7.1 however when run application using version 7.0 (without ios 9.1) any idea problem ? i had same issue while trying update 7.1. manually deleting xcode & restarting laptop solved problem, though had 1 copy of xcode on mac.

installation - IBM Rational ClearCase/ClearQuest fails to install -

i trying install ibm rational clearcase/clearquest on machine,but fails following error: error during "install" phase: error backing files c:\program files (x86)\ibm\imshared\native\com.ibm.team.install.win32helper_1.0.0.v200810172210.zip the error details in log file follows: > java.io.ioexception: failed rename file > 'c:\programdata\ibm\installation manager\adapters\native\ibm rational > sdlc\com.ibm.sdp.native\backupdirs\10_' > 'c:\programdata\ibm\installation manager\adapters\native\ibm rational > sdlc\com.ibm.sdp.native\backupdirs\10'. that shouldn't case latest versions of im (and marked before user error ) more generally, make sure have upgraded im (installation manager) latest version before using install ibm product.

dataframe - R error when using write.xlsx with an object created with functions of 'dplyr' -

i´m having problem when trying write data frame excel file using function write.xlsx xlsx package. though problem appears when data frame created functions dplyr package. when use base functions, there no problem. below minimal example. first, sample data: library(dplyr) library(xlsx) month <- c('julio','diciembre','diciembre','agosto','noviembre', 'diciembre', 'junio','septiembre','agosto','julio') irrelevant_column <- rep(1,10) df <- as.data.frame(cbind(irrelevant_column, month)) as said, when use base functions there no problem: month1 <- table(df$month, df$irrelevant_column) month1 <- prop.table(month1 , 2) month1 <- as.data.frame.matrix(month1 ) write.xlsx(month1 , file="month1.xlsx") no error appears, when create similar data frame 'dplyr': month2<- count(df, month) month2<- mutate(month2, porc = n / sum(month2[, 2])) month

run android application at a time -

i new in android. i use bellow code run application @ special time. times when mobile phone locked , screen off , service stops , not work. public class timeservice extends service { ibinder mbinder; timer t; public ibinder onbind(intent intent) { return mbinder; } public void ondestroy(){ t.cancel(); } public void ontaskremoved(intent rootintent){ intent restartserviceintent = new intent(getapplicationcontext(), this.getclass()); restartserviceintent.setpackage(getpackagename()); pendingintent restartservicependingintent = pendingintent.getservice(getapplicationcontext(), 1, restartserviceintent, pendingintent.flag_one_shot); alarmmanager alarmservice = (alarmmanager) getapplicationcontext().getsystemservice(context.a larm_service); alarmservice.set( alarmmanager.elapsed_realtime, systemclock.elapsedrealtime() + 1000, restartservicependingintent); super.ontaskremoved(rootintent); } public int onstartcommand(i

c - Why do I get smiley characters while reading a txt file? -

Image
i trying continuously read text file don't know doing wrong here. keeps printing me non-printable ascii characters. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <signal.h> #include <fcntl.h> #include <errno.h> #include <sys/types.h> #include "windows.h" int main(int argc, char **argv) { int n, fd; char buff[256]; if (argc != 2) { fprintf(stderr, "usage: %s <filename>\n", argv[0]); return 1; } fd = open(argv[1], o_rdonly); if (fd < 0) { perror("open"); return 1; } else if (lseek(fd, 0, seek_end) < 0) { perror("lseek"); return 1; } else { while (1) { n = read(fd, buff, sizeof(buff)); if (n < 0) { perror("read"); break; }

angularjs - using angular $compile for string replacement -

endpointtemplate = "/api/endpoint?city={{city}}&state={{state}}&facility={{facility}}"; var model = angular.extend(scope.$new(), { city: 'brooklyn', state: 'ny', facility: 'facility 2' }); var compiled = $compile($('<a>', { //none of these work expect 'ng-href': endpointtemplate, 'test': endpointtemplate, 'ng-bind': endpointtemplate })); var result = compiled(model); i value out like: "/api/endpoint?city=brooklyn&state=ny&facility=facility 2" but angular doesnt seem leave string "as-is" (except ng-bind attempt, throws error) how can make work? you may notice result became interpolated once digest cycle over. inappropriate use $compile if that's required string interpolation, consider using $interpolate instead, which is used html $compile service data binding. it should this: var model = { city: &#

whitespace - Insert space character in AppleScript filename -

i'm using date property in applescript define filename current year in it, should "[yyyy] ideaz.txt". however, breaks whenever insert space. works: property text_file : "~/dropbox/notes/" & year of this_date & "ideaz.txt" . yields "2015ideaz.txt". however, not: property text_file : "/users/nathanlucy/dropbox/notes/" & year of this_date & space & "ideaz.txt" . yields file "2015" (no extension). what missing here? how should define property text_file differently can include space character? two ideas: 1) explicitly set year text: (this_date's year text) 2) express concatenation own variable: set year_file_name (this_date's year text) & space & "ideaz.txt" then, use variable in property definition.

android - Binary XML File, Error Inflating Class, What is the issue? -

i'm getting error when application changing layout. resolution of images fine other layouts when comes particular layout, crashes. tried using simple design colours layout , there wasn't crashes. hence, know if it's memory issue or whether if it's resolution issue. please note inexperience android studio user , appreciate if can advise on problem , whether if there solution logcat: java.lang.runtimeexception: unable start activity componentinfo{com.fluke.kgwee.flukegame/com.fluke.kgwee.flukegame.endactivity}: android.view.inflateexception: binary xml file line #1: binary xml file line #1: error inflating class <unknown> @ android.app.activitythread.performlaunchactivity(activitythread.java:2416) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2476) @ android.app.activitythread.-wrap11(activitythread.java) @ android.app.activitythread$h.handlemessage(activitythread.java:1344) @ android.os.handler

ruby on rails - The has_many :through Association - Modification? -

i have read through basics of association app fits `has_many :through associations properly...but there 1 issue other question lacks. i'd rather ask question keep question clear , clean. in understanding of how has_many :through associations work whenever doctor has new patient, new appointment created or has created patient. while makes sense, my app dont 1 bit. in case, whenever user 'likes' someone's posts, creates new post. dont want 1 bit. i'm trying understanding of rails association answer other question pertaining one. how prevent 'appointment' being automatically created? or make perfect sense, when new instance of patient created , merged doctor.patients , creates new appointment. d = doctor.new p = patient.new = appointment.new # created or not foo = doctor.find(1) foo.patients << p # creates new appointment not want. whenever there many-to-many relationship, instance: any single doctor can have multiple patient

java - dom4j not loading through entire xml -

i doing project downloads weather yahoo! weather rss feed , writing database. links yahoo! weather: http://weather.yahooapis.com/forecastrss?p=95129 problem right it's not loading tag. can read other parts kinda stops after astronomy tag. can tell me why not working? (also, using hibernate , jpa) here code: public void testbasicusage() { url myurl; document document; element root; weather weather = new weather(); try { myurl = new url("http://weather.yahooapis.com/forecastrss?p=95129"); document = parse(myurl); root = document.getrootelement(); element row; iterator itr; (iterator = root.elementiterator(); i.hasnext();) { row = (element) i.next(); itr = row.elementiterator(); while (itr.hasnext()) { element child = (element) itr.next(); if(child.getqualified

javascript - PHP And AJAX Download of a few MB file freezes website -

hello ive searched everywhere find answer none of solutions ive tried helped what building site connects youtube allow users search , download videos mp3 files. have built site search etc having problem download part (ive worked out how youtube audio file). format audio audio/mp4 need convert mp3 first need file on server so on download page ive made script sends ajax request server start downloading file. sends request different page every few seconds find out progress , update on page user viewing. however problem while video downloading whole website freezes (all pages dont load until file downloaded) , when script tries find out progress cant until done. the file downloads: <?php session_start(); if (isset($_get['yt_vid']) && isset($_get['yrt'])) { set_time_limit(0); // prevent script stopping execution include "assets/functions.php"; define('chunk', (1024 * 8 * 1024)); if ($_get['yrt'] == "gphj

java - Tomcat logging stops (pauses) soon after initialization -

i'm running tomcat 8.0 on windows server 2008 r2. when use system.out.print in jsp-file log file, following issue occures: right after starting tomcat server (tomcat8w.exe / tomcat gui), stdout logging logfile (default = tomcat8-stdout.#date#.log) working fine. but after seconds no longer output in stdout-logfile. i still can see stdout output in tomcat console! finally after stopping tomcat server missing stdout-lines appear in logfile. alternative: if start tomcat console startup.bat or tomcat8.exe stdout traffic directly appear on tomcat console in logfiles not until stop tomcat server! additional info: the above behavior affects default logfiles (e. g. commons-daemon#date#.log, catalina#date#.log). the affected files locked until tomcat server stopped. can tell me background of behaviour , changeable? thanks help!

c++ - OpenMP: how to handle race condition on global std vectors -

i'm interested in parallelize loop using openmp global std vectors involved. in specific example, order in operation vec[1] = vec[1] + i executed doesn't matter results appears wrong due race conditions. proper way handle this? the reduction clause seems not working containers. #include <iostream> #include <vector> std::vector<double> vec = {1,1}; void func(int i){ vec[1] = vec[1] + i; } int main(int argc, char *argv[]) { int k; #pragma omp parallel for(k=1; k<10; k++){ func(k); } std::cout << vec[0] << ", " << vec[1] << std::endl; } the problem line vec[1] = vec[1] + i; isn't atomic. when compiled, looks more this auto tmp = vec[1]; tmp = tmp + i; vec[1] = tmp and in case, have race condition. if want way, can tell openmp vec[1] = vec[1] + i; should atomic, : #include <iostream> #include <vector> std::vector<double> vec = {1,1}; vo

javascript - How do I make my thumbnail as a link and the title append to the right? -

want create thumbnail link, as, putting title right of thumbnail. i tried using after , messed html see if can span them next each other. how go doing so? here js: $(function(){ var search = function(term, el){ $.get('https://www.googleapis.com/youtube/v3/search', { part: 'snippet', key: 'aizasya8dm-n-qcxpgkvkwii0lky0ak4zpgfp3c', q: term, maxresults: 25 }, function(data){ display(data.items, el); }); }; var display = function(videos, el){ el.empty(); $.each(videos, function(index, video){ var thumbnail = video.snippet.thumbnails.default.url; var vidtitle = video.snippet.title; var vidid = video.id.videoid; var container = $('<span/>', { 'class': 'video-container' }); var thumbcontainer = $('<div/>', { 'class': 'thumbnail

OSX 10.11 El capitan cannot use curl anymore -

i upgraded osx 10.11 , cannot use curl anymore correctly trying set fresh installation of homebrew using : ruby -e "$(curl -fssl https://raw.githubusercontent.com/homebrew/install/master/install)" as stated on homebrew site ( http://brew.sh ) i error : curl: (4) requested feature, protocol or option not found built-in in libcurl due build-time decision. the system version of curl @ /usr/bin $ curl --version curl 7.43.0 (x86_64-apple-darwin15.0) libcurl/7.43.0 securetransport zlib/1.2.5 protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smb smbs smtp smtps telnet tftp features: asynchdns ipv6 largefile gss-api kerberos spnego ntlm ntlm_wb ssl libz unixsockets this errors means : curle_not_built_in (4) a requested feature, protocol or option not found built-in in libcurl due build-time decision. means feature or option not enabled or explicitly disabled when libcurl built , in order function have rebuilt lib curl. bu

arrays - Remove leading zeros Ruby -

i want remove leading zeros number.i want use integer(i) instead of i.to_i in order rescue nil. "011,12,h,013,14".split(",").map{|i| integer rescue nil} i want get: [11,12,nil,13,14] instead this: [9, 12, nil, 11, 14] what problem? from documentation of kernel#integer : integer(arg, base=0) → integer […] if arg string , when base omitted or equals zero, radix indicators ( 0 , 0b , , 0x ) honored. […] you're omitting base leading 0 in strings means base-8 (or octal ) used conversion integers. integer literals work same way ( 011 == 9 yields true ). if prefixes/radix indicators shouldn't honored , integers represented strings should treated base-10 (or decimal ) one, pass 10 base : "011,12,h,013,14".split(",").map{|i| integer(i, 10) rescue nil} # => [11, 12, nil, 13, 14]

c - Gstreamer 1.0 image/video player. Which way to implement? -

i have list of files (videos , images) show on screen using gstreamer 1.0, means iterating on elements (file paths) in list , "play" them sequentially in c application "delays" e. tried different examples partly work, cannot whole picture implement. so conceptual solution this? should use 1 "dynamic" pipeline or 2 (one images - because think here imagefreeze before videoconvert necessary , 1 video)? , how can use decodebin detect format of media automatically? decodebin works command line, errors no video decoder found 'jpeg' in c application? try make universal pipeline (or 2 videos , images). i.e. put input file list , output video or image. pipeline(s) should works gst-launch . after try implement pipeline in c code, or write pipeline here. my way: take file list. if image -> create image decode pipeline, if video -> create video decode pipeline. delete pipeline. delay. go next file.

c# - convert geoJson data to sql server spatial data type (GIS) -

i've downloaded openstreetmaps administrative borders (city, region, country, etc...) in geojson format. i'm trying store json data related polygons in ms sql server using spatial data. since i've never parsed such complex json file i've got difficulties in manually creating c# object store parsed data. i'm using newtonsoftjson.json, read geojson file , create object. use reflection properties related object. quite tedious task because in cases objects nested in more 4 levels in geojson file. since i've got store polygons cities in world, need faster , accurate way of doing it. what best method of achieving goal? i guess json schemas of great help, how? is there standard geojson schema, in sense if use schema openstreetmaps , other gis framework (google maps), compatible? in sql server 2016 can parse geojson format using openjson function , can convert table of coordinates spatial types. each nested geojson level handled 1 additional cro

python - makemigrations does not work after deleting migrations -

i mistakenly deleted .py file under path projectname/appname/migrations , include like: 0001_initial.py 0011_auto_20150918_0723.py 0002_auto_20150819_1301.py ... now, updated model file, , run command python manage.py makemigrations , prompt no changes detected . how can recover everything? first of all, even if happened in production , do not panic . when deleted migrations django forgot app supposed managed migrations. django defaults legacy python manage.py syncdb migrationless behaviour , not attempt detect changes or generate new migrations when run python manage.py makemigrations in order make aware of migrations, have run command app: python manage.py makemigrations appname however, running application, django not able detect new migrations applied in database, , try run them again when run python manage.py migrate . when happens migrations fail saying relation appname.xyz exists! . to make django understand migration refle

objective c - Unable to set top margin NSLayout Constraint programatically in iOS? -

i trying set top margin constraint not work.i have custom cell in have 2 labels.i want give top spacing dynamic @ run time between labels have set constraint of top margin & have made outlet of & using below code update top margin. self.view.translatesautoresizingmaskintoconstraints = no; self.customcell.nslc_first_comment_margin.constant=-21; [self.customcell.first_comment layoutifneeded]; please tell how solve problem? edit: code works if write code inside cellforrowatindexpath not work under heightforrowatindexpath ?can please tell exact reason behaviour.

debugging - Why does my Matlab code not work correctly? -

my code b(abs(b(1:3:length(b))) > 0.75) = 0.75 what it's supposed do: b1 = b(1:3:end); b1(abs(b1)>0.75) = 0.75; b(1:3:end) = b1; how these 2 not same? the indexing part b(1:3:end) returns short vector of zeros , ones, change i -th entry of b (for i in first third-ish of b ) 0.75 if absolute value of 3*i + 1 -th entry greater 0.75 . for example: b = [-0.684; 0.941; 0.914; -0.029; 0.6; -0.716; -0.156; 0.831; 0.584; 0.919]; b_index = abs(b(1:3:length(b)))>0.75 would return b_index = 0 0 0 1 and b(b_index) = 0.75 change 4th entry of b 0.75 . one way of doing one-liner is b(1:3:end) = b(1:3:end).*(abs(b(1:3:end))<=0.75)) + 0.75*((b(1:3:end)>0.75)); but think three-liner bit clearer.

r - Elastic : make a light count query (vs search query) -

i accessing bulk data in elastic through r. analytics purpose need query data relatively long duration (say month). data month approx 4.5 million rows , r goes out of memory. sample data below (for 1 day): dt <- as.date("2015-09-01", "%y-%m-%d") frmdt <- strftime(dt,"%y-%m-%d") todt <- as.date(dt+1) todt <- strftime(todt,"%y-%m-%d") connect(es_base="http://xx.yy.zzz.kk") start_date <- as.integer(as.posixct(frmdt))*1000 end_date <- as.integer(as.posixct(todt))*1000 query <- sprintf('{"query":{"range":{"time":{"gte":"%s","lte":"%s"}}}}',start_date,end_date) s_list <- elastic::search(index = "organised_2015_09",type = "property_search", body=query , fields = c("trackid", "time"), size=1000000)$hits$hits length(s_list) [1] 144612 this result 1 day has

jquery - why remove an item with a click event goes wrong with react -

i totally confused problem.from list of articles,i delete 1 of them getting articleid data().when first delete,it works well.but when delete again.the data() former articleid rather articleid.but when event.target,the articleid in dataset fine.what' wrong? for code long,i chose important part post. remove: function(e) { var articleid = $(e.target).data("articleid"); if (confirm("are sure delete article?")) { $.ajax({ url: config.api.deletearticle[0].replace("<article_id>", articleid) .replace("<studio_id>", cookie.getcookie("studioid")), type:config.api.deletearticle[1], success: function() { this.reload(); }.bind(this), error: function() { alert("fail"); } }); } }, reload: function(sorttype){ $.ajax({ url:config.api.getarticles[0],

qt - Error Handling in QPrinter -

when printing pdf qtextdocument , qprinter there way of detecting errors (e.g. not being able write pdf file)? i'm using following code: qtextdocument document; qprinter printer( qprinter::highresolution ); printer.setoutputformat( qprinter::pdfformat ); printer.setoutputfilename( filename ); document.print( &printer ); in docs you'll find qprinter::printerstate . can do: if (printer.printerstate() == qprinter::error) // error handling i admit that's not lot work with, there 4 qprinter::printerstate 's. might want best avoid errors in first place. detailed description in doc states: note setting parameters paper size , resolution on invalid printer undefined. can use qprinter::isvalid() verify before changing parameters. additionaly, check if filename setting exists using qfile::exists . also, when setting can call , handle qprinter::supportedresolutions() , qprinter::supportedpapersources() , qprinter::supportsmultiplecopies() . of

machine learning - PCA in matlab selecting top n components -

Image
i want select top n=10,000 principal components matrix. after pca completed, matlab should return pxp matrix, doesn't! >> size(train_data) ans = 400 153600 >> [coefs,scores,variances] = pca(train_data); >> size(coefs) ans = 153600 399 >> size(scores) ans = 400 399 >> size(variances) ans = 399 1 it should coefs:153600 x 153600 ? , scores:400 x 153600 ? when use below code gives me out of memory error:: >> [v d] = eig(cov(train_data)); out of memory. type memory options. error in cov (line 96) xy = (xc' * xc) / (m-1); i don't understand why matlab returns lesser dimensional matrix. should return error pca: 153600*153600*8 bytes=188 gb error eigs: >> eigs(cov(train_data)); out of memory. type memory options. error in cov (line 96) xy = (xc' * xc) / (m-1); foreword i think falling prey xy problem , since trying find 153.600 dimensions in data non-ph

angularjs - Spring boot - Thymeleaf template - multiple resolvers -

we have multiple thmeleaf template resolvers in our project. our project structure, /src/main/java/*.java /src/main/resources/pages/*.html /src/main/resources/templates/*.html inside, resources, have pages , templates folder. so, have add 1 more view resolvers have html files inside pages. @configuration public class thymeleafconfig { @autowired private springtemplateengine templateengine; @postconstruct public void init() { classloadertemplateresolver resolver = new classloadertemplateresolver(); resolver.setprefix("pages/"); resolver.setsuffix(".html"); resolver.settemplatemode("legacyhtml5"); resolver.setorder(templateengine.gettemplateresolvers().size()); templateengine.addtemplateresolver(resolver); } } now, move few files /srs/main/webapp/ /src/main/resources/ /src/main/webapp/*.html so, tried above config file with, resolver.setprefix("webapp/");

javascript - Div doesn't stay visible -

i have 4 links. when click first link div 1 should displayed , other 3 hidden. when click link 2, div 2 should displayed , other 3 hidden, , on... what did: with css i've set class of 4 divs display: none created 4 functions javascript set display property of correct div block , 3 others none call function when clicking link when click link, div shown quarter of second disappears again css: .catdiv { display:none; } js function: function showkadoballonnen() { document.getelementbyid("kadoballonnen").style.display = "block" document.getelementbyid("geschenkmanden").style.display = "none" document.getelementbyid("pampercadeaus").style.display = "none" document.getelementbyid("origineleverpakkingen").style.display = "none"; } calling function: <a href="" onclick="showkadoballonnen()">kadoballonnen</a> div has called: <di

javascript - spring mvc jquery map,array -

in spring mvc application, have dynamic buttons. <input type="button" id="button${id}" class="btn register" value="add option" onclick="processid(${id})"/> based on click action above number of buttons increase. have buttons button1,button2,button3,button4 etc. now click on each button calling processid(id) function passing id value. on processid(id) function doing call spring controller. passing 2 parameter, id , increment of variable. struggling, second parameter. function processid(id) { $.get("<%=request.getcontextpath()%>/processid", { id: id,secondid:secondid,}, function(data){ $("#submitidoptionrow"+id).before(data); }); } how increase secondid value click event of 1 id . suppose click on button2 - 1st click - parameter 2,0 - 2nd click - paramter 2, 1 - 3rd click - paramter 2, 2 button3 - 1st click - parameter 3,0 - 2nd click - paramter 3, 1 looks

objective c - how to convert cv::Mat to json format in ios -

-(void) processimage:(cv::mat &)image{ cvtcolor(image, img2, cv_bgr2gray); orb -> detect(img2, keypoints1); orb -> compute(img2, keypoints1, descriptors1); drawkeypoints(img2, keypoints1, outimage); } outimage in cv::mat format. how convert nsdictionary format, using opencv orb algorithm project.

linux - Determine USB device file Path -

how can usb device file path correctly in linux. used command: find / -iname "usb" , got result below: /dev/bus/usb /sys/bus/usb /sys/bus/usb/drivers/usb /sys/kernel/debug/usb under /dev/bus/usb see: 001 002 003 004 005 006 but think aren't files need. under /sys/bus/usb/devices/: sh-3.2# ls /sys/bus/usb/devices/ 1-0:1.0 1-1:1.0 3-0:1.0 5-0:1.0 usb1 usb3 usb5 1-1 2-0:1.0 4-0:1.0 6-0:1.0 usb2 usb4 usb6 and under /sys/bus/scsi/devices/ when pluged usb see: 2:0:0:0 host0 host2 target2:0:0 and when removed usb see: sh-3.2# ls host0 so device file used usb? how can indentify it? need make c program usb device file... further more, explain me number 1-1:1.0? mean? thank you. so device file used usb? how can indentify it? what see behind /sys/ configuration/information devices. /dev/bus/usb looking for. think following article can you http://www.linuxjournal.com/article/7466?pag

java - Need help to connect with MongoDB -

i need little connect code mongodb. have created simple online shopping application hibernate, servlets , jsp. able connect code mysql , works fine. tried changing hibernate.config.xml file , added mongodb jars , tried connecting mongodb not happening. can 1 please me out. project error in console i suggest follow book mongodb java developers packt publishing or can go through official course provided mongodb university : m101j mongodb java developers . well, book provides knowledge how connect mongodb java applications such javase & javaee.

javascript - Backbone collection working with Rest not working -

when console.log(this.collection.fetch()) can see in responcejson , responsetext it's returned correct data api. however, readystate remain 1 , when run this.collection.fetch({ success : function() { console.log(that.collection.tojson()) } }); it returns blank array though no sever has responded data. here's code... model define(['backbone'], function(backbone){ var google_place = backbone.model.extend({ defaults : { 'title' : 'no titile', 'sub_title' : 'no subtitle', 'content' : 'no content available', 'lat' : 0, 'lng' : 0, 'text' : 'no text' } }); return google_place; }); collection define(['../model/google_place'], function(google_place){ var google_places = backbone.collection.extend({ model: google_p

javascript - How to deal with modified models when using Backbone.history -

i have simple controller + router below example purposes. question is: how deal router , backbone.history if have modified model? let's fire route r , controller . default route "" brings me function blue set background color blue. can click on button bring me function red sets background red , url /#red . if click button, go "" url, background stay red. there way of getting previous state , not change url when dealing history? i understand in function blue , set background blue , not this.model.get("background) , asking in more complex cases, how previous state of this.model through backbone.history . myapp.module('main', function (main, myapp, backbone, marionette, $, _){ main.router = marionette.approuter.extend({ approutes: { "": "blue", "red": "red" } }); main.controller = marionette.controller.extend({ start: function() {

java - Upper bounded wildcard is causing compilation error -

this question has answer here: can't add moduleinfo object arraylist<? extends moduleinfo> 2 answers is list<dog> subclass of list<animal>? why aren't java's generics implicitly polymorphic? 12 answers public class testing { public static void main(string[] args) { list<? extends integer> list = new arraylist<>(); list.add(new integer(21)); } } what compilation error in line#4?

javascript - How to ng-include a partial view that requires a lot of data (parameters) to be rendered? -

i have angular.js web ui editing complex , large mathematical objects. i'm trying build view displays results such object. thus, edited object needs sent back-end , back-end compute partial view based on data. the ordinary (easy) way of doing use nginclude directive: <div ng-include=".../resultview?data=[json_stringyfied_object_here]> this works. problem object can quite big in terms of numbers of chars used in json representation (as contain lot of floating point number , dates etc.). so, i'm afraid of running practical limitations of length of query string . instead, i'd rather send object payload of (or post?) request. i'm not sure how accomplish angular way. there way of doing so? worst case, can live solution displays "compute" button fetch partial view calling function uses $http . how include view in dom in case? i appreciate hints in how people tackle problem. edit : view can quite different depending on (dynamic) type of

javascript - check if input ends with specific character -

i have basic input field: <input type="text" name="one" /> how can make sure user ends input value specific character, example comma (,) before running server-side code? example: "hello world" (invalid) "hello world," (valid) why don't use html5 pattern validation? it's easy , no javascript maintain. demo snippet: <form> <input type="text" name="one" pattern=".*,$" /> <input type="submit" value="submit" /> </form>

SQL query with case datepart -

i data exclude weekends result based on bind variable value. somehow not able query run. select * tablename a.date >= '2015-04-13' , a.date <= '2015-04-21' , case when :1 = 'y' ((datepart(dw, a.date) + @@datefirst) % 7) not in (0, 1) end i getting following error : incorrect syntax near keyword 'not' . use case expression here over-complicates things, imho. have 2 situations: if bind variables y , need exclude weekends. if isn't, want include them. this logic can achieved simpler (again, imho) usage of or logical operator: select * tablename a.date >= '2015-04-13' , a.date <= '2015-04-21' , (:1 != 'y' or ((datepart(dw, a.date) + @@datefirst) % 7) not in (0, 1))

php - How to go thought multidimensional array? -

i have multidimensional array in php , need when user on www.web.com/index?page=graphicdesigner read parameter page get $_get["page" ]. need go throught array , return array under current position. so if on url above return echo $array["urlanchor"]; => graphic-designer $jobs = array( "graphicdesigner" => array( "urlanchor" => "graphic-designer", "og:title" => "graphicdesigner ogtitle", "og:description" => "graphicdesigner ogdescription", "og:image" => "", "og:url" => "" ), "uidesigner" => array( "urlanchor" => "ui-designer", "og:title" => "uidesigner ogtitle", "og:description" => "uidesigner ogdescription", "og:image" => "", "

angularjs - Angular: How to get sibling directive value from directive? -

here jsfiddle . html: <div ng-app="app"> <div ng-controller="maincontroller"> {{test}} <form> <username></username> <submit></submit> </form> </div> </div> and js: var app = angular.module("app", []); app.controller("maincontroller", ["$scope", function($scope){ $scope.test = "greetings!" }]) .directive("username", function(){ return { restrict: "e", controller: function($scope){ this.value = $scope.username; }, template: "<div>username<input type='text' value='123' ng-model='username' /></div>" }; }) .directive("submit", function(){ return { restrict: "e", require: "username", link: function(scope, ele, attr, ctrl){

bash - ElasticSearch update all documents with bulk API and script -

i have application document field not required array such "tags" : "tag1" now application requires field array such "tags" : ["tag1","tag2"] currently in elasticsearch there 4.5m documents so wrote bash script update 1000 documents takes on 2 minutes means take on 8 days run on 4.5m documents. seems i'm doing wrong. best way in elastic? here bash script #!/bin/bash echo "starting" ids=$(curl -xget 'http://elastichost/index/_search?size=1000' -d '{ "query" : {"match_all" : {}},"fields":"[_id]"}' | grep -po '"_id":.*?[^\\]",'| awk -f':' '{print $2}'| sed -e 's/^"//' -e 's/",$//') #create array out of ids array=($ids) #loop through ids , update them in "${!array[@]}" echo "$i=>|${array[i]}|" curl -xpost "http://elastichost/index/type/${arr

java - creating arrays of Jbuttons in windowbuilder -

is there anyway make arrays of j buttons in eclipse. want use window builder there anyway this?? program kinda needs use array cause have use loops , cant if buttons of different variable names. found tutorials there manually done. want use windowbuilder create same output of jbuttons can provide tutorials or videos on how can achieve this? thank you have code far. public class sungka_gui extends jframe { public static void main(string[] args) { eventqueue.invokelater(new runnable() { public void run() { try { sungka_gui frame = new sungka_gui(); frame.setvisible(true); } catch (exception e) { e.printstacktrace(); } } }); } /** * create frame. */ public sungka_gui() { setresizable(false); seticonimage(toolkit.getdefaulttoolkit().getimage(sungka_gui.class.getresource("/com/sun/java

ios9 - Open the Bluetooth Settings Menu in IOS -

i need open bluetooth settings menu in ios9.0 . next opens settings menu ok!, uiapplication.sharedapplication().openurl(nsurl(string: uiapplicationopensettingsurlstring)!) but need open bluetooth settings menu tried with uiapplication.sharedapplication().openurl(nsurl(string: "prefs:root=general&path=bluetooth")!) it not work anyone can me? luis found answer, read past @ first, because saw no answers. answer: go xcode project, under info -> url types section -> "prefs" in url scheme in ios9: let url = nsurl(string: "prefs:root=bluetooth")! ios8: let url = nsurl(string: "prefs:root=general&path=bluetooth")!

DefaultHttpContent instead of HttpResponse in netty 4.0.23 -

i have following pipeline configuration http client - pipeline.addlast("ssl", new sslhandler()); pipeline.addlast("decoder", new httpresponsedecoder()); pipeline.addlast("encoder", new httprequestencoder()); pipeline.addlast("handler", new mysimplechannelinboundhandler()); in mysimplechannelinboundhandler 's channelread0() method, instance of defaulthttpcontent instead of httpresponse . when log defaulthttpcontent 's content using - defaulthttpcontent content = (defaulthttpcontent) msg; log.debug(content.content().tostring(charsetutil.utf_8)); i can see actual http response being logged. why http response not being decoded httpresponse object though have http decoder in pipeline? thanks! use httpobjectaggregator before enc/decoders in order aggregate httpresponse , following httpcontents. after adding httpobjectaggregator in pipeline you'll fullhttpresponse object in handler. eg :

c++ - Insertion sort on strings -

i trying sort array of strings according middle 3 characters using insertion sort. the code compiles crashes while running i sorting array of middle 3 character , sorting array stores index of strings. while printing final result can sorted array void ins(string a[size],int n) { int i,j,k,length[size],index[size],m,t; string temp,ts[size]; // ts[] stores middle 3 characters for(i=0;i<n;i++) { index[i]=i; } for(i=0;i<n;i++) { length[i]=a[i].length(); } for(i=0;i<n;i++) { m=length[i]/2; ts[i]=a[i].substr(m-1,3); } for(i=0;i<n;i++) cout<<ts[i]<<endl; for(k=1;k<n;k++) { temp=ts[k]; t=index[k]; j=k-1; while((temp < ts[j]) && (j>=0)) { ts[j+1]=ts[j]; index[j+1]=index[j]; j=j-1; } ts[j+1]=temp; index[j+1]=t; } for(i=0;i<n;i++) {

javascript - Declaring new formData() while Image uploading using PHP and jQuery -

i trying upload image using php , jquery, following javascript error: typeerror: 'append' called on object not implement interface formdata. ...d=[],e=function(a,b){b=n.isfunction(b)?b():null==b?"":b,d[d.length]=encodeuricom... what wrong code? html: <form id="uploadform" name="form_movie" method="post" action="index.php" class="form form-default"> <input id="file-upload" name="userimage" type="file" class="inputfile" /> <input id="upload-image" type="button" value="upload image" class="btnsubmit" /> jquery: $(document).ready(function (e) { $( "#upload-image" ).click(function( e ) { var file_data = $('#file-upload').prop('files')[0]; var form_data = new formdata(); form_data.append('file-upload', file_data); // alert('s

javascript - Force link to open in same window/tab -

i using google chrome extension - open link in same tab . it's simple , says, forces links open in same window/tab. require functionality touch screen kiosk left/right swipe navigation. the plugin works when comes links . doesn't work when search performed in 'submit' web search form. presumably because extension forcing _blank open in _top , it's ignoring forms . how can modify extension in such way takes consideration forms, , forces these open in same tab? i have downloaded extension , viewed code, main js seems in sametab.js file. have included below, i'm sure can modify somehow fit needs. any appreciated. "use strict"; // "_blank|_self|_parent|_top|framename"; "framename" should not start "_" // - list of iframe names contains names of iframes , not names // of windows in other tabs targets // - list of iframe names not updated if iframe's name changes (function() { var sametab = { conv