Posts

Showing posts from May, 2015

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

python - How do I make a projectile in pygame that will move upward? -

i wrote game meant shoot blue square screen when spacebar pressed. however, blue square right above shooter. here code: import pygame, sys, random gameobjects import * def main(): pygame.init() screen = pygame.display.set_mode((800, 800)) numberofcolumns = 5 columnwidth = screen.get_width() / numberofcolumns numberofrows = 5 rowwidth = screen.get_width() / numberofrows magazineimage = pygame.image.load("images/magazine.bmp") magazineissueoneimage = pygame.image.load("images/magazine #1.bmp") monsterstate1 = pygame.image.load("images/zombie pos 1.bmp") monsterstate2 = pygame.image.load("images/zombie pos 2.bmp") monsterstate3 = pygame.image.load("images/zombie pos 3.bmp") monsters = [] forrystate1 = pygame.image.load("images/forry pos 1.bmp") forrystate2 = pygame.image.load("images/forry pos 2.bmp") forrydelaytime = 8 gameobjects = []

python - Is it possible to declare relationship after class is created by automap in SqlAlchemy -

i'm new sqlalchemy. have followed tutorial create automap of existing db relationship mysql db from sqlalchemy import create_engine, metadata, column, table, foreignkey sqlalchemy.ext.automap import automap_base, generate_relationship sqlalchemy.orm import relationship, backref config import constr, mytables def _gen_relationship(base, direction, return_fn, attrname, local_cls, refferred_cls, **kw): return generate_relationship(base, direction, return_fn, attrname, local_cls, refferred_cls, **kw) engine = create_engine(constr) metadata = metadata() metadata.reflect(engine, only=mytables) base = automap_base(metadata=metadata) base.prepare(engine, reflect=true, generate_relationship=_gen_relationship) tableclass1 = base.classes.table1 tableclass2 = base.classes.table2 table2.id maps 1 of table1 's columns. when trying use query , join table1 , table2 , reports error saying "can't find foreign key relationships". since know relation

swift - How to create a UIButton and set frame using CGRect? -

hello ask question, if in object c create button given position (eg)    # define kwidthbutton 120 # define kheightbutton 80 - (uibutton*)createbuttonwithindex:(int)index{ int row = index / 2; int column = index %2; uibutton * newbutton = [uibutton buttonwithtype: uibuttontyperoundedrect]; newbutton.frame = cgrectmake (* kwidthbutton column, row * kheightbutton, kwidthbutton, kheightbutton); } how can make swift ? i found create button can way value index in swift let button = uibutton.buttonwithtype(uibuttontype.system) uibutton button.frame = cgrectmake(100, 100, 100, 50)

Switching background image then resizing image to 'new height' with jQuery -

