Posts

Showing posts from July, 2012

asp.net - How do I display an image on a webpage from a network location? -

i have web application used internally points images on network drive. it works when test in vs, images don't load once published. i'm sure it's setting in iis can't figure out is. each computer logged domain, , have access should allowed view image. i tried changing authentication impersonate, no luck. any ideas? thanks i ended fixing issue changing way images loaded. rather using network path src, switched using generic handler render image. so, image tag looks like <img alt="item image" src="/imagehandler.ashx?f=100" /> and images loaded in handler following code. public void processrequest(httpcontext context) { var f = convert.tostring(context.request.querystring.get("f")); var path = string.format("//network-share/images/{0}.jpg", f); var image = image.fromfile(path); context.response.clear(); context.response.clearheaders(); image.save(context.response.outputstre

JavaScript get clipboard data on paste event (Cross browser) -

how can web application detect paste event , retrieve data pasted? i remove html content before text pasted rich text editor. cleaning text after being pasted afterwards works, problem previous formatting lost. example, can write sentence in editor , make bold, when paste new text, formatting lost. want clean text pasted, , leave previous formatting untouched. ideally, solution should work across modern browsers (e.g., msie, gecko, chrome, , safari). note msie has clipboarddata.getdata() , not find similar functionality other browsers. the situation has changed since writing answer: firefox has added support in version 22, major browsers support accessing clipboard data in paste event. see nico burns's answer example. in past not possible in cross-browser way. ideal able pasted content via paste event, which possible in recent browsers not in older browsers (in particular, firefox < 22). when need support older browsers, can quite involved , bit of ha

asp.net mvc - How to prevent Razor from adding prefixes to inputs when using nested display templates? -

when use nested display templates , add input elements through html helper razor engine adds prefix fields names. i understand done guarantee input name uniqueness @ page level (and rebuild whole model on post back). however have many small forms perform ad-hoc actions, , don't need neither name uniqueness nor ability rebuild whole model. i need single property value, , having razor alter input items names breaks model binder when submit 1 of forms, since names different. this example contains simplified nested model public class student { public guid id { get; set; } public string firstname { get; set; } public string lastname { get; set; } public list<course> courses { get; set; } } public class course { public guid id { get; set; } public string name { get; set; } public list<grade> grades { get; set; } } public class grade { public guid id { get; set; } public datetime date { get; set; } public decimal value {

vb.net - Change the increase value of numericupdown -

i looking while how change increase value of numericupdown in vb.net , can't find resources online. what mean is, when have numericupdown value 1,000 , minimum of 0, maximum of 100,000, want make when clicks increase arrow, value increase 1,000 example. you can control minimum , maximum values this: me.numericupdown1.minimum = 0 me.numericupdown1.maximum = 100000 you can define increment this: me.numericupdown1.increment = 1000

php - contents of side menu items not showing on click (only the last child content is showing) -

everything working fine,but thing when click on each menu items, page shows contents of last child.it shows value last category-> $category='j_w'. <ul id="menuv2" class="indicator-market"> <li><a href="#<?php $category='cloth'; ?>" class="action" data-target="tab">clothing & accessories</a></li> <li><a href="#<?php $category='elec'; ?>" class="action" data-target="tab">electronics</a></li> <li><a href=#<?php $category='j_w'; ?>" class="action"data-target="tab" >jewelries & watches</a></li> </ul> <script> $('.action').click(function () { $('#menuv2 a:first').tab('show'); }) </script> the value pass through cat.php , retrieve pictures database. <ul id="ti

css - Wordpress 3.6: Mediaelement (audio) hide elements -

with mediaelement.js wordpress has native audio/video player. problem customization , don't want change core mediaelement.css. the standard theme looks this . this page shows how modify settings. changed little.. .mejs-time-rail, .mejs-time-total, .mejs-currenttime, .mejs-duration, .mejs-volume-button, .mejs-horizontal-volume-slider, { display: none !important; } .mejs-container { width: 26px !important; } ..to hide except play , pause button. additionally tried add short text right/left player atm not shown. [audio mp3="audio_path"]i important message[/audio] the code above hides controls except play button, shrinks width text not visible. ideas do? to hide except play , pause button try: css .mejs-time, .mejs-time-rail, .mejs-volume-button, .mejs-mute, .mejs-horizontal-volume-slider { display: none !important; } .mejs-container { width: 26px !important; } because of 26px maybe text not shown properly. move outside may

batch file - BAT - How would I detect the number of days from a date? -

so today wanted make simple bat file, sorts builds of app folders in specific hierarchy: app name day 0 build 1 d0_b1_g1.html build 2 d0_b1_g2.html day 1 build 1 d1_b1_g3.html build 2 d1_b1_g4.html d1_b1_g4 stands day 1, build of day 1, global build 4. now, problem ran detecting how many days date have passed. example, if started building app on 1st september 2013, , today it's 5th septermber 2013, number of days passed 4. i hope there simple solution this, if not, stick naming day folders date. david

jquery - How to show a forwarded jsp on fancybox? -

is possible displaying jsp forwarded servlet on fancybox? following trying, doesn't work js: $('.showdetail').fancybox(); html: <a class="showdetail" href="<%=request.getcontextpath()%>/employee/emp.do?empid=${empid}"> ${average}</a> try $('.showdetail').fancybox({ type: "ajax" }); or via html, add class fancybox.ajax <a class="showdetail fancybox.ajax" href="<%=request.getcontextpath()%>/employee/emp.do?empid=${empid}"> ${average}</a> note : v2.x

Where can I find the PackageID of my pre 7.0 Blackberry app? -

i'm having boatload of trouble trying submit bb10 application, managed submit under new product got rejected. have add upgrade our existing <7.0 version. keeps telling me packageid needs same. i have no idea find packageid on <7.0 app, have source code on machine not sure packageid, suggestions? edit: following error message blackberry vendor portal (file bundle upload section): file bundle (my_app-2_0_0_1.bar) has been rejected. package id required .bar file. if upgrade, package id must match package id in original file bundle.

C++ 'Using space as a delimiter' -

i complete beginner in c++, , trying following program: read sentence console. break sentence words using space character delimiter. iterate on each word, if word numeric value print value doubled, otherwise print out word, each output on own line. i lost on how this. using space key delimiter. can have following : with std::stringstream , std::getline std::string str; std::string temp; std::getline(std::cin,str); std::stringstream ss(str); while(getline(ss,temp, ' ')) // delimiter space { std::stringstream stream(temp); if(stream >> val) std::cout<<2*val<<std::endl; else std::cout<<temp<<std::endl; } see demo

javascript - Userscript: Trigger Google Map resize? -

Image
i'm building userscript ( script install in browser modify 3rd party pages ) geoguessr.com . adds button allows expand small guess map fullscreen. while had no problems layout, issue google map not resize: the page built backbone , not have api access of views, less internal google maps object. i tried $(window).trigger('resize'); to trigger window resize event because noticed when manually map resizes. yet nothing happens (chrome 29). is there way force google map resize in userscript? if resize div container of map, must resize map object itself. stated in reference : developers should trigger event on map when div changes size: google.maps.event.trigger(map, 'resize') . where map variable name of google.maps.map object. (which i'm guessing can access if it's in global namespace). update: first thing first, access properties built backbone.view.extends need access prototype of class - in case window.gg.guessmapvi

sql - MySQL querying transition states -

Image
i'm new sql , 1 of project find transition states of issue 1 status (see enclosed image) stored in mysql jira database. i sorted data based on issue id followed transition dates order data. if @ first 2 rows see transition date of issue open fixing. on second row same issue moves fixing on hold. need find out days issue remained in fixing state. in excel or using 2d arrays doesn't seem difficult sql ... seems impossible. suggestion , pointers kindly appreciated :). i created table based on mentioned , here schema , query. create table tablename ( tid int , startdate date, transitiondate date, fromstatus varchar(10), tostatus varchar(10) ); pay attention not exists subquery. tid 1 goes in , out of fixing takes care of incorrect calculations. select t1.tid, sum(t2.transitiondate - t1.transitiondate) tablename t1, tablename t2 t1.tid = t2.tid , t1.tostatus = "f" , t2.fromstatus = "f" , t1.

ehcache - How to avoid lost data in Terracotta BigMemory Go -

i'm testing bigmemory go performances, , notice lost of data. this unit test: public class bigmemorygoperformancetest { public static void main(string[] args) throws ioexception { bigmemorygoperformancetest test = new bigmemorygoperformancetest(); test.testbigmemorygoperformance(args[0], long.valueof(args[1]), long.valueof(args[2])); } @dataprovider(name = "bigmemorygoperformance") public object[][] bigmemorygoperformance() { return new object[][] { { "very small", 250000, 1 } ,{ "small", 1000000, 2 } ,{ "large", 10000000, 2 } ,{ "very large", 50000000, 4 } }; } @test(dataprovider="bigmemorygoperformance") public void testbigmemorygoperformance(string testname, long maxregisters, long externalmemory) throws ioexception { configuration managerconfiguration = new configurati

javascript - Dynamically changing an icon in Twitter Bootstrap 3 -

take here (it uses jquery, knockoutjs, twitter bootstrap 3): http://jsfiddle.net/ncufy/3/ <i class="glyphicon" data-bind="click: function() { ispaused(!ispaused()) }, css: {'glyphicon-play': ispaused(), '.glyphicon-pause': !ispaused()}"></i> var viewmodel = { ispaused: ko.observable(true), }; ko.applybindings(viewmodel); when click on play icon, icon disappears. instead, icon should turn pause icon. wrong? use latest chrome. you have . in front of glyphicon-pause . remove it demo: http://jsfiddle.net/tymejv/ncufy/4/ css: {'glyphicon-play': ispaused(), '.glyphicon-pause': !ispaused()} ^ dont belong there!!

elasticsearch - Elastic search exact match -

i'm using elasticsearch , having devil of time getting exact match happen. i've tried various combinations of match, query_string, etc, , either nothing or bad results. query looks this: { "filter": { "term": { "term": "dog", "type": "main" } }, "query": { "match_phrase": { "term": "dog" } }, "sort": [ "_score" ] } sorted results 10.102211 {u'term': u'the dog', u'type': u'main', u'conceptid': 7730506} 10.102211 {u'term': u'that dog', u'type': u'main', u'conceptid': 4345664} 10.102211 {u'term': u'dog', u'type': u'main', u'conceptid': 144} 7.147442 {u'term': u'dog eat dog (song)', u'type': u'main', u'conceptid': u'5288184'} i see, of c

android - .APK file is not uploading for PayPal classic application creation -

i have developed android app paypal integration, obtain live paypal appid paypal classic apis, trying fill form on paypal , has upload .apk file paypal under "additional testing files (ad hoc files required mobile app submissions)." heading. not allowing me upload .apk file, allows doc, png, pdf, docx extension files upload. it not before, think during recent changes have changed few things here well. can me , advice this. thanks yes, believe there additional restrictions around possible file types. we'll see if can improve on this. in meantime suggest including link .apk on dropbox-type service / direct link on server on can access it.

javascript - FineUploader allowedExtensions use an array? -

i'm using fineuploader v3.8, , have gotten , running. @ point, i'm listing available file types user in html, , there's reference these in configuration. wanted have 1 place extensions listed there's no duplication, , can changed. i tried this: var allowedextensions = new array('jpg', 'gif', 'png'); var allowedextensions = "'jpg', 'gif', 'png'"; and within 'validation:' used this: allowedextensions: [allowedextensions], this doesn't work, , invalid file type messagebox any/all file types. there way utilize array variable in javascript of control configuration? thanks! with 1st , 3rd snippet, you're creating array containing array it needs either array literal ( [...] ) or new array(...) rather both. var allowedextensions = ['jpg', 'gif', 'png']; allowedextensions: allowedextensions, // no brackets

networking - How to obtain the IP of a network printer from a list of printers through Java -

i have database contains list of ip addresses various printers. users choose printer print on, , way see workng out java application iterate through list of printers until finds 1 matching ip address. using printservice class, i've been able generate list of printservices following code: docflavor flavor = new docflavor.input_stream("application/octet-stream"); printservice pservices[] = printservicelookup.lookupprintservices(flavor, null); when debug , step through code, able locate printer. can identify based on name gave when installed drivers local pc. however, stated above, need find based on ip address. when put current value of pservices on watch, able see value of ip address in "port" variable. through quick searching, found there no public "getter" method "port" variable. there easier way of doing this, or there i'm missing?

java - Read clipboard data with GWT -

this question has answer here: how copy clipboard gwt? 6 answers i have code have made handle ctrl + v browser, works fine need clipboard data this: event.addnativepreviewhandler(new event.nativepreviewhandler() { @override public void onpreviewnativeevent(event.nativepreviewevent event) { nativeevent ne = event.getnativeevent(); // when ctrl + v pressed if (event.getnativeevent().getkeycode() == 86 && // 'v' event.getnativeevent().getctrlkey() == true) { // need clipboard data } } }); although i'm 1 marked question duplicate, think answers in question may bit out of date. when google, find this discussion . answers in there solve problem jsni remark doesn't work in ff because ff requires manually enabling r

javascript - Parse Seats from PokerStars History -

i have following string: seat 6: dizzy (€26.49 in chips) i parse seatnumber (6), screenname of player (dizzy), , stack (26.49). possible 1 regex ? here try: seat.([0-9]) : . //space ([^(]*) //screenname (everything next opening parenthesis) \( [^0-9]+ // euro or dollar sign ([0-9\.]+) // stack .in.chips but doesn't work if screenname has parenthesis, example : seat 3: padre(93) (€10.52 in chips) your "screenname" section needs adjusted from: ([^(]*) to: (.*) quantifiers greedy default -- match as possible, while still allowing rest of pattern match. in case want match last ( character. modifying pattern way cause .* pattern match end of string, regex engine notice causes pattern fail match. backtrack last ( , rest of pattern match. see this test illustration of how modification affect matches.

android - Impliment Slidingdrawer with viewpager where slidingdrawer resides on the viewpager -

Image
i want display viewpager slidingdrawer.viewpager used scroll images , on top of viewpager want place 1 sliding drawer(top button). i attached sample code. if have idea how implement screen, please me out. android:id="@+id/linearlayout1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" > <textview android:id="@+id/textview01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginleft="10dip" android:text="infra2apps" android:textcolor="#ffffff" android:textsize="9pt" /> <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginleft="6dip" android:text="sales , marketing resources"

java - Guice: Inject a class bound by another module? -

i have following classes: public class cachemodule extends abstractmodule { @override protected void configure() { bindconstant().annotatedwith(names.named(timeout")).to(60); // ...etc. } } public class defaultcacheadaptor implements cacheadaptor { private cachemodule bootstrapper = new cachemodule(); @named("timeout") private int timeout; // other fields omitted brevity public defaultcacheadaptor() { super(); injector injector = guice.createinjector(bootstrapper); @named("timeout") int t = injector.getinstance(integer.class); settimeout(t); } } public class queuemodule extennds abstractmodule { @override public void configure() { bind(cacheadaptor.class).to(defaultcacheadaptor.class); } } public class defaultqueueadaptor implements queueadaptor { private queuemodule bootstrapper = new queuemodule(); private cacheadaptor cacheadaptor;

spring convert from deprecated -

using simplejdbccall.returningresultset(parameterizedbeanpropertyrowmapper) deprecated spring 3.0.5. how change code use non-deprecated version of method? private jdbctemplate jdbctemplate; private simplejdbccall procgetreportextras; public void setdatasource(datasource datasource) { this.jdbctemplate = new jdbctemplate(datasource); jdbctemplate.setresultsmapcaseinsensitive(true); this.procgetreportextras = new simplejdbccall(jdbctemplate) .withcatalogname("package") .withprocedurename("proc") .returningresultset("curreportlist", parameterizedbeanpropertyrowmapper.newinstance(report.class)); } you should able use beanpropertyrowmapper instead of parameterizedbeanpropertyrowmapper new simplejdbccall(jdbctemplate) .withcatalogname("package") .withprocedurename("proc") .returningre

c# - How to modify WPF DatePicker to accept any text input? -

is there way modify wpf datepicker user can enter non dates (e.g period codes such 1y) in addition dates? basically i'm looking text entry field can take string (or optionally string matches custom validation rule) has calendar icon next it, when used paste selected date text field...

C++ MySQL Connector Unable to Disconnect TCP Connection on sql::Connection close() call -

i having difficulties terminating mysql connection created using mysql c++ connector 1.1.3 sql::connection *con; /* creating connection */ //.... /* executing statements */ //.. con->close(); // should terminate tcp connection but after calling close() function tcp connection mysql server doesn't terminate. disconnects after application process terminated. after close found following: 1> //checkedclosed() function of mysql_connection class if (!intern->is_valid) { // returns true throw sql::sqlexception("connection has been closed"); 2> mysql_connection::clearwarnings() { cpp_enter_wl(intern->logger, "mysql_connection::clearwarnings"); // intern closed = false intern->warnings.reset(); } please guide me how can terminate mysql connection. update: class mysqlconn { private: sql::driver *driver; sql::connection *con; public: bool initdbconnection(); bool closedbconnection(); };

php - Call Javascript Function Based on Radio Button Checked Value -

i have form sets default values based on user's account settings (stored in mysql db , pulled using php). when form displayed, pulls relevant account information , populates form (first name, last name, email, account type, etc.) when user's account type 'admin' want rest of form become disabled, , have options selected. if user's account type 'admin', , therefore 'edit_type_admin' radio button checked default (see below) call makeeditdisable() function below page loaded (without requiring clicks). right form displays account type follows: client or admin: <br /> client <input type="radio" name="edit_type" id="edit_type_client" value="client" <? if($selected_type == 'client') { echo 'checked'; } ?> onclick="makeeditenable()" /> admin <input type="radio" name="edit_type" id="edit_type_admin" value="admin" <? if($s

javascript - Q promise & synchronous I/O -

after reading q documentation, under impression following wait on select thereby providing sync i/o capability. assume db open sqlite database. count = 500; q.invoke(db, 'get', "select * blah blah ...").done( function () { --count; }, function () { // error code} ); console.log(count); testing reveals not true. how can select , result synchronized via promise methodology console output 499? i want wrap in while loop processes x number of rows given row can decrease count value retrieved row. number of times through loop data dependent. without introducing threads or fibers, not possible make asynchronous operation synchronous operation. such, need put console.log inside handler notifies when operation has completed. var count = 500; q.invoke(db, 'get', "select * blah blah ...") .then(function (results) { (var = 0; < results.length; i++) { var result = results[i]; --count; } })

asp.net - Why can't I get my site to recognize a default error page for status code 404 in a WebMatrix WebPages environment? -

i have seen in multiple places [here] http://www.localwisdom.com/blog/2010/08/how-to-setup-custom-404s-for-iis-and-asp-net-through-web-config/ [and previous question here] how can make custom error page in asp.net web-pages webmatrix? how setup web.config file force custom error pages given status codes (i think ones care "500" , "404"). i using <system.web> element in web.config xml. <system.web> <compilation debug="true" targetframework="4.0"><assemblies><add assembly="system.configuration, version=4.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a" /></assemblies></compilation> <customerrors mode="on"> <error statuscode="500" redirect="~/error.cshtml" /> <error statuscode="404" redirect="~/error404.cshtml" /> </customerrors> </system.web> the custom error page s

php - CakePHP - How to add associated records to a model on save? -

i'm using cakephp 2.3 , i'm trying find correct way perform associated data saving. i've setup image upload form save picture data in mean time want process saved image such on save application should examine file , extract exif data , add tags associated models tags. my relations are picture hasmany tags tag belongsto picture right i'm trying use picture beforesave callback programmatically add new records data array it's not working (it's not saving added data). picturecontroller $this->picture->create(); $this->picture->saveall($this->request->data); data array after beforesave array ( [picture] => array ( [field1] => foo [field2] => bar ) [tag] => array ( [0] => array ( [tag] => example [value] => example ) [1] => array (

css - JavaScript display none after CSS3 animation -

i have div id='mainmenu'. i'm adding css3 transition javascript after button click (by adding 'transition' #mainmenu , creating class .fadein , .fadeout added div element). code: <div id='mainmenu'></div> <button id="btn1">click me1</button> <button id="btn2">click me2</button> #mainmenu { width:100px; height:100px; background:#eee; -webkit-transition: opacity 1s; -moz-transition: opacity 1s; transition: opacity 1s; } .fadeout { opacity:0; } .fadein { opacity:1; } var menu = document.getelementbyid('mainmenu'), btn1 = document.getelementbyid('btn1'), btn2 = document.getelementbyid('btn2'); btn1.addeventlistener('click', function() { menu.classname = 'fadeout'; } btn2.addeventlistener('click', function() { menu.classname = 'fadein'; } the problem want add display none , block fadeout

java - Use variable in activiti -

i playing around vaadin , activity, , wondering how use variable, in vaadin code, in activiti script. example vaadin code following textfield field = new textfield("enter name: "); button button = new button("click me: "); button.addclicklistener(new button.clicklistener() { @override public void buttonclick(clickevent event) { processengine processengine = processengines.getdefaultprocessengine(); repositoryservice repositoryservice = processengine.getrepositoryservice(); repositoryservice.createdeployment() .addclasspathresource("hello_world.bpmn20.xml") .deploy(); hashmap<string, object> v = new hashmap<string, object> (); v.put("name", field.getvalue()); runtimeservice runtimeservice = processengine.getruntimeservice(); runtimeservice.startprocessinstancebykey("myprocess", v); } }); and groovy script in activiti

ruby - Creating a simple hit counter in Rails -

i've been trying implement gem impressionist , doc confusing , gem carries bit of overhead simple use case wonder how go implementing myself? i want track impressions (requests) of action in controller. the impressions don't have registered unique visitors. i need counter unique each record in model (i.e. shop 1: 34 hits, shop 2: 77 hits etc). the counter should not include requests bots on list: http://www.user-agents.org/allagents.xml what minimal code required accomplish above? update to clarify, if possible don't want use gem impressionist. used prelude describe problem i'm trying solve. you need add attribute model. if using impressionsit gem, should use built-in migration generator add correct scheme database. otherwise, if not planing use gem, need create migration following: mymigration < activerecord::migration def change add_column :pluralized_model_eg_users, :integer, default: 0 end end then, on actions want coun

.net - Union or Variant type static dispatch -

i have function takes number of arguments, each of may 1 of set of types. i can handle dynamically , throw type error if fails, in code snippet directly below rather catch these type errors @ compile time. function specializingfunction(a) string select case a.gettype case gettype(integer) return "int" case gettype(boolean) return "bool" case else return "__unknown__" ' or throw exception end select end function sub mayfail(a1, a2, a3, a4) console.writeline(specializingfunction(a1)) console.writeline(specializingfunction(a2)) console.writeline(specializingfunction(a3)) console.writeline(specializingfunction(a4)) end sub i had hoped solve problem using dotnet generics, see final code example in question. i happy use either: 1. open solution - client code may add further type specializations in c++ code below 2. closed solution - fixed set of allowed ty

c# - Remove file type from string -

this question has answer here: remove file extension file name string 11 answers i'm calling list of strings server. at moment i'm getting full name , file extension like: image1.jpg image2.png test_folder.folder i have code relies on knowing extension is, need access name of item i've selected out extension. so far 2 attempts have been following: _clickedfolder = listbox1.selecteditem.tostring() - "folder"; _clickedfolder.trim(new char[] { '.folder' }); but neither of these work. what correct way take file extension away , have file name display? use path class: string fnwithoutextension = path.getfilenamewithoutextension(path); or string extension = path.getextension(path);

iphone - Can you remove an app update in iTunes Connect after its been accepted -

if submit update ios application via itunes connect , set release date distant date in future, able remove/cancel update once gets accepted? updated: shortly after adding this, found following: rejecting app pending developer release can reject app after getting apple approval? yes, can in itunesconnect. here's how remove app sale: (this itunesconnect developer guide). click on "rights , pricing" button app summary page. click on link view specific stores. click on "deselect all" uncheck app store territories. click on "save changes" button. if app hasn't been released yet (it "pending developer release"), use "reject binary" instead.

c# - What to test/mock? -

given following simple service class, in getcategories() method, should test fact categoryrepository.query() method called, or should setting test keeps list of categories , returns those? i guess saying mocking categoryrepository , verifying it's query method called once cover test case? public class categoryservice : validatingservicebase, icategoryservice { private readonly irepository<category> categoryrepository; private readonly irepository<subcategory> subcategoryrepository; private readonly ivalidationservice validationservice; public categoryservice( irepository<category> categoryrepository, irepository<subcategory> subcategoryrepository, ivalidationservice validationservice) : base(validationservice) { this.categoryrepository = categoryrepository; this.subcategoryrepository = subcategoryrepository; this.validationservice = validationservice; } public i

c# - Is it Possible to ignore expected parameter -

.net if (ssn.contains("x)) { cmd.parameters.addwithvalue(nothing ignore); } - stored procedure select case when ssn null '' else case when ssn = '' '' else 'xxxxx' + right(rtrim(ssn),4) - stored procedure update @currentuser varchar(30), @ssn varchar(11) = null set [ssn] = [@ssn] [currentuser] = [@currentuser] when read value want xxx-xx-1234 value exist in textbox , dont want user click update , save xxx-xx-1234 database. best way handle that? if declare stored procedure default value, in case: @ssn varchar(11) = null you don't have pass if don't need to. don't do cmd.parameters.addwithvalue for it, in fact simple skip when adding parameters stored procedure , parameter not "expected", value of null assigned default. but if simple don't want update - don't. check textbox specific value , if incorrect - skip call db update.

javascript - Submit in Fine Uploader without a file -

i have fine uploader using upload file , submit form data @ same time. i have edit option allow change form data or without changing file. so, possible have fine uploader submit without requiring file submitted along form data. no, fine uploader not general-purpose library. deals cross-browser uploading, , it's complex enough without branching out other areas. if you'd submit form without file data, it's easy cross-browser, no library required. without knowing more web app, can't provide more detailed answer. if you'd request feature, please in fine uploader github repository's issue tracker. if take route, please describe use case in detail.

c# - Why does 1 + 0 + 0 + 0 + 3 == 244? -

passing value of "01200000131" method: private static int sumoddvals(string barcode) { int cumulativeval = 0; (int = 0; < barcode.length; i++) { if (i % 2 != 0) { messagebox.show(string.format("i {0}; barcode{0} {1}", i, barcode[i])); cumulativeval += convert.toint16(barcode[i]); } } messagebox.show(string.format("odd total {0}", cumulativeval)); return cumulativeval; } ...returns "244" i'm expecting return "4". the first message box shows me i'd expect see, namely "1", "0" 3 times, "3", expect add "4", not "244". you converting numerical char values int 's here: cumulativeval += convert.toint16(barcode[i]); // indexer on string char what want.. convert string representation of number number.. not char value.. add tostring() : cumulativeval += convert.toint16(barcode[i].t

IIS->Tomcat Redirect: multiple worker with default -

i trying configure multiple instances of tomcat (7) behind single domain in iis. tomcat instances both run on separate ports. have installed tomcat isapi_rediect.dll , configured iis. everything works redirector, except (you knew coming) being told "all other traffic must mapped 1 of 2 instances (they different applications). more accurate requests except specific pattern need mapped 1 worker , specific pattern (/rpt) needs go other worker. i have 2 workers defined in workers.properties: worker.list=ajp13_1,ajp13_2 worker.ajp13_1.port=8009 worker.ajp13_2.port=8010 and following in uriworkermap.properties: /wxx|/*=ajp13_1 /rpt|/*=ajp13_2 with this, seems fine. except (considerable) number of request not include wxx scope. need map rpt , sub content ajp3_2 , other requests ajp3_1. if add /|*=ajp13_1 then ajp3_2 becomes unreachable , wildchar match maps /rpt/* uri ajp3_1. is there way trying do? appreciate help- have spent time reading same references

How to make SQL many-to-many same-type relationship table -

Image
i'm newbie sql , i'm jumping in head first trying learn as possible i'm coding, difficult i'm designing database i'll have live while want make sure right. learned basics of many-to-many bridge tables, if 2 fields same type? let's social network thousands of users, , how create table keep track of friends who? if there additional data each relationship, say... "date friended" example. knowing there queries "show friends of userx friended between datey , datez". database have several situations , can't figure out efficient way it. since it's coming lot me, figure others have figured out best way design tables, right? create user table relationships table store id of 2 friend , kind of information relationship. sql diagram mysql code create table `users` ( `id` tinyint not null auto_increment default null, primary key (`id`) ); create table `relationships` ( `id` tinyint not null auto_increment defau

ruby on rails - Application Error for Heroku Deployment -

i deploying website on heroku, received "application error" when try run "heroku open". i believed have pushed files heroku, part of code "git push heroku master": -----> ruby/rails app detected -----> using ruby version: ruby-1.9.3 -----> installing dependencies using bundler version 1.3.2 ruby version change detected. clearing bundler cache. old: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux] new: ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux] running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment when run "heroku config -s | grep path", got path=bin:vendor/bundle/ruby/1.9.1/bin:/usr/local/bin:/usr/bin:/bin i using ruby 1.9.3 , rails 4.0.0 heroku run ruby -v running `ruby -v` attached terminal... up, run.1868 ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux] heroku logs 2013-09-03t22:19:50.190

idl programming language - IDL D format -- 26/60 is not 26.d/60.d? -

i trying write like ep = 23 + (26/60) and give me ep=23; however, if change either of 26 or 60 26. or 26.d, ep=23.43 want. i curious why this? try searching, question difficult express. the result type of operation given types of arguments. above, in 23/60 , result should 0 using integer division. but, if 1 of 23 or 60 float (specified making them 23. or 60. , respectively), operation done float division. furthermore, setting 1 of them double makes operation done in double precision.

otp - My Erlang project has multiple applications: How should I start them? -

i'm struggling, otp noobie, understand how structure erlang project. far has several applications under app directory managed rebar: proj_root apps app1 app2 appn rebar.config i can start app1, say, in shell application:start(app1). no doubt repeat through appn. there preferred or better way? can i, say, write function bundles these starts? if so, put it? i have several other questions along line, post separately. many thanks, lrp you can indeed start applications manually suggest. can become burdensome if have many applications , there dependencies between them. automating process quite easy implement recursive function. if try start application while 1 or more dependencies not running, application:start/1 fail , return {error, {not_started, app}} . function can in of applications or in own. however, manual (or automated) way proceed not otp way , if can prove useful (typically tests…). if follow otp principles, you supposed cr

performance - ListView Values are being duplictaed upon scrolling -

i using listview s.t every row have imageview , flowlayout, extended baseadapter , send arraylisy of hashmaps each 1 have image path , list of words problem every time scroll entry "leaves" screen , down , entry "comes back" screen words in entry flowlayout gets recycled being duplicated (meaning if word next disk-on-key "dok" after scroll down , again word in flowlayout "dok dok")...i cant figure out why... =( i took flowlayout + bubbles here - http://www.superliminal.com/sources/flowlayout.java.html http://nishantvnair.wordpress.com/2010/09/28/android-create-bubble-like-facebook/ and decode async task load images list @mceley's answer here - large listview containing images in android and getview code - @override public view getview(int position, view convertview, viewgroup parent) { imageview imageview = null; flowlayout flowlayout = null; if (convertview == null) { convertview = layoutinflater.inflate(r.l

sql - How can I read a .dump file with R ? -

suppose have .dump file convert data.frame can analyse in r. know sqldf allows use sql commands on data frames can use or package read in .dump files? this post shows how restore .dump file sql syntax doesn't work in sqldf . of course, have no idea how use sql syntax, fault. this think syntax should based on post mentioned: mysql create database mydb; mysql use mydb; mysql source dumpname.dump;

python - python3 encode errors, confusion (using twython) -

this first time trying out python in long time. trying extract , print tweets console using twython. tw = twython(app_key, access_token=access_token) search = tw.search(q='#python') tweet in search["statuses"]: print(tweet['user']['name']) print(tweet['text']) usually few tweets print , run this, while printing either user name or tweet text (varies depending on character occurs): unicodeencodeerror: 'charmap' codec can't encode character '\u2026' in position 139: character maps i have tried adding .encode('utf-8') or wrapping in str() , closest b'text here' , want tweet text. tried tacking on decode() . read have tell python kind of charset want encode, have been doing, still b'string here' . alot of examples find on web not python3 makes little more difficult find need. can point me in right direction? what character set used of console? assume it's ascii. '\u