Posts

Showing posts from February, 2014

r - Building and adjacency matrix -

i wondering if guys can me building adjacency matrix. have data in cvs format this: paper_id author 2 foster-mcgregor, n. 3 van houte, m. 4 van de meerendonk, a. 5 farla, k. 6 van houte, m. 6 siegel, m. 8 farla, k. 11 farla, k. 11 verspagen, b. as can see column "paper_id" has repeated value of 11, meaning "farla, k." , "verspagen, b." coauthors of publication. need build square weighted matrix using names of authors, counting times collaborating together. does following looking for? # simulate data. d <- data.frame( id=c(2,3,4,5,6,6,8,11,11,12,12), author=c("fn", "vm","va","fk","vm","sm","fk","fk","vb","fk","vb") ) d id author 1 2 fn 2 3 vm 3 4 va 4 5 fk 5 6 vm 6 6 sm 7 8 fk 8 11 fk 9 11 vb 10 12 fk 11 12 vb # create incidence matrix: m &l

c++ - Constant Buffer DirectX 11 -

getting frustrated cbuffer in hlsl d3d11 not updating, initial values set upon application launch updating no go, used updatesubresource, tried id3d11devicecontext::map & id3d11devicecontext::unmap. note: cbuffer setup d3d11_usage_dynamic & d3d11_cpu_access_write. my id3d11buffer (constant buffer) returning 4 bytes when it's size queried.... sounds part of problem struct vs_cbuffer_data { xmfloat4x4 world; xmfloat4x4 view; xmfloat4x4 projection; vs_cbuffer_data() { xmstorefloat4x4(&world, directx::xmmatrixidentity()); xmstorefloat4x4(&view, directx::xmmatrixidentity()); xmstorefloat4x4(&projection, directx::xmmatrixidentity()); } }; d3d11_buffer_desc cbufferdesc; memset(&cbufferdesc, 0, sizeof(cbufferdesc)); cbufferdesc.bindflags = d3d11_bind_constant_buffer cbufferdesc.usage = d3d11_usage_dynamic; cbufferdesc.bytewidth = sizeof(m_cbufferdata); cbufferdesc.cpuaccessflags = d3d11_cpu_access_write; c

python - Collision Detection in a List -

i'm new collision detection , have been working on brick breaker style game tkinter. each of bricks created separately instead of creating if statements each of 30+ bricks put them in list, when run program collision detection function doesn't work. can please don't understand wrong in code. from tkinter import * root = tk() drawpad = canvas(root, width=600,height=600, background='white') player = drawpad.create_rectangle(260,590,340,595, fill = "blue") ball = drawpad.create_oval(293,576,307,590, fill = "white") brick1 = drawpad.create_rectangle(30,20,80,50, fill='green') brick2 = drawpad.create_rectangle(30,100,80,130, fill='green') brick3 = drawpad.create_rectangle(30,180,80,210, fill='green') brick4 = drawpad.create_rectangle(100,20,150,50, fill='green') brick5 = drawpad.create_rectangle(100,100,150,130, fill='green') brick6 = drawpad.create_rectangle(100,180,150,210, fill='green') brick7 =

What does ">" mean in jQuery and how to use it? -

i'm new jquery code, , saw code this: var $pages = $('#main > div'); does mean $pages first div under #main or divs under #main? if have html code: <div id="main"> <div class="sub-div" id="1">1</div> <div id="1a">1a</div> <div class="sub-div" id="2">2</div> <div class="sub-div" id="3">3</div> </div> so, $pages array contain 3 divs or first one? additionally, can use var $pages = $('#main > div > div'); to "1a" ? many thanks! $pages immediate child divs of #main. if have <div id=main> <div id=1> <div id=2></div> </div> <div id=3></div> <div id=4></div> <span id=5> <div id=6></div> </span> </div> then $('#main > div') fetch 1,

Why is my Point array only returning null in Java? -

