Posts

php - How do I turn this commonly used javascript code into a plugin? -

overview i developing wordpress based website allows visitor upload images @ few different places on page. have (after lot of trial , error) got working code but, code differs between each 'upload' area, thought trying make re-usable in form of 'plugin'. my background i self-taught programmer prone lots of mistakes , doing things in illogical ways plus writing thousand lines of code when 1 line have sufficed. history of problem (please skip section see code below) i thought include bit of history don't fall foul of x-y problem . have 4 places on webpage visitors can upload site. 3 of these image uploads should allow visitor 'crop' image. i'm using jquery plugins plupload , jcrop in order provide functionality. initially attempted write code in way page included relevant code in dom @ execution time. in order have multiple plupload instances on same page created 1 "dynamic variable" , called code this... var dynamicpartofvar ...

objective c - drawWithRect crashing with an exception breakpoint on iOS 8 (Does not crash without exception breakpoint) -

happy iphone day everyone! hope managed hands on one. i have strange issue. in code, have uitableview , if user selects email icon in uinavigationbar , 2 things: 1) opens mfmailcomposer 2) creates pdf in background of contents of uitableview , attaches email this has far been working in ios 7. ios 8, if set exception breakpoint in code , run on ios 8 device, crash when click email icon (iphone 5s), pointing code below: [strheader drawwithrect:cgrectmake(65, -670, 1024, 100) options:nsstringdrawinguseslinefragmentorigin attributes:@{nsfontattributename:headerfont} context:nil]; it doesn't let me jump in or out of breakpoint or find out what's going on. if remove exception breakpoint, there's no crash. if run app on device , disconnect device xcode, run again, there's no crash. so ultimately, there's no crash when running app, makes me extremely nervous exception breakpoint, crashes @ code above means isn't right somewhere. there no warni...

javascript - How to to make collapsing table rows (with IE8 support also)? -

i want last 2 rows of table folded , collapse when user click on "click here see more rows". appear last row of first 2 rows, , turn toggle button if user wants fold them back. after understanding there's no way this via css2 only, guess if want ie8 support need use javascript/jquery. i found jquery accordion example , tried implement on table, didn't work. here's fiddle tried wrapping last 2 rows <div class="open" >` didn't work (barely have knowledge in jquery, trying patch website). on ie7 if it's impossible, want rows collapased start. html: <table border="1"> <col style="width:120px;" /> <col style="width:120px;" /> <col style="width:120px;" /> <col style="width:120px;" /> <col style="width:120px;" /> <thead> <tr> <th>1</th> <th>2</th> ...

git - Pushing a commit to a branch of a forked repository -

i getting strange error when updating forked repository. created dev-branch in forked repo(for development work). i have cloned forked repo git clone https://github.com/twbs/bootstrap check current branch git branch *master dev-branch change dev-branch git checkout dev-branch make changes , commited them dev-branch git commit add remote url git remote add parent git@github.com:twbs/bootstrap when git push now, getting error hint: updates rejected because tip of current branch behind hint: remote counterpart so, did git fetch parent git merge parent/master new commit screen opened commit message "merge remote-tracking branch 'bootstrap/master' dev-branch" still same error, when git push now, did git pull new commit screen opened commit message "merge branch 'dev-branch' of https://github.com/username/bootsrap dev-branch now, git push worked. i don't know has happened. di...

Pass variables from javascript to iMacros -

i want run imacro save lots of webpages (threads on forum). worked out in vba, couldn't make run imacro. i have tried javascript. want pass basic parameters (thread number, start page number, number of pages save, file type) imacro , have loop until pages saved. i've come far. <script type="text/javascript"> <!-- var thrno = prompt("enter thread number”); var pgst = prompt("enter page start number”); var pgno = prompt("enter number of pages save”); var thrnm = prompt("enter thread name/identifier files”); var fltp = prompt("enter save file type”); var cntr = 1 { var urln = "http://www.mysite.co.uk/my-forum/showthread.php?t=" & thrno & "&page=" & cntr var flnm = thrnm & ".html" iimset("urln", urln) iimset("fltp", fltp) iimset("flnm", flnm) iimplay("imacrouniversal.iim") cntr = cntr + 1 } while (cntr < pgno); //--> </scri...

javascript - How to get width in percentage using jquery -

i trying value of width in percentage using j-query. don't want set value of in j-query.i had tried width() method , css('width').they both return not return result in percentage. html-code style.css .demo{ width:50%; } jquery code $(document).ready(function(){ var = $('.demo').css('width');//50px var = $('.demo').width();//50 }); thanks in advance help. $(function() { var parentwidth = $(document).width(); // parent element var demowidth = ($(".demo").width()/parentwidth * 100).tofixed() +"%"; }); this give width in %

How to check if last email sent was successfully delivered or not using MIME::Lite perl -

i wanted send emails in perl code. used mime::lite module. i able send emails wanted if removed last_send_successful check, else error mentioned below.i want know if email sent successfully. below code snippet used. sub sendemailwithcsvattachments { $retries = 3; $retry_duration = 500000; # in microseconds $return_status; ( $from, $to, $cc, $subject, $body, @attachments_path_array ); $from = shift; $to = shift; $cc = shift; $subject = shift; $body = shift; @attachments_path_array = shift; $msg = mime::lite->new( => $from, => $to, cc => $cc, subject => $subject, type => 'multipart/mixed' ) or die "error while creating multipart container email: $!\n"; $msg->attach( type => 'text', data => $body ) o...