Posts

Showing posts from July, 2015

c# - Checking value in column foreach row -

the datatable (dt) stores retrieved values of carid's , makes stores 3 rows within datatable, have datatable called dt2 stores carid's , makes, trying loop through each row in dt see if carid stored in dt exists in of rows in dt2, here have far: datatable dt = w.getusercars(userid); foreach (datarow dr in dt.rows) { string carid = dr["carid"].tostring(); } how do this? you should able achieve using datatable.select() method. on right track. need add method find row (s) in dt2 . datatable dt = w.getusercars(userid); datarow[] foundrows; foreach (datarow dr in dt.rows) { string carid = dr["carid"].tostring(); foundrows = dt2.select("carid = " + carid); // stuff here foundrows foreach (datarow r in foundrows) { r.delete(); } }

android - Exchange between activity and a service -

i have 2 activities , 1 service in 1 app activity2 start , stop service activity1 main ui the service have 2 supposed tasks: 1- receive data server though socket , pass activity1 update user interface 2- receive data activity1 , send sever the problem wasn't able have clear idea how can make service exchange data activity i read aidl , binding here http://developer.android.com/guide/components/bound-services.html i couldn't apply on codes, after 3 weeks of hard work didn't !!! thank ! service: public class netservice extends service { public static client client = new client("192.168.1.5"); thread call; bufferedwriter out; int a; string a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15; public static int = 5; intent intent2; notificationmanager mnm; private final ibinder mbinder = new localbinder(); /** * class used client binder. because know service * runs in same process clients, don't need deal ipc. */ public class localb

java - Unable to bind spring form checkbox -

i trying display full name, along checkboxes supervisor , manager. these 2 checkboxes checked if person has values these true. what trying display users full name , supervior , manager columns having checkboxes , these checked or unchecked, , when form submitted changes binded well. tried model attribute don't have luck. here's have far. controller @controller @requestmapping("/person.html") public class personscontroller { @autowired private personservice personservice; @requestmapping(method = requestmethod.get) public string initform(@modelattribute("personview")personview personview, bindingresult result, model model) { list<person> persons= personservice.getpersonlist(); personview persondata = new personview(); personview.setpersonlist(persons); model.addattribute("personview", persondata); return "member"; } @requestmapping(method = reque

sql server - SQL Case Statement (Understanding) -

i ran across case statement in database. i'm trying figure out does. case statement trying forecast sum of toys week. below case statement can break down , explain me. case when row_number() over(order datetbl.[date]) <> count(*) over() null else isnull(case when case when row_number() over(order datetbl.[date]) = count(*) over() (sum([toy])/(datepart(dw,getdate())-1))*7 end = 0 sum(toy) + 1 else case when row_number() over(order datetbl.[date]) = count(*) over() (sum([toy])/(datepart(dw,getdate())-1))*7 end end,0) end [toyforcast] thanks i've added comments query try break down bit bit. case when row_number() over(order datetbl.[date]) <> count(*) over() --this checks if on last row of dataset, if not => put null in column null else isnull(case when case when row_number() over(order datetbl.[

angularjs - Attribute ng-view not allowed on element div at this point -

i've been receiving error using validator.w3.org html5 "attribute ng-view not allowed on element div @ point" how can solve problem passing ng-view through div ? <div ng-view></div> it specified somewhere on angularjs site if want valid html should place data- before every ng-something . you <div data-ng-view></div> will make example valid. hope helps. +1 answer

database - how should I design tables to store a data in a specific format based on user nationality? -

let's have data regarding size differs based on user nationality, example trousers size. example italy uses different sizing scheme usa. want ask user insert trouser size based on sizing scheme of nationality. let's user selects italy, user presented list of possible italian trousers sizes. how do based on stored nationality in user_data table? example: user table user_name user_nationality user_trouser_size size table italian_sizes american_sizes when registering user sets nationality, example "italian" when asked chose size trousers system return automatically italian_sizes size table , store user account. what tables need , how reference between them? thanks here 1 simple way store them. it's no means way, nor best, think it's reasonably sound , understandable. code sql server other database systems should similar. create table sizes ( countrycode nvarchar(3), size int, constraint px_sizes primary key(countrycode,s

android - Make asynchronous http calls synchronous while displaying progress bar? -

i want json web service ,displaying progress circle , processing , displaying data. how make asynchronous calls synchronous without jdts , loading circle ?any library or else? for example ....some code call json webservice //wait http call execute while displaying loading circle update ui well, 1 solution using progressdialog, other progressbar, progressdialog send dialog progress circle. for progressdialog should know: progressdialog = new progressdialog(mainactivity.this); progressdialog.settitle("downloading json ..."); progressdialog.setmessage("download in progress ..."); progressdialog.setprogressstyle(progressdialog.style_horizontal);//horizontal progressdialog.setprogressstyle(progressdialog.style_spinner); //circular progressdialog.setprogress(0); progressdialog.setmax(20); // progress has 20 steps progressdialog.setindeterminate(true);// infinite loop in progress progressdialog.show(); for asynctask should know: doinbackgroun

java - How do you define and inject a bean with annotations in Spring Boot? -

my bean definition looks this: @enablews @configuration public class webserviceconfig extends wsconfigureradapter { @bean public executorservice executorservice() { return executors.newfixedthreadpool(5); } } i want use bean in class this: @endpoint public class soapendpoint { @autowired private executorservice executor; } is correct? i'm curious because output says injected instance has pool size of 0 instead of 5. system.out.println(executor); java.util.concurrent.threadpoolexecutor@1058b8a[running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]

java - Why can't I generate this GUI? -

this question has answer here: what nullpointerexception, , how fix it? 12 answers so i'm trying create gui ball controlled buttons run through maze. begin want create frame few directional buttons , whenever try run in eclipse comes error not specific @ all. code below. error points "buttontl, buttontr, buttonbl , buttonbr" sections of code. thank can provide. the error is: exception in thread "main" java.lang.nullpointerexception @ mazeassignment.one.creategui(one.java:55) @ mazeassignment.one.main(one.java:23) import java.awt.*; import java.awt.event.*; import javax.imageio.imageio; import javax.swing.*; public class 1 extends jframe implements actionlistener//, changelistener { private jbutton buttonright, buttonleft, buttonup, buttondown, buttonplay, buttonexit, buttonreset, buttongrid, buttontl, buttontr, butt

Use Neo4j for an instant messaging webApp -

how graph database neo4j perform on instant messaging webapp ? information on matter appreciated :) ! nosql databases neo4j great when used transaction databases, loads of transactions occur. superior relational databases when relationships between nodes increasing. system instant messaging app can setup relationships between users, 'know' each other. or can have image node , create relationship between image , user. connection/relationship system able supply related node properties faster because has direct links, compared relational database table joins.

AngularJS and Laravel Blade: Module Error when changing the interpolateProvider (Delimiter) -

i have strange problem when combining laravel 5 (with blade) , angular 1.3. i experienced laravel, newbie angular. know have change angular's delimiters able make work laravel's blade. so here did: //app.js (function(){ var app = angular.module('teammanager', [], function($interpolateprovider) { $interpolateprovider.startsymbol('<%'); $interpolateprovider.endsymbol('%>'); }); app.controller('teamcontroller', function(){ // }); })(); an in view-file definded ng-app , ng-controller. goal iterate through json. json not part of js above - aware of that. <div class="container" ng-app="teammanager"> <hr> <div class="row" ng-controller="teamcontroller team"> <div class="col-xs-4"> <div class="teamlist-container"> <table class="table table-striped"> <tr ng-repe

Insert multiple rows and documents from JSON files to MySQL database with PHP -

i wrote php code extract values json file , insert them mysql database. <?php //connect mysql db $con = mysqli_connect("localhost","root","","db_tweets") or die('could not connect: ' . mysql_error()); //read json file contents $jsondata = file_get_contents('prova.json'); //convert json object php associative array $data = json_decode($jsondata, true); foreach ($data $u => $z){ foreach ($z $n => $line){ //get tweet details $text = $line['text']; $id_tweet = $line['id_str']; $date = $line['created_at']; $id_user = $line['user']['id_str']; $screen_name = $line['user']['screen_name']; $name = $line['user']['name']; $sqlu = "insert user(id_user, screen_name, name) values ('".$id_user."', '".$screen_name."', '".$name.&q

What is "Staged rollout" on Google Play Developer? -

when @ detailed statistics app, namely "current installs device" filter, can see sections: top 10, staged rollout, beta , alpha. i not sure term staged rollout refer to? it's more strange because there no builds pushed yesterday , today (reasonable today). number of builds being sent users' devices? if remember, when publish app, user not notified immediately, after few days. google makes priority based on app's population. ps. i've asked on android enthusiasts, told me question concerned developers. if think wrong place question, please suggest should post it. you can release app update production using staged rollout, release app update percentage of users , increase percentage on time. new , existing users eligible receive updates staged rollouts. staged rollouts can used app updates, not when publishing app first time. when increase percentage of staged rollout, original group of users eligible receive apk included. if upload new ap

ruby on rails - Using Figaro and Secrets.yml to Manage Env Variables -

i have rails 4.1 app , i'm trying organize env variables. of right have secrets.yml file in config/ folder. installed figaro gem. goal have env variables in application.yml (not checked git) file , use secrets.yml (checked git) file map variables appliation.yml application. when print files using rails.application.secrets shows hashes this: :salesforce_username=>"env['salesforce_username']" none of external services working env variables setup. when view traces, env['account_id'] being passed through in requests this: v2/accounts/env['account_id']/envelopes in addition, cannot access env variables using rails.application.secrets.account_id in app. secrets.yml development: account_id: <%= env['account_id'] %> aplication.yml development: account_id: "123456" application.rb # preload tokens in application.yml local env config = yaml.load(file.read(file.expand_path('../application.yml', __f

php - MySQL link to return results -

i have image displayed table , want user able click image directs them page returns rest of data row. need php loop this? can't quite figure out. returns last name, first name, , image: <?php if (isset($_get['lastname'])) { $ln = $_get['lastname']; } include 'connection.php'; $query = "select * residents lastname '$ln%' "; $result = mysql_query($query); while($person = mysql_fetch_array($result)) { ?> <div class="media col-sm-4"> <a class="pull-left" href="redirectionpage.php?<?php echo $person['id'];?>.php"> <img class="media-object" src="upload/<?php echo $person['picture'];?>" width="100" height="100"/> </a> <div class="media-body"> <h4 class="media-heading"><?php echo $person['lastname'

javascript - Reading files in multiple directories, matching filenames with their data using Node and Promises -

i have array of directories. var directories = ['/dir1', '/dir2']; i want read files under these directories, , in end have object matches filenames base64/utf8 data. in case these files images. resulting object might like: var result = { '/dir1': { 'file1': 'ivborw0kggoaaaansuheugaaaoeaaadhcaiaaacx0uutaaaagxrfwhrtb2z0d2fyzqbbzg9izsbjbwf...', 'file2': 'ivborw0kggoaaaansuheugaaaoeaaadhcaiaaacx0uutaaaagxrfwhrtb2z0d2fyzqbbzg9izsbjbwf...' } } i implemented callback hell, when try promises, i'm not sure how pass directory information, , filename succeeding then() , map() functions. in example below i'm using bluebird library: const promise = require('bluebird'), fs = promise.promisifyall(require('fs')); var getfiles = function (dir) { return fs.readdirasync(dir); }; promise.map(directories, function(directory) { return getfiles(directory) }).map(function (files) { /

three.js - Select the zone where to draw shadows with DirectionalLight -

i use directional light cast shadow on ground of scene. have single object. decided have small shadow keep shadow quality. problem can't manage shift position of shadow camera , keep on top of object. i tried several things. targeting object works center of camera don't change, angle. don't want behavior. want keep same light direction. changing shadowcameraright of light nothing change changing shadowcameraright of shadowcamera, nothing change changing position of sahdowcamera. "debugger" moves shadow stop being drawn if did not anyting i think there must pretty easy way of doing not find it. edit : var light = three.directionallight(...); var myobject = three.mesh(); //moving everyframe //here want move shadowcamera object stay in frustum best why not using object3d? var light = three.directionallight(...); var myobject = three.mesh(); val alltogether = new object3d(); alltogether.add(light); alltogether.add(myobject); // here se

css - Rmarkdown html matrix output width too narrow -

i'm aware of existing options make output wider : option(width=200) the issue when using rmarkdown go straight r file html , output bounded size of html box, not predetermined r option line width. what css option or similar change wider output box? i think you're looking max-width property of .main-container. default bootstrap theme sets 940px. can change adding top of rmd file: <style type="text/css"> .main-container { max-width: 1280px; } </style>

javascript - jQuery - Childs -

i wondering how change specific child of element. in case want change first of ul. tried this: [html , jquery] <body> <ul id="nav"> <a href="#"><li>1</li></a> <a href="#"><li>2</li></a> <a href="#"><li>3</li></a> <a href="#"><li>4</li></a> <a href="#"><li>5</li></a> <a href="#"><li>6</li></a> <a href="#"><li>7</li></a> <a href="#"><li>8</li></a> </ul> <div id="hidden"> <h1>text</h1> <img src="#"> </div> <script> var main = function() { var el1h1 = "text"; var el1p = "some text again."; $('ul').child().click(function() { $

Switching quickly between different C styles in emacs -

what best way define multiple different c-styles in emacs , easily? have 1 project requires google c/c++ style while else uses bsd. have key combination allow me change between style provided by https://google-styleguide.googlecode.com/svn/trunk/google-c-style.el and standard "bsd" emacs style. instead of key combination, suggest using directory-local variables . modified example documentation should work: ((c-mode . ((c-file-style . "bsd")))) put file called .dir-locals.el in root of project, , adjust value c-file-style necessary.

php - Imagick convert CMYK JPG to PNG and transparency -

Image
i have cmyk jpg file need cut parts , save cmyk png file. problem open jpg file , save png file colors shifted massively. i've been trying fix day , have exhausted available resources on , google. here's code: $imagestick = new imagick("original.jpg"); // cmyk jpg $largestick = new imagick(); // create bigger png file transparent background $largestick->newimage($smallstick->getimagewidth(), $smallstick->getimageheight() * 3, new imagickpixel('transparent'), 'png'); $largestick->compositeimage($smallstick, imagick::composite_default, 0, 0); $largestick->writeimage("resampled.png"); and here images: - original - download file - resampled any ideas why happening? i've tried copying possible profiles , image properties original jpg file: foreach ($smallstick->getimageprofiles() $name => $profile) !empty($profile) && $largestick->setimageprofile($name, $profile); foreach ($smallsti

loops - Django: Save same formset multiple times -

this might sound stupid, have model_formset single model in views passed template. in template place formset inside loop: <form action="generate/" method="post"> {% csrf_token %} {{ formset.management_form }} {% count in formset_count %} <p id="{{ count }}">{{ formset }}</p> {% endfor %} <div class="submitbutton" style="text-align: center;"> <input type="submit" value="submit"> </div> </form> formset_count range of 1 5. have javascript automatically enters necessary values in formset , each formset different. submit , save 5 formsets simultaneously hitting submit button once. in generate views have normal: f = myformset(request.post) if f.is_valid(): f.save() return httpresponse("saved") else: return httpresponse(f.errors) this saves last formset in loop. is possible save 5 formsets (the same for

c# - Excel does not start correctly when impersonating users running as a service -

running excel service not recommended, know. :-) problem: starting excel windows service work fine. multiple instances can work side side seamlessly. problem arises necessity run queries against analysis services. unfortunately user id/ password properties of analysis services connection not used when not using http protocol. msas ole db connection pass on user of running process. makes necessary not start excel service impersonation beforehand. (if has better idea here, welcome!) to let excel impersonated process.start in c# not work anymore uses createprocesswithlogonw under hood leads access denied error message when running service while trying load user profile. steps: logonuser impersonate loaduserprofile getenvironmentblock createprocessasuser the problem after isnt excel doesnt start @ or gives error messages, doesnt have windows. threads available no windows iterate. is there out there having experience that? note: if code necessary, happy add it, bu

java - How to remove duplicate Key-Value pair in Hashmap ? - Not just duplicate Key or Value -

i have hashmap in java retreaving apis of softwares system. so, have this: [softwareid, softwareapi] when ask apis software systems, receive: [ [softwareid, softwareapi], [softwareid, softwareapi], [softwareid, softwareapi] ] but have problem, need remove duplicates softwareapis per software. for example when iterate on hashmap get, [ [0, a], [0, b], [0, a], [0, a] ]; [ [1, a], [1, b], [1, b], [1, c] ]; [ [2, a], [2, b], [2, a] ]; but need remove duplicated pairs, this: [ [0, a], [0, b] ]; [ [1, a], [1, b], [1, c] ]; [ [2, a], [2, b] ] just add code information here part of code: // hashmap apis per user/systems hashmap<integer, set<api>> apispersystem = new hashmap<integer, set<api>>(); /** * stores api in data model * @param system user * @param api item * @return newly added api */ public api addapis(int system, string api) { api r = new api(system,api); apis.add(r); set<api> systemapis = apisperuser

javascript - Implementating wizard (jquery.steps) in Yii2 framework -

i implement wizard (with forms) application. therefore, use jquery.steps (which can find here. i have created assetbundle containing correct js files namespace app\assets; use yii\web\assetbundle; class wizardasset extends assetbundle { public $basepath = '@webroot'; public $baseurl = '@web'; public $css = [ 'css/site.css', 'css/smart_wizard.css', 'css/jquery.steps.css', ]; public $js = [ 'js/jquery.steps.min.js', ]; public $depends = [ 'yii\web\yiiasset', 'yii\bootstrap\bootstrapasset', ]; } and have following code in view: <?php use app\assets\wizardasset; wizardasset::register($this); ?> <div id="example-basic"> <h3>keyboard</h3> <section> <p>try keyboard navigation clicking arrow left or right!</p> </section> <h3>effects</h3> <section> <p>wonderful transition eff

Errors without name in AngularJS form -

i'm trying disable button if form in in isn't valid. however, reason $error array associated form holding list of ten useless errors (so button off ), following shape: { "$validators": {}, "$asyncvalidators": {}, "$parsers": [], "$formatters": [ null ], "$viewchangelisteners": [], "$untouched": true, "$touched": false, "$pristine": true, "$dirty": false, "$valid": false, "$invalid": true, "$error": { "required": true }, "$name": "", "$options": null } as can see, empty $name property, , no other helpful information. i've found solution, although not posted problem. issue was using ngif hide parts of form, containing inputs, intentionally. @ point magic idea of changing ngshow came mind, , didn't realize consequences u

c# - Can't convert my string to hex representation -

i'm receiving data using serial port, , i'm use following code convert string hex representation , show in richtextbox5: string hex = ""; foreach (char c in rxstring) { uint tmp = c; hex += string.format("{0:x2}", (uint)system.convert.toint16(tmp.tostring())) ; } richtextbox5.appendtext(hex + " <= hex"); where rxstring store data serial port. problem : when send data 127(decimal)=> 01111111(binary)=> 7f(hex) converted correctly, while when send data 191 or 167 share significant bit 1 , 8 bits output 3f despite other bits, (the representation of 8 bits start 1 3f), whats wrong code? can help, thx. this example of using bytes - , seems work want: string hex = ""; byte[] rxstring = { 0xff, 0xcf, 0xb8, 167,191 }; foreach (byte c in rxstring) { uint tmp = c; hex += string.for

amazon s3 - Spark Storage Best Practice -

i planning deploy spark cluster. spark supports many storage schema such hdfs, s3, hbase, cassandra, hive, etc. since not migrating hadoop spark, have no existing 'big data' storage , still trying figure out 1 best choice. what best way store data optimize spark fullest? use case tracking user behavior data , use spark etl create data warehouse , other data products. one thing came mind having hdfs storage in each of worker node, hadoop storage schema is.

security - Media Streaming Help AWS Cloudfront HLS RTMP -

Image
would appreciate following have been working aws while try , deliver secure streaming experience seem hit hurdle @ every step. going list them obvious. take following. progressive streaming grabbing public urls via amazon s3 , streaming . (hurdle: user can right click on players , download, or open web inspector click network refresh page , grab url). signing urls 1 of sdks $signedurl = $client->getobjecturl($bucket, 'video.mp4', '+10 minutes'); (hurdle: makes no real difference above user can still copy url in web inspector network tab , download) using cloudfront rtmp , amazon s3 (hurdle: works great browser streaming relying on flash , there no way grab url through inspect element , download, need fallback mobile in mp4 needed provided can open safari web developer tool set user agent iphone refresh , url download) using hls streaming (hurdle: works great on browser , mobile hear not supported on android devices, after playing around , creati

asp.net mvc - SignInManager.PasswordSignInAsync is lying to me -

i've been using code log in: // // get: /account/login [allowanonymous] public actionresult login(string returnurl) { viewbag.returnurl = returnurl; return view(); } // // post: /account/login [httppost] [allowanonymous] [validateantiforgerytoken] public async task<actionresult> login(loginviewmodel model, string returnurl) { if (!modelstate.isvalid) { return view(model); } // doesn't count login failures towards account lockout // enable password failures trigger account lockout, change shouldlockout: true var result = await signinmanager.passwordsigninasync(model.email, model.password, model.rememberme, shouldlockout: false); switch (result) { case signinstatus.success: return redirecttolocal(returnurl); case signinstatus.lockedout: return view("lockout"); case signinstatus.requiresverification: return redirecttoaction("sendcode", new {

c++ - I need some help formatting a file in an organized way -

i'm writing program update, delete , list tools hardware store in file. i'm able update , list tools in file in unorganized format on screen. here code output. give me idea on how format headers in file line more evenly? thanks. #include <iostream> #include <fstream> #include <string> #include "hardware.h" #include <iomanip> using namespace std; int main() { int ch = 0, count=0, rno, qty; string filename, h1, h2, h3, h4,hname; double c; ifstream infile; ofstream outfile; hardwaredata hwd[10]; cout<<endl<<endl<<"enter 1 opening data file."<<endl; cout<<"enter 2 list records."<<endl; cout<<"enter 3 add record."<<endl; cout << "enter 4 delete entry."<<endl; cout<<"enter 5 exit program."<<endl; cout<<"choice: "; cin>>ch; while(ch!=5) { switch(ch) { case 1:

parse.com - Convery my UIImageView to a PFFile in SWIFT -

i have uiimageview in storyboard, , user can select image phone place in imageview; however, i'm not sure how storyboard parse.com. any code appreciated. there lots of tutorials on downloading, not saving initially. you need take image out of uiimageview , sage pffile. var file = pffile(data: uiimagejpegrepresentation(imageview.image, 1.0)) then of course, can upload file somewhere choose.

java - Android Studio: SQlite db ListView items disappear on startActivity -

i new android studio , app creation. followed johhny mansons youtube quide new apps, , extended work greatly. my problem is, logging out of app removes items list view, upon new login. when implemented login functionality, changed loginactivity main page, following startactivity reach mainactivity.java app functional once log in. can submit picture , text, saved sqlite , display in listview tab. however, whenever log out, or tab back, , login again. data wiped. believe because startactivity executes mainactivity anew, creating new database , removing old. not quite sure of cause , why happens. before implmeneting loginactivity, app retain data fine. loginactivity (login page) mlogin = (button) findviewbyid(r.id.obutton); mlogin.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { user user = new user(dbhandlerusers.getusercount(), string.valueof(musername.gettext()), string.valueof(mpassword.gettext()), nu

php - Override Class Twig Timely all-in-one-event-calendar -

i trying override how categories display in timely's all-in-one-event-calendar. calendar uses twig display categories in , alphabetical list. need group list parent id. at location /all-in-on-event-calendar/app/view/calendar/taxonomy.php is: /** * creates html categories filter * * @param array $view_args * @return string */ public function get_html_for_categories( array $view_args ) { return $this->_get_html_for_taxonomy( $view_args ); } /** * generates html taxonomy selector. * * @param array $view_args arguments parent view * @param bool $tag whether it's tags or categories. * * @return string markup categories selector */ protected function _get_html_for_taxonomy( $view_args, $tag = false ) { $taxonomy_name = 'events_categories'; $type = 'category'; $type_for_filter = 'cat_ids'; $type_for_view_args = 'categories'; .... stuff want override.... .... twig

iphone - Performance issue, drawing app on iOS with OpenGL ES 2.0 -

i’m developing drawing app on ios, opengl es 2.0 (i begin using it). reproduce textured brushes on app. that, decided use shaders (best choice?). @ stage, have textured brushes, unfortunately, have performance problems after few seconds… here overview of app process: i receive 140 points each second. each time, on draw function, browse of points (points of contained on stroke class, contained on layer) , redraw it. code: for (int strokeid = 0; strokeid < layer->strokeslist.size(); strokeid++) { stroke* stroke = layer->strokeslist.at(strokeid); […] glvertexattribpointer(mainprogram.positionslot, 2, gl_float, gl_false, 0, stroke->vertices.position); glvertexattribpointer(mainprogram.colorslot, 4, gl_float, gl_false, 0, stroke->vertices.color); gldrawarrays(gl_triangles, 0, (int)(stroke->nbvertices)); […] } i opened suggestion improve drawing method, thank you!

c# - Hacking Razor partial views into a WebForms project in MVC5 -

so, i'm supporting project made webforms, i've upgraded mvc5 , want use razor views new features i'm adding. why want because i've no time/will rewrite stuff got pure razor view. there used hack achieve sort of stuff extending controller , rendering razor view inside aspx view partial . described here but in mvc3, applied project throws stackoverflowexception when trying render page. any ideas of achieving in mvc5? hmpf, googling topic looked obscure... actually, solution straightforward. two files: someview.aspx someview_razor.cshtml aspx 1 incorporates site.master , things need. , little fella : <% html.renderpartial("someview_razor"); %> voila!

css - Should I add the sass source map to my git repo? -

i had added style.css.map .gitignore file thinking kind of internal file not needed public consumption. now i'm seeing when chrome (not firefox) loads page, looking style.css.map , returning 404. i'm not explicitly asking load file, seems getting called automatically. why chrome looking file? should have included .map file repo? for further context, wordpress site , am including style.scss file in repo. using sourcemaps can live edit scss using devtools. for each generated css file, sass generating source map file (.map file) in addition compiled css. each css file contains annotation specifies url of source map file, embedded in special comment on last line of file: /*# sourcemappingurl= */ more info sourcemaps: https://developer.chrome.com/devtools/docs/css-preprocessors if want use sourcemaps on prod, must have .map file, if don't need it, disable generation. if using grunt run sass, check config.rb file , sass_options entry, might f

android - Kotlin and new ActivityTestRule : The @Rule must be public -

i'm trying make ui test android app in kotlin. since new system using activitytestrule, can't make work: compiles correctly, , @ runtime, get: java.lang.exception: @rule 'mactivityrule' must public. @ org.junit.internal.runners.rules.rulefieldvalidator.adderror(rulefieldvalidator.java:90) @ org.junit.internal.runners.rules.rulefieldvalidator.validatepublic(rulefieldvalidator.java:67) @ org.junit.internal.runners.rules.rulefieldvalidator.validatefield(rulefieldvalidator.java:55) @ org.junit.internal.runners.rules.rulefieldvalidator.validate(rulefieldvalidator.java:50) @ org.junit.runners.blockjunit4classrunner.validatefields(blockjunit4classrunner.java:170) @ org.junit.runners.blockjunit4classrunner.collectinitializationerrors(blockjunit4classrunner.java:103) @ org.junit.runners.parentrunner.validate(parentrunner.java:344) @ org.junit.runners.parentrunner.<init>(parentrunner.java:74) @ org.junit.runners.blockjunit4classrunner.<init>(blockjunit4classrunn

light inject - LightInject IoC container throws stackoverflow in fallback method -

i fiddling lightinject try , set ioc solution containing domain proj, infrastructure proj, mvc proj, , dependencyresolution proj. infrastructure, mvc, , dependencyresolution references domain. mvc references dependencyresolution , dependencyresolution references lightinject. the idea dependencyresolution registers necessary dependencies @ app startup. has no knowledge of controllers in mvc proj @ time. instead set fallback routine catch unknown mvc controller classes. in fallback routine register mvc controller , return it. doing expect code run 1 time, since first hit mvc controller not registered yet. not case. instead stackoverflowexception because fallback routine hit every time mvc controller asked though registered first time. so question why happens? expected behaviour , if so, why , how around it? edit: here source code below. [assembly: webactivatorex.preapplicationstartmethod(typeof(dependencyresolution.app_start.webcommon), "start")] namespace dependen

python - Parse HTML with JavaScript&jQuery - replace class names with random characters -

this question has answer here: regular expression pattern not matching anywhere in string 8 answers regex match open tags except xhtml self-contained tags 35 answers i'm trying parse html page additional javascript or jquery class names , replace random characters. can extract class names replacing causes trouble. have code far: class_ids = [tag.split() tag in re.findall(r'class=(?:"|\')([a-za-z0-9-_\s]+)(?:"|\')', html_page)] class_ids = set([item sublist in class_ids item in sublist]) for each class i'll generate corresponding random characters class name (exp. footer : sjrh13li ). replacing footer string through file replace in body text, class names title convert tag <title></title> <cjir4331></cjir4331> . i&