Posts

Showing posts from April, 2011

PHP: Get all lines containing specific text -

i'm trying parse source code website goes like <html> ... ... ... <div class="menu_body"> <a href="url" onclick="_gaq.push([parameters]);location.href=this.href+'?channelid=287&date='+dateofmonth;return false;"> <img src="img"></a> <a href="url"><img src="img"></a> <a href="url"><img src="img"></a> </div> ... ... <div class="menu_body"> <a href="url"><img src="img></a> <a href="url"><img src="img"></a> <a href="url"><img src="img"></a> </div> ... ... ... </html> what want if possible grep out lines contains channelid , not sure if it's possible? sounds want sort of html parser http://si

asp.net mvc 3 - Changing setting in applicationHost.config to Allow has no effect on 500.19 error -

i have web site using .net 4 , asp.net mvc3 running in iis 7.5. following error: this configuration section cannot used @ path. happens when section locked @ parent level. locking either default (overridemodedefault="deny"), or set explicitly location tag overridemode="deny" or legacy allowoverride="false". i found solution here , setting overridemodedefault allow both handlers , modules seems have no effect on site still 500.19 error. tried restarting iis , searching other possible config files not find any. i'm out of ideas , every site i've looked @ suggesting above solution says change it, save , you're done, i'm @ loss on problem. other thing haven't done restarted server, nothing has suggested should necessary. i recommend using appcmd.exe allow overriding different configuration sections. more info on can found @ (http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe/). to answer question direct

command line interface - Google cli - where to ask questions? -

i'm trying use google cli (e.g. 'google calendar "...") used work poorly , fails error diagnostic. searching "google calendar" less useless searching "evolution email." i wish people think searchability when naming programs. /rant is there forum or newsgroup somewhere can post questions? and if there's expert here, after open browser , authorize, program produces: traceback (most recent call last): file "/usr/bin/google", line 839, in <module> main() file "/usr/bin/google", line 825, in main run_once(options, args) file "/usr/bin/google", line 605, in run_once authenticated = authenticate(auth_manager, options, config, section_header) file "/usr/bin/google", line 119, in authenticate valid_token = auth_manager.retrieve_access_token(display_name, browser) file "/usr/lib/pymodules/python2.6/googlecl/authentication.py", line 180, in retrieve_access_token

What is a Parameter in PHP? -

i wondering parameter in php? a parameter pass function or method. can value stored in variable, or literal value pass on fly. known arguments . some_function($some_param, "some other param"); it's kind of using blender make smoothie: blender function, ingredients , milk put in blender blend parameters/arguments, , smoothie return value :) $banana_smoothie = make_smoothie('banana', 'milk'); you can see similar analogies in php manual entry link ( makecoffee() , makeyogurt() ).

Loading data from multiple xls files to oracle table -

i have multiple xls files . have stored these file names in table below table name sequence file1.xls 1 file2.xls 2 file3.xls 3 each file has 3 fields field1 field2 filed3 now have load data in table has 4 column field1 field2 field3 field4 , filed4 should field sequnce of file name. please suggest way load data files if convert excel spreadsheets csv can load them using external tables.

seam - org.apache.poi.POIXMLException: java.lang.reflect.InvocationTargetException when deployed in JBoss6 -

i have upload excel file in jbossseam application. using poi3.6 jar. excel upload successful in application server jboss5.1. got exception when used jboss6. how resolve problem? please me solve issue? the stacktrace follows : 2011-02-09 10:20:00,247 error [stderr] (http-10.120.10.19-8086-1) org.apache.poi.poixmlexception: java.lang.reflect.invocationtargetexception 2011-02-09 10:20:00,247 error [stderr] (http-10.120.10.19-8086-1) @ org.apache.poi.xssf.usermodel.xssffactory.createdocumentpart(xssffactory.java:61) 2011-02-09 10:20:00,263 error [stderr] (http-10.120.10.19-8086-1) @ org.apache.poi.poixmldocumentpart.read(poixmldocumentpart.java:256) 2011-02-09 10:20:00,263 error [stderr] (http-10.120.10.19-8086-1) @ org.apache.poi.poixmldocument.load(poixmldocument.java:196) 2011-02-09 10:20:00,263 error [stderr] (http-10.120.10.19-8086-1) @ org.apache.poi.xssf.usermodel.xssfworkbook.(xssfworkbook.java:179) 2011-02-09 10:20:00,263 er

c++ - Qmake Project File -

i have class file (header , cpp) made, want use in main.cpp file. generated qmake project file (from current directory of main.cpp) , added header , cpp with: headers += $$quote(/home/myusername/projects/src/myclass.h) sources += $$quote(/home/myusername/projects/src/myclass.cpp) sources += main.cpp when run makefile, seems work until gets part of main.cpp include header file , says: fatal error, no such file or directory i feel i'm making basic mistake, can't seem figure out. first, using absolute paths in project file bad idea. if class part of project, located in directory, use relative paths both in project file , in #include directive, using #include "relative/path/myclass.h" syntax. if class not part of project, should compile library, use qmake following options: qmake includepath+=/path/to/the/header libs+=-l/path/to/the/library and add library name project file: libs += -llibraryname then may include class #include <myclas

wcf - Why web services remains an integrated part in .net 4.0 -

