Posts

Showing posts from January, 2010

xml - Sorting with xslt 1.0 -

i have evaluation form filled in lot of users. created export in excel form. want achieve is: header of excel have questions , below every question answers grouped user filled in form. this, i'm getting questions evaluation form , order them position, i'm grouping users filled in form, looping through results of grouping have same lines every question. part of xml i'm generating: <questionnames> <item> <quesid>468</quesid> <quesname><![cdata[name]]></quesname> </item> <item> <quesid>554</quesid> <quesname><![cdata[palce]]></quesname> </item> </questionnames> <exportline> <items> <item> <quesid>468</quesid> <values> <userid>25151</userid> <value><![cdata[dommel]]></value> <userid>45372</useri

ruby - How to attach message to rspec check? -

in rspec: can attach message check same way in xunit style test frameworks? how? assert_equal value1, value2, "something wrong" should , should_not take second argument ( message ) overrides matcher’s default message. 1.should be(2), 'one not two!' the default messages pretty useful though. update: for rspec 3: expect(1).to eq(2), "one not two!"

c# - storing and parsing boolean expressions in database -

this follow-up question previous question which design pattern suitable workflow requirement? . know best way store boolean expression in database , evaluate @ runtime without effort. have requirement set of jobs need executed screen every month-end , decision of whether job can executed depends on outcome of previous jobs. should able save expression in database e = (a or b) , (c or d) (could complex nested expression). means e can run if or b successful , c or d successful. how can represented in database , parsed , condition evaluated later? thinking of doing (not tested yet) if "job e = (a , b) or (c , d)". store tree structure in table jobid dependentjobid successjobid failurejobid e b c e c d 0 e d 1 0 e b 1 0 this means "if successful, check b else check c", "if c successful check d". process starts hi

reporting services - SSRS line graph: x-axis time-scale with gaps in data -

