to retrieve k random numbers from an array of undetermined size we use a technique called reservoir sampling. Can anybody briefly highlight how it happens with a sample code??
I have an html file where i am loading images from an xml file in to it. i am using jtemplate for that. I am getting the images properly.but i want to display them horizontaly those are coming as vertical. Please help me to do that,This is the sample.
I have a complex project using SilverLight Toolkit's ListBoxDragDropTarget for drag-drop operations and it is maxing CPU. I tried to reproduce the issue in a small sample project, but then it works fine. The problem persists when I remove our custom styles and all other controls from the page, but the page is hosted in another page's ScrollView.
"EnableRedrawRegions" shows that the screen gets redrawn on every frame. My question is this: How can I track down the cause of this constant redrawing?
Friends,
I need to debug a application. The using Oracle Workshop for weblogic 10.3, I have downloaded plugins for TPTP. when i tested working of TPTP in a sample Java Standard-alone application it worked. but when i tried to use it for Web-app which uses Weblogic, it prompting me the above error[in the subject]. Please help.
How to specify a fixed digit number in antlr grammar?
I want to parse a line which contains fields of fixed number of characters. Each field is a number.
0034|9056|4567|0987|-2340| +345|1000
The above line is a sample line. | indicates field boundaries.
The fields can include blank characters +/-
Recently I created a spike of a view engine, in which views are plain classes, and the content is created by using funny using-scope blocks.
The code together with a simple sample site is available at http://code.google.com/p/sharp-view-engine/
Here I'd like to hear your opinions regarding such an idea. Is it completely weird or maybe someone likes it?
Does anyone know any sample Oracle SOAP XML requests that that queries the database?
For example, the url:
http://myoracle:7778/oracle/soap/soaprouter/
I'd like to program xml requests and get return xml database.
But I have no idea on the Oracle SOAP format.
Please provide an example.
It seems like there should be a simpler way than:
import string
s = "string. With. Punctuation?" # Sample string
out = s.translate(string.maketrans("",""), string.punctuation)
Is there?
I've heard this term used a lot in the same context as logging, but I can't seem to find a clear definition of what it actually is.
Is it simply a more general class of logging/monitoring tools and activities?
Please provide sample code/scenarios when/how instrumentation should be used.
what is annotation class. what is the use of it in java/android.
In iphone Annotation is used to drop a pin on the map..
java has java.lang.Annotation package... what is the use of it? can i have a examples, tutorials,sample codes, etc?
I am looking for some large public datasets, in particular:
Large sample web server logs that have been anonymized.
Datasets used for database performance benchmarking.
Any other links to large public datasets would be appreciated. I already know about Amazon's public datasets at: http://aws.amazon.com/publicdatasets/
GAE Datastore Table Display using JSON and Google Visualization Table?
Anyone has experience on this? How Google Visualization Table will render pagination with JSON? Really need an example on how to do this or another solution on achieving same result?
I just want to render my table just like this sample using above methode and source.
Thx
hello friends i am new to networking in iphone.i would like to see some sample code for cache its not based on image.i need for complete url. thanks in advance.
I have a custom uitableviewcell with several labels and I would like for some of them to autoresize their frame (width) based on the content (text). I am not sure how to accomplish that. I tried to set fixed frame of the label and after apply autoresizingMask, but that doesn't do the trick. Any *pointer to a sample?
The problem: combobox is databound to a DataView, first item in the dataview is DataRowView whose fields are DBNull.Value; Combo DropdownStyle = ComboBoxStyle.DropDownList
Loads fine, displays fine, selects fine, problem is to Unselect via code. Setting the SelectedIndex to 0 throws an exception. (Setting to -1 is a no-no as per msdn doco that says dont set SelectedIndex=-1 if databound)
So how to unselect without throwing an exception ?
For now i wrapped it into a try/catch to just ignore the error!
EDIT: As asked by Hubeza, i worked on sample code to post. Did a stripped down version of the original code in C# (original is in VB.NET) and could NOT reproduce it either. Converted to VB.NET and could NOT reproduce it either ! In other words, SelectedIndex = 0 does work in the stripped down version!
Currently further investigating what else could be wrong with the original code.
EDIT2: Case Closed. Call me a stupid fool if you like, and apologies for wasting anyone's time - The error was originating from MyComboBox_SelectedIndexChanged event, which i neglected to check !
May as well post the sample in case anyone finds useful.
private void LoadComboMethod() {
DataTable dtFruit = new DataTable("FruitTable");
//define columns
DataColumn colID = new DataColumn();
colID.DataType = typeof(Int32); //VB.NET GetType(Int32)
colID.ColumnName = "ID";
DataColumn colDesc = new DataColumn();
colDesc.DataType = typeof(String);
colDesc.ColumnName = "Description";
//add columns to table
dtFruit.Columns.AddRange(new DataColumn[] { colID, colDesc });
//add rows
DataRow row = dtFruit.NewRow();
row[colID] = 1; row[colDesc] = "Apples";
dtFruit.Rows.Add(row);
row = dtFruit.NewRow();
row[colID] = 1; row[colDesc] = "Bananas";
dtFruit.Rows.Add(row);
row = dtFruit.NewRow();
row[colID] = 1; row[colDesc] = "Oranges";
dtFruit.Rows.Add(row);
//add extra blank row.
DataRowView drv = dtFruit.DefaultView.AddNew();
drv.EndEdit();
//Bind combo box
DataView dv = new DataView(dtFruit);
dv.Sort = "ID ASC"; //ensure blank item on top
cboFruit.DataSource = dv;
cboFruit.DisplayMember = "Description";
cboFruit.ValueMember = "ID";
}
private void UnselectComboMethod() {
if (cboFruit.SelectedIndex > 0)
{
cboFruit.SelectedIndex = 0;
}
else
{
MessageBox.Show("no fruit selected");
}
}
Hi,
I am able to list Documents from "Public Folders"
Using this sample code :
session.LogonExchangeMailbox("[email protected]", "server");
RDOFolder folder = session.GetFolderFromPath(@"\Public Folders\All Public Folders");
Now i want to Extract this documents to another location.
Hello,
Whenever I try to create a custom window using NSBorderlessWindowMask and set an NSView (for example an NSImageView) as its contentView, I get a 1px gray border around the NSView and I don't seem to be able to get rid of it.
I have followed several approaches including Apple's RoundTransparentWindow sample code as well as several suggestions on StackOverflow.
I suspect the gray border is either coming from the window itself or the NSView.
Have any of you experienced this problem or do you have a possible solution?
Thanks
Hi, I'm new to R, and I'm having trouble figuring out how to replace the FOR loop in the function below. The function estimates a population mean. Any help at all would be much appreciated. Thank you!
myFunc<- function(){
myFRAME <- read.csv(file="2008short.csv",head=TRUE,sep=",")
meanTotal <- 0
for(i in 1:100)
{
mySample <- sample(myFRAME$TaxiIn, 100, replace = TRUE)
tempMean <- mean(mySample)
meanTotal <- meanTotal + tempMean
}
cat("Estimated Mean: ", meanTotal/100, "\n") #print result
}
I thought using colons in URIs was "illegal". Then I saw that vimeo.com is using URIs like http://www.vimeo.com/tag:sample.
What do you feel about the usage of colons in URIs?
How do I make my Apache server work with the "colon" syntax because now it's throwing the "Access forbidden!" error when there is a colon in the first segment of the URI?
I have just tried using the NSArchiver but for some reason I am getting this error.
I have downloaded a sample project and get the same error too.
Could it be something wrong with my installation?!
Thanks
I'd set up a site a while back using Django-CMS and it was working fine. However, after upgrading to the latest version of both Django and Django-CMS, it doesn't work anymore...when I try to run the development server, I get this message:
"Signal recerivers must accept keyword arguments (**kwargs)."
AssertionError: Signal receivers must accept keyword arguments (**kwargs).
What could be the problem here? I've tried running the sample app that comes with the CMS and it works just fine.
I currently have a Service in Android that is a sample VOIP client so it listens out for SIP messages and if it recieves one it starts up an Activity screen with UI components.
Then the following SIP messages determine what the Activity is to display on the screen.
For example if its an incoming call it will display Answer or Reject or an outgoing call it will show a dialling screen.
At the minute I use Intents to let the Activity know what state it should display.
An example is as follows:
Intent i = new Intent();
i.setAction(SIPEngine.SIP_TRYING_INTENT);
i.putExtra("com.net.INCOMING", true);
sendBroadcast(i);
Intent x = new Intent();
x.setAction(CallManager.SIP_INCOMING_CALL_INTENT);
sendBroadcast(x);
Log.d("INTENT SENT", "INTENT SENT INCOMING CALL AFTER PROCESSINVITE");
So the activity will have a broadcast reciever registered for these intents and will switch its state according to the last intent it received.
Sample code as follows:
SipCallListener = new BroadcastReceiver(){
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if(SIPEngine.SIP_RINGING_INTENT.equals(action)){
Log.d("cda ", "Got RINGING action SIPENGINE");
ringingSetup();
}
if(CallManager.SIP_INCOMING_CALL_INTENT.equals(action)){
Log.d("cda ", "Got PHONE RINGING action");
incomingCallSetup();
}
}
};
IntentFilter filter = new IntentFilter(CallManager.SIP_INCOMING_CALL_INTENT);
filter.addAction(CallManager.SIP_RINGING_CALL_INTENT);
registerReceiver(SipCallListener, filter);
This works however it seems like it is not very efficient, the Intents will get broadcast system wide and Intents having to fire for different states seems like it could become inefficient the more I have to include as well as adding complexity.
So I was wondering if there is a different more efficient and cleaner way to do this?
Is there a way to keep Intents broadcasting only inside an application?
Would callbacks be a better idea? If so why and in what way should they be implemented?
A fair bit is written about literate programming, but I've yet to see any project that uses it in any capacity, nor have I seen it used to teach programming. My sample may small, so I'm looking for evidence that literate programming exists and is successful in the real world.
How to import import Msn contact in our application?
I want to learn about importing msn contact list in my java appication.
Need help on this and where can i find the sample java code for achieving this?