Posts

Showing posts from September, 2012

boost - C++: digits vs bits? -

i trying understand difference of vocabulary used in c++ language between digits , bits in : char_bit; std::numeric_limits<char>::digits; is there conceptual difference? maybe weird architectures? if so, called result of operator[] of std::bitset . give access bit or digit? and current documentation of boost not help: cppint provides code digits documentation mention bits (this problem documentation, don't know whether text or code more recent.) from this std::numeric_limits::digits reference : the value of std::numeric_limits::digits number of digits in base-radix can represented type t without change. integer types, number of bits not counting sign bit. and later states char result char_bit - std::numeric_limits<char>::is_signed . and c numeric limits reference : char_bit number of bits in byte so normal modern computer, char 8 bits, char_bits equal 8 , digits function return either 7 or 8 depending on if char sign

java - Autowired HttpServletRequest in Spring-test integration tests -

i trying test cover login functionality. version of spring 3.2.12. have session bean, declared as: @service @scope(value = "session", proxymode = scopedproxymode.interfaces) public class clientsessionserviceimpl implements clientsessionservice { @autowired private httpservletrequest request; // method called during login routine filter public boolean checkuser() { // rely on request attributes here, set in filter } this works when run on server, when run means of spring-test, problem comes. test method: this.mockmvc = mockmvcbuilders.webappcontextsetup(this.wac).addfilter(springsecurityfilterchain).build(); mockmvc.perform(post(url)); after debugging, found out, when test spring context started, in servlettestexecutionlistener.setuprequestcontextifnecessary instance of mockhttpservletrequest created, mockhttpservletrequest request = new mockhttpservletrequest(mockservletcontext);
 // lets' call instance a. , instance that&#

html - How do I add left and slide effect for this basic image slider in jQuery? -

$(document).ready(function(){ $("#circle1").click(function(){ $(".headlines").css('background-image', 'url(bg.png)'); }); $("#circle2").click(function(){ $(".headlines").css('background-image', 'url(bg2.png)'); }); $("#circle3").click(function(){ $(".headlines").css('background-image', 'url(bg3.png)'); }); }); all #circle clickable circles make basic image slide. when click circle works want have slide effect. idea? hope looking for. circles slide left. need change #circle .headliner accordingly in javascript. $(document).ready(function() { $("#circle1").click(function() { $("#circle1").css('background-image', 'url(bg.png)').toggle("slide"); }); $("#circle2").click(function() { $("#circle2").css('background-image'

c++ - Const array initialization if its too long -

in answer question mentioned code posted wouldn't work if variable declared const . what if want initialize long array that's const type int main (){ const int ar[100]; //this invalid in c++ //something (int i=0;i <100;++i) ar[i]=i; return 0; } are there other ways using #define method proposed in question? there's no way directly, without hacks. in c++ 1 way work around problem take advantage of fact inside constructors const objects still modifiable. so, can wrap array class , initialize in constructor struct arr { int a[100]; a() { (unsigned = 0; < 100; ++i) a[i] = i; } }; and declare const arr arr; of course, have access arr.a[i] , unless override operators in arr .

c++ - Creating a Texture2DArray and populate it with solid values -

i have problems in creating , filling texture2darray in directx11. i want render many quads onto screen, drawing done instancing, every quad should own texture. tried create texture array , added index value instances data format. the problem is, when try create 2 different textures array, fails when try call function createtexture2d following error: d3d11 error: id3d11device::createtexture2d: pinitialdata[4].sysmempitch cannot 0 [ state_creation error #100: createtexture2d_invalidinitialdata] d3d11 error: id3d11device::createtexture2d: pinitialdata[6].psysmem cannot null. [ state_creation error #100: createtexture2d_invalidinitialdata] d3d11 error: id3d11device::createtexture2d: pinitialdata[7].psysmem cannot null. [ state_creation error #100: createtexture2d_invalidinitialdata] d3d11 error: id3d11device::createtexture2d: returning e_invalidarg, meaning invalid parameters passed. [ state_creation error #104: createtexture2d_invalidarg_return] here code use generate texture

node.js - Mongo/Mongoose - Find by partial document -

i have collection of properties have addresses. "address" : { "street" : "5 orange drive", "city" : "orlando", "state" : { "abbreviation" : "fl", "name" : "florida" }, "zip" : "32822", "geo" : { "lat" : 28.519, "lng" : -81.304 } }, "address" : { "street" : "16 main street", "city" : "tallahassee", "state" : { "abbreviation" : "fl", "name" : "florida" }, "zip" : "32823", "geo" : { "lat" : 28.529, "lng" : -81.314 } }, "address" : { "street" : "125 oak drive", "city" : "salem", "state" : { &q

php - Display saved checkbox value -

i have checkbox options save in db. able view , select multiple options , save them in db. issue want display saved information don't know how that. <form action="save_comp.php" method="post"> <?php //display include ('mysql_connect.php'); $sql = mysql_query("select * competency "); //$row = mysql_fetch_array($sql); while($row = mysql_fetch_array($sql)) { echo"<input type='checkbox' name='comp[]' value= ".$row['id']." /> ".$row['competency']." <br />"; } ?> <input name="submit" type="submit" value="submit" /> </form> save db <?php session_start(); $id = $_session['user_id']; //$id = 3; include ('mysql_connect.php'); $insstr = ''; foreach($_post['comp'] $val){ $insstr .=$val.","; } mysql_query("insert competency_result (user_id,result) values ( '

javascript - How to refresh resolve? -

using ui-router , have state resolve function: .state('tab.social', { url: '/social/', views: { 'menucontent': { templateurl: 'templates/social/tab-social.html', controller: 'socialctrl', resolve: { socialauthresolve: socialauthresolve } } } }) i capture resolve in controller follows: .controller('socialctrl', function($scope, socialauth, socialauthresolve) { // console.log(socialauthresolve); // $scope.logout = function() { socialauth.logout(); $state.go('tab.social', {}, {reload: true}); }; // $scope.login= function() { socialauth.login(); $state.go('tab.social', {}, {reload: true}); }; }) however, when either pressing logout or login , state not refreshed. using parameters resolve socialauthresolve , updated. in case, old parameters still in there. only when refresh browser, v

Python - show an XML file on a TreeView structure -

Image
i have code tranverse dict object , put on treeview. simple xml gets ok complex xml doesn't work. the problem walk_dict function, can't right. #-*- encoding: utf8 -*- tkinter import * ttk import treeview import xmltodict class app: def __init__(self, root): try: self.tagsoup = xmltodict.parse(file(sys.argv[1],'r').read()) self.tree = treeview(root, height=30) self.tree.pack() self.last = '' self.walk_dict(self.tagsoup) except exception e: print e def walk_dict(self, d,depth=0): k,v in sorted(d.items(),key=lambda x: x[0]): if isinstance(v, dict): self.last = k self.tree.insert('', 'end', k, text = k) self.walk_dict(v,depth+1) else: self.tree.insert(self.last, 'end', k, text = k) self.tree.insert(k, 'end', v, text = v) root = tk() app(root) root.mainloop() the xml feeding this: <menu> <opcao1>aspar

laravel - Converting sql to eloquent -

i'm trying write self join in eloquent, here in sql select t2.id products t1, products t2 t1.id = 1 , t2.id != 1 , (t1.color_id = t2.color_id or t1.process_id = t2.process_id or t1.length_id = t2.length_id or t1.size_id = t2.size_id or t1.height_id = t2.height_id) order rand() limit 10 here have in eloquent: product::join('products t2', 'products.id', '=', 't2.id') ->select('t2.id') ->where('products.id', 1) ->where('t2.id', '!=', 1) ->where(function($query){ $query->where('products.color_id', '=', 't2.color_id') ->orwhere('products.process_id', '=', 't2.process_id') ->orwhere('products.length_id', '=', 't2.length_id') ->orwhere('products.size_id', '=', 't2.size_id') ->orwhere('products.height_id', '=', 't2.hei

ruby - Rails loading modals -

i have views require lot of partials, in turn require several bootstrap modals work correctly. however, loading modals bit painful, because if load them in wrong tag, can screw them up, , duplicate them. i'd have nice helper load_modal , save list of modals need loaded. then, in part of html of choosing, can choose iterate on list load partials my problem how can store list of partials called arguments ? i have thought of following, (deliberately using non-working syntax didn't know how otherwise) application_helper.rb # input should # => 'path_to_partial', {locals} def load_modal(*args) unless (@modals ||= []).include?(args.first) @modals << args end end some_partial.html.erb <% load_modals('project/deadline', project: @project) %> application.html <% if @modals @modals.each |modal| %> <%= render(modal) %> <% end %> <% end %> note : current error code '"projec

gwt rpc - GWT RPC vs RPC Proxies in GXT -

i'm brand new gwt , gxt, might dumb question, advantages rpcproxies in gxt provides on traditional gwt rpc. know rpcproxies uses gwt rpc if i'm fetching data display in treegrid, example, why not gwt rpc directly rather using rpcproxy?

c++ - Embarcadero C++Builder: Transitive project dependencies and includes? -

let's have such project dependencies: serialportdemo (exe) --> serialport (dll) -> byteio (dll). xyz-app (exe) -> xyz-lib (dll) -> byteio (dll) each dll project has 2 folders, include , src . include contains public interface header(s) , src/ implementation along non-public headers. being used cmake's target_include_directories public, private , interface keywords, i'd tell byteio project if , directory consumers have add own list of include directories in order use byteio project. same applies linked libraries - again, target_link_libraries in cmake. right forced add byteio's include directory manually each , every project directly or indirectly depending on byteio's headers. example, class serialport in serialport.dll project subclasses byteio defined in byteio.ddl project , therefore project serialportdemo.exe has add (public) include paths of both projects, byteio , serialport. tiny example above (serialportdemo, serialport, xyz-a

visual c++ - How to find what headers my C++ application is using? -

this question has answer here: list of header files included c file 3 answers i'm using open source (mit license) project that's composed of headers only. i'm using small fraction of project has offer, , i'd hate include headers in project no reason. created sample project , included open source project in it. there way list of headers used sample project? to clarify, in sample project have: #include "opensourcemainheader.h" and opensourcemainheader.h has: #include "opensourceauxiliaryheader1.h" #include "opensourceauxiliaryheader2.h" #include "opensourceauxiliaryheader3.h" and on. i'd (i'm guessing linker or other tool chain in vc++) list of headers used. is possible? there project setting in vs can this. go property pages project, configuration properties | c/c++ | options . ena

python - python2.7 select data file to rerun file -

i running python/pygame game need 'txt' data file previouse running of game. 'save1.txt' have many files save....txt need able select 1 list possibly using tkinter askdialog update value of 'y' in code snip. code in same directory i nave been searching can not find suitable example y = 'save1.txt' r=[0]*10 inputfile = (y,'r') #open(y , 'rb') in range(0,10): r[i] = pickle.load(inputfile) inputfile.close() in range(0,10): if r[i]== 0: print i,'ii' s=i-1 else: s = 3

javascript - unable to alert id of checked checkboxes correctly -

php&html <?php $param=$_get['param']; $sql= "select * categories,main_category categories.main_cat_id=main_category.main_cat_id , categories.main_cat_id='$param'"; $stmt = $pdo->query($sql); ?> <table class="small-12 medium-12 large-12 medium-centered large-centered columns pop_tbl"><tr> <?php $i=0; while($row = $stmt->fetch(pdo::fetch_assoc)) { $i++; //echo $i; ?> <td> <label for="level_<?php echo $row['catid'];?>"> <input type="checkbox" class="level" id="level_<?php echo $row['catid'];?>" value="<?php echo $row['catid'];?>" onchange="searchcourse('<?php echo $row['catid'];?>')"> <span>&l

symfony - Class SymfonyStandard\Composer is not autoloadable -

i've started new symfony projects composer executing: composer create-project symfony/framework-standard-edition my_project_name until now.. for no apparent reason, composer started complain error: class symfonystandard\composer not autoloadable, can not call post-root-package-install script has encountered problem? i should add composer proceeded installing project after displaying message. try removing vendor directory , trying again curl extension enabled correctly.

c# - Removing line breaks from XML data before converting to CSV -

so i'm using following snippet in c# wpf application convert xml data csv. string text = file.readalltext(file); text = "<root>" + text + "</root>"; xmldocument doc = new xmldocument(); doc.loadxml(text); streamwriter write = new streamwriter(filename1); xmlnodelist rows = doc.getelementsbytagname("xml"); foreach (xmlnode row in rows) { list<string> children = new list<string>(); foreach (xmlnode child in row.childnodes) { children.add(child.innertext.trim()); } write.writeline(string.join(",", children.toarray())); } however i've run situation. input xml data looks following (sorry, have scroll horizontally see how data looks in raw format): <xml><header>1.0,770162,20121009133435,3,</header>20121009133435,721,5,1,0,0,0,00:00,00:00,<event>00032134826064957,4627,</event><drug>1,1872161156,7,0,10000</drug><dose>1,0,5000000,0,1000

javascript - Issues using Localize.js and AngularJs -

localize.js causing problems when trying translate contents included in ng-repeat element. the content should translated, removed. no errors in console. the way found make working putting localize.setlanguage() within angular controller managing content translated, , there. the point (for specific reasons) need put localize.setlanguage() before point. any ideas why happening? edit - relevant code: this script in html head: <script> localize.initialize({ key: 'xxxxxxxx', rememberlanguage: false, savenewphrases: false, translatetitle: true, translatebody: true }); localize.setlanguage('en'); </script> where, 'en' not default language in localize.js (which 'it'). and html in body: <b ng-repeat="f in filtri" ng-cloak> <span class="filter__label filter__label--key">{{f.l}}</span>

asp.net mvc 4 - data displays erroneously after five minutes -

i have mvc site after ~5 minutes, alters how displays string data on partial. data should read: new auto - 36 months , rate ... after 5 minutes displays: up 36 months i unable reproduce issue in testing or local versions of code. if upload dll, reverts proper display, 5 minutes. any thoughts on overcome issue appreciated. edit (added code) display part partial: @model afcuresponsive.rateviewer <div class="col"> <h5>featured rates</h5> <form method="post" action=""> <div class="tabber"> <ul class="tabs list-unstyled"> <li class="selected"><a href="#tab1">loans</a></li> <li><a href="#tab2">deposits</a></li> </ul> <!-- loans tab --> <div class="tab" id="tab1">

tfs - Team Foundation 2012 not recognising changes in vb6 app -

i'm using team foundation 2012 provide source control vb6 (yes, know) project. on newly set machine (installed team explorer 2012 , tfs power tools 2012), tfs not seem noticing changes. local team explorer says connected server, , has gotten files. however, when make changes, still says have latest, , when attempting check in changes, says there no pending changes. despite using "compare" between workspace , latest showing clear differences. i've seen this question , no such "bind" option appears me in team explorer (and adding new projects requires .sln, never mind fact don't want add further projects) edit: steps followed install visual basic 6 install team explorer 2012 install team foundation power tools 2012 v2 connect team foundation server team explorer (inc login etc) map solution folders on local machine make changes files in said folders (using vb6 ide, notepad) note tfe/tf explorer extension insist there no pending changes.

javascript - Adding a function to shift pieces of a puzzle -

i want create sliding puzzle different formats like: 3x3, 3x4, 4x3 , 4x4. when run code can see on right side selection box can choose 4 formats. want create function can slide/move each piece of puzzle right have no idea how make work. here example of how puzzle should work: http://www.yash.info/jspuzzle.htm since don't have enough reputation post link images here: http://imgur.com/a/2nmlt . these images placeholders right now. //jscript: function load() { var puzzle = '<div id="slidingpuzzlecontainer4x4">'; (var = 0; <= 15; ++i) { puzzle += '<img src="images/blank.jpg" alt="blank" width="100" height="100" />'; } puzzle += '</div>'; showslidingpuzzle(puzzle); } function changeformat(x, y) { var puzzlepieces = []; var finalvalue = x * y - 2; (var = 0; <= finalvalue; ++i) { puzzlepieces.push(i); } puzzlepieces.push(&#

ios - Subclass as delegate of superclass -

i have class imageviewcontroller . has delegate: @protocol imageviewcontrollerdelegate @optional - (void)singletapgesturerecognizer:(uitapgesturerecognizer *)gesture; - (void)imagedidloaded; i have class attachmentviewcontroller subclass of imageviewcontroller . in class want event image property in changed. here code of change: - (void)setimage:(uiimage *)image { // * assign image animation [uiview transitionwithview:self.imageview duration:k_duration_imageappearence options:uiviewanimationoptiontransitioncrossdissolve animations: ^{ self.imageview.alpha = 1; } completion:^(bool finished) { if ([self respondstoselector:@selector(imagedidloaded)]) { [self.delegate imagedidloaded]; } }]; but can not use if ([self.delegate respondstoselector:@selector(imagedidloaded)]) then have error: no known insta

asp.net mvc 4 - MVC Routing News Pages -

i have managed mvc project present list of news items in seo friendly manner: /news/ - present list /news/newsitem/id/news-item-title - individual news item what is: news/id/news-item-title exactly how stackoverflow presents questions. however, cant seem head around how routing differentiate between 2 actions same controller action name (index). any suggestions appreciated. edit: here's routes config: routes.maproute( "news", "news/newsitem/{newsid}/{newstitle}", new { controller = "news", action = "newsitem", newstitle = urlparameter.optional }, new { newsid = @"\d+" } ); routes.maproute( name: "default", url: "{controller}/{action}/{id}", defaults: new { controller = "skiphire", action = "index", id = urlparameter.optional } ); edit 2: this i've amended to: route routes.maproute( "news", "{con

node.js - Mongoose populate not returning results -

i trying use populate return results ref stamp model, under users array of stamps reason not return results when see in database list of stamp ids in stamps array... here code: var selectquery = "_id name"; var populatequery = [{path:'stamps', select: selectquery, model: 'stamp', }]; user.findone({_id: userid}).populate(populatequery).sort({date: -1}).skip(count).limit(100).exec(function(err, results) { if(err) { here user schema var mongoose = require('mongoose'), schema = mongoose.schema, objectid = mongoose.schema.types.objectid, var stamp = require('../models/stamp.js'); var user = new schema({ name: { type: string}, stamps: [{ type: objectid, ref: 'stamp' }], the "query" form of populate doesn't take array argument, object: // `model` can left out mongoose in schema var populatequery = { path : 'stamps', select : selectquery };

javascript - determine line number when my codemirror mode object is called -

my codemirror mode object implements token(stream, state) , blankline(state) methods. how determine line number of stream object passed in token method, , line number skipped when blankline called? you can't, , shouldn't. modes must approach document stream, , know came before (the state) , current line (the stream). necessary allow editor use highlighting info , states if lines added or removed above given position in document.

javascript - Onclick feature over image -

i trying make text appear when user clicks on image cannt work. please me i'm doing using javascript. thanks here go, and example: <img src='http://placehold.it/350x150' onclick='alert("text appears...")'/> here's example showing how can alert , write text div , since alert of limited value. can write div

javascript - jquery dialogue destroy syntax -

i have dialog box loads partial view, called number of different views in mvc 4 app. has text area , small notice of how many characters remaining in text area. works fine on page load, when dialog box closed, whether send button or close button in dialog titlebar, when reopened '#textarea_feedback' div content disappears until page reload. believe should using dialog('destroy') cannot seem syntax right. either has no effect or displays partialview @ bottom of page. please advise, hope i've included enough code identify issue. thanx $(document).ready(function () { var text_max = 160; $('#textarea_feedback').html(text_max + ' characters remaining'); $('#txtmessage').keyup(function () { var text_length = $('#txtmessage').val().length; var text_remaining = text_max - text_length; $('#textarea_feedback').html(text_remaining + ' characters remaining'); }); $('#send&

Avoiding HTML duplication with mustache templates -

if have several components (individual '.mustache' files) want import partials main template , components have identical containing <div> , can code in way avoids having repetition across components? <div class="component"> <h3>component one</h3> <p>lorem ipsum...</p> </div> <div class="component"> <h3>component two</h3> <p>dolor sit amet...</p> </div> the common container <div class="component"> duplicated in each file seems inefficient i'm not sure how avoid duplication. so have template called 'home.mustache' , has: <div class="main"> content </div> <div class="sidebar"> {{> component1 }} {{> component2 }} </div> i guess in head this, compontent-container spits out opening , closing markup (then can remove container each component): <div class="side

matlab - Reduce matrix by adding every n -

not sure how explain here goes example: a=[1 0 0 1 4 4 4 4 0 0 0 0 2 3 2 2 0 0 0 0 0 0 0 1 2 3 4 5 2 3 4 1 ] result: b=[ 1 1 13 12 5 9 5 6]; each of elements computed adding n size submatrix inside original, in case n=2 . so b(1,1) a(1,1)+a(1,2)+a(2,1)+a(2,2) , , b(1,4) a(1,7)+a(2,7)+a(1,8)+a(2,8) . visually , more clearly: a=[|1 0| 0 1| 4 4| 4 4| |0 0| 0 0| 2 3| 2 2| ____________________ |0 0| 0 0| 0 0| 0 1| |2 3| 4 5| 2 3| 4 1| ] b sum of elements on squares, in example of size 2. i can imagine how make loops, feels vectorizable. ideas of how done? assume matrix has sizes multipliers of n. if have image processing toolbox blockproc option well: b = blockproc(a,[2 2],@(x) sum(x.data(:)))

xcode - '+=' cannot be applied to two [AnyObject] operands -

i have following code try , create array of constraints add view: let views = ["button": button] let metrics = ["margin": 16] var constraints: [anyobject] = [] constraints += nslayoutconstraint.constraintswithvisualformat("|-margin-[button]-margin-|", options: 0, metrics: metrics, views: views) from understand swift arrays, should able '+=' them join two, error: "binary operator '+=' cannot applied 2 [anyobject] operands" what's wrong code? it's not because of operator. it's because passing in int supposed pass nslayoutformatoptions enum type. if pass in 1 of nslayoutformatoptions enum options parameter, error go away: constraints += nslayoutconstraint.constraintswithvisualformat("|-margin-[button]-margin-|", options: .alignallleft, metrics: metrics, views: views) or initialize nslayoutformatoptions int value want use, this: nslayoutformatoptions(rawvalue: 0) 0 have wor

string - Is Javascript's toUpperCase() language safe? -

will javascript's string prototype method touppercase() deliver naturally expected result in every utf-8-supported language/charset? i've tried simplified chinese, south korean, tamil, japanese , cyrillic , results seemed reasonable far. can rely on method being language-safe? example: "イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス".touppercase() > "イロハニホヘトチリヌルヲワカヨタレソツネナラムウヰノオクヤマケフコエテアサキユメミシヱヒモセス" edit: @quentin pointed out, there string.prototype.tolocaleuppercase() "safer" use, have support ie 8 , above, webkit-based browsers. since part of ecmascript 3 standard, should available on browsers, right? does know of cases using delivers naturally unexpected results? what expect? javascript's touppercase() method supposed use "locale invariant upper case mapping" defined unicode standard. so, basically, "i".touppercase() supposed i in cases. in cases locale invariant upper case mapping consi

angularjs - Angular JS service dependency injection error -

i new angular have been trying asynchronous validation username availability , getting "cannot read property 'username' of undefined" here service code webappservices.factory('services', ['$resource', function ($resource){ return{ users: $resource('http://localhost:8080/api/users',{},{ get:{method:'get',isarray:true}, add:{method:'post',isarray:false}, update:{method:'post',isarray:false} }), username:$resource('http://localhost:8080/api/users/check/:username',{},{ check:{method:'get',isarray:false} }) };}]); here directive code passes username validation webappvalidation.directive('checkusername', ['services', function ($q, services) { return { require: "ngmodel", link: function (scope, elm, attrs, ctrl) { ctrl.$asyncvalidators.checkusername = functio

c# - Get private property of a private property using reflection -

public class foo { private bar foobar {get;set;} private class bar { private string str {get;set;} public bar() {str = "some value";} } } if i've got above , have reference foo, how can use reflection value str out foo's foobar? know there's no actual reason ever (or very few ways), figure there has way , can't figure out how accomplish it. edited because asked wrong question in body differs correct question in title you can use getproperty method along nonpublic , instance binding flags. assuming have instance of foo , f : propertyinfo prop = typeof(foo).getproperty("foobar", bindingflags.nonpublic | bindingflags.instance); methodinfo getter = prop.getgetmethod(nonpublic: true); object bar = getter.invoke(f, null); update : if want access str property, same thing on bar object that's retrieved: propertyinfo strproperty = bar.gettype().getproperty("str", bindi

how many partition key for a Cassandra table? -

partition key cassandra table? in customer table customerid partition key? suppose have 1 million customers in year have 1 million partitions after 10 years have 10 million customers or more ... have 10 million paritions so question ? 1) if want read customers table (10 million partition) affect read performance ? note : in single partition may have 50 100 columns ? you have right idea in you'll want use data modeling create multi-tenant environment. caveat you're not going want full table/multiple partition scans in cassandra retrieve data. it's pretty documented why, anytime have highly distributed environment, want minimize amount of network hops, data shuffling, etc. can't fight physics :) anyways, sounds reporting type of use case - you're going need use spark or type of map , reduce efficiently report on multiple partitions this.

html - Scrapy xpath construction for tables of data - yielding empty brackets -

i attempting build out xpath constructs data items extract several hundred pages of site formatted same. example site https://weedmaps.com/dispensaries/cannabicare as can seen site has headings , within headings rows of item names , prices. trying extract sections, item names, , item prices whether per gram, 8th, ounce or edibles price per unit , keep them categorized. example scrapy item fields following: sativa_item_name=scrapy.field() sative_item_price_gra,=scrapy.field() sativa_item_price_eigth=scrapy.field() sativa_item_price_quarter=scrapy.field() edible_item_name=scrapy.field() edible_item_price_each=scrapy.field() and on , forth. able extract item names , price/gram xpaths such following: response.xpath('.//div/span[@class="item_name"]/text()'].extract() response.xpath('//div[@data-price-name="price_gram"]/span/text()').extract() i can't figure out how extract items within heading containers, price per gram items in hybrid

c# - Writing a generic method and the compiler expects T to be a known type -

this question has answer here: cannot create generic method: “t” not found 1 answer i writing generic extension method. compiler not accept generic parameter. compiler message the type or namespace name 't' not found (are missing using directive or assembly reference? can point out should differently? here code public static class ienumerableextensionmethods { public static stack<t> tostack(this ienumerable<t> source) { var reversed = source.reverse(); if(source icollection<t>) return new stack<t>(reversed); var returnstack = new stack<t>(reversed.count); foreach (t item in reversed) returnstack.push(item); return returnstack; } } your method signature needs type parameter: public static stack<t> tostack<t>(this ienumerable<t> source) as side

python - easy method for spliting substrings of a given length from a string -

i have 34-mer string like atggggtttccc...ctg i want possible 6-mer substrings in string. can suggest way this. assuming have contiguous, can use slicing in list comprehension >>> s = 'agtaatggcgattgagggtccactgtcctggtac' >>> [s[i:i+6] in range(len(s)-5)] ['agtaat', 'gtaatg', 'taatgg', 'aatggc', 'atggcg', 'tggcga', 'ggcgat', 'gcgatt', 'cgattg', 'gattga', 'attgag', 'ttgagg', 'tgaggg', 'gagggt', 'agggtc', 'gggtcc', 'ggtcca', 'gtccac', 'tccact', 'ccactg', 'cactgt', 'actgtc', 'ctgtcc', 'tgtcct', 'gtcctg', 'tcctgg', 'cctggt', 'ctggta', 'tggtac']

java - How to set Holo light theme for all android application -

i accidentally did in layout , of activities dark colored white text "inside textviews", before of them grey color black text, searched internet believe somehow changed activities "holo light" "holo dark", how can default theme back? ps. don't believe problem layouts because didn't touch them. ps. here manifest : <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.excellence.youniversity" android:versioncode="2" android:versionname="1.1" > <uses-sdk android:minsdkversion="9" android:targetsdkversion="22" /> <supports-screens android:largescreens="true" android:normalscreens="true" android:resizeable="true" android:smallscreens="true" /> <application android:allowbackup="true" android:

javascript - Using Ajax and PHP to insert a result in my db and then display it -

i'm attempting create shipping status page , want basic feature work. want able press button on page says "mark shipped". want button's text change "shipped". want option change status of "mark shipped', have alert prevent doing until click proceed or that. i attempting php , ajax. i've never used ajax before or js, i'm not sure on how use 2 simultaneously. i have created database table house status of 'shipped' status, whenever click 'mark shipped' button word 'shipped' go db table id of order , want word shipped echo button , remain there indefinitely. php query working great until changed action of ajax script. so table.. if( $result ){ while($row = mysqli_fetch_assoc($result)) : ?> <form method="post" action="shippingstatus.php"> <tr> <td class="tdproduct"><?php echo $row['order_id&#