Posts

Showing posts from September, 2012

linux - Gawk not working correctly in finding min between 3 lines -

i have following gawk script: begin{ count = 0 imp = "" time = 0 } { if(count==0){ imp = $0 time = $7 count = 1 } else if(count==1 || count==2){ if($7 < time){ imp = $0 time = $7 } count+=1 } else{ count=0 print imp } } and bunch of files this: 1 57 0.850000 0.000010 0.784696 0.114561 0.670135 1 57 0.850000 0.000010 0.783619 0.114349 0.669270 1 57 0.850000 0.000010 0.725526 0.114805 0.610721 2 57 0.850000 0.000010 1.590584 0.102643 1.487942 2 57 0.850000 0.000010 1.291972 0.076006 1.215967 2 57 0.850000 0.000010 1.224136 0.063005 1.161131 4 57 0.850000 0.000010 0.679327 0.062899 0.616428 4 57 0.850000 0.000010 0.680867 0.062456 0.618411 4 57 0.850000 0.000010 0.684800 0.063411 0.621389 8 57 0.850000 0.000010 0.374985 0.063619 0.311367 8 57 0.850000 0.000010 0.401494 0.062838 0.338655 8 57 0.850000 0.000010 0.405216 0.064353 0.340

c# - Unity Facebook Canvas inject background image -

i have game made unity , facebook integrated.all works nice, cant change background image, dont know html :). can manualy developer tools in chrome, cant injecting code. have code. private void configurecanvas(){ debug.log("configure facebook canvas "); // inject top ads string injectionadsfacebook = "var headerelement = document.createelement('div'); " + "headerelement.id = ('adswebfacebook') ; " + "headerelement.textcontent = ('check out our other great games: ...');" + "headerelement.style.width = 400; " + "headerelement.style.height = 200; " + "headerelement.style.marginleft = (window.innerwidth - 400)/2;" + "headerelement.style.marginright = (window.innerwidth - 400)/2;" + "var body = document.getelementbyid('unitypl

excel - Plotting a line graph with a dynamic number of data rows -

Image
i trying plot line graph on summary sheet based on dynamic number of lines on weight tracking sheet (i.e. add row of data every day) i trying make line graph example (same colors etc.). right now, code compiles graph doesn't appear anywhere. here spreadsheet https://drive.google.com/file/d/0b1glubx-ronhsnjpddrftfvubda/edit?usp=sharing private sub weighttrackingchart() 'variable declaration dim long dim lastrow long dim wtchart shape dim ws worksheet 'find last used row lastrow = sheets("weight tracking").range("b3").end(xlup).row 'looping fifth row till last row has data = 6 lastrow 'prints chart summary sheet set ws = sheets("weight tracking") 'deletes old charts ' ws.shapes("wtchart").delete 'adds new chart sheet set wtchart = ws.shapes.addchart(xlline, 15, 750, 500, 400) 'sets chart name w

set chart height and width in c# -

Image
i have chart view in designer. looks this: but when i'm running app, height have 50%. look: how can move center or resize full height? solved: remove default chartarea1 , series1

osx - Java applications on Mac using Java7, have a limited window width -

i'm developing desktop application mac. when run application using java6 works fine, when run using java7, application window seems limited width 1024 pixels (i.e. when starts window 1024px wide, , can't expanded/dragged make wider). i've tried sorts of ways adjust size (setting window state maximized, explicitly setting width, etc.). i've tried changing set window size, far no luck. i have tried searching has had similar problems, have not had luck. real hit got otn discussion forum: https://community.oracle.com/thread/2617106 , there no resolution , discussion seems archived can't reply it. if out there has come across issue, i'd love hear it. environment: operating system: mac os x 10.7.5 java version: 1.7.0_55 (oracle corporation) new information: have found related bug report in openjdk: https://bugs.openjdk.java.net/browse/jdk-8046008?page=com.atlassian.jira.plugin.system.issuetabpanels:changehistory-tabpanel this seems indicate pr

java - Get index of objects in an array -