i'm trying write method uses board , check see if @ given point on board, swap between 1 point right or below, causes "match" occur on board. points cause swap added point[] , returned. array returns, returns, [null],[null],[null]. why not returning points? thanks public static point[] findpossibleswaps(board b) { point[] swaps = new point[3]; int x = 0; int y = 0; point normal = new point (x,y); point hor = new point (x+1, y); point ver = new point (x, y+1); int count = 0; for(y = 0; y < b.getsize()-1; y++) { for(x = 0; x < b.getsize()-1; x++) { b.swapsquares(normal,hor); if (b.hasmatches() && (x)!=b.getsize()-1) { swaps[count] = new point(x+1,y); count++; } b.swapsquares(hor, normal); b.swapsquares(normal, ver); if (b.hasmatches() && y!=b.getsize()-1) {

r - Aggregate columns in data.table for descriptive statistics -

i looking @ student data set @ individual student level. what want do descriptive analysis @ faculty degree level. that students doing 2 degrees (double degrees eg bachelor of , bachelor of science) students generate 2 degrees. my data looks below. faculty assignments (whether fac1 or fac2) arbitrary. studid fac1 fac2 success sex ave_mark 1 arts 0 male 65 2 science 1 male 35 3 law 0 male 98 4 science 0 female 55 5 commerce 0 female 20 6 commerce 1 male 80 this generated students<-data.table(studid=c(1:6) ,fac1 = c("it","science", "law","it","commerce","commerce"), fac2 = c("arts","","","science","it","it"), success = c(0,1,0,0,0,1), sex=c("male","male","male&q

html5 - Is it still an unline tag or does it mean something else? -

i looking use jssor slider , in looking through code found <span u="arrowleft"...> tag (which can seen in other question: how move span different position in div ) the <u> tag used indicate underline, i've never seen u= tag. whenever try google comes underline tag results. mean? it specifies usage of ui element. jssor slider recognizes usage of every element in slider. for more info. if pass html validation, here.

checkout - Using TFS power tools 2013 to query checked out files in Visual Studio 2013 return nothing -

Image
i trying find checked out files tfs using tfs power tools 2013 add-in in visual studio 2013. search results empty. the tfs server 2012 though. see following screenshot took testing. i checked out few files, search same folder, nothing show up.does know how fix it?

java - BufferedImage class -

this might seem silly question, i'm bit of idiot i'm asking anyways. attempting modify existing open source code compare 2 images can create rudimentary retina scanner android app. however, code uses bufferedimage subclass. problem bufferedimage keeps returning unresolved symbol, , worried may because have create subclass, though thought part of java library. am right? or there i'm missing? , if right, provide me direction on making subclass? if helps, platform android studio 0.8.14. bufferedimage belongs awt package , isn't available on android :/ docs.oracle.com -> bufferedimage however can use bitmap class .it should wanna go. android developer - bitmap android developer - guide working bitmaps

haskell - Understanding type constraints -

my particular problem may have existential types i'm not sure won't put in title. anyways, here's i'm trying do. have entity type wraps on heterogeneous list of components. then, have hascomponent b typeclass denotes list b has component of type a . here's how i've written it, , classes instances. data entity c = entity c data compnode c n = compnode c n data compend = compend class hascomponent b getcomponent :: b -> instance hascomponent (compnode n) getcomponent (compnode _) = instance hascomponent n => hascomponent (compnode b n) getcomponent (compnode _ n) = getcomponent n instance hascomponent b => hascomponent (entity b) getcomponent (entity b) = getcomponent b there's hascomponent instance entity . that's convenience. so far, compiles. now, i'd try out. i've made displaydata a type holds data of type a that's meant displayed. 1 of components. i've made displayer a wrapper around

create a custom root in ruby on rails -

i have resource called bus_companies resources :bus_companies this generates url bus_companies/ , bus_companies/show , etc. need url companies/ , companies/show , etc. , don't want change name of controller companies put in config/routes.rb file resources :bus_companies, path: "companies" you can read more here

html - CSS Centering floating divs -

this centering div problem never go away! need help... reason never managed center multiple floating divs, whole internet having answer..!! (am problem?) .middle { margin-top: 40px; border-radius: 10px; width: 100%; background: #ffffff; bordder-radius: 10px; border: thin solid #777; box-shadow: 0 0 10px #888; padding: 5px 10px; text-align: center; overflow: hidden; display: inline-block; text-align: center; } .vidtyp { float: left; padding: 5px; margin: 30px 30px; border: thin solid #bbb; border-radius: 10px; display: inline-block; box-shadow: 0 0 1px #000; } .vidtyp img { width: 250px; height: 250px; } .vidtyp:after { clear: both; content: ""; display: table; } <div class="middle"> <br> <div clas

java - Log cat going crazy, logging phone too and not just app? -

when connect phone log cat goes crazy, prints tons , tons of messages , never stops. can't write useful debug logging because gets lost tons of other messages getting printed out. it wasn't doing this, started recently. tried restarting eclipse , unplugging/pluggin in phone. why log cat doing this? it's it's tied phone , going on don't want that, want app... that normal. logcat collects logs every app on device. want create filters based on tags or package name make useful.

android - TransferManager upload doesn't actually upload file -

i'm trying follow tutorial uploading file s3 from android sdk, outlined here . after verifying able create cognitocachingcredentialsprovider, tried execute upload device s3 bucket set up. have following code attempt this: cognitocachingcredentialsprovider credentialsprovider = new cognitocachingcredentialsprovider( context, identityprovider, null, {autarn}); log.d("logtag", "my id " + credentialsprovider.getidentityid()); //shows me identityid; credentialsprovider valid transfermanager transfermanager = new transfermanager(credentialsprovider); file file = new file("/storage/sdcard0/download"); upload upload = transfermanager.upload({bucket name}, "test.txt", file); while (upload.isdone() == false) { system.out.println(upload.getprogress().getpercenttransferred() + "%"); } the while loop shows me 0% of file has been uploaded, , indeed file not show expected in target bucket. have clue why file

angularjs - authenticating a route in angular -

i need routes require authentication, using module: https://github.com/enginous/angular-oauth which has $scope.authenticate trying figure out how access $scope/that function $routeprovider. saw example call factory function isn't trying do. 'use strict'; angular.module('app', [ 'ngroute', 'angularoauth', 'googleoauth', 'app.global', 'app.home', 'app.view' ]). config(['$routeprovider', function($routeprovider) { $routeprovider.when('/', { templateurl: 'views/home/index.html', controller: 'home' }); $routeprovider.when('/view', { templateurl: 'views/view/index.html', controller: 'view', resolve: { factory: checkauth } }).otherwise({redirectto: '/'}); $routeprovider.otherwise({redirectto: '/'}); }]); var checkauth = function() { }; the annotation resolve same dependency injectio

java - Is it safe to have HttpClient 3 and 4 in same classpath? -

as - legacy parts of web application depend on apache http client 3, new parts require http client 4.2. apache httpclient 3 , 4 seem live in different packages, theoretically should possible have both versions in same classpath. simple test code works fine. are there potential issues kind of deployment? in general, don't see potential issues. i'd prioritize updating legacy parts of webapp. the specific thing can think of if using both version 3 , 4 parts access same sites , sites used cookies carry session information, maintaining 2 separate cookie stores might result in strange behaviour. example, server side might invalidate sessions.

java - Identifier Expected Error Hash Table -

i'm having identifier expected error in block of code: @suppresswarnings({"rawtypes","unchecked"}) thelists = new list<anytype>[ nextprime( 2 * thelists.length ) ]; for( int j = 0; j < thelists.length; j++ ) thelists[ j ] = new linkedlist<>( ); the compiler says there should identifier after "thelists" , before =. identifier? how fix this? this full method: private void rehash( ) { list<anytype> [ ] oldlists = thelists; // create new double-sized, empty table @suppresswarnings({"rawtypes","unchecked"}) thelists = new list<anytype>[ nextprime( 2 * thelists.length ) ]; for( int j = 0; j < thelists.length; j++ ) thelists[ j ] = new linkedlist<>( ); // copy table on currentsize = 0; for( list<anytype> list : oldlists ) for( anytype item : list ) insert( item ); } i removed suppress warnings body , put

is microsoft exchange and sharepoint the same? -

there's time of life whereby confuse microsoft technologies exists. can clarify difference between ms exchange , ms sharepoint , ms onedrive business, formerly skydrive pro? the big points: ms exchange email, contacts, calendaring. activesync mobile component of these services. sharepoint, @ it's basic level, "team site" platform. people many different things on sharepoint. onedrive business "dropbox" service runs on sharepoint technologies. many features sharepoint taken out of odfb, such document library. confusion comes mail integration sharepoint. sharepoint capable of hosting email integrated services, calendaring. of these functions tie exchange, , not. instance, sharepoint calendar not exchange object, can connected outlook. if have particular points of confusion, please clarify question.

How do I parse a JSON array response in JScript .NET 4.0? -

i have question parsing json data jscript .net, 4.0. using visual studio 2005 running in windows xp make windows form (as opposed website). my restful api calls return json data in form of array of objects, example: [{"country": "usa", "state": "ca", "city": "san francisco”}, {“country”: “usa”, “state”: “wa”, “city”: “seattle”}, {"country": "usa", "state": “ma", "city": “boston”}], and don’t know how parse usable object. think need serializer/deserializer, datacontractjsonserializer this, see msdn , having difficulty implementing in jscript .net 4. i'm not sure if you've moved on this, , need more information help, have collection scripts serve library common things in jscript. 1 common task might make call 1 of these scripts api , json back. in order parse it, went json.org , downloaded json2.js. once got that, i'm able call: var data = json.parse(st

java - Get value from strings.xml in Facebook SDK -

i setting app facebook login , trying of pre set strings , colors facebook sdk , use them in activity_login.xml. this <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:layout_margintop="100dp" android:text="@string/com_facebook_loginview_log_in_button" android:textcolor="@color/com_facebook_loginview_text_color" android:textsize="@dimen/com_facebook_loginview_text_size" android:textstyle="bold" android:background="@drawable/com_facebook_button_blue" android:drawableleft="@drawable/com_facebook_inverse_icon" android:drawablepadding="@dimen/com_facebook_likebutton_compound_drawable_padding" android:paddingleft="@dimen/com_facebook_loginview_padding_left" android:paddingtop="@dimen/com_facebook_loginview_padding_top"

c++ - OpengGL Array Texture shows up distorted -

Image
this texture this how showing up i getting distorted result when using array textures. do need create mipmaps? using wrong image type? bmp's might bot idea images using time being simplicity. code #include <iostream> using namespace std; #include <cstdlib> #include <stdio.h> #include <gl/glew.h> #include <glfw/glfw3.h> #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> using namespace glm; glfwwindow* window; #define window_height 768 #define window_width 1024 #include "common/shaders.h" #include "common/texture.h" #include "common/controls.h" #define buffer_offset(i) ((char *)null + (i)) static void error_callback(int error, const char* description); static void key_callback(glfwwindow* window, int key, int scancode, int action, int mods); int main(void) { if (!glfwinit()) { fprintf( stderr, "failed initialize glfw\n" ); exit(exit_failure); }

html5 - Block element inside custom element inside <p> -

i'm using html5 custom elements create might termed "rich footnotes" (essentially little mouseover boxes). markup looks like <p> socrates <x-info> <x-text> man </x-text> <x-planation> <p>what man? here examples of men:</p> <ul> <li>bill clinton</li> <li>aristotle</li> </ul> </x-planation> </x-info>, therefore socrates mortal </p> which should render like socrates man , therefore socrates mortal such box appears when hover on word man . works fine when <x-info> contains inline elements. however, in above example html parser gets angry have <p> s , <ul> s nested inside <p> , , mangles markup renders more like socrates man what man? here examples of men: bill clinton aristotle , therefore socrates mortal is there way around this? avoid chang

java - How to remove and return an object from a Hashset? -

i have hashset has been populated penny objects , want create method remove 1 of these penny objects hashset , return it. here method have created not work error messages. can explain me correct way of doing public penny removepenny(){ if(penniesset.size()<= 0){ return null; } else penniesset.remove(penny) return penniesset.get(penny) } penniesset.remove(penny) , penniesset.get(penny) not work, penny class name, not value. if want element set remove, use set.iterator().next() : public penny removepenny() { if (penniesset.size() == 0) { return null; } penny penny = penniesset.iterator().next(); penniesset.remove(penny); return penny; }

python - ValueError when using pandas.read_json -

i made 250mb json file should this: [ {"a":"uniquevalue0", "b":[1,2,3]}, {"a":"uniquevalue1", "b":[1]}, {"a":"uniquevalue2", "b":[1,2,3,4]} ] where "b" value can variable len >= 1. this says have valid json. i call df = pandas.read_json('ut1.json', orient = 'records', dtype={"a":str, "b":list}) here documentation. when reading pandas dataframe, following traceback: traceback (most recent call last): file "<stdin>", line 1, in <module> file "/.../pandas/io/json.py", line 198, in read_json date_unit).parse() file "/.../pandas/io/json.py", line 266, in parse self._parse_no_numpy() file "/.../pandas/io/json.py", line 496, in _parse_no_numpy loads(json, precise_float=self.precise_float), dtype=none) valueerror: unexpected character found when decoding &#

python - getattr throws TypeError on ImageSpecField -

class mymodel(models.model): ... original_image = models.imagefield(upload_to=upload_image_to) thumbnail = imagespecfield( processors=thumbnail_processors, source='original_image', format='png' ) ... obj = mymodel() val = getattr(obj, 'thumbnail') ... gives me following error: "typeerror: can't pickle instancemethod objects" django 1.7.1 imagekit 3.2.4

BASH printf numbers with 1 char suffix -

i'm trying format number in bash. i'd replicate byte/packet number output iptables. here examples: 258 591k 55273 37g 22244 2212 6127k 12m 114k as can see: there no thousands separator, the field max of 5 characters wide, each suffix either: none, k, m, g, etc... i've searched documentation on printf have been unable find can format number way. know how this? thanks. you build custom formatting awk , : awk 'begin{ u[0]=""; u[1]="k"; u[2]="m"; u[3]="g"} { n = $1; = 0; while(n > 1000) { i+=1; n= int(n/1000) } print n u[i] } ' input sample : 258 591000 55273 37000000000 22244 2212 6127000 12000000 114000 output : 258 591k 55k 37g 22k 2k 6m 12m 114k

Create MultiDimensional javascript array from C++ -

edit: have figured out problem. there several bugs in posted code came (very) poor understanding of com, notably not understanding calls getdispid doing. i'll update post correctly working code, in case else runs issue. i have c++ application (mfc) embedded web browser. calling c++ functions javascript using: var arrresult = window.external.myfunction (myargs); it works well. send data array using code codeproject article http://www.codeproject.com/articles/88753/creating-javascript-arrays-and-other-objects-from now need send 2-dimensional array. code works me, now. note that, in javascript, 2 dimensional array comes object, not array. so, isarray returns false: omyresult = window.external.vpquery (strquery); if (array.isarray (omyresult)) alert ("this array!"); but successful: if( (typeof arrvpresult === "object") && (arrvpresult !== null) ) alert ("this object!"); so can iterate through this: (var st

java - How would I check if a part of a string equals another string of unknown length? -

for(int j = 1;j<filearray.size();j++) { if(str.contains(filearray.get(end+j))) { } } (assume end number such 30). goal of part when having window length of 30 , filearray size > 30, check if theres after index 30 matches whatever inside window. ex: "i eat piesss aaaabbbbpiesssbbbb" starting beginning of string add first 17 characters arraylist called window. check rest of string starting right after window see if there's matches. space doesnt match add output. keep checking see "piesss" matches. replace second "piesss" wherever first "piesss" occurs. so right im using filearray.get(end+j) check if there's matches within string(str) except doesn't work. there way fix code segment? the replacement part of question still unclear. reasoning use arraylist. i've written code 5 character window search match after splitting string provided. note how 30 , 17 va

osx - ServiceStack with Xamarin on MAC OS X -

are there step step instructions on how create servicestack project using xamarin on mac os x? the step-by-step instructions building web service scratch should apply xamarin studio well. otherwise can start copy of 1 of live demos instead.

sql - How I get computed column in select statement? -

i have 3 tables. one product table , has unitsaleprice , other table orderproduct , has column productquantity (how order particular product) , orders add detail of customer's orders. i wrote select statement this: select orderprice product, orderproduct, orders orderproduct.product_id = product.product_id , orders.order_id = orderproduct.order_id , orderprice (orderproduct.productqty * product.unitsaleprice) ; but orderprice column not in 3 tables , dummy column. when run query gives error column not exists. how do this??? you should learn use explicit join syntax: select (op.productqty * p.unitsaleprice) orderprice product p join orderproduct op on op.product_id = p.product_id join orders o on o.order_id = op.order_id;

Python adding dictionary values with same key within a list -

i picked python not long ago. an example below i have dictionary within list myword = [{'a': 2},{'b':3},{'c':4},{'a':1}] i need change output below [{'a':3} , {'b':3} , {'c':4}] is there way can add value together? tried using counter, prints out each dict out. what did using counter: for in range(1,4,1): text = myword[i] print counter(text) the output counter({'a': 2}) counter({'b': 3}) counter({'c': 4}) counter({'a': 1}) i have read link below compared between 2 dict. is there better way compare dictionary values thanks! merge dictionaries 1 dictionary (counter), , split them. >>> collections import counter >>> myword = [{'a': 2}, {'b':3}, {'c':4}, {'a':1}] >>> c = counter() >>> d in myword: ... c.update(d) ... >>> [{key: value} key, value in c.items()] [{'a

core data - Array of NSManagedObjects and reduce function compile but fail at runtime -

using playground simulate problem core data based app turned issue can't seem understand. class pole { var length: nsnumber! } var poles: [pole] = [] let pole1 = pole() pole1.length = 1 poles.append(pole1) let pole2 = pole() pole2.length = 2 poles.append(pole2) var sum = poles.reduce(0) { $0 + $1.length } // error not find member 'length' the property (attribute) named length nsnumber in nsmanagedobject class (entity). changing type nsnumber! int! allows line compile , run correctly in playground. leaving the type nsnumber! , changing the offending line follows: var sum = poles.reduce(0) { $0 + int($1.length) } also compiles , run correctly in playground. next step, taking app, using actual nsmanagedobject entity , attribute compiles fails @ runtime. failure 'unwrapping nil'. so bottom line can't figure out how use reduce function when attribute nsnumber , casting int doesn't seem acceptable. nsnumber foundation class used w

dns - Fowarding Customer Subdomain to appspot subdomain in google app engine -

we building saas product offer our customer installed/mounted product on website. i.e. our app @ http://saasproduct.appspot.com and our 2 different customer's website @ http://www.cust1.com , http://www.cust2.com can create cname record www cust1 pointing @ cust1.saasproduct.appspot.com , cname record www cust2 poiting @ cust2.saasproduct.appspot.com is possible ? can achieve similar compute engine ? the reasonable follow concepts here , use own domain: google custom domains essentially create cust1.saasproduct.com, cust2.saasproduct.com. both of have cname records google's servers , serve app. another option make use of: virtual ips then cname customer domains single app , presumably app check domain name if need serve pages differently. it's conceivable cust1.saasproduct.appspot.com, cust2.saasproduct.appspot.com names working. you'd need name deployed versions cust1, cust2 bit of hack , hard maintain.

Binary Tree Search Node Method using recursion JAVA -

hi sample tree ---------e -------d----g ----b------f--t ---a--c--------z so if node string class. , trying find f. need start searching possible right nodes first, search in left nodes match incoming string this have far public node search (string string) if(this.name.isequalto.string) return this; else if(this.next!=null) return this.getright().search; i not sure how make code go in 3 , search left. you there: make code search both subtrees, not return search of this.getright unless item found. instead, search left subtree, this: if (this.getright() != null) { node res = this.getright().search(string); if (res != null) { return res; } } if (this.getleft() != null) { return this.getleft().search(string); } return null;

sockets - com.jcraft.jsch.JSchException: java.net.ConnectException: Connection refused: connect -

i understand there duplicate >>> copied duplicate >>>as long local machine has ssh server running <<<<< cannot comment , cannot question (and im not providing answer....) it stated "as long local machine has ssh server running" not know how have ssh server running. turn on putty (double click on it) (not sure if means ssh(?putty?) server (?) running... doubt so... im new socket programming. making use of jsch ( http://www.jcraft.com/jsch/ ) try connect remote server (later stage) currently, code use , im trying connect local computer , execute command (ls exact) test. however, keep hitting connection refused. googled , noticed there articles mentions on "having server listening" have no idea means. please view code below. import java.awt.event.*; import javax.swing.*; import java.awt.*; import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; import java.util.properties; import com.jc

ffmpeg - building opencv, got undefined reference to avformat_network_init error -

Image
i using centos6.5, downloaded opencv-2.4.9, made build directory, , under there, ran 'cmake ..' , 'make'. during make run, got error message. i found avformat_network_init in ffmpeg source, installed ffmpeg once in home , /usr/lib. don't know how tell cmake ffmpeg installed (include header , library). see *.so files ffmpeg under /usr/lib64. why can't cmake find ffmpeg location? in advance. i succeeded in building opencv. anyone's reference post answer here. have had installed ffmpeg in 3 different places before (/usr/local/lib, /usr/local/lib64 , /usr/local). removed of them (i ran make uninstall @ build directories used install ffmpeg had been configured different prefix values). removed ffmpeg installed yum install running 'rpm -e ffmpeg'. started fresh installing ffmpeg (to /usr/local). time ok until last part, make couldn't find javac compiler. figured java_home env varailbe pointing wrong place set java_home directory

Syntax error due to using a reserved word as a table or column name in MySQL -

i'm trying execute simple mysql query below: insert user_details (username, location, key) values ('tim', 'florida', 42) but i'm getting following error: you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'key) values ('tim', 'florida', 42)' @ line 1 how can fix issue? the problem in mysql, words select , insert , delete etc. reserved words. since have special meaning, mysql treats syntax error whenever use them table name, column name, or other kind of identifier - unless surround identifier backticks. as noted in official docs, in section 10.2 schema object names (emphasis added): certain objects within mysql, including database, table, index, column, alias, view, stored procedure, partition, tablespace, , other object names known identifiers . ... if identifier contains special characters or reserved word , must quote whenever refer it.

java - Concatenate bytes to get char -

how 1 concatenate 2 byte primitives 1 char in java? i'm trying this: byte = 0x01; byte b = 0x02; char c = (char) (a + b); which gives 0x03. answer want 0x0102. is there no simple way concatenate primitives? i'm surprised there isn't obvious solution, since seems should easy. maybe there , don't see it. :p any appreciated. thanks! by shifting left 8 bits , adding. like, byte = 0x01; byte b = 0x02; char c = (char) ((a << 8) + b); system.out.println(integer.tohexstring(c)); output is 102 as pointed out in comments (by @chrismartin ) bitwise-or (and i'll add might xor ) like char c = (char) ((a << 8) | b); and char c = (char) ((a << 8) ^ b); to achieve same result. since should write dumb code suggest use whichever find easiest understand.

objective c - unrecognized selector sent to instance exception in iOS7 -

Image
i have requirement check whether string contains particular string or not.for purpose using function of nsstring class called c containsstring . function works fine in ios8 without throwing kind of exception in case of ios7 throwing exception called unrecognized selector sent instance i have used try & catch block prevent exception may know why happening? thanks in advance you can check in framework header. - (bool)containsstring:(nsstring *)astring ns_available(10_10, 8_0); this method of containsstring exist after ios 8 obvious throw error in ios7.... please use below method ios7 , can use above method ios8: if ([string rangeofstring:@"bla"].location != nsnotfound) { nslog(@"charecter found"); } may can solve issue. thanks

docker - Fig support on Boot2Docker / Windows platform -

i trying started with docker & fig using official boot2docker framework. the fig website includes instructions getting fig working on os-x ( http://blog.docker.com/2014/10/fig-1-0-boot2docker-compatibility-and-more/ ). however, there no references getting fig working within boot2docker under windows. i tried instructions installing fig within boot2docker fig website @ http://www.fig.sh/install.html , , ran roadblock command: curl -l https://github.com/docker/fig/releases/download/1.0.1/fig-`uname -s`-`uname -m` > /usr/local/bin/fig; chmod +x /usr/local/bin/fig apparently boot2docker filesystem read-only, curl command fails. can assist me getting fig working boot2docker under windows? i ended adding alias boot2docker vm (by editing default user .profile): alias fig='docker run --rm -it \ -v $(pwd):/app \ -v /var/run/docker.sock:/var/run/docker.sock \ -e fig_project_name=$(basename $(pwd)) \ dduportal/fig' this c

Spark submit failing with Hive -

i trying spark 1.1.0 program written in scala work, i'm having hard time it. have hive query simple: select json, score data when run following command spark-shell works (i need mysql_conn in driver class path i'm using hive mysql metadata store) bin/spark-shell --master $spark_url --driver-class-path $mysql_conn import org.apache.spark.sql.hive.hivecontext val sqlcontext = new hivecontext(sc) sqlcontext.sql("select json data").map(t => t.getstring(0)).take(10).foreach(println) i ten lines of json want. however, when run spark-submit follows problem bin/spark-submit --master $spark_url --class spark.main --driver-class-path $mysql_conn target/spark-testing-1.0-snapshot.jar here whole spark program package spark import org.apache.spark.sql.hive.hivecontext import org.apache.spark.{sparkcontext, sparkconf} object main { def main(args: array[string]) { val sc = new sparkcontext(new sparkconf().setappname("gathering data")) va

java - Modifying code within a protected method -

i wondering if possible override protected method in 3rd party jar file. guessing can invoke method using reflection, how overwrite it? the method is protected void a(world world, int i, int j, int k, itemstack itemstack) { if (!world.isstatic && world.getgamerules().getboolean("dotiledrops")) { float f = 0.7f; double d0 = (double) (world.random.nextfloat() * f) + (double) (1.0f - f) * 0.5d; double d1 = (double) (world.random.nextfloat() * f) + (double) (1.0f - f) * 0.5d; double d2 = (double) (world.random.nextfloat() * f) + (double) (1.0f - f) * 0.5d; entityitem entityitem = new entityitem(world, (double) + d0, (double) j + d1, (double) k + d2, itemstack); entityitem.pickupdelay = 10; world.addentity(entityitem); } } yes, point of protected methods can overridden subclass implementations in different packages/modules (the default access mode allows same package). it subclass decide if