Posts

Showing posts from September, 2014

swift - When should we clear Core Data cache entity? -

i using code in tutorial http://www.raywenderlich.com/76735/using-nsurlprotocol-swift in tutorial code caching every single request. my question when , how can clear entity of caching (core data)? or dont need clear caching entity? caching entity entity save data requested nsconnection. if need clear cache in core data how can choose data stay , others deleted. for example , making news app. every vc has label such title, date, category , uiwebview. , when app closed want delete caching links except "saved news". "saved news" category users choose tapping button "plus". i thinking create new column named "istosave". so, when user taps button save. need parse content text , pull out links (src=) , in coredata set column "istosave "to true. when app closed delete links column "istosave" = false so shortly: practice clear entity "cacheurls" , if yes how can clear urls selection ? here code: import

Count Distinct Number of Email Addresses in the Results of a Query in MS Access -

i have query in ms access return multiple columns multiple tables user-specified period of time. training registration database, , times, people take multiple classes during given time period. need count of distinct number of people trained during given time frame, can't figure out way in access. here query i'm starting with: select userstable.firstname, userstable.lastname, userstable.emailaddress, userstable.department, userstable.activeuser, classsessionstable.coursename, classsessionstable.starttime, activitytable.registered, activitytable.attended classsessionstable inner join (userstable inner join activitytable on userstable.[userid] = activitytable.[userid]) on classsessionstable.classsessionid = activitytable.classsessionid (((classsessionstable.starttime) between [early date in mm/dd/yyyy hh:mm:ss am/pm format] , [late date in mm/dd/yyyy hh:mm:ss am/pm format]) , ((activitytable.registered)=t

node.js - knexjs column specific type -

how can specific type of column in knexjs? i have table users : id serial not null, id_file_avatar bigint, id_sectors bigint not null, name character varying(50), email character varying(100) when in rest got it: { "user": { "id": 1, "id_file_avatar": null, "id_sectors": "0", "name": "rodrigo lopes", "email": "rodlps22@gmail.com" } } my usermodel var user = bookshelf .model .extend({ tablename: 'users', visible: [ 'id', 'id_file_avatar', 'id_sectors', 'name', 'email' ], soft: false, initialize: function () { //this.on('saving', this.validatesave); }, validatesave: function () { return new checkit(rules).run(this.attributes); } }); but id_se

matlab: keeping only first N digits of numbers -

i trying find way in matlab truncate values of vector, keeping first n digits (i don't want round it, cut it.) of them. wrote converts values in strings, cut , returns number truncated, slow. any more clever solution? thanks lot in advance! since strictly not want round number, here 1 possible solution floor function, drop numbers after specified decimal numbers n want keep: function trunc = truncate(x,n) trunc = floor(x*10^n)/10^n; end here's sample run: >> b=rand(1,2) b = 0.957166948242946 0.485375648722841 >> truncate(b,3) ans = 0.957000000000000 0.485000000000000 note if considering numbers greater one, function above have modified: function trunc = truncate(x,n) %for numbers equal or greater 1, getting n first digits trunc=x; idx = x>=1; trunc(idx) = floor(x(idx)/10^n); %for decimals, keeping n first digits after comma trunc(~idx) = floor(x(~idx)*10^n)/10^n; en

Right way to set up Rust using Vim -

i've started dive rust , want clarify issues when comes setting nicely. i'm using vim on linux , found nice plugin syntax highlighting. autocompletion troublesome though, using phildawes/racer. the plugin needs src location rust in fact not big of deal, if know said directory (i found binaries , libs when using suggested curl <...> | sh install). sources downloadable separately, although didn't find install rust sets sources in let's e.g. /usr/local/src/rust binaries , libs. second i've looked through cargo docs , and didn't find extern dependencies cloned (wouldn't source directory?) also should rust sources updated setting manually kind of lame? is quintessence clone rust repository , build yourself? the plugin needs setting src location rust in fact not big of deal, if know said directory was i couldn't find sources either. if want sources without history: for 1.0.0, git clone --depth=1 --branch 1.0.0 --single-

.net - SolrNet query not working for Scandinavian characters -

when making query through solrnet contains scandinavian characters ø, æ, å query returns no results while queries containing regular words work fine. the query has been added filterqueries collection using solrquerybyfield class values "ss_content" field name , values \"søren\" quoted set false. if test without "" in søren doesn't give results. when running same query through solr admin page in browser works fine. am missing configuration in solrnet causing issue? solr version 3.6 on tomcat 8 , being called .net 4.5 application any appreciated. solr admin page query plain html <form method=get action="#">[...]</form> , meaning browser automatically url-encode input values - why works admin page. you need url-encode parameter values when forming requests. in .net 4.5 can use webutility.urlencode(string) . please try replace "søren" string webutility.urlencode("søren") , see if wo

android - How to hide drawn values in MPAndroidChart? -

i need hide value above bars in mpandroidchart barchart. have tried methods available in , not find solution. try dataset.setdrawvalues(false) . to alter (customise) drawn values, can use valueformatter interface.

javascript - Google spider gives 404 error on Angular links: how to fix it? -

i use custom angular tags [{ }] avoid conflicts twig. in first version of website used: <a href="[{ article.slug | url }]">article</a> of course, found many 404 google spider errors. changed in: <a href="#" ng-href="[{ article.slug | url }]">article</a> but surprisingly again 404 error on: http://www.myangularwebsite.com/[%7b%article.slug%20%7c%20url%20%7d] how possible? why spider reading ng-href tag? how prevent error?

r - Error in UseMethod("meta", x) : no applicable method for 'try-error' applied to an object of class "character" -

i using tm package in r stemming in corpus. however, got problem when ran documenttermmartix "error in usemethod("meta", x) : no applicable method 'try-error' applied object of class "character" here workflow: library(tm) mycorpus <- corpus(vectorsource(training$fulldescription)) mycorpus <- tm_map(mycorpus, content_transformer(tolower), lazy=true) mycorpus <- tm_map(mycorpus, removepunctuation, lazy=true) mycorpus <- tm_map(mycorpus, removenumbers, lazy=true) mystopwords <- c(stopwords('english'), "available", "via") mycorpus <- tm_map(mycorpus, removewords, mystopwords, lazy=true) dictcorpus <- mycorpus mycorpus <- tm_map(mycorpus, stemdocument, lazy=true) mycorpus <- tm_map(mycorpus, stemcompletion, dictionary=dictcorpus, lazy=true) mydtm <- documenttermmatrix(mycorpus, control=list(wordlengths=c(1, inf), bounds=list(global=c(floor(length(mycorpus)*0.05), inf)))) i trie

python 3.x - Python3.4 : List to CSV -

i'm trying convert list csv. import csv import pandas pd ciklist = [] open('/home/a73nk-xce/pycharmprojects/sp500_list/stockchar/cik.csv', 'r', newline='') csvfile: spamreader = csv.reader(csvfile) row in spamreader: eachrow in row: eachrow = eachrow.lstrip('0') ciklist.append(eachrow) myfile = open('newcik.csv', 'wb') wr = csv.writer(myfile, quoting=csv.quote_all) wr.writerow(ciklist) when running code return following: typeerror: 'str' not support buffer interface change: myfile = open('newcik.csv', 'wb') to: myfile = open('newcik.csv', 'w')

python - SQLAlchemy DatabaseError server close connection -

i running several processes in python using multiprocessing. hitting postgresql database , keep getting error: (databaseerror) server closed connection unexpectedlythis means server terminated abnormallybefore or while processing request. the db admin tells not seeing errors on side , can't figure out causings this.

excel - VBA - Copy value if cell CONTAINS certain value rather than equal to or not equal to -

i have working macro loops through folder open files , important info columns of names "holder" , "cutting tool" , printing info 1 excel document, masterfile. i have run problem in “holder” column, there information “holder / toolbox” not consistent. have working “holder” wondering if possible still regardless of if there text in holder header name or if lowercase rather capitals. thank can provide! this code deals "holder" section . below full code better reference (section 4 regards section tinkering , section 8 function references). 'find headers on sheet set hc1 = headercell(startsht.range("b1"), "holder") ... '(4) 'find holder on source sheet set hc3 = headercell(ws.cells(row_header, 1), "holder") if not hc3 nothing set dict = getvalues(hc3.offset(1, 0)) if dict.count > 0 set d = startsht.cells(rows.count, h

java - How to calculate the distance from a pixel in the Lab-color space to a specific prototype -

i have lab-image , each pixel in it, want know how red, green, blue , yellow pixel is. which means, input lab-image should 4 images 1 red,green,blue , yellow. as far researched, knew done calculating ecludian distance each pixel in lab-image prototype of color (r,g,b or y). example, if want produce image contains how red pixels in lab-image , each pixel in lab-image , have calculate distance pixel in lab-image prototype of red color in lab-color space kindly please provide advice , guidance. all need convert color value need (e.g. red = 255,0,0 in rgb) lab (lref,aref,bref), calculate euclidean distance between each pixel , value, , set distance output pixel value. out_pixel=sqrt(sqr(lpixel-lref)+sqr(apixel-aref)+sqr(bpixel-bref)) you may want normalize values, if want pixel output fit in 0-255.

Connecting to MSSQL server in PHP using integrated authentication -

i have xampp running on ms server 2012 r2. need make connection mssql server accepts integrated win authentication. if try below, login failure , error log on sql server sql authentication not option. accepts connection user. php script not being run under account. $server = "sqlservername"; $sqluser = "username"; $sqlpass = "pw"; $sqldatabase = "db"; $link = mssql_connect($server,$sqluser,$sqlpass); as i'm using php 5.3.1 sqlsrv_connect not option. tried load php drivers it's not working. can't change authentication sql server , can't use other version of php. i can't turn secure_connection on have able connect other sql servers requires "normal" sql authentication: mssql.secure_connection = off how connect problematic sql server? update : upgraded xampp latest version. php version 5.6.8 still can't use sqlsrv_connect() though installed necessary driver , added every single dll php.ini . re

MYSQL PHP Sorting table rows with Full date names by date -

i have table there date field. values of items inserted there full date names. how able sort selected result proper date? example table february 10, 2010 january 5, 2010 january 4, 2010 january 5, 2009 january 6, 2010 march 21, 2010 what want happen january 5, 2009 january 4, 2010 january 5, 2010 january 6, 2010 february 10, 2010 march 21, 2010 is there mysql function this? here query. date field named date $sql = "select * `$table` order date"; unfortunately, sorts result alphabetically. how should modify/change query? your future insights , feedback appreciated! :) update so problem field string/varchar . possible change after data has been stored? , query above automatically sort correctly? this because column in database setup string / varchar , versus datetime field. there few ways approach this, easiest convert fields datetime fields instead. an inefficient solution do: $sql = "select * `$table` order str_to_date(`date`)&

cordova - Android: Couldn't load mupdf -

i having (android studio - gradle) cordova (3.6.4) project. in app there can list of pdf files should shown mupdf. following error message: 06-10 15:04:38.365 5940-5940/? e/androidruntime﹕ fatal exception: main process: de.dil.dsm, pid: 5940 java.lang.unsatisfiedlinkerror: couldn't load mupdf loader dalvik.system.pathclassloader[dexpathlist[[zip file "/data/app/de.dil.dsm-2.apk"],nativelibrarydirectories=[/data/app-lib/de.dil.dsm-2, /vendor/lib, /system/lib]]]: findlibrary returned null @ java.lang.runtime.loadlibrary(runtime.java:358) @ java.lang.system.loadlibrary(system.java:526) @ com.artifex.mupdfdemo.mupdfcore.<clinit>(mupdfcore.java:14) @ de.dil.dsm.dsm.loadfile(dsm.java:216) @ de.dil.dsm.xviewer$6.run(xviewer.java:102) @ android.os.handler.handlecallback(handler.java:733) @ android.os.handler.dispatchmessage(handler.java:95) @ android.os.looper.

html - JavaScript after Form Handling spit content on page -

hello i'm trying make website enter name , gets spit out on page. want using javascript. html: <div id='errormsg'></div> <form action='' method='post' onsubmit="formsubmit();"> <input id='name' type='text' placeholder='slogan here...'> <input id='submit' type='submit' value='generate'> </form> <div id="namecontent"></div> js: function formsubmit() { var formname, formerror, namesentence; formerror = document.getelementbyid("errormsg"); formname = document.getelementbyid("name"); namesentence = document.getelementbyid("namecontent"); if (formname == "") { formerror.innerhtml = "put name in!"; } else if (formname > 20) { formname.innerhtml = "max. 20 characters"; } else { namesentence.innerhtml = formname ; } } the first pr

How to access Google Prediction API with Python? -

i have practice project given me advisor asks me write python script access model trained prediction api using api explorer. have 2 questions regarding this, the guidelines specify should not check in credentials in python script , not sure means, leads question... when follow documentation call "predict" method of "trainedmodels" (to predict language of text using trained model) from apiclient import discovery service = discovery.build('prediction','v1.6') x = service.trainedmodels().predict(project='my first project', id='my_project_id', body={"input":{"csvinstance":['bonjour!']}}) this return value <googleapiclient.http.httprequest object @ 0x1031996d0> because not aware of meant "not checking in credentials", unclear how proceed in resolving problem. thank in advance. there @ least ways achieve that: using gcloud tool store credentials loca

javascript - compess json data from rest node.js use express compression -

i created small application rest node.js. try compress data json, return request api, nothing compressed. use express , compression. var express = require('express'); var methodoverride = require('method-override'); var bodyparser = require('body-parser'); var servestatic = require('serve-static'); var compression = require('compression'); var app = express(); app.use(compression()); app.use(methodoverride('x-http-method-override')); app.use(bodyparser.json()); app.use(servestatic('public', {'index': ['index.html']})); app.use('/', require('./routes')); app.use(function(req, res) { res.sendfile('public/index.html'); }); app.disable('x-powered-by'); var server = app.listen(3000, function () { var host = server.address().address; var port = server.address().port; }); this response header without compession =((( http/1.1 200 ok content-type: application/json;

Refresh on swiping tabs android -

i using view pager , fragments. have 3 swipable tabs. each extend fragment. want them refresh them on swipe. how achieve this? when swipe, tab not refreshed. public class orders extends fragmentactivity implements actionbar.tablistener { private viewpager viewpager; private tabspageradapter madapter; private actionbar actionbar; // tab titles private string[] tabs = { "pending", "completed", "rejected" }; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_orders); this.settitle((html.fromhtml("<font color=\"#ffffff\">" + "pharmeazy-mobile" + "</font>"))); // initilization viewpager = (viewpager)findviewbyid(r.id.pager1); madapter = new tabspageradapter(getsupportfragmentmanager()); actionbar=getactionbar(); getactionbar().setbackgrounddrawable(new colordrawable(color.parsecolor(&quo

python - matplotlib: Displaying an image as separate convolution regions -

i'm trying display image using matplotlib. want display said image series of subplots each subplot represents region used when performing valid convolution. example, image in first link 32x32 grayscale image. want perform convolution on image using 5x5 filter. in order see filter being convolved each time want split image separate overlapping 5x5 regions. code using follows: fig14 = plt.figure(14) = images[4,0,:,:] in range(images.shape[3]-5+1): #counts 0 27 (28 = no of convolutions) j in range(images.shape[3]-5+1): #counts 0 27 plt.subplot(28,28,(i*28)+j+1) plt.gray plt.axis("off") plt.imshow(a[i:(i-1)+5,j:(j-1)+5]) the result in second link. don't understand why there black pixels in centre? surely should white. can tell me i'm going wrong? in advance. input image result

machine learning - Prediction of sets -

assume have 4 transactions a,a,a,b. assume, has been grouped b single group. there similar transactions c,c,g,c,c,c , c,c,b,c , c,c,b,c,c grouped. here see c has been grouped b , g c&b have been grouped twice compared c&g there lots of transactions these. when new set of transactions come c,c,b,a,a,g need suggest each of these transactions, other transactions should paired with. in example, prediction should follows. c -> b (predicted since had max probability) c -> b (predicted since had max probability) b -> c (predicted) -> b (predicted) -> b (predicted) g -> c (predicted) 1) simple case approach/ ml technique needed achieve this? 2) if transactions become more complicated a,a,a,b,n grouped, how able handle case. i can go through transactions , calculate probability of each transactions in group, there better approach should considering. packages available these problems?

powershell - How to show all value that have a null entry in a specific column -

i wanting bring forward csv file containing users name , samaccountname , description , have noticed there several people not have descriptions. looking how edit existing code (i know there's simple way can't remember it) filters output shows users have no description. get-aduser -filter * -properties name,samaccountname,description -searchbase "dc=removed,dc=com" | ? { $_.enabled -notlike "false" } | select name,samaccountname,description | export-csv "c:\scripts\nodescriptionusers.csv" you need add condition in where-object scriptblock since can't filter empty values ldap-query afaik. 1 suggestion: get-aduser -filter * -properties name,samaccountname,description -searchbase "dc=removed,dc=com" | ? { $_.enabled -notlike "false" -and [string]::isnullorempty($_.description.trim()) } | select name,samaccountname,description | export-csv "c:\scripts\nodescriptionusers.csv" personally move enabl

liquid - Shopify vendor if statement -

a shopify liquid question: if no vendor available, shopify adds shop name default vendor. i'd instances blank. i'm trying create if statement hides vendor if there no vendor or if equals default vendor name. here's i've come far , i'm stuck <div class="prod-caption">{% if product.vendor == 'test' %} {% else %} {{ product.vendor }} {% endif %} {{ product.title }}</div> i want on product page in product grid item snippet can help? what you've got looks should work (assuming replace 'test' shop's name), i'd write if statement this: {% if product.vendor != shop.name %}{{ product.vendor }}{% endif %} {{ product.title }} this work in both product.liquid , product-grid-item.liquid . (just search {{ product.title }} , replace code above.)

arrays - Process pairs of elements in a vector -

is there standard function can applied single vector process 2 elements per step? for example, have vector: > <- c(8, 4, 5, 5, 7, 10) and want subtract 2 neighbors elements: > func(a, function (x1, x2) { x1-x2 }) [1] 4 -1 0 -2 -3 in general if want process consecutive vector elements in pairs can first element in each pair with: (first <- head(a, -1)) # [1] 8 4 5 5 7 and can second element in each pair with (second <- tail(a, -1)) # [1] 4 5 5 7 10 then can perform operation want on consecutive elements. instance, here's operation: first-second # [1] 4 -1 0 -2 -3 here's product of consecutive elements: first*second # [1] 32 20 25 35 70 note operation pretty common there specialized function take differences of consecutive elements, diff .

common lisp - Updating the window in response to CLIM frame commands -

while trying figure out clim, ran this example program . it's simple maze game. author claims have tested in lispworks (and has #+genera in there, implying program work on real lisp machine), i'm trying working in sbcl mcclim. under sbcl/mcclim, window draws, nothing visible happens when press movement keys. non-movement keys cause text entered pane game instructions. i figured out game command keys changing game's internal state, problem screen not update. then realized couldn't write code redraw maze scope of code implements commands. methods draw receive stream argument clim, must passed graphics primitives. example: (defun draw-stone (stream x y cell-width cell-height) (let ((half-cell-width (/ cell-width 2)) (half-cell-height (/ cell-height 2))) (draw-ellipse* stream (+ (* x cell-width) half-cell-width) (+ (* y cell-height) half-cell-height) half-cell-width 0 0

java - Remove "Using default security password" on Spring Boot -

i added 1 custom security config in application on spring boot, message "using default security password" still there in log file. is there remove it? not need default password. seems spring boot not recognizing security policy. @configuration @enablewebsecurity public class customsecurityconfig extends websecurityconfigureradapter { private final string uri = "/custom/*"; @override public void configure(final httpsecurity http) throws exception { http.csrf().disable(); http.headers().httpstricttransportsecurity().disable(); http.sessionmanagement().sessioncreationpolicy(sessioncreationpolicy.stateless); // authorize sub-folders permissions http.antmatcher(uri).authorizerequests().anyrequest().permitall(); } } i found out solution excluding securityautoconfiguration class. example: @springbootapplication(exclude = {securityautoconfiguration.class }) public class reportapplication {

c# - Bulk insert using code first migrations for azure -

we have lot of data needs loaded number of tables. far can see have 2 options: include data part of configuration class seed method problems 1.a. slow , involve writing lot of c# code) use bulk insert code first migrations - lot quicker , better solution. problems 2.a. may prove tricky working other data gets loaded same tables part of seed. 2.b. requires sql identity insert switched on. what solution best , if 2 how go bulk insert code first migrations , how can address problems? bypassing ef , using ado.net/sql approach bulk data upload. best approach depends on whether want data inserted part of migration or logic runs on app start. if want inserted part of migration (which may nice since don't have worry defensive checks if data exists etc.) can use sql(string) method execute sql uses whatever format , sql features want (including switching identity_insert on/off). in ef6.1 there overload allows run .sql file rather having in code string. if want on

rust - How can I wrap any impl of std::error::Error to ease error propagation? -

i'm trying simplify error flow in webapp i'm working on, , plan make struct implements std::error::error , forwards result of description() whatever kind of error it's wrapped around. i've implemented from types of errors want wrap, struct makes easy use try! uniform error result. here's have far struct: #![feature(convert)] use std::error::{error}; use std::fmt::{self,display,formatter}; use std::io::{self,read}; use std::ops::deref; use std::fs::{file}; #[derive(debug)] pub struct strerr{ desc:string, c: option<box<error>> } impl strerr{ pub fn new(msg:string) ->self{ strerr{desc:msg, c:none} } } impl error strerr{ fn description(&self) -> &str{ self.desc.as_str() } fn cause(& self) -> option<& error> { self.c.map(|e| e.deref()) } } impl display strerr { fn fmt(&self, f:&mut formatter) -> result<(),fmt::error> { f.write_str(

apache - How to access WAMP Server form everywhere? -

i created first homepage in last weeks , want show friends. using wampserver 2.5 , followed lot of guides nothing worked me. first of new this, have no idea how accessing works exactly. guess point out how understand should work. on pc wrote htmls css php , on can access via localhost:8080/foldername/homepage.php okay changed port 80 8080 cause lot of guides recommenced it. a few days ago able reach local ip 192.168.2.103/foldername/homepage.php or this i have no idea how did , @ moment doesn't work anymore. my httpd.config file pretty messed (and long post here), maybe should reinstall wamp. okay come question: if set correctly able access homepage on pc via http://ipv4-address/homepage.php http://91.11.87.45/homepage.php without buying domain , having wamp installed? page intended not online 24/7 when , friends need it, or wamp online when pc powered. i did - "put online" - portforwarding on router , firewall - turned off firewall/antiv

c# - Scrollbar resetting to the top of the treeView after sorting? -

i have large tree structure, , whenever user adds or removes child node, tree re-sorted. works well, issue this: after sorting, scrollbar automatically reset top of tree. i'd make scrollbar holds (or returns to) position node added or deleted user doesn't have scroll down , find parent node every single time want add or delete something. i've been trying find way time now, haven't had luck. have tips? here's method i'm using removing child node, if helps: private void removefromcategoryevent(object sender, eventargs e) { suspendlayout(); if (treeviewcategories.selectednode != null) { treenode treenode = treeviewcategories.selectednode; treenode parentnode = treenode.parent; if ((settinggroup != null) && (settinggroup.grouprootcategory != null) && (settinggroup.grouprootcategory.settings != null) && (treenode.tag isetting) && (parentnode.tag idevicesettingcategory)) { isetting

django: reading from database after form submission -

i have form in django template call javascript function when it's submitted: <input name="button2" type="submit" class="test" id="button2" value="submit" onclick="checksubmitstatus();"/> after form submission, code in python views, write data in form database. like: if request.method == 'post': customer_data = customers(customerid=1, customername=request.post['textfield1']) customer_data.save() return httpresponse(status=204) and in javascript function have used ajax data server: <script type="text/javascript"> function checksubmitstatus() { $.ajax({ url: "customerdata", type: 'get', datatype: 'html', async: false, success: function(data) { x = data; } }); alert(x); } when customerdata reads data db: r

python - matplotlib - what kind of set_major_locator should I use -

i have question regarding plot feature when x-axis date. setting i have 2 time-series dt , x , dt list of datetime.datetime values , x numpy array object. dt = [datetime.datetime(1996, 12, 3, 0, 0), datetime.datetime(1996, 12, 4, 0, 0), ..., datetime.datetime(2015, 6, 5, 0, 0), datetime.datetime(2015, 6, 8, 0, 0)] x = array([29.06262, 29.26933, ..., 208.41999, 208.44532]) and both have same length. when plot them : ax.plot(dt, x, color='black', lw=2) i chart has x-tick labels years (e.g. 1994, 1998, 2002, 2006, 2010, 2014 ). after zooming, x-tick labels nicely start showing months (e.g. aug 2009, oct 2009, dec 2009, feb 2010, apr 2010, jun 2010 ). after further zooming, x-tick labels again nicely start showing days (e.g. jan 14 2010, jan 21 2010, jan 28 2010, feb 04 2010, feb 11 2010, feb 18 2010 ). question now, trying draw custom chart (e.g. using linecollection ) instead of using default plot . i suspect need use ax.xaxis.set_major

How do you calculate the size of a single row in hbase? -

i trying figure out size of single row in hbase. haven't found way online or through of hbase utils , have used hbase hfile -mbsf find out average row size , other statistics hfile, curious single row's size. has found way this? worked fine me calculate size of single record http://prafull-blog.blogspot.com/2012/06/how-to-calculate-record-size-of-hbase.html

javascript - Bootstrap + Affix : affixed menu jumps off screen -

i trying set simple example bootstrap's affix.js . however, problem item trying have sticky jumps off screen negative top switches affix-top affix . , never recovers there. i set small jsfiddle, illustrates issue: https://jsfiddle.net/mjg12uep/6/ i have done on project, can't heck of figure out going on here. when playing around little bit more, realized works when add position: relative .affix-top . suppose without that, javascript not sure "anchor" element, , pushed off screen. have updated fiddle accordingly.

merge - git merging only recent changes from one repository to another which is an unrelated snapshot (not a clone) -

i have 2 git repositories: internal , external. internal repo has our full history. external repo has 1 commit of snapshot of internal repository of 3 weeks ago. graphically looks this: a01 | a02 | a03 | a04 --> snapshot b01 | a05 | a06 - a07 | | a08 | | / a09 / | / | / + | a10 | a11 | a12 my question how best merge commits a05 through a12 local copy repository b? (i'll squash them internally before pushing them our public-facing repo) a , b unrelated repositories (b not created clone of a; took checkout copy of repo of commit a04 , checked them new repo b) the twist in of (and if weren't true, continue use snapshots) have file renaming. repo contains refactoring commits files renamed , moved. if take snapshot of a12 , commit b01, somehow have tell git how relate files before , after move (like hg rename -a in mercurial); information in repo a's history , not want have recreate it. other people suggesting manually copying

ruby on rails - ActiveRecord Slow Object Instantiation -

i maintain website of events taking place in city. my website homepage 5-days calendar events taking place today 4 days in future. i have done quite job "activerecord" code have around ~120ms spent in mysql (double checked rackminiprofiler) load ~200-300 events. however response time slow (1.5s - 2s). most time spent in instantiation of ar's objects queries using objectspace, see ~6k ar::base objects instantiated +300 events displayed. the reason why there many objects event model has many associated models (e.g. venue, occurrences, categories, etc...), of contain bits of information need show. as expected, profiling proved activerecord's object instantiation consuming task during request. i not experienced enough in neither activerecord nor performance. is such speed expected or should objects instantiated faster? should move away ar , use simple ruby hashes ? is rails standard when data model complex? ========= update 1 ========= th

javascript - How to load different Scss files with Meteor routed pages -

i'm creating meteor site routed iron router. every subpage has it's own folder , it's own scss files. problem scss files become available on every subpage after compiling. it's easy solve adding html class="homepage" or html class="adminpage" , prefix styling .adminpage {...code goes here...} , when comes excluding big files, such entire html5reset.scss , prefixing names not solution. how exclude html5reset.scss files particular routes? file structure /homepage > global.scss > homepage.scss > html5reset.scss /404 > global.scss > 404page.scss > html5reset.scss /admin > global.scss > adminpage.scss // no html5 reset /framework > global.scss > frameworkpage.scss // no html5 reset and how dynamically set html classnames: html <template name="homepage"> {{html_class 'homepage'}} </template> client js // dynamically set html class handlebars.regis

php - How to set and read cookies using C and the G-wan web server -

in php set cookie doing setting new cookie ============================= <?php  setcookie("name","value",time()+$int); /*name cookie's name value cookie's value $int time of cookie expires*/ ?> getting cookie ============================= <?php  echo $_cookie["your cookie name"]; ?> how set , read cookie? i can't seem find articles on web explaining hoe this. in fact there not many c web development article the g-wan tar ball includes 2 sample source code files related cookies: cookie.c (set cookie) #include "gwan.h" // g-wan exported functions int main(int argc, char *argv[]) { // "set-cookie: domain=.foo.com; path=/; max-age=%u\r\n" const char cookie[] = "set-cookie: max-age=3600\r\n" // 1 hour "location: /?served_from\r\n\r\nblah\r\n"; http_header(head_add, (char*)cookie, sizeof(cookie) - 1, argv); return 301; // return http code

ruby on rails - Activity.order("created_at desc").where(How to include current_user & following_ids?) -

this shows on feed activities users following, want include posts users following + own . class activitiescontroller < applicationcontroller def index @activities = activity.order("created_at desc").where(user_id: current_user.following_ids).paginate(:page => params[:page]) # if take out following_ids list out activities current_user. need both. end activity.rb class activity < activerecord::base self.per_page = 20 belongs_to :user belongs_to :habit belongs_to :comment belongs_to :valuation belongs_to :quantified belongs_to :trackable, polymorphic: true def conceal trackable.conceal end def page_number (index / per_page.to_f).ceil end private def index activity.order(created_at: :desc).index self end end user.rb class user < activerecord::base acts_as_tagger acts_as_taggable has_many :notifications has_many :activities has_many :activity_likes has_many :liked_activities, through: :

jquery - Disabling every html DOM element excluding specific #id -

actually trying disable element in html page, there element want active. $('body').find('*').attr('onclick',"return false;"); //disabling elements // trying make id("prerequisitedetails") active. $("#prerequisitedetails").parents().attr('onclick',null).off('click'); can tell me proper way this. can tell me proper way this. don't use onclick attributes, use real event handlers. this should it: $('body') .find('*') .not($("#prerequisitedetails").parents().addback()) .click(false); what does: finds elements descendants of body from set, removes ones prerequisitedetails element or of parents. note addback we're including element itself. uses jquery shorthand click handler returns false. although thinking it, sure want allow clicks on element's parents rather descendants ? may want: $('body') .find('*') .n

python - Is there a way to evaluate a system of disequations? -

i have bunch of strings, keys in dictionary, contain systems of inequalities: e.g. "t1+t2 > 2 ^ t1 < 1 ^ t2 >= 1" these strings created based on user input, systems impossible: e.g "t1+t3 > 2 ^ t1 <= 1 ^ t3 <= 1". there no possible values of t1 , t3 solve system.in case system impossible need remove element dictionary. i know sure there no multiple inequalities regarding same "subject". instance, there can't be: "... ^ t2 > 0 ^ t2 <= 2 ^ ..." but "... ^ 0 < t2 <= 2 ^ ..." possible if have write code this, messy , can't picture (or @ least nice one) on how result true or false, whether it's impossible or possible system ... , i'm pretty sure there better ways of handling problem (there can more 3 variables, think if understand how 3, can n): def logical(string): h = string.split(" ^ ") count = [0,0,0] in [1,2,3]: j in h:

syntax - Specflow Given When Then BUT? -

i have been using specflow while, without making use of "but" logic. considering following scenario: scenario: kiran logs system doesn't click remember me given have username of 'kiran' , password of 'password' when chose login don't chose remember me should logged in , taken home screen username should not remembered couldn't "but" steps interchanged "and"? is there advantage using "but"? am right in thinking purely readability purposes? i forward hearing thoughts on this. many thanks, kiran yes right, "and" , "but" inter-changeable in gherkin syntax. however in experience "and" used when indicating user should carry out action, whereas "but" best suited when want highlight user should not perform action; because "but" in english language used in negative context. hence in example: but don't chose remember me is use of &quo

google admin sdk - How can I access group members with a service account? -

i attempting use service account access members of group. have verified can using normal oauth2 token on behalf of user, call https://www.googleapis.com/admin/directory/v1/groups/{group}/members , scope https://www.googleapis.com/auth/admin.directory.group.readonly . i’d same service account, , have added service account email address group member , verified view members permissions set “all members of group, organization members”. when ask list of members, receive error: { "error": { "errors": [ { "domain": "global", "reason": "forbidden", "message": "not authorized access resource/api" } ], "code": 403, "message": "not authorized access resource/api" } } what need authorize service account see group? you can follow steps outlined in following api docs page create service account , perform domain wide delegation of authority,

Directed Dependency Graph in php -

Image
is possible construct directed dependency graph in yii framework of php or in classic php. want dynamically draw graph this, i have array of ids as: array ( [0] =>array ( [0] => 10 [1] => 12 [2] => 14 [3] => 19 ) [1] => array ( [0] => 10 [1] => 13 [2] => 18 [3] => 20 ) [2] => array ( [0] => 10 [1] => 16 [2] => 14 [3] => 21 ) [3] => array ( [0] => 10 [1] => 12 [2] => 18 [3] => 19 ) [4] => array ( [0] => 10 [1] => 13 [2] => 14 [3] => 20 ) [5] => array ( [0] => 10 [1] => 16 [2] => 18 [3] => 21 ) [6] => array ( [0] => 10 [1] => 12 [2] => 14 [3] => 19 ) [7] => array ( [0] => 10 [1] => 13 [2] => 18 [3] => 20 ) [8] => array ( [0] => 10 [1] => 16 [2] => 14 [3] => 21 ) [9] => array ( [0] => 10 [1] => 12 [2] => 18 [3] => 19 ) [10] => array ( [0] =>

sql - MySQL JOIN two tables (Union) -

i have 2 mysql tables first 1 booking +------------+--------------+---------+ | id | contact_no | date | +------------+--------------+---------+ | p1 | 7898787946 | 15-06-05| | p1 | 7897891562 | 15-06-05| | p1 | 1546879585 | 15-06-07| | p2 | 1789546528 | 15-06-07| | p3 | 7894668265 | 15-06-07| +------------+--------------+---------+ second 1 setup +------------+--------------+------+-----+ | id | date | time | max | +------------+--------------+------+-----+ | p1 | 15-06-06 | 8.00 | 20 | | p1 | 15-06-07 | 8.00 | 20 | | p2 | 15-06-07 | 9.00 | 10 | | p3 | 15-06-08 | 8.00 | 20 | +------------+--------------+------+-----+ i need join 2 tables particular id(let's p1) , wanted generate table. count number of rows particular date , id. (e.g count 15-06-05 of p1 2) +------------+--------------+------+-----+ | count | date | time