Posts

Showing posts from February, 2011

Find hash in another array and substract in Ruby -

i have 2 arrays of hashes this: a = [ { car_id: 1, motor_id: 1, quantity: 5 }, { car_id: 1, motor_id: 2, quantity: 6 }, { car_id: 5, motor_id: 3, quantity: 3 } ] b = [ { car_id: 1, motor_id: 1, quantity: 2 }, { car_id: 1, motor_id: 2, quantity: 3 } ] i want substract quantities each hash in b hashes in a hashes have same car_id & motor_id . so, expected result be: c = [ {car_id: 1, motor_id: 1, quantity: 3}, {car_id: 1, motor_id: 2, quantity: 3}, {car_id: 5, motor_id: 3, quantity: 3 } ] what way in ruby? thoughts iterate on a , , each element find if there in b have same car_id , motor_id , if so, substract, , continue. i suggest first create hash bqty b that, each element (hash) g of b , maps [g[:car_id], g[:motor_id]] g[:quantity] : bqty = b.each_with_object({}) {|g,h| h[[g[:car_id], g[:motor_id]]] = g[:quantity]} #=> {[1, 1]=>2, [1, 2]=>3} next, map each element (hash) g of a desired hash. done merging

javascript - How to send a query result with sequelize between model and controller -

my problem following: i have nodejs+expressjs , generated mvc project generator-express have mysql+sequelize+gulp app. i connected db , made query in model, can't pass result controller , print in screen. instead of error variable undefined. the code model (regiones.js) is: module.exports = function (sequelize, datatypes) { var regiones = sequelize.define('regiones', { idregion: datatypes.integer, nombre: datatypes.string }, { classmethods: { encontrar : function(){ sequelize .query('select * regiones', { raw: true }) .spread(function(resul, m){console.log(resul); return resul;}); } } }); return regiones }; the code controller (home.js) is: var express = require('express'), router = express.router(), db = require('../models'); module.exports = function (app) { app.use('/', router); }; router.g

django - Python - Parsing large text file and inserting data into database -

i may undertaking large of project noob, i'm trying host unofficial api kickasstorrents. currently, offer text dumps of entire database around 650mb. right i'm reading text file python , inserting database using django's orm: with open('hourlydump.txt', 'r') f: line in f: sections = line.split('|') torrent.objects.create(...) using hourly dump test (which ~900kb), came execution time of 2 minutes. scaling 700mb speed impractical. i'm thinking problem has solution, i'm not sure be. i'm sure time load entire database own still significant, i'm hoping there's more efficient solution don't know reduce execution time less 25 hours. edit: bottleneck inserting database. inserting orm: $ python manage.py create_data execution time: 134.284000158 just creating objects , storing them in list: $ python manage.py create_data execution time: 1.18499994278 i appreciate guidance mi

oop - Method Chaining PHP -

i have quick question that's killing head. i'm trying make form validation system method chaining in php what want able call example (please check code comments): $firstname = $object->forms->field("first name", "firstname"); //this 1 doesn't validate, puts what's on firstname field on $firstname. way doesn't work me, because have return object can chainable , not variable of post. how can this? $firstname = $object->forms->field("first name", "firstname")->validate(); //this 1 validates if field not empty , if it's empty it'll insert first parameter ("first name") onto array display errors. $email = $object->forms->field("email", "email")->validate()->email(); //this 1 same above validates email , inserts value of email field onto $email prefer next one... $email = $object->forms->field("email", "email")->validate->email

javascript - How could I dynamically choose a div class with an if-else statement? -

i use ext.xtemplate show data in list , want realize function when positive number, show red , green when negative. to realize function, create 2 style , want pass parameters dynamically create template this currentcontrol.balanceresulttpl +='<div class="{[{'+available_qty+'} &gt; 0 ?"summary-qty-style-red":"summary-qty-style-green"]}">{'+available_qty+'}/{'+qty+'}</div></div>'; the parameter available_qty in store , value set when template used. however, judgement statement seems don't work , confused. i have looked in sencha docs found nothing useful case. thanks! var tpl = new ext.xtemplate( '<div class="', '<tpl if="available_qty &gt; 0">', 'summary-qty-style-red', '<tpl else>', 'summary-qty-style-gr

function - Return type of list front (C++) -

so want use list part of program. i'm trying acquainted library list , wrote quick little program myself understand what's going on. works properly, there's 1 thing don't understand. according this: http://www.cplusplus.com/reference/list/list/front/ return type front function should reference of type (in case, room) of first element (the element in case). but able access values without having reference, because seems values passed directly (not reference). expected? website wrong? compiler wrong (codeblocks 13.12)? here's code: #include <iostream> #include <list> using namespace std; struct room { int content; struct room * north; struct room * south; struct room * east; struct room * west; } ; int main () { list<room> mylist; cout << ( mylist.empty() ? "list empty.\n" : "list not empty.\n" ) << endl; room * room1 = new room; room1->content = 15; cout &

java - Class with long name -

name of exception class in java must have exception suffix describe throwing situation. have 2 exception classes in primary external storage in android : /** * thrown when application tries access primary external storage , not * available write.this depends on status of storage, example media * not mounted,bad mounted, or ... . */ public class primaryexternalstorageisnotreadytowriteexception extends exception { ... } /** * thrown when application tries write on directory * of primary external storage needs * {@link manifest.permission#write_external_storage} permission * permission has not granted application. */ public class writetoprimaryexternalstoragepermisionexception extends runtimeexception { ... } as see, names long, can not remove exception or primaryexternalstorage names. not want use securityexception or other existing exceptions because general. know long names not forbidden using , reminding them hard. thing can think creating package name primaryex

Summarize Multidimensional Array in C# -

i trying find best (quickest) way summarize multidimensional array passed object. for example if have object[,] data contains data similar to: john,utah,huntsville,0120152,60 john,utah,huntsville,06122013,40 dallin,maryland,citytown,10202012,30 aaron,connecticut, harbourville,12122017,100 dallin,maryland,citytown,04232011,8 aaron,virginia,georgetown,02212013,200 this passed object defined following: string name, string state, string city, list<int> date, list<double> total so representation of data like: dallin,maryland,citytown 04232011, 8 10202012, 30 john,utah,huntsville, 0120152, 60 06122013,40 i know fetch distinct items each column use , if statments, being new programming , having extremely large dataset bit worried how long take. , being multidimensional array makes difficult sort. on how approach problem appreciated. do

unity3d - Is there a way to build asset bundle that exclude texture2d from an image? -

in unity 4.x, can archive because can select resource type directly sprite variable before putting bundle via buildassetbundle. however, in unity 5.x, need put name in editor can cannot choose resource type sprite in editor. when make bundle, bundle have both texture2d , sprite want sprite save memory , disk space. bundle exclude texture2d if create bundle prefab not image want raw image. should do? as clarification future readers, i'm taking account your other question , , reason want exclude original texture because use atlas sprite packer generates. short answer: don't add textures in bundle , let taken care of in shadows. each bundle, sprite or atlas needed referenced object needs it, included. long, insightful answer: first, let's compare 2 assetbundle buidling pipelines: in unity 4.x, create assetbundle chose assets wanted bundle together. call buildpipeline.buildassetbundle , using buildassetbundleoptions optionally collectdependencies or incl

c# - Configure routes and dependency injection outside of MVC UI -

we want move our composition root out of our ui layer , project. means moving startup class out of ui layer. how can configure routes when startup class not in ui layer's project? we have setup. the dal depends on bll , because dal implements bll interfaces. the ui depends on bll , because ui controllers call bll interfaces. the ui depends on dal , because ui's startup contains composition root . current dependency graph +---------+ ui.xproj | + | | | | | | | v | bll.xproj | ^ | | | | | | | + +---------> dal.xproj based on article , numerous examples in aspnet github account , we're wiring our dependencies within ui.startup class. article states: register dependencies in application startup method, before doing else. that's we're doing i

database - Copying (Cloning) DB to another Vertica Cluster with Different no. of Nodes and Different IP Addresses -

i have requirement have copy complete db single node installation 2 nodes cluster of vertica. per documentation not possible. are there no workaround methods performing this? we may not have same no. of nodes in different clusters when pre-prod , prod case. method must exist doing this. kindly advise on same. unfortunately not possible @ time. you can export single node, add node. side note, want @ least 3 nodes production environment. for users, roles , permissions, see datadug.com 's export script. with regards moving data, have few options: export vertica - allows for export of entire table, specific columns, or result of select copy vertica - works similiar export not allow result of select vsql - import flat files piping out input output of vsql command using copy

concurrency - Correct use of go context.Context -

i read article: build own web framework in go , sharing values among handlers picked context.context , i'm using in following way share values across handlers , middlewares: type appcontext struct { db *sql.db ctx context.context cancel context.cancelfunc } func (c *appcontext)authhandler(next http.handler) http.handler { fn := func(w http.responsewriter, r *http.request { defer c.cancel() //this feels weird authtoken := r.header.get("authorization") // fakes form c.ctx = getuser(c.ctx, c.db, authtoken) // feels weird next.servehttp(w, r) } return http.handlerfunc(fn) } func (c *appcontext)adminhandler(w http.responsewriter, r *http.request) { defer c.cancel() user := c.ctx.value(0).(user) json.newencoder(w).encode(user) } func getuser(ctx context.context, db *sql.db, token string) context.context{ //this function mimics database access return context.withvalue(ctx, 0, user{no

