Posts

Showing posts from March, 2010

jsp - Dynamically set the length of td using javascript? -

i looking setting td length value 4 1 condition set length 11 other condition. since cant access javascript values in jsp, not thinking set flag in javascript function thought of using hidden parameter concept access, since using btt framework doesnot suport feature. feature eliminated then there other way in javascript can control display of td or tr based on condition some thing 2 td based row <tr> <td> </td> (display if condition true) <td length=4> </td> (display if condition false) <td length=11> </td> </tr> <tr> <td> </td> <td> </td> </tr> just let jsp print java side variable if javascript variable. <script>var width = ${width};</script> imagine jsp ${width} prints 11 , generated output follows in webbrowser: <script>var width = 11;</script> that's it. can use in js functions.

crash - Offset of shared libries on android -

in project after crash got log this i/debug ( 1133): r0 0000deed r1 00001234 r2 deedbeed r3 00000000 i/debug ( 1133): r4 befab4c0 r5 00000007 r6 befab548 r7 4214cb20 i/debug ( 1133): r8 befab49c r9 4214cb0c 10 4214caf8 fp 81da5368 i/debug ( 1133): ip 80003108 sp befab440 lr 845133d4 pc 844ed8f0 cpsr 60000010 i/debug ( 1133): d0 7165722068736175 d1 4320585858585865 i/debug ( 1133): d2 006f006900740073 d3 00200030003d0074 i/debug ( 1133): d4 4214e9804214e94c d5 4214e9e84214e9b4 i/debug ( 1133): d6 3ce2000000000000 d7 000000424214ea84 i/debug ( 1133): d8 0000000000000000 d9 0000000000000000 i/debug ( 1133): d10 0000000000000000 d11 0000000000000000 i/debug ( 1133): d12 0000000000000000 d13 0000000000000000 i/debug ( 1133): d14 0000000000000000 d15 0000000000000000 i/debug ( 1133): d16 4050800000000000 d17 4050800000000000 i/debug ( 1133): d18 4018000000000000 d19 3fe00000000000b4 i/debug ( 1133): d20 3ff00

Loading widgets/gadgets dynamically on JQuery? -

i planning build web app structured in widgets/gadgets. the app load various widgets/gadgets on demand. way user create/configure interface dynamically. the closest framework i've seen approach opensocial. dynamic loading can done using jquery-depends , requirejs, i'm looking more structured approach load gadget (script, css , templates). is there library or framework in jquery can use this? thanks see apache wookie: http://incubator.apache.org/wookie/ this provides system including w3c widgets in websites using rest api. also worth taking @ apache rave: http://rave.apache.org/ which may provide complete framework sort of application you're working on.

adding images dynamically to an openerp rml report file -

i want in openerp report, how need go create file path: <image file="images\[[o.name]]" x="72" y="72"/> are there ways create variables in rml feed file= attribute. i have little no python knowledge, love solved. right trying adjust order.rml, can load images, statically ... in reports .py file add python function this: self.localcontext.update({ 'time': time, 'image_url' : self._get_imagepath, }) def _get_imagepath(self,product): attach_ids = self.pool.get('ir.attachment').search(self.cr, self.uid, [('res_model','=','product.product'), ('res_id', '=',product)]) datas = self.pool.get('ir.attachment').read(self.cr, self.uid, attach_ids) if len(datas): # if there several, pick first try: if datas[0]['link']: try:

Android: Service start Activity -

the problem is: service send me data every 1 hour , need start activity1. if nothing, time create same activity1 , in 5 hours in stack have 5 same activities...so, how kill activity before new 1 start ? ! intent dialogintent = new intent(getbasecontext(), someclass.class); getapplication().startactivity(dialogintent); so, how kill activity before new 1 start ? you don't. first, users attack hunting knives popping activity in middle of nowhere. not know may in middle of doing (playing game, typing text message, etc.). few apps, such voip clients , alarm clocks, should displaying activities except based upon direct user input. second, don't "kill activity" service. rather put appropriate flags on intent bring existing activity front if exists (e.g., flag_reorder_to_front ), rather create new one.

scheduled tasks - Small Team : Is it better to work on specefic objects, or on specific layers? -

i'm leader of small team, , want advice of how divide tasks on developers of n-tier business software. scenario a: each developer has specific objects build @ layers (db, dal,bl, gui...) scenario b: each developer has domain of layers work on @ object !! scenario c: each developer work on specific schedule !! any advice help! thanks you should take account knowledge skills , experience of each of team members , divide work accordingly. if design correctly layered , decomposed there should no problem regards waiting on else since can stub out missing class(es) , continue on work. if time permits, may want assign portions of work members not familiar areas of system (either business domain or programming related) can learn areas , in time not become rounded programmers business benefit having more 1 team member being familiar various areas of system having deep understanding on business domain. it's win-win (with investment of time).

