Posts

Showing posts from June, 2012

django - Extending the User to add a profile_pic -

in older versions of django extends user model , create userprofile. seems in django 1.8 not same anymore. im looking examples in django 1.8 . here example found somewhere on net, not extend anything. want extend user can still use user object in tempaltes etc. class myuser(abstractbaseuser): """ custom user class. """ gender_choices = ( ('m', 'male'), ('f', 'female'), ) email = models.emailfield('email address', unique=true, db_index=true) is_staff = models.booleanfield('is staff', default=false) first_name = models.textfield('first name', default=none, null=true) last_name = models.textfield('last name', default=none, null=true) date_of_birth = models.datefield('date of birth', null=true) avatar = models.imagefield('profile picture', upload_to='static/media/images/avatars/', null=true, blank=true) ...

java - installing DBpedia spotlight on windows 7 -

i'm using dbpedia spotlight web service on project , stop working, not annotate default text on it. i've searched internet , seems have install server on laptop. don't understand those instructions . i'm using statistical version: i downloaded en.tar.gz file mentioned i downloaded dbpedia-spotlight.jar mentioned now what? my project built using netbeans , glassfish server, , have win7 os. any help? , there memory requirement that? stack overflow focused on programming questions. doesn't appear programming question. dbpedia spotlight has its own mailing list among other support areas , , you're better , faster answers there experts in space, random folks here.

java - Guice inject context instance that is created upon each request -

is there way have guice bind type of instance created upon new request? pseudocode using threadlocal : // upon request incoming, creating context context context = new context(request, response); // save threadlocal later on can // provider context.setthreadlocal(context); ... // in appmodule.java file modules.add(new abstractmodule() { @override protected void configure() { bind(context.class).toprovider(new provider<context>() { @override public context get() {return context.getthreadlocal();} }); } }); ... // in source file injector injector = guice.createinjector(modules); // suppose foo has context property , injector shall // inject current context foo instance foo foo = injector.getinstance(foo.class); can implement behavior without threadlocal ? guice has concept of scopes . sounds you're looking bound @requestscoped annotation. bind instance persists life of request, , inject new object next request. ...

javascript - Geochart - mark one country with a special color -

Image
there standard example of google geochart, countries have scale color depends on value. question how mark 1 country, example canada, red one, leave countries before. ok if canada without value, how mark in color? https://jsfiddle.net/8wowo9xc/ google.setonloadcallback(drawregionsmap); function drawregionsmap() { var data = google.visualization.arraytodatatable([ ['country', 'popularity'], ['germany', 200], ['united states', 300], ['brazil', 400], ['canada', 500], ['france', 600], ['ru', 700] ]); var options = {}; var chart = new google.visualization.geochart(document.getelementbyid('regions_div')); chart.draw(data, options); } the desire result: if specify defaultcolor , give canada no value, want. so like: google.setonloadcallback(drawregionsmap); function drawregionsmap() { var data = google.visualization.arr...

jdbc - How to set Hive configuration property hive.exec.dynamic.partition from Java code -

