Posts

Showing posts from August, 2010

vb.net - How do I download a TXT and then read it? -

okay have program supposed download txt file contains url dropbox, save on desktop, , open webbrowser process.start(downloadedfile) . my code looks this: dim path string = "c:\users\" & systeminformation.username & "\desktop" my.computer.network.downloadfile("https://www.dropbox.com/s/uy9jpt1em3o6khp/download_location.txt?dl=1", path + "\" + "download_location" + ".txt") dim filereader string filereader = my.computer.filesystem.readalltext(path + "\download_location.txt") process.start(filereader) now problem that, program download txt file , name correctly. if know there text in text file, when program downloads , saves on desktop named "download_location.txt", empty. downloaded file doesn't conatin text if im 100% sure there should url text. and when program reached code process.start(filereader) gives me error: you can not start process because no file name specified. th...

html - Div being stretched on any mobile safari -

Image
i have slideshow divs selectors images. are, divs border. looks on every single browser apart mobile safari and mobile safari here css them: .slick-dots { padding-left: 0px; text-align: center; } .slick-dots li { display: inline-block; list-style-type: none; margin: 0 3px; } .slick-dots li button { background: #fff; border: 1px solid #000; border-radius: 0; height: 18px; width: 18px; opacity: 1; color: transparent; } .slick-dots li.slick-active button { background: #000; } .inspiration .slick-dots, .destinations .slick-dots { padding-left: 0px; } .inspiration .slick-dots li button, .destinations .slick-dots li button { background: none; border: 1px solid #fff; } .inspiration .slick-dots li.slick-active button, .destinations .slick-dots li.slick-active button { background: #fff; } .slick-slide img { display: inline !important; } its set height , width in pixels of 18px. looks if change width below 18px doesn't go less wide... has...

c++ - View class into a container -

i'm trying write class view serve view container, (a sparse matrix class, should unimportant question). view should contain references (e.g. std::reference_wrapper ) selection of elements in container, , have methods returning references elements, assignment operator making 1 block equal another. my problem want view able take values in addition references: both constructed values non-reference instance used in assignments, , assign values single elements in reference instance. an mve of code far is: #include <array> template<typename t, size_t size> class view { private: std::array<t, size> _values; public: view(const std::array<t, size> & values) : _values{ values } { } // ---------- view<t, size> & operator=(const view<t, size> & other) { ( size_t = 0; < size; ++i ) { this->get(i) = other.get(i); } ...

c# - Reading w3wp .Net Performance Counter Instances programmatically -

Image
when viewing .net performance counters using performance tool can see web process performance counters listed (w3wp, w3wp#1): however when run following code administrator: var instancenames = new performancecountercategory(".net clr memory") .getinstancenames() .orderby(x => x); foreach (var name in instancenames) { console.writeline(name); } this output see: notice w3wp counters not listed. know why case , how can fix it? the solution have run application in same bitness website. website 64 bit needed run console application in 64 bit mode. right click on console application project, click properties in build tab untick box says "prefer 32-bit". also when collect process id w3wp process using process id counter inside .net clr memory category 0 begin with. process id have initialize web site , make sure @ least 1 garbage collection happens. in test code call gc.collect in applicatio...

vb.net - VB - displaying chart from datagridview -

i willing show line chart based datagridview, able show not x values, showing each 5 or 10 values, example had record of temperature in room every hour in 10 days, got 24x10 = 240 data, able show value in each every 3 hour showed on chart. ex. have data 1-100 want show chart each data 5,10,15,20,... how possibly done ? chart1.series(0).charttype = datavisualization.charting.seriescharttype.line chart1.series(0).points.clear() count integer = 0 datagridview1.rows.count - 1 chart1.series(0).points.addxy(datagridview1.item(0, count).value, datagridview1.item(2, count).value) next the code above has showed normal line chart. skip points don't want plot in loop using mod in vb.net dim divisor = 3 chart1.series(0).charttype = datavisualization.charting.seriescharttype.line chart1.series(0).points.clear() count integer = 0 datagridview1.rows.count - 1 if (datagridview1.item(0, count).value mod divisor = 0) chart1.series(0).points.addx...

Unity With C# script : Class Data Type Passing Value From Class With Data Twice Weird -

i got simple question , weird passing value data type class variable. the code below : void additem(int id) { (int = 0; < database.items.count; i++) { if(database.items[i].itemid == id) { itemxs = new item (database.items [i].itemname, database.items [i].itemid, database.items [i].itemdesc, database.items [i].harvest, database.items [i].itemtime, database.items [i].stdprice, database.items [i].hightprice, database.items [i].itemstock, database.items [i].lvlunlock, database.items [i].rawtree, database.items [i].itemtype, database.items [i].itemprod, database.items [i].itemicon); debug.l...

javascript - DatePicker/Timepicker is Visible all the time -

i have fields datepicker & timepicker . whenever move page last used datepicker or timepicker visible time. example if had used timepicker on page, whenever going page timepicker open. my requirement when click on textbox datepicker or timepicker should visible. javascript function: $(document).ready(function () { $("[id$=textbox1]").pickadate({format: 'dd/mm/yyyy'}); $("[id$=textbox3]").pickatime({ interval: 10 }); $("[id$=textbox4]").pickatime({ interval: 10 }); }); where should change code? please me so. thanks update code: for textbox1 <tr> <td class="style10"> <strong> today </strong> </td> <td class="style13"> <strong> <asp:textbox id="textbox1" runat="se...

heap memory - Elasticsearch getting stopped and starting again and again -

i running elasticsearch on 4gb instance , having 2gb heap size. elasticsearch runs fine after requests gets stopped , starts on own following logs. [2016-07-11 11:11:04,492][info ][discovery ] [ev teel urizen] elasticsearch/9amxixxmttyv_l_s3t6gnw [2016-07-11 11:11:07,568][info ][cluster.service ] [ev teel urizen] new_master {ev teel urizen}{9amxixxmttyv_l_s3t6gnw}{p.p.p.p}{p.p.p.p:$300}, reason: zen-disco-join(elected_as_master, [0] joins received) [2016-07-11 11:11:07,611][info ][http ] [ev teel urizen] publish_address {p.p.p.p:9200}, bound_addresses {p.p.p.p:9200} [2016-07-11 11:11:07,611][info ][node ] [ev teel urizen] started [2016-07-11 11:11:07,641][info ][gateway ] [ev teel urizen] recovered [1] indices cluster_state [2016-07-11 11:11:07,912][info ][cluster.routing.allocation] [ev teel urizen] cluster health status changed [red] [green] (reason: [shards start$d [[user-details-index][0]] .....

aggregation framework - MongoDB query selecting documents with distinct fields -

this question has answer here: select max() “group by” in mongodb 4 answers imagine have mongodb collection such following, each row corresponds document: {name:'rick', age:30} {name:'john', age:40} {name:'rick', age:35} {name:'john', age:20} {name:'jeff', age:50} {name:'jeff', age:40} some documents have "name" field set same value (2 ricks, 2 johns , 2 jeffs). if 2 or more documents have "name" field set same value, of these want select document highest age. this: {name:'rick', age:35} {name:'john', age:40} {name:'jeff', age:50} is there rick aged 30 , rick aged 35? select rick aged 35! , on... but how can query like? db.getcollection('mytest').aggregate({$group:{_id:{"name":"$name"}, age: { $max: "$age" }}}) output:...

tsql - T-SQL | 3 Tables, Optional Joins, Confused -

i have orders table lists stores parts deleted, removed , installed on each job. --deleted items on order. declare @deleted table (id int, item int); insert @deleted (id, item) values (1, 12345), (2, 12345); -- removed items on order declare @removed table (id int, item int); insert @removed (id, item) values(3, 12345), (4, 67891); --installed items on order declare @installed table (id int, item int); insert @installed(id, item) values(1, 12345), (2, 67891), (3, 12345), (4, 12345), (4, 67891); i need following result set: --required result set /* id | del / rem | installed | match | 1 | 12345 | 12345 | 1 | 2 | 12345 | 67891 | 0 | 3 | 12345 | 12345 | 1 | 4 | 67891 | 67891 | 1 | 4 | null | 12345 | 0 | */ the main problem have order 4. there match on 1 of parts installed not second. need id = ...

javascript - Angular Material md-chips not refreshing correctly -

Image
i developing app works "widget layout". the user gets page dashboard different widgets can interact with, such table, graphs etc. i adding global "filter" using <md-chips> , objective of having filters shared widgets , can updated widgets. my filter list uses <md-chips> , read-only , md-removable set true . filters can deleted, or added interacting widgets (so added programmatically). one of feature of "module" add new filter on field when graph element is clicked . example : here filters list before clicking graph element now click on graph element in child controller of filter controller, $emit event global controller : "i want update filters ! here filter add" and filter controller event , update filters accordingly ( $scope.tags list of filters , model used in <md-chips> ) // chips $scope.tags = []; $scope.readonly = true; $scope.removable = true; // filter listener $scope.$on(...

line continuation in intersystems cache objectscript -

i writing in intersystems cache object script. have statement has become long. there way continue statement in next line? thanks. can post sample? if have long string can concatenate this: set sql = "select * "_ "from sample.person "_ "where name [ 'a'" this equal to: set sql = "select * sample.person name [ 'a'" other types of statements can placed on several lines.

c# - Base Pages in XAML Xamarin forms -

i have multiple user controls in xaml shared code want put in base page want singleline.xaml --> singleline.xaml.cs --- > basepage.cs doubleline.xaml --> doubleline.xaml.cs --- > basepage.cs singleline.xaml <stacklayout orientation="horizontal" horizontaloptions="fillandexpand" margin="0" backgroundcolor="white"> <stacklayout.gesturerecognizers> <tapgesturerecognizer tapped="ontapped"/> </stacklayout.gesturerecognizers> <stacklayout orientation="horizontal" horizontaloptions="fillandexpand" margin="0" backgroundcolor="white"> <label x:name="viewtitle" style="{staticresource lbljobdetailname}" /> <label x:name="viewvalue" style="{staticresource lbljobdetailvalue}" /> </stacklayout> <image x:name="editicon" source="edit.png" mar...

CakePHP 3 find list with valuefield as lowercase -

$this->find('list', [ 'keyfield' => 'id', 'valuefield' => 'lower(code)', 'conditions' => ['service_id' => $service_id], 'hydrate' => false ])->toarray(); i need select value table lowercase, when apply code above, returns empty values like: array( '1' => '2' => '3' => ) i not want use virtual fields. there missing? i tried way below, not desired result. 'valuefield' => function($e){ return $e->get('lower(code)'); } maybe looking : $this->find('list', [ 'keyfield' => 'id', //set code field lowercase 'valuefield' => function($q){ return strtolower($q->code); }, 'conditions' => ['service_id' => $service_id], 'hydrate' => false ])->toarray();

What is Swift enum byte representation? -

i have following enum: enum enum: uint8 { case = 0x00 case b = 0x01 case c = 0x10 } i use following code convert nsdata : var value = enum.c let data = nsdata(bytes: &value, length: 1) naturally, expect data contain 0x10 , however, contains 0x02 . for enum.a contains 0x00 , enum.b contains 0x01 . to me, looks stores index of value instead of actual raw data. explain behavior? p.s. if use rawvalue works perfectly. however, want understand reason behind, since because of cannot create generic function convert values nsdata. the swift abi still work in progress (expected fixed swift 4). way enums represented in memory is described here . your case "c-like enum" because has... two or more cases no associated values quoting abi document: the enum laid out integer tag minimal number of bits contain of cases. [...] cases assigned tag values in declaration order. the crucial information here "minimal number of bits...

php - Symfony 3.1 EventListener method executed two times? -

hello made eventlistener things before send response request. eventlistener: namespace appbundle\eventlistener; use symfony\component\httpkernel\event\filtercontrollerevent; use symfony\component\httpfoundation\session\session; use doctrine\orm\entitymanager; class requestlistener { private $em; private $session; public function __construct(entitymanager $em, session $session) { $this->em = $em; $this->session = $session; } public function onkernelcontroller(filtercontrollerevent $event) { $repo=$this->em->getrepository("appbundle:flashmessage"); $repo->addflashmessage("test","content"); } } and add services: </services> <service id="app.request.listener" class="appbundle\eventlistener\requestlistener"> <argument type="service" id="doctrine.orm.entity_manager"/> <argument type="service...

python - Best way to handle ZeroDivisonError? -

i've got following code: def chunk_trades(a): last = a[0] new = [] x in a.iteritems(): if np.abs((x[1]-last)/last) > 0.1: new.append(x[1]) last = x[1] else: new.append(last) s = pd.series(new, index=a.index) return s sometimes last can zero. in case, i'd carry on gracefully if last zero. what's cleanest way? just replace line this: if not last or np.abs((x[1]-last)/last) > 0.1: this not raise exception since left assertion checked first.

c# - Trying to import data from Excel sheet into SQL Server table with different datatypes -

i try import data excel sheet sql server table. have 1 column data type decimal. i error: input string not in correct format. this code price = convert.todecimal(((excel.range)range.cells[row, 13]).text) i have resolved myself thank kind response , kind support. here solution string pricevalue = ((excel.range) range.cells[row, 14]).text; cards.price = convert.todecimal(pricevalue);

Microsoft Botframework Emulator Error -

i followed instructions given in online tutorial (building bot 0 60), emulator doesn't work. keeps on telling me "401 unauthorized". looked online , of suggested https should used. however, when did emulator displayed message saying cannot connect remote server. of suggested changing appid microsoftappid , doing same thing password, again didn't work. of suggested leaving both appid , password blank in both emulator , web.config , didn't work well. does know how fix issue? (i made sure (like port , appid , password) written correctly, there shouldn't syntax or user errors). thanks if using v3.0.0, please note there issue authentication if use node.js. suggested workaround deactivate authentication not handing on appid , apppassword in connector options in bot , not use auth data in emulator. also note @thegaram said use matching emulator botbuilder version use. if have v0/v1 of botbuilder, should use bot framework emulator (v1), if v3+, bot ...

javascript - How to use response functions in Hosted Payment Form in Chase Paymentech? -

i working on chase payment gateway integration php. has bad documentation not shows how use response functions on merchant parent page. using hosted payment form (hpf) in chase payementech. on merchant parent page, have response functions , iframe contains hosted payment form. here don't know how use response functions cancelcrepayment() whatcvv2() crehandleerrors(errorcode) crehandledetailerrors(errorcode, gatewaycode, gatewaymessage) completecrepayment(transaction) on merchant parent page. have submitted callback_url , css_url etc @ admin panel. is resolved? if not, have in callback_url? chase paymenttech website documentation section provides sample callback.html file has actual implementation these methods. can override in iframe html page.

c# - BindingExpression path error property not found in derived class -

i confusing binding internal property of base class. i having below classes , b , tried bind class "a" property (which internal) in xaml. public class { internal int myproperty { { return (int)getvalue(mypropertyproperty); } set { setvalue(mypropertyproperty, value); } } // using dependencyproperty backing store myproperty. enables animation, styling, binding, etc... internal static readonly dependencyproperty mypropertyproperty = dependencyproperty.register("myproperty", typeof(int), typeof(a), new propertymetadata(0)); } public class b : { } question : while creating instance class datacontext set class , can bind internal property of class in xaml scenario binding property works without issues issue: but same scenario have created instance of class b inherits class a, datacontext set class b , cannot bind internal property of class a(from base class) , error thrown bindingexpression path error pr...

javascript - Jquery datatable creating extra header on chrome browser when using scrollX property -

('#instant-quotes').datatable({ "data": dataset, "scrolly": yscroll, /*"initcomplete": function(settings, json) { $('#instant-quotes thead tr:first').remove(); },*/ "dom": "lfrti", "scrollcollapse": false, "bsortcellstop": false, "info": false, "processing": true, "blengthchange": false, "searching": false, "pagelength": 7, "order": [ 0, "desc" ]... }) when use datatable scrollx property append blank <thead> <tr> .i dont why occurs doing this,however removed using jquery $('#instant-quotes thead tr:first').remove() but dont think solution because when sort or redraw table blank <thead> again appears, when change layout (coz responsive) appears again, kindly suggest better , optimal solution.

java - UserDetailsService is never called(Spring boot security) -

i have springsecurity config @configuration @enablewebsecurity @enableglobalmethodsecurity(securedenabled = true) public class securityconfig extends websecurityconfigureradapter { @autowired private userdetailsserviceimpl detailsservice; @autowired public void registerglobalauthentication(authenticationmanagerbuilder auth) throws exception { auth.userdetailsservice(detailsservice); } @override protected void configure(httpsecurity http) throws exception { http.authorizerequests() .antmatchers("/", "/index").access("hasrole('user')"); http.userdetailsservice(detailsservice); } } when open index.html page 403 error. because user anonymous . want check user , set role , detail before opened page. write service @service public class userdetailsserviceimpl implements userdetailsservice { @autowired private httpservletrequest request; @autowired authse...

php - Passing array in many to many relationship to the controller- laravel -

i have many many relationship between category , posts tables this: category class: class category extends model { public function posts() { //return $this->hasmany('app\posts','category_id'); return $this->belongstomany('app\posts', 'categories_post', 'category_id', 'post_id') ->withtimestamps(); } } posts class: class posts extends model { public function category() { //return $this->belongsto('app\category','category_id'); return $this->belongstomany('app\category', 'categories_post', 'post_id', 'category_id') ->withtimestamps(); } } when need access 1 category's posts in controller: public function cat($category_id) { $posts= $category_id->posts()->paginate(7); return view('cat')->with('posts',$posts); } edit to make work, added in "routeserviceprovider.php" file: ...

javascript - angular.js:13642 Error: [$compile:multidir] -

this question has answer here: multiple directives [mypopup, mydraggable] asking new/isolated scope 7 answers i have scenario need change star colors based on hover value appending color using custom directive , displaying stars using ui-rating(ui-bootstrap) html: <uib-rating ng-model="rate" class="col-xs-3 star-color" max="max" read-only="isreadonly" on-hover="rating=value;hoveringover(value)" star-color rating="rating" ng-click="viewpage||fnputrating(rating)" on-leave="overstar = null" titles="['one','two','three']" aria-labelledby="default-rating"></uib-rating> here star-color custom directive directive: angular.module('hrportalapp') .directive('starcolor', function() { return { restrict: ...

If sim card cloned, can we use it in real world? -

is sim card, comp128 v1 , version can cloned? in real network operator can use , have 2 sim card? the answer yes , no, depending mean 2 sim cards. if have 2 identical sim cards identified same imsi , ki (key). 1 work @ time. if use sim1 in device authenticate network , receive called tmsi (temporary mobile subscriber identity). network on address subscriber tmsi. if start sim2 authentication happen , network associate new tmsi. any sms or call re routed last "authenticated" sim. authentication retrigged bootup, location change etc.

c# - How to implement nhibernate session per request pattern, using Service stack's funq container as a dependency injector -

i getting session injecting session service method in global.asax as 1 protected void application_start() { this.registercontainer(); } 2 private void registercontainer() { container.register<iactivityservice>(c => new activityservice(sessionfactory.getcurrentsession())); } 3 in service method getting session as using (var transaction = _session.begintransaction()) { ........................ } the problem when concurrent requests came service method, throwing exceptions.i came know nhibernate not supporting concurency.ho achieve using funq container? by default servicestack's ioc registers dependencies singleton default whereas should register transient dependency instead with: container.register<iactivityservice>(c => new activityservice(sessionfactory.getcurrentsession())) .reusedwithin(reusescope.none); also previous question shows other registration examples using nhibernate servicestack.

tags - Regex to capture also outer parts of html fragment -

the issue shown online https://regex101.com/r/wz9ox5/4 the subject string html fragment code tags. need regex pattern parts of string between text of code htaml elements. parts should contain code opening , closing tag too. example subject pattern: abc <code fsa='fdsa'> lorem </code> bcd <code fsa='fdsa'> ipsum </code> cde <code fsa='fdsa'> quo vadis </code> desf my pattern this: (<\/code>.*?<code[^>]*?>) but gets inner parts of string. possible create pattern outer parts of string too? i mean aditional parts such abc <code fsa='fdsa'> and </code> defs thank you solved: https://regex101.com/r/wz9ox5/6 ((^|<\/code>).*?(<code[^>]*?>|$))/gs

multithreading - Interrupt signals awake Python process from sleeping and continue where it left off? -

the following code print out current time every 5 seconds, , handles keyboard interrupt signals int_handler . from signal import * import time datetime import datetime def int_handler(*args): print 'interrupted' signal(sigint, int_handler) while true: print datetime.now() time.sleep(5) however, every time press ctrl - c print out current time immediately, , continue running. 2016-06-28 18:17:19.441574 2016-06-28 18:17:24.446659 2016-06-28 18:17:29.451759 2016-06-28 18:17:34.452328 ^cinterrupted 2016-06-28 18:17:37.244227 ^cinterrupted 2016-06-28 18:17:37.692217 ^cinterrupted 2016-06-28 18:17:38.236343 ^cinterrupted 2016-06-28 18:17:38.572194 2016-06-28 18:17:43.577122 2016-06-28 18:17:48.577242 it seems interruption awakes process sleeping, handler gets executed, , somehow gets while loop again. can explain me why? thanks! from documentation of sleep() : the actual suspension time may less requested because caught signal terminate sl...

How Will I get the Present date is 1st of the Month in C# -

this question has answer here: check date equals 1st date of month c# [closed] 3 answers could please me, how know "present date 1st of month" in c#. writing batch job (which runs on every day mid night 12 am) in c#, here doing logic , if present date 1st of month. kindly me. take @ datetime.day property: gets day of month represented instance. so, in code test: if(datetime.today.day == 1) { // today first of month }

To check the JavaScript object has a value -

Image
can tell me how check javascript object has value ? vm.occupantdetail.contactdetail object neither null nor undefined .it looks shown below @ run time. it defines shown below. vm.occupantdetail = { contactdetail: {}, }; you can find using object.keys(vm.occupantdetail.contactdetail).length

c - Why this reverse function can not work in the for loop? -

#include <stdio.h> #include <math.h> int prime (long n); long reverse(long n); int main(void) { long n; long i, j; puts("enter n dight number, , find symmetrical prime number"); scanf("%ld", &n); (i = 11; < (pow(10, n) - 1); i+= 2) { if (prime(i)) { j = reverse(i); if (i == j) { printf("%ld\n", i); } } } } int prime (long n) //estimate whether number n primer number { int status = 0; int j; //1 prime, 0 not if (n % 2 == 0 || n == 3) { if (n == 2) status = 1; if (n == 3) status = 1; else { n++; status = 0; } } else { j = 3; while (j <= sqrt(n)) { if (n % j == 0) { status = 0; break; } ...

asp.net - What is the minimum .NET framework required for OData service development -

what minimum .net framework required odata service development? is possible develop odata services in .net framework 4 & microsoft asp.net web api but system.web.odata still not available. do have develop project using .net framweork 4.5 (minimum) & microsoft asp.net web api 2 webapi/odata v4 using .net framework 4.5, if want use .net framework 4, can try system.web.http.odata webapi/odata v3, it's under maintanance, , won't add new features anymore, recommandation move use webapi/odata v4, or try restier https://github.com/odata/restier if start build odata service.

Cygwin - launch windows program without cygwin env vars -

i need execute windows program on ssh. have cygwin installed, ssh working i've run small issue. program needs environment variables cygwin modifies (one of them term). how can launch program default set of windows environment variables?

java - Google Maps key in AndroidManifest.xml from google-services.json -

i have google-services.json file contains api key for, amongst other things, google maps service. google maps requires following information in androidmanifest.xml : <meta-data android:name="com.google.android.geo.api_key" android:value="key_goes_here" /> i can access information in java using r.string.google_api_key , build process turns json file resources per https://developers.google.com/android/guides/google-services-plugin , there way refer key inside manifest file? you can use <meta-data android:name="com.google.android.geo.api_key" android:value="@string/google_api_key"/>

Android: remove data from database -

i using this code (android-sqlite-asset-helper) load database file place in asset folder. works great. however, processing of refreshing/upgrading database not simple, , wondering if there simple way manually remove data databases in app; in order load new database asset file. you can use simple copy file override data in default database. overwriting default database new database file. following code work file, need little change here , there make work asset file. here method overwrite database file: /** * copies database file @ specified location on current * internal application database. **/ public boolean importdatabase(context context, string dbpath) throws ioexception { file olddbfile = context.getapplicationcontext().getdatabasepath(dbschema.database_name); // close sqliteopenhelper commit created empty // database internal storage. close(); file newdb = new file(dbpath); if (newdb.exists()) { fileutils.copyfile(new fileinputstream(...

c# - Single NuGet transformation file for web.config and app.config -

nuget has nice feature of transforming configurations , used transformations in web.config or app.config . now in scenario, want update main config, no matter whether it's web or app , have single source of truth , e.g., 1 file install , uninstall in package file. is possible somehow? best practice? you can copy , rename file before building package. of course, should make kind of script task.

python 3.x - How do Gtk.ScrolledWindow() work? What are the rules/good practices? -

Image
i'm trying display gtk.treeview() in gtk.messagedialog() , this: box = dialog.get_message_area() box.add(treeview) and works: but it's tall dialog window. you'd think treeview widget take care of own size allocation , scrollbars, ok: scrolledwindow = gtk.scrolledwindow() scrolledwindow.set_policy(gtk.policytype.never, gtk.policytype.automatic) scrolledwindow.add_with_viewport(treeview) box.add(scrolledwindow) but apparently not right way it: no errors, nothing. , empty dialog. driving me crazy. i'm getting sense want impossible/discouraged, can't find relevant information on that. mean, maybe it's not gtk.messagedialog() have use? can't find relevant info that. i want display tabular data in popup window , why hard, it's been 2 days now..? guidance, i'm lost here. ok, found solution (thank much) in an archived mail somewhere . yes, can put treeview in scrolled_window . solution use ...

Merge PHP multidimensional-array on key, parent keys and depth. In other words an array to a binary search tree. -

i have array trying merge. merging dependent upon key, parent keys , depth of array. can manipulate array in number of ways achieve unique key values. outcome technically binary search tree. have attached 2 files json_in.txt have , json_out.txt want. notice json_in file has unique key names in order merge , json_out file has "name" , "children" keys. plan use preg_replace_all remove digits json string after array merged, if know better way great! again, trying make json array in json_in.txt json_out.txt , can manipulate key of json_in whatever needed in order accomplish this. json_in.txt json_out.txt

javascript - How does a variable without var keyword in self invoking function works? -

this question has answer here: surprised global variable has undefined value in javascript 4 answers var salary = "1000$"; (function () { console.log("original salary " + salary); //1000$ salary = "5000$"; console.log("my new salary " + salary); //5000$ })(); (function () { console.log("original salary " + salary); //undefined ?? var salary = "5000$"; console.log("my new salary " + salary); //5000$ })(); why , how first , third console logs displaying different outputs ? this due variable hosting .in second iife function , have declared salary variable , moves top of function , overshadows global salary function javascript convrts code .see code. var salary = "1000$"; (function () { console.log("original salary " + sal...

Mongodb query to node.js format -

db.gpsvalues.aggregate([ {$sort:{"timestamp":1}}, {$group:{ "_id":"$empid", lastupdated:{$last:"$timestamp"}, latitude:{$last:"$latitude"}, longitude:{$last:"$longitude"} }} ]) this query returns expected value in mongodb. want same values node.js api call? can tell me how make node.js api? in advance you may check mongojs node.js client supports aggregation mentionned in manual . personnally have not used feature yet should work expected.

sql - Convert yyyy/mm/dd into dd/mm/yyyy hh24:MI:SS -

i'm trying convert data in format 2016/06/26 26/06/2016 00:00:00 trying few option time getting error "invalid months name", idea/advice? thanks select to_date('2016/05/07 00:00:00','mm/dd/yyyy hh24:mi:ss') dual in order convert string date need convert first date. problems trying format string not date. specific case be: --convert first date select to_date('2016/05/07 00:00:00','yyyy/mm/dd hh24:mi:ss') dual --then convert string in format want: select to_char( to_date('2016/05/07 00:00:00','yyyy/mm/dd hh24:mi:ss'), 'mm/dd/yyyy hh24:mi:ss' ) dual --since want date: --then convert string in format want: select to_date( to_char( to_date('2016/05/07 00:00:00', 'yyyy/mm/dd hh24:mi:ss'), 'mm/dd/yyyy hh24:mi:ss' ) 'mm/dd/yyyy hh24:mi:ss' ) dual if want convert string dat...

python 2.7 - Pyasn1 how do decoder.decode works? -

i have little part of code: from pyasn1.type import univ pyasn1.codec.ber import decoder decoder.decode(binary_file.read(5)) my binary_file variable it's particular binary file encoded (cdr) if try decode readed part gives me error: pyasn1.error.pyasn1error: [128:0:0]+[128:32:79] not in asn1spec: none how can fix? unless decoding data structure contains base asn.1 types (such integer, sequence etc.), need pass top-level asn.1 data structure object decoder. way decoder match custom tags (of tlv tuples in ber/der/cer serialization) same tags present in data structure object. example: custom_int_type = integer().subtype(implicittag=tag(tagclasscontext, tagformatsimple, 40)) custom_int_instance = custom_int_type.clone(12345) serialization = encode(custom_int_instance) # fail on unknown custom asn.1 type tag custom_int_instance, rest_of_serialization = decode(serialization) # succeed custom asn.1 type (containing tag) provided custom_int_instance, rest_of_se...

material-ui textfield with japanese -

excuse poor english. 'textfield' of material-ui have problem japanese input. when use inside 'dialog' tag. first letter determined without consideration. example, entering 'da' should 'だ', 'pa' should 'ぱ'. become 'dあ' , 'pあ' because first letter determined automatically. when first letter entered, should suspended until second letter inputted. does have idea? import react, { component } 'react'; import dialog 'material-ui/dialog'; import textfield 'material-ui/textfield'; export default class mymodal extends component { constructor(props) { super(props); this.state = { question: '', }; this.oninputchange = this.oninputchange.bind(this); } oninputchange(event) { this.setstate({ question: event.target.value, }); } render() { return ( <dialog open > <textfield value={this.state....

ios - Swift: How to get the position of SKShapeNode? -

Image
i'm having trouble skshapenode's position. i'm storing path user touch of screen. create polygon of , put pathofshape variable. create skshapenode of path , works fine. user drawn polygon neatly drawn on screen. however add more stuff on polygon. reason cannot position of skshapenode. instead if try use position attribute, points x:0.0, y:0.0 below. what's going 1 here? how can actual position of skshapenode? var pathofshape = cgpathcreatemutable() //path of polygon added here pathofshape var shapenode = skshapenode() shapenode.path = pathofshape shapenode.name = "shape" self.addchild(shapenode) let node1 = self.childnodewithname("shape") print(node1?.position) results optional((0.0, 0.0)) actually if make cgpath , example triangle: var pathofshape = cgpathcreatemutable() let center = cgpointmake(cgrectgetmidx(self.frame), cgrectgetmidy(self.frame)) cgpathmovetopoint(pathofshape, nil, center.x, center.y...

dataframe - Data format change while writing to a file connection R -

i have data, reproducible example set is: a<-data.frame( mdse_item_i=as.factor(c(rep(10,2),rep(15,2),rep(23,4))), co_loc_i=as.factor(c(rep(1,2),rep(3,2),rep(5,1),rep(7,3))), date = seq(as.date("2011-12-01"), as.date("2011-12-08"),by="days"), sls_type_grp_c=as.factor(c(rep("r",2),rep("p",4),rep("p",2))), non_clr_sls_q=as.numeric(rnorm(8,3,1))) which trying write file connection using cat command: fileconn<-file("/users/z076156/desktop/output.txt") sapply(1:nrow(a), fun = function(row) { cat(a$mdse_item_i[row],",",a$co_loc_i[row],",",a$date[row],",", a$sls_type_grp_c[row],",",a$non_clr_sls_q[row],"\n",sep='')}) close(fileconn) the output is: 1,1,15309,2,3.043244 1,1,15310,2,2.667343 2,2,15311,1,1.177765 2,2,15312,1,4.411262 3,3,15313,1,2.162418 3,4,15314,1,1.876237 3,4,15315,1,6.043766 3,4,15316,1,3.235021 this output stripped of fa...

c# - Light/Shadow doesn't apply on small gameobejct -

Image
i want implement object in scene . if add here's looks : it's beautiful, unfortunately, because of rest of scene, have apply scale of 0.0006 : planeobject.transform.localscale = new vector3(0.0006f, 0.0006f, 0.0006f); and here's happen, no light or shadow on texture of plane : i try modify light, here's parameters : did miss something, there minimum size light apply ? i'm not sure why need apply small scale plane. should able model in reasonable scale. then, can use view parameters zoom plane. don't object sizes or directional light located. guess light inside, behind, or pointing away plane, flat shading. should able put light far away plane , see if anything, move closer, if need effects, sun pretty far away. ;-)

testing - How to Test Angular2 / TypeScript HTTPService without Mock -

import {injectable} '@angular/core'; import {http} '@angular/http'; @injectable() export class httpservice { result: any; constructor(private http:http) { } public postrequest(){ return this.http.get('http://httpbin.org/get'); } } above code, here test: i do not want mock anything, test real http connection. edit - new service.spec file: import {beforeeachproviders, beforeeach, it, describe, expect, inject} '@angular/core/testing'; import {httpservice} '../../providers/http-service/http-service'; import {translateservice} 'ng2-translate/ng2-translate'; import {goal} '../../providers/goal/goal'; import {navcontroller} 'ionic-angular'; import {http_providers, http} '@angular/http'; describe('http service test', () => { beforeeachproviders(() => { return [ http_providers, httpservice ]; }); it('should retur...

Create a MSI installer for deploying fonts using Wix (including more fonts in one MSI) -

please, provide full .wxs example creating msi package? i've read thread already: how install open type fonts using wix but not me enough. add comment there, i've got not enough reputation points :/ what wrong? receive following errors: d:\share\it\install-msi\msi věvoj\fonty-2016>candle font-gabka2.wxs windows installer xml toolset compiler version 3.10.2.2516 copyright (c) outercurve foundation. rights reserved. font-gabka2.wxs d:\share\it\install-msi\msi věvoj\fonty-2016\font-gabka2.wxs(14) : warning cndl1091 : package/@id attribute has been set. setting attribute allow nonidentical .msi files have same package code. may problem because package code primary identifier used installer search , validate correct package given installation. if package changed without changing package code, installer may not use newer package if both still accessible installer. please remove id attribute in order automatically generate new package code each new .msi file. d:...