i trying find index of each object in array. public class monstertest { public static void main(string[] args) { // todo auto-generated method stub monster [] ma = new monster[3]; ma[0] = new vampire(); ma[1] = new dragon(); ma[2] = new monster(); for(int x = 0; x < 3; x++) { system.out.println(ma[x].getclass()); system.out.println(java.util.arrays.aslist(ma[x]).indexof(x)); ma[x].frighten(x); } } } am using java.util.arrays.aslist(array).indexof(element) method here correct? (well not because output incorrect. you have - it's x . don't need use such specific functions have. public class monstertest { public static void main(string[] args) { // todo auto-generated method stub monster [] ma = new monster[3]; ma[0] = new vampire(); ma[1] = new dragon(); ma[2] = new monster(); for(int x = 0; x < 3;

count mongodb in php -

i have collection user has 2 parameters (username,paid), username string , paid string too, should count how many users parameter paid="true" this try <?php $connection = new mongoclient(); $collection = $connection->ahmed->user; $cursor = $collection->find(); var_dump($collection->count()); var_dump($collection->count($cursor->paid=>"true"))); ?> if there expert in mongo help, :) the new driver not implement $cursor->count() use $collection->count() instead $collection->count($filter) in case: $filter = array('paid' => 'true')

c# - InvalidArgument exception on remove of item -

i have listbox1 in items collected. a timer1 start button1 click. and progressbar1 here complete code. private void button1_click(object sender, eventargs e) { timer1.enabled = true; timer1.interval = 500; progressbar1.maximum = listbox1.items.count; } private void timer1_tick(object sender, eventargs e) { x.send("<iq type='set' to='" + textbox6.text + "@conference.jabber.com'>" + "<query xmlns='http://jabber.org/protocol/muc#admin'>" + "<item jid='" + listbox1.items[0].tostring() + "@nimbuzz.com' affiliation='member'/></query></iq>"); listbox1.items.removeat(0); progressbar1.value += 1; groupbox4.text = listbox1.items.count.tostring(); } the code above runs when 0 item left in listbox1 progressbar1 stops there comes , error system.argumentoutofrangeexception unhandled message: invalida

How to install Azure cmdlets using powershell -

i'm trying install azure cmdlets using powershell, not wizard provided microsoft. that's because script (which has azure cmdlets) used in new virtual machine located in azure , if script try run cmdlet of azure, fail sure. i put installation lines of powershell cmdlets on top of script install whole cmdlets , after that, script execute other cmdlets without problem. so, knows? thanks! if have web platform installer in vm, can use script posted @ powershell magazine. http://www.powershellmagazine.com/2014/02/27/using-powershell-and-web-platform-installer-to-install-azure-powershell-cmdlets/ or windows standalone installer https://github.com/azure/azure-sdk-tools/releases , use msiexec install that. if want use powershell download latest version too: you can use invoke-webrequest read page ( https://github.com/azure/azure-sdk-tools/releases ) , links that. can links end .msi , take first link download. #code not tested $doc = invoke-webrequest 

javascript - How to get the particular cell value in JQgrid -

