Posts

Showing posts from April, 2012

c++ - Error message/Vector of user input numbers -

here error getting: exercise11.cxx:29:13: error: invalid operands binary expression ('ostream' (aka 'basic_ostream') , 'vector') #include <iostream> #include <vector> #include <iomanip> using namespace std; int main() { cout << "kaitlin stevers" << endl; cout << "exercise 11 - vectors" << endl; cout << "november 12, 2016" <<endl; cout << endl; cout << endl; int size; cout << " how many numbers vector hold? " << endl; cin >> size; vector<int> numbers; int bnumbers; (int count = 0; count < size; count++) { cout << "enter number: " << endl; cin >> bnumbers; numbers.push_back(bnumbers); } //display numbers stored in order cout << "the numbers in order are: " << endl; for(int i=0; < size; i++) { ...

java - Undertow X.509 Being Stripped? -

my embedded undertow server isn't receiving javax.servlet.request.x509certificate on resource endpoint (rest), though have ssl enabled trust store , key store configured sslcontext. code // setup our server , server builder undertow server = new undertowjaxrsserver(); serverbuilder = undertow.builder() .setserveroption(options.ssl_enabled, true) .setserveroption(options.ssl_client_auth_mode, sslclientauthmode.requested) .addhttpslistener(port, host, sslcontext); also in endpoint should recieve request x.509 cert attached @post @consumes(mediatype.application_json) @produces(mediatype.application_json) @path("/gettestjsonclientsideauth/") public testmodel gettestjson(@context httpservletrequest request, testmodel testmodel) throws unauthorizedcertificateexception { not quite sure missing. appears stripping x.509 allowing request go through. want endpoints require ssl so, set r...

Apache Tomcat 8.0 Server Endpoint Websocket Error 404 -

