Posts

Showing posts from April, 2013

c# - DataBinding to Charts -

i trying create charts c# .net 4.0 winforms application. have begun pie-chart. there way use databinding in order keep chart updated? so far have managed use datapoint.yvalues property change chart's appearance. the series object has got datasource property, not sure how use datasource single points (which inside list, inside series property). i hope explain question detailed enough. ps: charts system.forms.datavisualization.charting namespace.

java - Class could not be loaded or is not persistent: scala.collection.immutable.List in Berkeley DB JE -

when use berkeley db je in scala project, define entity list member. when run project, throws exception telling class not loaded or not persistent: scala.collection.immutable.list . how can solve problem? or convert scala list java.util.list? i found answer myself. berkeley db je not support list of scala, , supports java.util.list. using following statement change scala list java list works. import scala.collection.javaconverters._ val sl = list(...) val jl = new java.util.arraylist(sl.asjava) passing jl berkeley db je using dpl solves problem. thanks.

java - Make JFrame not repaint -

im trying not repaint window in java. have: public void paint(graphics g) { super.paint(g); graphics2d g2d = (graphics2d) g; g2d.setrenderinghint(renderinghints.key_antialiasing, renderinghints.value_antialias_on); ball.paint(g2d); } and in main: while (true) { game.move(); game.repaint(); thread.sleep(10); } my jframe window , have tried window.setignorerepaint(true); there no change. give me hand? thank :) while (true) { game.move(); game.repaint(); thread.sleep(10); } must replaced with timer t=new timer(10,new actionlistener() { public void actionperformed(actionevent e) { game.move(); game.repaint(); } }); t.start(); and override paintcomponent() of content pane.

c# - Cannot interact with items on the adorner layer -

Image
the above image example of options menu in ms word 2010 when click on text box on document. trying implement similar using adorners in wpf , struggling implementation. i have created 2 adorners called optionsbuttonadorner , advancedoptionsadorner. when click on item on canvas show optionsbuttonadorner little sliding animation , when click on optionsbuttonadorner show advancedoptionsadorner same sliding animation. got above tasking working , system renders both adorners correctly above picture. but complicated part if try put inside advancedoptionsadorner, can disaplay button inside adorner not getting hittest on button (same other control if try put testbox cannot focus or interact it). if use snoop @ objects, can see button , textbox enabled , hittest set true. looking bit further getting mousedown events on canvas iteself rather adorner objects. thinking if approach wrong. below sample code advancedoptionsadorner thanks , sorry such long post. public designeritemadvance...

.net - PostAndAsyncReply deadlock on exception -