i have made java script connect hive using hiveserver2 , create table , manage tables, simple create, drop, insert data works fine. i want create external table partition, need change value following hive property, hive.exec.dynamic.partition = true hive.exec.dynamic.partition.mode = nonstrict in hive cli can using set , property name, how can done in java code. here java code: public class hivejdbcclient { private static string strdrivername = "org.apache.hive.jdbc.hivedriver"; public static void main(string[] args) throws sqlexception { try{ class.forname(strdrivername); } catch (classnotfoundexception e){ e.printstacktrace(); system.out.println("no class found"); system.exit(1); } connection con = drivermanager.getconnection("jdbc:hive2://172.11.1.11:10000/default","root","root123"); statement stmt = con.createstatement(); ...

javascript - Multiple Fixed headings on scroll -

suppose have headings below <h1 class="fixontop">heading 1</h1> content goes here. . . . long paragraph. <h1 class="fixontop">heading 2</h1> 2nd content goes here. . . . long paragraph. <h1 class="fixontop">heading 3</h1> 3nd content goes here. . . . long paragraph. so when scroll heading 1 should fixed on top , scroll down heading 2 should fixed , other headings fixed position must removed.i think possible via jquery.how can ? i have tried below.. $(window).scroll(function() { if ($(this).scrolltop() ) { //here condition finds if heading tag in screenview. $('.fixontop').css({ 'display': 'fixed' }); } }); here fiddle http://jsfiddle.net/0can8pt9/ check 1 out https://jsfiddle.net/ctjdpe91/1/ think using plugin waypoints such purposes idea var scrolltimeout; var breakpoints = []; function fix_heading(heading){ if( heading.hasclas...

Activity of my android project is skipping -

i have created simple android project. but, problem 2nd activity among 3 of it's activities skipping. logcat displays few warnings. "skipped 108 frames! application may doing work on main thread." my 2nd activity- edittext et1,et2,et3,et4; button btn; int i,counter; double theory_credit,theory_gp,lab_credit,lab_gp,total_credit,total_gp,cgpa; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_another); et1 = (edittext) findviewbyid(r.id.edittext1); et2 = (edittext) findviewbyid(r.id.edittext2); et3 = (edittext) findviewbyid(r.id.edittext3); et4 = (edittext) findviewbyid(r.id.edittext4); btn = (button) findviewbyid(r.id.button1); string value=getintent().getstringextra("input"); counter=integer.parseint(value); theory_credit=theory_gp=lab_credit=lab_gp=total_credit=total_gp=cgpa=0.0; for(i=1;i<=counter;i++){ btn.se...

system verilog - How to access the structures from testbench -

typedef struct packed signed{ bit valid; bit tag; bit signed[31:0] data; }my_data; module structure_example5(input clk,input my_data a); always@(posedge clk) begin if(a.tag>a.valid)begin $display("g"); end else begin $display("l"); end end endmodule:structure_example5 //test bench module structure_example5_tb; reg clk; reg a.tag,a.valid; structure_example5 uut (clk,a); initial begin #5 clk=0; forever #5clk=!clk; end initial begin a.tag=1'b1; a.valid=1'b0; #50 $finish(); end endmodule:structure_example5_tb until , unless struct of single direction there won't difficulty in connecting test-bench , dut ports together here @ test-bench code comment out reg declaration of structure members , use structure declaration //reg a.tag,a.valid; my_data a; and try run code, corrected/working code can found in link update: as per dave's sugg...

mysql - Subtracting value of a particular column where a value of particular column is same in both tables -

my db has 2 tables stock , damage. stock table looks like item_code, ss_no, item_name, rack_no, shelf_no, cold_storage, batch_no, qty, packing, expiry_date, mrp, purchase_price, selling_price, margin, formulation, stock_date, min_qty, ss_flag_id, ban_flag_id, sales_discount '1', 1, 'abzorb powder', 'a-1', ' ', ' ', '9086626', 18, 1, '2017-06-01', 87.00, 66.29, 87.00, 0.00, 'powder', '2015-05-11', 0, 0, 0, 0.0 damage table looks below damage_stock_date, invoice_no, invoice_date, dist_name, contact_no, item_code, item_name, batch_no, mfr_name, expiry_date, qty, damaged_qty, unit_price, unit_vat, unit_discount, sub_total, total_amount, remarks, ds_flag_id, packing '2015-06-19', '56', '2015-06-19', 'ganapati drugs', '', '0', 'saxim_', '1', '', '', 50, 10, 2.00, 5.00, 0.00, 21.00, 21.00, '', 0, 0 if want select row s...

html - How to do <p> tag word wrapping? -

Image
as shown in above image. exceeding words needs hide , dotted line need show. how word wrapping in css/angular js. you can use text-overflow style available in css. text-overflow: clip|ellipsis|string|initial|inherit; use ellipsis trim word , show dots. see word wrapping in css

flask - How to have server call another server in Python with threading? -

i have pipeline request hits 1 server, , server calls server , 1 executes job 2 seconds, should return main server minor computation, return client. problem current setup blocks if number of concurrent requests > number of workers, , don't know how use python threading make async. ideas on how implement this? main server -> outside server -> 2 seconds -> main server :edit the line takes 2 seconds 1 "find_most_similar_overall(image_name, classifier, labels)" call. function takes 2 seconds, means worker stops right there. @app.route("/shoes/<_id>") def classify_shoe(_id): if request.method == 'get': unique_user = request.cookies.get('uniqueuser') shoe = shoe.query.filter_by(id = _id) if shoe.count() not 0: shoe = shoe.first() image_name = shoe.image_name shoes,category = find_most_similar_overall(image_name, classifier, labels) return render_template('category.html...

php - Clubbing several similar repeating mysql SELECT statements -

i want fetch classified details table. have classified_ids in csv format. break them out csv , make independent queries every classified_id . what doing right is: select * classified classified_id = 501; select * classified classified_id = 545; select * classified classified_id = 578; ..... , on... executing each 1 of them. i feel inefficient large number of ids. there better way club of these statements 1 or make more efficient somehow? [i using php mysql* (i know deprecated, old project)] thanks in advance. instead create array of classified_id like, $classified_ids = [545, 123, 234]; and query using mysql in like, $query = "select * classified classified_id in ( {implode(',', $classified_ids)} )"; will query, $query = "select * classified classified_id in ( 545, 123, 234 )";

sql - how to navigate in self loop tables? -

consider following table create table employee ( empno number not null, ename varchar2(100), salary number, hiredate date, manager number ); alter table employee add constraint pk_emp primary key (empno); alter table employee add constraint fk_mgr foreign key (manager) references employee (empno); which self looped table i.e. every employee has manager, except root. i want run following query on table: find employees having more salary managers? p.s. there 1 root in structure consider following query select lpad(emp.ename, (level-1)*5 + length(emp.ename), ' ') "hierarchy" employee emp start emp.manager null connect manager = prior empno; the result this: alice alex abbey sarah jack bill jacob valencia bob babak ... i made following query select lpad(emp.ename, (level-1)*5 + length(emp.ename), ' ') "hierarchy" employee emp start empno in (select ...

java - App crashes when filtering SimpleAdapter while images are still loading -

/** asynctask parse json data , load listview */ private class listviewloadertask extends asynctask<string, void, string>{ // doing parsing of xml data in non-ui thread @override protected string doinbackground(string... strjson) { try{ jobject = new jsonobject(strjson[0]); storejsonparser countryjsonparser = new storejsonparser(); countryjsonparser.parse(jobject); }catch(exception e){ log.d("json exception1",e.tostring()); } // instantiating json parser class //storejsonparser countryjsonparser = new storejsonparser(); try{ // getting parsed data list construct countries = countryjsonparser.parse(jobject); }catch(exception e){ log.d("exception",e.tostring()); ...

Django API specifications and dot notation -

is there tree django dot notation can navigate , discover options dot operator of sub class? for example can have models.foreignkey models.datetime models.charfield etc. etc. but options? know have inheritance (i.e., check example in parent classes django.db.models ) wondering if aware of place info gathered in 1 place ( example java http://docs.oracle.com/javase/7/docs/api/ ) that's not django, that's python. dot-notation used object paths, not inheritance. did this: from django.db import models this python instruction, telling interpreter locate module django.db , lookup models in , make available in current context. happens specific item submodule. possible because in python modules actual objects (some kind of singletons). what want know what's inside module. if so, may either @ django's fields documentation or list content of module in python shell, using dir(models) (will return lots of useless stuff). by way, equivalent: f...

math - Rotate a grid of points in C++ -

Image
if had array of point structs defined as struct point{ float x; float y; }; how rotate points in array given angle? as example: any appreciated! float x_old = p.x; float y_old = p.y; p.x = x_old * cos(a) - y_old * sin(a); p.y = x_old * sin(a) + y_old * cos(a); of course, if rotating many points same angle, want save sin & cos, instead of calculating them twice per point.

html - Change the CSS on hover -

i have following html code: <div class="counters2"> <div class="one_fourth"> item 1 <h4> 99$ </h4> </div> <div class="one_fourth last"> item 2 <h4> 139$ </h4> </div> </div> and following css code: .counters2 h4 { font-size: 18px; color: #999; font-weight: 400; margin: 20px 0px 0px 0px; } .counters2 .one_fourth { background-color: #f3f3f3; padding: 30px 0px; border-radius: 4px; font-family: 'open sans', sans-serif; font-size: 35px; color: #393939; font-weight: bold; } how during hover can change : text color white (#fff) background color green (#9eca45) problem actual code price between <h4> tags change color not change white until make hover on it. how can changed that? tried: .counters2 h4.active, .counters2 h4:hover { font-size: 18px; color: #fff; font-weight: 400; margin: 20px 0px 0px 0px; ...

html - Positioning of div's using css: layout issue with absolute positioned div -

the code below shows circle plus bar, built using previous post . problem i'm experiencing bar in practice has fixed height equal circle 's height. guess because of absolute inline-block . however, seem need absolute inline-block because without them text placed below bar instead of inside it. the problem i'm experiencing if text within text div not fit within bar (too text), text runs belows bar (so heigth of bar not expanding). second problem if there's little text within bar , bottom-half overlaps bar . how can adjust code these problems? .tophalf { width: 100%; background: #f1f3f2 none repeat scroll 0% 0%; padding: 5em; } .bar { background: #333; margin-left: 75px; min-height: 150px; } .circle { width: 150px; height: 150px; border-radius: 50%; background: white; box-shadow: 0 0 8px rgba(0, 0, 0, .8); margin-left: -75px; position: relative; vertical-align: middle; margin-right: 20px; overflow: hi...

php - Trying to upload files from a form that is allowing more inputs -

i need allow admin upload many images in admin area. using code allows them press link , adds upload button. post php script upload files. however, it's not uploading them, it's not printing error message. great. here snip-it of form code: <tr> <td width="280" bgcolor="#e1e1e1"><font color="#000000">product image:</font></td> <td width="615" bgcolor="#e1e1e1"> <div id="newlink"> <div class="feed"> <input name="image[]" type="file" /> </div> </div> <p id="addnew"> <a href="javascript:add_feed()">add image </a> </p> <div id="newlinktpl" style="display:none"> <div class="feed"> <input name="image[]" type="file" /> </div> </div> </td></tr> here php code upload files: $len = count($_p...

javascript - this.prop trampling in textarea change handler -

trying learn react. in sample app, other components need know if document (content of textarea) unsaved. one method i'm trying having parent component inject prop can called child "editor" component. except, when handlechange called textarea, this.props no longer refers editor. i'm sure have this trampling not sure on recommended way resolve it. export default class editor extends react.component { constructor(props) { super(props); console.log(this.props); } handlechange(event) { console.log(this.props); // this.props.setunsaved(true); } render() { return <textarea onchange={this.handlechange} />; } }; if there better ways share "unsaved" state, i'm open them. i'll need better model system, , might use backbone. when using es6 class version of react classes (as opposed using react.createclass ), functions aren't auto-bound (see no autobinding react ...

oracle - DB Index not being called -

i know question has been asked more once here. not able resolve issue posting again help. i have table called transaction in oracle database (11g) 2.7 million records. there not-null varchar2(20) ( txn_id ) column contains numeric values. not primary key of table, , of values unique. of values mean there cases 1 value can there 3-4 times in table. if perform simple query of select based on txn_id take 5 seconds or more return result. select * transaction t t.txn_id = 245643 i have index created on column, when check explain plan above query, using full table scan. query being used many times in application making application slow. can please provide might causing issue? you comparing varchar column numeric literal ( 245643 ). forces oracle convert 1 side of equality, , off hand, seems though it's choosing "wrong" side. instead of having guess how oracle handle conversion, use character literal: select * transaction t t.txn_id = '245643...

java - Vaadin is it possible to have different colors for text items in ComboBox -

for example in combobox want expense items colored in red text , revenue items colored in green text. how can in vaadin's combobox component, assuming i'm working beanitemcontainer ? it's not possible combobox without client-side modifications. might possible develop own extension , that.

javascript - How can I do gapless audio looping with mobile browser? -

it seems i'm unable achieve gapless looping mobile. i've done far: https://github.com/hivenfour/seamlessloop creates gap. http://www.schillmania.com/projects/soundmanager2/demo/api/ creates gap. https://github.com/regosen/gapless-5 creates gap. downloads same audio twice. https://github.com/floatinghotpot/cordova-plugin-nativeaudio creates gap. html5 audio creates gap. cordova's media plugin creates gap. webaudio works! for 1.5min audio clip, decoding time > 30 seconds. https://code.google.com/p/chromium/issues/detail?id=424174 all above tested mp3 , ogg. edit: soundjs's cordova plugin broken , doesn't work; https://github.com/createjs/soundjs/issues/170 with html5 if using html5, use loop attribute. <audio controls loop> <source src="horse.ogg" type="audio/ogg"> <source src="horse.mp3" type="audio/mpeg"> browser not support audi...

python - Django queryset on related field with multiple constraints -

suppose have following models: class user(models.model): # ... fields class tag(models.model): # ... fields class usertag(models.model): user = models.foreignkey(user, related_name='tags') tag = models.foreignkey(tag, related_name='users') date_removed = models.datetimefield(null=true, blank=true) now lets want users have given tag has not yet been removed (ie date_removed=none). if didn't have worry date_removed constraint, do: user.objects.filter(tags__tag=given_tag) but want users have given tag and have tag without date_removed on it. there easy way in django in single queryset? , assume have millions of users, getting sort of list of user ids , keeping in memory not practical. your filter() call can include multiple constraints: user.objects.filter(tags__tag=given_tag, tags__date_removed=none) see the documentation on spanning multi-valued relationships. (in particular, difference between filter(a, b) , filter(...

php - Find <p> that contains image(s) and change style of that <p> -

Image
i'm parsing wordpress post html through php. want images centered. alone easy enough, however, want images on same line centered together. in order need apply attribute class="image-content" <p> block. how do php? this post in editor: and html wordpress provides post: <p>single line paragraph.</p> <p> <a href="image.png"> <img class="alignnone wp-image-39 size-thumbnail" src="image.png" width="150" height="150" /> </a> </p> <p> multi line paragraph multi line paragraph multi line paragraph multi line paragraph multi line paragraph multi line paragraph multi line paragraph multi line paragraph multi line paragraph multi line paragraph multi line paragraph multi line paragraph multi line paragraph multi line paragraph multi line paragraph multi line paragraph multi line paragraph. </p...

coq - Handling let in hypothesis -

as exercise in coq, i'm trying prove following function returns pair of lists of equal length. require import list. fixpoint split (a b:set)(x:list (a*b)) : (list a)*(list b) := match x |nil => (nil, nil) |cons (a,b) x1 => let (ta, tb) := split b x1 in (a::ta, b::tb) end. theorem split_eq_len : forall (a b:set)(x:list (a*b))(y:list a)(z:list b),(split b x)=(y,z) -> length y = length z. proof. intros b x. elim x. simpl. intros y z. intros h. injection h. intros h1 h2. rewrite <- h1. rewrite <- h2. reflexivity. intros hx. elim hx. intros b tx h y z. simpl. intro. after last step hypothesis let statement inside, not know how handle: 1 subgoals : set b : set x : list (a * b) hx : * b : b : b tx : list (a * b) h : forall (y : list a) (z : list b), split b tx = (y, z) -> length y = length z y : list z : list b h0 : (let (ta, tb) := split b tx in (a :: ta, b :: tb)) = (y, z) ______________________________________(1/1) length y = length z you wan...

ruby - Table Join in Rails Active Record -

i have film model class film < activerecord::base has_many :film_genres has_many :genres, through: :film_genres end a genre model class genre < activerecord::base has_many :film_genres has_many :films, through: :film_genres end and have filmgenre model class filmgenre < activerecord::base belongs_to :film belongs_to :genre end im try list of films in controller under particular genre, cant seem join work. def show @films = ## need join / select here fetch films genre.id of 4 end use includes join genres table , can reference in where conditions: @films = film.includes(:genres).where(genres: {id: 4}) alternatively, might easier films genre 4 starting genre model: @films = genre.find(4).films

javascript - Ember.js - Rendering additional data for a model -

i have app model , apps have id , name . this.resource("apps", function() { this.route('show', { path: ':app_id' }); }); i'd make show view show metrics app, query pretty intense, don't want include in call index view (let's table). i'm not sure if possible ember-data because app in store simplified payload , not re-requested show view metrics. then head went making metrics different model accessible apps/1/metrics , making model , everything. but if sideload data, have provide id references metrics particular app . , it's hasone there's not ids there database backed model. what's best way load in additional data model or expand information supplied in show view? the backend rails , ember-cli project. the easiest way retrieve data in route 's aftermodel handler: var showroute = ember.route.extend({ model: function(params) { // load model , return it. // fire if model isn...

javascript - How to filter .mp3 files using Amazon S3 listObjects -

i'm using amazon s3 service node.js , want filter .mp3 files in directory, using amazon s3 listobjects() . there prefix parameter there no sufix . there way using regular expression or filter *.mp3 or something? this function reference http://docs.aws.amazon.com/awsjavascriptsdk/latest/aws/s3.html#listobjects-property var prefix = "mys3dir/"; bucket.listobjects({prefix:prefix}, function(err, data){ //do data }); nope. that's not possible s3. can filter prefix sever-side. has fact s3 not have true key hierarchy, it's key->object store, , prefix matching works there. if want suffix matching have pull out name of keys , inspect them client side.

spring - Flash Attributes are not working -

i have got spring mvc project (appfuse) , flash attributes not transmitted request. what do: in transmitter method: @requestmapping(method = requestmethod.post) public string onsubmit(entity entity, bindingresult errors, httpservletrequest request, httpservletresponse response, redirectattributes ra){ ... ra.addflashattribute("id", entity.getid().tostring()); success = "redirect:somepage"; ... return success; } in receiver method, cannot passed flash attribute. tried these approaches: by modelmap by model by @modelattribute("id") the issue in redirecting string. working 1 is: success = "redirect:/somepage"; more correct solution is: success = "redirect:" + request.getcontextpath() + "/somepage"; double slash redirect non-working: success = "redirect://somepage";

ios - CCLabelTTF universal device issue -

Image
i have cclabelttf on ccnodecolor scroll across screen. problem looks perfect on ipad mini,iphone 4,5,6 , wrong on iphone6+,ipad air, ipad retina. i've changed contentsizetype , nothing changed. current font size 15.0f, if lower 5.0f work correctly(but small). odd if change font 25.0f wont work on device. don't know contentsize before hand because based on length of nsstring. can done in spritebuilder? using spritebuilder other aspect of app. using lastest cocos2d version. below images , code: self.tickerone = [ccnodecolor nodewithcolor:[cccolor redcolor]]; self.tickertwo = [ccnodecolor nodewithcolor:[cccolor redcolor]]; self.datasourcearray = [self.datasource setdatasourcearray]; nsstring *stocktickerstring = [self.datasourcearray componentsjoinedbystring:@" | "]; self.tickerone.positiontype = ccpositiontypenormalized; self.tickerone.anchorpoint = ccp(0.5f,0.0f); self.tickerone.name = @"tickerone"; cclabelttf *tickerlabel = [cclabelttf labelwithst...

objective c - Run Request In Background IOS -

i want run request while app in background.my app supports background mode -> background fetches. but below code return failure while app in background! there way run request?i tried nsurlconnection receives response not receive response! [[afhttprequestoperationmanager manager]post:@"http://app.xxxx.com/message_delivery.php" parameters:@{@"message_id":msgid} constructingbodywithblock:^(id<afmultipartformdata> formdata) { } success:^(afhttprequestoperation *operation, id response) { nslog(@"succesfuly tik"); } failure:^(afhttprequestoperation *operation, nserror *error) { nslog(@"%@",error); }]; these code working not nsurl *url=[nsurl urlwithstring:[nsstring stringwithformat:@"http://app.xxxx.com/message_delivery.php?message_id=%@",msgid]]; nsurlrequest *request = [nsurlrequest requestwithurl:url cachepolicy:nsurlrequestuseprotocolc...

machine learning - SVM is not generating forecast using R -

i have sales data 5 different product along weather information.to read data, have daily sales data @ particular store , daily weather information temperature, average speed of area store located. using support vector machine prediction. works products except one. giving me following error: tunedmodellog named numeric(0) below code: # load packages library(zoo) library(mass) library(e1071) library(rpart) library(caret) normalize <- function(x) { <- min(x, na.rm=true) b <- max(x, na.rm=true) (x - a)/(b - a) } # define train , test data test_data <- train[1:23,] train_data<-train[24:nrow(train),] # define factors categorical data names<-c("year","month","dom","holiday","blackfriday","after1","back1","after2","back2","after3","back3","is_weekend","weeday") train_data[,names]<- lapply(train_data[,names],factor) test_d...

Having trouble with methods for Vimeo's new API to get url of files -

i try the data of field "files" "quality" value "hd". read endpoints , try make request thee values of fields. my problem can't obtain value of field "files" because vector. how way pass endpoint?. the resource of research follow: https://developer.vimeo.com/api/endpoints . actually code can obtein principal fields can't acces fileds compound others. $client_id = "xxx"; $client_secret= "xxx"; $access_token = "xxx" ; $lib = new vimeo($client_id, $client_secret, $access_token); $response = $lib->request("/videos/videoid") the return value of request method associative array. associative array contain 3 values body : associative array containing full json response headers : associative array of response headers status : http status code (see http://httpstatus.es detailed list) to access files array specifically, use following code: $response['body'][...

Delphi XE and Unicode -

i have 1 function working in delphi 6. trying migrate old project delphi xe8, function doesn't work properly. please me. old function: function readstring(var p: pointer): string; var b: byte; begin b := byte(p^); setlength(result, b); p := pointer( integer(p) + 1); move(p^, result[1], integer(b)); p := pointer( integer(p) + b ); end; i try changed uncode, doesn't work: function readstring(var p: pointer): string; var b: byte; lresult: ansistring; begin b := byte(p^); setlength(lresult, b); p := pointer( integer(p) + 1); move(p^, lresult[1], integer(b)); p := pointer( integer(p) + b ); result := string(lresult); end the function use in: getintfmetadata(myobj ifcontroller, intfmd, true); procedure getintfmetadata(info: ptypeinfo; var intfmd: tintfmetadata; methodarrayopt: tfillmethodarrayopt); var i, offset: integer; methods: integer; baserttimethods: integer; hasrtti: integer; pp: pptypeinfo; p: pointer; selfmeth...

npm - Bluemix node buildpack and modules in private repos -

my node.js app uses number of private shared modules hosted in git repos. use git urls below in dependencies block in package.json: "xxx-accountmgr": "git+ssh://git@github.xxx.ibm.com:xxx/lib-account-mgr.git", when "cf push" errors during npm install on ssh: npm err! git clone --template=/home/vcap/.npm/_git-remotes/_templates --mirror ssh://git@github.xxx.ibm.com/ipaas/lib-account-mgr.git /home/vcap/.npm/_git-remotes/ssh-git-github-xxx-ibm-com-xxx-lib-account-mgr-git-bf65c10c: ssh: not resolve hostname github.xxx.ibm.com: name or service not known i expected haven't configured ssh key in bluemix. possible? if not, what's alternative install modules private repo in bluemix? if downloading private module hosted on git, should able use https protocol (with creds) access it. there trick avoid issue if not option you: 1) package private modules application (in node_modules) 2) move private modules devdependencies in package...

Unique .exe file in visual Studio, C# desktop application -

i have c# desktop application created in visual studio. i need have 1 executable file, can run anywhere. without compiler or need of having folders of libraries. .exe file have in project folder doesn't work alone. thanks if it's .net application executable yes can send anywhere , run anywhere having 1 file; provided fact wherever or whichever machine trying run it; have .net framework installed. else, should create self extracting installer not include executable have framework executable. way wherever run installer first install framework , can run exe without trouble.

jackrabbit-webapp-2.10.1.war on tomcat7 -

i having issue deploying jackrabbit-webapp-2.10.1.war on tomcat7 (pls see trace below). didn't have problems deploying jackrabbit-webapp-2.10.1.war on tomcat6 nor deploying jackrabbit-webapp-2.8.1.war on tomcat7 (but because 2.8.1 not contain protectedhandlers.properties in web.xml ). the class protectedhandlers.properties points can found in jackrabits' lib - ideas? l 015-06-19 17:47:09.095 error [localhost-startstop-1] protectedremovemanager.java:97 /web-inf/protectedhandlers.properties java.lang.classnotfoundexception: /web-inf/protectedhandlers.properties @ java.lang.class.forname0(native method) ~[na:1.7.0_79] @ java.lang.class.forname(class.java:191) ~[na:1.7.0_79] @ org.apache.jackrabbit.server.remoting.davex.protectedremovemanager.createhandler(protectedremovemanager.java:91) [jackrabbit-jcr-server-2.10.1.jar:na] @ org.apache.jackrabbit.server.remoting.davex.protectedremovemanager.(protectedremovemanager...

java - How do I create a number of chars that are automatically given a name based on a int? -

i'm creating program , needs way convert each letter of string char. number of letters in string variable, i'm using s.length() to create int has number of chars need make. question how extract letters each point in string , input them chars automatically named? e.g. char 0 = s.charat(0) char 1 = s.charat(1) etc... you can't thing you've done in example. you'll have hand or make kind of list, example arraylist. if so, loop , check if it's bigger int i , add value list. other (and easier) way use string.tochararray , able chararray[char number] then. example: string s = "wesley luh"; char[] ca = s.tochararray(); system.out.println("" + ca[0] + ca[1] + ca[2]); // result in wes

Function mapping Delphi DLL with Java (JNA) -

i'm having problems when trying use 2 functions of dll in delphi jna java. in test software (delphi, provided dll ), have functions (working in test software): function abrir_conexao (const modelo : **byte**; const host : **pansichar**; const porta : **word**; const senha : **pansichar**) : integer; stdcall external 'comunicacao.dll'; function enviar_comando (const comando : **byte**; var tamanho : **byte**; var dados : **pbyte**) : integer; stdcall external 'comunicacao.dll'; i'm trying implement these functions in java (jna). i'm getting load dll , , believe problem lies in use of correct primitive variables: public int abrir_conexao (**byte** modelo, **string** host, **short** porta, **string** senha); public int enviar_comando(**byte** comando, **byte** tamanho, **byte[]** dados); but it's not working. can ? for following native functions: function abrir_conexao (const modelo : byte; const host : pansichar; const porta : word...

excel - Error in dax formula -

i'm new dax. im trying sum amount of fatalities per year. formula: = summarize ( 'tablecrash', 'tablecrash'[year], "fatal", sum ( 'tablecrash'[fatalities] ) ) - example: summarize(<table>, <groupby_columnname>[, <groupby_columnname>]…[, <name>, <expression>]…) source there isn't wrong formula. problem how using it. because returns table incorporate snippet larger formula. can install dax studio excel test these snippets. in case execute: evaluate ( summarize ( 'tablecrash', 'tablecrash'[year], "fatal", sum ( 'tablecrash'[fatalities] ) ) ) but if have table contains year , fatalities don't need formula calculate sum of fatalities. try drop both fields power view or pivot table , fatalities sum automagically.

c# - LibGit2Sharp Find what files were updated/added/deleted after pull -

after running repo.network.pull() command want able see files added repository, altered in repository , removed repository. need file path of file , if add/update or delete. is there easy way this? i've tried looking diff.compare() i'm not sure if right way it. libgit2sharp 0.21.0.176 here libgit2 example of walking current commit tree , getting files changed , type of change. git version: git log --name-status --pretty=oneline 1d9d4bb881f97f5d3b67741a893f238e7221e2b1 updated readme fork info m readme.md 58cc5c41963d5ff68556476158c9c0c2499e061c update makefile pe32+ (platform:x64) assemblies m makefile m readme.md a7823c1c0a737c5218d33691f98828c78d52130b fix makefile 64-bit native lib , add readme.md m makefile readme.md ea7e6722f67569cb9d7a433ff2c036fc630d8561 update solution files. m mono-curses.csproj m mono-curses.sln 05dbe6e18895d1037ce333b0a1f652eeae3f8b33 fix resize handling. m attrib.c m gui.c...

ios - Can Xcode (command-line) build an archive without a scheme? -

i'm .net developer trying compile applications ios using xcode command-line tools. goal use command-line write script clone repository, compile code, , sign ios developer certificate. however, when clone git repository ios/osx application, contains xcode project file (and workspace file). when try use 'xcodebuild archive' requires scheme specified 'xcodebuild -list' says none exist. what correct way automatically generate these schemes command-line?

sql - Select first row from group each by with count using Big Query -

i've got on 500million rows stored in bigquery represent exact position of device @ time (irregular). i'm trying find fast , efficient way determine first , last seen position of device . so far, have working join it's taking on 10 mins complete (unless limit in query). tried dense_rank query can't sort count out (and don't understand tbh). i have client_id, device_id (which fixed , represents location within building) , timestamp. first did group client_id , device_id validate should expect. tried joining table using min , max timestamp: select count(firstset.device_id), firstset.device_id ( select client_id, device_id, created_at [mytable.visitsv3] secret = 'xxx' group each client_id, device_id, created_at order client_id, created_at asc limit 1000 ) firstset inner join ( select client_id, device_id, min(created_at) [mytable.visitsv3] secret = 'xxx' group each client_id, device_id, created_at limit 1000 ) seconds...

Setting color palette in R -

i have been trying produce plot in grayscale confidence interval fill , black lines predicted lines. have tried every lead find online , far has not produced plot in grayscale. obliged help. for reference, predictor 1 categorical variable (3 levels) , predictor 2 continuous predictor variable. library(ggthemes) ggplot() + geom_ribbon(data=yhat, aes(x=predictor2, ymax=fit+se*1.96, ymin=fit-se*1.96, fill=predictor1), alpha=0.5)+ geom_line(data=yhat, aes(predictor2, fit, color=predictor1), size=1.5) +xlab('') + ylab('') + ggtitle('')+ theme_few(base_size=14)+ scale_y_continuous(limits=c(0,1))+ geom_abline(aes(intercept=0.5,slope=0),linetype="dashed") you can create own pallette ggplot pallette_yellow_green <- c("#ffff00", "#d4e100", "#bfd300", "#95b500", "#80a600", "#6a9700", "#558800", "#2b6b00", "#155c00", "#003400") and ggplot...

PHP Regex to match word in a sentence with optionally only other certain words -

i'm looking php regex match word in sentence optionally permit other words in sentence match should fail if there other words in sentence not in allowed list. eg: the quick fox here i'm looking fox. 'the' , 'quick' ok if appear. since words optional fox would ok too. however, the quick brown fox is not ok. don't want brown fox. feel free suggest way of doing needs blazing fast. edit: words come before fox can appear in order quick fox should match too. just make first 2 words optional. ^(?:(?:the )?(?:quick )?fox|(?:quick )(?:the )?fox|(?:fox )?(the )?quick|(?:the )?(?:fox )?quick)$

Distinguish Android onDestroy events -

i'll start saying i've seen activity lifecycle diagram ( http://developer.android.com/reference/android/app/activity.html ) , thouht understand perfectly. how andestood if there ondestroy event, there no coming , activity in process of being shut down. all others involve ability show activity again between oncreate , onstop (both inclusive). i creating application polls custom bluetooth device measurements result. want connection (bluetooth) kept, want discover if user kills activity (from taskbar killing application) can send 1 more thing device , disconnect socket. understood, can put code in ondestroy. turned out (sony xperia z3 , samsung galaxy s2) ondestroy being executed when user clicks power button, locking screen. when screen unlocked, new activity (that guess) created , oncreate run. , can guess - device disconnected because of code put ondestroy normal automatic screen off + lock not ondestroy... so point is: there way distinguish ondestroy destroys ac...

excel - VBA data validation to default value from named range -

so have data validation in once cell changes 1 of 3 different named ranges based on user selection in cell. need when user selects value, i.e. "selection a", data validation not change corresponding named range, display first value within range. currently can manipulate code default value, keeps changing default value every time try , make selection.is possible? below code i'm running once specific named range using worksheet_change event in example i've used named range selection_a private sub worksheet_change(byval target range) if range("$e$3").value = "selection a" range("l3:r4").validation .delete .add type:=xlvalidatelist, alertstyle:=xlvalidalertstop, operator:= _ xlbetween, formula1:="=selection_a" .ignoreblank = false .incelldropdown = true .inputtitle = "" .errortitle = "" .inputmessage = "" .errormes...

loops - repeat operation to different data set in R language -

i have data set have 5 columns (column, 0 4) named data1. add column 2, 3 , normalize result of data1. following : final_data = my_norm_function(data1[2]+data1[3]) write.table(final_data) but want same operation other data set, data2 , data3 , data4 , etc -- 2 columns out each data set , add them together, normalize result , save. there loop can use this? saved data set corresponding data1 , data2 , data3 . sure, here's for loop version: for(i in c("vector of file names")){ datain<-read.table(i) final_data = my_norm_function(datain[2]+datain[3]) write.table(final_data,file=paste("final_data",i)) }

How to search and replace multiple number sequences in a file using bash -

i have file lots of lines this: dog:7066469:182:0:0:7050964:7087402:7058396:7079290:7087537 cat:7066469:182:0:0:7050964:7087402:7058396 dog:7066469:182:0:0:7050964:7087402:7058396:7079290 using bash programming (sed or awk or something), how can add 6 in front of every number after 5th ":", lines begins "cat:"? correct result this: dog:7066469:182:0:0:7050964:7087402:7058396:7079290:7087537 cat:7066469:182:0:0:67050964:67087402:67058396 dog:7066469:182:0:0:7050964:7087402:7058396:7079290 using awk: awk 'begin{fs=ofs=":"} $1=="cat"{for (i=6; i<=nf; i++) $i = "6" $i} 1' file dog:7066469:182:0:0:7050964:7087402:7058396:7079290:7087537 cat:7066469:182:0:0:67050964:67087402:67058396 dog:7066469:182:0:0:7050964:7087402:7058396:7079290

service - How do I create a log entry for the systemd Journal? -

i have service , , have create logs journald daemon in cases. far, have not been able find instructions on how so. am misunderstanding intended use of journal ? or obvious missing? any appreciated. if have service, write log standard error . (it's available stream named std::clog in c++, more "log-like" semantics std::cerr .) that's it. it's logging mechanism works systemd, daemontools, daemontools-encore, runit, s6, perp, nosh, freedt, , others. there api writing systemd journal. make sure have excellent reason locking softwares , users in api, however. writing standard error mechanism works, pretty everywhere. it's understood , easy administrators control, tweak, , comprehend. should first choice. further reading jonathan de boyne pollard (2015). "logging" . daemontools family. given answers. jonathan de boyne pollard (2001). " don't use `syslog(). ". mistakes avoid when designing unix dæmon prog...