Image
i have dataset counts number of produced pallets per hour, eg 11/11/2010 22:00 --> 22 11/11/2010 23:00 --> 12 11/12/2010 00:00 --> 18 11/12/2010 01:00 --> 19 11/12/2010 03:00 --> 20 as may notice, there gap between 01:00 , 03:00 since there no data hour. data gets visualised in ssrs 2005 using graph time-scale x-axis. when graph type 'column', there no problem @ since 02:00 gets visualised no (0) value , gap visible in graph. when graph type 'line' or 'area', 02:00 visualised on graph no 0 value: there connection line between value of 01:00 , 03:00. when looking line graph, 1 conclude there production @ 02:00 not true, line connects value of 01:00 value of 03:00. example of same data in area graph (original image: http://img577.imageshack.us/img577/9616/area.jpg ) and column graph (original image: http://img577.imageshack.us/img577/7590/column.jpg ) should explain problem. does know how resolve problem? thank you!

JSON for Jquery autocomplete -

i've json response php file. [{"name":"kiev"},{"name":"kiev metro"},{"name":"kiev-dnepro"},{"name":"kiev-dnepro"},{"name":"kiev-donetsk"},{"name":"kiev-donetsk"} how can use standard jquery autocomplete? autocomplete function request seems cant parse response json (simple array works fine). me please derin, yes that's it. works fine! want modify little. getting more data in response , i'd display near of main autocomplete input var infogisname = null; var infogistype = null; var infogislocationid = null; var infogisparentid = null; $('#gisname').autocomplete({ source: function(request, response) { $.getjson("autocomplete.php", { term: request.term }, function(result) { response($.map(result, function(item) { infogisname = item.name;

java - Is there a single XPath expression I can use to navigate XML in a CDATA section? -

i'm trying figure out how use xpath exceptionid , instrumentid values out of xml snippet in following xml document (yes having xml in cdata little odd, that's 3rd party service) <?xml version="1.0"?> <exception> <info> <![cdata[ <info> <exceptionid>1</exceptionid> <instrumentid>1</instrumentid> </info> ]]> </info> </exception> is possible values in 1 xpath statement? i'm using javax.xml.xpath.xpath inside java (jdk 1.5 xalan 2.7.1 , xerces 2.9.1), e.g. xpath xpath = xpathfactory.newinstance().newxpath(); long exceptionid = new long(((double)xpath.evaluate(this.exceptionidxpath, document, xpathconstants.number)).longvalue()); it's this.exceptionidxpath variable i'm not sure how set, know example that: /exception/info/text()/info/exceptionid won't work (text() returns data in

Chrome extension message passing, when xhr call fails in jQuery -

i'm building extension in google chrome issues queries against websites. the queries issued "background page" on request "content script"; when background page receives request issue query, sends query out, parses response , sends response content script, using sendresponse(). it works fine when using xmlhttprequest(); problem if want issue queries using jquery .get() or .load(), when queries fail, fail silently , response never sent content script. if register event handler .ajaxerror() error catched, event handler apparently cannot call sendresponse() because following chrome error: "attempting use disconnected port object" searching error retrieves source code chrome text found, it's not helpful. in short, question is: possible use jquery.get() in background script of chrome extension, , still able send response content script when request fails? (and if yes, how) this hard address directly without code sample (how passi

Character set issues in filepath using ruby on XP -

i'm trying file.exist?(file) ruby script doesn't find file because of \, spaces, - , . in filepath. i'm beginner in ruby , need fix this. i assume has os, more ruby. file tèst.rb: puts "hello" puts "smørebrød" used in irb: irb(main):001:0> require "tèst.rb" hello smørebrød ruby can include file name tèst.rb fine. irb(main):005:0> f = file.new("ÅÄÖ.txt") irb(main):006:0> f.each {|l| p l } "\"hej verden\"\n" loading file requested characters , printing lines ( p l ) works fine. running ruby 1.8.7 on ubuntu linux . rather old ruby.

multicolumn listbox in html -

is there way create multicolumn listbox in html align each of columns lined vertically column header? example: plate state make model year color g655555 il mercury montago 2007 black g655555 il ford windstar 2007 grey instead of plate state make model year color g655555 il mercury montago 2007 black g655555 il ford windstar 2007 grey i using listbox instead of table because want able select data being displayed. not sure if can table. either way, can show me how align listbox columns or can see method of selecting items, row instead of column, in table. no. browsers prefer match os on inputs interfaces. , browsers ignore html , css inside option tag. might able set font monospace on select or option tag. i think there may better ways build ui want... have question why want put 6 data fields 1 form value on list box. if you're showing tabular data, use table. if want select row, add checkbox (

java - Any way to generate ant build.xml file automatically from Eclipse? -

from eclipse, found i can export ant build file project . provides references 3rd party libraries , base targets. i'm using global build file. thing bothers me this, if modified in project structure (like adding new 3rd party library), have think (yes can hard sometimes!) regenerating build.xml file. i'm wondering if here knows way have updated automatically. "automatically" mean not necessary explicitly ask eclipse regenerate every time it's needed. don't know trigger though... any thoughts or knowledge on this? thanks! mj right-click on eclipse project "export" "general" "ant build files". don't think possible customise output format though.

iis 7.5 - Forms Authentication fails for IE only in IIS 7.5 classic mode -

This summary is not available. Please click here to view the post.

path - Rake task which executes other rake tasks via system fails -- no such file to load 'rake' -

i've written rake task run few other rake tasks via system (so bind activerecord different databases, among other things). works fine on os x box, fails on our production linux boxes load error. tasks trivially boil down to: namespace :jobs task :foo => :environment system "rake jobs:bar" end task :bar => :environment puts "foobar" end and traced output is: -bash-3.2$ rake jobs:foo --trace (in /the/path) ** invoke jobs:foo (first_time) ** invoke environment (first_time) ** execute environment ** erubis 2.6.6 ** execute jobs:foo /usr/bin/rake:19:in `load': no such file load -- rake (loaderror) /usr/bin/rake:19 i dumped puts $: /usr/bin/rake , have discovered interesting. primary job has load path containing both of these paths: /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/bin /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib while secondary job has load path containing only: /usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib which e

c# - A potentially dangerous Request.Form value was detected from the client -

hi error when hit submit button on user login form because there repeater on same page repeating html being posted form content. apart applying validaterequest="false" login usercontrol there can add around repeater stop this? when set validaterequest false kind of dangerous characters accepted parameters must make sure html encode them if intend redisplay user input.

how to use blob pattern as an alternative of EAV -

in literature , on forums people eav evil , sugest using serialized lob pattern alternative of eav, don't concrete how use it. i wonder how overcome problems using blob pattern alternative of eav. let’s assume store custom fields of entity in field custom_fields string example in json tihis: {customfield1: value1, customfield2: value2, …, customfieldn: valuen} let's assume table subscribers has fields: id, email, custom_fields (where custom fields stored) how overcome following problems: 1. how seach seperate custom fields, example, find entities conditions custfield1 = value1 , customfield2 = value2? 2. how mantain data integrity, example, if delete custom field entity how delete values oif these custom fields in entity?

iphone - Put a link on home screen of my app and connect it to WebView -

in app want put website's url on home screen , on clicking on want open webview. how should go this. thanks, previous commenter incorrect. can open hyperlink either externally safari or internally uiwebview. add uiwebviewcontroller project. then, instantiate instance of uiwebviewcontroller shown inside app--you'll declaring property & synthesizing within main view controller (which need declared uiwebviewdelegate), such as: @interface mymainviewcontroller: uiviewcontroller <uiwebviewdelegate> { // implementation code here } when user taps button (assuming make button, rather text hyperlink), instruct app add uiwebview view stack, loading correct link. you'll want either within modal view or within navigation stack users can out of web view, of course. in mymainviewcontroller implementation file, this: -(void) showwebview { // note: have not tested this, prototyping // off top of head uiwebview *mywebview = [[uiwebview allo

Invoke python callable with an arg list -

simple question: how can pass arbitrary list of args python callable? let's want invoke function command line, so: my_script.py foo hello world with following script: import myfuncs f = getattr(myfuncs, sys.args[1]) if f , callable(f): # bit don't know. want f(sys.args[2:]) i'm sure there's way this, must overlooking it. you looking sequence unpacking . i.e. f(*sys.argv[2:])

objective c - Use AquaticPrime Framework with AppleScriptObjC -

how go using aquaticprime framework in applescriptobjc? that's broad topic, essentially, need implement applescript automation in application, , possibly implement in aquatic framework download. apple's applescript documentation far-reaching , covers more topics think can managed in single answer.

php - Add missing dates to an array -

i have following array: array ( [2010-10-30] => 1 [2010-11-11] => 1 [2010-11-13] => 11 ) i trying fill in array missing dates between first , last elements. attempting using following got nowhere: foreach($users_by_date $key => $value){ $real_next_day = date($key, time()+86400); $array_next_day = key(next($users_by_date)); if($real_next_day != $array_next_day){ $users_by_date[$real_next_day] = $value; } } the datetime, dateinterval , dateperiod classes can out here. $begin=date_create('2010-10-30'); $end=date_create('2010-11-13'); $i = new dateinterval('p1d'); $period=new dateperiod($begin,$i,$end); foreach ($period $d){ $day=$d->format('y-m-d'); $usercount= isset($users_by_date[$day]) ? $users_by_date[$day] :0; echo "$day $usercount"; }

How to Override Drupal Views Query? -

how can replace views 3 query custom sql query in code? from understand, can use hook_views_query_alter modify query. assume use replace query. here couple hook_views_query_alter examples, started: using hook views query alter alter view query add clause or group operator .

Way to override the way html tags are generated by Visual Studio 2010 -

is possible override particular tag generations vs2010? right when type <table> , vs create matching </table> tag close statement. when type <table> , i'd vs generate <tr><td></td></tr></table> . i'm pretty sure macro, nice able type , have generated. you create code snippet , toggle that... http://blogs.msdn.com/b/zainnab/archive/2010/02/16/html-code-snippets-vstipedit0018.aspx

c# - Can I find out if CodeGeneration was turned off in a binary? -

when use poco's in place of entity framework generated objects, have turn of default code generation in edm designer setting value of code generation strategy property of conceptual model (or edm) none , , setting custom tool property of edmx file (.edmx) empty string. if binary had poco's , had adhered above mentioned requirements, there way can programmatically query binary see if above properties set or not? in other words, information edm designer properties embedded somewhere in binary? ps: know can query binary getknownproxytypes see if proxies generated poco's. can query individual objects see if not derived entityobject . designer properties code generation tool used generate entities written ef assembly wondering about? update i think changing question , have answer. answer no. binary, cannot find out if code generation edm turned off or not, if have source code, can read .edmx file , designerinfopropertyset section has value shown below. <d

Fastest PDF generation in PHP? -

i'm attempting generate reports dynamically, simple html tables borders. i've tried tcpdf , renders 400 rows fine more (about 20 pages) can't handle it. dompdf can't that. these reports can thousands of rows. any idea on faster library or better plan of attack? try php-wkhtml2x php extension. uses popular web engine webkit(chrome , safari uses that)

unit testing - Selenium RC just run the first case in the suite -

i'm trying run html testsuite selenium rc. browser starts, first test runs, nothing else. selenium never start running second test in suite. couldn't find related in selenium's rc docs nor internet (except forum's post without answer). me? doing wrong? if run same testsuite using selenium ide firefox runs perfectly. if manually run second testcase in suite after seleniumrc launching browser, runs ok - running manually mean clicking in second row in left frame of selenium test page , click in "run selected test". that's command line i'm using: java -jar selenium-server.jar -htmlsuite *chrome http://localhost:8088/ /home/devel/dev/tests/ts_5.1.2 /home/devel/dev/tests/log.html apreciate help! fernando add ".html" extension test suite file , each test case file (else suite not run past first test case)

scheme - Reading and recreating a list based on its values -

i want create subset of list based on values. example: list (aa ab ba dc ad) i want list has values of atoms in starting 'a' answer should be: (aa ab ad) i can traversing through whole list , converting each value list , reading first value , recreating list. this awfully complex solution. is there method in scheme can read first character of string in list , remove element? check if scheme implementation has procedure called filter or that. if not can define 1 yourself: (define (filter p lst) (let loop ((lst lst) (res ())) (if (null? lst) (reverse res) (if (p (car lst)) (loop (cdr lst) (cons (car lst) res)) (loop (cdr lst) res))))) using filter atoms start 'a': > (filter (lambda (x) (char=? (string-ref (symbol->string x) 0) #\a)) '(aa ab ba dc ad)) => (aa ab ad)

c# - VaryByCustom not working for session variable -

i'm using output cache web site login system. have global pages can accessed every user. these pages cached , use master page. <%@ outputcache duration="3600" varybyparam="none" varybycustom="userid" %> i'm storing user login details in session. global.asax file here: public override string getvarybycustomstring(httpcontext context, string arg) { string result = string.empty; if (arg == "userid") { object o = session["userid"]; if (o != null) { result = o.tostring(); } } else { result = base.getvarybycustomstring(context, arg); } return result; } i have panel in master page visible authenticated users. when user logins , views public page guest user sees authenticated user panel on page a. if guest first view page authenticated user not see panel on page a. what part of code wrong? i'm using varybycustom first time. edit i've modified global.asax nothing wr

iPhone application closes on IPad -

i have iphone application , when starts on ipad shows start image (degault.png) , closes. i feel should common problem...can help? thankyou when these types of things happen, open organizer ipad plugged in. click on ipad in list, , in "crash logs" tab on right hand side. select appropriate crash log application (or many there application relevant you), , use crash report figure out problem application.

Memory analysis product for c -

i have written down code should garbage collection c programs. problem need run large number of objects 100 mb dynamically allocated. is there tool can me find out memory usage of c code @ runtime. pretty helpful if can come know current heap size , or number of memory blocks allocated etc. compare performance of code. should run along code or run it. if know please tell little more information regarding own impact @ runtime etc. lot... :) look @ valgrind . provides variety of memory analysis tools, including leak checking , heap profiling. runtime overhead depends on tool using; full memory checker slow, instruments memory accesses, memory profiler should pretty fast.

android - Setting text into a ContentView -

how go setting texts/images image , content view have in xml? i have like: tv.settext("random number: " + math.random()); if (currenthour > 8 && currenthour < 22) { tv.settext("random number:" + random + "%"); but want displayed text (tv) displayed in new xml file, result. setcontentview(r.layout.result); is there way gather information random number, etc..and have results displayed in new layout - result? thanks! this question makes no sense. layout xml static, tells layoutinflater views create, properties set, , how link them together. if want change activity's layout call setcontentview(r.layout.result) , call findviewbyid() find edittext want , call settext() on that.

javascript - PHP Shopping Cart Problem -

okay, have shopping cart problem. i've decided roll out own cart, alot easier had expected. but, i've run problem , cannot life of me figure out next. the problem: after adding products cart, user taken "checkout" page, edit quantities of items want. these items displayed in table. how can these items edited/new values php variable, , update corresponding entries in database? the page in question is: but see stuff in "checkout" page, you'll need visit: http://www.com.au/.php , click on few prices, , click "place order" link above table. any help/advice @ appreciated. if understand correctly, need add input variable. <tr> <td>cool item</td> <td><input type='text' name='items[<?=$product_id;?>]' value='1' /></td> </tr> then check $_post['items'] array. foreach($_post['items'] $product_id=>$quanity) { pro

android - order of ContentObserver notifications -

i'm querying contentprovider, looping thru rows in cursor, creating object each row , adding object list. i'm registering each object contentobserver of own uri. that's working fine, objects getting notified when db row updated and/or deleted. problem if db row deleted how know remove it's corresponding object list? in object's onchange() method, i'm querying contentprovider it's _id , if no results back, i'm setting "deleted" flag. i've registered list (actually contentobserver wrapper around list) contentobserver main contentprovider uri, , in onchange() method, loop thru list , check "deleted" flag of each object in list , remove list if deleted==true. however, seems list getting notified before individual objects are...hence, loop thru list relevant object's "deleted" flag not yet set. is there way control order in contentobservers notified of changes? since docs don't anything, suspect answer

ios - Weird error validating code-signing for apps-store distribution -

when building app distribution app store, following warning: warning: application failed codesign verification. signature invalid, or not signed apple submission certificate. (-19011) executable=/users/tijszwinkels/dropbox/documents/projects/iphone/batterylogger pro/build/app-store distribution-iphoneos/batterylogger pro.app/batterylogger pro codesign_wrapper-0.7.10: using apple ca profile evaluation illegal entitlement key/value pair: keychain-access-groups, <cfarray 0x104270 [0xa0376ee0]>{type = mutable-small, count = 1, values = ( 0 : <cfstring 0x104170 [0xa0376ee0]>{contents = "eu.tinkertank.batteryloggerpro"} )} illegal entitlement key/value pair: application-identifier, eu.tinkertank.batteryloggerpro - (null) upon submission, same 'application failed codesign verification' error. this file said in error: <?xml version="1.0" encoding="utf-8"?> <!doctype plist public "-//apple//dtd plist 1.0

android - Simplified and Traditional Chinese vs Regions -

in process of implementing traditional , simplified chinese support in android application , confused on how supposed work. so reading documentation discussions this , this have put simplified chinese values-zh values-zh-rcn values-zh-rsg and traditional chinese values-zh-rtw values-zh-rhk that works fine somehow not make sense me (sorry if dont understand enough chinese simplified vs traditional usage). from understand checking locale setting dialog in emulator on rooted phone user can change locale simplified chinese or traditional chinese. now here question. how system know simplified or traditional chinese strings.xml. there sort of assumption baked in says if supposed display simplified chinese values-zh , traditional values-zh-rtw? but if user located in hk , set device display simplified chinese? or if emigrant somewhere else in world sets device traditional chinese region e.g. or ca? what have allow users set locale , have app appear right locale

javascript - mixing my jquery with an onclick event also tied to a SelectedIndexChanged event -

the issue no post occurs. noticed if returned true not be case .. there non-deterministic results @ loss. appreciated! <dropdownlist id="ddls1" runat="server" onclick = "checkhighdegreecompliance(this, 1);" selectedindexchanged = "ddls1_selectedindexchanged" autopostback="true" > here markup on actual page after loading <select name="rptrsection1$ctl00$rptrsection2$ctl00$ddls2" class="ddlselector2 sdropdown isnormal" id="rptrsection1_ctl00_rptrsection2_ctl00_ddls2" style="width: 200px;" onchange="checkhighdegreecompliance(this, 2);settimeout('__dopostback(\'rptrsection1$ctl00$rptrsection2$ctl00$ddls2\',\'\')', 0)"> here javascript function checkhighdegreecompliance(obj, sectionnum) { var parddl = $(obj); var parcomplev = parddl.attr('selectedindex'); var pnldiv = parddl.parents('.section'); var ddls = pnldiv.find

sql server - Why does this Sql Statement (with 2 table joins) takes 5 mins to complete? -

Image
updates : 3 updates added below the following sql statement takes 5 mins complete. i. just. don't. get. :( first table has 6861534 rows in it. second table has little bit less .. , third table (which contains 4 geography fields) has same first. those geography fields in 3rd table .. shouldn't messin' sql statement ... should it? because table large (due geography fields) has huge page sizes or .. destroying table scan count does? select count(*) [dbo].[locations] inner join [dbo].[myusalocations] b on a.locationid = b.locationid inner join [dbo].[geographyboundaries] c on a.locationid = c.locationid update as requested, here's more info geographyboundaries table... /****** object: index [pk_geographyboundaries] script date: 11/16/2010 12:42:36 ******/ alter table [dbo].[geographyboundaries] add constraint [pk_geographyboundaries] primary key clustered ( [locationid] asc )with (pad_index = off, statistics_norecompute = off, s

mysql - Combining mutliple Wordpress database queries -

forgive me re-wording , re-asking question, answers received couple weeks didn't much... basically, i'm looking somehow combine multiple database queries in wordpress retrieve user ids searching term in 'usermeta' table, entries have 'meta_value' i'm trying combine: $users = $wpdb->get_results("select user_id, meta_value 'business_name' $wpdb->usermeta meta_key = 'business_name'"); and: $users = $wpdb->get_results("select user_id, meta_value 'business_description' $wpdb->usermeta meta_key = 'business_description'"); to have this: $users = $wpdb->get_results("select user_id, business_name, business_description business_name '%{$keyword}%' or business_description '%{$keyword}%'"); i've looked inner joins , subqueries, cannot seem find solution. realize can away multiple queries, searching through possibly thousands of entries, i'

javascript - Check All won't work in Chrome but works in Firefox -

i have check box wherein when user tick it, items under ticked. works fine in firefox won't perform check function in chrome. this js function: function check(chk, num) { if(chk.value=="check all"){ (i = 0; <= num; i++){ chk[i].checked = true ; } chk.value="uncheck all"; }else{ (i = 0; <= num; i++){ chk[i].checked = false ; } chk.value="check all"; } } html: <form target="_blank" action="" method="post" id="myform" name="myform"> <input type="checkbox" value="check all" onclick="check(document.myform.product a, 9)" id="fujitsu" name="fujitsu"> select <input type="hidden" value="1" name="product_id[1]"> <input type="checkbox" value="product 1" id=&qu

serialization - Serializing data structures to a file with Haskell? -

i'm new haskell , i'm trying figure out how io works. have data structure, tree, want serialize file , de-serialize out data structure. seems should able through show , read, use of read throwing error. here's relevant part of code: data tree = answer string | question string tree tree deriving (read, show) filetotree :: (read a) => filepath -> io filetotree filepath = datastruct <- readfile filepath return (read datastruct) treetofile :: (show a) => -> filepath -> io () treetofile datastruct filepath = writefile filepath (show datastruct) main = let filepath = "data.txt" let ds = filetotree filepath ask ds treetofile ds filepath ask :: tree -> io () ask (question q yes no) = putstrln q answer <- getline the error i'm getting "couldn't match expected type 'tree' against inferred type 'io a' in first argument of 'ask'". seems read should return tree ty

SQL Server 2005 Table-valued Function weird performance -

Image
i have huge difference of time execution between 1-minute query , same 1 in table-valued function. but weired thing running udf (valid) company_id argument gives me result in ~40 seconds , change company_id 12 (valid again), never stops. the execution plans of these 2 queries absolutely not same , of course, long 1 complicated. execution plan between batch version , udf version same , batch version fast...! if following query "by hand", execution time 1min36s 306 rows: select dbo.date_only(call.date) date, count(distinct customer_id) new_customers call left outer join dbo.company_new_customers(12, 2009, 2009) new_customers on dbo.date_only(new_customers.date) = dbo.date_only(call.date) company_id = 12 , year(call.date) >= 2009 , year(call.date) <= 2009 group dbo.date_only(call.date) i stored same query in function , ran : select * company_new_customers_count(12, 2009, 2009) 13 minutes running... , sure never give me result. y

What's wrong with my Syntax? (PHP/HTML) -

well, i've gone on atleast 30 times, tried many possible combinations think of, can spot syntax error? (i can't, obviously). doesn't display should be, instead displays actual html of page! the code: $ct->data[$key][1] = '<input id="quantity" name='."items[<?=$product_id;?>]". 'type="text" value="'.$ct->data[$key][1].'" style="background:#ffffff url(qty.png) no-repeat 4px 4px; can please tell me i've done wrong? help/advice @ appreciated. thanks! what this? name='."items[<?=$product_id;?>]".' type= i think meant name="items[' . $product_id . ']" type=

ruby - Nested Models Error in Rails 3 -

i have 2 models app , contact. app has has_one relationship contact. have declared accepts_nested_attributes_for clause in app model contact. now, in apps_controller, if use build method on app object, error the nil class, though had declared relationship. app.rb class app < activerecord::base has_one :contact_person, :dependent => :destroy accepts_nested_attributes_for :contact_person end contactperson.rb class contactperson < activerecord::base belongs_to :app end apps_controller.rb def new @app = app.new @app.contact_person.build end could please point me out whether doing incorrectly. have used nested models before have not encountered error. i supposed use @app.build_contact_person instead of @app.contact_person.build . in way, worked :)

vb.net - VB .NET Access a class property by string value -

i have function updates client in database. client object passed in, along string array of fields/properties should updated. need way of accessing each property in client object, based on in array. basically, looking vb .net equivalent javascript: var fields = ["firstname","lastname","dob"]; for(field in fields) { var thisfield = fields[field]; client[thisfield] = obj[thisfield]; } any appreciated! stack. you can use reflection this. without knowing more how data objects set up, can't give perfect example, here's general idea: dim myperson new person myperson.firstname = "john" myperson.lastname = "doe" myperson.dob = #1/1/2000# dim myupdates new dictionary(of string, object) myupdates.add("firstname", "adam") myupdates.add("lastname" , "maras") myupdates.add("dob" , #1/1/1990#) dim persontype type = gettype(person) each kvp keyvaluepair

emacs23 - Making the emacs cursor into a line -

hi have been using emacs23 time , find cool editor. not happy cursor (or point in emacs lingo) being ' little black box'. want nice thin straight line way in gedit or notepad. suggestions on how this? add .emacs file: (setq-default cursor-type 'bar)

image processing - Can we change the upload path of niceedit WYSIWYG texteditor -

i found niceedit text editor simple wanted. includes file upload plugin. uploads file imageshack. change upload path. how don't know. can set path? i found nicupload plugin , changed upload dir path... :)

json - Using JsonCpp and Qt Together (Problems with Unicode) -

i trying write c++ qt 4.7 app gets json web api. have done reading , jsoncpp seems best. built find , added project fine. void retrievinginformationpage::replyfinished(qnetworkreply *reply) { json::value root; json::reader reader; bool success = reader.parse(reply->readall().data(), root); // here issues qdebug() << qstring::fromstdstring(root["data"][30]["name"].tostyledstring()); return; } when run code, outputs name testing (it name unicode in it) special characters output complete gibberish ("à¤?à¥Ã ¤²Ã ¤¿Ã ¤«Ã ¤°Ã ¥Ã ¤¡"). unicode went in json string "\u0915\u094d\u0932\u093f\u092b\u0930\u094d\u0921", assume jsoncpp converts actual unicode characters. hoping qstring::fromstdstring take unicode in std::string , store in qstring, messing somewhere. what missing? as far can tell short @ jsoncpp documentation, library delivers strings in utf-8 encoding. convert qstrings use qstring::fromutf8 qdeb

list - Determine "wiggliness" of set of data - Python -

Image
i'm working on piece of software needs implement wiggliness of set of data. here's sample of input receive, merged lightness plot of each vertical pixel strip: it easy see left margin really wiggly (i.e. has ton of minima/maxima), , want generate set of critical points of image. i've applied gaussian smoothing function data ~ 10 times, seems pretty wiggly begin with. any ideas? here's original code, not produce nice results (for wiggliness): def local_maximum(list, center, delta): maximum = [0, 0] in range(delta): if list[center + i] > maximum[1]: maximum = [center + i, list[center + i]] if list[center - i] > maximum[1]: maximum = [center - i, list[center - i]] return maximum def count_maxima(list, start, end, delta, threshold = 10): count = 0 in range(start + delta, end - delta): if abs(list[i] - local_maximum(list, i, delta)[1]) < threshold: count += 1 return count def wiggliness(list, start, end, delta, threshol

php - PDT Eclipse searching path -

i have php project , using zend framework. there library folder zend framework , doctrine. have autocompletion zend framework classes, don't want have "todo" things in tasks window , don't want show results directories when performing searching. how configure eclipse that? using helios release. move these libs out of project folder, add them external libraries: project properties -> php include path -> libraries -> add library...

Balloon hints on Delphi app tray icon keep popping up indefinitely -

i have delphi 2006 app can minimize tray icon, , displays various alert messages via balloon hint on tray icon. under circumstances - don't know when - displayed balloon hint keeps popping , won't go away. displays length of time programmed, closes, reappears. it balloon hint app. if app displays balloon hint, 1 shows programmed time, phantom hint resumes. it if hint stuck in queue somewhere , doesn't removed. in absence of inspiration (i realise it's long shot...), know how purge balloon hints? which trayicon using? tcustomtrayicon in "vcl.extctrls" uses tnotifyicondata send popup trayicon. properties require windows vista or later. public fdata: tnotifyicondata; //winapi.shellapi procedure tcustomtrayicon.showballoonhint; begin fdata.uflags := fdata.uflags or nif_info; fdata.dwinfoflags := cardinal(fballoonflags); shell_notifyicon(nim_modify, fdata); //refresh(nim_modify); end; you can see whats going on handling messages

javascript - Advise me against using <table>! -

i'm working on javascript (using html display tech) widget framework embedded device memory consumption big deal. recently tried create table-layout using divs. mimic colspan , rowspan functionality became quite complicated, adding logic make dynamic. result came out quite layout-wise, @ cost of memory consumption (had have several js objects representing each cell , div presentation) wouldn't better use table element instead, getting col- , rowspans , layout free? since markup crated framework , user (of framework) never touches html itself. or missing here? well tables fine tabular data if want right semantically. , imo, have go best solution in situation. performance more important using div's or not in case guess.

java - What does the provided regexp match? -

i've got regex i'm not sure {1,} stands for. full regex next: ^.{1,}$ . ^.{1,}$ matches strings have atleast one of any(non-newline) character. it same as: ^.+$ the general form of limiting quantifier is: {min,max} means minimum of min repetitions not more max repetitions. you can drop max part thereby specifying lower limit on number of repetitions , no bound on upper limit: {min,} in case {1,} means 1 or more repetitions.

c# - Finally Block Not Running? -

Image
ok kind of weird issue , hoping can shed light. have following code: static void main(string[] args) { try { console.writeline("in try"); throw new encoderfallbackexception(); } catch (exception) { console.writeline("in catch"); throw new abandonedmutexexception(); } { console.writeline("in finally"); console.readline(); } } now when compile target 3.5(2.0 clr) pop window saying "xxx has stopped working". if click on cancel button run finally, , if wait until done looking , click on close program button run finally. now interesting , confusing if same thing compiled against 4.0 clicking on cancel button run block , clicking on close program button not. my question is: why run on 2.0 , not on 4.0 when hitting close program button? repercussions of this? edit: running command prompt in release mode(built in release mode) on windows 7 32 bit. err

objective c - iPhone, how can I add a first view, show once, to a mainWindow but not have a tab bar button? -

i need have view shows first before other views doesn't have tab bar button. is there way ? edit: don't want show modally want use standard function show other views , having cater different ways of showing view messy. you add tabbarcontroller in window once need , remove view it's superview discard , free memory. something like: - (void)applicationdidfinishlaunching:(uiapplication *)application { [window addsubview:viewcontroller.view]; [window makekeyandvisible]; } - (void)showtabbarcontroller { [window addsubview:tabbarcontroller.view]; [viewcontroller.view removefromsuperview]; self.viewcontroller = nil; }

c# - asp:CreateUserWizard Redirecting After Complete -

i have asp registration page using custom asp:createuserwizard. once registration completed (registeruser_createduser example) want redirect user page, welcome screen, etc... (using response.redirect(url); guess), want to, how, popup new window login page. is possible popup screen external url using method, or there way should go it? i did try creating custom button calls js function registration: function redirectafterregister() { page_clientvalidate(); if (page_isvalid) { window.open('/account/login.aspx?usercreated=true'); $('#createuserbutton').click(); } return false; } this popup works because called off click, problem popup called if creation of user unsuccessful - wrong. any highly appreciated. the problem popups work when user clicks in external sites. prevents spammers popping ads time. once function called after click considered unfriendly , therefore allowed externally. i think best let user know

php - What would cause DOMNode::nodeValue to be empty? -

i'm trying parse document domdocument, , i'm having serious problems. created script runs fine on php 5.2.9, ripping out content using domnode::nodevalue. same script fails content on php 5.3.3 - though correctly navigates proper nodes extract content. basically, code used looks this: $dom = new domdocument(); $dom->loadhtml($data); $dom->preservewhitespace = false; $xpath = new domxpath($dom); $nodelist = $xpath->query($query); $value = $nodelist->item(0)->nodevalue; i've checked make sure item(0) in fact node - it's there , of right type, nodevalue empty. the script works on documents not others (on 5.3.3) - on 5.2.9 works on documents, returning proper nodevalue. i seem have missed basic and/or bug (though if bug in php or libxml don't know). basically, issue fixed making sure data loaded loadhtml utf-8 encoded. mind you, it's not entire document needs utf-8 encoded - problem here there character in element wasn't in

properties - Java library for extended attributes, typing and validation -

background: have object model needs extended adding several attributes few types, can vary across installations. example, 'user' objects need have few extended attributes. on sites 'users' need several identifiers whereas in other sites 'users' need other attributes phone numbers, addresses , dates. prefer avoid maintaining several object models , interfaces, , instead model "extensible object properties". question: there java library can handle type definitions, providing typed property bags, methods list properties, enforce typing, validate values, convert values , string, , maybe related sql queries , form processing...? i need able define types , attributes programatically. ability load type definitions configuration files desirable. comments welcome. thank you. if right barely possible in scala trait mechanizm, interfaces may mixin in class, may contain code, don't need rewrite abstract methods times use them. trait stacko

sql server - C# MSSQL alter table then modify values -

while following work fine in sql server management studio, won't work in c#: declare @periodid bigint; select top 1 @periodid = periodid periods order periodid desc; if not exists(select * information_schema.columns column_name = n'periodid' , table_name = n'mobileplans') begin begin alter table mobileplans add periodid bigint null end begin update mobileplans set periodid = @periodid end begin alter table mobileplans alter column periodid bigint not null end end in c#, keeps telling me invalid column name 'periodid'. , after spending couple of hours searching, thought i'd ask here. while searching, came across http://bytes.com/topic/c-sharp/answers/258520-problem-sqlcommand-t-sql-transaction , couldn't translate conditional query that. why can't c# same management studio? is there way query does, works in c#? need perform on 400 databases, i'd script me. thanks in advance! sql server ver

Need to develop Stock tracker Application in Android using Google Finance API? -

i need develop stock tracker application using google finance api . searched lot same i'm unable find tutorial step step tutoring of same done. didnt find official googla finance api documentation helpful android development. can suggest tutorialfor above query? first should aware of limitations. finance api allows track given portfolio entered in google finance. allows list of positions (owned stocks) , transactions associated given google account. allows see current market value, , gains/losses of overall position. not allow querying of market price of given stock ticker or generate graphs or else along lines. essentially, api view content of http://www.google.com/finance/portfolio?action=view , nothing else. as way data, @ http://code.google.com/p/google-api-java-client/ fetch data. there samples in place. need authentication working because portfolios tied accounts. once have authentication, can pull , push updates through provided classes.

Ruby on rails - flash variable -

i'm new rails. while learning came across use of flash variable maintaining data next postback when redirecting. my questions are when should used. how rails maintain me, make round trip user , or maintained server side. if maintained server side how rails know when discard variable , prevent memory getting clogged up. any replies appreciated flash used store data (generally text) required in next request , deleted automatically after next request. flash nothing object stores in session , maintain rails (server side). rails initialize flash object , marked removal in next request gets deleted in next request.

Inserting custom html tag using javascript pasteHTML function -

i creating custom wysiwyg using editable iframe.i want add custom html tag <ino> selected text <info> some content here </info> .i have used code editor = document.getelementbyid('iframe_id').contentwindow.document; var tag='info' var range = editor.selection.createrange(); if (range.pastehtml) { var content=editor.selection.createrange().htmltext content1="<"+tag+">"+content+"</"+tag+">" range.pastehtml(content1); } this code ie.in content1 getting correct text.but in output, starting tag <info> not getting .i have created element using document.createelement('info'); how can solve problem.thanks in advance. there no html <info> element. reason code not working. if need (i can't see why would), take advantage of fact ie allows create invalid dom elements using document.createelement() , following, pastes in marker element, positions <info>

c# - My PivotViewer isn't displaying any information -

Image
i'm trying learn how use pivotviewer control silverlight. used excel tool create collection , output files folder called 'asdf'. copied folder of it's contents d: partition , here code use call collection: using system; using system.collections.generic; using system.linq; using system.net; using system.windows; using system.windows.controls; using system.windows.documents; using system.windows.input; using system.windows.media; using system.windows.media.animation; using system.windows.shapes; namespace pivottest { public partial class mainpage : usercontrol { public mainpage() { initializecomponent(); pivot.loadcollection(@"d:\asdf\my.cxml", string.empty); } } } here's screenshot of what's inside folder , in browser when running application. any suggestions on i'm doing wrong? help! my guess pivotviewer not allowed access xml file on local drive. have pu

regex - Regular Expression for recognizing non-negative values 1..99 -

i'm looking regular expression can accept value 1 99 , not accept negative values. far, have: "regex":/^[a-za-z0-9]{3}[0-9]{6,}$/, this should work: [1-9][0-9]? if want whole string number, need ^$ included: ^[1-9][0-9]?$ that depends whether whole regexp, or want part of bigger regexp.

Why is it such a mission to backup a SQL Server 2008 Express database? -

i wouldn't describe myself afraid of change - afraid of new technologies? yes indeed! technologies operating systems, database servers seem become bugged, inefficient , backward further "progress" msde 2000 (what might call "sql 2000 express" in today's world) backup [mydatabase] file 'c:\backups\mybackup.backup' sql 2008 express wait up! 'user instance' - need attach server instance wait up! attach need sql management studio express (78mb download) wait up! when login our .\sqlexpress server instance , try attach our database gives error literally looks bug in our homebrew dev project: title: microsoft sql server management studio cannot show requested dialog. ------------------------------ additional information: parameter name: ncolindex actual value -1. (microsoft.sqlserver.gridcontrol) can explain how backup user instance of sql server 2008 express database in t-sql code? (sorry if comes ac

sql server - TSQL logging inside transaction -

i'm trying write log file inside transaction log survives if transaction rolled back. --start code begin tran insert [something] dbo.logtable [[main code here]] rollback commit -- end code you log before transaction starts not easy because transaction starts before s-proc run (i.e. code part of bigger transaction) so, in short, there way write special statement inside transaction not part of transaction. hope question makes sense. use table variable (@temp) hold log info. table variables survive transaction rollback. see this article .

java - Have to use a thread sleep procedure to get document updated -

i have word macro needs run using java. use vb script run macro below. editing in word document , use "test.doc" read inputstream . have sleep main thread while document changes in "test.doc" file (varies time needed thread sleep time document document). shown in code. bit confused because wait process end. , still document not updated? can please me here? process proc = runtime.getruntime().exec("cmd /c start c:\\test.vbs"); proc.waitfor(); thread.currentthread().sleep(2000); inputstream uploadedfilestream = new bufferedinputstream(new fileinputstream("c:\\test.doc")); get rid of "start", created instance of word doesn't run in background, , sleep unnecessary.

javascript - Writing to .innerHTML doesn't work when served from webserver but works when browsed as a file, what could be causing this? -

i'm using mootool's request.json retrieve tweets twitter. after receive it, write .innerhtml property target div. when test locally file, i.e. file:// in url, see formatted tweets on webpage. when serve local webserver, i.e. http://, formatted tweets not showing in div. what causing this? (i've tested in safari , chrome on osx...same behavior) i've included code that's head section of page. also, when debug javascript in safari: "typeerror: result of expression 'data' [undefined] not object" appears oncomplete callback function declaration. <script type="text/javascript" src="js/mootools-1.3-full-compat.js"></script> <script type="text/javascript" src="js/jquery-1.4.3.js"></script> <script type="text/javascript" src="http://twitterjs.googlecode.com/svn/trunk/src/twitter.min.js"></script> <script type="text/javascript"> var j