w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
The field is too small to accept the amount of data you are attempted to add
The SELECT clause includes a single field followed by a comma. SELECT qryOutgoings.[Unique Number], If that comma is also present in the actual query, discard it. However I suspect that stray comma is in the question but not the actual query because otherwise you would get a different error message. Try explicitly casting qryOutgoings.[Unique Number] as string. INSERT INTO Exceptions ([Unique Number]) SELECT CStr(qryOutgoings.[Unique Number]) FROM qryOutgoings LEFT JOIN tblExlcusions ON qryOutgoings.[PLAN CODES] = tblExlcusions.[PLAN CODES] WHERE (((tblExlcusions.[PLAN CODES]) Is Null)); If that doesn't eliminate the error, examine what Access sees as the data type of that field, and the length of the text it contains. SELECT qryOutgoings.[Unique Number],

Categories : Ms Access

Processing huge amount of data on a small python script
You're reading the entire file at the start - if the file is that large, loading it into memory will be a problem. Try iterating over the lines instead. Generally, you'd like with open(filename) as f: for line in f: # This will iterate over the lines in the file rather than read them all at once So for you, change your loop construction to: for line in f: and remove: lines=f.readlines()

Categories : Python

c# best way to store huge amount of data during runtime
Using the latest version of c#.NET you can avoid a lot of over head just using a Zip File. System.IO.Compression.ZipFile.CreateFromDirectory(folderPathWithTiles, containerPath); You can access the different file (tiles) in your zip archive (container file) with the .OpenRead method. using (ZipArchive tiles = ZipFile.OpenRead(containerPath)) { ZipArchiveEntry tile = tiles.GetEntry(relativeTilePath); Image tileImage = Image.FromStream(tile.Open()); } ZipFile: http://msdn.microsoft.com/en-us/library/system.io.compression.zipfile.aspx ZipArchive: http://msdn.microsoft.com/en-us/library/system.io.compression.ziparchive.aspx ZipArchiveEntry: http://msdn.microsoft.com/en-us/library/system.io.compression.ziparchiveentry.aspx

Categories : C#

