Posts

Showing posts from August, 2013

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

internet explorer - Rounded Corners in IE: VML vs jQuery -

as follow post: https://stackoverflow.com/questions/521432/best-jquery-rounded-corners-script assuming jquery being included, tradeoffs between following ie solutions rounded corners: a) using vml solution rounded corners (such css3pie, dd_roundies, , curved-corner) b) using jquery plugin (such curvy corners, rounded corners, or jquery.corner) generate corner pngs/gifs? there no (and stable) substitute border-radius . vml has quite few shortcomings makes render inappropriately or doesn't correctly apply in edge cases (of there 2 many). my advice? either listen this advice or stick generating png/gif rounded corners , applying them via conditional comments ie.

mfc - Radio buttons enabled, user cannot change the value -

is possible have enabled radio buttons though user cannot change value? it possible. if create radio buttons bs_radiobutton style instead of bs_autoradiobutton windows not automatically change selection when user clicks radio button. (in dialog editor in visual studio, right click radio button , set auto property false .) read "using radio buttons" section of this page in msdn more information.

configurable product - Magento Price Not Updating -

we've installed simple configurable products on our 1.4.2.0 magento install price on product isn't updating when user selects option, if configure product , add cart price show's correct in cart, not on product @ time of selection. if out on great. if price , availability not showing on simple/virtual/downloadable product page when there no configurable/custom options. the solution follows: go to: app/design/frontend/base/custom theme/layout/ open catalog.xml file replace (line 279): <block type="catalog/product_view_type_simple" name="product.info.simple" as="product_type_data" template="catalog/product/view/type/simple.phtml"> with: <block type="catalog/product_view_type_simple" name="product.info.simple" as="product_type_data" template="catalog/product/view/type/default.phtml"> answers , modules magento specialists @ agilewebsolutions

javascript - extjs vtype does not work on textarea -

