Search Results

Search found 1626 results on 66 pages for 'age'.

Page 19/66 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • Best Static Website Generator

    - by Nick Retallack
    In the age of dynamic websites built with layouts and templates, nobody wants to write plain old repetitive static html anymore. But now that you can outsource dynamic features to services like Disqus, and you could get slashdotted/dugg/reddited at any moment, sometimes a static website is best for scalability. There are quite a few static website generators out there that let you use templates, layouts, alternative markup languages, and other new age stuff. So this question is a bit of a survey. Which do you think is the best, and why? Here are a few examples to start us off: WebGen StaticMatic Static

    Read the article

  • Exception design: Custom exceptions reading data from file?

    - by User
    I have a method that reads data from a comma separated text file and constructs a list of entity objects, let's say customers. So it reads for example, Name Age Weight Then I take these data objects and pass them to a business layer that saves them to a database. Now the data in this file might be invalid, so I'm trying to figure out the best error handling design. For example, the text file might have character data in the Age field. Now my question is, should I throw an exception such as InvalidAgeException from the method reading the file data? And suppose there is length restriction on the Name field, so if the length is greater than max characters do I throw a NameTooLongException or just an InvalidNameException, or do I just accept it and wait until the business layer gets a hold of it and throw exceptions from there? (If you can point me to a good resource that would be good too)

    Read the article

  • Convert json to a string using jquery

    - by becomingGuru
    I have a nested json. I want to post it as a form input value. But, seems like jquery puts "Object object" string into the value. It seems easier to pass around the string and convert into the native form I need, than dealing with json as I don't need to change anything once it is generated. What is the simplest way to convert a json var json = { "firstName": "John", "lastName": "Smith", "age": 25, "address": { "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": "10021" }, "phoneNumber": [ { "type": "home", "number": "212 555-1234" }, { "type": "fax", "number": "646 555-4567" } ], "newSubscription": false, "companyName": null }; into its string form? var json = '{ "firstName": "John", "lastName": "Smith", "age": 25, "address": { "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": "10021" }, "phoneNumber": [ { "type": "home", "number": "212 555-1234" }, { "type": "fax", "number": "646 555-4567" } ], "newSubscription": false, "companyName": null }' Following doesn't do what I need: Json.stringify()

    Read the article

  • Skip some row in jsf dataTable

    - by Marc
    How to skip some rows to be displayed using dataTable: <h:dataTable cellspacing="0" id="dogs" value="#{dogBean.dogs}" var="dog" rendered="#{dogBeans.dogs != null}"> <h:column id="nameColumn"> <h:outputText value="#{dog.name}"/> </h:column> <h:column id="breedColumn"> <h:outputText value="#{dog.breed}"/> </h:column> </h:dataTable> I want to display all dogs, but those how have an age greater than 10. dog.age 10. I'm using Seam.

    Read the article

  • Precompile Lambda Expression Tree conversions as constants?

    - by Nathan
    It is fairly common to take an Expression tree, and convert it to some other form, such as a string representation (for example this question and this question, and I suspect Linq2Sql does something similar). In many cases, perhaps even most cases, the Expression tree conversion will always be the same, i.e. if I have a function public string GenerateSomeSql(Expression<Func<TResult, TProperty>> expression) then any call with the same argument will always return the same result for example: GenerateSomeSql(x => x.Age) //suppose this will always return "select Age from Person" GenerateSomeSql(x => x.Ssn) //suppose this will always return "select Ssn from Person" So, in essence, the function call with a particular argument is really just a constant, except time is wasted at runtime re-computing it continuously. Assuming, for the sake of argument, that the conversion was sufficiently complex to cause a noticeable performance hit, is there any way to pre-compile the function call into an actual constant?

    Read the article

  • Declarative JDOQL vs Single-String JDOQL : performance

    - by DrDro
    When querying with JDOQL is there a performance difference between using the declarative version and the Single-String version: Example from the JDOQL doc: //Declarative JDOQL : Query q = pm.newQuery(org.jpox.Person.class, "lastName == \"Jones\" && age < age_limit"); q.declareParameters("double age_limit"); List results = (List)q.execute(20.0); //Single-String JDOQL : Query q = pm.newQuery("SELECT FROM org.jpox.Person WHERE lastName == \"Jones\"" + " && age < :age_limit PARAMETERS double age_limit"); List results = (List)q.execute(20.0); Other then performance, are there any reasons for which one is better to use then the other or is it just about the one with which we feel more comfortable.

    Read the article

  • Join one row to multiple rows in another table

    - by Ghostrider
    I have a table to entities (lets call them people) and properties (one person can have an arbitrary number of properties). Ex: People Name Age -------- Jane 27 Joe 36 Jim 16 Properties Name Property ----------------- Jane Smart Jane Funny Jane Good-looking Joe Smart Joe Workaholic Jim Funny Jim Young I would like to write an efficient select that would select people based on age and return all or some of their properties. Ex: People older than 26 Name Properties Jane Smart, Funny, Good-looking Joe Smart, Workaholic It's also acceptable to return one of the properties and total property count. The query should be efficient: there are millions of rows in people table, hundreds of thousands of rows in properties table (so most people have no properties). There are hundreds of rows selected at a time. Is there any way to do it?

    Read the article

  • mySql table returning JSON that needs formatting for a iPhone UITableview

    - by Michael Robinson
    I have a php query the returns the following JSON format from a table. [{"memberid":"18", "useridFK":"30", "loginName":"Johnson", "name":"Frank", "age":"23", "place":"School", }, It needs the following format: [{"memberid":"18" { "useridFK":"30", "loginName":"Johnson", "name":"Frank", "age":"23", "place":"School",} }, I can figure out where/how to convert this, Where would I create the formatting following: (1) In the php return? (2) the JSON instructions for deserialization? or (3) Some kinb of Obj-C coding instruction? My end use is a simple Drill Down table using the NSObject, so when I select "memberid" row, I'll get the child/detail list on the next UITableview. My Data.plist will look like the following: Root: Dictionary V Rows: Array V Item 0: Dictionary Title: String 18 V Children Array V Item 0 Dictionary Title String 30 etc. Thanks in advance, this site rocks.

    Read the article

  • A lock could not obtained within the time requested issue

    - by Wayne Daly
    The title is the error I'm getting, when I click load my program freezes. I assume its because I'm doing a statement inside a statement, but from what I see its the only solution to my issue. By loading I want to just repopulate the list of patients, but to do so I need to do their conditions also. The code works, the bottom method is what I'm trying to fix. I think the issue is that I have 2 statements open but I am not sure. load: public void DatabaseLoad() { try { String Name = "Wayne"; String Pass= "Wayne"; String Host = "jdbc:derby://localhost:1527/Patients"; Connection con = DriverManager.getConnection( Host,Name, Pass); PatientList.clear(); Statement stmt8 = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); String SQL8 = "SELECT * FROM PATIENTS"; ResultSet rs8 = stmt8.executeQuery( SQL8 ); ArrayList<PatientCondition> PatientConditions1 = new ArrayList(); while(rs8.next()) { PatientConditions1 = LoadPatientConditions(); } Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); String SQL = "SELECT * FROM PATIENTS"; ResultSet rs = stmt.executeQuery( SQL ); while(rs.next()) { int id = (rs.getInt("ID")); String name = (rs.getString("NAME")); int age = (rs.getInt("AGE")); String address = (rs.getString("ADDRESS")); String sex = (rs.getString("SEX")); String phone = (rs.getString("PHONE")); Patient p = new Patient(id, name, age, address, sex, phone, PatientConditions1); PatientList.add(p); } UpdateTable(); UpdateAllViews(); DefaultListModel PatientListModel = new DefaultListModel(); for (Patient s : PatientList) { PatientListModel.addElement(s.getAccountNumber() + "-" + s.getName()); } PatientJList.setModel(PatientListModel); } catch(SQLException err) { System.out.println(err.getMessage()); } } This is the method that returns the arraylist of patient conditions public ArrayList LoadPatientConditions() { ArrayList<PatientCondition> PatientConditionsTemp = new ArrayList(); try { String Name = "Wayne"; String Pass= "Wayne"; String Host = "jdbc:derby://localhost:1527/Patients"; Connection con = DriverManager.getConnection( Host,Name, Pass); Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); String SQL = "SELECT * FROM PATIENTCONDITIONS"; ResultSet rs5 = stmt.executeQuery( SQL ); int e = 0; while(rs5.next()) { e++; String ConName = (rs5.getString("CONDITION")); PatientCondition k = new PatientCondition(e,ConName); PatientConditionsTemp.add(k); } } catch(SQLException err) { System.out.println(err.getMessage()); } return PatientConditionsTemp; }

    Read the article

  • Ruby on Rails: reducing complexity of parameters in a RESTFul HTTP POST request (multi-model)

    - by randombits
    I'm using cURL to test a RESTFul HTTP web service. The problem is I'm normally submitting a bunch of values normally like this: curl -d "firstname=bob&lastname=smith&age=25&from=kansas&someothermodelattr=val" -H "Content-Type: application/x-www-form-urlencoded" http://mysite/people.xml -i The problem with this is my controller will then have code like this: unless params[:firstname].nil? end unless params[:lastname].nil? end // FINALLY @person = People.new(params[:firstname], params[:lastname], params[:age], params[:from]) etc.. What's the best way to simplify this? My Person model has all the validations it needs. Is there a way (assuming the request has multi-model parameters) that I can just do: @person = People.new(params[:person]) and then the initializer can take care of the rest?

    Read the article

  • PHP equivalent to Perl format function

    - by Dustin Hansen
    Is there an equivalent to Perl's format function in PHP? I have a client that has an old-ass okidata dotmatrix printer, and need a good way to format receipts and bills with this arcane beast. I remember easily doing this in perl with something like: format BILLFORMAT = Name: @>>>>>>>>>>>>>>>>>>>>>> Age: @### $name, $age . write; Any ideas would be much appreciated, banging my head on the wall with this one. O.o

    Read the article

  • Inference engine to calculate matching set according to internal rules

    - by Zecrates
    I have a set of objects with attributes and a bunch of rules that, when applied to the set of objects, provides a subset of those objects. To make this easier to understand I'll provide a concrete example. My objects are persons and each has three attributes: country of origin, gender and age group (all attributes are discrete). I have a bunch of rules, like "all males from the US", which correspond with subsets of this larger set of objects. I'm looking for either an existing Java "inference engine" or something similar, which will be able to map from the rules to a subset of persons, or advice on how to go about creating my own. I have read up on rule engines, but that term seems to be exclusively used for expert systems that externalize the business rules, and usually doesn't include any advanced form of inferencing. Here are some examples of the more complex scenarios I have to deal with: I need the conjunction of rules. So when presented with both "include all males" and "exclude all US persons in the 10 - 20 age group," I'm only interested in the males outside of the US, and the males within the US that are outside the 10 - 20 age group. Rules may have different priorities (explicitly defined). So a rule saying "exclude all males" will override a rule saying "include all US males." Rules may be conflicting. So I could have both an "include all males" and an "exclude all males" in which case the priorities will have to settle the issue. Rules are symmetric. So "include all males" is equivalent to "exclude all females." Rules (or rather subsets) may have meta rules (explicitly defined) associated with them. These meta rules will have to be applied in any case that the original rule is applied, or if the subset is reached via inferencing. So if a meta rule of "exclude the US" is attached to the rule "include all males", and I provide the engine with the rule "exclude all females," it should be able to inference that the "exclude all females" subset is equivalent to the "include all males" subset and as such apply the "exclude the US" rule additionally. I can in all likelihood live without item 5, but I do need all the other properties mentioned. Both my rules and objects are stored in a database and may be updated at any stage, so I'd need to instantiate the 'inference engine' when needed and destroy it afterward.

    Read the article

  • I need to create Trigger for delete action which backsup all fields old value in audit table

    - by Parth
    I need to create Trigger for delete action which backsup all fields old value in audit table. I have a table structure for audit table as id, menuid, field, oldvalue, changedone now whenever any of the row is deleted from its mother table(menu) having 21 fields in count, every fields old value should get insert in the audit table with new audit id.. like If I delete a row having fields as: menuid, name, age, address, sex, town now in audit table 6 rows should get inserted seperately for every field given above as: AUdit Table: id=2(audittable id) menuid = menuid field = name oldvalue = joy changedone = (whatever the deleted time was) id=3(audittable id) menuid = menuid field = age oldvalue = 23 changedone = (whatever the deleted time was) an so on..

    Read the article

  • cleaned_data() doesn't have some of the entered data

    - by SC Ghost
    I have a simple form for a user to enter in Name (CharField), Age(IntegerField), and Sex(ChoiceField). However the data that is taken from the Sex choice field is not showing up in my cleaned_data(). Using a debugger, I can clearly see that the data is being received in the correct format but as soon as I do form.cleaned_data() all sign of my choice field data is gone. Any help would be greatly appreciated. Here is the relative code: class InformationForm(forms.Form): Name = forms.CharField() Age = forms.IntegerField() Sex = forms.ChoiceField(SEX_CHOICES, required=True) def get_information(request, username): if request.method == 'GET': form = InformationForm() else: form = RelativeForm(request.POST) if form.is_valid(): relative_data = form.cleaned_data

    Read the article

  • python sax error "junk after document element"

    - by user293487
    Hi, I use python sax to parse xml file. The xml file is actually a combination of multiple xml files. It looks like as follows: <row name="abc" age="40" body="blalalala..." creationdate="03/10/10" /> <row name="bcd" age="50" body="blalalala..." creationdate="03/10/09" /> My python code is in the following. It show "junk after document element" error. Any good idea to solve this problem. Thanks. from xml.sax.handler import ContentHandler from xml.sax import make_parser,SAXException import sys class PostHandler (ContentHandler): def __init__(self): self.find = 0 self.buffer = '' self.mapping={} def startElement(self,name,attrs): if name == 'row': self.find = 1 self.body = attrs["body"] print attrs["body"] def character(self,data): if self.find==1: self.buffer+=data def endElement(self,name): if self.find == 1: self.mapping[self.body] = self.buffer print self.mapping parser = make_parser() handler = PostHandler() parser.setContentHandler(handler) try: parser.parse(open("2.xml")) except SAXException:

    Read the article

  • HTTP caching confusion

    - by Keith
    I'm not sure whether this is a server issue, or whether I'm failing to understand how HTTP caching really works. I have an ASP MVC application running on IIS7. There's a lot of static content as part of the site including lots of CSS, Javascript and image files. For these files I want the browser to cache them for at least a day - our .css, .js, .gif and .png files rarely change. My web.config goes like this: <system.webServer> <staticContent> <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="1.00:00:00" /> </staticContent> </system.webServer> The problem I'm getting is that the browser (tested Chrome, IE8 and FX) doesn't seem to be caching the files as I'd expect. I've got the default settings (check for newer pages automatically in IE). On first visit the content downloads as expected HTTP/1.1 200 OK Cache-Control: max-age=86400 Content-Type: image/gif Last-Modified: Fri, 07 Aug 2009 09:55:15 GMT Accept-Ranges: bytes ETag: "3efeb2294517ca1:0" Server: Microsoft-IIS/7.0 X-Powered-By: ASP.NET Date: Mon, 07 Jun 2010 14:29:16 GMT Content-Length: 918 <content> I think that the Cache-Control: max-age=86400 should tell the browser not to request the page again for a day. Ok, so now the page is reloaded and the browser requests the image again. This time it gets an empty response with these headers: HTTP/1.1 304 Not Modified Cache-Control: max-age=86400 Last-Modified: Fri, 07 Aug 2009 09:55:15 GMT Accept-Ranges: bytes ETag: "3efeb2294517ca1:0" Server: Microsoft-IIS/7.0 X-Powered-By: ASP.NET Date: Mon, 07 Jun 2010 14:30:32 GMT So it looks like the browser has sent the ETag back (as a unique id for the resource), and the server's come back with a 304 Not Modified - telling the browser that it can use the previously downloaded file. It seems to me that would be correct for many caching situations, but here I don't want the extra round trip. I don't care if the image gets out of date when the file on the server changes. There are a lot of these files (even with sprite-maps and the like) and many of our clients have very slow networks. Each round trip to ping for that 304 status is taking about a 10th to a 5th of a second. Many also have IE6 which only has 2 HTTP connections at a time. The net result is that our application appears to be very slow for these clients with every page taking an extra couple of seconds to check that the static content hasn't changed. What response header am I missing that would cause the browser to aggressively cache the files? How would I set this in a .Net web.config for IIS7? Am I misunderstanding how HTTP caching works in the first place?

    Read the article

  • How to implement dynamic queries for MNesia?

    - by Kerem
    I'm trying to implement a function that generates dynamic queries for MNesia. For example, when function is called with these arguments; dyn_query(list, person, [name, age], ["jack", 21]) I want to query MNesia to list items whose name is "jack" and age is 21 in person table. I've tried to implement this by using qlc:q(ListComprehension) and qlc:string_to_handle("ListComprehension"). First failed because of compile errors, compiler didn't let me to use functions instead of ListComprehentions and variables instead of record names like "Item#Table.Member". Second failed, because erl_eval couldn't handle records and throwed exceptions like {undefined_record, person}. Which method should I use? How could i solve these problems? Or should I use a different method? Thanks.

    Read the article

  • REST/ROA Architecture - Send database search/querying/filter/sorting parameters in URL? (>, <, IN, e

    - by DutrowLLC
    I'm building a REST interface to my application using ROA (Resource Oriented Architecture) . I'd like to give the client the ability to specify search parameters in URL. So a client could say "Give me all people who's: "first_name" is equal to "BOB" "age" is greater than "30" sort by "last_name" I was thinking something like: GET /PEOPLE/{query_parameters}/{sort_parameters} ...or perhaps GET /PEOPLE?query=<query_string>&sort=<sort_string> ...but I'm unsure what syntax would be good for specifying in the COLUMN_NAME-OPERATOR-VALUE triplicates. I was thinking perhaps something like: column_name.operator.value So the client could say: GET /PEOPLE?query=first_name.EQUALS.bob&query=age.GREATER_THAN.30&sort=last_name.ASCENDING I really don't want to re-invent the wheel here, are there some accepted ways that this is done? I am using Restlets, I don't know if that makes a difference.

    Read the article

  • How to extract a specific input field value from external webpage using Javascript

    - by Tom
    Hi, i get the webpage content from an external website using ajax but now i want a function which extract a specific input field value which is already autofilled. the webpage content is like this: ......... <input name="fullname" id="fullname" size="20" value="David Smith" type="text"> <input name="age" id="age" size="2" value="32" type="text"> <input name="income" id="income" size="20" value="22000$" type="text"> ......... I only want to get the value of fullname, maybe with some javascript regex, or some jQuery dom parser, i know i can do it easily with php but i want it using Javascript or jQuery. Note: this inputs are not hosted in my page, they are just pulled from other website through Ajax. Thanks

    Read the article

  • optional search parameters in sql query and rows with null values

    - by glenn.danthi
    Ok here is my problem : Before i start the description, let me to tell you that I have googled up a lot and I am posting this question for a good optimal solution :) i am building a rest service on WCF to get userProfiles... the user can filter userProfiles by giving something like userProfiles?location=London now i have the following method GetUserProfiles(string firstname, string lastname, string age, string location) the sql query string i built is: select firstname, lastname, .... from profiles where (firstName like '%{firstname}%') AND (lastName like '%{lastName}%') ....and so on with all variables being replaced by string formatter. Problem with this is that it filters any row having firstname, lastname, age or location having a null value.... doing something like (firstName like '%{firstName}%' OR firstName IS NULL) would be tedious and the statement would become unmaintanable! (in this example there are only 4 arguments, but in my actual method there are 10) What would be the best solution for this?....How is this situation usually handled? Database used : MySql

    Read the article

  • Ignoring extra keys in a hash passed in to create

    - by denniss
    Does rails provide a way to ignore extra keys that are passed in to create. Supposed User has two attributes, first_name and last_name. When I do User.create({ :first_name => "first", :last_name => "last", :age => 10}) that line gives me an UknonwnAttributeError. Well, that makes sense, it happens cause age is not one of the attributes. But is there a way to just ignore key-value pair that is not one of the attributes for User?

    Read the article

  • How to test a lamda expression var query result is null?

    - by mike
    var query = from emp in dbEmp.Employees join dept in dbEmp.Departments on emp.DeptID equals dept.DeptID where dept.DepartmentName.Contains(this.TextBox1.Text) select new { EmpID = emp.EmpID, EmpName = emp.EmpName, Age = emp.Age, Address = emp.Address, DeptName = dept.DepartmentName }; if (query==null) Label1.Text = "no results match your search"; GridView1.DataSource = query; GridView1.DataBind(); Everything works in the right way, but the label doesn't show the message when query result returns null. The label can show without condition(querry==null). So how to test if a var query result returns nothing? Thanks

    Read the article

  • Track/Display Array Index As Part Of Cout (C++)

    - by John Smith
    Hi, I have a command line C++ program that lets you enter basic information about a person (ID number, name, age, etc.) and I want to output to a console in the following manner: ------------------------------------------------------------------- Index ID # First Name Last Name Age ------------------------------------------------------------------- 0 1234 John Smith 25 The person objects are stored in an array of Persons and I've overload the ostream (<<) operator to print out all of the fields like you see. The dashed lines and header come from a displayHdg() function. Anyhow, I have not been able to figure out how to get the proper index value for the array. Ideally, I'd like to generate the indices for each line, but all my attempts have failed. The array is looped through and each object printed in the main() function, and the ostream is overloaded in a person class, so I tried to use global variables as well as static variables, and all of those produce incorrect numbering (i.e. show 0, 1 the first time (for 2 objects), then change to 1, 2 on the next display). Any ideas?

    Read the article

  • Get data types from arbitrary sql statement in SQL Server 2008

    - by Christopherous 5000
    Given some arbitrary SQL I would like to get the data types of the returned columns. The statement might join many tables, views, TVFs, etc. I know I could create a view based on the query and get the datatypes from that, hoping there's a quicker way. Only think I've been able to think of is writing a .net utility to run the SQL and examine the results, wondering if there is a TSQL answer. i.e. Given (not real tables just an example) SELECT p.Name AS PersonName, p.Age, a.Account as AccountName FROM Person as p LEFT JOIN Account as a ON p.Id = a.OwnerId I would like to have something like PersonName: (nvarchar(255), not null) Age: (smallInt, not null) etc...

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >