Posts

Showing posts from June, 2012

amazon web services - Limit S3 access to specific object -

what standard procedure limiting access object on s3? the object using server side encryption. i want user able access specific object (not objects in bucket) , limited time, 5 minutes. i looked creating iam account seems user access every object in bucket. i looked generating presigned url, there no way tell has url. i found this: s3 = aws::s3.new( :access_key_id => 1234, :secret_access_key => abcd ) object = s3.buckets['bucket'].objects['path/to/object'] object.url_for(:get, { :expires => 20.minutes.from_now, :secure => true}).to_s which close i'm looking for, couldn't find similar solution in .net. thanks help. you should use pre signed urls purpose. here standard example static iamazons3 s3client; s3client = new amazons3client(amazon.regionendpoint.useast1) getpresignedurlrequest request1 = new getpresignedurlrequest() { bucketname = bucketname, key = objectkey, expires = datetime.now.addminutes...

c# - DoubleClick in listbox element to enable to edit fields -

i have form in c# in windows forms application textfields, comboboxes , checkboxes. these fields saved clicking in "add" button. there button show entries in listbox. able edit fields added entries double clicking in respective element in listbox (or clicking "edit" button if it's easier). how can accomplish this? in advance.

c++ - how can i access to a byte array of array of different size? -

i facing problem when try access array of array pointer, have several arrays declared following : byte a[5] = {0xcc,0xaa,0xbb,0xcc,0xff}; byte b[3] = {0xaa,0xbb,0xff}; thos byte arrays represents image want load in memory dll, can access them separately no difficulty, want access them loop pointer ... i tried put them array of array : byte* c[2] = {a,b}; but when want loop through pointer c[i] doesent load image @ index memory, how fix it? im trying draw images method within loop avoid repating lines ( consider c images[i]) void menuicon::drawicons(lpdirect3ddevice9 npdevice) { ismenuvisible = (pos.x < 100) && (pos.x > 0)? true : false; if(ismenuvisible) (int = 0; < 2; i++) { if (icon[i].img == null)d3dxcreatetexturefromfileinmemory(npdevice, &images[i], sizeof(images[i]), &icon[i].img); drawtexture(icon[i].coord.x, icon[i].coord.y, icon[i].img); } } i try use method after reading answer : void menui...

asp.net mvc - How to enable create, while also disabling edit for a Kendo Grid -

is possible enable inserting new records in kendo grid, disable editing records? best ondatabound remove "edit" buttons in javascript. tried setting editable(ed => ed.enabled(false)) errors during runtime. @(html.kendo().grid(model) .name("grid" + guid) .htmlattributes(new { style = "margin:20px" }) .columns(columns => { columns.bound(p => p.id).hidden(true); //a few more columns columns.command(command => { command.edit().text(resources.kendoedit).updatetext(resources.kendoupdatetext).canceltext(resources.kendocanceltext); command.destroy().text(resources.kendodestroy); }).title(resources.kendocommands).width(180); }) .toolbar(toolbar => toolbar.create().text(resources.kendotoolbarcreate)) .editable(editable => editable //.enabled(false) .mode(grideditmode.inline) .displaydeleteconfirmation(fa...

python - How do I run a script on friday, once every two weeks? -

i use cron, can't figure out if there's way set right schedule. can check date in python, running script via cron everyday, checking right date inside (python) script (which assume has more powerful conditions). i thought on limiting 1 run on fridays between 1 , 7, , other 1 on fridays between 15 , 21. option have problem on months 3/2013 have 5 fridays. is you're looking for? put in crontab: 0 7 * * 5 sh -c " if [ $(expr $(expr $(date +\%s) \/ 604800) \% 2) -eq 0 ]; command; fi " this run command every other friday @ 7.00 am. note: number 604800 means 1 week (3600sec * 24 * 7).

android - Multiple step registration process in a single activity with fragments -

i'am trying create multiple-step registration activity handles several fragments. each fragments step in process , final fragment should send registration information collected in fragments server , response. problem thinking how should handle information across fragments if user goes 1 step not loose typed information. , how should handle these fragment transactions. thinking in storing data in activity , retrieve each time user goes 1 step , retrieve in final fragment send information don't think best approach. there way cleanly? since fragments run on top of activities, think way cleanly have fragments communicate activity. basically approach thinking correct.

Node.js domains in Express app middleware -

i believe following code might useful handle exceptions occur requests: var domain = require('domain'); app.use(function(req,res,next){ var d = domain.create(); d.on('error',function(err){ res.json({error: err.stack}); }); d.run(function(){ next(); }); }); however, read type of code can leak memory. not sure understand why. there way avoid leaking memory? perhaps should manually remove event handling , listeners domain after response stream closed? how allow domain object garbage collected?

left join - SQL merge tables with matching columns -

Image
how can merge 2 tables same column names 1 table? this: the 2nd table should fill in 1st table. this close got select * animals left join best on animals.species=best.species; http://sqlfiddle.com/#!5/d0a98/3 but seems concatenate 2nd table on there. is left join correct way this? you should list columns in select . readily see need coalesce() : select a.price, a.species, coalesce(b.name, a.name) name animals left join best b on a.species = b.species;

objective c - NSMetadataQuery returns results outside of searchScopes -

i'm working joint mac/ios app syncs documents , data via icloud 1 another. in order detect when data changes, use nsmetadataquery observe relevant icloud folder. the apps use purely local data storage monitor nsmetadataquery object in case user deletes or adds documents finder. each separate nsmetadataquery objects given distinct searchscopes not observe each others respective folders accident. the problem local query doesn't respect searchscope , randomly return values outside of it. here example 1 of times caught misbehaving. (lldb) po docquery.searchscopes $1 = 0x0000000101553ae0 <__nsarrayi 0x101553ae0>( file://localhost/users/aschenk/library/containers/com.chimpstudios.cloudclipboard/data/documents/largeclippings ) and here url of 'found' file erroneous query reporting >> file://localhost/users/aschenk/library/mobile%20documents/8yjaw5la57~com~chimpstudios~cloudclipboard/documents/d7d31630-81b7-47aa-bee7-71a5b8d96b23.ccc/ for now, i...

actionscript 3 - Java performance in Air Native Extension, how do I optimize? -

i have simulatin 30 airplanes want run on android phone. i coded whole thing in as3 figured there boost in performance if i'd use java in native extension. the simlation library of 30 units. simulation calculates distance , rotation between units. 870 iteration many distance , rotation calculations. my ane on java runs 50x slower as3 version. the problem seems calling setobjectat() on frearray multiple times. guess conversion of java as3 slow. there way optimize getting variables java as3? i guess as3 performance not different standard java performance, when used native extension. however, android ndk, allowed me rebuild library in c++, not @ performance increase of 20x. so if looking performance edge on android as3: use ndk.

Docker: what is the equivalent of the legacy --link parameter -

i need connect db container server container. red legacy parameter --link , works perfect $> docker run -d -p --name rethinkdb1 rethinkdb $> docker run -d --link rethinkdb:db my-server but, if parameter dropped eventually, how above ? the docs says use docker network command instead (which available since docker 1.9.0 - 2015-11-03) instead of $> docker run -d -p --name rethinkdb rethinkdb $> docker run -d --link rethinkdb:rethinkdb my-server you use $> docker network create --name my-network $> docker run -d -p --name rethinkdb1 --net=my-network rethinkdb $> docker run -d --net=my-network my-server note in new form, container names used, while before able define alias . when 2 containers part of same network, /etc/hosts file updated can use container names instead of ip addresses.

asp.net - Exception: Argument must be either a FieldInfo or PropertyInfo On server -

the environment: development pc: windows 7 x64 clean install, visual studio 2012 , iis 7.5 deployment server: windows 2008 w/ sp2, iis 7, .net 4.0 (not sure if it's 32 or 64 bit) language: vb codebase: classic asp, new code additions done in asp.net using the backstory: i rewriting section of our intranet admin site. have bunch of code (20+ files) under directories in app_code 2 namespaces defined. have aspx page in subfolder of site uses code in app_code. running linq query pulls down data sqlserver display on page. the issue: when code deployed server, linq-to-sql query errors out stack trace: [argumentexception: argument must either fieldinfo or propertyinfo] system.linq.expressions.expression.validatesettablefieldorpropertymember(memberinfo member, type& membertype) +2751766 system.linq.expressions.expression.bind(memberinfo member, expression expression) +48 {my aspx file class}.{defined function} in {my aspx.vb file} {my aspx f...

php - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near " at line 14 -

i continue error within query, can't seem find issue stunning. $query = "insert skills set reference = '', name = '".mysql_real_escape_string($name)."', description = '".mysql_real_escape_string($description)."', cost = '".mysql_real_escape_string($cost)."', img = '".mysql_real_escape_string($oldnameimg)."', advlevel = '".mysql_real_escape_string($advlevel)."', tradelevel = '".mysql_real_escape_string($tradelevel)."', battlelevel = '".mysql_real_escape_string($battlelevel)."', expert = '".mysql_real_escape_string($expert)."', favoured = '".mysql_real_escape_string($favoured)."', location = '".mysql_real_escape_string($location)."', type = '".mysql_real_escape_string($type)....

Regex replacement issues -

https://www.myregextester.com/?r=6fba8b94 regex is (\w(s)\b) sample word dress \1 returns "dress" \2 returns "dres" so figured: \1 \2 return "dress dres" but returns: "dress s" how can make return "dress dres" first, use + quantifier \w match 1 or more word characters (you match 1 \w ). why s , s (see your regex in action capturing ss group 1 , s group 2). and use: (\w+)s\b with \0 \1 replacement \0 backreferences whole match, , \1 backreferences captured (\w+) . see demo here . or, if perl, use ((\w+)s)\b , replace \1 \2 (see demo ). see demo

sql server - Calculate Sum From Moving 4 Rows in SQL -

i've have following data. wm_week pos_store_count pos_qty pos_sales pos_cost ------ --------------- ------ -------- -------- 201541 3965 77722 153904.67 102593.04 201542 3952 77866 154219.66 102783.12 201543 3951 70690 139967.06 94724.60 201544 3958 70773 140131.41 95543.55 201545 3958 76623 151739.31 103441.05 201546 3956 73236 145016.54 98868.60 201547 3939 64317 127368.62 86827.95 201548 3927 60762 120309.32 82028.70 i need write sql query last 4 weeks of data, , last 4 weeks summed each of following columns: pos_store_count , pos_qty , pos_sales , , pos_cost . for example, if wanted 201548's data contain 201548, 201547, 201546, , 201545's. the sum of 201547 contain 201547, 201546, 201545, , 201544. the query should return 4 rows when ran successfully. how formulate recursive query t...

c++ - I need white color like transparent color -

i have problem. have program makes black color transparent. src=imread("0.jpg", 1); cvtcolor(src,tmp,cv_bgr2gray); threshold(tmp,alpha,100,255,thresh_binary); mat rgb[3]; split(src,rgb); mat rgba[4]={rgb[0],rgb[1],rgb[2],alpha}; merge(rgba,4,dst); imwrite("1.png",dst); and input , output is: http://i.imgur.com/fypbebb.jpg - input transparent background white places - output but don't want black color transparent, want white transparent. can not figure out. me please? thank you. src=imread("0.jpg", 1); cvtcolor(src,tmp,cv_bgr2gray); threshold(tmp,alpha,100,255,thresh_binary_inv); mat rgb[3]; split(src,rgb); mat rgba[4]={rgb[0],rgb[1],rgb[2],alpha}; merge(rgba,4,dst); imwrite("1.png",dst); if choose thresh_binary_inv instead of thresh_binary. output is: black background transparent places . whole problem , solved.

ios - How to select an 'Account' when adding Google Analytics to an app -

Image
this not programming setting ga account finally start programming . google himself redirected me here , has closed own google groups community. hope don't mind me bringing here: i want add google analytics ios app. i'm going to https://developers.google.com/analytics/devguides/collection/ios/v3/ i click on "get configuration file"-button, create app , hit analytics-icon shows me this: now have select account , property. have set few on https://analytics.google.com interface doesn't allow me choose right one! how can select right account app? bonus: clarify relationship between https://developers.google.com/mobile/add https://console.developers.google.com/project https://analytics.google.com/analytics/web/#management/settings/ , respective data models "app", "account" , "property" mentioned on different sites?

c++ - How can I reach the second word in a string? -

i'm new here , first question, don't harsh :] i'm trying reverse sentence, i.e. every word separately. problem can't reach second word, or reach ending of 1-word sentence. wrong? char* reverse(char* string) { int = 0; char str[80]; while (*string) str[i++] = *string++; str[i] = '\0'; //null char in end char temp; int wstart = 0, wend = 0, ending = 0; //wordstart, wordend, sentence ending while (str[ending]) /*@@@@this part won't stop@@@@*/ { //skip spaces while (str[wstart] == ' ') wstart++; //wstart - word start //for each word wend = wstart; while (str[wend] != ' ' && str[wend]) wend++; //wend - word ending ending = wend; //for sentence ending (int k = 0; k < (wstart + wend) / 2; k++) //reverse { temp = str[wstart]; str[wstart++] = str[wend]; str[wend--] = tem...

c++ - const correctness for containers -

after years of blindly accepting fact std::vector<t>::operator[] const returns const_reference , but, in light of how const works smart pointers, i'm beginning wonder why , rest of stl containers designed way. seems "constness" of const std::vector being applied both vector , elements, whereas smart pointers "constness" applies pointer , not element it's pointing. to clarify, seems there should vector-like container const means user can't change size of container, elements in container mutable. main question is: there prevent type of container being "const correct"? it seems there couple of hackish workarounds adding layer of indirection (e.g. std::vector<std::unique_ptr<t>> const ) accomplish this, i'm looking little less awkward in terms of maintenance. as aside, if smart pointers incorporated language before stl containers, const accessors still have been defined way today? to clarify, seems the...

python - How to count non NaN values accross columns in pandas dataframe? -

my data looks this: close b c d e time 2015-12-03 2051.25 5 4 3 1 1 05:00:00 2015-12-04 2088.25 5 4 3 1 nan 06:00:00 2015-12-07 2081.50 5 4 3 nan nan 07:00:00 2015-12-08 2058.25 5 4 nan nan nan 08:00:00 2015-12-09 2042.25 5 nan nan nan nan 09:00:00 i need count 'horizontally' values in columns ['a'] ['e'] not nan. outcome this: df['count'] = ..... df close b c d e time count 2015-12-03 2051.25 5 4 3 1 1 05:00:00 5 2015-12-04 2088.25 5 4 3 1 nan 06:00:00 4 2015-12-07 2081.50 5 4 3 nan nan 07:00:00 3 2015-12-08 2058.25 5 4 nan nan nan 08:00:00 2 2015-12-09 2042.25 5 nan nan nan nan 09:00:00 1 thanks you can subselect df , call count passing axis=1 : in [24]: df['count'] = df[list('abcde')].count(axis=1) df out[24]: close b c d e time count 2015-12-03 2051....

cuda - reduction for sum of vector when size is not power of 2? -

for classical reduction algorithm on gpu, works if size of vector power of 2. if not case? @ point have find sum of odd number of element. best way deal that? you can compute sum of matrix doesn't have size of power of two. @ example : #include <math.h> #define n 1022 //total size __global__ void sum(int *a, int *c) { __shared__ int temp[blockdim.x]; int idx = threadidx.x+blockdim.x*blockidx.x; int local_idx = threadidx.x; temp[local_idx] = a[idx]; int i=ceil(blockdim.x/2); __syncthreads(); while(i!=0) { if(idx+i<n && local_idx<i) temp[local_idx] += tmp[local_idx+i]; i/=2; __syncthreads(); } if(local_idx == 0) c[blockidx.x] = temp[0]; }

"ruby-2.0.0-p0 is not installed" after trying to install with RVM -

if run rvm install 2.0.0 , goes through normal steps (downloading, extracting, configuring, compiling, installing), ends saying: ruby-2.0.0-p0 not installed. install do: 'rvm install ruby-2.0.0-p0' i've tried following: rvm remove 2.0.0 rvm head rvm requirements rvm install ruby-2.0.0 i keep getting same result: no error, "is not installed." know what's wrong? i had same issue , managed work out. when did echo $cc came /usr/bin/gcc-4.2 . did export cc=clang , rvm reinstall 2.0.0 , worked. hope helps.

azure - Save-AzureWebSiteLog Invoke-WebRequest error -

i close finish job started cause error. when execute this save-azurewebsitelog -name $websitename -output "c:\logs\error.zip" save-azurewebsitelog : maximum message size quota incoming messages (65536) has been exceeded. increase quota, use maxreceivedmessagesize property on appropriate binding element. so, searched solution, seems many people have exact same problem. https://azure.microsoft.com/en-us/blog/windows-azure-websites-online-tools-you-should-know-about/ thanks @parth sehgal, have tried solve problem using powershell $username = "maiemai" $password = "password" $base64authinfo = [convert]::tobase64string([text.encoding]::ascii.getbytes(("{0}:{1}" -f $username,$password))) $apiurl = "https://wngphase2it.scm.azurewebsites.net/api/zip/logfiles/" $response = invoke-webrequest -uri $apiurl -headers @{authorization=("basic {0}" -f $base64authinfo)} -method try { $filename = [system.io.path]::get...

database - Oracle DB backup script not running -

i trying make backup using crontab on linux machine. i have short script : #!/bin/bash export oracle_home=<oracle_home_directory> date=`date +%f_%h-%m-%s` echo $date /u01/app/oracle/product/11.2.0/dbhome_1/bin/expdp system/oramanager full=y parallel=4 directory=data_pump_dir dumpfile=prod1-ecmdb1-$date.dmp logfile=prod-ecmdb1-$date.log compression=all i have placed script in crontab such: 02 17 * * * cd /u01/app/oracle/admin/ecmdb1/dpdump/ && /u01/app/oracle/admin/ecmdb1/dpdump/backup.sh > /tmp/test.out but script not run. says in logs : ude-12162: operation generated oracle error 12162 ora-12162: tns:net service name incorrectly specified if run whole script line manually, works fine. doesnt work fine using cron. need setup variables ? add export oracle_sid=<...> , make sure cron set under same user, not root.

converting cookies into sessions without javascript -

i want use cookie create session expires when user closes browser window. of posts online says way remove expires attribute cookie. tried , did not work. i have following cookie string: example=true;path=/ note did not set expires attribute. what happens expires attribute gets set 1 year now. try setting cookie expires=0 .

java - Mockito when...thenResult always returns null -

with above code error in line of test when(request.getservletcontext().getattribute("sessionfactory")) .thenreturn(factory); any ideas? java class protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { sessionfactory sessionfactory = (sessionfactory) request.getservletcontext().getattribute("sessionfactory"); ............... } test class @test public void testservlet() throws exception { httpservletrequest request = mock(httpservletrequest.class); httpservletresponse response = mock(httpservletresponse.class); factory = contextinitialized(); when(request.getservletcontext().getattribute("sessionfactory")).thenreturn(factory); //always error here when(request.getparameter("empid")).thenreturn("35"); printwriter writer = new printwriter("somefile.txt"); when(...

php - Laravel choosing a class at runtime -

i trying merge 2 websites created using laravel 5 1 multisite (yes, wasn't experienced when making decision). 2 websites 1 cats , 1 dogs. my problem have model called item , 1 in cats storing things in different table model item in dogs. what have done in controller: protected $posts_class; public function __construct() { $this->items_class = "app\\models\\" . config('domain') . "\\item"; } public function index() { $items = $this->items_class::all(); return view('items')->with('items', $items); } but keeps giving error: syntax error, unexpected '::' (t_paamayim_nekudotayim) however if do: public function index() { $class= $this->items_class; $items = $class::all(); } it works.. don't want variables within controller method. i know why first 1 doesn't work. if has recommendations on how make multisite work in better way 1 open suggestions. thank you. the...

sql - SELECT DISTINCT is not working -

let's have table name tablea below partial data: lookup_value lookups_code lookups_id ------------ ------------ ---------- 5% 120 1001 5% 121 1002 5% 123 1003 2% 130 2001 2% 131 2002 i wanted select 1 row of 5% , 1 row of 2% view using distinct fail, query is: select distinct lookup_value, lookups_code tablea; the above query give me result shown below. lookup_value lookups_code ------------ ------------ 5% 120 5% 121 5% 123 2% 130 2% 131 but not expected result, mt expected result shown below: lookup_value lookups_code ------------ ------------ 5% 120 ...

faceted search - Using solr facet pivot field in sub query -

i have set of documents similar parent child relation, except not indexed nested - denormalized. below set of records id,parent_id,,author 1,0,a1 2,1,a2 3,1,a3 4,1,a4 5,0,a5 6,5,a6 7,5,a7 8,0,a8 9,8,a9 10,0,a10 the above records id 1,5,8,10 parent records(parent_id=0) , others child(their parent_id value parent) my solr query should facet based on parent_id child records, use pivot parent_id , match id author of parent need combine below 2 queries one query 1: fq=-parent_id:0&facet=true;facet.pivot=parent_id from above query if 3 parent ids result of faceting - 1,5,8,10 query 2: fl=author&fq=parent_id in {1,5,8,10} finally output should a1,a5,a8,a10 - ideally need top author a1 have 4 children i tried local parameters option, faceting etc. not able find way combine output of facet query, , use in query - in 1 go. restrictions - not able nest documents use block join. appreciated. thank you fq={!join from=parent_id to=id}-pare...

javascript - gulp useref remove files from pipeline -

is there way not output gulp.src file? goal bundle javascript , output .js only, not html. in base.html following blocks used bundle javascript gulp-useref: <!-- build:js app.core.js --> <script src="{{ static_url }}etherflex/js/vendor/conditionizr_4.5.1.js"></script> <script src="{{ static_url }}etherflex/js/app/conditionizr.detects.js"></script> <script src="{{ static_url }}etherflex/js/app/conditionizr.config.js"></script> <script src="{{ static_url }}etherflex/js/vendor/mootools-core_1.4.5.js"></script> <!-- endbuild --> the gulp task var gulp = require('gulp'); var notify = require('gulp-notify'); var changed = require('gulp-changed'); var plumber = require('gulp-plumber'); var uglify = require('gulp-uglify'); var rename = require('gulp-rename'); var gzip = require('gulp-gzip'); var useref = require('gulp-usere...

audio - Android 5.0 Bluetooth A2DP Sink -

i have specific answer looking. hope there out there smart enough point me in correct direction. background: have android phone (lg power on 5.0 rooted ) nexus 10 running 6.0. in house have set nice pa system love stream audio. capable of plugging in 3.5mm cord listen audio or stream audio on wifi. however, stubborn person , have fancied idea of streaming audio 1 device via bluetooth. after all, android linux. after searching on internet, quite extensively, there seem many people love find solution. there answers ranging from: 'this cannot done', 'why ever want that?' 'here things may need. build away. oh , way, there may more need' i not find these answers satisfactory , put out there request of higher intelligence myself find easy (not requiring building custom rom, modifying kernel, making own application etc) way achieve goal. here 1 source seems close answer: android device receiver a2dp profile if more info needed, please ask! ...

node.js - Mongoose, is it possible to assign parent id to sub document on save in one call? -

i wondering if it's possible(or needed) provide subdocument reference it's parents id in 1 call. here code i'm working with: var mongoose = require('mongoose'); var schema = mongoose.schema; var latlng = new schema({ id: schema.objectid, created_at: date, accuracy: { type: number, required: true }, latitude: { type: number, required: true }, longitude: { type: number, required: true }, _walk: { type: schema.objectid, ref: 'walk', required: true } }); latlng.pre('save', function(next){ if(!this.created_at) this.created_at = new date(); }); var walk = new schema({ id: schema.objectid, created_at: date, updated_at: date, description: string, elapsedtime: number, distance: number, waypoints: [latlng], _user: { type: schema.objectid, ref: 'user', required: true } }); walk.pre('save', function(next){ var = new date(); this.updated_at = n...

url rewriting - Rewrite rule for the root file in nginx? -

i want redirect / different file rather index.php/.html. so on apache can this.. rewritecond %{request_filename} -f rewriterule . /path/to/dir/index.html [l] trying in nginx doesn't run, seems: if (-f $request_filename){ set $rule_0 1$rule_0; } if ($rule_0 = "1"){ rewrite /. /path/to/dir/index.html last; } also tried this: if ($request_filename ~ "/index.php"){ set $rule_3 1$rule_3; } if ($args ~ "^$"){ set $rule_3 2$rule_3; } if ($rule_3 = "21"){ rewrite /. /wp-content/plugins/i-static/content/index.html last; } it acts doesn't exist , prints out index.php. if want isolate single uri / , use location = variant. try: location = / { rewrite ^ /new/index.html last; } this perform internal rewrite. see this document details.

javascript - Retrieving JSON data from API -

i trying simple stock api work on jsfiddle.net using quandl api: https://www.quandl.com/blog/api-for-stock-data if use current ".csv" format below, returned csv file. if change format ".json" in api, how recover data can use on website example? i believe need use getjson command, confused how works. can me out? html: <input type="text" id="symbol"> <button id="getprice">get price!</button> <div id="result">stock market ticker</div> javascript: function getprice() { var symbol = $("#symbol").val(); var baseurl = "https://www.quandl.com/api/v3/datasets/wiki/"; var stock = symbol+".csv"; var endurl = "column_index=4&rows=1&api_key='8mii36sd1q46ulgstklm"; var url = baseurl+ stock + "?" + endurl; $("#result ").html("<a href = '" + url + "' >hyperlink</a>"); }...

Why cmake always build ".xcode" projects instead of .xcodeproj -

no matter virson(2.8.12 3.0.2 3.1.0 or 3.4.1) cmake use,it build ".xcode" project instead of .xcdeproj. ideas why happen? see https://cmake.org/cmake/help/v3.0/variable/xcode_version.html hava both xcode 6.3 , xcode 7.1.so rename thers app name "xcode6.3" , "xcode7.1",then cmake can't find "xcode.app/contents/version.plist".

Git refusing to merge because of changes to an unchanged file -

i'm having git problem want merge branch master it's refusing merge because thinks have local changes file. doing status shows no changes , diffing files produces nothing. here's terminal output: $ git checkout productsandcontents switched branch 'productsandcontents' $ git status # on branch productsandcontents nothing commit (working directory clean) $ git checkout master switched branch 'master' $ git status # on branch master nothing commit (working directory clean) $ git merge productsandcontents error: local changes following files overwritten merge: tests/unit/src/models/brandtests.js please, commit changes or stash them before can merge. aborting any or suggestions appreciated! thanks andrew myers' comment on initial question, discovered setting core.trustctime false solved problem. git config core.trustctime false something mismatching inode change times. i'm guessing because repo sitting on fileshare on machin...

using ASP.NET MVC, is there a way to capture all POST requests regardless of URL to a host? -

i'm having trouble debugging mvc app i'm expecting relying part post to. is there easy way configure mvc 4 application intercept post requests can see url trying post , response is? normally, global filter want. however, since not trigger until after route determined, might not in situation. one thing try add application_beginrequest method in global.asax. doesn't have do anything. set breakpoint in it, , inspect request.apprelativecurrentexecutionfilepath (or other members of request) see inbound path is. protected void application_beginrequest() { if (request.httpmethod.equals("post", stringcomparison.invariantcultureignorecase)) { // breakpoint here } } a " global filter " preferred method injecting behaviors, etc. pipeline. mvc implements of these, , can extend or implement own. one concrete example implemented last year: client site has feature expire password. great; works fine...

css - How do you make this style without table? -

layout this: abc 1 2 bcd 1 2 3 4 eaasd 5 6 i heard it's not make layout table, in case? you can make div based layout following way. , use display:inline-block . .main > div { display: inline-block; padding: 5px; width: 50px; } <div class="main"> <div>abc</div><div>1 2</div> </div> <div class="main"> <div>bcd</div><div>1 2 3 4</div> </div> <div class="main"> <div>eaasd</div><div>5 6</div> </div> hope helps.

javascript - Detect click outside divs with particular class and hide them -

my dom looks this: <div class = filter x> <div class = a> <ul><li>……..</li></ul> </div> </div> <div class = filter y> <div class = a> <ul><li>……..</li></ul> </div> </div> both divs class dropdown menus. expected functionality is: whenever click on divs class filter, js-active class added , dropdown opens. whenever click anywhere outside div or dropdown, js-active class removed , dropdown hides. at time, 1 out of 2 dropdowns open. another event handling if 1 dropdown visible , click on dropdown, first 1 hides (remove class js-active) i able achieve following code: $(document).on('mouseup touchend', function(e){ var xcontainer = $(‘.filter x’); var ycontainer = $(‘.filter y’); if (!xcontainer.is(e.target) && xcontainer.has(e.target).length === 0) { xcontainer.removeclass('js-...

python - Zero-padding data until its length is equal to a power of 2 -

i'm trying write function can zero-pad data until length equal closest higher power of 2. want able number of iterations of this. right function: def pad_to_next_2n(array, iterations = 1): n = 1 while n <= iterations: l = len(array) padding = l +1 #incase array length equal 2^n while np.log2(padding) % 1 != 0: padding += 1 if l % 2 == 0: total_padding = padding - l array = np.pad(array, (total_padding/2,), 'constant') n += 1 else: total_padding = padding - l left_padding = (total_padding - 1)/2 right_padding = total_padding - left_padding print total_padding print left_padding print right_padding array = np.pad(array, (left_padding, right_padding), 'constant') n += 1 return array this work it's slow iterations higher 5. wondering if improve speed of or see b...

javascript - jQuery: spin plus to minus font awesome icon, on accordion section click -

i trying learn how rotate/ spin plus sign icon minus sign on click. i saw effect on vaccordion lukasz watroba . right capable have code toggle plus icon minus icon, without spin/ convert effect: mark-up: <div class="panel-group" id="accordion"> <div class="panel panel-default"> <div class="panel-heading"> <h4 class="panel-title"> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseone"> collapsible group item #1 <i class="fa fa-plus"></i> </a> </h4> </div> <div id="collapseone" class="panel-collapse collapse"> <div class="panel-body"> collapsible content #1 </div> </div> </div> <div class="panel panel-default"> <div c...

c# - Alternative to VMR in DirectShow.NET -

i developing video recording application using directshow.net in c# windows application. till able build graph , recording done using asf writer. while recording have show preview window overlay text on it, overlay text have implemented samplegrabber , working fine. what issue facing is, working fine on machine deploy test application other machine (os : windows 7) recording not started camera has been found. later going through exception log have found following entry in log creating instance of com component clsid {51b4abf3-748f-4e3b-a276-c828330e926a} iclassfactory failed due following error: 80040273 exception hresult: 0x80040273. after google on issue got exception caused due graphics driver not installed on system. after installing respected graphics driver working fine. before installing graphics drivers have checked camera working in skype , google hangout video chat application. this exception occurred @ line: ibasefilter vmr9preview = null; vmr9p...

haskell - What kind of data structure is a monad? -

i have half-competent understanding of monad (a parameterized type provides context useful computation building), why exists (so can things require context, io), how use (bind returned variables >>= ), , rough understanding of fits in in category theory (a category guarantees homogeneity of contexts of functions)**. what, however, monad in terms of underlying data structure? since related applicative functor (which seems list), guess ghc takes monad's contents , puts them linked list of sort, , passes them around throughout computation. what going on underneath hood? ** feel free correct of if know better. monad not data structure — it's property. you can define class of data types have default values (like [] lists, 0 int , false bool , on). let's call class defaultable . postulate default integer 0 , prove type of integers defaultable . bool defaultable in same way. another example tostringable class ( show in haskell): type tostring...

r - Error when adding vertical lines in ggplot2 -

so, i've got large dataset (around 400 000 observations) of data auctions. i'm trying use ggplot plot auction prices day, while denoting year color , month using vertical lines. i have posixlt vector holds dates, here i'm working with: firstmonth<- c(1,32,60,91,121,152,182,213,244,274,305,335) require(ggplot2) p <- ggplot(bb, aes(saledate$yday, saleprice)) p <- p + geom_point(aes(color = factor(saledate$year)), alpha = i(1/30)) #this plot works p + geom_vline(aes(xintercept = firstmonth)) error in data.frame(xintercept = c(1, 32, 60, 91, 121, 152, 182, 213, : arguments imply differing number of rows: 12, 401125 what's error? why can't vertical lines? you need pass new data.frame geom_vline : library(ggplot2) bb <- data.frame(saleprice=rnorm(1000)) saledate <- data.frame(yday=1:1000,year=rep(1:10,each=100)) firstmonth<- c(1,32,60,91,121,152,182,213,244,274,305,335) p <- ggplot(bb, aes(saledate$yday, saleprice)) p <...

php - Is an image display website better suited for procedural or OO programming? -

i have comics website, http://hittingtreeswithsticks.com , , guess i'm unclear style, procedural or oo, it's written in. basically, there several "templates", homepage.php, viewall.php, viewfullsize.php, call upon various scripts... namely, templates include imagedisplay.php, has several scripts determine how query based on category, tag, or subsite selected. i've read lot benefits of oo programming- when it's used , when it's not... still having trouble answering question. the way understand difference between oop , procedural example standpoint is: oop: if have website user can create object, such forum user can submit post... you'd want go oop because you'd want allow users create several instances of article class. procedural: went think procedural because comics website displays comics out users. user can submit comment using disqus, or like/dislike. don't see i'd able fit oop paradigm simple image display site. so, que...

javascript - How to feed dynamic data to static jquery function? -

my source code here below. chart creates made using chartist.js . <html> <head> <link rel="stylesheet" href="chartist.min.css"> </head> <body> <h3>chartist test</h3> <br> <div id="ct-chart5" class="ct-perfect-fourth"></div> <script src="chartist.min.js"></script> <script src="jquery-2.1.4.min.js"></script> <script> $(document).ready(function(){ var data = { series: [5, 3, 4] }; var sum = function(a, b) { return + b }; new chartist.pie('#ct-chart5', data, { labelinterpolationfnc: function(value) { return math.round(value / data.series.reduce(sum) * 100) + '%'; } }); }); </script> </body> </html> there var called data inside scripts tags below. thing has predefined values , chat creating s...

swift - ios error "plugin com.swiftkey.SwiftKeyApp.Keyboard invalidated" -

i have simple app logs in username / password redirect webview.when on webview , come app login form users key in login again,it throws me error "plugin com.swiftkey.swiftkeyapp.keyboard invalidated", although happens when connect , test on deivce,it fine on simulator i tried on ios8.1 - iphone 4s. virtually no available anywhere. just found out happening due swift key app installed dictionary prediction. still no clue how make work that.

iphone - Ads purgeIdleCellConnections ios -

Image
this issue started showing up. getting following when try cache chartboost ads show later. there no issue in simulator when try test on actual device no ads ever show. know how fix this? purgeidlecellconnections: found 1 purge conn = 0x1fd38360 purgeidlecellconnections: found 1 purge conn = 0x1fdf5e20 purgeidlecellconnections: found 1 purge conn = 0x1fde23d0 purgeidlecellconnections: found 1 purge conn = 0x1fdc16e0 purgeidlecellconnections: found 1 purge conn = 0x1fdb5ec0 you can test chartboost ads in real device in 2 ways. « 1. enable testmod in chartboost app section. « 2. add publishing campaign , add device udid in test device. see these screenshot more information.

php - How many instances of one class is there on server? -

is possible know how many instanced objects of 1 php class there on whole server (for users, not 1 thread). here reason why want it. making card game , want have room class (with unique room name, players @ moment online in room, socked id ...) when user join server have fresh list of active rooms. , when 1 room canceled (destroyed) send users information (basically real-time room(s) status). ok, here reason why want it. making card game project , want have room class (with unique room name, players @ moment online in room, socked id ...) when user join server have fresh list of active rooms. , when 1 room canceled(destroyed) send users information ( real-time room(s) status ). hope understand want do. you want implement multi-user game, should use client-server architecture it: set single, persistent server process runs on machine , keeps track of game state. each user request handled php "client" script talks game server , asks necessary information. ...

npm - .npmrc file permission are not stored by git -

in project want use .npmrc file point private repository. documentation npmrc read: note: because local (per-project or per-user) .npmrc files can contain sensitive credentials, must readable , writable user account (i.e. must have mode of 0600 ), otherwise ignored npm ! unfortunately git not honouring file permission 0600. so: how store .npmrc file in git? as found out right. git doesn't care file permissions. git stores 2 permissions ( 755 & 644 ), need of 600 not "recognized" git. to override im using manual script this site or this umask umask process attribute containing permission bits removed newly created files. git creates directories , executable files mode 777, , non-executable files 666, , umask turns off of bits. if want default permissions 644 , 755, set umask 022: umask 022

javascript - How to style using d3's .style() method instead of using CSS in style tags for .axis path {}? -

i have d3 code here of area chart. question styling axis , tick marks. currently x axis , y axis styled this: .axis line { fill: none; stroke: red; shape-rendering: crispedges; } .axis path { fill: none; stroke: blue; shape-rendering: crispedges; } i don't want use approach. let's want change stroke color of axis (to green), using d3's style() method in javascript. tried doing this: svg.append("g") .attr("class", "x axis") .style("stroke", "green") .attr("transform", "translate(0," + height + ")") .call(xaxis); what ended changing axis text labels green color. not intended do. what missing ? how style .axis line , .axis path using style() method of d3. please find me code here on jsfiddle if want use javascript after drawing axis using selectall method can change colors. svg.append(...

java - Why CaseInsensitiveComparator does not uppercase and lowercase comparisions -

this question has answer here: understanding logic in caseinsensitivecomparator 5 answers i looking @ code of caseinsensitivecomparator not understand following piece of code if (c1 != c2) { c1 = character.touppercase(c1); c2 = character.touppercase(c2); if (c1 != c2) { c1 = character.tolowercase(c1); c2 = character.tolowercase(c2); if (c1 != c2) { // no overflow because of numeric promotion return c1 - c2; } } } what purpose of comparing characters in both uppercase , lowercase form? isn't 1 of them sufficient? suspecting characters can equal when lowercase not equal when uppercase? from unicode standard : in addition, because of...

android - Circle Progress Bar on Fragment is not showing progress -

i'm trying show feedback percentage of have downloaded data server. the flow goes this: loginactivity - onsuccess, call service download data - while service working, i've switched user homeactivity homeactivity -this activities layout holds fragment created called loadingfragment -there method in loadingfragment subscribed event posted service my problem fragment ui not changing @ whenever event has been posted. i logged everything, , can see event posting correct data data not being reflected on ui. below service : @override public int onstartcommand(intent intent, int flags, final int startid) { integer id = intent.getintextra("id", 0); //do sync here log.i(log_tag, "make rest call retrieve r id: " + id); mrestclient.getapiservice().getr(id, new callback<list<r>>() { @override public void success(list<r> rresponse, response response) { integer outstanding = route...