Posts

Showing posts from June, 2013

Spring Batch skip exception for ItemWriter -

i'm trying use spring batch 2.2.5 java config. here config have: @configuration @enablebatchprocessing public class jobconfiguration { @autowired private jobbuilderfactory jobbuilder; @autowired private stepbuilderfactory stepbuilder; @bean @autowired public job processdocumentsjob() { return jobbuilder.get("processdocumentsjob") .start(procesingstep()) .build(); } @bean @autowired public step procesingstep() { compositeitemprocessor<file, documentpackagefilemetadata> compositeprocessor = new compositeitemprocessor<file, documentpackagefilemetadata>(); compositeprocessor.setdelegates(lists.newarraylist( documentpackagefilevalidationprocessor(), documentmetadatafiletransformer() )); return stepbuilder.get("procesingstep") .<file, documentpackagefilemetadata&g

sql - How to call stored procedure from OSB without using JDeveloper JCA adapter -

i need on osb 11g. want call stored procedure osb. got many answers guide develop jca adopter through jdeveloper , configure in osb. dont want depend on jdeveloper every time. can suggest me there way can call stored procedure without using jdeveloper jca adopter. please note not executing simple sql query, calling stored procedure. you can use fn-bea:execute-sql function in xquery . within execute procedure , assign in variable.

jquery - Padding issue with Kendo UI Grid -

