Posts

c# - Linq join query displayed in MVC view -

i'm trying display linq join query in partial web view. here query within controller: public actionresult inactiveusers() { using (modelcontainer ctn = new modelcontainer()) { datetime duration = datetime.now.adddays(-3); var inactive = usrs in ctn.aspnet_users usrs.lastactivitydate <= duration join o in ctn.groups on usrs.userid equals o.userid select new { usrs.username, usrs.lastactivitydate, o.primaryphonenumber, }; return view(inactive.tolist()); } } what i'm bit confused on next. i'm familiar adding typed views using models, happens in case have join query? if point ...

c# - linq to sql Distinct and orderby -

var result = table1.join(table2, o => o.programid, t => t.programid, (o, t) => new { o.programid, t.program }) .orderby(t => t.program) .distinct(); the above linq statement returns correct result, sql generated (below) not simple be select [t2].[programid], [t2].[program] ( select distinct [t0].[programid], [t1].[program] [table1] [t0] inner join [table2] [t1] on [t0].[programid] = [t1].[programid] ) [t2] order [t2].[program] i have thought sql below far cleaner i'm not sure of linq statement achieve it. select distinct o.programid, t.program table1 0 inner join table2 t on t.programid = o.programid order t.program thanks in advance i don't know if help, can try this; var result = (from o in table1 join t in table2 on o.programid equals t.programid orderby t.program select new { o.programid, t.program }).distinct();

linux - PHP and the build process (/.configure, make and install): orientation, please -

i'm newbie , after i've learnt enough build simple useful web services, managed put myself in position need configure own php build. the problem don't know build means --never built either. my broad question is: step step tutorial doesn't "must have dependencies"? my specific question is: instance, 1 shows how build php odbc, rebuild (configure.nice , make nice?) imap in addition. if finds php bundle comes odbc, great; odbc & imap, better. i'm looking show me how fish. please. thnx. a. gazler correct, simple setup, can configure ubuntu through repositories via apt-get. rhel-based systems - yum equivalent. however, if wanting know more of how compile scratch (which give more control on installation), can so. basics of compiling application: download source website (such php, www.php.net) untar source ( tar -xzvf source.tar.gz ) cd source configure source ( ./configure [install-option-flags] ) compile source ( make ) te...

visual studio - LINQ to XSD in VS 2010 -

Image
how use linq xsd in vs2010. last know install linqtoxsd in vs2008 . there updated in vs2010?. the current version 2.x .net 4.0 there samples , docs if download source.

git filter branch - How to detach subdirectory in Git but keep all branches -

i have been following answers question detach subdirectory separate git repository , had successes simple subdirectories on 1 branch confronted subdirectory littered on multiple branches simple git filter-branch --subdirectory-filter subdirectory head does not job. do have switch each , every branch , run filter-branch command or there can blanked change through complete history ? the head @ end of command specifying ref process. can give number of other commands, including --all specify absolutely everything, --branches specify branches, or --remotes specify remotes. may have prefix these options -- tell filter-branch these rev-list args. note --all try process tags explicitly, may not want. use --branches --remotes specify non-tag refs instead. may want add --tag-name-filter cat rewrite tags point rewritten commits - original command leave tags unchanged.

iphone - How to set VoIP mode on a socket in iOS 4 -

i'm trying set socket in voip mode on iphone, app can woken when event happens. have simple server write socket if , if app should wake , talk main web service something. calling cfreadstreamsetproperty() on stream attached socket seems return zero, if i'm not mistaken false, meaning stream did not recognize and/or accept property value. read in previous question facility not available on simulator, tried on real phone, same result. how can figure out why call failing? the code below: - (id) init { nslog(@"notificationclient init, host = %@", [self getnotificationhostname]); cfhostref notificationhost = cfhostcreatewithname(kcfallocatordefault, (cfstringref)[self getnotificationhostname]); cfstreamcreatepairwithsockettocfhost(kcfallocatordefault, notificationhost, [self getnotificationport], &_fromserver, &_toserver); bool status; status = cfreadstreamopen(_fromserver); status = cfreadstreamsetproperty(_fromserver,...

wolfram mathematica - Combinations with repetition -

i'm using mathematica 7 , combinatorica package function can combinations of number list of elements order doesn't matter , there no repetition.e.g: in: ksubsets[{a, b, c, d}, 3] out: {{a, b, c}, {a, b, d}, {a, c, d}, {b, c, d}} i cannot find function give me combinations of number list of elements order doesn't matter , there is repetition. i.e. above example include elements {a,a,b},{a,a,a},{b,b,b}...etc in output. it may require custom function. if can come 1 post answer don't see obvious solution. edit: ideally output not contain duplication of combination e.g. tuples[{a, b, c, d}, 3] return list contains 2 elements {a,a,b} , {b,a,a} combinations point of view same. deleteduplicates[map[sort, tuples[{a, b, c, d}, 3]]]