Posts

Showing posts from March, 2010

python - How to remove the Xframe Options header in django? -

i have made page has iframe . inside iframe want show multiple different links article facebook, or news, or youtube video or other possible url. but, due xframe header, unable so. referred following link: https://docs.djangoproject.com/en/1.8/ref/clickjacking/ , django xframeoptionsmiddleware (x-frame-options) - allow iframe client ip but didn't help. my settings.py file's middleware_classes is: middleware_classes = ( 'django.contrib.sessions.middleware.sessionmiddleware', 'django.middleware.common.commonmiddleware', 'django.middleware.csrf.csrfviewmiddleware', 'django.contrib.auth.middleware.authenticationmiddleware', 'django.contrib.auth.middleware.sessionauthenticationmiddleware', 'django.contrib.messages.middleware.messagemiddleware', 'django.middleware.clickjacking.xframeoptionsmiddleware', ) from http://django-secure.readthedocs.org/en/latest/middleware.html , found using

excel - Find all duplicate values in one column and combine all its values -

Image
so got excel file lot of data why want avoid doing manually. want find values same in 1 column , combine it's values 1 row. if have data in worksheet. i output this i appreciate can get. edit: this pivot table when want this. you must use pivot table function (i recommend it) ms excel. it lets set wich columns becomes rows, type of values contain , more. pivot tables want. it saved career @ previous job :) here got screenshot of example making sums duplicates in first column: original table:

ios - UIImageView+AFNetworking maxConcurrentOperationCount -

