Posts

Showing posts from February, 2013

plot - R: Graphing a table plan -

Image
general goal i placing guests around tables according set of rules. goal, in post, have handy function display names of these guests around respective tables on r graphic. input data guests describes position of each guest @ each table. note number of guests per table varies. guests = list( table_1 = c("jack", "christelle", "frank", "john s.", "lucia"), table_2 = c("george", "amanda", "alice", "laura", "john h."), table_3 = c("jeanette", "elizabeth", "remi", "fabian", "urs", "emma"), table_5 = c("roger", "marry", "henrique", "claire", "julia"), table_6 = c("alphonse", "marie", "dani", "rachel") ) table_positions indicate each table should positioned on graph. assume here each axis goes 0 10, point c(5,5) @ c...

How to Strip Time from Date Time and store in PSQL using Python? -

i have situation want strip time date time object , store in database (psql precisely) how do ? >>> print(datetime.now()) 2016-06-28 16:22:30.918715 what want 2016-06-28 and store psql database what best way handle ? i posting answer cause took me around hour find answer , hope helps someone. best solution of have found dt = datetime.today() 2016-06-28 16:22:30.918715 dt.strftime('%y-%m-%d') 2016-06-28 basically psql stores data in type string code dt.strftime('%y-%m-%d') strip off time , return string data type , can store it.

c# - How to connect the socket.io with backend -

