Posts

Showing posts from June, 2015

string - How can I remove ONLY leading and trailing spaces while leaving spaces in between words alone with an excel formula? -

in excel, trim() remove spaces before , after text, while removing duplicate spaces in between words. is there formula or combination thereof same trim() leave spaces between words as-is? in following example, i'm looking formula accomplish of fictitious formula "wxyz": trim(" omicron persei 8 ") = "omicron persei 8" wxyz(" omicron persei 8 ") = "omicron persei 8" note i've read somewhere trim() in vba work of wxyz above. however, i'm looking formula solution. i believe should work (assuming string located @ a1): =mid(a1, find(left(trim(a1),1),a1), (len(a1)-match(right(trim(a1),1),index(mid(a1,len(a1)-row(indirect("1:"&len(a1)))+1,1),0),0)-find(left(trim(a1),1),a1)+2) find(left(trim(a1),1),a1) returns location of first non-space character in string match(right(trim(a1),1),index(mid(a1,len(a1)-row(indirect("1:"&len(a1)))+1,1),0),0) returns location o...

python - upper() case of number key -

i'm trying implement input box in pygame. i've gotten point can input text in lower , upper case letters (shift changes upper case, usual). checking whether l_shift/r_shift pressed , if is, use char = char.upper() turn char corresponds pressed key corresponding upper char. works fine letters ( a-z -> a-z ). not work numbers , other special symbols 1 -> ! , 2 -> " , . -> : or , -> ; (german keyboard layout). is there better way in python turn chars corresponding shift+key chars? there no inherent mapping numbers punctuation marks associated them on keyboard, you'll have specify them yourself. use map, this: number_map = { '1':'!', '2':'@', '3':'#', #etc #etc } print(number_map['1']) # print ! this nice because can use other non-alphabetic keys.

python - How do I filter a pandas dataframe by the start of the index? -

