Posts

Showing posts from September, 2011

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

css - Html table specify columns width in px does not work -

i'm trying make ajax columns-resizable table, interface works fine, when resize columnns, browser enlarges table @ max 100%, resizing other columns. i've tried both 2 solutions no 1 works well: 1. min-width: 100%; table-layout: fixed; width: 100%; with solution, need resize single column before going (if necessary) on 100%; if enlarge 1 column, example, others columns restricted, not maintain original width (as would) 2. table-layout: fixed; any ideas? edit: relevant html code: <table class="resizable" id="tabelladati" ><thead> <tr> <th id="mdt_thid"><span>id</span></th> <th id="mdt_thtext" style="width: 146px;">text</th> <th id="mdt_thtitle" style="width: 148px;">title</th> <th id="mdt_thcssclass" style="width: 83px;">cssclass</th> <th id="mdt_thurl" sty

java - Exposing C++ program as a Web Service -

how expose c++ program web service? or better idea invoke c++ java , expose resultant java web service. in case, c++ program should not undergo changes. interestingly, webservices work on http protocol, means can't "host" webservice written in c++ without having http server. since each web server have it's own mechanism of writing "hooks" or extensions, next obvious question web server chose. let's want iis on windows. it's possible use isapi extensions; need know how write one, complies web services standards. or, alternatively, it's better learn how in c++ visual studio, have lots of built-in stuff started . in short, there no "standard" way of exposing web service in c++ , have "platform" specific. windows iis has 1 way of doing it. apache axis c++ has another.

python - Getting started with Django on Amazon Web Services -

i'm starting migrate few applications amazon web services. applications python/django apps, running on mysql. i plan on using ec2 , ebs starters. i'm looking few things: a step-by-step tutorial explaining how deploy django on aws. i've looked around, tutorials 2 years ago, i'm worried they're outdated. i'm trying understand, ami should start? know there's bitnami ami comes preconfigured django goodiness, i've seen lot of other sources should start basic (clean) linux box , install yourself. why? are there other important things should thinking about? have little sysadmining experience (the apps on webfaction), i'm not sure should thinking about. a few points: i plan on running several applications on same ec2 instance, assume that's possible? i'm using virtualenv separate between various apps right now, assume can continue doing same on ec2 instance? thanks! there nothing "special" ec2 here. provides

How to implement Authentication and Authorization in Asp.Net 4.0? -

could 1 suggest me best sites learn authentication , authorization roles sample code ?because beginner security system in asp.net. tutorials here informative , in detail sample code. http://www.asp.net/web-forms/security (including videos) http://www.4guysfromrolla.com/articles/120705-1.aspx there aren't major changes in 4.0 in terms of authorization , authentication. tutorial 2.0+ should fine.

css3 multiple backgrounds - shorthand for gradient and image -

is there way use both gradient & image background shorthand ? have tried: backround: url(image_path) no-repeat top left, gradient - doesn't seem work. loreley: doing right. here demo: http://jsfiddle.net/ggulm/ the gradient syntax quite delicate, , if wrong fail entirely. test gradient, , add image later. a practice in stackoverflow sharing specific piece of code able pinpoint exact source of problem.

java - Android: Creating a custom container-view -

i'm trying create custom view (or better, layout) in android, serves container 2 child views (think of bar separates 2 containers vertically, can swiped , down). i'd use layout in xml, can nest views in it. thought of that: <view class="at.calista.quatscha.views.swipebarlayout" android:id="@+id/sbl" android:layout_width="fill_parent" android:layout_height="fill_parent"> <!-- top view --> <button android:text="top" android:id="@+id/button01" android:layout_width="wrap_content" android:layout_height="wrap_content"></button> <!-- bottom view --> <button android:text="bottom" android:id="@+id/button02" android:layout_width="wrap_content" android:layout_height="wrap_content"></button> </view> this xml should

iphone - cocos2d change sprite texture with animation -

i want change sprite texture dynamically within animation.here code.. smiletexture=[[cctexturecache sharedtexturecache] addimage:@"monkey-smile_pad.png"]; angrytexture=[[cctexturecache sharedtexturecache] addimage:@"monkey-angry_pad.png"]; and change texture of sprite _monkeyone this.. _monkeyone.texture=smiletexture; and change sprite texture successfully.....but it's instant....i want change within animation duration..... can me...?? check cocos2d sprite tests. find examples of how animate sprites in there.

routing algorithm different to Dijkstra-concept -

what kind of routing algorithms exists different different dijkstra-concept? dijkstra (and a*,d*, bellman forge etc.) use concept: best node known nodes, expand , save results known nodes. are there concepts fundamental different? bellman-ford fundamentally different. uses dynamic programing instead of dijkstra greedy approach , works graphs negative weight edges.

