Posts

Showing posts from June, 2014

Using JavaScript from Selenium RC by Java -

i have following function in user-extensions.js file:selenium.prototype.dotyperepeated = function(locator, text) { // locator-strategies automatically handled "findelement" var element = this.page().findelement(locator); // create text type var valuetotype = text + text; // replace element text new text this.page().replacetext(element, valuetotype); }; i using selenium rc java. have java class file "services_procmethodreoi.java". used following line in java file call javascript function typerepeated() : selenium.geteval("typerepeated(\"txtappcode\", \"service5\")"); //txtappcode textfield , service5 inputted text on textfield when ran java file using eclipse, found following error: com.thoughtworks.selenium.seleniumexception: error: threw exception: object expected pls suggest me how can solve it. you need use docommand method fire off new command have created. there documentation

prolog - cannibals and missionaries -

i newbie prolog , started learning prolog. found missionaries , cannibals puzzle interesting solve in prolog. have researched lot of forums , found link think solution. how not getting actual result. moves on output seem wrong. tried trace program, seems perfect during assignment of values somehow solution wrong. i need experts know logical error. source: http://www.enrico-franchi.org/2008/12/missionaries-cannibals-and-prolog.html as discussed in comments of post, there no logical error, ill chosen output format.

Devise/Ruby on Rails: NoMethodError in Devise/sessionsController#create when trying to login existing user -

i have ror application devise user authentication. devise used local user registration / authentication. latest devise suppose :omniauthable - supporting facebook , other logins. tried doing described in instruction: https://github.com/plataformatec/devise/wiki/omniauth:-overview facebook authentication started work. problem when local user tries login now, error: nomethoderror in devise/sessionscontroller#create undefined method `redirect_location' # so, facebook login works, , local login doesn't. hint might going wrong? seems mixup gemsets , using different stuff different versions of devise.

html - Why does Opera 9 have a space between these two images? -

every other browser rendering correctly. <body> <div> <div><img src="img/logo_top.png" width="168" height="85" alt="logo top" /></div> <div><img src="img/logo_bottom.png" width="168" height="83" alt="logo bottom" /></div> </div> </body> it's same thing without divs, , < br /> between images. update: here html, doctype: <!doctype html public "-//w3c//dtd xhtml 1.1//en" "http://www.w3.org/tr/xhtml11/dtd/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <head> <title>test</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <style type="text/css"> img {border: none;} body {font-size: 0px;}

android - Add / Remove App Drawer Shortcuts -

i trying programmatically add , remove application shortcuts app drawer. understand app drawer knows applications should presented using intent filter launcher category. i able add/remove shortcuts specific activities in application, according dynamic conditions, why can't have them in manifest file. thank you. as far know, not possible. unfortunately, current android api level there no way add intentfilter s activity objects through code. check out this doc on intent filters. relevant quote: an intent filter instance of intentfilter class. however, since android system must know capabilities of component before can launch component, intent filters not set in java code, in application's manifest file (androidmanifest.xml) elements. (the 1 exception filters broadcast receivers registered dynamically calling context.registerreceiver(); directly created intentfilter objects.)

I am trying to make a POST request to a URL using Curl but getting this error? -

error: request entity large requested resource /check.php not allow request data post requests, or amount of data provided in request exceeds capacity limit. whar reason error? think data size cannot reason , know ./check.php accepts post method. security lmiting access? regards, aqif if want use post have use curlopt_post , curlopt_postfields in order. having result handy debugging well. <?php $params=array( 'a'=>'text1', 'b'=>'text2' ); $curl=curl_init(); curl_setopt($curl, curlopt_post, true); curl_setopt($curl, curlopt_postfields, $params); curl_setopt($curl, curlopt_returntransfer, true); $result=curl_exec($curl); print $result; edit: note, if want send no parameters post, use empty array. empty string break curl.

TTS - Text to Speech Synthesis System -

i trying make html page including tts - text speech synthesis system feature. please suggest me online demos. also please let me know if google providing api tts - text speech synthesis system. thanks lot. unofficial google api , limit 100 characters http://translate.google.com/translate_tts?q=hello+sanket

Access like tool for MySQL -

i looking tool work mysql database. in particular, interested in tool has same "subdatasheet" feature in ms access. functionality, joins table , shows them tree , easy edit value. i looked @ posts here, , had @ sqlyog. other alternative subdatasheet feature? take @ base (open office), can connect mysql database.

html - jQuery noob: (this).replacewith am I doing it wrong? -

i've been learning more , more jquery here i've become stuck. i have code change color of div when checkbox cliked, works fine. after want able change contents of textarea on focus, tried this: //textarea $("textarea").focus(function(){ if ($(this).contains('skriv valg av headset her')){ $(this).replacewith(''); }); but there no effect. have syntax errors or taking wrong approach? jsfiddle example here . there's $.contains function , :contains selector, no jquery.fn.contains . you're looking val here believe: $('textarea').focus(function(){ var t = $(this); if(t.val().indexof('skriv valg av headset her') !== -1) { t.val(''); } }); replacewith wrong here - if work (and shouldn't believe because takes either dom element or html text) remove textarea element (which better done remove anyway)

javascript - how to update time regularly? -

function timeclock() { settimeout("timeclock()", 1000); = new date(); alert(now); f_date = now.getdate()+" "+strmonth(now.getmonth())+" "+now.getfullyear()+" / "+timeformat(now.gethours(), now.getminutes()); return f_date; } <span class="foo"><script type="text/javascript">document.write(timeclock());</script></span> alert(now); gives me value every second not updated in html. how can update time on html without refresh page? there number of mistakes in code. without use of var infront of variable declarations, leak them global scope. also, use of document.write discouraged . here's how it: javascript: function updateclock() { var = new date(), // current date months = ['january', 'february', '...']; // idea time = now.gethours() + ':' + now.getminutes(), // again, idea // cleaner way s

security - CouchDB Authentication -

i've read lot of things authentication in couchdb, regarding cookie authentication. i'm still making tests , seems working well, instance command : curl -vx post $host/_session -h 'application/x-www-form-urlencoded' -d 'name=foo&password=bar' i cookie can use. point is, anytime see think kind of sample on web, username , password sent in plain text. i'm new security what's interest of cookie auth method if first have send credentials in clear ? is there way send @ least password hashed ? idk : curl -vx post $host/_session -h 'application/x-www-form-urlencoded' -d 'name=foo&hashed_password=hashed_bar' cheers arnaud if send password hashed attacker needs know hashed password wouldn't solve problem of sending password in cleartext - have problem of sending hash in cleartext. also remember if solved problem still sending cookie in cleartext being vulnerable session hijacking. (there's htt

winapi - Deleting contents of silverlight isolated storage from an MSI -

i have scenario msi needs delete contents of silverlight isolated storage directory particular silverlight app. since location of isolated storage app different user-to-user/machine-to-machine, msi can't directly , needs call out sort of script/executable job done. question 2 parts what's best way determine location of silverlight isolated storage particular silverlight app? current thinking walk folders underneath <user>\appdata\locallow\microsoft\silverlight\is\ , find id.dat file matches app. what framework/language should use write program (1) above , delete contents of folder? have few external dependencies possible; e.g., .net, msi require user have .net delete couple of files (unfortunately, unacceptable). for (2), i'm thinking straight win32 app or vbscript, have no experience win32, , i'm not sure of hurdles may need jump through if people have disabled vbscript security reasons. to identify directory i'd write empty file gu

asp.net mvc 3 - Rewriting Html.BeginForm() in MVC 3.0 and keeping unobtrusive javascript -

this going seem bit of silly endeavor, it's want learn nonetheless. right now, in asp.net mvc 3.0, need use syntax @using (html.beginform()) { , later, } close form block fancy new 'unobtrusive javascript', lest want write of hand (which fine). for reason ( read: *ocd* ) don't that. i'd rather this.. @html.beginform() <div class="happy-css"> </div> @html.endform() seem stupid yet? yeah, each own. want understand why working how , mold liking. thought first place start digging mvc 3.0 source itself. jumped codeplex find beginform extension method. ( http://aspnet.codeplex.com/sourcecontrol/changeset/view/63452#288009 ) so little confused how begin achieving goal. reading through code, discovered go down root method (not surprising, extension methods seem hierarchical methods reaching down single 1 avoid redundancy). private static mvcform formhelper(this htmlhelper htmlhelper, string formaction, formmethod method, idiction

javascript - How do I avoid looping through an array to find a partial match? -

i looping through array of english phrases, , if find match, current text node, replace it's translation in non_english array. of works 100% exact matches. but partial matches, need use .match command, allows partial matches. my code search exact matches this: var found = $.inarray(value,en_lang); then if there found value, replacement of text. method fast , love it. however partial word/phrase matching, have use looping code. // loop thru language arrays (var x = en_count; x > 0; x--) { // assign current from/to variables replace var = en_lang[x]; var = other_lang[x]; // if value match translation if (value.match(from)) { content(node, value.replace(from, to)); } // mark node translated if ($.browser.msie == 'false') { $(node).data('translated', 'yes'); } } this job pretty slow. after lot of research, have found can convert english array list-based string via join command. but unable come function search list partial

How to implement MATLAB-like cell mode in Vim -

in matlab, can write editor following %% -- example cell -- plot(rand(3)); %% -- cell a=rand(2^10); t=linspace(-pi,pi,2^10); compass(fft(a*sin(t)) and can hit ctrl + enter run cell being clicked mouse pointer. now know in vim, can :'<,>'w !matlab run visually selected block of code. but how implement matlab-like cell mode in vim/gvim? for example python code import os import subprocess import random ## 1st cell ps =["python", "-h"] out = subprocess.popen(ps).communicate()[0] print out ## 2nd cell # import random -sould not needed if concatenate import section , cell print random.randint(1,100) can offer ideas? not sure you're asking, if want process cell block upon double-clicking in block mouse, can map mouse-double-click (the <2-leftmouse> mapping) call function: nnoremap <buffer> <2-leftmouse> :call processmousedoubleclick()<cr> processmousedoubleclick() function (1) visually selec

opengl es - How do I overlay a textview over a glsufaceview(android) -

ive been following android opengl tutorials @ http://blog.jayway.com/2009/12/03/opengl-es-tutorial-for-android-part-i/ , have searched on how go adding hud type display. simplest solution seems to overlay textview on glsurfaceview cannot find examples online.does know of examples?? simply include both views in layout, 1 on top of other so: <merge> <your.package.yourglsurfaceview/> <textview .../> </merge>

android - Refactor > Move overlaps the location of another project -

i trying move android project difference directory in workspace, using refactor > move. the problem "move project" dialog box keeps ok button disabled, while issuing following message in red: \winshare\sandbox\workspace\newdirname overlaps location of project: newdirname the funny thing is... directory named newdirname doesn't exist! (i later tried creating such directory outside of eclipse didn't help) any idea why is? i using eclipse 3.6.1 64-bit latest android sdk 9 (under windows 7). delete project. not delete resources filesystem. you can rename project folder outside of eclipse (using command line or file manager gui) now import project workspace (file -> import -> existing project workspace. the error message you're getting misleading. refactoring operations not intended projects. problem plugin should remove refactor options when selected item project rather package or class.

flash - Make a Flex/AIR scroller with an HGroup "snap" to each item when scrolling completes -

i'm developing app android devices using flash builder burrito , having trouble figuring out how accomplish 1 aspect of app. i have hgroup inside of scroller. hgroup has images 400px in width , have width of each hgroup column set 400px. although number of items dynamic, assume have 10 images in hgroup. width of scroller , viewport set 400px. so far -- user can see single image within scroller. user can scroll left or right using touch or mouse , see each image. here's i'm stuck. want make when user stops scrolling scroller "snaps" image view. in other words, don't want half of 1 image , half of image in viewport. seems pretty straightforward can't figure out. part of issue there doesn't seem event use purpose. know can hook in propertychangeevent.property_change or mouseevent.mouse_up/touchevent.touch_end (which i'm doing now) event doesn't give me need. i need event fires when user releases mouse part of scroll or lifts

YUI Radiobutton ASP.Net oncheckedchanged -

i'm using yui framework style radiobuttons , want use oncheckedchanged event redirect page. works fine traditional radiobuttons using yui framework oncheckedchanged event never fires. if yui has built in function replacing it. there workarounds this? so yui replaces <input type='radio'... html looks <span><span><button /></span></span> so whatever function attaching oncheckedchanged event, have attach click or change event using yui's api, it'd this. var buttongroup = new yahoo.widget.buttongroup("radiogroup"); //init buttons var buttons = buttongroup.getbuttons(); //get buttons buttons[0].on('click', function(){alert('a');}); //attach event, need iterate buttons array attach events buttons

arm - Problems with static local variables with relocatable code -

i building project has relocatable code on bare metal. cortex m3 embedded application. not have dynamic linker , have implemented relocations in startup code. mostly working local static variables appear incorrectly located. address offset amount executable offset in memory - ie compile code if loaded @ memory location 0 load in memory located @ 0x8000. static local variable have memory address offset 0x8000 not good. my global variables located got static local variables not in got @ (at least don't appear when run readelf -r ). compiling code -fpic , linker has -fpic , -pie specified. think must missing compile and/or link option either instruct gcc use got static local variables or instruct use absolute addressing them. it seems code adds pc location of static local variables. i think have repeated seeing: statloc.c unsigned int glob; unsigned int fun ( unsigned int ) { static unsigned int loc; if(a==0) loc=7; return(a+glob+loc);

multithreading - Python 2.6 threading KeyError with Apache -

i'm running apache, installed using macports on os x, serve django app. i'm getting many lines in apache error_log these: [wed feb 23 11:35:42 2011] [error] exception keyerror: keyerror(-1606572256,) in <module 'threading' '/opt/local/library/frameworks/python.framework/versions/2.6/lib/python2.6/threading.pyc'> ignored the server doesn't seem having noticeable problems while these errors logged, crash every requiring manual restart - may or may not related these error messages. any ideas? that bug year old. update mod_wsgi.

ruby - How to return an object from two tables form a rails web serivce? -

i have 2 activerecord models: event , place. event has property name place_id points place. place has column named place_name. how write web service returns json of events each event holds associated place_name value. i tried adding attr_accessor field name place_name event model , populate manually after selecting events. when do: render :json => events_collection_result the place_name doesn't appear in json. all of logic falls under activerecord associations . it's fundamental piece of rails functionality, it's documented. guide should more suffice. you'll want invoke belongs_to :place if event class definition. there, can access event's place name via @event.place.place_name , although i'd recommend rename place_name name . json won't display association default. there plenty of ways remedy this, basic of overwrite event#to_json , method called default when rails attempts produce json representation of activerecord instance.

Eclipse Java launch configuration file path -

i'm looking file eclipse stores launch configurations. i'm doing java development in ubuntu. one of executables i'm developing requires output executable argument it. say, output of 'b' needs passed commandline argument 'a'. in eclipse, don't want manually change "run configuration" every time. eclipse store these configurations esp arguments? i found "eclipsearguments.txt" in extras folder of project isn't same arguments i'm passing run configurations. ".project" file doesn't contain either. i'm confused. thanks help. you can find configuration files in : <workspace>/.metadata/.plugins/org.eclipse.debug.core/.launches there should *.launch file every configuration have in workspace stored there.

silverlight - Why is my MEF usage not CLS-compliant? -

when compile silverlight application, of elements decorated mef attributes warning of cls-noncompliance. when compile again, warnings not return, , application seems run fine. need worry about? i'm using standard naming convention properties, classes, , such. time use underscores private members. i'd assume assembly mef attributes contained in not have clscompliant attribute set. ie, if reference silverlight class library, class library should have attribute set in assemblyinfo file: [assembly: clscompliant(true)]

jQuery TableSorter Remember Sort Preferences? -

is possible somehow store or cache sort preferences. if can store them php session or can associate current search (it's returning search results) , it's sort preferences can go , see stuff in order... any way this? thanks! well can specify sort when set tablesorter, this: $("table").tablesorter({ // sort on first column , third column, order asc sortlist: [[0,0],[2,0]] }); so if store object , pass sortlist option, sure!

iphone - UIButton in a custom UIView trouble -

i have simple (view-based) application. want on tapping on custom uiview button moved somewhere inside view (for example point 10,10). my custom uiview drawview (drawview.h , drawview.m). rotatorviewcontroller (h. , .m). i add drawview uibutton, connect outlets drawview , uibutton. add uitapgesturerecognizer in rotatorviewcontroller , @selector(tap:). here code of uitapgesturerecognizer - (void)viewdidload { [super viewdidload]; uigesturerecognizer *tapgr = [[uitapgesturerecognizer alloc] initwithtarget:drawview action:@selector(tap:)]; [drawview addgesturerecognizer:tapgr]; [tapgr release]; } @selector(tap:) - (void) tap:(uitapgesturerecognizer *)gesture { mybutton.transform = cgaffinetransformmaketranslation(10, 10); } but when tap anywhere in drawview application crashes. here log console 2011-02-23 20:59:24.897 rotator[7345:207] -[drawview tap:]: unrecognized selector sent instance 0x4d0fa80 2011-02-23 20:59:24.900 rotator[7345:207]

java - Display forwarded JSP with url-pattern "/*" -

to improve java skills, i'm trying build simple j2ee framework (mvc). i built handle every request in frontservlet. here mapping used : web.xml : <servlet> <servlet-name>front</servlet-name> <servlet-class>test.frontservlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>front</servlet-name> <url-pattern>/*</url-pattern> </servlet-mapping> my problem when forward request frontservlet jsp, obviously, jsp request handle frontservlet , view isn't rendered. how can resolve problem keeping url-pattern "/*" ? is there way render jsp in servlet without performance losses ? thanks in advance reply ! solution 1 (@bryan kyle) i'm trying follow advise. created filter : public void dofilter(servletrequest request, servletresponse response, filterchain chain) throws ioexception, servletexception { httpservletrequest req = (ht

How to return failed validation parameters to a rails model form that doesn't know what page it's on? -

i have small contact request form appears on every page in site. form submits requestscontroller create method. if goes well, request saved in requests table , e-mail sent. if validation fails, redirect referrer page. here create action... def create @request = request.new(params[:request]) @location = location.find(params[:location_id]) if @request.save podsmailer.contact_request(@request, @location).deliver podsmailer.contact_confirmation(@request, @location).deliver flash[:notice] = "thanks! message sent. contact shortly." redirect_to :back else flash[:notice] = "errors -- please check form" flash[:errors] = @request.errors redirect_to ?????? end end my question when validation fails, how redirect referrer , send values entered form user? can't use named route because don't know request coming from. "redirect_to :back" works fine itself. can't figure out how send parameters. flash hash makes

Rails authorization necessary for post actions? -

i have app i'm writing in rails 3 w/ cancan , devise. i'm curious if authorizing post actions on controllers necessary or helpful security standpoint? assuming controller actions require authentication w/ devise (ie user must logged in). i can see why need authorization through cancan on controller actions use get's since user can input url wish visit freely , must locked down. however, posts user must post data form, protected against xss attack token. in case safe assume if limit visibility of, say, button in view cancan user wouldn't able submit form maliciously? thanks alot edit: thanks quick answer guys. has been pointed out below malicious user can forge form post using tools such firebug , authorization necessary. what best way simulate type of interaction (a user posting url form they've hacked) using capybara / cucumber? thanks again. a user can submit post request regardless of whether on website or not. you're correct in t

passing assumed-shape arrays in two levels of subroutines (Fortran 90) -

i have had problems calling successive subroutines assumed-shape arrays in fortran 90. more specifically, call 2 levels of subroutines, passing assumed-shape array parameter, in end array lost. demonstrate it, 1 can follow code below. program main interface subroutine sub1(x) real, dimension(:):: x real c end subroutine sub1 subroutine sub2(x) real, dimension(:):: x real c end subroutine sub2 end interface real, dimension(:), allocatable:: x allocate(x(1:10)) ! first executable command in main x(1) = 5. call sub1(x) write(*,*) 'result = ',x(1) deallocate(x) end program main subroutine sub1(x) ! first subroutine real, dimension(:):: x real c call sub2(x) end subroutine sub1 subroutine sub2(x) ! second subroutine real, dimension(:):: x real c c2=x(1) end subroutine sub2 very shortly, main allocates x call sub1(x). sub1 calls sub2(x). means allocated array passed subroutine passes

objective c - How to launch Facebook with Button -

hey friends created button on app called: "find on facebook". right ran situation need button launch facebook application. use such launching facebook application, detecting if there facebook application, , sorts of stuff that, thanks some googling shows facebook app apparently registers receive urls fb:// scheme. can construct fb:// url (like, fb://notes or something) , ask uiapplication object if can open url . if says can, open it .

asp.net - Display an image in an Image control using FileUpload -

i want show image in image control user select image file through fileupload control, don't want image saved on server. the best have uploaded memory, , without saving display using .ashx or something. edit before html5, perhaps have done having javascript function takes directory of uploaded file , sets img src property filepath. image load preview own hard drive. in html5 compliant browsers, filepath hidden can't use in javascript. happens in ie8, chrome, etc. here's messy way it. first, create javascript function handle fileupload controls onchange event. when event fires, post entire form. function uploadfile() { var value = $("#<%=futest.clientid %>").val(); if (value != '') { $("#form1").submit(); } } here upload control: <asp:fileupload runat="server" id="futest" onchange="uploadfile()" /> now, when chooses file,

android: unusual way to start activity -

in 1 activity need start 1 one condition: if started before must finished , started again. activity show information system state (theme.dialog style) can start services , on. far know when startactivity(intent) onresume() called (if activity started before). know how it? in 1 activity need start 1 one condition: if started before must finished , started again there nothing this. closest have combination of flag_activity_clear_task|flag_activity_new_task , has other side effects, such wiping out other activities. as far know when startactivity(intent) onresume() called (if activity started before). not default. default, second instance of activity created.

http - Android ClientLogin Authentication - HTTPURLConnect -

i have implemented httpoperations class in android can produce http post request. class extends asynctask can run in background. this used create http request authenticates google blogger service using clientlogin method (detailed here: http://code.google.com/apis/accounts/docs/authforinstalledapps.html ) recently have run issues getting filenotfoundexception if enter correct credentials. i'm puzzled few days ago working fine correct credentials , returning filenotfoundexception when entered wrong credentials. my questions be: why returning filenotfoundexception when post incorrect credentials - why not return string stating error=badauthentication when access via browser? https://www.google.com/accounts/clientlogin why experiencing issues correct credentials? may worth noting http post correct, know because if post http version of clientlogin rather https one, http 302 moved temporarily error page. my httpoperations class built using httpurlconnection cla

java - What is the proper way to display a complex dialog in an Eclipse plugin? -

i want complex dialog appear when user clicks button plugin adds, not find existing dialog type supports adding arbitrary controls. instead, thinking creating wizard 1 page - enough doesn't feel right. there better way create dialog complex controls? you want subclass org.eclipse.jface.dialogs.traydialog. give dialog button bar , slide out tray appear when click button. according javadoc of traydialog: it recommended subclass class instead of dialog in cases except dialog should never show tray you put complex code in createdialogarea(composite parent) method. if want right make sure use composite returned calling super instead of using parent. make sure margins set default. instance: protected control createdialogarea(composite parent) { composite parentwithmargins = (composite) super.createdialogarea(parent); /* * add code here parenting off of parentwithmargins */ return parentwithmargins; }

extjs - Ext - Dynamic Columns triggered by an event -

i have viewport , in center region have tabpanel.each tabpanel contain columns, , each column has panel 3-4 items. like... column a(week 1) column b(week 2) item a1 item b1 item a2 item b2 i want these columns dynamic. if columns week of calendar once month changes,the columns change.i have small calendar in east region of viewport , planning trigger column change using calendar. here code... <title>test</title> <link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css" /> <!-- tabs example files --> <link rel="stylesheet" type="text/css" href="tabs-example.css" /> <!-- common styles examples --> <link rel="stylesheet" type="text/css" href="../shared/examples.css" /> <link rel="stylesheet" type="text/css" href="../../resources/css/ex

iphone - Messaging instanciated objects in another class in Objective C -

i using uitableview within uipopover aim set property instantiated object using within original viewcontroller class(from popover launched). cant access declared object(from within viewcontroller class). have tried import viewcontroller class popover class, no avail, object isn't visible within popover class. guidance on appreciated. your popover controller wrapper place normal uiviewcontroller in give particular effect. therefore, variable in scope in popover controller, need set uiviewcontroller subclass property. @property (nonatomic, retain) thing *thing; so main view calling popover initialize uiviewcontroller property above, , pass init method uipopovercontroller , proceed normal.

rss - How to Use Regex to Ensure Complete Words While Adding a Character Limit to Yahoo Pipes? -

i'm pretty new this, excuse me if question isn't clear. i'm pulling rss feed yahoo pipes , using regex modify it. here's i'm trying do: limit number of characters in entry, but... make sure item includes complete words, and... if item shortened, add ellipses, but... if falls within limits nothing should done so, if feed's title is: "this article important" , limit 20 characters, result should "this article is..." if title "good article," nothing should happen it. after doing research think want combine if/then statement lookahead, i.e. go character limit , if there character following space, add ellipses, if number or letter, go final space within limit , add ellipses, if there isn't character following it, don't anything. make sense? there easier way i'm going for? i appreciate provide. thanks! try replacing title using following pattern: ^(?=.{23})(.{0,20})(?=\s).*$ with string $1...

php - PhpPgAdmin asks enter login and password -

i installed phppgadmin in centos. every time select object (database, table, schema,..) phppgadmin asks me enter login , password. left side menu (servers->postgresql) not connected. system centos 5 php version 5.1.6 postgresql8.3.11 thank you, g. padmanabhan. your problem sounds session lost. possible problem sources: browser not accept cookies php cannot store session data because session save path not exist, not writable or no space left

layout - Android - ListView that looks like 'settings' -

i create listview looks 'settings' in android (i.e. if click "sound & display" item, show items such "silent mode, ringer volume, etc"). looks preferencescreen time, doesn't configure anything. a clearer example: wanted when item category selected -- let's say, hospitals --, calls listview contains roster of hospitals around area. when 1 of items in roster selected, execute call intent , dial number. , if wanted go list, press button see other categories. thanks in advance! try this, android preferences and android - creating custom preferences activity screen

Setting the Cursor property in Silverlight has no effect -

i'm trying set cursor changes hand when mouse hovers item. doesn't seem have effect, cursor remains default one. example: <grid x:name="layoutroot" background="white"> <rectangle width="100" height="100" fill="black" cursor="arrow" /> </grid> any idea why? thanks! silly question, but...arrow default cursor. did try other cursors "hand" or "wait"?

Printing Infopath form 2010(.xml) in Sharepoint 2010 -

my question related printing infopath 2010 form in sharepoint 2010.i designed infopath 2010 form in infopath designer 2010 , published form library in sharepoint 2010.the end user fill form , store in .xml format in document library.now print form filled end user? ideas or suggestion above scenario?please consider both browser based forms , normal forms thanking in advance. for normal forms, have create print view. create word document can printed user's workstations. here link how design view printing: http://office.microsoft.com/en-us/infopath-help/design-a-view-that-is-optimized-for-printing-ha010151438.aspx unfortunately word print views not supported web-based forms. option create infopath view , design "print": controls labels or read only; sections visible, etc. [update] @surendra j: ok. there 2 things address separately. first of user should able request "print" operation right sharepoint view (and don't mean "b

Printing Infopath form 2010(.xml) in Sharepoint 2010 -

my question related printing infopath 2010 form in sharepoint 2010.i designed infopath 2010 form in infopath designer 2010 , published form library in sharepoint 2010.the end user fill form , store in .xml format in document library.now print form filled end user? ideas or suggestion above scenario?please consider both browser based forms , normal forms by default infopath print , work might want format things differently. create new view craft way want. print views, might want create controls show data in label format rather text boxes , display things yes/no fields text. take work can build out view that's customized print media. once you've created view select page design tab , under properties view click on print settings. there can set default print view, headers/footers are, etc.

com+ - what is the .net technology to replace Microsoft Transaction Server -

mts popular com+ service distributed transation control. wondeirng .net replacement since com+ phased out. afaik there no replacement mts in .net framework, integrated through system.enterpriseservices namespace, lookup servicedcomponent transaction control feature looking for. have @ msdn documentation of this.

cocoa - Using `NSCache` object which doesn't conform `NSDiscardableContent`? -

i read doc nscache . documentation says objects conforms nsdiscardablecontent removed on insufficient memory situation. class behave on classes don't conform nsdiscardablecontent protocol? yes, does. nscache behaves expected.

windows - UNIX format files with Powershell -

how create unix file format in powershell? using following create file, creates in windows format. "hello world" | out-file -filepath test.txt -append as understand, new line characters crlf make windows format file whereas unix format needs lf @ end of line. tried replacing crlf following, didn't work "hello world" | %{ $_.replace("`r`n","`n") } | out-file -filepath test.txt -append one ugly-looking answer (taking input dos.txt outputting unix.txt): [string]::join( "`n", (gc dos.txt)) | sc unix.txt but able make set-content , solution not stream , therefore not work on large files... and solution end file dos line ending well... not 100%

how to change values of a dropdown on key press using JavaScript -

i need change values of "focused" drop-down on keypress using javascript. i need, how focused drop-down or how can check whether drop-down has focus. how change drop-down values in key press 1,2,3 etc. using javascript. thanks in advance.

iphone - How can I move to another view controller when the user clicks on a row? -

i new iphone development, , want move page when user clicks on particular row. so, if click on first row, want page redirect first view controller, , on. each row has own view controller. first of don't need set different view controller each row (unless have reason doing that). the correct way set 1 view controller fit cells in raws , change data according selected row. the way is: in - didselectrowatindexpath function in implementation file shuld: - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { //allocate view controller detailedviewcontroller *detailedviewcontroller = [[detailedviewcontroller alloc] init]; //send properties view controller detailedviewcontroller.property1 = someproperty1; detailedviewcontroller.property2 = someproperty2; //push navigationcontroller [[self navigationcontroller] pushviewcontroller:detailedviewcontroller animated:yes]; [detai

iphone - Rotate UIImage custom degree -

Image
i want rotate uiimage (not uiimageview) in custom degree followed this post didn't work me. anyone can help? thanks. update: code below of job, lose of image after rotating it: what should change right? (btw yellow color in screenshots uiimageview bg) - (uiimage *) rotate: (uiimage *) image { double angle = 20; cgsize s = {image.size.width, image.size.height}; uigraphicsbeginimagecontext(s); cgcontextref ctx = uigraphicsgetcurrentcontext(); cgcontexttranslatectm(ctx, 0,image.size.height); cgcontextscalectm(ctx, 1.0, -1.0); cgcontextrotatectm(ctx, 2*m_pi*angle/360); cgcontextdrawimage(ctx,cgrectmake(0,0,image.size.width, image.size.height),image.cgimage); uiimage *newimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); return newimage; } this method return image on angle of rotate #pragma mark - #pragma mark rotate image - (uiimage *)scaleandrotateimage:(uiimage *)image { cg

c# - FFT on WP7 shows two mirrors -

hello i'm exploring audio possibilities of wp7 platform , first stumble i've had trying implement fft using cooley-tukey method. result of spectrogram shows 4 identical images in order: 1 normal, 1 reversed, 1 normal, 1 reversed. code taken c# project (for desktop), implementation , variables seem in place algorithm. can see 2 problems right away: reduced resolution , cpu wasted generate 4 identical spectrograms. given sample size of 1600 (could 2048) know have 512 usable frequency information leaves me 15hz resolution 8khz frequency span. not bad, not either. should give on code , use naudio? cannot seem have explanation why spectrum quadrupled, input data ok, algorithm seems ok. this sounds correct. have 2 mirrors, can assume 1 real part , other image part. standard fft. from real , image can compute magnitude or amplitude of each harmonic more common or compute angle or phase shift of each harmonic less common. gilad.

silverlight - Set DataGrid size to fit all its contents -

i need make datagrid size fit contents (even if datagrid bigger it's parent). possible? so, answer have found... put datagrid stackpanel vertical orientation. has unbounded height, grid take space needed.

java - ant warning: "'includeantruntime' was not set" -

i receive following warning: [javac] build.xml:9: warning: 'includeantruntime' not set, defaulting build.sysclasspath=last; set false repeatable builds what mean? ant runtime simply set includeantruntime="false" : <javac includeantruntime="false" ...>...</javac> if have use javac -task multiple times might want consider using presetdef define own javac -task sets includeantruntime="false" . additional details from http://www.coderanch.com/t/503097/tools/warning-includeantruntime-was-not-set : that's caused misfeature introduced in ant 1.8. add attribute of name javac task, set false, , forget ever happened. from http://ant.apache.org/manual/tasks/javac.html : whether include ant run-time libraries in classpath; defaults yes, unless build.sysclasspath set. best set false script's behavior not sensitive environment in run.

PHP: loop trought array and create li list with array elements - array in array -

i have an array objects: array ( [0] => 479,1,sometext [1] => 474,2,again text [2] => 472,3,and text ) the objects in array can unlimited, each object consists of 3 parts delimited comma . the result should (in example)- corrected secondly <li> <span class="somecrap">array[0][0]</span> <input type="text" class="secondcrap" value="array[0][1]"/> <textarea class="3crap">array[0][2]</textarea> </li> <li> <span class="somecrap">array[1][0]</span> <input type="text" class="secondcrap" value="array[1][1]"/> <textarea class="3crap">array[1][2]</textarea> </li> <li> <span class="somecrap">array[2][0]</span> <input type="text" class="secondcrap" value="array[2][1]"/> <textarea class="3crap">array[2][2]</textare

c# - what is a free PDF create library for asp.net -

i want create reports on asp.net website in pdf format. need way easy. not using fancy text directions or things that. recommand should choose? itextsharp free. however, pdf library require define fonts etc.

javascript - jquery: onclick change background color -

i have following ul - li html. <ul> <li><span id='select1'>text</span></li> <li><span id='select2'>text</span></li> <li><span id='select3'>text</span></li> <li><span id='select4'>text</span></li> <li><span id='select5'>text</span></li> <li><span id='select6'>text</span></li> </ul> if click on specific <span> , background color should changed. i.e. if click on span having id='select3' , background-color should changed. how can done using jquery? try 1 : $('li span[id^="select"]').click(function(){ $(this).css('background-color',"#ccc") }) what is, clicking span inside li having id starting 'select' changes backgound color.

java - Point me in the right direction on NLP datastructures and search algorithm -

i've got school assignment make language analyzer that's able guess language of input. assignment states has done pre-parsing language defined texts , making statistics letters used, combinations of letter etc , making guess based on data. the data structure we're supposed use simple multi-dimensional hashtables i'd take opportunity learn bit more implementing structures etc. what'd i'd know read about. knowledge of algorithms limited i'm keen on learning if point me in right direction. without real knowledge , reading on different posts i'm planing on studying undirected graphs datastructure letter combinations (and somehow storing statistics within graph well) , boyer-moore per-word search algorithm. am totally on wrong track , these impossible implement in situation or there else superior problem? if can hands on copy of cormen et al. "introduction algorithms" http://www.amazon.com/introduction-algorithms-second-thomas-c

sql - Is it possible to JOIN on the NEW/OLD tables inside a trigger -

i want join incoming data (in new virtual table) other database tables inside instead of insert trigger. possible in sqlite? pseudo-ish code: create trigger vtablec_oninsert instead of insert on vtablec begin insert tablea (column1, column2) select new.column1, b.column2 tableb b join new n on b.vtablec_id = n.id end i tried, error: "no such table: main.new". i guess answer no, since according docs sqlite supports each row triggers, there's no virtual new table, array of fields each iteration.

c# - Comparing two dates by week in a .NET entity framework LINQ query? -

is there easy way of comparing weeks in 2 dates this... var times = (from d in db.timeset d.eventdate.week) == datetime.thisweek && d.employee.username == username select d).tolist(); public static int getweeknumber(datetime date) { cultureinfo ci = cultureinfo.currentculture; int weeknum = ci.calendar.getweekofyear(date, calendarweekrule.firstfourdayweek, dayofweek.monday); return weeknum; } and var times = (from d in db.timeset getweeknumber(d.eventdate) == getweeknumber(datetime.now) && d.employee.username == username select d).tolist(); you might want calendarweekrule pick 1 fits needs.

tkinter - How to create a tree view with checkboxes in Python -

Image
i've been using tkinter , tix write small program. i'm @ point need tree view checkboxes (checkbuttons) can select items tree view. there easy way this? i've been looking @ ttk.treeview () , looks easy tree view there way insert checkbutton view? a simple code snippet appreciated. i'm not limited ttk. do; long have example or docs can make work import tix class view(object): def __init__(self, root): self.root = root self.makechecklist() def makechecklist(self): self.cl = tix.checklist(self.root, browsecmd=self.selectitem) self.cl.pack() self.cl.hlist.add("cl1", text="checklist1") self.cl.hlist.add("cl1.item1", text="subitem1") self.cl.hlist.add("cl2", text="checklist2") self.cl.hlist.add("cl2.item1", text="subitem1") self.cl.setstatus("cl2", "on") self.cl.sets

list - Scheme: advise on implementation of flatten -

my implementation of flatten looks this: (define flatten (lambda (lst) (if (null? lst) lst (append (rtn-lst (car lst)) (flatten (cdr lst)))))) (define rtn-lst (lambda (lst) (cond ((null? lst) empty) ((atom? lst) (list lst)) (else (flatten lst))))) while standard implementation is: (define (flatten lst) (cond ((null? list) empty) ((list? (car lst)) (append (flatten (car lst)) (flatten (cdr lst)))) (else (cons (car lst) (flatten (cdr lst)))))) apart obvious verboseness, else wrong code? i'd try this: (define rtn-lst (lambda (lst) (cond ((list? lst) (if (null? lst) empty (flatten-list lst))) ((atom? lst) (list lst)) (else (flatten-list lst))))) probably have different implementations of scheme. edit: with modified else branch: (define rtn-lst (lambda (l

Is there a nicer way to set POST body data in rspec on rails? -

than request.env['raw_post_data'] = json_body ? i'm not sure if mean, can set request headers indicate json: describe "post 'create'" "should successful" request.env["http_accept"] = "application/json" post 'create', :article => { :title => "foo" }.to_json response.should be_success end end

asp.net mvc 3 - IIS 7.5 not taking notice of customErrors for 404 returned by MVC 3 app -

i'm running mvc 3 app (recently updated 2) on iis 7.5 (win 7 64bit) .net 4.0 integrated pipeline app pool , have following set-up in web.config: <customerrors mode="on" defaultredirect="~/problem/oops" redirectmode="responseredirect"> <error statuscode="404" redirect="~/problem/notfound" /> </customerrors> if action method on controller throws exception server , hence generates 500 errorcode correctly sends browser default redirect url. however if action deliberately returns httpnotfoundresult via httpnotfound() iis 7.5 404.0 error page , not 1 indicated in web.config. if enter url doesn't exist on app http://localhost/myapp/foo shown page indicated web.config. anybody have ideas why i'm not getting redirected custom 404 error page when using httpnotfound()? please try below syntax instead of calling httpnotfound , let me know result ;) throw new httpexception(404, "notfo

android - Handling touchscreen clicks on context menu -

at context menu select edit object , send information of object. if long press object on listview emulators buttons information passed normally. if mouse (like touchscreen) information passed other object. the creation of contextmenu: private void onlistviewcreatecontextmenu(contextmenu menu, view v, contextmenu.contextmenuinfo menuinfo) { menu.setheadertitle("selected project"); menu.add(0, del, menu.none, r.string.remove); // define menu item menuitem menuedit = menu.add(0, edit, menu.none, r.string.edit); // define intent intent editintent = new intent(this, pm_edit.class); // pass row id or project name or whatever.. int itemid = ((listview) v).getselecteditemposition(); itemid = itemid == -1 ? selectedposition : itemid; // set clicked value if none selected log.v(tag, "selecteditemposition = " + itemid); editintent.putextra("itemid", ite

jquery - MVC 3 Client Validation works intermittently -

update: if set @ least 1 breakpoint in javascript, validation start works, without not work update: adding jquery tag may connected validation plugin i have mvc 3 version, system.web.mvc product version is: 3.0.20105.0 modified on 5th of jan 2011 - think that's latest. i’ve notice client validation not working suppose in application creating, i’ve made quick test. i’ve created basic mvc 3 application using internet application template. i’ve added test controller: using system.web.mvc; using mvcapplication3.models; namespace mvcapplication3.controllers { public class testcontroller : controller { public actionresult index() { return view(); } public actionresult create() { sample model = new sample(); return view(model); } [httppost] public actionresult create(sample model) { if(!modelstate.isvalid) { ret