w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to store data with abstract type? Is it sane to store data as sql_variant data type?
It's hard to determine right answer from your question. What data types you are expecting to be and what are you going to do with that types? Because,if you are going to create to many tables for each type you will end up in complexity and more size on disk than using sql_variant type. Keep in mind that when using sql_variant to represent boolean, will only represent 1 byte of overhead(for storing data type kind) + variable length bytes(wich you probably already have in table). But if you are using that type fore some complex mission critical logic and if yours data access framework doesn't support sql_variant you should not use sql_variant.

Categories : SQL

Using single data store for single grid instance which is used everywhere in extjs
You can create the store for your second panel, so try this: var secondStore=Ext.create('your_store'); items: [ { xtype: 'gridpanel', title: 'grid1', store: 'your_store' },{ xtype: 'gridpanel', title: 'grid2', store: secondStore } ]

Categories : Extjs

jquery set value from input type file multifile to input type file single file for multiple file upload
It is not possible to programatically select files into a an <input type="file" />. The reason for this is security. Consider if it was possible - it would mean that unscrupulous developers could essentially steal files from visitors computers by using Javascript to select a file and submit the form without the user knowing.

Categories : Jquery

Which data type is more apt to store generic data without any data loss
From my experience with .Net and Excel, it appears that it is good to have SQL Variant in the database. If necessary, either in SQL or in an application casting can be made (if you know the type of data) . In SQL you can use for this purpose SQL_VARIANT_PROPERTY (expression, property) with gives you the type of stored data.

Categories : C#

Mysql: Store array of data in a single column
I would recommend creating a separate table with three columns for the samples. One would be the id of the record,second - the id of the sample and the third - the value. Of course if your main table doesn't have a unique id column already, you would have to create it and use it as foreign key. The reason for my suggestion is simplicity and data integrity. Another argument is that this structure is memory efficient, as you will avoid varchar (which would also then also require parsing and has the offset of additional computations). UPDATE As GordonM and Darin elaborated below, the memory argument is not necessarily valid (see below for further explanation), but there are also other reasons against a serialized approach. Finally, this doesn't involve any complex php - java script and is

Categories : PHP

How to send email and store log file from a single cronjob?
This is because you are redirecting the output of echo to mail so there is nothing to write to the log file. As a result, the log file is empty. If you want to write the output of echo to the log file and also send it to mail, use tee as shown below: echo 'blabla' 2>&1 | tee /test/test.log | mail -s "Cron report" test@example.com

Categories : Linux

Calculate storage space used by sql server sql_variant data type to store fixed length data types
You missed part 7. 7 . Calculate the number of rows per page (8096 free bytes per page): Rows_Per_Page = 8096 / (Row_Size + 2) Because rows do not span pages, the number of rows per page should be rounded down to the nearest whole row. The value 2 in the formula is for the row's entry in the slot array of the page.

Categories : Sql Server

Securely store data for multiple party's in a single table
You are on the right track, but mapping the USER ID into the table is probably not what you want, because in practice many users have access to the corporations data. In those cases you would store "CorpID" as a column, or more generically "ContextID". But yes, to limit access to data, each row should be able to convey who the data is for, either directly (the row actually contains a reference to CorpID, UserID, ContextID or the like) or it can be inferred by joining to other tables that reference the qualifier. In practice, these rules are enforced by a middle tier that queries the database, providing the user context in some way so that only the correct records are selected out of the database and ultimately presented to the user.

Categories : Database

Data type to store value <=10^20 in C/C++
A float and a double can store values in the range you have specified, and beyond. Note that it cannot store the precise discrete integers in that range, merely an approximation that is often relevant to the order of magnitude.

Categories : C++

Is it possible to store a C data type in a variable?
No, there's no such type that can store a type in standard C. gcc provides a typeof extension that may be useful. The syntax of using of this keyword looks like sizeof, but the construct acts semantically like a type name defined with typedef. See here for detail. Some more examples of the use of typeof: This declares y with the type of what x points to. typeof (*x) y; This declares y as an array of such values. typeof (*x) y[4]; This declares y as an array of pointers to characters: typeof (typeof (char *)[4]) y; It is equivalent to the following traditional C declaration: char *y[4]; To see the meaning of the declaration using typeof, and why it might be a useful way to write, rewrite it with these macros: #define pointer(T) typeof(T *) #define array(T, N) typeof(T [N])

