Posts

Showing posts from June, 2013

android - Radiobutton dynamically -

i have edittext depending on number given in edit text have create radiobutton im getting error code public void oncreate(bundle icicle) { super.oncreate(icicle); // todo add gui initialization code here setcontentview(r.layout.main); go=(button)findviewbyid(r.id.go); no=(edittext)findviewbyid(r.id.noofradio); err=(textview)findviewbyid(r.id.err); go.setonclicklistener(new onclicklistener() { public void onclick(view arg0) { try { int = integer.parseint(no.gettext().tostring()); radiogroup radiogroup = new radiogroup(mainactivity.this); linearlayout.layoutparams rg = new radiogroup.layoutparams( radiogroup.layoutparams.wrap_content, radiogroup.layoutparams.wrap_content); (int = 0; < a; i++) { radiobutton = new radiobutton(mainacti...

cocoa touch - UITableViewCell - overlapping with previous cells contents -

Image
i have wierd problem table i have 20 cells display each cell 84px in height when click no cell, have set background colour the first 4 cells ok, when scroll down , click on 5th cell, content of each cell starts overlap other content, content 1st 4 cells. i belive cell reusability or drawing issue. not sure how solve it, have checked through code, not changing cell's content on touch. here code , add pics - (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { return 104; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { return [stores count]; } -(uitableviewcell *)tableview:(uitableview *) tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; cgrect label1frame = cgrectmake(5, 5, 250, 30); cgrect label2frame = cgrectmake(6, 42, 220, 20); cgrect label3frame = cgrectmake(6, 62, 220, 20); ...

javascript - How do I detect that all frames have returned responses from a contentscript in a Chrome extension? -

i want chrome extension rerun contentscript open tabs prior viewing popup window gather recent data each webpage (it sends message background page). problem in order full access each iframe, need set allframes true. means prior showing popup window, need wait until have received message each frame. my problem not sure how determine how many frames there are. 1 approach looked @ detect frame count within contentscript, there open bug indicates can't request right now. wait number of responses equivalent got when first navigated page, possible due ajax calls number of frames increased since then. finally, hoping response chrome.extension.sendrequest include such information not. your appreciated. i suggest run content script manifest, content script run every time new frame loads. then, have content script open port extension, every open frame has port background. it's background page keep track of open ports each tab, , send messages desired ports.

JQuery (UI): Javascript Variable convert to PHP Variable -

first of all.. possible? work&create var in javascript (jquery ui framework) , when click on "submit" button of form should variable? html & javascript (jquery ui): <script> $(document).ready(function() { var slider1 = $( "#slider1" ).slider( "value" ); var slider2 = $( "#slider2" ).slider( "value" ); }); </script> pseudo: html & php: <?php echo slider1 ?> how can echo value of #slider1 ?? you cannot assign variable javascript php, can set javascript variable form input element before send form, can values via $_post or $_get (or $_request) superglobal arrays, based on method (). http://php.net/manual/en/reserved.variables.get.php http://php.net/manual/en/reserved.variables.post.php for example: javascript: $(document).ready(function(){ var test = "test"; $('#someinput').value(test); }); html: <form action="some...

jquery - looping through hidden fields within a php while loop that are in a table row -

how know hidden field should fetch value given button clicked adjacent hidden fields. button in while loop hence giving rise list of buttons , hidden fields. each button has hidden field adjacent it. i want use jquery ajax insert data hidden field table in db wen loop through buttons find out 1 clicked, works problem comes in wen loop through hidden fields, gets value of last hidden field. how value of hidden field adjacent button clicked? appreciate help. thanx in advance. <table id="list_tb"> <?php while($rows=mysql_fetch_assoc(ordersql)) { ?> <tr> <td><?php echo $rows['name'];?></td> <td> <form> <input type="submit" name="add_btn" id="add_btn" value="add"/> <input type="hidden" name="order_id" id="order_id" value="<?php echo $rows['order_id'];?>"/> </form </td> </tr> <?php } ?> </ta...

How to use push notification in titanium for Android -

i have worked in android , got small apps in android. newly working in titanium. i stuck on how push notification in titanium android? problem little worse. need push notification versions of android. google providing c2dm v2.2 , above. got know urban airship not sure used in titanium. use urban airship need install seperate app not recommended. support highly welcomed. please response possible. in advance. rai, it's not form ask, essentially, same question in multiple ways. need read on titanium api, answered in how write android code in titanium

iphone - Different options to make payments inside an Application -

i exploring options enable user make payments within application.right aware of 2 options through user can make payments within app. 1 in-app purchase (already implemented). 2 pay pal (exploring). so there other way implement purchases. links , apis ,advices welcomed... ps: intend release app on app store. cheers. i can tell you, in-app purchases paypal no go, find out :) apple accept payment such activities through in app purchases, no other methods of payment allowed. there workaround these type of purchases (especially paypal); them not within app mobile safari. work , (for now) accepted method used more applications.

