Posts

Recursively Delete Matching Files via PHP -

i reworked naming convention of images on our website. when uploaded images altered names, ended getting images duplicated, 1 copy old naming convention , 1 new naming convention. images numbered in thousands , didn't want manually delete them all. so decided needed figure out php script capable of deleting old images site. luckily old images consistently named either ending of f.jpg or s.jpg. had find files endings , delete them. thought straightforward thing, whatever reason several different solutions found listed online didn't work right. ended going old code had posted on stackoverflow different purpose , reworked this. i'm posting code answer problem in case might useful else. below solution finding files matching naming convention in selected folder , sub-folders , deleting them. make work situation. you'll want place above directory want delete, , you'll specify specific folder replacing part have ./media/catalog/ . you'll want replace cr...

c# - Moq Callback is fine in first test, but same code returns null in second test -

would know why, when using moq in 2 tests have following code: var magentochannelmock = new mock<imagentochannel>(); var magentochannelmock = new mock<imagentochannel>(); magentochannelmock.setup(x => x.salesorderinvoicecreate(it.isany<string>(), "2", it.isany<orderitemidqty[]>(), it.isany<string>(), it.isany<string>(), it.isany<string>())) .callback<string, string, orderitemidqty[], string, string, string>((s1, s2, x, s3, s4, s5) => invoicessent = x); i have 2 tests in test class, when run each individually, run fine , callback object "invoicessent" contains expected value. when run both tests @ same time, second test run gets null returned callback. any idea? [test] public void invoice_3line_qtythatisinvoicedshouldbe12() { //arrange orderitemidqty[] invoicessent = null; var magentochannelmock = new mock<imagentochannel>(); magentochannelmock.setup(x => x...

database - Parse error: syntax error, unexpected '$sql' (T_VARIABLE) in -

parse error: syntax error, unexpected '$sql' (t_variable) in /home/orientsolutionsc/public_html/cdmdb/dbcon.php on line 19 here codes //insert data `mysql` $sql="insert users(jimbo, kata, mtaa ,uongozi ) values('$jimbo', '$kata', '$mtaa' '$uongozi')"; $result=mysql_query($sql); $sql="insert users(jimbo, kata, mtaa ,uongozi ) values('".$jimbo."', '".$kata."', '".$mtaa."', '".$uongozi."')" or if want insert '$jimbo' etc.. string then $sql="insert users(jimbo, kata, mtaa ,uongozi ) values('$jimbo', '$kata', '$mtaa', '$uongozi')";

Read multiple data types from txt file into arrayList - Java -

for program i'm supposed read txt file containing information on automobile's make , model , mpg , , trunk space in order. example is: hyundai genesis 24.6 100 , repeated several different cars. had construct " automobile " superclass instance variables of make , model. " gasengineauto " subclass instance variable mpg extends " automobile ". subclass called " sedan " extends " gasengine auto " , has instance variable trunk space. assignment had these classes signed off on make sure made correctly. write method read information file gas_sedans.txt , store in list created in previous step. list should parameter method. within method, open file, read information each sedan appropriately-typed variables, call parameterized constructor (the 1 takes arguments attributes) create object, add object list. call method main. below code far. wanted try make sure read arraylist before used method it. impor...

delete bundle file in iOS app -

here problem: trying check contents of app's bundle. writing couple of lines of code like: nsbundle *mybundle = [nsbundle mainbundle]; nslog(@"%@",mybundle); i got path need locate app's bundle. however, when deleted bundle, expecting app give error saying bundle doesn't exist. instead, showed same path again. hy doesn't have impact on program. how work under hoods? new ios, appreciated. thanks in advance!!!

ios - How can I "remove" the embed segue in my container view, or remove the container view completely? -

i have splashviewcontroller containerview , created in storyboard. in story board, automatically drag embed segue containerview profileviewcontroller . inside splashviewcontroller , want programatically "destroy" containerview + profileviewcontroller (both of them). i've tried this: self.containerview.hidden = true //obviously doesn't work. it's visual self.containerview.removefromsuperview() //nope. it's visual. how can remove both containerview and profileviewcontroller completely, making sure both deinit appropriately? if that's not possible, can @ least deinit profileviewcontroller? (i'll set containerview hidden). note: play movie video automatically (looping) in profileviewcontroller. has sound, , when set containerview nil , remove superview, sound keeps playing. i wrote quick example project here demonstrating solution here . autoplaying video (with dog barking) automatically plays in bottom of screen. pressing ...

makefile - Treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated -

this similar warning: treating 'c-header' input 'c++-header' when in c++ mode, behavior deprecated . however, op trying compile header files. in case, i'm trying generate dependencies: $ git diff diff --git a/gnumakefile b/gnumakefile index 791ef05..ce48a59 100644 --- a/gnumakefile +++ b/gnumakefile @@ -175,6 +176,11 @@ libimportobjs = $(libobjs:.o=.import.o) testimportobjs = $(testobjs:.o=.import.o) dlltestobjs = dlltest.dllonly.o +-include gnumakefile.deps + +gnumakefile.deps: + $(cxx) $(cxxflags) -mm *.h *.cpp > gnumakefile.deps + how use cxx build dependencies while avoiding clang warning? the -mm option of c++ compiler give list of dependencies input file. assuming compile .cpp files (and don't $(cxx) -c xyz.h or such) , dependencies needed .cpp files. changing to: $(cxx) $(cxxflags) -mm *.cpp > gnumakefile.deps should give dependencies need in gnumakefile.deps.