Posts

Jquery accessing function -

in function below calling on page load, function called. new jquery , im wondering how call same function inside of function. comments have been inserted indicate need put call same function recreate click triggers. _loadfolder: function () { $("#title a").each( function (intindex) { $(this).bind( "click", function () { var stop = intindex; var temp = ''; var directory = ''; var item = ''; var newlink = ''; var folders = ''; $("#title a").each( function (intindex) { item = $(this).text(); temp = temp + item; folders = folders + "<a id='item'>" + item + "</a>"; ...

django - Can't Install `pip` for `python 3.3` but worked fine for `python 2.7` -

i'm new python not programming. goal learn django web development. i've been trying install later versions of python , pip , django . install pip python 2.7 fine i'm trying install on python 3 , gives me error think related ssl certifications not sure how resolve it. confusion fact worked fine once doesn't happen again. appreciate help. my code below: ~$> python3 /library/frameworks/python.framework/versions/3.3/bin/python3 ~$> pip /usr/local/bin/pip ~$> pip -v pip 1.5.6 /library/python/2.7/site-packages (python 2.7) ~$> sudo python3 /applications/get-pip.py downloading/unpacking pip cannot fetch index base url https://pypi.python.org/simple/ not find downloads satisfy requirement pip cleaning up... no distributions @ found pip storing debug log failure in /users/gemeni/.pip/pip.log ~$> i'm still stuck. used work around , installed pip... easy_install pip==1.2.1 but version not 1.2.1 , can't install else pip now. ~$>...

php - mod_rewrite not working in htaccess -

in .htaccess file in root of directory, have this; rewriteengine on rewritebase / rewriterule ^website-comments/webid/([^/]*)$ /website-comments?webid=$1 [l] but reason not rewriting url, if i'm thinking correct if user visits www.website.com/website-comments?webid=1 should change url www.website.com/website-comments/webid/1 doesn't seem working, doing wrong? in advance edit 1 other htaccess rules rewritecond %{request_filename} !-d rewritecond %{request_filename}\.php -f rewriterule ^(.*)$ $1.php [l] apache's mod_rewrite when used basic rules can silently serve internal url users, cannot enforce use of internal url same simple rule. typically if want end users never use actual url ( /website-comments?webid=123 in case) need first provide rule redirects away url matching in original http request using apache's variable %{the_request} . rewriteengine on # don't need rewritebase rewritebase / # first match url user requested. if ?webid=n...

javascript - Using jquery variable in Razor -

i have table in there input buttons attribute data. want read value of attribute , pass on razor's routeurl. my jquery function: $('#table').on("click", "input.myclass", function () { var abc = $(this).attr('data'); var myroute = @url.routeurl("routename", abc)-- > says abc not defined //use myroute }); what have experience can't use js variable in razor vica vera possible. so have achieve doing this: var myroute = '@url.routeurl("routename")'; myroute = myroute +"/"+ abc; suppose route rendered routeurlhelper is: var myroute = '/home/about'; var abc = 1; concatenate value it: myroute = myroute +"/"+ abc;// ---> /home/about/1

csv - Print in Reverse Order Python -

this question has answer here: read file in reverse order using python 11 answers f = urlopen ('http://ichart.finance.yahoo.com/table.csv?s=aapl&d=4&e=29&f=2014&g=d&a=8&b=22&c=1981&ignore=.csv') sys.stdout = open('output.csv', 'w') p = f.read() print p f.close this opens (or creates) file called output.csv , outputs lines downloaded file local csv. how reverse order lines printed in? if there header in input, might want print header first; followed remaining lines. f = urlopen ('http://ichart.finance.yahoo.com/table.csv?s=aapl&d=4&e=29&f=2014&g=d&a=8&b=22&c=1981&ignore=.csv') open('output.csv', 'w') out: # print header first out.write(f.readline()) # print reversed lines line in reversed(f.readlines()): out.write(line)...

google apps script - How can you do a non-case sensitive search of an array? -

i have function returned list of unique names in spreadsheet column. looking way make check not case sensitive without forcing lowercase. here original code: function testgetuniqueclassnames(){ var sheet = getrostersheet(); var datarange = sheet.getdatarange(); var indices = returnindices(); datarange = datarange.getvalues(); var classnames = getuniqueclassnames(datarange, indices.clsnameindex, indices.crfidindex); logger.log(classnames); } function getuniqueclassnames(datarange, clsnameindex, crfidindex) { var classnames = []; (var i=2; i<datarange.length; i++) { var thisclassname = datarange[i][clsnameindex]; var thisclassroot = datarange[i][crfidindex]; if ((classnames.indexof(thisclassname)==-1)&&(thisclassname!='')&&(thisclassroot!='')) { classnames.push(thisclassname); } } classnames.sort(); return classnames; } to solve created second lowercase array check against, used or...

ruby on rails - Active Record query based on property of has_many relationship? -

here's common occurrence. have parent category, category . has_many child categories, books . books have property published , , want categories have published books. how do that? i loop through categories find them, want better way. in this railscast , suggests using following query: category.joins(:products).merge(product.cheap) , or subject.joins(:books).merge(book.published) in example. however, don't have scope published in book . i have method all_published in book returns published books, tried category.joins(:books).merge(book.all_published) contained duplicate categories. what's best general way solve common problem? the .joins makes duplicates, whereas .includes not. in case, following should work: category.includes(:books).merge(book.all_published)