this awesome uiimageview extension has af_sharedimagerequestoperationqueue , max concurrent number set _af_sharedimagerequestoperationqueue.maxconcurrentoperationcount = nsoperationqueuedefaultmaxconcurrentoperationcount; how access private field , set custom value maxconcurrentoperationcount ? (i don't want edit files under cocoapods directly) upd: generatorofone, looks best solution me. however, decided use sdwebimage, because provides cache out of box , allows set maxconcurrentoperationcount in line of code. this private method has static nsoperationqueue. either go , poke code directly not change existing code librarues. suggest create new uiimageview category, expose method , set maxconcurrentoperationcount on it. like, @interface uiimageview(myextension) + (nsoperationqueue *)af_sharedimagerequestoperationqueue; @end @implementation uiimageview(myextension) + (void)load { nsoperationqueue *queue = [self af_sharedimagerequestoperationqueue];

Convert Javascript code, that changes DOM element's background color, to JQuery -

i new in jquery , still learning. problem don't know how convert following javascript code jquery. javacript: document.getelementsbyclassname('p-bg')[0].style.backgroundcolor = '#'+this.color thanks in advance guys. by way full code: <input class="color" onchange="document.getelementsbyclassname('p-bg')[0].style.backgroundcolor = '#'+this.color"> thanks again $(".color") jquery class selector .change .change() form events .eq() .eq() filter elements .css() .css() manipulation $(".color").change(function(){ $(".p-bg").eq(0).css("background-color", $(this).css("color")); }) note document.getelementsbyclassname('p-bg')[0] in jquery equivalent $(".p-bg").eq(0) remember in jquery , dom must loaded start working, eg: $(document).ready(function(){ //you jquery code here... })

selenium - how to write below xpath in java -

//div[@ng-if="subnav.state == 'active'"] i tried below getting "invalidselectorexception" : string active = "subnav.state == 'active'"; driver.findelement(by.xpath("//div[@ng-if='"+active+"']")) <li class="active" on="subnav.state != '' && subnav.state != 'active'" ng-switch="" ng-repeat="subnav in navigation[activenav].pages | filter:subnavfilter(navigation[activenav].pages)"> <div class="whereabouts ng-scope" ng-if="subnav.state == 'active'"></div> <span class="badge badge-active" aria-disabled="true" ng-if="subnav.state != 'complete'">6</span> <span class="ng-binding ng-scope" ng-switch-when="false">loan</span> </li> if there quotes used inside value should escape quotes.and sugge

deserialize json response to c# -

i not able deserialize following response : json json { "disclaimer": "exchange rates/", "license": "data sourced various providers", "timestamp": 1435813262, "base": "usd", "rates": { "aed": 3.672973, "afn": 60.150001, "all": 126.7792, "amd": 472.46, "ang": 1.78875, "aoa": 121.253666, "ars": 9.095239, "aud": 1.307011, "awg": 1.793333, "azn": 1.04955, } } controller : [httppost] public actionresult index(test1 values) { string appid = values.apikey; httpwebrequest request = (httpwebrequest)webrequest.create("https://openexchangerates.org//api/latest.json?app_id=5db2fa81c8174a839756eb4d5a4a5e05"); request.method = "post"; using (streamwriter streamwriter = new streamwriter(request.getrequeststream(), asciiencodin

javascript - Remove html element from a page loaded as ajax response into div -

i trying remove link(i want make button please in too) id=regbutton index.jsp page loaded response on clicking login button on regdata.jsp page regdata.jsp <script> $(document).ready(function(){ $("button").click(function(){ $("#maindiv").load("index.jsp"); $('#regbutton').remove(); }); }); </script> </head> <body> <div id="maindiv" class="units-row"> <h2>thanks registering!</h2> <button id="reglogin">login now</button> </div> index.jsp <body> <center> <s:actionerror /> <h1 id="login_title"></h1> <form action="checklogin.action" method="post"> <p> <input type="text" id="username" name="username" placeholder=&qu

mongodb - How to create a website with a searchbar to query a mongo database? -

i have large mongodb database set , trying create website user can use searchbar query database remotely , have results posted on site (strictly read-only). i have experience databases data analysis, have never created website querying results. i'm don't have experience web development , don't know platforms (php? node.js?) use. thanks in advance. there following steps problem: create front-end, consist of html, css, , javascript. beginners find easiest work jquery , jquery ui, because well-documented , contain plugins possible scenarios (they should not, however, used create large complex applications!). bootstrap or foundation can html / css. create (probably) json api, front-end can communicate submit searches , retrieve results. use php, python, ruby, or many other languages this. simple site 1 you're describing, it's more matter of preference else. translate search request front-end mongodb query apis, , return results through api. use m

sqlite - How to make an pdo_sqlite connection from binary stream in PHP -

having .sqlite file in memory stream (php://memory), want pipe pdo_sqlite driver create connection. possible? its testing purposes, want recreate dbs without recreate schema @ each time nor using tmpfs. in memory sqlite has limitations. memory space request, session, no way seems documented share base in memory among users. for request, open base code $pdo = new pdo( 'sqlite::memory:'); and base disapear on next request. for session persistency <?php $pdo = new pdo( 'sqlite::memory:', null, null, array(pdo::attr_persistent => true) ); ?> also read manual

Google search based on country -

i using google chrome , google search engine default. current location india . when search anything, gives me result india . that's great. now, want have searched result country e.g. uae . should make change result uae or other country. there's artile here: http://www.entrepreneurs-journey.com/322/how-to-search-google-as-a-local-in-any-country/ you can change query parameter 'gl' value desired country result country. example ... this show results japan https://www.google.com/search?q=kangaroo&gws_rd=ssl&gl=jp and show results us https://www.google.com/search?q=kangaroo&gws_rd=ssl&gl=us hope clears.

ios - iPhone Simulator stucks on launchscreen. Struct issues in Objective-C? -

this first time using struct in objective-c , can't figure out i'd go wrong. let's me explain better: in "appdata" class have created struct. instance let's suppose containing information market products. // struct declaration typedef struct { int apple; int banana; int cherry; } products; // variable declaration @property (assign, nonatomic) products products; the first thing app on startup check if keys exist inside nsuserdefault, update products (in order easy access values). way try achieve step: + (void)update { nsuserdefaults *defaultuser = [nsuserdefaults standarduserdefaults]; products updatedproducts; if ([defaultuser objectforkey:@"apple"] != nil) updatedproducts.apple = [[defaultuser objectforkey:@"apple"] intvalue]; if ([defaultuser objectforkey:@"banana"] != nil) updatedproducts.banana = [[defaultuser objectforkey:@"banana"] intvalue]; if ([de

c# - How to get Credit Card Memo data from Netsuite TransactionSearchAdvanced? -

i'm newbie netsuite's api. i'm trying credit memo data (invoice or vendor payment also) transactionsearchadvanced. here code : public void getcreditlist() { transactionsearchadvanced tsa = new transactionsearchadvanced(); tsa.columns = new transactionsearchrow(); tsa.columns.basic = new transactionsearchrowbasic(); tsa.columns.basic.tranid = new searchcolumnstringfield[] { new searchcolumnstringfield() }; tsa.criteria = new transactionsearch(); tsa.criteria.basic = new transactionsearchbasic(); tsa.criteria.basic.mainline = new searchbooleanfield(); tsa.criteria.basic.mainline.searchvalue = true; tsa.criteria.basic.mainline.searchvaluespecified = true; tsa.criteria.basic.type = new searchenummultiselectfield(); tsa.criteria.basic.type.@operator = searchenummultiselectfieldoperator.anyof; tsa.criteria.basic.type.operatorspecified = true; tsa.criteria.ba

arrays - How to convert from Jama Matrix object to double[][] - Java -

i have object matrix package jama , stored double[][] array. want return values of method matrix.inverse(). how can pass values matrix object double[][] array? double k[][] = {{1,5,3,4} , {1,10,4,3} , {1,40,232,4} , {32,434,23,5}}; matrix getinverse = new matrix(k); double returnvalues[][] = getinverse.inverse(); // ---?---- it's hard know how answer without knowing more matrix class itself. best approach to write todoublearray() method in matrix class, operate in way similar how toarray() method words classes implement list (which return object[] ). it might simple returning internal double[][] stored in matrix instance. since edit clarified using jama class, can this: double returnvalues[][] = getinverse.inverse().getarray(); since not keeping reference inverse matrix object, safe. in general, though, safe should not access internal array directly , instead use getarraycopy() instead of getarray() .

Graphs in Android: aChartEngine vs GraphView -

i developing app health gadget , point need able draw graphs. data continuously received via bluetooth , graph should similar cardiograph 1 continuous smooth update when new data received. found 2 libraries tackle issue (achartengine , graphview). please suggest difference between them , when use each of them? here quick summary of 3 libraries have tested draw real-time graphs. graphview http://www.android-graphview.org/ pros: great showing , updating multiple graphs in 1 view (tested 12 graphs). great documentation. works fine single graph in view. cons : limited styling options. y-axis neither scalable not scrollable. difficult have x-axis time (hh:mm:ss:sss) updated real-time mpandroidchart https://github.com/philjay/mpandroidchart pros: great styling options. easy implement on tap listener. real-time update supported. scalable , scrollable in directions. best use single graph in view. pretty documentation. cons: slower , consumer more memory graphview.

MYSQL SQL syntax error c# -

Image
i have error in sql statement. query: mysqlcommand cmd = new mysqlcommand("insert bills (bill_number,bill_date,bill_from,bill_note,bill_taxrate,bill_disrate,bill_entrydate,cus_sup,by,archived) values(" + txbbillnumber.text + ",'" + datetime.parse(txbbilldate.text).year + "-" + datetime.parse(txbbilldate.text).month + "-" + datetime.parse(txbbilldate.text).day + "'," + sup_id + ",'" + txb_note.text + "'," + taxrate + "," + disrate + ",'" + datetime.now.year + "-" + datetime.now.month + "-" + datetime.now.day + "'," + bills.cus_sup + ",0,0)", objconn); cmd.executenonquery(); and in image error , bills table structure: one problem word by use column reserved keyword (both in mysql , sql standard in general). use have enclose in backticks `` or double-quotes " ". also, string values

Remove coefficients from lm output in R -

i remove of as.factor elements output of ordinary least squares lm() model in r. last line doesn't work, example: frame <- data.frame(y = rnorm(100), x= rnorm(100), block = sample(c("a", "b", "c", "d"), 100, replace = true)) mod <- lm(y ~ x + as.factor(block), data = frame) summary(mod) summary(mod)$coefficients[3:5,] <- null is there way remove of these elements saved `lm' object no longer has them? thanks. one option use felm function in lfe package. as stated in package: the package intended linear models multiple group fixed effects, i.e. 2 or more factors large number of levels. performs similar functions lm , uses special method projecting out multiple group fixed effects normal equations, hence faster. set.seed(123) frame <- data.frame(y = rnorm(100), x= rnorm(100), block = sample(c("a", "b", "c", "d"), 100, replace = true)) id<-as.factor(frame$block)

java - SLF4J: Class path contains multiple SLF4J bindings. multiple logback-classic jars -

i bulding , run spring web app using gradle. there multiple bindings. reading existing posts, found lots of similar problems. have 2 problems. (1) can not find conflict depencies. (2) not fimilar gradle syntaxt. tried lots of methods. still confused. welcome. thanks. here error: slf4j: class path contains multiple slf4j bindings. slf4j: found bindings in [jar:file:/c:/myproject/gradle-2.3-all/gradle-2.3/lib/logback-classic-1.0.13.jar!/org/slf4j/impl/statloggerbinder.class] slf4j: found bindings in [jar:file:/c:/myproject/myproject/build/temp/tomcatrunwar/work/tomcat/localhost/myproject/web-inf/lib/logback-classic-1.1.2.jar!/org/slf4j/impl/statloggerbinder.class] slf4j: actual binding of type [ch.qos.logback.classic.util.contextselectorstaticbinder] below depencies: buildscript { repositories { maven { url "http://repo.spring.io/libs-release" } mavenlocal() } dependencies { classpath("org.springframework.boot:spring-boot-gradle

Android REST Client: best solution? -

i need create application dialogues rest server. i found answer: android rest client, sample? it's of 2012. is there tutorial can follow (and suggest) in order obtain little working sample project? in advance. all need here. https://square.github.io/retrofit/ easy use , dont have care json deserialization

android - Centered textview does not appear in RelativeLayout -

i have textview, need centered horizontally , vertically inside square. this, have put inside relativelayout: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="match_parent" android:layout_width="match_parent" android:background="#fff" > <textview android:id="@+id/centered_text_view_text" android:layout_centerinparent="true" android:text="test" android:background="#00ff00" android:textcolor="#000" android:textsize="16dp" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </relativelayout> i instantiate relativelayout layoutinflater , call layout method on relativelayout position need it. layoutinflate

c - fread() is not returning successfully -

im following tutorial http://c.learncodethehardway.org/book/ex17.html , "learning c hard way", there seems bug function called database_load : void database_load(struct connection *conn) { int rc = fread(conn->db, sizeof(struct database), 1, conn->file); if(rc != 1) die("failed load database."); } the function returns "failed load database.". i tried using debugger, , looked @ fread() docs, i'm unable figure why function returning successfully. i rewrote function print out tests sanity check: void database_load(struct connection *conn) { printf("database_load(struct connection *conn)\n"); if (conn!=0) { printf("conn not null\n"); if (conn->file!=0) { printf("conn->file not null\n"); }//file not null }//end conn not null //actual read filesystem int rc = fread(conn->db, sizeof(struct database), 1, conn->file);

php - get 'returning' value from postgres update query in code igniter -

so have query following (actually more complicated not important question, deleted some) 'return' value. the query works fine in sql: $sql = "update user_authentication set failed_login_attempts = failed_login_attempts + 1, returning failed_login_attempts"; but in codeigniter returns boolean instead of integer. should happen codeigniter's result() function, it's not bug or anything, wondering if there work-around return value update statement. know can second query... when user $query->result(); you chain cte : with upd (update user_authentication set failed_login_attempts = failed_login_attempts + 1 returning failed_login_attempts ) select * upd;

c# - how to change listBox item font colour from code behind -

i have tried access listbox items properties this: mylistbox.items[0] and set foreground property unknow me reason cant access way. can using code behind - , if yes - how? implement itemtemplate , bind brush foreground property. you should implement inotifypropertychanged in binding object , notify on mycolorbrush value change. <listbox itemssource="{binding myitems}"> <listbox.itemtemplate> <datatemplate> <textblock text="{binding mytext}" foreground="{binding mycolorbrush}"/> </datatemplate> </listbox.itemtemplate> </listbox>

Flattening multidimensional arrays in javascript -

i need flatten multidimensional arrays code flattens 1 array , stops. wrong? how transfer elements no arrays. function flatten(arr) { // i'm steamroller, baby arr.reduce(function (flat, toflatten) { return flat.concat(array.isarray(toflatten) ? flatten(toflatten) : toflatten); },[]); } flatten([[['a']], [['b']]]); assert.deepequal(flatten([[['a']], [['b']]]), ['a', 'b'], 'should flatten nested arrays'); should flatten nested arrays: expected [ [ 'a' ], [ 'b' ] ] equal [ 'a', 'b' ] you're doing right -- missing return statement. function flatten(arr) { // i'm steamroller, baby return arr.reduce(function (flat, toflatten) { return flat.concat(array.isarray(toflatten) ? flatten(toflatten) : toflatten); }, []); } console.log(flatten([[['a']], [['b']]]));

How to export R plots as TEX files? -

let's have simple plot this: mu = matrix(c(0,0),2,1) sigma = matrix(c(1,0,0,1),2,2) x = mvrnorm(1000, mu, sigma) plot(x,pch=20,panel.first = grid(10, lty = 2, lwd = 2)) how can export plot .tex file fromat? mean direct output tex , don't want use tikz. here how in gnuplot set terminal latex set output "eg2.tex" set size 5/5., 4/3. set format xy "$%g$" set title ’this plot of $y=\sin(x)$’ set xlabel ’this $x$ axis’ set ylabel ’this is\\the\\$y$ axis’ plot [0:6.28] [0:1] sin(x) and include tex file in tex document. i may making mistake out put of above gnuplot following: % gnuplot: latex picture \setlength{\unitlength}{0.240900pt} \ifx\plotpoint\undefined\newsavebox{\plotpoint}\fi \sbox{\plotpoint}{\rule[-0.200pt]{0.400pt}{0.400pt}}% \begin{picture}(1500,900)(0,0) \sbox{\plotpoint}{\rule[-0.200pt]{0.400pt}{0.400pt}}% \put(110.0,82.0){\rule[-0.200pt]{4.818pt}{0.400pt}} \put(90,82){\makebox(0,0)[r]{$0$}} \put(1419.0,82.0){\rule[-0.200

html - Trying to fix gaps in between vertically aligned divs -

i trying align divs there 6 ontop of eachover, spreading across whole height of page, text centered inside. example here: http://gyazo.com/871760197e572bd35d79ac3be63d9869 now nothing have worked far works, , extends page. have made div (to change text in of these boxes) surrounds them, , has value of height: 100vh; . reason, there appear gaps in between divs. have stripped code down have portfolio div, still has gap above it. here code: <!doctype html> <html> <head> <meta charset="utf-8"> <style> body { margin: 0; padding: 0; top: 0; } { padding: 0; margin: 0; text-decoration: none; color: black; } .navigation-bar { float: left; width: 350px; font-size: 40px; height: 100vh; text-align: center; } .portfolio { background-color: #909090; height: 16%; line-height: 16%; } .twitter { background-color: #a0a0a0; height: 16%; } .git-hub { backgroun

angularjs - Console error, not sure way -

i getting error.. not sure what's problem.. typeerror: statisticsservice.getstatisticsfromserver not function i cant seem see problem, not sure i'm doing wrong this controller app.controller('statisticsctrl', ['$scope', '$auth', 'statisticsservice', function ($scope, $auth, statisticsservice) { var token = $auth.gettoken(); console.log('statisticsctrl init'); function run() { var data = { token: token, timestamp_from: moment(new date()).unix()-30 * 24 * 3600, timestamp_till: moment(new date()).unix(), order: 'duration_minutes', limit: 20 }; // statisticsservice.getstatisticsfromserver(data).then(function (response) {

javascript - Migrating EventEmitter to ES6 -

i'm getting error gettoken undefined when called below , after transpiling gulp-babel. moving constructor bottom of class not either. can advise? i think has util inheriting, may trying take es5 code , apply area es6 things differently? var events = require('events'); var util = require('util'); class report { constructor(private_key, service_email, debug) { this.private_key = private_key; this.service_email = service_email; this.debug = debug || false; events.eventemitter.call(this); this.gettoken( (err, token) => { if (err) throw err; return this.emit('ready'); }); } gettoken(cb) { ... } } util.inherits(report, events.eventemitter); module.exports = report; judging call events.eventemitter in constructor, using this: require('util').inherits(report, events.eventemitter); this breaks report class (not sure why, can reprodu

R Inserting a Dataframe/List into a Dataframe Element -

i'd insert dataframe dataframe element, such if called: df1[1,1] get: [a b] [c d] i thought possible in r perhaps mistaken. in project of mine, working 50x50 matrix, i'd each element contain column of data containing numbers , labeled rows. trying df1[1,1] <- df2 yields following warning warning message: in [<-.data.frame ( *tmp* , i, j, value = list(djn.10 = c(0, 3, : replacement element 1 has 144 rows replace 1 rows and calling df1[1,1] yields 0 . i've tried inserting data in various ways, as.vector() , as.list() no success. best, perhaps matrix work you, so: x <- matrix(list(), nrow=2, ncol=3) print(x) # [,1] [,2] [,3] #[1,] null null null #[2,] null null null x[[1,1]] <- data.frame(a=c("a","c"), b=c("b","d")) x[[1,2]] <- data.frame(c=2:3) x[[2,3]] <- data.frame(x=1, y=2:4) x[[2,1]] <- list(1,2,3,5) x[[1,3]] <- list("a","b","c",&q

security - odoo[v8] rules for groups -

i have boolean field 'classified' on sale order , idea users in group created 'classified quotations' can see records on tree view in classified true . created 2 rules , have no idea why doesn't work. here code: <?xml version="1.0" encoding="utf-8"?> <openerp> <data> <record id="sale_order_rule_group_classified_quotations" model="ir.rule"> <field name="name">sale_order_rule_group_classified_quotations</field> <field name="model_id" search="[('model','=','sale.order')]" model="ir.model"/> <field name="groups" eval="[(4,ref('group_classified_quotations'))]"/> <field name="domain_force">['|',('classified','=',true),('classified','=',false)]</field> </record>

java - Swagger ui - Query param -

i using swagger ui , swagger core (1.3) jersey application. have query parameters must send every request post, get, delete... how can default ? you can use annotation @apiparam swagger annotations in order configure query param used swagger-ui. for example @path("/{username}") @apioperation(value = "updated user") public response updateuser( @apiparam(value = "description query-parameter") @queryparam("username") string username ) { ... } please, read more annotation in following official documentation: https://github.com/swagger-api/swagger-core/wiki/annotations#apiparam

javascript - Get UTC time for different timezone in mysql format -

with dateobj.toisostring().slice(0, 19).replace('t', ' ') can convert date object mysql datetime format in javascript. timezone considered client's (browser's) timezone. i want convert date , time of different time-zones (not browser's timezone) utc time , mysql time format. eg: alice scheduling meeting in new-york sydney. alice enters new-york time input. thought browser's location sydney, javascript code has assume browser's location in new-york , convert date time utc, mysql format. i can current new-york time with, dateobj.tolocalestring('en-us', { timezone: 'america/new_york'}) . not sure next. seems considering time differences... anybody knows how this? so want store date in utc representation of event occurred. to save: know alice has time zone set specific value, therefore, need convert alice's time zone utc. if alice entered 11:59:59 pm meeting time time stored when occurred in gmt, +4/5 hours de

c# - Color Dialog Displays behind browser -

i created asp.net web forms application , when click on button display color dialog works correctly on first click. subsequent clicks dialog box displays behind browser. noticed posts people had placed color dialog on form. i'm not sure why, color dialog no in toolbox. looking forward answer see id-10-t mistake. thanks! protected void button1_click(object sender, eventargs e) { colordialog colordialog = new colordialog(); colordialog.anycolor = true; colordialog.allowfullopen = false; if (colordialog.showdialog() == dialogresult.ok) { string str = null; str = colordialog.color.name; if (str.substring(0, 2) == "ff") { str = "#" + str.substring(2); } //messagebox.show(str); lblto.forecolor = system.drawing.colortranslator.fromhtml(str); lblfrom.forecolor = system.drawing.colortranslator.fromhtml

angular ui router - Resolve data not being found in controller AngularJS -

suppose have 1 route: angular.module('liveapp', ['ui.router', 'liveapp.main', 'liveapp.artist', 'liveapp.signup', 'liveapp.factory', 'liveapp.review' ]) .config(function($urlrouterprovider, $stateprovider) { $stateprovider.state("home", { url:"/", templateurl : '/home.html', controller : 'mainctrl', resolve: { artists: function () { console.log('resolved') return "i want in controller"; } } }) }) prior instantiation of mainctrl want function bound artists run. in controller have following setup: angular.module('liveapp.main&#

android - Gradle build time too slow -

Image
i have android project has around 15 modules each of them separate github project, of modules have interdependencies, sample client library has 14 components(modules). every time make single change , re build/run takes takes 1 min 40 seconds on i7 28gb ram i have tried many things improve build time, including tips in article,but have not seen significant change. https://medium.com/@erikhellman/boosting-the-performance-for-gradle-in-your-android-projects-6d5f9e4580b6 it looks goes through modules , see if date, takes time, compiling , dexing. does 1 have idea on how improve this? i using gradle plugin 1.2.3, buildtools 22.0.1 , taskwrapper 2.4 i suffering same problem before google announced in there last i/o there big improvement in performance in gradle , android studio in common. but me single trick helps me lot , reduce time more 50%. make gradle run offline.

html - How to center a row with text and inputs -

i have row text , input text fields , want text above text feild , wanted centered. should make div , center that? or center each row individually? help? here code: <div class="modal-body"> <!-- test new content area --> <div class="row"> <div class="col-sm-4"> <h6 class="section-header">username*</h6> <input align="middle" class="form-control no-glow" type="text" id="assignment-name" ng-model="assignment.name" ng-required="true"> </div> </div> <div class="row"> <div class="col-sm-4"> <h6 class="section-header">firstname*</h6> <input class="form-control no-glow" type="text" id="assignment-name" ng-model="assignment.name" ng-required="true"> </div&

excel - Join function not working for horizontal ranges? -

i'm want convert range string custom delimiter join function, while worked vertical range haven't been able horizontal one. worked column/vertical range: join(application.transpose(workbooks("book3").sheets(1).range("a1:a5").value), ";") now when try same horizontal range error "invalid procedure call or argument" join(application.transpose(workbooks("book3").sheets(1).range("a1:d1").value), ";") join(workbooks("book3").sheets(1).range("a1:d1").value, ";") how can done? join(application.transpose(application.transpose( _ workbooks("book3").sheets(1).range("a1:d1").value)), ";")

tomcat - Session handling in grails app -

i'm doing simple login follows def login() { session.auth = true redirect(uri: request.getheader('referer')) } <g:form controller="login" action="login"> <input type="password" placeholder="password" name="password"> <button type="submit">submit</button> </g:form> when submitting user gets logged in session created if page refreshed authentication lost (when deployed tomcat 7). now test seems fail after page refresh <g:if test="${session.auth}"> everything works fine when builing eclipse breaks down in tomcat. does know how can fix this? prefer not add additional security plugins app. can done cookies or other way? related issue grails 2.1.0 app tomcat 7.0.22 session empty after redirect *i know it's not secure in way, temporary solution mimic logging.

java - How to download GZip file from S3? -

i have looked @ both aws s3 java sdk - download file help , working zip , gzip files in java . while provide ways download , deal files s3 , gzipped files respectively, these not in dealing gzipped file located in s3. how this? currently have: try { amazons3 s3client = new amazons3client( new profilecredentialsprovider()); string url = downloadurl.getprimitivejavaobject(arg0[0].get()); s3object fileobj = s3client.getobject(getbucket(url), getfile(url)); bufferedreader filein = new bufferedreader(new inputstreamreader( fileobj.getobjectcontent())); string filecontent = ""; string line = filein.readline(); while (line != null){ filecontent += line + "\n"; line = filein.readline(); } fileobj.close(); return filecontent; } catch (ioexception e) { e.printstacktrace(); return "error ioexception"; } clearly, not handling compressed nature of file, , output is: �

checking kafka data if compressed -

the document said add line compression.codec=gzip in producer.properties make message compressed. when open data file such as: 0000000000000.log found data not compressed. how should check whether data in kafka compressed already? p.s: every testing stop kafka cluster , zookeeper , deleted of data in kafka-logs , zookeeper,then start server again , create new topic. the java producerconfig class has changed config. public static final string compression_type_config = "compression.type"; i've produced messages java client ( 0.8.2.1 ) using producerconfig.compression_type_config , works fine. example: props.put(producerconfig.compression_type_config, "gzip"); or set compression.type=gzip in server.properties file java client. update cli tool read usage command line tools: chrisblack:kafka:% ./bin/kafka-console-producer.sh ... --compression-codec [compression-codec] compression codec: either 'none',

mysql - Opencart database user issue -

i have problem installing opencart. when point need type in name , user database, error: "access denied user 'slo114_agp'@'(the ip of domain)' (using password: yes)". 100% sure using right password database user, have given rights user. hosting using hostgator , uploaded files via filezilla. not sure put in hostname, since tested opencart locally using localhost, here put in domain. thank help. have flush hosts after creating user. setting example creating user on host 192.168.10.193 , access it. setting % in host in syntax, can set host wants login. testing purpose, first check it works fine replace host required host. mysql> create user bob@'%' identified 'test'; query ok, 0 rows affected (0.00 sec) mysql> flush hosts; query ok, 0 rows affected (0.00 sec) mysql> flush privileges; query ok, 0 rows affected (0.00 sec) mysql> exit bye now access mysql server user remotely. hiteshmundra@smart:~$ mysql -ubob -ptes

windows 7 - Initial Ubuntu guest screen resolution on VMWare -

windows 7 (host) vmware workstation 11. kubuntu 15.04 guest. problem: after system startup, in example, on login screen - screen size/resolution 800x600. ba, earlier - during startup when console active. making window fullscreen isn't helping, console output limits small window in middle. setting vmware window fullscreen helps little - screen gets bigger (size of host 1920x1080) - guest kubuntu applications windows taking whole screen area. but, example, desktop wallpaper acts still if 800x600 in effect. , inside system settings -> display virtual screen stays @ 800x600, nevertheless resolution list long. unfortunately - 1920x1080 isn't there. this xrandr shows: screen 0: minimum 1 x 1, current 1920 x 1080, maximum 8192 x 8192 virtual1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 0mm x 0mm 1920x1080 60.0*+ 2560x1600 60.0 1920x1440 60.0 1856x1392 60.0 1792x1344 60.0 1920x1200

nginx - Why am I getting a 400 Bad Request error when visiting domain? -

my website has been down 2 months, i've given resolving issue, have been talking support posting on stackoverflow , nobody seems able me. setup: digital ocean 1-click install of django, ubuntu, nginx issue: after setting domain, visiting domain results in 400 error. visiting ip works no problem. purchased domain using google domains , used custom name server option , put: ns1.digitalocean.com ns2.digitalocean.com ns3.digitalocean.com in etc/nginx/sites-available/django have: upstream app_server { server 127.0.0.1:9000 fail_timeout=0; } server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.html index.htm; client_max_body_size 4g; server_name cannablr.com www.cannablr.com; keepalive_timeout 5; # django project's media files - amend required location /media { alias /home/django/django/dealr/dealr/media; } # django project's static files - amend required location /static { alias /home

android - Application crashes when scrolling listview up or down if listAdapter is notified while scrolling and crashes after about 20 seconds without scrolling -

i have listview customlistadapter. updating arraylist new data using handler runs asynktask every 6 seconds , calling notifydatasetchanged() on oppostexcute(). data shown in listview , updated , ok. if scroll listview or down, application crashes. these global variables: listview lv1; swiperefreshlayout mswiperefreshlayout; posttask posttask = new posttask(); stockquotelistadapter stockquotelistadapter; arraylist<stockquote> stockslist=new arraylist<stockquote>(); and activity oncreate: public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { result = inflater.inflate(r.layout.indeces_fragment,container,false); mswiperefreshlayout = (swiperefreshlayout) result.findviewbyid(r.id.activity_main_swipe_refresh_layout); lv1 = (listview) result.findviewbyid(r.id.stocks_list); stockquotelistadapter = new stockquotelistadapter(result.getcontext(), stockslist); lv1.setadapter(stockquotelistadapter);

android - UIL, Picasso - Images in adapter always reload when stop scrolling -

Image
i have listview text , large image internet. image item has fit width , wrap_content height. tried display image in background uil & picasso . both of them can work image reloads when stop scrolling, , makes listview flickering looks this: you can see it reload downloaded , cached images when stop scrolling (i scroll down , scroll up) . how can prevent happen? <imageview android:id="@+id/imgfeed" android:layout_width="match_parent" android:layout_height="wrap_content" android:scaletype="centercrop"/> // uil options = new displayimageoptions.builder() .showimageonloading(defaultimage) .showimageonfail(defaultimage) .showimageforemptyuri(defaultimage) .resetviewbeforeloading(false) .cacheondisk(true).delaybeforeloading(0) .displayer(new fadeinbitmapdisplayer(200)).cacheinmemory(true).imagescaletype(imagescaletype.exactly_stretched).build(); imageaware imageaware =