Posts

Showing posts from February, 2012

uml - Difference between software design and modeling and software analysis -

what basic difference between : modeling - software design , software analysis . software analysis step analyse software , create use case diagram, , software design preparation coding step, contains class diagram , others, prepared requirement specifications , helps in specifying hardware , system requirements , helps in defining overall system architecture, there following 6 phases in every software development life cycle model requirement gathering , analysis design implementation or coding testing deployment maintenance

php - Multiple jQuery AJAX calls conflicts? -

i trying create simple shopping cart using ajax , php. everything works should 1 thing doesn't work time , seems fails execute. (it works 3 times out of 5). to explain issue please take @ code bellow: jquery(document).ready(function() { //////////////////////lets run our add cart feature using ajax ////////////// $(function(){ $('.form1').on('submit', function(e){ $( "#preloader" ).fadein( 850 ); // prevent native form submission here e.preventdefault(); // whatever want here $.ajax({ type: $(this).attr('method'),// <-- method of form url: $(this).attr('action'), //url: "cart.php", data: $(this).serialize(), // <-- serialize fields string ready posted php file beforesend: function(){ }, success: function(data){ $( "#preloader" ).fadeout( 850 );

javascript - Multiple values from redis with nodejs -

i've been trying figure out how achieve nodejs , redis: var var1 = redisclient.get("foo"); var var2 = redisclient.get("bar"); if (var1 && var2) { do_something(); } else { do_something_else(); } i know redis calls asynchronous repeating like: var var1, var2; redisclient.get("foo", function(err, data) { var1 = data; redisclient.get("bar", function(err, data) { var2 = data; if (var1 && var2) { do_something(); } else { do_something_else(); } } }); doesn't feel right every time want access 2 variables. you can use async library control flow: async.parallel([ function(done) { redisclient.get("foo",done); }, function(done) { redisclient.get("bar",done); } ], function(err, result) { /

sql - Cannot insert multiple lines in Sqlite using C# -

i know simple question cannot find answer can me. i'm using c# in order connect sqlite database , insert data. here code : private void opendb() { this.m_handle = new sqliteconnection("data source=" + m_filename + ".sqlite3;version=3;"); this.m_handle.open(); } private void closedb() { this.m_handle.close(); } private void createdb() { this.opendb(); string query = "create table streamingurl ([url] varchar(255) not null, [daterequest] text not null);"; sqlitecommand command = new sqlitecommand(query, this.m_handle); command.executenonquery(); this.closedb(); } public void addstreamingurl(string url) { this.opendb(); string query = "insert streamingurl (url, daterequest) values ('" + url + "', datetime('now', 'lo

magento set drop down as readonly not working -

i need set drop down readonly. put as; <select readonly="readonly" name="name" > <option>1</option> <option>2</option> <select> but not working. since readonly, can change drop down value. please help.thank you. the select tag doesn't have readonly attribute. have disabled . the problem disabled form inputs don't included in post / data. to around this, add hidden input same name , value.

javascript - Play audio file on the server side using ElFinder -

i trying play .mp3 file on server side using elfinder. have created 2 instances of elfinder. how should play file 1 of instances on server side? here code handlers : { select : function(event, elfinderinstance) { var selected = event.data.selected; if (selected.length>0) { var filenamex=elfinderinstance.file(selected[0]).name; console.log(filenamex); var path=elfinderinstance.path(selected[0]); console.log(path); if(filenamex.indexof(".mp3") == filenamex.length - 4) { console.log("mp3 file"); } } } }, lang : 'en', customdata : {answer : 42}, rememberlastdir :false, debug:true })

java - Design pattern for interface that determines order of method invocation -

i want create java interface number methods. want user of interface able invoke methods in sequence or order define. instance buyticket() should not called before reserveticket() . q: there design pattern or tips on how go this? i considered: a) interface wrapped, showing next possible method. each invocation of method returns new operation can called after it, , on. so reserveticketoperation has public buyticketoperation execute(); then buyticketoperation has public renderticketoperation execute(); b) use kind of context state machine records position of execution using enums , has factory obtaining next operation. any thoughts or suggestions appreciated. thanks my immediate feeling: don't @ all pattern. if inner logic of methods requires them always call them in order; exposing implementation detail make easy use interface wrong. meaning: instead of trying somehow force "client code" adhere specific order should design interf

