Posts

Showing posts from February, 2015

java - Android Screen Turns Black -

i looking reason happening. writing image-stitching app android. have decided use opencv4android , had android ndk stuff in order work (i sure somehow causing problem). problem having when code reaches opencv ndk portion of program, screen on android device turns black , logcat stops displaying anything. crashes without telling me of errors @ all. unusual because in .cpp portion of project if there problem, logcat @ least display vague fatal signal 11 , end. because of this, have no idea begin searching solution. beginner when comes android programming, may can overlooked beginner. appreciated! more info on blank screen: android device not frozen, can exit app if try enter app again through multitasking button, takes 5 seconds enter logcat or android studio not frozen edit: after leaving black screen on android device said [app name] wasn't responding, , gave me option either close it, or keep waiting. suspicion line mat img = imread("/storage/emulat

apache - System Configuration of a standalone Hadoop cluster -

i going set standalone hortonworks cluster. needed system configuration process 1tb of data. requirement such as: ram space hard disk space quad-/hex-/octo-core cpus running how ghz cent os version etc., system configuration depends on usecase. disk - assuming 1 replication, 1 tb + 25% processing space if using hive or mapreduce start 16 gig, 4 or 8 core. centos 7.0

javascript - Unhandled rejection Error: Invalid path -

when npm run dev react project, encounters error this: unhandled rejection error: invalid path './dist/' someone told me should try absolute path, error lies there again. unhandled rejection error: invalid path '/path/to/dist/' i confused~ encountered problem? const output = { path: './dist/', filename: 'bundle.js', publicpath: '../' }; i think leading ./ in path might problem. work-around, can try this: path: require("path").resolve("./dist") also, error message, think absolute path you're using isn't working because has leading .

How to populate a bash array with a file's lines -

populating array file should basic, can't work. #!/bin/bash declare -a i=0 cat "file.txt" | while read line; a[$i]="$line" i=$(($i + 1)) done echo "${a[0]}" this prints empty line. file contains lines "foo" , "bar", here's output bash -x: + declare -a + i=0 + cat file.txt + read line + a[$i]=foo + i=1 + read line + a[$i]=bar + i=2 + read line + echo '' i can't readarray builtin working: #!/bin/bash declare -a b cat "file.txt" | readarray b echo "${b[0]}" + declare -a b + cat file.txt + readarray b + echo '' what doing wrong here? this basic bash pitfall: segments of pipeline execute in subshells default, means whatever variables create go out of scope when these subshells terminate (the current shell won't see them). depending on version of b

blender - How does opengl texturing works? -

