Posts

Showing posts from May, 2012

jquery - ASP.NET CheckBoxFor generates hidden field messes up ajax submit -

so default @html.checkboxfor going generate hidden field after original field, like <input name="xxx" id="xxx" type="checkbox" .... data-val="true" value="true"/> <input name="xxx" type="hidden" value="false"/> when ajax submit $(form).serialize() post body contain 2 xxx fields if checkbox checked. ( xxx=true&&xxx=false ) expected. modelstate.isvalid returns false , error system.invalidoperationexception: parameter conversion type 'system.collections.generic.list`1[system.string]' type 'system.boolean' failed because no type converter can convert between these types how can fix this?? update: happening webapi controller, doing regular model binding [httppost] public void mymethod(mymodel model) { if ( !modelstate.isvalid ) throw new httpresponseexception( httpstatuscode.badrequest ); }

c++ create, assign and compare a new variable to two object inside an Operator Overloaded function. -

the assignment: implement alien class using provided alien.h file. alien, in scenario described in terms of his/her height, weight, , gender. compare 2 aliens, use following equation determine alien’s statuspoints value: statuspoints = weight * height * gendervalue gendervalue 2 if alien male, , 3 if alien female. status points should calculated when needed, not kept data member. avoids so-called stale data, in 1 data member, such weight might change , status points variable wouldn’t updated. status should used when comparing aliens. need overload ==, !=, >, <, >=, , <= operators compare aliens. thus, might have statements such following: if(alien1 > alien2) { //do } obviously, alien1 alien object, , alien2. assumed have data members (height, weight, , gender) initialized. here provided .h file. again, cannot alter file provided me. #ifndef alien_h #define alien_h class alien { public: alien(); alien(int h, in

android - Libgdx Scene2d Image from NinePatchDrawable doesn't rotate -

i creating image using ninepatchdrawable , trying rotate using rotateby method simply, not rotating somehow. using following code snippet: textureatlas ninepatchatlas = game.getassetsinterface().gettextureatlas(constants.game_atlas); atlasregion region = ninepatchatlas.findregion("drawpatch"); ninepatch ninepatch = new ninepatch(region, 59, 59, 59, 59); ninepatchdrawable ninepatchdrawable = new ninepatchdrawable(ninepatch); image image = new image(ninepatchdrawable); image.setorigin(image.getwidth() / 2, image.getheight() / 2); image.setposition(200, 400); image.setwidth(150); image.rotateby(45); rotate working if use drawable instead of ninepatchdrawable on constructor of image. there facing same issue? after investigating have decided use containers follows: textureatlas ninepatchatlas = game.getassetsinterface().gettextureatlas(constants.game_atlas); atlasregion region = ninepatchatlas.findregion("drawpatch"); ninepatch ninepatch = new ninepatc

regex - Javascript - modify regexp constructor or add tokens -

i need parse input against complex regexp's have common elements. i make "my text 2014".match(/{date}/); where date long regexp or set of tokens like regexp.tokens.date = /{year}|{month}|{day}/ etc. and uses tokens regexp.tokens.year = /** native regexp matching year number **/ i want {tokens} (recursively) parsed native regexp before testing. in other words - want add list of tokens , meaning , able make regexp using them. i trying modify constructor of regexp dont make change. rather hacking around existing stuff, should create own wrappers . something like: function myregex(src,flags) { for( var k in myregex.tokens) if( myregex.tokens.hasownproperty(k)) { src = src.replace(new regexp("\\{"+k+"\\}","g"),myregex.tokens[k]); } this.pattern = new regexp(src,flags); }; myregex.tokens = { "year": "your regex string here", // ... }; myregex.prototype.test = functi

jquery - Multiple Google Maps within Bootstrap Tabs -

i have bootstrap tab structure single google map iframe inside each tab. first tab's iframe looks fine other ones unzoomed , uncentered. it's not iframe src code because tried replacing first 1 second , others; first 1 works fine. i have seen solutions none of them worked me; don't generate maps javascript (i thought bit complicated 'coz there 11 tabs, meaning 11 maps triggered separately js). how can make them first one? <ul id="tablist" class="nav mt20" role="tablist"> <li role="presentation" class="active"> <a href="#location1" aria-controls="location1" role="tab" data-toggle="tab">edÄ°rne</a> </li> <li role="presentation"> <a href="#location2" aria-controls="location2" role="tab" data-

