Posts

sh - Bourne Shell script doing the job but producing extra message -

so, script should take in file extension , possibly multiple files change extensions. works most, when file has space in it, changes , says file not exist. heres have... #!/bin/sh fileextension="$1" shift oldname="$@" extension=${oldname##*.} totalfiles=$# totalfiles=$(( totalfiles+1 )) num=1 while [ $num -lt $totalfiles ] in "$oldname" extension=${i##*.} if test -e "$i" newname="${i%.*}.$fileextension" if [ "$i" = "$newname" ] : else mv "$i" "$newname" fi else echo "$i": no such file fi num=$(( num+1 )) shift done done you cannot iterate string, least not way are. oldname needs array # other stuff oldname=("$@") # other stuff in "${oldname[@]}" # other stuff

Ruby on Rails Tutorial by Michael Hartl Chapter 7.1.3 - Failing Test -

i've spent couple hours trying figure out tiny little piece of puzzle before moving on in tutorial doesn't blow on later. because of that, know issues tests failing these dime dozen, apologize. in "7.1.3 testing user show page (with factories)" section of tutorial (link provided below), cannot signup page tests pass. seems it's trivial, can't find wrong in of seemingly endless files there issue (the controller, routes, test itself, user model, , on). no 1 online seems have had issue either, figure it's got random setting or on rails project. anyway, here believe relevant code: the error running user_pages_spec test in sublime: failures: 1) user pages signup page failure/error: { should have_content('sign up') } expected #has_content?("sign up") return true, got false # ./spec/requests/user_pages_spec.rb:18:in `block (3 levels) in <top (required)>' 2) user pages signup page failure/error...

.htaccess - creating nice looking URLs -

i trying make friendly looking urls ugly urls. mod directory contains index.php , user.php file. index.php has links, of various formats, user page. path mod directory : http://localhost/mod/ at time user's urls this.. http://localhost/mod/user.php?id=ricky etc.. i need make ugly 1 nice looking 1 this.. http://localhost/mod/user/ricky i tried in htaccess file, , code far in file. # enable rewriting rewriteengine on # rewrite user urls # input: user/name/ # output: user.php?id=name rewriterule ^user/([a-z]+)/?$ user.php?id=$1 this not working me. hope me. thank you. rewriterule ^user/([a-za-z]+)/?$ user.php?id=$1 [nc,l] state end of line , case insensitive [nc,l] you can use \w match text chars (non digit) rewriterule ^user/(\w+)/?$ user.php?id=$1 [nc,l] here's cheat sheet regex: http://www.regular-expressions.info/reference.html

Debugging Groovy scripts running in a ScriptEngine from IDEA -

in app, load script file classpath string, pass scriptengine. howerver, breakpoint set in script file doesn't trigger. how can make work? use intellij idea. scriptengine engine = ...; string script = fileutils.readfiletostring(file); bindings bindings = engine.createbindings(); object result = engine.eval(script, bindings); since scriptengine.eval() method takes script string or generic reader , don't think possible achieve this. groovyscriptengineimpl class generate script name , compile class @ runtime, make hard (impossible?) debugger know breakpoint(s) associated running script. it might not solution you, if instead invoke script using groovyshell , pretty works out of box. example: file file = new file(scriptdir, "scripttorun.groovy"); binding binding = new binding(); object result = new groovyshell(binding).evaluate(file); just remember set correct package in script if not located @ root.

css - laying out html elements without using inline styles -

Image
i'm coming ios background , having trouble laying out elements in html , using css. want create "simple" this: i want able split screen in separate divs have fieldsets align each other. (they fieldsets didn't draw them in primitive mockup. didn't put in third box there's more stuff in there). but here of questions: box 1 questions: have style="display:block;" in elements. if have overarching div style=display:block , don't same effect. there better way that? box 2 general question: ended hardcoding styles sort of achieve image shown. doesn't seem usable or scalable. general principals should start with? <div style="display:inline-block; vertical-align:top; float:left; width:25%"> <fieldset> <legend>first fieldset</legend> <div style="display:block;">field 1 <input type="text" style="display:block;" /> ...

php - guestbook returning database data to flash -

i've been struggling problem long , unable make work, hope can me it. first, know php files correct , mysql database works fine. in flash, able submit comment database comments not display. did many tests such making returned_database flash separately , worked fine - can see old comments. long combine submitting 1 , returning 1 together, flash doesn't show comments more. put lower version flash effects on frame thinking doesn't collaborate returning flash, submitting flash works fine. since pretty complex problem hard me copy actionscript code because on different frames in flash. if has ideas fixing maybe can send file you?

java - Entering multiple values into a url post -

working on taking input users edittext , formatting go url $_get can save mysql database. of right app store first value in each edittext fields. if give me pointer doing wrong sweet! public class newidea extends activity{ /** called when activity first created. */ private list<edittext> edittextlist = new arraylist<edittext>(); private button button; private edittext idea, des; private object mpassword; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_add_screen); button = (button) findviewbyid(r.id.btncreateidea); idea = (edittext) findviewbyid(r.id.inid); des = (edittext) findviewbyid(r.id.indis); button.setonclicklistener(new onclicklistener() { @override public void onclick(view v) { //stringbuilder params = new stringbuilder(); //for (int = 0; < des.length(); ...