Posts

Showing posts from February, 2012

regex - java replaceAll and '+' match -

regex - java replaceAll and '+' match - i have code setup remove spaces in between words of title string formattedstring = unformattedstring.replaceall(" +"," "); my understanding of type of regex match many spaces possible before stopping. however, strings coming out not changing in way. possible it's matching 1 space @ time, , replacing space? there replaceall method, since it's doing multiple matches, alter way type of match work here? a improve approach might utilize "\\s+" match runs of possible whitespace characters. edit another approach might extract matches "\\b([a-za-z0-9]+)\\b" , bring together them using space allow remove except valid words , numbers. if need preserve punctuation, utilize "(\\s+)" capture runs of non-whitespace characters. java regex

c# - ASP, Listview conditional Alert -

c# - ASP, Listview conditional Alert - i'm working listview in want htmltablecell possess onclick property driven codebehind rather javascript.. i'm guessing that's pretty much dream getting obey c# code... anyways want run: protected void show_anm(object sender, eventargs e) { label hiddenc = (label)listview1.findcontrol("hidden"); alert.show(hiddenc.text); } and here's alert class public static class alert { public static void show(string message) { string cleanmessage = message.replace("'", "\\'"); string script = "<script type=\"text/javascript\">alert('" + cleanmessage + "');</script>"; page page = httpcontext.current.currenthandler page; if (page != null && !page.clientscript.isclientscriptblockregistered("alert")) { page.clientscript.registerclientscriptblo...

arrays - What is this pointer in C? -

arrays - What is this pointer in C? - i have seen lot of these types, have no thought means unsigned char somevar[maxlen]; int *ptr = (int *) somevar; can explain? it's somevar interpreted sequence of int 's (or one) through ptr pointer. incrementing ptr 1 time moves pointer sizeof(int) bytes ahead. be aware of endianness when doing conversions these. bytes somevar may need reordering interpreted ints. also create sure somevar of length that's multiple of sizeof(int) , otherwise undefined behaviour when trying access lastly int since partially available. c arrays pointers char

Ruby on Rails Tutorial Chapter 8 Signup Success -

Ruby on Rails Tutorial Chapter 8 Signup Success - i have written users controller , spec tests correctly "successful creation" in user controller next 2 errors: 1) userscontroller post 'create' success should create user failure/error: lambda count should have been changed 1, changed 0 # ./spec/controllers/users_controller_spec.rb:95:in `block (4 levels) in <top (required)>' 2) userscontroller post 'create' success should redirect user show page failure/error: response.should redirect_to(user_path(assigns(:user))) actioncontroller::routingerror: no route matches {:action=>"show", :controller=>"users", :id=>#<user id: nil, name: "new user", email: "user@example.com", created_at: nil, updated_at: nil, encrypted_password: nil, salt: nil>} # ./spec/controllers/users_controller_spec.rb:102:in `block (4 levels) in <top (required)>' the test specs ...

java - Tapestry 5 - communication between two components -

java - Tapestry 5 - communication between two components - i have page in java + tapestry 5 application, contains 2 components - form , grid. form field utilize filter results displayed in grid. form textfield sets value of object on mapped. grid created object a. need send right instance grid component form component. best way this? plain old java way setting object in upper page, there should cleaner way. thinking environment annotation, isn't heavy? public class i1 { @component private wfrformfilter wfrformfilter; @component (parameters={ "wfrdataholder=property:wfrformfilter.wfrdataholder" }) private wfrresulttable wfrresulttable; } public class wfrformfilter { @inject private wfrservice wfrservice; @propperty @persist private wfrdataholder wfrdataholder; @pageattached void pageattached() { if (wfrdataholder == null) { wfrdataholder = new wfrdataholder(); } } @onevent(event...

c++ - What is the difference between -1 and ~0 -

c++ - What is the difference between -1 and ~0 - the title says all: difference between minus 1 , tilda (ones-complement) zero? the question came during give-and-take of best way specify bit mask in bits set. of next better? int func(int value, int mask = -1) { homecoming (value & mask); } or int func(int value, int mask = ~0) { homecoming (value & mask); } are there other uses other way around? update: there has been similar give-and-take on topic on @ stackoverflow.com/q/809227/34509 missed during prior research. johannes schaub pointing out. the first variant relies on 2's complement representation of negative numbers, isn't used. 1's complement can used too... or other encoding. vote sec approach c++ bitmask ones-complement

php - Getting remote file contents after login with cURL -

php - Getting remote file contents after login with cURL - as title suggest, i'm trying content of (several) pages on site requires login. legitimate login , have access content - nil shady's going on. i've searched , found several posters attempting same thing - nil i've found has helped specific issue. i've tried several variations - adding various options followlocation (set true, tried set false); increasing timeout; setting both cookiejar , cookiefile; calling curl_close after login, new curl_init after (before loading target file); using traditional php methods grab file (file_get_contents, etc); explicitly creating cookie file , setting writable; tried , without referer; tried changing referer; tried both http , https protocols; tried calling curl_close 1 time first forcefulness cookie written, running script block 1 time again afterward; etc... no luck. below snapshot of code beingness used (just trying 1 file now). any suggestions appr...

hyperlink - I google maps, s there a way to change the view from 'map' to 'earth' or 'satellite, in a http link? -

hyperlink - I google maps, s there a way to change the view from 'map' to 'earth' or 'satellite, in a http link? - how can alter next hyperlink path, show default, earth or satellite view in google maps? http://maps.google.com/maps?f=q&hl=en&geocode=&q=36.070690,-95.807090%28linestat%29 i realize can select other options after site pulled up, sofware have developed, save step our customers if see in different view. give thanks you! here parameters: t= map type. available options "m" map, "k" satellite, "h" hybrid, "p" terrain, "e" googleearth. so terrain on link: http://maps.google.com/maps?f=q&hl=en&geocode=&q=36.070690,-95.807090%28linestat%29&t=p notice &t=p @ end. use &t=e google earth. here useful site: http://mapki.com/wiki/google_map_parameters google-maps hyperlink google-earth

api - HTML5 Video Player to play a partial video file from browsers File System -

