Posts

Showing posts from May, 2013

algorithm - Comparing the Bounds of Functions -

i understand general idea of bounds of functions; example, if function ƒ1(n) ∈ ω(n^2) then know ƒ1(n) element within constraints of lower bound n^2 , meaning ƒ1(n) can function grows slower or equal of n^2 . now start confused when talk other functions in regards bounds of ƒ1(n) . example, have statement claims this: if ƒ1(n) ∈ ω(n^2) and ƒ2(n) ∈ θ(n) then ƒ2(n) ∈ o(ƒ1(n)) i have hard time telling whether or not it's true or false. have 2 different approaches contradict each other: true - since ƒ2 tightly bound under n , can considered element within constraints of o(ƒ1(n)) because ƒ2 not grow slower ƒ1 . false - since ƒ1 has lower bound of n^2 , function ƒ2 , tightly bound under n , cannot considered element of upper bounds of ƒ1 since know ƒ1 not have upper bound grows slower n^2 . both of these approaches i've thought of seem valid me; think i'm getting confused on whether or not care lower bounds of

c# - Any reference that confirms that Array.Sort(charArray, StringComparer.Ordinal) works? -

i sort array of chars according ordinal positions (code points) in unicode table. i see following code works: char[] chararray = new[] { 'h', 'e', 'l', 'l', 'o' }; array.sort(chararray, stringcomparer.ordinal); but looks bit weird. first because both of these parameters non-generic, , secondly, here using stringcomparer compare chars. is guaranteed work? reference? orderby(chr => chr) trick. char icomparable , comparable definition compares integer/"ordinal" value of chars.

php - How to echo "..." after number 9 and echo the last two numbers after "..." for pagination? -

Image
how echo 3 dots "..." after specific number (e.g., 9) , echo last 2 numbers after 3 dots "..." (e.g., 57 , 58) pagination using mysqli , php? here's code: <?php $output = ""; $tpages = ceil($engine->numrows("select null `cms_articles_comments` `article_id` = '" . $id . "'") / 10); if ($page == 1) { $output .= '<button type="button" class="btn btn-info pull-left gototop" disabled><i class="fa fa-arrow-left"></i> previous</button>'; } else { $output .= '<a href="/articles/' . $seo . '&p=' . ($page - 1) . '#comments" ng-click="progress()" class="btn btn-info pull-left gototop"><i class="fa fa-arrow-left"></i> previous</a>'; } if ($page >= $tpages) {

CSS style <audio> -

Image
is there way how style timeline thumb (seeker) of <audio> tag? i'm able target , style of element using audio::-webkit- shadow dom pseudo selectors. however, unlucky finding selector match playback timeline thumb. it's done <input type="range"> , shadow dom element. i'm trying target shadow dom pseudo element inside shadow dom pseudo element. my playground on https://jsfiddle.net/clwwwyh5/ . i need work in chrome (chrome app) going through list of available modifiers: audio::-webkit-media-controls-panel audio::-webkit-media-controls-mute-button audio::-webkit-media-controls-play-button audio::-webkit-media-controls-timeline-container audio::-webkit-media-controls-current-time-display audio::-webkit-media-controls-time-remaining-display audio::-webkit-media-controls-timeline audio::-webkit-media-controls-volume-slider-container audio::-webkit-media-controls-volume-slider audio::-webkit-media-controls-seek-back-button audio::-w

css - How do I remove the margin on the bottom 2 divs on my basic HTML site? -

below code site. trying figure out why there right margin on bottom 2 divs when .jumbotron has width of 100%. <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link href="main.css" rel="stylesheet"/> <title>vasilios lambos</title> </head> <body> <header role="banner"> <div id="fixed"> <nav role="navigation"> <ul> <li><a href="home.html">home</a></li> <li><a href="portfolio.html">portfolio</a></li> <li><a href="process.html">process</a></li> <li><a href="https://www.linkedin.com/in/vasilios-lambos-81220366">contact</a></li> </ul> </nav> </div> </header> <div class="jumbotron"> <img src="img_1677.jpg" width="20

python - Downheaping from an interior node with a recursive call to the index of the biggest child? -