java - in JTable, How can I disable to edit a specified colunm or row? -

i have trouble , looking solution. but now, can't do. i ask guys issue jtable. this code makes me disable edit cells. final jtable table = new jtable(data, columnnames){ public boolean iscelleditable(int row, int col) { return true; } }; but, want code me not edit specified colunm or row. so, if me, appreciate ! if - else out : public boolean iscelleditable(int row, int col) { if(yourconditionmet) <--- can apply check return true; else return false; }

git - Overwrite index file in /var/www with vcsrepo -

i trying make puppet module overwrite default index.file (which comes apaceh2) in /var/www/ index file have in git repository. using puppet plugin vcsrepo clone repository. vcsrepo { "/var/www/": provider => git, source => "git@git.*****/testing.git", identity => '/root/.ssh/id_rsa', require => package['git'], } i right getting error: error: /stage[main]/web::repository/vcsrepo[/var/www/]: not evaluate: undefined method `include?' nil:nilclass i have tried force=>"true" , without managing solve problem. the easiest way of doing clone git repository location, , use file resource make index.file either copy or symlink version in checkout. vcsrepo { "/tmp/apacherepo": provider => git, source => "git@git.*****/testing.git", identity => '/root/.ssh/id_rsa', require => package[

excel - VBA vlookup code in different sheet -

i new vba. have 2 sheets under excel: "data", "sheet1".data sheet amended every day. use vlookup vba macro rows added column in sheet1. code doesn't give me results (it works if run macro under same sheet data are). thank you private sub commandbutton21_click() on error resume next sheet1.range("b3:d500").clear dim dept_row long dim dept_clm long table1 = sheet1.range("a3:a50") table2 = data.range("a3:h24") dept_row = sheet1.range("b3").row dept_clm1 = sheet1.range("b3").column dept_clm2 = sheet1.range("c3").column dept_clm3 = sheet1.range("d3").column each cl in table1 sheet1.cells(dept_row, dept_clm1) = application.worksheetfunction.vlookup(cl, table2, 6, false) sheet1.cells(dept_row, dept_clm2) = application.worksheetfunction.vlookup(cl, table2, 7, false) sheet1.cells(dept_row, dept_clm3) = application.worksheetfunction.vlookup(cl, table2, 8, false) dept_row = dept_row + 1

How to fill tables in PDF forms with iTextSharp? -

Image
all i must fill this pdf form using itextsharp . i have no problems header fields, don't know how fill table in bottom. can fill first row pdfstamper.acrofields.setfield() , how can add more rows, if @ possible? your form form based on acroform technology. means form static. every field in form corresponds widget annotation absolute position defined on page. can not add data on coordinates not predefined, hence can not "add more rows". asking impossible. take under hood of pdf: there's array of /fields , each field defined dictionary combines field entries , entries of single widget annotation. each widget annotation has fixed coordinates on page. it seems looking dynamic form solution. in case, need form based on xml forms architecture (xfa). form not xfa form. if in doubt difference between acroform , xfa technology, please download free ebook: the best itext questions on stackoverflow . in book you'll find answer several questions s

java - Apache POI Evaluate Formula in SXSSF workbook -

in project use sxssfworkbook (apache-poi 3.9) class manage large spreadsheet. need evaluate formulas cells, tried formulaevaluator this ... sxssfworkbook streamingworkbook = new sxssfworkbook(100); ... formulaevaluator fe = streamingworkbook.getcreationhelper().createformulaevaluator(); ... fe.evaluateincell(cell); but doing so, exception thrown java.lang.classcastexception: org.apache.poi.xssf.streaming.sxssfcell cannot cast org.apache.poi.xssf.usermodel.xssfcell @ org.apache.poi.xssf.usermodel.xssfformulaevaluator.evaluateincell(xssfformulaevaluator.java:177) @ org.apache.poi.xssf.usermodel.xssfformulaevaluator.evaluateincell(xssfformulaevaluator.java:44) ... the direct cause of error clear: method .evaluateincell takes cell object, internally casts cell xssfcell . since i'm passing instead sxssfcell exception thrown. so question is: there way implement formula evaluation in streaming workbooks (sxssf)? tl;dr - support need isn't in older 3.9

javascript - Sorting icon issue with Jquery Datatable fixd header -

Image
i have follwoing script. it enables fixed header jquery datatable.. var alertion = 0; $(document).ready(function() { $(window).on('scroll', function() { var scrolltop = $(this).scrolltop(); var topdistance = $("#campaigns_list").offset().top; if(topdistance < scrolltop) { if($(".fixedheader").length == 0) { new $.fn.datatable.fixedheader(campaign_overview_table, {"offsettop": 82},{ "top": true }); } else { $(".fixedheader").not(':last-child').remove(); } } else { $(".fixedheader").remove(); } }); }); the datatable initialized way campaign_overview_table = $("#campaigns_list").datatable(); now every thing runs fine,

Using custom user instead of ASP.NET IdentityUser -

i'm new on asp.net identity , trying customize identity provided while creating new mvc project. asp.net identity automatically creates few tables handle authentication , authorization itself. my main goal create users table others. i've tried following code prevent creating these tables: protected override void onmodelcreating(dbmodelbuilder modelbuilder) { base.onmodelcreating(modelbuilder); modelbuilder.ignore<identityuserrole>(); modelbuilder.ignore<identityuserclaim>(); modelbuilder.ignore<identityrole>(); } when want create user, following error returning: the navigation property 'roles' not declared property on type 'applicationuser'. verify has not been explicitly excluded model , valid navigation property. i found built-in identity user has following structure: identityuser<string, identityuserlogin, identityuserrole, identityuserclaim>, iuser, iuser<string> what n

mysql - Automatically xampp shutdown when computer start -

6:29:08 pm [mercury] run program xampp root directory! 6:29:08 pm [tomcat] problem detected: tomcat not found! 6:29:08 pm [tomcat] disabling tomcat buttons 6:29:08 pm [tomcat] run program xampp root directory! 6:29:08 pm [tomcat] problem detected: required tool catalina_start.bat not found! 6:29:08 pm [tomcat] problem detected: required tool catalina_stop.bat not found! 6:29:08 pm [tomcat] problem detected: required tool catalina_service.bat not found! 6:29:08 pm [main] starting check-timer 6:29:08 pm [main] control panel ready i installed xampp , use correctly.if shut down computer , start xampp apache,mysql,and options buttons disabled.then again uninstall , insatll xampp time worked.but if computer shutdown , start xampp not worked.i googled dll missing like.but not work.what problem exactly.anybody guide me. how take backup existing databases.i cant know how retrieve database files.

Convert SQL query to Android Azure Mobile Service query -

i have query works fine in azure sql database, i'm trying use within android application , can't work correctly. find overlaps in time bookings. here sql query dummy data, arrival , depart both integers: select * bourguestmob.tableobjectbookings tabobjid = 28 , day = 30 , month = 3 , year = 2015 , ((arrival <= 1600 , depart > 1600) or (arrival< 1800 , depart >= 1800)); using mobile service provided, have use query like: tableobjectbookingstable.where().field("tabobjid").eq(tables.get(i).getid()) .and().field("day").eq(day).and().field("month").eq(month).and().field("year").eq(year) .and().field("arrival").lt(inttime).or().field("arrival").eq(inttime).and().field("depart").gt(inttime) that's have partially think part of query needs nested evaluated correctly. i think want change end of query so: .and(field("arrival").lt(inttime).or() .field("arrival&quo

how to read sms while testing in appium or selenium -

while testing of android , ios app. provisioning screen of app, otp usecase comes stops further testing of app. usecase is. when user enters mobile number in app's starting page instruction . after tap on send button text box otp option comes on app's screen. upto point, possible record/playback. after this, stops our process. because usecase not possible automate our app further processings. here, otp comes via sms , verification purpose user needs enter otp(one time passcode) comes via sms. so, complication ... how check otp sms app of device, , return testing app , enter verification code it. step validate user , app appears user. query is... how can test use case using automation? please me because blocks complete further testings. i think cannot navigate 1 application application single test passing capabilities of test application , cannot work application. however workaround can try is: 1. first test, send otp test application. 2. second test, ot

.net - How to calculate memory usage as Task Manager does? -

Image
ok using wmi (.net/c#) collect data specific process running on machine. data through win32_perfformatteddata_perfproc_process class. class has lot of properties interested in follows: uint64 pagefilebytes; value, in bytes, process has used in paging file(s). paging files store pages of memory used process not contained in other files. paging files shared processes , lack of space in paging files can prevent other processes allocating memory. uint32 poolnonpagedbytes; value, in bytes, in nonpaged pool, area of system memory (physical memory used operating system) objects cannot written disk, must remain in physical memory long allocated. poolnonpagedbytes in win32_perfformatteddata_perfos_memory calculated differently poolpagedbytes property in win32_perfformatteddata_perfproc_process, might not equal total of poolpagedbytes instances of win32_perfformatteddata_perfproc_process. property displays last observed value only; not average. uint32 poolpagedbytes; value

javascript - How do I make the Codeschools angular side look similar? -

i've tried quite time after passing codeschools "shaping angular" course make work. last thing tried copy source code make sure there no typos on side , results vary quite lot , don't know i'm doing wrong @ point. this site looks on gitpages: http://danieboy.github.io/codeschool-shaping-up-with-angular-master/index.html this looks on course website: http://i.imgur.com/r3xlcp7.png anyone able shed light on problem hero. the actual source can found here: http://discuss.codeschool.io/t/shaping-up-with-angularjs-source-code-demo/5363 it seems have style.css file not included in code. file specifies layout , appearance body tag, img-thumbnails, img-wrap, small-image, thumbnail classes , others. right now, add these classes elements in html files, there no css stylesheet define them. check out plunker share @ above link. you'll need create css file specifies appropriate styles these classes , reference in index file header.

preg replace - PHP preg_replace supplement link URL pattern -

i have following urls structure: http://example.com/item/example-descriptions/6454986 http://example.com/item/example-bla-bla-bla/6545455 http://example.com/item/example-other-url/5454555 i need add text numbers (add "/demo/" , "?id=test") http://example.com/item/example-descriptions/demo/6454986?id=test http://example.com/item/example-bla-bla-bla/demo/6545455?id=test http://example.com/item/example-other-url/demo/5454555?id=test here couple of ways imperfect: $myurl = 'http://example.com/item/example-descriptions/6454986'; if (substr_count($myurl, 'example.com')){ $url = "$myurl.html"; $url = preg_replace('/^(.*)\/([^.]+)\.html$/','$1/demo/$2?id=test', $url); echo "$url"; } else { echo "$myurl"; } and $myurl = 'http://example.com/item/example-descriptions/6454986'; if (substr_count($myurl, 'example.com')){ $url = explode('

windows - CasperJS script never exits -

my casperjs script never stops executing. var casper = require('casper').create(); casper.useragent('mozilla/5.0 (windows nt 6.3; wow64) applewebkit/537.36(khtml, gecko) chrome/41.0.2272.101 safari/537.36'); casper.start('https://www.google.co.in/',function(){ casper.wait(3000,function(){ this.echo(this.gettitle()); }); }); casper.run(); it looks if casperjs never exits. issue on windows. see this: c:\> casperjs script.js c:\> script output more script output _ it has how casperjs installed , invoked. happens when have cygwin installed , install casperjs through npm. npm detect have cygwin , create special batch file start casperjs with. there somewhere bug how whole situation handled, doesn't affect functionality of casperjs. if press enter, see prompt again: c:\> casperjs script.js c:\> script output more script output c:\> _ if use casperjs master branch on github, proper exe file executes without i

turtle graphics - Drawing a fractal tree in Python -

i trying draw fractal tree in python, has 3 branches. know how draw tree 2 branches, 3 branches...not sure tried find examples, couldn`t. found examples of trees 2 branches. have ideas how that? for 2 branches tree used following code: import turtle def tree(f_lenght, min_lenght=10): """ draws tree 2 branches using recursion """ turtle.forward(f_lenght) if f_lenght > min_lenght: turtle.left(45) tree(0.6*f_lenght, min_lenght) turtle.right(90) tree(0.6*f_lenght, min_lenght) turtle.left(45) turtle.back(f_lenght) turtle.left(90) tree(100) turtle.exitonclick() here expanded example. using method make branches, easy make them overlap added few parameters that. feel free play around code, example of arbitrary levels of recursion. import turtle def tree(f_length, spray=90., branches=2, f_scale=0.5, f_scale_friction=1.4, min_length=10): """ draws tree 2

javascript - alert showing once instead of several times ScriptManager asp.NET -

i experience issue using alert('mytext'); through scriptmanager.registerstartupscript() . the problem is, when use in loop, example, writting : for(int = 0; < 3; i++) { scriptmanager.registerstartupscript(page, page.gettype(), "alert", "alert('hello world');", true); } the alert displayed once, instead of 3 times. to precise, function takes 5 parameters, : control control : control of page type typeofcontrol : type of control string key : key used identify js script string script : js script itself boolean addscripttags : put script <script></script> or not the essence of problem can't specify key . tryied use milliseconds identify each script seems script faster , have same amount of millisecond (and cannot more precised time...). question : how use possible unique idenifier key parameters ? or there alternative ?

javascript - Keeping slideshow on top with page below visible -

i have pretty big intranet site @ work, there detailed work descriptions. there links in procedure bring pics, , i'm using highslide. default behavior bring gallery , dim background. when click outside gallery closes. of users keep gallery up, on top can follow procedure. of keep having bring gallery up. have pop on section of page pops modal html in it(i have calculators popping up). behaviors of these stay on top of page until close them. i'd same behavior gallery, possible? a highslide gallery/image can stay open highslide html popup. need do, removing hs.dimmingopacity setting gallery. since haven't seen page, can't tell find setting in gallery setup.

mysql - PHP keeping session logged on after link -

i have written page displays load of data mysql database , works perfect except when click home link (the title of page) logs out , need log in, im missing stupid or not doing need, code below <?php session_start(); ?><title>vend365 monitor (beta test)</title> <h1><u><a href="http://www.codeman.org/v365.php">vend 365 online monitor (beta test)</a><p></p></u></h3> <?php require_once ("v365connect.php"); //following if 'update' clicked if (isset($_post['lastseen'])){?><p> <style> table, th, td { border: 1px solid black; border-collapse: collapse; } th, td { padding: 1px; text-align: left; } </style> <h1>vend 'last seen' times: page loaded @ <?php echo date("d/m/y g:i:s"); ?></h1> <?php $result1 = mysql_query("select distinct customer vends order customer") or die(mysql_error()); whi

python - Wrapping C/C++ Library with SWIG -

i've got project i'm working on requires use of topaz signature capture pad. our product uses activex control provided topaz collecting signatures on website, we're trying move desktop application powered python. python allow branch out multiple os's without work. topaz provides 'c' library ( http://www.topazsystems.com/sigpluslibrary.html ) interfacing devices. believe i've determined c++ (uses classes , other c++ constructs). i've attempted create wrapper python using swig , cython, have not had whole lot of luck. my directory structure swig this: sigswig includes (contains of headers topaz shared c library) setup.py siglib.i signature.i etc... setup.py # setup.py import distutils distutils.core import setup, extension module = extension( "_siglib", ["siglib.i"], swig_opts=['-c++'], language='c++',

custom exception mapping in spring security xml -

i giving below snippet in spring security.xml <!-- exception mapping configuration --> <bean id="securityexceptiontranslationhandler" class="com.abc.xyz.exceptionmappingfailurehandler" > <property name="exceptionmappings"> <props> <prop key="org.springframework.security.authentication.credentialsexpiredexception">/408</prop> </props> </property> </bean> i getting error while starting tomcat saying : invalid property exceptionmappings of com.abc.xyz.exceptionmappingfailurehandler class :bean property exceptionmappings not writtable or has invalid setter method . what should content of com.abc.xyz.exceptionmappingfailurehandler class ? appreciated ! your class should work: package com.abc.xyz; public class exceptionmappingfailurehandler { public void setexceptionmappings(map mappings) {

css - chrome and IE layout Differences issue -

Image
i having weird layout issues between ie , chrome, can decent on one, not other. moving drop-down menu bars css gets great on chrome, moves 1 of bars way far middle of page in ie. not best @ web programming/layouts, may missing small/simple. attached @ pictures of issue. ie-prod chrome-prod ie-dev(changes) chrome-dev(changes) the changes have made far css , here are: ( top dropdown menu) #searchbar { margin: 3px 0; padding: 3px 0; width: 190px; clear: left; } /*translate element*/ #google_translate_element { color: transparent; } to: #searchbar { position:relative; top: 15px; right: -10px; margin: 3px 0; padding: 3px 0; width: 190px; /*clear: left;*/ } /*translate element*/ #google_translate_element { position: relative; left: -310px; color: transparent; } the related html/ascx code follows (no changes between prod/dev)(links removed): <div id="container"> <div class="skin-heade

itext - can BR tag work inside TD with XmlWorker? -

<td>text text text</br>text text<td> is legitimate html - throws error xmlworker 5.5.5 , itext 5.5.5 com.itextpdf.tool.xml.exceptions.runtimeworkerexception: invalid nested tag br found, expected closing tag td. if remove 'br' code works, of course not multiline row this not fixed using white-space:pre in td css, , converting 'br' carriage return, new line ignored itext is feature/ issue/ never been asked before thing? or missing not in examples? html file... link this invalid xhtml: <td>text text text</br>text text<td> this valid xhtml: <td>text text text<br />text text<td> please change </br> <br /> . because when xml parser encounters closing tag </br> without having encountered opening tag <br> first, throw exception because xml invalid. note <br /> shorthand <br></br> (an opening tag followed closing tag).

python - Automate clicking of menu item and opening file - Windows XP -

i have windows xp computer, running lasercut 5.3. i automate process of importing dxf file, going file > import > [selecting dxf] > clicking import. the dxf file in same location. (c:\autocut\receivedfile.dxf) is there way can automate clicking through of importing file? the computer runs windows xp professional , has python 2.7 installed. school computer, rather not install programs, can if way. thanks take @ pywinauto: http://pywinauto.github.io/ there's swapy project, might useful getting head start on generating pywinauto code: https://code.google.com/p/swapy/

python - What's an elegant way for one loop iteration to affect another? -

i needed process config file now. because of way generated, contains lines this: ---(more 15%)--- the first step strip these unwanted lines out. slight twist, each of these lines followed blank line, want strip. created quick python script this: skip_next = false line in sys.stdin: if skip_next: skip_next = false continue if line.startswith('---(more'): skip_next = true continue print line, now, works, it's more hacky i'd hoped. difficulty when looping through lines, want content of 1 line affect subsequent line. hence question: what's elegant way 1 loop iteration affect another? another way itertools.tee , allows split iterator two. can advance 1 iterator 1 step, putting 1 iterator 1 line ahead of other. can zip 2 iterators , @ both previous line , current line @ each step of for loop (i use izip_longest doesn't drop last line): from itertools import tee, izip_longest in1, in2 = tee(

average list of dictionaries in python -

i have list of dictionary this data = [{'name': 'john', 'height': 176, 'weight':62, 'iq':120,..},...] the .. signifies various other integer/float attributes , elements of list has same format.. i want average height, weight , other numerical attributes in cleanest/easiest way. i not come better way normal looping messy... , don't want use external packages you can use following sum([item['weight'] item in data])/len(data) and use float(len(data)) if want more exact value.

How to deploy SharePoint 2013 Provider hosted app on Microsoft Azure and SharePoint 2013 On Premise? -

i need deploy sharepoint 2013 provider hosted app on microsoft azure , sharepoint 2013 on premise. same app works when deployed on microsoft azure , sharepoint 2013 online, sharepoint context error in case of sharepoint on premise. app correctly redirects azure site. in regard highly appreciated. for on premise, need setup high trust app , generate client context using windows authentication since there no token available on premise. please find below steps setup on premise app , troubleshooting steps http://blogs.msdn.com/b/shariq/archive/2013/05/07/how-to-set-up-high-trust-apps-for-sharepoint-2013-amp-troubleshooting-tips.aspx please provide error message

node.js - Highland.js for CSV parsing -

i'm trying write functional manner. we're using highland.js managing stream processing, because i'm new think i'm getting confused how can deal unique situation. the issue here data in file stream not consistent. first line in file typically header, want store memory , zip rows in stream afterwards. here's first go @ it: var _ = require('highland'); var fs = require('fs'); var stream = fs.createreadstream('./data/gigfile.txt'); var output = fs.createwritestream('output.txt'); var headers = []; var through = _.pipeline( _.split(), _.head(), _.doto(function(col) { headers = col.split(','); return headers; }), ...... _.splitby(','), _.zip(headers), _.wrapcallback(process) ); _(stream) .pipe(through) .pipe(output); the first command in pipeline split files lines. next grabs header , doto declares global variable. problem next few lines in str

c# - How to compare these two strings representing a file name -

i want compare 2 strings represent file name: private void button2_click(object sender, eventargs e) { string search = textbox1.text; string[] files = directory.getfiles(@"c:\cache", "*.*", searchoption.alldirectories); int flag = 0; string dir = @"c:\cache"; string[] files1; int numfiles; files1 = directory.getfiles(dir); numfiles = files.length; messagebox.show("files searched : " + numfiles); console.writeline("files searched : " + numfiles + "<br>"); foreach (string name in files1) { if (textbox1.text.substring(23,30) == files1.tostring()) // << line { messagebox.show(name); } } } i have question how that, comparing using line: if (textbox1.text.substring(23,30) == files1.tostring()) where textbox1 = "http://localhost:11806/ourwork.html" files1 = "d:\m.tech\dissertation 2\cache\ourwork.html"

Apache CXF add namespace in XML response -

i trying return namespace information in xml response of rest service. using apache cxf 2.7.11. have configured </bean> <!-- cxf jaxb provider --> <bean id="jaxbxmlprovider" class="org.apache.cxf.jaxrs.provider.jaxbelementprovider"> <property name="namespaceprefixes" ref="xmlnamespacemap"></property> </bean> <util:map id="xmlnamespacemap" map-class="java.util.hashmap"> <entry value="li" key="http://www.abc.xom/xyz"/> </util:map> but not return namespace information in xml response. tried debug cxf code , found in org.apache.cxf.jaxrs.provider.abstractjaxbprovider class in setnamespacemapper, code checks "namespacemapperpropertyname", not sure property means. also if suggest other way return custom namespace in apache-cxf, helpful. thanks

ios - AFHTTPRequestOperationManager file upload returns 500 server error -

im trying upload camera taken photo webservice afnetworking. this upload part code : cgsize newsize = cgsizemake(500.0f, 500.0f); uigraphicsbeginimagecontext(newsize); [_imagedata drawinrect:cgrectmake(0,0,newsize.width,newsize.height)]; uiimage* newimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); nsdata *imgdata = uiimagejpegrepresentation(newimage, 0.9f); afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager]; nsdictionary *parameters = @{@"user": "test_user"}; [manager post:@"http://www.mywebsite.com/webservice.aspx" parameters:parameters constructingbodywithblock:^(id<afmultipartformdata> formdata) { manager.responseserializer = [afhttpresponseserializer serializer]; [formdata appendpartwithformdata:imgdata name:@"image"]; } success:^(afhttprequestoperation *operation, id responseobject) { nslog(@"success: %@", responseo

WinRT API WIndows::System::Launcher::LaunchFileAsync() usage from C++ -

i'm trying launch image using winrt api windows::system::launcher::launchfileasync() . code snippet follows: roinitialize(ro_init_multithreaded); string^ imagepath = ref new string(l"c:\\users\\goodman\\pictures\\wood.png"); auto file = storage::storagefile::getfilefrompathasync(imagepath); windows::system::launcher::launchfileasync(file); i'm getting error launchfileasync() api: error c2665: 'windows::system::launcher::launchfileasync' : none of 2 overloads convert argument types can please how solve this. i'm new winrt c++ coding . the method getfilefrompathasync not return storagefile , returns iasyncoperation<storagefile>^ . have convert latter former, follows: using namespace concurrency; string^ imagepath = ref new string(l"c:\\users\\goodman\\pictures\\wood.png"); auto task = create_task(windows::storage::storagefile::getfilefrompathasync(imagepath)); task.then([this](windows::sto

swing - Java cant make TempListener work -

import javax.swing.*; import java.awt.*; import java.awt.event.*; public class circlepanel extends jpanel { private jtextfield xfield, yfield, diameterfield; private jbutton redraw; private jlabel xlabel, ylabel, rlabel; circle mycircle = new circle (150, 150, 30, color.red, color.white); graphics g; //paint objects on panel public void paintcomponent (graphics page) { super.paintcomponent(page); g = page; mycircle.draw(g); } public circlepanel(){ xlabel = new jlabel("x= "); ylabel = new jlabel("y= "); rlabel = new jlabel("r= "); xfield = new jtextfield(5); xfield.addactionlistener(new templistener()); yfield = new jtextfield(5); yfield.addactionlistener(new templistener()); diameterfield = new jtextfield(5); diameterfield.addactionlistener(new templistener()); redraw = new jbutton("redraw!"); redraw.addactionlistener(new buttonlistener()); add(xlabel); add(xfield); add(ylabel);

javascript - check if object is a mongo cursor -

i have method in want either receive list or mongo cursor , react that, example: createfromtemplate: function(template) { var iter; if(template instanceof mongo.cursor) { iter = template.fetch(); } else if(template instanceof array) { iter = template; } else { throw new meteor.error(500, 'template must cursor or array'); } } however, seems return false when don't expect it > var p = pagetemplates.find(); // mongo cursor > var parray = p.fetch(); // array > object.prototype.tostring.call(p); [object object] > typeof p object > p instanceof mongo.cursor false how can tell if object mongo cursor? you should able use instanceof mongo.collection.cursor (not mongo.cursor ). console: > = meteor.users.find() <- localcollection.cursor {collection: localcollection, sorter: null, _selectorid: undefined, matcher: minimongo.matcher, skip: undefined…} > instanceof mongo.collection.cursor <- true

angularjs - How to target ng-show on specific items in ng-repeat? -

Image
http://plnkr.co/edit/aigcpjewtj0rwnuocjsw?p=preview i want remove button show popover that item . how go this? html: <li ng-repeat="acc in accounts"> <div class="well well-sm"> <div class="popover-remove" ng-show="popoverremove">click remove item</div> <h4>{{acc.label}}</h4> <button class="btn btn-default" ng-mouseover="showpopover()" ng-mouseleave="hidepopover()">remove</button> </div> </li> angular controller: var app = angular.module('myapp', []) .controller('accountsctrl', ['$scope', function($scope) { var vs = $scope; vs.accounts = [ { id: '1', label: 'bitage' }, { id: '2', label: 'blockchain.info

java - Failed having default tenant to connect to a Multi-tenant application -

i want migrate existing single-tenant application multi-tenant application. first step create default tenant , connect application, code following: the model : @entity @multitenant(multitenanttype.table_per_tenant) @tenanttablediscriminator(type = schema, contextproperty = multitenant_property_default) @table(name = "utilisateur") public class user implements serializable { @sequencegenerator(name = "user_seq", sequencename = "user_seq", allocationsize = 1) @generatedvalue(strategy = generationtype.sequence, generator = "user_seq") @column(name = "id", nullable = false) private integer id; private string username; private string password; @manytomany @jointable(name = "user_roles", joincolumns = { @joincolumn(name = "user_userid")}, inversejoincolumns = { @joincolumn(name = "role_roleid")}) private lis