How to store a huge amount of static data for a SPA in javascript array?
When loading data into a SPA, I use the best practice recommended by the Backbone documentation and bootstrap the data into the page when it loads, rather than incurring a large network call, which is going to be slower when you want the data later on. You might also consider caching the data into the local storage mechanism (if it doesn't change often), which is doable since the size of the two files is overall pretty small. In my opinion, get the data to the point where all your have to do is something like this in your SPA: <script>var characterData = JSON.parse(<?php json_encode($data); ?>);</script> Keep HTTP requests minimized up-front while loading as much data as you can into the page. JSON.parse is a native method (back to IE8, I think), and it's pretty fast.

Categories : Javascript

Android, Best way to store lists of data
There are basically a few options: Use a SQlite Database and optionally hide it behind a ContentProvider Let your Classes implement Serializable and save things with ObjectStream to some file to persist them Implement some custom String serialization (eg. JSONObject / JSONArray / XML) to save your objects in SharedPreferences Pros/Cons: Quite an overhead but faster than the others when you got more than a couple of objects. Easy to implement, not that fast, OK for a couple objects Easy to implement, even slower, OK for a few objects, upgrading your data structure can break thinks. be prepared. So in the end, it depends on your use case. Further readings: https://developer.android.com/guide/topics/data/data-storage.html

Categories : Android

Allocating huge amount of relatively small objects in Java
Option 1. For sure. A couple of million objects is nothing special, and the VM can easily manage that. Option 2 probably won't make a difference in memory usage, and number 3 is the worst option available. See Item 55 from Effective Java, 2nd edition.

Categories : Java

ajax & javascript help needed (I need a small amount of code to be replaced)
You current data seems to be a javascript object, perfectly represented as a json string, so: // Javascript file var e = ""; $.ajax({ dataType: "json", url: "/TEST.json", success: function (data) { e = data; next(); }) }); // TEST.json { "a" : "Text1", "b" : "Text2" } I assume the next() function is used to initialize your script with the e variable, but i supose you could improve this by passing the e variable as an argument of the next function, like next(e);. This means you dont need to initialize e outside of the ajax request and prevents namespace polution. JSON is basically formatted text, so it solves your eventual "what will my data format be" problem at the same time.

Categories : Javascript

creating small arrays in cython takes a humongous amount of time
Creating np.empty inside the Cython function has some overhead as you already saw. Here you will see an example about how to create the empty array and pass it to the Cython module in order to fill with the correct values: n=10: numpy.searchsorted: 1.30574745517 cython O(1): 3.28732016088 cython no array declaration 1.54710909596 n=100: numpy.searchsorted: 4.15200545373 cython O(1): 13.7273431067 cython no array declaration 11.4186086744 As you already pointed out, the numpy version scales better since it is O(len(u)*long(len(a))) and this algorithm here is O(len(u)*len(a))... I also tried to use Memoryview, basically changing np.ndarray[double, ndim=1] by double[:], but the first option was faster in this case. The new .pyx file is: from __future__ import division import numpy a

Categories : Python

extract() data from raster with small polygons - rounded weights too small
I think the easiest, albeit inelegant, solution is to disaggregate the RasterLayer first. I will have a look to see if I can change the extract function to do this automatically for very small (relative to the cells size) polygons. library(raster) r <- raster("my.tif") pu <- shapefile("socc_buff_Rx.shp") p <- spTransform(pu, crs(r)) extract(r, p, weights = TRUE, small = TRUE) #[[1]] # value weight # 209 0.03 rr <- disaggregate(r, 10) e <- extract(rr, p, weights = TRUE, small = TRUE) lapply(e, function(x) { aggregate(x[,2,drop=F], list(value=x[,1]), sum ) } ) #[[1]] # value weight #1 197 0.95 #2 209 3.44 #3 256 0.31 #4 293 0.04 plot(r, legend=F) plot(p, add=T) text(r)

Categories : R

EXT.NET: "Uncaught TypeError: Cannot read property 'data' of undefined" when adding record to store
Ok, I found the answer. Thanks is due to Reimius for making me stop being lazy and actually pay attention to the documentation. A generic object just won't work with store.add(), a subclass instance of Ext.data.Record is needed. In order to do so, here's the neat template I have followed and solved my problems in less than 10 minutes: http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.data.Record-static-method-create And even though the documentation itself says that store.add accepts a Ext.data.Record[], I didn't use it, after I created the object (that is, recordHistory) in the proper way, a mere storeActivityProjectHistory.add(recordHistory) did the trick.

Categories : Javascript

Memory efficient way to store many small objects
A combination of things might work here... First, it's best left as a reference type so that you're not copying structs everywhere when searching. Use string.Intern(string) to reduce memory usage on duplicate first and last names as well as postal codes... Finally use Dictionary<TKey, TValue> to index these entries by value... Perhaps the TKey is string in the case of FirstName and TValue' is List<Person> so that you can look up the people by said string... This is called an inverted index: http://en.wikipedia.org/wiki/Inverted_index - an alternative to Dictionary is to implement your own Tree or Trie structure such as a Prefix trie... You trade O(log n) speed for less memory than the O(1) dictionary. In terms of storing a LOT of them in memory, it depends what a lot is... bu

Categories : C#

What are the best practices when one needs to store [enough] large amount of plaintext files?
If you are using Oracle, storing files outside database has no benefits, according to Tom Kyte. I suspect other modern DBMSes behave similarly. Even if some of them doesn't, consider very carefully whether it's worth trading the data integrity (guaranteed by the database) for performance...

Categories : Database

Mysql show Name, SUM(Amount) WHERE Amount is less than 210 AND SUM(Amount) is greater or equal to 210
use HAVING clause to filter up aggregated results like SUM(), etc. SELECT Name, SUM(Amount) FROM tableName WHERE Amount < 210 GROUP BY Name HAVING SUM(Amount) >= 210

Categories : Mysql

Modify view property based on scroll amount
ScrollViews are annoying in that someone forgot to add the OnScrollListener. You have to extend them and override the onScrollChanged method to get notified. Once you've done that, it's just a bit of math - I think in Play Music's case, they just time it so that it hits 100% right when the buttons underneath the album art go under it. That is, the distance you animate over is height(album art) + height(buttons).

Categories : Android

fastest way to store n-grams (strings with variable amount of words) in python
Personally I would move to a database (sqllite3 is built in to python) with indexes. Indexes make queries go fast. Python also supports in memory sqllite databases. You can also supply the special name :memory: to create a database in RAM.

Categories : Python

Can i create lists of lists using Core Data
There's nothing wrong with your approach. Just be careful when setting what happens to dependents in the event of record deletion to avoid circular deletion. A cleaner way would be to create a listItem table that contains a boolean field to indicate whether the item is associated to list or track, then have has_one relationship with list and track. List table will contain listItems and listItems will manage what it contains. It's same as yours except it adds a design separation that makes it easy to deal with dependencies.

Categories : IOS

Python store lists with single key and two values
Is there any good data structure to store the data above? collections.namedtuple How can I convert (0,) into a key (of string) ? You don't actually need to. Since (0,) is a tuple and tuples are hashable, it can be used as a key directly. I'd also need to sort the list by kweight later on, is it possible to use a data structure which can call some python sort function? sorted(dictofnamedtuples.values(), key=operator.attrgetter('kweight'))

Categories : Python

Compare Two Lists Via One Property Using LINQ
What you want here is a Join. var widgets1_in_widgets2 = from first in widgest1 join second in widgets2 on first.TypeID equals second.TypeID select first; Intersect can be more or less thought of as a special case of Join where the two sequences are of the same type, and can thus be applied for equality instead of needing a projection for each type to generate a key to compare. Given your case, Intersect isn't an option. If a particular ID is duplicated in your second set and you don't want the item to be duplicated in the results then you can use a GroupJoin instead of a Join: var widgets1_in_widgets2 = from first in widgest1 join second in widgets2 on first.TypeID equals second.TypeID into matches where matches.Any() select first;

Categories : C#

How to store lists of embedded documents with MongoDB under Grails?
I think you're adding a map in the second person instead of an Address object. Is there any reason why you're adding the otherAddress different for each person? I think this should work although I haven't tested it: def address = new Address(street: "Mainstreet. 164", city: "New York", postCode:"12345") def person1 = new Person(firstName: "John", lastName: "Doe") person1.address = address person1.otherAddresses.add(address) println person1.otherAddresses // Result: "[mongoembeddedlisttest.Address : (unsaved)]" person1.save() person1.errors.allErrors.each { println it } // no errors def person2 = new Person(firstName: "Jane", lastName: "Doe") person2.otherAddresses += new Address('street': 'Second Street. 164', 'city': 'New York', 'postCode':'13579') println person2.otherAddresses perso

Categories : List

Setting up infinite scroll for tabular display of data and rendering only a small subset of data
Here's what I would do: Add a class (scrolled-past) to any row that is scrolled past the window top. (If you're using jQuery, jQuery Waypoints is a great tool to detect this.) Fetch more data when reaching bottom. When the data has been fetched, hide all .scrolled-past elements, append new rows and scroll to the top of the table (where to first row now is the one that was previously the uppermost visible row). There might be glitches when hiding, appending and scrolling, but I bet you'll nail it with an hour of tweaking. Adding the exact top offset of the uppermost visible row to the scroll offset in step 3 is one way of making it more neat.