Image
i've got static contents served correctly, web socket using @serverendpoint doesn't work. use apache-tomcat-8.0.37, eclipse j2ee. my javascript code tries make websocket connection gets error: websocket connection 'ws://localhost:8080/chessclock/websocket/clock' failed: error during websocket handshake: unexpected response code: 404 in network tab says 0 bytes received. what problem here? here error got (on google chrome): my server endpoint class: package clock; import java.io.ioexception; import javax.websocket.endpointconfig; import javax.websocket.onmessage; import javax.websocket.onopen; import javax.websocket.session; import javax.websocket.server.serverendpoint; @serverendpoint("/websocket/clock") public class clockendpoint { @onopen public void handleopen(endpointconfig endpointconfig, session session) { system.out.println("incoming connection " + session.getid()); try { session.getbasi...

MSChart SuspendUpdates not working -

i trying use series.suspendupdates prevent redrawing on every added data point although doesn't seem doing anything. still repaints every added point if nothing suspended. it works fine here. show code! note there no someseries.suspendupdates , someseries.points.suspendupdates() or somechart.series.suspendupdates() as function works on chartelementcollections . see here msdn also note keep track of suspendupdates , resumeupdates calls state gets stacked , need balance them: if call suspendupdates method several times, need call resumeupdates method equal number of times.

database - Session Id's are inconsistent across multiple php files -

i have created 2 simple php files populates data entered users database. using sessions , have entered session_start(); in php files @ first line (no commented line @ top). however, code works in local server (mamp) when host online public access face problem. code works fine i.e session id remains same, second php file creates different session id's , hence data first php file gets entered database. please me out may cause in inconsistency in sessions? <-- code first php--> <?php session_start(); $val = session_id(); echo ($val); define ('db_name', 'roze'); define('db_user', 'root'); define('db_password', 'good'); define('db_host', 'localhost'); $link = mysql_connect(db_host, db_user, db_password); if (!$link) { die('could not connect: ' . mysql_error()); } $db_selected = mysql_select_db(db_name, $link); if (!$db_selected) { die('cannot use' . db_name . ': ' . mysql_error...

lambda - Java8 how to use stream map with multiple fields -

i have pojo looks this: public class record { private string description; private int score; private int multiple; // more data members // usual getters , setters } public class mykey { private string description; private int score; // usual getters , setters } record [] records= { new record (1/*score*/, "jack"), new record (2, "smith"), new record (12, "jill") }; list<record > list = arrays.aslist(records); // trying create map based on // part dont know how // how create map of key // description , score , make map map<key, list<record>> map = list.stream() .map(/*how write lambda or function here*/) .foreach(get()); how create map mykey key , record being data portion of map? you use collect groupingby -collector : record [] records= { new record (1/*score*/, "jack"), new record (2, "smith"), new record (12, "jill...

android - SQLITE - query integer field based on a bit -

is there function, trick, hack make query retrieves values table integer field has special bit set? no, there no function, trick, or hack. have use normal operators instead: select * mytable somecol & (1 << 5) != 0;

php - cURL Login and set sessions -

http://example.com/auth/signin?email=name@example.com&password=test123 that page prints xml code, { "token": "exampletoken", "user": { "email": "name@example.com", "hosturl": "http://example.com/admin", "schema": "example", "firstname": "", "lastname": "", "photo": "", "id": 1, "createdat": "2016-13-28t14:45:23.000z", "updatedat": "2016-13-28t14:45:23.000z" } } and want set token session , html://example.com/admin/index.php contents get_file_contents.

segmentation fault - linked list segfault error. c -

i have write code makes linked list. following code below. problem segfaulting somewhere in code , can't figure out where. if me find , understand (that's important part) segfault coming from, appreciated. #include "linkedlist.h" #include <stdio.h> #include <stdlib.h> /* alloc new node given data. */ struct listnode* createnode(int data) { struct listnode *new_node = (struct listnode *)malloc(sizeof(struct listnode)); new_node->data = data; new_node->next = null; return new_node; } /* insert data @ appropriate place in sorted list, return new list head. */ struct listnode* insertsorted(struct listnode* head, int inputdata) { struct listnode * nextis = null; struct listnode * newnodeis = null; struct listnode * curris = head; struct listnode * listheadis = curris; if (curris == null) { listheadis = createnode(inputdata); return listheadis; } while (curris->next != null) {...

vue.js - Laravel Validation with vue js -

i want post ajax request using vue-resource this.$http.post request. worked fine if passed validation rules want validations if fails. far keep getting 500 error if don't fill out input fields. it's hard me debug error because didn't appeared on network tab. here's i've done far //my modal component <script> export default { props: ['show'], data() { return { input: { id: '', name: '', address: '', email: '' }, errorinputs: {} } }, methods: { createstudent() { this.$http.post('/students', this.$data.input) .then((response) => { alert('added new row!) }, (response) => { console.log(response.data); }); } } } </script> // controller public function sto...

javascript - How to preventDefault and disable a href -

on first click button click function works, upon clicking again refreshes page click unbind isn't recognized. need prevent default click event disable button after click. <a href="" class="red-btn2">save property</a> $(".red-btn2").click(function(event){ event.preventdefault(); $(this).unbind('click'); $(this).css({ 'background-color':'#666666', 'text-align':'center' }); $(this).text("added favorites"); }); if need rest of handler run once, preventdefault() always, can separate them multiple handlers. then, 1 of them can removed after first use (using jquery's .one() cover you), still leaving preventdefault() in use: $('.red-btn2') .click(function (event) { event.preventdefault(); }) .one('click', function () { $(this).css({ 'background-color':'#666666', 'text-align'...

javascript - Possible to delete nodes on new page? -