Categories : C

What's the best data type to store 01,02,03 etc. in mySQL?
These look like codes as opposed to numbers, meaning that you are not doing arithmetic operations. If they are codes, the best way to store them is as varchar(2) or char(2) types. If you are treating them as numbers (that is, doing any arithmetic operations), then you should store them as integers (small integers) and append the leading zeros on output. EDIT: It is very important to distinguish between strings of digits that are just that -- strings that contain digits -- and actual numbers. There are many examples of such strings that you definitely want to store as character strings. Four that come to mind are telephone numbers, American zip codes, account numbers (the account number at my bank starts "057" and the "0" is really, really, really important), and (for the most part) t

Categories : Mysql

How to create your own type and use it to store data
The basic definition of a Dictionary is given by Dictionary(Of type1, type2), where types can be anything, that is, primitive types (String, Double, etc.) or ones you create (via Class, for example). Also you can account for them as "individual variables" or inside collections (Lists, Arrays, etc.). Some examples: Dim dict = New Dictionary(Of String, List(Of String)) Dim tempList = New List(Of String) tempList.Add("val11") tempList.Add("val12") tempList.Add("val13") dict.Add("1", tempList) Dim dict2 = New Dictionary(Of String, type2) Dim tempProp = New type2 With tempProp .prop1 = "11" .prop2 = "12" .prop2 = "13" End With dict2.Add("1", tempProp) Dim dict3 = New Dictionary(Of String, List(Of type2)) Dim tempPropList = New List(Of type2) Dim tempProp2 = New

Categories : Vb.Net