Categories : Javascript

How to store frequently modified lists in database in a natural way so that they are just ready to read?
I used the same method that is, to store a 2 column row for every record, which I turned to a txt file with the formatted html which then we changed to json and finally to mongodb. But since you have got frequent operations, I suggest cassandra, hbase and googles big table implementations like accumulo cloudata and hypertable. Cloudata may be the right one for you.

Categories : Mysql

Is it possible to restrict the amount of data ('gate' the data) sent to unauthenticated (angularFire) clients in firebase?
You'll need to restructure your data in order to achieve this with Firebase. See this blog post for some background on this: https://www.firebase.com/blog/2013-04-12-denormalizing-is-normal.html One way to structure the data would be to create two separate lists, one for active items and another for inactive items. When an item becomes active or inactive, be sure to remove it from one list and put it in another. { "active": { 0: { "data": {...}, "sign": {...} } }, "inactive": { 0: { "data": {...}, "sign": {...} } } } In your security rules, you can simply prevent access to inactive items to unauthenticated users: { "rules": { "active": { ".read": true }, "inactive": { ".read": "auth != null" } } } Hope t

Categories : Javascript

Edit multiline text in Xcode's property lists
Inside the plist editor in Xcode, that is not possible. What you can do, however, is to right-click on the entry in the file browser and choose "Open as > Source Code". You then see the raw XML text of the plist which is much easier to edit. Just make sure you don't mess up the tags - otherwise Xcode will complain that it's not a valid file.

