Here a code I'm using now.
<%= f.select :project_id, @project_select %>
How to modify it to make it it's default value params[:pid] when page is loaded?
i have an html page where i have a table of items (one item per row) where each item is a html link that says "Add" and there is a textbox next to each link with a number in it.
the text link and the textbox are in the same td inside the row of the table.
how do i, using jquery, capture the value from the textbox that is to the right of the link i click on.
I want to do something like this:
<ControlTemplate.Triggers>
<Trigger Property="Width" Value=">25">
<!-- Set values here -->
</Trigger>
</ControlTemplate.Triggers>
Anyway to do something like this?
I have the following class:
class Seller
{
private string sellerName;
private decimal price;
}
~propreties for SellerName and Price goes here~
I also have a list of sellers:
list<Seller> s = new list<Seller>();
How can I get the maximum value of price out of all the sellers?
Thank you very much.
I am having a small problem trying to decide on database schema for a current project. I am by no means a DBA.
The application parses through a file based on user input and enters that data in the database. The number of fields that can be parsed is between 1 and 42 at the current moment.
The current design of the database is entirely flat with there being 42 columns; some have repeated columns such as address1, address2, address3, etc...
This says that I should normalize the data. However, data integrity is not needed at this moment and the way the data is shaped I'm looking at several joins. Not a bad thing but the data is still in a 1 to 1 relationship and I still see a lot of empty fields per row.
So my concerns are that this does not allow the database or the application to be very extendable. If they want to add more fields to be parsed (which they do) than I'd need to create another table and add another foreign key to the linking table.
The third option is I have a table where the fields are defined and a table for each record. So what I was thinking is to make a table that stores the value and then links to those two tables. The problem is I can picture the size of that table growing large depending on the input size. If someone gives me a file with 300,000 records than 300,000 x 40 = 12 million so I have some reservations. However I think if I get to that point than I should be happy it is being used. This option also allows for more custom displaying of information albeit a bit more work but little rework even if you add more fields.
So the problem boils down to:
1. Current design is a flat file which makes extending it hard and it is not normalized.
2. Normalize the tables although no real benefits for the moment but requirements change.
3. Normalize it down into the name value pair and hope size doesn't hurt.
There are a large number of inserts, updates, and selects against that table. So performance is a worry but I believe the saying is design now, performance testing later?
I'm probably just missing something practical so any comments would be appreciated even if it’s a quick sanity check.
Thank you for your time.
How to find a value exist in an array and how to remove it. If any php builtin array functions for doing this. After removing I need the sequential index order. any body knows please help me.
I have been learning php for sometime now. Besides reading books and doing tutorials i also like to sometimes read other programmers code. I have came across this:
<?php
// authentication.
include_once($sys_root."/inc/authenticate_check.php");
I understand the use for $sys_root, but what i dont understand is, how is $sys_root bieng assigned a value.
I have checked and made sure that $sys_root is not a special var of PHP's.
Hi
How to translate GdkEventKey.keyval with level 0 to key value with level == 0? For example:
GDK_ISO_Left_Tab ==> GDK_Tab? Of course not using switch/case for every key.
I need to get particular key, not a character.
When a vote value is changed, the form POSTs the change, then refreshes the page. This is called on the top of the page upon load:
if (isset($_POST['q'.$question_id]))
{
$user->updateQuestionVotes($question_id, $_POST['q'.$question_id]);
}
Why does it update every time I refresh after the first time? Do I need to unset it somehow?
I'm retrieving an IEnumerable list of properties via following code:
BindingFlags bindingFlag = BindingFlags.Instance | BindingFlags.Public;
var dataProperties = typeof(myParentObject).GetProperties(bindingFlag);
Then I'm iterating through the list and retrieving the value for each property.
I've come across two different approaches to doing this, and just wondered what the difference is between them:
1)
object propertyValue = property.GetGetMethod().Invoke(myObject, null);
2)
object propertValue = property.GetValue(myObject, null)
Hi,
How to alert variable name, not a value of variable?
var color = 'red';
alert(color); // Will alert 'red'
alert(/* magic */); // Will alert 'color'
We have link to some page (with html code), that page have one img, which attributes title and alt are equal.
Script must open link, grab the src attribute of img which title=alt, and throw the value into some variable.
How to do it?
Thanks.
$("input[id^='exc-flwup-<%=Model.Date%>']").click(function() {
$(this).val('');
});
I am using this to clear the input field..when i click on the input box its doign clear but.. on form submit if i ccheck at controler side I am still seeing this value there?
do I need to do anyting else here to make null inputbox?
dear experts,
This question is an extension of this question I asked.
I have a std::vector vec_B.which stores instances of class Foo. The order of elements in this vector changes in the code.
Now, I want to access the value of the current "last element" or current 'nth' element of the vector. If I use the code below to get the last element using getLastFoo() method, it doesn't return the correct value.
For example, to begin with the last element of the vector has Foo.getNumber() = 9. After sorting it in descending order of num, for the last element, Foo.getNumber() = 0.
But with the code below, it still returns 9.. that means it is still pointing to the original element that was the last element.
What change should I make to the code below so that "lastFoo" points to the correct last element?
class Foo {
public:
Foo(int i);
~Foo(){};
int getNum();
private:
int num;
};
Foo:Foo(int i){
num = i;
}
int Foo::getNum(){
return num;
}
class B {
public:
Foo* getLastFoo();
B();
~B(){};
private:
vector<Foo> vec_B;
};
B::B(){
int i;
for (i = 0; i< 10; i++){
vec_B.push_back(Foo(i));
}
// Do some random changes to the vector vec_B so that elements are reordered. For
// example rearrange elements in decreasing order of 'num'
//...
}
Foo* B::getLastFoo(){
&vec_B.back();
};
int main(){
B b;
Foo* lastFoo;
lastFoo = b.getLastFoo()
cout<<lastFoo->getNumber();
return 0;
}
How can i loop thru a stl::List and store the value of one of the objects for use later in the function?
Particle *closestParticle;
for(list<Particle>::iterator p1 = mParticles.begin(); p1 != mParticles.end(); ++p1 )
{
// Extra stuff removed
closestParticle = p1; // fails
}
I have a dictionary collection as bleow:
mydic.addvalue(key1, val1)
mydic.addvalue(key2, val1)
mydic.addvalue(key3, val1)
mydic.addvalue(key4, val2)
mydic.addvalue(key5, val2)
From the above dictionary I want to delete all the entries where value == "val1", so that the result would have only following entry:
mydic.addvalue(key4, val2)
mydic.addvalue(key5, val2)
My VB source code is on VS2008 and targeted for 3.5
Hi, I have defined my class:
public class Host
{
public string Name;
}
then a strongly-typed dictionary:
Dictionary<string, Host> HostsTable;
then I try to compare a value:
if (HostsTable.Values.Where(s => s.Name == "myhostname") != null) { doSomething }
and the problem is, nothing is found, even I'm sure the item is on the list. What I'm doing wrong ?
I want to read pattern for JST formatDate also from resource bundle but this naive approach does not working, what I'm doing wrong ?
in com/company/MyPortlet.properties is this key:
company.date.format = yyyy-MM-dd HH:mm:ss
In page I have:
<fmt:setBundle basename="com.company.MyPortlet"/>
<fmt:formatDate value="${date}" pattern="${company.date.format}" />
Hi!
How do i go about passing the value of width ,height,resize received as parameter to window.open using javascript?
Thanks
Example
function poponload(mywidth,myheight,resizeVal)
{
testwindow = window.open ("http://www.yahoo.com", "mywindow","location=1,status=1,scrollbars=1,width=+mywidth+,height=myheight,resizeVal");
testwindow.moveTo(0,0);
}
<body onload="javascript: poponload(200, 500,yes)">
Hi folks,
Quick question. I want to change the color of an int based on the value being positive or negative, using css if possible.
Any ideas??
Thanks again!
Using LINQ 2SQL , How can i call a stored procedure which returns either 1 or 0 when being executed.My procedure has 3 input params.I want to know the return value from procedure in my code too.
Hi, im traversing through the registry, taking the values of the keys and storing them as strings. I have discovered there are many different types. Some of these types are causing my filestream writer to fail. Is it possible to convert all of the below into a string form. The actual data value is not important, just the ability to differentiate between different values.
DWORD
ExpandString
Binary (is this just the same as byte[] ?)
MultiString