Posts

Showing posts from July, 2011

html - Why does the scrollbar not work in IE? -

i have created scrollbar , works fine in google chrome , firefox not in ie. have feeling has line-height property. my code: html: <div id="scrollbar"><br /></div> css: #scrollbar { margin-top: 10px; height: 220px; float: right; overflow-y: scroll; line-height: 403px; } here jsfiddle . anyway work in ie? change <br/> &nbsp; . ie picks non-breaking space bit better <br> tag. http://jsfiddle.net/s9sycey1/3/

Excel VBA Copy/Paste Range to the next available cell in another worksheet -

what want do: filter on array, copy filtered data onto different workbook. copy data pasted onto worksheet in same workbook, time below existing data. my thinking: code used below used me copy , paste 1 workbook workbook , worked perfectly, wb.sheets("2014 current week").range("c2:cc10000").copy nwb.sheets("2014 ytd").range("c" & rows.count).end(xlup).offset(1, 0) but seems not work same way if want copy in same workbook. appreciated. thanks! dim wb workbook dim strs string dim str string dim nwb workbook set wb = thisworkbook strs = wb.sheets("macros").range("h5") 'the 2014 address can found in full in cell h5 in macros tab set nwb = workbooks.open(strs) 'address of new workbook , opens activesheet .autofiltermode = false 'filter , here' end nwb.sheets("all data").range("a1:ca100000").copy wb.sheets("2014 current week").range("c" & rows.co

c++ - When using IBO/EBO, program only works when I call glBindBuffer to bind the IBO/EBO AFTER creation of the VAO -

for reason, program works when bind ibo/ebo again , after create vao. read online, and multiple posts , glbindbuffer binds current buffer, , not attach the vao. thought glvertexattribpointer function attached data vao. float points[] = { -0.5f, 0.5f, 0.0f, // top left = 0 0.5f, 0.5f, 0.0f, // top right = 1 0.5f, -0.5f, 0.0f, // bottom right = 2 -0.5f, -0.5f, 0.0f, // bottom left = 3 }; gluint elements[] = { 0, 1, 2, 2, 3, 0, }; // generate vbo (point buffer) gluint pb = 0; glgenbuffers(1, &pb); glbindbuffer(gl_array_buffer, pb); glbufferdata(gl_array_buffer, sizeof(points), points, gl_static_draw); // generate element buffer object (ibo/ebo) gluint ebo = 0; glgenbuffers(1, &ebo); glbindbuffer(gl_element_array_buffer, ebo); glbufferdata(gl_element_array_buffer, sizeof(elements), elements, gl_static_draw); // generate vao gluint vao = 0; glgenvertexarrays(1, &vao); glbindvertexarray(vao); glbindbuffer(gl_array_buffer, pb); g

java - Openshift with lombok issue -

i create new application template of openshift wildfly 8, , works fine. after add lombok:1.16.4 library, maven in server doesn't compile, in local machine works fine. when run mvn -e -popenshift -dskiptests -x compile in openshift machine, says me: [debug] command line options: [debug] -d /var/lib/openshift/id/app-root/runtime/repo/target/classes -classpath /var/lib/openshift/id/app-root/runtime/repo/target/classes:/var/lib/openshift/id/.m2/repository/javax/javaee-api/7.0/javaee-api-7.0.jar:/var/lib/openshift/id/.m2/repository/com/sun/mail/javax.mail/1.5.0/javax.mail-1.5.0.jar:/var/lib/openshift/id/.m2/repository/javax/activation/activation/1.1/activation-1.1.jar:/var/lib/openshift/id/.m2/repository/org/projectlombok/lombok/1.16.4/lombok-1.16.4.jar:/var/lib/openshift/id/.m2/repository/org/torpedoquery/org.torpedoquery/1.7.0/org.torpedoquery-1.7.0.jar:/var/lib/openshift/id/.m2/repository/org/javassist/javassist/3.18.0-ga/javassist-3.18.0-ga.jar:/var/lib/openshift/id/.m2/

string - Pluralize method for different language in Ruby on Rails -

i using pluralize method in html files dynamic value user can set per locale. i.e. if user sets label department german word "abteilung", append 's' per current rails inflection rules pluralize string. resulting word "abteilungs" , there no such word in german. i researched , there no such inflection rules specific language. there may many such words in many languages can't make custom inflection rules. not using i18n or tr8n internationalizing such words. can suggest can resolve this?

javascript - Promises are not working in componentDidMount -

i new react.js . in componentdidmount function, calling 4 functions parallelly using q module. in every function, making api . once got responses 4 services,i want trigger 1 more function. have written following logic. var q=require("q"); componentdidmount: function () { var self=this; this.setstate({loader:true}); q.all([this.getsegmentinfo(),this.getsignedurl(),this.getoverrallmyntrametricinfo(),this.getsegmentmetricinfo()]).then( function(result){ self.makedataformetrics(); },function(error){ utils.togglemessage(true,"sorry services failed.. try again","verror"); } ); } the problem was, after got response services. dependent callback not triggering. all parallel functions looks like getsignedurl:function(){ var promiseinfo1=q.defer(); //making service using ajax return promiseinfo1.promise; } can me, why dependent function not triggering. thanks.

PHP How to get the intersection of two or more arrays -

i trying intersection of 2 or more arrays kind of structure: first array: array( [0] => array( ['room_id'] => 21 ['room_name'] => 'gb 101' ['capacity'] => 40 ) [1] => array( ['room_id'] => 22 ['room_name'] => 'h 114' ['capacity'] => 20 ) [2] => array( ['room_id'] => 23 ['room_name'] => 'gb 203' ['capacity'] => 20 ) [3] => array( ['room_id'] => 25 ['room_name'] => 'h 100' ['capacity'] => 30 ) [4] => array( ['room_id'] => 26 ['room_name'] => 'gb 206' ['capacity'] => 40 ) ) second array: array( [0] => array( ['room_id'] => 21 ['room_name'] => 'gb 101'

c# - updates an entity flush is child entity in EF -

when save existing entity in project, if don't include child on dbset, lose previous value. can't figure out what's wrong project, not have in others projects. some code : var quoterequest = _session.set<quoterequest>() .include(x => x.quoterequestinvites) .include(x => x.quoterequestinvites.select(y => y.selectedservice)) .include(x => x.quoterequestinvites.select(y => y.selectedservice).select(z => z.service)) .include(x => x.quoterequestinvites.select(y => y.provider)) .include(x => x.district) .include(x => x.city) .firstordefault(x => x.id == quoterequestid); if (quoterequest == null) return request.createresponse(httpstatuscode.notfound); foreach (var invite in quoterequest.quoterequestinvites) { if (invite.token == guid.empty) { _logger.warn(invite, "empty token changed invite "

css - Bootstrap responsive scaling issue on smaller than 1920 x 1080 resolutions -

i have private video site that's main aimed towards home networks , desktop computers, however, site constructed on 1920x1080 resolution if that's smaller site looks catastrophe. here code page. <nav class="navbar navbar-trans navbar-fixed-top" role="navigation"> <div style="width:66%" class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapsible"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="navbar-collapse collapse" id="na

machine learning - What type of neural network would work best for credit scoring? -

let me start saying took undergrad ai class @ school know enough dangerous. here's problem i'm looking solve...accurate credit scoring key part success of business. rely on team of actuaries , statistical analysis suss out patterns in few dozen variables track each individual indicate may low or high credit risk. understand type of job neural nets great @ solving, is, finding high order relationships across many inputs human never spot , rendering decision or output on average more accurate trained human do. in short, want able input name, address, marital status, car drive, work, hair color, favorite food, etc in , credit score back. my question type or architecture neural network best particular problem. i've done bit of research , seems i'm generating questions faster i'm finding answers @ point. best i've been able come kind of generative deep neural network multiple hidden layers each layer able abstract 1 level beyond previous one. im assuming it&#

objective c - iOS Storyboards - How to re-use a View Controller -

Image
i have application takes through multiple steps (5-6 steps) @ end of have newly registered account. using storyboard , lot of these steps have similar (or identical) layouts , objects , elements within them. right doing creating new view controller each of these steps , altering data within them pertain specific step. when @ storyboard, feel has way optimize don't have many identical view controllers beside 1 another. as can see there 5 view controllers identical , looking way condense these single view controller or perhaps 5 view controllers access single view contains variety of elements see in image. appreciated. in advance! if view controllers' same no need create multiple view controllers. you can create 1 view controller , change view or content of view per requirement. hope helps

Spring integration DSL creating Sftp OutBound Adapter in java 1.7 -

i have created sftp outbound flow in spring dsl have created 1 more file inbound flow on top of sftp outbound flow files local directory , send message channel responsible copying file remote directory when running code no file getting copied in remote directory. getting stuck in point, can 1 please provide pointer not able proceed. this session factory... @autowired private defaultsftpsessionfactory sftpsessionfactory; @bean public defaultsftpsessionfactory sftpsessionfactory() { defaultsftpsessionfactory factory = new defaultsftpsessionfactory( true); factory.sethost("111.11.12.143"); factory.setport(22); factory.setuser("sftp"); factory.setpassword("*******"); return factory; } this sftp outbound flow.. @bean public integrationflow sftpoutboundflow() { return integrationflows .from("tosftpchannel")

sprite kit - Swift game not updating highscore inside didMoveToView -

i'm creating game swift , score works fine. problem highscore. created function called checkscores() check if score greater highscore. highscore remains @ 0. func checkscores() { if scoreint > highscoreint { nsuserdefaults.standarduserdefaults().setinteger(scoreint, forkey: "high") highscoreint = nsuserdefaults.standarduserdefaults().integerforkey("high") nsuserdefaults.standarduserdefaults().synchronize() highscorelbl.text = "highscore : \(highscoreint)" } i called inside didmovetoview. created highscore label , integer inside game scene, , set label text inside inithud() func inithud() { scorelbl = sklabelnode(fontnamed: "geneva") scorelbl.position = cgpointmake(self.frame.size.width / 2, self.frame.size.height / 2) scorelbl.text = "0" scorelbl.fontsize = 100 scorelbl.alpha = 0.5 addchild(scorelbl) highscoreint = nsuserdefaults.standarduserdefaults

rotation - Rotate individual shape -

i'm working on replicating piece of art in processing. i'm having issue rotate functionality. so image can found here . below can see code processing. can see differing part rotating of ellipses. i've tried changing origin e.g: translate(midpoint - (position*tenth + layer*tenth/2.0), i*tenth + layer*tenth/2.0,) then rotating , creating shape @ (0,0), doesn't i'd to! any ideas appreciated this changes origin x, y position want ellipse drawn at. void setup(){ size(550,550); background(187,182,179); midpoint = height/2.0; tenth = height/10.0; circle_radius = 20.0; } float circle_radius = 15.0; float midpoint; float tenth; float base_colour = 0; float getcolour(float x_value){ float colour_val = ((x_value - 50.0)*255.0)/(450.0-50.0); if(floor(colour_val/255.0)%2 == 0){ return colour_val%255.0; } return 225.0 - (colour_val%255.0); } void draw(){ nostroke(); background(187,182,179); base_colour += 5.0; for(int layer =

php - Add prefix to link url in wordpress -

i want add image link on wordpress site redirect user page of same url different prefix. example page url mydomain.com/post1234 when user click image on page redirect user url mydomain.com/md/post1234 the following code print current page url on every post page on site want add "md" prefix in url <a href="<?php $path=$_server['request_uri']; $uri='http://www.example.com'.$path; ?>"><img src="<?php bloginfo('template_url'); ?>/images/sgxx.png">click here</a> pls suggest correct code this. try this: <?php $domain = get_site_url(); //you can use or either "http://".$_server[http_host]; $path = $_server[request_uri]; $prefix = "/md"; ?> <a href="<?= $domain.$prefix.$path ?>">link</a> for more info $_server , check link below: http://php.net/manual/en/reserved.variables.server.php

homebrew - Is there a way I can find what HOMEBREW_CC/XX was set to when I installed a package -

some of i'm doing compiler dependent. possible check if, example, boost formula installed gcc-4.9 or clang compiler? what i'm looking might this: $ echo homebrew_cc $ brew install boost $ <comand> built clang $ brew uninstall --force boost $ export homebrew_cc = gcc-4.9 ; export homebrew_cxx = g++-4.9 $ brew install boost $ <command> built gcc-4.9 the compiler listed in receipt $ cat /usr/local/cellar/boost/1.58.0/install_receipt.json {"used_options":["--c++11","--with-mpi","--without-single"],"unused_options":["--universal","--with-icu4c","--without-static"],"built_as_bottle":false,"poured_from_bottle":false,"time":1437512231,"head":"1d7b6215cbe7d690e961f1a72f497a58c95f6de4","stdlib":"libstdcxx","compiler":"gcc-5","source":{"path":"/usr/local/

python - Same code different result on different computers -

i can run these code correctly on 2 computers, ios, windows, can find 98 names on company's computer, linux. , use python 2.7 import requests, bs4 index_url = 'http://www.nlm.nih.gov/medlineplus/druginfo/herb_all.html' def get_urls(): response = requests.get(index_url) soup = bs4.beautifulsoup(response.text) #print(response.) return [a.attrs.get('href') in soup.select('div.section-body a[href^=]')] print(len(get_urls())) perhaps make sure using same parser , maybe specify html parser using in code way when run on different machine know 1 use. beautifulsoup(markup, "html.parser") there more info in documentation.

testing - How to test the case that HTML <object> (or a similar feature) is unsupported? -

i'm writing web page has html <object> in it, like <object [...]>your browser not support this.</object> on machines have up-to-date browsers installed , don't want clutter machines old browsers (this not possible in cases without depending on third-party-software and/or doing hours of configuration tweaking). i know of pages https://www.browserstack.com/ let render websites, rather time consuming when need check loads of small changes. , don't want give data external companies simple rendering. how can check how page on old browsers? just found out. content between <object></object> tags not triggered in unsupporting browsers, when data attribute holds invalid target (like unavailable file). so, test how looks on unsupporting browsers, 1 can set data -attribute unavailable. keep in mind webdesigner has define more meaningful message "your browser not support svg", has consider object display missing (for ex

javascript - Selects' events in Angular2 -

please, can me? supposed easy, can't find solution. there form 2 selects. when #select1 changes, #select2 needs show data according value of #select1. example, cities of each state. kind of : //html <select (change)="select2.getcities($event)" ng-control="userstate"> <option *ng-for="#state of states" [value]="state">{{state}}</option> </select> <select #select2 ng-control="usercity"> <option *ng-for="#city of cities" [value]="city">{{city}}</option> </select> //the component @component({ selector: 'user-management', appinjector: [formbuilder] }); @view({ templateurl: 'user-management.html', directives: [ngfor] }); export class usermanagement { constructor(fb: formbuilder){ this.userform = fb.group({ userstate: [], usercity: [] }); this.states = ['new york', 'pennsylvani

Sum different lists from dictionaries PYTHON -

i have data structure. list of 4 dictionaries each 4 keys , 3 values in list. dict_list = [0] {key1: [1, 2, 3] key2: [4, 5, 6] key3: [7, 8, 9] key4: [10, 11, 12] [1] {key1: [13.......] key2: [16... etc. i want sum each sub column [1, 4, 7, 10]....[2,5,8,11] etc. form new_dict_list = [0] {new_key: [(1+4+7+10), (2,5,8,11), (3,6,9,12)] [1] {new_key2: [(13+16....) etc. so i'm cascading each column within each dictionary. i have explicit , long way far (checking math correct), there way use list comprehensions long-winded or not worth effort in end? use zip group [1, 4, 7, 10]....[2,5,8,11]: >>> d = dict_list[0] >>> zip(*d.values()) [(7, 4, 1, 10), (8, 5, 2, 11), (9, 6, 3, 12)] use map generate new list: >>> map(sum, zip(*d.values())) [22, 26, 30] if using python3.x, need list(map...) list.

parallel processing - MPI_TEST: invalid mpi_request -

i want test if mpi_isend , mpi_irecv have run fine. i have 2 request(argument) vectors: 1 vector mpi_isend, other mpi_irecv. the point program runs fine until started run cycle mpi_test. have tried 2 numbers (do i=1,2), still same error. fatal error in pmpi_test: invalid mpi_request, error stack: pmpi_test(166): mpi_test(request=0x7fff93fd2220, flag=0x7fff93fd1ffc, status=0x7fff93fd2890) failed pmpi_test(121): invalid mpi_request integer :: ierr, myid, istatus(mpi_status_size), num, i, n integer,parameter :: seed = 86456, numbers=200 integer :: req1(numbers), req2(numbers) logical :: flag call mpi_comm_rank(mpi_comm_world, myid, ierr) if (myid==0) n=1, numbers req1(n)=0 req2(n)=0 num=irand() call mpi_isend(num,1,mpi_integer,1,1,mpi_comm_world,req1(n),ierr) call mpi_irecv(best_prime,1,mpi_integer,1,0,mpi_comm_world,req2(n),ierr) end else if (myid==1) i=1, numbers call mpi_test(req2(i),flag,istatus,ie

javascript - Bootstrap Switch in Datagrid -

Image
im rendering datagrid in asp.net vb, want incorporate bootstrap switch, can target 1 row html: <asp:templatecolumn headertext="allow text" itemstyle-width="1px" headerstyle-width="1px"> <itemtemplate> <asp:checkbox id="cbtxt" runat="server" checked='<%# container.dataitem("allowtxt")%>'/> </itemtemplate> </asp:templatecolumn> jquery: $("[id='contentplaceholder1_dgnames_cbtxt_1']").bootstrapswitch(); i 1 working accessing chrome developer console, when tried dropping "1" @ end, didnt work, work if have full id, , nothing more. there way around this?! display console the answer question can found on here . class added <asp:checkbox> wasnt being picked when page rendered. in reference @mark , link above, added class checkbox through jquery, before initialized bootstrap switch: $("input[type=check

android studio - What does adb device status mean? -

i getting message adb device status:offline in terminal of android studio. mean ? have 1 android virtual device emulator. emulator working fine. , connecting internet since maps getting loaded. gonna affect ? this described in the adb documentation : state — connection state of instance may 1 of following: offline — instance not connected adb or not responding. device — instance connected adb server. note state not imply android system booted , operational, since instance connects adb while system still booting. however, after boot-up, normal operational state of emulator/device instance. no device — there no emulator/device connected. so if device listed offline might affect ability communicate via adb - e.g. collect logs. it's not inidcator of device's internet connection status.

date - MONYY7. and DATE9. operations -

i'm working on big data set, (more 100 variables , 11 millions observations). in data set, have variable named dtdsi (simulation date) in date9. format. (for example: 01apr2015 , 02mar2015...). have macro-program analyse data set comparing observations in 2 different months: %macro analysis (data_input , m , m_1); ..... %mend; the 2 macro-variables m , m_1 months want compare. format monyy7.(apr2015 , mar2015...). keep in mind cannot modify data_input (its data of company). in beginning of macro program, want create new data set observations of &m , &m_1 month. can creating new date variable dtdsi (real_month ex) in format monyy7. select observations real_month equal &m or real_month equal &m: data new; set &data_input; mois_real = input(dtdsi,monyy7); run; proc sql; create table new as; select * mois_real in ("&m" , "&m_1") new; .... the problem in first data statement, duplicated data_input; bad because took 30 minut

python - Basemap drawparallels tick label color -

i have possibly simple question. simplified version of code below: # rid of white stripe on map ionst, lons=addcyclic(ionst, lons) #setting figure attributes fig=plt.figure(figsize=(15,15),frameon=false, facecolor='gray') #map settings m=basemap(llcrnrlon=-180, llcrnrlat=-87.5, urcrnrlon=180, urcrnrlat=87.5,rsphere=6467997, resolution='l', projection='cyl',area_thresh=10000, lat_0=0, lon_0=0) #creating 2d array of latitude , longitude lon, lat=np.meshgrid(lons, lats) xi, yi=m(lon, lat) #plotting data onto basemap cs=m.imshow(varcor, interpolation=none, alpha=.8, cmap='seismic', vmin=-.02, vmax=.02) vert=plt.axvline(x=-75, color='black', linewidth=5) #drawing grid lines m.drawparallels(np.arange(-90.,90.,30.),labels=[1,0,0,0],fontsize=20) m.drawmeridians(np.arange(-180.,181.,45.), labels=[0,0,0,1],fontsize=20) #drawing coast lines m.drawcoastlines() when call drawparallels , drawmeridians argument, labels set according array specify.

java - How to get a string from .properties file and use it in the same .properties file -

is there way retrieve value of var in .properties file , use inside same .properties file? insted of (where have write manually words 'main menu' in every line) mainmenutitle = main menu notblank.menu.title = field 'main menu' can't null size.menu.title = field 'main menu' must contains 10 characters i want (where automatically value of var 'mainmenutitle') mainmenutitle = main menu notblank.menu.title = field **mainmenutitle** can't null size.menu.title = field **mainmenutitle** must contains 10 characters you can both message separately , make replace inject title @inject public messagesource messagesource; public static string getmessage(string messagekey1, string messagekey12) { string title = messagesource.getmessage(messagekey1, arguments, locale); string message = messagesource.getmessage(messagekey2, arguments, locale).replace("**mainmenutitle**", title); }

asp.net mvc - Mapping SubCategories to list Categories using valueInjecter mvc -

i want map sub categories model has foreign key category model categories model using "valueinjecter" mapping. have made "viewmodel" , write list<category> type property in , want bind sub categories it. tables follows according specifications categories table: id name 1 gender 2 role sub categories table: id categoryid name 1 1 male 2 1 femal 3 2 admin 4 2 user you need this: mapper.addmap<customer, customerinput>(src => { var res = new customerinput(); res.injectfrom(src); // maps simple properties same name , type res.coll = src.collection.select(srcitem => mapper.map<collitemrestype>(srcitem) return res; });

java - Order of list's elements -

consider following enum: public enum type{ integer, double, boolean } now, have following line: list<type> types = arrays.aslist(type.values()); do list contains elements in same order put enum? order reliable? yes. java language specification enums states: /** * returns array containing constants of enum * type, in order they're declared. method may * used iterate on constants follows: * * for(e c : e.values()) * system.out.println(c); * * @return array containing constants of enum * type, in order they're declared */ public static e[] values(); it returned array constants declared. regarding arrays.aslist() method, can rely on order well: returns fixed-size list backed specified array. (changes returned list "write through" array.) consider below example, common way initialize list : list<string> stooges = arrays.aslist("larry", "moe", "curly"); the order o

fill - Varying filling colour in Gnuplot according to certain palette -

Image
i want fill number of closed curves using gnuplot. result far. not bad. have used code: plot \ 'fort.40' u 1:2 smooth bezier w filledcurves lt 1 lc 4 lw 3 t 't=100 s' ,\ 'fort.30' u 1:2 smooth bezier w filledcurves lt 1 lc 3 lw 3 t 't=20 s' ,\ 'fort.20' u 1:2 smooth bezier w filledcurves lt 1 lc 2 lw 3 t 't=1 s' ,\ 'fort.10' u 1:2 smooth bezier w filledcurves lt 1 lc 1 lw 3 t 't=0' however, want plot 1 hundred of such curves (for physicists, want illustrate temporal evolution of circle in phase space of double pendulum). each closed curve stored 2 columns coordinates of curve in different ascii file. see, have achieved figure above 4 different filling colours set hand. generalise have smooth transition of colours, following palette. idea colour gives hint third dimension implicit in figure: time. do know if possible @ use filling colour follows palette, instead of fixed colour? in worst case, define 100 filli

asp.net web api - How can I use Castle Windsor's PerWebRequest lifestyle with OWIN -

i converting existing asp .net web api 2 project use owin. project uses castle windsor dependency injection framework 1 of dependencies set use perwebrequest lifestyle. when make request server castle.microkernel.componentresolutionexception exception. exception recommends adding following system.web/httpmodules , system.webserver/modules sections in config file: <add name="perrequestlifestyle" type="castle.microkernel.lifestyle.perwebrequestlifestylemodule, castle.windsor" /> this doesn't resolve error. taking inspiration example provided simpleinjector's owin integration, attempted set scope in owin startup class (as update dependency's lifestyle) using: appbuilder.user(async (context, next) => { using (config.dependencyresolver.beginscope()){ { await next(); } } unfortunately hasn't worked either. how can use castle windsor's perwebrequest lifestyle or simulate in owin? according

javascript - Select2 - use JSON as local data -

Image
i can work... var options = [{id: 1, text: 'adair, charles'}] $('#names').select2({ data: options, }) but cant work out how here... alert(json.stringify(request.names)) gives me... [{"id":"1","name":"adair,james"}, {"id":"2","name":"anderson,peter"}, {"id":"3","name":"armstrong,ryan"}] to select2 accept local data load data local array the webpage of jquery-select2 examples contains demo use select2 with local data (an array) . the html <input type="hidden" id="e10" style="width:300px"/> the javascript $(document).ready(function() { var samplearray = [{id:0,text:'enhancement'}, {id:1,text:'bug'} ,{id:2,text:'duplicate'},{id:3,text:'invalid'} ,{id:4,text:'wontfix'}]; $("#e10&q

java - Rearrange modifier keywords in IntelliJ -

is there way automatically rearrange modifier keywords in intellij? for example, if have following code: private final static int x = 0; final private static int y = 0; static final private int z = 0; rearrange to: private final static int x = 0; private final static int y = 0; private final static int z = 0; go settings , enable editor | inspections | java | code style issues | missorted modifiers inspection. has quick fix sort modifiers. inspection part of analyze | code cleanup... , solution invoke on code.

What is the difference in configuring SSL on Sails, between set it on Nginx? -

i use nginx config: server { listen 80; return 301 https://$host$request_uri; } server { listen 443; server_name www.domain.com; ssl_certificate /etc/nginx/cert.crt; ssl_certificate_key /etc/nginx/cert.key; ssl on; ssl_session_cache builtin:1000 shared:ssl:10m; ssl_protocols tlsv1 tlsv1.1 tlsv1.2; ssl_ciphers high:!anull:!enull:!export:!camellia:!des:!md5:!psk:!rc4; ssl_prefer_server_ciphers on; access_log /var/log/nginx/domain.access.log; location / { proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header x-forwarded-proto $scheme; # fix “it appears reverse proxy set broken" error. proxy_pass http://localhost:8086; proxy_read_timeout 90; proxy_redirect http://localhost:8086 https://www.domain.com; }

javascript - How to unbind a jquery plugin in IE8 -

i have jquery plugin in code force input box accept numeric input @ point have disable , make accept alphabets also. cannot use unbind() because unbind other features well. appreciated, thanks. here jsfiddle https://jsfiddle.net/mpr73v9w/ , below code. <input type="text"> <button>button</button> $.fn.forcenumericonly = function () { return this.each(function () { $(this).keydown(function (e) { var key = e.charcode || e.keycode || 0; if (e.shiftkey) { e.preventdefault(); } // allow backspace, tab, delete, arrows, numbers , keypad numbers return ( key == 8 || key == 9 || key == 13 || key == 46 || (key >= 37 && key <= 40) || (key >= 48 && key <= 57) || (key >= 96 && key <= 105)); }); }); }; $("

html - How to use :nth-child correctly to target individual elements? -

so have <ul> 5 <li> tags nested in. want style them differently , have been experimenting :nth-child try , target each <li> element instead of adding classes etc. my .scss file looks this: ul { display: inline-block; li:nth-child(1) { list-style-type: none; list-style: none; display: inline-block; background: blue; } li:nth-child(2) { list-style-type: none; list-style: none; display: inline-block; background: red; } li:nth-child(3) { list-style-type: none; list-style: none; display: inline-block; background: white; } li:nth-child(4) { list-style-type: none; list-style: none; display: inline-block; background: pink; } } i've added in colours try , notice style changes pick easier however, i'm not targeting each <li> element , changing colour few , getting colour blue show. have misunderstood? help?

How to remove Hyper Link in XAxis name in Highcharts? -

how remove hyper link in xaxis name. there property in xaxis lable or need write function remove hyper link. in link below how remove hyper link in animals. { "chart":{"defaultseriestype":"column"}, "plotoptions":{"column":{"borderwidth":0}}, "series":[ {"data":[{"x":1.435689e12,"y":6.0,"drilldown":"all-1.435689e12"}],"name":"all","type":"column","tooltip":{"xdateformat":"%m/%d/%y"}}, {"data":[{"x":1.435689e12,"y":2.0,"drilldown":"abcd-1.435689e12"}],"name":"abcd","type":"column","tooltip":{"xdateformat":"%m/%d/%y"}}, {"data":[{"x":1.435689e12,"y":1.0,"drilldown":"efgh-1.435689e12"}],"name":"efgh&q

java - Why annotation @JsonValue does not work in Jersey? -

i have restful service based on jersey framework. i need serialize , deserialize object wich include enum fields. i wrote 2 methods , annotated @jsonvalue , @jsoncreator . jersey doesn't show enum fields? my object enum: @xmlrootelement public class recipientwrapper{ @apimodelproperty(hidden = true) private recipient recipient; private string name; private string address; private recipienttype type; public recipientwrapper(){} public recipientwrapper(string name, string address, message.recipienttype type) { recipient = new recipient(name, address, type); } @xmltransient public recipient getrecipient(){ if (recipient == null && name != null && address != null){ if (type != null){ recipient = new recipient(name, address, type.tomsgrecipienttypevalue()); } else{ recipient = new recipient(name, address, message.recipienttype.to);

"Unresolved Variable" caused by very long expression in AngularJS -

because i'm receiving highly nested object backend, i'm trying use long expression: <span>{{monitorvalues.monitor.eventcounters[0].propertycounters[0].total}}</span> at calling array propertycounters , webstorm shows me hint "unresolved variable" , nothing shown. farest expression works monitorvalues.monitor.eventcounters[0].propertycounters , shows me whole array then. how can make full expression work show values want show? ok, outsourced expression js file like: $scope.getvalue = function(eventindex, propindex, index){ var eventcounter = $scope.monitorvalues.monitor.eventcounters[eventindex]; var propcounter = eventcounter.propertycounters[propindex]; var valuecounter = propcounter.total[index]; return valuecounter; } now works.

c# i'm not editing my collection,but the program show me InvalidOperationException error -

i don't understand why code not work. foreach (datarow dr in dtr.rows) { = new kustom.metier.authentification.utilisateur(convert.toint32(dr[0]), dr[1].tostring().trim(), dr[2].tostring().trim(), convert.toboolean(dr[3]), _droitdal.getdroits(convert.toint32(dr[0]))); list.add(a); }

First Page empty when printing plots in R -

i trying create pdf several plots. more specifically, want save plots, 4 in each page. therefore, have following code in r (which works, leaves page empty -the first one-): pdf("plots/plots_numeric_four_in_page.pdf",paper="a4r",width = 14) graphlist <- lapply(3:ncol(agg_num), function(i) { force(i) tempcolname=dataname_num[i] print (tempcolname) p<-qplot(group.1,agg_num[[tempcolname]],data = agg_num,color=group.2,geom = "line",main=tempcolname) + xlab("date") + ylab(paste("count of ", tempcolname)) + geom_line(size=1.5)+ scale_x_date(labels = date_format("%m/%y"))+ theme(legend.position="bottom",legend.direction="horizontal")+ guides(col=guide_legend(ncol=3)) }) do.call("marrangegrob",c(graphlist,ncol=2,nrow=2)) dev.off() it correctly displays around 50 plots, 4 in each page correctly in pdf. however, leaves first page empty , starts second. looked @ marrangegrob optio

file upload - Error in uploading the Large video over 100MB on youtube via php youtube Google api v3 -

i facing issue when upload video has size more 100mb on youtube via google php api v3. working fine small video less 100mb.i have followed tutorial https://www.domsammut.com/code/php-server-side-youtube-v3-oauth-api-video-upload-guide this error getting larger video warning: filesize(): stat failed uploads/20150618_112657.mp4 in/home/n001pr5/public_html/youtube2/upload.phpon line 99 warning: fopen(uploads/20150618_112657.mp4): failed open stream: no such file or directory in/home/n001pr5/public_html/youtube2 /upload.phpon line 105 warning: feof() expects parameter 1 resource, boolean given in/home/n001pr5/public_html/youtube2/upload.phpon line 106 warning: fread() expects parameter 1 resource, boolean given in/home/n001pr5/public_html/youtube2/upload.phpon line 107 caught google service exception 400 message error calling put https://www.googleapis.com/upload/youtube/v3/videos?part=status%2csnippet&uploadtype=res

require class name in rspec-puppet -

i have 2 different manifests files 1 define , other 1 normal manifests. here use require classname in normal manifests. class bfile { require dummy if $::operatingsystemmajrelease > 5 { file {'/some/path/foo': ensure => present, owner => 'root', group => 'root', mode => '0644', } } } i tried it {should contain_class('dummy')} , it {should contain_require('dummy')} , but i'm getting "could not find class dummy on node" error. is there option available in puppet-rspec check require classname ? the error message could not find class dummy on node might signify class dummy not in modulepath . it's recommended use absolute scope , modules: require ::my_module::dummy . class should defined in: modules/my_module/manifests/dummy.pp regarding second part, require cause puppet ensure every resource in bfile class gets applied before ev

digit in mysqli query returns data but a string does not -

so did multi filter search in mysqli can search using textbox, collection id or type id. the problem when using search textbox, returns call member function fetch_object() on boolean but returns error when type in string or single letter. when type in digit such 1 or 2, works fine , brings correct result. ` $whereclauses = array(); if (! empty($_post['search'])) $whereclauses[] = 'tblfurniture.product_name ='.'%'.mysql_real_escape_string($_post['search']).'%'; if (! empty($_post['collection'])) $whereclauses[] ='tblfurniture.colid='.mysql_real_escape_string($_post['collection']); if (! empty($_post['type'])) $whereclauses[] = 'tblfurniture.typid='.mysql_real_escape_string($_post['type']); $where = ''; if (count($whereclauses) > 0) { $where = 'where '.implode(' , ',$whereclauses); } $results = $mysqli->query("select * tblfurn

How can I create a nested array in JavaScript? -

with code below: var result = []; result.push({success : 1}); (var = 0; < rows.length; i++) { result.push({email : rows[i].email}); }; i create array looks this: [ { "success": 1 }, { "email": "email1@email.com" }, { "email": "email2@email.com" }, { "email": "emailn@email.com" } ] but want create array looks this: [ { "success": 1 }, { "email": ["email1@email.com","email2@email.com","emailn@email.com"] } ] i'm stuck on exact syntax doing this. how can put array inside array? var result = [ { success : 1 }, { email : rows.map(function(row) { return row.email; }) } ]; some explanation: rows array, , arrays in js have method .map() can used process each item in array , return new array processed values. for each item, function called value of item, , whichever valu

c# - Windows azure REST API to List containers issue -

i'm trying list containers in windows azure storage account. i'm struck exception "the remote server returned error: (403) server failed authenticate request. make sure value of authorization header formed correctly including signature.." but have included signature per instructions given, 1 find mistake in code ? private static string signthis(string stringtosign,string key,string account) { string signature = string.empty; byte[] unicodekey = convert.frombase64string(key); using (hmacsha256 hmacsha256 = new hmacsha256(unicodekey)) { byte[] datatohmac = system.text.encoding.utf8.getbytes(stringtosign); signature = convert.tobase64string(hmacsha256.computehash(datatohmac)); } string authorizationheader = string.format( system.globalization.cultureinfo.invariantculture, "{0} {1}:{2}", &quo

How does AngularJS handle Memory -

i wondering how angularjs 'saves' data/model. save or.. how work? we using different methods retrieve json data. in other frameworks jquery had think how store data locally, i.e. when want provide sorting possibility. in angular seems different, seems out of box. is angular displays how supposed , looks @ changes, reads in displayed data in , displays differently or use local storage save raw json.. , work there? (this limit amount of data can feed) here simple code-example: $http.get("url-to-json") .success(function(returneddata) { $scope.search_result = returneddata['search_result']; }) from there can use: <div ng-repeat='result in search_results | sortresult:"price":sorted' id="res_<% result.id %>" class="result"> product: <% result.name %> </div> i riddled how angular still knows data , doesn't have load again external source. do know? there lot more

javascript - Search with a variable in array -

i trying search array variable, seems not work because thinks variable value. var variable = "create"; var navviews = { "create" : [ { "id" : "1", "name" : "create", "urlext" : "stylecreator" } ] } navviews.variable; how reach "create" through variable? if want create array , can in way: navviews[variable]

c++ - QSqlDatabase check the data base already exist -

i need sore value on system locally , access later in table format, chose qsqldatabase. , first have check database exist. using below code getting message data base not exist creating new.... can problem ? #include <qtcore/qcoreapplication> #include <qtsql/qsqldatabase> #include "qfile" #include "qdebug" int main(int argc, char *argv[]) { qcoreapplication a(argc, argv); qstring dbname = "lprdb"; qsqldatabase db = qsqldatabase::adddatabase("qsqlite"); if( qfile::exists(dbname)) { qdebug()<<"data base exist...."; } else { qdebug()<<"data base not exist creating new...."; db.setdatabasename(dbname); } return a.exec(); } as noted @armatel, should open db, create db file. #include <qtcore/qcoreapplication> #include <qtsql/qsqldatabase> #include "qfile" #include "qdebug" int main(int argc, cha