Rails 3: Social Stream Gem. Where is the code? -

i've installed social_stream according readme ( https://github.com/ging/social_stream ) , works fine, however, i'd have code in app/ directory , code isn't there. the same question arises devise , other gems. when install it, i'd have access controllers, models, views, etc seems nothing in app/. what have in order put code there , being able change i'd like? or, access in other folder. thank you here url explain how change views https://github.com/ging/social_stream/wiki/how-to-change-controllers%2c-models-and-views

iphone - Restarting animation when I touch a button -

i need restart animation when click button. this code of animation: imgstar.frame = cgrectmake(205, 6, imgstar.frame.size.width, imgstar.frame.size.height); [uiview beginanimations:nil context:null]; [uiview setanimationduration:1.5]; [uiview setanimationdelegate:self]; [uiview setanimationdidstopselector:@selector(animationfinished:finished:context:)]; imgstar.transform = cgaffinetransformmaketranslation(-4, 340); [uiview commitanimations]; the problem that: when re-click(click second time) button animation don't work! can me, please? i found problem. error imgstar.transform. try use code: [imgstar setframe:cgrectoffset([imgstar frame], -4, 340)]; instead of imgstar.transform = cgaffinetransformmaketranslation(-4, 340); and work!!

c# - stackoverflow exception was unhandled -

in code below should multiply 2 numbers. works 3 , less 3 digits numbers when give numbers 4 digits or bigger gives runtime error: stackoverflow exception unhandled . i've commented problem is. thought problem defining variables in int , changed them in long problem still exists. mistake? edited: now,whats think problem?it doesnt anything public long prod2(long u, long v) { var numbers = textbox7.text.split(',').select(p => long.parse(p)).toarray(); int n = math.max((int)math.floor(math.log10(u) + 1),(int)math.floor(math.log10(v) + 1)); int threshold = 3; if (u == 0 || v == 0) { return 0; } else if (n <= threshold) { return u * v; } else { int m = (int)math.ceiling(n / 2.0); int x = (int)(u / math.pow(10, m)); int y = (int)(u % math.pow(10, m)); int w = (int)(u / math.pow(10, m))

ios - How to convert "SEL" and "id" to NSString? -

id parent; sel selector; // lot's of code... if ([parent respondstoselector:selector]) { } else { // doesn't work: nsstring *errormessage = [nsstring stringwithformat:@"%@ in class %@ doesn't exist!", selector, parent]; } how convert "sel" , "id" string? call nsstringfromselector() passing selector argument selector string, , use [parent class] parent object's class: nsstring *errormessage = [nsstring stringwithformat:@"%@ in class %@ doesn't exist!", nsstringfromselector(selector), [parent class]];

Computer Vision: Simple Question - what are 'side lobes'? -

this trivial question!! in computer vision literature, side-lobes mentioned.. they?.... can't seem find anywhere says :s. thanks :). this term antenna theory. antennas broadcast radiation (radio, microwave, light, infrared) in pattern. generally, there preferred direction , of energy in 'main lobe'. however, there exists secondary directions ('side lobes') of energy transmission. times, side lobes not ideal , engineered minimum. other times, side lobes can advantage , enhanced. bob

eclipse - Why does CDT rebuild my C-project on Ant build in unrelated project? -