i have following: html: <div id="section-one" class="section"> <img id="section-one-img" style="width: 100%;" src="http://176.67.174.179/ukcctvinstallations.co.uk/wp-content/uploads/2014/09/section-one-pointers.jpg" /> <div id="section-one-headline"> <h1 class="main-headline"><span class="site-colour border-box">your local cctv company</span> <br /><p class="headline-desc">with on 80 installation teams nationwide</span></h1> </div> </div> jquery: jquery(document).ready(function() { if (jquery(window).width() < 880) { jquery('#section-one-img').attr("src", 'http://176.67.174.179/ukcctvinstallations.co.uk/wp-content/uploads/2014/09/section-one-880px.jpg'); } var imgheight = jquery('#section-one-img').height(); jquery('#section-one-img').

java - How to add button to row of JTable? -

i have swing based application containing jtable . allow each row updated or deleted, using unique row id. want add update , delete button each row, have capability support actionlistener. however, have no idea how using netbeans. check out table button column 1 approach. code supports custom renderer , editor need column display text button.

ios - DB Scheme tables -

i db newbie, , working on apps db scheme, , came wall in representing 1 of tables. working parse db starter db until app rolling. in parse db have tv show entity, episode entity (one many relationship) , user entity. have entered few tv-shows parse db. want able follow episodes user has viewed. until have created array of episodes user have viewed , when want them fetch them, seems bit tedious , inefficient. my q is, there way else represent relationship between viewed episodes user. thanks :) you create new table called watchedepisodes . table contain 2 pointers. first pointer userpointer , second episodepointer . can run following code episodes currentuser has watched. swift var query = pfquery(classname: "watchedepisodes") query.wherekey("userpointer", equalto: pfuser.currentuser()) query.find({ //handle success , error });

c# - How to debug XML deserialization? -

i wondering if had tips on how can debug below xml deserialization? cannot work. deserializer creates summon , slash instances, properties empty. relevant classes shown below. skillcollection class deserializer: [datacontract(name = "skills", namespace = "")] public class skillcollection { [datamember(name = "slash")] public skill slash { get; set; } [datamember(name = "summon")] public skill summon { get; set; } public static object deser(string path, type totype) { var s = new datacontractserializer(totype); using (filestream fs = file.open(path, filemode.open)) { object s2 = s.readobject(fs); if (s2 == null) console.writeline(@" deserialized object null"); else console.writeline(@" deserialized type: {0}", s2.gettype()); return s2; } } it called class through property skills: skills = (skillcollection)skillcollection.deser(

SCHEME remove atomic value from a list -

i need function send value, , check in list if there equal value remove it. here examples: (elimina 1 '(a b c)) => (a b c) (elimina 'b '(a (b) c)) => (a () c) (elimina 1 '(0 (1 (2) 1) 0)) => (0 ((2)) 0) i tried this: (define (elimina v1 lista) (cond ((null? lista)'()) ((list? (first lista)) (list (elimina v1 (first lista)))) (else (if(equal? v1 (first lista)) (elimina v1 (cdr lista)) (append (cons (first lista) (elimina v1 (cdr lista)))))) ) ) and results this: (elimina 1 '(a b c)) => (a b c) (elimina 'b '(a (b) c)) => (a ()) (elimina 1 '(0 (1 (2) 1) 0) => (0 ((2))) for reason last value on list isn't showing. hope can help. thanks! 1) problem here: ((list? (first lista)) (list (elimina v1 (first lista)))) when recurse sublist, don't process rest of list anymore. 2) also, (append (con

php - Inner Join select only two records from mysql -

i have subject , departments table, each subject associated departments table. trying select subjects including departments name. code bellow work perfect show 2 records. appreciated //select statement $selects=$connection->query("select subjects.id , subjects.name , subjects.related_to , subjects.related_to_sem , departments.dept subjects inner join departments on subjects.related_to = departments.dep_id"); <table class="table table-striped table-bordered bootstrap-datatable datatable"> <thead> <tr> <th>sub id</th> <th>subject name</th> <th>related department</th> <th>related semester</th> <th>actions</th> </tr> </thead> <tbody> <?php while($result=$select->fetch_assoc()) { ?> <tr> <td><?php echo $result['id']; ?></td> <td class="center"><?php echo $result['name']; ?></td> &l

java - ICS (iCalendar) UID purpose and use -

i'm creating sync adapter towards ics files in java, , have problem recognizing same events across new updates towards remote file dynamically created. so thought, great can use uid, turns out it's randomly generated every time ics file downloaded. point of uid property if it's randomly generated everytime? why not assume every ics event exists in universe unique? ics file generators fault not using same uid it's same events (i have seen 2 ics file providers this, 2 schools)? so what's standard way of recognizing same event across ics file updates, instead of wiping whole calendar , re-importing? rfc5545 section on uid ( link ) aligned expectations , unfortunately not implementation on server connecting to: property name: uid purpose: property defines persistent, globally unique identifier calendar component. unfortunately there nothing can done against bad server side implementations...

c# - Create Categories in Wordpress PHP to .NET -

i need creation wordpress categories in (.net) php converted because can programm in c# <?php include ("ixr_library.php"); $log = ''; $pwd = ''; $xmlrpc = 'http://www..com/xmlrpc.php'; $client = new ixr_client($xmlrpc); $res = $client->query('wp.newcategory', '', $log, $pwd, array( 'name' => '@mycat000egory', 'slug' => 'my-category-slug', 'parent_id' => 0, 'description' => 'test category xml-rpc' ) ); ?>

php - Form sending all HTML from nav bar -

i'm having bit of issue in when im working script allows conversion of html csv files. the actual table data sent , parsed absolutely fine, 1 of issues im finding html form sits inside trigger this, ends sending entire document html, , in excel file given html markup in navigation bar. <form class = "element brand place-right" action="client-summary.php" method="post"> <input type="hidden" name="data" value = " <?php echo htmlspecialchars(strip_tags($table, '<table><th><tr><td>')); ?>"> <!--<input value="download xls" type="submit" class="bg-dark xls-download">--> <button type ="submit" class="button fg-white xls-download"> <i class="icon-download-2 on-left bg-dark"></i>download report </button> </form> this sits

serialization - c# JavaScriptSerializer deserialize variable type field -

i trying deserialize json strings fields can different. these of strings have deserialize: {"field1":{"array":[1,2,3]},"field2":{"array":["a","b","c"]}} {"field1":"", "field2":""} {"field1":"","field2":{"array":["a","b","c"]}} {"field1":{"array":[1,2,3]},"field2":""} the first string deserialized, remainder throws exception. is possible parse 4 strings same code? the reason why others throwing exception because deserialization target data type expecting object inside field1 , field2, in last three, have empty strings. try replacing empty strings null .

android - adding files to my project -

i want add folder containing rules manipulations performed during run time. file names not fulfill name conventions (for example dd-pp-f4.cib ), cannot put them inside raw resource folder. there 1000 files , many internal dependencies within can't change file names. how can add folder files project , load them during runtime? you can put them in assets folder. have here: http://developer.android.com/reference/android/content/res/assetmanager.html

Word VBA: Modifying words by looping ActiveDocument.Words creates an infinte loop -

i want loop through word document word word. i'm using activedocument.words collection seems pretty simple. but, there strange issue if change content of 1 word, internal pointer doesn't move next word instead point's once more same word modified. , in cases creates situation routine stuck in looping on single word infinitely. an example code: sub loopwords() dim wd range = 0 each wd in activedocument.words if wd.text = "foo " wd.text = wd.text & "bar " end if 'prevent infinite loop: = + 1 if > 99 exit end if next wd end sub so example using macro in doc containing phrase "there foo in here." results in "there foo bar bar bar bar bar bar bar bar bar bar bar bar bar bar ..." , on. so why on earth behave this? how can loop word word , modify text when necessary? your macro replacing "foo" "foo bar"

apache - Searching in Different Drupal websites -

i have 4 drupal websites different in database , files. need use drupal search website content related in others. also, in article content type need related articles through website. is apache solar best solution that? , what's limitation task? thanks you need read http://www.phase2technology.com/blog/exposing-external-content-to-drupals-search/ do go through comments well. it better treat 4 sites different/external in case db's different.

python - How do I format axis number format to thousands with a comma in matplotlib? -

Image
how can change format of numbers in x-axis 10,000 instead of 10000 ? ideally, this: x = format((10000.21, 22000.32, 10120.54), "#,###") here code: import matplotlib.pyplot plt # create figure instance fig1 = plt.figure(1) fig1.set_figheight(15) fig1.set_figwidth(20) ax = fig1.add_subplot(2,1,1) x = 10000.21, 22000.32, 10120.54 y = 1, 4, 15 ax.plot(x, y) ax2 = fig1.add_subplot(2,1,2) x2 = 10434, 24444, 31234 y2 = 1, 4, 9 ax2.plot(x2, y2) fig1.show() use , format specifier : >>> format(10000.21, ',') '10,000.21' alternatively can use str.format instead of format : >>> '{:,}'.format(10000.21) '10,000.21' with matplotlib.ticker.funcformatter : ... ax.get_xaxis().set_major_formatter( matplotlib.ticker.funcformatter(lambda x, p: format(int(x), ','))) ax2.get_xaxis().set_major_formatter( matplotlib.ticker.funcformatter(lambda x, p: format(int(x), ','))) fig1.show()

javascript - facebook friend invites - who sent invitation -

i have app each user can invite friends join app. i have done via js fb sdk. i use php sdk server sessions , other things. now questions how can determine id of inviter when user joins app based on invitation sent? eg: let's user-x invites user-z join app. user-y invites user-z join app too. user-z joins through link of user-x. want reward user-x because brought new user app, need fbid or something. how can determine referer? i have used code implement facebook friends invite on website: <script src="https://connect.facebook.net/en_us/all.js"></script> <script type="text/javascript"> fb.init({ appid:'<?=appid?>', cookie:true, status:true, xfbml:true }); function fbinvite(){ fb.ui({ method: 'apprequests', message: 'invite facebook friends' },function(response) { if (response) { alert('successfully invited'); } else { alert('failed invite'); } }

intuit partner platform - Account Aggregators/API's - which provide credit card bill due-dates and allow for cross-party payments? -

i understand there number of account aggregators out there allow businesses access customers's transaction data (plaid, yodlee, intuit customer account api, open others...). i'd know ones or don't allow for: determining due-date of customer's credit card balance. making payments across accounts , parties. response yodlee 1) determining due-date of customer's credit card balance yes , yodlee provide credit card bill due-date though api. 2) making payments across accounts , parties. yodlee have bill-pay product it's not available api customers of today.

inno setup - How do I save the selected option in the combobox -

i need . have in script ability record , save write in box . how save selected option in combobox? line of code : editindex1 : inputpage.add = ( ' name ' , false ) ; inputpage.values ​​[ editindex1 ] : = getpreviousdata ( ' name' , '') ; and : setpreviousdata ( previousdatakey , ' name ' , inputpage.values ​​[ 0 ] ) ; thank .

html - Function Return Behavior in Javascript -

i have <a href='...'>link</a> want invoke custom warning if click , either select "ok" or "cancel" button underlying in html taking appropriate action. default action if "ok" or nothing if "cancel." the code in html code is: <div id="dialogoverlay"></div> <div id="dialogbox"> <div> <div id="dialogboxhead"></div> <div id="dialogboxbody"></div> <div id="dialogboxfoot"></div> </div> </div> <a href='sumcodehere' return onclick=\"javascript: return warn.render(\'this operation cannot reversed.\')\"><img></a> the javascript code follows: <script> function warn() { this.render = function(dialog) { var winw = window.innerwidth; var winh = window.innerheight; var dialogoverlay = document.getelementbyid('dialogoverla

javascript - modify Xaxis in highcharts -

how can introduce in highcharts code array comes php code? in next code php generate 4 arrays, 3 data (tmax ($rows), tmin ($rows1) , rain ($rows2) , last 1 days of consulting ($dia). $sth = mysqli_query($con,"select city,tmax, day(date) dia meteo2 city= '" . $_session["city"] ."' , data between '" . split($_session["date8"]) ."' , '" . split($_session["date9"]) ."'order date"); $rows = array(); $dia = array(); $dia['name'] = 'dia'; $rows['name'] = 'tmax'; $rows['color'] = '#ff0000'; $cont=1; while($r = mysqli_fetch_array($sth)) { $rows['data'][] = $r['tmax']; $dia['categories'][] = $r['dia']; } $sth = mysqli_query($con,"select city,tmin meteo2 city= '" . $_session["city"] ."' , data between '" . split($_session["date8"]) ."' , '" . sp

regex - django url regular expressions capture invalid url -

i want understand how create urls / regular expressions capture , redirect views patterns not match defined pattern. i have pattern in url project looking waitlist. not match want direct project view, assuming caught second url below url(r'^waitlist/', include('waitlist.urls')), url(r'^.*$', views.my_default_2), if user include url waitlist, should pass app url match , if no match pass through wild card, second line. url(r'^$', views.index, name='index') url(r'^.*$', views.my_default), is correct way capture invalid/ incorrect url input through project , app? for project can override 404 view https://docs.djangoproject.com/en/dev/topics/http/views/#customizing-error-views

mysql - How to select data given several rows match? -

i have configuration table , users table. users: | id | name | |----|----------| | 0 | bob | | 1 | ted | | 2 | sam | config: | user_id | name | value | |---------|----------|-------| | 0 | | 11 | | 0 | b | 2 | | 0 | c | 54 | | 1 | | 5 | | 1 | b | 3 | | 1 | c | 0 | | 2 | | 1 | | 2 | b | 74 | | 2 | c | 54 | i normalized configuration way since config of unknown amount, have query users based on config, couldn't stored in serialized form. my issue how find users based on multiple rows? instance: select users > 4 , b < 5 this should return bob , ted. try this: select us.name users exists (select name config name='a' , value>4 , user_id=us.id) , exists (select name config name='b' , value<5 , user_id=us.id) alternatively, can use 2 joins: select us.name

ruby on rails - Error with sudo gem install sqlite3 and gem install sqlite3 -

error 'gem install sqlite3' 'error: while executing gem ... (gem::filepermissionerror) don't have write permissions /library/ruby/gems/2.0.0 directory.' and error while 'sudo gem install sqlite3' "1 warning generated. compiling exception.c compiling sqlite3.c compiling statement.c linking shared-object sqlite3/sqlite3_native.bundle clang: error: unknown argument: '-multiply_definedsuppress' [-wunused-command-line-argument-hard-error-in-future] clang: note: hard error (cannot downgraded warning) in future make: * [sqlite3_native.bundle] error 1 make failed, exit code 2 gem files remain installed in /library/ruby/gems/2.0.0/gems/sqlite3-1.3.9 inspection. results logged /library/ruby/gems/2.0.0/extensions/universal-darwin-13/2.0.0/sqlite3-1.3.9/gem_make.out" i have installed rvm , used 'sudo' gem install sqlite3 , gem install sqlite3 . missing? thx! you should not use sudo rvm. however, may rvm default

Unable to find Mysql Database in DataBase Explorer of VIsual Studio Express 2012 -

i using visual studio express 2012 , mysql server 5.0.i want add mysql database provider in database explorer. i installed mysql visualstudio 1.2.3" , **mysql connector/net 6.93 ..but same result previous.. i cant post images here due repution points in stackoverflow account..i have provided image link. http://i.imgur.com/tnhzfay.png http://i.imgur.com/5lqkd5n.png?1 please me... if have installed mysql connector. add reference of mysql.dll installed location of mysql connector . start using functions. step 1: navigate solution explorer -> , right click on reference -> add reference. http://uploadffs.nl/images/2014/09/23/kqk4p.jpg step 2: now click browse -> locate have installed mysql connector plugin. -> common pathway ... /directory/mysqlconnector/assemblies/v4.5 http://uploadffs.nl/images/2014/09/23/ya3ot.jpg step 3: now start using functions! using mysql.data.mysqlclient; enjoy!!! ps: sorry mate don't have enough repu

lambda - Find maximum, minimum, sum and average of a list in Java 8 -

how find maximum, minimum, sum , average of numbers in following list in java 8? list<integer> primes = arrays.aslist(2, 3, 5, 7, 11, 13, 17, 19, 23, 29); there class name, intsummarystatistics for example: list<integer> primes = arrays.aslist(2, 3, 5, 7, 11, 13, 17, 19, 23, 29); intsummarystatistics stats = primes.stream() .maptoint((x) -> x) .summarystatistics(); system.out.println(stats); output: intsummarystatistics{count=10, sum=129, min=2, average=12.900000, max=29} hope helps read intsummarystatistics

linq to sql - Save and load decimal in windows phone built-in database -

i use built-in database engine on wp8 app. when save decimal value, e.g. 3.5 value stored in database follows: 3.5000. when load value database 3.5000 shown in textbox. how can change behaivoir? note: if debug code see 3.5m. textbox displays 3.5000. default windows phone stores decimal value decimal(29,4) thanks help. michael you can format value using stringformat when binding textbox in xaml e.g. text="{binding latitude, stringformat=\{0:n2\}}" i've not tried myself, general ("g") format specifier you're after. have experiment stringformat property achieve you're after.

ubuntu 14.04 - Unable to stop the Bash command running when terminal is opened -

whenever open terminal in ubuntu 14.04, following command terminal opens: bash: “source/usr/local/share/chruby/chruby.sh”: no such file or directoy how can stop bash file being executed upon opening terminal? thanks, delete line .bash-profile . if waht stop reading whole .bash-profile file, edit .profile file.

ruby on rails - Fill in an input text in a modal popin -

i'm triing test modal form cucumber/capybara. modal loaded after page rendering. input text not found. here sourcecode. the view rendering modal <div class="modal hide fade" id="mymodal" tabindex="-1" role="dialog" data-backdrop="static" style="width:600px; padding:30px">loading...</div> <script type="text/javascript"> $(document).ready(function() { $('#mymodal').modal('show'); $('#mymodal').html("<%= j render("form")%>"); }); </script> the modal contains input text <input id="project_title" name="project[title]" type="text" value=""> the test (i have tried differents methods in comments) # find(:css, "#project_title").set value # within("#mymodal") # find(:css, "#project_title", visible: false).set value # end # sleep 3 find(:css, &q

ruby - Change value of a cloned object -

i have object has instance variable array called my_array . declare via attr_accessor . my_object.my_array = [1,2,3] # <= don't know max size of my_array(it can dynamic) i want create same object my_object , fill my_array 1 element. value inside element each value my_array 's element (from my_object ). because size of my_array dynamic suppose need iterate via each . here's attempt: my_object.my_array.each |element| # <= my_object special object new_object = nil unless new_object.nil? new_object = my_object.clone # <= create new object same class my_object new_object.my_array.clear # <= clear element inside it. new_object.my_array.push(element) # assign element value first element. # rest of code # new_object = nil end the iteration not iterating properly. size of my_object.my_array 3, should iterating 3 times, it's not, it's iterating 1 time. believe it's because of new_object.my_array.clear , cloned my_obje

c# - Variable condition in LINQ where clause -

i have database did not create , cannot modify. need run linq query, need pass in variable in where clause. columns in table: advmonam (all bit), advmonam , advtueam , advtuepm , advwedam , etc. var column = "adv" + dayofweek + time; var employeesoncall = r in db.advoncalls (variable column needed here) == true select r.chartemployee; if hard code r.advtueam works perfectly, r.column == true or column == true not. feel should easy, stumped. i trying find employee(s) on call @ given time of day. you can build expression tree represent condition want manually, rather using lambda you're trying do: public static iqueryable<t> whereequals<t>( iqueryable<t> query, string property, object valuetocompare) { var param = expression.parameter(typeof(t)); var body = expression.equal( expression.property(param, property), expression.constant(valuetocompare));

what format blueimp-gallery.add expects for list parameter -

i tried load additional slides blueimp-gallery instance collected infinityscroll using callback , galler.add()-method. in blueimp-gallery readme there list parameter listed .add(list) method can't figure out kind of list expects. list of a-tags or list list of javascript-objects, couldn't work. ok found out, it's array of html-nodes or jquery selector

How to list all SSIS packages on the Sql Server 2008 using T-SQL -

i have no access connect ssis subsystem via sql management studio, looking way list ssis packages via t-sql. found the following query sql server 2005 , not working 2008: -- list ssis packages stored in msdb database. select pck.name packagename ,pck.[description] [description] ,fld.foldername foldername ,case pck.packagetype when 0 'default client' when 1 'i/o wizard' when 2 'dts designer' when 3 'replication' when 5 'ssis designer' when 6 'maintenance plan' else 'unknown' end packagetye ,lg.name ownername ,pck.isencrypted isencrypted ,pck.createdate createdate ,convert(varchar(10), vermajor) + '.' + convert(varchar(10), verminor) + '.' + convert(varchar(10), verbuild) version ,pck.vercomments versioncomment ,datalength(pck.packagedata) pac

javascript - How redirect respective controller into "$routeProvider" -

i know if possible change next normal code angular app: this how index.html file has: <!-- load controllers. --> <script type="text/javascript" src="js/controllers/controller_1.js"></script> <script type="text/javascript" src="js/controllers/controller_2.js"></script> <script type="text/javascript" src="js/controllers/controller_3.js"></script> <script type="text/javascript" src="js/controllers/controller_4.js"></script> <script type="text/javascript" src="js/controllers/controller_5.js"></script> and app.js file has next part: $routeprovider. when('/', { controller: 'controller_1', templateurl: 'views/views-1.html' }). when('/menu/:restaurantid', { controller: 'controller_2', templateurl: 'views/views-2.html' }). when('/checkout

ms access - SQL selecting data from two tables in two different mdb files -

i use mdb viewer plus handle mdb database files. problem following sql query: select `0bok`.bk booktitle, `book`.page [database=e:\feqh\main.mdb].`0bok`, [database=e:\feqh\31620.mdb].`book` `0bok`.bkid = 31620 i want perform select 2 different tables in 2 different database files. above query returns following error: error: parameter object improperly defined. inconsistent or incomplete information provided. i tried prefix database ; [;database=e:\feqh\main.mdb] generate errors. inspired solution microsoft official article

javascript - Create video with ffmpeg from youtube URL? -

i'm creating video player e-learning platform javascript. let our users upload videos or images & audio files or youtube videos via url. when it's not youtube url, convert files in our servers using ffmpeg our player handles same type of files, i'm having issues control youtube video our own controls. want know: there way take youtube url , create video file using fmmpeg or other similar way? idea not control youtube videos using youtube api, using instead our own controls. try youtube-dl https://github.com/rg3/youtube-dl this can download video youtube , process if via ffmpeg if have installed

python - How to use threading to help parse a large file -

alright, file 410k lines of code. right parse in 1.4 seconds, need faster. there couple weird things file though... the file structured (thanks arm): arm fromelf parse of map key name of structure, , in case can duplicated due arm generating warnings. values in case fields follow. is there way can use threads split task multiple threads adding data same map? p.s. not looking me, provided example of file structure understand can't process each line, rather process [start:finish] based off structure. per request, sample of i'm parsing: ; structure, table , size 0x104 bytes, inputfile.cpp |table.tablesize| equ 0 ; int |table.data| equ 0x4 ; array[64] of myclasshandle ; end of structure table ; structure, box2 , size 0x8 bytes, inputfile.cpp |box2.| equ 0 ; anonymous |box2..| equ 0 ; anonymous |box2...min|

javascript - Get the last Valid Value of day in a date using JQuery -

i have code : //set delivery date based request date document.getelementbyid('ctl00_ctl00_pagecontent_content_scs_requestdate').onblur = function (e) { var requestdate = new date($('#ctl00_ctl00_pagecontent_content_scs_requestdate').val()); var dd = requestdate.getdate()+1; var mm = requestdate.getmonth()+1; //january 0! var yyyy = requestdate.getfullyear(); if(dd<10){dd='0'+dd} if(mm<10){mm='0'+mm} requestdate = yyyy+'-'+mm+'-'+dd; $('#ctl00_ctl00_pagecontent_content_scs_deliverydate').val(requestdate); it works fine if requestdate day + 1 on range of given month, if requestdate day last day of given month , add 1 day, deliverydate field display mm/dd/yy mean date set field invalid. how can check if requestdate day last day of month , set delivery date right value. you can add a date date instead of adding day of month value, can read values desired date. var requestdate = new date($('#ctl00

c++ - Double pointer difference when using with array -

is there difference between following 2 lines , if it? (in c++) float (**a[10]); float *(*a[10]); no. try float (**a[10]); float *(*b[10]); if (typeid(a) == typeid(b)) printf("==\n"); else printf("!=\n"); the output is ==

function - Pointer Confusion with C++ -

i confused c++ pointers , reference operators. main confusion following (simple ) code: #include <iostream> using namespace std; void changeint(int &a) { *= 3; } int main() { int n = 3; changeint(n); cout << n << endl; return 0; } mainly, confused why changing address (&a) changes actual variable (n). when first attempted problem code: #include <iostream> using namespace std; void changeint(int &a) { *a *= 3; } int main() { int n = 3; changeint(n); cout << n << endl; return 0; } but gives me error. why when change address changes variable, when change value pointed address error? your second example not valid c++, can dereference pointer (or object type overload operator* , not case). your first example pass parameter reference ( int &a not "the address of a", reference a), why change a change object being passed function (in case, n )

How do I convert an integer to string in CakePHP? -

in cakephp app when try data this: $this->loadmodel('radio'); $posts = $this->radio->find('all'); the integers displayed strings (in debug) : 'radio' => array( 'idsong' => '4', 'name' => 'batman', 'title' => 'batman theme song' ), why? type int in db. need integers correctly displayed in json files not sure if there's straightforward solution, change model data using afterfind something like public function afterfind($results, $primary = false) { foreach ($results $key => $val) { if (isset($val['radio']['idsong'])) { $results[$key]['radio']['idsong'] = (int)$results[$key]['radio']['idsong']; } } return $results; }

oracle11g - How Can I install oci8 drivers in php 5.3 on my windows pc whith out xampp or wamp -

win 2007 server 32bit apache2.2 php version 5.3.14 without php_oci8 files oracle enterprise edition installed i need able connect remote oracle database, find out, oci8 extension should used. make oci8 work, should need @ least oracle instant client on server, because of dll oci8 need. what did? downloaded oracle instant client sites ( oracle download site ), version 11.2.0.4.0 unpacked folder, choosed program files/oci_11_2 added windows variable path address restarted win downloaded php_oci8 libraries pecl ( pecl oci8 dl site ) put them ext directory set in php.ini added extension=php_oci8.dll php.ini restarted apache after checked php_info see, if ok, no signs of oci8. i tried older oracle instant client, swtiching between php_oci8.dll, php_oci8_11g.dll or php_oci8_12c.dll, yet nothing helped. currently, have no idea do, unless trying reinstalling php(which don't want because of many problematics connected that), different oracle instant clients or differenct php

html - Selenium/Webdriver/Java: How to verify that particular elements scrollbar was scrolled down to bottom? -

maybe has clue how verify if particular elements scroll bar scrolled down bottom? use selenium , webdriver on java (running junit scripts). can't figure how @ all... thanks. :) without sample code, guesses. if it's container div , contains more elements inside, may want use element located @ bottom check if visible.

python - Setting labels manually in matplotlib contour-plot wrong -

Image
i trying add manual labels contourplot in code below. labels printed randomly. have idea how fix this? seems bug in matplotlib. regards, david import numpy np import matplotlib.pyplot plt = 0.2 resolution = 100 xarray = np.linspace(0,0.25,num=resolution) yarray = np.linspace(0,1,num=resolution) = np.empty([resolution,resolution]) xc = 0 yc = 0 x in xarray: y in yarray: #print xc,yc wp = 1./np.pi*np.arctan(np.sin(np.pi*y)*np.sinh(np.pi*a/2.)/ (np.cosh(np.pi*x)-np.cos(np.pi*y)*np.cosh(np.pi*a/2.))) if wp <= 0: wp = wp+1 a[xc, yc] = wp else: a[xc, yc] = wp yc += 1 yc=0 xc += 1 = a.transpose() b = np.fliplr(a) ab = np.hstack((b,a)) fullx = np.hstack((-xarray[::-1],xarray)) #plot fig = plt.figure() fig.suptitle("weighting potential") ax = plt.subplot(1,1,1) cs = plt.contour(fullx,yarray,ab,10, colors='k') labelpos = np.dstack((np.zeros(9),np.arange(0.1,