Posts

Showing posts from July, 2013

XSLT: If check parameter value -

following code in xslt (i've cut out irrelevant parts, get-textblock lot longer , has lot of parameters passed correctly): <xsl:template name="get-textblock"> <xsl:param name="style"/> <xsl:element name="border"> <xsl:if test="$style='{staticresource labeltext}'" > <xsl:attribute name="background">#ff3b596e</xsl:attribute> </xsl:if> <xsl:attribute name="background">#ff3b5940</xsl:attribute> </xsl:element> </xsl:template> the style parameter can either '{staticresource labeltext}' or '{staticresource valuetext}' , background of border depends on value. this if structure fails however, draws ff3b5940 border in output.xaml file. call template this: <xsl:call-template name="get-textblock"> <xsl:with-param

java - validate that an email address contains "@" and "." -

i need validate inserted email address contains "@" , "." without regular expression. can give me "java code" , "structure chart" examples please? i suspect you're after like: if (!address.contains("@") || !address.contains(".")) { // handle bad address } edit: far complete validation, of course. it's barely start of validation - going particular case wanted handle.

Creative Use of OpenID -

the situation i have 3 websites used same one. result, use single database user administration , authentication. unfortunately, distinct websites , have grown include drastically different features. when 3 sites 1 site, used nifty layout switcher keyed on requested url determine stylesheets use. if logged in domain1.com user domain2.com , server swap url without problem. as added features 1 site, needed split 3 different systems keep stepping on ourselves. adding feature domain1 break unrelated system on domain3 , keeping things separate smarter. kept same user database because it's tied in our licensing , subscription systems. now, want begin using ssl/tls protect sites ... meaning they're transferred on https rather http. using http, didn't have many problems bouncing users 1 site version another. log in of 3 sites, server detect site supposed on, , kick on there. since we're using state server session management, didn't lose in transfer,

c# - Data transfer from one website to another -

i have 2 websites , b both written in asp.net mvc 3. in website there form needs submitted website b via post method. user has option post directly or after encrypting values. when submit form without encryption simple form.submit() , able values in website b using formcollection object. when user selects submit after encryption, redirect action on website encryption occurs , encrypted data placed in hidden textbox in corresponding view , auto submitted on page load using jquery website b. unable values in formcollection object on website b. what problem be? happening because of security feature prevent xss or similar? its doubtful xss protections - in case see exception. load fiddler , make sure see data in element inside form getting posted website b. if there in form being submitted - should available.

xaml - Silverlight 5: Set ConstructorArgument on a IMarkupExtension class -

i have markupextension can initiated 1 value, binding : <textbox text="{binding mypath}"/> instead of <textbox text="{binding path=mypath}"> in wpf done constructorargumentattribute , doesn't exist in silverlight. checked attributes on path property of binding have'nt found attributes applied it. any ideas? for realize it's not yet implemented. so if think feature compelling, please go ahead , vote feature here . hope answer updated have piece of news (hope happen asap...).

sql - Excluding a table from a transaction rollback -

we have table , set of procedures used generating pk ids. table holds last id, , procedures gets id, increments it, updates table, , returns newly incremented id. this procedure potentially within transaction. problem if have rollback, potentially rollback id before id's came use during transaction (say generated different user or thread). when id incremented again, cause duplicates. is there way exclude id generating table parent transaction prevent happening? to add detail our current problem... first, have system preparing migrate lot of data into. system consists of ms-sql (2008) database, , textml database. sql database houses data less 3 days old, while textml acts archive older. textml db relies on sql db provide ids' particular fields. these fields identity pk's currently, , generated on insertion before publishing texml db. not want wash our migrated data through sql since records flood current system, both in terms of traffic , data. @ same time have n

jdbc - blocking consumers in apache camel using existing components -

i use apache camel jdbc component read oracle table. want camel run in distributed environment meet availability concerns. however, table reading similar queue, want have single reader @ given time can avoid locking issues (messy in oracle). if reader goes down, want reader take over. how accomplish using out-of-the-box camel components? possible? it depends on deployment architecture. example, if deploy camel apps on servicemix (or activemq) in master/slave configuration (for ha), 1 consumer active @ given time... but, if need multiple running (clustered scalability), (by default) compete/duplicate reads table unless write own locking logic. this easy using hazelcast distributed locking . there camel-hazelcast component, doesn't support lock api. once configure apps participate in hazelcast cluster, just lock api around code need synchronize given object... import com.hazelcast.core.hazelcast; import java.util.concurrent.locks.lock; lock lock = haz

c - Passing fscanf to struct -

i'm trying open file , pass struct , i'm using fscanf() loop, saves 1 struct last read: imagine file: jr john rambo 24353432 jl john lennon 6435463 i'm using code: typedef struct people{ char code[10]; char name[100]; long telephone; }people; int read(people people[], int n_p){ char temp; file *fp; fp=fopen("example.txt","r"); if(fp==null){ printf("error\n"); return -1; } while(!feof(fp)){ fscanf(fp,"%s %s %s %d\n", people[n_p].code,people[n_p].name, &people[n_p].telephone); } } the problem saves last line of file...should if cicle?? another question how can separate similar file ";" first of all, scanning 3 strings ( %s ) , 1 int ( %d ) when pass 3 parameters in fscanf() . add char first_name[50]; in struct , do: fscanf(fp,"%s %s %s %d\n", people[n_p].code,people[n_p].first_name, people[n_p]

c - getaddrinfo and IPv6 -

i'm trying understand getaddrinfo function returns : #include <stdlib.h> #include <sys/types.h> #include <unistd.h> #include <sys/socket.h> #include <netdb.h> int main (int argc, char *argv[]) { struct addrinfo *res = 0 ; getaddrinfo("localhost", null ,null,&res); printf("ai_flags -> %i\n", res->ai_flags) ; printf("ai_family -> %i\n", res->ai_family) ; printf("ai_socktype -> %i\n", res->ai_socktype) ; printf("ai_protocol -> %i\n", res->ai_protocol) ; printf("ai_addrlen -> %i\n", res->ai_addrlen) ; struct sockaddr_in* saddr = (struct sockaddr_in*)res->ai_addr; printf("ai_addr hostname -> %s\n", inet_ntoa(saddr->sin_addr)); freeaddrinfo(res); return 0 ; } results : ai_flags -> 40 ai_family -> 2 ai_socktype -> 1 ai_protocol -> 6 ai_addrlen -> 16 ai_addr hostname -> 127.0.0.1 in /etc/host

coldfusion - is it possible to dynamically create a query and escape the values too using cfscript+cfquery+cfqueryparam? -

i'm still new coldfusion. dynamically creating query oracle. have used cfquery/cfparam in past rather use cfscript accomplish more readable. intended large 'insert ... into.' here's basic example of have far: <cfscript> clinicnil = structnew(); clinicnil.address1 = 'line 1'; clinicnil.address2 = 'line 2'; myfields = [ 'address1' ,'address2' ]; query = querynew(""); sql = "insert all"; (i=1; lte arraylen(myfields); i=i+1) { sql = sql & "into notinlist (sourcetable, sourcecolumn, sourcepk, enteredvalue, insertdate, updateddate, insertedby, updatedby) values("; // [..] // how dynamically escape value below? sql = sql & escapetheparameterhere( clinicnil[ myfields[i] ]); // [..] sql = sql & ") "; } writeoutput( query ); </cfscript> where have 'escapetheparameterhere' want able have value escaped somehow. how can escape

c# - How can I add a listView column header a click event programmatically -

Image
i building dynamic listview , trying achieve same thing in picture bellow. how can programmatically. have tried: probably this: listview.addhandler(gridviewcolumnheader.clickevent, new routedeventhandler(header_click));

plugins - a Java code analysis tool for intelliJ and Eclipse is needed -

does has experience code analysis tool has working plugin both eclipse , intellij? both findbugs , checkstyle work intellij 10 , eclipse. may have modify jvm setting plugins work. but works.

java - Open File on Sdcard -

hey, want open .gif file on sdcard. used temp .gif in app , works need open raw file on sdcard , not letting me.... can help? code works: http://pastebin.com/5klvag5c code im trying use: http://pastebin.com/q7t9qanq thank you! :) iirc, openrawresource() needs resource id. doesn't work filepaths. try replacing = context.getresources().openrawresource(location); with = new bufferedinputstream( new fileinputstream(location) ); remember, you'll need sdcard permissions.

How to assign a chrome tab to a variable by a given tab id in javascript? -

i tried assign tab variable; failed. here code: var tab; chrome.tabs.get(id, function(t) { tab = t; console.log("tab: " + tab); // here printed result right }); console.log("(after assignment) tab: " + tab); // "undefined" the code simple don't know problem is... the problem in asynchronous chrome api calls, meaning don't receive response them immediately. can rewrite code in way example: var tab; chrome.tabs.get(id, function(t) { tab = t; console.log("tab: " + tab); // here printed result right afterassignment(); }); function afterassignment() { console.log("(after assignment) tab: " + tab); // "undefined" //the rest of code needs use tab var }

jQuery: Help with <Select> Form -

here's have: <select id="barrelselect"> <option value="barreldefaultoption">-- choose --</option> <option value="blackbarrel" rel="10">black barrel</option> <option value="bluebarrel" rel="25">blue barrel</option> <option value="greenbarrel" rel="30">green barrel</option> </select> <select id="slideselect"> <option value="slidedefaultoption">-- choose --</option> <option value="blueslide" rel="15">blue slide</option> <option value="blackslide" rel="45">black slide</option> <option value="greenslide" rel="50">green slide</option> </select> <p>$ <span id="output"></span> </p> <script> function onselectchange(){ var total = 0, barrel = $("#barrelsel

java - Maven project for both WAR and standalone server/client -

i have pom-based java project. contains number of servlets deployment in war. however, in addition this, have classes launch application standalone using embedded servlet , database environments (for turnkey development environment). additionally, there command-line client application. i have ability build project both war , 2 separate executable jars (one server, 1 client). i'm not concerned jars/war containing unnecessary code or deps- want 3 work. what's "correct" way maven? multiple projects way this. put common code in first project along standalone support. make second war packaging depends on first.

mono - MonoDevelop Code Wrapping C# -

with monodevelop c#, when press format code button (ctrl+shift+f) ide take multi line statement , create long single one. lambda , linq statements, can counter productive. i looking way have ide format code, if command on seperate lines, leave on seperate lines. i think should filed bug in monodevelop, not question on stackoverflow.

gcc - libiconv solaris-sparc/opteron 64 bits -

i have 64 bit solaris - sparc , opteron systems. under /usr/local/lib , can see libiconv.so both systems. file command on libiconv.so gives following output:- elf 32-bit lsb dynamic lib 80386 version 1, dynamically linked, not stripped, no debugging information available how build 64 bit libiconv w/o disturbing existing 32 bit on both sparc , opteron systems? reason being, not aware of existing version of libiconv. this libiconv.so not part of os being in non standard /usr/local/lib. should want build or install elsewhere 64 bit version of library, install in /usr/local/lib/amd64 or /usr/local/lib/64. however, useless in first place solaris includes iconv library function in standard c library gnu libiconv redundant , unnecessary here.

c# - What sorting algorithm does the .NET framework implement -

this question has answer here: which sorting algorithm used .net in icomparer 2 answers could please advise when implementing icomparable in .net sorting algorithm .net use sort underlying data? algorithm used customizable or selectable? there 2 biggies. array.sort (which sorts array in-place) uses unstable quicksort . this same implementation used internally list<t>.sort , according msdn documentation: this method uses array.sort , uses quicksort algorithm. the enumerable.orderby<tsource, tkey> method (which sorts copy of input sequence) uses stable quicksort . as far know, these 2 sorting implementations in .net bcl.

jsf - How to force only one page to open with SSL? -

in project, using ssl works pages.i want use login page, after page should revert http protocol. how can that? found way below, not work. <security-constraint> <web-resource-collection> <web-resource-name>notify page, accessed internally application</web-resource-name> <url-pattern>/login.xhtml</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>confidential</transport-guarantee> </user-data-constraint> </security-constraint> <security-constraint> <web-resource-collection> <web-resource-name>entire site</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>none</transport-guarantee> </user-data-constraint> </security-constraint> my project jsf 2.0 project

dynamic - How can we change the HTML table contents dynamically using javascript? -

how can dynamically change html table contents if table in pop displayed while pressing button? i know can change content using below function function change(){ var x=document.getelementbyid('tbl').rows var y=x[0].cells y[0].innerhtml="new content" } but possible when table on same window. in case of pop not change. you can access elements in window open using windowref.document.getelementbyid(...) so: <script type="text/javascript"> // global used here, use in closure in rl var popupwindow; function popwin() { var content = '<title>popup window</title>' + '<table id="tbl">' + '<tr><td>row 0 cell 0<td>row 0 cell 1' + '</table>'; var newwin = window.open('','newwin'); newwin.document.write(content); newwin.document.close(); return newwin; } </script> <

encoding - how to encode int with base32 in sql server 2008 -

i looking encode int base32 string in sql server 2008. any suggestions of built-in function or perhaps custom function? thanks here few implementations: http://dpatrickcaldwell.blogspot.com/2009/05/converting-decimal-to-hexadecimal-with.html http://snippets.dzone.com/posts/show/707 http://geekswithblogs.net/bbiales/archive/2009/05/04/131732.aspx

Mercurial: Lightweight copies/renames -

from mercurial wiki - gsoc ideas 2010 : project ideas lightweight copies/renames (very difficult - successful student become expert in mercurial's storage format , transmission protocol) copies , renames not efficient. mercurial copies copied/renamed source file new initial revision of target file in internal history store. renames, counter-intuitive, renaming large file grows store file's size. better if mercurial had way of referring existing revision new file, while preserving backwards compatbility , bounded i/o guarantees retrieving revisions. see issue883 discussion. there's mq old attempt @ located here . sorry if obvious question (i'm not @ english , programming). i'm wondering, "lightweight copies " mean? is mean: when feature implemented, multiple files same content (same hash value different file names) stored once in repository (just git)? update: thanks answers. 1 of

ios - Cannot delete files from Dropbox(from iPhone app) -

i'm trying delete files dropbox. have implemented swipe delete behaviour. 'swipe-delete' deletes files tableview only. next time upload, can see 'deleted' files , when check dropbox account on pc, files never deleted. they're there after file disappears tableview. - (uitableviewcelleditingstyle)tableview:(uitableview *)tableview editingstyleforrowatindexpath:(nsindexpath *)indexpath { return uitableviewcelleditingstyledelete; } - (void)tableview:(uitableview *)atableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath :(nsindexpath *)indexpath { [self.itemarray removeobjectatindex:indexpath.row]; [atableview deleterowsatindexpaths:[nsarray arraywithobject:indexpath] withrowanimation:yes]; [self.tableview reloadsections:[nsindexset indexsetwithindex:0]withrowanimation:uitableviewrowanimationfade]; } you're code shows you're deleting entry table view

How to add javascript file to Xcode4 -

i worked javascript files within xcode3 before , great, need copy .js remove javascript file compile sources build phase , add copy bundle resources build phase suggested in post the problem how do same thing in xcode4, can't seem find place that. help please, thankz in advance. pondd have check here project navigator (cmd + 1) select project select target select "build phases" tab, there desire sections.

c# - Access to Reporting services Reports? -

i have problem reporting services. security , security configure. biggest problem i've got : how access reporting services (mean reports) none certificated computer(user)? let me explain question, have windows-app , web-app, both of them use reporting services base reports. when want use these app in none-domain-network. problem occur. (for example, web-app users have access web-app via internet it's ridiculous make them in member of domain) additional info: i'm use server mode in report viewer control. have address uri of reporting service , put reports same directory in reporting. when want execute report in web or win application, send report name sightly form or page (also set report server uri , report path , after setting report path call refresh method , set parameter reports). i find call local report in report viewer control seems odd cuz must define data-source in project , attach report-file solution , can use report !!!

Do we have any open source libraries for android to create a pdf viewer app? -

i trying develop android app capable of rendering pdf files. how can render pdf files in android app? there libraries this? can 1 suggest me open source libraries android create pdf viewer in app? if possible please give me sample tutorial links achieve this. any appreciated greate thanks sathish search in code.google.com http://code.google.com/p/apv/ http://sourceforge.net/projects/andpdf/ http://code.google.com/p/apdfviewer/ lot of pdf viewers there select 1 of them based on requirement thanks.

android - Popup when user trying to uninstall my application -

is possible prompt popup show message when user trying uninstall android application? wanted show message user when uninstall. idea? this not possible far know. uninstalling process invokes none of application code.

user interface - Clickable banner image in WiX dialog -

i put image banner on 1 of wix dialogs when clicked opens web page our product support, in case users have trouble installation. think know how open web page problem registering click event. there way this? from own attempts i've concluded "bitmap" type control won't let detect clicks. have other options, making pushbutton picture on , hiding borders looks good? i've not been successful this. i'm using wix 3.5. i think can't want internal msi ui wix provides interface. you can create button image on can't hide borders of button. starting windows installer 4.5, there's ability include custom ui elements, see using embedded ui reference. option using external ui , develop ui regular application , handle notification messages msi.

page.VisualEffect in rails 3 with jquery -

i trying migrate rails 3 , ujs jquery now old code this: page['contact_detail_data'].visual_effect :scrollto,:duration => 0.5,:offset => -30 now in jquery think must use animate so thought of : page['contact_detail_data'].animate :scrollto,:duration => 0.5,:offset => -30 but unsure of how give parameters can please guide me ? you can use : page.call("anim_up_down","certification_#{params[:index]}",30,500 ) and in javascript function anim_up_down(ele,extraoffset,duration){ $('html,body').animate({scrolltop: $('#'+ele).offset().top-extraoffset},duration) }

c# - DisconnectedContext/ContextSwitchDeadlock was detected -

i have richtextbox heavy message logging multi threads. after time first received "disconnectedcontext detected" message , removed breaking on exception debug->exceptions... window. received "contextswitchdeadlock detected". removed , ui came life. after time freezed again. is there way prevent this? or there component supports coloring, changing fonts give visual feedback in .net richtextbox without error? contextswitchdeadlock detected message: clr has been unable transition com context 0x6eb0760 com context 0x6eb08d0 60 seconds. thread owns destination context/apartment either doing non pumping wait or processing long running operation without pumping windows messages. situation has negative performance impact , may lead application becoming non responsive or memory usage accumulating continually on time. avoid problem, single threaded apartment (sta) threads should use pumping wait primitives (such cowaitformulti

iphone - Accessibility in custom drawn UITableViewCell -

uitableviewcells scrolling speed increases dramatically when custom drawing, however, accessibility breaks. how should 1 add accessibility support cell this? old question, ios has built in support kind of accessibility. take @ uiaccessibilitycontainer informal protocol allow define rects in view , label them appropriately. thus, if draw big x @ 0,0 size of 44x44, can set accessibilitylabel rect "delete".

string - c++ ifstream to char * -

my code reads file ifstream , parse it, changed things , don't need read file, 'cause read place, have char* instead ifstream... how can change code use ifstream.get()? again you put char * std::stringstream . std::stringstream buffer(your_string); you can use buffer std::ifstream (you cannot open or close it). ideally, parse-method take reference std::istream parameter, not mind kind of input-stream receives: void parse(std::istream & input); since both std::ifstream , std::stringstream inherit std::istream , can pass them parameters, , parser runs without modifications.

Maintaining session in android ( application stay authenticated on the server side) -

i building login application in android in hitting url(with username , password) upto part works fine after whenever hitting url(once user authenticated) , return nothing(i.e. error message please login first). works fine in similar iphone app , on browser. i got somewhere error of phpsessionid(i.e. session destroyed further request) , if want our android application stay authenticated on server side need fetch id after first connection , send in headers of our subsequent requests. but problem unable sessionid header of first connection , sending further request along header. please give me codes or links complete task properly. thanks. finally solved issue of session handling in android . android cant handle session itself(which simple browser can) have handle explicitly. changed code http connection bit. created instance of defaulthttpclient in first activity when connection established. public static defaulthttpclient httpclient; for first time connection,i

java - Character set on Solaris -

i have simple java program prints out special characters system.out.println("á"); system.out.println("é"); system.out.println("í"); system.out.println("ó"); system.out.println("ú"); when run code on windows 7 machine, prints console correct characters. deploy soloris machine , run code.it looks á ú í ó é i have tried running jar commands java -dfile.encoding=utf-8 -dsun.jnu.encoding=utf-8 how can special characters print out in solaris? you need utf-8 locale installed , configured terminal. i'm not familiar setting on solaris, these links might started: customizing , creating solaris locales how manually add locale pkgs on solaris 10 en_us.utf-8 locale in solaris 10

cocoa touch - iPhone: How to set the application badge, when the app is closed/in background? -

Image
is possible set application badge, while app in background mode or closed? haven't found anything, yet. from within application can use applicationiconbadgenumber property of uiapplication set badge number: [uiapplication sharedapplication].applicationiconbadgenumber = 1; if want change badge without user launching app, need use push notification service. push notification service programming guide should have info need.

zip library for native C++ with remove/modify capabilities -

i looking simple zip library (prefers without dll/lib) have zip modification capabilities. the option i've found far update/remove entries creating temp file , writing temp, , rename original file. does know better way update/remove zip entries without mess? thanks! libzip has support replacing: zip_replace(3) , deleting: zip_delete(3) files in zip archive.

ldap - VBScript returning 0 rows when ADSIEdit returns correct number of rows -

i've been banging head against last 2 days or so, , without success - regardless try. when run query retrieve share volumes ends specific ending, work in adsiedit - not in vbscript. odd, i'm using same query. the adsiedit query configured so: name: test root of search: dc=ad,dc=server,dc=com query string: (&(objectcategory=volume)(objectclass=volume)(cn=k_*)) query scope: subtree search. search results: 11 records cn starts k_ vbscript results: 1 record (!?!?) if change query string (last part) (uncname=*\5cost-gro)) instead, want (the first query string gave testing purposes), in adsiedit 7 rows returned - in vbscript none! here's (current) vbscript code: set objdomain = getobject("ldap://rootdse") set objsysinfo = createobject("adsysteminfo") set objconnection = createobject("adodb.connection") objconnection.provider = "adsdsoobject" objconnection.open "active directory provider" set objcomman

spring - SSO/CAS intranet session to my Java EE portlet -

i develop jsp/servlet application "portlet" on intranet , want user stay connect intranet cas session , retrieve session informations use in application (like login). if user not connected cas, want redirect to. i use spring in java connections ldap , maybe can found sso/cas session in framework. if has suggestion please me, it's urgent project... edit: application "portlet", integrate on jahia website need connect cas access it if straight servlet or jsp issue, i'd should use spring security handle cas integration (through spring-security-cas-client.jar documented in springsec docs ). however, you're using portlet framework makes much more complex. should check documentation, security 1 of things handled portlet framework. (a quick scan of admin docs isn't helpful; seems entirely focused on password management rather delegating separate specialist service cas.)

ruby - How to calculate XOR with offset? -

i want xor calculation different offset list in calculation. example : key = [0, 1, 0] text = ["0", "1", "0", "1", "0", "1", "0", "1", "1", "1"] the xor calculation: key[0] ^ text[0] ; key[1] ^ text[1] ; key[2] ^ text[2] ; key[0] ^ text[3] ; key[1] ^ text[4] ; key[2] ^ text[5] ; key[0] ^ text[6] ; key[1] ^ text[7] ; key[2] ^ text[8] ; key[0] ^ text[9] ; how ? you can use array#cycle method "cycle" key as needed: text.zip(key.cycle).map{|t,k| t.to_i ^ k} # => [0, 0, 0, 1, 1, 1, 0, 0, 1, 1]

How to configure Chrome's Java plugin so it uses an existing JDK in the machine -

when installing jdk in machines (windows 7), following. install latest 1.7 jdk oracle installer (just jdk, no jre ) copy install folder, place want, remove samples, etc. uninstall java set %java_home%, add %java_home%\bin %path% then synchronise folder in machines keep updated (with unlimited cryptography stuff, jssecacerts , java.policy , endorsed libraries, etc). but has 1 big caveat, when chrome needs use load page uses java, thinks java not installed , wants install it. don't want install mess 'hand-installed' jdk. so there way configure chrome uses jdk in disk? have both jdk 32-bit , jdk 64-bit, not problem (i guess need use 32-bit 1 chrome). i found question in chrome project, how have chrome java plugin reference existing jdk without reinstalling java? , no replies far... update: ubuntu, see kalyan's answer update: still continue use approach successfully, last time 1.7.0_21 on win7 update 1.7.45: path in windows registry [hkey_local_mac

html - Are there any math rules for creating a fluid CSS template without borders overlapping? -

i'm creating template page (you can see here ) , i'm trying use proportional height , width. i'm having troubles borders. think there math calculation because want have pixel perfect borders each div (that means 2 adjacent divs should separed 1px border) , divs contained in container div should use available space (i hope understand mean). you can find source code here thx in advance suggestions on how achieve this. so have modify html , css bit achieve such result. elements width of 50% , 1px border larger 50% in box model. wrap contents in div , give div border. outer div should 50% width. use top , left borders. i've modified left part of fiddle give impression how work. http://jsfiddle.net/3pw7y/2/

ruby - Conflict the key name in MongoMapper -

i use mongo mapper (0.8.6) in sinatra service. have 1 problem stack level deep. problem there conflict of key " changes " in model. here model: class changelog include mongomapper::document belongs_to :resource key :changes, hash, :required => true key :message, string, :required => true key :note, string key :user_uuid, string, :required => true key :user_name, string, :required => true timestamps! end however, don't want rename key in case, it's right name web service. suggestions? changes instance method tell fields have changed since last saved document. here's example mongomapper's documentation user = user.create(:name => 'john', :age => 29) puts user.changed? # false puts user.changes.inspect # {} user.name = 'steve' puts user.changed? # true puts user.changes.inspect # {"name"=>["john", "steve"]} unfortunately, you're

google maps api 3 - how to fix the precision for lat/lng? -

with v2 version can fix precision tofixed example: point.y.tofixed(4) how can v3 version ? tofixed javascript function - not google maps api. in api v3 can during latlng creating: var latitude = -25.363882; var longitude = 131.044922; var latlng = new google.maps.latlng(latitude.tofixed(4), longitude.tofixed(4));

objective c - IOS: action with enter key of iPad KeyBoard -

i have 2 textfield, in first textfield write "hello" , when push enter in ipad keyboard, want in second textfield appear "world"; how can use enter create action in application? you typically assign view controller text field's delegate , implement textfieldshouldreturn: method, e.g.: - (bool)textfieldshouldreturn:(uitextfield *)textfield { othertextfield.text = @"world" return yes; }

java - JAR or Maven dependency for wicketstuff-dojo -

i want use org.wicketstuff.dojo.markup.html.form.dojodatepicker searching on internet maven dependency of wicketstuff-dojo. mvn browser found dependency. not working getting "missing artifact" error. if knows dependency or location can download jar helpful me. my pom.xml is: <dependencies> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupid>jaxen</groupid> <artifactid>jaxen</artifactid> <version>1.1-beta-9</version> <scope>runtime</scope> <exclusions> <exclusion> <groupid>jdom</groupid> <artifactid>jdom</artifactid> </exclusion> <exclusion>

Date formatting a Ruby date from a .NET Webservice -

i have date coming through .net webservice rails app: 2011-05-09t10:57:00+01:00 what date format can use date.strptime give me reliable way of extracting date? date , datetime can handle natively: datetime.parse "2011-05-09t10:57:00+01:00" # => mon, 09 may 2011 10:57:00 +0100

asp.net - Object references and cache -

i have function getallproducts() fetches products database , stores in cache future requests. works fine, if call function e.g. productsearchresults = getallproducts(), , modify productsearchresults variable, modifies cache, important never happens, cache affects whole website. i understand because both productsearchresults , cache have same reference, how solve problem? there can put in getallproducts() ensure cache uses own value? public shared function getallproducts() productcollection dim products new productcollection() if isnothing(system.web.httpcontext.current.cache("productdata")) '////// database code products goes here ////// system.web.httpcontext.current.cache.insert("productdata", products, nothing, datetime.now.addminutes(5), timespan.zero) end if products = system.web.httpcontext.current.cache("productdata") return products end function public shared f

dialog - android error: Can't create handler inside thread that has not called Looper.prepare() -

this question has answer here: can't create handler inside thread has not called looper.prepare() inside asynctask progressdialog 4 answers i have error users of android market. have no idea when error occurs . simulator , test phone runs app perfectly! any1 idea begin looking? ! this error: java.lang.runtimeexception: can't create handler inside thread has not called looper.prepare() @ android.os.handler.(handler.java:121) @ android.view.viewroot.(viewroot.java:259) @ android.view.windowmanagerimpl.addview(windowmanagerimpl.java:148) @ android.view.windowmanagerimpl.addview(windowmanagerimpl.java:91) @ android.view.window$localwindowmanager.addview(window.java:430) @ android.app.dialog.show(dialog.java:288) @ be.test.testerd$1.run(testscreen.java:103) this can occur, if have used asynctask , in dobackground() me

shell - BASH script for sorting files recursively by base filename into folders of the same name -

i have following file structure: \hi actionpotential_hi.mp4 adhd_hi.mp4 alzheimersdisease_hi.mp4 alzheimers_art_hi.mp4 artificial_eye_hi.mp4 more files ... \lo actionpotential_lo.mp4 adhd_lo.mp4 alzheimersdisease_lo.mp4 alzheimers_art_lo.mp4 artificial_eye_lo.mp4 etc. \med *base_filename*_med.mp4 \stills *base_filename*_med.jpg \captions *base_filename*.adb.xml \transcripts *base_filename*.txt in order ingest these marklogic environment, need these rearranged following structure, asset base filename. \asset asset_lo.mp4 asset_med.mp4 asset_hi.mp4 asset.txt asset.adb.xml asset_med.jpg i bash script sort these out me. suggestions? find . -type f -print | while read -r pathname; filename=${pathname##*/} case "$filename" in *_hi* | *_med* | *_lo*) # strip off last underscore , following chars new_dirname=${filename%_*} ;; *) # strip off fi

css - JQuery UI with icon on the right side of an hyperlink -

i'm trying place icon (using jquery ui theme) on right side of hyperlink. best satisfactory result had icon on far right side of page, , not after actual text. easiest option have <img> tag after text, icon needs styled current theme. this have : .... <a href="#" id="contractlink" target="_blank" class="left-margin"> <span id="contractlinktext">loading...</span> </a> ... <script type="text/javascript"> $(function() { $('#contractlink') .append($('<div></div>') .addclass('ui-icon ui-icon-newwin') .css({'float':'right', 'border':'1px solid blue'}) ); }); </script> you can make icon display:inline-block or display:inline . not sure effect have on icon in browsers, although put on same line span. since jqueryui css makes display:block , maybe i

Python 3 writing to a pipe -

i'm trying write code put data pipe, , i'd solution python 2.6+ , 3.x compatible. example: from __future__ import print_function import subprocess import sys if(sys.version_info > (3,0)): print ("using python3") def raw_input(*prmpt): """in python3, input behaves raw_input in python2""" return input(*prmpt) class pipe(object): def __init__(self,openstr): self.gnuprocess=subprocess.popen(openstr.split(), stdin=subprocess.pipe) def putinpipe(self,mystr): print(mystr, file=self.gnuprocess.stdin) if(__name__=="__main__"): print("this simple program echoes (control-d exit)") p=pipe("cat -") while(true): try: inpt=raw_input() except eoferror: break print('putting in pipe:%s'%inpt) p.putinpipe(inpt) the above code works on python 2.6 fail

linux - Sh, awk: how to convert integers, visible in the shell as a string to 16-bit low-/big- endian binary integers? -

i have bash sequence, grep "integer =" $1 | awk -f= '{printf("%d\n",int($2*327))}' which filters producing smth like: 6768 6572 6638 8403 8436 8436 8305 8502 i need these numbers placed in binary file 16-bit low-endian words (or big-endian if specified). there awk-, bash- way it? ideally, like: grep "integer =" $1 | awk -f='{to16bit_lendian(printf("%d\n",int($2*327)))}' >> out.bin this should work: cat $1 | grep "integer =" | awk -f=' function out(b) { if(b==0) { system("printf \"\\00\""); } else { printf("%c",b); } } function shorttole(n) { n%=65536; msb=n/256; lsb=n%256; out(lsb); out(msb); } { shorttole($2*327) } ' >> out.bin and optimized way removing useless cat , grep: awk -f" =" ' function out(b) { if(b==0) { system("printf \"\\00\""); } else { printf

Get selected item value from listbox -

public void select(int z) { listbox1.selectedindex = z; listbox1.selecteditem = listbox1.items[z]; listboxitem selecteditem=listbox1.itemcontainergenerator.containerfromitem(this.listbox1.selecteditem) listboxitem; selecteditem.focus(); } in method i'm trying select element in listbox, reference variable carrying value null returning selection code. "listbox1.itemcontainergenerator.containerfromitem(this.listbox1.selecteditem) listboxitem;" i have debugged code , keenly observed values coming listbox1 object, still returning null value. listboxitem selecteditem = listbox1.itemcontainergenerator.containerfromitem(this.listbox1.selecteditem) listboxitem; textbox1.text = selecteditem.content.tostring(); or textbox1.context = selecteditem.content.tostring(); good luck :)

tsql - How to formulate index_name in SQL? -

i trying create index on 1 of tables accurate label. here how trying it...expecting "sysname" resolve column or table name. after run command , view in object explorer, listed "[<name of missing index, sysname + '_prod',>]". how u define index_names in better descriptive fashion? (i trying add extension "_prod" index_name, since index of index_name exists). use [amdmetrics] go create nonclustered index [<name of missing index, sysname + '_prod',>] on [smartsolve].[v_cxp_customer_pxp] ([qxp_udf_string_8], [qxp_report_date], [qxp_xrs_description]) include ([qxp_id], [qxp_exception_no], [qxp_base_exception], [qxp_category], [qxp_occurence_date], [qxp_coord_id], [qxp_short_desc], [qxp_root_cause], [qxp_description], [qxp_qei_id], [pxp_lot_number], [cxp_id], [cxp_aware_date], [qxp_xsv_code], [qxp_coord_name], [pxp_product_code], [pxp_product_name], [qxp_oru_name], [qxp_resolution_desc], [qxp_closed_date],