I have a UserControl that exposes a System.Type property. I want to make it settable at design time, like the BindingSource's DataSource property. How can I achieve this?
I saw couple of SO questions (SO) concerning SQL-server. For SQL-server there was no decent solution. All were hacks/workarounds. What about Oracle? Is it same answer (Paremeterizing each value)? Any Oracle example without LINQ would be appreciated (I have .NET 2.0).
Thanks & BR -Matti
Hi,
The title is a bit confusing but here's what I'm after:
I have a set of elements containing all the h3 elements in a page.
In jQuery terms: var mySet = $('h3').
I also have an div element var myContainer = $('div#foo')
I need to find all items in the set mySet that are children of myContainer.
Any ideas? I bet there's some magical one liner for this but I cannot think of any. I'd rather not loop through every element in the set manually and use .closest(myContainer) or something like that to determine the relationship.
Note that in my scenario, I cannot use a new selector like $('div#foo h3') (that would be too easy) as I don't have access to the actual selector values. So it has to be dynamic.
Here is my javascript:
$(document).ready(function(){
var queries = getUrlVars();
$.get("mail3.php", { listid: queries["listid"], mindex: queries["mindex"] }, showData, 'html');
});
function showData(data)
{
var response = $(data).find("#mailing").html();
if (response == null)
{
$("#results").html("<h3>Server didn't respond, try again.</h3>");
}
else if (response.length)
{
var old = $("#results").html();
old = old + "<br /><h3>" + response + "</h3>";
$("#results").html(old);
var words = response.split(' ');
words[2] = words[2] * 1;
words[4] = words[4] * 1;
if (words[2] < words[4])
{
var queries = getUrlVars();
$.get("mail3.php", { listid: queries["listid"], mindex: words[2] }, function(data){showData(data);}, 'html');
}
else
{
var done = $(data).find("#done").html();
old = old + "<br />" + done;
$("#results").html(old);
}
}
else
{
$("#results").html("<h3>Server responded with an empty reply, try again.</h3>");
}
}
function getUrlVars()
{
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for (var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
After the first line in showData:
var response = $(data).find("#mailing").html();
the javascript stops. If I put an alert before it, the alert pops up, after it, it doesn't pop up. There must be something wrong with using $(data), but why? Any ideas would be appreciated.
I am storing the response to various rpc calls in a mysql table with the following fields:
Table: rpc_responses
timestamp (date)
method (varchar)
id (varchar)
response (mediumtext)
PRIMARY KEY(timestamp,method,id)
What is the best method of selecting the most recent responses for all existing combinations of method and id?
For each date there can only be one response for a given method/id.
Not all call combinations are necessarily present for a given date.
There are dozens of methods, thousands of ids and at least 356 different dates
Sample data:
timestamp method id response
2009-01-10 getThud 16 "....."
2009-01-10 getFoo 12 "....."
2009-01-10 getBar 12 "....."
2009-01-11 getFoo 12 "....."
2009-01-11 getBar 16 "....."
Desired result:
2009-01-10 getThud 16 "....."
2009-01-10 getBar 12 "....."
2009-01-11 getFoo 12 "....."
2009-01-11 getBar 16 "....."
(I don't think this is the same question - it won't give me the most recent response)
I have a single MYSQL Question and need help ASAP.
Database:
Email | Name | Tag
[email protected] |Test Person | TagOne
[email protected] |Test Person | Tag Two
Need an SQL query that will return
Email | Name | Tag
[email protected] |Test Person | TagOne, Tag Two
Any help?
how can I extract the first 2 C-Values ('Baby' and 'Cola') where B is 'RED'. Input instance is:
<Root>
<A>
<B>BLACK</B>
<C>Apple</C>
</A>
<A>
<B>RED</B>
<C>Baby</C>
</A>
<A>
<B>GREEN</B>
<C>Sun</C>
</A>
<A>
<B>RED</B>
<C>Cola</C>
</A>
<A>
<B>RED</B>
<C>Mobile</C>
</A>
</Root>
Output instance must be:
<Root>
<D>Baby</D>
<D>Cola</D>
</Root>
I thought about the combination of for-each and global variables. But in XSLT it is not possible to change the value for a global variable to break the for-each. I have no idea anymore.
I have a contracts table:
contractId date price partId
1 20120121 10 1
2 20110130 9 1
3 20130101 15 2
4 20110101 20 2
The contract with greatest date being the active contract (don't blame me, I blame infor for creating xpps)
I need to create query to see only active contracts (one contract per part, the contract with highest date).
So the result of the query should be like this:
contractId date price partId
1 20120121 10 1
3 20130101 15 2
I am out of ideas here, I tried self joining the table, I tried aggregation functions, but I can't figure it out. If anyone would have any idea, please share them with me..
I had a table (Some_Table) with two columns:
A B
-------------------
1 test
2 test
3 test1
4 test1
i would like to return DISTINCT values for column B and it's associated value in column A (first in distinct set), so something like this:
A B
-----------
1 test
3 test1
What is the sql?
I have a relationship like this:
class E {
string name
hasMany = [me:ME]
}
class M {
float price
}
class ME {
E e
M m
int quantity
}
And I'd hate to iterate to achieve this: "obtain the sum of the quantity in ME times the price of the corresponding M for a given E".
Any hints on how to implement it using GORM/HQL ?
Thanks in advance
Below is my example script:
<li><a <?php if ($_GET['page']=='photos' && $_GET['view']!=="projects"||!=="forsale") { echo ("href=\"#\" class=\"active\""); } else { echo ("href=\"/?page=photos\""); } ?>>Photos</a></li>
<li><a <?php if ($_GET['view']=='projects') { echo ("href=\"#\" class=\"active\""); } else { echo ("href=\"/?page=photos&view=projects\""); } ?>>Projects</a></li>
<li><a <?php if ($_GET['view']=='forsale') { echo ("href=\"#\" class=\"active\""); } else { echo ("href=\"/?page=photos&view=forsale\""); } ?>>For Sale</a></li>
I want the PHP to echo the "href="#" class="active" only when it is not on the two pages:
?page=photos&view=forsale
or
?page=photos&view=projects
I have an ASP.Net webpage where the user selects a row for editing. I want to use the row lock on that row and once the user finishes the editing and updates another user can edit that row i.e. How can I use rowlock so that only one user can edit a row?
Thank you
a.2<-sample(1:10,100,replace=T)
b.2<-sample(1:100,100,replace=T)
a.3<-data.frame(a.2,b.2)
r<-sapply(split(a.3,a.2),function(x) which.max(x$b.2))
a.3[r,]
returns the list index, not the index for the entire data.frame
Im trying to return the largest value of b.2 for each subgroup of a.2. How can I do this efficiently?
Under
(BOOL)peoplePickerNavigationController:(ABPeoplePickerNavigationController *)
peoplePicker
shouldContinueAfterSelectingPerson:(ABRecordRef)person
property:(ABPropertyID)property
identifier:(ABMultiValueIdentifier)identifier{}
is it possible to get returned the phone number or somewhat the user has clicked?
I am having trouble with a ListView I created: I want an item to get selected when I click on it.
My code for this looks like:
protected void onResume() {
...
ListView lv = getListView();
lv.setOnItemSelectedListener(new OnItemSelectedListener()
{
public void onItemSelected(AdapterView<?> adapterView, View view, int pos, long id) {
Log.v(TAG, "onItemSelected(..., " + pos + ",...) => selected: " + getSelectedItemPosition());
}
public void onNothingSelected(AdapterView<?> adapterView) {
Log.v(TAG, "onNothingSelected(...) => selected: " + getSelectedItemPosition());
}
});
lv.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView<?> adapterView, View view, int pos, long id) {
lv.setSelection(pos);
Log.v(TAG, "onItemClick(..., " + pos + ",...) => selected: " + getSelectedItemPosition());
}
});
...
}
When I run this and click e.g. on the second item (i.e. pos=1) I get:
04-03 23:08:36.994: V/DisplayLists(663): onItemClick(..., 1,...) => selected: -1
i.e. even though the OnItemClickListener is called with the proper argument and calls a setSelection(1), there is no item selected (and hence also OnItemSelectedListener.onItemSelected(...) is never called) and getSelectedItemPosition() still yields -1 after the setSelection(1)-call.
What am I missing?
Michael
PS.: My list does have =2 elements...
Hi all. Please be gentle, I'm still learning. I imagine that the solution to my problem is simple and that perhaps I have just been in front of the computer too long.
I am trying to detect the size of the viewport, and then use a different sized image for a background on an element depending on the size of the viewport.
Here is what I have so far:
$(document).ready(function(){
var pageWidth = $(window).width();
if ( pageWidth <= 1280 ) {
$('#contact').css('background-image', 'url(../images/contact_us_low.jpg)');
}
elseif ( pageWidth > 1280 ) {
$('#contact').css('background-image', 'url(../images/contact_us_high.jpg)');
}
});
Error:
missing ; before statement
[Break on this error] elseif ( pageWidth 1280 ) {\n (Line 7)
To me it seems like all of my semi-colons are in the right place. Two questions:
Am I going about solving the problem in a sensible way? To me a simple conditional should solve this background problem, as the code is merely selecting between two images based on what size it detects the viewport to be.
Can you please help point out my n00b syntax error? Sometimes it really does help to have an extra pair of eyes look at something like this, even if small.
Thank you kindly for your advice, I will continue poking and perusing the docs I have available to me.
hello, i have following function:
function delete_auswahl()
{
var anzahl =document.getElementById ("warenkorbfeld").length ;
for (var i =0; i<=anzahl; i++)
{
if (document.getElementById ("warenkorbfeld").options[i].selected==true)
{
if (document.getElementById ("warenkorbfeld").options[i].id == "Margherita" )
gesamtbetrag = gesamtbetrag - 4;
if (document.getElementById ("warenkorbfeld").options[i].id=="Salami" )
gesamtbetrag = gesamtbetrag - 4.50;
if (document.getElementById ("warenkorbfeld").options[i].id=="Hawaii" )
gesamtbetrag = gesamtbetrag - 5.50;
document.getElementById ("warenkorbfeld").options[i]=null;
i--;// auf der gleichen stelle bleiben, da dass nächste feld nachrückt
}
}
document.getElementById('gesamtbetrag').innerHTML=gesamtbetrag ;
}
before i added values with
function hinzu (pizza)
{
NeuerEintrag = new Option(pizza, pizza, false, false);
document.getElementById("warenkorbfeld").options[document.getElementById("warenkorbfeld").length] = NeuerEintrag ;
if (pizza=="Margherita")
{
gesamtbetrag = gesamtbetrag + 4;
}
if (pizza=="Salami")
{
gesamtbetrag = gesamtbetrag + 4.50;
}
if (pizza=="Hawaii")
{
gesamtbetrag = gesamtbetrag + 5.50;
}
document.getElementById('gesamtbetrag').innerHTML=gesamtbetrag ;
}
now, in the delete function doesn't substract the price.
despite this, all works.
what's wrong with this term?
if (document.getElementById ("warenkorbfeld").options[i].id == "Margherita" )
gesamtbetrag = gesamtbetrag - 4;
thanks in advance
How can I query a table which has a column of data type HIERARCHYID and get a list of descendants X levels deep under an employee?
Here is the current structure:
CREATE TABLE [dbo].[Employees](
[NodeId] [hierarchyid] NOT NULL,
[EmployeeId] [int] IDENTITY(1,1) NOT NULL,
[FirstName] [varchar](120) NULL,
[MiddleInitial] [varchar](1) NULL,
[LastName] [varchar](120) NULL,
[DepartmentId] [int] NULL,
[Title] [varchar](120) NULL,
[PhoneNumber] [varchar](20) NULL,
[IM] [varchar](120) NULL,
[Photo] [varbinary](max) NULL,
[Bio] [varchar](400) NULL,
[Active] [bit] NULL,
[ManagerId] [int] NULL
)
Hi!
I have a collection of elements of type B and C, which all extends A. I need to filter the collection to get elements of only B type.
Is there any way to do it except:
for (A a : initCollection) {
if (a instance of B) {
newCollection.add(a)?
}
}
Thanks
I have an architecture similar to this:
<div id="container">
<div>stuff here</div>
<div>stuff here</div>
<div>stuff here</div>
<div>stuff here</div>
</div>
I want to, using jQuery, hide the cursor when the mouse enters #container. However as the nested divs appear on top it doesn't quite work that way. How can I hide the mouse cursor when hovering over any of the divs within #container. Below is the cursor hiding code.
$('#container').mouseover(function()
{
$(this).css({cursor: 'none'});
});
I am in need of a jquery based 360 rotational slider I want the user to be able to grab the end and rotate it 360 degrees anyone know of anything like that I can't seem to find one
I have the following tables/columns:
Parent:
ParentID
Child:
ChildID
ParentID
SubChild:
SubChildID
ChildID
Date
Parent has 1 to Many relationship with Child
Child has 1 to Many relationship with SubChild
For every Parent, I need to get the SubChild with the most recent Date value.
How can I do this using SQL. I've tried using MAX(Date),
but I can't seem to figure out how to join Parent and Child successfully.
The ideal result set would contain all the Parents joined with all the SubChild columns of the latest record.
Note: using MS SQL 2005+
I have a Users Table where it stores city, state and country along with other Users attributes. The states are stored as California, Alabama and so forth. Now I want to retrieve the user information for certain records but the state should get translated to two digit code. Say 'California' should be 'CA'. How should I go about doing this.
I was thinking to create a mapping table for state names with there abbreviation and then use some sort of replace function to do it.
Any ideas ?