ok , have vtype enslish , sign looks this: ext.apply(ext.form.vtypes, { excel: function (v) { return /^.*.(xls)$/.test(v); }, exceltext: 'must *.xls file', englishonly: function (v) { return /^[a-z0-9,\.\~\!\@\#\$\%\^\&\*\(\)\_\+\<\>]*$/.test(v); }, englishonlytest: 'must english letters' }); now have form looks this: new ext.formpanel({ id: 'add-label-form', url: hp, frame: true, baseparams: { actionname: 'addlable' }, defaulttype: 'textfield', labelwidth: 70, items: [{ id: 'tbkey', fieldlabel: localize.key, allowblank: false, name: 'tbkey', anchor: '100%' }, { id: 'tbhebrewtran', fieldlabel: localize.hebrew, allowblank: false, name: 'tbhebrewtran', anchor: '100%' }, { id: 'tbenglishtran', fieldlabel: localize.english, allo

asp.net - jquery ui autocomplete needs additional function -

i have such autocomplete code: $("input#pickupspot").autocomplete({ source: function(request, response){ $.ajax({ url: "ajaxsearch.aspx", datatype: "jsonp", data: { a: "getspots", c: "updatespotlist", q: request.term }, success: function(){ alert("success"); }, error: function (xhr, ajaxoptions, thrownerror){ alert(xhr.status); alert(thrownerror); } }); } }); when try data firebug shows error: "updatespotlist not defined" . need creat function called updatespotlist response server. , success alert never invoked. why need function? maybe there defined in aspx? is: string response = ""; string callback = request.querystring["c"]; string action = request.querystring["a"]; string query = request.querystring["q&quo

browser - open webpage in firefox -

i not sure..is there chance open webpage in firefox. example browsing mywebsite using ie. when ever click link of page automatically open in firefox. option not pages specified page. thanks. if case, ie6 have gone out long ago. best can here, check browser using ( get_browser if using php) , refuse show content people using browsers other firefox. instead redirect them page explaining why need using firefox access websites services (i guess link firefox download page nice too)

android - Scrollbars in TextView -

i didn't want use scrollview. have textview enabled vertical scrollbars. <textview android:id="@+id/tv_service_ticketinfo_details" android:layout_width="fill_parent" android:layout_height="150dp" android:textcolor="@color/black" android:autolink="web" android:scrollbars="vertical" android:text="empty" android:background="@drawable/custom_shape_grey"> </textview> the problem is, scrollbars scrollable texts, contain web-links. other texts see scrollbar, can't scroll. i can't explain it. , you? upd: another strange thing: once set text links, can replace 1 without links , textview stays scrollable so think problem textviews don't automatically scroll, because set android:scrollbars. have set scrollingmovementmethod. however, when use autolink , links found, android framework set movementmethod you. that's why be

asp classic - What common database is used with ASP? -

i know php , how use mysql moving onto asp common database used asp (ie. equivalent mysql)? usually it's microsoft sql server . if want free alternative try microsoft sql server express , scaled down version. here can find more informations different versions.

python - User defined Exception doubt -

i have exception class class value(exception): def __init__(self,val): self.val = val def __str__(self): return repr(self.val) raise value('4') and exception comes as traceback (most recent call last): file "<module1>", line 20, in <module> value: '4' ------------------------------------update------ i found out typo mistake mark.... problem want display 4 , string hello along error how so...... thanks lot i think meant write val instead of value here: def __str__(self): return repr(self.val) # <--- not self.value to display multiple values i'd recommend str.format (requires python 2.6 or newer). example: def __str__(self): return "hello: {0}".format(self.val) another example: def __str__(self): return "val1 = {}, val2 = {}".format(self.val1, self.val2)

emacs public/protected/private label indentation of C++ header file not working for zero offset -

i cannot 0 offset things c++ header files in emacs if have defined in .emacs file. the header file below shows class definition inside 2 namespaces , importantly public keyword have 0 offset below. namespace n1 { namespace n2 // no offset { class someclass // no offset namespace open curly { public: // line 0 offset someclass(); // offset 4 ... }; inline someclass::someclass() // no offset { } } // n2 } // n2 in .emacs file have added label this: (c-set-offset 'label 0) i used ctrl-c ctrl-s find out modify. other offsets have defined in .emacs file working fine , values other 0 work label. when set offset 0 label turns out 1 when hitting tab line. strange , looks else overriding or adding minimum of 1. can explain how can achieve want , maybe explanation happening currently? phew, first question here. :) update: thanks answers have been able bit farther, still no solution overall, because changing things necessary total offset 0 accessors result i

collaboration - CVS Web frontend -

is there free web application, can installed , pointed cvs server, show commits arrive, allow search them, , possibly present nice diffs, , visual representation of branches. http://www.gjt.org/src/cvsweb/ http://www.viewvc.org/

html - styled input box shows a BIG cursor when selected -

a styled text input box shows big cursor when selected , reduces correct size(relative font) after u type in first character. can suggest fix? regards, amit because item prescribed line-height text alignment within vertically stretched , cursor @ full height, after clicking on input, gets focus , applies font size specified in styles of element , therefore decreases.you must remove line-height.

c# - ObjectDataSource could not find a non-generic method -

i have asp.net code: <asp:dropdownlist id="ddlbrokers" runat="server" autopostback="true" datasourceid="srcbrokers" datatextfield="broker" datavaluefield="brokerid" /> <asp:objectdatasource id="srcbrokers" typename="databasecomponent.dbutil" selectmethod="getbrokers" runat="server"> </asp:objectdatasource> my dal code: public datatable getbrokers(bool? hasimport=null) { sqlcommand cmd = new sqlcommand("usp_getbrokers"); if (hasimport.hasvalue) cmd.parameters.addwithvalue("@hasimport", hasimport); return filldatatable(cmd, "brokers"); } when form loads error: objectdatasource 'srcbrokers' not find non-generic method 'getbrokers' has no parameters. is optional parameter causing problem? how can workaround this? possible have optional paramete

Internet explorer testing -

does know tools can use view site in different browsers styling purposes? expression web superpreview ietester browsershots

wpf - Modal Window with MVVM pattern -

i trying make modal dialog window let user know error messages, or let user edit values. using mvvm pattern, mainwindow has control part , workspace part. in workspace part, opening viewmodels tight datatemplate views (defined usercontrols). 1 of these views want open modal dialog window. following answer error window show modal in mvvm wpf . described in answer, have implemented dialogclass in invoiceviewmodel. have problem showing content of modal window. if set content of window viewmodel class, output simple text namespace path viewmodel. (viewmodel attached view datatemplate.) if set content view - working - view showed but, disobeing mvvm pattern (opening view viewmodel viewmodel has no reference view). errorviewmodel newerrorviewmodel = new errorviewmodel(); errorview newerrorview = new errorview(); dialogwindow dialogwindow = new dialogwindow(); //not working //dialogwindow.content = newerrorviewmodel; //working but, breaki

Charset encoding problem in webservices called from Biztalk -

i have problem occurring when biztalk calls soap web services. web services 1 specific system seems not include "charset" attribute in content-type response header. in cases missing, charset interpreted windows-1252 encoding instead of utf-8. the response web servcie utf-8 encoded when "charset" attribute missing. question if it's somehow possible tell biztalk utf-8 should used default charset when no charset specified in http response headers service. just specify further: if following header returned web service, biztalk interprets charset correctly: content-type: text/xml; charset=utf-8 however when charset part missing, biztalk falls on windows-1252 encoding , international characters garbled: content-type: text/xml i know simplest solution fix web service return utf-8 charset attribute, sadly have no control on services , vendor not release fix anytime soon. another fix have attempted use rewriting in iis rewrite response header. works fin

sql server 2005 - How to use the wizard to replicate 2 tables into one using a join? -

i have 1 app 1 database, , need make replication of of tables, , include 1 new table join of more 1 of tables. i tried transaction replication, filter tables allows me modify 'where' clause. anybody can me this? i'd replicate 2 tables in question as-is, create view on subscriber represent desired join.

c++ - enable_shared_from_this and inheritance -

i've got type inherits enable_shared_from_this<type> , , type inherits type. can't use shared_from_this method because returns base type , in specific derived class method need derived type. valid construct shared_ptr directly? edit: in related question, how can move rvalue of type shared_ptr<base> type of shared_ptr<derived> ? used dynamic_cast verify correct type, can't seem accomplish actual move. once obtain shared_ptr<base> , can use static_pointer_cast convert shared_ptr<derived> . you can't create shared_ptr directly this ; equivalent to: shared_ptr<t> x(new t()); shared_ptr<t> y(x.get()); // have 2 separate reference counts

ruby on rails - Trying to get counts through multiple associations -

i have created question answer app client stackoverflow. not trying implement sort of point system (like reputation). trying record counts through associations (which believe set correctly). trying counts votes on users answers. here example. in /views/questions/show page list answers question calling partial _answer.html.erb . each answer pull in answer.user information (username, email, etc.) doing answer.user.username . wanting display in badge format total point calculations. if user a answered question a , next user a 's answer want display total of user a 's answer votes. i can count users answers in /views/answers/_answer.html.erb doing following: <%= answer.user.answers.count %> but when try extend syntax/association count of votes on user a 's answers undefined method errors. <%= answer.user.answers.votes.count %> is set fundamentally wrong here or missing something. that bit confusing let me know if need more detail. update: he

jquery - Javascript -- filter set of links and style -

here set of links: <ul id="power"> <li><a id="10watt" name="power" href="#">10 watt</a></li> <li><a id="25watt" name="power" href="#">25 watt</a> <li><a id="30watt" name="power" href="#">30 watt</a> <li><a id="40watt" name="power" href="#">40 watt</a> <li><a id="50watt" name="power" href="#">50 watt</a> <li><a id="60watt" name="power" href="#">60 watt</a> <li><a id="75watt" name="power" href="#">75 watt</a> <li><a id="100watt" name="power" href="#">100 watt</a> <li><a id="120watt" name="power" href="#">12

android - Kindly provide the source code to determine the last item in the ListView -

i trying implementing pagination in android. displaying in listview , list of 10 items data list items exist in database. each list item contains thumbnail image url , text data i have following requirement. i> when user scrolls 10 th list item , calling webservice method of server fetch next set of records. my question how can determine when user scrolls 10 th list item , kind of validation can make. kindly provide me sample source code. warm regards, cb if want fetch next set of records when 10th item visible on list write condition in onscrolllistener similar this... mlistview.setonscrolllistener(new onscrolllistener() { @override public void onscrollstatechanged(abslistview view, int scrollstate) { // todo auto-generated method stub } @override public void onscroll(abslistview view, int firstvisibleitem, int visibleitemcount, int totalitemcount) { if(view.getlastvi

silverlight - Modifying <Style> from code -

i need modify style in resources code. know can access setters : style st = (style)this.resources["mystyle"]; set.setters.etc... but need change value of specific setter in style. there way it? also, how can retrieve appropriate setter in setters list based on "property" thanks may not "cleanest" way, found out somthing works : style mystyle = (style)this.resources["mystyle"]; setterbase sb = mystyle.setters.firstordefault(z => (z setter).property == rectangle.fillproperty); int isetterindex = mystyle.setters.indexof(sb); mystyle.setters[isetterindex] = new setter(rectangle.fillproperty, newscrollthumbbackground); it seems can't replace value of setter instead find old setter index using property. replace setter @ found index new setter object.

xcode - Unable to Read Symbols for iOS SDK 4.2.1 -

everytime attempt debug app on 3gs running ios 4.2.1 (8c148a) warning in compiler: warning: unable read symbols /developer/platforms/iphoneos.platform/devicesupport/4.2.1 (8c148a)/symbols/usr/lib/info/dns.so (file not found). at first thought so question might rooted in same cause accepted answer didn't work , other answers didn't seem apply. exact warning little different , occurs once believe it's reason crashes aren't providing information me debug. else seeing issue or have idea of how solve it? edit: updating more models , ios version based on comments , other tests iphone 3g w/ios 4.2.1 (8c148) iphone 3gs w/ios 4.2 ipod touch 4g w/ios 4.2.1

html - What CSS would get two buttons to line up, respectively, on the left and right side of a 3-colspan table cell? -

i have table this: <table> <tr> <td>short text</td> <td>long long long text</td> <td>short text</td> </tr> <tr> <td colspan='3'> <button id='leftbutton'/> <button id='rightbutton'/> </td> </tr> </table> what css styles should apply buttons lay out this: ----------------------------------------------------------------- |short text | long long long text | short text | ----------------------------------------------------------------- | button left | | button right | ----------------------------------------------------------------- instead of current layout: ----------------------------------------------------------------- |short text | long long long text | short text | ----------------------------------------------------------------- |button left|bu

algorithm - How to find the minimum set of vertices in a Directed Graph such that all other vertices can be reached -

given directed graph, need find minimum set of vertices other vertices can reached. so result of function should smallest number of vertices, other vertices can reached following directed edges. the largest result possible if there no edges, nodes returned. if there cycles in graph, each cycle, 1 node selected. not matter one, should consistent if algorithm run again. i not sure there existing algorithm this? if have name? have tried doing research , closest thing seems finding mother vertex if algorithm, actual algorithm elaborated answer given in link kind of vague. given have implement in javascript, preference .js library or javascript example code. from understanding, finding connected components in graph. kosaraju's algorithm 1 of neatest approaches this. uses 2 depth first searches against later algorithms use one, simple concept. edit: expand on that, minimum set of vertices found suggested in comments post : 1. find connected components of graph

Rails: Factory Girl failing to sequence -

just getting started factory girl, , i've come across problem sequencing: specifically, doesn't increment. i've tried changing database type, updating factory_girl 1.3.2 2.0.0.beta1 (and factory_girl_rails 1.0 1.1.0.beta1), tried recreating database, same problem - sequence won't increment , validation error after first time insert unique field. any assistance appreciated. code & trace stack below: /spec/models/user.rb require 'spec_helper' describe user describe "test user factory correct" user = factory(:user) "should have email ending in example.com" #user.email.should match "test2@example.com" end "should have password of foobar" user.password.should == 'foobar' end "should have password confirmation field of foobar" user.password_confirmation.should == 'foobar' end end end /spec/factories/user.rb factory.define :user |

sql - Design Pattern to add columns in database table dynamically -

the user wants add new fields in ui dynamically. new field should stored in database , should allowed perform crud on it. now can specifying xml wanted better way these new columns searchable. idea of firing alter statement , adding new column seems wrong. can me design pattern on database server side of how solve problem? this can approached using key value system. create table primary key column(s) of table want annotate, column name of attribute, , column value. when user wants add attribute (say height) record of person 123 add row new table values (123, 'height', '140.5'). in general cast values text storage if know attributes numeric can choose different type value column. can (not recommended) use several different value columns depending on type of data. this technique has advantage don't need modify database structure add new attributes , attributes stored records have them. disadvantage querying not straightforward if columns in

linq - Display properties of child object in Datagridview -

how can display in datagridview selected properties of object, , selected properties of member object of first object? think not require binding rely on hard coding updates, because updates initiate on non-ui threads, , think not easy bind. @ least i've had problems in other project. basically i'm looking understand different ways can this. maybe linq, or whatever suitable. note: want display data in same table. child/parent 1:1 relation. so example code: public class user public property score integer public property details userdetails end class public class userdetails public property name string public property username string end class hence, want table show columns: score, name, username edit: oh, more easy thought, seems work: dim q = (from n in userlist select new {n.score, n.details.name, n.details.username}).toarray you can use databinding here, if use itypedlist interface expose properties wanted. itypedlist powerful, hard understand

ajax - jQuery: first callback isn't fluent (slidedown effect) -

i know must newbie question, since don't know jquery have ask here: i have element has toggle different content on clicking on different buttons.now i'll post here how call javascript: onclick="javascript:gotosubonderdeelmenu(this);" this gets div element, , i'll right id content show. jquery code: function gotosubonderdeelmenu(obj) { displaysubmenu(obj.id); } function displaysubmenu(niveauid) { $.get("submenu.htm", { niveau : niveauid }, function(data) { $('#submenu').html(data); $('#submenu').slidedown('slow',function(){ $('#overzicht').fadeto(500,0.25,function(){}); $('#terugknop').show(); }); }); } it fluently slides down expect, except first time it's being called. anyone got clue on how solve this? you need .hide() content slides/expands nothing, this: $.get("submenu.htm", { niveau : niveauid }, funct

CXF Web service client error -

i trying invoke web service java client using apache cxf. following client code snippet. client client = new clientimpl(new url("http://localhost:8080/socialkast-web/services/skservice?wsdl")); object[] results = client.invoke("uploadvideometadata", new object[] {metadata}); string result = (string)results[0]; i getting parsing error although able access wsdl file browser. following exception stack. info: pre-instantiating singletons in org.springframework.beans.factory.support.defaultlistablebeanfactory@14f5a31: defining beans [cxf,org.apache.cxf.bus.spring.busapplicationlistener,org.apache.cxf.bus.spring.buswiringbeanfactorypostprocessor,org.apache.cxf.bus.spring.jsr250beanpostprocessor,org.apache.cxf.bus.spring.busextensionpostprocessor,org.apache.cxf.resource.resourcemanager,org.apache.cxf.configuration.configurer,org.apache.cxf.binding.bindingfactorymanager,org.apache.cxf.transport.destinationfactorymanager,org.apache.cxf.transport.conduitiniti

php - How to extract an object tag from a text -

hi i've created system adds articles in database, user can embed youtube or dailymotion or simple flash text area. in home page, i've inserted slideshow slides new feed image, i've writen simple condition if checks if text contains embeded video using: if (ereg('<object>',$text){} i want insert video(object element in general) in slide show in case there's object in text. in other words want extract what's between <object> , </object> thank you i'm not sure slideshow part or if trying modify content. extraction part there's 2 options. can use simple-minded regular expression like: preg_match("#<object[^>]*>(.+?)</object>#ims", $text, $matches); print $matches[1]; or more reliable html parser readable api phpquery or querypath : print qp($text)->find("object")->text(); the latter allow extract attributes more easily.

visual studio 2010 - warning MSB8012 : make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Link.OutputFile) -

i getting following error when building code. c:\program files (x86)\msbuild\microsoft.cpp\v4.0\microsoft.cppbuild.targets(990,5): warning msb8012: targetpath(e:\study\fwif\demola\ext-libs\libcommoncpp2-1.6.0\w32\debug\ccgnu2.dll) not match linker's outputfile property value g\capecommon14.dll). may cause project build incorrectly. correct this, please make sure $(outdir), $(targetname) , $(targetext) property values match value specified in %(link.outputfile). i hope 1 know do. did upgrade project visual studio 2010 previous version? if so, well-known issue. visual studio 2010 c++ project upgrade guide http://blogs.msdn.com/b/vcblog/archive/2010/03/02/visual-studio-2010-c-project-upgrade-guide.aspx warnings during upgrade here of common warnings may run during conversion: 1) linker output directory one of warnings may see when upgrading applications msb8012: $(targetpath) , linker’s outputfile property value not m

java - ODBC Error: Invalid String or Buffer Length--Microsoft Server 2008 32bit vs 2008 R2 64bit -

attempting connect java 6 console app microsoft sql server 2008 r2 on microsoft windows server 2008 r2 64bit system via odbc system dsn using sql server native client 10.0. following source code: try { class.forname("sun.jdbc.odbc.jdbcodbcdriver"); string srcurl = "jdbc:odbc:foo"; if (dbc == null) { dbc = drivermanager.getconnection(srcurl); dbc.settransactionisolation(connection.transaction_read_uncommitted); } else { dbc.close(); dbc = drivermanager.getconnection(srcurl); dbc.settransactionisolation(connection.transaction_read_uncommitted); } } catch (classnotfoundexception cx) { system.out.println("class not found"); } catch (sqlexception sx) { system.out.println("sql exception: &quo

Python regex matching problem -

i have been parsing graphviz file specific identifer using regex. here typical content file: node10 [label="second-messenger-mediated signaling\ngo:0019932", fontname=courier, ...]; node11 [label="inositol phosphate-mediated signaling\ngo:0048016", fontname=courier, ...]; node12 [label="activation of phospholipase c activity g-protein coupled receptor protein signaling pathway coupled ip3 second messenger\n\ go:0007200", fontname=courier, ...]; node13 [label="g-protein coupled receptor protein signaling pathway\ngo:0007186", fontname=courier, ...]; node14 [label="activation of phospholipase c activity\ngo:0007202", fontname=courier, ...]; node15 [label="elevation of cytosolic calcium ion concentration involved in g-protein signaling coupled ip3 second messenger\ngo:0051482", fontname=courier, pos="798,1162", width="9.56", height="0.50"]; since interested in nodeid , label , go ident

java - Is it possible to detect the time difference between the moment an epoll is generated by the kernel and the moment the Sun JVM reads it? -

i.e. time = voltage hits nic; time b = selector java nio package able select socket channel i/o. use so_timestamp , find nic supports timestamps , 1 supports timestamps better millisecond resolution. should have chance if can java read incoming cmsg ancillary data. without hardware support packets going tagged kernel low resolution unstable timer. (edit #1) example code in c requiring 2.6.30 or newer kernel think: http://www.mjmwired.net/kernel/documentation/networking/timestamping/timestamping.c (edit #2) example code determine kernel user-space latency in c: http://vilimpoc.org/research/ku-latency/ (edit #3) recommend following j-owamp project dependent upon high resolution timers , packet latency testing. owamp team have been pushing linux kernel team better so_timestamp support. http://www.av.it.pt/jowamp/

grouping - Linq extract a count() value from a data object -

i have divassignments has potential multiple rows rni, official id, according compound key of indictment , booking numbers. rni booking indictment 12345 954445 10 12345 12345 954445 10 12346 12345 954445 10 12347 so id has count of 3 single booking number rni. i lost attempting generate count , group booking number: var morethen = da in divassignments select new { da.rni, indictmentcount = da.indictmentnumber.count() }; most of examples dealing static int[] , don't seem work in case. how group , count? if put in having fantastic. from t-sql pov i'd use this: select rni, bookingnumber, count(*) indictmentcount divassignments group rni, bookingnumber having count(*) > 0 tia how this: var query = item in divassignments group item item.rni grouping select new { id = grouping.key, count = grouping.count() } if you're interested in grouping both rni , booking number, change this: var query = item in divassigne

Removing characters in a java string -

i want remove charecters string. example: have application users check off check mark building sql script, if check female adds string and gender = 'female' . , if select male adds and gender = 'male' . script working when adding string check off when uncheck item not sure how remove char added when checked. tried .replace .replaceall , other replace. know string want remove, why won't replace "" . string sql; sql += " , gender = 'female'"; sql.replace("and gender = 'female'",""); this won't work! sql = sql.replace("and gender = 'female'",""); strings immutable in java

c# - Mono + named/optional parameters = compiler bug? -

i have encountered unforeseen consequences of porting mono 2.8.1. problem can boiled down sample program (i have been unable reduce further, after cutting several classes , ~1000 lines of code file quoted below) public class person { public person(int age, string name = null){} public person(double income, string name = null){} public person(double income, int age, string name = null){} } class program { static void main() { person p = new person(1.0, name: "john doe"); } } compilation of above code mcs gives output: test.cs(22,24): error cs0584: internal compiler error: internal error test.cs(22,20): error cs0266: cannot implicitly convert type `object' `namedparams.person'. explicit conversion exists (are missing cast?) compilation failed: 2 error(s), 0 warnings removing use of optional/named parameter (i.e. calling new person(1.0, null, "john doe") or new person(1.0, null, name:"john doe"), or new pe

c# - Resizing a grid control programatically over a period of time -

g'day, i attempting simulate old xbox 360 gui sliding tabs (remember, you'd press left or right , content slide in depending on tab?) anyways, @ moment, have working well, cannot "animation" working. when user presses left arrow or right arrow, openwindow(int iindex) method called, iindex index next or previous "window" slid in. (not window... each "window" struct parent grid control containing button , smaller grid control contains windows contents.) now, problem lies resizing parent grid control. when slid in, resized calling mygrid.width += 1; works, don't see happen on determined period of time, lags bit , resizes required width. whereas if call this.width += 1 in same method, (this being main program window) window resizes how want grid control resize. i've tried updatelayout() no avail. tells me timing okay. if of assistance, appreciated. here openwindow method... public void openwindow(int iindex) { int ii

Implementing Generic Type Inference in C# reflectively -

i need generic type inference scripting language implementation , wondering if missing straightforward approach. moment let me ask type structure , ignore bounds. illustrate, here nested example: t foo<t>( list<list<list<t>>> ) {...} now want test if can pass argument bar of type: list<list<list<string>>> to method , later use makegenericmethod() discovered param type reify , invoke it. from can tell, if manage construct open generic type equivalent foo argument (i.e. list<list<list<t>>> ), not test isassignable(). i'm not sure if there trick checking assignability of open generic types or if it's not supported. guess if have can directly. on reification - looks i'm going have recursively crawl through types find argument type matches location of type parameter , substitution... had been hoping might able somehow construct invocable method argument type more directly, i'm not seeing how thi

c++ - how to prevent calling virtual function in constructor or desturctor? -

some c++ materials mention can't call virtual function inside ctor or dtor, ( sorry ,i think it's better change to c++ materials mention we'd better not call virtual function inside ctor or dtor, ) but may call them accidentally. there way prevent that? for example: # include < iostream > using namespace std; class cat { public: cat(){ f();} virtual void f(){cout<<"void cat:f()"<<std::endl;} }; class smallcat :public cat { public: smallcat():cat() { } void f(){cout<<"void smallcat:f()"<<std::endl;} }; int main() { smallcat sc; } output: void cat::f() //not expected!!! thanks you need throw "c++ materials" garbage bin. you can call virtual functions constructor or destructor. , job. need aware of language specification states virtual dispatch mechanism works in accordance current dynamic type of objec

Google chrome and safari browser data storage -

i want know whether google chrome , safari browsers support local data storage? i need store data in browser level , need query it. browsers support local data storage? thank you, yes do, part of support html 5, html 5 client-side database storage through api. you can see example of in action here . can find tutorial @ darkcrimson.com . can find standard at w3c .

web config - Using RegExp in IIS rewrite statements -

i have set of pages need rewrite handler using iis's web.config file. final structure should this: mydomain.com/es/mexico this needs mapped to: international.php?lang=es&country=mexico the language code, however, won't there - if types in "mydomain.com/mexico" should redirected to: international.php?country=mexico i tried set in web.config, whenever try add second querystring hit web.config server error. can help? try like: ^(?:/([a-za-z0-9]{2})?)?(?:/(.{3,})) language (2 letters) matched {r:1} country (3+ letters) matched {r:2}

javascript - Identifying which element invoked the event -

i have following html code <input type="button" id ="b1" value="click me" onclick="msg()" /> <input type="button" id="b2" value="click me" onclick="msg()" /> now in javascript want identify whether button 1 clicked or button 2. how can it? if change inline handler use .call() method, setting context of function this : <input type="button" id ="b1" value="click me" onclick="msg.call( )" /> ...then in function, this represent 1 received event. function msg() { alert( this.id ); } otherwise, pass this argument: <input type="button" id ="b1" value="click me" onclick="msg( )" /> ...and reference argument: function msg( elem ) { alert( elem.id ); }

c++ - C++0x: How can I access variadic tuple members by index at runtime? -

i have written following basic tuple template: template <typename... t> class tuple; template <uintptr_t n, typename... t> struct tupleindexer; template <typename head, typename... tail> class tuple<head, tail...> : public tuple<tail...> { private: head element; public: template <uintptr_t n> typename tupleindexer<n, head, tail...>::type& get() { return tupleindexer<n, head, tail...>::get(*this); } uintptr_t getcount() const { return sizeof...(tail) + 1; } private: friend struct tupleindexer<0, head, tail...>; }; template <> class tuple<> { public: uintptr_t getcount() const { return 0; } }; template <typename head, typename... tail> struct tupleindexer<0, head, tail...> { typedef head& type; static type get(tuple<head, tail...>& tuple) { return tuple.element; } }; template &l

mobile - Is culling child nodes a valid WURFL search strategy? -

i've implemented wurfl based detection routine based on similar strategy 2 phase 1 outlined @ http://wurfl.sourceforge.net/newapi/ . this working improve worst case scenario if can. in worst case scenario, @ moment, every device's user agent string compared against current user agent string. what i'm curious how valid search tree of devices , cull entire branches device matches don't minimum match threshold? (obviously ignoring 'root' devices don't have user agent strings intended matching) do user agent strings tend follow general pattern of ever closer matches 1 decends down tree... , make aforemention strategy valid? ... or user agent strings random beast in terms of parent verse child device matches , forced search entire tree every single time? wurfl-pro, company beside wurfl project, has dual licensing strategy. can ask them obtain gpl-free library. for know wurfl java api implementation can browse source available on svn...or

c - pthread condition loop -

the typical pattern i've seen using pthread_cond_wait is: pthread_mutex_lock(&lock); while (!test) pthread_cond_wait(&condition, &lock); pthread_mutex_unlock(&lock); why can't if statement used instead of while loop. pthread_mutex_lock(&lock); if (!test) pthread_cond_wait(&condition, &lock); pthread_mutex_unlock(&lock); http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_cond_timedwait.html when using condition variables there boolean predicate involving shared variables associated each condition wait true if thread should proceed. spurious wakeups pthread_cond_timedwait() or pthread_cond_wait() functions may occur. since return pthread_cond_timedwait() or pthread_cond_wait() not imply value of predicate, predicate should re-evaluated upon such return. the while loop standard way of re-evaluating predicate, required posix.

android - How to get real-time status notification with Facebook SDK via listener -

i'm using twitter4j , android facebook sdk fetch status messages. twitter4j real-time notifications whenever new status has been added stream via statuslistener (twitter4j). in facebook sdk cannot find similar way, can fetch entire streams on , on again in fixed time interval using requestlistener (facebook sdk) far see it. is there way notified of new statuses in realtime facebook sdk in similar way twitter4j? (found similar unanswered question here: facebook real-time updated application wall ) there realtime api http://developers.facebook.com/docs/api/realtime but it's server-to-server communication, it's not useful if have mobile app without server infrastructure app can subscribed - looking in particular case. see q&a @ http://forum.developers.facebook.net/viewtopic.php?id=56610

javascript - permission denied with shell.application -

i have following javascript code run notepade.exe: <script type="text/javascript" language="javascript"> function executecommands() { var oshell = new activexobject("shell.application"); var commandtorun ="c:\windows\notepad.exe"; oshell.shellexecute(commandtorun,"","", "open", "1"); } </script> the problem that, when run script give error..."permission denied." can me on matter? it's necessary have 2 settings turned on. enable unsigned activex controls current zone tools > internet options > security > custom level... enable "activex controls , plug-ins" > "initialize , script activex controls not marked safe scripting" allow active content run files tools > internet options > advanced > security enable "allow active content run in files on computer&quo

regex - Regular Expression - Accept 15 to 17 Digits -

i want regular expression accepts numeric between 15 17 digits. ^\d{15,17}$ - digit (use [0-9] instead of \d avoid unicode characters, if applicable). ^[1-9]\d{14,16}$ - if don't want number start zeros. of course, might easier parse number , check it, fits nicely in long value.

opera - Browser-Sidebar for number conversion? -

does know sidebar (or 'panel' it's called in opera) can use number conversions (decimal hex , on)? i'm using this one it's bit large fit narrow sidebar. since it's bit of javascript, 1 can roll oneself: <html> <body> <form> <input name="dec" id="dec" placeholder="decimal" onblur="document.getelementbyid('hex').value= parseint(this.value,10).tostring(16)" ></input> <br /> <input name="hex" id="hex" placeholder="hex" onblur="document.getelementbyid('dec').value= parseint(this.value,16).tostring(10)" ></input> </form> </body> </html>

List<T> add method in C# -

as know. list add method works below. list<string> cities = new list<string>(); cities.add("new york"); cities.add("mumbai"); cities.add("berlin"); cities.add("istanbul"); if designed data structure this list<object> lstobj = new list<object>(); if (true) // string members { cities.add("new york"); cities.add("istanbul"); } else // list obj members here { list<object> alistobject= new list<object>(); cities.add(alistobject); // how handle this? } does list add method works or not if add different types members in same function. you can't add list<object> list<string> . thing can add list of strings strings (or null references). use instead: list<object> cities = new list<object>(); but seems bad design. when use object generic type of collection lose benefits of type-safety. for parsing xml i'd sugge

c# - Wpf binding problem -

i have in window rectangle tooltip, clicking button suppose change tooltip text doesn't. xaml: <grid> <grid.rowdefinitions> <rowdefinition /> <rowdefinition /> </grid.rowdefinitions> <grid.resources> <tooltip x:key="@tooltip"> <textblock text="{binding name}" /> </tooltip> </grid.resources> <rectangle width="200" height="200" fill="lightblue" verticalalignment="center" horizontalalignment="center" tooltip="{dynamicresource @tooltip}" /> <button click="button_click" grid.row="1" margin="20">click me</button> </grid> code behind: public partial class window1 : window { public window1() { datacontext = new person { name = "a" }; initializecomponent(); } priv

vsto - Word 2007 add-in for a custom ribbon - ribbon not visible in the saved document -

i have requirement need have custom ribbon added word 2007 file populated items. created add-in using this , pressing f5 opens word file contains newly added custom ribbon. save word file , open again , not have newly added custom ribbon. sure missing here.could throw light? i save word file , open again are opening again outside of word instance running visual studio? add-in might available when you're debugging project. check if entry add-in exists in registry, under: hklm\software\microsoft\office\word\addins\ . if no entry exists, i've found easiest way deploy vsto add-in machine create setup project in visual studio.

LINQ to NHibernate WHERE EXISTS IN -

i've been trying out nhibernate 3 , linq nhibernate. can't spit out correct t-sql query. here's domain model: employee { id, name } department { id, name } employeedepartment { id, employee_id, department_id, startdate, enddate } attendanceregistration { id, datetime, employee_id } now suppose i'd select attendanceregistrations between '2010-10-1' , '2010-11-1' connected department @ time. datetime start = new datetime(2010,10,1); datetime end = new datetime(2010,11,1); var list = ar in session.query < attendanceregistration > () start <= ar.datetime && ar.datetime > end && ( ed in session.query < employeedepartment > () ed.startdate <= ar.datetime && ed.enddate > ar.datetime && ed.department_id = 1 select ed.employee_id ).contains(ar.employee_id) select ar; the resulting sql code this: sel

Geolocation APIs for Rails -

i trying show map location rails app.i tried checking ym4r/gm , geokit combination not sure if there better rails 3. try ruby geocoder . allows street address lookup, ip address lookup , geographic coordinates.