Posts

haskell - Using filter on an item in a list? -

i trying filter item in list , print them line line. here's code: data car = car string [string] int [string] testdatabase :: [car] testdatabase = [car"casino royale" ["daniel craig"] 2006 ["garry", "dave", "zoe", "kevin", "emma"],car"blade runner" ["harrison ford", "rutger hauer"] 1982 ["dave", "zoe", "amy", "bill", "ian", "kevin", "emma", "sam", "megan"]] formatcarrow (car b c d) = show ++ " | " ++ concat [i ++ ", " | <- init b] ++ last b ++ " | " ++ show c ++ " | " ++ concat [j ++ ", " | j <- init d] ++ last d displayfilmsbyyear :: string -> io [()] displayfilmsbyyear chosenyear = mapm (putstrln.formatfilmrow) [putstrln(filter ((== chosenyear).y)) | (w x y z) <- testdatabase] -- code not working think why isnt work...

e commerce - Best CSS Layout for typical ecommerce sites -

ok, going varied opinions on question here goes anyway: best css layout type typical ecommerce site. typical in standard grid based product pages, header footer etc. an infinite number of layouts job done, , impossible definitively 1 'best'. however, there few guidelines should help: make product good.if you're going sell something, need make apparent why product awesome. prominent images can greatly. don't make things more complicated need be. minimalistic! no one's going "well, site design complex , intricate, should give them money..." make easy on eyes , mind. consider usability: people should able find need , efficiently. longer people have spend on site before being able buy something, less successful site be. also, make sure you're using colors aren't stressful on eyes . when in doubt, @ other successful e-commerce sites. don't need spend countless hours thinking of new site layout when there plenty of tried , true ...

c# - When does PreApplicationStartMethod actually get triggered to run? -

when using webactivator preapplicationstart method, triggers methods bound run? when iis7 has started app pool? when first request made webserver? else? if have answer, please provide reference got information? does of change in iis 7.5? webactivator preapplicationstart relies on asp.net preapplicationstartmethodattribute (see this link see how web activator works). preapplicationstartmethodattribute works when asp.net runtime starts up application , code runs in pipeline before app_start event gets fired. answer question, trigger happen when first request made web server (which in turn kicks in application start up). note trigger related asp.net app start , not app pool. app pool might running because of other application (can non asp.net app) when first request comes asp.net app, trigger happen (for particular app) because application gets started. if using auto-start feature iis re-start application on app pool recycle , preapplicationstart triggered. ...

windows mobile - Help me C# code backup/recover & Search contacts on WindowsMobile? -

hi studying programming on windows mobile. , build mini program "manage contacts" functions: add, edit, delete, search , sort group. don't know how complete function : search , backup/recovery contacts! can me? description search function: create textbox , listbox , when press word on textbox, name of contacts containing word display on listbox ! can me? this demo, convert , repair example of windows mobile 5.0 this form main, , picture main form here : http://3.bp.blogspot.com/-lmmkcf6-req/tcqwnk9kgdi/aaaaaaaaab4/-eis3mimhy0/s320/main.jpg using system; using system.drawing; using system.collections; using system.windows.forms; using system.data; using microsoft.windowsmobile.pocketoutlook; using microsoft.windowsmobile.telephony; namespace managercontacts { /// <summary> /// summary description form1. /// </summary> public class contactselector : system.windows.forms.form { private system.windows.forms.listbox lis...

tomcat6 - Exception when stopping container for a with Spring + Quartz + Tomcat web application -

