Posts

Showing posts from March, 2013

c++ using an array without calling constructor -

my task create template type array without calling t (template) constructor. after want move value array std::move. how can in c++? here code: void *temp = malloc((end-begin) * sizeof(t)); (unsigned int = begin; < end; ++i){ temp[i] = std::move(array[i]); } but isn't work. compiler says following: subscript of pointer incomplete type 'void'. an array of void makes no sense. void incomplete type (and has no size), temp[i] generates error you're seeing. to achieve want do, why not use std::vector , , push items become available ? std::vector<t> temp; (unsigned int = begin; < end; ++i){ temp.push_back(std::move(array[i])); }

Spring SecurityConfiguration -

i'm having problem code... when run application goes login page instead of going index page security config protected void configure(httpsecurity http) throws exception { http.authorizerequests().antmatchers("/index").permitall() .antmatchers("/login").permitall() .antmatchers("/admin/**").hasrole("admin") .antmatchers("/user/**").hasrole("user") .antmatchers("/dba/**").hasrole("dba").and().formlogin().loginpage("/login") .loginprocessingurl("/login").usernameparameter("email").passwordparameter("password").and() .rememberme().remembermeparameter("remember-me").tokenrepository(tokenrepository) .tokenvalidityseconds(86400).and().csrf().and().exceptionhandling().accessdeniedpage("/access_denied"); } i have index file when put adress have 404... don&

how to monitor JVM on cloud applications -

we using cloud applications spark jre1.8 want know jvm of spark instance , same need monitored using nagios core server. can please share inputs view jvm stats. noticed, jstat command used know jvm unfortunately jstat not working on jre. you might want check "metrics" section here also source configuration in metrics.properties using monitor jvm metrics in emr spark. sink configuratuion dependent whether want push metrics graphite or use plain jmx instance. point on can use favorite jmx client or jolokia make metrics available via http. aware there may more 1 jvm running on each of servers (one each executors, maybe hdfs or whatever else deploy). # enable jvm source instance master, worker, driver master.source.jvm.class=org.apache.spark.metrics.source.jvmsource worker.source.jvm.class=org.apache.spark.metrics.source.jvmsource driver.source.jvm.class=org.apache.spark.metrics.source.jvmsource

javascript - JavescriptInterface and thread not returning to main thread -

i'm developing app android , of content displayed via webview. i have interface javascript this. webappinterface(context c, response response) { activity = (activity) c; delegate = response; context = c; } /** show toast web page */ @javascriptinterface public void getresponse(final string operation, final string response, final string type) { final handler mainhandler = new handler(context.getmainlooper()); mainhandler.post(new runnable() { @override public void run() { delegate.didgetresponse(operation, response, type); log.d("success: ", "im still here"); <-- why not in main thread? } }); } public interface response { public void didgetresponse(string operation, string response, string type); } my activity implements didgetresponse , have switch executes code , update webview if needed on f

extjs - How to come out of the inserting row in grid row insert -

im trying insert record in grid using validation , on meeting gets inserted, want when validation fails, want dirty deleted, not reload store.. i'm trying this.. (a part) ext.each(gridrows, function(gridrow) { if (gridrow.dirty) { if ((dirtind !== 0 && (ext.date.diff(new date(prevocc), modifiedocctime, ext.date.second) < 0)) { isincorrectpos = true; }; } else if (isincorrectpos) { ext.messagebox.confirm('delete', 'are sure ?', function(btn) { if (btn === 'yes') { ext.each(gridrows, function(gridrow) { gridrowsdirty.pop(gridrow.data); grid.store.load(); //me.el.unmask(); }); } }); unmask() keeps row dirty is, waits user modify correct record , add, want come of row in didnt try add row, not reload grid. how can able achieve this?

php - print_r($_FILES); output is blank Array ( ) **.It means there is no file uploaded but i have uploaded the file -