api - HTML5 Video Player to play a partial video file from browsers File System - i have written html5 (javascript) code download video file from set of servers, able file scheme api implemented on chrome. after download/merge pieces , create instance of html5 player var video = document.createelement('video'); video.src = fileentry.tourl(); video.autoplay = true; console.log(fileentry.tourl()); document.body.appendchild(video); this works fine. but want create player start playing file after (20 of 300) pieces written, when so, player starts playing file stops after part of 20th piece, , if drag player progress bar fwd or backward bit , plays rest. is there someway of fixing this? play smoothly without manual intervention user? file api html5 video

node.js - How do I fix npm's global location? -

node.js - How do I fix npm's global location? - when run npm ls -g i back -> /usr/local/lib64/usr/local/bin (empty) which incorrect. using locate can see global modules installed @ /usr/lib64/node_modules . how go correcting issue? (i'm running gentoo amd64.) npm uses .npmrc file should in home directory. (ie ~/.npmrc) in file should see key value pair key beingness "prefix". seek setting value "/usr/lib64". .npmrc file have next in add-on whatever else set in it: prefix = /usr/lib64 node.js npm

Synchronous AJAX call fails on iPad, but not other platforms and browsers -

Synchronous AJAX call fails on iPad, but not other platforms and browsers - does know why synchronous ajax phone call fail , give next error on safari on ipad, same code works fine on other platforms , browsers i've tested far? network_err: xmlhttprequest exception 101: network error occurred in synchronous requests. that error suggests i'm attempting cross-domain request, i'm not; requested url on same host, , in fact it's relative url. in trivial tests, fails on ipad (and works on other platforms , browsers, including safari), i'm confident i've ruled out possibility of time out. also, same request, if made asynchronously, works on ipad; it's synchronous requests give 101 exception. it's driving me crazy! one more bit of detail: happens on production server. synchronous ajax phone call works fine on development server. both servers require same client certificate... don't think there's difference there. can't think of differ...

how to display alert by using serverside code in asp.net? -

how to display alert by using serverside code in asp.net? - i want execute next code on button click follwing code executes when refresh page well. don't want behaviour. please help me. string str = "are sure, want approve record?"; this.clientscript.registerstartupscript(typeof(page), "popup", "confirmapproval('" + str + "');", true); your question in quite unclear. assumed utilize asp.net c# , here way: public static class clientmessagebox { public static void show(string message, command owner) { page page = (owner page) ?? owner.page; if (page == null) return; page.clientscript.registerstartupscript(owner.gettype(), "showmessage", string.format("<script type='text/javascript'>alert('{0}')</script>", message)); } } then, in page (remember reference class above): protected void page_load(object ...

osx - MacOS In-App Purchases -

osx - MacOS In-App Purchases - i cannot find documentation regarding code in-app purchases macos apps (not ios). official link (https://developer.apple.com/appstore/mac/resources/in-app-purchase/) not coding part of process. check out in-app purchase programming guide , technical note: cover both platforms (macos , ios) , gives sample code. osx in-app-purchase

java - `Can't create handler...Looper.prepare()` in inherited Activity -

java - `Can't create handler...Looper.prepare()` in inherited Activity - i have game activity (activity a) works code. create new activity (activity b) new game mode, extends activity a. however, when encounter toast line, activity b thrown exception (activity works showing toast): can't create handler within thread has not called looper.prepare() activity b overrides load-level method, no differrence! try this: handler innerhandler; (new thread(new runnable() { @override public void run() { looper.prepare(); innerhandler = new handler() { @override public void handlemessage(message message) { toast.make(...); } @override public void dispatchmessage(message message) { handlemessage(message); } }; me...

osx - Hiding the symbols of a static library in a dynamic library in MAC OS X? -

osx - Hiding the symbols of a static library in a dynamic library in MAC OS X? - i using static library (eg: boost.a) , *.o files create dynamic library (eg: libdynamic.dylib) in mac os x. i able hide symbols *.o files since created -fvisibility=hidden flag. but, can't hide symbols boost.a library since have been compiled already. is there way hide symbols (functions) of static library, in dynamic library ? i.e., if have function (hidden) in myfuncs.o file calls functions(visible) in boost.a file, boost.a functions visible when utilize "nm tool". please suggest me solution. first need create sure declare symbols want maintain extern "c" attribute((visibility("default"))) , check "symbols hidden default" in code generation tab of xcode project (i think checked default). then need create exported symbols file contains symbols want export (keep). you need point xcode file adding "symbols.exp" "exported sy...

actionscript 2 - adobe flash layering -

actionscript 2 - adobe flash layering - im not sure if layering right issue im facing anyway, here's problem in detail. i have created flash file, many layers. have created buttons on these layers such on release, load movieclip acts popup window. movieclip loaded , visibily on upper layer though unable see buttons below, still able click on them through loaded movieclip , loads other stuff scripted on buttons. hope have explained headache detail plenty , hope can advice go fixing it. i tried googling got no thought keywords search for! okay think title should have been "flash click through problem". anyway have solved following; use big plenty clip on top of everything. don't disable though. mc_overlay.onrollover = function() { this.usehandcursor = false; } credits gotoandlearn() chee...

ruby on rails - Date comparison for same dates -

ruby on rails - Date comparison for same dates - my problem when user selects same dates, query below returns empty array. instead when user selects same dates, has show users created @ date. help appreciated. user.where("created_at >= ? , created_at =< ?", params[:from].to_date, params[:to].to_date) you using datetime database columns. problem user selects "from" (for example) 2011-07-09 , comparing database translates "2011-07-09 00:00:00" , if user selects same day twice, there no results (unless created @ "2011-07-09 00:00:00"). prepare this, do to_date = params[to].to_date + 1.day before making actual database search call. , utilize to_date instead of params[:to].to_date ruby-on-rails

Paypal Adaptive Payment invoice data -

Paypal Adaptive Payment invoice data - i'm trying add together item details show on paypal invoice nil appears. utilize setpaymentoptions next values: "paykey" => "$paykey", "receiveroptions(0).customid" => "11", "receiveroptions(0).receiver.email" => "email@paypal.com", "receiveroptions(0).description" => "invoice title", "receiveroptions(0).invoicedata.item(0).name" => "item name", "receiveroptions(0).invoicedata.item(0).itemcount" => "1.0", "receiveroptions(0).invoicedata.item(0).itemprice" => "20.0", "receiveroptions(0).invoicedata.item(0).price" => "20.0", "receiveroptions(0).invoicedata.item(0).identifier" => "111", "receiveroptions(0).invoicedata.totaltax" => "0.0", "requestenvelope.errorlanguage" => "en_us", ...

audio - Turning off AGC on the iPad -

audio - Turning off AGC on the iPad - there little consensus on whether ios interface apple provides shut off automatic gain command implemented. know definitively if possible shut off agc when recording sound on ipad and, if reply yes, how? if using ios< 5...the reply no. if using ios>=5 on ipad2...the reply still no. not if using ios>=5 on iphone 3gs, ipod(4th gen), ipad1 (1st gen) reply seems yes. acg turned off when audiosessionmode changed kaudiosessionmode_measurement. check sound session services reference. input gain can controlled by: 1) set audiosession's mode kaudiosessionmode_measurement. 2) sure device using has input gain available using kaudiosessionproperty_inputgainavailable property. 3) set property kaudiosessionproperty_inputgainscalar desired gain level (between 0 , 1.0) *haven't gotten hands on newest ipad yet, cant confirm. ipad audio record