why 'web services' concept has not been removed vs 2010 becoz wcf services provides features 'web services' does. there available in web services can not implemented wcf service or becoz of backward compatibility? any appreciated , thanx because .net downwards compatible version >= .net 2. removing .net part of earlier release destroy downward compatibility. remember: .net 3 superset of .net 2, .net 3.5 superset of .net 3 , on...

ios4 - Iphone:Help in understanding Crash reports -

i worked on app got crashed. made app using appcelerator tool let write apps in javascript. code apple pointed , crash report given below: it;s crashing on iphone 4 running ios 4.2.1.(as reported apple). relevant files given below: code: http://pastie.org/1543760 crash report: http://pastie.org/1542144 i not being able understand it. help me out! thanks i have same issue, app rejected apple saying 2.1 apps crash rejected and give crash report, search , find how read crash report. think may you. drag crash report xcode>window>organizer>device logs show crash report more readable form. in of app function show memory locations. following line find line of error, steps analyze crash report apple: copy release .app file pushed appstore, .dsym file created @ time of release , crash report receive apple folder. open terminal application , go folder created above (using cd command) atos -arch armv7 -o '<your .app file name here>

secure message in IE for ASP.Net website -

can please tell me, why no-secure message comes on site's homepage in internet explorer following message: "the web page contains content can not delivered using secure https connection" message box comes yes/no option. your webpage using https items (picture example) on page linked using http (not https). why ie warns users although of page secured not content on is. if want rid of message should serve items on page via https.

How can i create a xml document based on a schema using php? -

i want create xml file data given users. i can use simplexml or domdocument creating xml files , there option in domdocument verify xml document schema . but need instead of creating nodes , adding values using xml classes, can create xml file data stored somewhere else in respect schema? i think in .net there option write xml reading dataset.. couldn't find such thing in php. is possible , there classes that? if there no predefined classes , @ least on ways of doing that? edit: i'm editing question because seems of not clear requirement.. for example, if schema <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" attributeformdefault="unqualified"> <xs:element name="formpatterns"> <xs:element name="pan" type="pantype"/> <xs:element name="name" type="nametype"/> <xs:element name="fathername" type="nametype"/> <xs:group ref="addr

javascript - Compressed JS Decoder -

http://www.lotterypost.com/js-compress.aspx this site nice compressing js but want decode.... and instead of online there free best tool encode/decode js http://jsbeautifier.org/ - online javascript unpacker , beautifier.

iphone - how To detect that cgaffinetransformrotate method is rotating the clockwise or anticlockwise? -

i need figure out thorough cgaffinetransformrrotate rotating view towards clockwise or anticlockwise. how possible? yourview.transform = cgaffinetransformmakerotation( positive value ); rotate view clockwise, , yourview.transform = cgaffinetransformmakerotation( negative value ); rotate view anti clockwise,

soapclient request from php to c# web service with authentication -

i want execute remote function using php soap.the web service created using c# .net.there must authentication in order call remote function.i unauthorized error whenever tried call remote function.however,when content of web service using wget this wget -c --user=my_username --password=my_password http://path/to/wsdl and got output: --2011-02-09 09:55:10-- http://path/to/wsdl connecting my_ip:80... connected. http request sent, awaiting response... 401 unauthorized reusing existing connection my_ip:80. http request sent, awaiting response... 401 unauthorized reusing existing connection my_ip:80. http request sent, awaiting response... 200 ok length: 3300 (3.2k) [text/html] saving to: `my_webservice.asmx' 100%[====================================================================================================================================================================================================>] 3,300 --.-k/s in 0.001s 2011-02-09 09:55:11 (3.8

visual studio 2010 - VS2010 Extensions - Subscribing to Events -

i'm trying create extension vs2010. i've started , 1 of things need keep track of project items. upon initialization of package i'd subscribe set of events. 1) solution opened 2) solution closed 3) project loaded 4) project unloaded 5) file added 6) file removed my main problem @ moment i'm not sure start these events. i've seen dte/solution/project/projectitem interfaces , i've seen techniques them, none of these have events on in way. does know need looking find these events? , how create instance subscribe them? found envdte.solutionevents allows needed.

Embed a 3rd party AIR program inside a c# form -

i looking way embed air standalone - singleform air program inside visual c# form. i don't need have communication whatsoever, need have "stuck" in zone of form moves around me , resizes when do. (ie: form needs control handler, right?) i tried using setparent user32.dll lib, doesn't work (although works notepad.exe, code correct). repeat: don't want have interactivity, want there "as widget". thank you. update: know sounds strange, air application in question actual .exe file, not swf. (in fact, puzzling me, i'm quite sure says need install air when install first time), i'm talking app: http://assistenza.vodafone.it/privati/servizi_web/applicazioni/widget_vodafone_it update 2: tried using user32.dll setparent function receive 1400 error: invalid_window_handler, although handler retrieved calling process.mainwindowshandle, , repeat, code works notepad: process notepad = process.start("c:\\windows\\system32\\notepa

Listening to Android Package Installer -

we know can launch apk file, can listen packages has been installed, removed or replaced. there way listen package installer when user chooses cancel installation? (this when package installer displays permissions install , cancel button) thank you. but there way listen package installer when user chooses cancel installation? i not aware of gets broadcast in case, sorry.

How to write a program that shows WLAN access points using Java -

