Posts

Showing posts from March, 2010

ruby on rails - Assigning attributes in HTML form or when calling .new(*attrs) -

i have worked on numerous projects have seen both setting of attributes new object in html form , when calling model.new(foo: 'bar') which correct way of doing in fashion of "best practices"? form: <%= form_for user.new, remote: true |f| %> <%= f.hidden_field :foo, value: "bar" %> <%= f.text_field :email %> <% end %> instance variable: #obviously set in controller @user = user.new(foo: "bar") <%= form_for @user, remote: true |f| %> <%= f.text_field :email %> <% end %> at first case, when validation of user not passed, empty form rendered, @ second case form filled fields rendered. it's because instance variable @user @ controller keep entered values. so recommend use second variant.

c# - Is there more elegant method for multiple conditions verification -

case: asp.net mvc, c# , extjs. user has got filter, can choose multiple values. there 13 such filters , user can add them or remove ui. problem: on server side i've got class getting filters values: public list<string> filter1 { get; set; } public list<string> filter2 { get; set; } ... public list<string> filter13 { get; set; } then select data database , convert ienumerable<dataclass> dataclass looks below: public string data1 { get; set; } public string data2 { get; set; } ... public string data13 { get; set; } then filter data this: if (filter.filter1 != null && filter.filter1.any()) { data = data.where(x => filter.filter1.contains(x.data1)); } ... if (filter.filter13 != null && filter.filter13.any()) { data = data.where(x => filter.filter13.contains(x.data13)); } so there 13 if , 13 same filter logic. , code looks horrible. there way make more beautiful filter? added: filter1 can applied data1 ,

asp.net - Changes to aspx.vb file not reflected on the server -

i made tweak aspx.vb file on test server, small change custom error message being written in code, making copy of file, changing text , replacing file on server. however, change not reflect when go page browser. i thinking had file not being compiled. however, seems if aspx.vb file should compiled dynamically. there setting ensures happens? copy of web.config file: <?xml version="1.0" encoding="utf-8"?> <configuration> <system.web> <compilation debug="true" strict="true" explicit="true" /> <authentication mode="windows" /> <identity impersonate="true" /> <customerrors mode="on" /> </system.web> <system.webserver> <validation validateintegratedmodeconfiguration="false" /> <modules runallmanagedmodulesforallrequests="true" /> <defaultdocument> <files>

C# winforms application: event handler when returning (focus) from an external application -

