In a form_tag, there is a list of 10 to 15 checkboxes:
<%= check_box_tag 'vehicles[]', car.id %>
How can I select-all (put a tick in every single) checkboxes by RJS? Thanks
Dear friends
I try to use system.form_status state,but when i check it after I change some texts or my list item,there is no changes in system.form_status ,I just receive "query" message but I must receive "changed" message.
So how I can solve my problem?has it any precondition?
I am trying to send a HTTP PUT (in order to create a new cache and populate it with my generated JSON)
to ehCache using my webservice which is on the same local tomcat instance.
Am new to RESTful Web Services and am using JDK 1.6, Tomcat 7, ehCache, and JSON.
I have my POJOs defined like this:
Person POJO:
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class Person {
private String firstName;
private String lastName;
private List<House> houses;
// Getters & Setters
}
House POJO:
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class House {
private String address;
private String city;
private String state;
// Getters & Setters
}
Using a PersonUtil class, I hardcoded the POJOs as follows:
public class PersonUtil {
public static Person getPerson() {
Person person = new Person();
person.setFirstName("John");
person.setLastName("Doe");
List<House> houses = new ArrayList<House>();
House house = new House();
house.setAddress("1234 Elm Street");
house.setCity("Anytown");
house.setState("Maine");
houses.add(house);
person.setHouses(houses);
return person;
}
}
Am able to create a JSON response per a GET request:
@Path("")
public class MyWebService{
@GET
@Produces(MediaType.APPLICATION_JSON)
public Person getPerson() {
return PersonUtil.getPerson();
}
}
When deploying the war to tomcat and pointing the browser to
http://localhost:8080/personservice/
Generated JSON:
{
"firstName" : "John",
"lastName" : "Doe",
"houses":
[
{
"address" : "1234 Elmstreet",
"city" : "Anytown",
"state" : "Maine"
}
]
}
So far, so good, however, I have a different app which is running on the same tomcat instance (and has support for REST):
http://localhost:8080/ehcache/rest/
While tomcat is running, I can issue a PUT like this:
echo "Hello World" | curl -S -T - http://localhost:8080/ehcache/rest/hello/1
When I "GET" it like this:
curl http://localhost:8080/ehcache/rest/hello/1
Will yield:
Hello World
What I need to do is create a POST which will put my entire Person generated JSON and create a new cache:
http://localhost:8080/ehcache/rest/person
And when I do a "GET" on this previous URL, it should look like this:
{
"firstName" : "John",
"lastName" : "Doe",
"houses":
[
{
"address" : "1234 Elmstreet",
"city" : "Anytown",
"state" : "Maine"
}
]
}
So, far, this is what my PUT looks like:
@PUT
@Path("/ehcache/rest/person")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response createCache() {
ResponseBuilder response = Response.ok(PersonUtil.getPerson(), MediaType.APPLICATION_JSON);
return response.build();
}
Question(s):
(1) Is this the correct way to write the PUT?
(2) What should I write inside the createCache() method to have it PUT my generated JSON into:
http://localhost:8080/ehcache/rest/person
(3) What would the command line CURL comment look like to use the PUT?
Thanks for taking the time to read this...
I know that I can retrieve "session" by using item.fields.name but what if I don't know in advance that the attribute is called "name". How can I retrieve the list of the attributes names in fields first.
[
{
"pk": 2,
"model": "auth.group",
"fields": {
"name": "session"
}
}
]
I am writing a driver to act as a wrapper around two separate MySQL connections (to distributed databases). Basically, the goal is to enable interaction with my driver for all applications instead of requiring the application to sort out which database holds the desired data.
Most of the code for this is in place, but I'm having a problem in that when I attempt to create connections via the MySQL Driver, the DriverManager is returning an instance of my driver instead of the MySQL Driver. I'd appreciate any tips on what could be causing this and what could be done to fix it!
Below is a few relevant snippets of code. I can provide more, but there's a lot, so I'd need to know what else you want to see.
First, from MyDriver.java:
public MyDriver() throws SQLException
{
DriverManager.registerDriver(this);
}
public Connection connect(String url, Properties info)
throws SQLException
{
try { return new MyConnection(info); }
catch (Exception e) { return null; }
}
public boolean acceptsURL(String url)
throws SQLException
{
if (url.contains("jdbc:jgb://"))
{ return true; }
return false;
}
It is my understanding that this acceptsURL function will dictate whether or not the DriverManager deems my driver a suitable fit for a given URL. Hence it should only be passing connections from my driver if the URL contains "jdbc:jgb://" right?
Here's code from MyConnection.java:
Connection c1 = null;
Connection c2 = null;
/**
*Constructors
*/
public DDBSConnection (Properties info)
throws SQLException, Exception
{
info.list(System.out); //included for testing
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url1 = "jdbc:mysql://server1.com/jgb";
String url2 = "jdbc:mysql://server2.com/jgb";
this.c1 = DriverManager.getConnection(
url1, info.getProperty("username"), info.getProperty("password"));
this.c2 = DriverManager.getConnection(
url2, info.getProperty("username"), info.getProperty("password"));
}
And this tells me two things. First, the info.list() call confirms that the correct user and password are being sent. Second, because we enter an infinite loop, we see that the DriverManager is providing new instances of my connection as matches for the mysql URLs instead of the desired mysql driver/connection.
FWIW, I have separately tested implementations that go straight to the mysql driver using this exact syntax (al beit only one at a time), and was able to successfully interact with each database individually from a test application outside of my driver.
I have a shell script, with a list of shell variables, which is executed before entering a programming environment.
I want to use a perl script to enter the programming environment:
system("environment_defaults.sh");
system("obe");
but I when I enter the environment the variables are not set.
I have a following string that I would like to parse into either a List or a String[].
(Test)(Testing (Value))
End result should be Test and Testing (Value)
Hi All,
I have just taken over as manager at a company and at the moment they are very rigid in how they approach development. Everyone gets a list of what they are doing each week. My question is how does your company balance support with development and if an important support request comes in how is this processed without disturbing the flow of the developers?
Lastly, do you use an software log support requests and development tasks.
Thanks
Possible Duplicate:
What will be the new features available in ASP.Net 4.0?
What all are the New features in asp.net 4.0.? Currently our team is doing project on .net 2.0 and we didn't go for an upgrade on asp.net 3.5. Now we are preparing to switch from asp.net 2.0 to asp.net 4.0. A list of such features would help us in designing the training program.
The question is pretty straight forward, I have tried using a span with rules set to clear:both; and display:block;, at the bottom of each list entry where the text is being inserted in with no luck. I am not really sure what to do on this. I don't expect to many entries with long consecutive letter strings but for example if someone does lolololololol or ahaahahahhhhhhhhhhhhaaaaaaaa for like 100 letters, it will overflow. If anyone can give me a pointer I would really appreciate it.
I'm creating a digg-like site using Ruby on Rails that ranks the item (based on this algorithm). I'm using the will-paginate gem list the items in pages.
The problem is, will-paginate only allows me to insert ':order =' based on the table data. I would like to make will-paginate to sort by a number which is calculated using a function based on different fields on the table (e.g number of votes, age hours).
How can I do that?
. I get this error: "Cannot convert lambda expression to type 'string' because it is not a delegate type" - keyword select become underlined in blue Can you please advice.
Employee emp = new Employee();
comHandledBySQt.DataSource = from x in emp.GetDataFromTable("1")
select new { x.Id, Name = x.FirstName + " " + x.LastName };
comHandledBySQt.DisplayMember = "Name";
comHandledBySQt.ValueMember = "Id";
Above code should displays drop list of employees first name and last name in a combo box
So, I make a checker if an id is in the database or not, the id is in numerical string, the type in database is char(6) though.
So this is my code
public class input extends Activity{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.input);
final EditText edittext = (EditText)findViewById(R.id.editText1);
Button button = (Button)findViewById(R.id.button1);
button.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String nopel = edittext.getText().toString();
if(nopel.length() == 0){
Toast.makeText(getApplicationContext(), "error", Toast.LENGTH_SHORT).show();
}else{
List<NameValuePair> pairs = new ArrayList<NameValuePair>();
pairs.add(new BasicNameValuePair("nopel", nopel));
JSON json_dp = new JSON();
JSONObject jobj_dp = json_dp.getJSON("http://10.0.2.2/KP/pdam/nopel.php", pairs);
try {
if(jobj_dp.getInt("row") == 0){
Toast.makeText(getApplicationContext(), "error", Toast.LENGTH_SHORT).show();
}else{
String snopel = jobj_dp.getString("nopel");
String snama = jobj_dp.getString("nama");
String salamat = jobj_dp.getString("alamat");
String sgolongan = jobj_dp.getString("golongan");
Intent i = new Intent(input.this, list.class);
i.putExtra("nopel", snopel);
i.putExtra("nama", snama);
i.putExtra("alamat", salamat);
i.putExtra("golongan", sgolongan);
startActivity(i);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
});
}
}
the first check is to check if an input is null, it's going right for now, the second check is to check if an id in the database, and it's the problem. When I try some id in numerical value like "0001" or "02013" it's fine, and can run. but when I just got to put "abushd" it forced close. anyone know why I got this?
If I made a program that stores strings on a text file using the "list"-function(#include ), and then I want to copy all of the text from that file and call it something(so I can tell the program to type in all of the text I copied somewhere by using that one variable to refer to the text), do I use a string,double,int or what do I declare that chunk of text as?
I'm making the program using c++ in a simple console application.
In the document for the method notifyDataSetChanged of class BaseAdapter noted that "Notifies the attached observers that the underlying data has been changed and any View reflecting the data set should refresh itself. "
Supposed I changed the 3rd element in my string array (array data for the listview), what "any View reflecting the data set should refresh itself" means ? Does the 3rd view item in my list view be notified ?
Also, how is notifyDataSetChanged() and getView() concerned ?
Thanks in advance
Hello,
Is there a list of pros-cons for deploying a PHP application on the cloud for AWS or Azure?
Which factors would make AWS a better choice over Azure and Vice-versa?
If anyone has chosen to use, either one instead of the other for a number or reasons i would really want to know why.
regards,
Hello Folks,
I am trying to develop a application where
The user 'X' has logged into Facebook
app has a set of email addresses (possible friends of user 'X')
app gets the list of friends of user 'X' (uids)
Want to check if user with email address [email protected] is a valid facebook user by using email address and is user X's friend (basically a uid to email mapping)
Thanks!
I just want to copy list of files displayed in eclipse search tab,
When i try using right click copy and paste into some folder it does not work.It actually copies the file location rather than the file itself
Hello All
I have a class ClientState
Class ClientState
{
Public int ID{get;set;}
public string State{get;set;}
}
List<ClientState> listClientState which contain all states of USA, Now may problem is listClientState contain some objects which have duplicates states.
How can i filter listClientState to remove duplicate record
def maxVote(nLabels):
count = {}
maxList = []
maxCount = 0
for nLabel in nLabels:
if nLabel in count:
count[nLabel] += 1
else:
count[nLabel] = 1
#Check if the count is max
if count[nLabel] > maxCount:
maxCount = count[nLabel]
maxList = [nLabel,]
elif count[nLabel]==maxCount:
maxList.append(nLabel)
return random.choice(maxList)
nLabels contains a list of integers.
The above function returns the integer with highest frequency, if more than one have same frequency then a randomly selected integer from them is returned.
E.g. maxVote([1,3,4,5,5,5,3,12,11]) is 5
Hey guys, there is a form where the user select some of his friends and I'm curious on how I can implement a list that searches simultaneously while the user is typing a friend's name and when he selects the name the name is written in the text box(jQuery). And if the user wants to select more than one friend, when I'm inserting the names in the database, how can I separate the names that are written in one input field?
For a table in oracle, I can query "all_tab_columns" and get table column information, like the data type, precision, whether or not the column is nullable.
In SQL Developer or TOAD, you can click on a view in the GUI and it will spit out a list of the columns that the view returns and the same set of data (data type, precision, nullable, etc).
So my question is, is there a way to query this column definition for a view, the way you can for a table? How do the GUI tools do it?
To provide a Windows Explorer-like view of the user's system, we have been using the shell controls from LogicNP (formerly Sky Software), but these have deficiencies, e.g., no support for Win7 libraries. The vendor has not responded to our inquiries about updates, so we're looking to replace the package.
Requirements:
ActiveX (no managed code or MFC)
Tree and list views of the system
Per-item checkboxes
32- and 64-bit versions
Any recommendations for a replacement product?
TIA.
At the moment I have a regular expression that looks like this:
^(cat|dog|bird){1}(cat|dog|bird)?(cat|dog|bird)?$
It matches at least 1, and at most 3 instances of a long list of words and makes the matching words for each group available via the corresponding variable.
Is there a way to revise this so that I can return the result for each word in the string without specifying the number of groups beforehand?
^(cat|dog|bird)+$
works but only returns the last match separately , because there is only one group.
is a problem to display data in Datagridview.
A large amount of data (stock quotes)
data to be displayed from left to right
Tell me what to do to display an array of data in datagridviev
Public dat As New List(Of act)
Public Class act
Public time As Date
Public price As Integer
End Class
Sub work()
Dim r As New Random
For x As Integer = 0 To 1000000
Dim el As New act
el.time = Now
el.price = r.Next(0, 1000)
dat.Add(New act)
Next
End Sub