as title, want write program detect wlan ap , there can detect how many host connected wlan ap. language provide function? idea search from, have no idea on networking. either wrapping command line tool or using native code. , depends on operation system. there no native java api this, imho.

"max_questions" limit not respected when running MySQL query via PHP -

i'm using mysql community server 5.5 php 5.3.3 on windows server 2008 platform. have set per user resources limits, particularly limit related queries run db user within 1 hour. have read document , interesting doesn't work me. http://dev.mysql.com/doc/refman/5.5/en/user-resources.html when run query via mysql command line tool (mysql.exe) limit works , if queries limit per hour 7, after 7 queries within 1 hour receive error: error 1226 (42000): user 'user' has exceeded 'max_questions' resource (current value: 7) this above wanted behavior. when run query via php (the user have used connect db same above), queries limit doesn't work: same user via php can run queries wants , without limit. , if come on mysql command line above counter seems reset (even if hour hasn't elapsed) : can run 7 queries within hour too. think isn't wanted behaviour. seems php resets counter , doesn't trigger queries limit. ps: 'user' owns

asp.net - How to store state in profiles? -

<profile> <properties> <add name="name" allowanonymous="true" /> <add name="age" allowanonymous="true" type="system.int16"/> </properties> <providers> <add name="aspnetsqlprofileprovider" connectionstringname="profileservices" applicationname="/" type="system.web.profile.sqlprofileprovider" /> </providers> </profile> <connectionstrings> <add name="applicationservices" connectionstring="data source=.\sqlexpress;integrated security=sspi;attachdbfilename=|datadirectory|\aspnetdb.mdf;user instance=true" providername="system.data.sqlclient" /> <add name="profileservices" connectionstring="data source=chanda

.net - C# Delegate eventhandler SelectedIndexChanged -

i want pass value method lecmb_statut_selectedindexchanged, how can proceed? i have code: sqldatareader reader = comm.executereader(); while (reader.read()) { ... dropdownlist lecmb_statut = new dropdownlist(); string templabel = reader["libelle"].tostring(); string templabelveh = reader["libveh"].tostring() } how can pass these temp variables lecmb_statut_selectedindexchanged ? lecmb_statut.selectedindexchanged += new eventhandler(lecmb_statut_selectedindexchanged); you use tag property of dropdownlist. first, create simple dto: public class labeldto { public string label {get;set;} public string labelveh {get;set;} } then: while (reader.read()) { ... dropdownlist lecmb_statut = new dropdownlist(); labeldto lbl= new labeldto(){label=reader["libelle"].tostring(), labelveh=reader["libveh"].tostring()}; lecmb_statut.tag=lbl; } then inside lecmb_statut_selectedindexchanged: lecmb_statu

What is relation between WPF and Silverlight -

these both same or different ? how develop silverlight in visual studio 2008 ? update please answer how develop silverlight application in visual studio 2008 ? both wpf , silverlight uses called xaml define interface / gui should like. wpf , silverlight both presentation layers used on different areas. wpf used windows based applications whereas silverlight used web based applications. read blog post "when should use wpf vs silverlight?" on @ msdn.

php - Show category post list on sidebar module on joomla -

i need show list of post of specific category on module. how can do? thanks use built-in module called latest news (mod_latestnews). when configuring module find module parameters right. specify category id there. you can find category ids in category manager. if need articles multiple categories can separate ids comma.

github - specifying git branch for remote -

i'm trying update webbynode pulling github got message below: you asked pull remote 'git@github.com:sigbackup/gsapp.git', did not specify branch. because not default configured remote current branch, must specify branch on command line. so have checked out forum , found comments regarding .git/config file mine looks fine (at least me): [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [remote "origin"] fetch = +refs/heads/*:refs/remotes/origin/* url = git@github.com:sigbackup/gsapp.git [branch "master"] remote = origin merge = refs/heads/master [branch "origin"] remote = origin merge = refs/heads/master am missing something? ideas how can solve it? ps tried git pull origin git@github.com:sigbackup/gsapp.git , got fatal: couldn't find remote ref git@github.com what local branch have checke

debugging - C# Debug Visualizer throug reflection: get value of property contained in complex object using Reflection -

suppose have list of 100 complex nested object, , want spool values of propery (identified pattern) of subobject. ie: lista_tipiclassifornitura[i].opzionetariffaria.codice the immediate windows doesn't support loop, want create public static method this: string spool(object c, string propertypath) i'll call method follow: spool(lista_tipiclassifornitura, "lista_tipiclassifornitura[#].opzionetariffaria.codice") the procedure replace # 0, 1, 2, ecc , should access property "opzionetariffaria" , property of "codice" through memberinfo. this example me? getting nested object property value using reflection any suggestion? yes! can done. this how: public class address { private string _addressline1; public string addressline1 { { return _addressline1; } set { _addressline1 = value; } } private string _addressline2; public string addressline2 { { return _addressline2

php - finding preg_match_all with a lookbehind and lookahead -

i have current line preg_match_all('/(?<=, ")<b>[\d\d]+(?="\)\;})/',$str,$matches); where $str equal to 906), "<b>tadam tadam 393943</b>");}); for reason won't find matches, how that? update in order work needed add u @ end of regex, wouldn't greedy... go figure. it match, have specify group parentheses: preg_match_all('/(?<=, ")(<b>[\d\d]+)(?="\)\;})/',$str,$matches); so fragment matching <b>[\d\d]+ can accessed via $matches[1][0] .