given 2 agents, communicates sending messages: agent 1 sends postandasyncreply agent 2, waiting result. agent 2 starts processing message, throws exception. now agent 1 deadlocked, since no reply ever sent agent 1. see it, there 2 ways handle such scenario: i set timeout postandasyncreply , since operation long running, time takes execute differs. wrap code in agent 2 in try..catch , , reply value indicates error. however, mean code handles messages replychannel, needs wrapped inside try..catch , seems.. cumbersome. how 1 go around handling such scenario? you have higher-order function alleviates try...catch : let replyorfail (chan: asyncreplychannel<option<'t>>) (action: async<'t>) : async<unit> = async { try let! reply = action return chan.reply (some reply) _ -> return chan.reply none } let agent2 = (* declare mailbox... *) (* matching receive...

java - Frequency List (ArrayList or LinkedList) with items over 700,000 -

i have list contains elements of person data type. best way , less consumption of time, find frequency of each element in list. the following things have tried, results in time beyond 10min on i7, 8gb arraylist<string> frequent = new arraylist<>(); (person e: mylist2) { int frequency = 0; //int frequency = collections.frequency(mylist2, e); (person e : mylist2) { if (e.getpassname().equals(e.getpassname())) frequency++; } if (frequency >= times) frequent.add(e.getpassname()); } also, collections results value 1, if there duplicates in linkedlist. use map<person, integer> store frequency: map<person, integer> frequency = new hashmap<person, integer>(); (person person: mylist2) { if (frequency.containskey(person)) { frequency.put(person, frequency.get(person) + 1); } else { frequency.put(person, 1); ...

java - Selectively expand associations in Spring Data Rest response -

i have standard spring data jpa , spring data rest setup which, correctly, returns associations links correct resources. { "id": 1, "version": 2, "date": "2011-11-22", "description": "xpto", "_links": { "self": { "href": "http://localhost:8000/api/domain/1" }, "otherdomain": { "href": "http://localhost:8000/api/domain/1/otherdomain" } } } however in some requests have association "otherdomain" expanded (so client not have n+1 requests full data). is possible configure spring data rest handle response in way? the default responses have stay same make sure payloads put requests symmetric ones get s return. however, spring data rest introduces feature called projections (see jira ticket details) works follows: you create dedicated interface , add...

javascript - JQuery UI sortable bug when drop place is hidden -

i've come upon strange bug, it's hard describe, made this: http://i.imgur.com/zoydgmd.gif basically, can't sort item bottom "trash place", until go through column. what heck happening? what i'm doing wrong? bug? you can find source here: http://github.com/mmajko/inpro/tree/develop i'm not allowed post more 2 links, can find: html file in /app/templates/home/default.latte js file in /www/js/main.js thank :)

java - login unsuccessfull on clicking button? -

i have table: create table user1(username varchar2(20) , first_name varchar2(20) , last_name varchar2(20) , password varchar2(20) , date_of_birth date ) following jdbc code:: if(e.getsource()==submit) { connection con=null; resultset rs=null; preparedstatement st=null; try { class.forname("oracle.jdbc.oracledriver"); con=drivermanager.getconnection("jdbc:oracle:thin:@localhost:1522:xe", "hr", "hr"); st=con.preparestatement("select count(1) user1 username = ? , password = ? "); //st.setparameter(1, text1.gettext()); //st.setparameter(2, p1.gettext()); st.setstring(1,text1.gettext()); st.setstring(2,text1.gettext()); rs= st.executequery(); //string t1=text1.gettext(); //string t2= p1.gettext(); while(rs.next()) { if (rs.getint(1) ...

linux - Shell Script - SFTP -> If copied, remove? -

iam trying copy textfiles shellscript on sftp. wrote script job. #!/bin/bash host='servername' user='username' sftp -b - ${user}@${host} << eofftp /files/*.txt /tmp/ftpfiles/ rm /files/*.txt quit eofftp before remove textfiles on ftp, want make sure, copied files without errors. how can this? use ssh-keys login. task is: copy textfiles on , on make sure, not same ones... (thats why use remove...) maybe move them on ftp? copy , move /files/copied ? actually, rsync ideal this: rsync --remove-source-files ${user}@${host}:/files/*.txt /tmp/ftpfiles/

Javascript: Email regex with min lenght and not max lenght -

this question has answer here: how validate email address in javascript? 65 answers i have regex on javascript: new regexp('^[0-9a-z._-]+@{1}[0-9a-z.-]{2,}[.]{1}[a-z]{2,}$','i'); and want modify it. last part of mail must have minimum value : 2 chars , no maximum length can put mails such .localhost .paris .thisismyexample ... how may do? thank answers new regexp('\b[a-z0-9._%+-]+@(?:[a-z0-9-]+\.)+[a-z]{2,}\b','i');

php - Free Radius + Captive Portal + MySql No valid RADIUS responses received -

my captiveportal shows strange behavior. occasionally (2-3 times in 5-6 days) returns standard php error exhausted allowed memory size. logs says in moment freeradius not answer error sending request: no valid radius responses received that why captiveportal not work. why happens? this error disappear if restart freeradius , captiveportal. i know mysql , available. my installation pfsense 2.1-release (amd64), memory 2 gb freeradius + mysql +captiveportal any idea, please? it due high resource utilization, try increase memory_limit variable in php.ini. you should see if there memory leaks in application, executing section hogs memory,and try optimise that

asp.net - How do I make asp menu extend to the end of the page when scrolling? -

i have horizontal asp menu in div. div set set width:100% fills width of page, when page can horizontally scrolled div doesn't extend end of page. have tried setting min-width%:100%; in css of div, doesn't make difference. can me solve problem telling me how make div fill out width of page when page can horizontal scrolled. using css 2.1 , asp.net 2.0 the code div is: <div class="clear hideskiplink"> <asp:menu id="navigationmenu" runat="server" cssclass="menu" enableviewstate="false" orientation="horizontal"> <staticmenuitemstyle itemspacing="30"/> <statichoverstyle backcolor="darkgray" bordercolor="black" borderstyle="solid" borderwidth="1"></statichoverstyle> <items> <asp:menuitem navigateurl="~/home.aspx...

angularjs - How to loading indicator in angular service -

i need make show user ajax request still being executed. i have angular module: var mymodule = angular.module('mymodule', [ 'ngroute', 'ngcookies', 'localization', 'mycontrollers', 'myservices' ]); my service looks like: var myservices = angular.module('myservices', ['ngresource']); myservices.factory('myinfo', ['$resource',function($resource){ return $resource('/api/:method', {}, { getsettings: {method:'post', params:{method:'get_my_settings'}}, getinfo: {method:'post',params:{method:'get_my_info'}} }); }]); and controller: var mycontrollers = angular.module('mycontrollers', []); mycontrollers.controller('somectrl', ['$scope', 'myinfo', function($scope, myinfo) { $scope.myinfo = myinfo.getinfo(); } ]); everything works fine! how can start doing action before send...

ios - Core Data and NSSortDescriptor - memory basics -

i'm trying sort on core data entity's relation. instance there employee object , has departments relationship. i nsfetchrequest of employee i write method take out departments ( nsset ) , gets me sorted departments the code i'm using following. [temparray sortedarrayusingdescriptors:[nsarray arraywithobject:sortdescriptor]]; i see memory getting retained after sometime , core data object in getting retained after long time. i removed line thinking reason //[moc setretainsregisteredobjects:yes]; but not helping. want understand objects method on nsset of core data object cause bump in memory , sortedarrayusingdescriptors deep copy? know shallow copy, please confirm , logical reason memory getting retained after usage of array of object got using sortedarrayusingdescriptors . as stated in comment, should provide context question. so, did see behavior in instrument? anyway, instead of fetching , sorting, can fetch and, @ same time, sort (thro...

regex - Finding all the ten different digits in a random string -

sorry if answered somewhere, couldn't find it. i need write regexp matches on strings contain digits 0 9 once. example: e8v5i0l9ny3hw1f24z7q6 you can see numbers [0-9] present once , in random order. (letters present once, advanced quest...) must not match if digit missing or if digit present more 1 time. so best regexp match on strings these? still learning regex , couldn't find solution. pcre, running in perl environment, cannot use perl, regex part of it. sorry english , thank in advance. what pattern verify string: ^\d*(?>(\d)(?!.*\1)\d*){10}$ ^\d* starts amount of characters, no digit (?>(\d)(?!.*\1)\d*){10} followed 10x: digit (captured in first capturing group), if captured digit not ahead, followed amount of \d non-digits, using negative lookahead . 10x digit, not ahead consecutive should result in 10 different [0-9] . \d shorthand [0-9] , \d negation [^0-9] test @ regex101 , regex faq if need digit-string then, extract...

java - Creating and Selecting from a Named Window -

i have esper running locally , feeding in (via xml) handful of epl statements - <?xml version="1.0" encoding="utf-8"?> <statements> <statement> create window ordereventwindow.win:keepall() select * orderevent </statement> <statement> @name("ordereventsfromwindow") @description("outputs order events window") select * ordereventwindow </statement> <statement> @name("ordereventsfromdirect") @description("outputs order events feed") select * orderevent </statement> </statements> this appears go in fine without errors. however, issue appears though above statement called "ordereventsfromwindow" not running see no results being output (despite events of type orderevent coming in). what strange other statement "ordereventsfromdirect" working expected. any idea might doi...

java - Multiple ImageButtons with setOnClickListener (clicks but does not launch activities) -

i have managed start 2 activities using imagebutton along .setonclicklistener tied it, have included layouts different imagebuttons. each button launches activity. have created activities. have managed remover crash bugs, lint errors, have latest android sdk. buttons stop working though hear click. neither activity launches on first imagebutton nor second one. this happens moment put multiple imagebuttons in. works 1 button. suspect (this) command in class confused call. intent call method start new activities streamlined , basic quick, uncomplicated access. can please me why multiple setonclicklistener cannot tied relevant imagebuttons please? import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.content.intent; import android.view.view.onclicklistener; import android.widget.imagebutton; public class mainactivity extends actionbaractivity implements onclickl...

ms access - Move values from 1 column to multiple rows organized by a unique identifier MSAccess/SQL -

sql newbie here. have work task i'm trying expidite using msaccess/sql familiar with! i have spreadsheet on 6000 unique rows looks this: | sampleid | unique id | | 123 | abc | | 124 | abc | | 125 | abc | | 456 | def | | 457 | def | | 458 | def | | 789 | ghi | | 790 | ghi | | 791 | ghi | | 792 | ghi | and i'd move values sampleid individual columns, based on uniqueid , so: | uniqueid | sampleid1 | sampleid2 | sampleid3 | sampleid4 | | abc | 123 | 124 | 125 | | | def | 456 | 457 | 458 | | | ghi | 789 | 790 | 791 | 792 | i'm attempting in sql/msaccess using queries on imported excel table has on 6000 rows. i've managed count maximum number samples per uniqueid : 55. is there way use pivot based grouped uniqueid? how should / how msaccess/sql handle null values? you can use pivot same... se...

asp.net - Cannot get update panel to update datalist -

i have following code , have tried putting timer inside , outside update panel data list not update: contenttemplate> <asp:timer id="timer1" runat="server" interval="1000" ontick="timer1_tick"></asp:timer> <asp:datalist id="datalist3" runat="server" bordercolor="gray" borderwidth="0px" datasourceid="sqldatasource2" font-bold="false" font-italic="false" font-names="calibri light" font-overline="false" font-size="small" font-strikeout="false" font-underline="false" gridlines="horizontal" width="441px"> <itemtemplate> &nbsp;<asp:label id="datelabel" runat="server" text='<%# eval("date", "{0:d}") %>' /> <br /...

java - how to print object value with String method -

i have abstract class public abstract class temperature { private float value; public temperature(float v) { value = v; } public final float getvalue() { return value; } public abstract temperature tocelsius(); public abstract temperature tofahrenheit(); public abstract temperature tokelvin(); } then have classes extend temperature class, example: public class celsius extends temperature { public celsius(float t) { super(t); } public string tostring() { return ""; } @override public temperature tocelsius() { // todo auto-generated method stub return this; } public temperature tokelvin(){ return new kelvin(this.getvalue() + 273); } @override public temperature tofahrenheit() { // todo auto-generated method stub return new fahrenheit(this.getvalue() * 9 / 5 +32); } } main method creates objects of of celcius temperature inputtemp = null, outputtemp = null; inputtemp = new celsius(temp_val); output...

c# - Pechkin with Windows Azure -

Image
i'm getting error whenever try debug azure project visual studio. checked on original site project file platform target , project's , every dependence using "any cpu". not sure here. could not load file or assembly 'pechkin' or 1 of dependencies. are running 32 bit allowed? lots of docs out there talk being limitation. mark answer please if problem. there solutions well. apparently guy did fork called tuespechkin 64 bit versions.

XML android file root element not visible -

hello new android. following this tutorial but can't find same window shown @ second 7.58. if go on "add">>"xml android file " can see windows of xml android file/layout in root element display nothing shown. have android 4.2 . this may due couple of reasons . might have missed required property. due shows xml window whole view not visible (but warn well). or sometimes may case when view dynamically used in case of tutorial . in listview values in run time won't see view in xml file , can use emulator or phone check if view appears on runtime. try running project . hope helps :)

html - Whitespace to right when I check website on my galaxy s4 -

i can't seem rid of whitespace right of content when view on galaxy s4. ok when minimize browser. suggestions? also, mailing address icon, email, , phone icons don't line-up in center exactly. http://www.henschen.com/sitetemplates/2014-16/ @media handheld, screen , (max-width: 767px) { body { width: 100%; height: 100%; overflow-x: hidden; } .grid { display:inline-block; text-align:center; } .grid-pad { background-color: transparent; display:inline-block; text-align:center; } .gridcontent { background-color: #fff; } .wrap { width: 100%; height: 100%; overflow-x: hidden; } .grid-padcontent { display: block; } .gridcontent { display: block; } [class*='col-'] { width: auto; float: none; margin-left: 0px; margin-right: 0px; margin-top: 10px; margin-bottom: 10px; padding-left: 20px; padding-right: 20px; } ...

dsl - How do I import python scripts that have a custom extension instead of default .py? -

this question has answer here: import python module without .py extension 5 answers i have 'test engine' (which big python script defines lot of functions) can run multiple 'test suites' (which python scripts, uses functions test-engine define custom tests). it intended test-cases should written non-programmers pedagogic reasons want enforce give scripts .tcs extension instead of .py extension. when doubleclick main-application, test engine find .tcs files in same directory using glob() , import of them execute statements sequentially. thanks alex thornton pointing out solution . imp.load_source("importname","script.extension")

php - mysqli_num_rows() Error -

this question has answer here: reference - error mean in php? 29 answers mysqli_fetch_array()/mysqli_fetch_assoc()/mysqli_fetch_row() expects parameter 1 resource or mysqli_result, boolean given 33 answers i passing $query"update...", has no errors, query method. have checked other posts point query not appear problem. public function query($sql) { $this->_result = mysqli_query($this->_link, $sql); $this->_numrows = mysqli_num_rows($this->_result); } $db->numrows(); i receiving error 'mysqli_num_rows() expects parameter 1 mysqli_result, boolean given in...', said there nothing wrong query, _numrows returning correct value numrows() method returns _numrows, returning error. ideas appreciated. thanks. ...

android - Sum and difference beetwen hours in Java (over 24h) -

i'm developing android app , need calculate times (with joda libs). know if exist java class this. the cases calculate (in example): case 1: t1 = "13:40" t2 = "12:30" result = t1 + t2 --> 26:10 case 2: t1 = "13:40" t2 = "12:30" result = t1 - t2 --> 1:10 case 2.1: t1 = "13:40" t2 = "14:00" result = t1 - t2 --> -0:20 thanks!! :) following jodatime-code handles both inputs , result temporal amounts, not points in time: case 1: periodformatterbuilder builder = new periodformatterbuilder(); builder.minimumprinteddigits(2); builder.printzeroalways(); builder.appendhours(); builder.appendliteral(":"); builder.appendminutes(); periodformatter pf = builder.toformatter(); period period1 = pf.parseperiod("13:40"); period period2 = pf.parseperiod("12:30"); period total = period1.plus(period2); period normalized = total.normalizedstandard(periodtype.time()); syst...

c# - Stop EF from checking the model -

the model backing 'applicationdbcontext' context has changed since database created. have happened because model used asp.net identity framework has changed or model being used in application has changed. resolve issue, need update database. ...yada yada yada... there's lots of questions on this, commonly accepted solutions aren't working me. frankly i'm fed migrations , prefer ef trusts me tables , columns there use. i've removed __migrations table. i've deleted migrations directory. i've tried enable-migrations -enableautomaticmigrations -force (this gets me model backing 'applicationdbcontext' context has changed since database created error) i've tried update-database (same error) i've tried database.setinitializer<applicationdbcontext>(null) in applicationdbcontext static constructor i've tried changing database.setinitializer<applicationdbcontext>(new nulldatabaseinitializer<applicationdbco...

caching - When Does Asp.Net Remove Expired Cache Items? -

when add item system.web.caching.cache absolute expiration date, in following example, how asp.net behave? it: simply mark item expired, execute cacheitemremovedcallback on next access attempt? remove item cache , execute cacheitemremovedcallback immediately? httpruntime.cache.insert(key, new object(), null, datetime.now.addseconds(seconds), cache.noslidingexpiration, cacheitempriority.notremovable, oncacheremove); msdn appears indicate happens immediately. example, the "expiration" section of "asp.net caching overview" says "asp.net automatically removes items cache when expire." similarly, example topic "how to: notify application when item removed cache" says "if more 15 seconds elapses between calls getreport [a method in example], asp.net removes report cache."...

javascript - Typing function definitions in Vim -

i'm newly excited using vim programming needs, haven't yet managed google myself neat way of writing function definitions. when typing new function definition (i'm writing javascript) this: i function foo(x) {} esc leaves me in normal mode cursor between braces. now i return esc puts closing brace on new line. finally o opens new line above closing brace cursor on new line. this seems inefficient. there neater way? (ideally not involving .vimrc hacks, because i'm trying learn 'vanilla' vim can) i function foo(x) { cr } ctrl-o o is golfiest can goal (parentheses closed @ times) without editing .vimrc or installing plugins.

c++ - Issue with allocating memory for pointers -

i asking similar question earlier. answers got pinpointed mistake not having set aside memory pointer. following piece of code still complains error: cannot convert ‘void*’ ‘double’ in assignment. mean elements in array set aside null? #include <cmath> #include <cstdlib> #include <fstream> #include <iostream> #include <vector> #include <stdio.h> #include <stdlib.h> using namespace std; int n = 2; int main(int argc, char *argv[]) { double *p[n]; for(int = 0; i<n; ++i){ *p[i]=malloc(sizeof(double)); } *p[0] = 1.0; *p[1] = 2.0; cout << p[0] << " " << p[1] <<endl; *p[0] = 5.0; *p[1] = 6.0; cout << p[0] << " " << p[1] <<endl; return 0; } i need array solve problem have. array needs in global memory (in cuda), needs pointer gpus can read/write from/to. p[i]=malloc(sizeof(double)); ..get rid of '*' derefer...

c - Jump every X instructions -

i need keep track of quantity of work done programs, inside single thread. have minimum impact on (c) code. there way trigger piece of code every x instructions ? i thinking adding check @ compile time, every x instructions. ok inside branch, (without in depth branch analysis) requires check @ every jump ... in programs many jumps costly. is there tool/technique allows analyse branches of code (at compilation) checks placed @ places ? i'd @ doing way, i.e. using profiler or cpu accounting. if using linux, bizarrely enough, posix mandated standard times() doesn't (or @ least didn't) meant to, , in fact gives (or gave) per thread accounting data: http://pubs.opengroup.org/onlinepubs/000095399/functions/times.html essentially linux threads are processes under hood. might useful you. (apologies isn't direct answer long comment)

.htaccess - max upload size php with symfony2 -

i have form file input post iframe. <form id="uploadform" enctype="multipart/form-data" action="{{ path('lesson_upload') }}" target="uploadframe" method="post"> <label for="uploadfile">image :</label> <input id="uploadfile" name="uploadfile" type="file" /> <br /><br /> <input class="btn btn-primary" id="uploadsubmit" type="submit" value="upload" /> </form> <div id="uploadinfos"> <div id="uploadstatus">aucun upload en cours</div> <iframe hidden id="uploadframe" name="uploadframe"></iframe> </div> it seems there upload size limit of 2m. i have edited php.ini increase limit. , there no limitation on .htaccess. is there limitation due symfony ? maybe configuration file ? edit : php script pu...

c# - Linq to Json MVC 5 not formatting as expected -

might seem simple can't json correctly formatted mvc 5 controller. my output showing as; [ { "result":{ "account_color":"b43104", "account_desc":"welcome xyz", "account_name":"xyz", "account_zone":1 } }, { "result":{ "account_color":"ff0000", "account_desc":"test company", "account_name":"test", "account_zone":2 } } ] so can see level above result not show text seems 'result' section getting added blank node my controller is; public ienumerable<dynamic> get() { return db.tblaccounts.select(o => new { result = new { account_name = o.account_name, account_desc = o.account_desc, ...

php regex find text within parenthesis -

using php or powershell need in finding text in text file.txt, within parenthesis output value. example: file.txt looks this: this test (mytest: test) in parenthesis testing (mytest: johnsmith) again. not testing testing (mytest: 123) my code: $content = file_get_contents('file.txt'); $needle="mytest" preg_match('~^(.*'.$needle.'.*)$~', $content, $line); output new text file be: 123test, johnsmith,123, use pattern: ~\(%s:\s*(.*?)\)~s note %s here not part of actual pattern. it's used sprintf() substitute values passed arguments. %s stands string, %d signed integer etc. explanation: ~ - starting delimiter \( - match literal ( %s - placeholder $needle value : - match literal : \s* - 0 or more whitespace characters (.*?) - match (and capture) inside parentheses \) - match literal ) ~ - ending delimiter s - pattern modifier makes . match newlines well code: $needle = 'myte...

How to fetch lat-long stored in mysql and display on google maps in android -

i developing tracking system in android , have list of latitude , longitude stored in mysql database. want display stored lat-long on google maps. if need work google maps api v3 check here official website .. there sample there in website start . , if want data mysql databse check this link

c# - ListView AddRange of Items starting from SubItem[1] -

Image
i have listview has populated first column. can use : mylistview.items.addrange(new listviewitem[] { item }) but since have first column populated, tried using: mylistview.items[0].subitems.addrange(new listviewitem[] { item }) but error: i can use string[] overload, there way use listviewitem[] instead subitems? here's code: listviewitem item = new listviewitem(new string[] { exp[listbox1.selectedindex].tostring(), exp2[listbox1.selectedindex].tostring() }); listview2.items[0].subitems.addrange(new listviewitem[] { item }); so why don't do: listview2.items[0].subitems .addrange(new [] { exp[listbox1.selectedindex].tostring(), exp2[listbox1.selectedindex].tostring(), }); the method expects either array of strings or listviewsubitems .

ios - Override a base localizable.strings file -

is there way have 1 base localizable.strings file multiple targets within project, , have second localizable.string file each target override , append individual values base file? edit i want app have 2 .strings files - localizable.string , override.strings. if string, title.welcome, not found in overridelocalizable.strings app search localizable.strings title.welcome. essentially, specifying localizable fallback, using overridelocalizable.strings default. here solution found: nsstring *psilocalizedstring(nsstring *key, nsstring *comment) { return nslocalizedstringwithdefaultvalue(key, @"overridelocalizable", [nsbundle mainbundle], nslocalizedstring(key, nil), comment); } what search file called overridelocalizable.strings key . if value key not found in overridelocalizabl...

wpf - Windows Phone TextBox alignment in grid -

i have below code in xaml. <grid x:name="contentpanel" grid.row="1" margin="12,0,12,0"> <grid.rowdefinitions> <rowdefinition/> <rowdefinition/> <rowdefinition/> <rowdefinition/> <rowdefinition/> <rowdefinition/> <rowdefinition/> <rowdefinition/> <rowdefinition/> <rowdefinition/> <rowdefinition/> </grid.rowdefinitions> <grid.columndefinitions> <columndefinition/> <columndefinition/> <columndefinition/> <columndefinition/> </grid.columndefinitions> <textblock grid.row="2" grid.column="0" grid.columnspan="4" grid.rowspan="2" foreground="black" text="username"/> <textbox grid.row="3" grid.column="0" grid...

android - IllegalStateException because notifyDataSetChanged() on PagerAdapter not called -

i have following situation , couldn't find solution far: in activity there viewpager fragmentstatepageradapter. activity call activity b. there can change global data, affects number of pages in viewpager in activity a. use button, return activity a, following exception: e/androidruntime(1756): java.lang.illegalstateexception: application's pageradapter changed adapter's contents without calling pageradapter#notifydatasetchanged! expected adapter item count: 121, found: 151 pager id: com.example.blablabla:id/main_view_pager pager class: class android.support.v4.view.viewpager problematic adapter: class com.example.blablabla.activitymain$mainviewpageradapter e/androidruntime(1756): @ android.support.v4.view.viewpager.populate(viewpager.java:962) e/androidruntime(1756): @ android.support.v4.view.viewpager.populate(viewpager.java:914) ... i tried calling notifydatasetchanged(); on adapter @ different places (oncreate, onrestart, onresume, onactivityresult) noth...

c# - How to create a Uml Diagram with Visual Studio 2013 -

Image
i make uml flow diagram , have visual studio 2013 cannot find way begin creating uml diagram i.e. either project add or item. i cannot find 'architecture menu' , there doesnt seem way add it. any ideas on i'm missing / doing wrong? this type of diagram create: you require visual studio 2013 ultimate sku access modeling features. check version of visual studio have click on help > microsoft visual studio . you can compare features available across various skus here: http://www.visualstudio.com/products/compare-visual-studio-products-vs

numpy - Consistent way to check if an np.array is datetime-like -

i'm dong unit testing , need make sure function returns np.datetime64-like object. however, can of unit (year, day, nanosecond, etc). i've tried: comp = function_returns_datetime_array(inp) assert isinstance(comp.dtype, np.datetime64) assert issubclass(comp.dtype, np.datetime64) assert issubclass(type(comp.dtype), np.datetime64) any suggestions? you can use issubdtype : np.issubdtype(comp.dtype, np.datetime64)

asp.net - Telerik RadAsyncUpload -

i using radasyncupload upload file server , works fine unless decide have multiple tabs open each uploading different files different tabs seems each radasyncupload steps on each other because 1 radasyncupload steps on in asp.net temp folder has else seen ? you can use many asyncuploads, upload many files. hit validation due file upload limit.

javascript - Nokia Here Maps calculating the centroid of a polygon (e.g triangle) generates wrong results -

as topic says have polygon , want calculate center of mass (centroid). take geo-coordinates, transform them pixel cooridinates use formula found on http://en.wikipedia.org/wiki/centroid , transform the calculated pixels geo-coordinates. the result seems wrong (i can't post pictures). relevant code snippet is: this.drawpolygoncenter = function (mapservice, coords) { var sumy = 0; var sumx = 0; var partialsum = 0; var sum = 0; var cm = mapservice.getcurrentmapreference(); var points = []; coords.foreach(function (c, idx) { points.push(cm.geotopixel(c)); console.log("x: " + points[idx].x + " y: " + points[idx].y); }); var n = points.length; (var = 0; < n - 1; i++) { partialsum = points[i].x * points[i + 1].y - points[i + 1].x * points[i].y; sum += partialsum; ...

mysql - SQL - Select Boolean Results from Table -

well ,i didn't find correct title question, sorry that. i have 1 table store emails sent users. in table can know if user read or not email. table structure: [mailsend_id] (int), [id_user] (int), [mail_id] (int), [read] (bit) data: ;with cte ( select * (values (1, 10256, 10, 0), (1, 10257, 10, 1), (1, 10258, 10, 1), (1, 10259, 10, 0), (2, 10256, 10, 0), (2, 10257, 10, 0), (2, 10258, 10, 1), (2, 10259, 10, 0), (3, 10256, 10, 1), (3, 10257, 10, 0), (3, 10258, 10, 0), (3, 10259, 10, 0) ) t(mailsend_id, id_user, mail_id, read) in example, can see, have 4 users , 3 emails sent. user 10256 1st email - don't read 2nd email - don't read 3rd email - read i need make select on table, give [mail_id] , [number] , number represent sequential e-mails not read user. using last example: give [number] = 3, [mail_id] = 10 return user_id 10259 only. give [number] = 2, [mail_id] = 10 return user_id 10257, 20259. give [number] = 1, [mai...

jquery - Move dataItem (row) to first place in Kendo grid -

i want able move specific row first place on first page in paginated kendo grid. have found dataitem via jquery not sure how append first element in grid. couldn´t find similar in documentation on how removerow . can perhaps me in moving dataitem firstplace? here´s script i´ve found dataitem: function onfetchitem(gridname) { var ids = gridname.split("_"); var item = $("#itemsearch_" + ids[1]).val(); var grid = $("#" + gridname).data("kendogrid"); var data = grid.datasource.data(); var dataitem = $.grep(data, function (d) { return d.item == item.touppercase(); }); //todo: move dataitem first record in grid } i found in thread use greb suggest above. you first remove item , insert @ first index: grid.datasource.remove(dataitem); grid.datasource.insert(0, dataitem);

multithreading - Is there a thread-safe way to print in Perl? -

i have script kicks off threads perform various actions on several directories. snippet of script is: #main sub buildinit { $actionstr = ""; $compstr = ""; @component_dirs; @comptobebuilt; foreach $comp (@complist) { @component_dirs = getdirs($comp); #populates @component_dirs } print "printing action list: @actionlist\n"; #--------------------------------------- #---- setup worker threads ---------- ( 1 .. num_workers ) { async { while ( defined( $job = $q->dequeue() ) ) { worker($job); } }; } #----------------------------------- #---- enqueue work ---------- $action (@actionlist) { $sem = thread::semaphore->new(0); $q->enqueue( [ $_, $action, $sem ] ) @component_dirs; $sem->down( scalar @component_dirs ); print "\n------>> waiting prior actions finish up... ...

xml - XSL need help get value -

i new xslt , trying following information. i have xml looks this: <?xml version="1.0" encoding="utf-8"?> <soa:label identifier="624e35e5-f7fe-49d2-b7d6-669543106161" name="metadata label" description="this label holds 2 fields, duration , file name of media file. intended populated using identify." instance="1ab96760-b2f2-439d-8c26-ef204236b3ec" signature="00000000-0000-0000-0000-000000000000" xmlns:soa="urn:telestream.net:soa:core"> <soa:category identifier="007cf696-0ee3-4bbf-8d1a-5fc90b75ae82" name="video" order="0" /> <soa:category identifier="f6754a00-a901-4cfe-b500-737506a67da5" name="audio" order="0" /> <soa:parameter type="timecode" identifier="f74643ba-085e-4a89-8362-a222720a4c4e" bindable="true" name="duration" enabled="true" disableable="fals...

JQuery delay several divs -

i have following code: http://jsfiddle.net/s5xlm/ with 2 delays , settimeout(function (){ } the first delay working, second won't work. the current object shown gray box. next object (a blue box) should shown after delay. , after delay, green box should shown. so instead of (like now): gray - delay -> blue i want: gray - delay -> blue - delay -> green. thanks. a slight modification fiddle desired effect. $('#object1').click(function () { settimeout(function() { $('#object1').hide(); $('#object2').show(); settimeout(function() { $('#object2').hide(); $('#object3').show(); }, 1000) }, 1000); });

c - OpenSSL- Linux System requirements -

this question has answer here: ssl_read failing ssl_error_syscall error 3 answers unfortunately, unable find answer question on google. i have 2 devices similar hardware. on 1 device ssl code runs flawlessly, on second doesn't. major difference between both devices linux kernel version. code works on 2.6.24.6 not 2.4.21 (error when attempting handshake using ssl_connect() error ssl_error_syscall). guess is, latter kernel version not supported. could point me out can find more information minimum system requirements openssl ? in case, kernel 2.4.21 not supported, there other library use? to see list of supported oses , platforms, run configure bogus argument: $ ./configure xxx configuring xxx usage: configure [no-<cipher> ...] [enable-<cipher> ...] [experimental-<cipher> ...] [-dxxx] [-lxxx] [-lxxx] [-fxxx] [-kxxx] [no-hw-xxx|...