i have eclipse workspace cdt project lives other unrelated projects. however, when run "build ant build" in 1 of projects, cdt insists on rebuilding projects too. anyone have ideas disconnect "hidden" dependency? (and no, it's not in "linked resources" or "project references"...) the workspace wide build caused me failing find option build in "external tools configurations". there can specify build whole workspace, containing project, or specific resource. there eclipse bug setting default different build whole workspace. (one think "run ant build" default not build except running specified ant target.)

html - content navigation help -

i'm working on content navigation in typoscript. these requirements should accomplished: show current node @ top -> done! show child nodes of current page -> done! if there no child nodes, show last treelevel with current page active - not done yet! for last point, need help. tried [treelevel = 2] control navigation on last treelevel, nothing happened. don't know why treelevel-condition won't work me. problem is, last treelevel on 2nd level, on 3rd... any ideas? this typoscript far: temp.leftcol = coa temp.leftcol { 5 = html 5.value = <ul class="contentnav"> ### show current page on top 10 = text 10.typolink { parameter.data = tsfe:id } 10 { wrap = <li class="title">|</li> data = leveltitle:2 if { istrue.numrows { table = pages } } } ### content navigation: show subpages 20 = hmenu 20.entrylevel = -1 20.1 = tmenu

windows phone 7 - How to fill generated Pivot Elements with data [templates] -

howdy, generate in application several pivotitems in pivotelement. generation proceeding fine, don't know how can apply template pivot elements. i thought need use: pivotitem.contenttemplate = (datatemplate)ressources["kantinenuebersicht"]; but producing empty page. my code in ressource file looks following: inserted whole ressources file <.resourcedictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> <datatemplate x:key="kantinentemplate"> <stackpanel verticalalignment="top"> <textblock horizontalalignment="left" textwrapping="wrap" text="{binding name}" fontsize="{staticresource phonefontsizelarge}" margin="8,0,0,0" verticalalignment="top"/> <textblock horizontalalignment="left" textwrapping="wr

Windows error LNK1179 -

i compiled exe on windows vs 2005, c++ program link other libs of mine. compiled , doesn't error of lnk1170 comdat " i can't understand happened , how solve problem. thanks there many issues concerning bug including: using of unnamed stuff (struct, class, namespace) instantiation of template parameter incremental linking ... i experienced bug in situation this: template < class inputiterator > id findorinsertsomething( const std::string & name, inputiterator begin, inputiterator end ) { id out; { static std::string sql( calculatequerya() ); if (findsomething( sql, name, out )) return out; } static std::string sql( calculatequeryb() ); out = insertsomehing( sql, name, begin, end ); return out; } when used in code, link error lnk1179 occurred. problem simple. without /h switch, maximum length of names can 2047 characters. when using template stuff, long names created. in example ther

python - Replace part of numpy 1D array with shorter array -

i have 1d numpy array containing audio data. i'm doing processing , want replace parts of data white noise. noise should, however, shorter replaced part. generating noise not problem, i'm wondering easiest way replace original data noise is. first thought of doing data[10:110] = noise[0:10] not work due obvious dimension mismatch. what's easiest way replace part of numpy array part of different dimension? edit: data uncompressed pcm data can hour long, taking few hundred mb of memory. avoid creating additional copies in memory. what advantage numpy array have on python list application? think 1 of weaknesses of numpy arrays not easy resize: http://mail.python.org/pipermail/python-list/2008-june/1181494.html do need reclaim memory segments of array you're shortening? if not, maybe can use masked array: http://docs.scipy.org/doc/numpy/reference/maskedarray.generic.html when want replace section of signal shorter section of noise, replace first c

java - JPA 2, JSF, setting id of OneToOne mapped entity problem -

we havent used jpa or other orm tools in our web application, have been on updating whole stuff java ee 6, problem jpa ,i have been looking answer,and learn how people solve kinda issue, have 2 entites, @entity person { @id private long id; @joincolumn(name="city_id") @onetoone(fetch=fetchtype.lazy) private city city; .... } and second entity @entity city { @id private long id; private string name; ..... } i querying person entity , show 1 on jsf page i have 2 input fields person.city show on jsf page inputhidden id , inputtext name people selecting cities popup set hidden component city id, new selected new value, , same name, everthing goes fine till now, when merge person entity, tries merge city also, id defined on table, constraint error cirty id. what doing kinda problem? i thought valuechange action inputhidden,but @ jsf life cycle happens before update model if replace person.city entity new 1 in action , updated again (actually same val

html - Using javascript to alter span text dynamically and keeping the original text -

i have html page, inside have following code snippet, depending on case we're following: case 1) <p> <span id ="xyz"> code here </span> </p> case 2) <p> <span id ="xyz"> </span> code here </p> now in javascript code have write values in span xyz dynamically. if try reference span xyz id , try alter innerhtml, html present in span xyz lost. if keep code outside span, appears on new line due css effects. cannot alter css due reasons. you can store current value in string, , modify string: var myspan = document.getelementbyid('xyz').innerhtml; myspan += ' , gets added after code here'; document.getelementbyid('xyz').innerhtml = myspan; or faster , more shorthand, document.getelementbyid('xyz').innerhtml = document.getelementbyid('xyz').innerhtml + ' new text after'; //to add text after existing text document.getelementbyid('xyz&

CPython as a library for C (To execute Python code from C) -

i'm not c expert i'm asking might crazy. is possible compile cpython using arm c-compiler (like yagarto or arm-gcc) , call c application process lines of python code? if so, resources/documents should looking at? embedding python in application on python.org

String Pattern Question - Core Java (repeatSeparator) -

write java function such given 2 strings, word , separator, return big string made of count occurences of word, separated separator string. repeatseparator("word", "x", 3) → "wordxwordxword" repeatseparator("this", "and", 2) → "thisandthis" repeatseparator("this", "and", 1) → "this" my code below not working public string repeatseparator(string word, string sep, int count) { if(count == 1) { return word; } if(count > 1) { (int = 0; < count-1; i++){ word = word + sep + word; } } return word; } example output :: expected run result repeatseparator("word", "x", 3) → "wordxwordxword" "wordxwordxwordxw

iphone - UIWebView takes over screen on rotate -

i'm creating banner using uiwebview , uiviewcontroller. in controller set shouldautorotatetointerfaceorientation return yes. in loadview, create uiwebview , give small banner frame using cgrectmake. works when it's added screen. problem occurs when screen rotates. uiwebview takes on whole screen. if output frame using nslog, can see gets overwritten rotation take whole screen. idea how stop doing this? feel i'm missing fundamental, cannot figure out wrong. if load uiwebview, on rotation should set width of uiwebview 480 , thats done on declaring javascript function on page load , on delegate - (void) willrotatetointerfaceorientation:(uiinterfaceorientation)tointerfaceorientation duration:(nstimeinterval)duration{ if ((tointerfaceorientation == uiinterfaceorientationlandscapeleft) || (tointerfaceorientation == uiinterfaceorientationlandscaperight)) { [webview stringbyevaluatingjavascriptfromstring:@"makewidth(480)"];

c# - matweb.com: How to get source of page? -

i have url like: http://www.matweb.com/search/datasheet.aspx?matguid=849e2916ab1541be9ff6a17b78f95c82 i want download source code page using code: private static string urltemplate = @"http://www.matweb.com/search/datasheet.aspx?matguid="; static string getsource(string guid) { try { uri url = new uri(urltemplate + guid); httpwebrequest webrequest = (httpwebrequest)webrequest.create(url); webrequest.method = "get"; httpwebresponse webresponse = (httpwebresponse)webrequest.getresponse(); stream responsestream = webresponse.getresponsestream(); streamreader responsestreamreader = new streamreader(responsestream); string result = responsestreamreader.readtoend(); return result; } catch (exception ex) { return null; } } when get: you not seem have cookies enabled. matweb requires cookies enabled. ok, understand, added lines: cookiecont

android - Adding menu options to webview code -

i have scoured net solution far unsuccessful. can me. newb , don't know java programming. tutorials on web, have created "webview" app loads local html files. works fine. i'm trying add options menu clicking "menu" button on phone can quit(exit) app. there many tutorials out there when try add code java file, existing code in file start coming errors & goes haywire. hoping can add appropriate code existing code below or correct code if wrong menu options included quit app. thank in advance. su `package com.xrefguide; import android.app.activity; import android.os.bundle; import android.webkit.webview; import android.webkit.webviewclient; public class xrefguide extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); webview web = (webview) findviewbyid(r.id.webview); web.ge

asp.net - geocoder.getLatLng() method not showing all the addresses on google map? -

i have latitude , longitude values in database columns(more 20), grabing values , passing them geocoder.getlatlng() method display them markers. method not pretty fast, kept method inside loop run through values database, not addresses showing everytime refresh page missing addresses.here code, please give me suggestions , tell how set time out. script += " var location = \"\"+ latitude +\", \"+ longitude +\"\";\n"; script += " geocoder.getlatlng( \n"; script += " location,function(point) \n"; script += " {if (point) { \n"; //script += " alert(point);\n"; script += " var icon = new gicon(baseicon);\n"; script += " icon.image = \"_gfx/gmap/marker\" + (iconnum) + \".png\";\n"; script += " var locimage = new image();\n"; script += " locimage.src =\"mod

Android Custom Tab linked to Activity -

how can class below create tabs link activities. worrking way tabs not linked activity. need tabs load different activities? import android.app.tabactivity; import android.content.context; import android.os.bundle; import android.view.layoutinflater; import android.view.view; import android.widget.tabhost; import android.widget.tabhost.tabspec; import android.widget.textview; import android.widget.tabhost.tabcontentfactory; public class customtabactivity extends tabactivity { tabhost mtabhost = null; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); mtabhost = (tabhost) findviewbyid(android.r.id.tabhost); // mtabhost.gettabwidget().setdividerdrawable(r.drawable.tab_divider); setuptab(new textview(this), "tab 1"); setuptab(new textview(this), "tab 2"); setuptab(new textview(this), "tab 3"); } priva

java - Is there any remotely cross platform way to execute an external process? -

i looking advice on how execute process cross platform. i have written java , ruby implementations of app, less of language specific problem , more of platform specific issue. e.g on ubuntu /usr/bin/ searched do # ruby `handbrakecli #{args}` # works on ubuntu , other linux distros since handbrakecli in /usr/bin/ for windows search current directory running in. however, if copy windows executable current directory runtime linking error cause crash (dll not present) the default install path handbrakecli in "program files(x86)/handbrake" (x86 in 64 bit obviously), program files isn't in search path far can tell. for macosx have no clue how execute mac "application folders" command line other "open" command. less of issue since after handbrakecli normal executable. handbrakecli not installed /usr/bin or /usr/local/bin ( or variation there of ) my best idea make config file has path handbrakecli. if go route ideal able detect platform on,

dom manipulation - Get the content of siblings elements with jQuery -

i need content of specific elements using jquery, problem have same element repeating on page: <div class="content"> <img alt="" src=""> <p class="txt">lorem ipsum dolor sit amet, consectetur adipisicing elit.</p> <p class="info">lorem ipsum dolor...</p> <ul> <li><a class="uibutton">test</a></li> </ul> </div> so, div.content repeat on page many times , want contents of div holds button clicked. i've added onclick event on .uibutton , tried use parent(".txt") or siblings(".txt"), dont seems work... $(".uibutton").click(function(){ var txt = $(this).parent(".txt").text(); } .txt isn't parent, , has direct parent ( .parent() matches immediate parent if matches selector), instead need: $(".uibutton").click(function(){ var txt = $(this).closest(&

swing - non standard locale with java.util.Calendar -

we have customer in sweden, using software in english. set locale(en, sv) . did hope calendar class adhere country settings, uses language , locale assumes settings. so searching way let calendar know new firstdayofweek , minimumdayinfirstweek settings prefered standard way other setting manually , hardcoded. for clarification: 29. august 2010 in sweden in cw 34 (also in germany , great britain) in reported cw 36. different results fact 01.01.2010 friday , 29.08.2010 sunday. i cannot change language setting swedish , use english fallback since not support swedish language, sun/oracle/.. does, swing ui have mixture of swedish , english texts, not acceptable. and adding properties file named "sun.util.resources.calendardata_en_sv.properties" not work out: not read! manually resourcebundle that's possible. somehow localedata.getcalendardata(locale) own magic in reading resourcfiles cannot find out since source of not available. method called here: java.util.cal

javascript - Problem with Event Handling via YUI -

when users click "search" input element, search text inside input disappear , since have several controls that, thought make code reusable. here code formerly done , working jquery in yui cannot make work. var subscriptionboxtarget = "div.main div.main-content div.side-right div.subscription-box input"; var ssbnode = yahoo.util.selector.query(subscriptionboxtarget); var ssbvalue = yahoo.util.dom.getattribute(ssbnode,"value"); var subscriptionbox = new removabletext(ssbnode,ssbvalue,null); subscriptionbox.bind(); //////////////////////////////// //target : target of element dispatches event // defaulttext : default input[type=text] elements // callback : function run after everthing completed function removabletext(target,defaulttext,callback) { var target = target; //private members var defaulttext = defaulttext; var callback = callback; //instance method this.bind = function() { mouseclick(target,defaulttext);

activerecord - Validation that excludes itself on update action if fields have not changed -

i have table called rents hold start , end date. have created validation no new rents cant overlap existing rents start , end dates. the thing is, when click on rent update , if don't change fields , click update. trys validate on , overlapping existing record. ( existing record referring itself.) the thing im trying is, how can have validation exclude itself. how validation looks like. def should_not_overlap_rental_periods errors.add(:start_date, "can't overlap other rental periods") if self.rents.where("end_date <= ? , start_date >= ?", self.end_date.strftime("%y-%m-%d"), self.start_date.strftime("%y-%m-%d")).count > 0 unless self.rents.blank? end you need check on activemodel's dirty checking module. can check on attributes if have changed , branch logic accordingly. http://railsapi.com/doc/rails-v3.0.1/classes/activemodel/dirty.html

ios4 - Is it possible to modify code generated by PhoneGap and how would this effect apps market application process? -

is possible modify/supplement code generated phonegap modify/add functionality? , how effect application's likelihood of being accepted apps market? the reason asking because there components of desired iphone application have can not achieve our converted cakephp web application. these desired items include qr code scanning , augmented reality. yes, can that. https://github.com/phonegap/phonegap-plugins you can there written (and validated) plugins. if remember correctly, qrscanner plugin exists. augmented reality not possible phonegap. (at least not far know) can't manipulate camera view phonegap. maby if write plugin it. mean writing whole application in objective-c.

javascript - Making custom right-click context menus for my web-app -

Image
i've few websites google-docs , map-quest have custom drop down menus when right-click. somehow override browser's behavior of drop-down menu, , i'm sure how it. found jquery plugin this, i'm still curious few things: how work? browser's drop-down menu being overridden, or effect simulated? if so, how? what plugin abstract away? what's going on behind scenes? is way of achieving effect? see several custom-context menus in action i know question old, came same problem , solved myself, i'm answering in case finds through google did. based solution on @andrew's one, modified afterwards. edit : seeing how popular has been lately, decided update styles make more 2014 , less windows 95. fixed bugs @quantico , @trengot spotted it's more solid answer. edit 2 : set stacksnippets they're cool new feature. leave good jsfiddle here reference thought (click on 4th panel see them work). new stack snippet: // javascript (jqu

How to update a Rails 3 project to latest gems? -

i created new ruby on rails 3.0.1 project, , globally updated gems 3.0.3. after digging around, ended editing project gemfile "3.0.3" instead of "3.0.1", , ran "rake rails:update", , appears up-to-date. however, can't find references on internet doing rails 3, want make sure right way of doing things. confirmation appreciated. thank you. if you're changing version in gemfile, should running bundle update gems updated latest versions specified gemfile . rake rails:update used updating things such prototype assets latest version.

How to match a newline \n in a perl regex? -

i want match line, <center>'''<font color="blue"><font size="18.0pt">no change alarms &amp; information</font></font>'''</center> and replace with, =<center>'''<font color="blue">no change alarms &amp; information</font>'''</center>= now simple if tags font colour or center, can absolutely , there can multiple of them. my current code this: $html =~ s/<font size=".+">(.+)<\/font>/$1/g; but not = on each end. what this: $html =~ s/\n(.+)<font size=".+">(.+)<\/font>(.+)\n/=$1$2$3=/g; however fails match newline characters , cannot figure out how make match them, clues? (i'm converting html wiki markup, converter stuffs font sizes i'm manually converting them wiki style headings.) all needed /gm on end of query, turns out ignores new lines default.

c++ - O(n) algorithm to find out the element appearing more than n/2 times -

i asked in interview give o(n) algorithm print element appears more n/2 times in array, if there such element. n size of array. don't have clue on how this. can help? it's boyer's voting algorithm . it's o(1) in space!. edit for complaining site color scheme (like me) ... here original paper .

wpf - In the grid layout , what the difference between the followings -

width="auto" width ="*" width ="100*" width="auto" autosizing: gives child elements space need - in case of grid column, makes column wide widest contained element. width ="*" width = "100*" proportional sizing or "star sizing": divide available space proportionally. example, in order divide available 2 columns @ 20% , 80% of grid width, use "20*"/"80*" or "2*"/"8*" or "*"/"4*" . "*" equivalent "1*" .

security - How to secure passwords in the Software Development? -

how secure passwords in propertie files? encryption / encoding? or use different approach handle database user / passwords connection strings? thanks help! update: responses! in special case talk 2 tier architecture. have many clients direct connections databases. propertie files on network share. for connection strings database use jndi connections. , there can encrypt passwords: http://tomcat.apache.org/tomcat-6.0-doc/realm-howto.html#digested_passwords

regex - Getting a list out of an extractor -- or even a Match -

first, cool ... scala> var namere = """\w*(\w+)\w+(\w+)\w*""".r namere: scala.util.matching.regex = \w*(\w+)\w+(\w+)\w* scala> var namere(first, last) = "will smith " first: string = last: string = smith then darn ... scala> var listofvowels = "(([aeiou])*)".r listofvowels: scala.util.matching.regex = (([aeiou])*) scala> var listofvowels(vowels:list[string]) = "uoiea" <console>:7: error: scrutinee incompatible pattern type; found : list[string] required: java.lang.string var listofvowels(vowels:list[string]) = "uoiea" now i'm huh ... scala> (listofvowels findfirstmatchin "uoiea" get) subgroups res35: list[string] = list(a) [ in case question isn't obvious: how list of subgroups matched pattern, ideally in extractor in case without writing second-level matcher. correct answer here list(u, o, i, e, a) of course. ] this let extract pattern:

android - How to implement multiple screens within an App -

i working on android app has different service dimensions, such " service order", "route planning", "photo gallery" , central login. far implemented each "screen" (and screen mean layout of screen) seperate class, loads specific layout , handles listeners , core functionalities such calling webservices in thread, receiving answers etc. not quite sure if best way implemnt mulitiple layout-screens. the android dev guideline proposes use single activities each "screen layout". doubt effective way of doing things. since need information each "layout" retrieved central login (here: user object). since activity (as far understand) seperate thread, passing , retrieving of information seems not practical. i oppinions/feedback on , hint or tip. so far structure looks : activity loads login layout (res/layout/login.xml setlcontentview) depending on buttonclick other resources loaded , initialized (means listeners added

iphone - How to delete a row from UITableView -

i'm trying delete row table view , far have been unsuccessful. keep getting error: "terminating app due uncaught exception 'nsinternalinconsistencyexception', reason: 'invalid update: invalid number of rows in section 0. number of rows contained in existing section after update (5) must equal number of rows contained in section before update (5), plus or minus number of rows inserted or deleted section (0 inserted, 1 deleted).'" array use populate table view declared in class, objects array sqlite db. the code used try deleting rows follows. - (void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath { if (editingstyle == uitableviewcelleditingstyledelete) { // delete row data source [categoryarray objectatindex:indexpath.row]; [tableview deleterowsatindexpaths:[nsarray arraywithobject:indexpath] withrowanimation:yes]; } e

linux - Redirect content of /dev/ttySDIO0 to a file -

is there way redirect content of tty device (/dev/ttysdio0) file content can managed using file io operations. don't prefer use 'cat' here. thank you. you can use socat can connect tty on 1 side lot of command line options, , other end can pretty accepts read/write or send/receive call. above link : socat command line based utility establishes 2 bidirectional byte streams , transfers data between them. because streams can constructed large set of different types of data sinks , sources (see address types), , because lots of address options may applied streams, socat can used many different purposes.

Incremental update of docs in solr -

i have table called emp id , name fields , has 2 records. have formed xml doc <add> <doc> <field name="id">1</field> <field name="name">name1</field> </doc> <doc> <field name="id">2</field> <field name="name">name2</field> </doc> </add> i have indexed above xml file solr first time. when 3rd record gets created in table, should go xml file has third record i.e <add> <doc> <field name="id">3</field> <field name="name">name3</field> </doc> </add> and index xml file separately? or should add new 3rd record original xml file i.e <add> <doc> <field name="id">1</field> <field name="name">name1</field> </doc> <doc> <field name="id">2</field>

java - multi threaded servlet; single threaded ejb -

in traditional n tier web app servlets web layer , ejbs(2.0) biz layer, rationale behind making servlet model multi threaded , ejb model single threaded? i.e there 1 servlet instance requests, ejbs, each request, there new bean instance assigned bean pool. there indeed 1 instance specific servlet since supposed stateless. in practice isn't case, it. there multiple instances of stateless session beans (slsb), , pooled. by definition, stateless session beans stateless, on surface seems paradox. things while stateless session beans stateless respect individual calls being made them, in fact have state. this state in form of references other resources . jpa entity manager , not thread-safe, prime example here. during single call stateless session bean , caller must have exclusive access resource. when call returns, next caller can have exclusive access, etc. if single instance used, either callers have wait on each other (which of course killing performance

Spring-portlet POST ajax xmlHttpRequest -

could please has experiences processing post xmlhttprequests spring dispatcherportlet, tell me best way ? i'm using yui io module , jackson object mapper example : @resourcemapping(value="stuff") public void method(resourceresponse response){ person person = new person(); person.setweight(150); objectmapper mapper = new objectmapper(); try{ mapper.writevalue(response.getwriter(), person); } ... } ajax: function() { var = aui(); a.io("<portlet:resourceurl id="stuff" />", { method: 'post', data: { description: 'value' } }); } this issue can vote spring-portlet environment have same support common spring-mvc has. @responsebody, data conversion json etc. afaik 1 has manually... edited: figured out solution please: take @ issue better formulated https://stackoverflow.com/questions/4782971/handling-ajax-requests-with-spring-portlet how const

.net - Store MSMQ queue in database -

i'm new msmq .net , have question. for system want use msmq queuing system requests, customer wants keep information in database. wonder there way store msmq messages in database? currently see way create record in database , put record id queue. yes, need read records queue , store in database. typically might using windows service. typically, need use msmq if there might intermittant networking connectivity between 2 locations or think number of requests exceeds database can handle in 1 go. otherwise, store straight in database.

c# - DbReference with custom MongoIdentifier (MongoDB & NoRM) -

i'm new mongo user (haven't gotten used name even... makes me laugh every time), , have problem (feeling mongo). i have class "user", mongoidentifier defined this: [mongoidentifier] public string username { get; set; } in class "role" have dbreference looks this: public dbreference<user> creator { get; set; } this compiles well, when try set creator this: role.creator = new norm.bson.dbtypes.dbreference<user>(useronline.username); i following error: system.formatexception: not find recognizable digits. any ideas why? thanks found solution... had specify type of mongoidentifier: public dbreference<user, string> creator { get; set; } and... role.creator = new norm.bson.dbtypes.dbreference<user, string>(useronline.username);

c# - Web Exception with Web Service -

i have developed client application consume web service, there no error's in code when debug following exception, 'webexception unhandled - underlying connection closed: not establish trust relationship ssl/tls secure channel.' i think fact secure web service trying consume, question error occur due security certificate not being installed correctly? , if there way manually instal certificate application? thanks time. this issue of missing trust. server's ssl certificate needs trusted consuming client. there 2 ways fix this: buy ssl certificate trusted certificate authority (ca) add server's ssl certificate trusted people certificate store of user running app (or computer on app run (localmacine/trustedpeople)) you can use x509certificatestore class add certificates appropriate store programmatically, can distribute public key of server's ssl certificate app , install when needed.

database - Default MySQL user privileges after executing CREATE USER -

what privileges newly created user have after running: create user 'jeffrey'@'localhost' identified 'mypass'; creates new row in mysql.user table , assigns account no privileges http://dev.mysql.com/doc/refman/5.1/en/create-user.html

gallio icarus debug - no source files hown -

using gallio icarus v 3.2 build 676 when click debug opens visual studio 2010 however, dont source code tests debug info in execution log , can view source in icarus tests, cant add breakpoints. if manually attache gallio.icarus.exe test project, , stick break in test, "no debug symbols loaded" error i've checkd , project referencing same dlls gallio , mbunit (directly program files/gallio/bin)

c++ - Disable aero preview for MDI Window -

in windows 7 taskbar preview mdi childs, way disable mfc? adding false parameter enabletaskbarinteraction(...) call in initinstance method disables displaying mfc mdi child views in win7 taskbar.

asp.net mvc - Same behavior as ActionLink from javascript function -

i update content of div using result action method returns partialview. the below code this. <%= ajax.actionlink("update", "comments", new { id = 1 }, new ajaxoptions { updatetargetid = "divcomments" })%> <div id="divcomments" /> public actionresult comments(string id) { ... return view(photo.comments); } is possible have update occur inside javascript method rather link on page? if familiar jquery, use $.ajax() or $.load() methods.

android - Samsung Galaxy Tab layout in graphical layout xml -

can me set graphical layout option in eclipse dimensions of galaxy tab (1024 x 600). have emulator set designing layout of using .xml , graphical layout version. i find helps me visualize better when design see in emulator. @ moment solution trial , error. you can bigger view in 'layout design' tab clicking on clipping button(next outline button) in upper right hand corner. not perhaps exact layout dimensions give more space.

audio - How to write a wah-wah sound effect in C++? -

i'm trying learn write wah-wah sound effect. fun :) so far, i've done lot of research, , page explains best. http://www.geofex.com/article_folders/wahpedl/voicewah.htm basically, i'm looking simple c++ examples generate wah-wah (ooaaooaa) effect. eventually once done, hope able create "eeeoooeeeoo" effect, or "eeaaeeaa" effect :) sort of vowel sythnthesis, music. if find examples i'll link them here. ... i'm having trouble mathematical side of things. what waves need generate make "e" sound? waves need generate make "o" sound? i did try making 2 frequencies, harmonics, according page, , adjusting 2 frequencies, still sounded electronic beeps, not vowels. ... http://www.acoustics.hut.fi/publications/files/theses/lemmetty_mst/chap3.html seems good. there numbers can use. sound "vowelish". edit: tried making sounds @ frequencies mentioned on page (100hz,600hz,1000hz,2500hz). did not sound &quo

javascript - Right way to show div with ASP.NET server controls -

i have hidden div asp.net server buttons. show content of div modal window on page via javascript copying innerhtml, buttons on div don't fire server events. knows how fix that? thanks a first guess innerhtml isn't complete copy of code needed fire events. maybe clone node instead?

web services - java.lang.IllegalAccessException during Ant jwsc webservice build -

i have large application, part of relies on set of 3 webservices. i'm in process of writing ant build script build , package application ear file. when building web sub-project application use <jwsc> task in ant compile webservices. causes illegalaccessexception, outlined in stack trace below: [jwsc] warning: 'includeantruntime' not set, defaulting build.sysclasspath=last; set false repeatable builds [jwsc] jws: processing module weboutput [jwsc] parsing source files [jwsc] parsing source files [jwsc] 3 jws files being processed module weboutput [jwsc] jws: c:\dev\ir\irweb\src\webservices\dailyrun.java validated. [jwsc] jws: c:\dev\ir\irweb\src\webservices\pendingregistrationssweep.java validated. [jwsc] jws: c:\dev\ir\irweb\src\webservices\registrationsgolive.java validated. [jwsc] compiling 6 source files c:\docume~1\kevin~1.bre\locals~1\temp\_5l950r [jwsc] exception has occurred in compiler (1.6.0_23). please file bug @ java developer connection (