Should I use HTTP or FTP to upload images from the North Pole? -

here's interesting request. client need blog north pole. connection speed on satellite phone poor, needs lean possible. in past, they've submitted text via html form on http, , ftp'd images. anecdotally, comfort of desk high speed broadband connection, feels http faster uploading files, compared ftp. i'm coder, know nothing of underlying technology get's data 1 part of web thought best double check people tend know lot more these things i suppose issues are: bandwidth, & reliability. so, given these strict conditions lower dialup bandwidth any number of small images (300x300px 72ppi) text data (max 1500 chars) should use ftp or http upload images north pole? definitely http if client , server support partial upload. reason ftp command-response protocol , lousy connection it's quite easy lose before gets uploading file. next, ftp requires 2 socket connections additional network load (and possible weak place in case of non-stable c

RDLC To Excel Export, Header and Footer Character Limit -

apparently excel hardcoded allow 255 characters in footers (and headers think). naturally wanted put more in footer hence post. header workaround: found putting stuff in rdlc header , setting printsonfirstpage , printsonlastpage true, when exported doesn't put rdlc header items excel header uses split region (with empty excel header) , can put in as like. visually it's ok won't print on every page, presumably use old trick of editing resulting worksheet repeat rows on pages. footer workaround: sadly i've not found similar workaround footer though rdlc footers do put excel footer , mentioned limited 255 characters. this gotcha never imagined when designing reports. anyone got ideas on how around footer character limit? (beyond "create screenshot" is.) note: response this question , , answer footer issue if possible.

vb.net - how to find out which textbox is currenlty selected -

Image
i have 3 text-boxes, how find out text-box selected (has focus). unable come anything. public class form1 public activetextbox textbox = ctype(me.activecontrol, textbox) private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click activetextbox.text = activetextbox.text & "this text 1" end sub private sub button2_click(byval sender system.object, byval e system.eventargs) handles button2.click activetextbox.text = activetextbox.text & "this text 2" end sub end class i assuming windows forms application. this similar question offers 2 possible suggestions: me.activecontrol or, can write method using windows api handle of control has focus. article on windowsclient.net has example. however, each of these options work if textbox still has focus @ time method called. within button event handler, trying find out last active textbox in order it. in situation

windows - Batch file not working: Spaces in path -

set rf_properties="%arcot_home%\conf" dir %rf_properties% if not exist %rf_properties% goto no_rf_properties the arcot_home variable above has spaces. dir command works , lists files, if command fails "the syntax of command incorrect.". there way make work? try way round: set rf_properties=%arcot_home%\conf dir "%rf_properties%" if not exist "%rf_properties%" goto no_rf_properties

Salesforce Session variables, set and get variables in Session -

i want able read / write variables current session in salesforce site pages. i have site built using salesforce sites, need store/retrieve values across pages (consider building similar shopping cart). cant find example on how read , write variables session (anonymous user). i using visualforce pages several controllers built in apex. regards custom settings cached @ application level, maybe that's why suggested in link above. i'm not sure if i'd recommend approach, might able work. if create custom setting named "sessiondata", , add custom fields (that represent data want store in session), save data this: database.saveresult result = database.insert(new sessiondata__c(yourfieldhere='your value here etc')); system.debug(result.getid()); then use resulting custom setting id store in cookie. while custom settings can accessed using normal soql, advantage data cached , can accessed this: if (sessiondata__c.getall().containskey(

java - How to parse SOAP response in JAX-WS? -

how should parse soap response? have write logicalhandler (like here http://www.java-tips.org/java-ee-tips/java-api-for-xml-web-services/writing-a-handler-in-jax-ws.html ) payload of response , use sax parse or there other handy methods in jax this? i need data xml tags in response? if use jax-ws implementation (cxf, axis2, metro) shouldn't have parse responses. can generate jaxb annotated classes wsdl of web service want access , have marshallers bind xml payload generated java beans.

Select an element with jQuery selector regardless of ID -

i have following code: <div> <div id="someid"><h1>blah</h1></div> <div id="someid2"><h1>blah</h1></div> </div> and trying select in jquery (for accordion in jquery ui). however, following not work unless remove id div. $('> div > h1') is there way tell selector ignore id, or going wrong way? edit: actual use i'm going in sortable accordion in jquery ui, ids on div elements. example of i'm doing, source, can found here: http://jqueryui.com/demos/accordion/#sortable edit: have feeling may related jqueryui, rather selectors themselves, below code i'm trying run. http://jsfiddle.net/zgkj4/1/ working example without id in div: http://jsfiddle.net/zgkj4/2/ you try selecting <h1> parent <div> has id attribute $("div > div[id] > h1") working example: http://jsfiddle.net/yjsvu/ ignores div w/o id : http://jsfidd

scala - Actor that waits for completing all jobs in children before exit -

can't figure out how resolve following problem: have few actors (workers) execute tasks in way when recieve (i mean react) them. main actor (foreman) controls process , can recieve task stop work. in case main actor must stop creating new tasks , wait when workers finish existing tasks , main actor should exit. import actors.actor import actors.actor._ class foreman extends actor{ val workera = new workera val workerb = new workerb val workerc = new workerc self.link(workera) self.link(workerb) self.link(workerc) def act{ workera.start workerb.start workerc.start // adding tasks workers somehow //... loop{ case resultoftask(res) => //... case stop => //workers mustn't stop must finish tasks , exit case productionaccident => //... } } } case class task(activity:string) case class resultoftask(result:string) trait worker extends actor{ def act{ loop{ react{ case task(activity)

Which is the correct text datatype to use in MySQL? -

there's varchar, char, text, bigtext, blob... which correct datatype use when storing small text fields (ie. first_name )? "correct" strong word, people use varchar . char option, it's not used in experience. this page explains difference. one of notable differences between char , varchar in latest versions of mysql char incapable of storing trailing spaces (because column automatically padded max length spaces). if store 'abc ' , retrieved 'abc' . might not matter applications, it's keep in mind. similarly, prior 5.03, trailing whitespaces stripped varchar fields before insertion. if need store arbitrary byte values , don't want worry different behaviors between mysql versions, should use 1 of blob types.

How to retrieve an average from a specific data type from a column in sql -

i have table called products, contains 2 rows (plus others):price , mfr. how list average price items provided particular manufacturer (using summary query)? select avg(price) priceaverage products mfr = 'particularmanufacter' but future recommend homework yourself. student :)

php - Regexp to ignore hyphenated words during common word removal pattern -

i've got regular expression removes common words( $commonwords ) string( $input ) tweak ignores hyphenated words these contain common words. return preg_replace('/\b('.implode('|',$commonwords).')\b/i','',$input); thanks try return preg_replace('/(?<!-)\b('.implode('|',$commonwords).')\b(?!-)/i','',$input); this adds negative lookaround expressions start , end of regex match allowed if there no dash before or after match.

javascript - JS chaining pattern to insert elements into the DOM -

i struggling make pattern below work. i'm not interested in using library. function _createelement(tagnm, attr){ var el = document.createelement(tagnm); for(var @ in attr){ el.setattribute(at, attr[at]); } } //below function not correct giving idea function _append(ele){ this.appendchild(ele) return this; } // able achive following chaining patter this. var div = document.getelementbyid('div'); div._append( _createelement('div', { id : 'parent', classname: 'parent' })).appendchile( _createelement('div', { id : 'child', classname: 'child' })); for work, you're going have have sort of object focal point of chained calls. object value of this , in other words, in "_append" function. alternative have functions extend native dom object prototypes, won't work in older ie versions (and maybe not newer ones; i'm not sure). you perhaps root in wrapper around doc