i have winforms application has perform action every time when returning external application (i.e. focus has been lost application, alt-tabbing program , back). is there application event handler this? i have looked activate , deactive handlers of form, these handlers fired when form receives focus (when closing messagebox or closing subform). windows sends wm_activateapp message window when being activated, , when being deactivated. want handle, when wparam true (indicating activation). winforms not wrap event (at least not i'm aware of), you'll need add code form's window procedure manually: public class myform : form { // other code protected override void wndproc(ref message m) { const int wm_activateapp = 0x001c; switch (m.msg) { case wm_activateapp: { if (m.wparam.toint32() != 0) { // application's window being activated,

jquery - After textbox field loosing focues? -

i new ajax/jquery. developing application takes loan number input. when ever textbox field loose focus should display information particular loan getting information database. i developing in mvc. view consists loannumber = textboxfield. contact name = textboxfield phone = textboxfield. below sample code tells whether loan number exists or not. $("#loannumber").blur(function () { var num = $("#loannumber").val(); var status = $("#divstatus"); $.post("/fnmaimport/checkloannumber", { loannumber: num }, function (data) { if (data == true) { status.html("<font color=green>'<b> loan number " + num + "</b>' available!</font>"); } else { status.html("<font color=red>'<b> loan number " + num + &q

Converting rows to columns in ORACLE SQL with parametrization -

for 1 of etl-jobs need sql-query converts rows columns. difficulty want parameterize how many rows getting converted 1 column shown in following example: atm scenario looks this: oracle 11g one column table: parameter ab ae cf gh 5g h3 7p ….. sql-query: select listagg ('''' ||parameter ||'''', ',') within group ( order rownumber) parameter, (select case when rownum <= 5 5 when rownum <= 10 10 when rownum <= 15 15 when rownum <= 20 20 when rownum <= 25 25 end rownumber parameter sr0_crtl_sl_ol_psm_parameter ) group rownumber result this: parameter ab, bg, rt, zh, jk ae, hl, gh, dz, kl cf, gh, nm, sd, ….. what have query takes number eg. 5 following result: parameter ab, bg, rt, zh, jk ae, hl, gh, dz, kl cf, gh, nm, sd, ….. or takes eg. 8 , result like: parameter ab, bg, rt, zh, jk, ae, hl, gh dz, kl, cf, gh, nm,

javascript - Phonegap email composer plugin for BlackBerry OS 7 -

it might repeating question did not find solution after search of whole day. i'm developing phonegap application blackberry os 7 stuck email(message) composer plugin. there plugin of phonegap (cordova 2.7) email composer support blackberry os 7. if guys have idea please share it. have tried blackberry os message api , tried mailto: of html5 both not working might i'm doing in wrong way, if guys have tried , success please share process. blackberry 7 provides html5 api blackberry.invoke.messagearguments email composer , easy use instead of writing plugin this. steps implement blackberry.invoke.messagearguments add these code config.xml file <feature id="blackberry.invoke" /> <feature id="blackberry.invoke.messagearguments" /> <feature id="blackberry.message" /> add code js file , call method. function sendmail(){ var torecipient = "user@gmail.com"; var subject = "test mail"; var

javascript - Rendering a partial multiple times in Handlebars+Nodejs -

i'm quite new world of node , handlebars , have managed single partial rendering in node doing following: response.render('index', { 'data': data, partials: { results: 'results' } }); and in html page have following {{> results}} which renders results.html partial. need have same partial rendering on index page multiple times each different set of data, i've tried following: response.render('index', { partials: { 'data': data, results: 'results' } }); but didn't work.

sql - Joining two log tables to get the status of an account at the time it was subject to a logged event -

i trying join 2 log tables using sql server 2012 , in order add status of each account @ time subject of action logged. the first table report created logs of contact requests users (to other users) of website, based on request date ( request_date ) , receiver ( receiver_account_id ) of request. if contact request approved, approval date ( approval_date ) column populated well. table looks this: receiver_account_id sender_account_id request_date approval_date 13 19 2012-08-10 2012-09-01 13 21 2013-05-15 null 17 19 2011-09-11 null 25 44 2012-11-05 2012-11-07 the second table logs status changes of accounts: date account_id status 2011-07-10 13 free 2012-08-15 13 premium 2010-12-10 17 free 2012

Old SSIS in SQL Server 2012 -

we in process of migrating our sql server 2005 2012 version. there's significant number of ssis (developedn in vs 2005) running on server. will ok re-deploy these packages on new sql instance? or have go through visual studio upgrade process each? any comments, advice appreciated. thanks in advance. you're looking @ upgrade, variety of reasons. in 2005, packages have been stored in msdb.dbo.sysdtspackages90 2008 forward, table renamed msdb.dbo.sysssispackages even if deploy them sysssispackages , kept 2005 integration services service installed, don't think 2005 dtexec work 2008 version of stored procs in msdb relative ssis work. procs should backwards compatible msdb ssis "stuff" in 2012 poured of attention 2012 ssisdb catalog , clr methods there. depending on connection managers, sql server ole db connection strings changed sqlncli01 sqlncli1.0 (approximate) the internals of how data flows works has changed. mechanism signaling end

javascript - Google Event Tracker not firing -

i've got event tracker (located in main.js rather inline click handler) supposed fire when user clicks on item specific class. however, client reporting these event tracker never fire, or atleast never sees response them. however, other ga event trackers throughout site working. can see issues code below causing this? the js function in main.js handles looks so: $('.vote.complete').click(function() { whence = "tocompleted"; vote_id = $(this).data('vote_id'); cid = $(this).data('campaign_id'); c_title = $('#outfitpair'+cid).data('campaign_title'); u_id = $('#outfitpair'+cid).data('other_id'); _gaq = window._gaq; if(_gaq != undefined){ _gaq.push(['_trackevent', 'viewpreviousvote', c_title, u_id]); } $('#outfitpair'+cid).find('.button.vote').removeclass('to-vote'); $(this).addclass('to-vote'); $.get('/campa

Visual Studio won't let me add a COM control to a form in C# -

i'm trying add activex control form in visual studio's designer mode , prompts failed import activex control. please ensure registered. . it's in case have registered properly. prove word, can add same control in same machine other project's form! can't project want. these 2 projects same , can not find difference might have caused this. can suggest might have gone wrong? [update] i'm using visual studio 2010 version 10.0.30319.1 , both projects c# winforms.

.net - Using github on my project that uses NuGet -

i'm creating open-source .net web development framework called "expressforms". uploaded project github: https://github.com/daniellangdon/expressforms . i used nuget set code run latest versions of asp.net mvc , entity framework; these saved in "packages" directory below solution. can see default, git ignores directory when uploading project github. when download project github directory, directory missing , solution won't build. what need make developer can download code github , build right away without fuss? i still new git, it's i'm missing basic. sounds need enable nuget package restore in newly downloaded solution . when using nuget github, github ignores files under packages directory because it's not idea commit binary files (like dll libraries) git, because causes git repos become bloated in size on time because have keep each version of binary in repo history forever (unless go , erase them git filter-branch ).

Taking common elements from 2 vectors in Lua -

i have 2 vectors, lets v1 = (a,b,c,d,e) , v2 = (e,h,t,b,w) , want third vector containing common elements of v1 , v2 , in case v3 = (e,b) i've seen asked in c++, cant see lua. i assume when saying vectors, mean v1 , v2 both array-like tables, this: local v1 = {1,2,4,8,16} local v2 = {2,3,4,5} then can this: local v3 = {} k1,v1 in pairs(v1) k2,v2 in pairs(v2) if v1 == v2 v3[#v3 + 1] = v1 end end end

sql server - Scalability limits of federated database on Azure -

we plan use federated azure sql database in our next project, because need database solution can handle large amount of concurrent requests - inserts, selects, updates, etc. however, there hard limit of 180 concurrent requests on database instance. the problem if use federations, every connection must connect federation root first (just regular sql server database). server redirect our client federation member contains required data: -- statement redirect federation root db federation member db use federation myfederation (uid = 0xff) reset, filtering = on; does mean, there no (easy) way scale beyond 180 concurrent requests on federation root server? you should @ sql database premium reservations, eliminate connection limit. http://msdn.microsoft.com/en-us/library/windowsazure/dn369873.aspx it in preview currently, doesn't mean can't start developing on it. don't sla in preview, retry block , using multiple instances mitigated.

c# - 51Degrees Memory Consumption -

i'm crossing posting 51degrees forums hasn't gotten traction there. i went ahead , implemented latest nuget package version of 51degrees site manage here @ work. (2.19.1.4) attempting bring in house management of mobile views site (it's done third party). functionality interested in detection. disabled redirect functionality commenting out redirect element in config , modified logging level fatal (the log in app_data folder). to our understanding, changes needed. , worked. switch our layout view between desktop , mobile based on information 51degrees providing. while testing , promoting through dev , qa noted increased memory consumption in app pool, nothing overly worried about. app pool @ standard traffic levels consumes 230 mb of memory in prod. spike 300 mb during peak times, nothing worrisome, considering fair amount of inproc caching. as of sunday promoted 51degreees lite prod, disabled mobile views (we did in qa well). wanted see how perform in prod , kin

linux - Minicom offline when trying to communicate using USB to RS232 cable -

i'm using usb rs232 cable communicate between 2 linux machines. on machine usb side connected, run: dmesg | grep tty and following output: console [tty0] enabled serial8250: ttys0 @ i/o 0x3f8 (irq = 4) 16550a serial8250: ttys1 @ i/o 0x2f8 (irq = 3) 16550a 00:0a: ttys0 @ i/o 0x3f8 (irq = 4) 16550a 00:0b: ttys1 @ i/o 0x2f8 (irq = 3) 16550a usb 2-1.2: pl2303 converter attached ttyusb0 so far good. run minicom -s , using "serial port setup", change "serial device" "/dev/ttyusb0", "bps/par/bits" "115200 8n1", , select "no" "hardware flow control" , "software flow control". i save these settings default, exit minicom, , run minicom again. minicom opens, remains "offline". can't enter commands. other linux machine connected serial port side of wire on , running fine. why can't connect other linux machine? minicom decides offline/online based on whether dcd line conn

joomla - Jooma Custom Component Router.php not being called -

i'm using joomla 3.1. i'm having strange issue router.php file in component. i have basic router.php file, not doing yet, before add features need working on basic stuff first. i have menu item component set item type. viewing homepage shows view created. for links, if use following: echo jroute::_('index.php?option=com_vacations&view=test&cat=123'); i this: http://mysite/en/component/vacations/?view=test&cat=123 i not want "component/vacations" shown however. i've tried this: echo jroute::_('index.php?view=test&cat=123'); and get: http://mysite/en/?view=test&cat=123 seemingly correct, second method never touches router.php. means cannot alter display like: http://mysite/en/test/123 how can fix url parsed through router.php? when use jroute create links application create full query in first code: echo jroute::_('index.php?option=com_vacations&view=test&cat=123'); r

Android ViewPager, first View is not swiping? -

i have viewpager component inside fragmentactivity , filling fragmentstatepageradapter , fragments. the thing works, there 1 thing don't want, maybe it's expected behaviour: the first fragment / view stays static , not move, when swipe next fragment / view. next fragment get's swiped above first one. when swipe first fragment, it's same. first 1 seems sit under other fragments , not move @ all. looks other fragments pulled away blanket above first one... how can have first fragment being moved in , out other fragments? thanks lot! look @ "customize animation pagetransformer" here http://developer.android.com/training/animation/screen-slide.html it explain how make animation between views. , if want default behaviour, remove call setpagetransformer();

Android how to make new Contacts in contacts app opens Activity -

i'm making app sync contacts phone's contact list app. this have: my app has sync adapter. i mannage sync contacts. the contacts there. at end this: screenshot this cool. my problem: i need open app when user clicks on "my app" row. have no idea how this. have 3 days browsing on google , found nothing... this might help: when click on facebook row this: i/activitymanager( 2014): starting: intent { act=android.intent.action.view dat=content://com.android.contacts/data/10940 cmp=com.facebook.katana/.contacturihandler } pid 18506 email row: i/activitymanager( 2014): starting: intent { act=android.intent.action.sendto dat=mailto:yb_test_001%40hotmail.com cmp=com.google.android.gm/.composeactivitygmail } pid 18346 "my app" row: i/activitymanager( 2014): starting: intent { act=android.intent.action.view dat=content://com.android.contacts/data/11653 } pid 18506 e/infinite(18506): contactinfolistadapter: no activity found external

firefox - Selenium can't determine ready state -

i'm running automated test in firefox browser using selenium web driver , testng, i'm encountering error: org.openqa.selenium.internal.seleniumemulation.waitforpagetoload handleselenesecommand warning: cannot determine whether page supports ready state. abandoning wait. this has been occurring, think might have firefox updates. know might causing issue?

ios - Adding subview to superview shared by a container view resizes container view -

i have view controller view has container view subview. set initial frame of container view in ib , later change according if iad loaded in banner. if add subview view controller's view container view's frame gets resized frame set in ib. i have no idea why happening , appreciate help. created test app eliminate of other variables know situation. when you're using auto layout, can't set frames of views load xib or storyboard. auto layout sets frames, , ignores changes make frames. need update constraints on views if need move or resize them directly. you can create outlet pointing nslayoutconstraint in view controller, , connect outlet appropriate constraint in xib or storyboard. can change constraint's constant property change view's position or height.

filesystems - How to find out if a directory exists on Delphi XE2 *correctly*? -

i need check if directory exists! if directory "e:\test" e: cd/dvd drive , there no disk inserted on it, see following delphi , windows issues. the first method: function direxists(name: string): boolean; var code: integer; begin code := getfileattributesw(pchar(name)); result := (code <> -1) , (file_attribute_directory , code <> 0); end; it gives range check error . can't use {$rangechecks off} , {$rangechecks on} blocks because: it breaks current state of $rangechecks option. we see system error drive not ready instead range check error . need check if directory exists without error dialogs user. the second method: if directoryexists(name, true) ... this function returns true non-existing e:\test directory on empty cd/dvd drive. can't use because works incorrectly. but then, how find out if directory exists? p.s. think error exists cd/dvd drive. using windows 7 x64 on vmware fusion 5 under mac os x 10.8.4 external cd/

php - using multiple mysql query loop inside each other -

i have big trouble using multiple queries inside each other. , searched not find needed! problem. plz me. i have table named "cat" , titles mysql , it's ok. have other table named works has field named "cat_id" field connect's data of both tables. works table has field named "years" , it's year of production of artwork. cat >> { id , title , ... } works >> { id , title , url , year , cat_id , ... } i need categorize gallery of works year, made code this: <?php $result = q("cat"); while($row = mysqli_fetch_array($result)) { ?> <div> <h2><a href="artwork.php?id=<?php echo $row['id'] ?>"> <?php echo $row['title']; ?></a></h2> <span> <?php $sql = "select distinct year works cat=".$row['cat_id']; $yresult = mysql_query($sql); while ($yrow = mysql_fetch_row($yresult)) { /

tcl - Adding/subtracting a second to a UTC timestamp -

i have timestamp data in form of "2013-07-31t13:31:29" need add second to. having issue "clock add" plan convert time epoch time , increment it. when trying noticed times don't seem match each-other. timestamp: 2013-07-31t13:31:29 epoch time: 1375252289 gmt: wed, 31 jul 2013 06:31:29 gmt this timestamp generated via tcl code below: # timeminusmilli == 2013-07-31t13:31:29 set epoch [ clock scan $timeminusmilli -gmt 0 ] now, maybe i'm confused, think 2013-07-31t13:31:29 wed, 31 jul 2013 1:31:29, not 6:31:29. the way iso times scanned tcl documented: http://www.tcl.tk/man/tcl8.5/tclcmd/clock.htm#m83 an iso 8601 point-in-time specification, such “ ccyymmdd t hhmmss ,” t literal “t”, “ ccyymmdd hhmmss ”, or “ ccyymmdd t hh:mm:ss ”. note these 3 formats accepted. command not accept full range of point-in-time specifications specified in iso8601. other formats can recognized giving explicit -format option clock scan command. so, either

Array value find using index partial string using PHP -

i having below array. value having '1' , key should 'wf_status_step%'. how write php script this? [ini_desc] => 31.07 initiative1 [mea_id] => 1 [status] => 4 [name] => 31.07 measure1 [scope] => npr [sector] => [mea_commodity] => 8463 [commodity_cls] => [delegate_usrid] => 877 [wf_status_step1] => 2 [wf_status_step2] => 1 [wf_status_step3] => 0 [wf_status_step4] => 0 [wf_status_step5] => 0 you can iterate on keys in array find keys match pattern, , simulatenously check associated values. this: <?php $found_key = null; foreach(array_keys($my_array) $key) { if(strpos($key, "wf_status_step") === 0) { //key matches, test value. if($my_array[$key] == 1) { $found_key = $key; break; } } } if( !is_null($found_key) ) { //$found_key 1 you're looking } else { //not found. } ?> if want more sophisticated matching key, can use regular expre

jquery - Trouble adding double the divs i already have -

okay creating game fun. game involves 5 second timer , divs shapped boxes. first round start off 1 div purpose click on div before timer runs out. if pass go next level adds double boxes level 2 have 2 boxes level 3 4 boxes , on. having trouble creating double length of div. dont have code because nothing ive tried has worked. here jsfiddle: http://jsfiddle.net/jzdkq/ <!doctype html> <html> <head> <title>jquery project: exploding game</title> <meta charset="utf-8"> <style> body, html { width: 960; height: 500%; } div.box { position: relative; width: 100px; height: 100px; background-color: orange; } div.exploding { position: absolute; width: 100px; height: 100px; background-color: red; } </style> </head> <body> </body> </html> your javascript... settimeout(function(){$("body").append("<div class='box'></div>").length() *2;}, 5000); is saying...

What best way to populate java list with separate elements and elements from other lists? -

i need create linked list , populate "containers" , "elements" containers. this code: public list<webelement> getexpectedelements(){ list<webelement> list = new linkedlist<webelement>(arrays.aslist( inetconnection, wiredconnection, phonesconnection, usbconnection, wificonnection )); list.addall(inetconnection.getexpectedelements()); list.addall(wiredconnection.getexpectedelements()); list.addall(phonesconnection.getexpectedelements()); list.addall(usbconnection.getexpectedelements()); list.addall(wificonnection.getexpectedelements()); return list; } is there way in java make nicer (more laconic, dry, etc.) ? you @ least introduce loop: list<webelement> containers = arrays.aslist(inetconnection, wiredconnection, phonesconnection, usbconnection, wificonnection); list<webelement> list = new linked

access token - Google OAuth 2.0 returns invalid redirect_uri_mismatch when getting access_token -

i trying exchange oauth one-time use code got client-side app access token , refresh token on server. response is: { "error" : "redirect_uri_mismatch" } my post request is: post /o/oauth2/token http/1.1 host: accounts.google.com content-type: application/x-www-form-urlencoded code={my code}& client_id={my client id}& client_secret={my client secret}& grant_type=authorization_code i have checked client id , client secret against in api console , match. i one-time use code on client following java code: static final list<string> scopes = arrays.aslist(new string[]{"https://www.googleapis.com/auth/plus.login","https://www.googleapis.com/auth/userinfo.email"}); string scope = string.format("oauth2:server:client_id:%s:api_scope:%s", server_client_id, textutils.join(" ", scopes)); final string token = googleauthutil.gettoken(c, email, scope); i have redirect_uri in api console, since trying

c# - Hide Windows Forms ListView Column in Details View without deleting Column or resizing it to Zero -

Image
i have in c# net 2.0 windows forms listview ten columns filled data @ startup of application. data huge, cannot reloaded fast in-between. listview has details view on , allows user resizing of each column separately. the user shall able hide of ten columns or multiple of them @ once , unhide columns again time in non-specific row. data shall not deleted while hiding column. following things have tried result not satisfying: 1) resizing column size 0 make disappearing until user starts play columns. user accidently resize them because in listview there option allowed user resize each column manually. 2) deleting column out occurs following problem: when try add column back, column doesn't remember position , size. position main problem, i'll try explain why. if user decides first hide "column 2" , "column 3" , user later unhides 3 before 2, "index 2" doesn't exist, cannot insert @ index no. 3 , exception rises. if remember index posi

java - Libgdx - Box2D: Attach Physics Body Editor Loader mask to dynamic texture -

i have texture of circle, gets drawn new position when touch drag occurs. isn’t set body. i have made physics map using aurelien ribon's physics body editor loader gui circle's upper , lower part, , i’d draw mask on texture’s position, , new position when drag occurs. how can this? in create method initialize variables, mask gets drawn texture’s initial position, when move mask stays @ circle’s initial position. here's code: create() method: //... rest of method ommited clarity karika = gameworld.getkarika(); world world = new world(new vector2(0, 0), false); box2ddebugrenderer renderer = new box2ddebugrenderer(); bodyeditorloader karikaloader = new bodyeditorloader(gdx.files.internal("data/collision-masks/karika.json")); bodydef karikadef = new bodydef(); karikadef.type = bodytype.dynamicbody; karikadef.position.set(karika.getposition().x, karika.getposition().y); karikadef.angle = karika.getrotation(); body k

regex - Perl match in context -

i find word in text file, , save variable along characters. example in text file like: isoelectric point = 6.2505 i'll looping through directory of files, value of isoelectric point change, , why need characters after match saved variable. if (my ($point) = $str =~ /isoelectric point = (\s+)/) { ... }

How to avoid adapting to zooming in responsive design? -

i’m not english speaker , try explain problem in better way can. i’m designing first responsive website using css. until things going slow fine. my first test page responding correctly in widths of desktop browsers, including narrowing them until smaller width. after tests loaded page in nokia 5800 smartphone uses symbian. my main problem following: the test page loaded correctly in nokia 5800 smartphone , when rotate phone, page adapts internal elements new width. it ok, but… when zoom page (double clicking on screen), page zoomed , browser narrows again internal elements new more narrow width , dont want page responsive in zoom (for example: when page loaded @ 320px width resolution) want elements zoomed when zoom page. explaining correctly? page appears responsive!!!!! :) or thing not working fine. in other words…. page adapts divs (etc) @ more narrow width on desktop browsers, problem when zoom in smaller screens (smartphone), because elements additionally narrowed

c# - How do I get SimpleMembershipProvider extended properties back from database like FirstName and LastName? -

following post, simplemembershipprovider, using multiple propertyvalues custom database tables , create new user using simplemembershipprovider , webmatrix.webdata.websecurity. websecurity.createuserandaccount(model.username, model.password,new { firstname = model.firstname,lastname = model.lastname,appid = guid.newguid(), memberid = model.memberid}); however, have not been able find built-in methods retrieving information membershipprovider or websecurity methods. know query database directly information , update, code become tightly coupled test implementation. anyone know how extended properties logged in user in simplemembershipprovider? thanks. sbirthare right, however, since doesn't explain how this, allow me (this assuming use c# server-side language option, tagged, believe do. assumes table name in "firstname" , "lastname" columns belong is, in fact, "userprofile"): since webmatrix comes sql server-ce, can use simple sql q

How can I avoid having too many arguments in Spring Java controllor -

in spring web application: @requestmapping(value = new) public string addproduct(@requestparam string name, @requestparam(required = false) string description, @requestparam string price, @requestparam string company, modelmap model, @requestparam(required = false) string volume, @requestparam(required = false) string weight) { try { productmanagementservice.addnewproduct(name, description, company, price, volume, weight); model.addattribute("confirm", product_added); return form_page; } catch (numberformatexception e) { logger.log(level.severe, invalid_value); model.addattribute("error", invalid_value); return form_page; } catch (invaliduserinputexception e) { logger.log(level.severe, e.getmessage()); model.addattribute("error", e.getmessage()); return form_page; } } what possible ways reduce/bind total numb

javascript - AJAX call not working in jQGrid -

i trying ajax call inside beforeselectrow event of grid : beforeselectrow: function(rowid, e) { $.ajax({ url: "gridedit.jsp", datatype: "json", async: true, cache: false, type:"get", data: { before:'row', }, success: function(data, status) { alert(data); } }); return true; } here gridedit.jsp : <% string b=request.getparameter("before"); if(b.equalsignorecase("row")) { system.out.println("row row row boat"); out.println("bummer"); } %> i dont error messages. want access data sent gridedit.jsp thats why trying pop alert see whether data being passed or not. when check apache tomcat logs, "row r

Unnable to send data from android application to PHP webpage (error:Unfortunately application stopped working) -

hello want post string android application website in php using httppost application lay out consists of text box , send button .when click on send button application crashes message unfortunately application stopped working.can body please provide how solve problem. the mainactivity.java file package com.example.test5; import java.io.ioexception; import java.io.unsupportedencodingexception; import java.util.arraylist; import java.util.list; import org.apache.http.namevaluepair; import org.apache.http.client.clientprotocolexception; import org.apache.http.client.httpclient; import org.apache.http.client.entity.urlencodedformentity; import org.apache.http.client.methods.httppost; import org.apache.http.impl.client.defaulthttpclient; import org.apache.http.message.basicnamevaluepair; import com.example.test5.r; import android.os.bundle; import android.app.activity; import android.view.menu; import android.view.

xamarin.android - selector state_enabled=false not working -

i have simple selector textview: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_enabled="false" android:state_pressed="false" android:drawable="@color/darkgray" /> <item android:state_pressed="true" android:state_enabled="true" android:drawable="@color/background_red_down" /> <item android:drawable="@color/background_red" /> i using mvvmcross textview enabled property binded property: <textview local:mvxbind="click recomenddishviewmodel.sendcommand; enabled recomenddishviewmodel.issendpostenabled" android:text="@string/sendlabel" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/sendbutton" android:textsize="

c++ - Apache Thrift over the Internet -

i interested in using apache thrift implement communication protocol between client , c++ device. ran through documentation noticed possible usind thrift in local network. question is, possible use thrift control devices outside local network, i.e. internet? how work? regards if using socket or http transport, you're on right way. technically, typical client/server scenario, there no difference between internal , external network. bidi-communication scenarios presence of firewalls may make things little more complicated.

html5 - Calculate compass heading from DeviceOrientation Event API -

for augmented reality web app smartphones i'm trying calculate compass heading when user holding device in hand, screen in vertical plane , top of screen pointing upwards. i have taken suggested formula http://dev.w3.org/geo/api/spec-source-orientation (see worked example) , implemented following function: function compassheading(alpha, beta, gamma) { var a1, a2, b1, b2; if ( beta !== 0 || gamma !== 0 ) { a1 = -math.cos(alpha) * math.sin(gamma); a2 = math.sin(alpha) * math.sin(beta) * math.cos(gamma); b1 = -math.sin(alpha) * math.sin(gamma); b2 = math.cos(alpha) * math.sin(beta) * math.cos(gamma); return math.atan((a1 - a2) / (b1 + b2)).todeg(); } else { return 0; } } while .todeg() number object extension courtesy http://www.movable-type.co.uk/scripts/latlong.html /** converts radians numeric (signed) degrees */ if (typeof number.prototype.todeg == 'undefined') { number.prototype.todeg = f

c# - Checking for null returned items -

currently returning list of items have date range. of appointments have expired , others have not happened yet. displaying appointments have not expired yet. want check if appoinments have expired show first item. var curapt = myappts.where(d => d.appt.endtime > datetime.utcnow).first(); if myappts.where(d => d.appt.endtime > datetime.utcnow) == null var curapt = myappts.first(); how can structure consider both cases? firstordefault , null coalescing operator ( ?? ) : var curapt = myappts.firstordefault(d => d.appt.endtime > datetime.utcnow) ?? myappts.first(); however, make less exception prone if have default value show if there no appointments @ all, chain null coalescing operator that: var curapt = myappts.firstordefault(d => d.appt.endtime > datetime.utcnow) ?? myappts.firstordefault() ?? yourdefault;

qt - Qt5 programs won't compile -

i'm trying qt5 working on ubuntu 12.04. downloaded 32-bit installer http://qt-project.org/downloads , let install in home folder. i had add ~/qt/5.1.0/gcc/bin path qmake work, when try make hello qt example (using qt4 book), when running make, cannot find qapplication or qlabel header. when replace them qtwidgets/qapplication , finds header, undefined references when linking. this command make executes: g++ -c -pipe -o2 -wall -w -d_reentrant -fpie -dqt_no_debug -dqt_gui_lib -dqt_core_lib -i../../../../qt/5.1.0/gcc/mkspecs/linux-g++ -i. -i. -i../../../../qt/5.1.0/gcc/include -i../../../../qt/5.1.0/gcc/include/qtgui -i../../../../qt/5.1.0/gcc/include/qtcore -i. -o hello.o hello.c i managed figure out it's qmake -project doing wrong. when make app in qt creator (which works), .pro file has lines qt += widgets , not there when run on command line. i found answer using qmake --help . says: note: created .pro file need edited. example

wcf - Injecting dependencies into an IErrorHandler implementation -

i implementing ierrorhandler in order centralize of error handling wcf service in 1 place. works well: public class serviceerrorhandler : ierrorhandler { public bool handleerror(exception error) { // ..log.. } public void providefault(exception error, messageversion version, ref message fault) { // ..provide fault.. } } now, we're using ninject inject dependencies in rest of service, , i'd same here. since wcf constructing objects based on configuration, , don't think have hooks process, need use property injection: [inject] public iloggingservice logger { get; set; } however, never seems injected. tried using ninject's mvc extensions set serviceerrorhandler allow injection filter, didn't seem trick. there way make happen? late answer, can inject dependencies ierrorhandler creating custom servicehost , let's testservicehost . in testservicehost need do: implement constructor ier

How do I overwrite a CSS property for iPad only? -

code: .container { width: 960px; max-width: 100%; min-width: 960px; height: 500px; background-color: #fff; border: 1px solid #000; } @media screen , (min-device-width : 768px) , (max-device-width : 1024px) , (orientation : portrait) { .container { width: 960px; max-width: 100%; height: 500px; background-color: #fff; border: 1px solid #000; } by default container has min-width of 960px using responsive design , ipad smalelr 960px width. using code above thought if it's ipad, not pickup min-width: 960px; is. what can min-width shows on non-ipad css , on ipad css doesn't min-width? just add min-width: 0 (or 704px if necessary) media query: @media screen , (min-device-width : 768px) , (max-device-width : 1024px) , (orientation : portrait) { .container { min-width: 0; } } think of media queries css declarations of general stylesheet need override, don't re-write decl

Python web framework for I/O intensive page -

i have i/o intensive task (it crawls webpages). want make task available via web api , built javascript+html interface on top of it. , want in python, since have set of python scripts implementing task. now i'm looking python web framework this. what web framework can recommend i/o intensive web page? some more details: i worked flask , liked it i don't need user management, need sessions i want build actual ui angular/ember since it's web crawling, i'd go scrapy crawling tool , twisted event-driven networking engine/web-framework. scrapy built on top of twisted, set might choice you. also, take @ tornado web framework using non-blocking i/o. hope helps.

When editing a grid, how do I disable specific fields by row? Kendo UI ASP.Net MVC wrapper -

i have kendo grid using asp.net mvc wrappers , has multiple columns (say col 1 , 2). grid set incell editing mode. columns 1, 2 need able edited (or preventing editing) based off values of each other specific row. for instance, if column 1 value true column 2 allowed edited. if column 2 value false, column 2 not allowed edited. any ideas? i found similar example using client side extensions. when editing grid, how disable specific fields row? is there similar way using asp.net mvc wrappers? we ran across similar issue , found following solution. might not right way it, seems work disabling field when row existing , enabling when new. logic should able swapped logic need. in kendo mvc bindings. "disableonedit" name of javascript function call when cell goes edit mode. @(html.kendo().grid<yourmodel>() .name("grid") ... .events(events => events.edit("disableonedit")) ... in javascript: function disableonedit(e) {