i have written jqgrid working fine need fill sub grid based on selected row of main grid. how can selected row cell value pass in url of subgrid. columns in main grid ---- id,firstname,lastname,gender. i need selected row of "id" value. here script $(document).ready(function () { jquery("#emptable").jqgrid({ datatype: 'json', url: "default1.aspx?x=getgriddata", mtype: 'post', ajaxgridoptions: { contenttype: 'application/json; charset=utf-8' }, serializegriddata: function (postdata) { return json.stringify(postdata); }, jsonreader: { repeatitems: false, root: "rows", page: "page", total: "total", records: "records" }, colnames: ['pid', 'first name', 'last name', 'gender'],

mysql - SQL: Application cross-db maintain only one generic schema -

i have application based on mysql schema based on innodb (with constraints...) co-workers need import schema, export schema in sql files. for example: drop table if exists `admins`; create table `admins` ( `id` smallint(5) unsigned not null auto_increment, `username` varchar(45) not null, `password` varchar(45) not null, `email` varchar(45) default null, `creation_date` datetime not null, `close_date` datetime default null, `close_reason` varchar(45) default null, primary key (`id`) ) engine=innodb default charset=utf8 auto_increment=4 ; now, have cross-db application, so: i tried import previous sql files in postgresql, didn't work, sql files mysql-related (for example use of ` character...) i tried export schema mysqldump , compatibility mode "--compatible=ansi" goal: have generic sql file compatible major sgbd. didn't work: postgresql returns error synthax compatible=ansi returns: drop table if exists "admins"; /*!40101

asp.net mvc - Ajax beginform() is not working -

i m trying load partial view in particular div using ajax form begin not working @ sametime please me while click submit button need load partial view div master page : <body> <form id="form1" runat="server" enctype="multipart/form-data" > <div> <div> <asp:contentplaceholder id="contentplaceholder2" runat="server">pagename</asp:contentplaceholder> <div id="content"> <div id="sidebar"> <asp:menu id="menubar" staticenabledefaultpopoutimage="false" runat="server" backcolor="black" dynamichorizontaloffset="2" font-names="arial" font-size="0.8em" forecolor="white" staticsubmenuindent="10px"> <dynamichoverstyle backcolor="white" forecolor="black" bordercolor="black&q

c# - Convert ICollection<Object> to another type ICollection<Person> using variable type of Type -

i try fill property type of icollection<person> or icollection<t> .i give objectlist type of list<object> or icollection<object> anyway can't set value property type of icollection<person> list of object if (property.propertytype.isgenerictype && property.propertytype.getgenerictypedefinition() == typeof(icollection<>)) { type itemtype = property.propertytype.getgenericarguments()[0]; icollection<object> objectlist =getobjectlist(); property.setvalue(item, objectlist); } thanks. you can't set icollection<person> icollection<object> since icollection isn't contravariant (there no in keyword in generic parameter declaration). you explicitly have cast collection of object person if (property.propertytype.isgenerictype && property.propertytype.getgenerictypedefinition() == typeof(icollection<>)) { type itemtype = property.propert

php - Laravel Fluent Query - property of non-object -

i working on displaying user active jobs , pending interviews on dashboard. can active jobs work, when try display pending interviews jobs, error: "trying error of non-object." error line: $jobinterviews->id here dashboard view: @if (! $active) <p> don't have active projects. click here post one! </p> @else @foreach($active $job) <div class="media-body"> display $job name/description </div> @if ($jobinterviews->id == $active->id) <table class="table table-striped"> display $jobinterviews details </table> @else <p></p> @endif </div> <!-- .media-body --> @endforeach @endif </div>

SQLite to replace fopen() -

i have heard sqlite designed replace fopen() ( 1 , 2 ) , hence faster read or write file disk in cases using sqlite rather fopen(). explain might cause it? assuming sqlite not use ram. i think don't quite "get" richard hipp means statement. of course under hood sqlite use fopen(3) system call, can not faster. rather opening raw file (e.g. fopen ) , implementing own structure , access functions (therefore ending implementing nih db @ point), better off using sqlite api optimized death , therefore faster come in reasonable time. of course applies when persisted data structures have complexity. simple files text files you're still better off fopen .

java - Changing the return value of a method -

this code asserting created class' method returns value returns right number. have insert own code [???] currently. class { int m() { return 1; } } public class exercise { public static void main(string [] arg) { a = [???]; assert a.m() == 2; } } how change return value of m method of class returns 2, not 1? i suppose need this: a = new a() { @override int m() {return 2;} };

java - Criteria to select b/w soap and restful ws and why rest is cacheable? -

i have read lot whats difference b/w soap , restful web services. have got specific doubts did not answers. here :- what goes in favor of restful web services in nutshell seems preferring restful web services on soap. main reason behind easy develop , understand. faster because of light weight data exchange format json. in performance in restful web services better because less data traveled on network(soap involves layer of saop message under http request). far good. accepted answer @ how restful web services better soap based webservices says rest naturally fits web/cloud api's, whilst soap fits distributed computing scenarios. i did not whats difference between web , distributed computing scenarios. web case of distributed computing scenarios. n't ? how come 1 better web while distributed scenarios ? (q1) what goes in favor of soap :- same answer says soap caters stateful operations . per understanding not true. if need maintain state need maintain

perl - Trouble Using ImageMagick - Installed Thru Homebrew -

i installed imagemagick thru homebrew - seems, anyways - when tested thru perl using perl -le 'use image::magick' i received error: cant load '/library/perl/5.12/darwin-thread-multi-2level/auto/image/magick/magick.bundle' module image::magick: dlopen(/library/perl/5.12/darwin-thread-multi-2level/auto/image/magick/magick.bundle, 1): library not loaded: /usr/local/lib/liblzma.5.dylib referenced from: /usr/local/lib/libmagickcore-6.q16.2.dylib reason: image not found @ /system/library/perl/5.12/darwin-thread-multi-2level/dynaloader.pm line 204. @ -e line 1 compilation failed in require @ -e line 1. begin failed--compilation aborted @ -e line 1. &image::magick::constant not defined. required imagemagick libraries not installed or not installed properly. end failed--call queue aborted @ -e line 1. i did research, , apparently perl not supported default when imagemagick installed through homebrew, tried installing perlmagick, imagemagick api perl. used f

android - EditText converting decimal to exponential -

i storing value in database 0.0004 , displaying same in edittext in edittext showing 4.0e-4 tried lot of things nothing seems work me. storing value in database fine when coming edittext display wrong. what have tried: increased size of edit text didn't solve problem. followed below process decimalformat formatter = new decimalformat("0.####"); textvalue.settext(real_formatter.format(new_percent.getlong(new_percent.getcolumnindex(bt.column2)))); but result same no chage. can 1 solve this..i want display in edit text 0.0004 not 4.0e-4 thanks time. instead of giving pattern bigdecimal send directly value constructor parameter. example: bigdecimal number = new bigdecimal("4.0e-4"); int ints= number.intvalue(); //bigdecimal integer double doubles= number.doublevalue(); //bigdecimal double

asp.net - How to use JSON.NET to serialize an array of objects -

i remember 1 of friends told me can throw json.net , serialize them json format. public string getrecords(string apikey, datetime start, datetime end) { var user = db.users.singleordefault(u => u.id == apikey); if (user == null) { return string.empty; } var records = db.histories.where(h => h.date >= start && h.date <= end); javascriptserializer s = new javascriptserializer(); return jsonconvert.serializeobject(records); } but got exception: there open datareader associated command must closed first. please help. call .tolist() on records, before passing jsonconvert.serializeobject

php - Undefined property: CI::$session -

i having trouble loading model on login page. has problem sessions on here. have security class helper $key part of it. think session error says. i think have set num rows correct not sure if may cause of it. a php error encountered severity: notice message: undefined property: ci::$session filename: core/model.php line number: 51 model <?php if ( ! defined('basepath')) exit('no direct script access allowed'); class users_model extends ci_model { private $user_id; private $username; private $permission = array(); public function __construct() { if (isset($this->session->userdata['user_id'])) { $user_query = $this->db->query("select * " . $this->input->post('dbprefix') . "user user_id = '" . (int)$this->session->userdata['user_id'] . "' , status = '1'"); if ($user_query->num_rows) { $this->

shared libraries - 'Can't find hdf5 library' while installing netCDF4 -

i trying build netcdf4 source on macosx. when run ./configure error: checking library containing h5fflush... no configure: error: can't find or link hdf5 library. use --disable-netcdf-4, or see config.log errors. i installed hdf5 before, , set environment variables as: ldflags=-l/opt/local/lib cppflags=-i/opt/local/include in /opt/local/lib have these files: libhdf5.8.dylib libhdf5.a libhdf5.dylib libhdf5.settings libhdf5_cpp.8.dylib libhdf5_cpp.a libhdf5_cpp.dylib libhdf5_hl.8.dylib libhdf5_hl.a libhdf5_hl.dylib libhdf5_hl_cpp.8.dylib libhdf5_hl_cpp.a libhdf5_hl_cpp.dylib and in /opt/local/include have: hdf5.h hdf5_hl.h why doesn't configure script find hdf5 library? happy provide more information if needed! edit: ultimate goal install netcdf4 use fortran module. have tried installing through macpor

mysql - Getting a Variable From a Database via an SQL Command -

here code: $result1 = mysqli_query($con, "insert third (id2, language, divid, point, ce, datetime, ip) values ('$id2', '$language', '$new_divid', 0, 'b', now(), '$ipaddress')"); in code ( mysql ) add new line database , didn't add id1 column it, cause id1 auto-increment in table - adds id1 automatically. now trying tp id1 back, inside same sql command don't want use php again , again. possible? note: saw output inserted.id1 didn't understand , whether can use it. ( i saw in question )

c# - How to unit test task from private method -

i have method (some code removed): try { var task = task.factory.startnew(validateaccounts, _token); } catch (aggregateexception) { _tokensource = new cancellationtokensource(); _token = _tokensource.token; } validateaccounts private method withing same class. test called , able mock task , try exception thrown , without it. as others have mentioned, have careful when treading fine line of what-to-test vs. what- not -to-test. can lead brittle tests coupled implementation. that being said, absolutely see utility in doing you're trying do. testing exception handling alone worth asking question. the problem rooted in use of static object ( task.factory ). static objects/methods notorious impeding testability. solution problem same used decoupling any type of static object - introducing seam . you using static object kick off, , return reference to, task . can define role interface for. might like: public interface itaskfactory { task startnew(a

locale - Kerberos credentials cache reported differently in Debian Squeeze and Debian Wheezy -

i have 2 debian servers use same ldap/kerberos server, dates in output of klist on them shown in different format - m/d/y on squeeze vs d/m/y on wheezy. is there way change on wheezy m/d/y format well? locale settings - squeeze user@squeeze:~ > locale -a c en_us.utf8 posix user@squeeze:~ > locale -ck lc_time lc_time abday="sun;mon;tue;wed;thu;fri;sat" day="sunday;monday;tuesday;wednesday;thursday;friday;saturday" abmon="jan;feb;mar;apr;may;jun;jul;aug;sep;oct;nov;dec" mon="january;february;march;april;may;june;july;august;september;october;november;december" am_pm="am;pm" d_t_fmt="%a %d %b %y %r %z" d_fmt="%m/%d/%y" t_fmt="%r" t_fmt_ampm="%i:%m:%s %p" era= era_year="" era_d_fmt="" alt_digits= era_d_t_fmt="" era_t_fmt="" time-era-num-entries=0 time-era-entries="s" week-ndays=7 week-1stday=19971130 week-1stweek=7 first_weekday=1 first

android - Recommended workflow for making a Google Play application available to in-house testers -

i working on android application (published in google play), undergoes great deal of bug fixing right now, , results in plenitude of versions need being tested, more not - simultaneously. at first wanted use alpha testing feature means exposing these versions in-house testers, seems 1 version of app (ie. 1 bugfix) can published alpha @ 1 time. is correct? or there way allow testers pick between various alphas install? if approach wrong, what's way should done? uploading apks on server , sharing links testers? your apha testing program can done in 2 ways: distribute apk through play store alpha release. catch cannot have users choose apks testing. can have 1 @ time although can upload multiple apks[you asked deactivate active apk]. distribute apks through server. add password protection , all. recommended option number 2 if you're interested in testing different versions overall.

oop - Table-driven factory vs inheritance -

i have bunch of derived classes differ static methods. (it's ruby, question not ruby, it's design.) class exporter def export # ... end end class exportera < exporter def 'aaa_table' end def fields ['a1', 'a2', 'a3'] end def 'aaa_file' end end class exporterb < exporter def 'bbb_table' end def fields ['b1', 'b2', 'b3'] end def 'bbb_file' end end so, looked @ , came idea of placing static data kind of table , use exporter appropriate attributes. in case, need kind of exporterfactory class going know who , how create , b exporters. class exporterfactory def _table return { :a => { :from => 'aaa_table', :fields => ['a1', 'a2', 'a3'], :to => 'aaa_file', }, :b => { :from => 'bbb_table', :fields =

java - How to ensure execution order -

what different ways , best way ensure order of execution when different database operations involved , 1 operations depends on other operations. in code this: string countryname = "name"; country countryobj = new country(); countryobj.setname(countryname); countryobj.setstates(new arraylist<state>()); // update database persistencemanager manager = new persistencemanager(); list<country> countries = manager.getallcountries(); if (countries != null && !countries.isempty()) { (country country2 : countries) { if (country2.getname().equalsignorecase(countryname)) { return; } } } manager.savecountry(countryobj, country); here manager.getallcountries() retrieves countries database , manager.savecountry depends on previous operation i think need start point of looking @ modeling data use atomic operations . what describing insert data if not present. upsert , looking logic if country ex

javascript - How to submit a sucessful post request using the MEAN stack? -

Image
ok, i'm using yeoman scaffold project. in end want learn scaffold crud. i'm getting stuck on post request. i've picked angular-fullstack generator because i'm comfortable normal angular-generator. my post request attempts being hulled 400 error while trying submit new object things collection. i'm pretty lost, need see completed code of post request using folder structure. update: 400 error gone however, req.body. update2: working answers both in code , answer. so, using angular-fullstack generator of yeoman, how make post request create awesomething in thing collection of mongo db. i'm surely missing think of pieces needed make post request successful presented below. direction appreciated. app/views/partials/main.html <div class="row marketing"> <div ng-repeat="thing in awesomethings"> <h4>{{thing.name}}</h4> <p>{{thing.info}}</p> </div> </div>

ember.js - ember data hasMany relationship -

http://jsbin.com/eveqoke/150/edit my payload looks this: var customers = { "customers":[ {"id":3,"name":"joe","bio":"some tex","contact":"ny"}, {"id":2,"name":"rox","bio":"mo' tex","contact":"la"} ] }; var orders = { "orders":[ {"id":1,"customer":3,"amount":20}, {"id":2,"customer":3,"amount":60} ] }; obviously wont work, have serialzer http://mozmonkey.com/2013/12/loading-json-with-embedded-records-into-ember-data-1-0-0-beta/ works fine far, expet hasmany relationships. is possible ember's store automatically detects relation btw 2 models? or has embedded?

linux - Python application becomes non-responsive due to subprocess -

i have written python application, using flask, serves simple website can use start playback of streaming video on raspberry pi (microcomputer). essentially, application allows use phone or tablet remote control. i tested application on mac os, , works fine. after deploying raspberry pi (with raspbian variant of debian installed), serves website fine, , starting playback works expected. but, stopping playback fails. relevant code hosted here: https://github.com/lcvisser/mlbviewer-remote/blob/master/remote/mlbviewer-remote.py the subprocess started this: cmd = 'python2.7 mlbplay.py v=%s j=%s/%s/%s i=t1' % (team, mm, dd, yy) player = subprocess.popen(cmd, shell=true, bufsize=-1, cwd=sys.argv[1]) this works fine. the subprocess supposed stop after this: player.send_signal(signal.sigint) player.communicate() this does work on mac os, not work on raspberry pi: application hangs until subprocess (started cmd ) finished itself. seems sigint not sent or not recei

How to restore a GIT repository to a server from a client -

i have synology ds212j nas running gitolite , git on it. ds212j corrupted virus , through process of cleaning it, nas lost , formatted. have up-to-date git repo on laptop , want start on over ds212j , push including of checkins , history repo on ds212j. there way accomplish task? as long have local copy can set empty git repository on server (in example gitolite instance on nas), update remote-url in local copy , push remote. so in single steps: set gitolite set project in gitolite instance (if required) change remote url (see git remote set-url ) in local copy do git push newly created remote (maybe multiple branches) after have exact copy of local on remote (your nas).

http - Is it possible to use nested resource in case of POST? -

i use play framework 2.2.x. is possible map route?: post /api/constructors/:constructorid/cars carcrudcontroller.create(constructorid) i badrequest (code 400) when hitting route. imo, seems play allows nested resources reads: get instead of post . is possible? nested routes supported in http method. can checkout samples github examples. computer-database example, has following routes.conf: # delete computer post /computers/:id/delete controllers.application.delete(id:long) the bad request response related content-type of request or post content itself, , nothing nested routes.

amazon web services - Elastic Beanstalk and Cron tasks not sure if its working with Yii -

i having problem getting simple cron task set on elastic beanstalk. have found of other questions on here useful, still can't seem cron execute. unsure if aws issue, or if script not executing. script set inside yii console command. not finding php errors, , ec2 instance loaded without errors. here have done far: i have created folder on root of application called .ebextensions. within folder have created configuration file contents # installing dos2unix in case files edited on windows pc packages: yum: dos2unix: [] container_commands: 01-command: command: dos2unix -k cron_setup.sh 02-command: command: chmod 700 cron_setup.sh 03-command: command: "cat .ebextensions/cron_task.txt > /etc/cron.d/cron_task && chmod 644 /etc/cron.d/cron_task" # leader_only prevents problems when eb auto-scales leader_only: true the file cron_task.txt exists inside .ebexte

ssl - Can i create users with passwords in openldap on non secure port 389 -

i working on application need create user passwords within open ldap. problem don't have relevant certificate can add truststore. certificate in time can't wait that. i know in active directory if want such thing must have 128 bit ssl connection between client , server , have use unicodepwd attribute guessing open ldap don't need ssl connection , password saved in attribute userpassword can add user password on port 389. assumptions correct? can please point me setup openldap on windows environment used own tests. thanks i guessing open ldap don't need ssl connection , password saved in attribute userpassword can add user password on port 389. assumptions correct? yes, can it, isn't advisable, transmitting passwords in plaintext. should go yard , set ssl well, on port 636, or starttls option on port 389 if port conservation issue. can please point me setup openldap on windows environment used own tests. it's documented @ http://op

c# - WPF combobox update other combobox based on selection of first one -

my wpf application has 2 comboboxes follows <combobox height="23" name="projectnamecombobox" width="215" itemssource="{binding}" displaymemberpath="name" selectionchanged="projectselection_changed" /> <combobox height="25" name="langaugecombobox" width="108" itemssource="{binding}" displaymemberpath="name" /> and code behind binding using database as projectnamecombobox.datacontext = dbconnector.getprojectnames(); langaugecombobox.datacontext = dbconnector.getlanguages(); project combobox contains list of projects langauges combobox contains list of langauges. i want updated langauges combobox based on project selection. based on project selection able langauges project database, how set in langauge combobox. langaugecombobox.selectedvalue = dt.rows[0][0].tostring(); not working. and suggestion/help? i advice start migrating events

ios - Returning method object from inside block -

i wondering how following correctly: have method return nsdata object. gets nsdata object uidocument . nsdata object can large, want make sure loaded before response starts. therefore return value of method within block itself. this: - (nsdata*)getmydata { myuidocument *doc = [[myuidocument alloc] initwithfileurl:fileurl]; [doc openwithcompletionhandler:^(bool success) { if (success) { return doc.myresponsedata; // return method not block } }]; } this causes error because return apparently refers block 's return . how can accomplish without having make thread blocking wait/while loop? thanks. you can't. embrace fact you're trying asynchronous , add completion block parameter getmydata method called when inner completion handler called. (and remove return method signature): - (void)getmydatawithcompletion:(void(^)(nsdata *data))completion { myuidocument *doc = [[myuidocument alloc] initwithfileurl:fileurl]; [doc openw

Elasticsearch 1.3. - Call custom REST endpoint from Java -

i building elasticsearch plugin exposes rest endpoint ( starting post ) i can call endpoint curl : curl -x post 'http://my-es:9200/lt-dev_terminology_v1/english/_terminology?pretty=-d '{ "segment": "database", "analyzer": "en_analyzer" } my question how can call same endpoint java , using transport client ? point me tutorial ? i suggest take here . should starting point you. let me sum : considering following parameters : string clustername = "..."; string clienttransporthost = "..."; integer clienttransportport= "..."; string clientindex = "..."; string indextype = "..."; of course replace dots settings wish use. then define cluster settings : settings settings = immutablesettings.settingsbuilder() .put("cluster.name", clustername).build(); you instantiate transportclient object : transportclient client = new transportc

algorithm - Standard Java queue data structure with time qouta? -

in order implement service limits of request count per time quantity implementation of queue reject adding elements if enqueue()/add() command exceeded frequency rate? so example can call enqueue()/add() no more 1000 times per second , prevent high resource consuming service ddos. also queue must reject enqueue()/add() if queue capacity exceeded (until call dequeue()/remove() ). one simple way implement check following whenever new enqueue / add operation requested: check whether queue full check whether time since last enqueue operation > 1/1000 seconds. 2a) can modify point 2 above keeping time stamp of 1000 latest enqueue operations. whenever enqueue operation requested, check time since first operation made in queue. if more 1 second, pop out operation time stamp queue , add one.

javascript - Popup script and content script can't communicate? -

my problem can't seem message chrome.extension.sendmessage("on"); popup.js transfer content.js. code popup.js: function click(e) { if ( e.target.id == "green"){ chrome.extension.sendmessage("start"); console.info("on"); return; } if ( e.target.id == "red"){ chrome.extension.sendmessage("stop"); console.info("off"); return; } } the popup.js receives message when add listener code. content.js can't seem it. code content.js: chrome.extension.onmessage.addlistener( function(request, sender, sendresponse) { console.info("ok"); } ); manifest: "content_scripts": [ { "matches": ["<all_urls>"], "js": ["content.js"], "run_at": "document_end" } ], any appreciated. chrome.extension.sendmessage non-canonical name.

embedded - A standard protocol for exchanging logs and commands between device and PC? -

here's problem: i've embedded device uses serial or usb send logs , accept commands. prints logs text , has simple cli commands can typed. i'd change it, data send/received binary . there standard protocols designed purpose of sending logs/commands/other type of data? i'm not aware of nor found suitable want sure before inventing wheel ;) edit ok i've edited question because fact data binary no relevant here. so far closest i've found android debug bridge protocol . the min protocol designed small 8-bit microcontroller limited ram talk device on standard serial link. i've documented "hello world" program running on arduino talking pc using ftdi serial-to-usb chip here: https://kentindell.wordpress.com/2015/02/18/micrcontroller-interconnect-network-min-version-1-0/ it's binary protocol payload 0-15 bytes. i've used min carry not binary sensor data ascii data within payload field , pc log ascii file.

Maxima - internal numeric representation ruins calculation -

how can tell maxima solve following problem? (the "solve" part): i did: load(distrib); fpprec: 100; bftorat:true; solve(2*bfloat(cdf_normal(x,0,1))-1=0.99999999999999999968130594071b0, [x]); %,numer got: (%o1) "/usr/share/maxima/5.32.1/share/distrib/distrib.mac" (%o2) 100 (%o3) true `rat' replaced -1.99999999999999999968130594071b0 -199999999999999999968130594071/100000000000000000000000000000 = -1.99999999999999999968130594071b0 `rat' replaced 5.0b-1 1/2 = 5.0b-1 `rat' replaced 5.0b-1 1/2 = 5.0b-1 `rat' replaced 7.071067811865475244008443621048490392848359376884740365883398689953662392310535194251937671638207864b-1 118807941462947422469655519336079782367473013592460/168019802134529020067676914738440478110633605571601 = 7.071067811865475244008443621048490392848359376884740365883398689953662392310535194251937671638207864b-1 `rat' replaced 7.071067811865475244008443621048490392848359376884740365883398689953662392310535194251937671638207

Jenkins "Execute Shell Script" vars needed in post-build action specifically in send email body? -

so set vars in execute shell script build action use in post-build action send email's body. possible without using plugins? if not possible without plugins plugins should use? much, not possible without plugins because: execute shell script , post-build actions run in separate environment sessions, had been set in former not available in latter. what need envinject plugin . in execute shell script step, instead of setting environment variable, write key-value pair file, example myvar=somevalue . add build step, called inject environment variables job . give location of file key-value pair. now variable available environment variable rest of job run (including other build steps , post-build steps).

javascript - AngularJS : Creating custom filter for decimal points -

i trying convert below js code re-usable angularjs filter var = 1.1230000, b = a.tofixed(15).replace(/\.?0+$/, ""); // ==> 1.123 i have created below code(angularjs) angular.module('myapp.filters', []).filter('fixed', [function () { return function(input) { return input = input.tofixed(15).replace(/\.?0+$/, ""); }; }]); and invoked new filter module var myapp = angular.module('myapp', ['fixed']); but displays error: [$injector:modulerr] http://errors.angularjs.org/1.2.16/ $injector/modulerr?p0=myapp&p1=%5b%24injector%3amodulerr%5d%20http%3a%2f%2ferrors.angularjs.org%......... am missing , sorry mistake. help. update - added jsbin url you don't need inject components part of module. myapp.filter('filtertofixed in module myapp.

android - Saving images to my own directory? image to fit Screen Size? -

i implementing wallpaper app. has lot of images of 100. 1) want save images in gallery seperate folder. 2) when set wallpaper size image zooms ,how fit screen size? i used mediastore.images.media.insertimage(getcontentresolver(), yourbitmap, yourtitle ,yourdescription); it stores in folder named camera, need own directoy name. i tried many things , many searches fitting image screen size i used display metrics bitmap bmap2 =bitmapfactory.decodestream(getresources().openrawresource(r.drawable.paper)); displaymetrics metrics = new displaymetrics(); getwindowmanager().getdefaultdisplay().getmetrics(metrics); int height = metrics.heightpixels; int width = metrics.widthpixels; bitmap bitmap = bitmap.createscaledbitmap(bmap2, width, height, true); wallpapermanager wallpapermanager = wallpapermanager.getinstance(mainactivity.this); try { wallpapermanager.setbitmap(bitmap); } catch (ioexception e) { e.printstacktrace(); } and other dispaly metrics