Posts

Showing posts from May, 2012

sendmail - PHP mail body construct -

i can't seem join (concatenate) these fields correctly. using mail api 3rd party end , can't change fields. add new fields need add them comments section. want add log in id ($loginid) $internal=$_server['server_addr']; $hostname = gethostbyaddr($_server['remote_addr']); to comments field $inquiry = $_post['textfield'] ; i need format follows in generated email: log in - xyz host name - xxxx internal ip - xxx comments - a;ldkjfalkdjf currently have following code, when joined returns nothing $loginid = $_post['loginid'] ; $internal=$_server['server_addr']; $hostname = gethostbyaddr($_server['remote_addr']); $inquiry = $_post['$loginid' . '$internal' . '$hostname' . 'textfield'] ; mail( "email@email.com", "subject", "$inquiry" "from: $email"); how can group desired data , format better in return email? thx! $inquiry = $_po...

ruby on rails - SQL nested query -

i have images table , locations table want retrieve list of images latest images each location within boundaries. select * images location_id in (select id locations latitude > 17.954 , latitude < 52.574 , longitude > -107.392 , longitude < -64.853) this nested query, achieve same join. works if want images each location, 1 image per location (the recent) here main fields of these tables table "images" integer "id" text "image_name" text "caption" integer "location_id" datetime "created_at" datetime "updated_at" integer "view_count" table "locations" integer "id" text "name" float "longitude" float "latitude" datetime "created_at" datetime "updated_at" string "city" string ...

design - Why does Haskell not have an I Monad (for input only, unlike the IO monad)? -

conceptually, seems computation performs output different 1 performs input only. latter is, in 1 sense, purer. i, one, have way separate input parts of programme ones might write out. so, why there no input monad? any reason why wouldn't work have monad (and o monad, combined io monad)? edit : meant input reading files, not interacting user. use case, can assume input files not change during execution of programme (otherwise, it's fine undefined behaviour). i disagree bdonlan's answer. it's true neither input nor output more "pure" are quite different. it's quite valid critique io single "sin bin" effects crammed together, , make ensuring properties harder. example, if have many functions know read memory locations, , never cause locations altered, nice know can reorder execution. or if have program uses forkio , mvars, nice know, based on type, isn't reading /etc/passwd. furthermore, 1 can compose monadic effects in ...

php - New Facebook application -

i have application uses require_login. created new application test purposes, doesn't work. stops at: $fb->require_login($required_permissions = 'email,publish_stream'); so question is, new applications must use new php sdk? thanks folks, sorry delay in response. noticed configuration application options different @ production application , test application. production app has more options configure, because it's has been registered long time ago. tried selecting/deselecting different options, , works.

java - Why does this generic code compile? -

javac infers t string in method f() . rules in language spec lead conclusion? <t> t g(){ return null; } string f() { return g(); } i suspect compiler using section 15.12.2.8 : if method result occurs in context subject assignment conversion (§5.2) type s, let r declared result type of method this treating return statement if subject assignment conversion. example, imagine converted f() to: string f() { string tmp = g(); return tmp; } now whether is subject assignment conversion, section 14.17 (the return statement) contains this: a return statement expression must contained in method declaration declared return value (§8.4) or compile-time error occurs. expression must denote variable or value of type t, or compile-time error occurs. type t must assignable (§5.2) declared result type of method, or compile-time error occurs. that reference 5.2 "assignment conversion" section, guess means expression g() is "subje...

ruby - Can't run this Rails app -

hey guys, clone repo in github: https://github.com/huacnlee/homeland/tree/ when run server, got error: agro:homeland zhulin$ rails s deprecation warning: railtie_name deprecated , has no effect. (called <top (required)> @ /users/zhulin/desktop/railsapps/homeland/config/application.rb:9) /usr/local/lib/ruby/1.9.1/syck.rb:145:in `initialize': no such file or directory - /users/zhulin/desktop/railsapps/homeland/config/config.yml (errno::enoent) /usr/local/lib/ruby/1.9.1/syck.rb:145:in `open' /usr/local/lib/ruby/1.9.1/syck.rb:145:in `load_file' /users/zhulin/desktop/railsapps/homeland/config/application.rb:48:in `<top (required)>' /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb:28:in `require' /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb:28:in `block in <top (required)>' /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.0/lib/rails/commands.rb:27:in `tap' /u...

jQuery in Grails 1.3.7 -