SharePoint 2010 Custom WCF Service - Windows and FBA Authentication -

i have sharepoint 2010 configured claims based authentication both windows , forms based authentication (fba) external users. need develop custom wcf services . issue want windows credentials passed wcf service(s); however, cannot seem windows credentials passed services. custom wcf service appears using anonymous authentication (which has enabled in iis in order display fba login screen). the example have tried follow found @ http://msdn.microsoft.com/en-us/library/ff521581.aspx . the wcf service gets deployed _vti_bin (isapi folder). here code .svc file <%@ servicehost language="c#" debug="true" service="mycompany.customerportal.sharepoint.ui.isapi.mycompany.services.librarymanagers.libraryuploader, $sharepoint.project.assemblyfullname$" factory="microsoft.sharepoint.client.services.multiplebaseaddressbasichttpbindingservicehostfactory, microsoft.sharepoint.client.serverruntime, version=14.0.0.0, culture=neutral, publickeyto

How to control package structure with seam-gen -

i've been adding existing application generating seam-gen , adjusting there. 1 problem keep having have spend great deal of time editing xhtml files reflect package structure. for example, seam-gen thinks work <s:decorate id="simplepidfield" template="layout/edit.xhtml"> and in every .xhtml, have change to <s:decorate id="simplepidfield" template="/layout/edit.xhtml"> this , other inconsistencies arise because seam-gen builds flat directory of xhtml files in 1 place, while our app has these divided , sub-divided several directories. is there way, in reveng.xml file define package structure? thanks. no not in reveng.xml file. have @ freemarker code in seam-gen source , adjust there. look @ seam-src/seam-gen/view/editproperty.xhtml.ftl file , locate <s:decorate id="${componentproperty.name}field" template="layout/edit.xhtml"> ' and <s:decorate id="$

ruby on rails - Cucumber + Webrat doesn't submit forms? -

i'm new cucumber , totally lost why integration test failing. have following scenarios: scenario: user changes profile given have account when change profile profile should saved scenario: user changes login given have account when change login information account should changed and these step definitions: given /^i have account$/ @user = factory.create(:user) visit login_path fill_in "email", :with => @user.email fill_in "password", :with => 'secret' click_button "sign in" end when /^i change profile$/ visit edit_user_profile_path(@user) fill_in "first name", :with => "john" fill_in "last name", :with => "doe" click_button "update profile" end /^my profile should saved$/ @user.profile.first_name.should == "john" @user.profile.last_name.should == "doe" end when /^i change login inf

how to read json data from a link and passing that data to django -

i have link(127.0.0.1:8000/read) contains json data.how read json data link , pass values django form. your question rough - , without understanding requirements are, hard place read example. simple example of how json: import urllib2 import json req = urllib2.request('http://127.0.0.1:8000/read') r = urllib2.urlopen(req) data = r.read() j = json.loads(data) node = j['node']['child_node'] element in node: print "element node information: %s" % element['child_node'] #an example of saving information send form form_text = j['parentnode']['copy']['formtext']

