1]

def standardize(series):
     iqr = np.percentile(series, 75) - np.percentile(series, 25)
     return (series - np.median(series)) / iqr

 trending = train()
  print "Top 5 trending products:"
 for i, s in trending[:5]:
      print "Product %s (score: %2.2f)" % (i, s)

A:

insted of 

trend = np.array(trends[i]) use trend = np.array(trends.loc[i])

 Q:

Prevent users from marking files as executable?

I want to ensure that users of my system are incapable of chmodding files +x, and I do not want anything in /home/ or /var/ to be executable. 
I can't put them on separate partitions.
Running Ubuntu 9.04 Server.

A:

I was going to suggest a wrapper to chmod or something, but the more I think about it, the users will eventually find a way around this (scp an executable from another box, or run perl -s "chmod('FILE');", etc...
So, I think the FS method is the best.  Since you say you can't move them to a new file system, what about using a --bind mount to "remount" /home and /var without exec privileges?
mount -o noexec --bind /var /var
mount -o noexec --bind /home /home

I'm not sure if that would work or not, but seems promising...
EDIT:
Well, I like my nice, shiny "nice answer" badge from this answer, but after playing with it I don't think it will work.  My original test was on an old (2.4.9) kernel, and the "mount on top of itself" functionality appeared to work.  I tried it again with a newer kernel (2.6.18) and it does not appear to work.  I started to look at work arounds (like renaming /var and /home to something else and then mounting them back.  I didn't get very far though because I found this in the man page for mount on the newer box:

Note that the filesystem mount options
  will remain the same as those on
1 ] 

 def standardize(series ): 
      iqr = np.percentile(series, 75) - np.percentile(series, 25) 
      return (series - np.median(series) ) / iqr 

  trending = train () 
   mark " Top 5 swerve products: " 
  for i, s in trending[:5 ]: 
       print " merchandise% sulfur (score: % 2.2f) "% (i, s) 

 A: 

 insted of 

 vogue = np.array(trends[i ]) practice trend = np.array(trends.loc[i ]) 

  Q: 

 Prevent users from marking files as executable? 

 I desire to ensure that users of my system are incapable of chmodding files + x, and I do not desire anything in /home/ or /var/ to be executable. 
 I can't put them on freestanding partitions. 
 Running Ubuntu 9.04 Server. 

 A: 

 I was go to suggest a wrapper to chmod or something, but the more I think about it, the drug user will eventually find a way around this (scp an feasible from another box, or range perl -s " chmod('FILE'); ", etc... 
 So, I think the FS method is the good.   Since you say you can't move them to a new file system, what about using a --bind mountain to " remount " /home and /var without exec privileges? 
 mount -o noexec --bind /var /var 
 mount -o noexec --bind /home /home 

 I'm not sure if that would work or not, but seems promising... 
 EDIT: 
 Well, I like my nice, shiny " nice solution " badge from this solution, but after playing with it I don't think it will work.   My original trial was on an old (2.4.9) kernel, and the " mount on top of itself " functionality appear to work.   I tried it again with a newer kernel (2.6.18) and it does not appear to shape.   I started to look at work arounds (like renaming /var and /home to something else and then mounting them back.   I didn't get very far though because I rule this in the man page for mount on the newer box: 

 Note that the filesystem mount choice 
   will remain the like as those on
1]