Backup List in Sharepoint 2010 in Shell -

Backup List in Sharepoint 2010 in Shell - i want backup list of sharepoint 2010 using powershell. i can backup list using central administration , can backup whole site using export-spweb -identity http://siteurl:22222/en-us -path \\public\backup.cmp but when seek export specific list (with path shown using central administration): export-spweb -identity http://siteurl:22222/en-us/lists/mylist -path \\public\backup.cmp i receive error: "the url provided invalid. valid urls site collections or sites allowed exported using stsadm.exe" i tried export-spweb -identity http://siteurl:22222/en-us -path \\public\backup.cmp -itemurl http://siteurl:22222/en-us/lists/mylist getting same error thanks in advance try fiddle itemurl parameter value: export-spweb -identity http://siteurl:22222/en-us -path \\public\backup.cmp -itemurl /lists/mylist or export-spweb -identity http://siteurl:22222/en-us -path \\public\backup.cmp -itemurl...

ios - iPhone dev - How can I display a google map in an app without using the browser? And other map questions -

ios - iPhone dev - How can I display a google map in an app without using the browser? And other map questions - i'm making iphone application want take in bunch of addresses , display them on map using different colored pins mark different addresses. first of all, possible? secondly, want way without having open map in browser, display straight view. possible? thanks. yes possible tim, check here: http://blog.objectgraph.com/index.php/2009/04/02/iphone-sdk-30-playing-with-map-kit/ iphone ios google-maps gps maps

php - a condition which will not proceed to step unless condition is true -

php - a condition which will not proceed to step unless condition is true - anyone help...:d im creating personal calendar schedule while im learning php. come across part need set particular status , output display if status meet. see notes. $n = 50 $n must not greater or equals 20 [ if ($n >= 20) ] else { $n - 10 } will print if $n less 20 is possible?? friends told me utilize recursion i'm not familiar still trying learn. thanks i believe asking while-do http://php.net/manual/en/control-structures.do.while.php as per php manual: $i = 0; { echo $i; } while ($i > 0); or: do { if ($i < 5) { echo "i not big enough"; break; } $i *= $factor; if ($i < $minimum_limit) { break; } echo "i ok"; /* process */ } while (0); php recursion if-statement condition

makefile - making source in subfolder question -

makefile - making source in subfolder question - i have makefile compiles *.c files in subfolder: objects := $(patsubst %.c,%.o,$(wildcard *.c)) cobj: $(objects) $(objects): %.o: %.c $(cc) -c $< -o $@ i having problem trying same parent folder. lets .c files in folder 'csrc' objects := $(addprefix, csrc/, $(patsubst %.c,%.o,$(wildcard *.c))) cobj: $(objects) $(objects): csrc/%.o: %.c $(cc) -c $< -o $@ i see "nothing cobj... ideas? your pattern rule csrc/%.o: %.c translates e.g. csrc/foo.o foo.c , not csrc/foo.c . presumably, not want. why not %.o: %.c ? makefile gnu-make

iOS - Grand Central Dispatch getting value from block in dispatch_async -

iOS - Grand Central Dispatch getting value from block in dispatch_async - i'm using below code download info web. right need retain info have done? nslog statement within block shows array has been populated, when run nslog outside block arrays show (null) . how save info outside dispatch_async method? __block nsarray *downloadedcareerids; __block nsarray *diskcareerids; dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{ /* download stuff */ downloadedcareerids = [[careersparser idsfrom:@"web"] retain]; diskcareerids = [[careersparser idsfrom:@"disk"] retain]; dlog(@"downloadedcareerids: %@", downloadedcareerids); dlog(@"diskcareerids: %@", diskcareerids); }); dlog(@"downloadedcareerids: %@", downloadedcareerids); dlog(@"diskcareerids: %@", diskcareerids); dispatch_async non blocking method homecom...

Since version 4.0, what are the most confusing parts of WCF? -

Since version 4.0, what are the most confusing parts of WCF? - this question inspired jon skeet's question here asked people pain points linq hope question isn't out of place ... version 4 of wcf tackled, probably, 1 of areas many people struggled wcf - namely configuration. however, tagged set of questions , other forums there other areas people struggle with. i've made bunch of blog posts , screencasts in past trying focus on mutual issues (such duplex, sessions, etc). i'm planning set want focus on things causing people problems changes in version 4.0. areas see things like instancing , threading security rest support wcf , silverlight large message processing / streaming configuration (still) serialization and i'm sure there more, i'd input , maybe can create sure product team feedback greatest pain points people have wcf i participate both here , on msdn , after answering many questions sentiment greatest pains people have are: c...

objective c - Multiplayer game for iOS -

