Posts

Showing posts from April, 2010

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)

ios - AVAssetExportSession sporadically causing black frame -

i attempting crop video take within ios app, , export mp4. original video records perfectly, 50% of time when crop video, there black frame in beginning. here code. avurlasset *asset = [avurlasset urlassetwithurl:videourl options:@{avurlassetpreferprecisedurationandtimingkey:@yes}]; avmutablecomposition *composition = [avmutablecomposition composition]; avmutablecompositiontrack *videotrack = [composition addmutabletrackwithmediatype:avmediatypevideo preferredtrackid:kcmpersistenttrackid_invalid]; avassettrack *assettrack = [[asset trackswithmediatype:avmediatypevideo] firstobject]; cmtime duration = assettrack.timerange.duration; [videotrack inserttimerange:cmtimerangemake(kcmtimezero, duration) oftrack:assettrack attime:kcmtimezero error:nil]; avmutablevideocomposition *videocomposition = [avmutablevideocomposition videocomposition]; videocomposition.frameduration = cmtimemake(1, 30.0); videocomposition.rendersize = cgsizemake(videotrack.naturalsize.height, videotrack.natu...

ios - Saving an image using node (fs writeStreams) inserts headers into file -

i trying upload photo (in multipart form) ios app, using afnetworking . using node.js backend, , have working. problem when trying save image writing headers file...so of images save have in beginning (when open image in plain text): --boundary+9ef923e9caacb213 content-disposition: form-data; name="para" val --boundary+9ef923e9caacb213 content-disposition: form-data; name="afimage"; filename="afimage.jpg" content-type: image/jpeg the server code using is: uploadios: (req, res) -> tmpfile = variables.uploadsdir + "tempname" ws = fs.createwritestream(tmpfile) req.on 'data', (data) -> ws.write data req.on 'end', -> ws.end() i can working using express body parser, prefer way if possible. ideas how strip away headers? you have use multipart-capable parser such busboy or multiparty .

apache - Siteminder issue Unable to process SMSESSION cookie -

the first time i'm able logging in web page , after if click link redirecting login page. i see message in logs "unable process smsession cookie" , there no error other this. all technologies used tagged question. could 1 me. here logic fix problem until proper siteminder package: due siteminder package update, got issue. the siteminder setup needs changed after mvn build. hence mvn build create conf files every time. every time maven build, settings go ‘wrong’ one. so after every maven build, following steps must followed: brief steps: 1. in web server- remove redirect @ end 2. in app server - remove uaa, 3. in app server - remove context-param (devsecuritycontext.xml part) 4. stop , start both web , app server's . detailed steps: go config directory of web instance , remove line: redirect 307 /login.fcc file config/redirects.conf go web.xml file , remove uaa filter – i.e. following lines: remove filter configurations. ` in same f...

c# - Manipulate DateTime using Linq -

i have solution table in database , want display solutions less day old of now(datetime.now) thank iqueryable<solution> solutions= x in db.solutions x.created_at == datetime.now -1 select x; use datetime.adddays target date. use >= comparison filter solutions less old target date (or equal it): iqueryable<solution> solutions = s in db.solutions s.created_at >= datetime.now.adddays(-1) select s; note: give entities withing 24 hours now. if want entities beginning of yesterday, use datetime.today instead of datetime.now .

android - Custom views inside ListView with itemViewType -

i have listview in application. adapter listview contains multiple item view types (around 5 till now), via can inflate different types of row views inside listview. all row views inflated inside adapter custom subclassed view/view group. public class customview1 extends relativelayout { bundle bundle; public customview1(bundle bundle) { super(context); this.bundle = bundle; addsubviews(bundle.getbundlelist("list")); } private void addsubviews(arraylist<bundle> list) { for(bundle element : list) { //add sub views via reflection view view = (view) class.forname(packagename + type).getconstructor(bundle.class).newinstance(element); addview(view); } } //called getview() in adapter when convertview != null public void onrecycle(bundle bundle) { if(bundle != this.bundle) { this.bundle = bundle; removeallviews(); ...

c# - Releasing and Renewing your DHCP-based IP Address -

using c# how can release , renew dhcp-based ip address? at moment using process method use these dos commands: ipconfig /release and ipconfig /renew is there more managed approach in c# this? you could use wmi, simpler using system.diagnostics.process here wmi solution anyway: managementclass objmc = new managementclass("win32_networkadapterconfiguration"); managementobjectcollection objmoc = objmc.getinstances(); foreach (managementobject objmo in objmoc) { //need determine adapter here kind of if() statement objmo.invokemethod("releasedhcplease", null, null); objmo.invokemethod("renewdhcplease", null, null); }

git branch - Branches other than master are hidden after cloning a Git repo? -

this question has answer here: only master branch visible after cloning git repo 1 answer when git clone , git branch , master shows up. see other branches remote when git branch -a . why other branches hidden? assuming did normal clone , didn't use --depth=1 , they're not hidden, haven't made local copy yet. check out 1 of other branches, run: git checkout <branchname> it'll detect remote branch , check out version of code locally.

android - Edittext inside ExpandableListView does not show keyboard -

i have custom dialogfragment thats displays expandablelistview , items edittext. when edittext gets focus input keyboard not shown, if force code using inputmethodmanager.forced flag. dialogfragment xml: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:descendantfocusability="afterdescendants" > ... <expandablelistview android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="match_parent" android:descendantfocusability="afterdescendants" /> <textview android:id="@android:id/empty" android:layout_width="match_parent" android:layout_height="match_parent" ...

jquery - getting values of multiple select2 select boxes which are on one page -

i have multiple select2 boxes on 1 page , want access value selected each one. i have tried adding each select tag 1 class, example: "my-select2-boxes" so: <select class="my-select2-boxes"> <option value="volvo">volvo</option> <option value="saab">saab</option> </select> <select class="my-select2-boxes"> <option value="superman">superman</option> <option value="batman">batman</option> </select> and try: $(".my-select2-boxes").select2("data") but returns data first select element i.e. 1 volva , saab. how can access data of select elements it's giving 1 set of data, because, though selector gets multiple elements, cannot "guess" want data return of element objects. should make use of jquery's .each() , allow subjugate data of each element needed. such as: $(function() { ...

django - PostGIS Nearest Neighbor Search Results Out of Order? -

i have django/postgresql application shows users nearest particular user. uses postgis 2.0 knn (k nearest neighbors) <-> operator in order clause list users, nearest first. i've found initial dataset 2 of search results out of order (all distances measured los angeles, ca): member, city, state, distance (miles) user1, north las vegas, nv, 239 user2, phoenix, az, 365 user3, provo, ut, 568 user4, twin falls, id, 630 user5, albuquerque, nm, 673 user6, portland, or, 828 user7, bozeman, mt, 896 user8, seattle, wa, 962 user9, boulder, co, 834 <- out of order! user10, laramie, wy, 862 <- out of order! user11, naperville, il, 1756 the member name username column django's contrib.auth.models user class. useraccount class contains geometry information defined follows: class useraccount(models.model): user = models.onetoonefield(user, primary_key=true, unique=true) address_line_1 = models.charfield(max_length=30) address_line_2 = models.cha...

Lead and Lag in SQL -

my table has following columns: product_id , customer_id , start_date , end_date , product , product_use . goal find product customer using @ beginning of each month end of each month? ideas how in sql? thanks. product_id cust_id start_dt end_dt 8398d 8678 12/18/2013 3/10/2014 270b9 8678 2/14/2014 3/16/2014 c0867 8678 3/25/2014 4/1/2014 2f9d2 8678 4/3/2014 5/7/2014 9ae65 8678 4/25/2014 5/6/2014 expected results month product_begining_of_month product_end_of_month december 8398d 8398d january 8398d 8398d february 8398d 8398d , 270b9 march 8398d , 270b9 c0867 april 2f9d2 2f9d2 , 9ae65 you select ids, , first , last dates result set; use outer table query these results select productid using inner table results of dates , customerid.. select custid, (select pr...

python - Use urlparse library to iterate through url param -

i need following i'm trying do: modify individual dictionary values each key (a param in case) single param @ time value self.fooz each iteration. like this so url like: somesite.com?id=6&name=bill become somesite.com?id=<self.fooz>&name=bill (iterating number of individual foozes) then, somesite.com?id=6&name=<self.fooz> (iterating number of individual foozes) finally, generating full_param_vector , full_param values discussed below can please me? i've done: 1) set of raw paths brought in via self.path_object ) 2) parse paths after ? grab raw parametrized key/values (via parse_after ) i wrote down pseudocode of i'm trying accomplish: if self.path_object not none: dictpath = {} path in self.path_object: #path.pathtoscan - returns full url e.g. somesite.com?id=6&name=bill #parse_after returns string parameters only, like: {u'id': [u'2'], u'name': [u'dog'...

html - Prevent 'display:table' stacking vertically only on Android -

Image
i have simple social media menu handful of different links. appears should in chrome, safari, ff, ie, ios devices, is: but on android devices, icons stack horizontally: html: <ul id="menu-social"> <li>link site</li> <li>link site</li> <li>link site</li> <li>link site</li> <li>link site</li> </ul> css: ul#menu-social { margin: 0 auto; text-align: center; height:40px; } ul#menu-social li { float:left; display: table; padding: 0; text-align: center; width: 20%; margin: 0 auto; background: none; } you better off doing css: ul#menu-social { margin: 0 auto; height:40px; display: table; padding: 0; } ul#menu-social li { display: table-cell; padding: 0; text-align: center; width: 20%; } the ul gets display: table , list items display: table-cell . ensure list items site side side.

c# - Get 3 layered object using entity framework -

if have manufacturer object has list of cars, , car object has list of features how return manufacturer object contains list of cars , each car in list contains list of features. every example see online uses 2 layered object. have , returns manufacturer , list of cars, each car returns 0 results list of features manufacturer man = new manufacturer(); using (myentities db = new myentities()) { man= (from m in db.manufacturer.include("cars") m.name.trim().equals("ford") select m).firstordefault(); } return man; mayif want use lazy loading, declare navigation properties 'virtual' if want eager load related objects, can use includes : .include("cars").include("cars.features") one drawback of method query may expensive execute. reason multiple join used , size of resulting server answer may pretty big. you can load 1 level @ ti...

debugging - windows phone 8.1 attach windbg to a build in process -

i know how attach windbg process running in windows phone 8.1. googling didn't help. can me? thanks to connect windbg existing process on phone 1. in tshell, enter command: debug-device –debugger windbgpath where windbgpath path windbg on host computer. 2. example: debug-device –debugger “c:\program files (x86)\windows kits\8.1\debuggers\x86\windbg.exe” 3. in windbg, on file menu, choose attach process. select 1 of listed processes, , click ok. for more refrence use debug-device in tshell attach debugger process

java - JAR file not running when adding images -

i having problems exporting pictures jar file , after browsing found sollution, doesn't seem working try { //leftfoot = imageio.read(new file("resources/leftfoot.png")); //rightfoot = imageio.read(new file("resources/rightfoot.png")); url url = this.getclass().getresource("/resources/leftfoot.png"); leftfoot = imageio.read(url); url = this.getclass().getresource("/resources/rightfoot.png"); rightfoot = imageio.read(url); } catch (ioexception e) { e.printstacktrace(); } } so, if try upload items first 2 lines(and comment following 4), main gui stuff runs in jar file images ar not shown. if other way round(the code above), no gui element works in jar file. have "resources" folder containing pictures both in "bin" folder , in main folder along bin,src,settings etc. cause read somewhere how supposed be, although not know why. leftfoot ...

php - How do I change the output of drupal 7 menu blocks in one specific region? -

so have several menu blocks in region 1 drupal 7 site. need wrap each of these menu blocks in <section> tag, leave other menu blocks unaffected. thinking preprocess region, check if blocks menu blocks, , can see, attempt wrap output in section tag. can please tell me i'm doing wrong? problem killing me. function mytheme_preprocess_region(&$vars){ //checks see if we're in correct region if($vars['region'] == "footer-top"){ //loops through every block in our region foreach($vars['elements'] $key => $item){ $block_type = $item['#block']->module; //if it's menu block, wrap output in section tag, doesnt work if($block_type == "menu_block"){ //$vars['elements']['menu_block_4']['#children'] = "<section>" . $item['#children'] . "</section>...

css - How do I align the button to the bottom of the row/column in bootstrap? -

Image
i have row 4 columns each heading , text. of columns have similar amount of text , push button in column down match rest of columns. 1 column has less text , doesn't push button down far enough. is there way align button bottom of row? achieve , keep responsive @ same time looks when screen smaller: this markup of page now: <div class="container"> <div class="row"> <div class="col-md-3"> <h2>heading</h2> <p>text here</p> <p><a class="btn btn-default" href="#" role="button">view details >></a></p> </div> <div class="col-md-3"> <h2>heading</h2> <p>text here</p> <p><a class="btn btn-default" href="#" role="button">view details >></a></p> </div> <div class="col-md-3...

ssl - Adobe Air Application HTTPS Security Popup -

i have air application communicates quite our server. usually, communication fine, every once in while following popup: "revocation information security certificate site not available. wan proceed? unfortunately, popup halts communications until end user clicks ok (which problem application not allow user interaction , not accessible locally. i connecting our website has valid comodo ssl certificate. visiting website causes no popups kind , shows valid. i have comodo software certificate validating application bundled program. i using actionscript http services communicate server get/post calls. checkinservice = new httpservice(); checkinservice.concurrency = concurrency.single; checkinservice.method = "post"; checkinservice.addeventlistener(resultevent.result,sendresult); checkinservice.addeventlistener(faultevent.fault, faultresult); checkinservice.addeventlistener(invokeevent.invoke, invokeattempt); checkinservice.url = "https://www.mywebsite.c...

php - Generate popular subjects from collection of post titles -

i have content aggregator website. i'd process post titles generate list of popular post subjects. subject "software development" important point 2 words "software" , "development" don't have directly next each other in post title. the idea generate list of possible collections (a group of posts based on same subject) i have started writing code , have far managed generate list of used words. need generate new list ordered number of occurrences of multiple words in post titles i'm hoping me final list of popular subjects. looking finish off. added comments code describe i've done far. also if know better way please let me know! /** * execute console command. * * @return mixed */ public function fire() { $this->info('starting...'); // last 1000 posts $posts = post::orderby('created_at', 'desc')->take(1000)->get(); // create array of post titles $titles_arr = array_map(f...

sql - Unpivot Multiple Columns in into Rows -

i did searching , didn't come answer. trying create table data , unpivot in sql server, can't columns , rows required. if object_id('tempdb..##expect_percents') not null drop table ##expect_percents create table ##expect_percents ( payor_id varchar(40) ,test_type varchar(40) ,[2011-08-31] int ,[2011-09-30] int ) go insert ##expect_percents values('uhc','udt','1','2'); select * ##expect_percents select payor_id, test_type, expect ##expect_percents unpivot ( expect expects in ([2011-08-31],[2011-09-30]) ) u i trying unpivot dates there field called "date" 2 dates representing each number. first line should be: uhc udt 1 2011-08-31 needing unpivot multiple columns can easier without unpivot command. 1 option use cross apply : select payor_id, test_type, expect, expectdate expect_percents cross apply ( select [2011-08-31],'2011-08-31' union select [2011-09-30],'2011-09-30...

Dropzone.js drag-and-drop re-ordering of queue with jQuery sortable -

i'm using dropzone autoprocessqueue: false give user chance remove files/etc. ideally, allow drag-n-drop reordering of queue...so if user selects 10 images , drags them dropzone, can ordered mouse. so far, have applied jquerys sortable() .dz-preview elements (.dz-preview div used in dropzone display each image uploaded). it works great insofar changes display order of .dz-preview elements...but still upload in exact order added queue. any ideas? you question jquery.sortable() need define stop() function sortable() . there can order of elements , inject hidden field in form sent server rest of fields. here example: get order of list items in jquery sortable list after resort

java - Android NullPointerException on variable in instantiated class -

i have activity calls expandablelistview. vanilla setup: activity->creates expandablelistviewadapter->draw it. when getchildview called , tries reference variable set via listadapter's constructor receives npe. so activitya->data gets set, sent arbitrarylistadapter. when childview method referenced , tries use datafromactivitya nullpointerexception. i'm not sure why, when verify datafromactivitya in adapter class, verifies correctly. when try reference in getchildview method npe shows up. to explain example: class activitya extends activity { private sparsearray<sparsearray<object>> data; private arbitrarylistadapter adapter; public void oncreate() { this.data = arbitraryfunctiontopopulatedatavariable(); // populates this.adapter = new arbitrarylistadapter(this, this.data); // other stuff this.adapter.notifydatasetchanged(); } // rest of activity here } /******************************/ cla...

javascript - Loop an array in Google Apps Scripts -

i'm trying write loop array getting invalid string error. if keyword = "mesothelioma|seo" function json(keyword) { var jsondata = urlfetchapp.fetch("http://api.grepwords.com/lookup?apikey=carterq="+keyword); var object = utilities.jsonparse(jsondata.getcontenttext()); var results = array("error", "error", "error", "error"); (var = 0; < object.length; i++) { results[0] = object[0].cpc; results[1] = object[0].cmp; results[2] = object[0].lms; results[3] = object[0].m1; } return results; } any thoughts? your reference error coming line: var jsondata = urlfetchapp.fetch("http://api.grepwords.com/lookup?apikey=carter&q="+keyword); from above code, moment use 'keyword'. sure returns correct information? , if have thought loop? suppose var object = utilities.jsonparse(jsondata.getcontenttext()); returns this: var object = [ {cpc: 'test1', ...

sql - selecting greatest in group +N if greatest is within a range -

my goal relevant rate changes vendor. means need recent rate change, plus if rate change in last month, need previous rate(s) until rate outside of month. i have sample data demo (this relating vendors , dates pay rate changes) vendorid rateeffectivedate 2 2011-06-01 2 2012-03-15 2 2014-05-15 1 2010-07-01 1 2011-03-15 1 2013-07-01 what select greatest effective date each vendorid + if row within last month, select next lower value. in case, today being 2014-05-29 result: vendorid rateeffectivedate 2 2012-03-15 2 2014-05-15 1 2013-07-01 this way can calculate pay rates previous rate on course of month instead of using "newest". granted, newest work of time, edge case eluding me. what have far is: select vendorid, max(rateeffectivedate) rateeffectivedate @ratechanges group vendorid which gets me greatest date each vendorid vendorid rateeffectivedate 2 2014-05-15 1 2013-07-01 b...

objective c - How to check if an NSString contains fancy characters? -

i have game renders player's nickname. normally, use nice, styled, bitmap font render nickname. however, have bitmaps "normal" characters - a,b,c,...,1,2,3,...!@#$%^,... . there no bitmaps chinese, japanese or whatever other "fancy" characters in other language. trying render such text bitmap crash because don't supply such bitmaps. therefore decided detect whether given string "fancy" string, , if case, render nickname using generated system font. how can detect if string has fancy characters? current solution like -(bool)isnormaltext:(nsstring *)text { char accepted[] = {"abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()_+{}/\\\"\'?.,"}; (int = 0; < [text length]; ++i) { char character = [text characteratindex:i]; bool found = no; (int j = 0; j < 84 && !found; ++j) { char acceptedchar = accepted[j]; if (character == acce...

algorithm - How to balance the readwrite conflict in Android Camera subsytem? -

there buffers store data getting camera sensor in android camera hal. upper layer copy data one one special things. frame per second (fps) handle speed in upper layer. i must ensure fps large possible! , since user experience. however, writing buffer faster reading upper layer. there way balance conflict?

node.js - can you access a mongoose created database from mongo? -

noob node.js, express , mongodb here, running on ubuntu 14; created mongoose in express/nodejs app database via: var mongoose = require('mongoose'); var express = require('express'); var app = express(); ... mongoose.connect("mongodb://localhost/firstexpress"); var userschema = new mongoose.schema({ name: string, email: string, age: number }); var users = mongoose.model('users', userschema); app.post('/users', function(req, res){ var b = req.body; new users({ name: b.name, email: b.email, age: b.age }).save(function(err, userdoc){ if (err) res.json(err); res.redirect('/users/' + userdoc.name); }); }); app.get('/users/:name', function(req, res){ users.find({ name: req.param.name }, function(err, docs){ if (err){ res.json(err); } else { res.json(doc[0]); } }); }); making post request works, , adds user userbase. there way view db in mongo shell? i.e. fr...

r - ggplot add percentage labels based on x-axis variables -

Image
i've ggplot shows counts of tweets brands label overall percentage. done link: show % instead of counts in charts of categorical variables # plot ggplot of brands ggplot(data = test, aes(x = brand, fill = brand)) + geom_bar() + stat_bin(aes(label = sprintf("%.02f %%", ..count../sum(..count..)*100)), geom = 'text', vjust = -0.3) next, plot based on brand , sentiment, labels bars of each brand totalling 100%. however, have difficulty amending code this. able please? also, possible change colours neu blue , pos green? # plot ggplot of brands , sentiment ggplot(data = test, aes(x = brand, fill = factor(sentiment))) + geom_bar(position = 'dodge') + stat_bin(aes(label = sprintf("%.02f %%", ..count../sum(..count..)*100)), geom = 'text', position = position_dodge(width = 0.9), vjust=-0.3) here's dput of 100 rows of data's brand , sentiment column structure(list(brand = structure(c(3l, 1l, 1l, 1l, 1l, 1l, 1l, 1...

excel - Selected a Filtered range -

i have list object filter date. once have filtered array. set range on column d have loop read filtered range here code activesheet.listobjects("invoices").range.autofilter field:=5, criteria1:="=" & year.value activesheet.listobjects("invoices").range.autofilter field:=6, criteria1:="=" & month.value dim r range set r = sheets("invoices").range(range("d1"), range("d1").end(xldown)).offset(1, 0) msgbox r.address column d have header in d1 . when filter range should d75:d90 ... msgbox returns d2:d90 if data not filtered. thx you're there. use specialcells property below: dim r range, c range sheets("invoices").range(range("d1"), range("d1").end(xldown)) set r = .offset(1, 0).resize(.rows.count - 1).specialcells(xlcelltypevisible) end '~~> use areas property if want loop '~~> through filtered data posted lukas2 each c in r.areas ...

c# - Save current page to image -

i'm working on project requires save current page in image. found examples in javascript create blob of page, save page in file. my question is, possible save content of page in image file? does plugin exist directly ? if not, possible save blob , render blob in c# create image? to save page image, can use http://html2canvas.hertzen.com/ example: var canvas = document.getelementbyid("mycanvas"); var img = canvas.todataurl("image/png"); document.write('<img src="'+img+'"/>');

c++ program using too much memory -

i have c++ program makes simulation. simulation large. needs ran several times. i didn't take account memory management guidelines passing arguments reference functions avoid copies of same data wasting memory, , maybe other techniques don't know about. late redo whole program again (or maybe won't help). i have program void main(){ //simulation consuming lot of memory. }; i void main(){ (int i=0;i<10000;i++){ //simulation consuming lot of memory (depending on i). }; }; but in such way after each loop of for memory used inside released (probably except used program , counter of for). the memory holds fine 1 repetition of loop not two. i there way can done? on unix/linux , create bash shell script call c++ program required number of times, run_my_app.sh following content: i=0 while (( $i < 10000 )); ./my_app $i let i+=1 done then make executable chmod +x run_my_app.sh . on windows , same cmd.exe "shel...

java - Garbage collection of String literals -

i reading garbage collection , getting confusing search results when search string literal garbage collections. i need clarification on following points: if string defined literal @ compile time [e.g: string str = "java" ] garbage collected? if use intern method [e.g: string str = new string("java").intern() ] garbage collected? treated differently string literal in point 1. some places mentioned literals garbage collected when string class unloaded? make sense because don't think string class ever unloaded. if string defined literal @ compile time [e.g: string str = "java"; ] garbage collected? probably not. code objects contain 1 or more references string objects represent literals. long code objects reachable, string objects to. it possible code objects become unreachable, if dynamically loaded ... , classloader destroyed. if use intern method [e.g: string str = new string("java").intern() ] garbage...

jQuery attach click event on empty select box -

using jquery, how load select box options dynamically while clicking on select box. i using redmine rest api's load issue categories dynamically in select box. how attach event handler selectbox. but not working, i.e event not attaching <script> //dynamically load status values $('#newstatusfield').on('click',function(){ alert('inside'); }); </script> <select name="status" id="newstatusfield" data-mini="true" data-native-menu="false"> <!--dynamic option values --> </select> always try wrap jquery code inside document.ready fucntion , change event work : edit : include latest jquery library can download here jquery library <head> <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> <script> $(document).ready(function() { $('#newstatusfield').on('change'...

javascript - Get values from ajax to php -

i have problem on getting value drop down on changing option html form php variable.and here have change second drop down option based upon first drop down.i want value of first drop down on change in php variable.....thanks in advance this js coding <script type="text/javascript"> function select_area(area_id){ if(area_id!="-1"){ load_data('layout',area_id); }else{ $("#layout_dropdown").html("<option value='-1'>---select area first---</option>"); } } function load_data(load_type,load_id){ var datastring='load_type='+load_type+'&load_id='+load_id; $.ajax({ type: "post", url: "load2.php", data: datastring, cache: false, success: function(result){ $("#"+load_type+"_dropdown").html("<option value='-1'>s...

mysqli - Having trouble updating database using php -

i have database called specials table called specials, table has 6 rows, there 3 records record id of 1,2, , 3. 1 of rows called title. have data there want update data using form. how ever mysqli_query not working. here code. mysqli_query($connect, "update specials set title=san diego id='1'"); assuming title varchar , id int mysqli_query($connect, "update specials set title='san diego' id=1");

asp.net mvc 3 - Unable to load the jquery grid on post in mvc3 -

i have 2 views , first index displaying jquery grid. second entry page customer after insertion redirect index() in controller again onload grid not displayed,below jquery function grid jquerygrid code <script type="text/javascript"> $(document).ready(function () { search(); }); function search() { var jqdataurl = "queuemgmt/loaddata"; var reportname = "wallboard"; $("#jqtable").jqgrid({ url: jqdataurl, datatype: "json", mtype: "post", postdata: { }, colnames: ["queue", "ciq", "avail", "staff"], colmodel: [ { name: "queue_no", index: "queue_no", align: "left" }, { name: "ciq", index: "ciq", align: "left" }, { name: "avail", index: "avail", align: ...

c# - Why I need re- reference dll on major change in library -

i implemented indexer in library base.dll namespace base { public class bocollection<tkey, tvalue> : dictionary<tkey, tvalue> { public bocollection() : base() { } public bocollection(int capacity) : base(capacity) { } public bocollection(iequalitycomparer<tkey> comparer) : base(comparer) { } public new tvalue this[tkey key] { { lock(this) { return base[key]; } } set { lock(this) { base[key] = value; } } } } } now change forcing me re-compile or re-reference base.dll in other library. cleaned web application problem still there. getting error : method not found: 'system.collections.generic.dictionary`2 base.get_child()'. but once re-reference base.dll in project giving error got fixed. have 15 different libraries dll being referenced. can suggest doing wrong. application base...