when stopping tomcat, getting following exception: ...appears have started thread named [ org.springframework.scheduling.quartz.schedulerfactorybean#0_worker-10 ] has failed stop it. create memory leak. how can prevent it? have destroy-method set destroy on schedulerfactorybean bean. just say... we have exactely same error grails (wich spring -based) & quartz on tomcat server... thread can't stopped quartz pool we've never managed correct that

google app engine - String conversion within GAE webapp template -

i trying create string of key of referenceproperty within webapp template: assume following simple datastore model: def user(db.model): first_name = stringproperty() last_name = stringproperty() def email(db.model): user = referenceproperty(user) email = emailproperty() i pass list of email entities webapp template in list named member_list. within template, want create string of key of each email entity's 'user' property use in url, such as: {% member in member_list %} <a href="/member_handler/{{insert_string_of_member.user_key_here"}}>blah</a> i realize pass string of key template, prefer string conversion in template if possible; have tried various permutations of str() , _ str_ no avail. since know entity in question member instance, , presumably won't have parent entity, it's simpler (and produces nicer urls) use key name or id of member, rather full string key. can user.key().name() ( user.key....

c# - Binding attached property to IEnumerable -

i using new wpf viewer crystal reports in c#. using mvvm, bind source of data displayed instead of doing in loaded event. therefore, wanted implement attached property source - binding doesn't work, getter method not called. other posts binding attached properties didn't , not sure doing different. can help? here simplified code attached property: public static class crystalreportsattached { public static readonly dependencyproperty sourceproperty = dependencyproperty.registerattached( "source", typeof(ienumerable), typeof(crystalreportsattached), new uipropertymetadata(new observablelist<participant>() ienumerable, sourcechanged)); public static void setsource(dependencyobject target, ienumerable value) { target.setvalue(sourceproperty, value); } public static ienumerable getsource(dependencyobject target) { return (ienumerable)target.getvalue(sourceproperty); } ...

matrix - SQL Server Reporting -

i have matrix style report have created , displaying total count of items series of companies throughout 12 month period. [company1] [company2] [etc....] [total] [may] (count)(percent) [june] [etc] [totals]----------------------------------------------------- the last column total subtotal function , automatically adds column counts based on in column group in case gives me total both (count)(percent) i want show <count> don't find method of modifying parameters subtotal function. the way found add additional matrix right hand side of main display total counts. kind of hokey , refrain implementing @ time. any suggestions?

sql - Perform Method on all entries on the whole Ruby class (using Rails framework) -

i trying write method selects subset of members of user class. here attempt: def self.stats_users(date) self.where("employee = false , last_sign_in_at >= ?", date) end i tried call function in manner: user.stats_user('2011-04-14') however, method executing sql statement: select "users".* "users" (employee = false , last_sign_in_at >= '2011-04-14') when should execute: select * "users" (employee = false , last_sign_in_at >= '2011-04-14') i guess real question revolves around writing methods act on members of class , relative ignorance of put these methods , how call them. appear having little trouble understanding how activerecord transforms statements raw sql. re sql the queries equivalent in case. re methods collections this scopes for: scope :stats_users, lambda { |date| where("employee = false , last_si...

c# - Creating windows forms open new form -

when create new windows forms application, what's easiest way dropping button on page, creating click event open new form. my method requires clicking button open 9 new forms, together, want able position them want, know code this, can't seem open multiple new forms @ same time? button -> click -> open 9 new forms must open @ same time. how would depend on whether forms same or not but for integer = 0 8 dim frm new form1 frm.show next using static method ie: form1.show not idea. cheers

php - simplexml_load_file() with non-standard XML file -

i'm having trouble using non-standard xml file simplexml_load_file(). here's code: <?php $file = 'http://www.gostanford.com/data/xml/events/m-baskbl/2010/index.xml'; $xml = simplexml_load_file($file); echo 'displaying user names of xml file...<br />'; foreach($xml $event_date){ echo 'home: '.$event_date->hn.'<br />'; } ?> as you'll see, nothing being output xml file, echo'd "home:" any appreciated. this xml data, nothing non-standard it: <game_days> <event_date date="20101023"> <event id="1271699" local_time="6:00 pm pt" eastern_time="21:00" hc="stan" vc="" hn="stanford" vn="" hs="" vs=""/> </event_date> the attribute looking 1 element level <event> below. , access attributes use array syntax instead: foreach($xml $event_date){ echo...

mysql - Finding SQL Query Bottleneck -

i learning sql. sharpen skills, i've found sql puzzle on coderloop.com. (great website programming puzzles, btw). working through puzzle: http://www.coderloop.com/puzzles/university i close solution. need optimize code. puzzle requires design course catalog database, along queries "add student course" or "get course details". have, think, working solution. have tested own data, , seems perform fine. coderloop uses thousands of queries stress test database schema , queries. unfortunately, solution fails due timeout after 4 minutes or so. have reviewed schema , queries , can't find bottleneck. ideas on how redesign database or queries speed things up? notes: executes on mysql server the ?s parameters of test data passed coderloop bot. see bottom of page . my soultion setup database create table students ( sid int not null, name varchar(255), surname varchar(255), email varchar(255), faculty varchar(255), matricu...

positioning things in android with CSS -

is aware of custom layout component can take css position buttons etc? making simple things fit screens takes far longer similar in css. if want stick web style development, check out http://www.phonegap.com it's framework let's make app in html/css/js , builds apk that. can't tell out knowing you're building if match, give go best bet till figure out android way.

Does a separate .exe always require a separate project in Delphi? -

our application requires quite few tools , utilities have written support our product. things data converters, backup utilities etc. currently, each of these utilities separate delphi project. on top of that, many of these projects have corresponding dunit project unit testing, have separate project. have 13 separate delphi projects. these projects in 1 project group. is necessary? have have many separate projects, or there way in delphi have multiple entry points same project? also, convenient during development write code , 'run' it. end hacking project file; commenting out normal behaviour , replacing code want run. way? we use delphi 2010 if makes difference. you can either of these pretty easily: combine projects project group, able work them more easily. (my preference) separate projects different units (instead of project files), create single application uses units, , call different functionality based on command-line parameters (see paramcount ,...

Rails 3: How to insert non English text in view -

i insert non english (e.g. russian or hebrew) text in view. is idea do: <div>что нибудь по русски</div> or <div><%= "משהו בעברית" %></div> or there better methods ? use rails i18n api. create yaml files translations of specific pieces of code; works amazingly well. here's guide: http://guides.rubyonrails.org/i18n.html if need more complicated, it's doable, rails i18n api 1 of best.

Create a forward proxy on a Linux server -

situation: have 2 linux boxes running lamp stack. want access http box1 via box2 (using wget , curl). want people using box2 see no change @ all. what's best solution? need easy setup if possible. you'll have more specific; why users notice anything box2? intention serve content box1 without intermediate processing? or box2 making requests of box1 while in process of generating content users have requested? proxy in question? if want requests made of box2 transparently handled box1 in background, ignore wget / curl , and configure apache mod_proxy . if you're trying build cache of responses box1 served via box2, perhaps running squid in reverse proxy mode makes more sense. it's made caching. :) (building caching application on box1 might better long-term answer; pretty easy in ruby-on-rails applications add fragment caching , page caching application, , memcached can used add model-caching behavior, different caching fragments or whole pages. appr...

c# - How can I filter for specific information from an EntityCollection? -

i'd display grade information each student in results variable. the way database set is: grade --- gradestudent --- student so each different year, have unique gradestudent record holding grade's id, , students id, year of record. i used entity framework 4 orm, , i'd display grade name in datagridview each student. private void btnsearch_click(object sender, eventargs e) { studentrepository repo = new studentrepository(); var results = repo.findallstudents().where( s => s.name == txtsearchquery.text || s.lastnamefather == txtsearchquery.text || s.lastnamemother == txtsearchquery.text); datagridview1.datasource = results.select(s => new { codigo = s.studentid, nombre = s.lastnamefather + " " + s.lastnamemother + ", " + s.name, sexo = s.sex, telefono = s.telephone }).tolist(); } if try following, can invoke entitycollection ...

haskell - ghc compile error but runghc works -

update solved i updated haskell platform 2011.2.0.1 , ghc 7.0.3 , works!! i have following haskell file named "webscrap2.hs". can execute "runghc webscrap2.hs" , works fine. when compile file error. webscrap2.hs import text.html.tagsoup import network.curl (curlgetstring, urlstring) main :: io () main = html <- openurl "https://github.com/languages/haskell/created" let links = linkify html print links openurl :: urlstring -> io string openurl target = fmap snd $ curlgetstring target [] linkify :: string -> [string] linkify l = [x | tagopen "a" atts <- parsetags l, (_,x) <- atts] ghc --version the glorious glasgow haskell compilation system, version 6.12.3 ghc -o webscrap2 webscrap2.hs webscrap2.o: in function `r17i_info': (.text+0x1fe): undefined reference `tagsoupzm0zi12_textzihtmlzitagsoupziparser_parsetags_closure' webscrap2.o: in function `r17i_info': (.text+0x204): undef...

iphone - Request for member 'uitextfield' in something not a structure or union? -

working through several other problems have found myself @ point. have learnt alot stuff trying 1 stumped on. i writing textfield format login have on app, , because apple don't have resembling textfield mask have decided write own custom cell looks has mask on doing concatenating textfields in background. however have struck problem. trying call textfield:shouldchangecharactersinrange:replacementstring: of uitextfield in subclassed uitableviewcell outlined in code below. im receiving request member 'uitextfield' in not structure or union error... appreciated. ////.h @interface registerdeviceviewcontroller : uiviewcontroller <uitableviewdelegate, uitextfielddelegate> { registerdeviceviewcontroller *registerdeviceviewcontroller; //uitextfields registration cell uitextfield *regfieldone; uitextfield *regfieldtwo; uitextfield *regfieldthree; uitextfield *regfieldfour; uitableviewcell *myregistrationfield; uitableviewcell *my...

.htaccess - Redirecting SUBDOMAIN to a FOLDER using MOD Rewrite -

i hope can me i trying redirect non www traffic requests from user.domain.com/folder/somethinghere to domain.com/newfolder/user/somethinghere i tried rewritecond %{http_host} (.*).domain.com rewriterule ^folder/%1/(.*) http://domain.com/newfolder/%1/$1 [r=301,l] but redirection goes to domain.com/newfolder/somethinghere can offer help? thanks! mark it should this: rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewritecond %{http_host} ^(.*)\.domain\.com$ [nc] rewriterule ^folder/(.*)$ http://domain.com/newfolder/%1/$1 [r=301,l,nc]