In perl, how do you store multiple values from a single test file line into an array
Well, in your case, I would probably consider using split, separating the fields on whitespace: while (<DATA>) { my @vals = split; # default split is fine print join(" ", @vals[3 .. $#vals]), " "; } Or if you want to store them, just push them onto an array, or use a hash with a suitable key. Something like... push @array, [ @vals[3 .. $#vals] ]; # push an array ref $hash{$vals[0]} = [ @vals[3 .. $#vals] ]; # use a hash The [ ... ] part is creating an anonymous array ref, which can then store the line's values in a single scalar slot.

Categories : Arrays

What is the proper data type to store a sum of microseconds in C
Given that the maximum value you can store in an unsigned long on a 32 bits platform is around 4G, these 4G microseconds translate to only 71 minutes. On a 64 bits platform (beware on Windows long is always 32 bits, even on Windows 64 bits), then you can count microseconds for up to 4G times 71 minutes. This is huge: approximately 5800 centuries. Answer: if your unsigned long is 64 bits, it's OK.

Categories : C

Data type to be used to store 10 digit mobile number?
The problem is in the string concatenation in the retrieve query. SQLquery = "SELECT * FROM tbl_cust WHERE ePhone =" & txt_number.text Here, you miss the single quotes that should enclose a string value when used as a WHERE condition. However, in your INSERT query you use a parameterized approach, why you don't use the same approach for the select? SQLquery = "SELECT * FROM tbl_cust WHERE ePhone = @number" Dim cmd As New SqlCeCommand(SQLquery, con) cmd.Parameters.Add("@number", txt_Number.Text) SqlCeDataReader reader = cmd.ExecuteReader() ........ If you use a parameterized query, the proper handling of string quotes, decimal numbers and date formatting is passed to the underlying framework code that knows better than you and me how to pass these values to the database engine.

Categories : Vb.Net

data type to store precision more than double in matlab
It appears that matlab only uses 64-bit doubles, but you might have luck with one of the arbitrary precision libraries available for matlab.

Categories : Matlab

how to store data in NS-Mutable-data in did-receive-data and than write to file
It's better to use asynchronous requests for the task like this. You can use the same ASIHTTPRequest class, but with block approach. Try to write the code similar to this: -(void) verifyReceipt { NSURL *theURL = [NSURL URLWithString:@"http://testing.io/dev.php/video/verifyReceipt"]; NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:theURL cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:10.0f]; [theRequest setHTTPMethod:@"POST"]; NSString *param1 = [self getParam1]; // getParam1 - some method to get useful data for request's body NSNumber *param2 = [self getParam2]; NSString *postString = [NSString stringWithFormat:@"param1=%@&param2=%@", param1, param2]; [theRequest setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEnco

Categories : Iphone

Proper Data Type in SQL Server to store Scientific Notation value? (Ex. 10^3)
If you want to use your data in numeric calculations, it is probably best to represent your data using once of SQL servers native numeric data type. Since you show scientific notation, it is likely you will want to use either REAL or FLOAT. Real is basically 7 decimal digits of precision and float has 15 digits of precision (at least this is how they are normally used). You can actually specify reduced precision for FLOAT, but in practice most people just use REAL in that case. REAL takes 4 bytes of storage, and FLOAT requires 8 bytes. The other numeric types are for fixed decimal point arithmetic.

Categories : SQL

How to accept as one data type and store in a defined structure using functions in C?
There is a lot wrong here. To start, your parameter is wrong for scan_sci. You are not passing a pointer to the structure you declared, you are passing an array of characters. Your declaration should be as follows: scinot_t scan_sci( scinot_t *collection ); To conform with passing a pointer to the structure, you will want to change the declaration to the following. Note, it is extremely bad practice and error prone to return a pointer to a variable declared on the stack, hence why we are mutating the structure within scan_sci. void scan_sci( scinot_t *collection ); Now you will need to create the structure before you make a call to the function and pass its memory address using the & operator.

Categories : C

can i use input type = file in my single page application
Its possible to upload files using ajax, so no show stopper there. you might need a controller to accept the file though, but that shouldn't be an issue. Check out this tutorial on an ajax upload http://tutorialzine.com/2013/05/mini-ajax-file-upload-form/ or you can check out uploadify, i think that does file upload via ajax too

Categories : Asp Net Mvc

How can I handle different data types in an Entity-Attribute-Value design (e.g. single table with multiple columns or multiple tables per data type)?
This is a well known problem. The problem with the approach you mentioned is that you need to know the type of the attribute before you query for it. it's not the end of the world because you manage metadata but still... Two possiable solutions might be using a varchar2 datatype to represent all data types in a known format. Numbers and chars are no problem, date values can be written in a predefined manner (it's like implementing to_String() in any OO design). use the ANYDATA data type. i personally played around with it but decided not to use it.

Categories : Database

how to set customer of one store should not be able to login to another store in magento in single website
Unfortunately Magento only allows you to set "customer sharing" across the global and website scopes. The (maybe not so simple) solution would be to move your other store to a separate website instead of a separate store. Found in System > Configuration > Customers > Customer Configuration:

Categories : Magento

Get the files chosen using the input type file (multiple) and store them in an array
This should work for you... function loadfiles() { var x=document.getElementsByTagName("input"); for (var i=0;i<x.length;i++) { if(x[i].type == "file"){ document.write(x[i].value); } } }

Categories : Javascript

How to read and store data from a text file in which the first line are titles, and the other lines are related data
You can read the file using opencsv. CSVReader reader = new CSVReader(new FileReader("yourfile.txt"), ' '); List<String[]> lines = reader.readAll(); The fist line contains the headers.

Categories : Java

To retrieve data from a CSV file, split it and store data of one column in a string array without duplicates
String.split() is not appropriate for your conditions. Ditch it. It isn't going to be that hard to search for the next occurrence of a delimiter starting from a position in the string; do that repeatedly (using String.indexOf(delimiter, start)) to find each field and load up your own list (I would use ArrayList, convert to array at the end if I have to have an array). There is a bit of futzing to make sure you have the starting and ending positions correct, but that's part of what programming is about. It will allow you to detect the ^^ cases and enter an empty or null string at your preference. Sorry, brute force is going to be easier to do than manhandling something that does not handle your cases so that it does.

Categories : Java

how can i read data from csv file and store in binary tree and write multiple file in perl
I believe the performance bottleneck in your script is not memory usage at all, but rather that you open and close a file for every record. If I understood the units correctly, 10lakh is 1,000,000, so that's quite a lot of opens and closes. One solution would be to process the data in batches, particularly if you have many repeated keys in the "first 5" that you extract as the key. I benchmarked your program against the one below on a synthetic file containing 100 unique 5-digit keys in that second field, but 10,000,000 records (10x the size of your file). The rows looked like this: 1,9990001,---------------------------------------------------------------------------------------------------- 2,9990002,------------------------------------------------------------------------------------

Categories : Perl

Store data both in base and derived tables in Table-per-type inheritance in Entity Framework
In your DbContext's OnModelCreating override, use the following: protected override void OnModelCreating(DbModelBuilder modelBuilder) { modelBuilder.Entity<Base>().Map(m => { m.ToTable("Base"); }); modelBuilder.Entity<Derived>().Map(m => { m.MapInheritedProperties(); m.ToTable("Derived"); }); }

Categories : Entity Framework

Store a single character (tab, new line, any character) in User.config file
You could store the decimal ASCII code for the character by converting to an int, and convert it back to a char in your program. e.g. char charToSave = ' '; int code = (int)charToSave; SaveCharToUserConfig(code); ... int code = GetCodeFromUserConfig(); char savedChar = (char)code;

Categories : C#

how to read data in file and store in 2-dim array c++
the most simple way is use getline to read the whole line, first, and then use stringstream or sscanf(). ie ifstream infile(filename); infile.getline(buffer,1024,' '); sscanf(buffer,"%d %d %d %d',&arr[0],&arr[1],&arr[2],&arr[3]);

Categories : Arrays

Store customer data into a binary file in c++
First: why binary? Binary files are usually not a good idea. If it does have to be binary, you'll have to start by defining a binary format: how you want to represent each type in the file. Binary does not mean unformatted. Unless there are good reasons for doing otherwise, you might start with an already defined format, such as XDR. Then you should probably define stream types for reading and writing this format—the input and output functions in std::istream and std::ostream either use text format, or are unformatted (which means you have to manually format or unformat the data you give it or receive from it). It's probably a good idea to have these classes derive from std::basic_ios<char>, however; it has a lot which will be superflous (e.g. the formatting flags), but

Categories : C++

Get WPF single path data from . png file
There is no direct way to do it. A PNG file is a raster format (i.e. it stores the colour of each pixel in the image). WPF Path Data is a vector format (i.e. it stores the image as geometric drawing instructions). If you are unsure what this means, see here for more info. Vector can be converted to raster (at a set size), but raster cannot be obviously converted to vector (which is what you want). The only way to try and convert raster to vector, with varying results, is to "trace" the raster image to guess what the equivalent geometric vector instructions might possibly be. The ability to trace a raster image accurately is directly proportional to its pixel dimensions and complexity of graphics. So tracing a [presumably] small icon might not be possible at all. If I were faced with you

Categories : Wpf

Using Resources to store data in json file in Angular
ngResource is an Angular service designed to interact with RESTful server side data sources (see ngResource docs). The angular js tutorials tend to reference local JSON files since they're meant to be stand-alone examples which anyone can download and run locally without the need for a back-end server. But you'll notice the tutorials only read data from the JSON files, they cannot update them. If you're looking to save data client side, check out LocalStorage (http://diveintohtml5.info/storage.html). If you're trying to save the data server side, you'll need to setup some back end service (via NodeJS, PHP, .NET, Ruby, Python, and many other frameworks..)

Categories : Angularjs

How to Store json data file in a services using angularjs
Well, it all depends on the architecture of your application but I guess you could create a factory or service that will store data then simply inject that factory wherever needed. If the data needs to be persistent, I would use something like localStorage. If it's a really small amount of data and your app cannot support HTML5, I would use cookies. The more you elaborate the more accurate answer you will get.

Categories : Angularjs

Read File, jump lines and store data in array.
As you read each file, you get data in a char. So, - Tokenize each line read by spaces using strtok. This logic doesnt work, if your string has spaces in between. It works fine, if your string is only one word like "STRRING" or "FLOAT". It doesnt work if your string is like "I am a Genius" :) - Validate each token a simple if condition should do your job. strings start with [a-z] or [A-Z]. Numbers use [0-9]. -Once valiadated. perform the required conversions using atoi or itoa, or others.

Categories : C++

Sqlite database unable to delete objects, failing with message "Cannot store type: "
Rather than use: public int DeleteItem<T>(int id) where T : IBusinessEntity, new() { lock (locker) { #if NETFX_CORE return Delete(new T() { ID = id }); #else return Delete<T> (new T () { ID = id }); #endif } } Use this instead: public int Delete(object objectToDelete) { var map = GetMapping(objectToDelete.GetType()); var pk = map.PK; if (pk == null) { throw new NotSupportedException("Cannot delete " + map.TableName + ": it has no PK"); } var q = string.Format("delete from "{0}" where "{1}" = ?", map.TableName, pk.Name); return Execute(q, pk.GetValue(objectToDelete)); }

Categories : Sqlite

How to store data from foreach function in HTML file in powershell and get Physicall ram
You need to look at the ConvertTo-Html cmdlet. Get-WmiObject -Class Win32_BIOS -ComputerName localhost,$env:COMPUTERNAME | Select PSComputerName,Version,SerialNumber | ConvertTo-Html | Out-File c: est3.html Another method based on OPs update: $arrComputers = get-Content -Path "C:Computers.txt" $arrComputers | ForEach-Object { Get-WMIObject -Class Win32_BIOS -ComputerName $_ } | Select PSComputerName, Version, Manufacturer | ConvertTo-Html | Out-File C: est4.html

Categories : Powershell

Variable store function as primitive type or reference type?
The value of f2 is, like f1, a reference to the same function. You can use the fact that functions are objects to prove it : var f1 = function(){} var f2 = f1; f1.a = 3; console.log(f2.a); // logs 3 But as you can't change a function core, there is little practical use in knowing this, apart the fact you don't use much memory if you duplicate a function reference.

Categories : Javascript

Import single csv file with one data field going to separate table
This is pretty easy to do. First, you use csv as usual to get all the columns. One of those columns will itself be a semicolon-separated list of values. If you don't need to worry about quoting, etc., you can just use split. For example: with open('foo.csv') as f: for row in csv.DictReader(f): cursor.execute('''INSERT INTO Product (ProductID, Name, UOM) VALUES (:ProductID, :Name, :UOM)''', row) for alias in row['Alias'].split(';'): cursor.execute('''INSERT INTO ProductAlias (Name, Alias) VALUES (?, ?)''', row['Name'], alias) If you can have spaces within the aliases, you're going to need two kinds of quoting or escaping, alongside the two kinds of delimiters. Like this: 123,"Widget 1","Widget1;

Categories : Python

How can I write data in a single line on text file using javascript
Just add everything to a variable then write the line. var st = document.getElementById('item'+j).innerText; st += ',' st += document.getElementById('txtBx'+j).value; s.WriteLine(st);

Categories : Javascript

Parse XML file to fetch required data and store it in mongodb database in Python
Here's an example that parses an xml from the url using lxml and inserts the data into mongodb using pymongo: from urllib2 import urlopen import pymongo from lxml import etree # parse xml file root = etree.parse(urlopen('https://www.eventbrite.com/xml/event_search?app_key=USO53E2ZHT6LM4D5RA&country=DE&max=100&date=Future&page=1')) events = [] for event in root.xpath('.//event'): event = {'start_date': event.find('start_date').text, 'end_date': event.find('end_date').text, 'title': event.find('title').text} events.append(event) # insert the date into MongoDB db = pymongo.MongoClient() collection = db.test collection.insert(events) Parsing venue items is left for you as a "homework". Note that there are other xml parsers out there,

Categories : Python



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.