objective c - Multiplayer game for iOS - i planning create multiplayer game ios. require server side programming (which have never done). going start out simple turn based game learn. can suggest me programming language/framework should utilize , perhaps tutorial/article beginner targeted toward server side programming games? thanks. i have used smartfox server creating multiplayer game. can test basic version free. have iphone api , sample code too. checkitout http://www.smartfoxserver.com/ objective-c ios cocoa-touch server-side

javascript - Do Backbone.js views require jQuery or Zepto? (Or: why am I getting “Uncaught TypeError: undefined is not a function”?) -

javascript - Do Backbone.js views require jQuery or Zepto? (Or: why am I getting “Uncaught TypeError: undefined is not a function”?) - i’m starting out backbone.js. i’ve subclassed backbone.model , backbone.view : var message = backbone.model.extend(); var messageview = backbone.view.extend({ tagname: 'div', classname: 'message', template: _.template('{{ html }}'), render: function(){ this.template({ html: this.model.html }); this.el.classname.append(' ' + this.model.type); homecoming this; } }); i’ve attempted create instance of each: var message = new message({html: html, type: type}); var messageview = new messageview({model: message}); the lastly line line causes error (in chrome 12): uncaught typeerror: undefined not function . traces error function f.extend.make in backbone.js. the backbone.js documentation on view.make says: convenience function creatin...

c++ - Boost force directed layout problem -

c++ - Boost force directed layout problem - i newbie in boost library, tried apply forcefulness directed layout boost documentation website encountered error when seek compile code: error: no matching function phone call ‘random_graph_layout(mygraph&, coordsqmap&, double, double, double, double, boost::minstd_rand&)’ error: no matching function phone call ‘fruchterman_reingold_force_directed_layout(mygraph&, coordsqmap&, double&, double&, boost::bgl_named_params<progress_cooling, boost::cooling_t, boost::no_property>)’ i have attached code. #include <boost/graph/fruchterman_reingold.hpp> #include <boost/graph/random_layout.hpp> #include <boost/graph/adjacency_list.hpp> #include <boost/graph/simple_point.hpp> #include <boost/lexical_cast.hpp> #include <string> #include <iostream> #include <map> #include <vector> #include <boost/random/linear_congruential.hpp> #include ...

java - Strange exception consuming JSON from Android application -

java - Strange exception consuming JSON from Android application - i created android application consumes , parsing json in development environment json is: http://balonmanoblog.hkadejo.com/ge/...v1/categorias/ , works fine but in production environment, alter direction of json follows: http://www.balonmanoblog.com/ge/inde...v1/categorias/ no longer works 07-09 09:17:37.390: warn/system.err(7247): java.lang.runtimeexception: internal error 07-09 09:17:37.390: warn/system.err(7247): @ org.codehaus.jackson.impl.bytesourcebootstrapper.detectencoding(bytesourcebootstrapper.java:155) 07-09 09:17:37.390: warn/system.err(7247): @ org.codehaus.jackson.impl.bytesourcebootstrapper.constructparser(bytesourcebootstrapper.java:197) wrong? help me please. thanks code path suggest went wrong during encoding detection; reproduce it necessary actual document bytes. if first read content byte array (use bytearrayoutputstream), easier know parser sees. error message no...

c# - WPF UserControl still active after Viewbox Child switch -

c# - WPF UserControl still active after Viewbox Child switch - i have viewbox , initial kid usercontrol displays webbrowser. if open pandora or youtube , begin playing sound , click button switch viewbox kid new user control, visually changes can still hear sound in background. any suggestions? the same behavior (audio playing pandora or youtube) true tabbed browsers well. web site owners consider feature go on playing audio. since cannot alter implementation, alternative have dispose of web control, or navigate different url (say about:blank) unload web page (which stop audio). c# wpf browser user-controls

objective c - iPhone - Replacing line breaks in my TextView with ? -

