Posts

Showing posts from July, 2012

c++ - OpenGL: GL_FRAMEBUFFER_UNSUPPORTED on specific combinations of framebuffer attachments -

im trying attach multiple targets framebuffer object. have following problem: there no error, when using float texture attachments , depth attachment. there no error, when using float texture attachments , integer texture attachments. although these combinations work, cant use float, integer , depth attachments @ same time. results in gl_framebuffer_unsupported status. this code: //working: framebuffer fb = framebuffer( 1280,720, { //attachmentinfo(gl_depth_component16,gl_depth_attachment), attachmentinfo(gl_rg32f,gl_color_attachment0), attachmentinfo(gl_rgb16ui,gl_color_attachment1), attachmentinfo(gl_rgb32f,gl_color_attachment2), attachmentinfo(gl_rgb32f,gl_color_attachment3), attachmentinfo(gl_rgba16f,gl_color_attachment4), attachmentinfo(gl_rgb32f,gl_color_attachment5), attachmentinfo(gl_rgb32f,gl_color_attachment6), } ); //working: framebuffer fb = framebuffer( 1280,720, { attac

Using pure Python over grep? -

i not familiar grep i've been on windows system when suggested add these lines code, i'm little confused... grep = 'grep -e \'@import.*{}\' * -l'.format(name) proc = popen(grep, shell=true, cwd=info['path'], stdout=pipe, stderr=pipe) from understanding, trying find files in cwd contain @import given_file_name essentially, right? if how grep works, need write in python me, i'm worried time may take such thing. the script in sublime text 3 plugin runs sublime_plugin.eventlistener method on_post_save find files containing saved filename , build list of file names compile. def files_that_import(filename, project_root): files = [] root, dirnames, files in os.walk(project_root): fn in files: if fn.endswith(('.scss', '.sass')): open(fn, 'r') f: data = f.read() if re.search(r'@import.*["\']{}["\'];'.format(fn),

r - SparkR and Packages -

how 1 call packages spark utilized data operations r? example trying access test.csv in hdfs below sys.setenv(spark_home="/opt/spark14") library(sparkr) sc <- sparkr.init(master="local") sqlcontext <- sparkrsql.init(sc) flights <- read.df(sqlcontext,"hdfs://sandbox.hortonworks.com:8020 /user/root/test.csv","com.databricks.spark.csv", header="true") but getting error below: caused by: java.lang.runtimeexception: failed load class data source: com.databricks.spark.csv i tried loading csv package below option sys.setenv('sparkr_submit_args'='--packages com.databricks:spark-csv_2.10:1.0.3') but getting below error during loading sqlcontext launching java spark-submit command /opt/spark14/bin/spark-submit --packages com.databricks:spark-csv_2.10:1.0.3 /tmp/rtmpuvwoky /backend_port95332e5267b error: cannot load main class jar file:/tmp/rtmpuvwoky/backend_port95332e5267b any highly appre

C# comparing 2 lists with string array property -

i have class 1 property of list<string> hold dynamic list of 1 or more string ids. public class fieldcompareitem { public list<string> fields = new list<string>(); public fieldcompareitem(string[] fields) { (int = 0; < fields.count(); i++) fields.add(fields[i]); } } } i'm trying compare 2 lists see if string arrays match doesn't work. basically, want a/b compare items exist in a, in b, , in both, this: var lista = new list<fieldcompareitem> { new fieldcompareitem(new[] {"a1"}), new fieldcompareitem(new[] {"a2"}), new fieldcompareitem(new[] {"a3","001"}) }; var listb = new list<fieldcompareitem> { new fieldcompareitem(new[] {"a2"}), new fieldcompareitem(new[] {"a3"}), new fieldcompareitem(new[] {"a3","001"}),

javascript - Access the nested value in JSON without looping through it -

this json, want directly zipcodes values json without looping through json. how can it? countries:[ { name:'india', states:[{ name:'orissa', cities:[{ name:'sambalpur', zipcodes:{'768019','768020'} }] }] } ] as not associative array, option use indexes this: countries[x].states[y].cities[0].zipcodes where x each representation of state in array, in case, of course, have more one. similarly y each state in each state in each country, in case have more of , can same cities if need to. edit: here's how can iterate array: for(var c in countries) { var name = countries[c].name; if (name === "countryiamlookingfor") { var stateslist = coun

c++ - BAD_ACCESS (code=EXC_I386_GPFLT) when signing with ECDSA -

Image
i trying use crypto++ on ios. downloaded prebuilt version of library marek kotewicz's github . i struggling hard run this sample code crypto++ wiki. ecdsa<ecp, cryptopp::sha256>::privatekey privatekey; ecdsa<ecp, cryptopp::sha256>::publickey publickey; autoseededrandompool prng, rrng; privatekey.initialize(prng, cryptopp::asn1::secp256k1()); privatekey.makepublickey(publickey); string signature; string message = "do or not. there no try."; stringsource s(message, true, new signerfilter(rrng, ecdsa<ecp, cryptopp::sha256>::signer(privatekey), new stringsink(signature))); its crashing following. showing in xcode output window: bad_access (code=exc_i386_gpflt) this code snippet memory.h of c++ file pointing bad_access _libcpp_inline_visibility ~auto_ptr() throw() {delete __ptr_;} i getting bad_access(code=1 , address=0x0) error pointing line of code

html - Page CSS is randomly adding padding to portfolio images -

Image
my team developed portfolio website. but facing strange issue. we pasted issue in theme support, not yet solved. while loading page , giving this: and this(we want this): how rid of this?? i'm not familiar wordpress if have access css controls template them maybe can use firebug or inspect element find out if upper , lower divs have class specifications, , set margins 0 in css file this: i'll pretend firebug revealed div classes upperdiv , lowerdiv this: <div class="upperdiv">photos</div> <div class="lowerdiv">photos</div> in css try: .upperdiv { margin-bottom: 0px; } .bottomdiv { margin-top: 0px; } hope helps.

How to expand a compressed list into a full list in Python? -

i have compressed list (and possibly bigger): [[[1, [2, 3], [3, 2]]], [[2, [1, 3], [3, 1]]], [[3, [1, 2], [2, 1]]]] what can expand complete list like? [[1,2,3], [1,3,2], [2,1,3], [3,1,2], [2,3,1], [3,2,1]] i think sort of recursion don't know how. thank in advance edit: here's function wrote keeps saying syntax error. def expandlist(alist): """expand list""" finallist = [] j in alist: if type(j) != type(list): templist = [] templist.append(j) finallist.append(templist) else: finallist.extend(expandlist(j)) return finallist edit: whoops, meant: [[1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]] not: [[1,2,3], [1,3,2], [2,1,3], [3,1,2], [2,3,1], [3,2,1]] sorry confusions. you may want try this, l = [[[1, [2, 3], [3, 2]]], [[2, [1, 3], [3, 1]]], [[3, [1, 2], [2, 1]]]] final_list = [] k in l: x in k: t = [x[0]]

python - Improving a sort program's efficiency; displaying column sort % completion in terminal -

i have big pipe-delimited input file approx 6 million lines below: 24|bbg000sjfvb0|eq0000000009296012|oi sa-adr|oibr/c|us|adr|equity 16|bbg002phvb83|eq0000000022353186|bloom select income fund|blb-u|ct|closed-end fund|equity -50|bbg000v0tn75|eq0000000010271114|mechel-pref spon adr|mtl/p|us|adr|equity 20|bbg002s0zr60|eq0000000022739316|dividend 15 split corp ii-rt|df-r|ct|closed-end fund|equity -20|bbg001r3lgm8|eq0000000017879513|ing floating rate senior loa|isl/u|ct|closed-end fund|equity 0|bbg006m6sxl2|eq0000000006846232|aa plc|aa/|ln|common stock|equity requirements below: 1. need sort input file 1st column , 2nd column , 2nd last column in order 2. displaying % of sort completion in terminal/console e.g. "column 2 75% sort done" 3. output in separate file. i have written program below sorting 1st column perfectly. how incorporate other conditions? taking little more time run. there more efficient , cleaner way it? thing can't use additional outsi

Reference C# type within XML schema? -

is possible reference types within c# project in xml schema file? validation , intelli-sense mean... lets have following: namespace example { class mytype { int test = 0; } } how reference example namespace within schema file can use mytype element type? not directly. there's sort of 2 ways can though. the first mark class serializable , use xmlserializer serialize xml. in conjunction this, can use xsd.exe create schema class, , that used type in (other) schema. xmlserializer used serialize , deserialize to/from type. on related note, if have method want capture in in xml (as opposed data types or structures), can extend xslt c# (or vb.net, or javascript) code. msdn has more documentation on how that, basic idea being use xsltargumentlist , addextensionobject add method. it's possible directly in xslt using msxsl:script (see here more information on that).

node.js - Is there a way to set maximum duration for browser-based video uploaders? -

vine.co allows videos @ 6 seconds. users upload phones. wonder if can done browsers. thanks. (i rely on node.js) it depends how want perform upload. option 1 - if movie uploaded streaming server in, example, rtsp or rtmp, server can elect drop movie based on duration, determined during upload. accurate , efficient option requires uploader able stream file , server accept stream media server. option 2 - if movie uploaded file transfer easiest limit movie file size. size can determined heuristics if know bit rate. example, @ 500kbps you'd expect 6 second movie weigh approximately 375kb, might limit uploads 450kb , figure exact boundary while inspecting file on server side. work must know in advance movie's average bit rate. option 3 - yet option, based on movie metadata: depending on movie format might able determine upfront movie's duration inspecting file headers. in mp4, example, if mov atom @ beginning of file can tell upfront what's movie'

recursive function and 2-d arrays c++ -

alright, have input looks this: 1 6 2 3 4 1 8 3 4 7 2 1st # represents number of dimensions of array 2nd # = # of elements in array. 3rd # = rows of array (index) 4th # = columns write segment of code print out indices of array. example, output of 2nd line should like: 00 01 02 03 10 11 12 13 20 21 22 23 i hope makes sense. understand how write code without recursion. it's matter of loops , cout statements can't figure out how use recursion. simplest case, 1-dimensional array, we'd write out code second simplest case have use recursion work next 3rd , 4th etc cases. one way recursively write function takes number p , string of numbers ones in input file. function prints out results describe, uses p prefix. f(99, 1 4) print: 990 991 992 993 is enough of hint, or should go little farther?

postgresql - How do I make a query search in rails case insensitive? -

i have search method in user.rb model def self.search(query) where("description ?", "%#{query}%") end but search case sensitive. want make case insensitive. how do that? i'm hoping it's quick fix. thanks because using postgresql: def self.search(query) where("description ilike ?", "%#{query}%") end just use ilike instead of like . like/ilike documentation if want use =, both sides either upper or lower

big o - Would this function be O(n^2log_2(n))? -

so given function 65536 n 2 + 128 n log 2 n and way o(n 2 log 2 n) if c = 65664, n0 = 2 n ≥ 2 since c1 = 65536 n1 = 2 when 65536 ≤ c1*n 2 and c2 = 128 n2 = 1 when 128 ≤ c2*n but number i've chosen constant seems bit high, there way check this? o(65536 n 2 + 128 n log 2 n) same o(n 2 + n log 2 n) since can ignore multiplicative constants. o(n 2 + n log 2 n) equal o(n 2 ) since n 2 grows faster n log 2 n. also, way, base of logarithms doesn't matter in big-o analysis. logarithms grow @ same rate. after all, log 2 n = log n / log 2, , multiplicative constants can factored out. can log n instead of log 2 n. caveat: technically, true statement 65536 n 2 + 128 n log 2 n &in; o(n 2 log 2 n) because big-o gives an upper bound, not strict one. o(n 2 ) lower upper bound, if makes sense. that said, should not have come o(n 2 log 2 n). merely result of accidentally turning addition multiplication. rule of thumb, if have multiple things added in

javascript - Angular - Uncaught ReferenceError: angular is not defined -

i'm trying use simple angular function in laravel 5 project , keep getting error: angular not defined i have tried move angular.min.js top making first js script on index page still doesn't work. this code: pastebin code it outputs {{name}} , not actual string controller! what doing wrong? i have seen issue before. in case due incorrect relative reference using. not expert in matter recommend try different combinations , see if helps. see js folder placed in website hierarchy ex. src="js/angular.min.js" or src="../js/angular.min.js"

r - Iteratively adding new columns to a list of data frames -

i trying write code iterates through list of data frames, adding each new column contains same values older column shifted 1. first value in column na. below code: for(dataframe in 1:length(listofdataframes)){ newcolumn <- c(na) for(row in 1:(nrow(listofdataframes[[dataframe]]) - 1)){ newcolumn <- append(newcolumn, listofdataframes[[dataframe]]$oldcolumn[row]) } mutate(listofdataframes[[i]], newcolumn = newcolumn) } however, when execute code in r, error on first dataframe: replacement has 894 rows, data has 895 what causing error? sorry if easy question, not expert in r. thank you! you code concentration of things should avoid in r: don't use for when can use lapply or more genrally xxapply family. don't append row of data.frame inside loop. inefficient. should pre-allocate. using lapply you. don't use $ inside function. should use [ operator no need loop on data.frame when can in vectorized manner. here

c# - File Retrieved via FtpWebRequest Is Different Than Source File On Server -

i retrieving gzip files ftp server using example code provided in microsoft page: https://msdn.microsoft.com/en-us/library/ms229711(v=vs.110).aspx the code works great! connection established, file retrieved , saved target path. the problem file created code not same file on source ftp site. example, may have source file 288,936 bytes, file created code 532,550 bytes. maybe fine if dealing plain text files, since these gzip files not able unzip them because corrupted, yielding following error: the magic number in gzip header not correct. make sure passing in gzip stream. i know error somewhere in ftp download code because can use different ftp client download file , upzip file correctly. here exact source code. have created own "helper" methods make connection ftp server , download remote file local folder destination. public static void transferfilefromftp(string uri, string username, string password, string foldername, string filename, directoryinf

javascript - Correct logging to file using Node.js's Winston module -

i'm using winston logging both console , file. if specify formatter , logged message same previous one, file log written once. in other situations (no formatter specified or writing console) logging works expected. here's simplified code: var winston = require('winston'); function formatter(args) { return "some formatting: " + args.message; } var weirdlogger = new (winston.logger)({ transports: [ new (winston.transports.console)({ json: false, formatter: formatter }), new (winston.transports.file)({ filename: "weirdlogger.csv", json: false, formatter: formatter }) ] }); var workinglogger = new (winston.logger)({ transports: [ new (winston.transports.console)({ json: false }), new (winston.transports.file)({ filename: "workinglogger.csv", json: false })

javascript - Getting HREF of an html node -

i have page @ http://www.entrepreneuronfire.com/podcast/edwinhavens/ with image @ http://i.imgur.com/u59iaxb.png i need download link (i.e. hxxp://traffic.libsyn.com/entrepreneuronfire/edwin_havens.mp3) of mp3 file @ class named spp-dloada (as web inspector detects) 48 hours attempt ended in smoke. that download link shows in chrome (as <a href="http://traffic.libsyn.com/entrepreneuronfire/edwin_havens.mp3" download="edwin_havens.mp3"> <span class="spp-dloada"></span> </a> ) but not in firefox 38 , ie11 need them in these 2 browser. for firefox , ie11 html snippet <div class="spp-controls"> <span class="spp-speed"/> <span class="spp-share"> <div class="spp-share-options" style="display: none;"> <a class="spp-share-icon spp-twitter-btn" href="">share</a> <a class="spp-share-icon spp-fb-bt

node.js - Installing MEAN Stack: npm -v module.js: 338 throw err; Error: Cannot find module './cache/caching-client.js' -

i think have installed node.js before never used homebrew it. today tried walkthrough of application got stuck @ beginning. new programming utterly confused why can't work. i have tried lot of things can't seem find answer. these commands run in order install mean stack: ruby -e "$(curl -fssl https://raw.githubusercontent.com/homebrew/install/master/install)" (succesful no errors) brew install node (succesfull no errors) i check if node has installed typing: node -v v0.12.4 i check if npm installed typing: npm -v here error message: module.js:338 throw err; ^ error: cannot find module './cache/caching-client.js' @ function.module._resolvefilename (module.js:336:15) @ function.module._load (module.js:278:25) @ module.require (module.js:365:17) @ require (module.js:384:17) @ /usr/local/lib/node_modules/npm/lib/npm.js:22:24 @ object.<anonymous> (/usr/local/lib/node_modules/npm/lib/npm.js:466:3)

mongodb - Should I make a compound index for this query? -

say have collection 1 million documents ones below: { email: "test@test.com", survey: objectid('whatever'), taken: date(1/1/2015) }, { email: "blah@blah.com", survey: objectid('whatever'), taken: date(6/1/2015) } if going going execute query 1 below often: db.participants.find({survey: objectid('whatever')}).sort({taken: 1}) how important me include taken in index? typically record set go down 1 million 30 based on survey query , 30 records sorted. does still make sense index column though filtered set sorted smaller?

java - how to parse a custom log file in scala to extract some key value pairs using patterns -

i building spark streaming app takes in logs coming out of server. log line looks this. 2015-06-18t13:53:46.606-0400 customlog v4 info: source="abcd" type="type1" <xml xml here attr1='value1' attr2='value2' > </xml> <some more xml></> time ="232" i trying follow sample app written databricks on here here . i kind of stuck @ pattern in apacheaccesslog.scala. log custom log , has key="value" pairs in typical log line. i don't quite understand pattern means , how change suit app. need aggregation on times based on source , type keys in log the case class expects variety of things ip address log doesn't have, therefore need modify case class definition include fields want add. just illustrate here, let's make case class so: case class apacheaccesslog(source: string, type: string, time: long) then can replace regex 1 finds those, can play regex on regex101 here i've

javascript - dc.js: ReduceSum with multiple CSVs -

this follow-up stackoverflow problem creating charts multiple csvs single dc.js dashboard. i followed instructions , charts working. however, not working numberdisplay elements. i'm suspecting since i'm tabulating totals of 2 csvs, have adjust groupall.reducesum() function, i'm unsure how. example of code below //using queue.js load data var q = queue() .defer(d3.csv, "data1.csv") .defer(d3.csv, "data2.csv"); q.await(function(error, data1, data2){ //initiatizing crossfilter , ingesting data var ndx = crossfilter(); ndx.add(data1.map(function(d){ return { age: d.age, gender: d.gender, scores: +d.scores, total: +d.total, type: 'data1'}; })); ndx.add(data2.map(function(d){ return { age: d.age, gender: d.gender, scores: +d.scores, total: +d.total, type: 'data2'}; })); //initializing charts total

iframe - DoubleClick For Publishers (DFP) : Serving expandable ads using asynchronous GPT -

i'm using asynchronous gpt serve expandable ad, creative getting cut off because seems asynchronous tags not friendly iframes. i used dom function escape iframe parent, think can't because creative rendering before rendering of page. this sample of tags <script type='text/javascript' src='http://www.googletagservices.com/tag/js/gpt.js'> googletag.pubads().definepassback('6917646/h24info/h24info_atf_home_728x90', [[728,90]]).setclickurl('[insert_click_counter_here]').display(); googletag.pubads().enablesinglerequest(); googletag.pubads().addeventlistener('slotrenderended', function(event) { var sas = document.getelementbyid("sas_format_33008"); var gpt = document.getelementbyid("gpt_unit_6917646/h24info/h24info_atf_home_728x90_1_ad_container"); gpt.style.position = "absolute"; gpt.style.zindex = "100"; sas.style.height = "

html - Have images in 3 wrapper divs but need to view only one div at a time. too slow loading -

i have 3 sets of images in 3 separate divs hard coded webpage. 1 set viewed @ time user choice button. ok when there 5 images in each set added more, page loading slowly. pictures 1200 900 px because using nivo-slider allows sizing. there way load picture set clicked? <div class="slider-wrapper theme-default" id="wrapper1" > <div class="nivoslider" id="c1" > <img src="images/germany2008/germanytrip01.jpg" alt="" /> <img src="images/germany2008/germanytrip02.jpg" alt="" /> <!--etc. --> </div> </div> <div class="slider-wrapper theme-default" id="wrapper2" > <div class="nivoslider" id="c2"> <img src="images/germany2008/germanytrip01.jpg" alt="" /> <img src="images/germany2008/ger

Singleton in swift is not accessible from another class -

i new swift , trying access 'problemsolved' array appended during gameplay in main gamecontroller class, class. reason array not visible in uiviewcontroller class want show problems solved in table. have read many of singleton examples on site see if it, doesn't seem to. or advice here appreciated! class gamecontroller: tiledragdelegateprotocol, centerviewcontrollerdelegate { static let sharedinstance = gamecontroller() var problemssolved = array<string>() func onproblemsolved() { problemssolved.append(problem) println("problemssolved contains \(problemssolved)") } } during gameplay can see in console array being appended ok in gamecontroller. when try access in viewcontroller class contents showing empty []. class sidepanelviewcontroller: uiviewcontroller, uitableviewdatasource, uitableviewdelegate { @iboutlet weak var tableview: uitableview! override func viewdidload() { tableview.reloaddata() println("the array viewe

Is there a way to get true client's ip address in dns servers? -

as i'm aware of, when dns server gets request name translation, there high chance comes dns server delegating (intercepting) clients request. src ip not address of real client. there dns response, like, here cname domain, let client ask directly record of cname me or other solutions dns, ip of requesting client (not other recursion dns resolver) public dns highly appreciated thank you no, there nothing remotely that.

Is there an updated truth table for WiX custom action conditions? -

i trying custom actions working on install. this table using logic in wix (provided ahmd0) the problem doesn't seem working. here conditions currently: <custom action='removeservice' after='installinitialize'>installed</custom> <custom action='waitforfilelocks' after='installinitialize'>installed</custom> <custom action='installservice' before='installfinalize'>not remove ~= "all" or upgradingproductcode</custom> <custom action='mergeconfigfiles' before='installfinalize'>not remove ~= "all" or upgradingproductcode</custom> the behavior expect this: removeservice , waitforfilelocks should run on uninstalls , upgrades. installservice , mergeconfigfiles should run on installs , upgrades. the behavior seeing: removeservice , waitforfilelocks running on uninstall, not upgrades. installservice , mergeconfigfiles being run on instal

amazon web services - i/o timeout error using progrium/docker-consul -

i'm attempting set production-ready cluster on aws uses jeff lindsay's progrium/docker-consul image install consul on each host can't secondary , tertiary servers -join initial server. i've followed running real consul cluster in production instructions i'm getting i/o timeout error when consul2 , consul3 nodes attempt -join consul1 private ip. the instances i spun 3 t2.micros on aws , got following private ip's assigned in vpc: 172.31.4.194 (intended `consul1`, leader) 172.31.4.195 (intended `consul2`) 172.31.4.193 (intended `consul3`) starting initial consul server instance my consul1 node gets , waiting other 2 fine: sudo docker run -d -h consul1 --name consul1 -v /mnt:/data \ -p 172.31.4.194:8300:8300 \ -p 172.31.4.194:8301:8301 \ -p 172.31.4.194:8301:8301/udp \ -p 172.31.4.194:8302:8302 \ -p 172.31.4.194:8302:8302/udp \ -p 172.31.4.194:8400:8400 \ -p 172.31.4.194:8500:8500 \ -p 172.17.42.1:53

java - How to cause a ComboBox EventHandler to be triggered when programmatically selecting items? -

the combobox control has method called setonaction . method takes in eventhandler called described documentation: the combobox action, invoked whenever combobox value property changed. may due value property being programmatically changed, when user selects item in popup list or dialog, or, in case of editable comboboxes, may when user provides own input (be via textfield or other input mechanism. when stage first loads, don't want combobox default empty value, want automatically select first option in combobox (if has one). getselectionmodel() . selectfirst() methods change selection of combobox, reason not trigger eventhandler. however, eventhandler button calls exact same methods will cause eventhandler trigger. doing wrong? here brief test case shows behavior using jdk 8u40: import javafx.application.*; import javafx.stage.*; import javafx.scene.*; import javafx.scene.layout.*; import javafx.scene.control.*; public class test extends application {

sql server - insert data in a row with undefined values in each row -

i have table few columns name,stage1, stage2, stage3, stage4, stage5 . want insert values these columns, every time when new row being inserted table, number of stages entered under each row undefined example:- suppose in row 1 values stage1 , stage2 defined, , row 2 values stage1, stage2, stage3 , stage4 defined , on problem not able insert new row in table because of uneven distribution of values each name. you want use relational database unstructured data. assume because tagged sql server. this document dbs or nosql dbs designed for. however, can emulate if want storing data in single column. within column can store either json or xml. json going hard query, sql server support xml field type can query xpath. the other option rotate data 90 degrees. instead of each stage being column stage1, stage2, stage3.... create row each stage. each row have stagenumber field or such. later pivot data display stages columns in excel or other pivot table or whatever.

highcharts - RallyChart Pie - Is there a way to consolidate data labels? -

i'm wondering if there way consolidate data labels one. here's simple example context: if had pie chart labels "apple", "banana", "grapefruit", "broccoli", "lettuce"-- there way me group data associated "broccoli" , "lettuce" "vegetables" label? don't need reference "broccoli" , "lettuce" afterwards, need "vegetables" label aggregates them 1 label. any , great. thanks! here example of how combine defects "open" , "closed" categories based on state attribute has 4 allowedvalues: ext.define("mydefectcalculator", { extend: "rally.data.lookback.calculator.timeseriescalculator", getmetrics: function () { var metrics = [ { field: "state", as: "open", display: &qu

pChart - Is possible to combine a stacked bar chart and a regular bar chart? -

i'm trying use pchart create combo chart, using 3 series. 2 series stacked bar , remaining series bar chart. i'm trying achieve put stacked bar column regular bar on side (like total bar). there way achieve this? know pchart has option combo charts, seems works nice when combine different kinds of charts, bar , line example. when try combine similar graphs, bar , stacked bar, seem overwrite each other. pchart documentation isn't clear on subject (or i'm missing there). code: $mydata = new pdata(); $mydata->addpoints(array(0,97,149,167),"previous"); $mydata->addpoints(array(97,52,18,10),"current"); $mydata->addpoints(array(97,149,167,177),"total"); $mydata->setaxisname(0,"quantity"); $mydata->addpoints(array('1','2','3','4'),"period"); $mydata->setseriedescription("period","period"); $mydata->setabscissa("period"); $mydata->setabs

hadoop - Create an external table in HIVE with multiple sources -

i want create external table in hive takes input multiple databases. eg: want create bigtable (a,b,c,d,e,f) sources coming db1.table1(a,b) , db2.table2(c,d,e,f,a) also, bigtable has update when db1.table1 , db2.table2 updated. side notes: the source tables updated on daily basis. field "a" common field if want perform join on tables. suggestions open scenario there no common fields between sources. yes. think can create view on top of union of tables. create view veie_test select * union select * b ... on.

Extract multiple files from gzip in ruby -

actually have multiple .txt files in .gz file. extract .txt files .gz file... example: gz_extract = zlib::gzipreader.open("sample.gz") gz_extract.each |extract| print extract end the above code prints whatever present in .gz file want un-gzip .txt files. hope ppl understood question.... actually have multiple .txt files in .gz file. extract .txt files .gz file. gzip cannot contain multiple files together. works 1 file. if want compress multiple files, first need tar them together, , gzip resulting .tar file, not appear case file using. if can read contents of sample.gz code provided, further proof have 1 file inside. can try gunzip sample.gz command-line again prove contains 1 file. edit: if want code output uncompressed .txt file: output_file = file.open('sample.txt', 'w') gz_extract = zlib::gzipreader.open("sample.gz") gz_extract.each_line |extract| output_file.write(extract) end output_file.close

performance - Clustering a large, very sparse, binary matrix in R -

i have large, sparse binary matrix (roughly 39,000 x 14,000; rows have single "1" entry). i'd cluster similar rows together, initial plan takes long complete: d <- dist(inputmatrix, method="binary") hc <- hclust(d, method="complete") the first step doesn't finish, i'm not sure how second step fare. approaches efficiently grouping similar rows of large, sparse, binary matrix in r? i've written rcpp code , r code works out binary/jaccard distance of binary matrix approx. 80x faster dist(x, method = "binary") . converts input matrix raw matrix transpose of input (so bit patterns in correct order internally). used in c++ code handles data 64 bit unsigned integers speed. jaccard distance of 2 vectors x , y equal x ^ y / (x | y) ^ xor operator. hamming weight calculation used count number of bits set if result of xor or or non-zero. i've put code on github @ https://github.com/niknakk/binarydist/ , rep

Given a table whose headers have backgrounds, can you CSS-rotate only the text in the headers? -

Image
here's jsfiddle has a simple table internal cms: <table class="rotated-text"> <thead> <tr> <th>property</th> <th>san francisco, ca</th> <th>new york, ny</th> <th>washington, dc</th> <th>charlottesville, va</th> </tr> </thead> <tbody> <tr> <td>days of sunshine</td> <td>260</td> <td>200</td> <td>210</td> <td>220</td> </tr> </tbody> </table> i'd rotate text in first element 45 degrees counterclockwise, without bringing along background. i'm hoping can without changing html -- applying css. result should similar this: is possible? the closest come dispense borders , border-spacing in table. giving borders style need may unattainable. lines between th s simulated underline. .rotate

python - Adding Columns to Existing Schema -

i getting started django (1.8) , bit confused how modify models. if go in , add new field existing model, start getting "no such column" error. far, i've been wiping db , starting over, gets annoying, there process this? what happens when go production? how modify schema @ point? resources see online south, guess built version of django, still can't find solid info. thanks in django 1.7+ there no need of south .only python manage.py makemigrations python manage.py migrate if you're changing on existing app made in django 1.7-, need 1 pre-step (as found out) listed in documentation: python manage.py makemigrations your_app_label also try this class mymodel(models.model): myfiled = models.charfield() # ... class meta: managed = true

javascript - Form submit not working after second attempt in jquery ajax -

i have form in project submitted jquery ajax. the data validated on server side , if data invalid load form validation errors , append html div. on next form submission attempt, directly redirected form action url i.e event.preventdefault() not working. initformsubmit: function () { var form = $('form#forum'); $(document).on('submit', form, function (event) { event.preventdefault(); if ($(this).attr('name')) { form.append( $("<input type='hidden'>").attr({ name: $(this).attr('name'), value: $(this).attr('value')}) ); } var formdata = form.serialize(); $.ajax({ type: form.attr('method'),

c++ - How can I make this function run more than once? -

let me first note absolute beginner c++. please, go easy on me. i've been writing code below part of assignment programming methodology course summer. it's meant bank program takes user input calculate number of months (n), interest rate (i) , monthly payment user's loan. then, program supposed take payment amount user , calculate new balance. here, supposed print amortization report delineates beginning balance, interest paid, principle paid, , ending balance. of works well, next part having trouble with. program supposed able take multiple payments , add additional lines amortization report, , cannot figure out how run make payment function second time additional payments. help, please!! also, know parameters set member functions needless, replaced user input, they're required instructor in assignment instructions. thanks again advice can give! #ifndef loan_data_h #define loan_data_h class loan_data { private: double bal; double n; double i

HTML Form javascript sum total taxes -

Image
i have nice working form , working. need total taxes calculated , autofilled. here code: <table class="tableventa"> <tr> <td style="width:200px;"></td> <td valign="top" style="width:900px;"><table class="table900"> <tr> <td class="header150">default unit price</td> <td class="header150">type of sell</td> <td class="header150">apply taxes?</td> <td class="header150">apply discount?</td> <td class="header150">quantity</td> </tr> <tr> <td class="header150small"><input type="text" class="input140" name="neto" id="neto" readonly value="1000"></td> <td class="header150small"> <select cla

css - Bootstrap shows black rectangles when printing focused input elements -

Image
if input element focused, chrome of time print black square. if same element not focused, always fine. focused element / print preview unfocused element / print preview i tried removing/resetting css styles on element, nothing works, , i'm not sure how fix this. can help? ** edit ** the following snippet reproduces problem; run , press ctrl+p. of time, should black rectangle if either field selected. <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <form class="form"> <div class="form-group"> <label for="exampleinputemail1">email address</label> <input type="email" clas

Hide controls and disable right click on HTML5 video on Safari -

i'm working on project includes video tag. users can full screen video. i'm disabling right click following code: document.oncontextmenu = document.body.oncontextmenu = function () { return false; }; in full screen mode, right click disabled on chrome , firefox on safari still right click menu (in full screen mode). how can solve this? i need disable controls on in full screen mode. following code chrome , firefox not safari. suggestions please? video::-webkit-media-controls-enclosure { display: none !important; }

jquery - How to format Qualtrics embedded data on a per-input basis? -

what i'm trying accomplish grab embedded data, , output in specific way (color, position, etc.). instance, put embedded data <div class="previous">$e://field/dtbeg}</div> in question text, want grab , insert directly under input field (something don't think can directly in qualtrics, custom js needed here). so in question text, have: <div>1a. reporting period: beginning</div> <div class="previous date">${e://field/dtbeg}</div> where dtbeg data may empty, or may 5/6 digits representing date. header of survey has: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script> var $j = jquery.noconflict(); </script> as explained in documentation . so in jquery can access field's previous data $j(".previous") , issue qualtrics puts 2 (or more, depending on question type) <div class="previous date"></div>

angularjs - Access parent controller from the child state -

i have controller in angluarjs defined so: 'use strict'; var app = angular.module('app'); app.controller('appctrl', ['sth', function (sth) { this.inverse = false; } ]); here routes deffinition: $stateprovider. state('app', { abstract: true, templateurl: 'app/views/layout.html', controller: 'appctrl', controlleras: 'app', resolve: {} }). state('app.settings', { abstract: true, url: '/settings', template: '<ui-view/>', onenter: function () { } }); how access inverse variable appctrl in app.settings route? if want share data between 2 controllers, service/factory best bet. below example of how it. have written free-hand, there may syntax errors, idea. app.controller('appctrl', ['sth', 'shareddata', function (sth, shareddata) { shareddata.inverse = false; } ]); app.factory(