Posts

c# - Finding or creating an object in Entity Framework -

my domain model , associations follows: customer has many region s region has many location s our client supplies csv file has following columns: customer name region name location name latitude longitude ... based on information, have find or create customer name, find or create region name, , find or update location name. i have tried following: var customer = c in _data.customer c.name == cells[0] select c; if (customer == null) customer = new customer(...); i follow same pattern finding or creating/updating region , location, however, problem run type of linq query cannot converted customer -object on line customer = new customers(); . need reference customer object later can't have 2 separate variables. how accomplish in entity framework? this code var customer = c in _data.customer c.name == cells[0] select c; returns customers has name equals cells[0] return type...

java - Can DailyRollingFileAppender roll logs at midnight instead of at next message? -

i using log4j logging. have jetty based module. need daily logging used dailyrollingfileappender. thing need log file roll on 12:00 a.m, @ moment wait new request before rolling, there way "force" rolling process? i doubt it. logging service have spawn thread waits day or depend on sort of timer service. loggers try hard not have dependencies or consume resources. can app log message every day trigger rollover? sure want 0 length log files days no messages? otherwise, need subclass appender.

uitableview - iOS 5.1 Drag&Drop from text view to table view -

i've developing ipad app , have been wondering if it's possible select text text view , drag , dropping paste uitableview. if can tell bit can start working on it? one way might work use touch events , detect when dragging textview , if so, put text inside textview private property , detect when dragging ends , see if in area of tableview (you need know boundaries of tableview (cgrect). if in area, add text whatever datasource have populates tableview , reload tableview. this take lots of trial , error make sure touch locations right.

html - Form does not submit if action present -

a few days ago set small development server. running on windows vista business , latest wamp. today wrote simple script test something, , when hit submit button, nothing happens. doesn't submit same page, doesn't give me 404 not found (which should). nothing. page doesn't flicker: <form method='post' action='controller.php'> <input type='hidden' name='test' value='test' /> <input type='submit' /> </form> nothing! however, if remove action, follows, page submits , probe of global $_post variable shows hidden value passed. <form method='post'> even following works: <form method='post' action=''> is there i've missed in apache setup?? solved! through trial , error got point happened in chrome. turned out malformed 'base' tag in . didn't affect other browser! thanks everyone's input.

c# - Repository NInject linq exception: different context exception on same context -

i working mvc , repository approach, using ninject inrequestscope(). using ef have 1 edmx file contains tables. testing functions through test project , running fine. when running site (and using ninject) exception: the specified linq expression contains references queries associated different contexts i assume because each time call db dbcontext getting created , destroyed right away, ef thinks have 2 different context. how can solve this?

salesforce - How do I get my Customer Portal to auto-adjust its component's size? -

Image
i have few html home page custom components titled custom_news, custom_articles, , custom_cases. here's html them: <iframe src="/apex/newspage?id=a1tw0000000ejal" frameborder="0" width="100%"></iframe>&nbsp; <iframe src="/apex/custom_home" frameborder="0" width="100%"></iframe>&nbsp; <iframe src="/apex/casespage" width="100%" frameborder="0"></iframe>&nbsp; this customer portal home page layout looks like: and custom components when login customer portal: how rid of scroll bars? want customer portal auto adjust size of components none of components have scroll bars. how do this? you try modifying height of iframes dynamically javascript. answer explains how accomplish this. here's example using javascript provided : <script language="javascript"> <!-- function autoresize(id){ var new...

java - Facebook extended permission grant by user -

how know if user has granted extended permission requested application. use java @ end, , login , facebook registration handled socialauth api. want publish feed user's timeline. javascript unable hit url because doesn't have access token facebook communication. can thing done without using client facebook java api? get /me/permissions graph api, in ever way like.