Image
i have been playing opengl time , found texturing interesting. have cube face selected, can project face 2d image , map color in image 3d model. how work? algorithm involved in this? in software blender can live edit vertices in 2d projection gets automatically mapped 3d model. there options unwrap, cube project, cylinder project etc. i not sure if right place ask such question. asking out of curiosity. texturing mapping of texels (a texture's pixel) onto fragments (a pixel composes image of rendered geometry on screen). texel mapped onto given fragment depends on fragment's texture coordinates. in simplest case coordinates associated geometry per vertex basis , interpolated fragments after geometry projected onto screen , rasterized. coordinates normalized, meaning have values between 0 , 1. 2d texture 1 have 2 coordinates - u , v. 1 of them aligned horizontal axis of texture image, other vertical. when in fragment shader texture sampled via texture sampler c

c# - GetWindowText() function is not executing correctly at all times -

Image
i'm writing small application wish url chrome browse. in order first check if chrome browser open or not use following code: intptr windowtitletextptr = getforegroundwindow(); stringbuilder windowtitletext = new stringbuilder(); getwindowtext(windowtitletextptr, windowtitletext, 256); // problem ... i'm using getwindowtext() function windows title text, i'm facing problem there. if chrome window has no url , new tab have no issues, windowtitletext.tostring() equal new tab - google chrome . however if open webpage, in case url filled url @ line getwindowtext() get: vs32host.exe has stopped working message window asking me what's going on? help! you should allocate memory within stringbuilder instance: stringbuilder windowtitletext = new stringbuilder(); int size = 256; windowtitletext.length = size; // <- memory allocation getwindowtext(windowtitletextptr, windowtitletext, windowtitletext.length); // <- read text

java - Jsoup: Parsing html out of a piece of javascript -

does of know how html out of javascript onmouseover event jsoup? might sound vague, here is code: <table onmouseover="showhoverinfo('', '<a href="somelink"><b>sometext</b>/a><br /> other text <br /> <a href="some other link"><b>some text</b></a>')" and goes on. know, is: how html code out of showhoverinfo() method, using jsoup? all appreciated. you can find onmouseover attribute via .attr() , process obtained string (in example below use regex) parameter value want: import java.util.regex.*; import org.jsoup.jsoup; import org.jsoup.nodes.*; public class jsoupgetattributeexample { public static void main(string[] args) { document doc = jsoup.parse("<html><body><div>example</div>" + "<table id='mytable' onmouseover=\"showhoverinfo('', '<a href=\\\'somelink\\\'>

Not able to get value from select element. (PHP/HTML) -

i'm trying value of drop down menu. drop down menu created after user clicks button with undrafted players . however, when echo selectoptionud , not value. idea what's going on here? <html> <body> <?php if (isset($_post['submitundrafted'])) { $selectoptionud = $_post['filter_ud']; //undrafted selection echo $selectoptionud; }//end of submitundrafted if (isset($_post['undrafted'])) { $menu= "<select name='filter_ud' id='filter_ud'> " . $options . " //i have erased previous code gets value of variable. </select>"; echo $menu; ?> <form action="transfer.php" method="post"> <input type="submit" name="submitundrafted" value="submit" /> <

jquery - Show and hide effect of div element -

i have div should hidden initially. on event (doesn't matter) want div slide up, stay several seconds , slide down again. how achieve this. you can use slideup() , slidedown() , delay() function anim() { $('div') // stop previous animation .stop() // slide div .slideup() // wait 2 seconds .delay(2000) // slide down div .slidedown(); } anim(); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <div style="height:100px;width:100px;background:black"></div> or using settimeout() instead of delay() function anim() { var $div = $('div') // stop previous animation .stop() // slide div .slideup(); // wait 2 seconds settimeout(function() { // slide down div $div.slidedown() }, 2000); } anim(); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.

javascript - Bootstrap Carousel is not showing up on the page -

i trying add bootstrap carousel, when inspect element, dom available not showing up. i using customized bootstrap library downloaded form link: bootstrap custom link what missing in template. this tried: html: <div id="mycarousel" class="carousel slide" data-ride="carousel"> <!-- indicators --> <ol class="carousel-indicators"> <li data-target="#mycarousel" data-slide-to="0" class="active"></li> <li data-target="#mycarousel" data-slide-to="1" class=""></li> <li data-target="#mycarousel" data-slide-to="2" class=""></li> </ol> <div class="carousel-inner" role="listbox"> <div class="item active"> <img class="first-slide" src="data:image/gif;base64,r0lgodlhaqabaiaa

angularjs - Why I get this error with angular and leaflet -

i set in separated files different components, when aggregate search input, error in local: angular.js:13424 error: map container not found. and in plunker: angular.js:13424error: map container initialized. the strange thing map works well. what's wrong? code working demo you have initialized map twice, 1 in basemapcontroller , in inputcontroller . in basemapcontroller , replace _map = basemapservice.mapelement(); with $scope.map = basemapservice.mapelement(); _map=$scope.map; in inputcontroller , replace basemapservice.autocomplete(_searchinputid).bindto('bounds', basemapservice.mapelement()); with basemapservice.autocomplete(_searchinputid).bindto('bounds', $scope.map); hope solve problem. update: in demo, auto-complete works fine not bound map. example if search place, not find place on map. have resolve error have mentioned. for auto-complete, have used google api , basemap , have used leaflet . my suggestion i

javascript - Proper "Angular" way to pass behavior to directive? -

when looking information regarding angular directives , passing behavior directives, ended being pointed in direction of method binding on isolate scope, i.e. scope: { something: '&' } the documentation functionality bit confusing, , don't think it'll end doing want. i ended coming snippet (simplified brevity), works passing scope function in homectrl , , directive it's work , calls function. (just incase matters, real code passes promise directive). angular.module('app', []); angular.module('app') .directive('passingfunction', function() { var changefn, bump = function() { console.log('bump() called'); internalvalue++; (changefn || function.prototype)(internalvalue); }, internalvalue = 42; return { template: '<button ng-click="bump()">click me!</button>', scope: { onc

javascript - Ajax wait till redirect to finish executing. -

i have same problem 1 described in link below, dont find solution clear. want ajax success function wait until window function finished executing, modify divs. instead, modifies divs of current page, redirects. ajax: on success redirect modify new page main.js $("#form").submit( function(e) { e.preventdefault(); var id = $('#searchbar').val(); // store form's data. $.ajax({ url: '/search', type: 'post', data: {id:id}, datatype: 'text', success: function(data) { //redirect page want display data window.location.href = '/test'; data = json.parse(data); console.log(data); $("#count").text("we analyzed..."); $("#result1").text(data.county); $("#totals").text("with score of.

function - How to use nested loop using recursion and check the sum of digits in c++ -

i want calculate number of occurence of particular sum of digits in k digit number. code long recur(long k, long n) { long count = 0; if(k == 0) { return 0; } for(long = 1; <= 9 ; i++) { long c = + recur(k - 1, n); if(c == n) { count++; } } return count; } /* k number of digits , n sum of digits want find. example, if k 3, can have numbers 111 999 sum of digits varies 1+1+1=3 9+9+9=27. if want find number of k=3 digit numbers sum(n)=4, answer 3. because 112,121 , 211 possible solutions.*/ it not giving me correct answer.the output 1. appreciated. try out long recur(long k, long n) { if(k==0) return n==0; long count=0; for(long i=1; i<=9; ++i) { count += recur(k - 1, n - i); } return count; }

WIX heat for registering COM with 64 bit -

i using following line generate wxs file registered com "c:\program files (x86)\wix toolset v3.10\bin\heat.exe" dir "$(solutiondir)output" -dr installfolder -cg sapfilescomp -gg -g1 -sf -srd -var "var.outputfolder" -out "$(projectdir)\sapheatfiles.wxs" it works fine, whenever use regasm 32 bit whenever try register using regasm (64bit), got following error: the typelib element non-advertised , therefore requires parent file element. attached generated wxs file both cases ( i noticed in first case "typelib" element nested in "file" element, while sibling in second case ): 32 bit <component id="cmp876eabd23bd0b870aa62fa8f8e0fe6b8" directory="installfolder" guid="92abc2c9-fcbc-403c-bdef-26fbd3f7246a"> <file id="fil45cfd89b1f7c95d68ea24cfd60ba3404" keypath="yes" source="$(var.outputfolder)\sap2000plugin_mali_curveloadv18.tlb">

java - Is it possible to send an hashmap with the Postman Chrome extension? -

i've been using postman chrome extension test out api , send hashmap via post. there way send map parameter in postman? hashmap inputhm = new hashmap(); inputhm.put("mvmt", "vl"); inputhm.put("no", 1); inputhm.put("fe", "e"); inputhm.put("ct", "20"); inputhm.put("ht", "80"); inputhm.put("type", "gp"); inputhm.put("opr_cd", "maeu"); inputhm.put("location", "bert"); inputhm.put("tmnl", "1"); inputhm.put("incl", ""); inputhm.put("id", 1); my controller follows @requestmapping(value = "/getbest", method = req

javascript - Search is not working in table in js -

i having table. want filter values of table based on input values. table not filtering. use onkeyup function filter. jsfiddle link below. function filtertable() { var q = document.getelementbyid("tabfilter"); var v = q.value.tolowercase(); var rows = document.getelementsbytagname("tr"); var on = 0; ( var = 0; < rows.length; i++ ) { var fullname = rows[i].getelementsbytagname("td"); fullname = fullname[0].innerhtml.tolowercase(); if ( fullname ) { if ( v.length == 0 || (v.length < 3 && fullname.indexof(v) == 0) || (v.length >= 3 && fullname.indexof(v) > -1 ) ) { rows[i].style.display = ""; on++; } else { rows[i].style.display = "none"; } } } var n = document.getelementbyid("noresults"); if ( on == 0 && n ) { n.style.display = "&

html - Remove WhiteSapce margin from responsive Page which is coming only on Safari not on Chorme , firefox -

i have developed responsive page of @media query . when check page on iphone 6+ there unwanted white space margin coming . but page working fine on chorme , firefox browser (developer mode also). is there css hack safari can remove unwanted whitespace margin page . i have used below code in responsive css when happens me able fix removing stylesheet *{ padding: 0 } another thing webkit stylesheet contains following 'margin' ,'padding' properties -webkit-margin-before: -webkit-margin-end: -webkit-margin-after: -webkit-margin-start: -webkit-padding-before: -webkit-padding-end: -webkit-padding-after: -webkit-padding-start: you can use , customize accordingly safari

css - Javascript: Drawing rectangle on canvas doesn't work on IE -

i have web application can draw rectangle on canvas. use 2 canvas elements: 1 preview while drawing , 1 laying under other 1 drawing it. the problem have in internet explorer, canvas2.width = canvas2.width doesn't clear content of canvas2, necessary because every mousemove rectangle gets drawn again. tried context2.clearrect(0,0,canvas2.width,canvas2.height) , but, however, preview rectangle doesn't drawn @ all. try out on http://jsfiddle.net/y389a/2/ html: <canvas id="canvas" width="600" height="400"></canvas> <canvas id="canvas2" width="600" height="400" onmouseup="return drawline()" onmousedown="return startline()"></canvas> css: #canvas, #canvas2 { position:absolute; left:0px; top:0px; border-width:1px; border-style:solid; border-color:#666666; cursor:default !important; } javascript: var x; var xstart; var y; var ystart; var

c - Read till end of file into array -

i've been trying figure i'm going wrong can't seem point out error exactly. i'm trying read text file, these integers 5 2 4 9 10 1 8 13 12 6 3 7 11 into array a. make sure works, trying print getting large random numbers instead. can me see i'm going wrong please? int main(){ file* in = fopen("input.txt","r"); int a[100]; while(!feof(in)){ fscanf(in, "%s", &a); printf("%d", a) } fclose(in); return 0; } *this main parts of code related question for read why using feof wrong, solution similar following. code open filename given first argument program (or read stdin default): #include <stdio.h> enum { maxi = 100 }; int main (int argc, char **argv) { int = 0, a[maxi] = {0}; /* initialize variables */ /* read file specified argument 1 (or stdin, default) */ file *in = argc > 1 ? fopen (argv[1],"r") : stdin; if (!in) { /* validate file opened re

c# - 3D project shape to 2D -

Image
in demo project i'm creating objects in 3d , display axis coordinate system. i want plot 3 different frontal views (frontal view, top view, side view) of 3d object surfaces axis spread out. currently i'm able plot bounding boxes, want plot contour. i have drawn it red pen bounding box, can see mean :) an easy way render using same view , projection matrix, apply shadow matrix. scale of 0 plane wish render onto translation plane place in world space want. eg: render onto z = 4.0 matrix3d = 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 4, 0, 0, 0, 1 i think that's right way around wpf you'd use system.windows.media.media3d.matrix3d functions make it.

firefox - How to create a hyperlink which will download the file in FF, Chrome -

i wanna create link , on click start downloading file. when putting file path working on chrome, android, on ie no on ios, firefox. any ideas why? here have done <a target="_blank" href="<?php $shortvideolink = get_post_meta( get_the_id(), 'music_record_link', true );if ( ! empty( $shortvideolink ) ) {echo $shortvideolink;} ?>" class="downdloadbtnlink">

How to set a block variable in excel vba -

i getting run-time error: 91 "object variable or block variable not set here code, don't did wrong with sheet1 lastrowcell = range("b" & rows.count).end(xlup).row pr_high = 14 n = pr_high lastrowcell max = worksheetfunction.max(range(cells(n - pr_high_1, 6), cells(n, 6))) if max > 0 rownum = .columns(6).find(what:=max, after:=.cells(n - period_high, 6), lookin:=xlformulas, lookat:=xlwhole, searchorder:=xlbyrows, searchdirection:=xlnext, matchcase:=false).row '>>>>at above line i'm getting error. range(cells(n - pr_high_1, 8)).formula = "=count(" & range(cells(n - pr_high_1, 6), cells(rownum, 6)).address(false, false) & ")" end if next thanks in advance. edited after op's full code posting i think found 2 incorrect lines in function calculate_high_low , namely 1) in "count maximum high" block rownum = .columns(6).find(what:=max, after:=.cells(n - period_high

elasticsearch - Java.lang.NullPointerException: Cannot get property ‘x’ on null object - when running a groovy script -

i run groovy script through transport client: script looks this: if (ctx._source.field.names == null) ctx._source.field.names=newitems else ctx._source.field.names<< newitems; ctx._source.field.names = ctx._source.field.names.flatten().unique() my problem of times works following error: caused by: java.lang.illegalargumentexception: failed execute script @ org.elasticsearch.action.update.updatehelper.executescript(updatehelper.java:256) ~[org.elasticsearch.elasticsearch-2.0.1.jar:2.0.1] @ org.elasticsearch.action.update.updatehelper.prepare(updatehelper.java:196) ~[org.elasticsearch.elasticsearch-2.0.1.jar:2.0.1] @ org.elasticsearch.action.update.updatehelper.prepare(updatehelper.java:79) ~[org.elasticsearch.elasticsearch-2.0.1.jar:2.0.1] @ org.elasticsearch.action.update.transportupdateaction.shardoperation(transportupdateaction.java:170) ~[org.elasticsearch.elasticsearch-2.0 @ org.elasticsearch.action.update.transportupdateaction$3$1.doru

c# - UWP roamingdata Does not async -

i make uwp app share data between windows 10 pc , windows 10 mobile phone.next code: public static storagefolder roamingfolder = applicationdata.current.roamingfolder; public async static task writetoroamingdataasync(string str) { storagefile savedfile = await roamingfolder.createfileasync("datafile", creationcollisionoption.replaceexisting); await fileio.writetextasync(savedfile, str); } public async static task<string> readroamingdataasync() { try { storagefile savedfile = await roamingfolder.getfileasync("datafile"); return await fileio.readtextasync(savedfile); } catch { return "-1"; } } i changed data in pc(input string "here data"), , can read in pc.but when deployed on phone, can't read data had written on pc,it give me "-1",i waited 2 hours,the mobile app gives me "-1". i

addView dynamically can not get measuredHeight in android -

i try encapulate custom listview head , footer.here description of problem. <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <com.example.pj.news_demo.widget.wrapperview android:id="@+id/fragment_msg_wrapper_view" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/holo_blue_bright" > <android.support.v7.widget.recyclerview android:id="@+id/msg_list" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ff34ff" android:paddingleft="10dp" android:paddingright="10dp" /> </com.example.pj.news_demo.widget.wrapperview> code above ui,wrapperview can treated c

javascript - how can i submit a form without refersh in node.js and ejs? -

<form action="" method="post"> <div class="bottom_wrapper clearfix"> <div class="message_input_wrapper" id="eventform"> <input class="message_input" name="msg" placeholder="type message here..." /> </div> <input type="submit" name="submit"> <div> </form> <script> $('#eventform').submit(function (e) { e.preventdefault(); var fd = new formdata($(this)[0]); $.ajax({ url: '/messages/'<%= id %>, data: fd, processdata: false, contenttype: false, type: 'post', success: function(data){

Integrating PHP into Javascript to display map markers with Google API -

i getting 1 map marker display not multiple markers. however data displays in html log. think missing loop or did not use current loop correctly. anyone clarify make day. thank you. herewith code: <?php get_header(); ?> <!-- row main content area --> <div class="small-12 large-12 columns" id="content" role="main"> <h1 class="entry-title">find store</h1> <script type="text/javascript"> var map; function initmap() { map = new google.maps.map(document.getelementbyid('map'), { center: {lat: -28.5758488, lng: 25.1128267}, zoom: 5 }); setmarkers(map); } ; </script> <div id="map"></div> <?php $args = array('post_type' => 'store', array("output" => "raw"), 'posts_per_page' => 50

javascript - Fetching the column id in a table using jQuery -

i have table structure. <table id = "table1"> <thead> <tr id = "header_row"> <th> <a id = "a1">abc</a> </th> <th> <a id = "a2">def</a> </th> <th> <a id = "a3">ghi</a> </th> <th> <a id = "a4">jkl</a> </th> </tr> </thead> <tr>.....data filling table.....</tr> <tr>.............</tr> . . </table> so table, want fetch value "a2", can please tell me how this? thanks! edit: there many other <a> <table> tags on page, if there way extract using id? so table, want fetch value "a2" you mean fetch id of second column in header row? try this $("#header_row th a:eq(1)").attr("id") if wants fetch abc of know a based on id then $("

java - vertx ssl handshake failure while connecting to https url using vertx HttpClient -

when trying connect https url... getting ssl handshaking failure... using vertx-version >>2.1.5 please me resolve this... stuck here important me code working fine, giving me proper response.. url url = new url("https://bugzilla.mozilla.org/rest/bug/707428/comment"); httpurlconnection conn = (httpurlconnection) url.openconnection(); conn.setdooutput(true); conn.setrequestmethod("get"); conn.setrequestproperty("accept", "application/json"); inputstream is=conn.getinputstream(); inputstreamreader isr=new inputstreamreader(is); bufferedreader br=new bufferedreader(isr); string str=null; while((str=br.readline())!=null){ system.out.println(str); } conn.disconnect(); but while using vertx. giving hand shaking problem httpclient client = myserver.defaultvertx.createhttpclient().setssl(true).settrustall(true) .sethost("bugzilla.mozilla.org").setpo

c# - Allotted timeout while logging System.Net on Trace level -

i'm having issue program. i've created service logging actions nlog. next service i've created tool catch logging , show user. connection based on wsdualhttpbinding. besides actions of service, i'm logging [system.net], [system.servicemodel] , [system.windows] complete log report. now i'm getting timeoutexception: message not transferred within allotted timeout of 00:01:00. there nog space available in reliable channel's transfer window. etc... i've found out exception thrown when loglevel system.net.* set trace. otherwise exception won't thrown. i've tried multiple solutions increasing timeout; setting defaultconnectionlimit; setting servicebehaviorattribute , many more. none of them worked me... could me this? consoleapplication service: class program { static void main(string[] args) { ioc.kernel.bind<ilogging>().toconstant(new logging()); try { //normal binding var

windows - vb.net creating an application that can be called by arguments -

i'm creating addin application autodesk inventor. addin has purpose have designtools increase productivity. (this tool in particular perform copy design info.) i have written tool in standalone application , worked, added autodesk inventor addin , didn't work anymore. so searched around bit , found should keep standalone application , call addin. this call addin i'm doing think, there bunch of methods on msdn page but, guess need sub openwitharguments() ' url's not considered documents. can opened ' passing them arguments. process.start("iexplore.exe", "www.northwindtraders.com") ' start web page using browser associated .html , .asp files. process.start("iexplore.exe", "c:\mypath\myfile.htm") process.start("iexplore.exe", "c:\mypath\myfile.asp") end sub 'openwitharguments but how create copydesign.exe can accept arguments when call it? you hav