Categories : Xcode

separate list into multiple lists based on property
Yes, you can do it with LINQ in a single statement: public List<List<IGrid>> Separat(List<IGrid> source) { return source .GroupBy(s => s.RowIndex) .OrderBy(g => g.Key) .Select(g => g.ToList()) .ToList(); } If you do not care that the lists appear in the ascending order of RowIndex, the way that your method produces them, you can remove the OrderBy method call from the chain of method invocations.

Categories : C#

Matplotlib multicoloredline using lists and an external property as condition
I eventually did this by plotting several plots so that each plot would always be one color. However, this leaves small gaps between plots and you can't easily handle it as one plot. I found out it's also much easier to do this kind of thing with scatters if you don't need to connect the dots, because scatter can have a colormap as an argument.

Categories : Python

How to split a large data table to some small data tables?
You shouldn't need to split tables like that just out of concern for joins. If the tables related use primary keys for FKs or indexes with the correct columns, the data retrieval would be quite efficient. See this post and the comments+answers, for an example of how the query analysis should be used to make sure your queries are using the right indexes, refs, etc. Also, if you're going to split tables to move things like location (a varchar field?) out of the table, then are the fields you are left with fixed-width? If not, the data-retrieval speed benefit you get from moving out one variable width column is lost if there are other variable width columns still left in the table, like item_name. (On a side note, see this answer about the type of optimizations ppl consider doing to improve

Categories : Database

How is data typically reloaded/displayed on a device when only a tiny amount of data changes after updating the database? (Conceptually)
This is ridiculously trivial. You update your local database and send off the remote update at the same time. You use the remote response to mark your local record as synched or try updating again later.

Categories : IOS

Methods of writing large amount of data and formulas for that data in JS
Unless you're recalculating the damage for each spell many times per second, why not just make it a function and add it to the prototype of your character? Character.prototype.getSpellDamage = function(name) { var spell = Spells[name]; return spell.baseDamage + this.level * spell.damagePerLevel + spell.ratio * this[spell.someStat]; } Now, you can just store the spells in a simple object: var Spells = { 'foo bar': { baseDamage: 40, damagePerLevel: 20, ratio: 0.5, someStat: 'foo' }, ... };

Categories : Javascript

design a data structure to hold large amount of data
Here's my stab at it. Basically the idea is to use a series of small binary trees to hold sorted data, creating and saving them to the disk on the fly to save memory, and a linked list to sort the trees themselves. Hand-wavey version: Create a binary tree sorted alphabetically based on the key of its entries. Each entry has a key and a value. Each tree has, as an attribute, the names of its first and last keys. We load each file separately, and line-by-line insert an entry into the tree, which sorts it automatically. When the size of the contents of the tree reaches 10 mb, we split the tree into two trees of 5 mb each. We save these two trees to the disk. To keep track of our trees, we keep an array of trees and their name/location and the names of their first and last attribute. From n

Categories : Database

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

socat how to receive large amount of messages store these messages and acknowledge each message
Although this question is quite old now, this would have worked: socat tcp-listen:5678,reuseaddr,fork 'system:echo +OK!!open:recv.data,create,append' Source: Dual inter addresses

Categories : Misc

Is there any way to configure disk store for terracotta BigMemory to remove all data store on service/cache manager start up?
As I understand your question, you want to remove the Index data from BigMemory Go on restart. Whether you can do this or not depends on your persistence strategy. If it is local restartable, BigMemory Go will try to either reuse the index data if the application was shutdown cleanly, or it will recover the indexes if it was shutdown abruptly. So, for a persistence strategy of local restartable, there is no way to avoid rebuilding the data. If your persistence strategy is "localTempswap", then you will not rebuild any data on restart and will lose the application's state. Please see here for more information: http://ehcache.org/documentation/configuration/fast-restart

Categories : Java

How to get Ember Data's "store" from anywhere in the application so that I can do store.find()?
The TRANSITION doc says that you can do this to inject the store into components : App.inject('component', 'store', 'store:main'); You might be able to change 'component' to 'view' or to 'model', but I'm not sure about that.

Categories : Ember Js

Is stripes a small footprint framework to make a small web application in a coporate enviroment?
Stripes is a really good, lightweight Java web application framework. However, it won't work without a sever. So, to answer your question, the simple answer is: no. Your requirements are absolutely not a recommended scenario, especially in a corporate environment. I'd always opt for a simple DB-based solution. You could, however, and if your corporate data security guidelines permit it, use a (free) Google App Engine account, to run your Stripes application. Of course, any other free or cheap platform will do.

Categories : Java

Twitter Bootstrap - How to get buttons to be block level only on extra small and small devices
Responsive CSS. You can define the max width or/and height of any section of CSS with @media tags, like in the bootstrap-responsive.css. Here is an example. @media (min-width: 400px) and (max-width: 600px) { /* Code here */ } That code will be applied to all devices with a minimum browser window width of 400 pixels, and a maximum of 600 pixels. You can grab the code for btn, btn-primary and btn-block from bootstrap.css or bootstrap-responsive.css (Some responsive examples in there), and put it in a <style></style> tag or in a separate CSS file, and edit it accordingly with responsive CSS.

Categories : CSS

Use Shared Object Data() or Shared Object Property() to store value
From the SharedObject reference: setProperty() marks a property as "dirty" in addition to setting it, which you need to do if you're using a remote SharedObject, as it tells the server that the value needs to be updated in other clients. It's slightly more convenient than manually setting the property and then calling setDirty(), and there's obviously no need to for a similar getProperty() method, as the server doesn't need to be informed when you do that.

Categories : Actionscript

What's faster; generating 5 small circles via CSS border-radius; or using a CSS sprite of a small circle repeated 5 times?
It all depends also in your needs. I think the border-radius is not rendered correctly in old IE versions, so...maybe the image sprite is the best solution. But I repeat it all depends. Maybe your clients are in a place where internet is slow (css is best) or maybe they won't update their IE and are stuck in IE6 or 7 (sprites). You could use both, using one stylesheet for IE with sprites and one for css border-radius.

Categories : CSS

Javascript slider with larger center slide? < [ small BIG small] >
I'm currently working on a small DOM library called pocketknife that also has a range slider extension (no true demo up atm, but the test suite ends on one, http://pomax.github.io/pocketknife/test.html) for which you can modify the look of the slider using plain CSS, which lets you use an onchange event handler to do whatever you need done... I'm stilled working on the documentation but the code's on github if you want to give that a try. (I use it myself on http://pomax.github.io/mathparser/, for instance)

Categories : Javascript

Mysql. Deduct SUM(d.Amount) from SUM(c.Amount) and group by (depending on) values in other column
SELECT TransactionPartnerName, SUM(if(CAST(DebitAccount AS UNSIGNED) IN (?), -Amount, Amount)) FROM 2_1_journal DATA WHERE (CAST(DebitAccount AS UNSIGNED) IN (?) OR CAST(CreditAccount AS UNSIGNED) IN (?)) GROUP BY TransactionPartnerName Try this Edit : Removed inner query

Categories : Mysql

Trouble with converting fixed-amount of for loops to parametrized amount
Ok, instead of stalling there is a solution which will work for ints, a general solution is much harder, note: This will "spiral" out in boxes. public static void main(String... ignored) { caller(10, 7, new Callback<int[]>() { @Override public void on(int[] ints) { System.out.println(Arrays.toString(ints)); } }); } interface Callback<T> { public void on(T t); } public static void caller(int maxSum, int dimensions, Callback<int[]> callback) { int[] ints = new int[dimensions]; for (int t = 0; t < maxSum; t++) { caller(t, 0, ints, callback); } } private static void caller(int sum, int idx, int[] ints, Callback<int[]> callback) { if (idx == ints.length) { callback.on(ints); re

Categories : Java



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