Image
i got issue padding kendo ui grid, grid covered header . on footer has toogle button, when click toogle button header appear. more specific see 2 images below. @(html.kendo().grid(model) .name("grid") .columns(columns => { columns.bound(c => c.productsubcategoryid).width(140); columns.bound(c => c.productcategoryid).width(140); columns.bound(c => c.nameofbike).width(190); columns.bound(c => c.isselected).width(120); }) .editable(edit => edit.mode(grideditmode.incell)) .pageable(pageable => pageable .refresh(true) .pagesizes(true) .buttoncount(5)) .sortable() .groupable() .toolbar(tb => { tb.create(); tb.save(); }) does knows what's wrong it? thanks!

Get no. of rows returned by stored procedure in SQL Server Reporting Services -

Image
i have created report using sql server reporting services makes use of stored procedure. added stored procedure dataset report , making use of parameters filtering etc. this works perfectly, want display no. of rows returned stored procedure @ bottom of report. in attempt added output parameter stored procedure , have statement after select statement: set @count = @@rowcount this parameter appears in parameter list in visual studio , added report, value 0. what i'm wondering how supposed catch output parameter in report, or there other way count in report? it's not possible directly catch output parameters of stored procedures using reporting services. the easiest way number of records in returned dataset, use expression in textbox want show count: =countrows("stp_cityhealthresearchrequests") if want filter count, use sum-function iif-function. example, if want count number of records concluded-column has value "yes": =sum(i

sql - wrong number in count() -

i've posted 2 questions problem , i'm there think. these older posts: use array/variable in sql-query extend sql result - add row if not exist it easier explain example, situation fictive example: my table looks (i show rows need, table contains +100k rows) status pgid nvarchar5 nvarchar10 catid tp_id isactive null information technology null 1 1 1 hr null human recource null 1 2 1 fin null finance null 1 3 1 new 1 null 1354 2 10001 1 new 1 null 464 2 10002 1 new 1 null 13465 2 10003 1 active 1 null 79846 2 10004 1 deleted 1 null 132465 2 10005 1 new 2 null 79847 2 10006 1 new 2

ios - Navigation controller popViewControllerAnimated : yes is not working as expected -

i using following line of code: [self.navigationcontroller popviewcontrolleranimated:yes]; but not behaving in ios 7 doing in ios 6.some times not pop controller while pressing button 2- 3 times in succession. resulting in abrupt behaviour in navigation bar , deallocating controller showing same on ui . when press on controller results crash since controller deallocated. [self.navigationcontroller poptorootviewcontrolleranimated:yes]; this method navigate root of navigationcontroller. you can check viewcontroller hierachy following code. nslog(@"%@",self.navigationcontroller.viewcontrollers);

Implement time window in procedures in Oracle -

the procedure unable execute,i invalid error statement create or replace procedure test declare current_time1 varchar(10); begin select to_char(systimestamp,'hh:mi.am') current_time1 dual if(current_time1 between '09:00.am' , '05:00.pm')then dbms_output.put_line (current_time1); else dbms_output.put_line ('unable insert'); end if; end; sql> select sysdate dual; sysdate ------------------- 20.03.2014 18:17:13 sql> create or replace procedure test 2 3 begin 4 5 if sysdate between trunc(sysdate,'dd')+interval '9' hour 6 , trunc(sysdate,'dd')+interval '17' hour 7 8 9 dbms_output.put_line(sysdate); 10 11 else 12 13 dbms_output.put_lin

Xamarin android mocking shared preferences -

i have android unit test project uses nunit test xamarin android project , need mock shared preferences object. have attempted use following mock isharedpreferences: new mockcontext().getsharedpreferences("",android.content.filecreationmode.append); however results in following exception: java.lang.classnotfoundexception: didn't find class "android.test.mock.mockcontext" i have included following using statement in project using android.test.mock . i not know why cannot find class when code compiles , builds in xamarin? it turns out of these class not yet supported xamarin yet. other users have alluded in previous posts well: testing activities in xamarin.android unfortunately there no solution mocking of yet xamarin. see other question @ mocking framework use xamarin android . have live using manual mocking.

apache - multiple conditions in .htaccess redirect with both if and or -

im trying setup htaccess redirect "domain.com" "www.domain.com" if request not "t.domain.com" below takes care of first part: rewritecond %{http_host} !^$ rewritecond %{http_host} !^www\. [nc] rewritecond %{https}s ^on(s)| rewriterule ^ http%1://www.%{http_host}%{request_uri} [r=301,l] but how extend not redirect if request "t.domain.com"? thanks! you can use: rewritecond %{http_host} !^(www|t)\. [nc] rewritecond %{https}s ^on(s)| rewriterule ^ http%1://www.%{http_host}%{request_uri} [r=301,l]

c++ - How to do this conditional compilation 'elegantly'? -

i have code needs run fast , optimizing heck out of inner loop run several hundred trillion times. in pursuit of this, have been writing several different versions of code in inner loop, using naive methods, using sse intrinsics, etc etc. did of idea when run it on particular hardware combination run test, see implementation / compiler commands combination worked best , run it. at first when 2 different methods used simple conditional compilation inside loop follows do { #ifdef naive_loop //more code here #endif #ifdef partially_unrolled_loop //more code here #endif } while( runnumber < maxrun ); later number of variations , different things tried grew, turned this: #ifdef naive_loop void calcrunner::loopfunction() { //code goes here } #endif #ifdef partially_unrolled_loop void calcrunner::loopfunction() { //code goes here } #endif #ifdef sse_intrinsics void calcrunner::loopfunction() { //code goes here } #endif //etc however making file becom

javascript - how to target the first div with jquery? -

i new jquery, please bear me. need find way first div every series of divs same class appears on page can add them specific css styling it. technically need similar :first-child in css. i tried using .first() got me first div first series of 'divs' class name. example: <div class="expl">....</div> <!-- need target div--> <div class="expl">....</div> <div class="expl">....</div> <h1>....</h1> - example, can have other html tag/content here <div class="expl">....</div> <!-- , div--> <div class="expl">....</div> <div class="expl">....</div> <p>....</p> <div class="expl">....</div> <!-- , div--> <div class="expl">....</div> <div class="expl">....</div> you can use css selector: *:not(.expl) + .expl this target .expl

c++ - Error: cannot call constructor -

i have included new module ns2 evaluation of video transmission. have make changes required files agent.h ,agent.cc, makefile , on. during make getting stuck error. error is: myevalvid/myudp.cc: in member function ‘virtual void myudpagent::sendmsg(int, appdata*, const char*)’: myevalvid/myudp.cc:56:123: warning: format ‘%d’ expects argument of type ‘int’, argument 4 has type ‘long unsigned int’ [-wformat] myevalvid/myudp.cc:78:123: warning: format ‘%d’ expects argument of type ‘int’, argument 4 has type ‘long unsigned int’ [-wformat] make: *** no rule make target `myevalvid/myevalvid_sink.o ', needed `ns'. stop. the code is #include "myudp.h" #include "rtp.h" #include "random.h" #include "address.h" #include "ip.h" static class myudpagentclass : public tclclass { public: myudpagentclass() : tclclass("agent/myudp") {} tclobject* create(int, const char*const*) { return (new myudpagent());

linux - Error with including ffmpeg to a project -

i have faced problem compilation project including ffmpeg library , have no idea error. /usr/lib/i386-linux-gnu/libavformat.a(utils.o): undefined reference symbol 'av_reduce@@libavutil_51' ffmpeg c/c++ problem and here linker invoking: gcc c++ linker g++ -l/usr/lib/i386-linux-gnu -o "ffmpeg" ./ffmpeg.o -lpthread -lswscale -lavdevice -lavutil -lavformat -lavcodec -lavfilter -lm -lz -lmp3lame -lpostproc -ldl -lx11 -lsdl -lrt -lswresample if me t great. thx use : error ffmpeg also use: ld --verbose -l * * lib u're looking and ensure linker found library expect( path compiled libs).

php - Strange character appearing in text in mysql -

in varchar , text mysql database datatypes, keep seeing  characters appear before every single space after content inserted or updated html textarea fields. when vardump php data prior insert/update,  characters aren't there. i tried converting database , tables default collation of latin1_swedish_ci utf8_general_ci encoding, inserting/updating data again,  characters still appeared in text before each space. i don't have grasp on collation , character encoding , thought things fine when left default, encountered issue. how can prevent these characters appearing? [edit]: if update text database first time, characters not appear. if load text database field , update second time,  characters appear. try execute set names 'utf8' on database init. check encoding of php files.

java - Counting levels in Breadth First Search (Distance between start node and goal node) -

can me how count visited levels of graph using breadth first search in java? here method, have start node (str) , end node (goal), when loop reach goal node should stopped. what want counting levels start node end node. public void bfs(string str,string goal) { int strinx = findindex(str); vertexlist[strinx].wasvisited = true; thequeue.insert(strinx); int v2; boolean bre = false; while (!thequeue.isempty()) { system.out.println(vertexlist[thequeue.getfront()].label); int v1 = thequeue.remove(); while ((v2 = getadjunvisitedvertex(v1)) != -1) { vertexlist[v2].wasvisited = true; system.out.println("--v2--->"+vertexlist[v2].label); thequeue.insert(v2); if(goal.equals(vertexlist[v2].label)) { bre=true; break; } } if(bre) break; } (int j = 0; j < nverts; j++) { ver

seek - Python: How to 'write' on the second line of a text file ignoring the first line -

i wanna know code/s can 'write' in text file second line. atm write data on text file: with open("data1.txt", "w") file: file.write(str(round(strength, 2)) + "\n") file.close() 'strength' in value(number) to 'read' specific line (the second line in case) text file: with open("data1.txt", "r", encoding="utf-8") file: s1 = file.readlines() s1 = float(s1[1].strip()) file.close() so how can 'write in file second line starting with: with open("data1.txt", "w+", encoding="utf-8") file: i know .. 'write' beginning of text file need use: file.seek(0) so how can replace/change/write second line? many thanks you need read file first: with open("file.txt", "r") file: lines = file.readlines() then change second line: lines[1] = str(round(strength, 2)) + "\n" then write back: with o

php - xhr in chrome extension -

i have created small extension requires communicate php script on server side mysql activities. the code used php connectivity works when used normal webpage when try access chrome extension, aint sure if getting called. code: document.addeventlistener('domcontentloaded', function() { var link = document.getelementbyid('signup_submit').submit(); // onclick's logic below: link.addeventlistener('click', function() { alert('jksd'); window.onload = function() { var xhr = new xmlhttprequest; var url = "http://localhost/browserextension/chrome%20extensions/register.php"; var username = document.getelementbyid('usrname').value; var dispname = document.getelementbyid('name').value; var password = document.getelementbyid('passwd').value; var params = "usrname=" + username + "&name=" + dispname + "&passwd=" + password; xhr.open("get", url, true); xhr.setrequesthea

javascript - .validate() not working JQuery -

i have problem regarding in validation in html. i'm using .validate() of validation plugin not working me. can me problem? have 2 names in each of . array of data used in inserting in database. conflict? should since required need use array in inserting data database? try put "#" , "data[0]" in rules still not worked. note: validation.js served validation plugin i've downloaded online. jquery validation plugin 1.11.1. , jquery.js served jquery 1.8.3. here's code. <html> <head> <script type="text/javascript" src="jquery.js"></script> <script src="jquery-ui-1.10.4.custom/js/jquery-ui-1.10.4.custom.min.js"></script> <script src="loginbouncy.js"></script> <script src="modal.js"></script> <script type="text/javascript" src="validation.js"></script> <script src="validate.js"></script> &

android - Fetching app details, app icons, app screenshots from Google play store -

does has idea how appbrain applications work? want make application can list selected publisher's apps, referred asked question "fetch details of application google play using package name?", did not hint. there unofficial api available play store api unofficial version of google play store let pullup applications google play store using18 different functions covering google store

javascript - Trying to build a Chrome Cordova App, but navigator is undefined -

i'm building chrome cordova app, , in chrome app apis works fine, i'm trying more advanced things, such take picture or read accelerometer data. my app works fine, navigator seems undefined. here's snippet of code i'm trying access accelerometer: $scope.picture = function(){navigator.accelerometer.getcurrentacceleration( function (acceleration) { alert('acceleration x: ' + acceleration.x + '\n' + 'acceleration y: ' + acceleration.y + '\n' + 'acceleration z: ' + acceleration.z + '\n' + 'timestamp: ' + acceleration.timestamp + '\n'); },function () {}); } }); here's of relevant logcat information: d/cordovalog(17498): chrome-extension://klfmkipmoapfodoemajgpobgjngbdejp/angular .min.js: line 86 : typeerror: cannot call method 'getcurrentacceleration' of und efined d/cordovalog(17498): @ h.$scope.picture

Java. Prevent Jar App from multiple running with pop up message "already running". (using ServerSocket()) -

currently trying display pop message when user trying run jar more 1 time. current code below public static void main(string[] args){ new serversocket(65535, 1, inetaddress.getlocalhost());// if there 1 // running jar, prevent // program execute joptionpane.showmessagedialog(frame, "hello world \n"); //display hello world message // when run } expectation output when user run jar more 1 time : your jar application running . . . my question is, how can display message tell user jar application running because serversocket() prevent application running, "already running "pop message put after not run. answer: try{ new serversocket(65535, 1, inetaddress.getlocalhost()); joptionpane.showmessagedialog(frame, "hello world \n"); } catch(bindexceptio

mysql - Compare values of two columns -

is there way compare values of 2 columns in mysql? example if have table: +----------------+ | col1 | col2 | |----------------| | abc | 123abc | | def | 234def | | | 123ghi | +----------------+ and wanted retrieve entries in col2 contained values of col1 : +---------+ | newcol | |---------| | 123abc | | 234def | +---------+ how go that? here pseudo-query explain bit further. select col2 tablename col2 col1; use locate() where locate(col1, col2); it returns non-zero value if col1 contained within col2 . update note empty substring contained within string, in case need condition: where length(col1) , locate(col1, col2);

Trouble creating a simple array in Java -

i'm having bit of trouble creating simple array in java random number generated every time loops. code follows: public class q1 { public static void main(string[] args) { scanner listscan = new scanner(system.in); system.out.println("size of list sort?"); int j = listscan.nextint(); int listarray[] = new int[j]; (int = 0; <= j; i++){ listarray[i] = (int)(math.random() * 100 +1); } system.out.println(listarray); } } but code gives me this: exception in thread "main" java.lang.arrayindexoutofboundsexception: 3 @ lab3.q1.main(q1.java:18) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:601) @ com.intellij.rt.execution.application.appmain.main(appmain.java:120

c# - Sort XmlNodeList with a specific Node value -

i searched web this, not able find related solution. i have following xml <table> <entity>employee</entity> <entityid>2786</entityid> <goal> <goalid>31931</goalid> <filterdata>lastmodifiedon¥2014-03-20t18:11:01.0000000+05:30Æactivetaskcount¥0</filterdata> </goal> <goal> <goalid>31932</goalid> <filterdata>lastmodifiedon¥2014-03-22t15:26:09.0000000+05:30Æactivetaskcount¥0</filterdata> </goal> <goal> <goalid>31932</goalid> <filterdata>lastmodifiedon¥2014-03-22t09:25:00.0000000+05:30Æactivetaskcount¥0</filterdata> </goal> </table> from above xml when read data got 2 separate datatables ; 1 employees , 1 related goals. what needed want sort goals related employee respect lastmodifiedon filterdata node. note: getting lastmodifiedon value split node value this

php - borderColor if null value -

while($row = mysql_fetch_array($query2testing)) { echo "<tr>"; echo "<td><center>$i</td>"; echo "<td>" . $row['name'] . "</td>"; echo "<td>" . $row['matricno'] . "</td>"; echo "<td><center>" . $row['lc'] . "</td>"; echo "<td>" . $row['code'] . "</td>"; echo "<td>" . $row['subject'] . "</td>"; if(!empty($row['assignment1'])) { echo "<td><center><font color='red'>" . $row['assignment1'] . "</td>"; } echo "<td><center>" . $row['quiz'] . "</td>"; echo "<td><center>" . $row['participation'] . "</td>"; echo "<td><center>" . $row['a

c++ - Would it be a good practise to store a 'validness' state for movable objects? -

i designing library, many of classes movable. many of movable classes passed arguments functions of other classes. thinking how minimize code validation checks. instances of movable classes in valid state after constructing, become invalid after being moved from. would practise have flag 'valid' true after constructing , becomes false after moving. way object valid again when valid object moved it. i'll mention after moving objects not go in state calling functions on them cause undefined behavior or anything. it's after moving contents garbage. should i, or shouldn't i? such flag might suitable debugging purposes, it's developer using library/code make sure he/she never uses objects in way quirky after have been used from. the whole purpose of move-constructors , move-assignments move data src dst , makes src contain nothing garbage, , developer using such functionality should aware of this. note: constructs should never ill-formed

ios - No visible @interface for 'GPUImageOutput<GPUImageInput>' declares the selector 'imageFromCurrentlyProcessedOutputWithOrientation:' -

i'm in charge of old project else created in company time ago, , have make changes using xcode 5.1 the thing is, compiled ok 1 year ago (spring of 2013) doesn't compile right now. project contains gpuimage library subproject. error xcode yields: no visible @interface 'gpuimageoutput<gpuimageinput>' declares selector 'imagefromcurrentlyprocessedoutputwithorientation:' when try compile these 2 lines: if( self.grayscaleoutput ) { photo = [grayscalefilter imagefromcurrentlyprocessedoutputwithorientation:uiimageorientationup]; } else { photo = [blendfilter imagefromcurrentlyprocessedoutputwithorientation:uiimageorientationup]; } i let xcode 5.1 change settings of project (it recommended me it), no luck. hint? setting need activate? arc misery might still remain in old lines of code? note: i've replaced 1 year old gpuimage library using, 1 i've freshly downloaded github. , no luck either. right, changed interface la

eclipse - All my android app get force close in AVD -

i have problem in avd , eclipse. i make new android app , when try run on avd or android device force close . manifest file : <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.azkar" android:versioncode="1" android:versionname="1.0" > <uses-sdk android:minsdkversion="8" android:targetsdkversion="19" /> <application android:allowbackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme" > <activity android:name="com.your.package.yourlauncheractivity" android:name=".main" android:lable="@string/app_name"> <intent-filter> <action android:name="android.intent.action.main"/> <category and

FTPS implicit TLS/SSL error -

i using ftp on implicit ssl upload files. encountered following error message [command] pwd [response] 257 "/" current directory. [command] pwd [response] 257 "/" current directory. [command] type [response] 200 type set [command] pwd [response] 257 "/" current directory. [command] pasv [response] 227 entering passive mode (10,0,0,19,195,113) [command] list -al [response] 521 prot p required [command] pwd [response] 257 "/" current directory. [command] pasv [response] 227 entering passive mode (10,0,0,19,195,114) [command] list -al [response] 521 prot p required [status] failed::ftp protocol error. 521 prot p required. may know error message "521 prot p required" saying? thanks before starting data transfer (e.g. creating new data connection outside control connection transfer files or listing) have specify protection level using prot command. main protection levels p protected (e.g. ssl encryption

Java Recursion - counting Characters in a string -

i'm trying find number of occurrences "character" found in "str" using recursion. think have concept of reason code not work when test out...do know why wrong? public static int countchar(string str, string character) { int number = 0; if(str.length()==1) { return number; } if (!(str.substring(0,1).equals(character))) { return countchar(str.substring(1), character); } else { number = number + 1; return countchar(str.substring(1), character); } } number local variable .... public static int countchar(string str, string character) { if(str.length()==0) { return 0; } if ((str.substring(0,1).equals(character))) { return 1 + countchar(str.substring(1), character); } return countchar(str.substring(1), character); } the terminating case when string length zero. for each step , check current char , if match - add 1 result rest of string, if not return m

html - want footer to stay at bottom, but not absolute -

am making website, , have wrapper on footer, want footer sticky footer, when minimise screen , make smaller footer overtakes content , header. #footerwrapper { height: 177px; bottom: 0; position: absolute; width: 100%; } this want makes footer go bottom of page regardless of size screen is. when minimise screen , move stays absolute hence staying in 1 page. as want stay on page rather footer being absolute. any ideas. i able keep footer sticky , not overtake header using z-index. give higher divs higher z-indexes. #headwrapper { padding-bottom: 0px; position: relative; } #headwrapper { z-index: 2; height: 160px; /* width: 960px; */ margin: 0 auto; background: url(/images/pageimages/homeheadback.png) repeat-x; } #footerwrapper { background: url(/images/pageimages/footerback.png) repeat-x; height: 177px; position: absolute; width: 100%; bottom:

wrong time shown in admin for registration in Django? -

i registered new user account using django admin gives time of registration wrong. must march 24, 2014, 11.01 a.m .but shows march 24, 2014, 6:01 p.m . in pst time-zone . in settings.py , have time_zone = 'utc' change timezone settings to: time_zone = 'us/pacific'

How can I add float parsing capability to a C lexical analyzer? -

i trying add floating point functionality simple lexical analyzer i've written in c, c (among other things). have ideas on how this, incomplete solutions, involving adding if statement parse integer literals, still stop , count period period because of while statement. thought adding or while statement, not entirely sure how specify period only. here code: /* front.c */ #include <stdio.h> #include <ctype.h> #include <string.h> #include <conio.h> /*global declarations */ /*variables*/ int charclass; char lexeme [100]; char nextchar; int lexlen; int token; int nexttoken; file *in_fp, *fopen(); /*function declarations*/ void addchar(); void getchar(); void getnonblank(); int lex(); /*character classes */ #define letter 0 #define digit 1 #define unknown 99 /*token codes*/ #define int_lit 10 #define float #define ident 11 #define assign_op 20 #define add_op 21 #define sub_op 22 #define mult_op 23 #define div_op 24 #define left_paren 25 #define rig

PHP - replace values in sub array -

i have 2 arrays $pq , $rs. please see them below: $pq = array ('page-0'=>array ('line-0'=>array('item-0'=>array('name'=>"item-00",'value'=>"123"), 'item-1'=>array('name'=>"item-01",'value'=>"456") ), 'line-1'=>array('item-0'=>array('name'=>"item-10",'value'=>"789"), 'item-1'=>array('name'=>"item-11",'value'=>"012") )), 'page-1'=>array ('line-0'=>array('item-0'=>array('name'=>"item-100",'value'=>"345"), 'item-1'=>a

android - Edittext in ListView lost cursor -

i have listview contains multi edittext . sometimes, when scroll , focus on edittext , cursor disappears although keyboard showing , can input character normally. cursor appears when put first character. <edittext android:id="@+id/et_nutri_lo" android:background="@drawable/edit_text_corner" android:paddingright="@dimen/et_corner_radius" style="@android:style/textappearance.medium" android:selectallonfocus="true" android:layout_width="wrap_content" android:layout_height="@dimen/btn_small_h" android:layout_gravity="center_vertical" android:layout_weight="1" android:minems="3" android:maxems="6" android:gravity="right|bottom" android:inputtype="numberdecimal" android:filtertoucheswhenob

Remove unwanted region in image by matlab -

Image
i have image includes object , unwanted region (small dots). want remove it. hence, use morphological operator example 'close' remove. not perfect. have other way remove more clear? can download example image @ raw image this code load image.mat %load img value img= bwmorph(img,'close'); imshow(img); you might prefer faster , vectorized approach using bsxfun along information obtained bwlabel itself. note: bsxfun memory intensive, that's precisely makes faster. therefore, watch out size of b1 in code below. method slower once reaches memory constraints set system, until provides speedup on regionprops method. code [l,num] = bwlabel( img ); counts = sum(bsxfun(@eq,l(:),1:num)); b1 = bsxfun(@eq,l,permute(find(counts>threshold),[1 3 2])); newimg = sum(b1,3)>0; edit 1: few benchmarks comparisons between bsxfun , regionprops approaches discussed next. case 1 benchmark code img = imread('coins.png');%%// 1 chosen a

sql - Too much difference in total run time of an update query with and without quotes -

i have query similar 1 below update table1 set colum1 = 'xyz' column2 in (1,2,3,....so on) here column2 of datatype varchar. in actual query in clause contains no.of values ranging 10000 60000 i.e, query updating 10000 60000 rows. now when supply values without quotes took 10 minutes query execute. same query when gave quotes(like mentioned below) took less minute. update table1* set colum1 = 'xyz' column2 in ('1','2','3',....so on) is natural? difference between above 2 queries former needs implicitly cast values in in clause. can 1 please explain? thanks this problem common character string has been used store numeric key. sql server dutifully perform implicit conversion , return correct result, @ cost of poor performance doing scan instead of seek , using index correctly. -> source

c# - Program only works on developer's machine -

i developed application visual studio 2013 , works fine. can move other directories, paths used in application relative! now unfortunately works on developer's computer , not on others. guess, there missing .dll or something. this error message get: > problem signature: > problem event name: clr20r3 > problem signature 01: myapp.exe > problem signature 02: 1.0.0.0 > problem signature 03: 53314d38 > problem signature 04: presentationcore > problem signature 05: 4.0.30319.18408 > problem signature 06: 52313210 > problem signature 07: 1b7e > problem signature 08: 0 > problem signature 09: system.badimageformatexception > os version: 6.1.7601.2.1.0.256.4 > locale id: 2055 > additional information 1: 0a9e > additional information 2: 0a9e372d3b4ad19135b953a78882e789 > additional information 3: 0a9e > addi

html - How can I use a `comment` fa-icon and a text div to display the number of messages a user has? -

i create message-counter similar link , using css , html. let's assume have means of injecting number of messages using angularjs, , use code: <i class="fa fa-comment-o"></i> present message icon. how can overlay span , put span element precisely in corner? you can use below. it's span (positioned relative), contains icon , span positioned absolute. <span class="count-icon"> <i class="fa fa-2x fa-comment"></i> <span class="count">3</span> </span> and css: .count-icon { display: inline-block; position: relative; } .count { position: absolute; top: 0; right: 0; height: 16px; width: 16px; background: red; border-radius: 8px; font-size: 12px; text-align: center; } see fiddle: http://jsfiddle.net/mx45f/

c# - Display value from other table -

i have database 2 tables. first table contains foreign key second table. in mvc-project, display value (stored in second table) instead of id first table.. in ssms join. how do in c#? rec.title = item.title + " - " + item.appointmentlength.tostring() + " mins" + " behandlingsid " + ***item.behandlingarid***; // item.behandlingarid contains id change corresponding value. these 2 tabeles: public class appointmentdiary { public int id { get; set; } public datetime datetimescheduled { get; set; } public behandlingar behandling { get; set; } public int? behandlingarid { get; set; } } public class behandlingar { public int behandlingarid { get; set; } public string namn { get; set; } public int pris { get; set; } public int tid { get; set; } } list<diaryevent> result = new list<diaryevent>(); foreach (var item in rslt)

jQuery doesn't work on items already processed -

$(document).ready(function() { $('#userid option').dblclick(function() { return !$('#userid option:selected').remove().appendto('#removelist'); }); $('#removelist option').dblclick(function() { return !$('#removelist option:selected').remove().appendto('#userid'); }); }); this works items transferred other list cannot transferred back, other items in other list can transferred back. delegate event containers not statically linked on element itself.. $(document).ready(function() { $('#userid').on('dblclick','option', function() { return !$(this).remove().appendto('#removelist'); }); $('#removelist').on('dblclick','option',function() { return !$(this).remove().appendto('#userid'); }); }); ( i changed inner selectors this . if moving multiple items @ once should use origi

sql - More elegant way in PHP to generate a query from array elements -

when need loop on while generating query each element, use like $querystr = "insert tablename (x,y) values "; ($i = 0 ; $i < $len ; $i++) { $querystr .= "( ".$thing[$i]['x'].", ".$thing[$i]['b']."), "; } //extra code remove last comma string would there alternative? don't mind performance (knowing length of array not big), looks nicer. a slight improvement rid of last part (removing latest comma). can first create array of values, use implode function like: $querystr = "insert tablename (x,y) values "; ($i = 0 ; $i < $len ; $i++) { $values[] = "( ".$thing[$i]['x'].", ".$thing[$i]['b'].")"; } $querystr .= implode(',', $values);

ios - Is Core data always necessary? -

i have developed ten apps ios. , haven't needed use core data! apps consistently based on receiving data servers. of apps have large feed lists, similar facebook , instagram. however coredata large topic in ios development, , i'm thinking maybe i'm missing something? there no data need save, , if large file image or audio file, save disk, because believe core data not suitable large files. in apps facebook or instagram, need there core data? core data interesting when have lot of objects relationships , if don't want manipulate sqlite requests. there no best , miracle way store data, depends on needs. if manipulate data coming webservice , don't want store caching them (and access offline) can use objects created right after parsing. maybe if want store preferences data (which no need secure) can use nsuserdefault . if want store graph of data (maybe custom objects linked , stored on nsarray or nsdictionary) can implements nskeyedarchiver n

How to find the recurrence relation T(N) = T(N/2) + N^2 -

what process involved in simplifying recurrence relation? i able much: t(n) = t(n/2) + n^2 t(n) = t(n/4) + (n/2)^2 +n^2 t(n) = t(n/8) + (n/4)^2 + (n/2)^2 + n^2 i understand terminate when n = 1 because 1/2 = 0; c(0) = 0. past stuck on way figure out these problems. well basic idea c(n) , c(n/2) should expression of same form. since difference simple function of n , infinite sum should pop mind, c(n)-c(n/2) becomes telescopic. each term of sum should given function n/2^k (for k=0, 1, ... ) argument. hence c(n) = n^2 + (n/2)^2 + (n/4)^2 + (n/8)^2 + ... job, , can further evaluated of identities geometric series c(n)=4/3*n^2 .

qt - Set Button imageSource from imageprovider -

i have image provider derived qquickimageprovider implementation of requestpixmap . this image provider works fine image component. now want provide imagesource button in same way. no image shows up. can problem? qml code image { anchors.fill: parent anchors.margins: 10 source: "image://provider/" + model.displayrole fillmode: image.preserveaspectfit } button { layout.fillwidth: true layout.preferredheight: width iconsource: "image://provider/" + model.displayrole onclicked: appcore.switch(model.displayrole) } c++ code qpixmap imageprovider::requestpixmap(const qstring &id, qsize *size, const qsize &requestedsize) { qmodelindex index; bool foundid = false; for(int row = 0; row < m_mymodel->rowcount(); row++) { index = m_mymodel->index(row, 0); qstring name = qvariant(m_mymodel->data(index, qt::displayrole)).tostring(); if(name == id) {

java - How to set up libdgx with IntelliJ? -

i followed this tutorial seems kind out of date? i'm not sure. unfortunately i'm not experienced java (but c#, python, ..) maybe there obvious did not regard. intellij giving me import errors libraries com.badlogic.gdx package import com.badlogic.gdx.applicationadapter; import com.badlogic.gdx.gdx; import com.badlogic.gdx.graphics.gl20; import com.badlogic.gdx.graphics.texture; import com.badlogic.gdx.graphics.g2d.spritebatch; java: package com.badlogic.gdx not exist etc.. actually there missing dependencies gdx-setup.jar should solve problems already? i had same problem , found answer worked me. open android skd manager tools directory of ever put android sdks make sure android sdk build-tools 19.03 installed if not install it then go intellij , menu bar open view->tool windows->gradle then hit refresh (two green arrow) worked me anyway.

C++ - standard-layout -

this question has answer here: why c++11's pod “standard layout” definition way is? 6 answers according current c++ standard draft, standard-layout class either has no non-static data members in derived class , @ 1 base class non-static data members, or has no base classes non-static data members i have yet see implementation more efficient limitation. why exist (except making things more difficult)? the purpose of standard-layout not efficiency, data-interoperability c

python - PyQt: How to load a url from a menu item -

i have main window buttons , plot. added file menu, using qt designer. now, if run app, , can see typical menu bar. problem is, want click on menu bar , perform action - want open internet web page default browser. can me? this code generated pyuic4 qt designer (i show code file menu): self.menubar = qtgui.qmenubar(mainwindow) self.menubar.setgeometry(qtcore.qrect(0, 0, 1445, 21)) self.menubar.setobjectname(_fromutf8("menubar")) self.menufile = qtgui.qmenu(self.menubar) self.menufile.setobjectname(_fromutf8("menufile")) mainwindow.setmenubar(self.menubar) self.statusbar = qtgui.qstatusbar(mainwindow) self.statusbar.setobjectname(_fromutf8("statusbar")) mainwindow.setstatusbar(self.statusbar) self.actionfsa_format = qtgui.qaction(mainwindow) self.actionfsa_format.setobjectname(_fromutf8("actionfsa_format")) self.menufile.addaction(self.actionfsa_format) self.menubar.addaction(self.menufile.menuaction()) as can see have file menu, , tool-

java - Changing language of a JComboBox -

so i'm writing program have change language different language have part done can't seem jcombobox change language example if user clicks japanese languages in jcombobox change english eigo , french furansugo there piece of code , go in actionperformed have languages? you don't need here's code: /** * */ package gui; import javax.swing.*; import gui.gui; import java.awt.*; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.util.locale; import java.util.resourcebundle; /** * @author michelle * */ public class gui extends jframe implements actionlistener { resourcebundle res, res1, res2; jframe frame; jbutton button, button1, button2, button3, button4; jlabel label, label1,label2,label3, label4; jscrollpane output; jcombobox<string> combo; string[] array; public gui() {

mongodb - Inline/combine other collection into one collection -

i want combine 2 mongodb collections. basically have collection containing documents reference 1 document collection. want have inline / nested field instead of separate document. so provide example: collection a: [{ "_id":"90a26c2a-4976-4edd-850d-2ed8bea46f9e", "somevalue": "foo" }, { "_id":"5f0bb248-e628-4b8f-a2f6-fecd79b78354", "somevalue": "bar" }] collection b: [{ "_id":"169099a4-5eb9-4d55-8118-53d30b8a2e1a", "collectionaid":"90a26c2a-4976-4edd-850d-2ed8bea46f9e", "some":"foo", "andother":"stuff" }, { "_id":"83b14a8b-86a8-49ff-8394-0a7f9e709c13", "collectionaid":"90a26c2a-4976-4edd-850d-2ed8bea46f9e", "some":"bar", "andother":"random" }] this should result in collecti