Java web start on iPad -

can run java applications (java web start) on ipad? looks not possible, suggested using cloud browse (an application couldn't' find) run java. any solutions? update : cloud browser application was available on app store removed apple. cloud browse process web site externally , stream web site content ipad screen (something video streaming). no, cannot run java programs on ipad (or ios device). apple's license terms forbid running applications can execute code downloaded internet (which java web start about).

ios - UIWebView Performance just for text? -

i want choose render formated text in uiwebviews in scrollview many pages. there 10 webviews text on 1 page. when viewing page, next , view behaing loaded. when scrolling, there 3 pages loaded @ time. my question is: how's performance when scrolling scrollview webviews. lag? use three20 text views text , works flawlessly. because don't have time test whole stuff webviews, wanted ask you, if have experience solution this. thanks in advance in experience , have implement 4 uiwebview load amount of xml data , convert html objective-c code , , use javascript manage each pages javascript hide/show document.getelementbyid so, it's quite me . think performance base on how internet connection speed ,your html layout arrangement complexity , managing content javascript.

prism - How to create a view for a single control? -

what best way create view single control need load shell region in prism app. know can wrap control in usercontrol, suspect there may better way. i working on demo app learn prism 4. each module load navigation button itemscontrol in region in shell. these navigation buttons function mail, calendar, , other buttons in outlook. i creating view in each module hold module's navigation button. simplest way create view seems to wrap in usercontrol. question this: there better way it? help. if need graphical control, doing way go. if find making of buttons same (copy - pasting) might find menu registration service way go. you'd have service imenuservice register container , modules can come around , register menu items to. can create buttons module. i've provided sample here: http://dl.getdropbox.com/u/376992/cagmenus.zip your question, though, seems whether or not need wrap control in usercontrol register them region? if that's question, believe answer

objective c - Interface Builder and Cocoa: wiring up behind an App Controller class -

i have been following this tutorial. i'm having conceptual trouble @ point app controller class written, , added , hooked within interface builder. adding appcontroller class next task add instance of new class interface builder document , connect class outlets. create instance of appcontroller class. in interface builder library window, click classes. locate appcontroller class. drag class document window create instance named app controller. connect app controller’s qcwindow outlet design window. hold down control key. in document window, drag app controller window object. select qcwindow outlet list appears. connect app controller’s qcview outlet qc view in design window. hold down control key. drag app controller qc view in design window. select qcview outlet list appears. specifically, don't understand how app controller being used @ run-time. did hook window , view outlets within ib, , magically works if bein

ruby on rails - Deeply Nested Form Data not going into database, no errors -

i'm building multi-nested form in rails 3. i'm using formtastic_cocoon gem, don't think has bearing on issue. i've got users, users have tasks, tasks have steps. nesting users>tasks>steps. can dynamically add , remove task fields user, , step fields tasks. however, when submit form, user gets tasks, task>steps don't saved database. rails isn't returning errors, nothing happens. my models are class user < activerecord::base acts_as_authentic has_many :tasks accepts_nested_attributes_for :tasks, :reject_if=> proc {|attributes| attributes[:entry].blank?}, :allow_destroy => true end class task < activerecord::base attr_accessible :entry belongs_to :user has_many :steps accepts_nested_attributes_for :steps, :reject_if=> proc {|attributes| attributes[:title].blank?}, :allow_destroy => true end class step < activerecord::base attr_accesible :title

PHP MySQL login function -