objective c - iPhone - Replacing line breaks in my TextView with <br />? - i trying convert linebreaks in uitextview <br /> tags, why next line crash? complains [nscharacterset newlinecharacterset] because when pass normal string works fine [mymutablestring stringbyreplacingoccurrencesofstring: [nscharacterset newlinecharacterset] withstring:@"<br />"]; terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[__nscfcharacterset length]: unrecognized selector sent instance 0x7b1cc80' a nscharacterset not nsstring .so you're passing wrong argument. if have newline "\n" characters can use: [mymutablestring stringbyreplacingoccurrencesofstring:@"\n" withstring:@"<br />"]; if have "\r" , "\lf" can seek (untested) nsrange range; while((range = [mymutablestring rangeofcharacterfromset: ...

c# - Link button to previous page -

c# - Link button to previous page - i making application in asp.net(c#,visual studio 2008). in create page in there 'proceed' link button. on clicking button go next page.on next page there 'back' link button.i want code such when click on button values have been entered in previous page preserved(i.e displayed on controls in have been filled).can help me solving simple problem? i know not direct reply question, may simpler approach: just suggestion, long you're using asp.net consider not using separate pages, instead utilize wizard control. it sounds you're creating wizard-style interface anyway, , wizard command solves lot of these issues lot more other approaches. "just works" , works beautifully. this page has more useful links: http://weblogs.asp.net/scottgu/archive/2006/02/21/438732.aspx c# asp.net

Using Django's ORM in a Celery Task -

Using Django's ORM in a Celery Task - how can celery task have access django database-abstraction api? need coded scratch using 1 of strategies stand-alone django orm usage, or there more streamlined, built-in way or mutual practice? it seems nobody asking question. however, me, it's fundamental. this example implies it's no big deal, can explain how session management , orm scoping works between celery , django? by default celery pickles task parameters. django model instances can pickled too. the grab pickling model instance taking snapshot of at time. unpickling doesn't touch database. whether or bad depends, suppose, on needs. tend send primary key tasks , re-query object in question. django django-models celery django-celery

json - ColdFusion9: Using serializeJson on Hibernate entity encodes numeric properties as strings -

json - ColdFusion9: Using serializeJson on Hibernate entity encodes numeric properties as strings - i'm writing first orm-backed rest api, , having issues json serialization. here's 1 of entity definitions: component persistent="true" extends="base" { property name="id" fieldtype="id" generator="native" ormtype="int" type="numeric"; property name="relationship" type="string" ormtype="string"; property name="comment" type="string" ormtype="text"; //related entities property name="terma" cfc="term" fieldtype="many-to-one" fkcolumn="terma" lazy="false"; property name="termb" cfc="term...

delphi - Make String into only 1 line -

delphi - Make String into only 1 line - i have output paragraph , when seek search string substring, if substring split doesnt' work. how can create paragraph string 1 line? example string: i have output paragraph , when seek search string substring, if substring split doesn't work. how can create paragraph string 1 line? substring: "it doesn't work" when seek search substring, doesn't homecoming true. it seems want treat newlines spaces. writing efficient search algorithms not trivial, approach works , answers question in title, is str := stringreplace(str, slinebreak, ' ', [rfreplaceall]); that is, replace linebreaks spaces. without magic constants, is str := stringreplace(str, #13#10, #32, [rfreplaceall]); perhaps there spaces between words, in add-on linebreaks? remove linebreaks, without adding spaces: str := stringreplace(str, #13#10, '', [rfreplaceall]); string delphi

c# - UI button is enabled -

c# - UI button is enabled - how check ui button enabled , visible in lua. suppose command ui button. want check if button visible , enabled or movedtoobject suppose have button creation code in c# , writing lua script have automation id , main application window title now able command on button. can click on button through lua script , parent of button command below code. need know how can check lua script visible or enabled assuming using luainterface connect lua , clr, create button object globally available in lua: luainstance["buttonname"] = buttoninstance; then in lua script: isenabled = buttonname.isenabled isvisible = buttonname.isvisible (not tested; started playing luainterface.) c# lua

javascript - how to get the content of the page in an modal using colorbox jquery plugin? -

javascript - how to get the content of the page in an modal using colorbox jquery plugin? - i having page print icon in there. now, need grab class , pull content of page in modal using colorbox , alter print class new name can execute actual print window.print. there way can pull content nowadays page using $("selector").html() , place within modal. moreover, need pull css well. thanks in advance suggestions. you can set html of object html of object: $('#modal_dialog').html($('selector').html()); javascript jquery colorbox

java - Netbeans Platform Project using Mediator Pattern - Is it possible? -

java - Netbeans Platform Project using Mediator Pattern - Is it possible? - i want utilize mediator design pattern (http://en.wikipedia.org/wiki/mediator_pattern) in netbeans platform modular app. however, not sure how on startup, since there not seem way create mediator , inject each module. does know way this? have resort using lookup api or something? when comes netbeans platform , inter-modular communications answers boil downwards lookup :) using sample code gave i'd following @serviceprovider(service = mediator.class) class mediator{..} the serviceprovider annotation netbeans extension serviceloader mechanism automates work of having set values in meta-inf/services folder. the buttonview class modified follows class btnview extends jbutton implements command { mediator med = lookup.getdefault().lookup(mediator.class); btnview(actionlistener al, mediator m) { super("view"); addactionlistener(al); med = m...

php script for star rating in admin panel? -

php script for star rating in admin panel? - i new php. have site have admin section.here want admin rate products having , rating should stored in database. i don't have thought this. please help me examples. on high level need do. in database, add together new column: alter table `products` add together column `star_rating` int(1) not null default 0; store value user has clicked on, either 0 5. on output, can output x stars such following: <strong>rating:</strong> <?php echo str_repeat('<img src="/star.png" alt="*" />', $row['star_rating']) ?> .. $row mysql_fetch_assoc() result select * products . this extremely basic , covered off in simplest of php/mysql tutorials, should larn language. php

javascript - Can't Get jQuery Easy Slider Plugin to Work - Please Help -

javascript - Can't Get jQuery Easy Slider Plugin to Work - Please Help - i'm using easy slider extension jquery on website , can't working properly. have used before not had issues. beingness called , features of easy slider working not everything. sample page: http://174.120.138.5/~mjbradle/ css: http://174.120.138.5/~mjbradle/sites/all/themes/mjb/main.css js: http://174.120.138.5/~mjbradle/sites/all/themes/mjb/slider.js js: http://174.120.138.5/~mjbradle/sites/all/themes/mjb/main.js any help appreciated. thanks! chuck in main.js, you're instantiating slider on jquery(".home-slide > ul") element, should instantiated straight on jquery(".home-slide") javascript jquery drupal easyslider

linux - Bash: How to assign an associative array to another variable name (e.g. rename the variable)? -

linux - Bash: How to assign an associative array to another variable name (e.g. rename the variable)? - i need loop on associative array , drain contents of temp array (and perform update value). the leftover contents of first array should discarded , want assign temp array original array variable. sudo code: declare -a mainarray declare -a temparray ... populate ${mainarray[...]} ... while something; #drain values mainarray temparray ${temparray["$name"]}=((${mainarray["$name"]} + $somevalue)) done ... other manipulations temparray ... unset mainarray #discard left on values had no update declare -a mainarray mainarray=${temparray[@]} #assign updated temparray mainarray (error here) with associative arrays, don't believe there's other method iterating for key in "${!temparray[@]}" # create sure include quotes there mainarray["$key"]="${temparray["$key"]}" # or: mainarray+...

Wordpress manually Attach Images to Post using SQL -

Wordpress manually Attach Images to Post using SQL - i have created custom post type called products , need associate multiple images 1 product. actual info exists in different non-wordpress database in table called productimages has productid, imageurl, , image title. need convert info wordpress format wordpress can display need. done regularly using sql automatically deleting products , meta info related , re-adding our main database changes regularly. from can tell, best way create work manually utilize sql insert productimages attachment posts wordpress when upload media wordpress. associate image product have manually insert records postmeta info in postmeta serialized or , unsure how insert info in right serialize format using mysql. possible mysql? am going wrong? should doing different? going utilize custom fields till realized custom field can have 1 value , needed 2 values: imageurl , imagetitle each image. seems programatically creating post type of at...

flash - Actionscript Button click to Flv video Help -

flash - Actionscript Button click to Flv video Help - i'm new @ actionscript , not sure how this. i have button named btnplay , flv video named valerie.flv when button pressed, flv video plays in same flash file through standard flv player. i tried , have no idea. appreciate help. as3 solution: this takes place on 1 frame in timeline. components panel > video > flv playback <-- drag component on stage in component inspector panel, flv playback instance selected, set: source: valerie.flv (this relative html path work if flv in same folder html , swfs) autoplay: false then, flv playback instance selected, in properties panel, set: myvideo instance name components panel > user interface > button <-- drag on stage with button instance selected, in properties panel, set: mybutton instance name in component inspector panel, button instance selected, set: label: play video with frame selected both these components on, open ac...

eclipse - Source Code shows as rectangles instead of characters -

eclipse - Source Code shows as rectangles instead of characters - i've weird problem: after upgrading ubuntu 10.10. 11.04 (new installation), have weird problems eclipse editor. when writing java code (new project created) type system.out.println("bla") and "out" shown rectangles only. weird half sec see "system.out.println" , editor changes system.[][][].println (not [] (here used 2 brackets), shown rectangles). see attached file example. this weird. i've never had before ubuntu, java or eclipse version. currently, use: ubuntu 11.04. eclipse 3.6 (latest download june 7th) , java 1.6.0_25. eclipse , ubuntu terminal set utf-8. the problem happens when using kde instead of gnome. any ideas wrong here , how prepare this? you have syntax highlighting set, , font or font style whatever type "out" classified in syntax highlighting (class variable?) cannot found. eclipse

comparison - What are the general rules for comparing different data types in C? -

comparison - What are the general rules for comparing different data types in C? - lets have next scenarios: int = 10; short s = 5; if (s == i){ stuff... } else if (s < i) { stuff... } when c comparing convert smaller info type, in case short int or convert info type on right info type on left? in case int short? this governed usual arithmetic conversions. simple cases, general rule of thumb type "less" precision converted match type "more" precision, gets complex 1 time start mixing signed , unsigned . in c99, described section 6.3.1.8, include here convenience: first, if corresponding real type of either operand long double , other operand converted, without alter of type domain, type corresponding real type long double . otherwise, if corresponding real type of either operand double , other operand converted, without alter of type domain, type corresponding real type double . otherwise, if co...

sql - Disallow duplicate columns for more than one other column value? -

sql - Disallow duplicate columns for more than one other column value? - the reply i've come close accepting 1 involving setting of unique constraint on column. what need is: ...in sql, disallow duplicate entries between 2 columns. so, have 2 columns, 'parcel' , 'year'. how go disallowing duplicate entry of parcel = 1, year = 1, , parcel = 1, year = 1? need while still allowing duplicates in each respective column, disallowing add unique constraint spans 2 columns: alter table table_name add together constraint constraint_name unique (parcel, year); sql sql-server sql-server-2008

How to find whether phone is in sleep/idle mode for Android -

How to find whether phone is in sleep/idle mode for Android - how find whether phone in sleep/idle mode android? my problem able wake phone sleepmode using alarm manager but when phone not sleep mode , @ same instant if alarm manager used wake phone..android forcefulness closes app.. whether there anyway find whether phone in sleep or idle mode?(black screen) update: my requirement: when phone in sleep mode ---> intent should launched service when phone not in sleep mode --> same intent should launched service none of solutions below worked here little tweak worked :):) //pending intent alarm manager intent intentaa=new intent(this,mybroadcastreceiver.class); pendingintent pendingintent = pendingintent.getbroadcast(this, 0, intentaa, 0); //intent launched myintent intent intent intenta = new intent(); intenta.setclass(this, myintent.class); intenta.setflags(intent.flag_activity_new_task); //real code seek { startactivity(intenta);...

ruby on rails 3 - Having a problem with my Model query -

ruby on rails 3 - Having a problem with my Model query - pls have next code in model letter.count(:id, :conditions => ["language_id = #{lang} , :created_at => '#{start_date.to_date.strftime('%y-%m-%d')}'..'#{end_date.to_date.strftime('%y-%m-%d')}' " ]) i trying count of letters.id of different letters between given dates. error having... please know doing wrong...thanks sqlite3::sqlexception: near ">": syntax error: select count("letters"."id") "letters" ("letters".language_id = 1) , (language_id = 1 , :created_at => '2011-05-01'..'2011-05-08 this can much simplified. couple points: you don't utilize :created_at => ... format within string you need utilize between ? , ? dates. you don't need manually strftime dates, rails handle automatically. in rails 3, preferred way utilize where(...) instead of :conditions hash count(...)...

php - Unable to set up pagelime with a codeigniter site -

php - Unable to set up pagelime with a codeigniter site - i'm trying setup pagelime work codeigniter site of mine , looks have setup because can view , edit site in pagelime, when publish page i've edited, says successfuly, if go webpage, doesn't contain of changes made. i'm guessing might have way codeigniter url's work because when setting site, asks url+index page. tried setting index page http://example.com/index.php/controller/index pagelime adds index.php url looks - http://example.com/index.php/controller/index/index.php . has setup codeigniter site on pagelime , can help me issue? i have , way pagelime works not work ci framework since have found out, pagelime setup standard websites. ie: pages in root , subpages follow link construction link homepage.com/pictures/album1 should in root of ftp in pictures folder , album1 whereas know pictures "folder" nil more controller. hope explained right or can decode trying there. php ...

c# - Regex accent insensitive? -

c# - Regex accent insensitive? - i need regex in c# program. i've capture name of file specific structure. i used \w char class, problem class doesn't match accented char. then how this? don't want set used accented letter in pattern because can theoretically set every accent on every letter. so though there maybe syntax, want case insensitive(or class takes in business relationship accent), or "regex" alternative allows me case insensitive. do know this? thank much case-insensite works me in example: string input =@"âãäåæçèéêëìíîïðñòóôõøùúûüýþÿı"; string pattern = @"\w+"; matchcollection matches = regex.matches (input, pattern, regexoptions.ignorecase); c# regex diacritics non-ascii-characters

javascript - Convert RGB to RGBA over white -

javascript - Convert RGB to RGBA over white - i have hex color, e.g. #f4f8fb (or rgb(244, 248, 251) ) want converted as-transparent-as-possible rgba color (when displayed on white). create sense? i'm looking algorithm, or @ to the lowest degree thought of algorithm how so. for example: rgb( 128, 128, 255 ) --> rgba( 0, 0, 255, .5 ) rgb( 152, 177, 202 ) --> rgba( 50, 100, 150, .5 ) // can better(lower alpha) ideas? fyi solution based on guffa's answer: class="lang-js prettyprint-override"> function rgbtorgba(r, g, b){ if((g==void 0) && (typeof r == 'string')){ r = r.replace(/^\s*#|\s*$/g, ''); if(r.length == 3){ r = r.replace(/(.)/g, '$1$1'); } g = parseint(r.substr(2, 2), 16); b = parseint(r.substr(4, 2), 16); r = parseint(r.substr(0, 2), 16); } var min, = ( 255 - (min = math.min(r, g, b)) ) / 255; homecoming { ...

Firefox addon change about:blank -

Firefox addon change about:blank - i alter about:blank page url of firefox addon homepage page. how alter default new tab url or can give new tab default url? i'm using firefox add-on sdk. you utilize combination of tabopen event , window.location method. firefox firefox-addon firefox-addon-sdk

php - Dynamic drop down menu from Mysql Result set -

php - Dynamic drop down menu from Mysql Result set - i create dynamic menu next result set. html construction should follows, <ul class="menu"> <li>menu 1</li> <ul class='submenu'> <li>submenu1</li> <li>submenu2</li> </ul> <li>menu2</li> <ul class='submenu'> <li>submenu1</li> <li>submenu2</li> </ul> <li>menu 3</li> </ul> tried following, <?php $cat = 0;?> <?php foreach($this->submenus $submenu): ?> <?php if($cat!= $submenu->category_id): ?> <li><?php echo $submenu->category_name ?></li> <?php echo (!empty($submenu->subcategory_name))?'<ul>':''; ?> <?php $flag = $submenu->category_id; ?> <?php e...

c# - ScriptSharp: myObject.prototype = new myOtherObject; -

c# - ScriptSharp: myObject.prototype = new myOtherObject; - how can reproduce in scriptsharp (c#): myobject = function(input) { } myobject.prototype = new myotherobject; when you're using script# you're using c# syntax create classes, derive classes etc. so define class myobject , have derive other class myotherobject, , allow compiler , bootstrapper script (mscorlib.js) set inheritance @ runtime. the whole point have natural oop syntax, rather work simulation manually chaining prototypes. hope helps. c# javascript asp.net script#

login POST form with cURL -

login POST form with cURL - i trying login website www.centralgreen.com.sg/login.php using curl (first time user of curl) i used tamper plugin firefox, , have 4 post inputs: login=mylogin password=mypassword button_dologin.x=33 button_dologin.y=6 i tried utilize curl 1 time again using curl.exe --data 'login=mylogin&password=mypassword&button_dologin.x=33&button_dologin.y=6' www.centralgreen.com.sg/login.php?ccsform=login but login apparently doesn't go through (the output of command same form, filled password, , error message the value in field username required.) here total list of info tamper host centralgreen.com.sg user-agent mozilla/5.0 (windows nt 5.1; rv:2.0) gecko/20100101 firefox/4.0 take text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 take language en-us,en;q=0.5 take encoding gzip, deflate take charset iso-8859-1,utf-8;q=0.7,*;q=0.7 maintain live 115 connection keep-alive referer http://centralgreen.c...

create instance of unknown derived class in C++ -

create instance of unknown derived class in C++ - let's have pointer base of operations class , want create new instance of object's derived class. how can this? class base of operations { // virtual }; class derived : base of operations { // ... }; void somefunction(base *b) { base of operations *newinstance = new derived(); // here don't know how can derived class type *b } void test() { derived *d = new derived(); somefunction(d); } cloning struct base of operations { virtual base* clone() { homecoming new base(*this); } }; struct derived : base of operations { virtual base* clone() { homecoming new derived(*this); } }; void somefunction(base* b) { base* newinstance = b->clone(); } int main() { derived* d = new derived(); somefunction(d); } this pretty typical pattern. creating new objects struct base of operations { virtual base* create_blank() { homecoming new base; } }; struct deriv...

Missing XML tags when the .xml files are extracted from webservice and viewed on Android -

Missing XML tags when the .xml files are extracted from webservice and viewed on Android - this first time using webservice , i' trying create webservice sends .xml replies (with tags) android device. when browsing through .xml url through browser, tags nicely presented. when i'm browsing same .xml url through android devices, tags have been removed , space separated values. is mutual happen ? xml tags still nowadays made "invisible" when viewing on android devices ? create difference when parse on device ? it depends on viewer you're using. of them show xml without info how display (called xslt) way describe – tags not visible, text within them (similar happens when unknown elements encountered in html). if want write application android parses xml, it's going read normally, tags intact. android xml web-services

properties - Any tool that can do partial code generation based on javabean rules(setter and getter method) -

properties - Any tool that can do partial code generation based on javabean rules(setter and getter method) - say if have class in java , want javabean(those getter , setter methods) the class write: class myclass{ string var1; integer var2; ........ many other properties ........ } after partial code generation based on javabean rules:(if there tool!) class myclass{ string var1; integer var2; ........ many other properties ........ public void setvar1(string var1){ this.var1=var1; } public string getvar1(){ homecoming var1; } public void setvar2(integer var2){ this.var1=var1; } public integer getvar2(){ homecoming var2; } ............ many other getter , setter method ............ } it tedious have write getter , setter methods properties in order create myclass javabean. is there software or ide plugin can help rest of work long give properties. t...

content management system - Rails 3 CMS + blog wanted to fit existing site. Unobtrusive and Lightweight -

content management system - Rails 3 CMS + blog wanted to fit existing site. Unobtrusive and Lightweight - i'd add together cms , blog web app. 1 won't in way. there's not lot of content, plenty want non-devs able revise pages , add together , remove them too. we have substantial app can't touched cms, not site we're migrating. how have dealt situation? would advise: running 2 apps (a content app , 'app' app) plugging in lite weight cms rolling our own using gems/plugins wysiwyg details we'll adding bug ticketing , back upwards scheme later too. built app. we'd users of app able comment on pages , blog posts, file tickets, etc. main account, seems create sense build our app, rather app. love hear war stories on this. should be: unobtrusive (shouldn't interfere existing app) must not mess devise, declarativeauthorization, or omniauth. we've got extensive user accounts, permissions, authentication mechanisms , gro...

Is it possible to trace what exactly Magento is doing? -

Is it possible to trace what exactly Magento is doing? - is possible see route chosen, controller, etc.? i know can turn on inline tracing doesn't seem sufficient. look alan storms commerce bug module , highly recommend setting x-debug. magento

Flex 3: Can anybody see why this dictionary isn't working? -

Flex 3: Can anybody see why this dictionary isn't working? - so, in main mxml, have variable defined such: [bindable] public var studentslistdict:dictionary = new dictionary; i have next imported: import flash.utils.dictionary; i have httpservice imports xml file: <mx:httpservice id="studentshttp" url="students.xml" resultformat="e4x" makeobjectsbindable="true" result="createstudentscollection(event)" /> the createstudentscollection function follows: private function createstudentscollection(e:resultevent):void { var xmllist:xmllist = xml(e.result).student; var dupstring:string = "|"; var temparray:array = new array; studentslistdict = new dictionary; (var i:int = 0; < xmllist.length(); i++) { if (dupstring.indexof(string("|" + xmllist[i].name) + "|") == -1) { temparray = new array; temparray[0] = xmllis...

osx - Apple keychain private/public key issue -

osx - Apple keychain private/public key issue - i accidentally deleted private , public key pair of certificate, can't find helpful undo or add together certificate again. actually developement certificate has expired, redownloaded new one. wanted add together private/public key new certificate. , there happend, deleted it. how can these , set them actual certificate again. i had issue 2 days ago. open keychain access what have create backups of certificates , go , delete private , public keys , certificates on machine relevant apple. then in keychain access click on keychain access(menu bar) , in menu select certificate assistant -> request certificate certificate authority. enter details , create sure saved disk , allow me specify key chain pair selected. save it. on next screen: these values must be: key size: 2048 bits algorithm: rsa you need log provisioning portal on apple's website , revoke certificates there. then click distri...

c# - Can repeated failed login attempts using ValidateCredentials cause user to get locked out? -

c# - Can repeated failed login attempts using ValidateCredentials cause user to get locked out? - i had implement security solution validates user credentials against ldap/ad server. the code this... using (principalcontext context = new principalcontext(contexttype.domain, domain)) { homecoming context.validatecredentials(username, password); } will repeated attempts user login using method, cause business relationship locked out based on ad/ldap rules? thank you, tony. edit: looking reply know if have handle user lock out or if auth server me. yes, if application has bad pw information, a/d lock user out. great illustration of happening in practice windows services running on user accounts...user changes pw , service isn't updated , user locked out. c# .net authentication active-directory ldap

Executing PL/SQL Begin/End procedure from Oracle JDBC thin driver -

Executing PL/SQL Begin/End procedure from Oracle JDBC thin driver - i trying create oracle pl/sql procedures , execute them via oracle jdbc (thin driver). here total pl/sql script: begin in (select owner, constraint_name, table_name all_constraints owner = 'schema' , status = 'enabled') loop execute immediate 'alter table schema.'||i.table_name||' disable constraint schema.'||i.constraint_name||''; end loop; end; / begin in (select table_name all_tables owner = 'schema') loop execute immediate 'truncate table schema.'||i.table_name||''; end loop; end; / begin in (select owner, constraint_name, table_name all_constraints owner = 'schema' , status = 'disabled') loop execute immediate 'alter table schema.'||i.table_name||' enable constraint schema.'||i.constraint_name||''; end loop; end; / in java splitting on '/' each begin end block executed in separate statement....

javascript - Best webpage editor for Ubuntu -

javascript - Best webpage editor for Ubuntu - i need create plain html, javascript, , css pages. thing keeps me away simple text editor because there no native method "master pages". hoping there kind of html editor ubuntu back upwards simple method incorporate simple scheme master pages. edit actually, maybe 1 windows nice point out ;) kompozer may you're looking for: it's wysiwyg editor uses same rendering engine firefox. offers back upwards working css styles , can tweak html / css generated programme if need be. you can install on ubuntu running: sudo apt-get install kompozer ...in terminal. edit: kompozer offers windows version same functionality. javascript html css ubuntu master-pages

pagemethods - Can you use AJAX page methods to make non-static function calls? -

pagemethods - Can you use AJAX page methods to make non-static function calls? - javascript: pagemethods.drageventtoevent(event.text(), event.parent().parent().text(), cell.parent().text(), onsucceeded, onfailed); c# function: [webmethod] public static void drageventtoevent(string evt, string startcell, string endcell) { //blahblah } this "works", it's static call. need non-static phone call here. can done page methods? no cant utilize non-static function calls pagemethods. use system.web.ui.icallbackeventhandler instead. implementing client callbacks programmatically without postbacks in asp.net web pages example 1: asynchronous client script callbacks example 2: using icallbackeventhandler in asp.net gl hf ;) ajax pagemethods

c# - in Entity framework, how to call a method on Entity before saving -

c# - in Entity framework, how to call a method on Entity before saving - below have created demo entity demonstrate iam looking for public class user : ivalidatableobject { public string name{get;set;} [required] public datetime creationdate{get;set;} public datetime updatedondate{get;set;} public ienumerable<validationresult> validate(validationcontext validationcontext) { if(name="abc") { yield homecoming new validationresult("please take other name abc", new[] { "name" }); } } } i implementing ivalidatableobject interface create entity selfvalidating. now create new user iam doing this user u= new user(); u.name="some name"; u.creationdate=datetime.now dbcontext.users.add(u); dbcontext.savechanges(); iam planning shift u.creationdate=datetime.now; code within user class. , implement interface provides method executed befor...