Posts

android - Can I add listener to Circle drawn on the map? -

i want draw circle on map , when user touches it. also, can't find method of circle that. need do? thanks, sarun edit in order clarify question. want circle have constant distance relative ground, means, if zoom map, circle grow bigger. you can using onmapclicklistener . in callback check if distance between clicked latlng , center of circle smaller radius. location.distancebetween should of help.

c# - Entity Framework Include without Relations -

i working on huge project using entity framework. because made entities time-dependent not possible use relations between entities anymore (i manage relations myself). problem came not longer able query data before. have entity called student . entity contains collection of books (list) belong student. each book contains author property comes database well. load students theirs book , corresponding authors either have write hundreds of custom queries (f.e. linq) or lazy load them results in big performance impact. great if use inlude of entity framework without relations. know how achieve this? thank you. if entity framework not managing relations between tables, has no way of using .include() create joins in sql call. best option add related entities parent normal, use [notmapped] attribute. can use custom sql call perform lookups , populate properties when need them. confused, however, statement because entities "time-dependent" can't use relationshi...

Python errors confusing a Python noobie -

Image
literally started learning python today , i'm ready pull hair out on errors i'm not understanding. here errors getting when try run script: and here script in question: primes = [] x = raw_input('enter max value check primes: ') num in range(2, x+1): if len(primes) == 0: primes.append(num) else: prime in primes: if (num % prime == 0): break primes.append(num) number in primes: print number from errors received far, looks cannot declare blank list, , doesn't input method. copied these lines more or less out of tutorial worked, , confused why work there not here. appreciated. the error messages posted start "command not found", implies running python script not in python, in shell. fix it, either run python question7.py , or add #!/usr/bin/env python first line of script (this known shebang line, , tells interpreter let python run script instead).

cordova - iOS 7 Status bar with Phonegap -

in ios 7, phonegap applications appear underneath status bar. can make difficult click on buttons/menus have been placed @ top of screen. is there knows way fix status bar issue on ios 7 in phonegap application? i've tried offset entire web page css doesn't seem work. there way offset entire uiwebview or make status bar behave did in ios6? thanks i found answer on thread, i'll answer question in case else wonders. just replace viewwillappear in mainviewcontroller.m this: - (void)viewwillappear:(bool)animated { // view defaults full size. if want customize view's size, or subviews (e.g. webview), // can here. // lower screen 20px on ios 7 if ([[[uidevice currentdevice] systemversion] floatvalue] >= 7) { cgrect viewbounds = [self.webview bounds]; viewbounds.origin.y = 20; viewbounds.size.height = viewbounds.size.height - 20; self.webview.frame = viewbounds; } [super viewwillappear:animat...

python - n-grams with Naive Bayes classifier Error -

i experimenting python nltk text classification. here code example practicing: http://www.laurentluce.com/posts/twitter-sentiment-analysis-using-python-and-nltk/ here code: from nltk import bigrams nltk.probability import eleprobdist, freqdist nltk import naivebayesclassifier collections import defaultdict train_samples = {} file ('data/positive.txt', 'rt') f: line in f.readlines(): train_samples[line] = 'pos' file ('data/negative.txt', 'rt') d: line in d.readlines(): train_samples[line] = 'neg' f = open("data/test.txt", "r") test_samples = f.readlines() # error in code # def bigramreturner(text): # tweetstring = text.lower() # bigramfeaturevector = {} # item in bigrams(tweetstring.split()): # bigramfeaturevector.append(' '.join(item)) # return bigramfeaturevector # updated code stack overflow comment def bigramreturner (tweetstring): tweetstring = tweet...

java - Publish an event using Struts 2 jQuery Plugin -

i want use publish / subscribe framework used internally strust2 jquery plugin. the user can select account number list or type in textbox. i want publish event when text box or select option changes. user can type textbox or select select box: <s:textfield name="account" onblur="$.publish('accountchanged',this,event)"/> <s:select name="accountlist" list="destinationaccounts" onblur="$.publish('accountchanged',this,event)"/> below js: $.subscribe('accountchanged', function(event, data) { alert("new data is: " + data.value); if ( event.target.id=='account') { //do } } here issues: the data.value works textbox, select box data.value undefined. i want know target received event. event.target.id not working! think event object not jquery event object? i reviewed sample showcase application, not find any. am calling $.publish method co...

matlab - determine average length of cells in a cell array -

this question has answer here: matlab length of each element in cell array 2 answers hi have cell array in matlab, cells of differing lengths. how determine average length of cells. i have tried: mean(length(mycell{:}); however many inputs mean function. thanks. use cellfun mean( cellfun( @length, mycell ) ) btw, of builtin functions might better write mean( cellfun( 'length', mycell ) )