php - Symfony2 Assetic not working with multiple javascript file with the * sign -

i use symfony2 , assetic bundle. (probleme when using * sign ask assetic take files) form have read here , there assetic allow use multiple javascript file. this work fine when when write file right before <'/html> tag: {% javascripts '@mysiteblogbundle/resources/public/js/test1.js' '@mysiteblogbundle/resources/public/js/test2.js' '@mysiteblogbundle/resources/public/js/test3.js' %} <script type="text/javascript" src="{{ asset_url }}"></script> {% endjavascripts %} but same code, doesn't work if instead of listing file, use * (just this:) {% javascripts '@mysiteblogbundle/resources/public/js/*' %} <script type="text/javascript" src="{{ asset_url }}"></script> {% endjavascripts %} with *, works depending on pages displayed. did javascipt test on class on main twig template. , thoses class displayed on pages... test should working.

javascript - Grab html element value -

how can grab html element value using php or javascript? tried using jquery dom ready event, problem value wanna grab dynamically loaded somewhere, , when use jquery dom ready event of times happens dom ready value of element empty (its still not loaded) , when grab value jquery gives empty value of element, because grabbing before loaded in element. how can grab value after loaded? there kind of trigger or event? any / ideas appreciated ! the accepted solution works, think better : <script type="text/javascript"> var bool = false; jquery('.element').bind('domnodeinserted', function() { if(bool == false) { alert("dom node inserted !"); bool = true; } }); </script> try using window.load below: $( window ).load(function() { // run code }); this guarantee page loaded first further comment. can't assign load event single element that. need wait elements loaded(whole page) if want

model - New to extending Django user profiles, Need help creating a contacts/phone numbers list for each user in the database -

i'm bit new django , far been working simple database/model configurations. i'm beginning run against limitations. need add list of contacts individual users stores collection of names , phone numbers. see no way of doing userprofile model have created other storing whole list string or deserialized json in single char or text field (yuck). for example have model: class userprofile(models.model): user = models.onetoonefield(user) #persional informaiton height = models.charfield(max_length=24, blank=false,null=true) weight = models.charfield(max_length=24, blank=false,null=true) birthday = models.charfield(max_length=24, blank=false,null=true) ###this field need add!! #contacts contact_list = models.somekindoffield() #could contain either array or json?? class meta: managed = true db_table = 'user_profiles' user.profile = property(lam

bar chart - Sum Barplot of a dataset in R -

Image
lets have csv dataset 100 columns , 200 rows. every row observation , columns questions measured on likert scale(categorical) 1-5. now want make one barplot frequency on y-axis , categories 1-5 on x-axis. in end want have clean overview of categories have been used or least without further detail. sorry, must super easy, if search solutions super fancy multiple or stacked barplots. so basically, if * defined columns need like: barplot(dataset$*) additional comment: when aksed questions code above worked 1 column f.e. barplot(dataset$column1) then played bit around , frequency on x-axis , looks weird way, same code. how possible? if change code to: barplot(xtabs(~dataset$column1)) i same result before: barplots of 2 sets x <- c(0.0001, 0.0059, 0.0855, 0.9082) y <- c(0.54, 0.813, 0.379, 0.35) # create 2 row matrix x , y height <- rbind(x, y) # use height , set 'beside = true' pairs # save bar midpoints in 'mp' # set bar

hibernate - Can't get an Entity from db -

i have postgree db. , spring+hibernate. when wan't entity criteria, return me 0 length list. looks dependency missed, or entity isn't recognized entity. my maven config: ... <spring.version>4.0.3.release</spring.version> <hibernate.version>3.6.9.final</hibernate.version> .... <!-- spring framework --> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-core</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-context</artifactid> <version>${spring.version}</version> </dependency> <dependency> <groupid>org.springframework</groupid> <artifactid>spring-web</artifactid> <version>${spring.version}</version>

javascript - HTML, calling JS (API) -

i have few issues calling chessboard.js ( http://chessboardjs.com ). downloaded api , made new html file: <!doctype html> <html> <head> <title>super chess/title> <meta charset="utf-8"/> <script src=":\path-to-js-file\jschessboard-0.3.0.js"></script> </head> <body bgcolor="lightgrey"> <div id="board" style="width: 400px"></div> <script> var board = new chessboard('board', 'start'); </script> </body> </html> i tried draw chessboard. i'm doing wrong? thanks. from can tell based on code , docs, you're missing 2 things: 1) title tag isn't closed on line 4 of html file 2) after you've fixed problem you'll error saying "$ isn't defined" in chessboard.js file. teased out jquery dependency chessboard.js file. if include jquery in html (either download file you've done chessb

python mutating a list while for loop Error -

all want removing duplicate elements in list l.c(l) working, d(l) shows typeerror: argument of type 'nonetype' not iterable when run it. think there no differences between these 2 functions. can not figure out why comes out type error: def c(l): l = [] in range(len(l)): if not(l[i] in l): l = l + [l[i]] return l def d(l): l = [] print type(l) in range(len(l)): if not (l[i] in l): l = l.append(l[i]) return l thanks help. this: l = l + [l[i]] is not equivalent this: l = l.append(l[i]) the line above assigns l value return value of calling append function, none . you can use instead: l.append(l[i])

javascript - Validating date input field with onsubmit -

i looking everywhere, couldn't find code problem. have input fields, users using send online requests. , 1 of fields date field, somehow validate in way, allowed if entered date somewhere between today , 8 days before. example: if today 29 november , allowed enter date between 21st-29th november , nothing else , shown alert window when have entered wrong date pick days minicalendar part resolved, need validating. if post working code, grateful. thank you use jquery ui datepicker, script below: $(function() { var currentdate = new date(); var maxalloweddate = new date(currentdate); maxalloweddate.setdate(currentdate.getdate() + 8); $( "#datepicker" ).datepicker({ changeyear: true, mindate: '0', maxdate: '+7d', }); $('#datepicker').change(function(){ var enteredval = new date(this.value); if(enteredval.gettime() < currentdate.gettime() || enteredval.gettime() >

mysql - How can i fix my (complicated) query so that it gives me proper table? -

so have query: select a.year, a.avg_kw_price, b.avg_kw_consumed (select year, avg(value) avg_kw_price ap_data substring(series_id, 8) ='72610' group year)a, (select substring(yyyymm,1,4) year, value*9506632 avg_kw_consumed residential_en_consumption msn = 'esrcbus' , substring(yyyymm, 4,2) = '13' group substring(yyyymm,1,4)) b a.year = b.year; my 2 tables this: ap_data: (the 72610 part refers item kw/h) series_id year period value apu000072610 1996 m11 0.092 apu000072610 1996 m12 0.092 apu000072610 1997 m01 0.092 apu000072610 1997 m02 0.092 apu000072610 1997 m03 0.093 apu000072610 1997 m04 0.092 table residential_en_consumption looks (the 13 @ end of yyyymm item refers total year): msn yyyymm value description unit esrcbus 201008 20

Simple jQuery Price Updating problems dropdown vs radio button -

so figured out how update price via jquery, radio buttons: here link: http://jsfiddle.net/pcvr7h2b/5/ now problem having applying exact same function dropdowns, "option" values. want price change when dimension selected in dropdown. i added in code here: $("option:selected").each(function() { var value = $(this).attr("value"); total += parseint(value); }); trying work, having no luck. ideas? thanks! i don't know ultracart is. regardless of ultracart, here how implement purpose. http://jsfiddle.net/matildayipan/01ekur6u/ function total(){ var total = 0; var opt3 = parseint($("select[name='optionvalue3'] option:selected").val()); var opt4 = parseint($("select[name='optionvalue4'] option:selected").val()); total = opt3 + opt4; return total; } $(document).ready(function(){ var num = total(); $("#total").append(num); $("select")

javascript - Persistent CSS class change on HTML page -

suppose want let readers of html page adjust font size. can make simple button , onlick event via javascript change font-size property in corresponding css file - change body { font-size: 10px;} body { font-size: 12px;} . however such changes not persist upon page reload, or when user moves different page. simplest solution save font-size under kind of variable last until browser closed? cookies way (meaning, there way same thing without having user download anything?). any suggestion/reference appreciated. i think you're looking html 5 storage mechanisms . quick rundown: localstorage lasts until cleared web-page, , sessionstorage lasts until browser closed. both store data client-side.

python - Float formatting to 3 or 4 decimal places -

i format float strictly 3 or 4 decimal places. for example: 1.0 => 1.000 # 3dp 1.02 => 1.020 # 3dp 1.023 => 1.023 # 3dp 1.0234 => 1.0234 # 4dp 1.02345 => 1.0234 # 4dp kind of combination of '{:.5g}'.format(my_float) , '{:.4f}'.format(my_float) . any ideas? assuming understand you're asking, can format 4 drop trailing '0' if there one. this: def fmt_3or4(v): """format float 4 decimal places, or 3 if ends 0.""" s = '{:.4f}'.format(v) if s[-1] == '0': s = s[:-1] return s >>> fmt_3or4(1.02345) '1.0234' >>> fmt_3or4(1.023) '1.023' >>> fmt_3or4(1.02) '1.020'

matlab - Save .mat file, use -v7.3 switch? -

Image
i'm running m-file, creating 2 variables, clus , watts_map . want save both variables file ends in ".mat". both variables dimensioned (1152,241,319), 1152 360 deg longitude in 0.3125 deg increments, 241 latitude 30s-30n in 0.25 deg increments, on 319 time steps. code works way until end, error: [warning: variable 'clus' cannot saved mat-file version older 7.3. save variable, use -v7.3 switch. skipping...] [warning: variable 'watts_map' cannot saved mat-file version older 7.3. save variable, use -v7.3 switch. skipping...] i using matlab version r2014a, think current version. also, have run same exact code on smaller spatial domain (but on 2920 timesteps) without error. % clear variables, initialize counter, indexed timestep clc; clear all; rain = nan(1152,241,319); clus = nan(1152,241,319); areas_final = nan(500,319); wattage_final = nan(500,319); cluster_size = zeros(319,1); watts_map = zeros(1152,241,319); year = 2000%:2008; nyear

Dialogue in Unity3D -

how can display os provided popup dialogue box in unity (4.6) game? the dialogue should block access other ui should provide 1 or more buttons callbacks attached each button tap you can use plugins this. ios example: download prime31 etcetera plugin , call public static void showalertwithtitlemessageandbuttons( string title, string message, string[] buttons ) more info here: https://prime31.com/docs#iosetc

jquery - Is there way to make two HTML ID's link to one javascript function? -

i have 2 tables need have different ids or not work. i'm using 3rd party data table code uses id differentiate between different tables in browser. <table id="promo" class="display"> <table id="official" class="display"> but need them both link same script function. can see below, have 1 #promo , 1 #official both using exact same code: $(document).ready(function() { $('#promo').datatable( { // ton of stuff here } ); $('#official').datatable( { // ton of stuff here } ); is there way make both tables link same code in script? is there way make both tables link same code in script? yes: $('#promo, #official').datatable( { // ton of stuff here }); this uses css group selector , can use other selector matches both elements. based on question, instance, .display (a class selector ) (provided doesn't match other elements haven't shown):

ANSI C: Error checking user input with a function -

i attempting use single error checking function check errors within multiple other functions. however, when running program, gets stuck in loop , won't break it. once application gets valid input, should continue next function. repeats fstartbalance function if error checking returns 0. i'm kind of beginner, i'm not @ troubleshooting. here applicable code: /* begin fvalidatefloat */ int fvalidatefloat(float input, float minvalue, float maxvalue) { int failed = 0; while (input < minvalue) { printf("\nerror: input low, please enter value greater or equal %.2f.", minvalue); failed = 1; return failed; } while (input > maxvalue) { printf("\nerror: input high, please enter value less or equal %.2f.", maxvalue); failed = 1; return failed; } } /* end fvalidatefloat */ /* begin fstartbalance */ float fstartbalance(void) { float startbalance; /* declare variable */ in

jquery - Display Day of the Week after Date with bootstrap-datepicker -

i'm using bootstrap-datepicker , display actual day of week in text field right after date. example: 12/01/2014 monday my datepicker configuration $(document).ready(function () { $('#calendar').datepicker({ format: "mm/dd/yyyy", weekstart: 1, autoclose: true, todayhighlight: true, }); }); the actual datepicker source here: https://bootstrap-datepicker.readthedocs.org/ you can try this, add part code: $('#calendar').change(function () { //your date picker input var eventdate = $('#calendar').val(); var dateelement = eventdate.split("/"); var dateformat = dateelement[2]+'-'+dateelement[0]+'-'+dateelement[1]; var date = new date(dateformat+'t10:00:00z'); //to avoid timezone issues var weekday = ["sunday", "monday", "tuesday", "we

javascript - AngularJS: element.show() in directive not working -

i have directive ( see plunk ) wraps div style display:none , after 1 second shows content. tried make display element.show() , $(element).show() (including jquery) never worked. timeout works, what's wrong code? this html: <hideme> show after 1 second </hideme> and javascript: angular.module("app", []); function myctrl($scope) {} angular.module("app").directive('hideme', function($timeout) { return { restrict: 'e', template: '<div style="display: none !important"></div>', link: function(scope, element, attrs) { $timeout(function() { element.show(); }, 1000); } }; }); plunker: http://plnkr.co/edit/bzhcwjxdll3ibxc7qsmy?p=preview try using transclude:true , ng-transclude display markup between custom element tags. also, i'm not familiar using show(), instead set html ng-show=&#

bit fields - Questions about C bitfields -

is bitfield c concept or c++? can used within structure? other places can use them? afaik, bitfields special structure variables occupy memory specified no. of bits. useful in saving memory , nothing else. am correct? i coded small program understand usage of bitfields - but, think not working expected. expect size of below structure 1+4+2 = 7 bytes (considering size of unsigned int 4 bytes on machine), surprise turns out 12 bytes (4+4+4). can let me know why? #include <stdio.h> struct s{ unsigned int a:1; unsigned int b; unsigned int c:2; }; int main() { printf("sizeof struct s = %d bytes \n",sizeof(struct s)); return 0; } output: sizeof struct s = 12 bytes because a , c not contiguous, each reserve full int's worth of memory space. if move a , c together, size of struct becomes 8 bytes. moreover, telling compiler want a occupy 1 bit , not 1 byte. though a , c next each other should occupy 3 bits total (still under single

javascript - is using a dependency inside a object's prototype method bad? -

i'm trying create simple app retrieves youtube song data database, , have displayed on list. here's track object looks basically: function track(title, artist, genre, length, videoid) { this.title = title; this.artist = artist; this.genre = genre; this.length = length; this.videoid = videoid; } note: videoid unique character string used player. now, create module public api handles youtube player functionality. below: var player = (function() { function playvideo(videoid) { youtubeplayer.playvid(videoid); } // ... other player functionality ... return { playvideo: function(videoid) { return playvideo(videoid); } } })(); (i'm making youtube's api above, forget actual code play video is, it's similar) now, want add function track object play track. i'll calling method when user clicks play button track. below: track.prototype.playvideo = function(player) { player.playvideo(this.videoid); } basicall

ios - Cannot assign to property in protocol - Swift compiler error -

i'm banging head against wall following code in swift. i've defined simple protocol: protocol nameable { var name : string { set } } and implemented with: class nameableimpl : nameable { var name : string = "" } and have following method in file (don't ask me why): func namenameable( nameable: nameable, name: string ) { nameable.name = name } the problem compiler gives following error property assignment in method: cannot assign 'name' in 'nameable' i can't see i'm doing wrong... following code compiles fine: var nameable : nameable = nameableimpl() nameable.name = "john" i'm sure it's simple i've overlooked - doing wrong? @matt's anwer correct. another solution declare nameable class protocol . protocol nameable: class { // ^^^^^^^ var name : string { set } } i think, solution more suitable case. because namenameable useless unless nameab

python - Setting the position of the insert character in the tkinter text widget -

i'd change position of insert character in tkinter text widget. there method or other way me set position insert character @ in text widget? you can use mark_set method insert mark. for example: t.mark_set('insert', '2.3') or t.mark_set(insert, '2.3') above code position cursor after 3rd character in 2nd line.

javascript - Transfer client side data to server side in Flask -

i trying build site using flask. have little knowledge client side. trying build jinja2 template runs script gives me user's latitude , longitude. problem have latitude , longitude don't know how transfer data server side script. this base.html <!doctype html public "-//w3c//dtd html 4.01//en"> <html> <head> <title>welcome tumu's app</title> </head> <body> <p> hello. lets share between close peoples. </p> <script type="text/javascript"> navigator.geolocation.getcurrentposition(function (position) { alert(position.coords.latitude + ',' + position.coords.longitude); }, function (error) { alert(error.code); }, {enablehighaccuracy: true, maximumage: 0}); </script>" <div>share location: <a href="/">home</a></div> <hr> {% block content %}{% endblock %} </body> </html> my test.html {% exte

java - Allow user to choose an image from their gallery to upload to imageview in an activity? -

i not sure search for, have tried few things have not found need. have default image app logo displaying in imageview. have , "admin" activity user able customize app further. how allow them change default logo 1 of choice , display in same imageview on mainactivity (separate choose it, admin activity)?? thanks much! on click of button trigger following code: @override public void onclick(view v) { intent photopickerintent = new intent(intent.action_pick); photopickerintent.settype("image/*"); startactivityforresult(photopickerintent, 1); } on activityresult : @override protected void onactivityresult(int requestcode, int resultcode, intent data) { // todo auto-generated method stub super.onactivityresult(requestcode, resultcode, data); try { string path = ""; if (requestcode == 1) { if (resultcode == result_o

haskell - How to change this function to work with any type, not just Int -

i have written following function @ 1 time in past, replace instance of integer x in list, integer y. here's code: substitute::int->int->[int]->[int] substitute x y [] =[] substitute x y (z:zs) |(z==x) =y:substitute x y (zs) |otherwise =z:substitute x y (zs) here's sample call: main = print $ substitute 2 3 [2, 2, 2] i want make code work input type. tried converting parameter types generic "a", spits out error haskell thinks sort of customary higher-order function. how can make work: substitute::a->a->[a]->[a] substitute x y [] =[] substitute x y (z:zs) |(z==x) =y:substitute x y (zs) |otherwise =z:substitute x y (zs) main = print $ substitute 2 'a' [2, 2, 2] one way find out remove type signature code , find out using ghci: λ> :t substitute substitute :: eq => -> -> [a] -> [a] haskell has type inference, a

Android action bar custom layout not fit with screen -

Image
hi using custom action bar layout in project.now have problem custom layout not fit full screen , action bar layout alignment changes on searchview click. custom layout <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <linearlayout android:layout_width="fill_parent" android:layout_height="40dp" android:background="#585858"> <linearlayout android:layout_width="0dp" android:layout_height="match_parent" android:orientation="vertical" android:layout_weight="0.5" android:gravity="center" > <imageview android:id="@+id/imageview1" android:layout_width="wrap_content" android:layout_height="wrap

ios - Difference between frame.size.width and frame.width -

i writing program in swift , noticed can directly access cgrect frame's width , height properties directly without using cgsize width , height. able write code this. @iboutlet var myview: uiview! override func viewdidload() { super.viewdidload() var height = myview.frame.height var height1 = myview.frame.size.height } in objective c, when tried write same code, line height = view.frame.height throwing error. can please tell me difference(if any) in these 2 lines of code. i looked cgrect structure reference. in swift there extension defined have members height , width . please have @ code below struct cgrect { var origin: cgpoint var size: cgsize } extension cgrect { ... var width: cgfloat { } var height: cgfloat { } ... } so can directly fetch height , width values cgrect . can see these getters , error if try set these values using view.frame.height = somevalue

sql - Mysql previous date -

i using following have previous date data @ 00.00.00 select * perf timestamp="subdate(curdate(),1)"; but not resulting output where select * perf timestamp="2014-11-28"; resulting proper output can of please me in trying find out issue.any appreciated. check subdate() function try this: select * perf date(timestamp) = subdate(curdate(), interval 1 day);

jquery - Issue in password field validation asp.net C# -

i have make validation password. works fine if add runat=server password validation not work.and when remove runat server works fine. my code as: <input value="" runat="server" class="validate[required] text-input" type="password" required pattern="(?=.*\d)(?=.*[a-z])(?=.*[a-z]).{6,}" name="password" id="password" /> <input value="" runat="server" class="validate[required,equals[password]] text-input" type="password" name="password2" id="password2" /> any on topic appreciated. you have taken normal html tag telling act server side control i,e runat="server".normal html control not work server side control,so please take asp.net controls , write required code. <asp:textbox runat="server"/>

Flume configuration to upload files with same name -

i have 10 files data varying in length.i store corresponding data in same file , same filename, flume splitting data , saving flumedata.timestamp. using configuration below: a1.sources = r1 a1.sinks = k2 a1.channels = c1 a1.channels.c1.type = file a1.channels.c1.checkpointdir = /mnt/flume/checkpoint a1.channels.c1.datadirs = /mnt/flume/data a1.channels.c1.trackerdir = /mnt/flume/track a1.channels.c1.transactioncapacity = 10000000 a1.channels.c1.capacity = 500000000 a1.channels.c1.maxfilesize = 10000000 a1.channels.c1.usedualcheckpoints = true a1.channels.c1.backupcheckpointdir = /mnt/flume/backup a1.channels.c1.checkpointinterval = 2000 a1.channels.c1.minimumrequiredspace = 9000000 a1.sources.r1.channels = c1 a1.sources.r1.type = spooldir a1.sources.r1.spooldir = /usr/local/netlog/ a1.sources.r1.fileheader = true a1.sources.r1.buffermaxlinelength = 500 a1.sources.r1.buffermaxlines = 10000 a1.sources.r1.batchsize = 100000 #a1.sources.r1.deletepolicy = immediate a1.sinks.k2.ty

javascript - JQuery adding object function using .on() -

i'm trying add object's function button created when conditions met. matter if have var i'm trying change outside document.ready? var myvar = 1; $(document).ready(function(){ var myobj = { changemyvar: function(){ myvar++;} } ... /* button id='my-button' created in div id='mydiv' */ ... $('#mydiv').on('click', '#my-button', myobj.changemyvar); }); no function attached button , no error thrown. in fact, console.log(myobj.changemyvar) returns undefined. missing here? edit: lied no errors, 'undefined not function' on .on() line. thanks! edit2: after further analysis, discovered silly type-o in original code. answers! i tried replicating issue in fiddle, worked. try out http://jsfiddle.net/7fjk3wxs/1/ this used: var myvar = 1; $(document).ready(function(){ var myobj = { changemyvar: function(){ myvar++; alert(myvar); } }; $('#mydiv').on('click', '#my-butto

Form validation in structr -

how validate form in structr? when add value "create:mytype" action attribute in "edit mode binding" tab submit button, html 5 form validation stops working. i've verified removing action allows html 5 validation process normally. am doing wrong? when adding action attribute button (in edit mode binding), structr automatically binds 'onclick' event submits form, preventing browser doing validation based on html5 attributes. we're experimenting different forms of client-side validation (jquery validation plugin etc.) in latest snapshot builds. ideally, the server-side validation rules applicable client-based validation. difficult resolve, , html5-based validation harder because not browsers support it.

.net - How to wire up a generic repository parameter -

i'm getting following error: none of constructors found 'autofac.core.activators.reflection.defaultconstructorfinder' on type 'hotelslive.application.companyservice' can invoked available services , parameters: cannot resolve parameter 'hotelslive.interfaces.repositories.irepositoryasync 1[hotelslive.domain.models.company] repository' of constructor 'void .ctor(hotelslive.interfaces.repositories.irepositoryasync 1[hotelslive.domain.models.company])'. the service constructor is: public companyservice(irepositoryasync<company> repository) : base(repository) { _companyrepository = repository; } the autofac registrations are: builder.registertype<companyservice>() .as<icompanyservice>() .instanceperrequest(); and builder.registergeneric(typeof(repository<>)) .as(typeof(irepositoryasync<>))

c# - I can't add ApplicationRoleManager to startup.auth -

Image
the question pretty simple, i'm trying implement roles application, , if not places go to, tell me use following line in startup.auth: app.createperowincontext<applicationrolemanager>(applicationrolemanager.create); the problem is, visual studio keeps telling me applicationrolemanager doesn't exist! searched different ways maybe implement this, keeps saying "use applicationrolemanager", can't use , apparently, got libraries needed too. any welcome here. apparently, application didn't auto-generate applicationrolemanager code, i'm trying add manually. in identityconfig.cs have added following code: public class applicationrolemanager : rolemanager<identityrole> { public applicationrolemanager(irolestore<identityrole, string> rolestore) : base(rolestore) { } } at point i'm stuck, because apparently need other methods (like create method) make work, cannot find example of code add. edit trying impl

Google geolocation gives coordinates for invalid addresses -

when using googles geolocation, sending in random numbers or address not exist, still gives answer location somewhere. why give location on address not exist? example. http://maps.googleapis.com/maps/api/geocode/xml?address=sdfsdfsdfsdf%209999999%20ghkhkgh&components=country:se&sensor=false result <result> <type>country</type> <type>political</type> <formatted_address>sweden</formatted_address> <address_component> <long_name>sweden</long_name> <short_name>se</short_name> <type>country</type> <type>political</type> </address_component> <geometry> <location> <lat>60.1281610</lat> <lng>18.6435010</lng> </location> <location_type>approximate</location_type> <viewport> <southwest> <lat>55.3367024</lat> <lng>10.9683721</lng> </southwe

c# - Any way to convert excel cell value in to html format? -

any way convert excel cell value in html format? i want convert excel cell value in html. ie: excell cell value: 'am programmer ' wanna convert like: am <b>programmer</b> am reading excel using excel interop. can check whether entire value in excel cell bold/italic add html tags accordingly unable check whether text bold\italic in between cell value. any way? you can use this method whether each character bold or not. a strategy think use stringbuilder build html: stringbuilder html = new stringbuilder(); (int index = 1; index <= cell.text.tostring().length; index++) { //cell here range object characters ch = cell.get_characters(index, 1); bool bold = (bool) ch.font.bold; if(bold){ if (html.length == 0) html.append("<b>"); html.append(ch.text); } } if (html.length !=0) html.append("</b>")

operator overloading - % operation for two vectors in C++ -

i have 2 vectors , b (with x , y & z coordinates) , want know whether a % b valid operation or not read somewhere / operation not valid 2 vectors , since % involves division hence confusion. if % valid how can overload % operator in c++ operation. this vector class: class vec { public: float x, y, z; }; it depends on mean "valid operation". there's no % operation defined standard library std::vector s, free define own operator overload that. it's not particularly idea - if every library decided operator use clash (i.e. ambiguous in contexts) - in practice you'll away it. more structured approach, consider creating own class sporting nifty operators, instead of modifying behaviour std::vector . the basics of overloading just: template <typename t> std::vector<t> operator%(const std::vector<t>& lhs, const std::vector<t>& rhs) { // generate , return vector, examp