settings - What is the preferred way to configure a mono application -

when using vs, preferred way store user- , application settings seems to access vs "settings" tab given assembly , type settings need. monodevelop not have feature (or @ least did not find it...) what preferred way under mono using monodevelop? if answer "well, same - hand-type code needed" i'd love pointers nice tutorial. on mono list , john ludlow had answer needed: ...first, configurationmanager ( http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.aspx ) expose 2 section handlers default... if want more complex configuration option can define own handlers inheriting configurationsection , configurationelement. see http://msdn.microsoft.com/en-us/library/system.configuration.configurationsection.aspx , http://msdn.microsoft.com/en-us/library/system.configuration.configurationelement.aspx . you may need provide class inheriting configurationelementcollection well, if want able co

unit testing - How can I get test coverage around AreaRegistration.RegisterAllAreas in ASP.NET MVC? -

so i'm shooting 100% coverage on mvc3 site, , we're using areas. can coverage on else except 1 line in application_start : arearegistration.registerallareas(); i've thoroughly tested each area's registration, amounts integration test of sorts, i'd still cover somehow without having resort coverageexclude attribute or lowering coverage percentage. note unit testing in nunit explodes following exception snippet: system.invalidoperationexception : method cannot called during application's pre-start initialization stage. @ system.web.compilation.buildmanager.ensuretoplevelfilescompiled() @ system.web.compilation.buildmanager.getreferencedassemblies() any ideas? i feel trying aim 100% test coverage on application not best approach. sure app should tested pushing aside make sure have 100% coverage stops focusing on quality of tests , more coverage. coverage rough guide , not tell if tests testing should "line x" got called. having

Call JavaScript's setTimeOut in dojo Class -

