Posts

bash - Finding multiple files recursively and renaming in linux -

i having files a_dbg.txt, b_dbg.txt ... in suse 10 system. want write bash shell script should rename these files removing "_dbg" them. google suggested me use rename command. executed command rename _dbg.txt .txt *dbg* on current_folder my actual current_folder contains below files. current_folder/a_dbg.txt current_folder/b_dbg.txt current_folder/xx/c_dbg.txt current_folder/yy/d_dbg.txt after executing rename command, current_folder/a.txt current_folder/b.txt current_folder/xx/c_dbg.txt current_folder/yy/d_dbg.txt its not doing recursively, how make command rename files in subdirectories. xx , yy having many subdirectories name unpredictable. , current_folder having other files also. you can use find find matching files recursively: $ find . -iname "*dbg*" -exec rename _dbg.txt .txt '{}' \; edit: '{}' , \; are? the -exec argument makes find execute rename every matching file found. '{}' replac...

apache - BIRT behind a proxy on a Tomcat Server: Sessoin expired -

i'm trieing run eclipse birt on tomcat6 server behind proxy. scenario this: request @ pc url www.webseite.de/client/birt-viewer/.... pc redirects url another, special 1 client. on sever apache proxypass rules redirects request birt this: proxypass /client/birt-viewer http://localhost:8008/client/birt-viewer proxypassreverse /client/birt-viewer http://localhost:8008/client/birt-viewer the next thing changes in in server.xml part of following <host name="localhost/client" appbase="webapps" unpackwars="true" autodeploy="true" xmlvalidation="false" xmlnamespaceaware="false"> now possible birt-viewer expample, everytime determines following error message: "the viewing session not available or has expired." what have change, birt run corretly? okay got it. problem cookie. added following line in http.conf proxypassreversecookiepath /birt-viewer /client/birt-view...

ruby on rails - Strong_parameters not working -

with ruby 1.9.3, rails 3.2.13, strong_parameters 0.2.1: i have followed every indication in tutorials , railscasts, can not strong_parameters working. should simple, can not see error. config/initializers/strong_parameters.rb: activerecord::base.send(:include, activemodel::forbiddenattributesprotection) config/application.rb config.active_record.whitelist_attributes = false app/models/product.rb class product < activerecord::base end app/controllers/products_controller.rb: class expedientescontroller < applicationcontroller ... def create @product = product.new(params[:product]) if @product.save redirect_to @product else render :new end end end this raises forbidden attributes exception, expected. when move to: ... def create @product = product.new(product_params) # , same flow before end private def product_params params.require(:product).permit(:name) end then, if go form , enter "name: pr...

Why does GCC not complain about _Bool in c89 mode? -

why following command produce no warnings or errors, though _bool not part of c89? $ echo "_bool x;" | gcc -x c -c -std=c89 -pedantic -wall -wextra - for comparison, changing _bool bool results in error: $ echo "bool x;" | gcc -x c -c -std=c89 -pedantic -wall -wextra - <stdin>:1:6: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘x’ this happens on cygwin [gcc (gcc) 4.5.3] , linux [gcc (gcc) 4.1.2 20080704 (red hat 4.1.2-54)]. using _bool in c89 compiler invokes undefined behavior because use identifier starting underscore , upper case letter. don't have paper copy of c89 handy, expect same c99 7.1.3: — identifiers begin underscore , either uppercase letter or underscore reserved use. one permissible undefined behavior accepting _bool without diagnostic. gnu extension. of course, bool doesn't fall implementation namespace, must diagnosed unless declared.

Node.JS Spawn inside an SELinux Sandbox -

i building node.js application involves redirecting user input server-side command. of course, catastrophic security, desire run child command inside selinux sandbox . (i not want run entire application inside of sandbox because want end users each have own workspace on server.) for example, consider command cowsay . in order run sandboxed cowsay, need sandbox cowsay . other behind-the-scenes security differences, interface of sandbox cowsay should same of plain cowsay . however, node.js responds differently these 2 approaches. consider code: var spawn = require('child_process').spawn; var cmd = spawn("cowsay", ["hello"]); // line (no sandbox) var cmd = spawn("sandbox", ["cowsay", "hello"]); // line b (with sandbox) cmd.stdout.on("data", function(data){ console.log("stdout: "+data); }); cmd.stderr.on("data", function(data){ console.log("stderr: ...

Mysql delete constraint -

i have table below structure : create table `lm_help` ( `id` int(10) not null auto_increment, `section` int(10) not null, `language` int(10) not null, `title` varchar(255) not null, `text` text not null, `timestamp` timestamp not null default current_timestamp, primary key (`id`), unique key `unique_help` (`section`,`language`), key `language_constraint` (`language`), constraint `language_constraint` foreign key (`language`) references `lm_languages` (`id`), constraint `section_constraint` foreign key (`section`) references `lm_help_sections` (`id`) ) engine=innodb auto_increment=4 default charset=latin1 i need remove "unique_help" key, getting foreign key constraint error. due error not able remove among these, section_constraint, language_constraint, unique_help. below other tables refer : create table `lm_languages` ( `id` int(11) not null auto_increment, `name` varchar(255) not null, `code` varchar(255) not null, `status` int(11) def...

android - Why findViewById() throws Null Exception? -

why findviewbyid throws null exception?here layout , sourcecode file: <relativelayout ... tools:context=".mainactivity" > <textview android:id="@+id/usernametext" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </relativelayout> and here source code in mainactivity: @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); try{ textview text=(textview)mainactivity.this.findviewbyid(r.id.usernametext); text.settext(10); }catch(exception e){ log.i("log", e.getmessage()+"error!"); // logcat message } } however, findviewbyid() returns null, , don't know why. code simple. text.settext(10); in way looking string id = 10; should change in text.settext(string.valueof(10));