Posts

Showing posts from September, 2015

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]

symfony1 - Symfony Edit Specific Related Records -

i have app have model supports multiple addresses, upfront want allow user add/edit 1 address. user ---- userid address ---- userid line1 ... i have following render form adding new address, how existing records? need add configure method in user form? $this->embedform("address", new addressform()); take @ more symfony: advanced forms . chapter outlines way embed multiple forms when dealing 1-to-many relationships , should more cover explaining need do.

iphone - How to sort NSArray with date time values? -

i have nsarray containing date/time nsstrings in following format: 2/2/2011 2:46:39 pm 2/4/2011 11:59:47 … where date represented month/day/year. how sort nsarray making sure newest date/times @ top? when you’re dealing dates, use nsdate instead of nsstring . also, it’s important consider time zone — web service provide dates in utc or other time zone? you should first convert array of strings array of dates. otherwise, you’d converting string date whenever used comparison, , there more comparisons number of strings. for example: nsdateformatter *formatter = [[[nsdateformatter alloc] init] autorelease]; [formatter setdateformat:@"mm/dd/yyyy hh:mm:ss a"]; nsmutablearray *datearray = [nsmutablearray array]; (nsstring *datestring in array) { nsdate *date = [formatter datefromstring:datestring]; if (date) [datearray addobject:date]; // if date nil, string wasn't valid date. // add error reporting in case. } this converts array ,

(Error 3071) Access -

i'm trying search course id checking the faculty id , course id in course table. simple query when launched receive a (this expression typed incorrectly, or complex evaluated. example, numeric expression may contain many complicated elements. try simplifying expression assigning parts of expression variables. (error 3071) the vb script i'm using looks this. private sub course_id_dblclick(cancel integer) dim x integer dim y string dim z integer x = me.faculty_id.value me.course_id.rowsource = "select course.[course id] course course.[course name]=['course']and course.[faculty id]='" & x & "'" end sub i think getting message because using wrong delimiters , confusing terminology in object names (where field content 'course' , table name [course] same. i guess datasource ms-access database. should use " (double quote) value separator (you'll have double sign inside expression) text, , nothing n

java - Strange title corruption of activity when using ListView -

i've got class (let's call mywidget now) extends view in custom drawing in ondraw(). mywidget works fine in situations, except when either adding mywidget listview or scrollview within tabview. when in 1 of these configurations, consistently observe scrolling overwrite title area of view partial image of contents of 1 of instances of mywidget. i know confusing description of problem here's screenshot of corruption: screen corruption any ideas?! addition: clipping logic use: try { canvas.save(canvas.all_save_flag); // clipping here } { canvas.restore(); } it looks view's custom drawing code doing tricks clip rect , not saving/restoring canvas state.

ruby on rails - Is it possible to use RMagick to draw overlays on to other application windows? -

i building desktop app put simple graphical hud on other application windows. need app able access app parent, , build out hud on top of it. possible rmagick? if not, there else in ruby needed? i need exploring options, since there seems little information related doing this. if involves fact have access specific c library or something, fine. i'm little lost on start. edit: can comment on why getting no responses whatsoever? unique of requirement? are trying create overlay on top of existing application window, similar xfire, raptr, steam, or fraps do? if doing on windows, , want overlay full screen directx apps such video or games, need hook directdraw. rather old library appears unsupported serve starting point: http://directdrawoverlaylib.codeplex.com/ if want overlay standard (not directx) app, might make app use borderless, transparent window on can paint content. then, track movement of "parent" window can move child window accordingly. he

i have created timer in service so i get error how to slove this in android -

i have created 1 service , added in manifest. when use timer call service periodically , in timer have used location manager location of user contin. there error that: 05-11 11:57:17.574: error/androidruntime(3305): java.lang.runtimeexception: can't create handler inside thread has not called looper.prepare() tell me problem in code. code here package com.collabera.labs.sai; import java.util.timer; import java.util.timertask; import android.app.service; import android.content.context; import android.content.intent; import android.location.location; import android.location.locationlistener; import android.location.locationmanager; import android.os.bundle; import android.os.ibinder; import android.util.log; import android.widget.toast; public class simpleservice extends service { timer mytimer; @override public ibinder onbind(intent arg0) { // todo auto-generated method stub return null; } @override public void oncreate() { super.oncreate

ruby on rails - Debugging stuff that lives in lib -

normally, in rails app, writing puts or rails.logger outputs data console. however, reason, when step in code lives in lib , written streams "swallowed" or -- is, doesn't end on stdout ! strategies debugging this? thanks, you may victim of activesupport::bufferedlogger , buffers log output , flushes when asked to. because you're not asking in lib files (hint: automatically in controllers / models / whatever used in request), won't. what need tell want wherever need it: rails.logger.auto_flushing = true then can call other rails.logger methods heart's content.

html - IE8 takes on class name of IE7 when using conditional comments -

i have seen couple of answers relate questions can't seem problem solved. i trying use conditional comments target ie per paul irish boilerplate i.e. <!--[if lt ie 7 ]> <body class="ie6"> <![endif]--> <!--[if ie 7 ]> <body class="ie7"> <![endif]--> <!--[if ie 8 ]> <body class="ie8"> <![endif]--> <!--[if ie 9 ]> <body class="ie9"> <![endif]--> <!--[if gt ie 9]> <body> <![endif]--> <!--[if !ie]><!--> <body> <!--<![endif]--> doctype 'transitional'. i testing site on local server , looking @ developer toolbar in ie8, class placed on body 'ie7' after looking using following try , render in ie8 standards mode hoping class put on body 'ie8' <meta http-equiv="x-ua-compatible" content="ie=emulateie8"> it doesn't work. used js here tell mode ie8 in. sa

c# - Can't connect to database server -

i'm encountering problem database connection. started new blank solution, added wcf library project, , last not least wcf website (service). in website added reference library have interface (data contract), class implements interface , dataclasses. i'm trying connect database on server , try retrieve data there. connection string looks like: <add name="myconnectionstring" connectionstring="data source=myserver; initial catalog=mydatabase; user id=me; password=me123;" providername="system.data.sqlclient" /> and how i'm trying connect database: public list<string> getengagements(string id) { string sql = "select mycolumn mytable id = '" + id + "'"; string connstring = string.empty; sqlconnection conndb; connstring = configurationmanager.connectionstrings["myconnectionstring"].connectionstring; conndb = new sqlconnection(connstring);

asp.net - how to reset dropdown selected index serverside value from javascript? -

problem have date text box , shifts drop down. when select date , shift list of employees. dropdown has onselectedindexchanged event, employee list populate if change shifts. date chage have added ajavascript reset shift dropdown 0 index. therefore every time when change date have select shift , selectindex change event fired. but the problem when reset shifts dropdown javascript done in client side not in server side.so if select dropdownt previous value doesn't fire change event other values works fine . <asp:textbox id="txtselectdate" runat="server" cssclass="inputaddres" onchange="javascript:return resetshifts();"></asp:textbox> <asp:dropdownlist id="ddlshifts" autopostback="true" onselectedindexchanged="ddlshifts_selectedindexchanged" runat="server" > <asp:listitem text="morning" value="1"/> <asp:listi

c# - Events and threads in a socket based program -

i'm working on library .net messenger service. it has connection main notification server, , connection per instant messaging session. handled using begin/end asynchronous methods. at present, events library user (ie.. messagereceieved) called inside read callback thread (albeit traversing through few different layers.. message parsing , not). this fine, means library user has careful. instance, blocking operation inside 1 of event handlers stop data being received. is acceptable/the standard way things? raise events on threadpool thread if necessary. eventually decided acceptable. you'll see same sort of problem windows forms. example, if perform blocking operation in clicked event handler, whole form locks up.

python - What is the best way to get row_num in django? -

what best way row_num in django ? can use variable counter in django template tags ? {% o in objects %} <tr> <td>{{ row_num }}</td> <td>{{ o.first_name }}</td> <td>{{ o.last_name }}</td> </tr> {% endfor %} thanks in advance. you can use forloop template tag : forloop.counter -> current iteration of loop (1-indexed) forloop.counter0 -> current iteration of loop (0-indexed) forloop.revcounter -> number of iterations end of loop (1-indexed) forloop.revcounter0 -> number of iterations end of loop (0-indexed) forloop.first -> true if first time through loop forloop.last -> true if last time through loop forloop.parentloop -> nested loops, loop "above" current one

objective c - Adding Entity References to Core Data -

ii trying use core data ios application , have been reading many tutorials , still confused. using iphone add reference or adding them programmatically 2 ways add row? mean if had product catalog of 20 items need type code 20 times? or add row because application supposed read-only. or better off wth sqlite instead of core data? in advance. the easiest way write quick mac app editing, using same data model file. if you're using xcode 3, this. create new mac app uses core data, , drag in data model (removing default data model creates you). then, open .xib file mac app's main window in interface builder. switch xcode , open data model. pick entity want editor for. hold down option (alt), , drag entity data model editor interface builder. automatically creates user interface editing database, can save , run through xcode. make sure mac app creating sqlite data store (look through code xcode created default, may have defaulted xml , you'll have change it). f

Windows Mobile 6.5 HD2 controls problem -

i have develope app company on wm6.5 deals xml (its not problem). framework: 3.5 c# device: hd2 resolution: 480x800 configured vs2008, installed sdk 6, 6.5 dtk got emulator 6.5.3 got severals questions controls. 1) possible set tabcontrol left side, not bottom? 2) possible make expand/colapse panel? (like click on "cars" expand down panel or form) <=important! a) im using show/hide panel 3) opensource/free use controls in company? a) found controls on xda developers. question conf vs2008 1) is possible make phone , display area bigger? you should separate different questions, since bit disparate, here answers: 1) no, tab control bottom-only on winmo. top or side, you'd have create custom control. 2) no, panel not natively collapsible. collapsable panel, need custom control. 3) vague. you're after ui controls cf? componentone , beemobile , resco , pocketpccontrols offer commercial controls. if you're after free can use

Why is the JavaScript NodeList immutable? -

recently came across fact childnodes property of element returns nodelist , not array. understand nodelist meant live collection of elements, don't why precludes having methods indexof, or push. could explain why thing can nodelist index it? because that's way it's specified. dom api designed separately javascript. fact nodelist has common aspects javascript arrays ( length , indexing) just...well, it's not coincidence , by-product of inputs design process. remember javascript not language has dom bindings. you can readily affect contents of nodelist using dom api: dom2 core dom2 html dom3 core ...or of course, favorite javascript library.

mapping - What's the Entity Framework equivalent of NHibernate's References(x => x.ResidenceCountry).Column("ResidingInCountryId")? -

i have code: class country { public int countryid { get; set; } public string countryname { get; set; } } class employee { public int employeeid { get; set; } public string employeename { get; set; } public int residingincountryid { get; set; } public virtual country residencecountry { get; set; } } what should put on onmodelcreating? can navigate country's countryname employee i'm quoting directly this blog posting ian nelson , think need: here's how you’d rename foreign key on unidirectional one-to-many relationship in fluent nhibernate: references(x => x.audioformat).column("audioformat"); whilst in entity framework code-first, equivalent is: hasoptional(x => x.audioformat) .withmany() .isindependent() .map(m => m.mapkey(a => a.id, "audioformat"));

Graph File Format that supports list as attributes -

i'd store graph file. in graphml. nodes have non-scalar properties (e.g. property "hobby" of node "alice" has values ["swimming", "reading"]). defined in graphml specification , properties of nodes may scalars, not lists. looked around , did not find graph file format supports lists properties. know such format? cheers, manuel since graphml type of xml, can use custom xml schema able add in own custom properties graphml, include adding lists. extending graphml , w3schools schema tutorial

asp.net - How to change property of UserControl on PostBack? -

let's have page custom usercontrol (containing asp:literal , string property) , button. want change literal's text on button click, change control's string property in button clicked event. this: //in aspx protected void button1_click(object sender, eventargs e) { testcontrol.text = "triggered"; } the problem literal remains unchanged because page_load event fires first , creates custom control, button_clicked fires , changes property control created, nothing. control's code behind: public partial class testcontrol : system.web.ui.usercontrol { public string text { get; set; } } protected void page_load(object sender, eventargs e) { lbltest.text = text; } } i figured out if move logic in custom control page_load property setter change intended. this: public string text { { return lbltest.text; } set { lbltest.text = value; } } is there other (better) way this? real problem involves more complicated controls des

asp.net mvc - How configure Nhibernate to not save object in current session -

i have 3 entites: users, roles , permissions. there 2 controllers: usercontroller , rolepermissioncontroller. controller wrapped nhibernate session. when create fill role permissions, user doesn't exist. storage new permission object in asp.mvc session. wants save new role permission when i`ll create user in usercontroller. but when filled new role exist permission (i got db nhibernate) , went user controller new object role created, without call session.saveorupdate or other methods. i tried use evict after fill new role exist permissions: microsoft.practices.servicelocation.servicelocator.current.getinstance<isession>().evict(newrole); but didn't help. want nhibernate - don't save entity on transaction (rolepermissioncontroller) - , save connected user object entities in usercontroller. this doesn't answer question directly, still might solution - how collecting information through viewmodel, end single controller action takes information

PHP autovivification -

update: original intention question determine if php has feature. has been lost in answers' focus on scalar issue. please see new question instead: "does php have autovivification?" question left here reference. according wikipedia , php doesn't have autovivification, yet code works: $test['a']['b'] = 1; $test['a']['c'] = 1; $test['b']['b'] = 1; $test['b']['c'] = 1; var_dump($test); output: array 'a' => array 'b' => int 1 'c' => int 1 'b' => array 'b' => int 1 'c' => int 1 i found code works too: $test['a'][4] = 1; $test['b'][4]['f'] = 3; but adding line causes warning ("warning: cannot use scalar value array") $test['a'][4]['f'] = 3; what's going on here? why fail when add associative element after index? 'true' perl-

Make a toast when user enters write password in android screen lock -

can toast message when user enters wrong password in android screen lock. thanks, pravin a way doesn't appear exist. (you can use broadcastlistener catch when lockscreen comes on/goes away, not capture failed password attempt.)

java - How to know if my HTTP request uses UTF-8? -

i'm trying fix problem in android app. app posts http request web service. when text in request contains swedish characters Å, Å , Ö, doesn't work. people have web service it's because request has encoded in utf-8, , it's not. the app uses org.apache.http.impl.client.defaulthttpclient, , assume line says utf-8 should used: httpprotocolparams.setcontentcharset(params, "utf-8"); i used wireshark see app sends, , string "teståäöÅÄÖéüà" shown as: "test\345\344\366\305\304\326\351\374\340" i found out by table numbers octal representation of "unicode code point" characters. that's else utf-8, right? is if utf-8, special characters represented 2 bytes, e.g. "c3 a5" "å" , "c3 a4" "ä"? so: 1. understand right unicode vs utf-8? 2. right what's being sent not in utf-8-encoding? 3. how make defaulthttpclient send in utf-8? jon as pointed out stephen, must distingui

regex - How to match strings that start and end with the same character, but have an odd number of letters? -

i'm trying formulate regex identifies strings begin , end 'b" have odd number of letters overall. far have following: strings start , end b: ^b.*b$ i not sure how accepts odd number of letter. numbers it's easy: ^b(..)*b$ but odd throwing me little it should same: ^b.(..)*b$

qt4 - Qt and multiscreen -

Image
i have example application came qt (dialogs/standarddialogs) , modified displays dialog on every screen: for(int i=0;i<app.desktop()->screencount();i++) { dialog* dialog = new dialog(app.desktop()->screen(i)); dialog->show(); } return app.exec(); when testing on xnest on application default screen (the 1 application has been started) works ok. however, on other screen icons in message boxes not displayed correctly. the problem can reproduced on both solaris , linux. however, when try xephyr instead of xnest problem disappears (on linux). on other hand not problem xnest on exceed problem can reproduced (but icons not displayed @ all). has seen kind of problem? think might problem qt or configuration of x server? or maybe need compile qt special options? it seems bug in qt x11 graphics system. if set qt_graphicssystem raster icons displayed properly.

Can't send with cURL in PHP -

i created test host on 0fees.net. create small php script receive file wish send. i tried lot of things server responds http 403 forbidden; actual message in verbose output is * connect() ********* port 80 (#0) * trying 209.190.85.12... * connected * connected ******* (209.190.85.12) port 80 (#0) > post /index.php http/1.1 host: ************* accept: */* content-length: 791 expect: 100-continue content-type: multipart/form-data; boundary=----------------------------4cad4df8 02c5 * requested url returned error: 403 * closing connection #0 * http response code said error the code use is curl_easy_setopt(curl, curlopt_url, link); curl_easy_setopt(curl, curlopt_header, "user-agent: mozilla/5.0 (windows nt 6.1) applewebkit/534.30 (khtml, gecko) chrome/12.0.742.30 safari/534.30"); curl_easy_setopt(curl, curlopt_verbose, 1); curl_easy_setopt(curl, curlopt_failonerror, true); curl_easy_setopt (curl, curlopt_followlocation, 1l); curl_easy_setopt (curl, curlopt_post,

c# - Issue While using an Jquery JqTransform plugin within Ajax update panel in asp.net -

i facing issue while using jquery jqtransform plugin controls inside ajax update panel in asp.net. here code: <%@ register assembly="ajaxcontroltoolkit" namespace="ajaxcontroltoolkit" tagprefix="asp" %> <asp:toolkitscriptmanager id="toolkitscriptmanager1" runat="server" enablepartialrendering="true"></asp:toolkitscriptmanager> <asp:updatepanel id="updatepanel1" runat="server" updatemode="conditional"> <contenttemplate> <asp:dropdownlist id="ddlartist" runat="server" autopostback="true" onselectedindexchanged="ddlartist_selectedindexchanged"></asp:dropdownlist> <p class="maintext"><asp:literal id="ltrartistdesc" runat="server"></asp:literal></p> </contenttemplate> <triggers> <asp:asyncpostbacktrigger controlid=&

asp.net - Linq query correction -

i want know if linq , sql equal ( means linq return same set of results sql ? dont have data in tables , need convert sql linq. please suggest var excludetypes = new[] { "ca00", "ca01", "ca03", "ca04", "ca02", "pa00", "pa01", "pa02", "pa03", "pa04" }; var accounts = account in context.accounts owner in context.accountowners business in context.businesses accountstatus in context.accountstatuses legalstatus in context.legalstatuses !excludetypes.contains(account.accounttype) select new accountsreport { account = account }; alter view [dbo].[vwrptborroweraccount] select dbo.tblaccount.[creditor registry id], dbo.tblaccount.[account no], dbo.tblaccount.[date opened], dbo.tblaccount.[account stat

Collecting the data into one object and sorting it in .NET/C# -

in our .net/c# project save users' browser name/version, os name, etc. in database. later on grab data , use statistics purposes. need somehow define, example: 5 customers had windows 7 + internet explorer 8 4 customers had windows xp + internet explorer 6 etc. when getting data database, can define os , browser used, case when collect data, how browser , os used , quantity of such platforms? example search windows xp , system show me browsers used os , in quantity. could give hint? thanks. sounds perfect fit group by operator (if you're using sql), or linq groupby() method (http://msdn.microsoft.com/en-us/library/system.linq.enumerable.groupby.aspx) if you're wanting stay within .net. for example, in sql: select count(*), os, browser yourtable group os, browser or, in linq: var groups = yt in yourtable group yt new { yt.os, yt.browser } ytgroup select new { key = ytgroup.key, groups = ytgroup }; from here, you'

configuration - SSIS XML DTSConfig update (VS 2005) -

i have dts package xml configuration (.dtsconfig) file have information needs updated every time package runs. is there way update .dtsconfiguration file? thanks ok. haven't found way created script updated elements wanted. dim xml xml.xmldocument dim xpathtemplate string dim fname string xpathtemplate = "/dtsconfiguration/configuration[@path='\package.variables[user::{0}].properties[value]']/configuredvalue" fname = "config.dtsconfig" xml = new xml.xmldocument() xml.load(fname) xml.selectsinglenode(string.format(xpathtemplate, "myelement")).innertext = "updated!" xml.save(fname) since wanted update 1 field used method.

redirect - nginx ignoring Apache rewrite directive -

my problem this: - use nginx in front of apache server wide meaning websites - rewrites have in .htaccess file work perfect, except 1 , far noone managed give me solution this .htaccess rule ------------- rewritecond %{the_request} ^.*/index\.(html|htm)\ http/ rewriterule ^(.*)index\.(html|htm)$ http://%{http_host}/$1 [r=301,l] ------------- this following: - redirects 301 http code www.domain.com/index.html www.domain.com - takes both index.html , index.htm now thing worked prior installing nginx , works far index.htm.. redirects properly. index.htm not exist. i tried other way around , found out if file exists, redirect won't happen. another weird thing found following: have mod_pagespeed installed google , when access url www.domain.com/index.html... 1 not rewrite /, mod_pagespeed is... inactive.. meaning no changes occur in source instance....like url not same normal requests. btw..in ssh when issue nginx command this: nginx: [warn] duplicate mime

xml - How to use a java class based on its API documentation -

i quite new java, , need work on project requiring using open source software. confusing understanding java api's documentation. example, can show me how use related java class, remotexmlsimplesearchenginebase, based on java api. please refer link http://download.carrot2.org/stable/javadoc/org/carrot2/source/xml/remotexmlsimplesearchenginebase.html i interested in derivation process, can use other java classes based on reading api documentation. thanks. often javadoc doesn't explain general concept of library api class. might contain more useful information (like jdk javadocs do), in general should try user manual, reference or getting started guide. from javadoc can still learn few things: what interfaces implemented which directly known subclasses/implementors exist you see class abstract which methods added/overridden class which methods added pre-/postconditions of methods , parameters (sometimes not listed) ... however, don't general conc

How can I determine paragraph and line indents in MS Word documents with c#? -

any 1 please tell me there way determine indents of each line , paragraph in ms word documents. i’m new in office programming , intend write application convert documents text while keeps styles converting intents white-spaces. take wordml, it's xml file contains doc document. it's quite easy generate , edit one. :) http://msdn.microsoft.com/en-us/library/aa212812%28v=office.11%29.aspx http://en.wikipedia.org/wiki/microsoft_office_xml_formats

sql - How can I make this query to accept dynamic table names? -

this function concats rows data 1 string. know function named coallasce available, out of curiosity want know how can change function accept table names dynamically. @ present reads employee table. alter function [dbo].[concatstrig] ( @tablename varchar(64), @fieldname varchar(64) ) returns varchar(max) begin declare @sql varchar(max) = '' set @sql = 'select ' + @fieldname + ' ' + @tablename declare curtemp cursor select empname sp_executesql(@sql) declare @strtemp varchar(max) declare @string varchar(max) = '' open curtemp fetch next curtemp @strtemp while @@fetch_status = 0 begin set @string = @string + ' ' + @strtemp fetch next curtemp @strtemp end close curtemp deallocate curtemp return @string end thanks in advance:) you need use dynamic sql . that's way parameterize table names.

c# - Error : Object must implement IConvertible -

hi, i new programming , appriciate if guys me. trying insert listbox items , textbox value each of listbox items database when below error. if try insert list box items successful when try insert textbox value error. can please tell me doing wrong. error message: object must implement iconvertible. description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.invalidcastexception: object must implement iconvertible. source error: line 60: line 61: line 62: cmd.executenonquery(); line 63: line 64: c# code using system; using system.data; using system.configuration; using system.collections; using system.collections.specialized; using system.text; using system.web; using system.web.security; using system.web.ui; using system.web.ui.webcontrols; using system.web.ui.webcontrols.webparts; using system.data.sqlclient; using syst