i attempting downheap on array last interior node way root, making mini-heaps bottom up. have algorithm believe though far 100% @ point, plus i'm having trouble implementing it. the problem have recursive call. index index of bk. want this, not sure how to. how should tweak things? #!/usr/bin/python import random random.seed() def make_heap(a): = (len(a)-1)/2 - 1 while(i>-1): downheap(a,i) -= 1 def downheap(a, i): if a[i*2] > len(a): return bk = a[i*2] #set bk left child (bk biggest child) if a[(i*2) + 1] <= len(a) , bk < a[(i*2) + 1]: bk = a[(i*2) + 1] # if bk less right child, right child bk if a[i] < bk: #if parent smaller bk, swap parent bk temp = bk bk = a[i] a[i] = temp downheap(a, i) #index of bk, not i?? def main(): l = [] size = 15 in range(size): l.append(i) random.shuffle(l)

r - Error in Pearson correlation, 'y' must be numeric -

i'm running regression modelling glm between train , validation variables. variables in numeric values. there error when try run correlation error: 'y' must numeric..the code following: data <- read.csv(file="fielddatabase.csv", sep=",", header=t) attach(data) summary(data) ############################### ## prepare bootstrap samples ############################### set.seed(550) # create empty lists in subsets can stored train <- list() validation <- list() # set bootstrap parameters n = length(data[,9]) # n° of observations b = 500 # n° of bootstrap iterations # start loop for(i in 1:b){ # create random numbers replacement select samples each group idx = sample(1:n, n, replace=true) # select subsets of 5 groups based on random numbers train[[i]] <- data[idx,] validation[[i]] <- data[-idx,] } ###################################### ## start regression modelling glm ######################################

Can you create a Python list from a string, while keeping characters in specific keywords together? -

i want create list characters in string, keep specific keywords together. for example: keywords: car, bus input: "xyzcarbusabccar" output: ["x", "y", "z", "car", "bus", "a", "b", "c", "car"] with re.findall . alternate between keywords first. >>> import re >>> s = "xyzcarbusabccar" >>> re.findall('car|bus|[a-z]', s) ['x', 'y', 'z', 'car', 'bus', 'a', 'b', 'c', 'car'] in case have overlapping keywords, note solution find first 1 encounter: >>> s = 'abcaratab' >>> re.findall('car|rat|[a-z]', s) ['a', 'b', 'car', 'a', 't', 'a', 'b'] you can make solution more general substituting [a-z] part whatever like, \w example, or simple . match character. shor

python - Why did conda and pip just stop working? 'CompiledFFI' object has no attribute 'def_extern' -

i installed/upgraded following packages on system (mac osx 10.7.5, using python 2.7.11). package | build ---------------------------|----------------- enum34-1.1.2 | py27_0 55 kb idna-2.0 | py27_0 123 kb ipaddress-1.0.14 | py27_0 27 kb pyasn1-0.1.9 | py27_0 54 kb pycparser-2.14 | py27_0 147 kb cffi-1.2.1 | py27_0 167 kb cryptography-1.0.2 | py27_0 370 kb pyopenssl-0.14 | py27_0 122 kb ndg-httpsclient-0.3.3 | py27_0 30 kb ------------------------------------------------------------ total: 1.1 mb afterwards, following error when trying call pip or anaconda: 'compiledffi' object has no attribute 'def_extern' what

curses - Display inverse video text with python on terminal -

python has curses module. there simple way use module display inverse video text? don't want full-blown curses application, want text bring inverse (or in color). if use filter function (before initscr ), curses application update current line of screen (and not clear whole screen). minimal use of curses library. if want lower-level (no optimization, yourself), have use terminfo level of library, i.e., these functions: initscr filter (since python curses apparently has no interface newterm ) tigetstr read capabilities sgr , sgr0 , smso , rmso , rev tparm format parameters sgr if use that putp write strings read/formatted via tigetstr , tparm the page python curses.tigetstr examples has (mostly incomplete) examples using tigetstr , , reminds me use setupterm alternative newterm . if visit page searching "curses.filter", asserts there examples of use, reading, found nothing report. further reading: complete as-you-type on command

java - How to create a boolean function that returns true if 's' is immediately followed by the letter 't' in a string -

