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 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...
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)
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 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
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 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
)
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 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 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 ?
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
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.
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 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+
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
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
Our solution is built using Release|x86; however, when our designers try to build using Blend they are forced to use Any CPU which we don't want to to add since it's going to change the behavior. I checked version 4, and it does not seem to address this issue.
Is there a way to specify Solution Configuration/Platform when using Blend? Any workarounds?
Hi folks,
From source1 and source2 i gather that IE9 will NOT support multi-column css3!! Since it is still the most popular browser (another thing i cannot understand), i am left but no other choice than to use Programming Power to make multi-columns work.
Now, I use three divs that float to left, and which are manually filled with text. Please don't laugh i know its stupid! But I would wish to not to have to worry about the columns and just have a one piece of (un-interrupted) text which all goes into only 1 div, and then have a program smart enough to split it up into X equally wide columns.
Question: before i start reinvent the wheel, what methods of programming power have you known that tackle this elegantly? Please suggest your best working multi-column layout sources so I can evaluate which option is the best (I will update the below table).
Exploring all possibilities 2011 and further, to enable multi column text user experience:
Language Author SourceCodeUsage WorksOnAllMajorBrowser?
=================================================================================
html manual labour put text manually in separate left-floating divs "Y"
// Upside: control! Downside: few changes necessitates to reflow 3 divs manually!
CSS3 w3c css3.info/preview/multi-column-layout/ "N"
// {-moz-column-count: 3; -webkit-column-count: 3; } Thats all!
javascript a list apart will add url soon ?
//
php ? ? ?
//
I have a workbook that contains rows of information that needs to printed to a seperate worksheet in excel. I am trying to utilize a checkbox to indicate which items need to print and which items need to be skipped. The checkbox is located in column "A" and once checked and the macro ran, I want it to pick up the data in each cell of that particular row, transfer it a seperate worksheet (form), prompt and save the worksheet to pdf, clear the form, and then return to the main worksheet to continue until all rows have been checked. However, right now, my code is only looping through the very first "TRUE" statement and not continuing to the rest. Here is the code:
Private Sub CommandButton1_Click()
On Error GoTo ErrHandler:
Dim i As Integer
For i = 1 To 10
If ActiveSheet.OLEObjects("CheckBox" & i).Object.Value = False Then
Else
If ActiveSheet.OLEObjects("CheckBox" & i).Object.Value = True Then
Call PrintWO
Else
End If
Do Until ActiveSheet.OLEObjects("CheckBox" & i).Object.Value = 10
MsgBox "Nothing Selected to Print"
Exit Do
Exit Sub
Loop
End If
Next i
ErrHandler:
End Sub
Take the following file...
ABCD,1234,http://example.com/mpe.exthttp://example/xyz.ext
EFGH,5678,http://example.com/wer.exthttp://example/ljn.ext
Note that "ext" is a constant file extension throughout the file.
I am looking for an expression to turn that file into something like this...
ABCD,1234,http://example.com/mpe.ext
ABCD,1234,http://example/xyz.ext
EFGH,5678,http://example.com/wer.ext
EFGH,5678,http://example/ljn.ext
In a nutshell I need to capture everything up to the urls. Then I need to capture each URL and put them on their own line with the leading capture.
I am working with sed to do this and I cannot figure out how to make it work correctly. Any ideas?
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
Say I have an unordered list like so:
<ul>
<li>Some Text</li>
<li>Some Text</li>
<li>Some Text</li>
<li>Some Text</li>
</ul>
I want to use jquery so that when I click a "li", the background changes to blue. So I do this:
$('li').click(function() {
$(this).addClass('active');
});
And the "active" class has as background of blue. However, I can't figure out how to make it so that when I click another "li", the other "li" that has a background of blue stops having a background of blue. I guess what I'm trying to say is how to make only one "li" have a background of blue at a time--using jquery.
So I have this table of book orders, it contains 2 columns, one is the order ID(primary key) and another is the ID of the book that the customer ordered. For example:
| OrderID | BookID |
| 0001 | B002 |
| 0002 | B005 |
| 0003 | B002 |
| 0004 | B003 |
| 0005 | B005 |
| 0006 | B002 |
| 0007 | B002 |
What I want is to get the IDs of the books that got 2 or more purchases/orders, for example if I run the SQL query against the above data, I would get this as the result:
| BookID |
| B002 |
| B005 |
I don't know if this can be archived in SQL or I have to built a simpler statement and repetitive run the query against all the records in another language. I need some help and thanks for reading my question.