Posts

linux - Concatenate and change extension -

i'm trying concatenate files 1.txt , 2.txt, , several html files. i'm trying save them .php after concatenation after. i've tried follows, doesn't work. step 1: sudo find . -name "*.html" -type f -exec ./code.sh {} \; code.sh cat 1.txt $1 2.txt > mv $1 `echo $1 | sed 's/\.html/.php/'`; any ideas how solve this? your problem you're trying write file called mv along other parameters. i think mean code.sh is: cat 1.txt $1 2.txt > $(echo $1 | sed 's/\.html/.php/')

How to display Django SelectDateWidget on one line using crispy forms -

i trying display 3 select fields rendered out using django selectdatewidget on 1 line. when use crispy forms, on separate rows. there way use layout helper achieve this? thank you! class wineaddform(forms.modelform): hold_until = forms.datefield(widget=selectdatewidget(years=range(1950, datetime.date.today().year+50)), required=false) drink_before = forms.datefield(widget=selectdatewidget(years=range(1950, datetime.date.today().year+50)), required=false) helper = formhelper() helper.form_method = 'post' helper.form_class = 'form-horizontal' helper.label_class = 'col-lg-2' helper.field_class = 'col-lg-8' helper.add_input(submit('submit', 'submit', css_class='btn-wine')) helper.layout = layout( 'name', 'year', 'description', 'country', 'region', 'sub_region', 'appellation', 'wine_type', 'producer', 'varietal...

javascript - node-ffi : Dynamic Linking Error -

i have c++ method (which role killing processes), in library risk.dll. on other hand, developing web-application (using nodejs , angularjs), running on google chrome. when click on button through browser, able call c++ function, through app.js file. i have decided use node-ffi, have error : error: dynamic linking error: "risk.dll": here code on javascript : var ffi = require('ffi') //kill server socket.on('killserver', function(date){ var ctest = ffi.library("risk", { "datemodified":["long", ["string"] ] }); var res = ctest.datemodified(date); console.log(res) }); in c++, have done extern c{ } and want add file risk.dll in same file file server.js run node when want use app. any clue ? try 64-bit compiler found in c:\program files (x86)\microsoft visual studio xx\vc\bin\amd64\cl.exe

Perl wont recognize my if statement -

my code: #!/usr/bin/perl $line = <stdin>; if ($line eq "/n") { print "that blank line!"; } else { print "that line of input was: $line"; } it wont recognize when $line in empty or /n. output "that line of input was:" , nothing, empty. print text if $line something. it's "\n" create newline.

Cannot connect from c# to sql locally but can remotely -

i have c# application want connect sql server , server , application used on same machine , application cannot connect sql if installed application on machine , keeping server in first server connected ! server installed on windows 8. thanks please following - make sure local database server has both windows authentication , sql server authentication mode enabled. but if using windows authentication change connection string - connectionstring="data source=lenovo;initial catalog=app;integrated security=true;" if using sql server authentication mode, seems since providing username connectionstring="data source=lenovo;initial catalog=app;integrated security=false;user id=sa;password=111" also, app reserve keyword in systems. better avoid such name name of db. if using default server instance can use . or (local) instead of lenovo

c# - Using custom JsonConverter to customize list reading -

i'm using json.net , want deserialize json list : [ { "name":"blabla", "price":"50" }, { "name":"blabla", "price":"50" }, ... ] so i've done list<priceitem> list = jsonconvert.deserializeobject<list<priceitem>>(json, new dictionnaryjsonconverter()); but want deserialize items names in line, basicly have function isnamevalid(string name) if return true put item in list , if false rid of it. i computation in second read need have perf on function. i've tried custom jsonconverter don't know how write list readjson function public class customjsonconverter : jsonconverter { public override bool canconvert(type objecttype) { if (objecttype == typeof(priceitem)) { return true; } else if (objecttype == typeof(list<priceitem>)) { return true; } throw new notimplementedex...

database - What is dirty read? And How does it hinder the performance issues? -

i have heard term dirty read many times in beginning career of development. somehow understand want expert's light on it. does diminish performance issues ? or making wrong assumptions. please provide characteristic also. thanks in advance. quite in database processing, come across situation wherein 1 transaction can change value, , second transaction can read value before original change has been committed or rolled back. known dirty read scenario because there possibility first transaction may rollback change, resulting in second transaction having read invalid value. while can command database disallow dirty reads, degrades performance of application due increased locking overhead. disallowing dirty reads leads decreased system concurrency.