i'm using this: function authuser($username, $password){ connectdb(); $sql = "select id, username users username = '".$username."' , password = '".$password."'"; $result = mysql_query($sql); $num_rows = mysql_num_rows($result); if ($num_rows > 0){ while ($row = mysql_fetch_array($result)){ $username = $row['username']; session_start(); session_register('username'); return $username; } } closeconn(); } with combination of this: $auth = authuser($username, $password); if (isset($username)){ header( "location: index.php" ); } and on index.php (where redirect them if successful login) i'm trying echo $username. nothing showing? ideas? function problem? edit: have changed so: if ($num_rows > 0){ while ($row = mysql_fetch_array($result)){ $_session['username'] = $row['usern

emulation - android 2.3 emulator hangs after adb shell stop then start -

in android 2.2, able start emulator, run 'adb shell stop' 'adb shell start' have emulator come up. since changing android 2.3 emulator not start, , logcat hangs these messages: settingsprovider cache settings table 'secure' rows=27; fullycached=true qemud fdhandler_accept_event: accepting on fd 9 qemud created client 0x11f88 listening on fd 11 qemud client_fd_receive: attempting registration service 'hw-control' qemud client_fd_receive: -> received channel id 5 settingsprovider cache settings table 'system' rows=45; fullycached=true i'm using eclipse, help! it might problem 1 of long running process re-establishing qemu hw simulation. kill process /system/bin/qemud , start emulator. steps adb shell stop adb shell ps (get pid of /system/bin/qemud ) adb kill <pid_process> adb shell start

r - Find largest 5 value less than 1, lowest 5 values -

i have large correlation matrix result in r - 30 items correlated against each other - array has 10,000 cells. want find largest 5 , smallest 5 results. how can this? here's small portion - upper left corner - looks like: pl1 v3 v4 v5 pl1 1.00000000 0.19905701 -0.02994034 -0.1533846 v3 0.19905701 1.00000000 0.09036472 0.1306054 v4 -0.02994034 0.09036472 1.00000000 0.1848030 v5 -0.15338465 0.13060539 0.18480296 1.0000000 the values in table between 1 & -1 , if helps, being correlation matrix upper half above diagonal duplicate of lower half below diagonal. i need positive 5 less 1 , negative 5 including -1 if exists. thanks in advance. you want find largest , smallest correlations , know not what, values came from. it's easy. x<-matrix(runif(25),5,5) cor<-cor(x) l <- length(cor) l1 <- length(cor[cor<1]) #the actual high , low correlation indexes corhigh <- order(cor)[

ipad - UIPopovercontroller Parent? -

how can "perform selector" parentviewcontroller of uipopovercontroller? have uipopovercontroller lanuched uiviewcontroller, , uipopovercontroller includes other uiviewcontroller. can't seem reach parent view controller either popover or "internal" view controller. i hope i'm being clear... btw - parentviewcontroller doesn't work... thanks! there's no way directly uipopovercontroller . you're going have pass reference parent view controller view controller you're managing popover controller: // assumes these calls made within view controller , // myviewcontroller has property called previousviewcontroller myviewcontroller * myviewcontroller = [[[myviewcontroller alloc] init] autorelease]; myviewcontroller.previousviewcontroller = self; uipopovercontroller * popovercontroller = [[[uipopovercontroller alloc] initwithcontentviewcontroller:myviewcontroller] autorelease]; uibarbuttonitem * rightbarbuttonitem = self.navig

silverlight - Users Can Break Service Reference URL -

according this question can't make service reference address relative. in site, have service reference pointing asmx web service. address is, say: " http://mysite/services/myservice.asmx " unfortunately, if users browse site using: http://www.mysite.com service breaks. i'm assuming silverlight blocking requests because it's seeing www.mysite.com being different domain mysite.com if user browses http://mysite.com , works great. is there way fix this?

Importing COM PIA when hosting PowerShell -

i have com component , pia installed in gac. in powershell, can do $a = new-object -com mysvr.progid $x = $a.method([mysvrlib.myenum]::enumvalue) and understands com enum type. but when host powershell in app using runspace, provide component instance via runspace.sessionstateproxy.setvariable , invoke code: $x = $a.method([mysvrlib.myenum]::enumvalue) i "unable find type [mysvrlib.myenum]: make sure assembly containing type loaded." is there way load type definitions of component hosted powershell instance? in runspaceconfiguration (option configuring new runspace), there assemblies property in can add assemblyconfigurationentry object points pia. note: constructor assemblyconfigurationentry expects assembly qualified name microsoft.office.interop.excel, version=14.0.0.0, culture=neutral, publickeytoken=71e9bce111e9429c .

python - Creating a new corpus with NLTK -

i reckoned answer title go , read documentations, ran through nltk book doesn't give answer. i'm kind of new python. i have bunch of .txt files , want able use corpus functions nltk provides corpus nltk_data . i've tried plaintextcorpusreader couldn't further than: >>>import nltk >>>from nltk.corpus import plaintextcorpusreader >>>corpus_root = './' >>>newcorpus = plaintextcorpusreader(corpus_root, '.*') >>>newcorpus.words() how segment newcorpus sentences using punkt? tried using punkt functions punkt functions couldn't read plaintextcorpusreader class? can lead me how can write segmented data text files? edit: question had bounty once, , has second bounty. see text in bounty box. i think plaintextcorpusreader segments input punkt tokenizer, @ least if input language english. documentation of plaintextcorpusreader's __init__ __init__( self, root, fileids

Why isnt the >> working properly C++? -

std::wifstream thefilehandle; std::wstring thedata; thefilehandle.open( thefile.name() ); thefilehandle >> thedata; thefilehandle.close(); could tell me why string (thedata) getting first word file (thefile) ??? string contain of text file including white spaces , new lines, have suggestion this? thank you. ps. need data preserved perfectly. thanks. the reason you're getting first word precisely how >> operator works when applied strings - gets first whitespace-delimited token whatever stream you're reading from, after skipping leading whitespace. if want read entire contents of file, can use getline function this: std::wifstream thefilehandle; thefilehandle.open( thefile.name() ); std::wstringstream data; (std::wstring line; getline(thefilehandle, line); ) data << line << l"\n"; std::wstring thedata = data.str(); this loops while more data can read via getline , pulls data file. since getline skips on newlines

java - Why isn't eclipse deploying my Dynamic Web Project correctly? -

here's problem: have java "dynamic web project" under source control , checked out in eclipse workspace. before, able run servlet on local tomcat server within eclipse. however, pulled changes got rid of files , added new ones. now eclipse looks it's not deploying web app tomcat directory. looked @ folder eclipse deployed (under .metadata) nothing gets copied there anymore. figure there's wrong build configuration, possible causes or steps go through find out problem? i able deploy/run web app ant script have written, , works correctly when executed. it's hard without more information. i'd start checking errors in console when starting tomcat. how problem manifest, got looking if files did copied? if i'm unable find specific problem, there's random stuff / voodoo rituals try (sometimes eclipse needs bit of attention): check window / preferences , java / installed jres , server / runtime environments. click on edit, see if eclips

visual studio 2010 - How do I make a LINQ to SQL database connection fully configurable / generic? -

for asp.net c# app, i'd use linq sql query sql database, have defined connection string in web.config file. used wizard in visual studio 2010 create linq classes. however, upon inspection, .dbml file explicitly contains database name , connection string i'm using (in dev system), , .designer.cs file explicitly names database. for example, in .dbml file: <?xml version="1.0" encoding="utf-8"?> <database name="mydatabasename" class="mylinqdatacontext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007"> <connection mode="websettings" connectionstring="xxx" settingsobjectname="system.configuration.configurationmanager.connectionstrings" settingspropertyname="myconnectionstring" provider="system.data.sqlclient" /> and in .designer.cs file: [global::system.data.linq.mapping.databaseattribute(name="mydatabasename")] although table struct

cocoa touch - Why isn't a registered UIDeviceOrientationDidChangeNotification always called? -

i wrote simple view controller shows modal popup dialog. because creates new window lay on entire screen, i've added uideviceorientationdidchangenotification observer figures out how rotate view using cgaffinetransformmakerotation() . , seems work. mostly. downside can fiddle orientation , end sideways or upside down. check out this 18s video demonstrating issue. in debugging, appears notification doesn't fire, or @ least doesn't call callback method that's listening it. i must missing something, though, because if @ video again, you'll notice view behind does rotate properly. 1 managed -willanimaterotationtointerfaceorientation:duration: . how ios controller method called (presumably managed uideviceorientationdidchangenotification observer in uiviewcontroller) own code not? i used uiapplicationwillchangestatusbarorientationnotification in kobo, appears trick. it's lot more reliable, because want match ui's chosen orientation, not dev

java - How to uri encode a string in jsp? -

if have string "output" equals url: ${output} = "/testing/method/thing.do?foo=testing&bar=foo" in jsp, how convert string into: %2ftesting%2fmethod%2fthing.do%3ffoo%3dtesting%26bar%3dfoo using <c:out value="${output}"/> ? need urlencoder.encode(url) in c:out somehow. it's not directly possible standard jstl tags/functions. here's hack of <c:url> : <c:url var="url" value=""><c:param name="output" value="${output}" /></c:url> <c:set var="url" value="${fn:substringafter(url, '=')}" /> <p>url-encoded component: ${url}</p> if want more cleanly, create el function. @ bottom of this answer can find basic kickoff example. you'd end as: <p>url-encoded component: ${my:urlencode(output, 'utf-8')}</p> with public static string urlencode(string value, string charset) throws unsupport

mysql query that takes sequence into account -

search term a: black small rock search term b: black rock small search term c: small rock black i want design query take order in terms written account. i'd above 3 terms produce same results, want order of results reflect sequence of terms. i hope makes sense; please let me know if doesn't. the way can see working if separating search terms attributes, in database table, in specific order. attribute 1: black attribute 2: small attribute 3: rock in case, query first search term "black small rock" match "black" in attributes 1, 2, or 3 , perform same logical-or operation other 2 fields in search term. your query, rather simple: select * table (attr1 = 'black' or attr2 = 'black' or attr3 = 'black') , (attr1 = 'small' or attr2 = 'small' or attr3 = 'small') , (attr1 = 'rock' or attr2 = 'rock' or attr3 = 'rock'); at point, rely on logic in programming lang

Is there a performance overhead to a private inner class in Java? -

when have inner classes private methods or fields compiler has create synthetic package-protected accessor methods allow outer class access private elements (and vice-versa). to avoid that, make fields , methods , constructors package-protected instead of private. but how visibility of class itself? there overhead to private static class { a(){} } versus static class { a(){} } note constructor package-protected in both cases, or making class private change that? have tried compiling , comparing byte code? here results. for: public class example { public static void main(string[] args) { system.out.println("hello world!"); } private static class { a(){} } } the above yields following *.class files: -rw-r--r-- 1 michaelsafyan staff 238 feb 10 00:11 example$a.class -rw-r--r-- 1 michaelsafyan staff 474 feb 10 00:11 example.class now, if move class files, delete private modifier, , recompile, get: -rw

android - Paid App Authenticating Server -

i have built free app , paid app. when user upgrades or buys paid app, on first launch, want app send "unique id" server every time app launches, check server , authenticate prove user paid app. what wondering should use "unique id." aware there android.telephony.telephonymanager.getdeviceid() imei or meid , use check validity. however, if use method, when user change cellphone, no longer work. there way user's google id connected android market or sort of unique id related android market when user changes phone, long id login market same, app can authenticate? please @ android licesing , verification libraray (lvl) http://developer.android.com/guide/publishing/licensing.html

iphone - When to use a colon with a @selector -

just getting going iphone development , objective-c. yesterday trying addobserver notification in view of mine, , kept getting error: unrecognized selector sent instance i tracked down fact needed include trailing colon selector argument: [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(nameofmyselector:) name:@"bblocationservicesaredisabled" object:nil]; today, thought clever because when setting action argument button, remembered mistake yesterday, , added colon action argument. action argument takes @selector, selector argument while setting observer nsnotification, figured doing right thing. however, following code: [self.calltoactionbutton addtarget:self action:@selector(nameofmyselector:) forcontrolevents:uicontroleventtouchupinside]; i exact same error: unrecognized selector sent instance what gives? why 1 @selector require trailing colon, , other doesn't? rules should follow when should included , when should lef