Posts

Showing posts from April, 2015

Joining numbers in array javascript -

i got different buttons looks down below (ranging 1 9) <button type="button" onclick="calculatornumber(1)"> it leads following function: function calculatornumber(i) { mynumbers.push(i); var x = document.getelementbyid("screen").innerhtml = mynumbers.join(""); but not working quite i'd to. if press number 3 once , number 4, 3 & 4 stored in array @ [0] , [1] them stored @ same place , 34. ideas? i've tried enhance function following code not seem work: function calculatornumber(i) { mynumbers.push(i); var x = document.getelementbyid("screen").innerhtml = mynumbers.join(""); //joining them without comma mynumbers = []; //then empty array altogether mynumbers.push(x); // , push new value in you don't need array of numbers. it's 1 number: theonenumber = theonenumber * 10 + i; so start 0. press 3 => number 3 press 4 => number 34 press 5 =...

android - How to sort LinearLayout's children programatically -

i have linear layout horizontal orientation has few imageviews in (hardcoded in xml). have sort them based on multiselectlistpreference (all checked first , unchecked later). put checked ones in beginning tried ((linearlayout)imageview.getparent()).removeview(imageview); ((linearlayout)imageview.getparent()).addview(imageview,0); and did nothing unchecked. gives me "the specified child exists. must call removeview(view) on view's given parent" though i've called it. may because imageviews present in xml. how can obtain desired arrangement of child imageviews. if @ linearlayout not suffice, should use recyclerview here , heavier? cast parent view viewgroup removeview method work. ((viewgroup)imageview.getparent()).removeview(imageview);

debian - Using Puppet do deploy Apt-Dater -

i configured puppet apt-dater-manager using following description: node 'puppet' { class { 'apt_dater': role => 'manager', manager_ssh_key => template('site/apt-dater.priv.key'); } } then added host class { 'apt_dater': customer => 'test', ssh_key_type => 'ssh-rsa', ssh_key => template('site/apt-dater.pub.key'); } well, works - apt-dater , apt-dater-host being installed - if want start apt-dater i'm getting error: error on loading config file /root/.config/apt-dater/hosts.conf the file exists: -rw------- 1 root root 0 jan 11 22:00 /root/.config/apt-dater/hosts.conf but file empty how can add configured hosts automatically? so collect resources clients first. class apt-dater::client { @apt-dater::register{ "$hostname": } } # collect hostnames: apt-dater::client <<| |>> this on apt-dater/manifests/client.pp , include on client nodes. then...

api - Implementing Two-Legged Oauth2 in ZendFramework 2 with Apigility -

i trying build zendframework2 rest api , want implement two-legged oauth2 authentication. i have been looking around , can not find resources point me in right direction this. has done before or know of source missing? in oauth can make access tokens client specific assigning client_id . client_id can stored in local storage on client side , reused on next user login client. when user logs in first time new client (no client_id in storage user) new client_id created , 2nd verification step can added part of authentication process. example sending text message phone number. add expires_at field client table can repeat process if client_id has expired.

How to make a simple timer image slideshow using HTML and CSS -

i'm trying make simple timer slideshow. image visible amount of seconds (lets 5) , switches image, , repeats. i've searched can't seem work me. amazing here's tried far. tried 2 images fading in, thing not overlap. 1 above other, , fading animation works, both fade @ exact same time, instead of 1 fading image. <style> @keyframes cf3fadeinout { 0% {opacity:1;} 45% {opacity:1;} 55% {opacity:0;} 100% {opacity:0;} } #cf { animation-name: cf3fadeinout; animation-timing-function: ease-in-out; animation-iteration-count: infinite; animation-duration: 10s; animation-direction: alternate; } </style> <div id="cf"> <img class="bottom" src="12289696_1526730367649084_3157113004361281453_n.jpg" /> <img class="top" src="11406788_1433347623654026_6824927253890240539_n.jpg" /> </div> with 2 image , can @ low cost css animation: @keyframes cf { 50% {/* @ 50%, avoids alternat...

c# - Security of displaying ID's in Hidden fields -

i trying understand proper way handle following scenario. wish learn more acceptable passed on page in terms of security. lets take tournament scenario. have list of teams signed displayed on page. in order report result of game, have click on team , select win or lose. posted server in return records in database. the dilemma know team have clicked , game. there many rounds, 1 team can displayed many times. such need have hidden field on page has id of team , id of game can record result. what wondering is, how secure me create hidden field holds id. there better way handle such scenario? giving out information hacker if print out id in hidden field? some of answers have found through research "may" ok long authorize request. user reporting score has enough privileges report score. wished ask of experts here @ stackoverflow further support research. edit: this web application. if printing out id no go, how else determine team selected round? need h...

jquery - Disabling javascript in a child window, from the parent -

bit of weird request, i'd able have parent window: create new child window on same domain (using window.open ) prevent javascript running in child window currently, can within in child window including following @ top of page: <script> function.prototype.call = function() {}; function.prototype.apply = function() {}; </script> this pretty stops javascript in child page running. there way me from parent window ? can somehow inject code child page before scripts have chance run? or there other way this? any appreciated you can use bit of server side remove <script> tags , inline event handlers onclick . edit using client side can try grab whole page using ajax remove scripts there , write content newly created window. don't think able use $.get('page.html', function(html) { var html = $(html).find('script').remove().html(); }); because scripts may executed when added dom, maybe need use parser or rege...

ASP.NET Web Api 2 - Log every incoming request for specific actions -

i working asp.net web api 2. have written 2 filter attributes check every incoming request specific headers , if header keys not present return unauthorized response users. this doing (one of filters): public class headerfilterattribute : authorizationfilterattribute { public override void onauthorization(httpactioncontext actioncontext) { var req = actioncontext.request; if (! req.headers.contains("api-key") || req.headers.getvalues("api-key") == null) { actioncontext.response = req.createresponse(httpstatuscode.unauthorized); actioncontext.response.content = new stringcontent("token required", encoding.utf8, "text/html"); } } } now if request contains valid header keys , have reached correct action method or endpoint, want log details request. what right way create filter attribute scenario? method filter attribute override...

html - Google map above every divs -

i'm using google map api website, notice map goes above elements of page, popup divs "position:absolute". have tried change css position attribute no success. how can solve issue? the css attribute z-index sets position of non-statically positioned element on z axis. try adding div's style: div { position: absolute; z-index: 9999999; }

reactjs - Syntax error when testing React component Jasmine and Webpack -

i keep getting error when trying run simple test using react, karma, jasmine , webpack. error ' uncaught syntaxerror: unexpected token < ', think jsx isn't being processed js, don't know why happening understand webpack should handle using babel loader. if can provide advice grateful here files karma.conf.js var webpack = require("webpack"), path = require("path"); // karma configuration module.exports = function(config) { config.set({ basepath: "", frameworks: ["jasmine"], files: [ "../test/!**!/!*.test.js" ], preprocessors: { "./test/!**!/!*.test.js": ["webpack"] }, webpack: { module: { loaders: [ { test: /\.jsx?$/i, loader: 'babel-loader', query: { presets: ['react', 'es2015', 'stage-1'] } }, { test: /\.less$/, loader: "style!cs...

java - Setup of JMS message listener invoker failed -

i'm using camel , spring create jms application (out of jee container) produce jms messages send jms provider (ibm mq on other machine). receiver of messages non jms application. i'm trying move cachingconnectionfactory on spring configuration when doing if i'm getting warn : 15:05:51,838 warn [org.apache.camel.component.jms.defaultjmsmessagelistenercontainer] (camel (xxxinputcamelcontext) thread #1 - jmsconsumer[dev.kp.xxx.yyy.r) setup of jms message listener invoker failed destination 'dev.kp.xxx.yyy.r' - trying recover. cause: com.sun.proxy.$proxy84 cannot cast com.ibm.mq.jms.mqqueuesession can please me understand meaning of warn , mean can not or misusing cachingconnectionfactory?

php - Laravel 5 maintenance mode error $app -

i'm configuring maintenance mode in laravel. trying make ip's whitelist. when run code: <?php namespace app\http\middleware; use closure; class checkformaintenancemode { /** * handle incoming request. * * @param \illuminate\http\request $request * @param \closure $next * @return mixed */ public function handle($request, closure $next) { if ($this->app->isdownformaintenance() && !in_array($request->getclientip(), ['127.0.0.1'])) { return response('be right back!', 503); } return $next($request); } } i error: undefined property: app\http\middleware\checkformaintenancemode::$app can tell me what's problem ? you're using $this->app , class doesn't have $app property. can either use app() helper method, can inject application middleware, or can extend laravel's checkformaintenancemode clas...

macro for dynamic types in C -

when define macro this: [niko@dev1 test]$ cat m1.c #define fl_uint_fline_(n) typedef struct fl_uint_line_## n ##e { unsigned int indexes[n]; } fl_uint_line_## n ##e_t; fl_uint_fline_(4) fl_uint_fline_(8) int main() { fl_uint_line_4e_t fl4; fl_uint_line_8e_t fl8; } [niko@dev1 test]$ it compiles perfectly. had add 'e' character ('e' element) before , after '## n ##' because without 'e' compile error: [niko@dev1 test]$ cat m2.c #define fl_uint_fline_(n) typedef struct fl_uint_line_## n ## { unsigned int indexes[n]; } fl_uint_line_## n ##_t; fl_uint_fline_(4) fl_uint_fline_(8) int main() { fl_uint_line_4_t fl4; fl_uint_line_8_t fl8; } [niko@dev1 test]$ gcc -c m2.c m2.c:1:42: error: pasting "fl_uint_line_4" , "{" not give valid preprocessing token #define fl_uint_fline_(n) typedef struct fl_uint_line_## n ## { unsigned int indexes[n]; } fl_uint_lin...

asp.net - AJAXControlToolkit MaskedEditExtender behavior -

i referencing latest ajaxcontroltoolkit in asp.net 4.0.xxx webform application. using extender format phone number field follows. if field left empty don't need mask showing up. if phone number entered don't want mask disappear when tabbed away field, whats happening. hyphens in mask disappear , numbers left in field. how can prevent happening? <asp:textbox id="contact_homephone" runat="server" maxlength="50"></asp:textbox> <ajaxtoolkit:maskededitextender mask="999-999-9999" masktype="number" clearmaskonlostfocus="true" id="contact_homephone_maskededitextender" runat="server" targetcontrolid="contact_homephone" /> thanks. i going jquery maskedinput code , working wanted , more. thanks feedback!

Plot surface in cylindrical coordinate system in matlab -

Image
i have function , want plot on cylindrical coordinate. w(z,theta)=sin(n.pi.z/a).sin(m.theta) the limits of variables are: z=0..a , theta=0..theta_0 , radius of cylinder r=1. as physical sense can explain if in cartesian coordinate, z & theta x,y axis , w surface on rectangular domain. in cylindrical coordinate z & theta restrict 1 cylindrical piece of cylinder radius=1 w surface on domain. plotting using cylindrical or spherical coordinates involves several steps: create vectors theta , z : theta = linspace(0,2*pi); z = linspace(0,10); create meshgrid theta , z : [th,z] = meshgrid(theta,z); write function r(th,z): r = sin(z)+1+5*sin(th); %// cylinder r = ones(size(z)); convert cylindrical coordinates cartesian: [x,y,z] = pol2cart(th,r,z); plot result using surf , mesh or whatever: mesh(x,y,z); axis equal this result get:

c# - ASP.NET MVC BeginCollectionItem issue -

i having issue html helper begincollectionitem . seems binding item view , changes not being propagated. i have partial view , model bound ienumerable . below snippet. <tbody> @foreach (var entry in model) { <tr> @using (html.begincollectionitem("editedentries")) { <td>@entry.storeid</td> <td>@entry.district</td> <td>@html.editorfor(x => entry.adjhrs)</td> } </tr> } </tbody> if remove the foreach works, need use foreach because collection returned partial view ajax call along table , members. the begincollectionitem designed work partial view. create 1 model (i'll assume named mymodel , name partial "_mymodel.cshtml" ) @model mymodel <tr> @using (html.begincollectionitem("editedentries")) { <td>@html.displayfor(m => m.storeid)</td> ...

c++ - Read an attribute of the base class using "istream" of derived class -

it looks coord(a) doesn't work , , values lon , lat 00.0000 , 00.0000 , default constructor . should do? ia there problem syntax ? isn't in >> coord(a) read lon , lat base class? //base class class coord { private: double lon; double lat; coord() { lon = 00.000000000000000; lat = 00.000000000000000; } //..... //..... //..... friend istream& operator>>(istream& in, coord& temp) { cout << "longitude : "; in >> temp.lon; cout << "latitude : "; in >> temp.lat; return in; } }; //derived class class location : public coord { private: char model[6]; double time; int speed; //..... //..... //..... friend istream& operator>>(istream& in, location& a) { cout << "model : "; in >> a.model; cout << "time : "; in >> a.time; cout << "speed : "; in >> a.speed; cout <<...

mysql - Angular API date not working: timestamp from PHP backend needs to be refactored? -

i having no luck using angular's date api. else no longer working on app wrote backend in php , database mysql.. i think original timestamp that's being used on backend perhaps "not play nice" angular's date api , wondering if showing suggest that, perhaps, "yes!" indeed way storing date , time in our backend , db what's causing angular not display date format want. i did search in php code , found following , wondering if should change timestamp.. or have wrong approach this? /applications/mamp/htdocs/myapp/myapp.sql: 140 `car_id` int(11) not null, 141 `company_id` int(11) not null, 142: `driver_departing_time` timestamp not null default '0000-00-00 00:00:00', 143 `driver_arrival_time` timestamp not null default '0000-00-00 00:00:00', 144 `departing_date` timestamp not null default '0000-00-00 00:00:00', the way store dates in database should not matter. important way in applicati...

R: How to multiply list elements by a vector? -

i want multiply list of matrices (with 1 row), this: lst <- list("111.2012"=matrix(c(1, 0, 6, na, 1, 0), nrow = 1, byrow = t), "112.2012"=matrix(c(6, 2, 2, 0, 3, na), nrow = 1, byrow = t)) with vector (with same length each matrix): vec <- c(1,2,3,1,2,3) and expect result: $`111.2012` [,1] [,2] [,3] [,4] [,5] [,6] [1,] 1 0 18 na 2 0 $`112.2012` [,1] [,2] [,3] [,4] [,5] [,6] [1,] 6 4 6 0 6 na i tried far this: mapply("*", lst, vec) map("*", lst, vec) which gives 3 times more numbers , wrong ones. thought of using lapply within mapply adress list, didn't know how it. suggestions? thanks i believe looking lapply() , since using list lapply( lst, fun= function(x) x*vec) for more information see this . hope helps! lapply(lst,fun= function(x) x*vec) ## old clunky way lapply(lst, "*" , ve...

Apache FOP the method newInstance(FopFactoryConfig) in the type FopFactory is not applicable for the arguments () -

i getting following error: exception in thread "main" java.lang.error: unresolved compilation problem: method newinstance(fopfactoryconfig) in type fopfactory not applicable arguments () @ fopdemo.fopvass.pdfhandler.createpdffile(pdfhandler.java:42) @ fopdemo.fopvass.testpdf.main(testpdf.java:40) this code: package fopdemo.fopvass; import java.io.bytearrayinputstream; import java.io.bytearrayoutputstream; import java.io.file; import java.io.fileoutputstream; import java.io.ioexception; import java.io.outputstream; import java.net.url; import javax.xml.bind.jaxbcontext; import javax.xml.bind.jaxbexception; import javax.xml.bind.marshaller; import javax.xml.transform.result; import javax.xml.transform.source; import javax.xml.transform.transformer; import javax.xml.transform.transformerconfigurationexception; import javax.xml.transform.transformerexception; import javax.xml.transform.transformerfactory; import javax.xml.transform.transformerfactoryconfi...

UI Router's Resolve and TypeScript -

Image
i'm curious how go using ui router's resolve typescript. .state("signin.notactivated", <ng.ui.istate> { controller: "signinctrl", controlleras: "signin", url: "/notactivated", resolve: { inprogress: function() { return { formdata : null } } } }) in controller, have injected resolve. constructor(public $state : angular.ui.istate, private inprogress) { this.init(); } private init = () => { this.somedata = this.inprogress.formdata; // error } i getting unknown provider error, because typescript trying register service. can done? try injecting this: static $inject = ['$state', 'inprogress']; constructor(public $state : angular.ui.istate, p...

android - PFQueryTableViewController getting possible error -

i have question regarding how 1 intercept error message on pfquerytableviewcontroller . basically, override method in pfquerytableviewcontroller allow me display custom error alerts if there problem executing query. know how perform such behavior. on ios, here's method override: - (void)objectsdidload:(nullable nserror *)error; in implementation, can check if there error , responded you'd like. note: should [super objectsdidload:] if override it. source: parse docs

google maps - PHP function for Reverse Geocoding for street number -

the following code from post working me, returning full address (street number, street name, city, state, zip code, country). there way return street number , name instead of full address? google hasn't been help. <? function getaddress($lat,$lng) { $url = 'http://maps.googleapis.com/maps/api/geocode/json?latlng='.trim($lat).','.trim($lng).'&sensor=false'; $json = @file_get_contents($url); $data=json_decode($json); $status = $data->status; if($status=="ok") { return $data->results[0]->formatted_address; } else { return false; } } $lat= 26.754347; //latitude $lng= 81.001640; //longitude $address= getaddress($lat,$lng); if($address) { echo $address; } else { echo "not found"; } ?> after lot of searching , trial , error managed needed working. if there more efficient way i'd love feedback. <?php function getaddress($lat...

Building 'Pong' with python (codeskulptor) -

i'm trying build arcade game 'pong' in codeskulptor python. need 2 things increase ball velocity 10% when hits paddle get fix color buttons, not working here's link code : http://www.codeskulptor.org/#user41_yjmm4nmju5x5zvk.py # implementation of classic arcade game pong # built by: dejvi zelo import simplegui import random # initialize globals - pos , vel encode vertical info paddles width = 600 height = 400 ball_radius = 20 pad_width = 8 pad_height = 80 half_pad_width = pad_width / 2 half_pad_height = pad_height / 2 left = false right = true score1 = 0 score2 = 0 #paddle position paddle1_pos = height/2 paddle2_pos = height/2 #paddle velocity paddle1_vel = 0 paddle2_vel = 0 # initialize ball_pos , ball_vel new bal in middle of table ball_pos = [width/2 , height/2] ball_vel = [0 , 0] #set color theme color_palette = ['#ff5252','#00bcd4','#536dfe','#8bc34a','#ffc107','#ff9800','#ff4081',...

google maps - android: 'inconvertible types' error on googlemap setup -

there tutorial setup google map on android here: https://gist.github.com/joshdholtz/4522551 i can run in application. but google replace getmapasync() getmap() here new google tutorial: https://developers.google.com/maps/documentation/android-api/start i try convert fragment: public class mfragment extends fragment implements onmapreadycallback { mapview gmapview; googlemap gmap = null; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view view = inflater.inflate(r.layout.m_layout, container, false); gmapview = (mapview) view.findviewbyid(r.id.map); gmapview.getmapasync(this); return view; } @override public void onmapready(googlemap map) { gmap = map; gmap.setmaptype(googlemap.map_type_hybrid); gmap.movecamera(cameraupdatefactory.newlatlngzoom(new latlng(49.39,-124.83), 20)); ...

java - How do I change the encoding of my jar file to manage characters such as "█▓▒ CRIT! ░░╚╡▌▌╞╗░░"? -

edited hey guys. my code using pircbot send irc messages twitch.tv. the messages include characters such '█▓▒ crit! ░░╚╡▌▌╞╗░░' example output code: sendmessage("#twitchraidstwitch", "/me █▓▒ crit! ░░╚╡▌▌╞╗░░"); so these characters displayed '?' in eclipse. didn't work until changed window -> preferences -> text file encoding us-ascii. (though i've learned these characters aren't ascii.) when export project jar , try run in cmd, characters '?'. how got getting work in cmd? thanks! ok got work. i used setencoding("utf-8"); score_under suggested. didn't change didn't hurt either. i launched java -dfile.encoding="utf-8" -jar jarfile.jar , did trick. i figured out utf-8 works on eclipse fails work exported jar

javascript - Code break when I'm trying to use an object methods in jquery mobile -

this class var player = function (name) { this.init(name); } $.extend(player.prototype, { name: '', goals: 0, fouls: 0, holding: 0, games: 0, wins: 0, taken: 0, init: function(name){ this.name = name; this.goals= 0; this.fouls= 0; this.holding= 0; this.games= 0; this.wins= 0; this.taken= 0; }, setgoal: function (num) { this.goals+= num; }, setfouls: function (num) { this.fouls+=num; }, setholding: function (holding) { this.holding = (this.holding * (this.games-1) + holding) / (this.games); }, setgames: function () { this.games+=1; }, setwins: function () { this.wins+=1; }, settaken: function (num) { this.taken+=num; } }); i tryed man...

java - Eclipse Maven Workspace Resolution not seeing Generated Classes -

Image
i have 2 maven projects in eclipse, jar , war. war has dependency on jar, resolved through workspace resolution. the problem jar has generated classes, added jar through build-helper-maven-plugin. these classes aren't being resolved in war project. example: auto-completes class keeps saying can't found. more importantly, when running glassfish through eclipse, class not found these classes. if disable workspace resolution works fine, hope use workspace resolution. ideas? edit: folder structure. maven workspace resolved persistence project in lower image in maven dependencies folder, seeing top , bottom of folder. idk if correct, talking eclipse problems - not "see" generated classes right? to fix it, have add generated sources directory eclipse's build path , should fix problem. right click on project has generated classes->buildpath->conf buildpath in source tab - click add folder select directory build helper generates java fi...

File uploads to another directory other than spcified directory in PHP code -

i have folder struct this: admin-panel -- thesis-scripts -- add_thesis.php uploads and trying upload .docx file uploads directory. here code: $targ_dir = "uploads/"; $targ_file = "../" . $targ_dir . basename($_files["thesisfile"]["name"]); $flagok = 1; $tempfolder = $_files['thesisfile']['tmp_name']; if(move_uploaded_file($tempfolder, urlencode($targ_file))){ echo $targ_file; } however, code above results file upload inside thesis-scripts folder. how can move file uploads folder? help. purposely added ../ in $targ_file because save file path in database. upload_tmp_dir need, change default temporary directory, according documentation here upload_tmp_dir string temporary directory used storing files when doing file upload. must writable whatever user php running as. if not specified php use system's default. if directory specified here not writable, php falls sy...

do windows azure mobile service scripts have transient fault handling -

when access sql table via server scripts sql azure retry logic implemented somewhere following request.execute(); ? yes, underlying code try several times complete operation sql azure on 30 second window.

html - Javascript slider not displaying array? -

here's link page i'm working on: https://www.servicerr.com/partners.php whenever click on different numbers, should update prices below slider. javascript file contains prices: https://www.servicerr.com/js/set_my_price.js what can't figure out why prices won't change , why every number staying highlighted when click 1 of next. about year ago, had working , had re-create it. can't figure out i'm doing wrong time around. appreciated. here links 2 other files javascript files make work: here's html code being used: <div class="product2" style="margin-right:2%"> <div class="title">starter</div> <div class="monthly">partner discount</div> <ul> <div class="servicerr-pricing-packet starter"><span class="original"><span style="font-weight: bold; border-bottom: 0px none; color: rgb(0, 125, 199); font-size: 70px; ...

Using Float is not working in SQL Server 2008 -

i have sql query select exchangerate, totalamt, exchangerate * totalamt totalamtconvert, round(exchangerate * totalaramt, 0) totalamtround dbo.table my results: exchangerate 22450 totalamt 16593.67 totalamtnoround 372527891.5 totalamtround 372527891 i want totalamtround = 372527892 can me? this reason use should not use float. approximate datatype. use decimal or numeric datatypr declare @exchangerate numeric(22, 6) = 22450, @totalamt numeric(22, 6) = 16593.67, @exchangerate1 float = 22450, @totalamt1 float = 16593.67 select numeric_result = round(@exchangerate * @totalamt, 0), --correct float_result = round(@exchangerate1 * @totalamt1, 0), --incorrect converted_numeric_result= round(cast(@exchangerate1 numeric(22, 6)) * cast(@totalamt1 numeric(22, 6)), 0) --correct when select @exchangerate1 * @totalamt1 gives 37252...

C++ OpenGL - Overlay example -

Image
i've opengl application (maze style) need work on possible. problem @ moment following: i've 3 subwindows on main window , working fine. aparently should using 1 subwindow , left side subwindows (smaller ones) should displayed overlay. actual app has following window display: and go this: i've searched internet , far i've found nothing subject. there anywhere can read on how solve this? thank much. you render overlays texture, , render wherever want on screen. gl*framebuffer functions. might this: // create texture render glgentextures(1, &overlay_tex); glbindtexture(gl_texture_2d, overlay_tex); gltexparameteri(gl_texture_2d, gl_texture_wrap_s, gl_repeat); gltexparameteri(gl_texture_2d, gl_texture_wrap_t, gl_repeat); gltexparameteri(gl_texture_2d, gl_texture_min_filter, gl_nearest); gltexparameteri(gl_texture_2d, gl_texture_mag_filter, gl_nearest); // null means reserve texture memory glteximage2d(gl_texture_2d, 0, gl_rgba8, width, heigh...

android - Chrome Custom Tabs throwing an error when chrome is not installed : No Activity found to handle Intent -

chrome custom tabs working fine when chrome installed when chrome not installed throwing error customtabsintent.builder intentbuilder = new customtabsintent.builder(); intentbuilder.setshowtitle(true); customtabactivityhelper.opencustomtab(activityy, intentbuilder.build(), uri.parse(link), new webviewfallback()); logcat error info fatal exception: main process: opensource.itspr.recycler, pid: 13114 android.content.activitynotfoundexception: no activity found handle intent { act=android.intent.action.view dat=http://www.google.com/... pkg=com.android.chrome (has extras) } @ android.app.instrumentation.checkstartactivityresult(instrumentation.java:1889) @ android.app.instrumentation.execstartactivity(instrumentation.java:1579) @ android.app.activity.startactivityforresult(activity.java:3921) @ android.app.activity.startactivityforresult(activity.java:3881) @ android.support.v4.app.fragmentactivity.startactivityforresult(fragmentactivity.jav...

cloud - PaaS provider for Grails application for production use -

i have application developed grails 2.5.1 , need paas provider deploy production use , must got these options : smtp server application needs send emails preferred have access file system not necessary mysql db able deploy php applications in it. easy deploy application's packages on good customer support some adviced jelastic , unfortunately don't have smtp server , , heroku deploying in little bit hard. any recommendations? sheriff it easy add smtp jelastic. need set smpt server is here . also, how use external smtp server in environment - is here . with reference rest of list jelastic provides: access file system ( ftp/ftps , sftp/fish , webdav , dashboard ) mysql db able deploy php applications in it easy deploy application's packages on ( direct , git/svn , bitbucket ) good customer support (you can choose hoster significant criteria here ). have nice day, jelastic support

linux - Qt 5 c++ how to include a file when the path is masked by another path in INCLUDEPATH? -

in application, i'm trying use own build of icu 54.1, on mint 17.2 (which comes icu 52.1). in application's .pri have: includepath += $${pwd}/third_party/icu/source/common \ $${pwd}/third_party/icu/source/i18n \ $${pwd}/third_party/build/icu/$${build_mode}/common libs += -l$${pwd}/third_party/build/icu/$${build_mode}/lib libs += $${pwd}/third_party/build/icu/$${build_mode}/lib/libicudata.so.54.1 libs += $${pwd}/third_party/build/icu/$${build_mode}/lib/libicui18n.so.54.1 libs += $${pwd}/third_party/build/icu/$${build_mode}/lib/libicuuc.so.54.1 in application code, when #include <unicode/regex.h> qt creator tooltip tells me using unicode/regex.h in /usr/include/x86_64-linux-gnu, mint's version, icu 52.1. want use unicode/regex.h icu 54.1 built, in $${pwd}/third_party/icu/source/i18n. is there way set preference of icu path on of mint's includes? best-practice way #include files build of icu? when u...

r - LDA topicmodel, how can I see the terms in the result -

i follow post topic analysis : a gentle introduction topic modeling using r i want view terms, should in ldaout.terms , however, see numbers instead of terms. how view terms? ldaout.terms topic 1 topic 2 topic 3 topic 4 topic 5 topic 6 topic 7 topic 8 topic 9 topic 10 [1,] "38" "85" "4" "79" "29" "43" "13" "81" "70" "39" i find out problem dtm, created dtm dtm <- create_matrix(ss, language="english", removenumbers=true, stemwords=true, weighting=weighttf) problem solved

python - Using dimensionality reduction on matrix -

for supervised learning, matrix size huge result of models agree run it. read pca can reducing dimensionality large extent. below code: def run(command): output = subprocess.check_output(command, shell=true) return output f = open('/users/ya/documents/10percent/vik.txt','r') vocab_temp = f.read().split() f.close() col = len(vocab_temp) print("training column size:") print(col) #dataset = list() row = run('cat '+'/users/ya/documents/10percent/x_true.txt'+" | wc -l").split()[0] print("training row size:") print(row) matrix_tmp = np.zeros((int(row),col), dtype=np.int64) print("train matrix size:") print(matrix_tmp.size) # label_tmp.ndim must equal 1 label_tmp = np.zeros((int(row)), dtype=np.int64) f = open('/users/ya/documents/10percent/x_true.txt','r') count = 0 line in f: line_tmp = line.split() #print(line_tmp) word in line_tmp[0:]: if word not in voca...

javascript - How does for loop index ascend the prototype chain? -

Image
say have object person so var person = { firstname: 'default', lastname: 'default', getfullname: function() { return this.firstname + ' ' + this.lastname; } } i make new object john , set prototype of person var john = { firstname: 'john', lastname: 'doe' } john.__proto__ = person; if console.log john , see tree structure so where see getfullname embedded under __proto__ . here comes surprise for (var prop in john) { console.log(prop) } returns even though getfullname 1 level deep, somehow, loop able find it. now, compare to var obj = {a: 1, b: {c:2, d: 3 }} (var prop in obj) {console.log(prop)} which behaves expect, c , d not automagically found loop so how in former case loop traversed deeper in tree dig embedded properties while in latter did not? the for..in loop iterate own enumerable properties, inherited enumerable properties. why seeing getfullname in loop. but in se...

android - How to avoid execute some piece of code in oncreateview while clicking back button in fragment -

i developing android application , trying implement drawer layout(slider menu) in project. let me explain project, have 1 recyclerview gridview items can able see our home screen. want display drawer layout on top grid items means recyclerview. display profile photo in drawer layout(slider menu) whenever application open after can swipe , usual can able see our grid items. i did have 1 problem. able display drawer layout(slider menu) fine whenever application open after swipe if click 1 gridview item , enter page , if click back, time drawer layout(slider menu) showing should not show while clicking grid items. have given recyclerview , drawer layout(slider menu) in same xml file reason whenever user click button, recyclerview displaying drawer layout(slider menu) actually if use activity not face problem because in activity, if click button not call oncreate method call onrestart method reason oncreate not execute if click button also. in fragment oncreateview executi...

android - CardView animation issue: no initial animation -

there 2 cardview s in recyclerview in framelayout . 1 cardview has android:visibility="gone" setting on it. when tapped, card flips 360 degrees, revealing 'gone' cardview . tapping again flips it, showing initial card. sounds simple now. used objectanimator class this, so: public static void flipview(view viewtoflip, int direction) { objectanimator flipanimator; if (direction == clockwise) { flipanimator = objectanimator.offloat(viewtoflip, "rotationy", 0f, 360f); flipanimator.setduration(3500); flipanimator.start(); } else { flipanimator = objectanimator.offloat(viewtoflip, "rotationy", 360f, 0f); flipanimator.setduration(3500); flipanimator.start(); } } the issue when cardview shows initially , animation does not work, in there no flip. card gets replaced 'gone' card sans animation. on subsequent taps, animation works beautifully. questions are: ...

neural network - python code does not generate any output -

i tried run code in http://sourceforge.net/projects/triangleinequal/files/machine%20learning/nn.py/download it run without error.. not generate output. how can output graph? please help the code not meant produce "output" text. prepares plot never shows it. add end of test_regression : plt.show() and execute test_regression uncommented

java - .getClassLoader().getResourceAsStream(path) caches result -

i load file @ servlet, use .getclassloader().getresourceasstream(path), path in web-inf/classes dir, found after changed path file content, file servlet loads same, don't change, file cached. example code: this method gets same result every time, after change test.key content private string getkey(string param){ string name = "keys/"+param+"/test.key"; inputstream in = xxxservlet.class.getclassloader().getresourceasstream(name); stringbuilder builder = new stringbuilder(); try { bufferedreader reader = new bufferedreader(new inputstreamreader(in)); string line = null; while((line = reader.readline()) != null){ builder.append(line).append("\n"); } } catch (ioexception ignoreexception) { }finally{ try { in.close(); } catch (ioexception e) { e.printstacktrace(); } } string result = builder.tostring(); return result; }...

node.js - exit status 255 : Crashed in liberty java web application in IBM Bluemix -

i'm working on web application using node.js , liberty java runtime in ibm bluemix. i'm using ibm devops service edit code. after creating default website, wanted change layout of webpage. added new html files , css along js in webapp folder click here :this image of project has files i'm facing click here problem while deploying , running website in ibm bluemix.... it understand you're trying accomplish. appears you're running node.js app on liberty runtime. believe node.js , liberty apps need run on own runtimes.

Debugging solr rss DataImportHandler -

i have existing collection, want add rss importer. i've copied gleam example-dih/solr/rss code. the details below, bottom line seems run, says "fetched: 0" (and no documents). there no exceptions in tomcat log. questions: is there way turn debugging on rss importers? can see solr's actual request , response? what cause request succeed, no rows fetched? is there tutorial adding rss dih existing collection? thanks! my solrconfig.xml file contains requesthandler: <requesthandler name="/dataimport" class="org.apache.solr.handler.dataimport.dataimporthandler"> <lst name="defaults"> <str name="config">rss-data-config.xml</str> </lst> </requesthandler> and rss-data-config.xml: <dataconfig> <datasource type="urldatasource" /> <document> <entity name="slashdot" pk="link...

android - how to parse this json formate using Gson lib -

how parse sub array getstring("sub") using gson lib in android. <pre> { "name" : "abc"; "class" : "xyz"; "address" : {[ "add" : "1"; "sub" :["abc"]; ]} } </pre> first of should reduce json correct form: { "name" : "abc", "class" : "xyz", "address" : [ {"add" : "1", "sub" :["abc"]} ] } now, create objects following structure: class foo{ string name; string class; address[] address; } class address{ string add; string[] sub; } and on step can parse json object, calling line: foo foo = new gson().fromjson(json, foo.class);