Confirmation box using jquery -

i want make confirmation before delete data how can make using jquery? $('#deletebtn').click(function() { if(confirm("are sure?")) { //delete here } });

c# - Merge Dictionary<TKey, TValue> with Enumerable.Union method -

i'm testing union method merge dictionaries (of type dictionary). works fine tvalue type string or int or object. if tvalue type collection (tested list , object[]) exception thrown : "argumentexception: item same key has been added." here code : dictionary<int,string> _dico1 = new dictionary<int, string>() { {0, "zero"}, {1, "one"} }; dictionary<int,string> _dico2 = new dictionary<int,string>() { {1 , "one"}, {2 , "two"}, {3 , "three"}, {4 , "four"}, {5 , "five"}, {6 , "six"} }; dictionary<int, list<string>> _dico3 = new dictionary<int, list<string>>() { {0, new list<string>{"zero"}}, {1, new list<string>{"one"}} }; dictionary<int, list<string>> _dico4 = new dictionary<int, list<string>>() { {1, new list<string>{"one"}}...

Use Google Gears geolocation from a python app -

i'd use google geolocation api in app, written in python. problem google provides json interface (easily useable python) http://code.google.com/p/gears/wiki/geolocationapi see api "is published allow developers provide own network location server use through gears api. google's network location server used through gears api. see section 5.3 of gears terms of service @ [address] ." it strange thing: there cool json cannot use it. have use through google gears instead. how can python app? for example, see geolocation service provided firefox calls directly json api. why ff able that? thanks, alessio palmero aprosio google has deprecated gears entirely , geolocation feature standard in modern browsers (for values of "standard"). the pylocation module may provide information need. can output geolocation data in text, json, or xml.

visual studio 2010 - WPF : Space key problem when using a Custom Markup Extension in VS2010 -

we developed localization solution using custom markup extension in vs 2008. at time, used way : <textblock text={utilswpf:intl key=objectname.propertyname, defaulttext=default name} /> (notice space in defaulttext). (notice how text-color tool of stackoverflow changes color of words well). but works fine , compiles without problem. in vs 2010 though, whenever try type space using way of implementing markup extension, ide adds comma you, gives : <textblock text={utilswpf:intl key=objectname.propertyname, defaulttext=default, name} /> of course, doesn't compile anymore... one solution implement markup extension other way : <textblock> <textblock.text> <utilswpf:intl key="objectname.propertyname", defaulttext="default name"/> </textblock.text> </textblock> but adds lot of lines , don't have 1 textblock can imagine... another solution not type space, copy space , paste (which sti...

java - Cannot find symbol: method add -

why receiving following error: cannot find symbol: method add ? code: import java.util.* public class arraylist { // instance variables - replace example below own public void processinput(string s) { int[] = { 34, 25, 16, 98, 77, 101, 24 }; arraylist b = new arraylist(); (int = 0; < a.length; i++) { int d = a[i]; if (d % 2 > 0) { b.add(new integer(d)); } } (int = 0; < b.size(); i++) { system.out.print(b.get(i) + " "); } (int = a.length - 1; >= 0; i--) { system.out.print(a[i] + " "); } } } how can resolve error? reading question again, assume missing import java.util.*; at start of class. way getting error. btw should getting error "cannot resolve symbol arraylist" tells problem is. change last loop for(int = a.length-1; >= 0; i--) { with experience able read...

xml - Any idea how these lat/lon pairs are formatted? -

i got snippet part of gpx data, can't figure format lat/lon pairs though... <rte><number>0</number><name>0</name><cmt>2.10000000000e+001</cmt> <rtept lat="151234.04567902" lon="982651.91230503"></rtept> <rtept lat="151172.75643152" lon="982728.52370036"></rtept> <rtept lat="151172.75643152" lon="982835.49986435"></rtept> <rtept lat="151195.41944394" lon="982998.67473486"></rtept> <rtept lat="151217.32983318" lon="983156.42868444"></rtept> <rtept lat="151163.84175119" lon="983446.15612336"></rtept> <rtept lat="151128.18302986" lon="983713.59653336"></rtept> <rtept lat="151119.26834951" lon="983945.37855011"></rtept> <rtept lat="151118.97110602" lon="983947....

jquery - Is it possible to create sign up possibility without PHP? -

is possible create sign possibility without php? made application jquery, , want users able sign , save there input. possible without php? thanks in advance web applications consists of 2 sides. server , client, server stored in host in remote computer while client request them our desktop. php server side programming language (that runs on server) while javascript client side language(runs on our computer). if want create alert message php then cannot. cannot store data on sever javascript because runs on computer. data sent server request , manipulated on browser css , javascript. (you are able see browse page extention .php though don't have php installed on computer. beasuse server has php compiler) now if want create sign then, need store data in server (because data has available), , javascript on run on server. need server side language. there lots of languages server side scripting , , can choose of them mentioned above. important thing need 1 ...! ...

Trigger hudson build when svn commit -

i have set version control system (subversion) going used developers commit , update code (let's address https://server/svn/project ). mention authenticated users able have access project's svn. on other hand, have installed hudson server project's continuous integration server (address of project server:8080/job/project ) , following: hudson builds triggered automatically when there svn commit. mails sent respective developers (the ones committed code) when committed code doesn't build. (meaning when user commits code doesn't build, user email notification) just mention have set matrix-based authorization hudson users, because don't want open anyone. i have seen suggestions post-commit hooks, none of them worked until now. can suggest me in both issues? specific steps appreciated. according "building software project # builds changes in subversion/cvs" , hudson needs poll svn repo in order detect changes , trigger build. ...

excel - How can I run a Macro when the value in a specific cell changes? -

let me preface saying new vb... i trying run macro whenever value in cell changes. i've read on how this, can't seem work. have entered following code private module of worksheet object: private sub worksheet_change(byval target range) if not intersect(target, target.worksheet.range("$c$5")) nothing application.run _ "'amex payments_experiment.xlsm'!selectcells" end if end sub c5 cell trying monitor change. "selectcells" macro want run. "amex payments_experiment.xlsm" name of file. when change value in c5 nothing happens. great. thanks! update: cyberkiwi - no, not how did it, when follow you're instructions find code should be. private module of worksheet object right clicked sheet tab @ bottom, selected "view code", selected "worksheet" dropdown in top center of page. user587834 - yes. macro's enabled. any other suggestions? if use e...

css - Major problem with 100% height div -

Image
/* left menu */ .leftmenu{ width: 200px; border:2px solid green; float:left; background-color:#c0c0c0; } /* main content area */ .mainbox{ border:2px solid red; background-color: #ffffff; } .mainwrapper{ border:2px solid white; } with <div class="mainwrapper"> <div class="leftmenu"> left </div> <div class="mainbox"> main<br /><br /><br /><br /><br /> </div> <div class="clear"></div> </div> how blazes left menu extend bottom? please note i've tried faux columns don't work white main box @ front reason. what this? http://jsfiddle.net/ph3t2/ i've added postion:absolute , top:0 , bottom:0 leftmenu i've given mainbox padding-left: 205px i've given mainwrapper position:relative feel free add content mainbox see leftmenu grows well. to finish off...

utf 8 - MySQL charset needed -

i'm developing application native language learning. need store characters 'ẽũ'. database set utf-8 charset default collation, table affected characters. the problem when try add row using regular sql insert: insert text(spanish,guarani) values('text','ẽũ'); this throws warning: warning code : 1366 incorrect string value: '\xe1\xba\xbd\xc5\xa9' column 'guarani' @ row 1 and result "??" there characters. question: these characters not covered utf-8 charset? 1 need? note: same problem latin-1 thanks. quick !!! read http://www.joelonsoftware.com/articles/unicode.html it required reading. once have read that, should ask yourself: what encoding connection using. what locale collation using. (if applicable). what encoding sql statement in? what encoding string literals in? what encoding html form presented in?

Jquery validation is not working chrome version- 4.0.249.30 -

jquery validation not working in chrome (4.0.249.30) external site,but works our local machine. sorry,i can`t solution.but worked after re-installation of chrome (4.0.249.30) thank all

asp.net - Cache and outputcache -

what difference between property cache , outputcache directive? cache can put data - stuff coming database, or result of expensive calculation, example. in cache should available users. outputcache caches html - entire page, or output user control.

javascript - OnKeyDown and String.FromCharCode -

i've question concerning onkeydown event. onkeydown event gives keycode don't know kind of code given. basically, using string.fromcharcode method real character thought ascii-code. worked fine until tried numbers numpad. if type '2' using key above 'w' that's ok, '2' numpad keycode given 98 (which 'b' ascii code). i looking @ page , there's same problem. example supposed prevent user typing numbers. works fine numbers on top of first character (for lack of better name), can type numbers using num pad. do have idea problem is? (is ascii code ? using wrong event ? )... thx... to prevent numbers use onkeypress instead: onkeypress="return preventdigits(event);" ... function preventdigits(evt) { evt = evt || window.event; var keycode = evt.keycode || evt.which;7 var num = parseint(string.fromcharcode(keycode), 10); return isnan(num); } live example: http://jsfiddle.net/yahavbr/vwc7a/

parsing - XQuery: extract number from string to use in comparison -

i new xquery, , frankly find learning curve incredibly steep. i have xml structure looks this: <root> <product> <size>500 units</size> </product> <product> <size>1000 units</size> </product> <product> <size>unlimited units</size> </product> </root> i need write xquery statement returns nodes numerical value in size less 1000. somehow need determine numerical value (ignoring text) perform 'le' operation assume. on top of this, there possibility node have no digits @ (e.g. 'unlimited units'), in case needs treated having value of 1000000. is there way this? i've tried various combinations of fn:replace(blah, '\d', '') , casting xs:int, can't seem work. any guidance appreciated. use xpath 1.0 expression : /root/product[not(number(substring-before(size, ' ')) >= 1000)] as know we...

css3 - IE9 problems with css such gradient background and rounded corners and shadow -

i use gradient background color selected or hovered menu items works fine in chrome,ff,opera,ie7,ie8 . in ie9 background of elements appears in right of element text keeps in place first problem. the second problem faced rounded corner works fine in chrome, ff, opera in ie9 corners ok background of box image appears white!!! the third problem of shadow apply shadow divs containing images works fine in browsers ie9 offset whole div instead of applying shadow , opacity change on mouse on increased problem adding black parts in side of div doesn't have shadow??????? when heard ie9 supports css3 knew unbelievable ie still nightmare!! i'm afraid of future appearance of website in ie 9 add <meta http-equiv="x-ua-compatible" content="ie=7.5"/> when used ie=7 or ie=8 problem still know appears better after adding line no support rounded corner. how telling ie9 implement corners , gradients? using ie filters (like assume you're using ...

php - Access codeigniter controller from command line -

i'm playing around ci around php cli. i'm able access whole ci structure via global variable $ci (followed tutorial here http://codeigniter.com/wiki/dip_into_ci/ ) $ci = new $class(); $ci -> load->view ('header'); now works good, don't know how access controller thru $ci variable. let's have controller called main(); i'd able : $ci->main->myfunction($params); must real simple can't figure out that's possible little crazy. use codeigniter reactor. controllers can respond command line perfectly. https://bitbucket.org/ellislab/codeigniter-reactor php index.php controller method param1 param2 works routing , everything.

php - Is a database the best choice to store data for my web app? -

after made this question decided best store data on own server. data in table 100-500 rows , 12 columns. newbie programmer developing first web app javascript , php , looking best solution store , retrieve data. have no needs make complicated queries, need retrieve each row of data based on content in 1 of columns. i considering database purpose, have no experience databases don't know if best solution needs. when content in csv format don't know if better save way on own server or saving database. on client request tranform data using php , send json. is database best solution web app? or should stick csv files? if database best choice, please point me tutorial, example or book started? thanks in advance. database best solution. if trying pick out individual rows in csv file, there quite overhead in parsing whole file, @ little piece of information. databases on otherhand far more efficient @ this, , in fraction of time. if using php, common databa...

android - transparent activity's full screen on 2.3 -

i using xml style: <style name="theme.transparent" parent="@android:style/theme.translucent.notitlebar"> this showing tansparent layout full screen, no title bar or status bar on top in android 2.1 , 2.2. however, when tested application on 2.3, same activity showing home screen status bar on top (battery etc). i had enter these lines java code oncreate: requestwindowfeature(window.feature_no_title); getwindow().setflags(windowmanager.layoutparams.flag_fullscreen, windowmanager.layoutparams.flag_fullscreen); to remove status or title bar top. can shed light why difference between 2.2 , 2.3? you can set theme to: <style name="theme.transparent" parent="@android:style/theme.translucent.notitlebar.fullscreen">" and should hide both title bar , fullscreen in every version.

visual studio 2008 - multithreading dispute on local variables -

i had implemented few methods being handled individual background threads. understand complexity of doing things way when tested results seemed fine. each thread accesses same variables @ times , there maximum of 5 threads working @ given time , guess should have used synchlock question whether there can way threads have been executing processes without overwriting variable contents. under impression each thread allocated site in memory variable , though named same, in memory different location mapped specific thread, right? if there collisions should getting error cannot access variable if used thread. am wrong on this? if talking local variables of function - no, each thread has own copy of on stack. if talking member variables of class being accessed different threads - yes, need protect them (unless read-only)

c# - Windows Forms Force everything half screen and put my form on top -

i know how put form on top, i'm striving more specific behavior: want window on top of screen, forcing other windows half screen. illustrate want, open windows magnifier tool , dock top of screen. does know how achieve this? hints or nudges in right direction welcome :) thanks !! there artice covers here - http://www.codeproject.com/kb/shell/csdoesshell3.aspx the article contains finished library can used in own application.

php - Multiple Loops in WordPress. Second loop not resetting -

i've created custom post type custom fields inside wordpress. created new page template runs through loop , works great. i'm trying add similar loop home page's sidebar doesn't work correctly. first, working code on own page template. <h2>upcoming events</h2> <?php $todaysdate = date('y/m/d'); $event_query = new wp_query('post_type=events&posts_per_page=-1&post_status=publish&meta_key=event_date&meta_compare=>=&meta_value=' . $todaysdate . '&orderby=meta_value&order=asc'); ?> <ul id="featured_event_list"> <?php if ($event_query->have_posts()): ?> <?php while ($event_query->have_posts()) : $event_query->the_post(); ?> <li> <h3><?php the_title(); ?></h3> <p> <?php if ( get_post_meta($post->id, 'event_featuring', true) ) : ?> <strong>featuring:</strong> <?php echo get_post...

sql - C# MySQL claims a field is too long -

here's sql: create table patients ( patient_id int auto_increment not null, last_name varchar(64) not null, first_name varchar(64), sex char(1), birth date, death date, primary key (patient_id) ) engine=innodb; and here's c#: mysqlcommand insertcom = new mysqlcommand("insert patients(" + "last_name, first_name, sex, birth) values" + "('@lastname', '@firstname', '@sex', '@birthdate')", connection); /* ... */ insertcom.parameters.add("@lastname", mysqldbtype.varchar, 64); insertcom.parameters.add("@firstname", mysqldbtype.varchar, 64); insertcom.parameters.add("@sex", mysqldbtype.char, 1); insertcom.parameters.add("@birthdate", mysqldbtype.date); insertcom.parameters["@lastname"].value = lastnam...

mysql - Shared Primary Key -

i guess semi-common question can't find in list of past questions. have set of tables products need share primary key index. assume following: product1_table: id, name, category, ...other fields product2_table: id, name, category, ...other fields product_to_category_table: product_id, category_id clearly useful have shared index between 2 product tables. note, idea of keeping them separate because have largely different sets of fields beyond basics, share common categorization. update: a lot of people have suggested table inheritance (or gen-spec). option i'm aware of given in other database systems share sequence between tables hoping mysql had similar solution. shall assume doesn't based on responses. guess i'll have go table inheritance... thank all. it's not common, no. there no native way share primary key. might in situation this: product_table id name category general_fi...

php - XDebug installed but not working -

i have downloaded latest xdebug windows machine running wamp , php 5.3. after following install instruction , restarting services, appears installed according php info: xdebug xdebug support => enabled version => 2.1.0 however, if try use following in script: xdebug_start_trace('c:\test.txt'); i error: fatal error: call undefined function xdebug_start_trace() i what going on? thanks, jonah wampserver has 2 php.ini files, 1 apache web pages, 1 cli. make sure you've edited correct one. the c:\wamp\bin\php\php5.3.0\php.ini cli. webpages there's @ c:\wamp\www\bin\apache\apache2.2.11\bin\php.ini

Java array question -

sorry, silly question here, have googled search seems returning methods of using binary search etc., need simpler. i have array of languages. creating scanner, asking input. trying make if language input user isn't in array, displays error , asks again. should simple, have drawn blank. can please ? here have far ! scanner scan = new scanner(system.in); language = scan.next(); while( language not in array languages) { system.out.print("error!"); language = scan.next(); } i understand question better now. should use set sure. want use contains() method of set check if language exists. scanner scan = new scanner(system.in); language = scan.next(); while(!set.contains(language)) { system.out.print("error!"); language = scan.next(); } old answer, still relevant info though: yo want use set collection type. set not allow duplicate entries. javadocs: a collection contains no duplicate elemen...

Rest API : passing the window.location.href in the REST uri -

i have rest api used trough jsonp due cross domain issues , i've implemeted errorlogger catches every error happens on page , posts server uri error logger : user/{userid}/message/{errormessage}/browser/{browser}/browserver/{browserver}/secure/{secure}/os/{os}/location/{location}" the location variable problematic , how can pass window.location.href in uri ? i've tried escape,encodeuri,encodeuricomponent have base64 ? escaping sequence uris defined in section 2.4.1 of rfc2396 (uniform resource identifiers): an escaped octet encoded character triplet, consisting of percent character "%" followed 2 hexadecimal digits representing octet code. example, "%20" escaped encoding us-ascii space character. escaped = "%" hex hex hex = digit | "a" | "b" | "c" | "d" | "e" | "f" | "a" | "b" | "c" | ...

Difference between Hooks and Abstract Methods in Java -

this quoted question study materials university. it makes totally no sense me. for me hooks specified points in (mostly sequential not only) programs, can specify own methods or callbacks executed. for example application has "on before shutdown hook", can register callback method there saves user data disk before shutdown. abstract methods self explaining. to me different? or either of things have 2nd meaning don't know of? did quick search didn't find anything. personally, go professor , ask clarification before asking stackoverflow community. ...but, being said, believe (if description of hook correct) class can register callback method hook whereas abstract method forces child class implement own algorithm given method.

Can I customise the UIAlertView [iPhone iOs 4]? -

i try run sample customise uialertview doesn't work. http://joris.kluivers.nl/iphone-dev/?p=customalert i change background image of uialertview. can it? thanks i have customized uialertview before, broke when new os released (4.2, specifically). recommend implementing own custom view instead of trying customizing uialertview.

asp.net mvc - After installing MVC3, I can't create or open projects for MVC2 on visual studio 2010 -

opening mvc2 projects makes "project not supported" error on visual studio, , can't find template creating new projects mvc2. i undertand mvc2 new project template not desired after installing mvc3, support editing , maitaining mvc2 projects should still there. in release notes states: asp.net mvc 3 can installed side side asp.net mvc 2 on same computer, gives flexibility in choosing when upgrade asp.net mvc 2 application asp.net mvc 3 i know have mvc1, mvc2 , mvc3 dlls "side side" on gac, i'm still hoping visual studio error error in setup. if not, ¿is possible upgrade project file , keep contents same, pointing mvc2 dll? to answer own question after few attempts: yes, possible upgrade project without altering mvc2. apply step 8 of manual migration procedure on release notes mvc3: 8- locate projecttypeguids element , replace {f85e285d-a4e0-4152-9332-ab1d724d3325} {e53f8fea-eae0-44a6-8774-ffd645390401}. a...

visual studio 2010 - Is It Possible to do Context/Specification Testing With MSTest? -

i'm moderately new test frameworks , have been reading on moq , this introductory post used way of organising tests had not seen before. further research shows in .net world tend meld terms bdd , context/specification (cs) testing. don't want argument - interested in achieving style of writing test classes. this article shows approach again , makes explicit use of base class allows construct our specification through test framework. this issue have cannot see instance method under mstest allow test fixture initialised once each test. best can see constructor of test class feels bit wrong. in nunit 1 use [testfixturesetup] . there equivalent using visual studio's built in test framework? edit i've subsequently moved nunit provides flexibility require. after investigation have moved using nunit. there several reasons preferring nunit on mstest but, regards particular issue, compelling reason class-wide initialisation method supported mstest (th...

mod rewrite - Mod_Rewrite for CDN -

i need mod_rewrite rule re-direct references in our web app cdn url instead of loading images /img on localhost. have sample mod_rewrite code snippet accomplish this? much! john proxypass , proxypassreverse friends proxypass /img/ http://cdn/imageslocation/ proxypassreverse /img/ http://cdn/imageslocation/

c# - Array evaluation -

newbie c#, programming in ninjatrader , need develop simple function performs following: i need check see if stocks high price higher price before, done indexing. such high[0] > high[1] (as 0 being current price). if current price higher needs set indexed variable (array guessing) if high[0] > high[1] variable = high[0]. the next evaluation , stuck how evaluate if current high price greater each element in array. meaning price increasing. once price no longer increasing output of function need highest of high prices in array. thanks can help! ben 3) if (high.all(x => currenthighprice > x)) { ... } 4) var highest = high.max(); but both options use linq . if that's not option, use for/foreach loop.

WPF XAML Button Click handler in InlineUIContainer problem -

i've got flowdocument has elements so: <inlineuicontainer> <button click="button_click" tag="123456789890"> <image source="images\image1.png" /> </button> </inlineuicontainer> this stored off in .xaml file , gets loaded @ point doing so: flowdocument = xamlreader.load(xamlfile, parsercontext) flowdocument; flowdocumentreader.document = flowdocument; the loading fails following error: xamlparseexception - failed create 'click' text 'button_click' the button_click method 1 exists within mainwindow in flowdocumentreader resides , idea tag of button has identifier (inventory id) , click handler inventory id. if flowdocument in mainwindow.xaml, everything's fine button_click event handler suspect when loads file disk, knows nothing handler. how can resolve this? ideas? update while think pavlo's solution work, ended doing following , seems work rather well. in flo...

html - about css ul properties -

if specify like .a ul{} .a ul li{} and .b ul{} .b ul li{} will properties of ul in .b totally separated properties of ul of .a ? or common? i want the styles of ul stays totally separated style of ul in .b without using div id . thanks. as long ensure in html don't have class="a" elements inside class="b" elements or vice versa, selectors apply separate <ul> . they common <ul> s in both .a , .b if: you group selectors, this: .a ul, .b ul {} .a ul li, .b ul li {} you declare exact same style rules both selectors in html, <ul> contained within elements of both classes (whether it's class="a b" or .a inside .b or .b inside .a ), example: <div class="a b"> <ul><li>item</li></ul> </div> <div class="b"> <div class="a"> <ul><li>item</li></ul> </div> </div> ...

Hibernate JBOSS JNDI Configuration -

currently have application configured hibernate , jndi runs on tomcat server. have been tasked moving web application jboss 5.1. have done following far: removed hibernate-3.2.1.ga.jar , hibernate-annotations-3.3.0.ga.jar , , hibernate-commons-annotations-3.3.0.ga.jar web application want deploy. i have added ojdbc.5 jar /default/conf/lib directory. i have following web application files configured so: file1: hibernate.cfg.xml <hibernate-configuration> <session-factory> <property name="hibernate.connection.datasource">java:comp/env/jdbc/ldcdatasource</property> <property name="hibernate.dialect">org.hibernate.dialect.oracledialect</property> <property name="hibernate.current_session_context_class">thread</property> <property name="hibernate.show_sql">true</property> <property name="hibernate.format_sql"...

javascript - jQuery slideDown slideUP - hide button -

i trying write simple slide , slide function hides buttons after pressed, have little javascript skill , surely doing silly. what not working, when user presses cancel menu should slide , show button should reappear. heres code <html> <head> <style> div {margin:3px; width:130px; height:30px; display:none;} </style> <script src="http://code.jquery.com/jquery-1.4.4.js"></script> </head> <body> <button id="show" onclick="this.style.visibility = 'hidden';">show</button> <div><input type="text" size="20"/></div> <div><input type="text" size="20"/></div> <div><button id="submit">submit</button> <button id="cancel">cancel</button></div> <script> // sliding menu down $(document.body).click(function () { if ($("div:first").is(":hi...

Ruby regex: extract text between quotes -

what best way quoted words / phrases out of text? this attempt not work properly: text.scan(/\"([^"]+)/) i think want: text.scan(/"([^"]*)"/) it works in rubular .

Rails 3 / Setting Custom Environment Variables -

i trying create rails application assigns 1 value variable when environment development environment, , value same variable when environment production environment. want specify both values in code (hardwired), , have rails know value assign variable based on environment running. how do this? in case important, later access variable , return value in class method of model. you can initializers. # config/initializers/configuration.rb class configuration class << self attr_accessor :json_url end end # config/environments/development.rb # put inside ______::application.configure block config.after_initialize configuration.json_url = 'http://test.domain.com' end # config/environments/production.rb # put inside ______::application.configure block config.after_initialize configuration.json_url = 'http://www.domain.com' end then in application, call variable configuration.json_url # app/controller/listings_controller.rb def grab_json...