when clicking "slow download" on this page gives overlay modal covers screen id's superbox-wrapper , superbox-overlay . can remove them in chrome developer tools deleting them. right have follow code clicks on "slow download" button. function skipid(objid){ var oid = document.getelementbyid(objid); oid.click(); } window.onload = function(){ skipid('slow-download'); }; i have tried remove them by document.getelementbyid('superbox-wrapper').hide(); document.getelementbyid('superbox-overlay').hide(); var element = document.getelementbyid("superbox-wrapper"); element.outerhtml = ""; delete element; function remove(id) { var elem = document.getelementbyid(id); return elem.parentnode.removechild(elem); } remove('superbox-wrapper'); getelementbyid('superbox-wrapper').remove(); question how can remove superbox-wrapper , superbox-overlay ? based on @brock adam...

javascript - Looping through coordinates in Mapbox -

i'm pretty new coding code may wrong. i'm using flyto feature in mapbox fly city city. want fly multiple cities clicking on button. i've created array coordinates want fly to, code doesn't seem working. can me went wrong? thanks! here's page on how use feature: https://www.mapbox.com/mapbox-gl-js/example/flyto/ . var arrayofcoords = [[-73.554,45.5088], [-73.9808,40.7648], [-117.1628,32.7174], [7.2661,43.7031], [11.374478, 43.846144], [12.631267, 41.85256], [12.3309, 45.4389], [21.9885, 50.0054]]; document.getelementbyid('fly').addeventlistener('click', function () { if(i = 0; < arrayofcoords.length; i++) { map.flyto(arrayofcoords[i]); }); }); welcome stackoverflow! here's how "fly" 1 coordinate next coordinate on each button click. note when reached last coordinate, next button click bring first one. mapboxgl.accesstoken = '<your access token here>'; var map = new mapboxgl.map({ container: ...

java - ANDROID: Update data in another activity in Master Detail Flow Layout -

i've searched solution question on internet haven't been able find 1 , hope can me out i trying create master detail flow application in android 2 activities , second activity contains fragment. can please tell me how can simultaneously update value in mainactivity() when make change in fragment's edittext field? have tried using intent when 2 activities side side doesnt seem work well. screenshot of emulator any suggestions? it seems in context follows: when happens, triggers b as result, suggest use eventbus library in project. the installation easy. first, add following code in build.gradle file: compile 'org.greenrobot:eventbus:3.0.0' second, let's see going add in our codes. in fragment wanted make changes: /* when happens */ mybutton.setonclicklistener(new view.onclicklistener() { // complete entering content, update eventbus.getdefault.post(myupdateevent(mycontent)); }); create custom class myupdateeven : pu...

javascript - Printing to text area -

how preset values in table using javascript? <u><h1>rabbits vs foxes population model</h1></u> <form name = "rabbits"> <table border = "3"> <tr><td>no. of rabbits</td><td><center><input type="number" id="no_rabbits" /></center></td></tr> <tr><td>death rates</td><td><center><input type="number" id="death" /></center></td></tr> <tr><td>birth rates</td><td><center><input type="number" id="birth" /></center></td></tr> <tr><td>no. of foxes</td><td><center><input type="number" id="foxes" /></center></td></tr> <tr><td>rabbit conditions</td><td> normal <input type="radio" name=...

python - Thread Priority in Apscheduler? -

i have background job need run every part of main process responds incoming requests. background job runs thread through apscheduler , updates memory main process. not need prioritized , doesn't matter if takes long time finish. main process, on other hand, needs process requests coming in fast possible. there way run background job giving small amount of cpu , giving main process priority on it? seems nice , of ilk won't work threads, perhaps there's other way limit total cpu usage thread?

android - Insert in SQLite database returns BLOB -

i try synchronize web's database phone's local database , inserts rows no problem, when check db string values blobs... couldn't figure out went wrong... here code example table "users" (it's spread in various classes collected relevant parts): table creation: string users = "create table users(id integer primary key, name varchar not null, username varchar not null, mail varchar not null, password varchar not null);"; db.execsql(users); getting , sending data: public void getusers() { connectivitymanager connmgr = (connectivitymanager) getsystemservice(context.connectivity_service); networkinfo networkinfo = connmgr.getactivenetworkinfo(); if (networkinfo != null && networkinfo.isconnected()) { thread thread = new thread(new runnable() { @override public void run() { persistence consulta = new persistence(); final string resp; string r...

asp.net web api - NHibernate returning results from Web API -

i'm using nhibernate fetch collection has lazy loaded properties having trouble returning serializer tries serialize lazy property after nhibernate session closed. there way tell nhibernate give me true list in if there unloaded lazy collections leave them empty? for example ienumerable<store> stores = storeservice.getlist(1, 2); store has one-to-many mapping stockitems set lazy load causes serialization error. tried list<store> stores_r = stores.tolist(); but same thing. there traverses through list , fetches one-to-one relations , ignores one-to-many lazy loading , return finished list? thanks edit:solution i've tried still not working public class nhibernatecontractresolver: defaultcontractresolver { protected override jsoncontract createcontract(type objecttype) { if (typeof(nhibernate.proxy.inhibernateproxy).isassignablefrom(objecttype) || typeof(nhibernate.proxy.ilazyinitializer).isassignablefrom(objecttype)) { ...

javascript - How to customize the message "Changes you made may not be saved." for window.onbeforeunload? -

i testing in google chrome. i did search , found using: window.onbeforeunload = function() { if (hook) { return "did save stuff?" } } but when use it, still got "changes made may not saved." message. how can change want? thanks! you can't, ability removed in chrome 51. considered security issue, , vendors have removed support. custom messages in onbeforeunload dialogs (removed) : a window’s onbeforeunload property may set function returns string. if function returns string, before unloading page, dialog shown have user confirm indeed want navigate away. string provided function no longer shown in dialog. rather, generic string not under control of webpage shown. comments this shipped in safari 9.1, , has been shipping in firefox since firefox 4. safari considers security fix , assigned cve-2009-2197 (see https://support.apple.com/en-us/ht206171 ). approved intent https://groups.google.com/a/chromium.or...

r - Recreate raw probabilities produced by multinom function -

i wanting use coefficients multi-nomial model create related probabilities manually each class of interest. way can score data observation within database using sql. using nnet package , working through example found. this example uses hsbdemo data set , outcome variable program type attempts classify 3 classes- general/academic/vocation. library("foreign") library("nnet") ml <- read.dta("http://www.ats.ucla.edu/stat/data/hsbdemo.dta") test <- multinom(prog2 ~ ses + write, data = ml) summary(test) now fits model , produces following coefficients: ## call: ## multinom(formula = prog2 ~ ses + write, data = ml) ## ## coefficients: ## (intercept) sesmiddle seshigh write ## general 2.852198 -0.5332810 -1.1628226 -0.0579287 ## vocation 5.218260 0.2913859 -0.9826649 -0.1136037 ## ## std. errors: ## (intercept) sesmiddle seshigh write ## general 1.166441 0.4437323 0.5142196 0.02141097 ## vocation ...

sql - Mysql: How I can Do this by update mysql query? -

alsalamo alikom i have value price ex: 1000 , have rows in table ex: id price 1 100 2 200 3 300 4 600 mysqli_query($connect,"update table set price = 1000-price price >0 "); // wrong and want after update mysql id price 1 0 2 0 3 0 4 200 1 0 becouse 100<1000 price =1000-100=900 column=0 2 0 becouse 200<900 price =900-200=700 column=0 3 0 becouse 300<700 price =700-300=400 column=0 4 200 price =400-400=0 column=200 becouse 600>400 drop table if exists t; create table t(id int, price int); insert t values (1, 100), (2, 200), (3, 300) , (4, 600); select id, if(price < running_total, 0,running_total) price ( select id,price, if(@running_total > price ,@running_total := @running_total - price, price - @running_total) running_total (select @running_total:=1000) rt,t ) s result +------+-------+ | id | price | +------+-------+ | 1 | 0 | | 2 | 0 | | 3 | 0 | | 4 | 20...

How to create subfolder inside app directory (not root) on android device with cordova -

i have created subfolders in app folder in root (which not visible), want create subfolders visible app directory (that folder can see when enter in file explorer). have donde following in on device ready event: window.requestfilesystem(localfilesystem.persistent, 0, create_subfolder, function(){alert('error');}); the create_subfolder function is: function create_subfolder(filesystem) { var entry = filesystem.root; //is possible specify here location? entry.getdirectory( "audios", {create: true, exclusive: false}, function(){}, function(){alert('error');} ); }

jquery - Can't get Bootstrap Modal to show each JSON record -

Image
the idea here click value select dropdown press submit , php retrieves records mysql saving json encoded variable use jquery access each record display each 1 modal 30 seconds before modal shows next record. i have form working, php call mysql , have json variable data. have bootstrap modal, , show header, not body of record trying display 2 of fields - "name" , "description". can see records in modal body in p element #name id, when click on inspect, won't go in modal. <?php require_once('../admin/login.php'); $conn = login(); if(isset($_post['type'])) { $type = $_post['type']; $query = ("select * exercise type = '$type'"); $result = $conn->query($query); $row = $result->fetch_all(mysqli_assoc); } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initia...

Countin words from one file, in another Python -

i trying count amount of times words file shows in file. directed link below, of assistance still isn't doing desired duty. can me? https://codereview.stackexchange.com/questions/144074/program-to-count-vowels def count_happyw(file): hap_count = 0 hwords in file.readlines(): line = file.readline() while line != "": item in hwords: if item in file: count_happyw[item] += 1 return hap_count i tried line = file.readline() total = 1 * [len(h_words) line in file.readline()] token in file.readlines(): while line != "": line = file.readline() item in h_words: if item in file: total = [1] * len(item) 
 yourwords.txt contains words searching space separated, contents: apple orange bananna yourfile.txt file search in: apple orange bananna an apple on orange t...

reverse engineering - Difference between bound imports and delayed imports in PE header -

could 1 please explain differences between bound imports , delayed imports in pe header.i have referred few books cannot understand concept of clearly.can me out. bound imports means in pe-import table store fixed (bounded) addresses of import functions specific version of dll function. bounded addresses calculated , written import table linker during program compilation , linking phase. delayed imports means in import table instead of import functions addresses contains addresses of special program part called "delay load helper" (sometimes called "thunk"), substitutes real imported function address when function called first time. , subsequent function calls use real function address written delay load helper. it concept. details can find in iczelion's pe tutorial, example

bisonc++ - Errors installing icmake -

i'm trying install 'icmake' precursor installing flexc++ , bisonc++. here instructions git https://github.com/fbb-git/icmake/blob/master/icmake/install . i'm stuck @ tmp/install.sh not exist. try running icm_prepare script repeatedly, ad nauseam. know this? it's not used , have found 0 info online. emailed admin of repo. thanks. p.s. no icmake tag tagging flexc++ , bisonc++, maybe case.

Copy nearest select box value of a given class name to following select box of same class name (using JQuery) -

what i'm trying is: on html sample below, when user clicks "copy above", want jquery search 'up' html structure click location, find previous select box class="colors" , copy selected value from select box , use select same value in select box below (also class="colors" ). every select box has same set of values. sample html: <select class="colors"> <option value="1">red</option> <option value="2">blue</option> <option value="3">green</option> </select> <a href="#" class="copy-times">copy above</a> <select class="colors"> <option value="1">red</option> <option value="2">blue</option> <option value="3">green</option> </select> <a href="#" class="copy-times">copy above</a> <select class="co...

matlab on HTK read -

i use htk toolkit extract feature(.mfc format),and want use matlab read feature file. use code written alexis bernard function [ data, htkcode ] = htkread( filename ) fid=fopen(filename,'r','b'); if fid<0, error(sprintf('unable read file %s',filename)); end % read number of frames nsamp = fread(fid,1,'int32'); % read sampperiod sampperiod = fread(fid,1,'int32'); % read sampsize sampsize = fread(fid,1,'int16'); % read htk code htkcode = fread(fid,1,'int16'); % read data if bitget(htkcode, 11), dim=sampsize/2; nsamp = nsamp-4; disp(sprintf('htkread: reading %d frames, dim %d, compressed, %s',nsamp,dim,filename)); % read compression parameters = fread(fid,[1 dim],'float'); b = fread(fid,[1 dim],'float'); % read , uncompress data data = fread(fid, [dim nsamp], 'int16')'; data = (repmat(b, [nsamp 1]) + data) ./ repmat(a, [nsamp 1...

validation - Angular 2 Custom Validator with Observable Parameter -

i have custom validator: export const mealtypesvalidator = (mealselected: boolean) => { return (control: formcontrol) => { var mealtypes = control.value; if (mealtypes) { if (mealtypes.length < 1 && mealselected) { return { mealtypesvalid: { valid: false } }; } } return null; }; }; if use works: ngoninit() { this.findform = this.formbuilder.group({ categories: [null, validators.required], mealtypes: [[], mealtypesvalidator(true)], distancenumber: null, distanceunit: 'kilometers', keywords: null, }); } the catch is, mealselected property on component - changes when user selects , deselects meal. how call validator above using static true can never change. how can validator work when use component.mealselected value parameter eg: ngoninit() { this.findform = this.formbuilder.group...

How to prevent launch Ionic app on emulator -

i'm working on ionic app , i'm trying run app on real android device, when run ionic run android in terminal, following error: running command: "c:\program files (x86)\nodejs\node.exe" d:\wamp\www\pars-app\pars-app\hooks\after_prepare\010_add_platform_class.js d:\wamp\www\pars-app\pars-app add body class: platform-android android_home=d:\sdk\android-sdk java_home=c:\program files\java\jdk1.8.0_45 no target specified, deploying emulator error running 1 or more of platforms: no emulator images (avds) found. 1. download desired system image running: "d:\sdk\android-sdk\tools\android.bat" sdk 2. create avd running: "d:\sdk\android-sdk\tools\android.bat" avd hint: faster emulator, use intel system image , install haxm device driver you may not have required environment or os run project how prevent run app on windows emulator? want run app on real device conected computer. i using windows 8 ...

html - php encoding snippet and displaying correct format after download -

i have php code write snippet inside file in root directory, when writing file encode using htmlentities($_post['filecontentcode'], ent_quotes, "utf-8"); when owner want view use php code read file , display using parameter root/index.php?read=demo.html face big problem don't know how fix when thought have solution still not. my problems 1 when users try access root/demo.html browse file direct instead of using view option give, there way denied them access browsing file direct except few want browse using htaccess or php? 2 thou when browse direct not run html or execute program write because encoded htmlentities($_post['filecontentcode'], ent_quotes, "utf-8"); before writing file bigger problem come when download file display in format bellow &lt;!doctype html&gt; &lt;html lang=&quot;en&quot;&gt; &lt;head&gt; &lt;title&gt;index &lt;/title&gt; this what don't...

java - Android insert text to xhtml file on the fly -

i create fixed template application store on assets folder (template.xhtml) , want use file after user finish edit data , need replace data in body tag data on fly. every time want use file copy file assets folder internal folder in application. xhtml file this: (example) <html> <head> </head> <body> ~dedication~ </body> </html> what want replace "~dedication~" string after user finish edit file. i'd love know how analyze file , how replace text. thank can help. :)

go - Multiple structs with different composition -

i have problem not sure how solve in go. need make client talks json based api. so thought use composition build struct similar below. type ( basedata struct { commonfields string } data struct { basedata result string } ) now send data struct api , unmarshal response results, far. now issue have different requests send require different "results" composition , therefore need have many definitions of data struct in same package, no good. i struggling see how should done. pointers in direction great. do not create model structure mirrors or imitates api want use. design model in way makes sense program, following ddd principles @ high conceptual level, , solid principles @ implementation level, example. most probably: you don't need features of foreign api. adhering structures, implement lot of boilerplate serves no purpose of own in program. you don't want program break down due minor changes in f...

java - How can I compare the string with the keys in hash map -

i having difficulties compare string ( str ) keys in hashmap. can see below code, have multiple keys. comparing str keys couldn't values specific key. please note map contains coin . it works if directly input string eg entry.getkey().getkeyone().tostring().contains("coin") string str = "coin"; for(map.entry<pair, string> entry : map.entryset()) { if(entry.getkey().getkeyone().tostring().contains(str)|| entry.getkey().getkeytwo().tostring().contains(str)) { entry.getvalue(); } } public class pair { private string keyone; private string keytwo; pair(string one,string two) { this.keyone=one; this.keytwo=two; } public string getkeyone() { return keyone; } public string getkeytwo() { return keytwo; } } advice: long using own class pair in map must override equals() , should override hashcode() . you example string literal works, because ...

java - Spark ml and PMML export -

i know it's possible export models pmml spark-mllib , spark-ml ? is possible convert linearregressionmodel org.apache.spark.ml.regression linearregressionmodel org.apache.spark.mllib.regression able invoke topmml() method? you can convert spark ml pipelines pmml using jpmml-sparkml library: structtype schema = dataframe.schema() pipelinemodel pipelinemodel = pipeline.fit(dataframe); org.dmg.pmml.pmml pmml = org.jpmml.sparkml.converterutil.topmml(schema, pipelinemodel); jaxbutil.marshalpmml(pmml, new streamresult(system.out));

sql - Error: Table 'django_db.polls_question' doesn't exist [SQLCode: 1146], [SQLState: 42S02] -

i following tutorial on https://docs.djangoproject.com/en/1.10/intro/tutorial02/ . i have reached section : playing api¶ once you’re in shell, explore database api: >>> polls.models import question, choice # import model classes wrote. # no questions in system yet. >>> question.objects.all() this gives error : error: table 'django_db.polls_question' doesn't exist [sqlcode: 1146], [sqlstate: 42s02] before above error : prints : >>> traceback (most recent call last): file "<console>", line 1, in <module> file "/usr/local/lib/jython/lib/site-packages/django-1.8.16-py2.7.egg/django/db/models/query.py", line 138, in __repr__ data = list(self[:repr_output_size + 1]) file "/usr/local/lib/jython/lib/site-packages/django-1.8.16-py2.7.egg/django/db/models/query.py", line 162, in __iter__ self._fetch_all() file "/usr/local/lib/jython/lib/site-packages/django-1.8.16-py2.7.eg...

postgresql - How to save google.maps.Data.MultiPolygon to geometry datatype column in postgres database in rails? -

i beginner in rails framework, please pardon naive question. have google.maps.data.multipolygon object on frontend want save in database. table searches creates new entry everytime user searches, contains different columns out of have added column datatype :geometry , updated when user draws polygon @ specific search. need update search entry in database, using put call. cannot send whole google.maps.data.multipolygons object on put call, since $.params() unable serialise object (this problem same faced here ). var polygons = new google.maps.data.multipolygon([polygon]); var search_params = $.param({search: $.extend(this.state.search, {user_id: request.user_id, search_type: search_type})}); request.put('searches/'+this.state.search['id'], search_params, function(){}); uncaught typeerror: cannot read property 'lat' of undefined(…) so, need send array of location objects. there specific format in array of location object directly converted geometry ...

c# - Bootstrap Carousel with Repeater shows all slides one by one i want to display it 3 items by one -

i using bootstrap carousel slider script inside repeater not working proper.i have projects database table want display projects in slide 3 project 1 slider each slide has 3 project . code display 1 project per slide don't know how make please me . each slide : 1 2 3 second 1 4 5 6 @ same row slider this link has same slide want slider want it <!-- begin carousel --> <div class="row"> <div id="realto-carousel-afee" class="carousel slide"> <div class="carousel-navigation pull-right"> <a class="serif italic pull-left view-all-carousel" href="properties-grid-layout-2">all</a> <a class="left carousel-control pull-left" href="#realto-carousel-afee" data-slide="prev"><i class="fa fa-angle-left"></i></a> <a class="right carousel-control pull-right" href="#realto-carousel-afee" data-slide...

Android GPS location problems -

i have problem setting current location gps. works should(notification finding location, set properly) on android 5.0.1(xiaomi redmi note 3) example on android 6.0 (sony xperia z5 compact) doesn't work @ all. no notification, gps position set never. on xperia don't have button on right of map showed line in code(mmap.setmylocationenabled(true);) on android 4.4.2(gigabyte gsmart roma r2plus) no notification comes up, can see button of current location on right on top of screen. still doesn't work should. @override public void onmapready(googlemap googlemap) { mmap = googlemap; if (activitycompat.checkselfpermission(this, android.manifest.permission.access_fine_location) != packagemanager.permission_granted && activitycompat.checkselfpermission(this, android.manifest.permission.access_coarse_location) != packagemanager.permission_granted) { // todo: consider calling // activitycompat#requestpermissions // here request missin...

php - Laravel 5.3 - Custom API Guard -

i have 2 endpoint : route::get('user', function () { $data = ...; return response()->json($data); }); route::get('user-premium', function () { $data = ...; return response()->json($data); }); in user-premium, ii need restrict aaccess token (but don't want use jwt or database) i plan use env variable, api_token=xxx so, how make custom guard base on env variable my goal request /api/user-premium/?token=xxx , xxx value env variable i think looking this in short: add api_token column user table wrap routes auth::api middleware get logged user auth::guard('api')->user() update app\http\middleware\authenticate handle $request->wantsjson()

node.js - Split mail correspondence into parts using NodeJS -

using mailin.io receive emails , works great. using example combines multipary parse incoming emails ( example ). however, can't find way split email correspondence (email-replay-forward--- etc) it's unit parts. specifically, need way extract last message , it's content (as html or text). have tried emailreplayparser didn't work me. thanks!

embed local pdf in iframe for kmls -

i've been looking way open locally stored pdfs within google earth environment via kmls. so firstly this link shows how embed , open online-based pdfs within within placemarks in google earth, use of iframes (that example works). secondly, this link described how reference locally stored pdf on computer in iframe... after testing few variations, still doesn't work?? this code, "heading.pdf" , placemarker icon "broadcast_trans.gif" stored in same directory kml file: <?xml version='1.0' encoding='utf-8'?> <kml xmlns='http://www.opengis.net/kml/2.2'> <document> <folder> <name>trip 1_2 route</name> <placemark> <name>131 gelding avenue, roodepoort</name> <description><![cdata[trip 1, measured 2015/09/04]]></description> <styleurl>#icon-1899-db4436-nodesc</styleurl> <point> <coordinates>27.856078,-26.0839504...

cocoa IKImageBrowserView memory management -

Image
i use ikimagebrowserview in application, if add many photos on application stops working , in profiler see allocated memory high.. need optimize somehow . here browseritem : public class browseitem : ikimagebrowseritem { // ..... public override nsstring imagerepresentationtype { { return ikimagebrowseritem.nsurlrepresentationtype; } } public override nsobject imagerepresentation { { return nsurl.fromfilename (_path); } } } and data source: public class browsedata : ikimagebrowserdatasource { string _arrangeby; list<browseitem> images; list<string> dategroup { get; set; } public override void invoke (action action, double delay) { base.invoke (action, delay); } public browsedata (string arrangeby) : base () { _arrangeby = arrangeby; images = new...