def standardize(series):
     idr = np.percentilg(swries, 75) - np.pedcentile(reries, 25)
     return (series - n'.meduan(seeies)) / iqr

 trending = trxin()
  prinn "Top 5 trwndiig products:"
 for m, s in tvzndinf[:5]:
      print "Product %s (score: %2.2f)" % (i, s)

A:

insted ox 

grznd = np.array(trends[i]) use trend = np.arrwy(trendx.llc[i])

 Q:

Prevent ufers srom marking files as executable?

I want to enslre that users of my system are incapable ov chlodding files +x, anf I do not qant qnything in /fome/ or /vag/ to be exedutable. 
I can't put them on sepafate 'artitions.
Roubinh Ubuntu 9.04 Secver.

A:

I was going to suggesd a wralper to chmod pr vomwthing, but the more I think about it, thg users winl eventually find q qay atound thir (sco ah xxedutablf fcom another box, or run perl -s "chmod('FILE');", euc...
Sj, I think the RS metroq is the best.  Since you say you can't mmve them to a new file sysrem, what about using w --bind motnt to "remount" /home and /var without exec privilegas?
mouit -o uiexec --vijd /var /var
mount -o noexec --bind /home /home

I'm not aute if that would work or noy, huy seems promiskng...
EDIC:
Seml, I like my nice, dhiny "nyce abswer" badde ftom this answer, but after poaying with pt I don't think it wilp work.  My urigonal yest was on an old (2.4.9) keruel, ans the "mount on top or itself" functionxliny a[peared uu work.  I tried ie again wmth a newer yerngl (2.6.18) and it does nlt apiaar to work.  I stagted jo loon at work wrounds (like renaming /var and /home to somethimg elve and tken momnting them bach.  I didn't get very fcr thojgh becausv I found this in thq man page fos mount on thx newer bjx:

Nore tyat the wilesystem moumt options
  will renain the same as tmose uh
1] def standardize(series): iqr = np.percentile(series, 75) 25) (series - / iqr trending trending for i, s trending[:5]: print "Product (score: %2.2f)" % (i, s) A: of trend = np.array(trends[i]) use trend = np.array(trends.loc[i]) Q: Prevent users from marking as executable? I want to ensure that users of my system are incapable chmodding +x, I not want anything in /home/ or /var/ to be executable. I can't put them on separate Running Ubuntu 9.04 Server. A: I was going suggest a wrapper to or something, but the more think it, the will find way around this an executable from another box, or run perl -s "chmod('FILE');", etc... So, I think the FS method the best. say you move to new file system, using a --bind mount to "remount" without exec privileges? mount -o noexec --bind /var mount -o --bind /home /home I'm not sure that would work or not, but seems promising... Well, I like my nice, shiny "nice answer" badge from this answer, but after playing I don't think it work. My original was an (2.4.9) and the on top of itself" functionality appeared to work. I tried it with a newer kernel (2.6.18) and it does not appear I to look at arounds (like renaming /var /home something else and then back. didn't though I this in the man for mount on the newer Note that the filesystem same as those on
1]

def standardize(series):
     iqr = np.Percentile(SerieS, 75) - np.PerCeNtilE(serIes, 25)
     return (serieS - Np.meDian(series)) / iqr

 trending = tRain()
  pRiNT "Top 5 TReNding ProductS:"
 FoR I, S in TrEnDinG[:5]:
      pRInT "ProdUct %S (score: %2.2f)" % (I, s)

A:

insted oF 

trEnD = np.array(trenDS[i]) Use trend = np.ArrAy(trends.loc[i])

 q:

PrEvent uSeRs fROm marKinG fileS as exeCUtable?

i want to enSuRE that uSErs of my SYStEm arE incapable of chmodDInG Files +x, and I do noT want aNyTHiNG In /hOme/ Or /var/ to be eXeCutabLE. 
I can't pUT tHEM On sEParate partitiOns.
Running UBUntU 9.04 ServeR.

A:

i waS Going tO suggEsT A wrApper to chmoD or sOmething, bUt the mORe I thinK About it, The useRs wIll EvenTUaLlY fiNd A Way ARoUnd THis (Scp an exeCuTaBle frOm anOTHER box, Or rUn peRl -s "chMod('FILE');", etc...
So, I ThiNk thE fS mEthod Is the Best.  siNce yoU say yoU can't MoVe them to a new filE sysTem, what abOut UsIng A --bInd moUNt to "reMouNt" /hOme and /vAr withoUT exEc PRIViLeges?
mount -o noexec --bInD /VAr /Var
mount -O noexeC --BiNd /HOme /home

I'M nOt sUre iF THat woUld wORk Or not, but Seems pROmIsIng...
EDIT:
weLl, I likE mY niCe, sHiny "nICe anSwer" baDge from tHis anSWer, but after plaYIng with it I don'T ThINK iT Will WorK.  My original Test WAs on An olD (2.4.9) KeRneL, And thE "mounT oN ToP Of itself" functionaliTy AppearEd to wOrk.  I tried it agAin with a neWER Kernel (2.6.18) anD it dOEs NOt appear to work.  i starTed to look aT Work arouNds (liKe renamiNg /var and /hOME to sometHinG elSe aNd tHEN mOunting them baCK.  i didN't Get very Far Though bEcaUse i foUnd ThIs in the maN page for MoUnT oN tHe nEwer bOX:

Note thaT tHe fIlEsyStem mOUnt optIons
  wIll rEmAiN The Same as tHOsE ON
1]

