Posts

linux - How do I use sed to change my configuration files, with flexible keys and values? -

i want search configuration file expression: "central.database". want change setting associated "central.database" "sqltest". the layout of config file initially: central.database = sqlfirsttest this want after sed replacement: central.database = sqltest i doing in bash script, suggestions, recommendations or alternative solutions welcome! (actually both central.database , sqltest come bash variables here.) my current code (third attempt): sshretvalue=$(ssh -p "35903" -i $home/sshids/idrsa-1.old ${1} <<eof sed -i "s/^\($central_db_name\s*=\s*\).*\$/\1$central_db_value/" /home/testing.txt; echo $? eof ) error message: pseudo-terminal not allocated because stdin not terminal. sed: -e expression #1, char 58: unknown option `s' -bash: line 3: eof: command not found here's example expression: sed -i 's/^\(central\.database\s*=\s*\).*$/\1sqltest/' file.cfg if want ...

python - Using git to manage virtualenv state: will this cause problems? -

i have git , virtualenv set in way suits needs and, far, hasn't caused problems. i'm aware setup non-standard , i'm wondering if more familiar virtualenv's internals can point out if, , where, it's go wrong. my setup my virtualenv inside git repository, git set ignore bin , include directories , in lib except site-packages directory. more precisely, .gitignore file looks this: *.pyc # ignore virtualenv stuff except actual packages # /bin /include /lib/python*/* !/lib/python*/site-packages # ignore easyinstall , setuptools /lib/python*/site-packages/easy-install.pth /lib/python*/site-packages/setuptools.pth /lib/python*/site-packages/setuptools-* /lib/python*/site-packages/pip-* with arrangement -- , else working on checkout of project -- can use virtualenv , pip normal following advantages: if updates or installs package , pushes changes, else pulls changes automatically gets update: don't need notice requirements.txt file has changed o...

iOS UIScrollView with UIImageView rotation aspect problem -

i apologize in advance lack of ios sdk knowledge, android developer has been tasked maintaining , updating iphone application. i using uiscrollview handle zooming , dragging of image being displayed on uiimageview. the image in uiimageview requested web server multiple times second. when orientation of device changes image dimensions change of current frame, example when using ipad in portrait mode image dimensions 768x1024 when switching landscape mode dimensions of image 1024x768. webserver work of adding black bars top/bottom or left/right of image depending on orientation , aspect ratio of image requesting. my problem after rotating device uiimageview never behaves way expect to. expected behavior uiscrollview continue perform scrolling actions reset base view of new frame dimensions after rotation. if don't specify contentmode uiscrollview image appears squished though scrollview trying display image in previous orientations dimensions. if specify contentmode ...

android - Black background while ScrollView loads -

i have scrollview in activity contains webview , looks scrollview takes little bit load showing black background until has loaded. if try , put layout behind scrollview white background fade indicates can scroll turns white too. i've tired putting background colour on layouts both within , outside scroll view; 1 affects scrolling fade , other doesn't load leaving black space, same setting colour on scroll view itself. if takes time scrollview load, means have processing can done in background. may want move processing background thread (using asynctask) , update gui in onpostexecute .

Eclipse rcp - how to load jdbc driver? -

i wondering if give me instructions on how following: how add mysql connection jar file eclipse plugin build path how add connector jar file library , adding plugin's runtime classpath i getting com.mysql.jdbc.driver exception when trying load driver class using class.forname("com.mysql.jdbc.driver") . have added jdbc driver project right clicking on project name , selecting add library button. found out there eclipse rcp project there different way of adding jdbc jar file. i've never used mysql eclipse, i've done postgres sql. maybe you: right-click project in package explorer build path add external archives... select mysql jar archive press ok the library should referenced in "referenced librairies" under package explorer. try run program again.

css - Image sprite in inline style? -

i able use image sprites (@sprite) explicitly defining clientbundle sibling cssresource , imageresource accessors. i'm wondering whether using sprite means must have separate .css file. if define styles inline <ui:style> , how known name image accessor use gwt-image: ? answered own question: <ui:style> @sprite .panel { gwt-image: "titlebackground"; } </ui:style> <ui:image field='titlebackground' src="constants/title-bg.jpg" /> the field names of image resources in same template serve names of image accessor functions in generated client bundle.

ios - Apple Push Notification listening port on iPhone -

i trying determine when ios receives push notification , want listen on port. app being worked on "always on" in background (lbs app), therefore nice use apn service send requests app when in background without requiring user click view. does know incoming port push service on iphone? push notification tcp 5223. see: important apple ports apple push notification support