i trying implement chat in ionic project have tried far connect socket.io backend (c#) below. here index.html <script src="http://192.xxx.x.xxx:8888/socket.io/socket.io.js"></script> and here created socketservice.js file looks var example = angular.module('starter.socketservice',[]) example.service('socketservice',function(socketfactory){ console.log("socketservice"); return socketfactory({ iosocket: io.connect('http://192.xxx.x.xxx:8888') }); console.log(socketfactory); }) finaly created folder called server have chat-server.js file in there. var io = require('socket.io')(8888); console.log(io); io.on('connection', function(socket){ console.log(socket); socket.on('send:message', function(msg){ console.log(msg); socket.emit('message', msg); console.log("succes...

recursion - Find all possible unique path in mXn matrix -

help me in finding possible path reach bottom right cell top left cell in mxn matrix. below restrictions, can not visit cell visited. should visit cell before reaching exit i.e. bottom right cell. tried few logic's not able paths. thanks the simplest idea recursively try every possible non-self-crossing path, , every time such path hits bottom-right corner check whether it's length equals number of cells. here comes naive [and slow , memory-consuming] implementation in js (judging profile know js), point algorithm in formal, unequivocal way. you're interested in "ok, let's this!" part, before helpers make example executable: function paths(m,n) { // given pos present in list of poss? var pos_member = fu...

javascript - Why datepicker is not working on 2 textboxes on the same page -

$(function() { $("#date1 , #date2").datepicker({ readonly_element: false, dateformat: 'y-m-d' }); }); try code $(function() { $("#datepicker1").datepicker(); $("#datepicker2").datepicker(); }); https://jsfiddle.net/dave17/squ5p6ak/ i hope helpful

softlayer - Detail information for Auto Scale in SL -

Image
i implementing detail information auto scaling using java api. how can detailed information of member configuration. please refer fields in red box in attached picture. detailed information. example, operation reference code, centos_6_64, how can long type of description centos 6.x - minimal install (64bit). try using object mask mask[id, name, status[name, keyname], regionalgroup[id, name, description], suspendedflag, terminationpolicy, cooldown, regionalgroupid, minimummembercount, maximummembercount, balancedterminationflag, networkvlans[ id, networkvlan[ id, name, vlannumber, networkspace, primaryrouter[id,hostname,datacenter[name,longname]],localdiskstoragecapabilityflag,sanstoragecapabilityflag]],virtualguestmembertemplate[hostname,domain,fullyqualifieddomainname,startcpus,maxmemory,hourlybillingflag,localdiskflag,operatingsystem,datacenter,privatenetworkonlyflag,networkcomponents.maxspeed,sshkeys,operatingsystemreferencecode,blockdevices[device,diskimage.capacit...

What is the difference between ad hoc and prepared query in sql server plan cache? -

i’m trying understand plan cache content of sql server. so questions are: 1. difference between ad hoc , prepared plans? 2.what should know when trying optimize sql server plan cache? what difference between ad hoc , prepared plans? adhoc query: select * t1 prepared query: queries substitute place holders in place of actual values called prepared statements. some examples: select * t1 id=@id one more example taken wikipedia: command.commandtext = "select * users username = @username , room = @room"; command.parameters.addwithvalue("@username", username); command.parameters.addwithvalue("@room", room); what should know when trying optimize sql server plan cache? there whitepapers written how optimize plan cache.so try keep little.. normally when query executed against sql ,sql compiles plan , stores in plan cache .this plan cache memory taken buffer pool , different versions have different restr...

multithreading - Calling a Function in Parallel C++ -

i want call function in parallel in c++, waits time , performs task. don't want execution flow wait function. considered using pthread in simple way again, have wait till joins ! void a_function() { /* call function waits time , perform tasks */ /* not wait above function return , continue performing background tasks */ } note: if not perform background tasks while calling function in parallel in next cycle, function doesn't give me correct output. thanks in advance. use std::future package std::async task. wait future @ head of function ensure it's completed before next iteration, since stated next iteration depends on execution of background task. in example below, make background task simple atomic increment of counter, , foreground task returns counter value. illustrative purposes only! #include <iostream> #include <future> #include <thread> class foo { public: foo() : counter_(0) {} std::pair<int, std::future<v...

javascript - Grey background for my streetview app -

i'm trying make geolocation app work , after lot of verification , console.log() functions, should work. problem doesn't work. have grey background instead of streetview want. here code : streetview: function (latitude, longitude) { $('#streetview').css({'width': $(window).width(), 'height': $(window).height()}); var lookto = {lat: parsefloat(latitude), lng: parsefloat(longitude)}; var latlong = new google.maps.latlng(parsefloat(latitude), parsefloat(longitude)); var panooptions = { position: lookto, pancontrol: false, addresscontrol: false, linkscontrol: false, zoomcontroloptions: false }; // initialize new panorama api object , point element id streetview container var pano = new google.maps.streetviewpanorama(document.getelementbyid('streetview'), panooptions); // initialize new streetviewservice object var service = new google.maps.streetviewservice; //...

c# - How to remove current row from a html table in jQuery json? -

i want write code multipledelete using jquery json. this jquery code: function deleteselected() { var categories = new array(); debugger; // iterate checkboxes , obtain checked values, unchecked values not pushed array $("input[type='checkbox']").each(function () //$('input[type=checkbox]').prop("checked", this.checked) { this.checked ? categories.push($(this).val()) : null; }); // assume urldata web method delete multiple records var urldata = "webform5.aspx/deleterecord"; debugger; $.ajax({ type: "post", contenttype: "application/json; charset=utf-8", url: urldata, data: "{ 'id':'"+json.stringify( categories)+"' }", // used convert array proper json format datatype: "json", ...

silverstripe - User Forms Dropdown Field -

for silvestripe 3.1, user defined form. have defined country dropdown list, default value us. have searched google, did not find answer. i want change default value australia, how can that? if you're talking "userforms" module, can set defaults on option option basis, within cms itself. i'm not sure 3.1, i'm using 3.4 userforms v3.1.0, can go "fields" tab, edit dropdown field in question , select "options" tab. checking box right of each option under "selected default?" gridfield column, should enable desired default. can't imagine it's different in ss v3.1.

Theano: implementing an integral function -

i trying implement function in theano. not solving integral (which immediate) rather how implement it. far have gotten this import theano theano import tensor t import numpy np import scipy.integrate integrate x = t.vector('x') h = t.vector('h') t = t.scalar('t') = np.asarray([[0,1],[1,0]]) = theano.shared(name='a', value=a) b = np.asarray([[-1,0],[0,-1]]) b = theano.shared(name='b', value=b) xn = a.dot(x) hn = b.dot(h) res = (t + xn.dot(hn))**(-2) g = theano.function([t,x,h],res) # computes integrand f = theano.function([x,h], integrate.quad(lambda t: g(t,x,h), 10, np.inf)) unfortunately, doesn't work. getting error missing 2 required positional arguments: 'x' , 'h' . maybe integrate.quad function cannot "see" inputs x,h . thanks lot help!

Android Multiple Language Support for more than 3 activities -

i developing android app multiple language support for language selection user need select language listview issue: when user selects language, supposed applied activities in app in real, 2 activities strings changed i have strings activities in languages on listview item selection: preferencemanager.getdefaultsharedpreferences(getapplicationcontext()).edit().putstring("lang", "hi").commit(); setlangrecreate("hi"); setlangcreate method public void setlangrecreate(string langval) { configuration config = getbasecontext().getresources().getconfiguration(); locale = new locale(langval); locale.setdefault(locale); config.locale = locale; getbasecontext().getresources().updateconfiguration(config, getbasecontext().getresources().getdisplaymetrics()); recreate(); } you need , work activities in application locale locale = new locale(langval); locale.setdefault(locale); configuration config = ...

ios - Error: definition conflict with previous value -

Image
func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("namecell", forindexpath: indexpath) let pancakehouse = pancakehouses[indexpath.row] if let cell = cell as? faqsviewcell { cell.pancakehouse = pancakehouse } else { cell.textlabel?.text = pancakehouse.que } return cell } i got error in function of uitableviewcontroller when run project @ time got can't understand why came or meaning. the "definition conflicts previous value" occurred when forgot set cell identifier make sure have set correct identifier custom cell (in case "namecell") :

oracle - Calling a Stored Procedure from Java - Exception not thrown on ORA error -

i'm calling oracle stored procedure java, , have no problem sending input parameter values , getting output parameter values java once execute callablestatement . however, when send bad data stored procedure (to force error) , execute callablestatement 's execute method, i'd expect sqlexception thrown in method. doesn't happen, , code continues normal. when run stored procedure through sql developer, can see oracle error message (code ora-06502 ) displayed in log window. it's mystery me why java code isn't catching error message. does have idea source of behaviour is? stored procedure not throwing error correctly; java try/catch not recognizing exception thrown? unfortunately have no access stored proc code check how they're handling errors. any pointers appreciated. java doesn't throw sqlexception because call stored procedure java function (callablestatement) has sent command oracle. if procedure executed success, methode of cal...

java - What is the alternative solution for @javax.jws.WebMethod(exclude=true)? -

in process of up-gradation cxf jars 2.2.12 3.1.6, facing issue "exclude=true" attribute in @javax.jws.webmethod annotation while building project. getting following exception. [java] error: java.lang.runtimeexception: org.apache.cxf.jaxws.jaxwsconfigurationexception: @javax.jws.webmethod(exclude=true) cannot used on service endpoint interface. method: deletefileinternal [java] use verbose setting show stacktrace of error [java] javatows error: org.apache.cxf.tools.common.toolexception: org.apache.cxf.jaxws.jaxwsconfigurationexception: @javax.jws.webmethod(exclude=true) cannot used on service endpoint interface. this due to, cxf 3.1.6 not supporting "exclude=true" attribute while generation wsdl java class if class annotated @javax.jws.webservice annotation. can please suggest alternate solution this? do not use @javax.jws.webmethod(exclude=true) on interface, use on implementation public class mywebserviceimpl im...

c# - Parse json file without key values -

i'm trying parse json file json.net . content of json file is: [ [ "240521000", "37.46272", "25.32613", "0", "71", "90", "15", "2016-07-18t21:09:00" ], [ "237485000", "37.50118", "25.23968", "177", "211", "273", "8", "2015-09-18t21:08:00" ] ] i created following code: webclient wc = new webclient(); string json = wc.downloadstring("data.json"); dynamic myobject = jsonconvert.deserializeobject<dynamic>(json); foreach (string item in myobject[0]) { var x = item[0]; } how can loop through individual items without having key? while diin_'s answer answers question, don't think it's solution. having had @ marine traffic api, feels they've made poor json implementation, xml representation has attribute names values. json should've been: ...

ios - How to set NSLocalNotification to run on monthly or weekly basis for the same time scheduled? -

i have app data coming server. have 2 type of notifications monthly.now data month (date-time format) 2-2:30,6-9:00,23-10:00,26-12:00. 2 denotes date followed time colon (:) format. now want run notification every month on same dates , time. able run multiple notifications. not repeat every month. how that. following code same. please missing. - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { [uiapplication sharedapplication].idletimerdisabled = yes; uiusernotificationsettings *notisett = [uiusernotificationsettings settingsfortypes:uiusernotificationtypebadge | uiusernotificationtypealert | uiusernotificationtypesound categories:null]; [[uiapplication sharedapplication]registerusernotificationsettings:notisett]; [self generatelocalnotificationdaily]; } -(void)generatelocalnotificationdaily { // [[uiapplication sharedapplication] cancelalllocalnotifica...

javascript - how can i interchange of two elements in html via js or jquery on click one of them? -

<a href="javascript:" id="highlowrating" tabindex="0"> <a href="javascript:" id="lowhighrating" tabindex="1"> $('#lowhighrating').click(function(){ // interchange highlowrating" , if nothing. }); $('#highlowrating').click(function(){ // interchange lowhighrating" , if nothing. }); i need interchange positions of links if click 1 of them , if on corresponding position nothing,i tried .toggle() changing position, little confused here. you can use insertafter() , insertbefore() inserting element after/before element. $("#highlowrating, #lowhighrating").click(function(){ var index = $(this).index() - 1; if (index != $(this).attr("tabindex")){ if (index == 0) $(this).insertafter($(this).siblings("a")); else $(this).insertbefore($(this).siblings("a")); } }); ...

How to set time interval api call in ios objective c and reload the table view after getting success -

i new ios development .i have issue . need call api after set time interval (ios objective c) . after getting success should load table view . below do... step 1 : call webservice [self makewebservicecall] step 2 : when webservice call done, use nstimer in - (void)connectiondidfinishloading:(nsurlconnection *)connection { [nstimer scheduledtimerwithtimeinterval:2.0 target:self selector:@selector(makewebservicecall) userinfo:nil repeats:no]; ^^^ --> change increase more that's it...

node.js - How to prevent PM2 to change the current directory? -

im using pm2 handle nodejs micro services , express-handlebars handle views: var hbs = exphbs.create({ defaultlayout: 'main', helpers: { ifeq: function(a, b, options) { if (a === b) { return options.fn(this); } return options.inverse(this); }, tojson : function(object) { return json.stringify(object); } } }); app.engine('handlebars', hbs.engine); app.set('view engine', 'handlebars'); lunching app directly (node app.js) works great. if lunch using pm2 (pm2 start app.js) get: error: failed lookup view "home" in views directory "/root/views" when lunching pm2 current working directory change /root/ , since app in not there got error handlebars trying open views directory (which in app directory). is there way fix telling pm2 current working directory or telling express-handlebars library complete directory instead of using relative one? i using koa , swig...

java - JavaFX fill a table view not possible -

this question has answer here: javafx propertyvaluefactory not populating tableview 2 answers i started javafx , wanted create tableview 3 columns can display values. created tableview , columns scene editor fxml file. created class named values special properties matched columns should fit in. set observable list "value" objects in items of table. when start application, shows me empty table. looked 4 hours in internet , still not found answer why not working me. here code: value class: public class values { public simpledoubleproperty psi = new simpledoubleproperty(0); public simpledoubleproperty alpha = new simpledoubleproperty(0); public simpledoubleproperty delta = new simpledoubleproperty(0); public values(double _psi, double _alpha, double _delta) { setpsi(_psi); setalpha(_alpha); setdelta(_delta);...

Burmese language is shown as "boxes" in sql server 2012 -

Image
i have observed burmese language shown "boxes" record level in sql server 2012. both fields shown in screenshot nvarchar type more required length.is expected ? if why. if storing in nvarchar ok, can test copy , paste 1 of row data google translate burma language selected source, if see text in burma language characters, ok related editor

openoffice.org - open Openoffice calc using system command using python -

i trying open calc openoffice in listening mode using python. earlier opening typing following command in terminal: c:\program files\openoffice 4\program\soffice" -calc "-accept=socket,host=localhost,port=2002;urp;"& now won't open if use os.system(command) follows: os.system('"c:\program files\openoffice 4\program\soffice" -calc "-accept=socket,host=localhost,port=2002;urp;"&') i tried: os.system('c:\\"program files"\\"openoffice 4"\\program\\soffice -calc "-accept=socket,host=localhost,port=2002;urp;"&') this results in following error: the program cannot started.a general error occurred while accessing central configuration. but while running command terminal working. which operating system using? nevertheless, avoid os.system calls , prefer subprocess . here link documentation . as example: subprocess.check_call(["c:\path\program", ...

c# - Why is a datagrid locked when adding a row during TabControl selectionchanged event? -

very simple setup: place datagrid in tabitem (from tabcontrol). add contents during selectionchanged-event of tabcontrol dependent on new selectedindex. if datagrid in tab beeing selected, datagrid locked. seemes not readonly or disabled still cannot edit it. if add row in datagrid outside tab selectindex works fine. mainwindow.xaml <window x:class="wpfapplication2.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:wpfapplication2" mc:ignorable="d" title="mainwindow" height="350" width="525"> <grid> <tabcontrol selectionchanged="tabcontrol_selectionchanged"> <tabitem header...

Timer runs automatically on a MsgBox vb.net -

i trying make validation user able choose between 2 different results msgbox , if no 1 selected close. method got not working. this code using make validation: private sub watcher_idle(sender object) handles watcher.idle dim result = messagebox.show("the application close because lot of time off.", "are sure?", messageboxbuttons.yesno) if result = dialogresult.yes end elseif result = dialogresult.no elseif timer4.interval = 3000 timer4.start() end end if end sub if user select yes application close, if user select no doesn't , if user not select 3 secs or application close automatically. last step not making anything. not work. do have idea doing wrong?

android api 21/22, status bar icons don't show when statusBarColor is set to white -

api 21+ supports android:statusbarcolor i'm using , setting white in theme. on api 23 on nexus 6p status bar icons show darker tint, can see them against white status bar. however on api 21/22, icons tinted white disappear against white background. understanding google set status bar icons white in lollipop , advised against white background. there anyway setcolorfilter() or similar icons in status bar? here's theme: <style name="apptheme" parent="theme.appcompat.light.darkactionbar"> <item name="colorprimary">@color/colorprimary</item> <item name="colorprimarydark">@color/gray</item> <item name="coloraccent">@color/coloraccent</item> <item name="android:statusbarcolor">@color/white</item> </style> if change android:statusbarcolor #cccccc, example, see white status bar icons. tint them dark gray , keep status bar color white. ...

ios - How can I open Podfile for editing -

Image
i used cocoapods app noticed can't open pod file , file turn exec file image down, need edit add new libraries. open podfile textedit use terminal $ cd "your_project_location" $ open -a textedit podfile

php - Before getting the records csv gets downloaded -

i'm working on php excel export. here i'm facing problems there huge number of data 8000 records. data placed in cell perfectly. issue on 3000 records csv gets downloaded. how can fix ? there no more 3000 8000 how can ? example code <?php // connection $tamdsreport_billing_qry = db_query($_session['tamdsreport_billing_qry']); while($result_tamdsreport_billing_qry = db_fetch_array($tamdsreport_billing_qry)){ $datacenter_param = $result_tamdsreport_billing_qry['datacenter']; $cid_param = $result_tamdsreport_billing_qry['cid']; $rid_param = $result_tamdsreport_billing_qry['rid']; $datastore_name_param = $result_tamdsreport_billing_qry['datastore_name']; $cloud_type_param = $result_tamdsreport_billing_q...

javascript - Height change to auto works for all elements -

this code changes height of div auto when click "more+" button. how can run function div want? currently works divs when click on "viwviewmori" button. another issue when click "viwviewmori" button second time, want change text "... less -" "more" again. <!doctype html> <html> <head> <meta charset="utf-8"> <title>untitled document</title> </head> <body> <div class="hidi"> <div class="uner-sch"> <input type="checkbox"/> first </div> </div> <div class="viwviewmori"> ... more +</div> <div class="hidi"> <div class="uner-sch"> <input type="checkbox"/> second </div> </div> <div class="viwviewmori"> ... more +</div> <script...

c# - How expensive is data templating? -

i have performance problems , trying dig reasons. so far not sure problem , next assumption it's data templating. question: how expensive using data-templating ? lets see how expensive single data template. below mcve. xaml: <window.resources> <datatemplate datatype="{x:type local:item}"> <stackpanel> <textblock text="{binding property1}" /> ... add here more things see difference </stackpanel> </datatemplate> </window.resources> <contentcontrol content="{binding content}" /> cs: class item : inotifypropertychanged { public event propertychangedeventhandler propertychanged; public string property1 { get; set; } = "1"; public string property2 { get; set; } = "2"; public string property3 { get; set; } = "3"; public string property4 { get; set; } = "4"; public string property5 { ...

image processing - Creating patches for Deeplearning using matlab -

i have function creates patches of 32x32 pixels given image. returns cell contains patches. if image on format 350*350*3, works although if image of format 256*150 , returns cell empty images. funny thing if debug code create patches inside cell fine , when returning patches inside cell, cell becomes empty.i trying save such images using setimage code. ? % demo divide color image blocks. function [imageset] = createpatches(imag) fontsize = 20; %rgbimage = imread(imag); rgbimage =imag; % imshow(rgbimage); % enlarge figure full screen. set(gcf, 'units','normalized','outerposition',[0 0 1 1]); % drawnow; % dimensions of image. numberofcolorbands should = 3. [rows columns numberofcolorbands] = size(rgbimage) %========================================================================== % divide image blocks using mat2cell(). blocksizer = 32; % rows in block. blocksizec = 32; % columns in block. % figure out size of each block in rows. % blocksizer there may rem...

How to programmatically change keyboard input type in android (xamarin) -

i need change keyboard input type programmatically. problem is, have 1 edittext view component. activity has many states (sttitle, stquantity, ...) , keyboard input type have change when state has changed. i tried this: batchstates state { {....} set { ... etinput.setrawinputtype(android.text.inputtypes.classnumber); ... } } but change happen after click enter. change visible in next state. is possible refresh keyboard or somethink else?

php - Adding a "return to shop" button on single product pages that leads back to product parent category -

my client wants place "return shop" button on single product pages in woocommerce leads the previous page , not main shop page. i have explained browsers have buttons dead set on having button. i've mentioned activating breadcrumbs don't either. how can achieve that. appreciated. you category id using bellow code , add if condition show like $product_category = wp_get_post_terms( $post->id, 'product_cat' );

symfony - Doctrine generate/symfony2 -

Image
hello have concern learn symfony , error when try generate doctrine. on google no solutions helped me. it appears might have misconfigured doctrine's db connection parameters. double-check parameters.yml 's database_* options , make sure these valid database. also, perhaps bit more specific in question: command did run, exactly?

bash - Issue in echo statement in shell scripting -

i have peculiar issue script have wrote today. trying form ip address 2 variables namely url , port. getting url value library script echos 10.241.1.8 , port number 10000. if concatenate both url , port variable ip, strange result(:10000241.1.8). have code , result below. please me suggestions fix this. clear echo $(date +'%h:%m:%s')'>> "sample records" script started...' usage() { echo ">> $ script.sh -ctoff 89 -env c -ns reporting -deppath /user/release/audit_prime_oozie" echo "usage: $ script.sh -ctoff <cutoff number> -env <testing cluster. ex: s staging,c,d,p , a> -ns <optional: hive namespace> -deppath <deployment path>" } # function validate if value of parameter not empty validate () { if [[ $flag != 1 ]]; if [[ $tmpvar == *"-"* ]] || [[ -z $tmpvar ]]; usage exit 1 fi fi } options=$@ if [[ -z $options ]]; usage exit 1 fi arguments=($options) index=0 # function ...

python - How to append all the loop elements in single line while using string Template? -

i have tried make template example.py using string template substitute each loop elements in $i ["ca:"+ $i +':'+" "]. partially works substituting last element. but, want append values in single line format . for example: what current script doing follows: for in range(1,4): #it takes each "i" elements , substituting last element str='''s=selection( self.atoms["ca:"+$i+':'+" "].select_sphere(10) ) what getting follows: s=selection( self.atoms["ca:"+3+':'+" "].select_sphere(10) ) what, expecting follows: s=selection ( self.atoms["ca:"+1+':'+" "].select_sphere(10),self.atoms["ca:"+2+':'+" "].select_sphere(10),self.atoms["ca:"+3+':'+" "].select_sphere(10) ) my script: import os string import template in range(1,4): str=''' s=selection( self.a...

Polymer dynamically added elements not styled -

here cut down version of element have: <dom-module id="my-element"> <template> <style> :host { display: inline; } .dark { background: black; color: white; } </style> <span id="container"> <content></content> </span> </template> <script> polymer({ is: 'my-element', ready: function () { var containerel = this.$.container; var containertext = containerel.textcontent.trim(); // create element var clippedspan = document.createelement('span'); clippedspan.textcontent = containertext; clippedspan.classlist.add("dark"); // clear container containerel.innerhtml = ''...

visual studio 2010 - Force project to always build using VS2012/VC11 when using MSBuild -

note : related well known vs2010/vs2012 problem of, under circumstances, having specify /p:visualstudioversion=11.0 when using msbuild build c++/cli applications. problem: when building vs2012 c++/cli application using msbuild task referring c++/cli project file need add /p:visualstudioversion=11.0 msbuild command line, otherwise error: error msb8008: specified platform toolset (v110) not installed or invalid. please make sure supported platformtoolset value selected. this shows when building on machines both vs2010 , vs2012 installed, , developer command prompt vs2012 or after calling %vs110comntools%\vsvars32.bat myself. obviously know workaround already, rid of requirement of specifiying the same additional command-line argument time . some details: have .proj file sets msbuild task building c++/cli application. here's meat of (let's call foo.proj ): <?xml version="1.0" encoding="utf-8"?> <project toolsversion="4.0"...

php - compare strings with differences and similarities -

Image
i use function compare strings.. but how add 1 more property return array similarities in 2 strings? function get_decorated_diff($old, $new){ $from_start = strspn($old ^ $new, "\0"); $from_end = strspn(strrev($old) ^ strrev($new), "\0"); $old_end = strlen($old) - $from_end; $new_end = strlen($new) - $from_end; $start = substr($new, 0, $from_start); $end = substr($new, $new_end); $new_diff = substr($new, $from_start, $new_end - $from_start); $old_diff = substr($old, $from_start, $old_end - $from_start); $new = "$start<ins style='background-color:#ccffcc'>$new_diff</ins>$end"; $old = "$start<del style='background-color:#ffcccc'>$old_diff</del>$end"; return array("old"=>$old, "new"=>$new); } $string_old = "the quick brown fox jumped on lazy dog"; $string_new = "the quick white rabbit jumped on lazy dog...

amazon ec2 - Swappiness getting reset to default on reboot -

i wanted set vm.swappiness value amazon ec2 instance runnign redhat enterprise 7. able set manually after machine starts using sudo sysctl -w vm.swappiness=10 but vm.swappiness gets reset default 30 once stop , start instance. googled , found couple of solutions like adding vm.swappiness = 10 in /etc/sysctl.conf . didn't work. adding vm.swappiness = 10 in /etc/sysctl.conf , adding sysctl -p in /etc/rc.local . didn't work. when run sysctl -p manually, works correctly. nevermind. found solution after consulting aws support same. need change value in /usr/lib/tuned/virtual-guest/tuned.conf .