this question has answer here: reference - regex mean? 1 answer i've started learn how write code using java , trying make boolean function takes string , returns true character 's' in string followed(somewhere) character 't', , false otherwise. example, "stay" should return true; "tta" should return false; "cc" should return true because 's' not appear @ therefore 's' preceded 't', there no 't's.how go this? the easiest approach this private static boolean findsfollowedbyt(string string) { if (!string.contains("t") && !string.contains("s")) return true; if (string.contains("s") && string.indexof("s") < string.lastindexof("t")) return true; else return false; } or more c

javascript - How to update ng-bind-html every 1 minute? -

my project running angular js. how can update element every 1 minute? this element <strong ng-class="{'red-text' : main.redbgarray[$index] == 'red-text'}" ng-bind-html='main.minutestatecheck(listvieworder.status,listvieworder.ordered_at,listvieworder.accepted_at,listvieworder.ready_in_mins,$index)'/> so function. vm.minutestatecheck = function(status,ordered_at,accepted_at,ready_in_mins,index){ if(status === "pending"){ vm.ordersstatusredtextnum = index; var differentdayoutput = vm.differenceindays(ordered_at) if(vm.milisecondcheck > 300000){ vm.redbgarray[index] = "red-text"; } return differentdayoutput; } else if(status === "accepted"){ var differentdayoutputforaccepted = vm.differentdayoutputforaccepted(accepted_at,ready_in_mins); if(vm.milisecondcheck > 0){ vm.redbgarray[index] = "red-text&qu

c - Simple <Time.h> program takes large amount CPU -

i trying familiarize myself c time.h library writing simple in vs. following code prints value of x added every 2 seconds: int main() { time_t start = time(null); time_t clock = time(null); time_t clocktemp = time(null); //temporary clock int x = 1; //program continue minute (60 sec) while (clock <= start + 58) { clocktemp = time(null); if (clocktemp >= clock + 2) { //if 2 seconds has passed clock = clocktemp; x = add(x); printf("%d @ %d\n", x, timediff(start, clock)); } } } int timediff(int start, int at) { return @ - start; } my concern amount of cpu program takes, 22%. figure problem stems constant updating of clocktemp (just below while statement), i'm not sure how fix issue. possible visual studio problem, or there special way check time? solution the code needed sleep function wouldn't need run constantly. added sleep #include <windows.h> , pu

Print a for-loop, Java -

i'm trying learn java on own. re-doing programs i've done before, in different way. stuck for-loop. have following code: public class head { public static void main(string[] args) { int = 0; int b = 0; int c = 0; int d = 0; int e = 0; int f = 0; for(int i=0; i<1000; i++){ int dice1 = 1 + (int)(math.random() * ((6 - 1) + 1)); if (dice1 == 1){ a++; } else if(dice1 == 2){ b++; } else if(dice1 == 3){ c++; } else if(dice1 == 4){ d++; } else if(dice1 == 5){ e++; } else if(dice1 == 6){ f++; } } system.out.println("ones: " + a); system.out.println("twos: " + b); system.out.println("threes: " + c); system.out.println("fours: " + d); system.out.println("fives: " + e); system.out.println("sixes:

regex - htaccess rewrite rule for specific domain -

so have rule that's working perfectly: rewriterule ^images_designs/([^.]+)-d00([^/]+)\.png$ /image_design_watermark.php?design=$2 [l,qsa,nc] now add additional "language" variable related domain htaccess used on i have tried it's not working: rewritecond %{http_host} ^(ni-dieu-ni-maitre|blablabla)\.com$ [nc] rewriterule images_designs/([^.]+)-d00([^/]+)\.png$ /image_design_watermark.php?design=$2&language=fr [l,qsa,nc] rewritecond %{http_host} ^(no-gods-no-masters|ni-dios-ni-amo)\.com$ [nc] rewriterule images_designs/([^.]+)-d00([^/]+)\.png$ /image_design_watermark.php?design=$2&language=en [l,qsa,nc] the %{http_host} includes subdomains should add www that. rewritecond %{http_host} ^(?:www\.)?(ni-dieu-ni-maitre|blablabla)\.com$ [nc] and rewritecond %{http_host} ^(?:www\.)?(no-gods-no-masters|ni-dios-ni-amo)\.com$ [nc] or make looser , take off starting anchor, ^ i'd go route though. reference: http://httpd.apache.org/do

.htaccess - Rewrite url in htaccess file -

hello know if possible rewrite this: www.example.com/view/page.html (where view directory) to: www.example.com/page.html by using rule inside htaccess file located in directory called "view". you can create .htaccess file on root folder , write code below on it: rewriteengine on rewriterule ^page.html$ /view/page.html [nc,l] you should able access www.example.com/page.html , see page.html page without restarting apache.

amazon web services - Creating a people-centric search with elastic search -

i have content-centric elastic search (in aws) index containing articles following data: {article id, title, keywords, summary text, [name 1 [completion rate], name 2 [completion rate]...], creation date} each person associated each article has associated completion rate. when search keyword names returned top-matching documents. pivot person-centric model where: name 1, completion rate { { [article id, title, keywords, summary text , creation date], [article id, title, keywords, summary text , creation date], ...} name 2, completion rate { { [article id, title, keywords, summary text , creation date], [article id, title, keywords, summary text , creation date], ...} when search to: _ match & rank people based on articles linked them (search terms should match title, keywords , summary text fields within person entity) _ tune ranking of person based on completion rate (people higher completion rates should rank higher) _ tune ranking o

numpy - How to transpose a 3D list in python? -

let's have matrix m of dimensions 9 x 9 x 26: [[['a00', ... 'z00'], ['a01', ... 'z01'], ... ['a09', ... 'z09']], [['a10', ... 'z10'], ['a11', ... 'z11'], ... ['a19', ... 'z19']], ... [['a90', ... 'z90'], ['a91', ... 'z91'], ... ['a99', ... 'z99']]] i want convert following matrix of dimensions 26 x 81: [['a00', 'a01', ... 'a09', 'a10', ... 'a19', ... 'a99'], ['z00', 'z01', ... 'z09', 'z10', ... 'z19', ... 'z99']] what's best way of doing in python? if have list , not numpy array: m = [[['a00', 'z00'], ['a01', 'z01'], ['a09', 'z09']], [['a10', 'z10'], ['a11', 'z11'], ['a19', 'z19']], [['a90', 'z90&#

python - Create Django slug method -

i started using django time , stuck trying work slug. know are, it's dificult me define simple slug , display on browser. here scenario: i've models.py containing class book 3 fields: name, price , autor. want retunr slug string name , autor hyphens (-) , lowercase letters. my question how achieve this. using model, views , html. i've got till now. don't know how displayed on browser( localhost:8000/book_name ) class book(models.model): name = models.charfield(max_length=100) price = models.integerfield(default=0) autor = models.charfield(max_length=100) slug = models.slugfield(unique=true) @models.permalink def get_absolute_url(self): return 'app:book', (self.slug,) from django.template.defaultfilters import slugify add following model: def save(self,*args,**kwargs): self.slug = slugify(self.name) return super(book,self).save(*args,**kwargs) then can use slug in urls: url(r'mybooks/(?p<slu

sorting - Second console prompt fails in Java -

this class assignment have user input 3 names, sort them alphabetically in descending or ascending order based again on user input. i've got input of names down , managed find way sort them code fails when ask user choose between ascending , descending (ie: following if statements don't execute). i'm sure it's simple explanation haven't been able figure out i'm doing wrong. here's code: package javaapplication9; import java.util.scanner; public class javaapplication9 { public static void main(string[] args) { string = getinput("enter first name: "); string b = getinput("enter second name: "); string c = getinput("enter third name: "); string ascending = getinput("enter [a] ascending , [d]" + "for descending order."); // find first name alphabetically string min = ""; if (a.compareto(b) <= 0 && a.compareto(c) <= 0) { min =

c# - regex match but not include in group -

i'm doing little regex recognize complex number. need in c# school program. must recognize complex numbers like: 3+5i 3+5k 4-i5 6+f7 so, imaginary part can have char behind or ahead value. wrote regex: (?<reale>[+-]?\d+)(?<immaginaria>[+-]\d+[a-za-z]|[+-][a-za-z]\d+) the problem is, when take group called "immaginaria" have got imaginary part char (like or j) , i'd without.. found solution of using look-ahead , look-behind but have got problem while trying implement in regex (it's first regex write) (?<reale>[+-]?\d+)(?<immaginaria>[+-]\d+(?=[a-za-z])|[+-](?=[a-za-z])\d+) i modified first attempt little bit separate sign , value of imaginary part, can concatenate them later after successful match: (?<reale>[+-]?\d+)((?<immaginariasign>[+-])(?<immaginaria>\d+)[a-za-z]|(?<immaginariasign>[+-])[a-za-z](?<immaginaria>\d+))

javascript - Froala v2 editor mangles my code upon retrieval -

i'm using froala editor v2 , i'm running frustrating , intermittent problem. i'm embedding custom html widget (a rich preview when user enters url on own line). when retrieve final html saved our database, seems froala decides "clean up" html before giving me. when inspect editor instance while i'm editing content, markup in shape. when call $('.froala-editor').froalaeditor('html.get') retrieve html, html url preview widget mangled. my suspicion that, since entire preview wrapped in <a> tag make whole thing linked (and don't have nested <a> tags in because that's bad html), froala taking other structural elements div s, h# tags, p tags, etc , placing copies of wrapping <a> tag inside of them (as you'll see in code samples) because doesn't think you're allowed have <a> wrapping stuff. that's guess. and top off, froala give me html intact , other times won't. i don't think m

javascript - Composing a function from an uncurried function -

i'm trying create curriable function returns whether or not supplied length equal length of supplied string. i'd work this: checklength(3)('asdf') // => false checklength(4)('asdf') // => true i tried this, argument order reversed because returns curried equals function: const checklength = r.compose(r.equals(), r.prop('length')) checklength('asdf')(4) i can fix wrapping in function this: const checklength = (len) => r.compose(r.equals(len), r.prop('length')) but seems there way use functional library solve this. have ideas? the simplest way go flip function found - unfortunately work properly, need add stage of uncurrying composed function: const checklength = r.flip(r.uncurryn(2, r.compose(r.equals, r.prop('length')))) checklength(4)('asdf') // => true an alternative solution use usewith function: const checklength = r.usewith(r.equals, [r.identity, r.prop('length')])

C++ volatile object, nonvolatile member -

as in question: let's have small piece of code this: #include <iostream> using namespace std; struct foo { int a; foo() : a(12) {}; }; int main() { volatile foo x; return 0; } compiled g++ -g -o2 turns out, x initialization optimized away. that 1 however: #include <iostream> using namespace std; struct foo { volatile int a; foo() : a(12) {}; }; int main() { volatile foo x; return 0; } calls constructor. if try use variables inside code, (ie. cout << foo.a << endl; ) assembly output equivalent in both cases. do following right, that: in first case, there's no access struct @ all, gets optimized away completely. in second one, struct's field indicated 1 possible change during construction , reason foo() called no matter what. added: i've tried fiddling above code: calling things while(foo.a--); works expected, happens instead o

Is is possible to select clang for compiling CPython extensions on Linux? -

all's in title: i'd try using clang compiling c extension module cpython on linux (cpython comes distro repositories, , built gcc). do distutils/setuptools support this? does fact cpython , extension built 2 different compilers matter? thanks. there environment variable that. cc=clang python setup.py build both of compiled binaries compatible cpython

MS Access ?: How to pull information into a table from another linked table -

new access. trying create db wedding. have 1 table listing individual guest names/addresses/etc.: (see picture titled "guests") (pictures here) and second 1-to-many table called "invitations" gives id, reference name, , formal name each intended invitation: (see picture titled "invites") then, each guest linked 1 of "invites" through lookup invite table: (see picture titled "links") in perfect world, after linking guests invitation, number_invited field populate number of linkages, , invite address information populate address of 1 of linked. right can @ guests list , see guests, individual addresses, , invite each linked, prefer able print list of unique invitations (basically "invites" table), , have address information filled in know write on each envelope (ie, formal "invitation_title" , respective address). i realize may asking tables more they're supposed to, , need sort of report or

css - Flexbox align-self is not working in my layout -

im trying center #view-ctrls-cntnr horizontally inside of .menubar. when use align-self: center doesnt appear anything. doing wrong, there better approach? jsfiddle . html <script src="https://code.jquery.com/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <script src="https://code.jquery.com/jquery-2.1.4.js"></script> <script src="https://code.jquery.com/jquery-1.11.3.js"></script> <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <section class="analysis"> <div class="menubar"> <div class="dropdown" id="file-btn"> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">dropdown <spa

delphi - Updating Inno Setup progress bar from Dephi DLL -

i need help, please. i'm trying call function dll written in delphi 10 seattle inno setup (ansi). not understand problem. if make application in delphi , call function dll, works perfectly! see code listing: delphi dll: function process(pb: tprogressbar): integer; stdcall; var i: integer; begin := 0 1000 begin pb.position := i; pb.update; sleep(10); end; end; exports process; inno setup (ansi): function count(progr: tnewprogressbar): integer; external 'process@files:callc.dll stdcall delayload'; procedure newbutton1click(sender: tobject); begin count(newprogressbar1); end; after call access violation . but, comment in dpr file read, sharemem write first line, 0 effect. show me how correctly update progress bar in inno setup delphi dll, please. you cannot call object methods way. may lucky working, if use same version of delphi 1 inno setup built with, tests delphi application shows. still wrong , unreliable, not it. use d

elasticsearch - Query search string on elastic search -

i have field thats defined below. "findings": { "type": "string", "fields": { "orig": { "type": "string" }, "raw": { "type": "string", "index": "not_analyzed" } } }, the findings contains following text - s91 - fiber cut now, when 'term' search on 'findings.orig' word 'fiber', search response when a 'query string' search on 'findings.orig' word 'fiber cut', don't search response. when 'query string' search on '_all' word 'fiber cut', search response. why dont response 'fiber cut' on 'query string' search on 'findings.orig'. elasticsearch: query_string nested search

Swift programming: Multiple Positions on Map View -

i have simple problem , new ios - want have multiple gps streams coming on same map. please how done the current code works: import uikit import mapkit import corelocation class viewcontroller: uiviewcontroller, mkmapviewdelegate, cllocationmanagerdelegate { @iboutlet weak var mapview: mkmapview! let locationmanager = cllocationmanager() override func viewdidload() { super.viewdidload() self.locationmanager.delegate = self self.locationmanager.desiredaccuracy = kcllocationaccuracybest self.locationmanager.requestwheninuseauthorization() self.locationmanager.startupdatinglocation() self.mapview.showsuserlocation = true self.mapview.delegate = self } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } func locationmanager(manager: cllocationmanager, didupdatelocations locations: [cllocation]) { let location = locations.last let center = cllocationcoordinate2d(latitud

python - Controlling tick labels alignment in pandas Boxplot within subplots -

for single boxplot, tick labels alignment can controlled so: import matplotlib.pyplot plt import matplotlib mpl %matplotlib inline fig,ax = plt.subplots() df.boxplot(column='col1',by='col2',rot=45,ax=ax) plt.xticks(ha='right') this necessary because when tick labels long, impossible read plot if tick labels centered (the default behavior). now on case of multiple subplots. (i sorry not posting complete code example). build main figure first: fig,axarr = plt.subplots(ny,nx,sharex=true,sharey=true,figsize=(12,6),squeeze=false) then comes loop iterates on subplot axes , calls function draws boxplot in each of axes objects: key,gr in grouped: ix = i/ny # python 2 iy = i%ny add_box_plot(gr,xcol,axarr[iy,ix]) where def add_box_plot(gs,xcol,ax): gs.boxplot(column=xcol,by=keycol,rot=45,ax=ax) i have not found way aligned tick labels. if add plt.xticks(ha='right') after boxplot command in function

java - My ArrayList<NameValuePair> is showing NameValuePair can not resolve -

this question has answer here: namevaluepair error “namevaluepair cannot resolved type” [duplicate] 1 answer can 1 give me complete code http , post request android https://wowjava.wordpress.com/2011/01/16/login-application-for-android/ . please wanted make login check server.so want make post request please me. new android developer can not resolving issue.so please me. build.gradle (module:app): apply plugin: 'com.android.application' android { compilesdkversion 23 buildtoolsversion "23.0.2" defaultconfig { applicationid "com.systechdigital.realtimetrackingandmonitoring" minsdkversion 17 targetsdkversion 23 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('prog

Spring Boot configuration behaviour with @ConfigurationProperties and Command Line arguments -

i seem having funny behaviour spring boot on yaml property files im trying load. i have settings bean setup follows : @configurationproperties(location = 'config.yml', prefix='settings') public class settings { private string path; ... } i've explicitly told spring in config.yml file property values bind settings bean. looks this: settings: path: /yaml_path this works well, however, don't seem able override these values command line i.e. java -jar my.jar --settings.path=test the value bound settings bean still /yaml_path would've expected --settings.path=test override settings in yaml. interestingly, i've noticed if take comment out path setting yaml file, commandline argument value of test comes through. additionally, i've noticed if change config file config.yml application.yml , remove 'location' attribute configuration properties file gives me desired desired behaviour, means can't have multiple appl

Retrieve parent child records in SQL Server -

i have 2 tables trade , trade details this: trade table: id portfolio source version createdon status --------------------------------------------------------- 1 test1 rim 1.0 2016-01-20 1 2 test2 ios 1.0 2016-01-20 1 trade details table: id tradeid ticker company shares action comments ---------------------------------------------------------------- 1 1 msft microsoft 100 buy test 2 1 ibm ibm 200 sell test 3 2 yahoo yahoo inc 50 sell test 4 2 goog google inc 500 buy test i want retrieve , show data in following format. output 1 test1 rim 1.0 2016-01-20 1 1 1 msft microsoft 100 buy test 2 1 ibm ibm 200 sell test 2 test2 ios 1.0 2016-01-20

c# to vb.net SequenceEqual error -

i encountering error while converting c# script vb.net. the c# code goes this: if (managed.computehash(destinationarray).sequenceequal(secondarray)) using code conversion tool, got error in vb.net, please see image: the error http://s2.postimg.org/ouxqvhubd/calc_error.png i newbie in please me how can solve error. thank much. this may work you, if managed.computehash(destinationarray).sequenceequal(secondarray) however provided short section it's difficult relate else.

java - how to replace filepath ,In that filepath delete some path and also replace \ to / -

fi.write(file); out.println("filepath"+file.getabsolutepath()); system.out.println("above actual paht , bellow replace path"); string propic = file.getabsolutepath(); hpiugs.setimagename(propic); system.out.println(hpiugs.getimagename()); out.println("uploaded filename: " + filename + "<br>"); out.println(filepath); output : c:\users\peado inffitech 5\desktop\eclipse\jsp\userspanel\upload\uploadspenguins.jpg where change output as: /jsp/userspanel/upload/uploadspenguins.jpg string gotstring = "c:\\users\\peado inffitech 5\\desktop\\eclipse\\jsp\\userspanel\\upload\\uploadspenguins.jpg"; string newstring = gotstring.replace("c:\\users\\peado inffitech 5\\desktop\\eclipse", "").replace("\\", "/"); system.out.print(newstring); this should work if not missing out point horribly.

apache pig - mismatched input '(' expecting QUOTEDSTRING -

i have 1 data set given below 1,2,3 4,5,6 grunt command have tried 1. load ('text') using pigstorage(","); 2. = load ("text") using pigstorage(','); 3. load ('text') using pigstorage(',') (f1:int,f2:int,f3:int); all command returns same error. error org.apache.pig.tools.grunt.grunt - error 1200: mismatched input '(' expecting quotedstring check documentation, it's easy https://pig.apache.org/docs/r0.14.0/basic.html#load

javascript - How to jQuery bindings with a Backbone View -

i have backbone view, inside view there's input uses twitters typeahead plugin. code works, i'm doing typeahead initialisation inside html code , not in backbone code. typeahead.init('#findprocedure', 'search/procedures', 'procedure', 'name', function(suggestion){ var source = $("#procedure-row-template").html(); var template = handlebars.compile(source); var context = { name: suggestion.name, created_at: suggestion.created_at, frequency: suggestion.frequency.frequency, urgency: suggestion.urgency.urgency, id: suggestion.id }; var html = template(context); addrow.init("#procedure-table", html); }); the code above works inside script tag. but when try taking backbone doesn't work. what i'm trying in bb code is: initialize: function(ob) { var url = ob.route; this.render(url); this.inittypeahead(); this.delegat

serialization - Deserializing flattened JSON to Java Object using Jackson -

so using jackson deserialize json complex java objects. works have fields such as: { "foo.bar.baz":"qux" } which correspond java objects such as: class foo { anotherclass bar; } class anotherclass { string baz; } jackson unable figure out dots correspond inner objects. there way jackson able deserialize on flattened fields such field in example? no jackson json library not detect different object levels. can use instead: { "foo": { "bar": { "baz":"qux" } } } and have create: class wrapperclass containing "foo" of type fooclass class fooclass containing "bar" of type barclass class barclass containing "baz" of type string

bash - Read columns from a file into variables and use for substitute values in another file -

i have following file : input.txt b73_chr10 w22_chr9 w22_chr7 w22_chr10 w22_chr8 w22_chr8 i have written following code(given below) read first , second column , substitute values of first column values in second column in output.conf file .for example, change value b73_chr10 w22_chr9,w22_chr7 w22_chr10,w22_chr8 w22_chr8 , keep doing values till end. value1=$(echo $line| awk -f\ '{print $1}' input.txt) value2=$(echo $line| awk -f\ '{print $2}' input.txt) sed -i '.bak' 's/$value1/$value2/g' output.conf cat output.conf output.conf <rules> <rule> condition =between(b73_chr10,w22_chr1) color = ylgn-9-seq-7 flow=continue z=9 </rule> <rule> condition =between(w22_chr7,w22_chr2) color = blue flow=continue z=10 </rule> <rule> condition =between(w22_chr8,w22_chr3) color = vvdblue flow=continue z=11 </rule> </rules>

loops - How to ignore the next line in python -

i trying print this * * * * * * * * * * here code while 1: n=int(input("enter n")) if n<3: print("wrong input") continue else: in range(1,n+1): j in range(1,i+1): print("x") i refer question not able achieve this. can please me how can achieve this? thank you example: for in range(5): print('* '* i) * * * * * * * * * * edit or use map functions faster: print('\n'.join(map(lambda x: '* ' * x, range(5)))) timing in [25]: %timeit print('\n'.join(map(lambda x: '* ' * x, range(5)))) 1000 loops, best of 3: 289 per loop in [26]: %timeit in range(5): print('* '*i) 1000 loops, best of 3: 444 per loop

python - ImportError when using read_excel into a data frame -

i encountering importerror when trying use read_excel function of pandas. i have script works reading csv files , read_csv function, using argparse allow command line arguments. thought i'd try , modify script read excel files. this code works csv file. df = pd.read_csv(args.src, header=0, skiprows=datarow, na_values=bad_data, usecols=[timecol, spcol, pvcol, mvcol], names=['timestamp', 'sp', 'pv', 'mv']) my code allows user select starting row , columns want read data from, , parses them new data frame. works well. using read_excel function, came this: df = pd.read_excel(args.src, skiprows=datarow, na_values=bad_data, parse_cols=[timecol, spcol, pvcol, mvcol], header=headerrow) i removed header argument wasn't required. changed usecols parse_cols per pandas documentation. in read_csv function used custom names column headers, looked read_excel couldn't this. replaced functionality header argument

javascript - Can not hide the button of table row using Angular.js -

i getting 1 issue while trying hide button after button click using angular.js.i explaining code below. <tbody id="detailsstockid"> <tr ng-repeat="code in listofgeneratedcode"> <td>{{$index+1}}</td> <td>{{code.name}}</td> <td>{{code.no_of_voucher}}</td> <td>{{code.expired_date}}</td> <td>{{code.voucher_amount}}</td> <td> <input type='button' class='btn btn-xs btn-green' value='view' ng-click="viewvouchercodedata(code.voucher_code_id);"> </td> <td><img ng-src="upload/{{code.image}}" name="pro" border="0" style="width:50px; height:50px; border:#808080 1px solid;" /></td> <td> <input type='button' class='btn btn-xs btn-green' value='send' ng-click="