I haven't found any example of how to make a dynamic form for a field which is a Postgresql array.
I want to fill it dynamically using Mustache.js. I have done it before but with a string field using a json string.
I am using ruby2.0, rails4.0 and postgresql9.1.
Thank you very much.
You can insert the Array values into a form with:
<input type = 'textbox' name = 'model[array_column_name][:item_1, :item_2...]'>
params['model']['array_column_name']
I'm not familiar with mustache.js but the above should give you a rough understanding on how to implement a form with a PostgreSQL Array.
Related
I have an array of JSON objects within my database (as depicted by the image below)
How do I search for a specific value within it? Say I want the record where the "ends_at" field is equal to "2018-11-24 08:00:00"
I've tried using
->where('column->starts_at', '2018-11-24 08:00:00')
or even tried
->whereJsonContains('column->starts_at', '2018-11-24 08:00:00').
Within the model I've cast the column to an array - am I missing something, or can this not be done?
Use this:
->whereJsonContains('column', ['starts_at' => '2018-11-24 08:00:00'])
I'm using ng-tags input, and the data I get after populating a line is an array of object, each with one 'text' string field like so
[{"text":"egon"},{"text":"peter"},{"text":"raymond"},{"text":"winston"}]
Is there a way to store the data as an array of strings instead? like
["egon", "peter", "raymond", "winston"]
ngTagsInput only works with arrays of objects. You can easily extract an array of strings out of an array of objects, though:
$scope.tagsString = $scope.tags.map(function(tag) { return tag.text; });
Update
It took some time, but ngTagsInput offers now basic support for array of strings. Starting in v3.2.0, the following is possible:
<tags-input ng-model="tags" use-strings="true"></tags-input>
Plunker
Better late than never, I guess.
I would like to know if there is any simple way in logstash to copy all the elements of one field array to another. Put another way, is there a way to copy all the nested fields of a top-level field to another top-level field?
I'm having this problem because I'm dealing with a nonstandard multiline log format which is not necessarily thread-safe. So in order to make sure I get all the data I need and in the right order, I'm currently on planning on throwing every relevant value of each type into an array, and then sorting them out later. The problem I'm having is that logstash doesn't seem to support too much array manipulation. If you think my approach just won't work at all in logstash, any suggestions as to what I could do instead would be greatly appreciated.
Thanks!
As this question almost shows: LogStash: How to make a copy of the #timestamp field while maintaining the same time format? you can use the ruby filter to copy an array.
filter {
ruby {
code => "event['another_top_level_field'] = event['top_level_field']"
}
}
I can append to a single array using
{append var='name' value='Bob' index='first'}
However, if I have a multi-dimensional array such as:
$name[first][last] = ['this','array']
and I want to append another value to the array at $name[first][last] e.g. to make the array like this:
$name[first][last] = ['this','array','appended']
how can I do this in the smarty template?
You can do this without using append:
{$name[first][last][] = 'this'}
{$name[first][last][] = 'array'}
{$name[first][last][] = 'appended'}
I must highlight though - templates should be used for specific purpose: to display prepared data; having to do the above is a code smell
I've tested many cases to try achieve it and I think it's not possible (in documentation there is also no info or example of multidimensional key or var)
You should also really think do you need it at all. Logic should be in PHP and role of Smarty is only displaying data not manipulating them
Hi can anyone provide me with a simple example (or point me in the direction of an example) of how to fill an array with a specific column from a dataset within VB.NET?
I'm having a hard time finding documentation on the controls of a dataset within VB.
here is documentation on the dataset class: http://msdn.microsoft.com/en-us/library/system.data.dataset.aspx
you can access a dataset which is strongly typed with:
dataSetName.dataTableName(rowIndex).ColumnName
if your dataset isn't strongly typed then you can use:
dataSetName.tables("tableName").Rows(rowIndex).Item(columnIndex)