Neo4J and timestamps - neo4j

I need information about node's creation & last modification dates...
Is there a way to automatically handle created and updated properties for a node?
Hibernate offers #Version for updated field. Is there something similar with Node4J.
I found http://neo4j.rubyforge.org/classes/Neo4j/Rails/Timestamps.html but it seems to be only available for Ruby.

You can use annotations form the spring-data-commons library. Use #CreatedDate and #LastModifiedDate on properties of type Long. Make sure you're using the simple mapping mode. For now, advanced mapping mode does not support this, see DATAGRAPH-335.

Related

Delete Bigtable row in Apache Beam 2.2.0

In Dataflow 1.x versions, we could use CloudBigtableIO.writeToTable(TABLE_ID) to create, update, and delete Bigtable rows. As long as a DoFn was configured to output a Mutation object, it could output either a Put or a Delete, and CloudBigtableIO.writeToTable() successfully created, updated, or deleted a row for the given RowID.
It seems that the new Beam 2.2.0 API uses BigtableIO.write() function, which works with KV<RowID, Iterable<Mutation>>, where the Iterable contains a set of row-level operations. I have found how to use that to work on Cell-level data, so it's OK to create new rows and create/delete columns, but how do we delete rows now, given an existing RowID?
Any help appreciated!
** Some further clarification:
From this document: https://cloud.google.com/bigtable/docs/dataflow-hbase I understand that changing the dependency ArtifactID from bigtable-hbase-dataflow to bigtable-hbase-beam should be compatible with Beam version 2.2.0 and the article suggests doing Bigtble writes (and hence Deletes) in the old way by using CloudBigtableIO.writeToTable(). However that requires imports from the com.google.cloud.bigtable.dataflow family of dependencies, which the Release Notes suggest is deprecated and shouldn't be used (and indeed it seems incompatible with the new Configuration classes/etc.)
** Further Update:
It looks like my pom.xml didn't refresh properly after the change from bigtable-hbase-dataflow to bigtable-hbase-beam ArtifactID. Once the project got updated, I am able to import from the
com.google.cloud.bigtable.beam.* branch, which seems to be working at least for the minimal test.
HOWEVER: It looks like now there are two different Mutation classes:
com.google.bigtable.v2.Mutation and
org.apache.hadoop.hbase.client.Mutation ?
And in order to get everything to work together, it has to be specified properly which Mutation is used for which operation?
Is there a better way to do this?
Unfortunately, Apache Beam 2.2.0 doesn't provide a native interface for deleting an entire row (including the row key) in Bigtable. The only full solution would be to continue using the CloudBigtableIO class as you already mentioned.
A different solution would be to just delete all the cells from the row. This way, you can fully move forward with using the BigtableIO class. However, this solution does NOT delete the row key itself, so the cost of storing the row key remains. If your application requires deleting many rows, this solution may not be ideal.
import com.google.bigtable.v2.Mutation
import com.google.bigtable.v2.Mutation.DeleteFromRow
// mutation to delete all cells from a row
Mutation.newBuilder().setDeleteFromRow(DeleteFromRow.getDefaultInstance()).build()
I would suggest that you should continue using CloudBigtableIO and bigtable-hbase-beam. It shouldn't be too different from CloudBigtableIO in bigtable-hbase-dataflow.
CloudBigtableIO uses the HBase org.apache.hadoop.hbase.client.Mutation and translates them into the Bigtable equivalent values under the covers

GXT 3.x Custom PropertyEditor / ValueBaseInputCell

I'm trying to write a custom field editor that will translate between Long and String. IE: String representation on screen but field type is a Long.
I've implemented the PropertyEditor (HrMinPropertyEditor) but don't know how to wire it in. My HrMinField is quite clunky as I needed to use a TriggerFieldCell because the generic types inside TextInputCell etc. prevented me from using them.
Do I need to do a subclass of ValueBaseInputCell? That seems strange since my PropertyEditor has all the Long / String conversions. It also looks difficult.
If so, is there a simple example or some documentation I can read?
BTW, my learning project is Maven based and should be easy to fire up if necessary:
svn checkout http://subversion.assembla.com/svn/freshcode_public/learn/gwt/ learn-gwt
cd learn-gwt
mvn gwt:run
Navigate to GXT | Forms | Time Edit
Thanks in advance,
Pete
PS: I've asked this on the Sencha forum too.
You should use method setPropertyEditor from Field class to specify your custom property editor:
HrMinField f = new HrMinField();
f.setPropertyEditor( new HrMinPropertyEditor() );
I managed to come up with a solution using a Converter and a Validator.
The more complete answer is on the Sencha thread.

Create column in TEasyListView

I use TEasyListView from mustangpeak.net. I'd like to create a combobox in a column. I can't find any sample to do this from the component demo. If I use TListView, I could follow a trick from http://www.swissdelphicenter.ch/en/showcode.php?id=801 but I need to use TEasyListView. Please, give me some guides.
I am not sure but I would guess TEasyListView is a descendant of TListView since pretty much everyone creates new components based on lower level components. Try checking back into the components and you will more then likely find a way to use the "trick" you named above.

What is the best way to access lookup values in symfony? On the database or constants?

I am creating a web project and want it to be optimized. Instead of accessing lookup values in the database (to minimize access), I think it should be stored somewhere in symfony. What is the best way to this? In YML with PHP Array?
You can put values that don't change often in lib/app.yml
You can access those values by using sfConfig::get('value').
app.yml is cool because you can store enviroment specific values in it.
Another option I use for values that should never change and that are not environment-specific is to define constants in a relevant model or helper class.
The advantages are:
1) if you name those constants well using them helps make the code more self-documenting
2) if you use an IDE with autocompletion features it will look up and verify their names as you're coding.
3) they are the fastest possible method of lookup.

Switch symfony 1.4 from Doctrine to Propel

How can I properly switch the newly installed Symfony 1.4 framework from Doctrine (that it is configured for by default) to Propel?
If you create new (fresh) project...
symfony generate:project xxx --orm=Propel
The easiest thing :)
If you want to change existing project - you have to dig in configuration file and enable propel plugin.
Your configuration file should look similar to:
// config/ProjectConfiguration.class.php
public function setup()
{
$this->enablePlugins('sfPropelPlugin');
...
}
(based on Symfony page, you should dig it next time - especially Practical Symfony)
Use Propel if you enjoy object-oriented syntax.
If you like chained object method calls that look like SQL statements, use Doctrine. If you like real objects that hide SQL, use Propel.
If you like creating criteria objects that then render themselves as WHERE clauses, use Propel. If you like creating WHERE clauses similar to SQL, use Doctrine.
You can use both at the same time, too. Not recommended, but if you use plugins like apostrophe that only use Doctrine, you might not have a choice.
Replying to the contributors here who wholly recommend Doctrine: the decision is not clear cut, in my view. Propel now also supports chainable query methods, so if you like that approach then both are still in play. Also, the Propel team maintain that the generated nature of model objects makes it faster to run for most use-cases than Doctrine.

Resources