can please tell how connect jquery plugin in grails 1.3.7. while trying install command "grails install-plugin jquery" within directory plugin appears following text "resolving dependencies ... dependencies resolved in 798ms. running script c: \ grails \ scripts \ installplugin.groovy environment set development application expects grails version [1.3.5], grails_home version [1.3.7] - use correct grails version or run 'grails upgrade' if grails version newer version application expects. " trying install jquery plugin 1.4.4.1 http://grails.org . grateful help! it looks have version mismatch between version of grails you're using , version used when application created. run 'grails-upgrade' , when complete, try installing plugin again. you're not going able install jquery plugin until resolve version mismatch issue. mike

animation - Animating LinearLayout background to blink in Android -

the question simple can't manage find solution it. have linearlayout in activity. depending on user need make background of layout blink 3 times. means change background color transparent red , backwards 3 times. let me give example: the user receives question , 2 buttons answers the user presses wrong answer. layout containing button change it's background (transparent - red, transparent - red, transparent - red - transparen) 3 times. how can make in android ? thank you. you use handler postdelayed method. this: handler h = new handler(); int count = 0; runnable r=new runnable() { public void run() { if(count < 6){ if(count % 2 == 0){ count++; layout.setbackground(red); h.postdelayed(r,500); }else{ count++; layout.setbackground(transparent); h.postdelayed(r,5...

validation - Android, Autocomplettextview, force text to be from the entry list -

is there way force entry in autocompletetextview 1 of elements in entrylist? i've found method called "performvalidation" im not sure does, , havent been able find documentation or examples. the autocompletetextview has method called setvalidator() takes instance of interface autocompletetextview.validator parameter. autocompletetextview.validator contains isvalid() can check value has been entered, , can "fix" string implementing fixtext() . seems best can autocompletetextview , documentation autocompletetextview.validator states following: "since there no foolproof way prevent user leaving view incorrect value in it, can try fix ourselves when happens." if list of elements not long, better off using spinner. ****** edit: ****** i wipped quick example of how can use this, hope helps! <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android....

Using CUDA Occupancy Calculator -

using occupancy calculator cannot understand how registers per thread / shared memory per block .i read documentation.i use visual studio .so in project properties under cuda build rule->command line -> additional options add --ptxas-options=-v.the program compiles fine .but not see output .can help? with switch on there should line on compiler output window tells number of registers , amount of shared memory. see @ on compiler output window? can copy , paste question? should ptxas info : used 3 registers, 2084+1060 bytes smem, 40 bytes cmem[0], 12 bytes cmem[1]

json - Encoding large numbers with json_encode in php -

i have php script outputs json-encoded object large numbers (greater php_max_int) store numbers internally, have store them strings. however, need them shown un-quoted numbers client. i've thought of several solutions, many of haven't worked. of ideas revolve around writing own json encoder, have done already, don't want take time change places have json_encode instead my_json_encode . since have no control on server, cannot turn remove json library. cannot undeclare json_encode , nor can rename it. there easy way handle this, or best option go through each , every file , rename method calls? with javascript being loosely typed, why need control type in json data? doing number in javascript, , parseint\parsefloat not able make leap string number on client side?

unrecognizable email address from javascript validation -

i have script written long ago freelancer that's worked fine until now. script checks email address form against matching rules , returns true/false. problem reason isn't recognizing email address has simple firstinitiallastname@domain.com syntax (no periods or characters, etc). i don't understand javascript understand php if tell me why script return false against email address formatted indicated above, i'd appreciate it. function check_email(str) { var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-za-z]{2,7}$/; if (!str.match(re)) { return false; } else { return true; } } it should work, regexp valid. are sure email trimmed of spaces @ end/beginning? if leave trailing space @ end or hanging 1 @ beginning won't work accepts alphanumeric characters @ beginning , a-za-z characters @ end (domain). whitespace thing can come can break it. and refactor bit , shorten return match value returns array of matches or null (which equals false in...

java metro framework - JAXB and file bgm.ser -

i have working test case of using jaxb. generated classes using xjc , dumped classes in package. working on doing same xsd, , put these classes in package. test second xsd not working, says cannot find bgm.ser. looking file in place not. however, test working, bgm.ser in same relative place. reasons why second test looking file in wrong place?

multithreading - What is the best way to throttle many .NET Task instances? -

i have created large amount of task instances. need run them all, , wait them complete. problem need make sure no more x tasks between "started" , "completed" @ given time; tasks involve calls other parties have restriction on number of simultaneous calls. since these restrictions not based on hardware, can't rely on built in intelligent throttling; need enforce limit strictly. i've been able having tasks increment , decrement shared variable in thread-safe way, seems unnecessarily cumbersome. there way that's more built-in api directly, or easy synchronization tool i'm missing? you have create own task scheduler, see how to: create task scheduler limits degree of concurrency edit: requires more code semaphore, have feeling might perform better, because thread pool in tasks executed unaware of semaphore, using taskscheduler playing rules. edit 2: 1 of possible drawback of using semaphore thread pool might think task doing io...

Clojure: Generating functions from template -

i have following code generic conversion library: (defn using-format [format] {:format format}) (defn- parse-date [str format] (.parse (java.text.simpledateformat. format) str)) (defn string-to-date ([str] (string-to-date str (using-format "yyyy-mm-dd"))) ([str conversion-params] (parse-date str (:format (merge (using-format "yyyy-mm-dd") conversion-params))))) i need able call this: (string-to-date "2011-02-17") (string-to-date "2/17/2011" (using-format "m/d/yyyy")) (string-to-date "2/17/2011" {}) the third case problematic: map not contain key :format critical function. that's why merge default value. i need have dozen of similar functions conversions between other types. there more elegant way not require me copy-paste, use merge etc. in every single function? ideally, looking (macro?): (defn string-to-date (wrap (fn [str conversion-params] (parse-date str (:format...

c - Sorting dynamically allocated strings -

i've got strange problem: int cmp(const void *a, const void *b) { const char *ia = (const char *) a; const char *ib = (const char *) b; return strcmp(ia, ib); } char ** names = null; if((names = (char **) calloc(3,sizeof(char*))) == null) { fprintf(stderr,"unable allocate memory"); return 1; } ... names[0] = "c"; names[1] = "b"; names[2] = "a"; printf("before\n"); printf("%s\n",names[0]); printf("%s\n",names[1]); printf("%s\n",names[2]); qsort(names,3,sizeof(char *),cmp); printf("after\n"); printf("%s\n",names[0]); printf("%s\n",names[1]); printf("%s\n",names[2]); gives expected: before c b after b c but names[0] = (char *) calloc(1024,sizeof(char)); names[1] = (char *) calloc(1024,sizeof(char)); names[2] = (char *) calloc(1024,sizeof(char)); scanf("%s",names[0]); scanf("%s",names[1]); scanf("%s",n...

xml - getting a substring out of a item in yahoo pipes -

following situation: item. content => "this 48593 test" title => "the title" item. content => "this 48593 test 3255252" title => "the title" item. content => "this 35542 48593 test" title => "the title" item. content => "i havent 5 digits 34567654" title => "the title" this current item in console of pipes no want replace "content" "the last match of number has 5 digits. wanted result: item. content => "48593" title => "the title" item. content => "48593" title => "the title" item. content => "48593" title => "the title" item. content => "" title => "the title" is there way in pypes 2? please comment if unclear use regex module this: in item.content replace (.*) x $1 in item.content ...

ASP.NET ObjectDataSource UpdateMethod Exception Handling -

i have gridview control on page connected objectdatasource typename="bll.mylogic" dataobjecttypename="bll.myobject" updatemethod="myupdatemethod". the update in myupdatemethod conditional checking conditions before _datacontext.submitchanges(). depending on check throw exceptions ("not unique") or ("no appropiate logic found") etc. catching these exceptions @ page level via onupdated="mydataupdated" of objectdatasource. these operations work fine. problem after process done , in case of "exception occured" gridview gets reloaded , editindex = -1 (initiated). if manually retrieve editindex , make editable form data (data input user) in edittemplate gets wipped away. viewstate doesnt work here. what work around situation ? thanks in advance. have tried setting gridviewupdatedeventargs.keepineditmode property true in rowupdated event handler?

Django form validation, clean(), and file upload -

can illuminate me when uploaded file written location returned "upload_to" in filefield, in particular regards order of field, model, , form validation , cleaning? right have "clean" method on model assumes uploaded file in place, can validation on it. looks file isn't yet saved, , may held in temporary location or in memory. if case, how "open" or find path if need execute external process/program validate file? thanks, ian the form cleansing has nothing saving file, or saving other data matter. file isn't saved until run save() method of model instance (note if use modelname.objects.create() save() method called automatically). the bound form contain open file object, should able validation on object directly. example: form = myform(request.post, request.files) if form.is_valid(): file_object = form.cleaned_data['myfile'] #run validation on file_object, or define clean_myfile() method # run automa...

c# 4.0 - How can I expand(inline) property in an expression(C# 4.0)? -

i have expression of form: expression<func<showparticipant, bool>> expr = z => z.show.orgname == "xyz"; i need convert/expand following form: expression<func<showparticipant, bool>> expr = z => z.show.organization.name == "xyz"; where orgname property on show entity resolves organization.name . how can achieve assuming need work in ef? can imagine orgname defined in show class below - public partial class show { public string orgname { { return this.organization.name; } set { this.organization.name = value; } } } appreciate response, anand. by itself, expression trees can't there's no way expression tree know calling orgname property under covers. however if put attribute on property, perhaps factory replace call property1 ("orgname") property path organization.name sample code below. static void...

ruby - How can we delete an object (having an integer identifier)? -

i delete object, can not. here example: irb(main):001:0> str = "hello" "hello" irb(main):003:0> str.object_id 2164703880 irb(main):004:0> str = nil nil irb(main):005:0> str.object_id 4 as can see, can set variable of object nil (and of course object id 4). , after that, garbage collector delete automatically unused object id: 2164703880. but no, don't want that. want remove object. thanks ideas, suggestions. you cannot un-define local variable in ruby. can use remove_class_variable, remove_instance_variable , remove_const, can't local variables. in code removing string object, or @ least garbage collector removing it. thing keep around pointer, named str, points nil. actual string object no longer exist. one way ensure variables un-defined wrap them in proc. of course has downside of having create proc, , it's easier let ruby perform garbage collection. if want use proc, define it's own binding , can force local...

jQuery UI Datepicker - why's it naked? -

Image
i'm using jquery ui datepicker , hooked text field in simplest way possible. $('#date').datepicker(); but when click text field, datepicker looks this: why's that? need install skin or something? thanks. you should add css file page. should come in same package js + css

how to make a jquery chart with expandable box with only one expanded box at a time? -

i'm working on jquery chart expandable box. main problem when 1 box open , go open another, first 1 doesn't close. how make script when second box open , first box close? i try use code in 1 of answers here somehow cant make work. thanks html: <h2 class="trigger"><a href="#">click see more</a></h2> <div class="toggle_container"> <div class="block"> <h3>one</h3> <p>consequat te olim letalis premo ad hos olim odio olim indoles ut venio iusto. euismod, sagaciter diam neque antehabeo blandit, jumentum transverbero luptatum. lenis vel diam praemitto molior facilisi facilisi suscipere abico, ludus, at. wisi suscipere nisl ad capto comis esse, autem genitus. feugiat immitto ullamcorper hos luptatum gilvus eum. delenit patria nunc os pneum acsi nulla magna singularis proprius autem exerci accumsan. </p> <p>praesent duis vel similis usitas ca...

ajax - How to process multiple sequential JSON responses in one request in JavaScript as they arrive without waiting for the last update? -

is there way make http request within javascript url will, on time, produce multiple json responses , process json response received client? what want is, in php on server, test series of flash streams, ensure serving data , communicate updates of test series of sequential json updates received , decoded javascript , update dom updates comes in. key part client process , display updates come in (the test takes while complete) , not wait socket close before processing updates. see: http://socket.io/ http://dev.w3.org/html5/websockets/ how implement basic "long polling"?

algorithm - Simplified (or smooth) polygons that contain the original detailed polygon -

Image
i have detailed 2d polygon (representing geographic area) defined large set of vertices. i'm looking algorithm simplify , smooth polygon, (reducing number of vertices) constraint area of resulting polygon must contain vertices of detailed polygon. for context, here's example of edge of 1 complex polygon: my research: i found ramer–douglas–peucker algorithm reduce number of vertices - resulting polygon not contain of original polygon's vertices. see article ramer-douglas-peucker on wikipedia i considered expanding polygon (i believe known outward polygon offsetting). found these questions: expanding polygon (convex only) , inflating polygon . don't think substantially reduce detail of polygon. thanks advice can give me! edit as of 2013, links below not functional anymore. however, i've found the cited paper, algorithm included, still available @ (very slow) server . here can find project dealing issues. although works area ...

.net - How to release Excel application objects -

i have following code below in have class class level excel objects defined. when call excelmodule.test class these excel objects getting created , can see excel instance in task manager. do have unload event class release these objects? module excelmodule public myrange excel.range public mysheet excel.worksheet public wb excel.workbook public ex new excel.application public sub test() end sub end module while robert's suggestion of calling quit may work, it's flawed because if user has excel open before application creates application object, calling quit quit open instance of excel. the issue com application doesn't know you're done reference excel application object. if goes out of scope , becomes eligible garbage collection/finalization, finalization won't occur immediately. in rare circumstances, it's necessary call marshal.finalreleasecomobject on com object of time not necessary. so while explicitly trig...

How to change this to String.Format in C# -

original string strcommandlineargs = (((("-i" + " ") + strvideopath + " -vcodec mjpeg -vframes 1 -an -f rawvideo -s ") + intwidth.tostring() + "x") + intheight.tostring() + " ") + strimagepath + " -ss 2"; i have done this string strcommandlineargs = string.format("-i {0} -vcodec mjpeg -vframes 1 -an -f rawvideo -s {1}x{2} {3} -ss 2", strvideopath, intwidth, intheight, strimagepath); i cant find difference in use of ( , ) in string. there no difference. brackets don't add special string.

java - Processing newline character in function jquery.i18n.prop() -

jquery code follows: alert(jquery.i18n.prop('message.key')); the value specified in properties file as: message.key=value after newline\nvalue here following output expected javascript alert(): value after newline value here the actual output is: value after newline\nvalue here i tried different methods changing value stored in properties file to: message.key=value after newline\\nvalue here message.key=value after newline\u000dvalue here but doesn't work. displays "\\n" instead what changes required made desired output? edit: following code gives desired output in javascript: alert('value after newline\nvalue here') but need use jquery.i18n.properties localization i'm pretty sure can go (the plugin supports multi-line properties): message.key1=value after newline value here message.key2=next value

jquery - Remove Particular Option from select Tag -

i have following combobox , want remove option value null (value='') using jquery <option value=''>--select--</option> <option value ='1'>one</option> <option value ='2'>two</option> <option value ='3'>three</option> <option value ='4'>four</option> expected combo option: <select name='x' id='x'> <option vlaue=''>--select--</option> </select> if understand correctly saying want remove options value not null, following work: $("#x").children("option").not("[value='']").remove(); if it's reverse, then: $("#x").children("[value='']").remove(); but first have fix misspellings in code: <select name='x' id='x'> <option value=''>--select--</option> <option value='1'>one</...

scrum - How to handle unplanned items in JIRA/Greenhopper -

i have setup jira , greenhopper , set initial sprint. have done scrum during years via whiteboard , face-to-face communication. wonder how should handle unplanned items using greenhopper? don't want add new card , have screw statistics. nice able figure of ammount of unplanned work when sprint done. initial guess add new card on task board , tag unplanned. don't seem find unplanned tag card . i've been using greenhopper 1 1/2 years. works pretty , invaluable our team isn't substitute post-its on daily stand-up. on 1.5 years, we've ended collecting lot of tasks, bugs, , other items in jira aren't immediate backlog items. managing them difficult in greenhopper. these unscheduled items. i have these versions set in greenhopper: unscheduled: holding pen few hundred items may or may not ever around to. ideas, bugs can't fix @ moment. unscrubbed bugs: find new bugs aren't related current sprint's work, go in here. every week...

visual studio 2010 - CodeAnalysis and CodeContracts combination -

i got contractclassfor generates low of warnings code analysis. example: microsoft.usage : parameter 'pagenumber' of 'idocumentservicecontracts.getitems(printqueue, int, int)' never used. remove parameter or use in method body. do have use supressmessage each parameter in each method in contracts class? or possible rid of warnings in way? want warnings classes except contract classes. a simple way disable code analysis entirely contract classes, putting [generatedcode] attribute on them. it's not right semantics job. suppressmessage not in scenario, since can't apply classes. you'd have apply each method, , gets messy.

Javascript Iteration issue - variable variable -

not expert on old js here goes i have store1.baseparams.competition = null; store2.baseparams.competition = null; store3.baseparams.competition = null; what want is for (i=1; 1<=3; 1++) { store + +.baseparams.competition = null; } hope makes sense want - possible basically make variable / object adding it cheers one way accomplish via eval() - (usually bad idea) for (var i=1; i<=3; i++) { eval("store" + + ".baseparams.competition = null;"); } another, more complex relatively efficient way create function gives ability mutate arbitrarily deep object hierarchies dynamically @ run-time. here's 1 such function: /* usage: nested objects: nested_object_setter(object, ['property', 'propertyofpreviousproperty'], somevalue); top-level objects: nested_object_setter(object, 'property', somevalue); */ function dynamic_property_setter_base(obj, property, value, strict) { var ...

scala - Can this be simplified? -

referring previous answer of mine on stackoverflow the core of complexity illustrated in 1 method: implicit def traversabletofilterops[cc[x] <: traversable[x], t] (xs: cc[t])(implicit witness: cc[t] <:< traversablelike[t,cc[t]]) = new morefilteroperations[cc[t], t](xs) with 2 questions: is there way give compiler hint map meets signature cc[x] <: traversable[x] ? expect match traversable[tuple2[_,_]] doesn't happen. in end, had write second method taking cc[kx,vx] <: map[kx,vx] , feels redundant witness: cc[t] <:< traversablelike[t,cc[t]] seems redundant given first type parameter, gut feeling enforced type of traversable , must always hold true possible subclass or value of x , there should no reason explicitly require witness. if test using existential type in repl, compiler seems agree me: scala> implicitly[traversable[x] <:< traversablelike[x,traversable[x]] forsome { type x }] res8: <:<[traversable[x],scala.collect...

sql loader - SQLLDR - problem with WHEN clauses -

i have multiple when clauses in control file, data loading in half of them satisfies when clauses , gets inserted desired table. other half arent (which expect) expecting data doesnt meet when conditions placed discard file there none created. any ideas? load data infile '/u04/app/vpht_app/flat_files/icr_load/marc/sqlldr_load/csso_ccrbscredentials_comsumer23062010160322.txt' badfile '/u04/app/vpht_app/flat_files/icr_load/marc/sqlldr_load/csso_ccrbscredentials_comsumer23062010160322.bad' discardfile '/u04/app/vpht_app/flat_files/icr_load/marc/sqlldr_load/csso_ccrbscredentials_comsumer23062010160322.dsc' insert table "dcvpapp"."rbs_cc_customerinfo" insert fields terminated ',' trailing nullcols (cc_user_name position(24:73), accountid position(1:12), customerid position(14:22)) table "dcvpapp"."rbs_cc_securitydetails" when (481:481) = 'n' , (477:479) ='0' fields terminated ',' traili...

encryption - Security using AES with salted password as key -

i understand how salted hash of password works, assuming need store salt, username, key, , encryptedpassword. think overall need understand how implement instance how store , how regenerate password. if explain why using salted value better, couldn't person dictionary attack salt in front of each word? thanks, it unclear trying do: verify supplied password correct (as system login); or implement encryption of data key derived password. if latter (which known password-based encryption ), should use key derivation function , such pbkdf2 . key derivation function takes salt , supplied user password, , produces key can used cipher aes. to encrypt, prompt password, generate random salt, , derive key using kdf. use key aes in suitable block cipher mode encrypt data, , store only salt , encrypted data (and whatever iv cipher mode requires). to decrypt, prompt password, load salt file, , re-derive key. use key decrypt file. the purpose of salt prevent precomputat...

wpf - How to get the X,Y position of a UserControl within a Canvas -

i have simple usercontrol below - place in canvas. move using multi-touch , want able read new x,y postion using procedural c# code. ideally have x , y 2 properties or point (x,y). <usercontrol x:class="touchcontrollibrary.mycontrol" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:ignorable="d" d:designheight="64" d:designwidth="104"> <border name="controlborder" borderthickness="1" borderbrush="black"> <dockpanel margin="1" height="60 " width="100"> <stackpanel dockpanel.dock="left" background="g...

How to switch a project built on Visual studio 2010 from dynamic to static? -

i have started using visual studio 2010 ,so i'm unaware of various options. have created project , in application wizard @ beginning,i had checked box said dynamic libraries. now need statically link same project make portable.please me out. thank you. in solution explorer, find project in question, right click , select properties . the default selection in left sidebar should configuration property -> general ; if it's not, select that. in main section, under project defaults , set configuration type dropdown static library (.lib) .

events - JavaScript: Get Function calling HTML-Object -

hey, yes, know [funcname].caller or arguments.callee.caller can reference function called actual function, - following scenario: <a href="#" onclick="return something()">test</a> inside of something() have no chance a-tag, .caller reference, unless alter script in following way: <a href="#" onclick="return something(this)">test</a> with "this" i'm passing a-tag reference function there way a-tag reference without explicitly passing function? well, think doing fine, it's 1 word of code , doesn't harm.using jquery can way $(function(){ $("body").delegate("a", "click", function(){ alert($(this).html()); }); }); //both code work you $(function(){ $('a').click( function(){ alert($(this).html()); } ); })

javascript - jQuery remove spaces on blur not working -

the replace function i'm using works i've tested in console not work @ on blur. how can fix that? <script type="text/javascript"> //ensure spaces not entered between tags jquery(document).ready(function(){ jquery('#item_keywords').blur(function(){ $(this).val().replace(/^\s+$/,""); }); }); </script> you have removed spaces u have not assigned them :) jquery(document).ready(function(){ jquery('#item_keywords').unbind('blur').bind('blur',function(){ $(this).val($(this).val().replace(/^\s+$/,"")); }); });

.net - How to consume web service hosted on multiple servers, from different clients? -

i consuming web services in client application. at present, proxy classes generated using wsdl.exe. web class's url property set specific url web service hosted. proxy classes part of 1 of class library projects. now, need host web service on more 1 servers , different clients point different servers. how can manage now? do need generate proxies different clients separately using url client pointing? if yes, how can use single setup clients? i using vs 2008. as long wsdl same* each service don't need generate different web service proxies - can use same 1 , set endpoint url on proxy url of web service wish use. * - apart things published endpoint url , things that.

iphone - How to render UIView into a CGContext -

i wanted render uiview cgcontextref -(void)methodname:(cgcontextref)ctx { uiview *someview = [[uiview alloc] init]; magicalfunction(ctx, someview); } so, magicalfunction here supposed render uiview(may layer) current context. how do that? thanks in advance! how renderincontext method of calayer ? -(void)methodname:(cgcontextref)ctx { uiview *someview = [[uiview alloc] init]; [someview.layer renderincontext:ctx]; } edit: noted in comment, due difference in origins in 2 coordinate systems involved in process, layer rendered upside-down. compensate, need flip context vertically. technically done scale , translation transformation, can combined in single matrix transformation: -(void)methodname:(cgcontextref)ctx { uiview *someview = [[uiview alloc] init]; cgaffinetransform verticalflip = cgaffinetransformmake(1, 0, 0, -1, 0, someview.frame.size.height); cgcontextconcatctm(ctx, verticalflip); [someview.layer renderincontext:ctx]; ...

c# - How to process layer templates using mapscript to respond to a WMS GetFeatureInfo request -

i'm trying handle getfeaturinfo wms requests using c# mapscript. prior using mapscript our software passed wms requests through cgi mapserver hosted on iis. processed html template associated each queried layer , substituted number of tokens within template data. we cannot use mapserver cgi implementation i'm attempting reimplement mechanism using mapscript via c# mapscript mechanism. the summary of code have far here. problem call processquerytemplate causes accessviolation exception thrown. public string getfeatureinfofromwms(namevaluecollection wmsquerystring) { //set projection library environment variable used mapscript.dll environment.setenvironmentvariable("proj_lib", projectionlibrarypath); string output = string.empty; try { using (mapobj map = new mapobj(mapfile)) { //add aditional layer specific params - ie location of plugins etc processlayers(map, wmsquerystring); map.web...

java - how should i make my switch go back to main switch? -

good day... creating address book program... used switch in main menu... , planning create switch edit menu... problem is.. don't know how go main switch... main program: import javax.swing.joptionpane; import javax.swing.jtextarea; public class addressbook { private addressbookentry entry[]; private int counter; public static void main(string[] args) { addressbook = new addressbook(); a.entry = new addressbookentry[100]; int option = 0; while (option != 6) { string content = "choose option\n\n" + "[1] add entry\n" + "[2] delete entry\n" + "[3] update entry\n" + "[4] view entries\n" + "[5] view specific entry\n" + "[6] exit"; option = integer.parseint(joptionpane.showinputdialog(content)); switch (option) { ...

visual studio 2010 - vs2010 xsd.exe tool auto -

i'm using xsd tool console, make classes xsd scheme, there plugin vs2010: when i'm changing scheme, classes changes automatically? i'm not aware of plugin add external tool in visual studio call xsd.exe path files - see blog intro see question has instructions doing in vs2005

otp - Erlang application problem -

i try write application erlang program. i have test_app.erl: -module(test_app). -behaviour(application). %% application callbacks -export([start/2, stop/1]). start(_type, _startargs) -> test_sup:start_link(). stop(_state) -> ok. and .app file: {application, test, [{description, "test system."}, {vsn, "1.0"}, {modules, [test_app, test_sup, fsm]}, {registered, [test_sup, fsm]}, {applications, [kernel, stdlib]}, {mod, {test_app, []}} ]}. when try start application: application:start(test). i error: =info report==== 18-feb-2011::19:38:53 === application: test exited: {bad_return, {{test_app,start,[normal,[]]}, {'exit', {undef, [{test_sup,start_link,[[]]}, {test_app,start,2}, {application_master,start_it_old,4}]}}}} type: temporary {error,{bad_return,{{test_app,start,[normal,...

fortran90 - Optional subroutines in Fortran 90 -

how can achieve objective in fortran 90 ? have routine accepting function subroutine foo(bar, mysub) integer, intent(in) :: bar interface subroutine mysub(x) integer :: x end subroutine end interface call mysub(bar) end subroutine now want routine optional subroutine foo(bar, mysub) integer, intent(in) :: bar interface subroutine mysub(x) integer :: x end subroutine end interface optional :: mysub call mysub(bar) end subroutine now, if mysub standard variable var like if (present(var)) l_var = var else l_var = <default value> endif but far know, cannot perform same optional subroutine. in practice not possible subroutine foo(bar, mysub) integer, intent(in) :: bar interface subroutine mysub(x) integer :: x end subroutine end interface optional :: mysub if (present(mysub)) l_mysub = mysub else l_mysub = default endif c...

Change XML node values from WiX -

i want able change xml node value wix. xml structure looks this: <settings xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <setting name="setting1"> <value xsi:type="xsd:boolean">false</value> </setting> <setting name="setting2"> <value xsi:type="xsd:string">hello</value> </setting> </settings> i want change string value of setting2 else. i'm trying use xmlconfig , code not working looks this: <util:xmlconfig id='setsetting2' file='[#defaultsettings.xml]' action='create' node='value' elementpath="//settings/setting[\[]@name='setting2'[\]]/value" name='value' value="test" on='install' preservemodifieddate='yes' ...

How can I convert immutable.Map to mutable.Map in Scala? -

how can convert immutable.map mutable.map in scala can update values in map? the cleanest way use mutable.map varargs factory. unlike ++ approach, uses canbuildfrom mechanism, , has potential more efficient if library code written take advantage of this: val m = collection.immutable.map(1->"one",2->"two") val n = collection.mutable.map(m.toseq: _*) this works because map can viewed sequence of pairs.

c - Why struct size is multiple of 8 when consist a int64 variable In 32 bit system -

in c programming language , use 32 bit system, have struct , struct size multiple of four. @ linker map file , size multiple of 8 example typedef struct _str { u64 var1, u32 var2 } str; size of struct 16. typedef struct _str { u32 var1, u32 var2, u32 var3 } str2; size of str2 12. working on 32 bit arm microcontroller. dont know why the size of structure defined multiple of alignment of member largest alignment requirement. looks alignment requirement of u64 8 bytes in 32-bit mode on platform. the following code: #include <stdio.h> #include <stdint.h> int main() { printf("alignof(uint64_t) %zu\n", __alignof(uint64_t)); } produces same output when compiled in both 32-bit , 64-bit mode on linux x86_64: alignof(uint64_t) 8

asp.net - Losing jQuery functionality after postback -

i have seen ton of people reporting issue online, no actual solutions. i'm not using ajax or updatepanels, dropdown posts on selected index change. html is <div id="mylist"> <table id="ctl00_placeholdermain_dlfields" cellspacing="0" border="0" style="border-collapse:collapse;"> <tr> <td> <tr> <td class="ms-formlabel" style="width: 175px; padding-left: 10px"> <span id="ctl00_placeholdermain_dlfields_ctl00_lbldestinationfield">body</span> </td> <td class="ms-formbody" style="width: 485px"> <input name="ctl00$placeholdermain$dlfields$ctl00$txtsource" type="text" id="ctl00_placeholdermain_dlfields_...