C# GUI on top of C hard calculation engine -

some time ago, developed mathematical plotter in c# draws functions in various geometrical spaces through old, "dumb", numerical calculations. users inserts n-variable equation or curve simplified , semicompiled, calculated entire set of combinations of values of variables in domain, , displayed. i'm working on optimization @ algorithm reduce calculations, far can see there’s no way, problems have manage, go under @ least 5*10^7 operations, in least powerful machines , in c# machine code results 1-1.5 seconds lag, unacceptable, @ least since same code implemented in c 20x faster (and that’s unoptimized version!). so modify application keeping 80% of old c# "slow" code, gui included, leaving therefore calculation , rendering part "fast" c. "slow" part must pass strings , int params "fast" engine, , receive int or byte arrays of order of 1mb. read there lot of ways make on windows (put c in dll called main c# app via p/invo

javascript - Loading a partial view into a Div AngularJS -

i'm relatively new angular , toying around simple spa, of experience comes vs , mvc 5, know can done partial views. can't seem figure out angular. in plunkr, have example: http://plnkr.co/edit/h4yyrnvwltisoahyhvxa?p=preview basically, dynamic list of links point different view, have home. however can't seem view load when hardcoded. i think should using ng-include: <div class="col-lg-12" ng-include ng-src="home.html"> </div> i don't recommend use ng-include kind of logic. angular router , angular new router , , ui-router have functionality, , have many features built in. however, address concern specific code snippet, ng-include expects value passed it. value passed should model property evaluates string, or string constant. in case of string constant, should included in single quote ' . so, try this: <div class="col-lg-12" data-ng-include="'home.html'" > </div&g

java - Does jooq offer a class similar with DataTable in C# to load data from ad-hoc queries? -

does jooq support running ad-hoc queries? wondering if provides data structure, similar c# datatable (or java cachedrowset) can store data query , support different rdbmses features such oracle cursor columns. thanks does jooq support running ad-hoc queries? yes. of jooq running ad-hoc queries. i wondering if provides data structure, similar c# datatable (or java cachedrowset) can store data query , support different rdbmses features such oracle cursor columns comes mind. no, that's not supported if understand correctly, on roadmap: https://github.com/jooq/jooq/issues/1846

wso2is - Service Provider and Identity Providers lists do not show changes in cluster node with WSO2 Identity Server -

two identity server cluster nodes, running 5.0.0, have been created. when idp or sp created on first node, second node not see entry until idp or sp added on node. displays correct entries. clicking on "list" option refresh not show entries. the identity server nodes running on rhel6 backend database pointing microsoft sql server , user repository against active directory. i resolved installing latest service pack http://wso2.com/products/identity-server/

javascript - 10 million puts failing in LevelDB -

i got started leveldb , wondering if answer few questions me. running on centos vm 8 gb ram, 20 gb storage, 2 cores, , intel i7 processor. don't know if matters. i wanted test performance of leveldb attempted 10 million puts sequentially, (not in batch) , not able to, got out of memory error. when did top, saw node using 25% of available memory. doing wrong? here code: var level = require('level'); var db = level('test.db' { valueencoding: 'json' }); (i = 0; <= 10000000; i++) { var value = { 'value': }; db.put(i.tostring(), value); } when failed, tried 1 million puts happened in 2-3 seconds without problems. upped 3.5 million , got out of memory error after 40 mins of waiting. noticed code manages go through of puts makes bunch of *.ldb files in test.db , continues make them until run out of memory. could maybe explain me whats going on?

SSIS ScriptTask hangs on Debug -

new ssis packages. working ssis package in visual studio 2013 after installing sql server data tools visual studio 2013 https://www.microsoft.com/en-us/download/details.aspx?id=42313 when edit scripttask, opens visual studio 2012. place breakpoint on line of code want hit in main() method. scripttask's entrypoint set main(). when debug ssis package, gets scripttask , opens visual studio 2012 , that's it. never hits breakpoint. hangs. modal window says window close when debugging has stopped. window has single button on says "stop debugging". does know happening here? how can hit breakpoint, can debug code? thanks to able have debugger hit breakpoint, should change ssis project's "run64bitruntime" propery's value default true false. but that's not enough. because "script task" still compiled 64bit. should edit script task "edit script" , save again. script task code compiled 32bit. credits: http://blo

