Posts

Showing posts from September, 2012

java - ExpandableListView doesn't appear in the right order -

Image
i wriring android app, , decided use expandable list view. have need, list working fine, when populate it, groups appear in different order should, here's example: as can see, child values fine, parent values appear in random order. here's full code have: my fragment code: public class buildingsfragment extends fragment { public buildingsfragment() { // required empty public constructor } public static buildingsfragment newinstance(context context) { buildingsfragment fragment = new buildingsfragment(); return fragment; } @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); } @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // inflate layout fragment view view = inflater.inflate(r.layout.fragment_buildings, container, false); final expandablelistview expandablelistview = (expandablelistview) view.findviewbyid(r.id.expandabl...

C# WPF Indeterminate progress bar -

please suggest why following doesn't work? want display indeterminate progressbar starts when button clicked, after i've done work set indeterminate progressbar false stop it. however when run code below indeterminate progressbar doesnt start. tried commenting out line this.progressbar.isindeterminate = false; , , when progressbar start doesn't terminate. private void generatecsv_click(object sender, routedeventargs e) { this.dispatcher.invoke(dispatcherpriority.normal, new action(delegate () { this.progressbar.isindeterminate = true; //do work thread.sleep(10 * 1000); this.progressbar.isindeterminate = false; })); } your code can't work because "do work" happening on same thread on ui works. so, if thread busy "work", how can handle ui animation progressbar @ same time? have put "work" on thread , ui thread free , can job progressbar (or other ui co...

c# - How to overwrite next line after found line in text document -

here want 1 thing, take line value, found in text document , want overwrite x not on found line, on next line coming after found line so if content is: line1 line2 line3 line4 and if string text = "line2"; code: using system; using system.io; namespace _03_0 { class program { static void main(string[] args) { string text = "line2"; string text = file.readalltext("doc.txt"); text = text.replace(text, "x"); file.writealltext("doc.txt", text); } } } i have result: line1 x line3 line4 but want result: line1 line2 x line4 i suggest using regular expressions this: string filepath = @"doc.txt"; string mystr = "line2"; string content = file.readalltext(filepath); string pattern = string.format(@"(?<={0}\r\n).+?(?=\r\n)", mystr); regex r = new regex(pattern); file.writealltext(filepa...

plugins - How to insert opening brace and matcing brace in vim manually -

i using autopairs plugin. if(num==5)//if delete here matching brace further couldn't add matching brace. i want add opening brace.. it's giving me pair of brace. int main() { }//if delete brace further can't add this... if(abs()(num*5))//here after abs want add opening brace //but here coming two. i new in vim.. if elaborately describe solution huge me.. that's odd. usually, bracket plugins let insert closing brackets when it's not next character under cursor. otherwise, can inhibit mapping on demand pressing ctrl-v before closing bracket key.

python - Multiply array with diagonal matrix stored as vector -

i have 1d array = [a, b, c...] (length n_a) , 3d array t of shape (n_a, n_b, n_a). meant represent diagonal n_a n_a matrix. i'd perform contractions of t without having promote dense storage. in particular, i'd np.einsum('ij, ikl', a, t) and np.einsum('ikl, lm', t, a) is possible such things while keeping sparse? note question similar dot product diagonal matrix, without creating full matrix but not identical, since it's not clear me how 1 generalizes more complicated index patterns. np.einsum('ij, ikl', np.diag(a), t) equivalent (a * t.t).t . np.einsum('ikl, lm', t, np.diag(a)) equivalent a * t . (found trial-and-error)

scala - Change Logback logging in Play standalone -

when create scala play web application, play generates conf/logback.xml file allows me configure how application logs. i created scala play standalone application , when include slick statements following in console: 21:46:04.811 [asyncexecutor.default-16] debug slick.jdbc.jdbcbackend.statement - preparing statement: insert report_data (cert,repdte,p3gtypar,p3gty,p3gtygnm,p9gtypar,p9gty,p9gtygnm,nagtypar,nagty,nagtygnm) values (5352,'2015-12-31',0,0,0,0,0,0,0,0,0) 21:46:04.811 [asyncexecutor.default-16] debug slick.jdbc.jdbcbackend.benchmark - execution of prepared statement took 43µs 21:46:04.811 [asyncexecutor.default-16] debug slick.jdbc.statementinvoker.result - 1 rows affected 21:46:04.811 [main] debug slick.backend.databasecomponent.action - #1: [fused] astry there's no lockback file in scala standalone. how change logging options? add following dependency in build.sbt "org.slf4j" % "slf4j-nop" % “1.6.4" and add slick...

php nginx proxy remote file download -

i want "proxy" file located on remote server (let's call server b) , force download visitor, server a. only server can access ressource on server b (ip address secured). ressource can weight few gigabytes. here code far: header('content-type: application/octet-stream'); header('content-disposition: attachment; filename='.$filename); header('content-transfer-encoding: chunked'); header('expires: 0'); header('cache-control: must-revalidate, post-check=0, pre-check=0'); header('pragma: public'); $stream = fopen('php://output', 'w'); $ch = curl_init($ruri); curl_setopt($ch, curlopt_readfunction, function($ch, $fd, $length) use ($stream) { return fwrite($stream, fread($fd, $length)); }); curl_exec($ch); curl_close($ch); it works partially. problem number 1: the visitor cannot browse page of website on server while downloading ressource. why? problem number 2: it not support pause or res...

A simple check if selected, if not add to array in Javascript -

this function supposed take id of selected row , check see if in array or not, if isn't on array, add array, otherwise remove array. problem can't seem order of events right. loop not run way through (because of breaks) if remove breaks, while image changing (checkbox) works, array still wrong. i don't understand why despite declaring deletestring = []; outside of function, without putting inside function, call of deletestring.push(orderid); fails it seems obvious problem, on first run regardless of how big array is, whether or not check matches or doesn't match, rest of loop won't run. perhaps should check wait until loop done before using result of found/not-found. function passselection(orderid) { // check if empty if (deletestring.length == 0) { // turn array deletestring = []; // first entry deletestring.push(orderid); // mark row checked $("#"+"select-box-"+orderid).attr('src', 'images/red...

angularjs - No NgModule in folders generated by Angular-Cli -

i newbie angular.js. have learn angular.js's basic notions , understand project structure. but when use angular-cli generate basic project, find in project there no ngmodule in root src folder. accord docs in homepage of angular, root ngmodule. here question, difference between them. , why angular-cli use component root? thanks. i think angular-cli has not been updated yet. angular 2 still changing fast. but, can create yourself: $ ng new yourproject then navigate inside yourproject/src/ folder, replace main.ts way: import { platformbrowserdynamic } '@angular/platform-browser-dynamic'; import { appmodule } './app/app.module'; platformbrowserdynamic().bootstrapmodule(appmodule); now go yourproject/src/app folder , create app.module.ts : import { ngmodule } '@angular/core'; import { browsermodule } '@angular/platform-browser'; import { mdbuttonmodule } '@angular2-material/button'; import { appcomponent } ...

enterprise architect - Arranging the ports in the element diagram in the EA -

we have 5 ports in diagram element .when add ports element through addin found ports placed 1 above another.so tried arrange them through co-ordinates provided diagram objects.but still not able arrange them properly.so there way can arrange ports in element such should placed in elements border without overlapping. you might need upgrade ea. functionality has been buggy former ea versions. (afair 10 , 11 suffered this)

angularjs - ASP.net and anjularjs ng-route -

i'm using asp.net mvc , angularjs create single page application (spa). have main page left menu panel. when click menu link in menu panel, show content (view) in right div. url change want keep url remain @ main page url. below code: main view <a href="#/admin">member</a> <script> var app = angular.module("myapp", ["ngroute"]); app.config(function ($routeprovider) { $routeprovider .when("/admin", { templateurl: "/admin/member", controller:"admincontroller" }); }); admin controller (admincontroller) , member content want show. example url main: http://localhost:58741/admin/main after click member link example url main: http://localhost:58741/admin/main#/admin try using #stateprovider var app = angular.module('myapp', ['ngroute','ui.router']); app.config( function($stateprovider, $urlrouterprovider) { $urlrouterprovider.ot...

ios - How to modify query with .whereKey, but utilizing multiple different parameters in Xcode? -

i creating application in xcode, using swift, pulling information parse-server database (hosted heroku). there convinient way modify query, can set up, example, follows: let getfolloweduserquery = pfquery(classname: "followers") getfolloweduserquery.wherekey("follower", equalto: (pfuser.currentuser()?.objectid)!) however, query query based on multiple parameters. here checking 1 column in db. there way modify query using .wherekey (or of same sort) such check multiple parameters/columns in db. essentially, checking these columns based on search parameters input user. user can select multiple parameters... query needs return objects fit all parameters, not one. there way that? did check docs ? says: you can give multiple constraints, , objects in results if match of constraints. in other words, it’s , of constraints. in case be: let getfolloweduserquery = pfquery(classname: "followers") getfolloweduserquery.wherekey("fol...

oauth - Angular 2 RC5 Router redirect with Auth0 service -

i have simple application using angular 2. on rc5 using ngmodule. using 3.0.0-beta.2 router. my default app url http://localhost:8080/# when login using auth0 service, after successful login access_token , id_token in url. redirecting url looks http://localhost:8080/#access_token=ykxqzxxx&id_token=eyjqwasxxx but angular router tries map route. below error. ** uncaught (in promise): error: cannot match routes: 'access_token' ** is there way can tell angular not this. want read data router param instead. please help.

c# - Can we notifiy .net application to update data from database instead of pooling concept? -

my concern ping .net web application pick updated data sql server db , showing same on ui instead of manual pooling concept. dnt want use javascript time intervals. in research found signal r still asking other concepts can opted. so question ways can notify application retrieve updated data db? signal r best 1 push notification on web ui in .net.

How to get today's date in java if system date is one year back of current date? -

my motive current date without caring of system date. my suggestion, if really can't rely on system time use time server. apache commons has useful client this. there plenty of examples online: https://commons.apache.org/proper/commons-net/apidocs/org/apache/commons/net/ntp/ntpudpclient.html there numerous available timeservers. don't tempted correct date in code, fragile , break if corrects server time. the obvious, , easier, solution correct time on server though!

accelerometer - Indoor Navigation system using Android Accelorometer? -

Image
i working on android app , can setup indoor navigation system of building. using accelorometer sensor develop system. little stuck in movement of navigation arrow. arrow not moving. mycode: package com.sample.accelerometer; import android.content.context; import android.hardware.sensor; import android.hardware.sensorevent; import android.hardware.sensoreventlistener; import android.hardware.sensormanager; import android.support.v7.app.appcompatactivity; import android.os.bundle; import android.view.view; import android.view.animation.animation; import android.view.animation.animationset; import android.view.animation.animationutils; import android.view.animation.translateanimation; import android.widget.framelayout; import android.widget.imageview; import android.widget.textview; import java.util.arraylist; import java.util.random; public class mainactivity extends appcompatactivity implements sensoreventlistener { private sensormanager sensensormanager; private sensor sena...

javascript - Meteor: this.userId and Meteor.userId() both are null within a Meteor Method -

to boil down issue basic problem , minimum of code, i've created plain new meteor app, added accounts-password package , added following code snippet. there's test user in database. meteor.methods({ 'testmethod': function() { console.log('test2:', this.userid); // => null console.log('test3:', meteor.userid()); // => null } }); if (meteor.isserver) { meteor.publish('testpublication', function() { console.log('test1:', this.userid); // => 1c8thy3zb8vp9e5yb meteor.call('testmethod'); }); } if (meteor.isclient) { meteor.loginwithpassword('test', 'test', function() { meteor.subscribe('testpublication'); }); } as can see, within publication this.userid contains correct userid. within meteor method testmethod both this.userid , meteor.userid() returning null . is meteor bug or approach wrong? this expected behavior....

javascript - Can't figure out why infinite loop occurs -

i'm practising loops in javascript whilst writing got infinite loop can't solve i'm sure hindsight 20/20 kind of problem cant't see it. loop in meleechoice /*var meleevalues = function() {*/ var userdmg = math.floor(math.random()* 5 + 10); var ghouldmg = math.floor(math.random()* 4 + 8); var ghoulhealth = 100; var userhealth = 110 ; var usertotaldmg = 0 ; var ghoultotaldmg = 0; var firstatk = function() { firststrike = math.floor(math.random()* 2 + 1); if(firststrike === 1) { ghoulhealth = 100 - usertotaldmg; console.log("you hit ghoul " + userdmg + " damage"); console.log("the ghoul has " + ghoulhealth + " health left"); userhealth = 110 - ghoultotaldmg; console.log("ghoul hits " + userdmg + " damage"); console.log("you have " + userhealth + " health left"); } else { use...

php - Laravel 5.3 active record OR -

can ask how on laravel 5.3 in objects ? used local scope method. far confused using or in objects. thanks. $sql = "select * `conversations` (`conversations`.`user_id` = 1 , `conversations`.`chat_id` = 2) or (`conversations`.`user_id` = 2 , `conversations`.`chat_id` = 1)"; try this: $conversation = conversation::where(function($q) { $q->where('user_id', 1); $q->where('chat_id', 2); })->orwhere(function($q) { $q->where('user_id', 2); $q->where('chat_id', 1); })->get(); if want use variables, don't forget pass them use() .

javascript - Jquery dialog chrome issue - scroll not visible when opening for second time -

this modal div element: <div id="modal-window" style="display:none;"> <iframe id="modal-window-inner-html" frameborder="0"></iframe> </div> and jquery modal defined in javascript: $("#modal-window").dialog({ autoopen: false, modal: true, width: 350, height: 800 }); this iframe css: #modal-window iframe { position: absolute; top: 0; bottom: 0; left: 0; right: 0; height: 100%; width: 100%; } in iframe content put large html should scroll. have 1 chrome issue (other browsers work fine), when open modal first time in chrome fine (scroll visible), when close modal , open again second, third time etc. scroll not visible can still scroll content. how force scroll visible? tried putting overflow-y: auto !important; on iframe, putting maxheight on jquery modal, destroying jquery modal on close, nothing resolved issue. adding fixed ...

copy - Dupicate an ImageField in another field of same model while saving the model objects -

i want upload 1 image(location of stores in photo field of model mentioned below ) , want duplicate photo field thumbnail programitically. i tried in way mentioned in class picture(models.model): below. bytheway resizedimagefield works , have tested photo field. needed overwrite def save(self, *args, **kwargs): method mentioned below. from django_resized import resizedimagefield class picture(models.model): photo = resizedimagefield('photo', upload_to='photos/%y/%m/%d', size=[636,331]) thumbnail = resizedimagefield('thumbnail', upload_to='thumbnail/%y/%m/%d', size=[150, 100], blank=true, null=true) def save(self, *args, **kwargs): super(picture, self).save(*args, **kwargs) if self.photo: self.thumbnail = resizedimagefield(self.photo) self.thumbnail.save() i think problem save method calling on self.thumbnail.save() , try instead: def save(self, *args, **kwargs): if self.ph...

javascript - How to add image at the end of text line using pdfmake? -

i'm using pdfmake . i'm trying figure out how add image end of text line instead of new line. example: var dd = { content: [ 'test text', {image: 'sampleimage.jpg', width: 24, height: 24} ] } using description pdfmake generates pdf first line 'test text', , second contains image. need text , image in single line 'test text [image]'. has done before? i advice on how it. thanks. use columns var dd = { content: [ { columns: [ { width: 'auto', text: 'test text' }, { width: '*', image: 'sampleimage.jpg', width: 24, height: 24 } ] } ] }

javascript - The Scroll Detect Multiply when it goes to bottom And the return data disappear -

the scroll detect multiply @ bottom , return data first comes disappear on next scroll have put append case in it. want display timeline data database on scroll down. comes value of start input hidden. goes , tells database display record. scroll detects multiply on scroll first , .append display record send start value. function yhandler(){ // watch video line line explanation of code // http://www.youtube.com/watch?v=ezirenzpml4 var wrap = document.getelementbyid('midcontent'); var contentheight = wrap.offsetheight; var yoffset = window.pageyoffset; var y = yoffset + window.innerheight; if(y > contentheight){ var start = document.getelementbyid("start").value; // create our xmlhttprequest object var hr = new xmlhttprequest(); // create variables need send our php file var url = "loadtimeline.php"; //var cityval = document.getelementbyid("city").value; ...

openmdao - Restarting SLSQP from sub iteration -

the case solving 2 discipline aerospace problem. architecture idf. using recorders record data @ each iteration. using finite difference. using slsqp optimizer scipy. if after few major iteration, optimization crashes during line search. how start line search same point? apart that, want check whether call solver_nonlinear() of component called purpose of derivative calculation or line search, inside component. there way it? slsqp doesn't offer built in restart capability, there isn't whole lot can there. pyopt-sparse have restart capability openmdao can use. called "hot-start" in code. as knowing if solve_nonlinear derivative calculations or not, assume mean want know if call fd step or not. don't have feature.

c# 4.0 - Log out existing user when current user login asp.net mvc c# -

i have mvc web application. example: in tab1, logged in user1 , doing operations , in tab2, logging in user2, ask pop override, clicked yes , sucessfully logged in now. question when goto tab1, if hit refresh(f5) or save button in page.. refresh - displays user2 logged default session unique happen if click save button , dont want save user1's data user2 instead wanted user1 logged out popping "user2 active user1 logged out"? you cant because browser entertain unique session, if user1 logged in session created particular browser if logged in other user in other tab session created , forgot previous session. instead can this, if (session["username"] == null) { return view(); } else { return redirecttoaction("index", "home"); } by 1 user can loggedin

php - How to work search query like or like and status -

if search multiple keywords in mysql query t_name '%key%' or t_name '%key%' want filter if tour status 1 show has 1 status in database. every thing working , status='1' not working below query code: if($stmt=$connc->query("select * jaipuragra_home_tours t_name '%shimla%' or t_name '%manali%' , status='1'")) any body can , plz reply if want add email array should make variable array first $email= array(); after declare variable array can add $email = $_post['email'];

dart - Modifying strings with source_span package in dartlang? -

i want transform parts of source files own transformer in dart. have dart file input , want edit file. know can contents of file with: var content = transform.primaryinput.readasstring(encoding: utf8); from inside transformers. know how find offset in source want apply changes. is there kind of "cursor"-style editing package strings in dart? want kind of (pseudo-code!): string sourcestring = transform.primaryinput.readasstring(encoding: utf8); //sourcefile comes source_span package, wrapped cursor implementation sourcefile source = new sourcefile(sourcestring); var cursor = new cursor(sourcefile); //.jumpto(int linenumber, [int columnnumber]) cursor.jumpto(30); //deletes next 2 chars cursor.delete(2); //adds new text after cursor cursor.write("hello world!"); //accept sourcespans deletion cursor.delete(sourcespanobject) or there better way change contents of source files in transfomers in dart?

javascript - Angularjs doesnot print from function -

<!doctype html> <html> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <body> <div ng-app="canerapp" ng-controller="canerctrl"> <br> {{text}}f </div> <script type="text/javascript"> var app = angular.module('canerapp', []); app.controller('canerctrl', function($scope){ $scope.text ="ff"; }); </script> </body> </html> this works , prints fff as can see here http://plnkr.co/edit/gp2ncc38jpsabqfacgkb?p=preview but doesnot work <!doctype html> <html> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <body> <div ng-app="myapp" ng-controller="mycontroller"> <br> {{text}}f <br> {{text}}fh </div> <script type="text/javascr...

asp.net - Convert true and false to 1 and 0 in XmlElement in C# -

i working soap web service third party. have generated objects using xsd.exe tool. problem need send xmlelement i'm serialising. service throwing error because expects boolean values represented 1 , 0 instead of true , false. i know can use custom serializers such this: ixmlserializable interface or this: making xmlserializer output alternate values simple types involve me changing code generated xsd.exe tool , difficult maintain every time there upgrade. am missing or there way achieve i'm looking for? you make object ignore bool value instead use different variable show it. example: [ignoredatamember, xmlignore] public bool boolprop { get; set; } /// <summary> /// xml serialized boolprop /// </summary> [datamember(name = "boolprop"] [xmlelement(elementname = "boolprop"] public int formattedboolprop { { return boolprop ? 1 : 0; } set { bo...

c# - how can i get the location of the player along a specific axis during play mode? -

Image
my player runs forward during play time want store current position along specific axis lets z in variable inside update function , use position elsewhere. want know kind of datatype have use store such value current position of player on z axis if doing possible. saw code somewhere:- var playerpos:vector3 = playerobject.transform.position; but idk how working if in first place you close current syntax in code javascript. you use transform.position position of axis. transform.position returns vector3 , vector3 contains axis gameobject position. vector3 has x , y , z properties float datatype. accessing position : assuming playerobject name of gameobject, below example of how access each individual axis. to x axis float x = playerobject.transform.position.x; to y axis float y = playerobject.transform.position.y; to z axis float z = playerobject.transform.position.z; you can position once , store vector3 variable access each individual axis...

Check if user credentials are correct in Login page without reloading the page? [Rails] -

so noticed neat thing on zapier's login page . when enter wrong credentials , click on 'login', gives 'incorrect email or password' error without reloading page. how being done? , how can replicate in rails app devise? without providing code, rather general answer, here go: in order create asynchronous request, want hook sort of javascript (jquery, angularjs, ...) issues asynchronous request (keyword: ajax) ruby on rails controller. make sure include username/password params controller evaluate ;) depending on entered information , desired behavior, controller respond json (something simple render json: true, status: 200 should job.) then, evaluated on clientside again, either show error or redirect user further. this tutorial may on way: https://hackhands.com/sign-users-ajax-using-devise-rails/ good luck!

css - Border with color gradient from left, top, bottom and right -

Image
i add border white color @ top left, top right dark blue, bottom left dark grey , bottom right light grey/light blue, gradient? is possible css or should use background image? you use :before pseudo element , linear-gradient create border-like effect. .element { background: white; position: relative; width: 200px; height: 150px; margin: 50px; } .element:before { content: ''; position: absolute; left: -5px; top: -5px; width: calc(100% + 10px); height: calc(100% + 10px); background: linear-gradient(45deg, rgba(220, 218, 219, 1) 0%, rgba(255, 255, 255, 1) 42%, rgba(255, 255, 255, 1) 59%, rgba(125, 188, 220, 1) 100%); z-index: -1; } <div class="element"></div>

android - Scaling the Image button in an included layout -

i have layout purely numeric keys , include in layout. problem, these keys scale in width when change orientation or place other lements next it. my includable keys xml: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content"> <linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:weightsum="3"> <button android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/btn_numeric_7" android:text="@string/numeric_7" android:textsize="@dimen...

python - 'CsrfViewMiddleware' object is not iterable -

Image
i new django, , took on developer on project. have done far clone code git , install dependencies. immediately after setting project, , running python manager.py runserver , going localhost:8000/admin error stating typeerror @ /admin/login/ , 'csrfviewmiddleware' object not iterable : traceback: file "/home/abhay/code/virtualenvironments/leaguesx/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner 39. response = get_response(request) file "/home/abhay/code/virtualenvironments/leaguesx/lib/python3.5/site-packages/django/core/handlers/base.py" in _legacy_get_response 249. response = self._get_response(request) file "/home/abhay/code/virtualenvironments/leaguesx/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response 217. response = self.process_exception_by_middleware(e, request) file "/home/abhay/code/vir...

c++ - Using OpenGL together with Qt Data Visualization -

i'm trying render 3d bar graph using data visualization library of qt. application want develop requires bars in different ranges must colored different color. make things more concrete 1) yellow if value <=5000 2) red if value between 5001 , 15000 3) blue if value above 15000 however qt's libraries not allow me color bars different colors. class qbar3dseries has 3 different options color style. 1) q3dtheme::colorstyleuniform : bars colored same color. out of question. 2) q3dtheme::colorstyleobjectgradient : bars colored same gradient. again out of question. 3) q3dtheme::colorstylerangegradient : temporary solution. bars colored according ratio of value of individual bar , value of highest bar. here, bars displayed in gradients , more 1 color used , want 1 color each bar. , based on relationship largest value, not on values want specify. (in example 5000, 15000 , 20000) maybe need other methods intervene in process system renders graph. can use opengl thi...

c# - The WebBrowser very slow in server from the second times calling -

when call navigatefrombrowser() first time, return fast, if called again, slowly, , timeout. btw, issue happens in windows server, , doesn't happen in windows client such win7.please advice why happens. private void navigatefrombrowser() { using (var wb = new webbrowser()) { wb.width = width; wb.height = height; wb.scrollbarsenabled = false; wb.navigate(_url); while (wb.readystate != webbrowserreadystate.complete) { application.doevents(); } } }

Swift - how to fill a path (opaque path) -

Image
i have path should have shape of isometric tile: let isometricpath = cgpathcreatemutable() cgpathmovetopoint(isometricpath, nil, 0, -(tilesize.height / 2)) cgpathaddlinetopoint(isometricpath, nil, (tilesize.width / 2), 0) cgpathaddlinetopoint(isometricpath, nil, 0, (tilesize.height / 2)) cgpathaddlinetopoint(isometricpath, nil, -(tilesize.width / 2), 0) cgpathclosesubpath(isometricpath) and try make opaque path line of code: let isometricpathref = isometricpath cgpathref but if want check if cgpoint inside path this: cgpathcontainspoint(isometricpathref, nil, locationinnode, true) it detect point on path not inside. how make possible? thanks your code correct should @ origins of scene. sure can see shape? by default, scene’s origin placed in lower-left corner of view. so, default scene initialized height of 1024 , width of 768, has origin (0,0) in lower-left co...

c# - Remove duplicates in a list of XYZ points -

mylist.groupby(x => new{x.x, x.y}).select(g => g.first()).tolist<xyz>(); the above code works fine me. want compare points based on round(5) of point component. for example x.x = 16.838974347323224 should compared x.x = 16.83897 because experienced inaccuracy after round 5. suggestions? solution: mylist.groupby(x => new { x = math.round(x.x,5), y = math.round(x.y,5) }) .select(g => g.first()).tolist(); to use math.round : var result = mylist.groupby(x => new { x = math.round(x.x,5, midpointrounding.awayfromzero), y = math.round(x.y,5, midpointrounding.awayfromzero) }) .select(g => g.first()).tolist(); however if want remove duplicates instead of groupby go 1 of these: select rounded , distinct : var result = mylist.select(item => new xyz { x = math.round(item.x,5, midpointrounding.awayfromzero), y = math.round(item.y,5, midpointrounding.awayfromze...

c# - How to return customer data with HttpResponseMessage -

httpresponsemessage r = new httpresponsemessage(); r.statuscode = httpstatuscode.ok; r.reasonphrase = "success"; now how pass customer object httpresponsemessage class client side ? one way return request.createresponse(httpstatuscode.ok, customers); suppose if not want return response way request.createresponse(httpstatuscode.ok, customers); rather want create instance of httpresponsemessage , initialize few property , return. tell me ow pass customer object httpresponsemessage class client side ? the simple way should create response based on request: return request.createresponse(httpstatuscode.ok, customers); because under hood, method deal content negotiation don't care much. otherwise, have deal manually below code: icontentnegotiator negotiator = this.configuration.services.getcontentnegotiator(); contentnegotiationresult result = negotiator.negotiate( typeof(customer), this.request, this.configuration.formatters); var...

javafx - Using String Time stamps in LineChart -

i'm using javafx. i've modified example of zoom function on linechart. exception when doing zoom. i've figured out there mismatch between types on xaxis, wants numbers , i'm using string time stamps. how can adapt work time strings "12:33:23" on xaxis? package javafxapplication28; import java.util.collections; import java.util.random; import static java.util.uuid.fromstring; import javafx.application.application; import javafx.beans.binding.booleanbinding; import javafx.beans.property.objectproperty; import javafx.beans.property.simpleobjectproperty; import javafx.collections.fxcollections; import javafx.collections.observablelist; import javafx.event.actionevent; import javafx.event.eventhandler; import javafx.geometry.insets; import javafx.geometry.point2d; import javafx.geometry.pos; import javafx.scene.node; import javafx.scene.scene; import javafx.scene.chart.axis; import javafx.scene.chart.linechart; import javafx.scene.chart.numberaxis; import j...

Prevent developers from modifying Liferay Database structure -

i working in environment contain many liferay newbies along experts, want make configuration prevent 1 modifying structure of liferay database, i.e. 1 developer started liferay 6.2 server while connecting liferay 6.1 configuration database causing database corrupted ... know can't make lr users read-only because change reflected database, want put limitations prevent scenario above.... related configuration available ? regular permissions required accessing liferay's database select, insert, update , delete. when you're developing new plugins need create table, alter table, create index , similar ddl permissions on database you're developing on . don't give them full permissions. update routines (that run when have 6.2 code running on 6.1 structures) require ddl permissions or fail. and, of course, can remove / unconfigure upgrade routines .

c++ - Use a variable from pointer that is pointed by a struct which (that structs') pointer is sent to a function that needs to use it -

welp, thats kind of pointerception. so. im using gtk+ in gtk define buttons this: gtkwidget *button1, *button2; so need function do this. make struct hold pointer it here is: typedef struct userdata{ gtkwidget *button1, *button2; }userdata; i point pointers struct pointers main: userdata data; data.button1 = button1; data.button2 = button2; then use struct gtk event: g_signal_connect(g_object(window), "configure-event", g_callback(resetbuttonsize), &data); and here comes problem. want these variables sent function, example resize them this: void resetbuttonsize(gtkwindow *window, gdkevent *event, gpointer data){ gtkwidget *button1 = data->button; } so like: gtk_widget_set_size_request(button1, 40, 40); sadly, can not (gtkwidget *button1 = data->button;) because following compiler error: /media/dysk250/pmanager/testfile/main.cpp|59|error: ‘gpointer {aka void*}’ not pointer-to-object type| can tell me im doing wrong? im newb...

python - How to eliminate duplicate key value pair inside a list -

this question has answer here: remove duplicate dict in list in python 6 answers [ {'date': '08/11/2016', 'duration': 13.0}, {'date': '08/17/2016', 'duration': 5.0}, {'date': '08/01/2016', 'duration': 5.2}, {'date': '08/11/2016', 'duration': 13.0}, {'date': '08/11/2016', 'duration': 13.0}, {'date': '08/11/2016', 'duration': 13.0} ] if data that. one easy not efficient solution can be: a = [{'date': '08/11/2016', 'duration': 13.0}, {'date': '08/17/2016', 'duration': 5.0}, {'date': '08/01/2016', 'duration': 5.2}, {'date': '08/11/2016', 'duration': 13.0}, {'date': '08/11/2016',...

tensorflow - string_input_producer with num_epochs throws OutofRangeError -

this code dequeues elements expected: import tensorflow tf tf.session() sess: queue = tf.train.string_input_producer([str(i) in range(10)]) deq = queue.dequeue() coord = tf.train.coordinator() threads = tf.train.start_queue_runners(coord=coord) in range(3): print(sess.run([deq])) however when add num_epochs string_input_producer fails outofrangeerror : import tensorflow tf tf.session() sess: queue = tf.train.string_input_producer([str(i) in range(10)], num_epochs=1) deq = queue.dequeue() coord = tf.train.coordinator() threads = tf.train.start_queue_runners(coord=coord) in range(3): print(sess.run([deq])) i'm using tensorflow 0.9 it needed tf.initialize_all_variables().run()