i'm trying convert javascript functions dojo class. i've settimeout("functionname",2000) in 1 of js method. how call method in class decared using dojo.declare method. example, below custom class. dojo.declare("person",null,{ constructor:function(age,country,name,state){ this.age=age; this.country=country; this.name=name; this.state=state; }, movetonewstate:function(newstate){ this.state=newstate; //i need call "isstatechanged" method after 2000 ms. how do this? settimeout("isstatechanged",2000); }, isstatechanged:function(){ alert('state updated'); } }); var person=new person(12,"us","tes

objective c - NSmutable Dictionary with MultipleKeys to Store in SingleArray -

i doing small concept on nsmutabledictionary. have 4 keys (name, age, phonenumber, gender) 10 employees. how can assign these values array? individually passed 4 different values dictionary fourth value coming repeatedly. code have written - (void)viewdidload { nslog(@"in mytableviews viewdidload"); emparray=[[nsmutablearray alloc]init]; //namesarray=[[nsmutablearray alloc]initwithobjects:@"jam",@"jack",@"gillchrist",@"jackson"]; empdictionary=[[nsmutabledictionary alloc]init]; [empdictionary setvalue:@"martin" forkey:@"name"]; [empdictionary setvalue:@"18" forkey:@"age"]; [empdictionary setvalue:@"m" forkey:@"gender"]; [empdictionary setvalue:@"9652893070" forkey:@"phonenumber"]; [emparray addobject:empdictionary]; nslog(@"emparray counr %d",[self.emparray count]); [empdictionary setvalue:@"jack" forkey

c# - Display certain contents depending on width of grid -

Image
lets have 2 x 2 grid. contain contents of different importance. cells (0,0) , (0,1) have important info. cells (1,0) , (1,1) have less important info. when resize window, dimensions of grids change well. how not show non-important cells when grids beyond threshold width. i have considered kind of value converter binds visibility min-width, there less hackish way this? there may more elegant way this, following works. it uses trigger set maxwidth property of right column's columndefinition 0 when window width falls below threshold. xaml: <window x:class="misc.window1" x:name="window1name" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="window1" height="300" width="300" sizechanged="window1_sizechanged"> <grid textblock.fontsize="40">

Is it possible to copy files through ftp connection? -

i use following code put file local machine remote machine: open abc b lcd c:\interfaces\kgr-arv\xml ascii prompt prompt cd /usr/qkreditnethome/interface/temp put c:\interfaces\kgr-arv\xml\*kgrrequest*qua.xml y quit bye is there way, using ftp command, copy file /usr/qkreditnethome/interface/temp /usr/qkreditnethome/interface/temp2 ? thanks in advance! depending on os can take third-party software mounts remote ftp part of local filesystem, , use regular system copy routines.

Java class to call a SOAP - Web service -

i have soap need call oracle , have heard way work out through java class , unfortunately im not familiar java i'm oracle developer ( oracle forms ) appreciated if can me creating class calling soap can build on oracle database , call oracle forms builder way call function . there 2 soaps (1.1 nd 1.2 ) , both of can work : * soap 1.1 the following sample soap 1.1 request , response. placeholders shown need replaced actual values. post /gmgwebservice/service.asmx http/1.1 host: 212.35.66.180 content-type: text/xml; charset=utf-8 content-length: length soapaction: "http://tempuri.org/sendsms" <?xml version="1.0" encoding="utf-8"?> <soap:envelope xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:body> <sendsms xmlns="http://tempuri.org/"> <username>str

c# - How to pass value in a constructor to enable or disable a button in asp.net control? -

i having constructor on user control main page reinitialize user control. i tried //constructor usercontrol(isnew) { this.btnadd.enabled=true; } btnadd (aspx button runat server) control want disable. while compiling not shows error.but while runtime throws error saying btnaddis null. object reference not set instance of object. btnadd . thnaks use page_init event , property. [browsableattribute(true)] [defaultvalue("true")] public bool isnew { get; set; } protected void page_init(object sender, eventargs e) { btnadd = isnew; }

How do I convert a string of bits to a hex string in Python? -

i have bit-string of 32 characters need represent hexadecimal in python. example, string "10000011101000011010100010010111" needs output "83a1a897" . any suggestions on how best go in python? to format hexadecimal can use hex function: >>> hex(int('10000011101000011010100010010111', 2)) 0x83a1a897 or in format requested: >>> '%08x' % int('10000011101000011010100010010111', 2) 83a1a897

nhibernate - Counting in hibernate using Criteria without unnecessary inner joins -

i using criteria counting number of rows. consider class class groupmembership{ public group group{get;set;} public member member{get;set;} } i have criteria fetches distinct members each group as: detachedcriteria.for<groupmembership>("this") .createcriteria("group", "grp") .createalias("this.communitymember", "communitymember") .setprojection(projections.projectionlist() .add(projections.groupproperty("this.group.id"),"groupid") .add(projections.countdistinct("this.communitymember.id"), "totalmembers")) is there way can count without performing inner join communitymember. update: adding sqls generated query select this_.groupid y0_, count(distinct communitym2_.communitymemberid) y1_ [groupmembership] this_ inner join [communitymember] communitym2_ on this_.communitymemberid = communitym2_.communitymem

sql server - Insert Node as parent -

i have xml column content this <root> <element> <tomove/> </element> <element> <envelope> <good>somevalue</good> </envelope> </element> <element> <tomove/> </element> <element> <envelope> <good>somevalue</good> </envelope> </element> </root> i want add new node envelope between element , tomove. (element/envelope/tomove) using xquery. i tried adding envelope/tomove sibling tomove insert not support adding multiple nodes. adding envelope alone , adding tomove in next statement not seem possible since there envelope nodes should not tomove node. any ideas? edit: order , number of element nodes variable. this might you. comments in code describes do. -- setup test data 2 records 4 elements in each declare @records table(id int, content xml) insert @records values (1, '<root> <el

popup - Show Javadoc after pressing ctrl + space in Eclipse -

is there way, display javadoc popup in eclipse in "netbeans way"? example: when write str , press ctrl + space i'd see popup proposals (string, stringmath, stringbuffer , on) , window javadoc highlighted proposal. eclipse support showing documentation of highlighted element when using ctrl + space autocompleting. have working need little set jre/jdk using show eclipse docs. you can checking out preferences > java > installed jres > edit jre / jdk you've there. have 2 options either setting javadoc location or source attachement.

.net - How to access global resources for localization in class library? -

Image
i've got asp.net website (not web application) , have localized text ui using resources files (.resx). i've got class library contains business logic , there's validation method returns error message. need localise error message cannot find way access global resource file in website. on website, in code behind, can use resources.localisedtext.myerrormessage (where localisedtext name of resource file localisedtext.resx). in class library, cannot reference it. i've found link http://weblogs.asp.net/rinze/archive/2008/12/03/using-globalization-resources-resx-in-a-class-library-or-custom-control.aspx says can done doesn't seem work me because cannot right namespace website? i managed work based on resx's designer file. if open , @ resourcemanager property's get accessor, can copy line in order access same resources. full explanation first of all, need open resource file's .designer.cs file. should in solution explorer in following imag

Android: Return search query to current activity -

i followed steps described on http://developer.android.com/guide/topics/search/search-dialog.html implement search feature in notepad application. my problem is, when finish search new activity opens capturing search query. want, query returned current activity instead of starting new one. is possible? update: androidmanifest.xml <activity android:name="mynotepad" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> <action android:name="android.intent.action.search"></action> </intent-filter> <meta-data android:resource="@xml/searchable" android:name="android.app.searchable"></meta-data> </activity><activity android:name

Replace in MySQL -

in database have few records these 2 columns: id, name, 11, meal 997, 12, meal 998, 13, meal 999, 14, meam 000, 15, meam 001, 16, meam 002, but issue in application wrong data due logical error. how can change records containing meam meal , continue incrementing? the above records should these: 11, meal 997, 12, meal 998, 13, meal 999, 14, meal 1000, 15, meal 1001, 16, meal 1002, how can change database? "meam 001" in 1 columm what query be? update tablename set name=replace(name,'meam','meal 1') name "meam%" you can test with: select name, replace(name,'meam','meal 1') tablename ;)

java - Ant Freezes with no warning on exception -

i have been experiencing weird problem can't find solution to. when running project through ant , there's uncaught exception, ant freezes absolutely no error. here build file. multi threaded environment, also <fileset id="masterlibs" dir="${lib.dir}"> <patternset> <include name="*.jar"/> </patternset> </fileset> <target name="clean"> <delete dir="${build.dir}"/> </target> <target name="init"> <mkdir dir="${build.dir}"/> </target> <target name="compile" depends="init"> <javac srcdir="${src.dir}" destdir="${build.dir}"> <classpath> <pathelement location="${build.dir}"/>

ios - Detecting whether or not device support phone calls? -

is below code reliable used determine whether device can support phone calls or not? concern if apple changes iphone string else let's decide have "iphone 3g", "iphone 4" etc. [[uidevice currentdevice].model isequaltostring:@"iphone"] the iphone supports tel:// uri scheme. use: [[uiapplication sharedapplication] canopenurl:[nsurl urlwithstring:@"tel://"]]; canopenurl: explicitly checks whether there's application capable of opening url scheme, not url correct. doesn't matter no phone number specified. method returns bool, check yes or no. that should literally answer whether there's application present capable of making telephone call. should okay against future changes in device segmentation.

Deciding on LINQ to SQL vs StoredProcs -

while developing applications, go stored procedures contain crud logic, improve performance , maintainability. after experimenting linq sql, wondering whether, using compiled linq-to-sql queries on stored procedures improve performance? based on comments both devslick , a1ex07, seems have fundamental misunderstanding of linq is. in order linq queries allow chaining, like var activepeople = peoplelist.where(o => o.active).orderby(o => o.ordering).select(o => o.name); the execution of linq query must delayed until enumerated: foreach(var person in activepeople) { //if linq-to-sql, query peoplelist has waited until request database } this means query .where(o => o.active).orderby(o => o.ordering).select(o => o.name) not interpreted computer until point well. if run same query 100 times, means computer has reinterpret query 100 times. linq-to-sql, means translating query sql 100 times before sql sent database each time, if sql same every time

jquery - JavaScript: get and set variables in window.location.hash? -

does have solution getting , setting variables in window.location.hash ? take url looks this: domain.com/#q=1&s=2 what i'd unstressful way - javascript or jquery - check values of q , s when page loads, , change them following events on page. i have found some code getting hash variables , nothing sensible setting them. am missing obvious, or need roll own solution (and release it!)? thanks. jquery bbq can this. see also: get url parameter jquery get querystring values jquery edit @gonchuki points out, jquery.query can this.

algorithm - How to optimally change item.OrderNum fields to match list order -

i have list of objects ordernum fields. the ordernum fields have match list order (but are not required continuous ). easy solution. reset every ordernum when list order changes: for (int = 0; < list.length; i++) { list[i].ordernum = i; } but ordernum stored in sql, the smaller amount of ordernum reset, better . when ordernum have reset, changes can big. there 32 bits use. ordered list retrieved by: select * orderable_items order order_num; the actual programming language c#. assuming numbers sparsely spaced, can following: compute target index in every element in original list compute longest increasing subsequence (o(nlogn)) on indices leave ordernum unchanged on elements in computed subsequence change ordernums on rest of elements fall appropriate gaps this assumes there's enough space between original ordernums. after several such reorderings might need readjust numbers case.

apache - Using mod_rewrite how to Get the last 3 digits from a url -

i need last set of numbers random url, url looks like: /directory/directory2/a-b-c-d-123 a,b,c,d etc.. can anything, numbers, letters have dashes in between we using kohana project there additional rewrite rules in play have far... # turn on url rewriting rewriteengine on # installation directory rewritebase /site/ # protect hidden files being viewed <files .*> order deny,allow deny </files> # protect application , system files being viewed rewriterule ^(?:application|modules|system)\b - [f,l] #my code attempts here rewritecond %{request_uri} dealership/listing/ rewriterule ([0-9]*)$ index.php/dealership/listing/$1 # allow files or directories exist displayed directly rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d # rewrite other urls index.php/url rewriterule .* index.php/$0 [pt] i have tried few dozen configurations, setups, , researched google few hours no specific answers. i have been able 123

powershell - Is it possible to change the default value of $profile to a new value? -

so rather not create profile file here: c:\users\fmerrow\documents\windowspowershell\microsoft.powershell_profile.ps1 i mean don't me wrong, isn't end of world , can live it. however, keep root "my documents" reasonably lean , rather not create directory there every time start using new application. i've nosed around looking setting might hidden, far no luck. doesn't seem in registry or of $pshome files. do have learn live this? . . . or there way change value of $profile "stick" on system time? is, change "default value" of $profile ? the best i've thought of far, ignore $profile , instead put code in $profile.allusersallhosts source/execute file want put instead of default $profile location. comments and/or other suggestions welcomed. frank i think solution source "new" profile in existing profile you're going get.

What is the relationship between Flex, Flash and ActionScript 3.0 -

i'm working on project uses actionscript 3.0 flex sdks. project built using eclipse ide. wonder if flex sdks used support actionscript 3.0 in eclipse? what relationship between actionscript 3.0 , flash? its question, , 1 of many people tend confused with. - flash the singing, dancing graphics , vector stuff you'll aware of - deemed visual stuff. when open adobe flash, interface build animated stuff turned binary magic - actionscript 3 this began life small variable assistance flash graphicy stuff. has evolved (as you're aware) full blown language based upon ecma standard. why similar languages java , js - flex may become confusing here. flex has many forms. its xml style language of allows build 'flash' stuff via markup language, instead of drawing yourself. this begins become stable component set based on mxml (macromedia xml) syntax. flex wraps pretty entire as3 language mxml syntax , becomes framework its become norm have flex

c# - Error: A project with an out put type of class library -

Image
i trying figure out .net , got code when try run vs 2008 gives me error a project output type of class library cannot started directly. in order debug project, add executable project solution references library project. set executable project startup project i learning c# have no idea here you cannot run library. run executable or web site. right click on corresponding project , set startup project. can run it:

javascript - Asynchronous uploading (HTTP POST) to Amazon S3: why aren't I getting the right callbacks? -

i'm attempting upload file asynchronously using http post , jquery, i'm running strange issue: can't right callback fire. when upload file, returns "ok" status code 201 and can access file on s3 bucket , jquery fires "error" callback every time. after inspecting xhr object little further, came across: error: permission denied [http://192.168.2.247] property window.document [https://pentoolcn.aplusldesign.com.s3.amazonaws.com]. what causing this? code taken verbatim http://developer.amazonwebservices.com/connect/entry!default.jspa?categoryid=139&externalid=1434&fromsearchpage=true , synchronously (normal form submit , page refresh), worked perfectly. my code below. <?php // cdn service options amazon s3 "s3" or none "none" [default] $cdn_service_type = "s3"; $cdn_service_type = 'none'; $cdn_access_key = '[confidential]'; $cdn_secret_key = '[confidential]'; $cdn_bucket = '[c

php - How can I assign one part of the WHERE clause to multiple other parts of it? -

i make mysql query like: select * title '%".$_post["search"]."%' or '%".$_post["search"]."%' , costs < '".$max."' this give me results title search , results search , costs smaller $max. want costs < $max title $search. dont want put costs < $max 2 times script. there way assign both? maybe brackets: where (title '%".$_post["search"]."%' or '%".$_post["search"]."%') , costs < '".$max."' how can achieve this? thank you! phpheini yes, can use parentheses or evaluated first: where (title '%foo%' or '%foo%') , costs < '20' other remarks: i'd suggest escape strings using mysql_string_real_escape prevent sql injection attacks. or take @ pdo , prepared statements . you may want @ full-text search alternative approach faster.

about "static function" in c++,what is corresponding feature in Java -

about "static function" in c++,what corresponding feature in java thank you you can declare class method static public static int test(int i) { ... }

Apache .htaccess : How to remove slash from directory end? -

how remove slash directory end? rewriteengine on rewritecond %{request_uri} ^(.+)/$ rewriterule ^.+/$ %1 [r=301,ne,l] this rule doesn't work directories. issue? i don't think going work. say have file that in 2 directories /this , /that . 2 directories in apache root directory /var/www/domain.com you're looking turn directory http://domain.com/that/ work http://domain.com/that . if think it, there's (or be) file that sitting in /var/www/domain.com . if logic apache allowed rewrites that, end requesting /var/www/domain.com/that file , not original directory. if /var/www/domain.com/that didn't exist, 404 you're seeing now.

iphone - Strange delay on NSTimer -

i having following code in viewdidload method. updating label every second. when run code shows dummy text, waits bit shows 8 sec instead of 9 8.. so seems skipping 9, possible fix this? should have rounded decimals when calculate time left? thank time! //just dummy text self.lbltime.text = @"tid: 0h 0min 10sec"; nsdate *expiredate = [[nsdate alloc] initwithtimeinterval:10 sincedate:[nsdate date]]; self.expires = expiredate; [expiredate release]; self.timer = [nstimer scheduledtimerwithtimeinterval:1.0 target:self selector:@selector(updatetimerdisplay) userinfo:nil repeats:yes]; [[nsrunloop currentrunloop] addtimer:self.timer formode:uitrackingrunloopmode]; in updatetimerdisplay have: //gets time right nsdate *now = [nsdate date]; //stores difference in seconds between when test started , now. nstimeinterval interval = [self.expires timeintervalsincedate:now]; //gets number of hours nsinteger hours = interval / 3600; interval = (int)interval % 3600;

opengl es - Updating variables in addcontentview - android -

i have been developing game opengles android , have glsurfaceview displayed. have textview displayed on using addcontentview(mytextview, new layoutparams(layoutparams.fill_parent, layoutparams.wrap_content) ); mytextview contains string made of string plus parsed value of int. eg mytextview = new textview(this); mytextview.settext("score: " + integer.tostring(score) ); the textview , integer value display question how update when integer value changes? you'll have call mytextview.settext("score: " + integer.tostring(score) ); every time score changes.

jsf - Problem with outputlink on files -

i'm working on jsf 2.0 project using mojarra, primefaces , tomcat 6.x. i created outputlink point files. these files external of war in directory under apache httpd's control. <h:outputlink value="#{fileitem.linktarget.sourceurl}">#{fileitem.boname} (#{fileitem.linktarget.mediatype})</h:outputlink> the sourceurl value /dir/subdir/file.pdf . when sourceurl doesn't contains space it's work. when contains space, are replace + . /dir/subdir/big file.pdf become /dir/subdir/big+file.pdf . when replace + space in normal webbrowser, it's work? what's wrong , how can fix it? i same problem graphicimage of mojarra , solve using primefaces's graphicimage. in general not recommend use blank spaces in urls. if have no influence on file names in url's should url-encode these names described here url-encoding . blank space has replaced %20. maybe there java class encoding you. know php, there have function urlencode().

iphone - How do I convert an NSHttpCookie to a System.Net.Cookie in MonoTouch? -

i have monotouch iphone app federated sign in via azure access control service. login done via embedded uiwebview browser. when login done, want transfer cookie app. have access the nshttpcookiestorage.sharedstorage.cookies collection, can find cookie. in order call end services, need have a system.net.cookie that can put cookiecontainer send service. how convert between two... way? nshttpcookie cookie = nshttpcookiestorage.sharedstorage.cookies[0]; system.net.cookie newcookie = new system.net.cookie() { name = cookie.name, value = cookie.value, version = (int) cookie.version, expires = cookie.expiresdate, domain = cookie.domain, path = cookie.path, port = cookie.portlist[0].tostring(), // correct?? secure = cookie.issecure, httponly = cookie.ishttponly }; yes, how convert. perhaps should make extension method on nshttpcookie? call like: var c = cookie.toclrcookie ();

Deviant Art API or SDK for iPhone? -

do have idea if there available official deviantart api or sdk iphone? i building application , integrate search through deviant art public feed. possible? there no official api or sdk iphone. reviewing forums, has been suggested many times, far has not been provided. there's called difi: http://www.botdom.com/documentation/difi may worth try. if doesn't work, try interacting web site using hidden uiwebview using – stringbyevaluatingjavascriptfromstring: method. i've used in past interact web sites not provide api.

php - How do you add abstract class library in the Codeigniter framework? -

i have following code in file called abstractclass.php in libraries folder abstract class abstractclass { abstract protected dosomething (); } class concreteclass extends abstractclass { public function dosomething () {}; } when try load abstractclass controllers follows: $this->load->library('abstractclass'); i unable load requested class: abstractclass error. what doing wrong? should include file rather loading it? thanks well cannot load abstract class directly goes against point of abstract class. you can put abstract class in file along library, bit pointless , goes against "one class 1 file" standard ci (and standards) suggest. you can include file include() in library files, or set __autoload() function you. best place __autoload() bottom of config.php.

java - TableCellRenderer selected cell problem -

i want implement tablecellrenderer of jtable component, should show different color depending on cell data. got this, can't change color of selected cell. tried this: public component gettablecellrenderercomponent(jtable table, object value, boolean isselected, boolean hasfocus, int rowindex, int vcolindex) { if (isselected) { this.setbackground((color)uimanager.get("table.selectionbackground")); this.setborder(javax.swing.borderfactory.createlineborder(new java.awt.color(0, 0, 0))); } else { this.setforeground((color)uimanager.get("table.foreground")); this.setbackground((color)uimanager.get("table.background")); this.setborder(borderfactory.createemptyborder()); } ... } but not work :s .. can not see problem because jtable not show different when click on cell. i want implement tablecellrenderer of jtable component, should show different color depending on cell dat

php - How to remove all leading zeroes in a string -

if have string 00020300504 00000234892839 000239074 how can rid of leading zeroes have this 20300504 234892839 239074 note number above generated randomly. ltrim : $str = ltrim($str, '0');

android - Locate Bluetooth Inbox -

our app needs grab files bluetooth inbox after pushed external hardware device. there way programmatically find bluetooth folder location? on galaxy it's /mnt/sdcard/bluetooth , , on desire seems /mnt/sdcard/downloads/bluetooth . thanks! as far can tell, there's no simple , easy way via apis (although there should be!) two solutions work (depending on usage context; first 1 seems better): on start-up, app checks if there's sharedpreference (e.g.) "bluetoothlocation". if doesn't find it, app searches either (a) fs or (b) fs rooted @ /mnt/ (probably (b) better) until finds file such that: the name.equals("bluetooth") , , isdirectory() . then saves path, , there go. alternatively (depending on context) could, the first time external device connects, sends file long, hard-coded filename (e.g. greoermmvemoper190erjvw0j9e2.txt ). app searches through fs until finds file shared, hard-coded name, , saves location. these both

Problem with git: remote 'refs/heads/master' is not an ancestor of local 'refs/heads/master' -

i faced situation don't understand. have remote git repo running on webdav / apache. sure, logged on server , run "chown -r wwwrun:www *" , "git update-server-info" on relevant directory (as root, obviously). now, do: git clone http://myserver/myrepo then: $git remote show origin * remote origin fetch url: http://myserver/myrepo push url: http://myserver/myrepo head branch: master remote branches: master tracked trunk tracked trunk2.0 tracked local branch configured 'git pull': master merges remote master local ref configured 'git push': master pushes master (fast-forwardable) and change file, stage, commit , try push, results in: error: remote 'refs/heads/master' not ancestor of local 'refs/heads/master'. obviously, attempt pull pointless: $git pull up-to-date. the repository fine few days ago. how can work again? ok, resolved problem wrote in comment. used 1 of

GWT won't deploy to Google -

everytime try deploy program google app engine shows me error, hae googled , have received no answer. can please tell me error , how fix it. compiling module com.romero.chapthree.gaejchapthree [error] unexpected java.lang.nosuchfielderror: warningthreshold @ com.google.gwt.dev.javac.jdtcompiler.getcompileroptions(jdtcompiler.java:340) @ com.google.gwt.dev.javac.jdtcompiler$compilerimpl.(jdtcompiler.java:174) @ com.google.gwt.dev.javac.jdtcompiler.docompile(jdtcompiler.java:616) @ com.google.gwt.dev.javac.compilationstatebuilder$compilemorelater.compile(compilationstatebuilder.java:193) @ com.google.gwt.dev.javac.compilationstatebuilder.dobuildfrom(compilationstatebuilder.java:390) @ com.google.gwt.dev.javac.compilationstatebuilder.buildfrom(compilationstatebuilder.java:275) @ com.google.gwt.dev.cfg.moduledef.getcompilationstate(moduledef.java:299) @ com.google.gwt.dev.precompile.precompile(precompile.java:529) @ com.google.gwt.dev.precompile.pr

security - Safely storing passwords when access to the plaintext is still needed -

possible duplicate: php 2-way encryption: need store passwords can retrieved i know best practice storing user passwords store irreversible hash of password. however, developing application need store user's login information web service -- i'll need periodically log them in , perform maintenance tasks. unfortunately, service doesn't offer authorization tokens (very apprehensively) have store passwords in way can access plain-text values. don't own or control service authenticating, , method 'borrow' users username , password , authenticate. i planning aes_encrypt passwords in db, means if somehow able access db won't able plaintext. code need have access key unencrypt them, if entire server compromised no protection , passwords revealed. aside above-described encryption, there best practices or steps can take safely possible? edit i know whatever do, passwords must accessible in plaintext , compromised server means passwords revea

wpf - Object reference not set to an instance of an object during xml serialization and problem with selection of combobox item upon loading -

question 1. have issue of "object reference not set instance of object" when majorlabel empty , occurs after try save button click on xml serialization. how can fix this? private void savebutton_click(object sender, routedeventargs e) { string savepath; savefiledialog dialogsave = new savefiledialog(); // default file extension dialogsave.defaultext = "txt"; // available file extensions dialogsave.filter = "xml file (*.xml)|*.xml|all files (*.*)|*.*"; // adds extension if user not dialogsave.addextension = true; // restores selected directory, next time dialogsave.restoredirectory = true; // dialog title dialogsave.title = "where want save file?"; // startup directory dialogsave.initialdirectory = @"c:/"; dialogsave.showdialog(); savepath = dialogsave.filename; dialogsave.dispose(); dialogsave = null; formsaving abc = new formsaving(); if (!string.i

Where does Windows Platform Installer (WPI) save the downloaded files in my computer? -

i have network 1 server connected internet , clients not. want download , install microsoft products on server first , let client computers download installer later server. the questions where wpi save downloaded files? is possible run wpi , force install microsoft products downloaded files rather downloading again microsoft's server. note: assume there no license issue, hopely :-) it cached under %localappdata%\microsoft\web platform installer\installers if on vista or above, or in equivalent location on xp (there no %localappdata% environment variable in xp). if products downloaded, installed again cached location, unless updated, change hash , force web pi download them again. moreover, can copy cache folder 1 computer same location , web pi pick automatically , install products cached installers.

Why does git rebase --onto a b, git rebase --onto b a create a different SHA1 from the original? -

suppose have following revision graph, c current branch: c \ / b git rebase --onto b creates following: c / / b and git rebase --onto b a returns graph to: c \ / b however, new sha1 of c different old sha1 of c, before both rebasings. why case? the sha1 of commit depends on commit, including metadata. in particular, depends on commit timestamp. twice-rebased commit has new timestamp, has new sha1. (note there's "author date", when written, , "commiter date", when actual commit recorded. latter has changed. see yourself, use git log --pretty=fuller , or @ commit in gitk .)

sql server - Enable Tracing in CRM -

i trying import customizations on server machine running dynamics crm 4. able upload customizations file on crm , shows me entities. however when try import these entities crm gives me sql server error. need details of error , therefore need enable tracing on crm server. how enable tracing on dynamics crm? have found quite many pages when googled term didn't quite looking for. there's diagnostic tool 4.0 enables tracing within crm you. enabling tracing causes crm emit ton of debug/error information , first step take when troubleshooting non-trivial issues. times error tell what's wrong. you can diag tool crmtools.zip link here . you'll want crmdiagtool4.zip file. extract contents of crmdiagtool4.zip onto crm server , run crmdiagtool4.exe. dropdown menu, choose "dynamics crm server". click first button enable tracing. enabling tracing huge performance hog, enable right before start import , disable right after error occurs. to read out

unit testing - Understanding metaClass in Grails tests -

i'm learning grails, , working through the guide on testing. there's example provided covers writing test piece of code in fictional bookcontroller : def show = { [ book : book.get( params.id ) ] } the guide suggests following approach mocking out result of params.id : void testa() { bookcontroller.metaclass.getparams = {-> [id:10] } } as change on static definition of bookcontroller , persist between tests, or grails magic somehow automatically clean in teardown method? ie, if write subsequent test skipped setup of metaclass.getparams , ran after testa , params.id still return 10 ? if so, what's standard grails practice cleaning in test tear-down? doesn't seem covered in guide i'm reading. you're using ancient version of docs covering 1.0.x. testing support lot more solid now, see updated chapter 9 in http://grails.org/doc/latest/

In Ruby on Rails, what kind of design pattern is to use false to denote don't do DB look up and nil to denote ok to look up? -

in restful authentication , found current_user quite intricate that, when @current_user set false, means don't try find user again (usually db), while nil means that's ok, can again in db: line 8 of lib/authenticated_system.rb def current_user @current_user ||= (login_from_session || login_from_basic_auth || login_from_cookie) unless @current_user == false end the intricate thing is, if tries db login_from_session , etc, , can't find it, final value gets assigned @current_user nil , , method returns nil (which last evaluated value in method). unless there 2 other places in code elsewhere can set @current_user false, , trigger unless , causing whole statement return nil , while @current_user remains false , , method returns nil ... i speechless code rely on these intricate facts. false has special meaning, , nil has special meaning in code, not documented, not commented, , current_user can nil , while @c

.net - T4 template to generate a typed dataset -

is there t4 template generate typed dataset? i using ndbunit testing , have xsd automatically updated when change database schema. ideally xsd contain subset of tables in database. alternatively there command line tools, nant or msbuild tasks can this? mygeneration has strongly-typed dataset generator template , set of command-line opts enable invoke automatically part of build process. see http://www.mygenerationsoftware.com/portal/default.aspx more info, downloads, link latest version, , library of existing templates. also, because mygeneration supports persisting mygeneration 'project settings' , re-running them command-line, can save input choices make template (e.g., subset of tables want select db) , re-apply them when template re-run.

android failed to show result -

in following code want crate file in sdcard. not giving valid output. showing hello world...where "file created" message displayed , file stored? package com.read; import java.io.fileoutputstream; import android.app.activity; import android.content.context; import android.os.bundle; public class read extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); string filename = "hello_file"; string string = "hello world!"; try{ fileoutputstream fos = openfileoutput(filename, context.mode_private); fos.write(string.getbytes()); fos.close(); }catch(exception e){} system.out.println("file created"); } } using method you're trying create file in phone's internal memory. just use code: fileouputstream fos = new fileoutputstream( "/sdcard/" + f