get

Django DRF ListField to deserialize list of ids in GET's queryparams

余生颓废 提交于 2019-12-11 13:43:37
问题 Tried to use DRF's ListField option to de-serialize list of values (applications in the example below) in query params. I'm having trouble making it work. Couldn't find with examples in the web. Hoping someone to throw some help. api : /getAppStats/?applications=one,two,three class MySerializer(serializers.Serializer): applications = serializers.ListField(child=serializers.CharField()) start_date = serializers.DateField(default=(datetime.datetime.utcnow() - datetime.timedelta(days=30)).date()

Draw an ellipse on a figure and get coordinates_Python

偶尔善良 提交于 2019-12-11 13:39:31
问题 I'm working on Python 2.7. I have to define some Areas of Interest (AoI) on a picture. Basically, I'm trying to do this drawing an ellipse (or more) on a specific part of the picture and to get the coordinates (x; y) of its contour. I want to save these coordinates on a file, in order to use them later to see whether (or not) my data are inside this area. This is my code: import matplotlib.pyplot as plt import numpy as np from matplotlib.patches import Ellipse, Circle from matplotlib.path

Pagination on JSF using get parameters

好久不见. 提交于 2019-12-11 12:57:19
问题 I am on index.xhtml and I have this code snippet: <h:form> <h:commandButton action="#{blogentryListerBean.olderBlogEntries}" value="Older Blog Entries"/> </h:form> BlogEntryListerBean is RequestScoped . This is the code I have in olderBlogEntries public String olderBlogEntries() { HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest(); String id = request.getParameter("id"); if (id == null || id.equals("")) { id = "0"; } int

How can I get both the GET and POST request params, on a POST request?

筅森魡賤 提交于 2019-12-11 12:23:38
问题 I'm creating a facebook app with a Perl backend. The problem is that since Facebook sends the request to my web app as a POST request I'm having a problem getting the GET parameters that were also part of the base URL for the application -- in effect I'm only getting the POST params from $CGI->Vars. 回答1: See CGI/MIXING POST AND URL PARAMETERS. Short version: use $CGI->param() for post paramenters and $CGI->url_param() for query string parameters. 回答2: Dump CGI in favour of a better interface.

get array value from get method

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 12:05:00
问题 How to get separate values of array in javascript? in one page: var c=new Array(a); (eg: a={"1","2"}) window.location="my_details.html?"+ c + "_"; and in my_details.html : my_details.htm: var q=window.location.search; alert("qqqqqqqqqqqqq " + q); var arrayList = (q)? q.substring(1).split("_"):[]; var list=new Array(arrayList); alert("dataaaaaaaaaaaa " + decodeURIComponent(list) + "llll " ); But i am not able to get individual array value like list[0] etc How to get it? thanks Sneha 回答1:

Retrieve list from object in Database

不问归期 提交于 2019-12-11 11:49:40
问题 I want to send a list of names contained in a Database using asp.net These are my two objects: public class Shop { public int ID { get; set; } public string Country { get; set; } public List<Item> Items{ get; set; } } public class Item { public int ID { get; set; } public string Name { get; set; } } I want to set a get controller in order to retrieve a list of items. I did something like this: public IEnumerable<Item> Get(int id) { var items= new List<Item>(); var shop= new Shop(); using (var

Cannot access json file with javascript

浪尽此生 提交于 2019-12-11 11:32:52
问题 I want to read the json content of this page : http://89.92.40.250:8010/dreamteam/interface/get_event_detail.php?id=397 with javascript. So i began this script : var req = new XMLHttpRequest(); req.open("GET", "http://89.92.40.250:8010/dreamteam/interface/get_event_detail.php?id=397", true); req.onreadystatechange = monCode; req.send(null); function monCode() { if (req.readyState == 4) { var doc = eval('(' + req.responseText + ')'); alert(req.responseText); } } when I want to show the content

Echoing multiple checkbox values In PHP

99封情书 提交于 2019-12-11 11:11:02
问题 I am having trouble using $_GET with radio buttons. 4th<input type="checkbox" name="date" value="4th"> 5th<input type="checkbox" name="date" value="5th"> 6th<input type="checkbox" name="date" value="6th"> The user chooses what days they are available. Then I want to echo out what days the user selected: <?php echo "You are available " . $_GET["date"] . "!"; ?> The above code only echos out one. Not all three. Is there a way to do this? 回答1: checkbox values are returned in an array as they

Node.js serve multiple files in one request

风格不统一 提交于 2019-12-11 10:56:14
问题 Is it possible to serve multiple files in one request? Here is a simplified version of my code to serve our website's home page on a request to our node.js server that contains no parameters (there is caching code that caches the file data to make the server more efficient, handles errors, etc.): var http = require("http"); http.createServer(function(req, res){ res.setHeader("Access-Control-Allow-Origin", "*"); if (req.url == "/"){ res.writeHead(200, {"Content-Type": "text/html"}); fs

How do you just get the vars in a url using php?

半世苍凉 提交于 2019-12-11 10:51:58
问题 I have a url, example.com/?/page1 and i want to find out what the GET part of the url is, for example: ?/page1 how do i do this? like, without having to split strings and stuff? 回答1: The following variable will contain the entirety of the query string (that is, the portion of the url following the ? character): $_SERVER['QUERY_STRING'] If you're curious about the rest of the contents of the $_SERVER array, they're listed in the PHP manual here. 回答2: That is a strange GET URL because the