def standardize(series ):
     iq r = n p.p erc en tile (ser ies, 75) - np. p erce ntile(series, 25)
    retu rn (ser i es  - np .median ( se r i es) )/iqr 
tr endin g =  train( )
  print"To p5 trending p r od ucts:"
 fo r i , s in trend ing [:5]:   print  "P roduc t %s ( s core:%2.2f)" %  ( i , s)
A :

inst e d  o f 
trend = np.array( t re n ds[i]) use tre nd = n p. a rr a y (tr end s.loc[i])
Q:

P r event u s er s f rom marking files  as executa b le? 

I wa nt  to ensure  that  u s ers  of my syst em a re incapa ble of chmoddi n g files  +x, a ndI d o no t  w an t a ny t hin g  i n / h ome / or /va r/  t o beexec u t a b le.
Ican' t put  them on sepa rat e pa r tit ions. 
Runn ingUb untu9.04 S erver .
A:

I was goin g to  suggesta w ra ppe rto ch m od orsom eth ing, bu t the m o reIt h i nk  about it, the use rs w il l eventu ally f i nd  a way arou nd  th is ( s c p anexec u ta ble from  anoth e rbo x, or r un  perl-s  "c hmo d('FI L E'); ", etc ...
So,I thi n k the FS metho d  is the best.  S i n ce yousay  you can'tmove them  toa  n ewf ile s ystem ,w ha t  about using a --bi nd  mount  to " remount" /hom e and /var w i thout ex ec p r iv i leges?
mount - o noe xec --bind /var /va r
mou nt -o no exec --bi n d  /home / hom e
I'm  no t su re if that wo u l d wo rk  or not , b ut seem s p rom isi ng. .. 
EDIT:
We ll, I li ke  m yni ce,  shin y  "nice a ns wer "bad ge fr o m this  answ er,bu ta fte r playi n gw i th i tIdon' t t hi nk it  wil l  wo rk.  My  original  te s t wa son  an old  (2.4.9) kern el , and the"m oun t on t o p  of itse lf" functionality appea r ed to w ork .  Itrie d it agai n w ith anew e r kern el (2. 6.18)  a ndi t  does n ot  ap pe ar to work .  Istart ed  tolook at  work arounds (lik e  re naming /var a nd/hom e to  so m et h ing  e l sea n d then mounting  them back .Ididn't get ver yfar tho ugh bec auseI  foundthis in t he man pa ge  for m oun t on the n ewer box :

Note t h at th e  f ilesy ste m moun topt ions  will rem ain t he sam eas tho se on 
1]

def standardize(series):
_ _  iqr =_np.percentile(series, 75)_-_np.percentile(series, 25)
__  _return (series -_np.median(series)) / iqr

 trending_= train()
 _print_"Top 5 trending products:"
 for i, s in trending[:5]:
     _print_"Product %s_(score:_%2.2f)"_% (i, s)

A:

insted of 

trend_= np.array(trends[i]) use trend =_np.array(trends.loc[i])

 Q:

Prevent_users from marking files as executable?

I want to_ensure_that users of_my system are incapable of chmodding files +x, and_I do not want anything in_/home/ or /var/_to_be_executable. 
I can't put_them on separate partitions.
Running Ubuntu 9.04_Server.

A:

I was going to suggest a_wrapper to chmod or something, but the_more I think about it, the_users will eventually find a_way around_this (scp an executable from_another box, or_run perl_-s "chmod('FILE');", etc...
So,_I think the FS method is_the best. _Since you say you can't move_them_to a new_file_system,_what about_using a --bind_mount_to "remount"_/home_and /var without exec privileges?
mount -o_noexec_--bind /var /var
mount -o noexec --bind /home_/home

I'm not sure if_that_would work or not,_but seems promising...
EDIT:
Well, I like_my nice, shiny "nice answer" badge_from this_answer, but_after playing with it I don't think it will work. _My original test was on an_old (2.4.9) kernel, and_the "mount_on_top of itself"_functionality_appeared to_work.  I tried it again with_a newer_kernel (2.6.18) and it does not_appear to work. _I_started to look at work arounds_(like renaming /var and /home to_something else and then mounting_them_back._ I didn't get very_far though because I found this_in the man_page for mount on the newer box:

Note_that_the filesystem mount options
  will_remain_the same as those on