Posts

Showing posts from August, 2013

How to use multiple model instances in views in django? -

i have created website when user upload image, detect objects on image , show them. here model: class document(models.model): docfile = models.filefield(upload_to='documents/%y/%m/%d') imgfile = models.filefield(upload_to='documents/%y/%m/%d',default='settings.media_root/default/default.jpg') catagory = models.charfield(max_length=100,default="unknow") the docfile original image, imgfile image label object in image, catagory category of object. my problem there might multiple objects in image, might have multiple document instances in views, don't know how many instances need in advance because depends on detection results. so how can implement this? , if can use document list in views, how can show contents in list in html template? thx. you can change models little: class baseimage(models.model): docfile = models.filefield(upload_to='documents/%y/%m/%d') class document(models.model): base_image =

ruby on rails - Spec is failing on the same hour -

in app have few specs depend on distracting dates: survey_instance.created_at + 1.day then check if collection of survey_instances have proper size. specs fails @ 3 a.m. how can distract dates avoid problem? for problem, timecop invented! a gem providing "time travel" , "time freezing" capabilities, making dead simple test time-dependent code. provides unified method mock time.now, date.today, , datetime.now in single call. bundle , change spec like: timecop.freeze(2015, 10, 21, 10, 5, 0) # whatever assertion end this make sure test run @ same time of day.

android - Regain Focus on EditText when User Clicks It -

i have activity wiht edittext, , want following behaviour 1 of edittext: on activity starting-up, edittext populated text. should not show cursor, has no focus , not show keyboard (so user can read text , scroll , down). when user clicks/touches edittext, gain focus, show cursor , show keyboard (so user can start editing). the behaviour @ starting working ok, cannot "start editing" behaviour work when user clicks on edittext. here code: activity_main.xml: ... ... <edittext android:id="@+id/notepad" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="0.5" android:background="@android:color/transparent" android:textsize="@dimen/font_large" android:textstyle="normal" android:textcolor="@color/appprimarytext" android:textcolorhint="@color/appaccentco

node.js - Push items into mongo array via mongoose -

i've scoured bit looking answer i'm sure i'm lost right words describe i'm after. basically have mongodb collection called 'people' schema collection follows: people: { name: string, friends: [{firstname: string, lastname: string}] } now, have basic express application connects database , creates 'people' empty friends array. in secondary place in application, form in place add friends. form takes in firstname , lastname , posts name field reference proper people object. what i'm having hard time doing creating new friend object , "pushing" friends array. i know when via mongo console use update function $push second argument after lookup criteria, can't seem find appropriate way mongoose this. db.people.update({name: "john"}, {$push: {friends: {firstname: "harry", lastname: "potter"}}}); update: so, adrian's answer helpful. following did in order accompli

r - ggplot2 legend only showing partial border with legend.key attribute -

