Posts

Showing posts from February, 2015

iphone - Search bar filter not working -

i creating search bar filter pragmatically, sadly not working. believe missing minor detail.the table view working correctly not search bar filter.i not using story board nor xib files project. .h uisearchbar *searchbar; nsmutablearray * getterms; @property (strong, nonatomic) nsmutablearray* alltabledata; @property (strong, nonatomic) nsmutablearray* filteredtabledata; @property (nonatomic, retain) uitableview *tableview; @property (nonatomic, assign) bool isfiltered; .m -(void)viewdidload{ searchbar.delegate = self; searchbar = [[uisearchbar alloc] initwithframe:cgrectmake(30, 10, 750, 31)]; searchbar.placeholder = @"search"; //place holder searchbar.backgroundcolor = [uicolor whitecolor]; searchbar.autocorrectiontype = uitextautocorrectiontypeno; searchbar.backgroundcolor = [uicolor clearcolor]; searchbar.keyboardtype = uikeyboardtypedefault; self.navigationitem.titleview = searchbar; searchbar.layer.cornerradius = 5; searchbar.layer.maskstobou

sql server - Join a column into a string -

i think need better understand xml path working. maybe can me simple example: given declare @p varchar(200) declare @phn table (phone varchar(25)) insert @phn values('204-721-1532') insert @phn values('306-922-2058') insert @phn values('204-728-3852') i want change rows in @phn.phone varchar, which, if python, like set @p = ', '.join(@phn.phone) # alas now, this works point: select distinct phone+', ' @phn xml path('') ==> 204-721-1532, 204-728-3852, 306-922-2058, there's trailing comma, no problem there. need result varchar variable, like select distinct @p = phone+', ' @phn xml path('') but that's not allowed (msg 6819, level 16, state 3, line 45/the xml clause not allowed in assignment statement.) eventually, going go scalar function, , want function return joined string. i think need: sql fiddle declare @p varchar(200) declare @phn table (phone varchar(25)) insert @phn

c - storage size of 'start' isn't known -

i have message error: storage size of 'start' isn't known when compile program. error here: struct _timeb start, finish; i make header file when i've put declarations , prototypes #include <stdio.h> #include <stdlib.h> #include <sys/timeb.h> #include <time.h> in .c file, put #include "image.h" #include <math.h> this indicates description of mentioned struct has not yet been encountered, , trying create variable of type compiler doesn't yet know about. missing header: #include <sys/timeb.h>

java - My different sessions are being duplicated with the same last activity and session id, why? -

i'm using spring security, when log in different browsers same user (which set possible have multiple sessions), data passed controller (where sessioninformation every principal) view being duplicated instead of creating new session id , last activity same different browser sessions well. this part of spring-security.xml sessionregistry configured , stuff. <form-login login-page="/login" default-target-url="/welcome" always-use-default-target="true" authentication-failure-url="/loginfailed"/> <logout logout-success-url="/logout" /> <custom-filter position="concurrent_session_filter" ref="concurrencyfilter" /> <custom-filter after="form_login_filter" ref="myauthfilter" /> <session-management session-authentication-strategy-ref="sas&

Formatting Human Names - PHP (or any language) library? -

is there way format human names? example, "john doe" should "john doe". or "angus macgyver" should "angus macgyver". etc. i know solution not going complete (there's many rules names), better nothing. suggestions? as suggested in comments, in php, can this: $name_formatted = ucfirst(strtolower($name_unformatted)); this handle 90% of cases. put function , add rules deal macguyver, o'reilly type exceptions. update: pointed out, ucfirst first word in string. use regex uppercase first letters in every word, or function this: <?php $name_unformatted = "john doe"; function format_name($name_unformatted) { $name_formatted = ucwords(strtolower($name_unformatted)); // handle 90% of names // ucwords work strings, if wanted break out each word can deal exceptions, this: $separator = array(" ","-","+","'"); foreach($separator $s) { if (strpos($nam

datetime - day of week and hour of day in a if statement c# -

i want if day, , time of day equal true in if statement. have day part down, can't figure out time part out. let wan time 9am. here have far var dt_check_monday = datetime.now.dayofweek; if (dt_check_monday == dayofweek.monday && time_now = datetime.now.hour==9) { //do } i can't use error: operator '&&' cannot applied operands of type 'bool' , 'system.timespan' thanks in advance. i think time_now having timespan datatype. can try this if (dt_check_monday == dayofweek.monday && time_now.hours == 9) { //do }

javascript - How do I horizontally extend the clickable area of an inline span? -

i have 2 spans, both of trigger action when clicked: <div> <span>this multiline<br/> chunk of text.</span> <span>and <br/> second one.</span> </div> i user able click anywhere in containing div (which styled box), , have click associated 1 or other span. right now, user has click on actual text click event fired. here's looks like: http://jsfiddle.net/bjjlf/1/ . i want spans appear single paragraph (ie, need keep them styled display: inline ). there going line breaks, i'm flexible re: how created (so can kill </br> s if necessary). is there easy css solution i'm missing, or have put click handler on surrounding box , coordinate math figure out span click belongs to? okay, found pure-css solution seems pretty far. suggestions on improving helpful. main constraint right need know width of containing box, constraint can work with. the idea create absolute-positioned psuedo-before

Reverse-Engineer SQL Server Compact Edition database using Entity Framework -

can "reverse engineer" sqlce (sql server compact edition) database using entity framework? i've followed msdn development center tutorial code first existing database on using entity framework "reverse engineer" database can use code-first it. per tutorial i've: installed entity framework power tools . generated application (empty mvc4) in visual studio 2012. added database (i need use sqlce). right-clicked root project folder , selected entity framework > reverse engineer code first . when connection properties window pops changed datasource type 'microsoft sql server compact 4.0. browse project app_data folder , select sqlce database. test connection (success) , click ok. then following error thrown: system.argumentexception: modelentitycontainername parameter '...\app_data\cesdfcontext' contains characters not valid. confirmed following the link provided in comment (by (thanks , credit to(erikej)) original

c# - System.IO.PathTooLongException On A URL -

i running issue long url throw system.io.pathtoolongexception. strange because system.io.pathtoolongexception physical files, not related url's. as example, have url looks following : products-for-sale.mvc/searchterm1-something/price-1000-1500/searchterm3-etcetc/ basically search terms bloating out url. allow keyword search can kinda big if user looking specific. side note, .mvc on url hangover of application when ran on iis6 , extensionless url's not supported, shouldn't issue here. what believe issue is, looks physical file using url. wrong, think issue. every article pathtoolongexception's revolve around actual files, not url's being long. i had inkling within iis handler mappings, switch off check if physical file exists (i think setting in iis6?), in iis7 under request restrictions of handler mapping, has "invoke handler if request mapped to" , file/folder/file or folder. not ticked .mvc in iis, , there no else have found try , "pl

c# - Async method failing when called -

i have method public class websearcher : iwebsearcher { private static readonly string _rooturi; private static readonly bingsearchcontainer _bingcontainer; private static readonly string _accountkey; static websearcher() { _rooturi = configurationsettings.settings.rooturi; _bingcontainer = new bingsearchcontainer(new uri(_rooturi)); _accountkey = configurationsettings.settings.accountkey; _bingcontainer.credentials = new networkcredential(_accountkey, _accountkey); } public task<ienumerable<webresult>> searchasynch(string query) { if (query == null) { throw new argumentnullexception("query cannot null"); } dataservicequery<webresult> webquery = _bingcontainer.web(query, null, null, null, null, null, null, null); return task.factory.fromasync(webquery.beginexecute(null, null), asyncresult => webquery.endexec

jquery - Javascript Date Object's getUTC and setUTC -

i'm having little trouble wrapping head around javascript object's getutc , setutc methods. i'm working on frontend countdown clock next shipping cuttoff using jquery plugin, tinytimer. cannot use backend scripts on platform i'm working on. timer working well, except don't know how adjust time zone var d = new date(); /* month & time & day of week*/ var monthoftheyear = d.getmonth(); var dayofthemonth = d.getdate(); var dayoftheweek = d.getday(); /*new years day */ if( monthoftheyear == 0 && dayofthemonth == 1){ d.setdate(d.getdate() + 1); $('#timer').prepend("<p>closed today new year's day</p>"); } /*memorial day */ if( monthoftheyear == 4 && dayofthemonth >= 25 && dayoftheweek == 1){ d.setdate(d.getdate() + 1); $('#timer').prepend("<p>closed today memorial day</p>"); } /*independence day */ if( monthoftheyear == 6 && dayofthemonth == 4 ){ d.setdate(

PHP/MySQL download file -

i using php/mysql in table have column called 'pdf'. each row has path pdf file on web server, using php code: $sql="select * table1 customer_sequence = '53' , invoice_number = '1234' , sequence = '7839' "; $rs=mysql_query($sql,$conn) or die(mysql_error()); $result=mysql_fetch_array($rs); header('content-disposition: attachment; filename=/path/to/file/'.$result["pdf"].''); header('content-type: application/pdf'); readfile('/path/to/file/'.$result["pdf"].''); the sql working ok, once tries download not doing anything. i have tried: header("location: /path/to/file/".$result["pdf"].""); but still no luck - ideas can do? okay, let's sort out. @ first, shouldn't output full path file in header. use this: header('content-disposition: attachment; filename='.$result["pdf"]); filename in header tells browser

python - PySide One slot to multiple widgets -

i creating small app in python using pyside. read lines text file , display each line in separate qlineedit widget. each "entry" has 2 line edits , 2 qpushbuttons. every line add widgets. problem set signal-slot qpushbuttons, when "entries" generated, last entries qpushbuttons connects slot. may please me. here code class itemlogger(qtgui.qmainwindow, ui.ui_mainwindow): def __init__(self, parent = none): super(itemlogger, self).__init__(parent) self.setupui(self) self.parsebossitem() self.combobox.currentindexchanged.connect(self.parsebossitem) self.increase.clicked.connect(self.add_subtract) def add_subtract(self): initial = 1 print "kajskasdjflsdkjflk" def addrow(self, item): self.frame = qtgui.qframe() self.layout = qtgui.qhboxlayout() self.itemname = qtgui.qlineedit(item) self.itemname.setreadonly(true) self.itemcount = qtgui.qlineedit() self.itemcount.settext("0") s

vb.net - How to select an image from resources via a string? -

i'm coding pokedex type deal practice class. basically, have class titled "pokemon". 1 of properties of class "imgname" want use display image resources same name. vb doesn't allow me call imgname string , use 'my.resources.imgname' how can this, or alternative options it? want determined property in pokemon object, , don't want have hard code in if-elseif statement every single pokemon. one way can have resource file added project. drop resource it. able address this: my.resources.resource1.imgname resource1 resource file name, , imgname resource name here. need hard code every call. however, full intellisense support type checking. if don't want hard code, here stripped down version of production code: imports system.reflection imports system.xml.linq public class embeddedresourcemanager private class embeddedresourcemanagercore private shared _executingassembly assembly private shared _resourceprefix s

Transfer columns into rows in sql server management studio -

table 1 column_pk num name id -1 id-2 id-3 1 145 sam 12345 null 34527 2 187 tom null 76544 null 3 567 david 78965 43215 89765 4 675 john null null null as shown in above table given column_pk id-1, id-2, id-3 can have values or can null now have move id-1 , i d-2 , id-3 table2 rows follows: since sam has 2 id’s: id-1 & id-3 same num 145 sam has 2 rows since david has 3 id’s in table 1 , table 2 has 3 rows david same num 567 table 2 column_pk num name id 1 145 sam 12345 2 145 sam 34527 3 187 tom 76544 4 567 david 78965 5 567 david 43215 6 567 david 89765 i tried using few update statements, statements useful limited data only. can please me when there huge transfer of data. since using sql server 2008, can unpivot data using cross apply , values . pro

c - making custom Malloc, what is wrong here? -

i've been working on little custom worstfit malloc using double-linked list while, , although small thought work. there obvious wrong code? #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "mymal.h" typedef struct node { int size; int status; struct node *next; struct node *previous; } node; node *endnode; node *rootnode; void *worstfit_mall(int size) { node *thenode = sbrk (size + sizeof(thenode)); void *ptr; if (rootnode == null) { thenode->status = 1; thenode->size = size; thenode->previous = thenode; thenode->next = thenode; rootnode = thenode; endnode = thenode; return thenode; } node *worstnode; worstnode = worstfit(size); if (worstnode != null) { thenode->status = 1; thenode->size = size; node *newnode = sbrk((worstnode->size - thenode->s

c# - SharePoint List- OData - Is it possible to acces the Choices in a Choice column? -

i'm in process of writing dynamic odata client connects sharepoint 2010 server. i able access list , it's related columns. if it's choice column able access possible choices have been defined. possible? i've been trying find information want feeding /listdata.svc/$metadata iedmmodel. can't figure out might though. here's i've started with, can loop through entities in model, , through respective properties. can see choice column's show type entity. example: have column named aquisition_type, "donation","purchase","tax sale" possible choices. assuming isn't dead end, pointers appreciated. foreach ( iedmentitytype type in model.schemaelementsacrossmodels().oftype<iedmentitytype>()) { str_test += "\n" + type.fullname(); foreach (iedmproperty property in type.properties()) { //my choice columns of type entity if (pro

c# - Can I create a wrapper that intercept all calls to objects implementing certain interface? -

let's have interface ifoo interface ifoo { int bar(); int bar2(); void vbar(); //etc, } can create wrapper takes ifoo object , before/after actual call? e.g. when this ifoo wrappedfoo = new wrapper<ifoo>(actualfooobject).object; wrappedfoo.bar(); then wrapper.bar() method execute this precall(); //some code can define in wrapper actualfooobject.bar(); postcall(); is there simple , clean way this? you can use code contracts approach. take on section 2.8 interface contracts of user manual (pdf).

How to reset telerik dropdownlist control value on client side -

i want reset dropdownlist selection on clear button click , set default message. <telerik:raddropdownlist id="raddrpdwn_user" runat="server" width="325px" defaultmessage="--select--"> </telerik:raddropdownlist> first of there isn't control in telerik called (raddropdownlist) , compatible control radcombobox control define using following ; <telerik:radcombobox id="raddrpdwn_user" runat="server" width="325px" defaultmessage="--select--"> </telerik:radcombobox> and in clear button : protected void clear_click(object sender,eventargs e) { raddrpdwn_user.clearselection(); } regards

d3.js - How can I add a duration histogram's time data to its bars? -

i working numerous d3 duration histograms , each different duration. tie in starting time of time range each bar represents div id inside each bar's html. information accessed via jquery. say example there's bar @ 00:10. add "00:10" bar's div. what can't figure out how hold of these times. suggestions on how this? to add attribute use selection.attr() example: bar.append("rect") .attr("x", 1) .attr("width", x(data[0].dx) - 1) .attr("height", function(d) { return height - y(d.y); }) .attr("data-time", function(d){return formatminutes(d.x)}) but, if want access api on click, d3's selection.on() : bar.append("rect") .attr("x", 1) .attr("width", x(data[0].dx) - 1) .attr("height", function(d) { return height - y(d.y); }) .on("click", function(d){ accessapi(formatminutes(d.x)) }) eg. http://jsf

html - How to word wrap inside table tds? -

this question has answer here: break long word in table cell percentage widths 7 answers the text inside table seems stretch 4000+px: http://letschat.info/a-list-of-amazon-questions-and-answers-from-glassdoor/ so can't read questions , answers. tried following: word-wrap in html table using table-layout: fixed and word-wrap: break-word, looked same. i not sure need do. try #td { word-wrap: break-word; } #table { word-wrap: normal; /* default, naturally */ }

sql server - Can I check what T-SQL statement had been executed in the database? -

i have c# application, thing in database, black boxed, possible can check t-sql statements had been run on sql server? thanks. profiler way go serge said keep query in pocket when can't approval enable profiler on production. select top 50 deqs.last_execution_time [time], dest.text [query] sys.dm_exec_query_stats deqs cross apply sys.dm_exec_sql_text(deqs.sql_handle) dest order deqs.last_execution_time desc of course want modify top 50 show more or less results. note: i've used such long time forgot didn't come myself. found on sqlauthority . credit credit due! :)

c++ - Why does this OpenCV code segfault? -

i'm preparing parallelize of c++ opencv code. i've come across segfault, , can't understand what's happening. here code: class exhaustivecomparisonmt { vector<mat> *m_sigs; mat *m_dist; public: exhaustivecomparisonmt(vector<mat> sigs, mat dist) { m_sigs = &sigs; m_dist = &dist; // gdb breakpoint 1 here } void operator() (size_t last_row, size_t last_col) const { mat diff = (*m_sigs)[0].clone(); // segfault happens here, gdb breakpoint 2 here (size_t = 0; != last_row; ++i) (size_t j = 0; j != last_row; ++j) { cv::absdiff((*m_sigs)[i], (*m_sigs)[j], diff); m_dist->at<double>(i, j) = cv::sum(diff).val[0]; } } }; void exhaustive_comparison(vector<mat> sigs, mat dist) { size_t width = sigs.size(); exhaustivecomparisonmt ecmt(sigs, dist); ecmt(width, width); } basically, vector of matrices being passed cons

sql - condition in where clause with optional parameter -

there thee input parameter in stored procedure. example, declare @fromdate datetime = null declare @todate datetime = null declare @id int = null i want write condition in clause like...if fromdate provided searching must done on @fromdate. if @fromdate not provided check @id variable if not null search basis on @id... something like... case when @fromdate not null (@fromdate null or ([created] between @fromdate , @todate)) else (@requestid null or id=@requestid) there 1 problem below solution...if @fromdate , @id both provided intesect of them , nothing return.....condition should like...if @fromdate given priority gives @fromdate if @id provided , result must not dependend @id parameter.... because depend on both parameters can use them both in condition: where (@fromdate null or ([created] between @fromdate , @todate)) or ((@requestid null or id=@requestid) , @fromdate null) ----mix @requestid & @fromdate

Restfb lib on android with proguard -

i'm using restfb library in android project, works super fine. when try run proguard it, it's completed successfully, when running app com.restfb.exception.facebookjsonmappingexception: must specify java type map to. @ com.restfb.defaultjsonmapper.tojavalist(unknown source) my proguard-project.txt contains lines -keep class com.restfb.** { *; } -keep interface com.restfb.** { *; } am missing something? the json mapper uses introspection find generic type information. proguard's obfuscation step removes default, because virtual machine doesn't need it, can preserve it: -keepattributes signature

java - path testing and branch testing -

can please explain me different between path , branch testing? i read in many articles still confused between two. i searched in stack overflow didn't find suitable answer please me providing link if duplicate question. thanks, quick summary summarized https://www.cs.drexel.edu/~jhk39/teaching/cs576su06/l4.pdf path testing: 100% path coverage. execute possible control flow paths through program. statement testing: 100% statement coverage. execute statements in program @ least once under test. branch testing: 100% branch coverage. execute enough tests assure every branch alternative has been exercised @ least once under test. in general path testing >= branch testing >= statement testing, in terms of how confidence can provide in correctness of system. discussion path coverage counts number of full paths input output through program executed, whereas branch coverage counts number of branches tested @ point in time. in definition

javascript - php: how to validate textbox using jquery ajax -

i have textbox, validate using jquery-ajax once user focusout textbox. validation include: server side, value goes php page , have validate it if validation success,show alert("succes"); else if error alert("failed"); i have doubt how jquery ajax show alert("failure"); till , have done success. i know below mention code,furthure should solve problem? please help <script type="text/javascript"> $(function() { $('input[id^="datepicker"]').on('focusout',function() { $.ajax({ url: "ajax_frmdate_validation.php?txtval="+$(this).val(), success: function(data){ alert('successfully ...'); } }); }); }); </script> -------------- -------------- <input class="plain" name="frmdate" value="" size="25" id="da

How can I connect database(Microsoft SQL server 2012) with Mathematica? -

i installed microsoft sql server 2012 , created new database, new tables & inserted values table. i want access data mathematica. read documentation opensqlconnection[] and jdbc[] didn not it. didn't create drivers in system. i installed database in system & want connect database mathematica. can me? here's recommendation: bring in databaselink package: needs["databaselink`"]; open connection database: conn = opensqlconnection[jdbc["microsoft sql server(jtds)", "/"], "username" -> "", "password" -> ""]; start using database. here example query on table "names" bunchofnames = sqlselect[conn, {"names"}]

c# - How to maintain the focus on same control after asynchronous postback? -

i have 3 textboxes , 1 in updatepanel refresh every 4 seconds. during refresh controls not in update panel loosing focus. want keep focus on controls. here code: <asp:updatepanel id="upnlchat" runat="server"> <contenttemplate > <asp:textbox id="txtchatbox" readonly="true" textmode="multiline" cssclass="mymultitextboxclass" runat="server"></asp:textbox> </contenttemplate> <triggers> <asp:asyncpostbacktrigger controlid="timerchat" /> </triggers> </asp:updatepanel> <asp:timer id="timerchat" interval="4000" runat="server" ontick="timerchat_tick" ></asp:timer> <table> <tr><td>user: </td><td colspan="2"><asp:textbox id="txtuser" runat="server" ></asp:textbox>

clojure - Is there any macro to help make a function with one open argument? -

(map (fn [x] (func 1 2 x)) [0 1 2]) func takes 3 arguments can written (map #(func 1 2 %) [0 1 2]) short. possible make more concise? in ocaml, (func 1 2) function. don't need create new 1 , pass map. clojure doesn't auto-currying, can't (func 1 2) , can use partial : (map (partial func 1 2) [0 1 2])

commit - Svn non-existent child node -

this should extremely simple question, find no answers anywhere. maybe on here can help... what's cause of problem when committing in svn, 1 gets message saying "attempted open non-existent child node 'name'"? how go fixing it? thanks, owen. i feel must provide answer in order give others may come along same problem handle on solution. the problem having when attempted commit changes svn netbeans ide, told couldn't commit because commit mechanism "attempted open non-existent child node 'name'". not have accurate idea of error means, tips given did put me in direction find out necessary fix within netbeans, , in process, learned thing or 2 patches are. so, solution problem generate patch on working copy against recent version in subversion repository. did netbeans going trunk directory of working copy, choosing team->export diff patch top menu. renamed working copy check out new 1 in place. after checking out new

wordpress - WP Query ignores variable for specific category -

ok i'm missing obvious here since it's simple thing, reason can't wp query work. want query posts category page user visiting (using get_the_category). - $category = get_the_category(); $category_id = $category[0]->cat_id; $category_items = new wp_query( array(    'post_type' => 'post',    'cat' => $category_id,    'showposts' => -1,    'orderby' => 'rand'    ) ); $category_id gives me correct id category page, referring inside wp query makes query posts regardless of category. try this: $category = get_the_category(); $category_name = $category[0]->cat_name; $category_items = new wp_query( array( 'post_type' => 'post', 'category_name' => $category_name, 'showposts' => -1, 'orderby' => 'rand' ) );

algorithm - Finding "line of best fit" using linear programming -

this homework question. i'm asked find coefficients of line of best fit given set of n dots(2d). coefficients b c in: ax+by=c.say there're n dots, use linear programming find coefficients leads smallest 'maximum absolute error', defined as: max(|a*xi+b*yi-c|), ranges 1-n. here's thought process: let m denote maximum absolute error. objective of linear programming minimize m. since m biggest of |a*xi+b*yi-c|, must bigger every 1 of them. (a*xi+b*yi-c)<= m, , (a*xi+b*yi-c)>= -m, (the second expression account absolute sign). i thought sufficient define problem. when put conditions solver, returned b c equal 0, in reality shouldn't. think i'm missing conditions here. can point out me? you should add 1 statement is: either or b should not 0. if both values 0 have valid solution system there no line both , b equal 0. edit: improving rerito's suggestion. line has either or b not equal 0. alo lines (k*a)*x + (k*b)* y + (k*c) , (a)*x

What's the difference between jQuery $().each() and implicit iteration? -

i have 2 inputs 2 separate search forms of same page. 1 has data-result-select-url attribute , 1 doesn't. <input id="q_id_eq" class="foo" type="text" size="30" name="q[id_eq]" data-result-select-url="/products/(id)" tabindex="-1"></input> <input id="q_id_eq" class="foo" type="text" size="30" name="q[id_eq]" tabindex="-1"></input> i write own select2 plugin these inputs. $ = jquery $.fn.my_select2 = (args) -> ... select_url = $(this).data("result-select-url") if select_url? $(this).on "change", (e) -> ... $(this).select2 args when use $().each() call plugiin my_select2() , works fine. 1 input receives "changed" event. jquery $('.foo').each -> $(this).my_select2() but if call my_select2() using jquery implicit iterations, both inputs receive

extjs - animate() function not work properly in EXTJS4 with IE 8 -

Image
i using extjs 4 ie 8 project. created 1 animation sequence of small circles. @ 1 interval of 1 second 1 circle disappeared , other circle disappeared. code :- me.startanimation=function(circles,color,direction,startindex,initindex) { try { circles.items[startindex].animate({ duration: 0, to: { fill:'#fff' } }).animate({ delay: 1000, to: { fill:color }, listeners: { afteranimate: function() { // execute custom method after animation if(direction==='direct') startindex++; else startindex--; if(startindex===circles.length || startindex<0)

database - Delete selected checkbox ticked rows -

i new on jsp. providing checkboxes in front of every row being fetched db. want delete rows checkboxes have been checked. please suggest how achieve task on submit of form. can make delete query @ end issue check boxes ticked or not ticket approach. have way request.getparameter("delete_checkbox").value or this? this need : http://theopentutorials.com/examples/java-ee/servlet/getting-checkbox-values-from-html-form-in-servlet/ as shown in tutorial in value attribute pass id of records. parse them long in servlet , make server hit delete .

javascript - Knockout mapping and foreach data-bind on table with buttons, missing reference to viewmodel? -

i use mvc4 , entityframework in combination knockout. use knockout mapping. run problem wich cannot solved. what want achieve: user clicks on delete button delete row table. [ works ] call delete action method on mvc controller actualy delete data database. [ works ] send new json object containing data of new changed table. [ works ] load new data in knockout viewmodel , update ui using ko.mapping.fromjs() , ko.applybindings() [does not work , realy lost here ] it looks totaly lost reference list of experiences wich use databind , foreach table with. , think has way call deletemethod within foreach loop. it looks javascript 'trick' var self = this; doesnt work reference correct data. here follows code use give better idea of situation. if more information needed please let me know. these mvc viewmodels: public class experienceoverviewmodel { public experiencemodel selectedexperience { get; set; } public list<experiencemodel> exper

special characters - Replace content of all files with some extension -

i have replace content in files specific extension. for eg: in folder tochange may have multiple sub folder, want change text isabcd isxyz in files extension html what batch such command, using windows actually there multiple items need replace. have them in key value form , need replace of them 1 one in files in folder my text have double quotes want replaced text follows if (louseragent.tolowercase().indexof("firefox") > -1 || (louseragent.tolowercase().indexof("msie") > -1 && louseragent.tolowercase().indexof("msie 7") != -1)) and want converted to if (louseragent.tolowercase().indexof(aaa.fire_fox) > -1 || (louseragent.tolowercase().indexof(aaa.msie) > -1 && louseragent.tolowercase().indexof(aaa.ie_7) != -1)) the conf.txt file have inputs like aaa.py_error_occurred_while_getting_payment_list_screen_for_org_type:::"error occurred while getting payment list screen org type: " aaa.py_ao_paymen

iphone - What is correct place for threading either in viewWillAppear or viewDidAppear in UIViewController? -

what correct place threading either in viewwillappear or viewdidappear in uiviewcontroller . in general, if want load images need seen (appear) other views of view controller, need load in sync way (you need wait until image loaded before viewcontroller shown) in viewwillappear: this way can animate view controller (including image), but, of course, may keep in mind loading images servers need time (and internet errors may occur), so, may happens user tap go viewcontrollers , app stops while (maybe much, depending on file size of image, internet speed connection...) so, better approach be: load images in viewdidappear in async way: user see animation viewcontroller (without image) , see image when available (with new animation, if will). anyway, depends on aspect app should do, both ways good...

c# - I want to check the username is already exists in my database table or not? -

i have registration page , want check username exist in database or not in 3 tier architecture. myregistration.cs: public static int checkusername(string user_txt) { int id2 = 0; string selectstr = "select * xyz username = '" + user_txt + " ' "; id2 = dataaccesslayer.executereader(selectstr); return id2; } and code behind onclick event of textbox : protected void txt_username_textchanged(object sender, eventargs e) { if (!string.isnullorempty(txt_username.text)) { int id = xyz.checkusername(txt_username.text.trim()); if (id > 0) { lblstatus.text = "username taken"; } else { lblstatus.text = "username available"; } } } dataaccesslayer: public static int executereader(string query) { sqlconnection con = new sqlconnection(); con.connectionstring = getconnectionstring(); con.open(); int id = 0; sqlcommand cmd = new sqlcommand(); c

SQL Column compare in the same table (self-join) -

i need hint in order solve sql (self-join) problem: a table, columns value , category id || value || category || foo ------------------------------------ 1 || 1 || || 1 2 || 2 || || 4 3 || 3 || || 2 4 || 0 || b || 2 5 || 1 || b || 1 6 || 2 || b || 4 7 || 3 || b || 2 8 || 4 || b || 2 9 || 5 || b || 1 10 || 5 || b || 4 11 || 6 || b || 2 12 || 99 || z || 2 i compare values category b , values category a , values in b , not in a or id , so: (0,1,2,3,4,5,5,6) "compare" (1,2,3) => (0,4,5,5,6) ansi sql: select * tbl category = 'b' , value not in (select value tbl category = 'a') see live here .

scala - play framework type mismatch; found : Int required: String -

i beginner play framework , scala, i'm trying develop simple web project play on scala, i'm using eclipse ide! my problem when change parameter of view template, despite fact pass "same new" parameter in action calling view, have error this: type mismatch; found : int required: string to simplify, assuming have view takes parameter @(value:string) can call view action ok(html.say(value)) such value declared string. in case, well! but when change parameter of view take int @(value:int) , call view action ok(html.say(value)) despite changed type of value string int, get: compilation error: type mismatch; found : int required: string i did clean on project didn't help. problem? make sure compile play console, either typing compile or reloading page (when running application). recompile template. can refresh eclipse make pick changes.

understanding good practice for java rmi -

i have rmi application, every request client, created new connection (on server side) database, r n sql query , turned data serializable class sent client. the user base of app grew,and request took long time complete. solution previous programmers came create fixed size connection pool server db, , every client's request used oldest(the 1 used least recently) run sql query. question is: correct way solve such problem? i say, pooling db connections important step, since establish connection expensive. instead of implementing own pool use existing , proven pooled datasource implementation such dbcp or c3p0. have many useful features such vaying size, automatic connection check, etc... if query istself takes long, optimisation more complex that. various approaches possible , depend on details of situation, example : is there 1 sql query, same, question seems imply ? is database read-only ? if not, modifications made within same application or externally ? etc..

C++: A way to find what is dependant on Visual C++ Redistribute -

i did lots of stuff training project in c++ stackoverflow helped me lot. tried keep "standard" possible cross-platform. using boost here , there, c++11 threading , wrapper uses either win32 sockets or bsd api. , decided compile release friend show off , required msvcpp110.dll installed on computer :( i had problem in beginning set visual studio compile mfc static library, , fixed initial tests, have no idea i've put code require "my users" install visual c++ redistribute simple console application starts 2 threads , opens tcp socket on 1 of them. do have tips newbie, how can check bothers system, or way include executable file, i've seen games on computer have aforementioned dll in install directories, work if package dll executable? thanks suggestion on matter in advance! ps: after thorough review of code realized might problem #pragma comment(lib, "ws2_32.lib") but don't seem find static version of library :u there workaround

Good manual on Assembly flags -

what manual/article on of assembly flags , instructions affect each flags? thanks! the official 1 intel, of course! intel® 64 , ia-32 architectures software developer’s manual combined volumes:1, 2a, 2b, 2c, 3a, 3b, , 3c . for more see intel® 64 , ia-32 architectures software developer manuals .

java - URISyntaxException while trying to build an httpget link -

i'm getting urisyntaxexception exception while trying following. have absolutely no idea whats causing issue. nice help. error located in last line edittext edusername = (edittext)findviewbyid(r.id.textbox_username_register); string strusernametemp = edusername.gettext().tostring(); byte[] byteusernametemp = null; try { byteusernametemp = strusernametemp.getbytes("utf-8"); } catch(unsupportedencodingexception e) { e.printstacktrace(); } string strusername = base64.encodetostring(byteusernametemp, base64.default); edittext edpassword = (edittext)findviewbyid(r.id.passwordbox_password_register); string strpasswordtemp = edpassword.gettext().tostring(); byte[] bytepasswordtemp = null; try { bytepasswordtemp = strpasswordtemp.getbytes("utf-8"); } catch(unsupportedencodingexception e) { e.printstacktrace(); } string strpassword = base64.encodeto