Posts

Showing posts from July, 2011

r - how to graph using geom_area? -

does know why data not graphing? data_frame univ_apps ---------------------------- timeappreceived chr may_12_2002, march_4_2002 bs_ms_phd factor 1 bs 2 ms 3 phd appid int rn89 qw23 et43 sample data -------------- timeappreceived bs_ms_phd appid sept_2_1989 1 rn89 sept_2_1989 2 dq11 oct_1_2011 1 bg32 etc univdata = ggplot(univ_apps, aes(x= yearappreceived, y= appid, fill=as.factor(bs_ms_phd))) + geom_area(position="stack") am missing command graph? the data frame shown, "timeappreceived" chr. guess data type of "yearappreceived" same "timeappreceived". should convert numeric. try following code. univdata = ggplot(univ_apps, aes(x= as.integer(yearappreceived), y= appid, fill=as.factor(bs_ms_phd))) + geom_area(position="stack"); univdata by way, if appid not numeric, shoud convert them too. appid integer, isn't it?

laravel - php how to pass authorization bearer in unirest -

i have unirest code running in laravel 4.2: (doesn't work) <?php $headers = array('authorization', 'bearer tokenasdkaskdn231das2'); $body = array(); $respons = unirest\request::get("https://api.request", $headers, $body); ?> // , <?php unirest\request::auth('tokenasdkaskdn231das2', ''); $header = array(); $body = array(); $respons = unirest\request::get("https://api.request", $headers, $body); ?> i tried running in getpostman url: - https://api.request header: authorization : bearer tokenasdkaskdn231das2 it works. don't why not in unirest. i have working code using auth basic: authorization: basic c2tfdgvzdf9unta0owfhnja1m2m5ytaymtdizwe3oda3mgzizjuwmto= in php: unirest\request::auth('c2tfdgvzdf9unta0owfhnja1m2m5ytaymtdizwe3oda3mgzizjuwmto=', ''); this 1 simple. this correct, said: unirest\request::auth('token here', '');

iphone - IAP Restoration -

i got problem working on restoration of purchased product. every time user clicks on restore button unlock content works before checking if user logged in, had purchased or not. unlocks. here question: how right? add code restoration function , purchase one. btw purchasing works perfect. func restorepurchases(){ println("hello") skpaymentqueue.defaultqueue().addtransactionobserver(self) skpaymentqueue.defaultqueue().restorecompletedtransactions() } func buyproduct(){ skpaymentqueue.defaultqueue().addtransactionobserver(self) let payment:skpayment = skpayment(product: product) skpaymentqueue.defaultqueue().addpayment(payment) } func paymentqueue(queue: skpaymentqueue!, restorecompletedtransactionsfailedwitherror error: nserror!) { showalert("error", message: "hoho") } func paymentqueue(queue: skpaymentqueue!, updatedtransactions transactions: [anyobject]!) { transaction:anyobject in transaction

java - Got this error : This class should provide a default constructor for dbHelper -

package com.mytelco.ahliang125.mytelco; import android.content.context; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteopenhelper; /** * created ahliang125 on 4/29/2015. */ public class dbhelper extends sqliteopenhelper { //databaserecord public static final string database_create_record = "create table " + databaserecord.database_table_record + " (" + databaserecord.key_id + " integer primary key autoincrement, " + databaserecord.name + " text not null, " + databaserecord.title + " text not null, " + databaserecord.link + " text not null," + databaserecord.remark + " text not null, " + databaserecord.priority + " text not null, " + databaserecord.username + " text not null);"; //databaserecord public static final string data

ios - How to allow connections only from authorized iphone apps to backend -

we developing iphone app connects custom aws api build. besides oauth, there other way can allow our paid users connect our backend api? meaning, there sort of key can assigned users buy our apps tied there apple id's paid possible or maybe there meid?

unit testing - How to test the main package functions in golang? -

i want test few functions included in main package, tests don't appear able access functions. my sample main.go file looks like: package main import ( "log" ) func main() { log.printf(foo()) } func foo() string { return "foo" } and main_test.go file looks like: package main import ( "testing" ) func foo(t testing.t) { t.error(foo()) } when run go test main_test.go get # command-line-arguments .\main_test.go:8: undefined: foo fail command-line-arguments [build failed] as understand, if moved test file elsewhere , tried importing main.go file, couldn't import it, since it's package main . what correct way of structuring such tests? should remove main package asides simple main function run , test functions in own package, or there way me call functions main file during testing? when specify files on command line, have specify of them here's run: $ ls main.go main_test.go $ go

javascript - fadeOut then fadeIn sequentially -

i'm trying fade out 1 image, fade in image in same spot. so far i've got fiddle , can see changes image before .fadeout() function finishes, when changing image via clicking thumbs. i've read jquery doesn't run sequentially standard (which code assuming does), tried adding in completed function, so: $('#image').fadeout('fast', function() { $('#image').html('<a href="' + image + '" data-lightbox="image-1" data-title="' + title + '"><img src="' + image + '" class="image"/></a>'); $('#image').fadein('fast'); }); however issue still present. should fix this? i wouldn't destroy , recreate elements; i'd update attributes. i'd include .stop(true, true) cancel previous animation , jump straight end before starting fadeout, in case clicks quickly. var images = [ 'http://i.stack.imgur.com/

html - Align Radio-Buttons and its Labels -

Image
i getting crazy right since try style radio buttons hours , cant reach goal (im new world of css). what want simple: i want 3 big radiobuttons underneath each other centered in div labels vertically aligned buttons. similar this: i have following html: <div class="answers"> <label> <input type="radio" name="answers" value="male" /> </label> <label> <input type="radio" name="answers" value="female" /> name </label> <label> <input type="radio" name="answers" value="male" /> vendor no. </label> </div> and result this: i want bigger buttons , bigger text. want text to right of buttom little padding. want radio buttons centered. tried many things looking weird. pls me... beginning hate css.... you can use css: .answers label { display: block; fon

How to create CSRF token for Cakephp 3 PHPunit testing? -

i trying unit tests working again after enabling csrf tokens , ssl in cakephp 3 app. how create or generate token test following? or disable testing purposes? public function testlogin() { $this->get('/login'); $this->assertresponseok(); $data = [ 'email' => 'info@example.com', 'password' => 'secret' ]; $this->post('/login', $data); $this->assertresponsesuccess(); $this->assertredirect(['controller' => 'users', 'action' => 'dashboard']); } the official documentation has approach since version 3.1.2 . you have call $this->enablecsrftoken(); and/or $this->enablesecuritytoken(); before post able perform request token. as official example shows: public function testadd() { $this->enablecsrftoken(); $this->enablesecuritytoken(); $this->post('/posts/add', ['title' => '

ios - Retrieving a cropped photo from the Facebook Graph API -

i have developed part of ios application involves using facebook's graph api accesses user's photos, , allows user crop image square desired zoom. images must squares. there way use graph api given rect parameter returns url of desired photo cropped rect? have done research , seems there isn't, hoping set of eyes on that. assuming there isn't, sounds better idea: uploading cropped photo own servers future access. or use own sql database store rect of cropping , url of photo (hosted facebook), , load full facebook photo , crop how want. 1 offers efficiency when loading data internet, means storing more data in own servers (this expensive in future) 2 means use less space on own servers, means entire photo forced loaded, parts won't used. i'm leaning towards 2, don't deal web/database work hoping advice. thanks. facebook transformations of pictures. not want might interesting take look: https://developers.facebook.com/docs/grap

math - Meteor.js the plus operator -

i'm writing simple program teach basic of input, form , template , sessions using meteor. if (meteor.isclient) { session.set('value',0); template.hello.helpers({ result: function(){ return(session.get('value')); } }); template.hello.events({ 'submit form': function(event) { event.preventdefault(); var s1=event.target.num1.value; var s2=event.target.num2.value; var s = s1 - s2; session.set('value',s); } }); } the problem when operator changed + seems concatenate 2 numbers. other basic operators work fine. bug ? simplest example can teach students , stuck. i'm using mac 10.6.8 , meteor 1.1.0.2 it's hard tell without seeing jsfiddle bet problem 1 of values or both being passed in string. the plus sign concatenation operator js , perform type coercion number string, if both not numbers , 1 string. - operator perform other way, , turn strings numbers. check data types being passed in , makes s

dplyr - r + keeping first observation of time series group -

a follow-up on this question (i want keep threads separate): want @ each user , fruits ate. i'm interested in first time eat fruit. there, want rank order fruits eaten time. some data: set.seed(1234) library(dplyr) data <- data.frame( user = sample(c("1234","9876","4567"), 30, replace = true), fruit = sample(c("banana","apple","pear","lemon"), 30, replace = true), date = rep(seq(as.date("2010-02-01"), length=10, = "1 day"),3)) data <- data %>% arrange(user, date) in case, can see that, example, user 1234 ate banana on 2010-02-01, again on 02-03, 02-04, , 02-05. user fruit date 1 1234 banana 2010-02-01 2 1234 lemon 2010-02-02 3 1234 banana 2010-02-03 4 1234 apple 2010-02-03 5 1234 lemon 2010-02-03 6 1234 banana 2010-02-04 7 1234 banana 2010-02-05 i don't want change relative order of fruits time, want remove subsequent instances of

user interface - GUI component for displaying chat messages? -

i'm searching gwt component following properties: -able display strings in structured way, ie. username , message in seperate columns -providing control on scrollbar in essence i'd have component able display more simple strings , auto scrolls bottom. at first used simple textarea fails satisfy first requirements. additionaly failed implement autoscroll bottom. there components accomplish features? or if not, how create similar component? create own custom widget below or similar hierarchy, vertical panel/dock panel: outer container. header panel : horizontal panel width set 100% , add required info. if using dock panel , set north scroll panel : infinite scroll , set width 100% horizontal panel(s) : 1 panel each chat string.

mysql - Java resultset getblob and getobject difference -

i having problem writing / reading bufferedimage java datatype here. when writing seems have no problem inserted data, when reading, have problem using "getobject" method java resultset (for particular reason, method must getobject , can read type of data, , convert after). when inserting bufferedimage datatype mysql using inputstream , has 42559 @ byte array's length, reading using getobject length not 42559 anymore it's size turned 42586, can not read using "imageio.read" method (it returns null) here insert code: bytearrayoutputstream baos = new bytearrayoutputstream(); imageio.write((bufferedimage) vals[i], "jpg", baos); inputstream = new bytearrayinputstream(baos.tobytearray()); ps.setbinarystream(i + 1, is); here read code: object set = rs.getobject(i + 1); and here convert bufferedimage code: bytearrayoutputstream b = new bytearrayoutputstream(); objectoutputstream o = new objectoutputstream(b); o.writeobject(set); o.flush(

Node.js - Unit Testing Middleware -

i have api middleware function use filter incoming requests. functions checks present of token in header, makes 2 calls database, 1 check token , 1 information , pass on request object, if 1st call successful. i struggling understand how unit test functions, mocking request object , database calls. middleware.js exports.checktoken = function (req, res, next) { if (!req.get('token')) { return res.status(400).json('bad request'); } var token = req.get('token'); //get token header user.findone({'token': token}, function(err, user) { // skipped error checking or no user found account.findone({'_id': user.account}, function(err, account) { // skipped error checking or no account found req.somevalue = account; return next(); }); }); }; currently using mocha , chai , sinon , thinking of following: mock user.findone , account.findone using sinon.stub() not sure req, res

sql - Group by with MIN value in same query while presnting all other columns -

i have view called a data: id tdate name task val 23 2015-06-14 23 2015-06-25 126 2015-06-18 126 2015-06-22 126 2015-06-24 id integer , tdate timestamp. basically want each id min value of tdate , present row. meaning: id tdate name task val 23 2015-06-14 126 2015-06-18 i wrote query: select id, min(tdate) group id order id this working but doesn't allow me present other columns of a for example if do: select id, min(tdate), name group id order id it says name must under group by. wrote query: select id, min(tdate), name, task, val , .... group id, name, task, val , .... order id and 1 doesn't work . gives false results. how solve it? postgres has convenient distinct on type of problem: select distinct on (id) a.* order id, tdate; this return 1 row each id . row first 1 determined ordering defined in order by clause.

jquery - Morris graphs. Have custom tooltip when hover -

i using morris.js (which has dependency on raphael) creating stacked bar graphs. each stacked bar want show split various levels in bar tooltip. tried using hovercallback: doesn't seem give me control on particular element hovering over. content particular bar. i have setup jsbin example same here: when hover on bar shows index of bar @ bottom. want show content tool tip instead. jsbin example piece of cake. demo , code: <script type="text/javascript"> morris.bar({ element: 'bar-example', data: [ {y: '2006',a: 100,b: 90}, {y: '2007',a: 75,b: 65}, {y: '2008',a: 50,b: 40}, {y: '2009',a: 75,b: 65}, {y: '2010',a: 50,b: 40}, {y: '2011',a: 75,b: 65}, {y: '2012',a: 100,b: 90} ], hovercallback: function(index, options, content) { return(content); }, xkey: 'y', ykeys: ['a', 

modifying key's name in python dictionary -

i trying write python script can find sub_directories called 'something' within parent directory.then rename sub directories , move them somewhere else. far have code as: import os, shutil,fnmatch match = {} root, dirnames, filenames in os.walk('test'): #print root #print dirnames #print filenames in fnmatch.filter(dirnames,'find'): #print os.path.join(root,dirnames[0]) print root #match.append(root) match[root]=dirnames[0] call match gives me {'test\a': 'find'......} . modify key value of dictionary looks {'a':'find'... trying rid of name of parent directory. thought converting string , use split seems not efficient. to dirname without parent directory name, use os.path.basename , way: >>> dirname = 'c:\\users\\myusers\\videos' >>> os.path.basename(dirname) 'videos' edit: in response op comments, given: dirname = '

php - How to use Glob Brace for listing only folders with pagination -

i want know , how can use php's glob brace function open dir , scan folders , , show pagination (page1,page2,etc). , how limit results per page? based on: pagination of php glob page $folders = glob("*", glob_onlydir); usort($folders, function ($a, $b) { return filemtime($b) - filemtime($a); }); $record_count = 20; $total_pages = ceil(count($folders)/$record_count); $page = $_request['page']; ///make dyanamic :: page num $offset = ($page-1)*$record_count; $folders_filter = array_slice($folders, $offset,$record_count); foreach ($folders_filter $folder) { echo "$folder <br/>"; } if($total_pages > 1){ if($page != 1){ echo '<a href="thispage.php?page='.($page-1).'">prev</a>'; } if($page != $total_pages){ echo '<a href="thispage.php?page='.($page+1).'">next</a>'; } }

python - Errors with Beautiful Soup output -

i'm trying scrape data webpage on gamespot using beautifulsoup . however, result different page source viewer . first off, alot of errors produced. instance, have r = requests.get(link) soup = bs4.beautifulsoup(r.text) and yet soup.title gives <title>404: not found - gamespot</title> . the data want scrape not appear. because webpage contains javascript alongside ? if how can around ? you're sending http request server. need process javascript content. a headless browser javascript support, ghost, it'd choice. from ghost import ghost ghost = ghost() ghost.open(link) page, resources = ghost.evaluate('document.documentelement.innerhtml;') soup = beautifulsoup(page) .evaluate('document.documentelement.innerhtml') show dynamically generated content, not static you'd see taking @ source.

android - Custom ID generation with OrmLite -

i'm working on android app has it's own way generate unique identifiers entities. before every entity creation assign new id our objects. we're doing that: idgenerator.assigncodefor(entity); dao.create(entity); i know ormlite has sort of generateid id scheme, seems feature designed working database sequences(eg: postgresql serial datatype , mysql's auto_increment). i looked customized datapersister , came sort of workarround don't feel confortable with. tldr; so question is: how can programmatically generate custom id entities ormlite? i'm looking interceptor or strategy pattern. how can programmatically generate custom id entities ormlite? i think example code doing it, right? question is: how can have ormlite custom generate id entities. the short answer doesn't have way this. ormlite not generating id, database is. however, there ways can better in own code. i'd extend dao , override dao.create(...) met

.net - C# Devexpress xtragird with multiple lookupedit in rows -

i developing windows application using c# uses devexpress tools. have grid contains more 1 lookup edit in single row. have bind each row in such manner when first lookup edit changes adjacent lookup edit in same row in bind. can dynamically add rows ' add row' button. how can bind second lookupedit on change of first lookup edit. on each value change 1 row affected previous should remain same. i've been stuck days - can me? thanks in advance. here workouts private void legridsubinventory_editvaluechanged(object sender, eventargs e) { gvreservation.posteditor(); gvreservation.updatecurrentrow(); gridview view = gvreservation; var obj = view.getfocusedrow(); int locationid = common.intcast(leoutlets.editvalue); lookupedit sub = (lookupedit)sender; view.setrowcellvalue(view.focusedrowhandle, view.columns["itemid"], -1); view.setrowcellvalue(view.focus

http - Error while connecting to wit api url using curl library in C code -

purpose : response of wit api using curl library using c source code : #include <stdio.h> #include <string.h> #include <curl/curl.h> int main(void) { curl *curl; curlcode res; struct curl_slist *list = null; static const char *postthis="q=hello"; curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, curlopt_url, "https://api.wit.ai/message); list = curl_slist_append(list, "authorization: bearer $token"); curl_easy_setopt(curl, curlopt_httpheader, list); curl_easy_setopt(curl, curlopt_postfields, postthis); /* if don't provide postfieldsize, libcurl strlen() */ curl_easy_setopt(curl, curlopt_postfieldsize, (long)strlen(postthis)); /* perform request, res return code */ res = curl_easy_perform(curl); /* check errors */ if(res != curle_ok) fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); /* cleanup */ curl_slist_free_all(list);

ruby on rails - Pushing app on heroku fails - rake -

i trying deploy app catarse on heroku, not want push it. quite new git , heroku, perhaps making stupid basic error, still.. this got: git push heroku master counting objects: 1740, done. delta compression using 4 threads. compressing objects: 100% (1657/1657), done. writing objects: 100% (1740/1740), 4.90 mib | 356.00 kib/s, done. total 1740 (delta 308), reused 0 (delta 0) remote: compressing source files... done. remote: building source: remote: remote: -----> warning: multiple default buildpacks reported ability handle app. first buildpack in list below used. remote: detected buildpacks: ruby, node.js remote: see https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order remote: -----> ruby app detected remote: -----> compiling ruby/rails remote: -----> using ruby version: ruby-2.2.2 remote: -----> installing dependencies using 1.9.7 remote: running: bundle install --without development:test --path vendor/bundle --binstubs ve

I want to create a method that uses dot(.) operator while calling in JAVA -

i wanted create method uses . while calling. string a="alpha",b="beta"; a.compareto(b); so how access a define method compareto() . can access string b in definition of compareto() , compare b need a well. how can access a . in definition of method. string already has compareto . if you're talking adding new methods existing classes without access class's source, c#'s extension methods, doesn't exist in java.

google apps script - Add-Ons in view only and comment mode? -

i've been looking everywhere , can't life of me find info on this. so i've published workflow add-on internally company, , i've realized there no add-on menu in view mode on documents, , in suggest mode menu there, empty. is there way enable add-on in these states? critical functionality of scripts. not possible. add-ons (and apps script in general) requires write permission bound document. i cant find anywhere in official docs either, thou vaguely suggested in docs saying "collaborators" https://developers.google.com/apps-script/add-ons/lifecycle i know not supported because first question asked google year ago when feature introduced. said no never built addon either because needed would-be addon.

csv - YQL - wrong query -

can tell me whats wrong yql statement: select symbol, earnings_per_share, dividend_yield, week_low, week_high, last_trade_date, open, low, high, volume, last_trade csv url="http://download.finance.yahoo.com/d/quotes.csv?s=yhoo,goog&f=seyjkd1oghvl1&e=.csv" , columns="symbol,earnings_per_share,dividend_yield,last_trade_date,week_low,week_high,open,low,high,volume,last_trade" in(select * yahoo.finance.historicaldata symbol = "yhoo" , startdate = "2009-09-11" , enddate = "2010-03-10") i want properties: http://www.electronics4design.com/wp-content/uploads/2015/07/pricetable.jpg what trying ? if need yhoo data, try this select symbol, earnings_per_share, dividend_yield, week_low, week_high, last_trade_date, open, low, high, volume, last_trade csv url="http://download.finance.yahoo.com/d/quotes.csv?s=yhoo&f=seyjkd1oghvl1&e=.csv" , columns="symbol,ea

php - How to pass shortcode param value to Javascript/Ajax? -

i have created contact form shortcode process ajax. shortcode have parameter set email address in messages going sent. way can use differents email accounts receive messages depending on form is. when clic submmit javascript take form fields value $('#name').val() , send ajax_contact_form function created in php file: $('.contact-form').submit(function(){ var action = $(this).attr('action'); $("#message").slideup(750,function() { $('#message').hide(); $('#submit') .after('<i class="fa fa-refresh fa-spin fa-2x"></i>') .attr('disabled', 'disabled'); $.post( action, { action: 'ajax_contact_form', name: $('#name').val(), email: $('#email').val(), phone: $('#phone').val(), subject: $('#subject').val(), message: $('#message').val(), }, f

css - displaying anchor tag with both block and table-cell features -

so, have following code: <div class="flexslider" id="carousel"> <ul class="thumbs"> <li class="thumbnail"> <a href="#">really long link happens move multiple lines</a> </li> <li class="thumbnail"> <a href="#">link 2</a> </li> <li class="thumbnail"> <a href="#">link 3 </a> </li> <li class="thumbnail"> <a href="#">link 4</a> </li> </ul> </div> with folllowing css: .flexslider ul.thumbs { margin: 0; display: table; height: 100px; } .flexslider li.thumbnail { list-style: none; width: 25%; height: 100px; display: table-cell; border-right: solid 1px #000000; text-align: center; vertical-align: midd

php - zlib_decode() data error -

Image
i've been struggling install/configure composer 3 days, , i'm totally lost: i type composer install , produced: after type composer diagnose & reading lot of articles without knowing i'm reading about, conclude because of network connection behinds proxy . if it's how force installing behind of proxy connection of network (mobile network).

ios - UIWebView Frame Load Interrupted -

we have mp3 files stored on online , our ios app loads them in web view. worked fine in past appears (8.4?) no longer works , instead fails error. loading these url works in mobile safari not in uiwebview. if shed light on appreciated! thanks! i've got similar problem , think i'm on check content-type header ? func headerfromnsurl(url: nsurl) { println("test header") header in nsurlrequest(url:url).allhttpheaderfields! as! [string : string] { println("key: " + header.0 + " content" + header.1) } println("/////////////////////////////////////") } mine doesn't contain header content-type think it's redirection problem

java - How to do JOIN ON query using Criteria API -

since version 2.1 jpa supports join on . found few examples how use join on in jpql none criteria api, , here question: is join on implemented in criteria api? , if yes, can provide example? try this criteriaquery<person> crit = cb.createquery(person.class); root<person> candidateroot = crit.from(person.class); join<person, address> addrjoin = candidateroot.join(person_.address, jointype.inner); addrjoin.on({some predicate}); filling "{some predicate}" whatever on clause want impose.

javascript - jQuery - delaying all functions calls declared with .on -

i using .on() function in jquery assign functions events. var someevent = geteventname(someparams); // gets event, 'click' var somefunctionreference = getfunctionnamebasedonparams(someparams); // gets function reference $('.myelement').on(someevent, somefunctionreference); what wrap 'somefunctionreference' inside timeout or delay firing (by time; lets 250ms) without having go , modify every single function returned method. is there way this? i'll assume can't modify code in getfunctionnamebasedonparams , need create function returns function wrapped in timer. function delayfunc(fn, ms) { return function() { var args = arguments; settimeout(function() { fn.apply(this, args); }, isnan(ms) ? 100 : ms); } } then pass function it. var somefunctionreference = delayfunc(getfunctionnamebasedonparams(someparams), 250); be aware handler's return value meaningless, if return false , it'

swift - Google autocomplete Component Restriction iOS -

is there equivalent of component restriction google places autocomplete ios. i have found few wrappers wrap around webservice call (wrappers) not have capability filter component restriction in general seems. i'm looking make sure results country of interest. http://goobbe.com/questions/8144956/google-places-autocomplete-api-country-restriction it's not possible ios sdk @ moment. the filter parameter of autocompletequery allows filter type (it's gmsautocompletefilter object), offers no other filters. for you'll have use webservice (or wrapper webservice includes support component restrictions).

api - How to embed the SoundCloud player in Android? -

i want embed soundcloud player play soundcloud url in android app. i had tried use soundcloud java api wrapper. thing giving me error when try track: this line causes error httpresponse trackresp = wrapper.get(request.to("/tracks/60913196")); error - 13781-13781/ com.example.dds.soundcloud e/trace﹕ error opening trace file: no such file or directory (2) if having working project of soundcloud player in android app. request please share project. this present code. string id = getresources().getstring(r.string.sc_client_id); string secret = getresources().getstring(r.string.sc_client_secret); apiwrapper wrapper = new apiwrapper(id,secret, null, null); try { //only needed user-specific actions; //wrapper.login("<user>", "<pass>"); //httpresponse resp = wrapper.get(request.to("/me")); //get track httpresponse trackresp = wrapper.get(request.to("/tracks/60913196")); //track json r

javascript - How to place html elements at the mouse position when it moves, without lag? -

i'm working on web-based drawing app not use canvas. reason avoiding using canvas, because going add css keyframes html elements placed. allows me keep track of each individual div, can give them incrementing ids. the way placing divs, jquerys's .on("mousemove")... problem running if move mouse fast, creates gaps in line. the question have whether there way generate line between gaps. i made jsfiddle snippet of code. https://jsfiddle.net/themejared/d16yjg9l/ thanks, jared. var mouseposx, mouseposy, style, circle; var windowheight = $(window).height(), // height of entire window windowwidth = $(window).width(); // width of entire window $(document).on("mousemove", function (event) { mouseposx = event.pagex; // px amount of mouse pos mouseposy = event.pagey; // px amount of mouse pos style = "top:" + (mouseposy - ($('#circle').height() / 2)) + "px; left: " + (mouseposx - ($('#circle').width

css - How stop width when img reaches max-height? -

situation : have site images/pictures , set them nicely. problem : in css max-height property works fine when image/pic reach max-height 15% width of image doesn't stop, wider , wider resizing browser or using wider resolution. question : pictures aren't nice, how stop img width auto resizing when img reaches max 15% height on page? what need : want totally fluid site percentages , img widths doesn't matter, max-height must 15% , keeping img ratio in situation. at moment tag properties in css: img { height: auto; max-height: 15%; }

android - Is it possible to "hijack" an oauth2 provided that the attacker has the client id, client secret and an auth token? -

i relativley new authentication procedures , came across oauth2 protocol when implementing android app. not aquainted procedure - possible attacker access data form server providing in possession of client id, client secret , auth token? i'm asking check how necessary securley hide these information. thank in advance.

cakephp 2.6 - I'd like to redirect and setFlash messages -

i tried cakephp blog tutorial ( http://book.cakephp.org/2.0/en/getting-started.html ) on , on again. but code can't redirect , not working setflash messages when adding posts. could tell me what's wrong code , how fix this? i'm thinking mamp setting wrong because adding process working when refreshing index page. mac mamp here code. <?php //file: /app/controller/postscontroller.php class postscontroller extends appcontroller { public $helpers = array('html', 'form', 'session'); public $components = array('session'); public function index() { $this->set('posts', $this->post->find('all')); } public function view($id = null) { if(!$id) { throw new notfoundexception(__('invalid post')); } $post = $this->post->findbyid($id); if(!$post) { throw new notfoundexception(__('invalid post'));

asp.net - Login Form Using HEAD or OPTIONS Verb Instead of POST -

i have strange problem. deployed application production. have 2 action methods logging in: accountcontroller [httpget]login(); [httppost]login(..); the form rendered capture login information , perform post straightforward form: <form action="/account/login" class=" form-horizontal" method="post" novalidate="novalidate"><input name="__requestverificationtoken" type="hidden" value=".."> . . </form> i log unhandled actions on controller, writes message event log. message see: protected overrides sub handleunknownaction(actionname string) eventlog.writeentry("application", "controller '" + me.gettype().name + "' not have action '" + actionname + "' request of type '" + me.controllercontext.httpcontext.request.httpmethod + "'.") end sub i see message logged: controller 'accountcontroller'

Including opt-out as alternative specific constant in R Mlogit -

i doing discrete choice experiment on preferences attributes of hypothetical drug treating weight loss in master thesis, , need little help. my design generic, , has 12 choice sets 3 alternatives: product a , product b , option out . somehow, need include option-out alternative specific constant, seems doing wrong here. have 197 responses on 12 choice sets of 3 alternatives, hence 197*12*3 observations of choice = 7,092 > head(choice3, 12*3) id choice_id mode.ids choice noadveff tab infreq_3 cost weightloss weightlosssq optout 1 x1 0 1 -1 -1 550 3.5 12.25 -1 1 x1 b 0 -1 1 1 90 6.0 36.00 -1 1 x1 c 1 0 0 0 0 0.0 0.00 1 1 x10 0 1 -1 1 50 6.0 36.00 -1 1 x10 b 0 -1 1 -1 165 3.5 12.25 -1 1 x10 c 1

javascript - Regex replace a set of characters -

i want replace + - ( ) , space empty character in javascript string. expression i'm using is: "+1 - (042) - 123456".replace(/[\+\-\' '\(\)]/, ""); which results in: "1 - (042) - 123456" only + replaced , not other characters. error in expression? when use square brackets list characters remove/change or whatever, don't want escape them. , recommend using \s instead of , and, of course, need global flag - g . "+1 - (042) - 123456".replace(/[+()\s-]/g, "")

Vb.NET Disabling timer when window loses focus -

i'm developing quiz software in vb. net has 2 separate windows after login. i've added timers each of windows. issue how disable timer count of 1 window when mouse focus on other window?? as hans suggested, use form deactivate event. private sub form1_deactivate(sender object, e eventargs) handles mybase.deactivate ' deactivate forms timer end sub

How to remove post archive posts description/excerpt from wordpress website? -

how remove post archive posts description/excerpt wordpress website? see screenshot: http://tinypic.com/r/1zq5zc7/8 i tried code, did not work me. .archive .post-content p { display: none; }

How to handle multiple ref cursors in data set ? (Birt Report Design) -

my data set (created using oracle procedure) returns "multiple ref cursors" . in case birt displaying output columns , difficult identify column belongs ref cursor , if there columns same name in both output cursors , displays one. there way handle ? or how handle data set contains multiple ref cursors in output ??

comparison - Writing an application to compare the shapes of images (ex: what state does this potato chip look most like?) and would like some help getting started -

i looking build application boyfriend's birthday gift , getting started! i'd able input photo (of potato chip or distinct edges) , have app select & output state in chip looks like. plan on building in java , wondering best approach designing algorithm be. i've never done edge detection or image comparisons , wondering if point me in right direction in terms of getting started. thank you! look caffe, implemented berkeley. uses neural networks identify objects based of learning models. for specific task, can create models of different potato chips , caffe "learn" them. then, can write application using video camera can place potato chip in video feed , caffe identify it. for identification process, need both feature detection object matching database of similar images, , caffe can that.

date - Converting Netezza timestamp to Julian Day Number -

i have been looking during days not find how do.. it like: select to_number(to_char('2015-06-24 00:00:00','j')) on oracle. i need find julian numeric day value, not confused ordinal date of year.. conversion templates indicate 'j' want. i think issue have to_number() function, not to_char() function. use casts instead. system(admin)=> select to_char('2015-06-24 00:00:00'::timestamp,'j')::int; ?column? ---------- 2457198 (1 row)

javascript - unbind jquery to copt the output text -

i trying unbind on element - #result the output box has id of #result because have ("input, body") the bind happen on body - keyup click , mousemove i need when ever click #result box wil not bind or unbind you can see example here http://5t5t5t5t5t5t5.weebly.com/ click generate widget show result box issue can not highlight text inside result box because event happening // text output $("input, body").bind("keyup click mousemove", function() { $("#result").text( '<div class="section-title-box animated fadeinup wow animated" data-wow-delay="0.2s">' + '<h6 style="color:#' + $("#h6_color").val() + ';">' + $("#h6_title_text").val() + '</h6>' + '<h2 style="color:#' + $("#h2_color").val() + ';">' + $("#h2_title_text").val() + '</h2

sql server - An existing connection was forcibly closed by the remote host - Intermitent -

i have sql server 2014 hosted on windows server 2012. i have many windows services develop in c# run on windows server 2012. my services have different responsabilities... connect on different databases on server mentionned above. sometimes, in realy intermitent manner, 1 of service gets following sqlexception... while other still working fine... message: client unable establish connection because of error during connection initialization process before login. possible causes include following: client tried connect unsupported version of sql server; server busy accept new connections; or there resource limitation (insufficient memory or maximum allowed connections) on server. (provider: tcp provider, error: 0 - existing connection forcibly closed remote host.) i googled troubleshooting info no luck... what appears strange, 2 service working on same database on same server 1 gets error...

c - Why this line make my program segfault? -

i cut useless part of code make post clearer. here problem, first , line in function init_dda() make programme segfault, don't understand how possible, if have explanation, you. void dda_algorithm(t_env *e) { t_dda *d; d = null; init_dda(e, d); } void init_dda(t_env *e, t_dda *d) { d->map_x = 3; } here construction of structure t_dda : typedef struct s_dda { int map_x; } t_dda; i have no compilation error warning flags enabled. in init_dda() call, you're passing second argument d null. then, inside init_dda() , you're trying de-reference pointer. (dereferencing null pointer, invalid pointer) invokes undefined behaviour . segmentation fault 1 of side effects. solution: need allocate memory d before passing init_dda() . can malloc() , family of functions.

php - What RewriteRule shall I add to my existing rules to fix this? -

my page has 2 languages (in near future 3). has structure on inner pages: domain.com/en/page (where page page.php in main root) and main page can accessed through domain.com or domain.com/en/ in server have files in main root, , 1 folder named articles, inside there other files. when access index of folder articles index domain.com/en/articles ok. but when access domain.com/articles takes me 404 page. how can still open folder without /en/ or /el/ in front of it? rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(en|el)/articles$ articles/index.php?lang=$1 [nc] rewriterule ^(en|el)(/)?$ index.php?lang=$1 [nc,l] rewriterule ^(en|el)/(.*)?$ $2.php?lang=$1 [nc,l] rewriterule ^([^\.]+)$ $1.php [nc,l] also, because new in htaccess please take @ overall code , tell me improvements. you can have rules this: rewriterule ^articles/?$ articles/index.php [nc,l] rewriterule ^(en|el)/articles$ articles/index.php?lang=$1 [nc

Visual Studio 2010, NVIDIA AndroidWorks and some questions about debugging Android Apps -

i have visual studio 2010 professional.i've installed nvidia androidworks.i have tablet android 4.1.1 also.i`ve been tried debug simple android ndk application in visual studio 2010 professional on device, received error 'failed attach: android 4.1(api level 16) devices not supported'. Сan somehow solve problem or debugger not support android 4.1 device?if not supported, there plans in future versions nvidia androidworks?i not have ability upgrade operating system on tablet. in general, wrote on nvidia forum , got answer, maybe useful:"there bug pertaining api level 16 devices makes debugging native code on them impossible. we've decided fail earlier error message instead of letting people buggy behavior. so, unfortunately, can't debug on android 4.1 device. workaround, try downgrading device api level 15 or installing custom firmware (such cyanogenmod) based on later api level 16."

ios - Make NSOperationQueue synchronous -

how can make nsoperationqueue synchronous? did tried subclassing nsoperation , setting "setmaxconcurrentoperationcount" 1. , adding dependencies on previous operations using "adddependency" method. adding code: if(!operationqueue) { operationqueue = [[myqueue alloc] init]; } [operationqueue setmaxconcurrentoperationcount:1]; uploadfileoperation *uploadfileoperation = [[uploadfileoperation alloc] initwithobject:someobject]; [operationqueue addoperation:uploadfileoperation]; now when log upload progress 2 files shows both files uploading @ same time. this: file1 - 17.647026% uploaded file1 - 18.352907% uploaded file2 - 0.870381% uploaded file2 - 1.740762% uploaded file2 - 2.611142% uploaded file2 - 3.481523% uploaded file1 - 19.058788% uploaded edit 2: how implemented nsoperation main method: - (void)main { @autoreleasepool { if(self.iscancelled) { return; } [[[networkmanager alloc] init] uploadfiletoamazon:someurl withreques

rrdtool - What means load_one metric Y-Axis in Ganglia/RRD Tool? -

i'm using ganglia + rrdtool monitoring web farm . many graphs clear when see load_one metric , don't have y-axis legend . so, what y-axis means ? thanks. load_one load average on 1 minute. number of threads (kernel level) runnable , queued while waiting cpu resources, averaged on 1 minute. the number should interpreted in relation number of hardware threads available on machine , time takes drain run queue. latter can evaluated looking @ 5 , fifteen minute load averages, long these stay reasonable, should ok