Posts

shell - In unix, how can I pipe the output of who into the groups command? -

i'm trying this: say there 4 users logged unix machine, a, b, c, , d. now, groups these guys belong to, have type out : groups b c d. what wondering, if there way who | groups can pipe users logged-in groups command, print out users given along group information. however, not seem work intended - rather, above command gives group first user belongs to. in bash, zsh, , others: groups $(who | cut -d' ' -f 1)

iphone code not firing -

i have class im using , cant code fire weatherserver.m ---------------------- - (nsarray *)weatheritemsformapregion:(mkcoordinateregion)region maximumcount:(nsinteger)maxcount { //code not firing } myviewcontroller.h ----------------------- @class weatherserver; @interface mapview : uiviewcontroller <mkmapviewdelegate, uitextfielddelegate, cllocationmanagerdelegate, adbannerviewdelegate> { weatherserver *weatherserver; } @property(nonatomic, retain) iboutlet weatherserver *weatherserver; @end myviewcontroller.m ---------------------- #import "weatherserver.h" @implementation mapview @synthesize weatherserver; - (void)mapview:(mkmapview *)map regiondidchangeanimated:(bool)animated { nsarray *weatheritems = [weatherserver weatheritemsformapregion:mapview.region maximumcount:300]; [mapview addannotations:weatheritems]; } @end regiondidchangeanimated fires ok however, code in weatheritemsformapregion never gets fired. i figured out go...

mysql - DB Design - Contextual constraints -

i have pair of tables parent-child relationship. domain: id int not null auto_increment primary_key domain varchar(100) not null domain_url: id int not null auto_increment primary key domain_id int not null path varchar(512) here want keep path unique in 1 domain. across domain path can duplicating. best constraint apply on path. should focus on composite key between domain_id , path. composite key reliable solution? i think want apply unique constraint in domain_url table on domain_id, path composite key. enforce requirement "to keep path unique in 1 domain"

c# - creating a web service with paging -

i creating web service in asp.net 2.0 c# , have web method looks this: [webmethod()] public list<comment> getyoursaycomments(int pagenumber, int pagesize, int commenttopicid) { commentmanager cm = new commentmanager(); return cm.getyoursaycomments(pagenumber, pagesize, commenttopicid, true); } this working greate services returned entities, method returns paged results. best way return total row count client? you have create custom type include count: public class envelopewithcount<t> { public t value { get; set; } public int rowcount { get; set; } } and web service return new type: [webmethod] public envelopewithcount<list<comment>> getyoursaycomments(int pagenumber, int pagesize, int commenttopicid) { commentmanager cm = new commentmanager(); envelope<list<comment>...

.net - Requirements for collection class to be used with LINQ -

i thought enough requirement class should satisfy able use where() implement ienumerable . but today friend of mine asked me question, why cannot apply where() object of spusercollection class (it sharepoint). since class derived spbasecollection implements ienumerable - expected should fine. not. any ideas, why? the linq extension methods defined on ienumerable<t> , not ienumerable . example, see where<t> signature: public static ienumerable<tsource> where<tsource>( ienumerable<tsource> source, func<tsource, bool> predicate ) to mitigate issue, linq cast<t> extension method turns ienumerable ienumerable<t> can used normal linq functions. in example below, can't e.where(...) , can cast , use where . int[] xs = new[] { 1, 2, 3, 4 }; ienumerable e = xs; var odds = e.cast<int>().where(x => x % 2 == 1); unfortunately, needs used lot when dealing pre-generics apis in .net bcl.

Multiple types in one specialized D template -

say have deal ushort , uint way, string differently. guess need 1 specialized template string , other both ushort , uint . it? // void func(t)(t var) { ... } // uint , ushort void func(t: uint, ushort)(t var) { ... } that idea, although code can't compile. it's valid or bad? try this: void func(t)(t var) if ( is(t : uint) || is(t : ushort) ) { ... } void func(t : string)(t var) { ... } you in 1 function: void func(t)(t var) { static if ( is(t : uint) || is(t : ushort) ) { ... } else if ( is(t : string) ) { ... } else { // handle else } }

regex - Date format in php using regular expression -

hai, can me change "wed sep 29 14:47:37 +0000 2010" "sep 29,2010 @ 2:47pm" using regular expression in php? you can use strtotime . no need regular expression. date('m j, y \a\t g:i a', strtotime('wed sep 29 14:47:37 +0000 2010'));