question stringlengths 11 28.2k | answer stringlengths 26 27.7k | tag stringclasses 130
values | question_id int64 935 78.4M | score int64 10 5.49k |
|---|---|---|---|---|
I am a little bit confused about the data augmentation performed in PyTorch. Now, as far as I know, when we are performing data augmentation, we are KEEPING our original dataset, and then adding other versions of it (Flipping, Cropping...etc). But that doesn't seem like happening in PyTorch. As far as I understood from... | I assume you are asking whether these data augmentation transforms (e.g. RandomHorizontalFlip) actually increase the size of the dataset as well, or are they applied on each item in the dataset one by one and not adding to the size of the dataset.
Running the following simple code snippet we could observe that the latt... | DataSet | 51,677,788 | 100 |
Say I have large datasets in R and I just want to know whether two of them they are the same. I use this often when I'm experimenting different algorithms to achieve the same result. For example, say we have the following datasets:
df1 <- data.frame(num = 1:5, let = letters[1:5])
df2 <- df1
df3 <- data.frame(num = c(1:... | Look up all.equal. It has some riders but it might work for you.
all.equal(df3,df4)
# [1] TRUE
all.equal(df2,df1)
# [1] TRUE
| DataSet | 19,119,320 | 98 |
I use a DataTable with Information about Users and I want search a user or a list of users in this DataTable. I try it butit don't work :(
Here is my c# code:
public DataTable GetEntriesBySearch(string username,string location,DataTable table)
{
list = null;
list = table;
... | You can use DataView.
DataView dv = new DataView(yourDatatable);
dv.RowFilter = "query"; // query example = "id = 10"
http://www.csharp-examples.net/dataview-rowfilter/
| DataSet | 13,012,585 | 94 |
Just having some problems running a simulation on some weather data in Python. The data was supplied in a .tif format, so I used the following code to try to open the image to extract the data into a numpy array.
from PIL import Image
im = Image.open('jan.tif')
But when I run this code I get the following error:
PIL.... | Try
PIL.Image.MAX_IMAGE_PIXELS = 933120000
How to find out such a thing?
import PIL
print(PIL.__file__) # prints, e. g., /usr/lib/python3/dist-packages/PIL/__init__.py
Then
cd /usr/lib/python3/dist-packages/PIL
grep -r -A 2 'exceeds limit' .
prints
./Image.py: "Image size (%d pixels) exceeds limit of %d ... | DataSet | 51,152,059 | 91 |
I'm just getting started using ADO.NET and DataSets and DataTables. One problem I'm having is it seems pretty hard to tell what values are in the data table when trying to debug.
What are some of the easiest ways of quickly seeing what values have been saved in a DataTable? Is there someway to see the contents in Visua... | With a break point set, after the DataTable or DataSet is populated, you can see a magnifying glass if you hover over the variable. If you click on it, it will bring up the DataTable Visualizer, which you can read about here.
In this image you see below, dt is my DataTable variable and the breakpoint was hit a few lin... | DataSet | 1,337,084 | 90 |
I have an asp.net application, and now I am using datasets for data manipulation. I recently started to convert this dataset to a List collection. But, in some places it doesn't work. One is that in my old version I am using datarow[] drow = dataset.datatable.select(searchcriteria). But in the List collection there is... | Well, to start with List<T> does have the FindAll and ConvertAll methods - but the more idiomatic, modern approach is to use LINQ:
// Find all the people older than 30
var query1 = list.Where(person => person.Age > 30);
// Find each person's name
var query2 = list.Select(person => person.Name);
You'll need a using di... | DataSet | 3,801,748 | 79 |
At the moment, when I iterate over the DataRow instances, I do this.
foreach(DataRow row in table)
return yield new Thingy { Name = row["hazaa"] };
Sooner of later (i.e. sooner), I'll get the table to be missing the column donkey and the poo will hit the fan. After some extensive googling (about 30 seconds) I discov... | You can create an extension method to make it cleaner:
static class DataRowExtensions
{
public static object GetValue(this DataRow row, string column)
{
return row.Table.Columns.Contains(column) ? row[column] : null;
}
}
Now call it like below:
foreach(DataRow row in table)
return yield new Thi... | DataSet | 18,208,311 | 77 |
Here is my c# code
Employee objEmp = new Employee();
List<Employee> empList = new List<Employee>();
foreach (DataRow dr in ds.Tables[0].Rows)
{
empList.Add(new Employee { Name = Convert.ToString(dr["Name"]), Age = Convert.ToInt32(dr["Age"]) });
}
It uses a loop to create a List from a dataset.Is there any direct m... | Try something like this:
var empList = ds.Tables[0].AsEnumerable()
.Select(dataRow => new Employee
{
Name = dataRow.Field<string>("Name")
}).ToList();
| DataSet | 17,107,220 | 76 |
I was trying to generate a Report using Export to Excell, PDF, TextFile. Well I am doing this in MVC. I have a class which I named SPBatch (which is the exact name of my Stored Procedure in my SQL) and it contains the following:
public string BatchNo { get; set; }
public string ProviderName { get; set; }
public Nullabl... | try with
dt.Columns.Add(pi.Name, Nullable.GetUnderlyingType(
pi.PropertyType) ?? pi.PropertyType);
| DataSet | 23,233,295 | 71 |
I am reading an XML file into a DataSet and need to get the data out of the DataSet. Since it is a user-editable config file the fields may or may not be there. To handle missing fields well I'd like to make sure each column in the DataRow exists and is not DBNull.
I already check for DBNull but I don't know how to ma... | DataRow's are nice in the way that they have their underlying table linked to them. With the underlying table you can verify that a specific row has a specific column in it.
If DataRow.Table.Columns.Contains("column") Then
MsgBox("YAY")
End If
| DataSet | 178,712 | 62 |
Is it possible to use any datasets available via the kaggle API in Google Colab? I see the Kaggle API is used in this Colab notebook, but it's a bit unclear to me what datasets it provides access to.
| Step-by-step --
Create an API key in Kaggle.
To do this, go to kaggle.com/ and open your user settings page.
Next, scroll down to the API access section and click generate
to download an API key.
This will download a file called kaggle.json to your computer.
You'll use this file in Colab to access Kaggle datasets an... | DataSet | 49,310,470 | 61 |
I am reading some values in data attribute fields. I have seen two easy ways to read the data as shown below:
var webappData = document.getElementById('web-app-data'),
rating = webappData.dataset.rating;
OR
var effectData = $('.effects-list li'),
creative = effectData.filter('[data-creative]').data("creative")... | dataset is a native property of an element that contains the data attributes, it's a new(ish) addition and as such is only supported in IE11+, Chrome 8+, FF 6+ etc.
A more cross browser solution would be to get the attribute directly
webappData.getAttribute('data-rating');
data() is a jQuery method, and other than us... | DataSet | 23,596,751 | 58 |
Can someone please help how to get the list of built-in data sets and their dependency packages?
| There are several ways to find the included datasets in R:
1: Using data() will give you a list of the datasets of all loaded packages (and not only the ones from the datasets package); the datasets are ordered by package
2: Using data(package = .packages(all.available = TRUE)) will give you a list of all datasets in t... | DataSet | 33,797,666 | 57 |
What is the most direct route to get a DataSet if I have a sql command?
string sqlCommand = "SELECT * FROM TABLE";
string connectionString = "blahblah";
DataSet = GetDataSet(sqlCommand,connectionString);
GetDataSet()
{
//...?
}
I started with SqlConnection and SqlCommand, but the closest thing I see in the API is... | public DataSet GetDataSet(string ConnectionString, string SQL)
{
SqlConnection conn = new SqlConnection(ConnectionString);
SqlDataAdapter da = new SqlDataAdapter();
SqlCommand cmd = conn.CreateCommand();
cmd.CommandText = SQL;
da.SelectCommand = cmd;
DataSet ds = new DataSet();
///conn.Open... | DataSet | 6,584,817 | 55 |
I have an Excel worksheet I want to read into a datatable - all is well except for one particular column in my Excel sheet. The column, 'ProductID', is a mix of values like ########## and n#########.
I tried to let OleDB handle everything by itself automatically by reading it into a dataset/datatable, but any values in... | Using .Net 4.0 and reading Excel files, I had a similar issue with OleDbDataAdapter - i.e. reading in a mixed data type on a "PartID" column in MS Excel, where a PartID value can be numeric (e.g. 561) or text (e.g. HL4354), even though the excel column was formatted as "Text".
From what I can tell, ADO.NET chooses th... | DataSet | 3,232,281 | 55 |
I'm modifying someone else's code where a query is performed using the following:
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter(sqlString, sqlConn);
da.Fill(ds);
How can I tell if the DataSet is empty (i.e. no results were returned)?
| If I understand correctly, this should work for you
if (ds.Tables[0].Rows.Count == 0)
{
//
}
| DataSet | 2,976,473 | 55 |
Howdy, I have a DataRow pulled out of a DataTable from a DataSet. I am accessing a column that is defined in SQL as a float datatype. I am trying to assign that value to a local variable (c# float datatype) but am getting an InvalidCastExecption
DataRow exercise = _exerciseDataSet.Exercise.FindByExerciseID(65);
_A... | A SQL float is a double according to the documentation for SQLDbType.
| DataSet | 122,523 | 51 |
What does the "vs" variable mean in the "mtcars" dataset in R? The helpfile says it means "V/S" but that is not enlightening.
Commands:
data(mtcars)
head(mtcars)
?mtcars
| I think it's whether the car has a V engine or a straight engine. I'm basing this on the foot note on the page numered 396 of http://www.mortality.org/INdb/2008/02/12/8/document.pdf
| DataSet | 18,617,174 | 49 |
I have a dataset with the following structure:
Classes ‘tbl_df’ and 'data.frame': 10 obs. of 7 variables:
$ GdeName : chr "Aeugst am Albis" "Aeugst am Albis" "Aeugst am Albis" "Aeugst am Albis" ...
$ Partei : chr "BDP" "CSP" "CVP" "EDU" ...
$ Stand1971: num NA NA 4.91 NA 3.21 ...
$ Stand1975: num NA NA 5.3... | Using the latest version of dplyr (>=0.7), you can use the rlang !! (bang-bang) operator.
library(tidyverse)
from <- "Stand1971"
to <- "Stand1987"
data %>%
mutate(diff=(!!as.name(from))-(!!as.name(to)))
You just need to convert the strings to names with as.name and then insert them into the expression. Unfortunatel... | DataSet | 29,678,435 | 47 |
I am brand new to LINQ and am trying to query my DataSet with it. So I followed this example to the letter, and it does not work.
I know that my DataTable needs the .AsEnumerable on the end, but it is not recognized by the IDE. What am I doing wrong? Am I missing a reference/import that is not shown in the example (... | While the class holding the extensions is in the System.Data namespace, it's located in an assembly that isn't added to your project by default. Add a reference to System.Data.DataSetExtensions to your project and it should be ok. Remember that, even after you've added the reference, any class that expects to use the... | DataSet | 3,949,302 | 44 |
I'm tring to get a string from a DataSet without using GetXml. I'm using WriteXml, instead. How to use it to get a string?
Thanks
| string result = null;
using (TextWriter sw = new StringWriter())
{
dataSet.WriteXml(sw);
result = sw.ToString();
}
| DataSet | 963,870 | 41 |
I am doing some exercises with datasets like so:
List with many dictionaries
users = [
{"id": 0, "name": "Ashley"},
{"id": 1, "name": "Ben"},
{"id": 2, "name": "Conrad"},
{"id": 3, "name": "Doug"},
{"id": 4, "name": "Evin"},
{"id": 5, "name": "Florian"},
{"id": 6, "name": "Gerald"}
]
Dictio... | This relates to column oriented databases versus row oriented. Your first example is a row oriented data structure, and the second is column oriented. In the particular case of Python, the first could be made notably more efficient using slots, such that the dictionary of columns doesn't need to be duplicated for every... | DataSet | 30,522,982 | 40 |
DataTable dt = ds.Tables[4].AsEnumerable()
.Where(x => ((DateTime)x["EndDate"]).Date >= DateTime.Now.Date)
.CopyToDataTable();
ds.Tables[4] has rows but it throws the exception
"The source contains no DataRows."
Any idea how to handle or get rid of this exception?
| ds.Tables[4] might have rows, but the result of your LINQ query might not, which is likely where the exception is being thrown. Split your method chaining to use interim parameters so you can be dead certain where the error is occurring. It'll also help you check for existing rows using .Any() before you call CopyToDat... | DataSet | 28,324,740 | 39 |
Here is my dataset:
After locking my dataframe by year and grouping by month, I proceed with calculating percentage increase/decrease as a new column; it ends up looking like this:
Now for my Plotly plot I use this to display traces and add some hover info:
fig.add_trace(go.Scatter(x=group_dfff.Months, y=group_dfff.... | For Plotly Express, you need to use the custom_data argument when you create the figure. For example:
fig = px.scatter(
data_frame=df,
x='ColX',
y='ColY',
custom_data=['Col1', 'Col2', 'Col3']
)
and then modify it using update_traces and hovertemplate, referencing it as customdata. For example:
fig.u... | DataSet | 59,057,881 | 38 |
To whom this may concern, I have searched a considerable amount of time, to work a way out of this error
"Deleted row information cannot be accessed through the row"
I understand that once a row has been deleted from a datatable that it cannot be accessed in a typical fashion and this is why I am getting this error.... | You can also use the DataSet's AcceptChanges() method to apply the deletes fully.
ds.Tables[0].Rows[0].Delete();
ds.AcceptChanges();
| DataSet | 4,321,840 | 38 |
Does anyone know of a Javascript charting library that can handle huge datasets?
By 'huge', I mean drawing a line graph with around 1,000 lines and 25,000 data points in total. (With an uneven distribution of points per line. A lot of lines have very few points, but some have up to 4,000.) Here is an example data file.... | In their example, the dygraphs library handles six thousand data points in a very fast manner. Perhaps that would be suitable for your needs?
It is based on Canvas with excanvas for IE support.
| DataSet | 5,019,674 | 36 |
How can I find out which column and value is violating the constraint? The exception message isn't helpful at all:
Failed to enable constraints. One or
more rows contain values violating
non-null, unique, or foreign-key
constraints.
| Like many people, I have my own standard data access components, which include methods to return a DataSet. Of course, if a ConstraintException is thrown, the DataSet isn't returned to the caller, so the caller can't check for row errors.
What I've done is catch and rethrow ConstraintException in such methods, logging... | DataSet | 140,161 | 36 |
For quick testing, debugging, creating portable examples, and benchmarking, R has available to it a large number of data sets (in the Base R datasets package). The command library(help="datasets") at the R prompt describes nearly 100 historical datasets, each of which have associated descriptions and metadata.
Is there... | You can use rpy2 package to access all R datasets from Python.
Set up the interface:
>>> from rpy2.robjects import r, pandas2ri
>>> def data(name):
... return pandas2ri.ri2py(r[name])
Then call data() with any dataset's name of the available datasets (just like in R)
>>> df = data('iris')
>>> df.describe()
... | DataSet | 16,579,407 | 34 |
After making some changes to my SQL database structure (using scripts in SQL Server Management Studio), how can I update my DataSet.xsd file in Visual Studio to match the new structure? Must I do this manually?
I considered deleting the DataSet and importing a new one, but I'll lose all my custom Table Adapter queries... | From the MSDN Forums:
If you right-click the TableAdapter in the Dataset Designer and click
'Configure' the TableAdapter Configuration Wizard opens where you can
reconfigure the main query that defines the schema of your table. This
should leave the additional TableAdapter queries (the additional
methods) that were ad... | DataSet | 9,497,689 | 33 |
Tensorflow seems to lack a reader for ".npy" files.
How can I read my data files into the new tensorflow.data.Dataset pipline?
My data doesn't fit in memory.
Each object is saved in a separate ".npy" file. each file contains 2 different ndarrays as features and a scalar as their label.
| It is actually possible to read directly NPY files with TensorFlow instead of TFRecords. The key pieces are tf.data.FixedLengthRecordDataset and tf.io.decode_raw, along with a look at the documentation of the NPY format. For simplicity, let's suppose that a float32 NPY file containing an array with shape (N, K) is give... | DataSet | 48,889,482 | 29 |
Is there any way to remove a dataset from an hdf5 file, preferably using h5py? Or alternatively, is it possible to overwrite a dataset while keeping the other datasets intact?
To my understanding, h5py can read/write hdf5 files in 5 modes
f = h5py.File("filename.hdf5",'mode')
where mode can be rfor read, r+ for read-w... | Yes, this can be done.
with h5py.File(input, "a") as f:
del f[datasetname]
You will need to have the file open in a writeable mode, for example append (as above) or write.
As noted by @seppo-enarvi in the comments the purpose of the previously recommended f.__delitem__(datasetname) function is to implement the d... | DataSet | 31,861,724 | 29 |
I can check for a DBnull on a data row using any of the methods.
Either by using
if(dr[0][0]==DBNull.Value)
//do somethin
or by doing
if(dr[0][0].ToString().IsNullOrEmpty())
//do something
In Both Cases I will be getting same result.
But Which one is conecptually right approach. Which was will use less resources
| The first way is somewhat correct.
However, more accepted way is:
if ( dr[0][0] is DBNull )
And the second way is definitely incorrect. If you use the second way, you will get true in two cases:
Your value is DBNull
Your value is an empty string
| DataSet | 3,393,958 | 29 |
I have a Generic list of Objects. Each object has 9 string properties. I want to turn that list into a dataset that i can pass to a datagridview......Whats the best way to go about doing this?
| I apologize for putting an answer up to this question, but I figured it would be the easiest way to view my final code. It includes fixes for nullable types and null values :-)
public static DataSet ToDataSet<T>(this IList<T> list)
{
Type elementType = typeof(T);
DataSet ds = new DataSet();
... | DataSet | 1,245,662 | 29 |
I am using a dataset to insert data being converted from an older database. The requirement is to maintain the current Order_ID numbers.
I've tried using:
SET IDENTITY_INSERT orders ON;
This works when I'm in SqlServer Management Studio, I am able to successfully
INSERT INTO orders (order_Id, ...) VALUES ( 1, ...);
H... | You have the options mixed up:
SET IDENTITY_INSERT orders ON
will turn ON the ability to insert specific values (that you specify) into a table with an IDENTITY column.
SET IDENTITY_INSERT orders OFF
Turns that behavior OFF again and the normal behavior (you can't specify values for IDENTITY columns since they are au... | DataSet | 1,234,780 | 29 |
I have a dataset of ~2m observations which I need to split into training, validation and test sets in the ratio 60:20:20. A simplified excerpt of my dataset looks like this:
+---------+------------+-----------+-----------+
| note_id | subject_id | category | note |
+---------+------------+-----------+-----------+... | This is solved in scikit-learn 1.0 with StratifiedGroupKFold
In this example you generate 3 folds after shuffling, keeping groups together and does stratification (as much as possible)
import numpy as np
from sklearn.model_selection import StratifiedGroupKFold
X = np.ones((30, 2))
y = np.array([0, 0, 1, 1, 1, 1, 1, 1,... | DataSet | 56,872,664 | 28 |
I need to read the ''wdbc.data' in the following data folder:
http://archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisconsin/
Doing this in R is easy using command read.csv but as the header is missing how can I add it? I have the information but don't know how to do this and I'd prefer do not edit th... | You can do the following:
Load the data:
test <- read.csv(
"http://archive.ics.uci.edu/ml/machine-learning-databases/breast-cancer-wisconsin/breast-cancer-wisconsin.data",
header=FALSE)
Note that the default value of the header argument for read.csv is TRUE so in order to get all lines you need to ... | DataSet | 14,021,675 | 27 |
Well. I have a DataTable with multiple columns and multiple rows.
I want to loop through the DataTable dynamically basically the output should look as follows excluding the braces :
Name (DataColumn)
Tom (DataRow)
Peter (DataRow)
Surname (DataColumn)
Smith (DataRow)
Brown (DataRow)
foreach (DataColumn col in rightsT... | foreach (DataColumn col in rightsTable.Columns)
{
foreach (DataRow row in rightsTable.Rows)
{
Console.WriteLine(row[col.ColumnName].ToString());
}
}
| DataSet | 12,198,131 | 27 |
How can I create a DataSet that is manually filled? ie. fill through the code or by user input. I want to know the required steps if I need to create a DataTable or a DataRow first, I really don't know the steps to fill the DataSet.
| DataSet ds = new DataSet();
DataTable dt = new DataTable("MyTable");
dt.Columns.Add(new DataColumn("id",typeof(int)));
dt.Columns.Add(new DataColumn("name", typeof(string)));
DataRow dr = dt.NewRow();
dr["id"] = 123;
dr["name"] = "John";
dt.Rows.Add(dr);
ds.Tables.Add(dt);
| DataSet | 3,125,864 | 27 |
I have a DataSet full of costumers. I was wondering if there is any way to filter the dataset and only get the information I want. For example, to get CostumerName and CostumerAddress for a costumer that has CostumerID = 1
Is it possible?
| You can use DataTable.Select:
var strExpr = "CostumerID = 1 AND OrderCount > 2";
var strSort = "OrderCount DESC";
// Use the Select method to find all rows matching the filter.
foundRows = ds.Table[0].Select(strExpr, strSort);
Or you can use DataView:
ds.Tables[0].DefaultView.RowFilter = strExpr;
UPDATE I'm ... | DataSet | 6,007,872 | 26 |
I'm trying to add to a new DataSet X a DataTable that is inside of a different DataSet Y.
If I add it directly, I get the following error:
DataTable already belongs to another DataSet.
Do I have to clone the DataTable and import all the rows to it and then add the new DataTable to the new DataSet? Is there a better/e... | There are two easy ways to do this:
DataTable.Copy
Instead of DataTable.Clone, use DataTable.Copy to create a copy of your data table; then insert the copy into the target DataSet:
dataSetX.Tables.Add( dataTableFromDataSetY.Copy() );
DataSet.Merge
You could also use DataSet.Merge for this:
dataSetX.Merge(dataTableFrom... | DataSet | 4,897,080 | 26 |
I am trying to output values of each rows from a DataSet:
for ($i=0;$i -le $ds.Tables[1].Rows.Count;$i++)
{
Write-Host 'value is : ' + $i + ' ' + $ds.Tables[1].Rows[$i][0]
}
gives the output ...
value is : +0+ +System.Data.DataSet.Tables[1].Rows[0][0]
value is : +1+ +System.Data.DataSet.Tables[1].Rows[1][0]
valu... | The PowerShell string evaluation is calling ToString() on the DataSet. In order to evaluate any properties (or method calls), you have to force evaluation by enclosing the expression in $()
for($i=0;$i -lt $ds.Tables[1].Rows.Count;$i++)
{
write-host "value is : $i $($ds.Tables[1].Rows[$i][0])"
}
Additionally foreac... | DataSet | 804,133 | 26 |
I have this:
If String.IsNullOrEmpty(editTransactionRow.pay_id.ToString()) = False Then
stTransactionPaymentID = editTransactionRow.pay_id 'Check for null value
End If
Now, when editTransactionRow.pay_id is Null Visual Basic throws an exception. Is there something wrong with this code?
| The equivalent of null in VB is Nothing so your check wants to be:
If editTransactionRow.pay_id IsNot Nothing Then
stTransactionPaymentID = editTransactionRow.pay_id
End If
Or possibly, if you are actually wanting to check for a SQL null value:
If editTransactionRow.pay_id <> DbNull.Value Then
...
End If
| DataSet | 378,225 | 26 |
According to this page, it's possible to use TClientDataset as an in-memory dataset, completely independent of any actual databases or files. It describes how to setup the dataset's table structure and how to load data into it at runtime. But when I tried to follow its instructions in D2009, step 4 (table.Open) raise... | At runtime you can use table.CreateDataset or if this is on a design surface you can right click on the CDS and click create dataset. You need to have specified columns/types for the CDS before you can do this though.
| DataSet | 274,958 | 26 |
Is any place I can download Treebank of English phrases for free or less than $100? I need training data containing bunch of syntactic parsed sentences (>1000) in English in any format. Basically all I need is just words in this sentences being recognized by part of speech.
| Here are a couple (English) treebanks available for free:
American National Corpus: MASC
Questions: QuestionBank and Stanford's corrections
British news: BNC
TED talks: NAIST-NTT TED Treebank
Georgetown University Multilayer Corpus: GUM
Biomedical:
NaCTeM GENIA treebank
Brown GENIA treebank
CRAFT corpus
See also Wi... | DataSet | 8,949,517 | 25 |
What I want to do
I'm trying to use the Microsoft.Office.Interop.Excel namespace to open an Excel file (XSL or CSV, but sadly not XSLX) and import it into a DataSet. I don't have control over the worksheet or column names, so I need to allow for changes to them.
What I've tried
I've tried the OLEDB method of this in th... | What about using Excel Data Reader (previously hosted here) an open source project on codeplex? Its works really well for me to export data from excel sheets.
The sample code given on the link specified:
FileStream stream = File.Open(filePath, FileMode.Open, FileAccess.Read);
//1. Reading from a binary Excel file ('9... | DataSet | 7,244,971 | 25 |
I'm attempting to use the DataSet designer to create a datatable from a query. I got this down just fine. The query used returns a nullable datetime column from the database. But, when it gets around to this code:
DataSet1.DataTable1DataTable table = adapter.GetData();
This throws a StrongTypingException from:
[glo... | Typed data sets don't support nullable types. They support nullable columns.
The typed data set generator creates non-nullable properties and related methods for handling null values. If you create a MyDate column of type DateTime and AllowDbNull set to true, the DataRow subclass will implement a non-nullable DateTim... | DataSet | 1,638,746 | 25 |
I need a solution to export a dataset to an excel file without any asp code (HttpResonpsne...) but i did not find a good example to do this...
Best thanks in advance
| I've created a class that exports a DataGridView or DataTable to an Excel file. You can probably change it a bit to make it use your DataSet instead (iterating through the DataTables in it). It also does some basic formatting which you could also extend.
To use it, simply call ExcelExport, and specify a filename and wh... | DataSet | 373,925 | 25 |
Say I am loading MNIST from torchvision.datasets.MNIST, but I only want to load in 10000 images total, how would I slice the data to limit it to only some number of data points? I understand that the DataLoader is a generator yielding data in the size of the specified batch size, but how do you slice datasets?
tr = da... | You can use torch.utils.data.Subset() e.g. for the first 10,000 elements:
import torch.utils.data as data_utils
indices = torch.arange(10000)
tr_10k = data_utils.Subset(tr, indices)
| DataSet | 44,856,691 | 24 |
I have 10000 BMP images of some handwritten digits. If i want to feed the datas to a neural network what do i need to do ? For MNIST dataset i just had to write
(X_train, y_train), (X_test, y_test) = mnist.load_data()
I am using Keras library in python . How can i create such dataset ?
| You can either write a function that loads all your images and stack them into a numpy array if all fits in RAM or use Keras ImageDataGenerator (https://keras.io/preprocessing/image/) which includes a function flow_from_directory. You can find an example here https://gist.github.com/fchollet/0830affa1f7f19fd47b06d4cf89... | DataSet | 39,289,285 | 24 |
In C#, I'm trying to loop through my dataset to show data from each row from a specific column. I want the get each date under the column name "TaskStart" and display it on a report, but its just shows the date from the first row for all rows can anybody help?
foreach (DataTable table in ds.Tables)
{
foreach (... | I believe you intended it more this way:
foreach (DataTable table in ds.Tables)
{
foreach (DataRow dr in table.Rows)
{
DateTime TaskStart = DateTime.Parse(dr["TaskStart"].ToString());
TaskStart.ToString("dd-MMMM-yyyy");
rpt.SetParameterValue("TaskStartDate", TaskStart);
}
}
You alwa... | DataSet | 15,252,223 | 24 |
I want to return virtual table from stored procedure and I want to use it in dataset in c# .net. My procedure is a little complex and can't find how to return a table and set it in a dataset
Here is my procedure to modify:
ALTER PROCEDURE [dbo].[Procedure1]
@Start datetime,
@Finish datetime,
@TimeRange ... | Try this
DataSet ds = new DataSet("TimeRanges");
using(SqlConnection conn = new SqlConnection("ConnectionString"))
{
SqlCommand sqlComm = new SqlCommand("Procedure1", conn);
sqlComm.Parameters.AddWithValue("@Start", StartTime);
sqlComm.Parame... | DataSet | 12,973,773 | 24 |
I have an RDLC file in which I want to make an expression.
Here is the image of properties of expression. I need to concatenate First Name, Last name and Middle Init.
| The following examples works for me:
=Fields!FirstName.Value & " " & Fields!LastName.Value
or
="$ " & Sum(Round((Fields!QTD_ORDER.Value - Fields!QTD_RETURN.Value) * Fields!PRICE.Value,2), "Entity_orderItens")
Have a look at MSDN
| DataSet | 5,552,292 | 24 |
I just realized that DBUnit doesn't create tables by itself (see How do I test with DBUnit with plain JDBC and HSQLDB without facing a NoSuchTableException?).
Is there any way for DBUnit to automatically create tables from a dataset or dtd?
EDIT: For simple testing of an in-memory database like HSQLDB, a crude approac... | Not really. As the answer you linked points out, the dbunit xml files contain data, but not column types.
And you really don't want to do this; you risk polluting your database with test artifacts, opening up the possibility that production code will accidentally rely on tables created by the test process.
Needing to d... | DataSet | 1,531,324 | 24 |
I'm trying to insert a column into an existing DataSet using C#.
As an example I have a DataSet defined as follows:
DataSet ds = new DataSet();
ds.Tables.Add(new DataTable());
ds.Tables[0].Columns.Add("column_1", typeof(string));
ds.Tables[0].Columns.Add("column_2", typeof(int));
ds.Tables[0].Columns.Add("column_4", ty... | You can use the DataColumn.SetOrdinal() method for this purpose.
DataSet ds = new DataSet();
ds.Tables.Add(new DataTable());
ds.Tables[0].Columns.Add("column_1", typeof(string));
ds.Tables[0].Columns.Add("column_2", typeof(int));
ds.Tables[0].Columns.Add("column_4", typeof(string));
ds.Tables[0].Columns.Add("column_3",... | DataSet | 351,557 | 24 |
I've got a DataSet in VisualStudio 2005. I need to change the datatype of a column in one of the datatables from System.Int32 to System.Decimal. When I try to change the datatype in the DataSet Designer I receive the following error:
Property value is not valid. Cannot change DataType of a column once
it has data... | I get the same error but only for columns with its DefaultValue set to any value (except the default <DBNull>). So the way I got around this issue was:
Column DefaultValue : Type in <DBNull>
Save and reopen the dataset
| DataSet | 47,217 | 24 |
For example, I have the following data frame:
> dataFrame <- read.csv(file="data.csv")
> dataFrame
Ozone Solar.R Wind Temp Month Day
1 41 190 7.4 67 5 1
2 36 118 8.0 72 5 2
3 12 149 12.6 74 5 3
4 18 313 11.5 62 5 4
5 NA NA 14.3 56 ... | You just need to use the square brackets to index your dataframe. A dataframe has two dimensions (rows and columns), so the square brackets will need to contain two pieces of information: row 10, and all columns. You indicate all columns by not putting anything. So your code would be this:
dataFrame[10,]
| DataSet | 34,696,951 | 23 |
I have a fraud detection algorithm, and I want to check to see if it works against a real world data set.
My algorithm says that a claim is usual or not.
Are there any data sets available?
| Below are some datasets I found that might be related.
Credit fraud
German credit fraud dataset: in weka's arff format
Email fraud
Enron dataset
Credit Approval
German credit dataset@ UCI
Australian credit approval
Intrusion Dectection
Intrusion Detection kddcup99 dataset
| DataSet | 14,151,327 | 23 |
I'm trying to fill DataSet which contains 2 tables with one to many relationship.
I'm using DataReader to achieve this :
public DataSet SelectOne(int id)
{
DataSet result = new DataSet();
using (DbCommand command = Connection.CreateCommand())
{
command.CommandText = "select *... | Filling a DataSet with multiple tables can be done by sending multiple requests to the database, or in a faster way: Multiple SELECT statements can be sent to the database server in a single request. The problem here is that the tables generated from the queries have automatic names Table and Table1. However, the gener... | DataSet | 11,345,761 | 23 |
What is the difference between a dataset and a database ? If they are different then how ?
Why is huge data difficult to be manageusing databases today?!
Please answer independent of any programming language.
| In American English, database usually means "an organized collection of data". A database is usually under the control of a database management system, which is software that, among other things, manages multi-user access to the database. (Usually, but not necessarily. Some simple databases are just text files processe... | DataSet | 7,782,594 | 23 |
I want to create a dataset that has the same format as the cifar-10 data set to use with Tensorflow. It should have images and labels. I'd like to be able to take the cifar-10 code but different images and labels, and run that code.
| First we need to understand the format in which the CIFAR10 data set is in. If we refer to: https://www.cs.toronto.edu/~kriz/cifar.html, and specifically, the Binary Version section, we see:
the first byte is the label of the first image, which
is a number in the range 0-9. The next 3072 bytes are the values of
the pi... | DataSet | 35,032,675 | 22 |
We're often working on a project where we've been handed a large data set (say, a handful of files that are 1GB each), and are writing code to analyze it.
All of the analysis code is in Git, so everybody can check changes in and out of our central repository. But what to do with the data sets that the code is working w... | use submodules to isolate your giant files from your source code. More on that here:
http://git-scm.com/book/en/v2/Git-Tools-Submodules
The examples talk about libraries, but this works for large bloated things like data samples for testing, images, movies, etc.
You should be able to fly while developing, only pausing ... | DataSet | 6,268,628 | 22 |
I am trying to load a dataset into R using the data() function. It works fine when I use the dataset name (e.g. data(Titanic) or data("Titanic")). What doesn't work for me is loading a dataset using a variable instead of its name. For example:
# This works fine:
> data(Titanic)
# This works fine as well:
> data("Titan... | Use the list argument. See ?data.
data(list=myvar)
You'll also need myvar to be a character string.
myvar <- "Titanic"
Note that myvar <- Titanic only worked (I think) because of the lazy loading of the Titanic data set. Most datasets in packages are loaded this way, but for other kinds of data sets, you'd still nee... | DataSet | 19,912,833 | 21 |
I've found myself increasingly unsatisfied with the DataSet/DataTable/DataRow paradigm in .Net, mostly because it's often a couple of steps more complicated than what I really want to do. In cases where I'm binding to controls, DataSets are fine. But in other cases, there seems to be a fair amount of mental overhead.... | Since .NET 3.5 came out, I've exclusively used LINQ. It's really that good; I don't see any reason to use any of those old crutches any more.
As great as LINQ is, though, I think any ORM system would allow you to do away with that dreck.
| DataSet | 18,533 | 21 |
Reading Interactive Analysis of Web-Scale Datasets paper, I bumped into the concept of repetition and definition level.
while I understand the need for these two, to be able to disambiguate occurrences, it attaches a repetition and definition level to each value.
What is unclear to me is how they computed the levels..... | The Dremel striping algorithm is by no means trivial.
To answer your first question:
The repetition level of en-us is 0 since it is the first occurrence of a name.language.code path within the record.
The repetition level of en is 2, since the repetition occurred at level 2 (the language tag).
To answer your sec... | DataSet | 43,568,132 | 20 |
I have an RDD[LabeledPoint] intended to be used within a machine learning pipeline. How do we convert that RDD to a DataSet? Note the newer spark.ml apis require inputs in the Dataset format.
| Here is an answer that traverses an extra step - the DataFrame. We use the SQLContext to create a DataFrame and then create a DataSet using the desired object type - in this case a LabeledPoint:
val sqlContext = new SQLContext(sc)
val pointsTrainDf = sqlContext.createDataFrame(training)
val pointsTrainDs = pointsTra... | DataSet | 37,513,667 | 20 |
There are a lot of examples online of how to fill a DataSet from a text file but I want to do the reverse. The only thing I've been able to find is this but it seems... incomplete?
I want it to be in a readable format, not just comma delimited, so non-equal spacing between columns on each row if that makes sense. Here ... | This should space out fixed length font text nicely, but it does mean it will process the full DataTable twice (pass 1: find longest text per column, pass 2: output text):
static void Write(DataTable dt, string outputFilePath)
{
int[] maxLengths = new int[dt.Columns.Count];
for (int i = 0; i < ... | DataSet | 7,174,077 | 20 |
The RODBC documentation suggests it is possible, but I am not sure how to read data from a Microsoft Access (the new .accdb format) file with this package into R (on Debian GNU/Linux). The vignette talks about drivers, but I do not quite understand how I can see which drivers are installed, and in particular, if I have... | To import a post-2007 Microsoft Access file (.accdb) into R, you can use the RODBC package.
For an .accdb file called "foo.accdb" with the following tables, "bar" and "bin", stored on the desktop of John Doe's computer:
library(RODBC) #loads the RODBC package
dta <- odbcConnectAccess2007("C:/Users/JohnDoe/Desktop/fo... | DataSet | 7,109,844 | 20 |
I download and clip some youtube videos with pytube but some videos are not downloading and asking for age verification. How can I solve this? Thanks for your advice
| For pytube 15.0.0 I had the AgeRestrictedError in streams contents even using the use_oauth option.
I fixed the problem only replacing ANDROID_MUSIC with ANDROID as "client" at line 223 of innertube.py:
def __init__(self, client='ANDROID_MUSIC', use_oauth=False, allow_cache=True):
def __init__(self, client='ANDROID',... | DataSet | 75,791,765 | 19 |
I'm using Visual Studio 2008 with C#.
I have a .xsd file and it has a table adapter. I want to change the table adapter's command timeout.
Thanks for your help.
| With some small modifications csl's idea works great.
partial class FooTableAdapter
{
/**
* <summary>
* Set timeout in seconds for Select statements.
* </summary>
*/
public int SelectCommandTimeout
{
set
{
for (int i = 0; i < this.CommandCollection.Length; i++)
if (... | DataSet | 1,192,171 | 19 |
I am desperately trying to download the Ta-Feng grocery dataset for few days but appears that all links are broken. I needed for data mining / machine learning research for my msc thesis. I also have the Microsoft grocery database, the Belgian store and Supermarket.arff from Weka. However in the research they say Ta Fe... | The person that down voted doesn't understand the difficulty to find this valuable piece of information for machine learning related to supermarket scenarios. It is the biggest publicly available dataset containing 4 months of shopping transactions of the Ta-Feng supermarket. I got it from Prof. Chun Nan who was very k... | DataSet | 25,014,904 | 18 |
I would like to read the contents of a CSV file and create a dataset.
I am trying like this:
var lines = File.ReadAllLines("test.csv").Select(a => a.Split(';'));
DataSet ds = new DataSet();
ds.load(lines);
but apparently this is not correct.
| You need to add the reference Microsoft.VisualBasic.dll to use TextFieldParser Class.
private static DataTable GetDataTabletFromCSVFile(string csv_file_path)
{
DataTable csvData = new DataTable();
try
{
using(TextFieldParser csvReader = new TextFieldParser(csv_... | DataSet | 16,606,753 | 18 |
Does anyone know of any resources that provide good, useful stock datasets? For example, I've downloaded a SQL script that includes all of the U.S. states, cities, and zipcodes. This saved me a lot of time in a recent application where I wanted to be able to do lookups by geography. Are any of you aware of other use... | Lots of links to open data sets here:
http://readwrite.com/2008/04/09/where_to_find_open_data_on_the/
although I doubt any of them will generate SQL statements for you.
| DataSet | 4,512,600 | 18 |
Given a list of objects, I am needing to transform it into a dataset where each item in the list is represented by a row and each property is a column in the row. This DataSet will then be passed to an Aspose.Cells function in order to create an Excel document as a report.
Say I have the following:
public class Record
... | You can do it through reflection and generics, inspecting the properties of the underlying type.
Consider this extension method that I use:
public static DataTable ToDataTable<T>(this IEnumerable<T> collection)
{
DataTable dt = new DataTable("DataTable");
Type t = typeof(T);
PropertyInfo... | DataSet | 523,153 | 18 |
I would like to read in R a dataset from google drive as the
screenshot indicated.
Neither
url <- "https://drive.google.com/file/d/1AiZda_1-2nwrxI8fLD0Y6e5rTg7aocv0"
temp <- tempfile()
download.file(url, temp)
bank <- read.table(unz(temp, "bank-additional.csv"))
unlink(temp)
nor
library(RCurl)
bank_url <- dowload.fil... | Try
temp <- tempfile(fileext = ".zip")
download.file("https://drive.google.com/uc?authuser=0&id=1AiZda_1-2nwrxI8fLD0Y6e5rTg7aocv0&export=download",
temp)
out <- unzip(temp, exdir = tempdir())
bank <- read.csv(out[14], sep = ";")
str(bank)
# 'data.frame': 4119 obs. of 21 variables:
# $ age : int 30 39 25 ... | DataSet | 47,851,761 | 17 |
I'm using a CSV dataset config element, which is reading from a file like this:
abd
sds
ase
sdd
ssd
cvv
Which, basically, has a number of 3 letter random string.
I'm assigning them to a variable called ${random_3}.
Now, I want to use values from this list multiple times within the same thread, but each time I want to ... | CSV Data Set Config works fine for this. All of the values need to be in one column in the file and assign them to the variable as described.
Create a Thread Group that has as many threads for as many users as you want iterating over the file (i.e. acting on the HTTP Request). Assuming 1 user, set the number of thread... | DataSet | 7,317,943 | 17 |
Does anyone know of a tool that can inspect a specified schema and generate random data based on the tables and columns of that schema?
| This is an interesting question. It is easy enough to generate random values - a simple loop round the data dictionary with calls to DBMS_RANDOM would do the trick.
Except for two things.
One is, as @FrustratedWithForms points out, there is the complication of foreign key constraints. Let's tip lookup values (referen... | DataSet | 6,189,275 | 17 |
What are the benefits of using the c# method DataRow.IsNull to determine a null value over checking if the row equals DbNull.value?
if(ds.Tables[0].Rows[0].IsNull("ROWNAME")) {do stuff}
vs
if(ds.Tables[0].Rows[0]["ROWNAME"] == DbNull.value) {do stuff}
| There is no real practical benefit. Use whichever one seems more readable to you.
As to the particular differences between them, the basic answer is that IsNull queries the null state for a particular record within a column. Using == DBNull.Value actually retrieves the value and does substitution in the case that it's ... | DataSet | 5,599,390 | 17 |
I have to consume a .NET hosted web service from a Java application. Interoperability between the two is usually very good. The problem I'm running into is that the .NET application developer chose to expose data using the .NET DataSet object. There are lots of articles written as to why you should not do this and how ... | Unfortunately I don't think there's an easy answer here. What I would do is create a Proxy web service in .NET that you could call from Java that would receive the dataset, transform it into something more consumable and then return that to your Java code.
| DataSet | 2,667,646 | 17 |
DataSets were one of the big things in .NET 1.0 and even now when using .NET 3.5 I still find myself having to use them....especially when I have to call a stored proc which returns a dataset which I then end up having to manually transform into an object to make it easier to work with.
I've never really liked DataSets... | For better or worse, the answer is simplicity. When the 2.0 Framework came out and TableAdapters were included in the process, it became ridiculously easy to get your basic CRUD type application, or even a front page showing data, rolling. Simply connect to your sever, drag your table(s) over, and the structure was in ... | DataSet | 552,371 | 17 |
I run my spark application in yarn cluster. In my code I use number available cores of queue for creating partitions on my dataset:
Dataset ds = ...
ds.coalesce(config.getNumberOfCores());
My question: how can I get number available cores of queue by programmatically way and not by configuration?
| There are ways to get both the number of executors and the number of cores in a cluster from Spark. Here is a bit of Scala utility code that I've used in the past. You should easily be able to adapt it to Java. There are two key ideas:
The number of workers is the number of executors minus one or sc.getExecutorStorage... | DataSet | 47,399,087 | 16 |
So, imagine having access to sufficient data (millions of datapoints for training and testing) of sufficient quality. Please ignore concept drift for now and assume the data static and does not change over time. Does it even make sense to use all of that data in terms of the quality of the model?
Brain and Webb (http:... | I did my master's thesis on this subject so I happen to know quite a bit about it.
In a few words in the first part of my master's thesis, I took some really big datasets (~5,000,000 samples) and tested some machine learning algorithms on them by learning on different % of the dataset (learning curves).
The hypothes... | DataSet | 25,665,017 | 16 |
I am working on sentiment analysis and I am using dataset given in this link: http://www.cs.jhu.edu/~mdredze/datasets/sentiment/index2.html and I have divided my dataset into 50:50 ratio. 50% are used as test samples and 50% are used as train samples and the features extracted from train samples and perform classificat... | There are many sources to get sentiment analysis dataset:
huge ngrams dataset from google storage.googleapis.com/books/ngrams/books/datasetsv2.html
http://www.sananalytics.com/lab/twitter-sentiment/
http://inclass.kaggle.com/c/si650winter11/data
http://nlp.stanford.edu/sentiment/treebank.html
or you can look into this... | DataSet | 24,605,702 | 16 |
I'm implementing an R package, where I have several big .rda data files in the 'data' folder.
When I build the package (with R CMD build to create the .tar.gz packed file), also the data files are included in the package, and since they are really big, this makes the build (as well the check) process very slow, and the... | If you use .Rbuildignore you should first build then check your package (it's not a check-ignore). Here a few tests in a Debian environment and a random package:
l@np350v5c:~/src/yapomif/pkg$ ls
data DESCRIPTION man NAMESPACE R
l@np350v5c:~/src/yapomif/pkg$ R
> save(Formaldehyde, file = "data/formal.rda")
l@np350... | DataSet | 23,382,030 | 16 |
In my dataset I have a number of continuous and dummy variables. For analysis with glmnet, I want the continuous variables to be standardized but not the dummy variables.
I currently do this manually by first defining a dummy vector of columns that have only values of [0,1] and then using the scale command on all the n... | In short, yes - this will standardize the dummy variables, but there's a reason for doing so. The glmnet function takes a matrix as an input for its X parameter, not a data frame, so it doesn't make the distinction for factor columns which you may have if the parameter was a data.frame. If you take a look at the R func... | DataSet | 17,887,747 | 16 |
I am creating my own R package and I was wondering what are the possible methods that I can use to add (time-series) datasets to my package. Here are the specifics:
I have created a package subdirectory called data and I am aware that this is the location where I should save the datasets that I want to add to my packag... | I'm not sure if I understood your question correctly. But, if you edit your data in your favorite format and save with
save(myediteddata, file="data.rda")
The data should be loaded exactly the way you saw it in R.
To load all files in data directory you should add
LazyData: true
To your DESCRIPTION file, in your pac... | DataSet | 16,507,295 | 16 |
The MSDN claims that the order is :
Child table: delete records.
Parent table: insert, update, and delete records.
Child table: insert and update records.
I have a problem with that.
Example : ParentTable have two records parent1(Id : 1) and parent2(Id : 2)
ChildTable have a record child1(Id : 1, ParentId : 1)
If we ... | You have to take their context into account. MS said
When updating related tables in a dataset, it is important to update
in the proper sequence to reduce the chance of violating referential
integrity constraints.
in the context of writing client data application software.
Why is it important to reduce the chance... | DataSet | 9,801,930 | 16 |
I want to know the difference between make_initializable_iterator and make_one_shot_iterator.
1. Tensorflow documentations said that A "one-shot" iterator does not currently support re-initialization. What exactly does that mean?
2. Are the following 2 snippets equivalent?
Use make_initializable_iterator
iterator = d... | Suppose you want to use the same code to do your training and validation. You might like to use the same iterator, but initialized to point to different datasets; something like the following:
def _make_batch_iterator(filenames):
dataset = tf.data.TFRecordDataset(filenames)
...
return dataset.make_initializ... | DataSet | 48,091,693 | 15 |
Dataset<Row> dataFrame = ... ;
StringIndexerModel labelIndexer = new StringIndexer()
.setInputCol("label")
.setOutputCol("indexedLabel")
.fit(dataFrame);
VectorIndexerModel featureIndexer = new VectorIndexer()
.setInputCol("s")
.setOutputCo... | String Indexer - Use it if you want the Machine Learning algorithm to identify column as categorical variable or if want to convert the textual data to numeric data keeping the categorical context.
e,g converting days(Monday, Tuesday...) to numeric representation.
Vector Indexer- use this if we do not know the types of... | DataSet | 44,195,535 | 15 |
I'm adding a datatable to a dataset like this:
DataTable dtImage = new DataTable();
//some updates in the Datatable
ds.Tables.Add(dtImage);
But the next time, when the datatable gets updated, will it be reflected in the dataset? or we need to write some code to make it reflected?
Also, I'm checking the dataset if the ... | I assume that you haven't set the TableName property of the DataTable, for example via constructor:
var tbl = new DataTable("dtImage");
If you don't provide a name, it will be automatically created with "Table1", the next table will get "Table2" and so on.
Then the solution would be to provide the TableName and then ... | DataSet | 12,178,823 | 15 |
I am looking for twitter or other social networking sites dataset for my project. I currently have the CAW 2.0 twitter dataset but it only contains tweets of users. I want a data that shows the number of friends, follower and such.
It does not have to be twitter but I would prefer twitter or facebook. I already tried ... | Try the following three datasets:
Contains around 97 milllion tweets:
http://demeter.inf.ed.ac.uk/index.php?option=com_content&view=article&id=2:test-post-for-twitter&catid=1:twitter&Itemid=2
ed note: the dataset previously linked above is no longer available because of a request from Twitter to remove it.
Contains use... | DataSet | 3,340,810 | 15 |
Does anyone know if there is a DataSet class in Java like there is in .Net? I am familiar with EJB3 and the "java way" of doing data. However, I really still miss the seamless integration between database queries, xml and objects provided by the DataSet class. Has anyone found a Java implementation of DataSet (inclu... | Have you looked at javax.sql.rowset.WebRowSet?
From the Javadocs:
The WebRowSetImpl provides the
standard reference implementation,
which may be extended if required.
The standard WebRowSet XML Schema
definition is available at the
following URI:
http://java.sun.com/xml/ns/jdbc/webrowset.xsd
It describes t... | DataSet | 1,194,971 | 15 |
Newbie here, trying to learn more about the micrometer. I'm currently exploring ways on how to accomplish this:
I'm using Spring boot 2 with actuator and micrometer enabled. Consider the following class:
@Component
class MyService {
@Autowired
AuthorizeTransaction callbackTransaction;
@Autowired
AuthorizeTrans... | To have "dynamic" tag values, simply skip the instantiation of the counters in the initCounters() method. Everytime the counter shall be increased, instantiate a counter by using its builder method and increment, for example:
Counter.builder("iso_response")
.tags("mti", request.getMTI())
.tags("response_code", ... | Micrometer | 59,592,118 | 23 |
Is there a way to turn off some of the returned metric values in Actuator/Micrometer? Looking at them now I'm seeing around 1000 and would like to whittle them down to a select few say 100 to actually be sent to our registry.
| Let me elaborate on the answer posted by checketts with a few examples. You can enable/disable certain metrics in your application.yml like this (Spring Boot docs):
management:
metrics:
enable:
tomcat: true
jvm: false
process: false
hikaricp: false
system: false
jdbc: false
... | Micrometer | 48,451,381 | 20 |
I am currently trying to migrate our prometheus lib to spring boot 2.0.3.RELEASE.
We use a custom path for prometheus and so far we use a work around to ensure this. As there is the possibility for a custom path for the info- and health-endpoint, uses management.endpoint.<health/info>.path.
I tried to specify manageme... | From the reference documentation:
By default, endpoints are exposed over HTTP under the /actuator path by using the ID of the endpoint. For example, the beans endpoint is exposed under /actuator/beans. If you want to map endpoints to a different path, you can use the management.endpoints.web.path-mapping property. Als... | Micrometer | 51,195,237 | 16 |
I am using the new MicroMeter metrics in Spring Boot 2 version 2.0.0-RELEASE.
When publishing metrics over the /actuator/metrics/{metric.name} endpoint, i get the following:
For a DistributionSummary :
"name": "sources.ingestion.rate",
"measurements": [
{
"statistic": "COUNT",
"value"... | After discussions on Github, this is not currently implemented in Micrometer.
More details directly on the Github Issues:
https://github.com/micrometer-metrics/micrometer/issues/488#issuecomment-373249656
https://github.com/spring-projects/spring-boot/issues/12433
https://github.com/micrometer-metrics/micrometer/issu... | Micrometer | 49,166,271 | 16 |
I am new to using spring-boot metrics and started with micrometer. I couldn't find good examples(the fact that its new) for performing timer Metrics in my spring-boot app. I am using spring-boot-starter-web:2.0.2.RELEASE dependency .
But running spring-boot server and starting jconsole, I didn't see it showing Metrics ... | This could be. If you are using Spring Boot 2, just call Timer wherever you want, no need to use a constructor.
public void methodName(){
//start
Stopwatch stopwatch = Stopwatch.createStarted();// Google Guava
// your job here
// check time
Metrics.timer("metric-name",
"ta... | Micrometer | 51,952,855 | 15 |
I am trying to generate Prometheus metrics with using Micrometer.io with Spring Boot 2.0.0.RELEASE.
When I am trying to expose the size of a List as Gauge, it keeps displaying NaN. In the documentation it says that;
It is your responsibility to hold a strong reference to the state object that you are measuring with a... | In all cases, you must hold a strong reference to the observed instance. When your createGauge() method is exited, all function stack allocated references are eligible for garbage collection.
For #1, pass your atomicInteger field like this: registry.gauge("my_ai", atomicInteger);. Then increment/decrement as you wish. ... | Micrometer | 50,821,924 | 15 |
I'd like to use Micrometer to record the execution time of an async method when it eventually happens. Is there a recommended way to do this?
Example: Kafka Replying Template. I want to record the time it takes to actually execute the sendAndReceive call (sends a message on a request topic and receives a response on ... | You can just metrics() from Mono/Flux() (have a look at metrics() here: https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html)
then you can do something like
public Mono<String> sendRequest(Mono<String> request) {
return request
.map(r -> new ProducerRecord<String, String>(request... | Micrometer | 49,311,495 | 14 |
I have a Spring boot app throwing out open metric stats using micrometer.
For each of my HTTP endpoints, I can see the following metric which I believe tracks the number of requests for the given endpoint:
http_server_requests_seconds_count
My question is how do I use this in a Grafana query to present the number numbe... | rate(http_client_requests_seconds_count{}[1m]) will provide you the number of request your service received at a per-second rate.
However by using [1m] it will only look at the last minute to calculate that number, and requires that you collect samples at a rate quicker than a minute. Meaning, you need to have collecte... | Micrometer | 66,282,512 | 13 |
After migrating spring boot from version 2.x to 3 we miss traceId and spanId in our logs.
We removed all sleuth dependencies and added
implementation 'io.micrometer:micrometer-core'
implementation 'io.micrometer:micrometer-tracing'
implementation 'io.micrometer:micrometer-tracing-bridge-brave'
implementation platform('... | You need actuator and a bridge, the rest you included is not needed:
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'io.micrometer:micrometer-tracing-bridge-brave'
If you also want to report your spans, you should add the zipkin reporter too:
implementation 'org.springframework.b... | Micrometer | 75,170,489 | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.