i trying upload image code upload image given below : if (!isset($_post['submit'])) { if (isset($_files['imageupload'])) { // image upload $target_dir = "c:/wamp64/www/images/"; $target_file = $target_dir . basename($_files["imageupload"]["name"]); echo 'your tmp location of img file ' . $_files['imageupload']['tmp_name'] . '<br>'; $imagetmp = addslashes(file_get_contents($_files['imageupload']['tmp_name'])); if (isset($_files['imageupload'])) { if (move_uploaded_file($_files["imageupload"]["tmp_name"], $target_file)) { echo "the file " . basename($_files["imageupload"]["name"]) . " has been uploaded."; } else { echo "sorry, there error uploading file."; } } $image

hadoop - Hive Editor - Not working in HUE -

when running hive query in hive editor - getting timed out error, query running fine in command line interface. also hue home - potential misconfiguration detected. hive editor application won't work without running hiveserver 2. all hive services running.

PHP: Rearranging digits in an integer number -

i have numerous 15 digit numbers. need rearrange digits in each number based on set order hide composite identifiers. exaample: convert 123456789123456 223134897616545 the method thinking of : 1) extract each digit using $array = str_split($int) 2) create new array required order $array above but here stuck. how combine digits of array single integer? efficient way this? also need know order in shuffled retrieve original number. implode array , cast int. (int) impode('',$array)

Animating one component in an array of components in Angular4 -