i have dataframe of form: code note oh2014 oats futures, march 2014, oh2014, cbot hgg2004 copper futures, february 2004, hgg2004, comex brh2014 brazilian real (brl/usd) futures, march 2014, ... f5h2014 pjm ppl zone off-peak calendar-month day-ahead... pdmu2016 miso indiana hub day-ahead peak calendar-month... glg2015 columbia gulf louisiana natural gas (platts if... ssiz2014 coal (api 8) cfr south china (argus/mccloskey)... kcu1997 coffee futures, september 1997, kcu1997, ice fvh2003 5 year treasury note futures, march 2003, fvh2... bok1974 soybean oil futures, may 1974, bok1974, cbot where code index. how can filter returning entries code begins 'oh'? something this: df[df.index.str.startswith('oh')]

Facebook Graph explorer: Unknown path components -

i'm new facebook graph api decide start explorer i access token photos permission i insert url first: me/albums and result: { "data": [ { "created_time": "2010-09-05t12:04:01+0000", "name": "profile pictures", "id": "1587403170821" }, { "created_time": "2015-10-09t14:24:32+0000", "name": "mobile uploads", "id": "10207728693601171" }, { "created_time": "2015-09-30t13:00:27+0000", "name": "cover photos", "id": "10207681207694053" }, { "created_time": "2008-08-28t15:16:46+0000", "name": "כללי", "id": "1020707883793" }, { "created_time": "2008-08-26t16:26:25+0000", "name": "דן", "id": "1019996386006" }, { "created_time": ...

json - Python: Checking if a variable is greater or smaller if/else statement -

hi everyone! using python 2.7 , xlrd convert .xlsx file .json file! want accomplish script, draw conclusions input. make sure less human errors made. but, there problem code. user has enter value in cell, represents pages book per hundered. want want check: there more or less pages 100. code using import sys import xlrd dir = '/path/to/json/to/write' dirworksheet = '/path/to/excel/file' file = sys.argv[1] filejson = sys.argv[1]+'.json' work_path = os.path.join(dirworksheet,file) full_path = os.path.join(dir,filejson) worksheet = xlrd.open_workbook(work_path) sheet_generalinfo = worksheet.sheet_by_index(0) data_generalinfo = [] colnumber in range(1, sheet_generalinfo.ncols): key1 = ordereddict() row_value = sheet_generalinfo.col_values(colnumber) key1['publish_id'] = 1 key1['book_name'] = row_value[1] key1['pages_per_100'] = float(row_value[2]) if row_value[2]>= 1: key1['greater_or_sma...

excel vba - Looping through one column in a table then sending the entire row to another table if it matches a certain criteria -

i have table runs columns aa although of columns have been hidden except a,b,c,t , aa. it has autofilters , titles applied row 3 of each column. (title rows) in column b, have bunch of strings, half of strings in uppercase , other half in propercase. what want seperate rows in b column contains either propercase or uppercase value, doesn't matter way. what's important rows split in 2 seperate tables, preferably side side. i don't need copy hidden values new table want steer clear of overwriting any, new table have start @ ab1. i have make happen after auto filter applied if possible. (disregarding data has been auto filtered out.) thanks,

r - RSelenium error when connecting to server using Internet Explorer in windows -

i try use rselenium in windows ie browser seems there discrepancies other browsers, , need fixing newer versions. instructed in answers: library(rselenium) startserver() remdr <- remotedriver(browser="internet explorer") remdr$open() remdr$open() [1] "connecting remote server" selenium message:unable create new remote session. desired capabilities = capabilities [{nativeevents=true, browsername=internet explorer, javascriptenabled=true, version=, platform=any}], required capabilities = capabilities [{}] build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700' system info: host: 'cl5065f329ebf2', ip: '130.115.158.36', os.name: 'windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_91' driver info: driver.version: internetexplorerdriver error: summary: sessionnotcreatedexception detail: new session not created. class: org.openqa.se...

polymer - functions calls inside dom-repeat only executed once -

we cannot simple use case running polymer@1.4.0. have list of items. if user click on item, icon before item shown. specific is-selected class added item. the list rendered dom-repeat. each list item looks like: { "label": "item 1", "value": 0 } if user click in item, store value in variable selectedvalue . reason, dom-repeat not rerendering. functions isselected , getselectedclass called initially. not after click-interaction. tried use this.$.listitems.render(); inside selectitem-function. have effect. how can handle this? our current code: <dom-module id="selectable-list"> <template> <style is="custom-style" include="selectable-list-styles"></style> <ul id="selectable-list"> <template is="dom-repeat" items="[[items]]" id="itemlist"> <li class$="{{getselectedclass(item)}}"> <tem...

asp.net - CS1002: ; expected but no embedded C# -

not sure i'm missing here. don't know wants me put semicolon at. line 9 says error at. server error in '/' application. compilation error description: error occurred during compilation of resource required >to service request. please review following specific error details , >modify source code appropriately. compiler error message: cs1002: ; expected source error: line 7: <%@ register assembly="chartfx.webforms.adornments.8, version=8.0.5693.19342, culture=neutral, publickeytoken=a1878e2052c08dce" namespace="chartfx.webforms.adornments" tagprefix="chartfx_adornments" %> line 8: <%@ register assembly="chartfx.webforms.statistical.8" namespace="chartfx.webforms.statistical" tagprefix="chartfx_statistical" %> line 9: <%@ register assembly="chartfx.webforms.8, version=8.0.5693.19342, culture=neutral, publickeytoken=a1878e2052c08dce" nam...

dependency injection - Angular 2 AOT - Property 'window' does not exist on type -

in angular 2 application provide window object using described here: angular2 - how inject window angular2 service . however ngc compiler used aot returns several errors. first had change way provide dependency (note 'window'): @ngmodule({ providers: [ { provide: 'window', usevalue: window } ], ... }) export class appmodule {} and in component (note type 'any'): @component({ ... }) export default class mycomponent { constructor ( @inject('window') private window: ) {} ... however still following error thrown ngc compiler in module ngfactory: property 'window' not exist on type again working fine tsc compiler. in end fixed issue following described here: http://juristr.com/blog/2016/09/ng2-get-window-ref/

xslt - Split XML element's names into multiple names -

this question exact duplicate of: split xml element many 1 answer i want transform xml format <ctp> <name>absa bank</name> <bas.ba>bank|sector|issuer</bas.ba> <altids.altid_label_altsystem>absb_bbg|asb_reuters</altids.altid_label_altsystem> </ctp> to format, can use in integration project while migrating 1 system another. <ctp> <name>absa bank</name> <bas> <ba>bank</ba> <ba>sector</ba> <ba>issuer</ba> </bas> <altids> <aldid> <label>absb</label> <altsystem>bbg</altsystem> </aldid> <aldid> <label>asb</label> <altsystem>reuters</altsystem> </aldid...

R shiny slider increments -

trying setup slider bar range 0.5 - 999.5 increments of 1 such range of values can take on 0.5, 1.5, 2.5 ... 999.5 . problem when use the slider code below, values including whole integer 1, 2, 3, 4...etc have tried changing steps 0.5 get, 1, 1.5, 2, 2.5 ...etc. ideas? column(4, fileinput("pbs", label = ("pbs file input")), sliderinput("size", label = ("size range selection"), min = 0.5, max = 999.5, value = c(0.5,999.5), step = 1, round = f ) so not greatest, work: in ui : sliderinput("size", label = ("size range selection"), min = 0, max = 999, value = c(0,999), step = 1, round = f, post=".5...

php - Laravel Model function using relationship -

Image
i made function in view summing total hours <?php $sum = []; foreach($user->workedtimes $item){ array_push($sum, ($item->end_time->diffinhours($item->start_time))); } echo array_sum($sum); ?> and in blade view fine, want same code in model can call user->totalhours in blade and made function in model: and when call {{ $user->totalhours }} i error: how make work model?? you should use method brackets this: {{ $user->totalhours() }} but if use laravel accessor this: <?php namespace app; use illuminate\database\eloquent\model; class user extends model { public function gettotaltimeattribute() { // logic here ... $sum = []; foreach($this->workedtimes $item) { array_push($sum, $item->end_time->diffinhours($item->start_time)); } return array_sum($sum); } } and access in blade this: {{ $user->total_time }} hope helps!...

How to make an IF Statement with OR and an empty cell in Excel VBA -

i trying make if statement in vba script. wants achieve copy content 1 sheet ("database") sheet ("search"), given fulfilment of if statement. the script starts defining variables ("country", "category") dependent on user input on cells "e5" , "e7" of "search" sheet. defines final row if statement run until row: country = sheets("search").range("e5").value category = sheets("search").range("e7").value finalrow = sheets("database").range("a200000").end(xlup).row after this, script establishes condition: if inputted values (in cells "country" , "category") matched content on cells of "database" sheet, values on sheet should copied "search" sheet: for = 2 finalrow if sheets("database").cells(i, 1) = country , _ sheets("database").cells(i, 3) = category sheets("database...

angularjs - Not able to get the updated value from modal back to controller -

i have modal , doing process update value modal , not updating controller. please let me know how value($scope.currentitem.value) modal controller. $scope.showmodalform = function(data, index) { $scope.currentitem = data; ngdialog.open( { template: '/scripts/app/panel/myinfo.html', controller: 'myinfocontroller', scope: $scope, width:"50%", }) }; angular.module('app') .controller('myinfocontroller', function ($scope,$http, $log) { $scope.submit = function() { // open modal , process sucessfully need send approve controller if(process) { $scope.currentitem.value = "corrected"; } if(!process) { $scope.currentitem.value = "wrong"; } } } according ngdialog docs: scope object passed dialog. if use controller separate $scope service object pass...

matlab - Performance issue strcat and hex2dec -

the dec2hex(d) function in matlab returns 2-d string array each row hexadecimal representation of each decimal integer in d. suppose use function read input data (ansi characters), , convert data 1-byte hexadecimal representations, such resulting matrix l x 4 char matrix (should l x 2 still). since there 2-byte numbers present in data cannot convert these hex values decimal values. now, decimal value of these 2 byte hex numbers, use following line (the later value in matrix corresponds msb): hex2dec(strcat(data_hex(index+1,:),data_hex(index,:))); so concatenate 2 rows of hex matrix (each containing 4 columns single chars), single string, , transform string decimal. however, takes lot of time; line executed 7000 times , takes 1.2 seconds. since still relatively small data set, i'm looking faster way achieve goal. note converting whole hex matrix decimal numbers takes negligible amount of time, hoping use decimal representations instead. appreciated! example reading 2-b...

html - Python Jinja2 For Range -

i'm learning python/jinja2 , found problem don't know how solve it. i'm passing list of data jinja, , list, creates table. table ok , works fine. when want pass 1 attribute of list/table form, looses reference of list , sent information first item of list. let me explain better: {% value in listresult %} <tr> <td><center>{{ value.date }}</center></td> {% set ident = value._id%} <td>{{ident}}</td> <td> <form name="info_form" class="form-inline" action="/changetime1" method="post"> <div id="enquirypopup" class="modal fade in" role="dialog"> <div class="modal-dialog"> <!-- modal content--> <div class="modal-content row"> <div class="modal-header custom-modal-header"> <h4 class="modal-title">{{ident}}<...

javascript - Page object pattern with protractor -

Image
i trying creat page object files protractor. my app has following layout. , page object files.. navbar_po.js var navbar = function() { // define navbar elements , operations // . // . }; module.exports = navbar; subnavbar_po.js var subnavbar = function() { // define subnavbar elements , operations // . // . }; module.exports = subnavbar; page1_po.js var page1 = function() { this.navbar = function(){ var navbar = require('./navbar_po.js'); return new navbar(); } this.subnavbar = function(){ var subnavbar = require('./subnavbar_po.js'); return new subnavbar(); } // define page1 particular elements , operations // . // . }; module.exports = page1; and access navbar elements follows in test script.. var page1 = new require('./page1_po.js'); page1.navbar.something_method(); page1.subnavbar.something_method(); is best way? i don't want d...

parse local server cloud code adds /1/ to the URL -

i have simple beforesave trigger, being invoked expected. within need access parse server using parse.query . problem is, request going /parse/1/classes/purchaseorder rather /parse/classes/purchaseorder (note /1/ ). have same issue in few other places. question, how configure parse not include /1/ , or should instead configure server handle /1/ ? if that, how configure parse expect /1/ in code?

php - How to make Magento run in my subdomain -

i'm trying build magento (1.9.3.1) staging site in subdomain can't work properly. site working no images, js or css files being loaded. i've searched around answers i've found don't work me. my main website structure www.domain.com has it's own website (not magento) have subdomain.domain.com magento installed. following answer tried editing .htaccess , added following: rewritecond %{http_host} ^subdomain\.domain.com$ rewriterule ^/(.*) http://subdomain.domain.com/index.php [l] but didn't work. tried different variations of too. any ideas i'm doing wrong? have dedicated server , domain structure is: /httpdocs /subdomain.domain.com where main website root in httpdocs. issue? the subdomain set correctly in core_config_data table well. most packages magento require root access.. may issue. also, try check path youre images.

android - Using RxJava with Handler reset Message.what value -

rxjava 1.1.8 the idea listen handler messages subscriptions message.what attribute comes 0 always. class rxhandler(looper: looper) : handler(looper) { val messagesobservable = publishsubject<message>() override fun handlemessage(msg: message?) { super.handlemessage(msg) msg?.let { messagesobservable.onnext(it) } } } and subscribe it: playbackhandler.messagesobservable .subscribe({ // it.what 0 }, { timber.e(it, "error on playback handler message handling") }) and then: playbackhandler.sendemptymessage(1) then message.what == 0 expected: message.what == 1

linux - error in installation lttng module in ubuntu 16.10: Bad return status for module build on kernel: 4.8.0-22-generic -

i got error when install lttng module in ubuntu 16.10, documents in installation guide : sudo apt-get install lttng-tools sudo apt-get install lttng-modules-dkms after line got error: bad return status module build on kernel: 4.8.0-22-generic (x86_64) consult /var/.... is there have problem this? or idea how solve that?

html - jQuery Mobile table is not aligning properly -

Image
i want create table looks second block of image: but when creating table this: <div data-role="main" class="ui-content"> <table data-role="table" class="ui-responsive" id="flight-info-block"> <thead> <tr> <th>ams</th> <th>us 153</th> <th>nyc</th> </tr> </thead> <tbody> <tr> <td>oct 2</td> <td></td> <td>oct 2</td> </tr> <tr> <td>10:00</td> <td></td> <td>19:50</td> </tr> <tr> <td>gate</td> ...

Amazon Lumberyard and Google Firebase: differences? -

good morning, i've spent past couple of days researching different mobile application development/hosting platforms, applications, enablers, ides, tools, etc. - there out there, hard figure out item fills need. right looking amazon lumberyard , google firebase. @ first seemed both competing fill same need, more researched them more seemed have differences. hoping here have actual development experience them correct/validate assumptions of purpose: amazon lumberyard: a feature rich, complex development environment can use code/model game includes options add additional features game, include daily gifts , community news feeds includes drag-and-drop gui interface works multiple platforms: ios, android, pc, etc can integrate amazon gamelift deploying multiplayer, session-based games google firebase is not game/app development platform (you'll need use other program develop game) enhances application providing data sync, authorization, messaging, file storag...

sql - Intelligent Debt Ageing Code -

i have data in format of; client amt date abc co £250 20/09/16 abc co £250 20/10/16 cde co £200 20/11/16 cde co £200 20/10/16 cde co £-200 20/09/16 fgh co £600 01/01/16 fgh co £-500 20/09/16 fgh co £-50 20/10/16 fgh co £100 20/11/16 i can pivot easily; client balance 0-29days 30-59days 60-89days 90days+ abc co £500 £0 £250 £250 £0 cde co £200 £200 £200 £-200 £0 fgh co £100 £100 £-50 £-500 £600 ijk co £-100 £100 £0 £0 £-200 but need like; client balance 0-29days 30-59days 60-89days 90days+ abc co £500 £0 £250 £250 £0 cde co £200 £200 £0 £0 £0 fgh co £100 £100 £0 £0 £50 ijk co £-100 £0 £0 £0 £-100 the columns or "aging buckets" represent age of debit/credit. single transaction not occur in more 1 bucket. if there credits , debits should applied eachother (starting oldest). elaborate on few of records.....

android - move screen over image in titanium javascript -

Image
i need create effect in site withe name: link example site //i need in javascript the problem created effect image designs. how can move trough entire image , show part of image in javascript android , ios? i achieved using index.xml <alloy> <window class="container"> <label id="label" top="80" onclick="doclick">play sign</label> <view height="84"> <imageview width="255" height="7224" id="sigimage" top="0" image="/testimages/0d8zt.png"></imageview> </view> </window> </alloy> index.tss ".container": { backgroundcolor:"white" } "label": { width: ti.ui.size, height: ti.ui.size, color: "#000" } "#label": { font: { fontsize: 18 } } index.js var interval = null; var i=0; function doclick(e) { clear...

javascript - How to Restrict to take input in JQuery from a input field Consisting on Alphabets without Space -

i want take input text field , value should consisting on alphabets , there should not space in between? kindly let me know how achieve this? code follows; $("#xxxx").bind("keyup change", function () { $(this).val($(this).val().replace(/ /g,"")); }); get know regexes. fun, , can test them here: https://regex101.com/ use regex in replace finds non-alpha characters: // no-conflict-safe document ready jquery(function($) { // bind using on *class* instead of id. $(".numbers-only").on("keyup blur", function() { // use regex finds non-alpha characters $(this).val($(this).val().replace(/[^a-z]/ig, '')); }); }); working fiddle: https://jsfiddle.net/cale_b/602wuwmx/ notes improving code: 1. use on instead of bind . (per bind documentation, bind superseded .on() method attaching event handlers document since jquery 1.7, use discouraged. ) 2. bind class rather id . in ...

c++ - Removing dependency of MSVCR120D.dll -

i have dll (c/c++) built using vs2013 used exe, let me call exe_1 call exe, exe_2. the same code (&the def file) used built dll on vs 6 many years & works exe_1 uses- > old_dll - >invokes exe_2 now problem new dll having issues not invoking exe_2 mentioned above. have source codes both dll & exe_2 not exe_1. hence used debugbreak statements check whether exe_2 getting invoked exe_1, result negative. here differences can find across new dll (vs 2013) & old dll (vs 6) the "dumpbin /exports" new & old dll have variations in summary section below (exports section have same function names both): new dll summary 6000 .data 1000 .idata c000 .rdata 4000 .reloc 1000 .rsrc 5f000 .text 2f000 .textbss old dll summary c000 .data 6000 .rdata 3000 .reloc 1000 .rsrc 2f000 .text if see profile output old dll (using dependency walker profiling), below warnings extra warning: @ least 1 delay-lo...

NServiceBus: Subscribing to Events with specific property value -

given following event, there way subscribe events have specific property value? example, subscribe events operationtypeid=3. public interface iserverevent : ievent { int operationtypeid { get; set; } string somevalue { get; set; } } i using nservicebus 6.0.0. the use case new operationtype's can created on server need "generic" event structure. i'd ability subscribers receive events operationtype's interested in , not require publisher send events subscribers , make subscriber filter. i hoping publish side of nservicebus can handle filter reduce number of events published. what's downside of subscribing event, acting on ones match criteria , ignoring rest? if in control of publishing side , if events specific value mean business, maybe need break generic event , publish finer grain ones? as why nservicebus doesn't support content-based routing, maybe this read original author? tl;dr "because dangerous pattern shoul...

javascript - jQuery way to Replace character from a string -

i have generated navigation, first n items have _ in front of them @ top of list. want accomplish remove _ front-end of site. i tried jquery code below worked changing text of other nav items. see full mark-up on js fiddle: https://jsfiddle.net/1fz661o4/ code: $(function() { $('.dropdown-submenu').html($('.dropdown-submenu').html().replace(/\_/g,'')); }); you change loop on anchors. $(function() { $('.dropdown-submenu > a').each(function() { $(this).text($(this).text().replace(/\_/g, '')); }); }); https://jsfiddle.net/utk12jdt/1/

ios - Unwanted space at the bottom of View after UILabel using ScrollView -

Image
i have got view have attached screen shot, have got unwanted space @ bottom of second uilabel, content coming uilabel web url json using alamofire. have set lines 0. can understand why space there because label , not fill height of bottom, if change height fit it, texts gets truncated. how avoid space. have added relevant constraints. new swift. i have solved it, stretched bottom labels height fill bottom , took off height constraint. in viewcontroller added articlecontentvalue.sizetofit()

version control - SVN project not showing in repository directory -

tortoisesvn 1.7.15, subversion 1.7.18, i imported project windows workstation using tortoise svn existing repository on centos server. my directory structure follows: springproject/trunk/[project files , dirs src/ resources/ etc.] springproject/branch , springproject/tags i highlighted springproject directory in explorer interface, right clicked , selected svn import, entered log message , clicked ok. project imported no errors the project directory , subdirectories in windows interface show green check marks signifying good. the problem: however, on centos server in repos directory /usr/local/svn/repos, springproject entry not appear alongside of other projects. if use tortoise repo browser, shows project , url expect. springproject shown in interface alongside of other projects. i changed out of /usr/local/svn/repos directory , in see if shell needed reread directory. entry still not there. svn list --verbose svn/192.168.0.76/usr/local/svn/repos shows...

Import in python -

this question has answer here: relative imports in python 3 4 answers i read lot of answers related question asking, still not understand how make possible thing trying. let's go point. report simplified version of application. suppose have main folder called project , inside src main package containing three subpackages: clustering (containing file: clustering.py ) parser (containing file: parser.py ) support_class (containing file: myclass.py ) in each folder, except project one, there __init__.py now, python scripts contained in clustering , parser package should use both myclass.py contained in support_class. i tried relative imports, not works because run scripts contained in clustering , parser package directly , not want use -m option. es. python parser.py [arguments] example of relative import used is: from ..supportclass imp...

c# - Unity3D Character glitching -

Image
having trouble glitch in character , animator: https://www.dropbox.com/s/pigrfr98p7oscx3/img_1876.mov?dl=0 i have c# script toggles between pawn piece , humanoid figure. have script handles click move motion include: public class mc : monobehaviour { private float speed = 10; //speed of player private vector3 targetposition; //location of mouseclick; move private bool ismoving; //check see if moving animator anim; //animates humanoid piece void start () { targetposition = transform.position; //current location anim = getcomponent<animator>(); //gets animator controller attached piece ismoving = false; } void update () { //if mouse clicked if (input.getmousebutton (0)) { //if piece selected; not moved yet anim.setbool ("isselected", true); ...

python - Problems while merging two pandas dataframes with different shapes? -

this quite simple, not why can't merge 2 dataframes. have following df s different shapes (one larger , wider other): df1 id 0 microsoft inc 1 1 apple computer. 2 2 google inc. 3 3 ibm 4 4 amazon, inc. 5 df2 b c d e id 0 (01780-500-01) 237489 - 342 api true. 1 0 (409-6043-01) 234324 api other 2 0 23423423 api nan nan 3 0 (001722-5e240-60) nan nan other 4 1 (0012172-52411-60) 32423423. nan other 4 0 29849032-29482390 api yes false 5 1 329482030-23490-1 api yes false 5 i merge df1 , df2 index column: df3 b c d e id 0 microsoft inc (01780-500-01) 237489 - 342 api true. 1 1 apple computer. (409-6043-01) 234324 api other 2 2 google inc. 23423423 api nan nan 3 3 ibm (001722-5e240-60) nan nan other 4 4 ib...

c# - Return JSON when Handling error in Web API -

i have created web api accepts 4 input parameters used in querying oracle database , returns result in json format. trying handle exception in uri if there input parameter missing or in wrong format . returning in json "error":"room cannot empty or null" if room in uri empty room=&dob_gt=01-sep-05&dob_lt=30-dec-06&status_type=cmplt public class tgsdatacontroller : apicontroller { [httpget] public httpresponsemessage getdetails(string room, datetime dob_gt, datetime dob_lt, string status_type) { if (string.isnullorempty(room)) { var resp = new httpresponsemessage() { content = new stringcontent("room cannot empty or null") }; resp.content.headers.contenttype = new mediatypeheadervalue("application/json"); return resp; } list<oracleparameter> prms = new list<oracleparameter>(); list<string> selectionstrings = new list<string>(); pr...

javascript - node.js synchronous requests for use in caching -

i have issue need resolve in code has caching api results. have async.map so: for(var user of allusers) { var requestlist = fill(cache, locations, apiurl, cachemap); async.map(requestlist, function(obj, callback) { // ... }, function(err, results) { // put results cache }); } the function fill looks within cache see if location in locations exists, , not creates request url api run. i'm realizing cache won't use @ approach, because code dispatch async.map , start on next loop iterations fill , meaning cache won't synchronized @ each iteration of user. how go ensuring each iteration of user has updated version of cache last user? need make smart use of limited api calls, if there duplicated requests want request once, pull result cache in later requests. my throught right to synchronized request instead of async.map, know goes against design of node.js. for(var user of allusers) { var requestlist = fill(cache, locations,...

typo3 bootstrap accordion - collapse the initial element -

this related typo3 bootstrap theme please. i'd have elements of accordion closed @ page startup. top element is open here in understand it's related in in class of statement <div id="panel-425-0" class="panel-collapse collapse in"> but changing in source have side effects other locations i'like avoid. so i'm looking solution closure css or javascript. any guidance welcome. here try this so element id , re-set class attribute without 'in' class. <script> document.getelementbyid('panel-425-0').setattribute('class','panel-collapse collapse'); </script>

How do I find a model for Refinery's built-in users in Rails -

i using refinery , want make edits refineryuser. in schema file see following: create_table "refinery_authentication_devise_users", force: :cascade |t| t.string "username", null: false t.string "email", null: false t.string "encrypted_password", null: false t.datetime "current_sign_in_at" t.datetime "last_sign_in_at" t.string "current_sign_in_ip" t.string "last_sign_in_ip" t.integer "sign_in_count" t.datetime "remember_created_at" t.string "reset_password_token" t.datetime "reset_password_sent_at" t.datetime "created_at" t.datetime "updated_at" t.string "slug" t.string "full_name" end but cannot find model. how find model can add callbacks, validations, , other code refineryusers. may add activeadmin , m...

ios - Menu Link on Joomla Site not working on iPhone 6 Plus -

i trying workout why menu on joomla website not work on iphone 6 plus in landscape mode. have tested on computer same viewport , have no issues have been told few times friends/colleagues of issue , kind of struggling workout why happening , how can fix it. if please advise on other methods try fix unfortunately don't have iphone 6 plus see issue. the site can viewed @ http://www.leicesterbakery.co.uk i can confirm me mobile menu wasn't working on iphone 6 plus either. when clicked on menu icon focussing on search box. i think have solution. in css file @ http://www.leicesterbakery.co.uk/templates/lbakery/css/custom.css , go line 1018 , edit width of .search class 80% lower. in tests, following worked well. .search { width:70%; float:left; margin-top:20px; } after making above change mobile menu worked me on iphone. good luck!

c - Size of different data types causes confusion -

i working on c programs , had confusion lately, hit me again: suppose have function takes 32 bit size variable, , takes 8 bits, , have transfer data 32 bit variable 8 bit variable. here sample program have confusion with: #include <stdio.h> #define size_of_block 512 uint32* = null; // read uint8* b = null; // write int read_register(uint32* rbuff) { uint8 i; (i = 0; < size_of_block / 4; i++) // here 1 rbuff[i] = read_from_32_bit_reg(); // read incrementally on each iteration return 0; } int write_register(uint8* wbuff) { uint8 i; (i = 0; < size_of_block; i++) // here 1 write_reg(wbuff[i]); // point 2 return 0; } int main() { = (uint32*)malloc(sizeof(uint32) * 128); // contains 4096 bits b = (uint8*)malloc(sizeof(uint8) * 512); // contains 4096 bits read_register(a); b = (uint8*)a; // point 1 write(0x0080000, b); free(a); free(b); return 0; } 1) 512 bits in 128, 4 byte locatio...

java - How convert any text or letter to image in javafx -

for example have text, written - letter or sentence. how convert text image in javafx , show image. can't use labels, because need have possibility edit pixel of converted image. does can give me advice ? private writableimage texttoimage(string text) { text t = new text(text); scene scene = new scene(new stackpane(t)); return t.snapshot(null, null); }

android - Determine at runtime which layout was used -

Image
i have number of different layouts different display sizes (see screen shot). possible determine programmatically, @ runtime, used? edit: suggestion made use this: displaymetrics displaymetrics = new displaymetrics(); float density = displaymetrics.density; this returns 0 3 devices: samsung t530nu, asus nexus 7, droid maxx code: displaymetrics metrics = context.getresources().getdisplaymetrics(); int densitydpi = (int)(metrics.density * 160f); returns following: samsung t530nu: 160 asus nexus 7: 320 droid maxx: 320 edit 2: implemented simlar @selvin's suggestion: create these folders in res: values-large-land values-med-land values-small-land values-xlarge-land values-large-port values-med-port values-small-port values-xlarge-port each folder contains file called strings.xml each strings.xml contains string called device_size: <string name="device_size">small-land</string> with value changing folder. defa...

PHP switch theme from browser URL -

i have list of theme users can select theme demo. want user able change theme browser: domain.com/?theme=bootstrap-2 a default function set theme is: $this->setdefaultview("client/bootstrap-1"); i tried code not yet effective: /*===================== theme switcher ========= */ $stylesarr = array('bootstrap-1', 'bootstrap-2', 'bootstrap-3', 'bootstrap-4'); if(isset($_cookie['theme']) && in_array($_cookie['theme'], $stylesarr)) { $style = '' . $_cookie['theme'] . ''; } else { $style = 'bootstrap-1'; //default theme } if(isset($_get['theme']) && in_array($_get['theme'], $stylesarr)){ $this->setdefaultview("client/".$stylesarr); } else { $this->setdefaultview("client/bootstrap-1"); } /* =================== theme switcher ========= */ i use blesta billing hosting.

amazon web services - kube-controller-manager outputs an error "cannot change NodeName" -

i use kubernetes on aws coreos & flannel vlan network. (followed guide https://coreos.com/kubernetes/docs/latest/getting-started.html ) k8s version 1.4.6 . and have following node-exporter daemon-set. apiversion: extensions/v1beta1 kind: daemonset metadata: name: node-exporter labels: app: node-exporter tier: monitor category: platform spec: template: metadata: labels: app: node-exporter tier: monitor category: platform name: node-exporter spec: containers: - image: prom/node-exporter:0.12.0 name: node-exporter ports: - containerport: 9100 hostport: 9100 name: scrape hostnetwork: true hostpid: true when run this, kube-controller-manager outputs error repeatedly below: e1117 18:31:23.197206 1 endpoints_controller.go:513] endpoints "node-exporter" invalid: [subsets[0].addresses[0].nodename: forbidden: cannot change nodename 172....

dojo - Javascript (0 && 1) -

i'm trying debug javascript code related dojo localization, , came across following code in dojo: isxd = function(mid, contextrequire){ return ( 0 && 1 ) ? contextrequire.isxdurl(require.tourl(mid + ".js")) : true; }, what purpose of ternary operator here? seems me (0 && 1) false , function return true . browser compatibility thing? the source i've found differs bit code, explanation should fit. the original code can found in i18n.js part of full source package: isxd = function(mid, contextrequire){ return (has("dojo-sync-loader") && has("dojo-v1x-i18n-api")) ? contextrequire.isxdurl(require.tourl(mid + ".js")) : true; }, the same part in i18n.js.uncompressed.js included in release package looks this: isxd = function(mid, contextrequire){ return ( 1 && 1 ) ? contextrequire.isxdurl(require.tourl(mid + ".js")) : ...

python - change name of domain in admin Django CMS -

Image
always create new project in django-cms, when go admin see that it posible change example.com other name? how that? thanks in advance you should able change name under sites in admin panel (usually under /admin/sites/site/ ) more info sites .

forecasting - Matlab Kalman Filter Code - Forecast h-steps ahead? -

i have following code forecast variable zhi . far can see result ezhivec(i) given me the t+1 observation. but want compute h-steps ahead forecasts , absolutely don't know how... clear all; % state space reprsentation forcasted kalman filter % zhi(t+1) = f*zhi(t) + v(t+1) --> unbobserved varaibles % v~n(0,q) % y(t) = a'*x(t) + h'*zhi(t) + w(t) % w~n(0,r) global y; global x; global hvec; %%---- enter input parameters load hon.txt %filename stock prices load dji.txt %filename index prices n=100; %no. of points consider offset=1; %use 1 daily return or 30 monthly return %------------------------------- datapts=1:offset:(n+1)*offset; dji=dji(datapts); hon=hon(datapts); %hvec=(dji(1:n)-dji(2:n+1))./dji(2:n+1); %index returns process %y=(hon(1:n)-hon(2:n+1))./hon(2:n+1); %index returns process hvec=log(dji(1:n)./dji(2:n+1)); %index returns process y=log(hon(1:n)./hon(2:n+1)); %stock returns process hvec=flipud(hvec); y=flipud(y); x=ones(n,1); ...

linux - Visual Studio Preview for Mac and Xamarin Mono 4 Issue -

i have been using xamarin studio on mac write app, , sharing lot of code , projects linux mono project. reason have target mono / .net 4.5 framework. in mac project settings target framework, mono / .net 4.5 under "unsupported framework" , has yellow caution symbol. understand , accept this, since need support linux , older mono 4 framework. however, think visual studio preview mac changed installed mono runtime. when opened same project in vs4m, gave error: could not find system.runtime 4.0.0.0 i tried run project in xamarin studio , got same error, within couple minutes received notification xamarin. after updating, app ran again. i opened vs4m see if worked, , get: could not launch visual studio application requires newer version (4.8+) of mono framework. is there better way deal this? need able build , debug project in linux using open source linux tools bit out of date xamarin , apparently not compatible. will downloading 4.8 mono mess x...

Get all rows where field matches another field in another table in django -

say have table called watchlist, contains list of entities i'm concerned about: class watchlist(models.model): entity = models.foreignkey(entity) objects = watchlistmanager() def __str__(self): return str(self.entity) and have list of alerts: class distinctalert(models.model): alert_type = models.foreignkey(alerttype, db_index=true, on_delete=models.cascade) entities = models.manytomanyfield(to='entity', db_index=true, through='entitytoalertmap') has_unattended = models.booleanfield(default=true) latest_datetime = models.datetimefield() disregarding alert type i'm trying distinctalerts long entity exists in watchlist. something this: distinctalert.objects.filter(entities__in=watchlist.objects.all()).all() but of ocurse doesn't work since require entity objects instead of watchlist objects. what's best approach this? should do: distinctalert.objects.filter(entities__in=[element.entity element in sel...

c - Inserting string (character by character) into a larger string -

i trying insert string replacing substring in (original) string new string (toinsert). start parameter starting position of substring want replace. note: part of larger program trying function work. #include <stdio.h> #include <stdlib.h> #include <string.h> #define row 5 #define column 81 void insertstring(char original[], int start, int length, char toinsert[]){ char buffer[column]; int = 0; (i=0; i<strlen(original); ++i){ if (i>=start){ buffer[i] = toinsert[i]; } else{ buffer[i] = original[i]; } } buffer[strlen(buffer)-1] = '\0'; printf("%s\n", buffer); return; } int main() { char rep[column] = "very"; char sub[column] = "are"; char buf[row][column] = { {"how doing"} }; int len = strlen(sub); int start = 4; insertstring(buf[0], start, len, rep); return 0; } the problem prints "how". i want print "how doing" also, have tried usin...