I am making a button invisible once it gets clicked. Is there any nice animation (programmably from code behind) code that fade the button away instead of sudden disappearance?
How I can lookup a specific date in Nhibernate?
I'm currently using this to lookup one day's order.
ICriteria criteria = SessionManager.CurrentSession.CreateCriteria(typeof(Order))
.Add(Expression.Between("DateCreated", date.Date.AddDays(-1), date.Date.AddDays(1)))
.AddOrder(NHibernate.Criterion.Order.Desc("OrderID"));
I tried the following code, but they did bring the data for me.
Expression.Eq("DateCreated", date)
Expression.Like("DateCreated", date)
Note:
The pass in date value will be like this 2010-04-03 00:00:00,
The actual date value in the database will be like this 2010-03-13 11:17:16.000
Can anyone let me know how to do this?
Many thanks.
I have a class2 which is involved by class1 when clicks are made. I have to pass some parameters/objects from class1 to class2. I only know the standard way which does not have an option of passing parameters.
// launch the full article
Intent i = new Intent(this, Class2.class);
startActivity(i);
I have a problem parsing a stored procedure parameter in the form:
declare @S varchar(100)
set @S = '4=2,24=1534'
Here's the query:
select
cast(idx as varchar(100)) 'idx'
, value
, SUBSTRING(value, 1, charindex(value, '=')+1) 'first'
, SUBSTRING(value, charindex(value, '=')+1, LEN(value)-charindex(value, '=')-1) 'second'
from Common.SplitToTable(@S, ',') -- returns (idx int, value varchar(max))
where len(value) > 0
But here is the result I get:
idx value first second
0 4=2 4 4=
1 24=1534 2 24=153
Here's what I expected:
idx value first second
0 4=2 4 2
1 24=1534 2 1534
Help?
I understand there are multiple questions about this on SO, but I have yet to find a definitive answer of "yes, here's how..."
So here it is again: What are the possible ways to store an unsigned integer value (32-bit value or 32-bit bitmap) into a 4-byte field in SQL Server?
Here are ideas I have seen:
1) Use a -1*2^31 offset for all values
Disadvantages: need to perform math on the values before reading/writing/aggregating.
2) Use 4 tinyint fields
Disadvantages: need to concatenate values to perform any operations
3) Use binary(4)
Disadvantages: actually uses 4 + 2 bytes of space
I have a order list and I want to generate and rank the product with its total sales and quantity. With @tvanfosson's help, I can bring the grouped product detail with the following code, but how can I calculate and add up the total sales and quantity into each productListResult's object?
Can anyone help me with this?
Many thanks.
var orderProductVariantListResult = productList.SelectMany(o => o.OrderProductVariantList)
.Select(opv => new {
Product = opv.ProductVariant.Product,
Quantity = opv.Quantity,
PriceSales = opv.PriceSales,
Sales = opv.Quantity * opv.PriceSales,
});
var productListResult = orderProductVariantResult
.Select(pv => pv.Product)
.GroupBy(p => p)
.Select(g => new
{
Product = g.Key,
TotalOrderCount = g.Count()
})
.OrderByDescending(x => x.TotalOrderCount).ToList();
I can get the current action name by using the following code
var currentActionName = ControllerContext.RouteData.GetRequiredString("action");
but is it possible to get the previous action name as well?
How I can lookup a specific date in Nhibernate?
I'm currently using this to lookup one day's order.
ICriteria criteria = SessionManager.CurrentSession.CreateCriteria(typeof(Order))
.Add(Expression.Between("DateCreated", date.Date.AddDays(-1), date.Date.AddDays(1)))
.AddOrder(NHibernate.Criterion.Order.Desc("OrderID"));
I tried the following code, but they did bring the data for me.
Expression.Eq("DateCreated", date)
Expression.Like("DateCreated", date)
Note:
The pass in date value will be like this 2010-04-03 00:00:00,
The actual date value in the database will be like this 2010-03-13 11:17:16.000
Can anyone let me know how to do this?
Many thanks.
My client wants to dogfood my android app. They don't have eclipse and don't want to install it. It there a more convenient way to send my apk to them? Can I send it via email and let them open the attachment in mobile device? Will it start installing itself automatically?
I have rewritten a VB6 based application developed in Delphi, which should have only one instance running. How can I do this with minimum of code?
In VB6 we just have to use one single line of code
If App.PrevInstance Then
'Take some action
End If
On goggling I did find a solution but it is very length and we have to mess with .drp file.
I do not want to do that.
I want something simpler.
Scaling up memcached to a cluster of shards/partitions requires either distributed routing/partition table maintenance or centralized proxying (and other stuff like detecting failures). What are the popular/typical approaches/systems here? There's software like libketama, which provides consistent hashing, but this is just a client-side library that reacts to messages about node arrivals/departures---do most users just run something like this, plus separate monitoring nodes that, on detecting failures, notify all the libketamas of the departure? I imagine something like this might be sufficient since typical use of memcached as a soft-state cache doesn't require careful attention to consistency, but I'm curious what people do.
Sometimes R stops displaying output. I type the number 1, followed by the return key, and nothing appears.
This situation occurred after I pressed the "STOP" icon in the window, which is for stopping long calculations. I'm using R 2.11.0 on a Mac.
Does pressing "STOP" cause R to stop displaying output? How do I get R to display output again?
I'm using Windows to develop android apps and want to know where user preference data is located. It says at /data/data/package/...., but where can I actually see the preference file? Via eclipse or command line tools?
I have an html-like xml, basically it is html. I need to get the elements in each . Each element looks like this:
<line tid="744476117"> <attr>1414</attr> <attr>31</attr><attr class="thread_title">title1</attr><attr>author1</attr><attr>date1</attr></line>
My code is as below, it does recognize that there are 50 in the file, but it gives me NULLPointException when parsing NodeList fstNmElmntLst = fstElmnt.getElementsByTagName("attr");
Any idea why this is happening? The same code has been used for other applications without problems.
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
InputSource is = new InputSource();
is.setCharacterStream(new StringReader(cleanxml));
Document doc = db.parse(is);
doc.getDocumentElement().normalize();
System.out.println("Root element " + doc.getDocumentElement().getNodeName());
NodeList nodeLst = doc.getElementsByTagName("line");
for (int s = 0; s < nodeLst.getLength(); s++) {
System.out.println(nodeLst.getLength());
Node fstNode = nodeLst.item(s);
if (fstNode.getNodeType() == Node.ELEMENT_NODE) {
Element fstElmnt = (Element) fstNode;
NodeList fstNmElmntLst = fstElmnt.getElementsByTagName("attr");
Element fstNmElmnt = (Element) fstNmElmntLst.item(0);
NodeList fstNm = fstNmElmnt.getChildNodes();
System.out.println("attr : " + ((Node) fstNm.item(0)).getNodeValue());
}
}
Hi there, I have recently ran into this strange issue, I was trying to reference parent window in an iframe, but somehow window.parent or parent are always undefined.
I got around the problem by using window.top, but this question still haunts me.
Why is window.parent undefined?
This is a .NET web app, if it helps.
Update: I would like to add that both parent and child iframes are pointed to the same domain (localhost). As for code, I have tried the following code:
if (parent != null)
{
// do something
}
where do something never happens, I also tried
alert(parent)
and
alert(window.parent)
they always come out as null.
I am trying to replace my previous ugly text button with an imagebutton. However, after changing the XML file with the following ImageButton code, my application won't even start. Why?
<ImageButton
android:layout_height="fill_parent"
android:id="@+id/refresh"
android:src="@drawable/refresh"
/>
<?php
$sendto = "[email protected]";
$subject = "email confirmation"; // Subject
$message = "the body of the email - this email is to confirm etc...";
# send the email
mail($sendto, $subject, $message);
?>
this is the code that i wrote to test mail function on localhost.
i have ran the script in browser for several times and still dun receive any email in my mail box.
Do I need any additional configurations?
thx in advance!
These two statements are logically equivalent:
select * from Table where someColumn between 1 and 100
select * from Table where someColumn >= 1 and someColumn <= 100
Is there a potential performance benefit to one versus the other?
I know it has been asked for many times, i also have found a lot of answers on this website, but i just cannot get out this problem.
Can anyone help me with this piece of code?
Many thanks.
Here is my parent mapping file
<set name="ProductPictureList" table="[ProductPicture]" lazy="true" order-by="DateCreated" inverse="true" cascade="all-delete-orphan" >
<key column="ProductID"/>
<one-to-many class="ProductPicture"/>
</set>
Here is my child mapping file
<class name="ProductPicture" table="[ProductPicture]" lazy="true">
<id name="ProductPictureID">
<generator class="identity" />
</id>
<property name="ProductID" type="Int32"></property>
<property name="PictureName" type="String"></property>
<property name="DateCreated" type="DateTime"></property>
</class>
Here is my c# code
var item = _productRepository.Get(productID);
var productPictrue = item.ProductPictureList
.OfType<ProductPicture>()
.Where(x => x.ProductPictureID == productPictureID);
// reomve the finding item
var ok = item.ProductPictureList.Remove(productPictrue);
_productRepository.SaveOrUpdate(item);
ok is false value and this child object is still in my database.
We may use the following code to clear keyboard buffer:
while PeekMessage(Msg, 0, WM_KEYFIRST, WM_KEYLAST, PM_REMOVE or PM_NOYIELD) do;
But how may I clear mouse click buffer?
Please forgive my programming knowledge. I know this is a simple thing, but I do not understand why result is always 0. Why decimal will be fine?
int a = 100;
int b = 200;
decimal c = (a / b) * 100;
Many thanks.
I have three arrays that need to be combined in one three-dimension array. The following code shows slow performance in Performance Explorer. Is there a faster solution?
for (int i = 0; i < sortedIndex.Length; i++) {
if (i < num_in_left)
{
// add instance to the left child
leftnode[i, 0] = sortedIndex[i];
leftnode[i, 1] = sortedInstances[i];
leftnode[i, 2] = sortedLabels[i];
}
else
{
// add instance to the right child
rightnode[i-num_in_left, 0] = sortedIndex[i];
rightnode[i-num_in_left, 1] = sortedInstances[i];
rightnode[i-num_in_left, 2] = sortedLabels[i];
}
}
Update:
I'm actually trying to do the following:
//given three 1d arrays
double[] sortedIndex, sortedInstances, sortedLabels;
// copy them over to a 3d array (forget about the rightnode for now)
double[] leftnode = new double[sortedIndex.Length, 3];
// some magic happens here so that
leftnode = {sortedIndex, sortedInstances, sortedLabels};
hi guys, when i am using 'localhost' as the host for mysql database, sequel pro alert me that i will be using socket, if i am using '127.0.0.1', i am actually using the ip address and port 3306 to locate the server.
is there any difference?
if a style is used, it can not be modified agaign. so i need a clone method. but its hard to implement.
what i want to do is implementing a cascading 'style' mechanism. for example, i set two style to the same frameworkelement. the same property of latter style will override the former one, while the different property remain unchanged.
but if i set the style property of the frameworkelement twice directly, the 1st style will be gone. so i use the baseon property of style class to do that. but now come across another problem, the style can not be modified after it's been set to a frameworkelement.
so now i need a clone method.