Image
i'm trying create graph using ggplot2, , don't understand why legend.key attribute placing border around part of legend. see minimal working example below. suggestions on fix? example provided here seems work fine ( https://github.com/hadley/ggplot2/wiki/legend-attributes#legendkey-rect ). set.seed(12) xy <- data.frame(x=c(rep(letters[1], times=25), rep(letters[2], times=25)), y=rep(letters[1:25], times=2), type = sample(c(-2,-1,0,1,2), 50, replace=t)) xy$type <- factor(xy$type, c(-2, -1, 0, 1, 2)) ggplot(xy, aes(x=x, y=y, fill=type, height=0.95)) + geom_tile() + scale_fill_manual(values = c("#323d8d", "#ffffff", "#ffffff", "#ffffff", "#ff0000"), na.value="#bebebe") + scale_x_discrete(expand=c(0,0.51)) + theme(legend.key = element_rect(colour="black")) + theme(axis.ticks.x = element_blank()) + theme(axis.ticks.y

python - Django form wizard 'NoneType' object has no attribute 'rsplit' error -

hi hope can help, i've been trying out form wizard project , have been following documentation closely, keep getting error: 'nonetype' object has no attribute 'rsplit' forms.py: from django import forms class contactform1(forms.form): subject = forms.charfield() sender = forms.charfield() class contactform2(forms.form): message = forms.charfield() views.py: class contactwizard(wizardview): def done(self, form_list, **kwargs): return render_to_response('done.html', { 'form_data': [form.cleaned_data form in form_list], }) and urls.py (atestapp 'woo') urlpatterns = [ url(r'^admin/', include(admin.site.urls)), url(r'^woo/', contactwizard.as_view([contactform1, contactform2])) ] traceback: environment: request method: request url: http://127.0.0.1:8000/woo/ django version: 1.8.4 python version: 3.4.0 installed applications: ('django.contrib.admi

android - Opening Default Camera using Intent , overriding other apps? -

i trying open camera app, there other apps installed, such candy , retrica , phone asks 1 open. however, want open default camera, default in every devices. solution? here code: public void camerafuture(view view) { intent intent = new intent(android.provider.mediastore.action_image_capture); startactivityforresult(intent, 0); } protected void onactivityresult(int requestcode, int resultcode, intent data) { // todo auto-generated method stub super.onactivityresult(requestcode, resultcode, data); imageview iv = (imageview)findviewbyid(r.id.camtemp); bitmap bp = (bitmap) data.getextras().get("data"); iv.setimagebitmap(bp); } first of package name of camera want open default .(if need let know how this) just write code. change package name got camera - setpackage(" place new package name in here ") method intent mintent = null; mintent = new intent(); mintent.setpackage("com.sec.android.app.camera"); minte

go - golang - how to get element from the interface{} type of slice? -

i want write function can convert slice([]int, []string, []bool, []int64, []float64) string. []string{a,b,c} -> a,b,c []int{1,2,3} -> 1,2,3 there code : func slicetostring(itr interface{}) string { switch itr.(type) { case []string: return strings.join(itr.([]string), ",") case []int: s := []string{} _, v := range itr.([]int) { s = append(s, fmt.sprintf("%v", v)) } return strings.join(s, ",") case []int64: s := []string{} _, v := range itr.([]int64) { s = append(s, fmt.sprintf("%v", v)) } return strings.join(s, ",") case []float64: s := []string{} _, v := range itr.([]float64) { s = append(s, fmt.sprintf("%v", v)) } return strings.join(s, ",") case []bool: s := []string{} _, v := range itr.([]bool) { s = appen

apply - MAPPLY across a vector in R -

i've seen several examples on google, still don't understand quite how works here's i'm trying do. i have text array > v <- c("aa","bb","cc","dd","ee","ff") > v [1] "aa" "bb" "cc" "dd" "ee" "ff" i output array of length length(v)-2 (=4) composed of [1] "aabbcc" "bbccdd" "ccddee" "ddeeff" which vector concatenations of 3 successive elements of v i'm thinking of using mapply mapply(function(x,i){paste(x[i:i+2],sep="",collapse="")},v,1:(length(v)-2)) but thats not right syntax thanks here's solution in case project needs many successive elements. there other approaches, mapply one: mapply(function(x,y) paste(v[x:y], collapse=""), 1:(length(v)-2), 3:length(v)) #[1] "aabbcc" "bbccdd" "ccddee" "ddeeff&q

node.js - JSON.parse returns [object] from JSON -

i'm using npm package called request make http request https://maps.googleapis.com/maps/api/geocode/json?address=jur%c4%8dkova+cesta+225&key=aizasychkpdcaaavzwyof8zbkspokuyt41nlj_0 now want parse data receive in order extract lat/long , write database. far output console is: [ { address_components: [ [object], [object], [object], [object], [object], [object], [object] ], formatted_address: 'breznikova ulica 15, 1230 domžale, slovenia', geometry: { location: [object], location_type: 'rooftop', viewport: [object] }, place_id: 'chijr2mtduc0zucrv5nxk0zex7m', types: [ 'street_address' ] }, { address_components: [ [object], [object], [object], [object], [object], [object], [object] ], formatted_address: 'breznikova ulica 15, 1000 ljubljana, slovenia', geometry: { location: [object], loca

perl count mismatch between two strings -

i need count mismatch between 2 strings. let say: my $s1 = "atcg"; $s2 = "attg"; this should give: 1 mismatch. no need find position or mismatches. i looking fast way do. thought splitting arrays , matching in loop or using substr match each position may slow because need checked more billion pairs. just xor 2 strings together. each nul character in result represents position characters same in both strings. my ($s1, $s2) = qw( atcg attg ); $count = ( $s1 ^ $s2 ) =~ tr/\0//c; print "$count\n"; # prints "1" note: if you're going repeatedly compare string, pass , 1 comparing utf8::downgrade makes sure ^ fast can be. utf8::downgrade($s1); # change internal format in utf8::downgrade($s2); # strings stored speed $s1^$s2. this useless/wasteful if either string contains unicode chars above u+00ff.

java - Android App saving to SD Card -

i'm having trouble. i'm new java , android programming. i'm using template started , i'm stuck. i have app pulls images tumblr feed , presents them on screen download button. works fine installs root of internal storage. how save folder in internal storage called "/pictures/tumblr"? my code is: public void onloadingcomplete(final string imageuri, view view, bitmap loadedimage) { spinner.setvisibility(view.gone); // close button click event btnsave.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { string path = environment.getexternalstoragedirectory().tostring(); outputstream fout = null; file file = new file(path, "tumblr_"+images.get(position).getid()+".jpg"); try { fout = n

random - Java RandomGenerator no reponse to be repeated twice in a row -

i need output random number relate repose. pick 1 need generate random number no number repeated twice in row. know have store previous value not know start. here code. private string pickdefaultresponse() { // pick random number index in default response list. // number between 0 (inclusive) , size of list (exclusive). int previndex; int newindex; int index = randomgenerator.nextint(defaultresponses.size()); return defaultresponses.get(index); } previndex must not inside method, keep @ class level. private int previndex = -1; private string pickdefaultresponse() { int index = 0; { index = randomgenerator.nextint(defaultresponses.size()); } while( index == previndex ); previndex = index; return defaultresponses.get(index); }

How to make a conditional lable call in batch -

i want make simple batch script should able run ant build script . when start batfile want prompt me target name. simple conditional test: if type enter (without entering string) goto lable1, else goto lable2 (wich calls ant argument, have entered @ promt). tried didn't work: @echo off set /p target=please enter target: if %target%=="" (goto call_script_with_default_target) else (goto call_script_with_specified_target) :call_script_with_default_target echo ant default-target ::when no argument present, assumes default target ant pause goto end :call_script_with_specified_target echo ant %target% ant %target% goto end :end pause when type clean (at prompt) works expected, when hit enter nothings happen. the facts: set /p target=please enter target: command keeps value of target variable unchanged if user hits enter ; %target% evaluates empty string if not initialised. hence, if %target%=="" (... evaluates syntactically wron

javascript - Custom error class not applying to all the checkbox when the button is click using jquery validation -

currently facing issue in checkbox when user click yes radio button panel filed displayed when user click next button error class applying first check box should apply check box question might easy how not getting exact result. here jquery code $(".phy_clp").click(function() { var inputvalidation = $('input[name=phy_clp]:checked').val(); if (inputvalidation === "yes") { $phyexpydiv.show(); $(".phyexpy").find(".chk_field_hlt").removeclass("chk_field"); //$(".chk_field_hlt").addclass('errred_chkb'); } else if (inputvalidation === "no") { $(".chk_field_hlt").removeclass('errred'); $(".phyexpy").find(".chk_field_hlt").addclass("chk_field"); $phyexpydiv.hide(); } }); here fiddle link thanks in advance in highlight , unhighlight , refer the source code of plugin ca

cookies - authentication with Java and apache HttpClient 4.5.1 -

my problem is, don't get, how log in java , apache httpcomponents (httpclient v4.5.1) specific site: site im trying log in . have username (test_admin) , password (testing) log in think not enough , need more. think has field security_token see when make request uri, dont know how keep or how save , afterwards. there hidden input field name login-ticket, dont know what's either. want login, because need see courses , add new ones. after trying several code implementations im stick code: public static void setget(closeablehttpclient httpclient) throws unsupportedoperationexception, ioexception { httpget httpget = new httpget("http://demo.studip.de/dispatch.php/admin/courses"); closeablehttpresponse httpresponse = httpclient.execute(httpget); system.out.println("get response status:: " + httpresponse.getstatusline().getstatuscode()); showentity(httpresponse,httpresponse.getentity()); } public static httpentity setpar

javascript - Websockets with Node -

i'm having trouble trying play websockets, made toy echo server , tried send requests directly browser console. can send message browser server, , server recieving properly, it's not sending echo back. here server code , browser console code i'm running little test: server.js var websocketserver = require('websocket').server; var http = require('http'); var server = http.createserver(function(request, response) { console.log((new date()) + ' received request ' + request.url); response.writehead(404); response.end(); }); server.listen(8080, function() { console.log((new date()) + ' server listening on port 8080'); }); wsserver = new websocketserver({ httpserver: server }); wsserver.on('request', function(request) { var connection = request.accept('echo-protocol', request.origin); console.log((new date()) + ' connection accepted.'); connection.on('message', function(me

signals - Genetic Algorithm for Data modem for GSM voice channel -

i'm working on project of data modem gsm voice channel. i'm coding c++ the main idea of modem: generate speech-like symbols, code data in , send throught gsm codec. ga used generate these symbols. the main idea of ga is: generate initial symbol set generate random data code data symbols send through gsm codec recieve data codec decode original data point 2 calculate percentage of rubbish data then there cycle until 1 of following conditions met: iterations has been passed or rubbish data percentage low enough. i able implement algorithm, ga opeators - crossover , mutation - not work properly. turns so, initial set best 1 , others worse. in algorithm use ranking selection probability distribution с*(1-с)^n n - number of element in rank c - ga parameter. in article put 0.075. the crossover: g' = b*g1 + (1-b)*g2 b [-a, 1+a]. a=0.5 g' - complex spectra of offspring g1, g2 - complex spectras of parents. parents selected roulette wheel rotation accor

javascript - Add Classes On TextBox foucusout event via jQuery -

hi succeeded remove classes on edit button click, having issue adding classes back. here code given below. any appreciated. $(document).ready(function() { $(".edit").click(function() { $(this).parent().find('.edit-field-area').removeclass('edit-field-area'); $(this).removeclass('edit-button'); $(this).parent().find('.transparent-control').prop('disabled', false); $(this).parent().find('.transparent-control').focus(); }); $(".transparent-control").focusout(function() { debugger; $(this).parent().find('.row').find('.edit').addclass('edit-button'); $(this).prop('disabled', true); }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <!-- latest compiled , minified css --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.co

c# - Xamarin CalendarContract -

i'm creating calendar in xamarin forms using dependencyservice , creating events code: contentresolver cr = ((activity)forms.context).contentresolver; contentvalues values = new contentvalues(); var uri = calendarcontract.calendars.contenturi; values.put(calendarcontract.events.interfaceconsts.calendarid, id); values.put(calendarcontract.events.interfaceconsts.title, title); values.put(calendarcontract.events.interfaceconsts.description, description); values.put(calendarcontract.events.interfaceconsts.dtstart, getdatetimems(year, month, day, hour, minute)); values.put(calendarcontract.events.interfaceconsts.dtend, getdatetimems(year, month, day, hour, minute)); values.put(calendarcontract.events.interfaceconsts.allday, allday ? "1" : "0"); values.put(calendarcontract.events.interfaceconsts.hasalarm, hasalarm ? "1" : "0"); values.put(calendarcontract.events.interfaceconsts.eventtimezone, "gmt+" + zone + ":00"); value

c++ - How can I quickly printf 2 dimensional array of chars made of pointers to pointers without using a loop? -

Image
i'm making ascii game , need performance, decided go printf(). there problem, designed char array multidimensional char ** array, , printing outputs garbage of memory instead of data. know it's possible print loop performance rapidly drops way. need printf static array[][]. there way? i did example of working , notworking array. need printf() work nonworking array. edit: using visual studio 2015 on win 10, , yeah, tested performance , cout slower printf (but don't know why happening) #include <iostream> #include <cstdio> int main() { const int x_size = 40; const int y_size = 20; char works[y_size][x_size]; char ** notworking; notworking = new char*[y_size]; (int = 0; < y_size; i++) { notworking[i] = new char[x_size]; } (int = 0; < y_size; i++) { (int j = 0; j < x_size; j++) { works[i][j] = '#'; notworking[i][j] = '#'; } works[i][x_size-1

r - dcast restructuring from long to wide format not working -

my df looks this: id task type freq 3 1 2 3 1 b 3 3 2 3 3 2 b 0 4 1 3 4 1 b 3 4 2 1 4 2 b 3 i want restructure id , get: id b … z 3 5 3 4 4 6 i tried: df_wide <- dcast(df, id + task ~ type, value.var="freq") and got error: aggregation function missing: defaulting length i can't figure out put in fun.aggregate . what's problem? the reason why getting warning in description of fun.aggregate (see ?dcast ): aggregation function needed if variables not identify single observation each output cell. defaults length (with message) if needed not specified so, aggregation function needed when there more 1 value 1 spot in wide dataframe. an explanation based on data: when use dcast(df, id + task ~ type, value.var="freq") get: id task b 1 3 1 2 3 2 3 2 3 0 3 4

php - How do I separate the while loop search results from the footer position? -

the logical error here footer's margin position affected while loop results. here's logical view of problem: https://www.dropbox.com/s/oxyt5o4pzmarome/before%20and%20after.png?dl=0 here's code: <div id="print_output1"> <?php $con=mysql_connect("localhost","root",""); mysql_set_charset("utf8", $con); if(!$con) { die("could not connect." .mysql_error()); } mysql_select_db("dictionary_enhanced", $con); if (isset($_post['word'])) { $search = $_post['word']; $search1=addslashes($search); $query = "select *" . " maranao, maranao_meaning, english, filipino, translate". " maranao.mar_id = maranao_meaning.mar_id , maranao.mar_id = translate.mar_id , filipino.fil_id = translate.fil_

parsing - How to identify the JAVACC parser unsuccessful programatically? -

in javacc, how check weather input file passed grammar or not? example, want print "filed parsed successfully" if whole file parsed parser, , if not want print "file parsing faild!" i'm pretty newbie javacc. please help try { parser.start() ; system.out.println("file parsed successfully.") ; } catch( parseexception ex ) { // syntax error system.out.println( ex.getmessage() ) ; } } catch( tokenmanagererror ex ) { // lexical error system.out.println( ex.getmessage() ) ; } } catch( throwable ex ) { // other error system.out.println( ex.getmessage() ) ; }

java - Unable to access parent project library(jar) in child module - Maven -

i have project called parent . type pom. there library ( ojdbc6.jar ) not available in public repository accessing via <systempath> can see in below pom.xml : <project> <modelversion>4.0.0</modelversion> <groupid>com.parent</groupid> <artifactid>parent</artifactid> <version>0.0.1-snapshot</version> <packaging>pom</packaging> <modules> <module>childmodule</module> </modules> <dependencies> <dependency> <groupid>com.oracle</groupid> <artifactid>ojdbc</artifactid> <version>6</version> <scope>system</scope> <systempath>${basedir}/lib/ojdbc6.jar</systempath> </dependency> </dependencies> <repositories> <repository> <id>in-project</id>

Red5 demo apps showing error -

i getting following while connecting red5 demo apps : netconnection.connect.closed [warn] [connectionchecker-1] org.red5.server.net.rtmp.rtmpconnmanager - connection gn0psgbze63tf has exceeded max inactivity threshold of 60000 ms [info] [nioprocessor-5] org.red5.server.net.rtmp.rtmpminaconnection - connection closed: [warn] [nioprocessor-5] org.red5.server.net.rtmp.rtmpminaiohandler - connection not found gn0psgbze63tf [error] [rtmpconnectionexecutor-3] org.red5.server.service.serviceinvoker - method getapplicationlist parameters [] not found in org.red5.server.context@4989fa8 [warn] [rtmpconnectionexecutor-3] org.red5.server.service.serviceinvoker - service not found: installer [warn] [connectionchecker-1] org.red5.server.net.rtmp.rtmpconnmanager - connection q6tfxyixbd4t4 has exceeded max inactivity threshold of 60000 ms [info] [nioprocessor-9] org.red5.server.net.rtmp.rtmpminaconnection - connection closed: [warn] [nioprocesso

Rdlc Report - Parameter -

i write windows form application in c#. in application have report parameter. need pass parameter report in int64 format. in rdlc have integer value report parameter. how can solve it? thanks. you can convert values string using str() function on main report , change report parameter in subreport string it worked me. hope helps

html - Php Error in_array() null given -

i followed tutorial on making web crawler app. pulls links page , follows them. have problem pushing foreach loop of links global variable. keep getting error says second variable in in_array should array set to. there there guys might see bugging code? error: in_array() expects parameter 2 array, null given html: <?php $to_crawl = "http://thechive.com/"; $c = array(); function get_links($url){ global $c; $input = file_get_contents($url); $regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>"; preg_match_all("/$regexp/siu", $input, $matches); $l = $matches[2]; $base_url = parse_url($url, php_url_host); foreach($l $link){ if(strpos($link, '#')){ $link = substr($link, 0, strpos($link, '#')); } if(substr($link, 0, 1) == "."){ $link

C++ cout string print its memory value -

i trying create keygen reversing challenges around there. decided try code in language don't know well, c++ i not sure how use pointers yet, thing implemented algorithm without them. problem print answer it's memory location instead string. char decrypt(char c, int position); int main(){ cout << "enter username:" << endl; string username; string answer[20] = ""; cin >> username; (int = username.length(); > 0; i--){ answer[username.length() - i] = decrypt(username[i-1],i); if (i == 0){ answer[username.length() +1] = '\0'; } } return 0; } char decrypt(char c, int position) { if (position == 4){ return '-'; } if (c > 'm'){ c -= 17; } else{ c += 21; } c ^= position; c ^= 2; return c; } if try print string username string , not memory location of username. i'm not sure going on.. hel

ajax - Implementing filters for search in my rails app -

i want create filters products in app not sure how that. on page products/ index display collection of products created form : = form_tag products_path, method: 'get', :remote => true, class: 'form-inline min-marged-top' || .form-group = check_box_tag :price = check_box_tag :weight = button_tag(type: 'submit', value: "go", class: 'btn btn-success') the idea when user ticks checkbox price or weight, products reordered price / weight. ajax form , why use :remote => true . first, noticed using checkbox_tag , value of checkboxes don't change when tick them or not : stay equal 1. shouldn't changing when checkbox ticked or not ? assuming value should equal 1 when checkbox clicked wanted in product_controller in method index (knowing can have params[:content] sent through search form) : def index if params[:content].present? && (params[:price] == &q

git - Gitstats commit_begin does not work -

i using gitstats on windows trying stats current month gitstats still returns stats untill time project created executing command: git log --since "1 month ago" this gives me month old commits until date, copy first commit_id , executing python gitstats.py -c commit_begin="commit_id_got_from_above" path_to_git_repo path_to_target my issue looks similar have tried how can total lines committed today in git?

get value in textbox from database according to seleceted dropdown item in php -

so i've change text box data according option selected in dropdown. want text box data fetched database. for eg: if choose airmail current frank value of airmail should displayed in text box database. here code <div> <form action="alertfrank.php" method="post" class="boxin" id="dropdown"> <select name="type_post" required id="type_post" > <option value="select post type" selected>select post type</option> <option value="airmail" >airmail</option> <option value="airmail ad">airmail ad</option> <option value="airmail speed post">airmail speed post</option> <option value="speed post">speed post</option> <option value="book post">book post</option> <option value="ord

postgresql - Added/updated pages in wrong place in Django CMS 3.0 (mptt) article tree using postgres -

for https://developer.ubuntu.com use django cms 3.0.6 (mptt) , we're happy it. recently added functionality import markdown docs bzr branches of projects, can have cronjobs update articles whenever things changed in of upstream projects interested in. took me time complete it, got working. locally used sqlite (the default) , happy. once deployed staging, import worked well, articles added or updated script ended in different place in article tree. after time reproduce local postgres installation. we tracking issue here: https://bugs.launchpad.net/developer-ubuntu-com/+bug/1506861 i'm bit lost , don't quite know how debug this. i put test-case , it's basically: $ bzr branch lp:~developer-ubuntu-com-dev/developer-ubuntu-com/debug-md-importer $ cd debug-md-importer $ virtualenv ./env $ ./env/bin/pip install -r requirements.txt $ ./env/bin/pip install django psycopg2 then apply diff http://pastebin.ubuntu.com/12798510/ developer_portal/settings.py , run

android EditText disable spell check and leave multiline -

i have edittext intended multiline. a default input type performs spell checking , red lines drawn below edittext if word "incorrect". i want disable feature. tried android:inputtype="textnosuggestions" , edittext no longer multiline. please tell me possible solutions. add this: android:inputtype="textmultiline|textnosuggestions"

php - Unable to authenticate mongoDB -

from mongo client looks can authenticate: > use admin switched db admin > db.auth('admin','secretpassword'); 1 > but when trying connect in config file in codeigniter code $config['mongo_server'] = null; $config['mongo_dbname'] = 'admin'; $config['mongo_db']['active'] = 'default'; $config['mongo_db']['default']['no_auth'] = false; $config['mongo_db']['default']['hostname'] = 'localhost'; $config['mongo_db']['default']['port'] = '27017'; $config['mongo_db']['default']['username'] = 'admin'; $config['mongo_db']['default']['password'] = 'secretpassword'; $config['mongo_db']['default']['database'] = 'mydb'; $config['mongo_db']['default']['db_debug'] = true; $config['mongo_db']['default']

xcode7 - Xcode 7 error when pushing changes -

Image
i have faced problem when try push changes of project when used xcode 7, 7.0.1, 7.1,and lately 7.3 see screenshot: that never happened on xcode 6.xx, when updated xcode 7 occurred, please provide me suggestion or answer possible. enter required ccredentials or select authentication method. "authentication" drop-down menu can select "user name , password" or "ssh keys". i use ssh keys, select option , click "ok". some form of authentication has been required push repository.

java - Error when connecting to URL - PKIX path building failed -

Image
i trying connect webpage gather information, , using jsoup parse html. however, whenever try connect url download source, error saying pkix build path. i've looked around, , i've found says add website's ca root certificate truststore, did, problem persists (the ca root cert there). able connect website through web browser, not through url class. here basic code write produce error. public class urlconnectstart { public static void main(string[] args) { try { url u = new url("https://ntst.umd.edu/soc/"); u.openstream(); } catch (malformedurlexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } } } here error javax.net.ssl.sslhandshakeexception: sun.security.validator.validatorexception: pkix path building failed: sun.security.provider.certpath.suncertpathbuilderexception: unable find valid certification path requested target @

javascript - Binding different this scope to ES6 => function operator -

after experimenting inheriting contexts => feature es6 gives noticed context can never changed. example: var othercontext = { a: 2 }; function foo() { this.a = 1; this.bar = () => this.a; } var instance = new foo; instance.bar(); // returns 1 instance.bar.bind(othercontext)(); // returns 1 without => operator , using function keyword: function foo() { this.a = 1; this.bar = function () { return this.a; } } var instance = new foo; instance.bar(); // returns 1 instance.bar.bind(othercontext)(); // returns 2 therefore, if receive function external call or have function in variable, how can sure if going able bind different or if inherit somewhere? it sounds dangerous javascript not tell anything, 1 might fall subtle , difficult bug. it new syntax bind , doesn't introduce new in way of gotchas. var othercontext = { a: 2 }; function foo() { this.a = 1; this.bar = function () { return this.a }.bind(this); } var inst

scons - Builder with optional source -

i want make builder 1 or more optional sources. i tried this: env.append(builders = {'my_builder': builder(action = action(do_something))}) def do_something(target, source, env): if source[1]: do_optional_stuff(source[1]) do_other_stuff(target, source[0]) ... env.my_builder(target.txt, [source1, none]) # fails env.my_builder(target.txt, [source2, source3]) # okay the trouble is, 'nonetype' object has no attribute 'get_ninfo' when pass in none, because scons expecting node arguments, , none isn't acceptable. is there can do? edit: as noted in answer below, it's possible solve simple case of 1 optional argument, varying length of source list. doesn't work making arbitrary arguments optional, i'd still interested in way that. instead of adding bogus element, check length of source list (or better yet, iterate on list starting after first element): def do_something(target, source, env): if len(

java - Selenium WebDriver - Auto Download on Firefox -

i try automate download firefox, using selenium webdriver in java. unfortunately, have found lot of answers strangly not working in code. i tried profile.setpreference("browser.download.folderlist", 2); profile.setpreference("browser.download.manager.showwhenstarting", false); profile.setpreference("browser.download.dir", "d:\\"); profile.setpreference("browser.helperapps.neverask.openfile","application/msword, application/csv, application/ris, text/csv, image/png, application/pdf, text/html, text/plain, application/zip, application/x-zip, application/x-zip-compressed, application/download, application/octet-stream"); profile.setpreference("browser.helperapps.neverask.savetodisk", "application/msword, application/csv, application/ris, text/csv, image/png, application/pdf, text/html, text/plain, application/zip, application/x-zip, application/x-zip-compressed, application/download, application/octet-strea

wpf - ComboxEdit that display many members of ObservableCollection -

i want display data in comboboxedit; example have model contains public class foo { public long id{get ; set ;} public string firstname {get ; set ;} public string lastname{get ; set ;} public string town {get ; set ;} } i have observablecollection contains many rows of model. in view, want display comboboxedit showing firstname , lastname columnfilter also. else used? all examples welcome. use lookupedit instead: <window ... xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid" xmlns:my="clr-namespace:mynamespace" ...> <window.resources> <window.resources> <my:myobservablecollection x:key="myobservablecollection" /> </window.resources> ... <dxg:lookupedit autopopulatecolumns="false" itemssource="{binding path=data, source={staticresource myobservablecollection}}" valuemember="id" displaymember="id"> <dxg:lo