css - How can I manage browser cache in PHP? -

my idea simple, take css files , generate 1 minified in time of change in css file. tell browser clear cache. if there unchanged file in browser cache use - user don't need redownload every time. i'm using following snip of code that. part using cache bit buggy, of time works tell browser use cached version (as there no change) , browser using old 1 , user must client side cache refresh. could give me advice how that, refresh client side browser cache everytime when change occurs , if there no change use cache? $cssfiles = getcssfiles(); $fm = new fileminifier(fileminifier::type_css); $lastmodified = $fm->lastmodification($cssfiles); $savedlastmodified = dateutils::converttotimestamp($this->system->systemsettings['csslastchange']); $etagfile = md5('css-file'); header("content-type: text/css"); header("pragma: public"); header('cache-control: public'); header("last-modified: " . gmdate("d, d m y h:i:

mysql - How to minimize the usage of these subqueries and increase the performance? -

it clause of subquery (columnnm = hierarchylvl#) changing. let me know way of improving performance of query. way rewrite subquery ? put in join ? use other functions? select * (select (select top 1 itmtxt tm.code catcd = (select catcd tm.clienthierarchy objid='system' , tablenm='resume1' , columnnm ='hierarchylvl0' , delflg = 0) , delflg = 0 , lngcd in (0,-1) , itmcd = r1.hierarchylvl0) hierarchylvl0txt, (select top 1 itmtxt tm.code catcd = (select catcd tm.clienthierarchy objid='system' , tablenm='resume1' , columnnm ='hierarchylvl1' , delflg = 0) , delflg = 0 , itmcd=r1.hierarchylvl1 , lngcd in (0,-1)) hierarchylvl1txt, (select top 1 itmtxt tm.code catcd = (select catcd tm.clienthierarchy objid='system' , tablenm='resume1' , columnnm ='hierarchylvl2' , delflg = 0) , lngcd in (0,-1) , delflg = 0 , itmcd=r1.hierarchylvl2) hierarchylvl2txt, (select top 1 itmtxt tm.code catcd = (select catcd tm.clien

similarity - SQLite combine values of similar records into one -

in sqlite database have table called tracks made of following columns: artist, track, genre1, genre2, genre3. table contains many values have same artist , track values different genre1, genre2, genre3 values. example below: artist | track | genre1 | genre2 | genre3 abba | song 1 | rock | rock | rock u2 | song 4 | rock | rock | rock abba | song 1 | pop | pop | pop u2 | song 4 | pop | pop | pop abba | song 1 | 70s | 70s | 70s u2 | song 4 | 90s | 90s | 90s i need create sqlite statement amalgamate unique genre values artist , track same, example shown below: artist | track | genre1 | genre2 | genre3 abba | song 1 | rock | pop | 70s u2 | song 4 | pop | rock | 90s any hugely appreciated. unfortunately looks suffering poor database design. in design above limited 3 genre per song, , when 1 genre applicable song repeat same value across genre fields. in design should able have

Node.js + Docker Compose: node_modules disappears -

i'm attempting use docker compose bring number of node.js apps in development environment. i'm running issue, however, node_modules . here's what's happening: npm install run part of dockerfile . i not have node_modules in local directory. (i shouldn't because installation of dependencies should happen in container, right? seems defeat purpose otherwise, since i'd need have node.js installed locally.) in docker-compose.yml , i'm setting volume source code. docker-compose build runs fine. when docker-compose up , node_modules directory disappears in container — i'm assuming because volume mounted , don't have in local directory. how ensure node_modules sticks around? dockerfile from node:0.10.37 copy package.json /src/package.json workdir /src run npm install -g grunt-cli && npm install copy . /src expose 9001 cmd ["npm", "start"] docker-compose.yml

php - Twilio returning 404 error when pointing to Controller Method of Slim Framework -

i trying twilio point method in order start call. when have twimlapp pointing www.example.com/twilio/dial.php able make calls no problem, when have pointing controller method www.example.com/twilioapps/dial receive 404 error when looking @ twilio app monitor. here twilioapps/index.php : <?php ini_set('display_errors', 1); error_reporting(e_all ^ e_notice); session_cache_limiter(false); session_start(); require_once __dir__ . '/../vendor/autoload.php'; require __dir__ . '/../twilio.php'; $app = new \slim\slim(); $app->get('/dial', function (){ $twilioobj = new twilioplugin; // phone number page request parameters, if given if (isset($_request['tocall'])) { $twilioobj->number = htmlspecialchars($_request['tocall']); } // wrap phone number or client name in appropriate twiml verb // checking if number given has digits , format symbols if (preg_match("/^[\d\+\-\(\) ]+$/", $twilio

trying to convert NSData of type (BigEndian) from BlueTooth to Int of type Little Endian in Swift -

i trying convert 6 byte hex of type nsdata got via bluetooth connection appropriate integer values. know of type big endian , need covnert little endian. however, every time try convert it, can extract right data, results wrong, see playground code below: var newdata = nsdata(bytes: [0x26, 0x01, 0x45, 0x01, 0x04, 0x5e, ] [uint8], length:6) //var timedata = newdata.subdatawithrange(nsmakerange(4,2)) //var heeldata = newdata.subdatawithrange(nsmakerange(2,2)) //var frontdata = newdata.subdatawithrange(nsmakerange(0,2)) var timedata:uint16 = 0 var heeldata:uint16 = 0 var frontdata:uint16 = 0 //var timedata = data.subdatawithrange(nsmakerange(4,2)) var timein: nsnumber = nsnumber(unsignedshort: 0) newdata.getbytes(&timein, range: nsrange(location: 4,length: 2)) timedata = cfswapint16bigtohost(timein.unsignedshortvalue) //24068 var heelin: nsnumber = nsnumber(unsignedshort: 0) newdata.getbytes(&heelin, range: nsrange(location: 2, length: 2)) heeldata = cfswapint16

regex - Check If first character is "+" -

how can detect string start "+" i tried ^\s*?\+.*$ no help. p.s: have 1 line alltime. you don't need \s*? , have use: ^\+ or... ^[+] in case want check complete string, can use: ^\+.*$ working demo

JavaScript file Not Minifying Correctly -

Image
i'm trying minify javascript file website part of code in snippet causing errors when minifies. //do not hide if click on label object associated select do need part of code or important command code. if need it, need add in order minify correctly? /* hide open selects */ var jqtransformhideselect = function(otarget){ var ulvisible = $('.jqtransformselectwrapper ul:visible'); ulvisible.each(function(){ var oselect = $(this).parents(".jqtransformselectwrapper:first").find("select").get(0); //do not hide if click on label object associated select if( !(otarget && oselect.olabel && oselect.olabel.get(0) == otarget.get(0)) ){$(this).hide();} }); }; it's comment. can remove it. check out this article on javascript comments . also, can lint see if there issues. linted you: make sure you've included jquery , stuff.

objective c - Google sign-in SDK 2.0.1 for iOS error -

i'm trying integrate google sign-in in project i'm using 'google sign-in sdk 2.0.1'. have follow steps shown on developer.google site when click on button returns error 'unknown error' in - (void)signin:(gidsignin *)signin didsigninforuser:(gidgoogleuser *)user witherror:(nserror *)error i have integrated 2 url schemes , app-delegate,vc implementation shown in tutorial here code viewcontroller implement sign-in button @interface viewcontroller () < gidsigninuidelegate,gidsignindelegate> @property (weak, nonatomic) iboutlet gidsigninbutton *btnsignin; @end @implementation viewcontroller - (void)didreceivememorywarning { [super didreceivememorywarning]; // dispose of resources can recreated. } - (void)viewdidload { [super viewdidload]; [gidsignin sharedinstance].uidelegate = self; [gidsignin sharedinstance].delegate = self; } // --------------------------------------------------------------------- #pragma mark - gid

graph - Hypergraphdb weighted rdf property -

i came across hypergraphdb, seems interesting. how represent weighted rdf property , higher order relationships in hypergraphdb? you can add values relations hgvaluelink method: hghandle relationlink = hypergraph.add(new hgvaluelink("my-string-identifier", starthandle, endhandle)); "my-string-value" string object add integer or other object relation.

security - What damage can a website do? -

now , (accidentally) come across websites anti-virus warns me about. out of curiosity, kind of damage can website do? i've been working in web development around 4 years , can't think of 'genuine' damage worth warning user about. maybe i'm missing obvious, surely browsers , basic security measures implemented main operating systems prevent particularly invasive going on? i'm talking threats aside deceptive way (phishing etc.). taxing browser enough warrant anti-virus warning (i.e. overload page resource-draining javascript)? typically, cookies, caches , localstorage have limits - can't think of go on there. i suspect may off-topic, it's less technically specific i'd ask. i'll happily delete if case. the main risk encountering drive-by download . a drive-by download isn't file download in usual sense, browser exploit allows executable code download , execute on system (known payload). one example microsoft internet explo

class - PHP get value from function called by constructor -

i have feeling i'm overlooking simple can't figure out how value function called constructor within class. below simple example but, essentially, need use userid value on index.php page returned function getuser called constructor. thank in advance help! index.php: $test = new test($username); //need value of userid here.... class/function: class test { //constructor public function __construct($username) { $this->getuserid($username); } //get user id public function getuserid($username) { //db query here id return $userid; } } i should add know can initialize class call function index.php , value way. simple example of scripts i'm working on call 6 or 7 functions within constructor perform various tasks. you forgot return value of $this->getuserid($username); in constructor doesn't matter anyway in php constructors not return values. have make secon

html - Changing the size of Bootstrap's standard navbar to a smaller size -

i trying change size of twitter bootstrap's standard navbar smaller size. inside navbar, want brand/logo on left, few menu options in center, , social media icons on right. i've got them lined fine far, , i've been able make smaller... however, when screen reduced smaller size (say, mobile phone, etc) social icons positioned right of menu options, , doesn't good. what missing in css/html making social icons not position below menu options? here link have accomplished far view source: http://trevormcgrath.com/navbartest/smallnavbar.html i'd appreciate can give me here! thank in advance. set display: block; icons <ul> , use media queries style wish.

Image not showing in live server - Laravel 4.2 -

am working on laravel 4.2, can able show image in localhost, not in live server example image tag, <img src="images/data/d3ss.jpg" alt="" class="img-responsive"> works in localhost not in live server, if hit image url in browser says notfoundexception in live sever in localhost can able see image http://xxxx.com/yyy/public/data/d3ss.jpg [notfoundexception] http://localhost/yyy/public/data/d3ss.jpg [working] the image has been place in public/images/data i tried with url::to('/').'/images/data/d3ss.jpg' works in localhost not in server please guide me, how solve issue. am sorry, i found solution. have mistakenly start image file name numbers 8989_filename.jpg. when remove numbers @ front works in server. in localhost numbers 8989_filename.jpg working. any other suggestions? advice. try use html::image helper. example {{ html::image('img/picture.jpg', 'a picture', array('cl

c# - Using OxyPlot in WindowsForms -

so far, i've seen on oxyplot documentation, not out there. how take x-y points , graph them using oxyplot? here attempt @ taking 2 points , graphing them: var datamodel = new plotmodel { title = "data plot" }; foreach (var pt in dataprofile) { xydata.text = string.format("x:{0} y:{1}", pt.x,pt.y); datamodel.series.add(pt.x, pt.y); //(obviously wrong here) this.plot1.model = datamodel; } what need change/add to: datamodel.series.add(pt.x, pt.y); , adds points? additionally, how can plot points on time? (x-y, plotted time t passes by) does know of oxyplot tutorial site (for winforms), because cannot find 1 (apart oxyplot documentation, broad @ best). i know you've mentioned winforms , must able comfortable looking @ of examples , of source code, regardless of ui framework being used. additionally, @ of examples: http://resources.oxyplot.org/examplebrowser/ anyways, want scattierseries plot. add points it. example:

java - Android HorizontalScrollView Snap and Center Focus -

Image
fairly new android dev. trying create horizontalscrollview snaps , filters images based on centered object selected in list. in picture below, notice how letter in center of screen should perform set of specific commands. example, when scroll "c" popup message "c" should pop up. i have created horizontalscrollview , populated view buttons. trying figure out how make snap , how identify letter in center @ given moment. i have taken @ viewpager, don't think able have described because have set of letters displayed @ moment. understand have create custom class. provide guidance?

Spring Boot 1.2.4.RELEASE cannot generate a simple Startup Project -

i using spring boot version 1.2.4.release generate simple web project. full url creating project is: http://start.spring.io/starter.zip?name=demo3&groupid=org.test&artifactid=demo3&version=0.0.1-snapshot&description=demo+project+for+spring+boot&packagename=demo3&type=maven-project&packaging=jar&javaversion=1.7&language=java&bootversion=1.2.4.release&dependencies=web the download starter project opened in sts 3.6.4.release tons of errors: missing artifact, artifactdescriptorexception pom.xml file. however, if use version 1.1.12.release of spring boot, have no problem create startup project. is bug in 1.2.4.release of spring boot? doubt it. the project ok. please check local env, specially connexion, maven configuration (setting.xml), ...etc good luck

How to get images for a youtube video of all size for a youtube channel? -

i want of different images youtube stores of videos channel guitar3covers for video https://www.youtube.com/watch?v=i03uuxgpwd8 video id is: "i03uuxgpwd8". can same image both http://img.youtube.com/vi/i03uuxgpwd8/0.jpg , http://img.youtube.com/vi/i03uuxgpwd8/hqdefault.jpg . want images stored youtube. there 4 different images why getting same image. various sizes of 0.jpg, except 1.jpg, 2.jpg , 3.jpg screen caps different stages of video. for reference, youtube stores 9 thumbnails each video: http://img.youtube.com/vi/i03uuxgpwd8/0.jpg (480x360px) http://img.youtube.com/vi/i03uuxgpwd8/1.jpg (120x90px) http://img.youtube.com/vi/i03uuxgpwd8/2.jpg (120x90px) http://img.youtube.com/vi/i03uuxgpwd8/3.jpg (120x90px) http://img.youtube.com/vi/i03uuxgpwd8/maxresdefault.jpg (1920x1080px) http://img.youtube.com/vi/i03uuxgpwd8/sddefault.jpg (640x480px) http://img.youtube.com/vi/i03uuxgpwd8/hqdefault.jpg (480x360px) http://img.youtube.com/vi/i03uuxgpwd8/mqde

amazon web services - Where to put ebextensions config in AWS Elastic Beanstalk Docker deploy with dockerrun source bundle? -

i having trouble getting docker elastic beanstalk deploy read .ebextensions/setup.config file. the documentation eb environment configuration says: you can include 1 or more configuration files source bundle. configuration files must named extension .config (for example, myapp.config) , placed in .ebextensions top-level directory in source bundle. however looks docker source bundle not .zip or .war file, .json file, e.g., docs create dockerrun.aws.json file —and looks source bundle? in creating version of app upload custom dockerrun-$version.aws.json file s3 , run following (where $app versioned dockerrun json file): aws elasticbeanstalk create-application-version \ --application-name $app_name \ --version-label $version \ --source-bundle s3bucket=$s3_bucket,s3key=$s3_path/$app so… how .ebextensions directory going found in top-level directory of source bundle when “bundle” json file ends building container? (my first attempt put in root of project

powershell - Add Custom Argument Completer for Cmdlet? -

Image
how add dynamic argument tab completion powershell cmdlet? when type , hit tab , i'd tab completion. pm> paket-add -nuget fsharp.co these values i'd use in example: pm> paket-findpackages -searchtext fsharp.co fsharp.core fsharp.core.3 fsharp.configuration fsharp.core.fluent-3.1 fsharp.core.fluent-4.0 fsharp.compiler.tools fsharp.compatibility.scala fsharp.compatibility.ocaml fsharp.compiler.codedom fsharp.compiler.service fsharp.control.reactive fsharp.compatibility.haskell fsharp.compatibility.ocaml.numerics fsharp.compatibility.ocaml.format fsharp.compatibility.ocaml.system fsharp.collections.parallelseq fsharp.compatibility.standardml fsharp.compatibility.ocaml.lexyacc fsharp.control.asyncseq i found this answer gave couple of helpful links , said should run get-content function:tabexpansion2 : it looks commandcompletion.completeinput needs implemented. thought read somewhere there hashtable of commands functions. if so, , how install custom ones?

row - Subtracting Columns in R -

i have 2 columns trying subtract , put new one, 1 of them contains values read '#null!', after converting on spss , excel, r reads factor , not let me subtract. easiest way fix knowing have 19,000+ rows of data? while reading dataset using read.table/read.csv , can specify na.strings argument values needs transformed 'na' or missing values. so, in dataset be dat <- read.table('yourfile.txt', na.strings=c("#null!", "-99999", "-88888"), header=true, stringsasfactors=false)

arrays - printing an string in cross manner using c program -

i'am trying write program converting given string in cross manner(i.e diagonal left-right , right-left). if string length returns message else arrange in cross form. the code is: #include<stdio.h> #include<string.h> int main() { char str[50]; char str2[50][50]; int lenstr; int i,j; char temp; printf("enter string :\n"); scanf("%s",str); lenstr = strlen(str); if(lenstr %2 == 0) { printf("the string length must odd length"); } else { j = 0; temp = 0; for(i = 0;i == lenstr;i++) { str2[i][j] = str[i]; j = j + 1; } for(i = lenstr; i==0 ;i--) { j = lenstr; str2[i][j] = str[temp]; temp = temp + 1; j = j - 1; } for(i = 0;i<lenstr;i++) { for(j = 0;j<lenstr;j++) {

regex - How to FULLY replace all special characters in PHP wihtout leaving any HTML Entity in the result -

i need php replace function trying create. basically, want fylly convert special characters á, é, í, ó, ú, ü, ñ, Á, É, Í, Ó, Ú, Ü, Ñ , on this: a, e, i, o, u, u, n, a, e, i, o, u, u, n . below explained why "fully convert". now have managed half way using below function: function clean_url($text){ $text = preg_replace('~&([a-z]{1,10})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities($text, ent_quotes, 'utf-8')); return $text; } this @ first glance gives me desired result when viewed in mysql or browser, in php: $string = "Ábalos"; echo clean_url($string); html page source code output: abalos . right @ first glance. but when $string = "Ábalos"; echo htmlentities(clean_url(($string)); html page source code output: a&acirc;?balos . i want able replace function part &acirc;? . how can achieved? i found function (in thread : how remove accents , t

in app purchase - Video tutoarial app IOS -

i developing app helps users purchase tutorial videos. our plan integrate payment through uiwebview . user can payment fill form in webview. once payment, track payment through webservice , can view video through app. my question apple approve app? because there no in-app purchase. they reject you. check section 11.2 in app store review guidelines 11.2 apps utilizing system other in-app purchase api (iap) purchase content, functionality, or services in app rejected

laravel - Can not change directory to the .ssh folder using command line -

basically, want change .ssh folder. typed mikesdemacbook-pro:~ mike$ cd .ssh and here result: -bash: cd: .ssh: not directory this typed try find folder: mikesdemacbook-pro:~ mike$ ls -ls .ssh 8 -rw------- 1 mike staff 1675 jun 19 00:53 .ssh i not sure whether there problem. have created ssh keygen still shows "not directory". it looks keygen not run correctly or there .ssh file on computer. in comment try deleting .ssh file , rerunning ssh-keygen .

javascript - Observe MyArray().length knock out -

is possible store length on observable array in observable variable , bind view, this? self.myarray = ko.observablearray([]); self.myarraylength = self.myarray().length; //bind in view self.observelength = ko.observable(self.myarraylength); when alert myarray length seems update proper, cant update in view? because myarraylength isn't observable, won't update when observable does. need computed function instead. you should have: self.myarray = ko.observablearray([]); // bind in view self.observelength = ko.computed(function(){ return self.myarray().length; });

How to append data to pandas multi-index dataframe -

how can append data pandas multi-index dataframe? use following code create dataframe data. df = pd.dataframe.from_dict(output, orient='index') i thinking maybe this... df = pd.dataframe['mmm', 'incomestatement'].from_dict(output, orient='index') dataframe merge 0 1 2 total revenue 182795000 170910000 156508000 cost of revenue 112258000 106606000 87846000 gross profit 70537000 64304000 68662000 research development 6041000 4475000 3381000 selling general , administrative 11993000 10830000 10040000 non recurring 0 0 0 others 0 0 0 total operating expenses 0 0 0 operating income or loss 5250300

Use version number in file links in Sphinx -

in sphinx, file links can generated using following syntax: `name_of_file.js <some/location/name_of_file.js>`_ in conf.py file, version variable defined can use in .rst files such: |version| including version file link using syntax not allowed: `name_of_file.|version|.min.js <some/location/name_of_file.|version|.min.js>`_ so, how can generate links files named name_of_file.<version_num>.min.js , use version number conf.py? i had need similar , after experimentation have workaround this. warned, crummy solution works. the short answer: you need split parts of link left , right of |version| , use raw html along |version| . .rst this: example of link version in |link-pre|\ |version|\ |link-post| .. |link-pre| raw:: html <a href="some/location/name_of_file. .. |link-post| raw:: html .min.js">name_of_file.min.js</a> the long answer there couple of hurdles need overcome: problem 1: now, |version| sub

ios - How call a function objective c with args in swift -

i have next function in objective c + (nsstring *)getnslog:(nsstring *)pstring, ...{ va_list args; va_start(args, pstring); nslogv(pstring, args); va_end(args); return [[nsstring alloc] initwithformat:pstring arguments:args]; } how can call function swift or convert code swift such when call function can be: getnslog("my value1 = %@ value2 = %@","hello","world") note second param not have alias how this. getnslog("my value1 = %@ value2 = %@", args:"hello","world") i solved follow: in objective c change code this: +(nsstring*)getnslog:(nsstring*)pstring args:(va_list)args{ nslogv(pstring, args); va_end(args); return [[nsstring alloc] initwithformat:pstring arguments:args]; } in swift app delegate add extension myclass { class func getnslog(format: string, _ args: cvarargtype...) -> nsstring? { return myclass.getnslog(format, args:getvalist(args)) } } now