Posts

Showing posts from May, 2014

java - Gson get list of objects from json -

i have json string contains array of objects(filters array). json string has other objects , fields im interested in parsing json array. can tell me how can using gson? here json file: { name: "test json", test_ob: { name: "test" } filters[ { test: 1, test: 2, ... } ... ] } and code: filters filters = new gson().fromjson(jsoncontent.tostring(), filters.class); and filters class: public class filters { private list<filter> filters; public list<filter> getfilters() { return filters; } public void setfilters(list<filter> filters) { this.filters = filters; } } is json valid? try this: data.json: { name: "test json", test_ob: { name: "test" }, filters: [ { name: filter1, value: 1 }, { name: filter2, value: 2 } ] } filter.java: public class filter { priva

Issues integrating FacebookSDK and SimpleFacebook into Main Eclipse Project and starting Android app -

first post ever, here go: so had luck of getting internship @ company builds , maintain apps eateries. have been stuck 3 weeks on getting app run in emulator (embarrassing af). i've looked many solutions none have worked, best came top answer in form of guide i've combined steps sromku's setup guide simplefacebook on eclipse ( https://github.com/sromku/android-simple-facebook/wiki/setup-project ), i'm still having issues. errors pop pretty similar whether running in windows or mac, pretty sure overlooking stupid. i forgot mentioned restricted using eclipse, though android studio recommended ide company pretty set on eclipse. i wish upload pictures, stackoverflow won't let me upload images until have @ least 10 rep >.< common errors getting : the container 'android dependencies' references non existing library ' ../..main\bin\main.jar' project cannot built until build path errors resolved and upon cleaning project asyncfaceb

java - Connecting to database with Jetty and JNDI/JPA -

i trying migrate glassfish jetty. trying setup connection pools within jetty access oracle database jpa. when have connection information in persistence.xml, connection works , can access database know database drivers working. apps use jndi lookup data source example below. when run entitymanager null @ em.createnativequery(querystring, config.class).getresultlist();. persistence.xml: <?xml version="1.0" encoding="utf-8"?> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> <persistence-unit name="data_source" transaction-type="jta"> <jta-data-source>testdata</jta-data-source> <exclude-unlisted-classes>false</exclude-unlisted-classes> <properti

azure - Mobile Application Revese Gateway recomendation -

i have mobile application communicates rest based web-service. web-service lives behind firewall , talks other systems. web-service requires firewall port opened , ssl cert generated each installation. mobile apps sends login credentials web-services can login custom back-end systems. recently customer approached asking how deploy 50 offices. don't want modify every firewall in every office, we're looking options.. list of possible solutions , thoughts on each one: open firewall port , expose https webservice - our current solution dont want have contact 50 network admins , explain why need this. vpn - heavy weight, complex , expensive, need access 1 server. not solve problem firewall needs modified. microsoft azure hybrid connection manager - provides managed service azure cloud expose end point. azure expect connections easy install application lives behind firewall. when rest call made cloud end-point, request forward down

javascript - Web Page Is Scrolled Half Way Down When Loading on iOS -

i'm having issue long-scroll website i'm working on. currently, when load page on iphone, initial scroll position appears half way down or near bottom of page majority of time. have tried disabling few of slide shows, etc. on page try isolate problem, i've had no luck. i'm sure caused either way i'm loading in javascript or stylesheets. if take @ page , see if have suggestions, i'd appreciate it: http://www.ideabasekent.com/staging/athletics2015/ i've checked code , figure out you're loading css files using javascript. it's not practice lazy load css files because browsers needs read css file before render page know every element must be. try put css using metatags instead of loading javascript.

python - no such option: --include for pybot -

i trying run test cases based on tags. following error pybot. has idea might wrong? run.py: error: no such option: --include i run follows pybot --include login login.robot documentation here: http://robotframework.org/robotframework/latest/robotframeworkuserguide.html#by-tag-names i run pybot , works: pybot --include ready c:\path\to\testsuites\testsuitename.txt ready name of tag instead of login.robot put path test suite file want run.

reflection - What's the proper way to extract unexported fields from a Golang type? -

i'm trying take ssh public key (x.crypto.ssh.publickey, generated parsing authorized_keys ) , extract plain old crypto.rsa.publickey (i know key of type ssh-rsa ). means, in ssh-land, key of (unexported) type rsapublickey . by using either reflect.interface() or plain old fmt.sprintf("%v") can value looks like: &{133141753607255377833524803712241410600224583899447743985716492314976605735038858392516407436607315136967439536840885454950028631410155683051419836325912444338003188332463816050354540934271243064035037856360864190161298769948076508355604915775510460445701536855931828420791030023079646791573156484306628882221 35} i know, reading ssh package source, ssh.rsapublickey in fact defined type want: type rsapublickey rsa.publickey and therefore value thing want. (in fact, can, using "%+v" , see fields (of course) named n , e .) my problem don't know better way make go believe in fact rsa.publickey extract each of numbers strings f

search - VBA Outlook loop through my colleagues tasks -

i found how assign tasks colleagues. possible loop through colleagues tasks filter on project name, monitorate tasks status? in team project assign tasks each other, , project manager in 1 click see important tasks, status, due date... you can use getshareddefaultfolder method of namespace class folder object represents specified default folder specified user. example, shared tasks folder can use following code: sub resolvename() dim mynamespace outlook.namespace dim myrecipient outlook.recipient dim calendarfolder outlook.folder set mynamespace = application.getnamespace("mapi") set myrecipient = mynamespace.createrecipient("eugene astafiev") myrecipient.resolve if myrecipient.resolved call showtasks(mynamespace, myrecipient) end if end sub sub showtasks(mynamespace, myrecipient) dim taskfolder outlook.folder set taskfolder = _ mynamespace.getshareddefaultfolder _ (myrecipient, olfoldertasks) taskfolder.display end s

to notify JAVA program a new file is uploaded in google drive folder? -

how set event such new file uploaded specified google drive folder instantly notified java program? i have no experience google drive api should started... https://developers.google.com/api-client-library/java/apis/drive/v2 i'd see come when you're done! luck! i dug little further out of curiosity - https://github.com/google/google-api-java-client-samples/blob/master/drive-cmdline-sample/src/main/java/com/google/api/services/samples/drive/cmdline/drivesample.java

javascript - Find closest point of a div border (relative to another div) -

Image
i have been looking answer long time , can't figure out. need find is, having 2 div's, coordinates of closest point @ border of last div, relative first one. as can see, right not able i'm linking fixed points of each div using svg. link closest points @ border of each div. thanks much i got it. finally, problem pointless , did connect center of each div , made sure div showing on top of canvas. no matter how elements positioned, looks perfect. thanks anyway!

Generating an m X n array with 0/1 that meets certain conditions in R -

i'm working on problem on surface seems easy i've been unable find key solving it. think harnessing power of r it's relatively trivial. the basic premise this. have 32 people @ networking event. there 4 tables seat 8 people @ time. @ event there 4 rounds people meet each other. idea come seating arrangement across rounds makes every person meets max number of unique people across rounds possible. so have 16 (table*round: t1r1, t1r2,...etc.)) column x 32 (number of people) row array of 0/1 (0 = not seated @ table/round, 1 = seated @ table/round). , array has meet following conditions: people can have 4 rounds rowsums should 4. each table/round combo can fit 8 people hence colsums should 8 each person can @ 1 table once rowsum of table columns has 1 (t1r1 + t1r2 +t1r3 + t1r4 = 1) each person can @ 1 per round rowsum of round columns has 1 (t1r1 + t2r1 + t3r1 +t4r1 = 1) i'm sure there's mathematical solution, thinking might quicker brute force in r gen

subset array with Fortran given a condition? -

suppose have array a(n,m). possible subset array in fortran create new array? example, a = 11 22 43 55 15 56 65 63 54 56 32 78 i want create array b m-1 columns , rows satisfies a(:,2) .eq. 56 so b should be: b = 15 65 63 54 32 78 i don't know how start because, example, dimension of b should determined dynamically (i think) thanks help! are looking this? function extractb(a) result(b) integer, dimension(:,:), intent(in) :: integer, dimension(:,:), pointer :: b integer :: nrowb, i, pos nrowb = count( a(:,2)==56) allocate( b(nrowb, size(a,2)-1 ) ) pos = 1 = 1, size(a,1) if(a(i,2)==56)then b(pos,1) = a(i,1) b(pos,2:) = a(i,3:) pos = pos+1 end if end end function extractb that call like b = extractb(a) with b defined like: integer, dimension(:,:), allocatable :: b i assumed integer arrays. if compiler implement pointer return v

r - Adding shading alternate areas for categorical variable in a bar plot in ggplot2 -

Image
i trying t o plot bar plot using ggplot2 as follows: library(ggplot2) ggplot(mtcars, aes(factor(carb))) + geom_bar() + coord_flip() x axis continous variable, while y axis categorical 1 ( factor ). i add alternate shading area behind each bar differentiate factors in y axis. know can use geom_rect() this. how calculate y axis limits area, when factor ? x axis limits rectangles -inf inf . i looking along lines of image, barplots instead of boxplots. solved it # create data.frame shading info shading <- data.frame(min = seq(from = 0.5, = max(as.numeric(as.factor(mtcars$carb))), = 1), max = seq(from = 1.5, = max(as.numeric(as.factor(mtcars$carb))) + 0.5, = 1), col = c(0,1)) # plot ggplot() + geom_bar(data = mtcars, mapping = aes(factor(carb))) + geom_rect(data = shading, aes(xmin = min, xmax = max, ymin = -inf, ymax = inf, fill = factor(col), alpha = 0.1)) + scale_fill_manual(values = c("whit

google app engine - Connect to dev_appserver Datastore using Python protocol buffers library -

i have python script add entities cloud datastore local development server using python protocol buffers library, , to: instead of using cloud datastore local development use dev_appserver datastore or make somehow dev_appserver use datastore file created cloud datastore local development server i know there option set datastore file: --datastore-path datastore_path path file used store datastore contents but couldn't make work. any thoughts? thanks this not supported, there open feature request: https://github.com/googlecloudplatform/google-cloud-datastore/issues/21 you can follow issue updates.

javascript - input onchange function calling not only on change -

so title states have dynamic form adds inputs dynamically , 1 of inputs dropdown on change calls val(this) function , call function when adds field when a.addspell on click function executed $('div#championinput').on('click', 'a.addspell',function(){ var championname = $(this).closest(".champion").find(".championinput").val(); if($.inarray(championname, championswithextraspells)==-1){ optionschampion = '\ <option value="passive">passive</option>\ <option value="q" selected>q</option>\ <option value="w">w</option>\ <option value="e">e</option>\ <option value="r">r</option>' ;} else{ optionschampion = '\ <option value="passive&q

javascript - OpenLayers 3 Polymer 1.0 module -

i'm trying make polymer module working openlayers 3 , displaying openstreetmaps. know there great module working leaflet need specifics functions map orientation. anyway, code , it's working except 1 thing can't figure out : when page loads, commands showing (zoom + / zoom -) , not map (and not thing such marker, etc). if resize window (my chrome window mean) map appear , working fine !! thinking maybe in relation dom loading... module code : <dom-module id="openlayer-map"> <link rel="stylesheet" href="http://openlayers.org/en/v3.7.0/css/ol.css" type="text/css"> <script src="http://openlayers.org/en/v3.7.0/build/ol.js" type="text/javascript"></script> <style> :host { display: block; } #map { position: absolute; height: 100%; } </style> <template> <div id="map" class="map"></div&

javascript - Tinymce load buttons according to users selection -

we using tinymce transcription/annotation. each button type of 'thing'. have lot of things , dont want of them load. instead ideally tiny mce editor have buttons hidden default, except drop down list contains types of documents transcribing. user can select document type , voila buttons appear. is possible tinymce? has else done this? this has done within tinymce editor loading editor floating window. the key keep settings intact , modify on user-selected option in case. i modified @pete's code little bit, , works fine. here code: <script type="text/javascript"> var settings = { selector: "textarea", plugins: [ "advlist autolink lists link image charmap print preview anchor", "searchreplace visualblocks code fullscreen", "insertdatetime media table contextmenu paste" ], toolbar: [] }; function loadtinymce(type

xml - xsl to get the element node value and attribute of parent node -

i'm trying place in text file following: <skos:concept rdf:about="http://aims.fao.org/aos/agrovoc/c_26321"> <skos:preflabel xml:lang="fa">آبیس ماریزی‌ای</skos:preflabel> <skos:preflabel xml:lang="zh">大白叶冷杉</skos:preflabel> <skos:preflabel xml:lang="tr">abies mariesii</skos:preflabel> <skos:preflabel xml:lang="th">abies mariesii</skos:preflabel> <skos:preflabel xml:lang="sk">abies mariesii</skos:preflabel> <skos:preflabel xml:lang="ru">abies mariesii</skos:preflabel> <skos:preflabel xml:lang="pt">abies mariesii</skos:preflabel> <skos:preflabel xml:lang="hi">एबीस मैरीइसी</skos:preflabel> <skos:preflabel xml:lang="pl">abies mariesii</skos:preflabel> <skos:preflabel xml:lang="lo">abies mariesii</skos:preflabel> <skos:preflabel xml:lang="it&

ios - Dynamic Button creation doesn't work -

can't figure out what's wrong - here's implementation of viewdidload() in uiviewcontroller; have 3 different ui elements dynamically created: uiimageview, uibutton , uilabel; though initiated in same way, turns out button not created correctly! - (void)viewdidload { [super viewdidload]; // additional setup after loading view. self.mainimageview = [[uiimageview alloc] initwithframe:cgrectmake(0, self.navigationcontroller.navigationbar.frame.origin.y + self.navigationcontroller.navigationbar.frame.size.height, self.view.frame.size.width, self.view.frame.size.width)]; [self.view addsubview:self.mainimageview]; self.mainimageview.image = [uiimage imagenamed:@"main"]; self.buttontraining = [uibutton buttonwithtype:uibuttontypesystem]; [self.view insertsubview:self.buttontraining abovesubview:self.mainimageview]; self.buttontraining.backgroundcolor = [uicolor redcolor]; self.buttontraining.tintcolor = [uicolor whitecolor]; self.buttontraining.titlelabel.f

mysql - JSON and PHP Error Occurred in registration- Android Studio -

when ever try register user, below error , not insert data database , table on localhost wamp server , database saved on phpmyadmin, when register user below error message occurs if user fails register. have 4 php files index.php error coming not register user on phpmyadmin database no data gets entered database. error log 07-23 15:23:10.833 2133-2395/com.bradvisor.bradvisor e/json﹕ no database selected 07-23 15:23:10.833 2133-2395/com.bradvisor.bradvisor e/json parser﹕ error parsing data org.json.jsonexception: value no of type java.lang.string cannot converted jsonobject php files index.php <?php /** php api login, register, changepassword, resetpassword requests , email notifications. **/ if (isset($_post['tag']) && $_post['tag'] != '') { // tag $tag = $_post['tag']; // include database handler require_once 'include/db_functions.php'; $db = new db_functions(); // respo

asp.net - Azure App Service Environment Access Levels -

i setting api apps within ase, , having difficulties understanding usage of access levels. i noticed if api app access level set “internal” it’s not accessible publicly, however, not internal endpoint, public 1 – unable access application internally (for example – browsing vm in same network). how can access api app virtual machine hosted on azure? how can internal endpoint api app? my goal able access api app vnet, , have public access blocked. how can accomplish this? thanks, turns out api apps have single end-point public vip. need create network security group on subnet , add explicit rules public vip's of back-end machines require access api. block internet traffic app when on public anonymous.

multithreading - Threadsafe test / decrement -

is code threadsafe, or fcount changed thread before interlockeddecrement executed? procedure tmyobject.wait; begin if fcount > 0 interlockeddecrement(fcount); .. end; it's not thread-safe. thread 1 reads fcount=1, evaluates condition true. thread 2 reads fcount=1, evaluates condition true. thread 1 decrements fcount 0 thread 2 decrements fcount -1 yet assume code intended prevent reducing fcount below zero. you might want consider following instead: if interlockeddecrement(fcount) < 0 interlockedincrement(fcount); in way, 1 of 2 concurrent threads reduce value -1 , "fix mistake". however, have side-effect fcount may temporarily < 0 .

cordova - Phonegap - build fails after including my js files -

Image
i'm trying build phonegap app, error when running: sudo -e env "path=$path" phonegap build android error code: 1 unable add '.../app/platforms/android/build/intermediates/assets/debug/www/react-backbone/node_modules/gulp-notify/node_modules/node-notifier/node_modules/semver/semver.browser.js.gz': file in archive (try '-u'?) error: unable process assets while packaging '.../app/platforms/android/build/intermediates/res/resources-debug.ap_' a brand new project builds fine. moment add own css , js files , modify index view, fails. after commenting out external css , js files i'm loading, fails. could inclusion of foreign directory in www/ confuse phonegap , cause error? edit: differences between working app , broken one. my new index.html : replaced <div class="app"> <h1>phonegap</h1> <div id="deviceready" class="blink"> <p class="event listening">

java - How to import excel data to mysql? -

i have excel sheet contains many fields. have database contains many tables linked 1 another. fields excel sheet contains inserted multiple tables linked 1 another. eg sample.xls or .xlsx id | name | number | designation 1 | manan | 987654321 | software eng. database : personal table id | name | number | desig_id 1 | manan | 987654321 | 1 database : designation table desig_id | designation name 1 | software eng. this sample have many tables linked @ same time. how shall import type of data? the coding bit complicated if want simple answer; can interact database java using jdbc , can interact excel file java using apache poi (their how-to page useful).

javascript - Google Spreadsheet - string value getting converted to date? -

guys have google sheet column taskname , type plain text . if enter value 5 jul under column stored 5 jul . i add value in sheet using code similar this: var name = "5 jul"; var url = "&taskname=" + encodeuricomponent(name); var encodedstring = encodereservedcharacters(url); var htmlval = "<html><script src='" + url + "?action=addname&groupid=" + groupid + "&prefix=addnamecallback" + "&" + encodedstring + "'><'/script><'/html>"; $("#checkscript").html(htmlval); function encodereservedcharacters(querystring) { var reservedcharwithequivalenthexcode = { "(": "%28", ")": "%29", "/": "%2f", "*": "%2a", "'": "

c# - Fix the height of table in html while printing -

i have created report displayed in webpage. it's set of tables 1 below other. has total 4 tables. now, out of 4, 3 tables having fixed height( content fixed), 1 table has content in number of rows vary. how can keep height of table fixed, irrespective of content. if height increases, content size(row size) should minimized, whole report should printed on single a4 size paper. have tried using min-height , max-height . there isn't going "one size fits all" solution this. there maximum number of rows can displayed fit on 1 physical a4 page. imagine maximum 10 rows, hit 11 rows spill on next page. you can reduce table cell height off increase number of rows can displayed can make cells small before become unreadable. once know best maximum may wish build "maximum report size" application prevents more maximum numbers of rows being output page in first place. you may able consider reducing width of table less 50% of page width, have 2 tables

Difference between modelname.new and modelname.create in rails? -

this question has answer here: rails new vs create 4 answers when using rails console can type either: paper.new(name: "deva", body: "testing") paper.create(name: "deva", body: "testing") and seems same result. difference between .new , .create ? new initialize object , not save object in database create initializes save if validations met. for see this: http://apidock.com/rails/activerecord/base/create/class

amazon s3 - Serving files on S3 bucket through Cloudflare -

i wanted serve s3 bucket files through cloudflare network, encountered issues. integration instructions given here , suitable new buckets since bucket required named subdomain.domain.com while bucket named domain . are there other solutions use cloudflare s3 without copying files 1 bucket - setting redirects etc.? problem bucket contains more 6 million files , take 200 gb of storage. amazon s3 pricing rules hard understand. struggle find information how costs transfer information 1 bucket if in same location. thanks answers. unfortunately amazon s3 requires cname conforms bucket name found out. you'll have fix name. here https://serverfault.com/questions/349460/how-to-move-files-between-two-s3-buckets-with-minimum-cost can find how copy files between buckets minimum cost. within same zone, , right tools, not incur bandwidth costs, duplicate storage costs duration , access costs, details in linked answer. your link cloudflare docs doesnt seem working anymor

php - Facebook & html validation error: meta tags in body -

this not duplicate, put meta tags in head element facebook see in body element, btw: i'm using utf-8 without bom , obliged to, cause if don't use php error appear telling me header sent this facebook view of code https://developers.facebook.com/tools/debug/og/echo?q=http%3a%2f%2fanime-el3rab.com%2f i found problem in code, there php include function, include function somehow generated "paragraph tag" paragraph tag inside head forced head closed , body start, made rest of elements writen after include goes body element

ajax - Problems with ajax_function i get an error -

hello stackowerflow people, ive got problem, im trying use 1 of community scripts, , cant find out problem. error ajax_function, how can solve it, or fix please help, here script: <script> function editcolumn(dbc) { var params = 'option=edit&dbc=' + dbc ; var divdbc = 'edit_' + dbc; ajax_function('ajax_edit.php', params, divdbc); } function savecolumn(dbc) { var value = document.getelementbyid('date_'+dbc).value; var params = 'option=save&value=' + value + '&id' + dbc ; var divdbc = 'edit_' + dbc; ajax_function('ajax_edit.php', params, divdbc); } </script> and here error get: referenceerror: ajax_function not defined how can possible create ajax function work script? it means ajax_function() not declared or not found find keyword in of files "function ajax_function()" or check if needs import script contains function ajax_func

html - Vertically aligning an input and an item in a top menu bar -

Image
i've got menu bar @ top of page called .top-utility-bar , in i'd have search box, sign in link , cart status. i've made i'm having issues aligning input box links on menu so: i'd other items align vertically. i've been trying working days still no luck. doing wrong that's obvious? html: <div class="top-utility-bar"> <div class="right-top"> <ul class="top-list"> <li class="top-li"> hello <a href="/account">{{ customer.first_name }}</a>! {{ 'log out' | customer_logout_link }} </li> <li class="top-li"> <a href="/cart"><i class="fa fa-shopping-cart icon"></i> {{ cart.item_count }} {{ cart.item_count | pluralize: 'item', 'items' }} ({{ cart.total_price | money }})</a> </li> <li class="top-li"> <form ac

ios - Use DATETIME and TIME of sqlite query in Core data -

what predicate equivalent of sql query datetime('now','+0 seconds’) > datetime(zdate,time(zend_time)) where zdate date in format yyyy-mm-dd hh:mm:ss zend_time date in format yyyy-mm-dd hh:mm:ss i getting following error when directly using in nspredicate unable parse function name 'datetime' supported selector (datetime)

nginx - berks-api will not run on ubuntu in azure - get Permission denied @ rb_sysopen - /etc/chef/client.pem -

as part of our chef infrastructure i'm trying set , configure berks-api server. have created ubuntu server in azure , have bootstrapped , appears node in chef-server. i have followed instructions @ github - bekshelf-api installation install berks-api via cookbook. have run sudo chef-client on node , cookbook appears have been run successfully. the problem berks-api doesn't appear run. linux terminology isn't great sorry if i'm making mistakes in appears if berks-api service isn't able run. if navigate /etc/service/berks-api , run command sudo berks-api i error i, [2015-07-23t11:56:37.490075 #16643] info -- : cache manager starting... i, [2015-07-23t11:56:37.491006 #16643] info -- : cache builder starting... e, [2015-07-23t11:56:37.493137 #16643] error -- : actor crashed! errno::eacces: permission denied @ rb_sysopen - /etc/chef/client.pem /opt/berkshelf-api/v2.1.1/vendor/bundle/ruby/2.1.0/gems/ridley-4.1.2/lib/ridley/client.rb:144:in `read&

ios - How can I apply multiplier to all my constraints created on nib files? -

i've pretty finished project, realize fonts , spaces in between weird in iphone 6plus. i've created constraints drag , drop on xib files. colleague added these codes on global function can apply multipliers: - (float)constraintscale { if (is_standard_iphone_6_plus) { return 1.29; } return 1.0;} - (float)textscale { if (is_standard_iphone_6_plus) { return 1.16; } return 1.0; } my problem having drag each (more 100) constraints code , applying each these multiplier , scale. there more convenient way add multipliers xib files? i've thought subclassing take same amount of time? self.view.constraints will give constraints on view. for(nslayoutconstraint *c in self.view.constraints) { c.multiplier = [self constraintscale]; } probably work. hope helps. edit: sorry readonly issue. way rid of problem may be; nsmutablearray *constraintsnew = [nsmutablearray new]; (nslayoutconstraint *c in self.view.constraints) { nslayoutcon

r - Merge for multiple columns and rows -

given following data tables: > d1 <- data.table(letter=c("a", "b", "a", "b"), v1=c(0,0,0,0),v2=c(0,0,0,0)) > d2 <- data.table(letter=c("a", "b"), value=c(1,2)) > d1 letter v1 v2 1: 0 0 2: b 0 0 3: 0 0 4: b 0 0 > d2 letter value 1: 1 2: b 2 i seek fill columns v1 , v2 d1 using values d2, that: > d12 letter v1 v2 1: 1 1 2: b 2 2 3: 1 1 4: b 2 2 i assume have use function 'merge' somehow have not managed. any advice on how achieve this? many in advance! setkey(d1, letter) setkey(d2, letter) d1[d2, c('v1','v2'):=value] # d1 holds updated dt the d1[d2] merges d1 d2; c('v1', 'v2'):=value assigns value column v1 , v2. rows in d1 have letters not in d2 left as-is.

android - Make whole layout scrollable and not just listview -

i trying make whole layout scrollable in case listview being scrolled , not whole layout. please tell me how can make whole page scrolled , not listview in it. thanks my xml file <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context=".mainactivity"> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content"> <gridview android:id="@+id/grid" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_centerinparent="true" android:columnwidth="100dp" android:gravity="center" android:horizontalspacing="2dp" android:numcolumns="auto_fit"

javascript - Leaflet circle radius doesn't matter -

i'm working on extension game map displays active map server. map working , isn't me. important they're using simple crs work around game coordinates. now want create circle radius. radius should bind map unit (latlng) , not pixels, if zoom in circle should have bigger radius on screen, relative world map same radius. so i've code extension map: var bla = l.circle([0,0], 1000, {'color': '#ffffff'}).addto(map); as can see, test only. there should circle radius 1000 (i think it's in map "units" because value in docs named "meters"). can see circle isn't more dot. if set radius size, there no effect: var bla = l.circle([0,0], 100000, {'color': '#ffffff'}).addto(map); and radius of 1000000000000000 doesn't matter radius calculation. negative radius doesn't work, too. have ideas? this happens when use 0.7 leaflet l.crs.simple projection. they've fixed in 1.0 beta added bunc

ios - How to get tweet ID ....? i am using twitter SDK through fabric -

twitter.sharedinstance().apiclient.loadtweetwithid(tweetid, completion:<#twtrloadtweetcompletion##(twtrtweet?, nserror?) -> void#>) how use tweet id fetch information tweets? try code. twtrloginbutton* loginbutton = [twtrloginbutton buttonwithlogincompletion: ^(twtrsession* session, nserror* error) { if (session) { nslog(@"signed in %@", [session userid]); } else { nslog(@"error: %@", [error localizeddescription]); } }]; loginbutton.center = self.view.center; [self.view addsubview:loginbutton];

swift - How to record video of front and back camera at a time in iOS -

how record video both front , camera @ time in ios swift. while recording video iphone front camera want open camera , record video. means in 1 video file want cover both sides i don't think it's record both camera @ 1 time in ios. check avcapturedeviceinput class. this how catch video session queue avcapturedevice *videodevice = [iskitacamviewcontroller devicewithmediatype:avmediatypevideo preferringposition:preferredposition]; avcapturedeviceinput *videodeviceinput = [avcapturedeviceinput deviceinputwithdevice:videodevice error:nil]; [[self session] beginconfiguration];

relational database - Yii2 Framework: GridView, create new column with data from another tablet with indirect relationship -

i need help, please. i'm using yii 2 framework , generate models, controller , views gii! i have database 3 tables. database model here: database model now, in gridview of "colaborador", want create new column data "carreira" table. values must filled way: "colaborador" has "categoriaprofissional" belong "carreira". atribute "categoriaprofissional_fk" in table "colaborador" permits access "categoriaprofissional" has foreign key "carreira_fk" access "carreira". i'm in trouble achieve solution problem. this index view of "colaborador": <?= gridview::widget([ 'dataprovider' => $dataprovider, 'filtermodel' => $searchmodel, 'columns' => [ ['class' => 'yii\grid\serialcolumn'], 'numerofuncionario', 'nome', //now new column want create

sh - New line in git hook -

i have git hook calls php file. php file produce output (after running unit tests). te hook file sh file. output php file echoed terminal, \n stripped, , on single line. ideas have have new lines? thanks you can try and, in sh script, assign output of php script variable avar ; echo variable with: echo -e "${avar}" that should keep newlines, mentioned in " echo multiple lines file ". the same link mentions printf well. printf '%s\n' "${avar}"

c# - Change Row/Cell color in LightSwitch 2010 -

Image
if have page show list of hotels (rows 1 till 500). want change row color red. example row 1 has 5 columns: name age email tel salary gender_man mo 25 xxx@x.com 12546 10 yes action: if gender_man == true , change row color red. since new c# please tell me , how can in light switch? i've done in vb.net. however, solution adapted here , here have examples in c#, though of links example classes broken. basically need create method bind converter class each row being loaded. binding take specific column name, gender_man . in links above, using column status , able bind using column name. column name color , had use new binding("details.entity.color") might need play around this. the converter class simple subclass of ivalueconverter , has implement constructor can leave empty, convert tests value of column , returns solidcolorbrush object argb value want background be, , convertback throws

PHP PECL extension V8Js on Openshift Online -

i need openshift online php pecl extension v8js running letting react.js execute server side javascript php. pecl extensions enabled? if yes, how can that? last saw feature request 02.2014. did not information if in meantime has changed. 25.07.2015: i'm step further. corey pointed me promising direction. did not know, pecl kind of pear. both seem compatible openshift. added 'v8js' .openshift/pear.txt file , when git pushing app console talked me. tried install v8js 'pecl install channel://pecl.php.net/v8js-0.2.0' compiler not find v8, console said: checking v8 javascript engine... yes, shared checking v8 files in default path... not found configure: error: please reinstall v8 distribution so, how find path v8, , how know, if there? if not there, how it? 26.07.2015: did not manage install v8. tried described in google docs . compilation takes 600mb! , running out of quota. maybe may need upgrade python version too, since depot_tools require more recent ver