i new angular , trying animate flip on single component(card) in array of components in angular. i have 10 cards in array, , want clicked card flip around. far have code when of cards clicked, flip around. clicked card flip. here card component: @component({ selector: 'app-card', templateurl: './card.component.html', styleurls: ['./card.component.scss'], changedetection: changedetectionstrategy.onpush, animations: [ trigger('flipstate', [ state('active', style({ transform: 'rotatey(179.9deg)' })), state('inactive', style({ transform: 'rotatey(0)' })), transition('active => inactive', animate('500ms ease-out')), transition('inactive => active', animate('500ms ease-in')) ]) ] }) export class cardcomponent { @input() data: person[]; flip: string = 'inactive'; toggleflip() { this.flip =

ios - How to remove the Xcode warning Apple Mach-O Linker Warning 'Pointer not aligned at address -

Image
i have slight issue when build xcode project, tones of warning after update pod. looks this already search whole site here still no luck. doesn't affect project quite annoying. help? it means binary file has non-aligned pointer when compile code. in cases alignment defaults 1 byte , hypothetically might impact performance. after updating xcode 8.3 public release still seeing error, google might need compile static library different settings make go away.

c# - Why Main() method is called on service start? -

i have application 1 main class overrides servicebase methods , has main() static method. want use main() method when called command line, , onstart()/onstop() when called windows service management. i installed app service installutils when start main() method called instead of onstart() expected. using system; using system.collections.generic; using system.io; using system.linq; using system.net; using system.text; using system.threading.tasks; using system.timers; using system.xml.serialization; using system.runtime.serialization.json; using system.threading; using system.serviceprocess; using system.configuration.install; using system.reflection; namespace test { class program : servicebase { static void main(string[] args) { log.error("run app"); } protected override void onstart(string[] args) { log.info("starting service"); } protected override void onstop(

python - Algorithm to unwrap recursive list of lists -

problem say have list l of elements. elements can either literals (strings) and/or lists l', l'',... list l' can contain either literals and/or lists. unwrap them such list of literal combinations. combination looks easier show explain; refer following examples. a basic example: l = [a,[b,c],d] solution: s = [[a,b,d],[a,c,d]] the solution combination of elements of l. second element list, wish create combination each element of list separately. more advanced example: l = [ a, [b,c], [d,[e]] ] solution: s = [ [a,b,d], [a,c,d], [a,b,e], [a,c,e] ] i loop on elements each sublist create new combination. in third element (list [d,[e]] ), second element yet list. contains 1 element e, when loop on it return 1 element. complex example: l = [ [a,b], [ [c,d], [e,[f,g]] ] ] solving subproblem, namely big list in second element: s' = [ [c,e,f], [c,e,g], [d,e,f], [d,e,g] ] the partially solved problem becomes: l' = [ [a,b], [ [c,e,f],

javascript - Sorting country list alphabeticaly -

this question has answer here: easiest way sort dom nodes? 7 answers i coded following list based on countries 2 letter code now boss whats country names in alphetical order. i'm start manually love know if there easy/quick way based on have already. <div class="dropdown"> <button class="btn btn-primary dropdown-toggle" type="button" data-toggle="dropdown">country list <span class="caret"></span></button> <ul style="height: 450px; overflow: auto;" class="dropdown-menu"> <li><a href="#" onclick="showdiv('ad')">andorra</a></li> <li><a href="#" onclick="showdiv('ag')">antigua , barbuda</a></li> <li><a href="#" onclick="showdiv(&

css - What are the differences between auto and 100%? -

what differences between these 2 styles : .styleone { height: auto; } .styletwo { height: 100%; } with "height: auto" height of element depend on content in it. height of 100% make te element high parent. note if height of element 100% , parent has fixed height position of parent not relative, element high html element.

ios - Resuable UIPickerView with delegate method -

i want have reusable uipickerview populated json object coming internet. problem how use picker , values picker in different controllers? appreciated. for generalize picker single class there library this. you can use actionsheetpicker requirement. this best maintain library picker. example code objective-c: // inside ibaction method: // create array of strings want show in picker: nsarray *colors = [nsarray arraywithobjects:@"red", @"green", @"blue", @"orange", nil]; [actionsheetstringpicker showpickerwithtitle:@"select color" rows:colors initialselection:0 doneblock:^(actionsheetstringpicker *picker, nsinteger selectedindex, id selectedvalue) { nslog(@"picker: %@, index: %@, value: %@", picker, selectedindex, selectedvalue)

javascript - Bootstrap 3 button dropdown displays list items -

Image
i'm trying implement bootstrap button dropdown . followed directions docs: <div class="btn-group"> <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">action <span class="caret"></span></button> <ul class="dropdown-menu"> <li><a href="#">action</a></li> <li><a href="#">another action</a></li> <li><a href="#">something else here</a></li> <li role="separator" class="divider"></li> <li><a href="#">separated link</a></li> </ul> </div> the dropdown displays list items on page: any ideas i'm doing wrong? working fine when include boostrap files, may missed css <!do

c++ - OpenCL could not found Intel HD 4000 -

i'll warn in advance written english not good, please have patience because i'll lot of errors. need expose graphic card in order benchmark parallel algorithms on finite element analysis. downloaded intel sdk @ link https://software.intel.com/en-us/intel-opencl . using ubuntu 16.10, followed instruction explained in post https://streamcomputing.eu/blog/2011-06-24/install-opencl-on-debianubuntu-orderly/ . when run simple algorithm wich checks device, recognizes cpu, failing find graphic card. same program works on mac (because opencl in stack of course). // includes... int main(int argc, const char * argv[]) { // see standard opencl sees std::vector<cl::platform> platforms; // platform cl::platform::get(&platforms); // temp std::string s; // gpu lies cl::device gpudevice; // found gpu bool gpufound = false; std::cout << "**** opencl ****" << std::endl; // see if have gpu (auto p : platforms) { std::vector<cl::device&g

browser.runtime.connect api not working as expected with Firefox for android? -

i developing extension firefox android, since tabs apis not supported on firefox(android), using following code. working fine on firefox when porting firefox android(52 version), background script messages not being passed content script listener. //content script code var myport = browser.runtime.connect({name:"port-from-cs"}); myport.postmessage({greeting: "hello content script"}); myport.onmessage.addlistener(function(m) { console.log("in content script, received message background script: "); console.log(m.greeting); }); // background script var portfromcs; function connected(p) { portfromcs = p; portfromcs.postmessage({greeting: "hi there content script!"}); portfromcs.onmessage.addlistener(function(m) { console.log("in background script, received message content script") console.log(m.greeting); portfromcs.postmessage({greeting: "hi there content script!"}); }); } browser.runtime.on

In JQuery, how to make an action when choosing an input with a mouse click? -

Image
as can see below, there history addresses chan choose in formular, when choose 1 , press "enter" color adapt (become green if it's mail address, or stay red if not). did using piece of code (jquery): $( "#mail" ).keyup(function() { if(!validateemail($("#mail").val())) { $("div.mail").removeclass("has-success"); $("div.mail").addclass("has-error"); } else{ $("div.mail").removeclass("has-error"); $("div.mail").addclass("has-success"); } }); but problem if click "history" email address mouse instead of pressing "enter", nothing happens (even if choose mail address). tried other jquery functions .mouseup() or .click() still not work. do have idea ? try this: $('#selector').focus(function(){ // code here }); focus event fires when element focus either mouse selectio

c# - Handling JSONP response in windows application -

i have asp.net web api 2 project that's been set return jsonp (using asp.net web api contrib repo github ( https://github.com/webapicontrib )), looks fine , dandy in web application when consuming api via jquery. however, there's windows application needs access same data, i'm quite @ loss on how process response in c# class. i have code, worked nicely (using json.net) when api returned plain json: public list<dropitem> getavailabledomains() { string jsondata = null; using (webclient wc = new webclient()) { jsondata = wc.downloadstring("http://foo.bar/api/core/getavailabledomains"); } return jsonconvert.deserializeobject<list<dropitem>>(jsondata); } however, using jsonp doesn't recognize response data due overhead stuff callback functions etc in response. is there way of handling this? this did trick public static void registerformatters(mediatypefo

angularjs - I want to filter the JSON data based on checkbox clicked but it is working only when more than one checkbox is clicked -

<!doctype html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script> <script> var myapp = angular.module('myapp', []); myapp.controller('checkboxcontroller', function ($scope) { //json data filtered based on last 4 properties $scope.patients=[{ "id": 160, "email": "test.lnt.hillrom+stephenmurphy904@gmail.com", "firstname": "stephen", "lastname": "murphy", "isdeleted": false, "zipcode": 55110, "address": "39 xswhss lane ", "city": "white bear lake", "dob": "12/21/1947", "gender": "male", "title": null, "hillromid": "46399", "langkey": null,

nlp - Arabic text not showing in R- -

Image
just started working r in arabic plan text analysis , text mining hadith corpus. have been reading threads related question nevertheless, still can't manage real basics here (sorry, absolute beginner). so, entered: textarabic.v <- scan("data/arabic-text.txt", encoding="utf-8", what= "character",sep="\n") and comes out textarabic.v of course, symbols (pic). prior this, saved text in utf-8 read in thread still nothing shows in arabic. i can type in arabic r scan brings text in symbols. also read , tried implement other user's codes make arabic text function don't know how , implement them. added r, tm , nlp packages. what suggest me next? in advance, i posted answer saying must using r on windows before saw comment you're on osx. on osx situation not quite dire. problem you're using old version of r. if right remember, prior 3.2 not handle unicode correctly. try installing 3.3.3 https://cran.r-projec

c# - Disable calendar dates between to dates in Sharepoint -

i making booking application in sharepoint , want disable dates on calendar booked. have started , got stuck here. datetime datestart = datetime.parse(radsp["startdatum"].tostring()); datetime dateend = datetime.parse(radsp["startdatum"].tostring()); while (datestart < dateend) { calendar2.selecteddate = datestart; calendar2.selecteddate.day.isselectable = false; datestart.adddays(1); e.day.isselectable = false; //dont have acces on "e" e.cell.forecolor = system.drawing.color.gray; //dont have acces on "e" } my dates stored in list in sharepoint

How to display capture screenshot into report using Python + Webdriver + nose & xunit -

how display capture screenshot report using python + webdriver + nose & xunit ? python script: import unittest selenium import webdriver selenium.webdriver.common.keys import keys class googletest(unittest.testcase): def test_google(self): self.driver = webdriver.firefox() self.driver.get("http://www.google.com") assert false, "desperately failing capture screenshot" def teardown(self): self.driver.save_screenshot("/tmp/screenshot.png") print ("/tmp/screenshot.png") self.driver.quit() unittest.testcase.teardown(self) and please find report.xml <?xml version="1.0" encoding="utf-8"?><testsuite name="nosetests" tests="1" errors="0" failures="1" skip="0"><testcase classname="sample.googletest" name="test_google" time="4.921"><failure type=&quo

Importing a project in IntelliJ -

hi iam facing issue while cloning project git. issue: while cloning project using option 'check out version control-->github' , giving git url , directory names. project1 getting option. project1: "would create idea project sources have checked out d:\users\myname\pardirname\dirname?" project2: project2 getting below option "you have checked out idea project file: d:\users\myname\pardirname\dirname\build.sbt open it?" for project2 select option option 'use auto import' if select import dependencies itself. but project1 don't see 'use auto import' option, see options 'create project existing sources' or 'import project existing model'. what issue project1, can 1 please assist me ? project2 sources include idea project configuration files, saved in .idea subfolder in project root. when check out, idea detects folder , acts accordingly. seems there no .idea folder in project1, sources, idea offe

php - How to preview and delete images in Krajee bootstrap? -

here setting of initialize file input. have done upload file want edit cant preview images in container of krajee bootstrap input. please if know give full code delete , preview. $("#userfiles").fileinput({ 'dropzoneenabled': true, 'maxfilecount': totalcount, 'showupload': false, 'browselabel': "click here or drag & drop images here", 'browseicon': "<i class=\"glyphicon glyphicon-picture\"></i> ", 'validateinitialcount': true, 'allowedfileextensions': ["jpg", "png", "gif", "jpeg"], 'showcaption': true, 'showpreview': true, 'showremove': true }); //this ajax images database $.ajax({ type: "post", url: site_url+'posting/getpicdata', data: {pid: ur

Javascript, saving values from onclick and saving previous values in arrays -

i'm trying save values retrieved "onclick" , save values retrieved "onclick" in different arrays when buttons clicked. but seems when "for loop" used, newly retrieved values overwrite retrieved data though values saved separately in different arrays. i'm confused right now, know why? (if hit button "refresh", can see current values saved.) var firstvalue = []; var prevalue = []; function returned(a){ prevalue = firstvalue; console.log("returned! prevalue: "+prevalue); (var = 0; < 1; i++) { firstvalue[i] = a; console.log("returned! firstvalue: "+firstvalue); } } function refresh1(){ console.log("prevalue: "+prevalue); console.log("firstvalue: "+firstvalue); } <!doctype html> <html> <head> <script src="jstest.js"></script> </head> <body id="thebody">

c# - asp:Content still visible when using Visible="False" -

i have master page couple contentplaceholder inside , added content page of master page. i set visible="false" on 1 asp:content in page it's not working i'm still able view data of both asp:content controls. why? master page: <%@ master language="c#" autoeventwireup="true" codebehind="masterbase.master.cs" inherits="masterbase" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> </head> <body> <form id="form1" runat="server"> <!-- header --> <asp:contentplaceholder id="head" runat="server" /> <!-- content -->

java - How should I fill Map in abstract mock class? -

i don't know how fill map in abstract class(mocked). have architecture: abstract class has member map: abstract class parent{ protected map<integer, example> map; protected abstract void methodforchild(); protected object dosomthingstaff(){ object o = map.get(...); //... } } right testing child class, , have mock parent class call methods. how can fill , work map @ parent mocked class ? i have setter map. when doing next example: map<string, example> mapexample = new hashmap<>(); mapexample.put(putdatahere); parent mockparent = mockito.mock(parent.class); mockparent.setmap(mapexample); map not filled while testing. should 100% use mockito.calls_real_methods or there exists proper way resolve problem? right testing child class, , have mock parent class call methods i wouldn't expect mock parent class whilst testing child class (not sure how can that, frankly) expect mock class being used componen

android - How to show this -

i have question. want make app mind reader. first want give 1 100 number , ask user think in mind number.on next want display 1 50 , 2 button yes,no. when click on yes shows 1 25 , on no shows 50 75 , on. use biginteger , bigdecimal instead of int , decimal biginteger a=new biginteger(valuea); biginteger b=new biginteger(valueb); biginteger c=a.multiply(b);

html - What to position a div relative to a div relative to a div -

Image
i produce following template div elements the idea div element have specific position relative div element containing positioned relatively div element containing it. i relation between 2 div elements making 1 have position:absolute , container having position:relative but how make relative big container. here image explaining i'm describing on top , i'm trying achieve. i managed code on jsfiddle. here go: jsfiddle demo you can enlarge output window's width , set width etc according project. body { margin: 0; padding: 0; } * { webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } .wrapper { margin: 50px auto 0; max-width: 600px; } .outer_div { border: 3px solid green; padding: 10px; } .inner_div { padding: 10px; } .inner_div .box:nth-child(3n) { margin: 0; } .inner_div .box { border: 3px solid #03a9f4; width: 172px; float: left; heigh

python - pxssh exceptions when host is not completely booted -

i error when running script intended monitor tasks in group of servers, script loops among servers connecting via ssh , getting required information. problem sometimes, when 1 of servers tries connect not booted or strange happening , ssh server refuses connection, error stops script. want script omit error , wait next rounds because problem solves in few loops. this error: traceback (most recent call last): file "/usr/lib/python3/dist-packages/pexpect/spawnbase.py", line 144, in read_nonblocking s = os.read(self.child_fd, size) oserror: [errno 5] input/output error during handling of above exception, exception occurred: traceback (most recent call last): file "/usr/lib/python3/dist-packages/pexpect/expect.py", line 97, in expect_loop incoming = spawn.read_nonblocking(spawn.maxread, timeout) file "/usr/lib/python3/dist-packages/pexpect/pty_spawn.py", line 455, in read_nonblocking return super(spawn, self).read_nonblocking(size

Conditional formatting in Microsoft Word -

question : there way apply conditional formatting in microsoft word ? situation : have created table in excel worksheet , copy pasted in word document, it's pasting option keeps link between table in word , raw data in excel table keeps style of word document can modify want to. what want apply color formatting on cells higher given target number in columns. i found that post not sure on how in situation.

javascript - avoid multiple cloned or duplicated div on button click and insertAfter the same last cloned div once -

i have div , want duplicate it. mean wanted same div duplicated once. have used such code it. $("#btnaddrules").click(function(){ $(".div1_section").clone().insertafter($(".div1_section")); }); but, when click on button again , again , adding multiple of divs , wanted 1 div inserted after last div. <div class="col-md-8"> <div class="row div1_section"> <div class="col-md-6"> <label>hey hey hey</label> <select class="form-control"> <option>klklk</option> <option>huhuuh</option> </select> <br/> </div> <div class="col-md-6"> <label>abc</label> <div class="input-group-currency"> <span class="currency">pk</span> <input type="text" class="form-control input-currency"

python - Flask-login shows unicode type not callable -

i tried using flask-login handle login , session. on registration process, once details validated, can use login_user(user) , redirect homepage. i have problem doing login process. upon trying login, there error raised in login_user(user) 'unicode' object not callable' on flask-login documentation says get_id() must return unicode, have done.i.e: def get_id(self): return text_type(self.id) i have imported text_type (from 6 import text_type). wrote return self.id. says : long object not callable how solve ? below login method: @app.route('/login', methods=['get','post']) def login(): if request.method == 'post': email = request.form['email'] password = request.form['password'] if email , password: error = "invalid email/password!" user = session.query(user).filter_by(email=email).first() if user: hpass = hash_str(password) if user.

r - H2O Random Forest Hangs on Completion -

i'm training random forest using h2o , r on large (~6 million) row dataset , ~50 output levels. despite progress bar hitting 100% console (and processor!) still busy , hangs on hour (so far!). not resource limitations, have 120gb of ram , couple of dozen cores. hard give reproducible example given nature of issue there 35 variables, half of factors, i'm running model training through r following options: rforest <- h2o.randomforest(y = y.var , x = x.vars , training_frame = traindata.h2o , validation_frame = testdata.h2o , ntrees = 100 , stopping_rounds = 3 , seed = 42 , model_id = modcode , mtries = -1) has encountered similar issue/has explanation/knows workaround, please?

javascript - redux-form - Calculate a field value using other 2 fields values using onChange -

the scene: think 3 fields: quantity , singleprice , totalprice . need them fields in form totalprice has re-calculated every time change quantity or singleprice simple operation can imagine.. what did: created function triggered onchange event of quantity field , 1 singleprice field. the above function calls redux action payload this: { name: name_of_the_updated_field, value: new_field_value } that action picked formreducer plugin makes calculations , return updated value object. the problem: redux store not updated nor form is. my form reducer (the property have update inside property). import { reducer formreducer } 'redux-form'; export default formreducer.plugin({ formname: (state, action) => { switch (action.type) { case 'calc_total_price': return { ...state, values: { ...state.values, competences: state.values.competences.map((c, i) => { if (i === action.pa

pointers - reflect.New returns <nil> instead of initialized struct -

i using reflection library i'm building there's don't understand reflect.new . type struct { int b string } func main() { real := new(a) reflected := reflect.new(reflect.typeof(real)).elem().interface() fmt.println(real) fmt.println(reflected) } gives: $ go run *go &{0 } <nil> isn't reflect.new supposed return &{0 } too? ( runnable version ) ultimately, wish able iterate on fields of reflected struct ( reflected.numfield() gives reflected.numfield undefined (type interface {} interface no methods) ) , use setint , setstring , on. thanks, you used builtin new() function when created real variable, returns pointer! type of real *a , not a ! source of confusion. reflect.new() returns pointer (zeroed) value of given type (wrapped in reflect.value ). if pass type a , wrapped *a , a initialized / zeroed. if pass type *a , wrapped **a , *a initialized (zeroed), , 0 value pointer type nil . you ask r

Convert C# Windows forms code to C# Android code -

i made program in windows formas using visual studio friends asked me make app it. noticed visual studio has made possible make apps direcly in c#. when opened new project different i'm used (obviously). what i'm looking easy way convert old windows forms code android format since i'm new programming don't know how mayself. of have tips or tutorials can me? have been googling around didn't find helped me. mabye suck @ googling? thanks in beforehand you can't automatically. xamarin can write app in c# must rewrite lot code, specially ui interface. maybe can reuse functions , logic

image processing - How to convert jp2 in pyramidal tiled files? -

i have set of whole slide images ~300-400 mb jp2 files , convert them in pyramidal (multi resolution) structures in such way each pyramid level decomposed in tiles. defition files pyramidal structures idea of how access specific resolution level , respective tiles? thanks. if looking quick , easy solution here do: $ kdu_expand -i input.jp2 -o output_tmp.tiff i use kakadu here since there no other implementations know of capable of dealing such large images. in case cannot use free kakadu binaries (academy only) , cannot afford license price, may want try again openjpeg: $ opj_decode -i input.jp2 -o output_tmp.tiff at least have been warned. anyway have file handled vips do: $ vips output_tmp.tiff pyramid_deflate.tiff --tile --pyramid --compression deflate --tile-width 256 --tile-height 256 this create pyramidal tiff tile size of 256x256 (pick favorite dimensions). choose deflate since did not mentionned whether or not accept lossy compression. in case n

java - Apache Ignite : Continuous SQLFieldQuery -

i looking expose apache ignite cache , client application can access same. can see continuous query support in apache ignite version 1.9 - https://github.com/apache/ignite/blob/master/examples/src/main/java/org/apache/ignite/examples/datagrid/cachecontinuousasyncqueryexample.java however not able find example how implement continuous sqlfieldquery. public static void main(string[] args) throws exception { system.out.println("run spring example!!"); ignition.setclientmode(true); igniteconfiguration cfg = new igniteconfiguration(); cfg.setincludeeventtypes( evts_cache); cfg.setpeerclassloadingenabled(true); tcpdiscoverymulticastipfinder discoverymulticastipfinder = new tcpdiscoverymulticastipfinder(); set<string> set = new hashset<>(); set.add("serverhost:47500..47509"); discoverymulticastipfinder.setaddresses(set); tcpdiscoveryspi discoveryspi = new tcpdiscoveryspi()