instruction
stringlengths
71
71.9k
Help me make it better. Requirement: support arbitrary number of factors, not just 3 & 5. (ns fizzbuzz.core (:use [clojure.contrib.string :only (join)])) (def targets (sorted-map 3 "fizz" 5 "buzz" 7 "baz")) ;; match any applicable factors (defn match [n, factors] (filter #(= 0 (mod n %)) factors)) (defn fizzbu...
I built my code according to the algorithm provided in this YouTube video. Please review it and help me find any problems. It definitely takes a lot longer than the qsort() function in C++. But the algorithm I use should be just as fast. Can anyone find problems? #include <iostream> #include <time.h> using namespace s...
Our company uses an old version of JAXB so it does not allow generics. Other than that, I am using recursive calls because Rows can have subrows and I want to find out if any of the rows for the given column id i has any values. I am interested to know if I got the recursion right. private static boolean anyCellHas...
I am at a loss as to how to simplify the following two functions that share variables without polluting the global namespace. (Partial code for a carousel). I would like to streamline it. Note: snapshotCheck(); is called once on window load. snapshotScroll(); is called on click events. //FIRST FUNCTION function snapsho...
I'm VERY new to PHP and have begun writing a basic login for a website that uses data from a Microsoft SQL server to display information on the web. Below are 3 snippets of code (two functions from the same file and one controller file that calls them.) Connect to MSSQL to validate user (from phplib) With this, I take...
My project has a central concept of a Callback<T> which is defined very simply: public interface Callback<T> { void call(T item) throws Exception; } This is used to enforce correct resource management (e.g. database connections, HTTP sessions) while still allowing the data to be streamed through. This works very w...
I promise that I've done my reading on this topic. I've seen many suggestions and critiques, but I haven't seen the argument below critiqued. I'm not trying to beat a dead horse, but I don't think anyone's offered this one up yet: x ||= y is functionally equivalent to x = y unless x The code below has been through 5 ...
I have a class library in which I'm using generics as below. I'm not sure if it's an improper use or not. So aside from the fact that it works and everything "depends", id like some specific critique on how this usage might fall apart. In particular In wondering about the shadowing of non generic properties with generi...
I'm trying to create a doubly linked list using the null object design pattern. I've implemented four classes: a node abstract class, nullnode and datanode classes for the null node object and the linkedlist class, for the linked list implementation. I'm not sure if I've done this correctly. Can anyone tell me if I am ...
This code (http://jsbin.com/isexez/5/edit) functions as expected: (1) it displays the page selected; and (2) it highlights the number of the selected page. I would appreciate help in improving it. I am in the process of writing an ebook (http://www.keepcount.net/ebook/01-09/02_tricks.html) and need to improve this co...
I have just implemented a quick test of the visitor design pattern in C++ and have a few questions regarding the code. main.cpp #include <iostream> #include "Base.h" #include "Derived.h" #include "Visitor.h" int main() { Base base; std::cout << "hello\n"; Base * derived = new Derived(); Visitor v; ...
I have written a class which I will use as a base class, allowing other classes to extend this class. How can I improve this? Am I breaking any conventions or styling? import requests import feedparser from BeautifulSoup import BeautifulSoup class BaseCrawler(object): ''' Base Class will be extended by other class...
When reigstering a user I request two reads from the database to see if there is a username and email and then I write if the checks pass.. Can anyone tell me if this code will block other users? I am using node with express.js and mongojs. I know I am saving passwords in plaintext.. This will be changed. app.post('/re...
My code listens for a number of events, and calls the Google Analytics event tracking function when they fire. Each event uses a similar pattern. Can I achieve the same functionality without repeating myself? /*jslint debug:true, browser:true, devel:true nomen:true */ /*global _gaq:true, jquery:true, $:true */ functio...
I'm playing around with JMock and trying to understand whether I understand the idea correctly. There's an interface Printer aimed to print integers somewhere. There's an interface Calculator aimed to perform math. There's a class CalculatingMachine aimed to connect Calculator and Printer: first, it calculates the resu...
This is a solver for Sudoku using backtracking. How can I make it more optimized and clean? #include <stdio.h> int isAvailable(int sudoku[][9], int row, int col, int num) { int i, j; for(i=0; i<9; ++i) if( (sudoku[row][i] == num) || ( sudoku[i][col] == num ) )//checking in row and col ret...
I want to validate a list of objects for example strings. and if one of the objects fails to pass the condition return false as validation result . this is the code I use : public static bool AreValid(string[] strs) { foreach (string str in strs) { if (str != condition ) ...
I have a simple script that will take a list of hosts and ping each host (there's about 200) a single time before moving on. This is not the most effecient method I am sure, as it is very linear. And it takes a few minutes to complete. I would ideally like to run this script every minute (so each IP address is checked ...
Any suggestions/improvements for the following custom thread-pool code? import threading from Queue import Queue class Worker(threading.Thread): def __init__(self, function, in_queue, out_queue): self.function = function self.in_queue, self.out_queue = in_queue, out_queue super(Worker, self...
When I read some code,I think the usage of Event is not necessary,is it right? # start server while True: # accept a request here queue.put(info) event.set() # notify all the threads? # pass queue and event here to a Thread constructor other place there are more than 10 threads running, # inside a Thre...
I am new to Groovy and I am having a little problem with constructors of subclasses. Basically, I have a base abstract class like class BaseClass { def BaseClass(Map options) { // Does something with options, // mainly initialization. } // More methods } and a bunch of derived classes like class AnotherC...
I am writing code for a very basic jQuery slider with the following features: Slide the content left or right on click of next/previous links till there is no more content on the clicked side. If any content is added dynamically, the entire content should slide. While there are still many additions and modifications ...
I have written a JS library (think, jQuery, but with much much less features, and targeted for newer browsers on mobile). This library provides an extension mechanism. One of the ways the extension can be defined is: $.extension("extname", function(options) { this.forEach(function(elem) { // do something ...
This is sort of a follow up question on https://stackoverflow.com/questions/754661/httpruntime-cache-best-practices/11431198 where a reply from frankadelic contains this quote and code sample from http://msdn.microsoft.com/en-us/magazine/cc500561.aspx: The problem is that if you've got a query that takes 30 seconds an...
We have an in-house time-tracking application at the office. We, the employees, can view an overview of our hours on a web page. This web page renders a table, with worked hours per day in table cells, which is styled as a monthly calendar. I wrote a small script which I can copy-paste in my console to get a total of h...
I am filtering a List (childList) based on the contents of another List (parentList). The parentList can contain 0-n entities where items of the childList are referenced by an ID (btw. ID is in this case a string, you could also call it "Name" or whatever you like). I want to filter the childList in a way that the resu...
The following is a symmetric encryption/decryption routine using AES in GCM mode. This code operates in the application layer, and is meant to receive user specific and confidential information and encrypt it, after which it is stored in a separate database server. It also is called upon to decrypt encrypted informatio...
I have this function which returns the time that a Tweet was created based on the created_at value that comes when a timeline is pulled. I also check whether or not the tweet was created more than 2 hours ago, and if it was, have an action execute. I was wondering, is there a way that this code could be shortened down ...
I have created a class intended to average the previous few data points submitted. It is able to change in size and has a feature to bypass the average without affecting the data contained therein. Are there any improvements I could make, or any exceptions thrown in certain situations that I haven't thought of? public ...
I have 3 car rental agencies. Each agency requires the data in XML, but in a different format, for example: Agency 1 <Rental> <Customer> <FirstName>test</FirstName> <LastName>test</LastName> </Customer> <Pickup date="07/20/2012"/> <Dropoff date="07/25/2012"/> <Deposit cost="100"/> </Rental> Agency 2 <Rental> <Custome...
I've been doing some parsing with regular expression named capture groups and decided it might make sense to write an extension to handle this. The code below will create an instance of a specified type and attempt to match the property names to the capture group names and then set the values. It also attempts to ca...
I currently have the following jQuery code, which does work, but I know there is a better way of doing it without having to repeat myself so much: <script> $(document).ready(function() { $('.container').hide(); $('#btn-post').click(function() { $('.container').hide(); }); $('#btn-game').cli...
This is the dashboard controller code in PHP Symfony 2. It collects some aggregate data and points for charts, but i don't like it very much. Do you think that this code belongs to what a controller should do in a MVC patter? How can i refactor it? public function dashboardAction() { $bag = array(); // Helpers...
Here is an ant script for generating TeX code and documentation for one LaTeX class and one LaTeX package. It is my first larger ant script: I welcome suggestions for improvements. <?xml version="1.0" encoding="UTF-8" standalone="no"?> <project name="customer TeX code" default="main"> <description>Buildscript for the L...
I am primarily a java programmer and for the first time working in C++. I have implemented a Factory design pattern in C++. class TaskFactory { public: typedef Task* (*create_callback)(map<string, string> vMap); static void register_task(const string& type, create_callback cb); // function ...
I tried to solve a programming contest problem in Scala, but I have a feeling, that it could be done in a more functional way. I compared it with the solution written in imperative style and it is not shorter or less complex at all. Do you have any idea how to "impove" or approach the problem in a more functional way? ...
The stored procedures must return their first resultset in the form: ( [index] int, [id] varchar(50) ) where [index] is 0,1,2,3,... and [id] is the name of the struct. As long as the first resultset returns the names of the resultsets in the same order they are returned by the stored procedure the php st...
Since I have little to no knowledge about native languages, I tried once more to write a simple application in C++, this time with a Brainfuck parser. It works, kind of, verified with the Hello World and Cat examples given in the Esolang wiki. So...what did I just break? #include <iostream> #include <fstream> using na...
I have the following class: Class Core { public $security; public $db; public $extra; public function __construct() { spl_autoload_register(array($this, 'loader')); } public function loader($name) { include $name.'.php'; } public function __get($key) { return $this->extra[$key]; } public function init(...
I'm working on a module that downloads a file saves it then validates if the file contents are valid. For simplicity lets assume that the file consists of 3 segments: Header, Body & Footer. Now here is the design I thought of: class File{ private $header; private $body; private $footer; function __con...
I need to do pending methods invocation in Java (Android) in my game project. A method represents actions in a scene. Maybe you're familiar with Context.startActivity in Android, which is not suddenly starting the activity, but statements below it is still executed before starting the requested activity. I've found 3 w...
Sometimes there is need to change an integer to text. I often use the following way: "" + myNumber But there is alternative way: Integer.toString(myNumber) Which one is better (performance, readability, safety)? Or are those equal?
I'm trying to merge two nodes. Basically, the idea is to take all children in left and new ones in right. Is there any way to get rid of toAdd variable and do it in a clean way? I don't want to convert any IEnumerable<T> to List or Array in this merge process. public IEnumerable<TChild> NodeMerge<TNode, TChild, TKey>(T...
I have two different data inputs for the same value, I want to use the non empty one if one of them is, to return the empty string if both are empty, and to flag an error if both are not empty but differ and return one of them. Empty for my criteria matches the meaning of string.IsNullOrEmpty(). And it's okay that it's...
I'm brand new to both Ruby and Rails, and while all the following works, it seems a bit messy. This is on a classified model to generate WHERE/AND WHERE clauses based on whether or not the user supplies a value through a dropdown. I'm not sure if there's a more Active Recordy way of doing this: class Classified < Acti...
This is just playing around and practicing javascript. I am learning JavaScript from Codecademy and I practice coding everyday so I can learn much as possible. I have a lot of if statements, prompt boxes, some alert boxes. I just got finished learning about functions and returns. I just don't know how to use the return...
Given the following HTML form (fragment): <fieldset id="timesheet-rows"> <legend>Add Entries</legend> <div id="timesheetrow-0" class="timesheet-row"> <label for="project-0">Project</label> <select id="project-0" name="project-0" required> <option value="" /> </select> <label fo...
I have a function that implements parts of reading iCal repetition rules, and returns a list of dates when a certain event takes place. Questions/Concerns of mine Any comments on the use of anonymous functions? I added them to keep the code as DRY as possible. One thing I rather dislike is the line return strtotime('+...
Base Info Two tables: tData, tData2 Exactly the same columns About 200,000 records SQL Server 2008 R2 Logic At first sight we need to insert tData rows into tData2. What else? We need a renamed version of a column inside another (tData2) with the condition checking it won't be an existing item when it's renamed. He...
I prompt the user for 9 numbers, store those numbers in 9 pointers and display the element 2. It seem to work just fine, but am I forgetting something? Can I improve it but keep it simple? I'm just a beginner testing what I have learned so far. int n; int *array[9]; bool isUsed[10] = {0}; for(int i = 0; i < 9; i++) {...
I got some really good responses here last time, which really helped out quite a bit, so I thought I'd try again with a new batch. Below is the second phase of my first Java project: Intercommunication between panels. This builds upon the old code, though it has been heavily modified since the first version. Many of th...
Function Enumerate-Properties($fileName) { $path = (Get-Item $fileName).FullName $shell = New-Object -COMObject Shell.Application $folder = Split-Path $path $file = Split-Path $path -Leaf $shellfolder = $shell.Namespace($folder) 0..287 | Foreach-Object {'{0} = {1}' -f $_, $shellfolder.GetDetails...
I am writing an API wrapper and the endpoint takes dates in a very specific format. The user of the API can pass in the parameters in whatever format they prefer, but regardless of what they pass in, I want to be able to clean up their input prior to submitting their query. My question centers around the best way to u...
Every time I go to write an MVVM application (say every 4-6 months) I rewrite my ViewModelBase class. This is for a range of reasons but let's say either I don't have access to prior code, the previous code was built for a client and isn't my code, or I'm working on someone else's machine and still don't have the code....
I'm using this pattern (for want of a better word) repeatedly in my code to call a REST API in my javascript code. Some particulars of the code below. I have a ConfigViewer javascript class that is responsible for creating, populating and handling events for DOM element. This class constructor inits the DOM components...
I am in the progress of creating a MVC structured website. I've opted to make my own instead of using pre-constructed MVC systems as a way to teach myself better coding and understanding how applications work. I've got everything laid out, but I'm not happy with my routing system. It is VERY crude and I'd like it to be...
I've created a database connection pool used on the serverside (of a client-server socket app) and was wondering what improvements can be made to help the design and/or efficiency of the solution. The pool is used from multiple threads so synchronisation is important. The application has been running for a while now w...
Code below is scattered all over the code base : if (StringUtils.contains(manager.getName, "custom")){ } It just checks if an object attribute contains a predefined String and if it does, enter condition. Is there a more elegant way of achieving above, perhaps using an enum?
I was trying to find a way to redirect to different pages on authorization and authentication failure. I found this to be a possible solution. However, I ended with a different solution by myself. It seems to work fine, however, I am not sure if it is the right thing to do. I created a custom Authorize Attribute that r...
I have a button group that looks like this: The user selects one of the options and they can search for a person based on that criteria. I wrote a switch statement that populates the URL to make the ajax call to get the data based on the option selected. However, the down side of this is that every time an option is ...
I made this small class the allows me to navigate large arrays using something like: key1/key2/key3 I made this because I was creating large arrays to hold my classes configs and needed a simpler way of accessing the data. Here is the project: - https://github.com/AntonioCS/settingsManager The class is here: <?php n...
I have written a script, introduced here, that improves the Linux terminal experience. It basically displays the content of the terminals current folder in a nicer way than the 'ls' command does. I use it all the time myself. #!/usr/bin/perl ########################################################################### #...
So I decided to create a trait that I could add to my classes that would add a simple way of binding functions to an event, and to fire those events. It ended up going a little further than I expected it to, and I am getting into things I do not normally work with, such as defining an object via a variable, $a = new $b...
I have a rather large javascript array of objects that I am transforming into an HTML table. Each object in the array looks like: { name:'Document Title', url:'/path/to/document.html', categories:['Some Category'], protocols:['ID Number','Another ID'], sites:['Location'] } It's possible to have mul...
I have a PhoneGap application that I wrote some time ago. After looking Doug Crockford's video seminar JavaScript: The Good Parts. I was just wondering if the code could be improved for better maintainability and readability as it now could be hard for others to understand what's happening. Maybe taking advantage of u...
I've created these 3 functions to count the value of letters in a word. All these functions are functionally the same. Apparently List comprehensions (count_word3) are usually seen as the most pythonic in these situations. But to me it is the least clear of the 3 examples. Have I stumbled across something that is so si...
I want to perform some operations on the gridview (asp.net 4.0). So, to achieve this i have written a jquery function which i am calling on pageload but, because this function takes some time for execution my grid performance degrades (IE 8). Can i optimize it someway? $.each($("#divTab2GridInquiries").find("tr")...
At the moment I am trying to create a Japanese rehearsal system, and it's working perfectly. However, I am not pleased with the code. Basically I had a .txt file called lesson1.txt. I saved it as UTF-8 so it can contain Japanese characters. I had the problem that I couldn't directly use the Japanese characters in Java...
Here is a simple Python script that I wrote with lots of help from the Python mailing list. I moves all the files of subdirectories to the top level directory. It works well for my use, but if there are things that can be improved then I would like to know. I ask in the interest of being a better Python programmer and ...
I created simple app that read ~ delimited txt file, convert it to [String] and display quotes on screen. How would you improve this code? To be more Haskell like... in splitStr (c/=) is faster than (/=c) by 20-50 ns. Why? Any other ways to clear screen in windows console app? If we compile this code as win console ...
I don't see anyway for a SQL attack to happen with its all hard coded. <?php $db = mysql_connect('host', 'user', 'pass') or die('Could not connect: ' . mysql_error()); mysql_select_db('DBNAME') or die('Could not select database'); // Strings must be escaped to prevent SQL injection attack. ...
This is a fraction of the binary writer I'm writing, and I'm trying find some way to improve it. using System; using System.Collections.Generic; public class ByteBuffer { // List used to hold all bytes that will be read private List<byte> buffer = new List<byte>(32); private int bitIndex = 0; /// <su...
I have started my hand at writing some scheme code. I am trying to get the first n primes. I plan to do so but first getting a list from 2 to m, and doing the following algorithm. Remove the first number and place in the primes list, remove all #'s from the initial list that are multiples of the number just pulled off,...
So far, I've used this in a few places and it seems solid. This is what I usually do to make a singleton: // Assume x86 for now #ifdef _MSC_VER #include <intrin.h> // for _mm_pause #else #include <xmmintrin.h> // for _mm_pause #endif #include <cstdint> #include <exception> #include <atomic> #include <memory>...
I have a little experience with Python and am trying to become more familiar with it. As an exercise, I've tried coding a program where the ordering of a list of players is determined by the roll of a die. A higher number would place the player ahead of others with lower numbers. Ties would be broken by the tied playe...
Answer in this question contains DateTimePrecise class that should return current date with millisecond precision. But class is pretty bug and complicated. So I wrote my own version which seems work fine. If you see any problems with my code? using System; using System.Collections.Generic; using System.Diagnostics; usi...
a=raw_input() prefix_dict = {} for j in xrange(1,len(a)+1): prefix = a[:j] prefix_dict[prefix] = len(prefix) print prefix_dict Is there any possibility of memory error in the above code?
Can someone please help to rewrite / tidy up this? // News Article Slideshow var periodToChangeSlide = 5000; var pp_slideshow = undefined; var currentPage = 0; $('#news-feature-img-wrap li').css('display', 'list-item').slice(1).css('display', 'none'); $('#news-items li:first').addClass('active'); $("#news-feature-wra...
Code Sudoku.java public class Sudoku implements ISudoku { /** * Generates wildcard values in case of conflict with the keys of the * Sudoku. Ensures all characters are alphanumeric, does not generate the * same wildcard twice, and tries to keep the wildcard as short as * possible. */ p...
Solution to 99 lisp problems: P08, with functional javascript If a list contains repeated elements they should be replaced with a single copy of the element. The order of the elements should not be changed. * (compress '(a a a a b c c a a d e e e e)) (A B C A D E) Anyone want to review? function cond( check, _th...
I am teaching myself C, and feel like I am just starting to get the hang of pointers and arrays (I come from Python, where everything is magic). I'm looking for reviews, especially if I'm doing anything wrong. In this code I wrote my own strcat() function, though it needs 3 args instead of the standard 2 (I couldn't ...
Here is part of my build system. guessCompilers :: Options -> IO Options guessCompilers options = foldl (>>=) (return options) modifiers where modifiers = [guessMetapost -- guessAsymptote, -- guessTex, -- guessLatex, -- guessXelatex ] guessMetapost :: Options -> IO Options guess...
I'm trying to validate some results that I see when using NetPipe to test some connectivity between a couple of Linux boxes (over various hardware). So, I concocted this simple client and server to do the same and I cannot seem to get the same numbers as NetPipe - I'm about 30-40% off the rtt times that it sees. Is the...
I have this code that places a marker and on mouse-over this marker is scaled out and then back to the 'original' scale: this.drawPerson = function () { self.svg.append("path") .attr("d", personPath) .attr("transform", "translate(100,100)scale(0.1)") .attr("class", "member") .style("f...
I'm creating a class to describe a "zigzag line" fit to a set of data. It implements my interface Fittable, which just contains evaluate() (I have mulitple kinds of curves that all implement this interface). I created the private inner class Node to describe a vertex. It will give the slope going to the left and the sl...
When checking for existence of a substring I have been doing this: var that = "ok hello cool"; if( that.indexOf('hello') + 1 ) { } Instead of: if( that.indexOf('hello') != -1 ) { } Am I overlooking something or is there a reason not to do this. Update: Yes, I was indeed unaware of the even simpler method of: if...
This is a Python script to save imgur pictures posted to reddit.com forums. I'm looking for an assessment on the design of this script and any web security issues that might exist. Obvious shortcomings: it only downloads image links http://i.imgur.com/xx.png not images from imgur pages http://imgur.com/page/ and lacks ...
I have an array of strings which are file names files, and an array of allowed file types or suffixes allowed_types. I want to filter out files which don't end with an allowed suffix. This does the trick, but I'm wondering if anyone can suggest a neater solution? Such as a way keep with ruby's usual streamlined style w...
I have written code exclusively in both C and C++. I see clear advantages in both and therefore have recently began using them together. I have also read, what I would consider, outrageous comments claiming that to code in C is outright dumb, and it is the language of past generations. So, in terms of maintena...
About Data: 3D data (100x100x20). Computation/Formula and Method: I am trying to compute the sum of squared differences along rows, columns and angles for various time differences. %% Grid and time paramters %# Grid parameters nRows=100; nCol=100; InitLag_Row=0; InitLag_Col=0; InitLag_Ang=0; LessLags=20; nLags_Row=nR...
This is the stripped down version of my update action for a Posts (blog post) controller: Posts.update = function(req, res){ _.extend(req.post, { title: req.body.title , author: req.body.author , body: req.body.body }); post.save(); }; This way feels a bit clumsy and repetitive, because...
My view submits data to the controller using Json objects which contains child objects.It allows users to add/remove/modify the relationship with child entities(authors,categories,LIbraryBookCopy). Users can only select authors and categories from list but can update/add LibraryBookCopy object. This is my first MVC pro...
This craps game simulator is based on someone else's posted Python code that I've redone for practice. I'm interested in improving readability and making it more pythonic. I used unittest instead of nose because I'm using an online IDE. from random import randrange import unittest class CrapsGame: def __init__(sel...
I am working on a personal iPhone ObjC project, and was recently getting frustrated with how tedious importing the same set of headers over and over was getting… So I created a header file that literally only imports other header files, and looks something along the lines of this: //BackboneTools.h #import "ASIHTTPRequ...
I need your opinion on writing a constructor that's clean code and unit test friendly. Option 1 : var res1 = bigObject.GetResource1(); var res2 = bigObject.GetResource2(); var res3 = bigObject.GetResource3(); var myObject = new Foo(bigObject, res1, res2, res3); //and the foo ctor just initializes its internal fields wi...
This is my current method for populating the sub-items of ListView controls. I like this method for two reasons... 1) I don't have to keep up with the display order of the columns. 2) If I enable column re-ordering, I don't have to change anything with the code. So, the question is... Is this a good approach? Can it ...
I would like to find a more efficienct way to use jQuery for my question and answer page. Here is the code which I want to change. If a .q_container is clicked, I want its corresponding answer div will slide down. $(document).ready(function() { $('#qc1').hover( function () { $('#a1').slideDown('...
The main advantage of this pattern is when I often create and destroy objects, which in this case are often used. I made this because I needed to track several short timers at the same time, but it can also be used for stuff like missiles or else. #include <vector> #include <queue> #define itv(TYPE) std::vector<TYPE>...
I have a map that I want to 'expand' into an infinite sequence in the following manner: {0 'zero 3 'three 10 'ten} => ('zero 'zero 'zero 'three 'three 'three 'three 'three 'three 'three 'ten 'ten 'ten ...) The indexes of the map indicating the index of the sequence where the value should change. The following code wor...
In re-writing my PHP framework vervPHP, I've created the following class: class storage { private static $instance; public $db = null; // Holds a database connection object public $user = null; // Holds user related information for custom auth public $data = array(); // Array of data for storage pr...