w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Using Hibernate in a distributed system
Approach # 1 For us, scalability is important and we use your approach #1. We deploy isolated instances of Hibernate (as a service behind Tomcat servers in EC2). When demand increases and more instances are needed, it's easy to add more instances. Benefits of this approach: encapsulation (not in the OO sense), as each instance is configured in isolation easier configuration, as only a single instance image is needed. scalable About transaction management: this is done by the DB engine itself; not by Hibernate, and not by EC2 as you mentioned. You can have one large instance of MySQL as an RDS and it can handle transactions from several "clients" (Hibernate, JDBC, SQL Concoles, etc.). Hibernate in this case 'doesn't matter'. The DB will also gracefully handle concurrency and deadlo

Categories : Hibernate

PHP Distributed File System, File System for downloading from Network Storage
Network file system, using PHP and MongoDB http://verens.com/2014/11/06/distributed-file-storage-using-php-and-mongodb/

Categories : PHP

Is it possible to deploy a distributed system on cloud?
Absolutely - depending on how your distributed application works. The Azure Auto-Scaling Block is the tool we use to scale (add additional Cloud Services) when memory or CPU reaches certain thresholds.

Categories : Azure

Generating a unique ID for every request in a distributed system
Try to use UUID System.out.println(UUID.randomUUID().toString()); Prints something like: 3aae7d1a-8799-4a6f-8863-cde6b1782e7b It's a common practice to use if for ids But why do you need short random id? You should understand that with short id there are more chance to get duplicates, and ID usually field for programs and not for people.

Categories : Java

CPU bound/stateful distributed system design
RabbitMQ is has an RPC tutorial. I haven't used this pattern in particular but I am running RabbitMQ on a couple of nodes and it can handle hundreds of connections and millions of messages. With a little work in monitoring you can detect when there is more work to do then you have consumers for. Messages can also timeout so queues won't backup too greatly. To scale out capacity you can create multiple RabbitMQ nodes/clusters. You could have multiple rounds of RPC so that after the first response you include the information required to get second message to the correct destination. 0MQ has this as a basic pattern which will fanout work as needed. I've only played with this but it is simpler to code and possibly simpler to maintain (as it doesn't need a broker, devices can provide one thoug

Categories : Amazon

Where to store configuration information in large Distributed Enterprise System
Apache ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services.

Categories : Misc

How to connect to a database using a distributed API?
Are the database Servers running on these machines? Are u starting the database server programmatically? If you try to connect a database Server with: jdbc:derby://localhost:1527/KempDB This Server needs to be up and running. For your case you should use an embedded Database. For the case your Database is already an embedded Database, then you can try using this URL: jdbc:derby:KempDB instead of: jdbc:derby://localhost:1527/KempDB Hav a look on this one

Categories : Java

How to connect a distributed database in a web application?
One option is to simply use a centralized database. Why is this not an option? Another option is to use a database at each location, and have them synchronize to a central database (master-slave), or with each other (master-master). Look at replication for your database of choice, or db sync tools like SymmetricDS.

Categories : Database

spring distributed database transaction manager
Sounds like you want to use a ChainedTransactionManager. Spring has implemented one of these for neo4j, so you can take the code out of the project. There was a good article on how to do this, but cant find it anymore. But perhaps this is enough to get you started..

Categories : Database

Advice about database design with tokens
The database design seems appropriate enough, not knowing much about the final solution needed. Your ultimate question really has nothing to do with database design however. You seem to need to create some kind of algorithm that would interpret the raw user input about an event and automatically classify it according to some kind of keywords. This is not a trivial exercise and would be error prone. You are correct that the easier, and probably more accurate, approach would be to have the user self select the categories. This would probably be the best user experience as well since because you would be expecting certain type of reports anyways, the user could get to the right classification with a few presses instead of typing out descriptions.

Categories : Regex

Database Design Advice - Multiple yes or no Questions
You can store the questions and answers in a separate table. Specifically you'll have a Questions table that has the 40 yes/no questions. The Answers table will have the columns for the question identifier, the user identifier, and the answer (for yes/no questions you could just use a boolean). AnswerChoices could also be a separate table. There is a lot of possible flexibility depending on your needs. If the same user can take the survey more than once, you can have a user-surveys table and link answers to that instead. You can also have a Surveys-Questions mapping table in case multiple surveys are needed.

Categories : Mysql

Advice on database design for multiple catalogs
If it were me, I would create the catalog table as an entity table, with it's own id. If that catalog only belong to one store, I would add a store_id column as a foreign key. I would then add a catalog_products table. This would have a foreign key to the catalog table, as well as a foreign key to the products and/or product_sizes table. (If a product_size belongs to only one products table, then just the products_sizes table.) To resolve a many-to-many relationship, we typically add a third relationship table. a catalog has zero, one or more products (product_sizes) a product (product_size) appears in zero, one or more catalogs The relationship table gets us "one-to-many" relationships, which we can represent: a catalog_product appears in exactly one catalog a catalog contains zer

Categories : Mysql

MySQL Database design advice - using joins
SELECT * FROM prices WHERE device_id=2939 AND id IN (SELECT price_id FROM prices_attributes WHERE attribute_option_id IN (19,47)); Is it what you're looking for? EDIT: sorry, didn't notice you're asking for query using joins

Categories : Mysql

Database design advice for mobile phones with variations
Litigation support systems run into this problem all the time with respect to people. The usual approach is to build a table of aliases. The simplest structure is a table of just two columns. create table device_aliases ( device_id integer not null, device_alias varchar(20) not null, primary key (device_id, device_alias), foreign key (device_id) references devices (id) );

Categories : Mysql

Database advice for counting wins/losses between players
If you don´t mind not knowing who dueled with whom, you can put a total_wins column in your user data table, and increment it for each user after each match. It has the advantage of not taking too much space. But if you have a pretty big applications your data base could lock up with so many querys and writes

Categories : Database

Advice for database choice and architecture for implementing a Human Resource web app
Your decision to go with a relational database or a NoSQL database will largely depend on a number of factors: How the data you need to be stored is to be modeled. What the expected access pattern for the data is to be What requirements you have for scalability What requirements you have for data consistency Typically NoSQL might be preferable when you have: A schema-less or dynamic data structure. No need to access the data outside of using a handful of indexes (i.e. you don't need much flexibility in how you access the data) You have the need to scale horizontally (something traditionally more difficult to do with relational DB's) You maybe don't need transactional consistency and are possibly OK with eventual read consistency (depending on the NoSQL system you choose) To me the

Categories : Mongodb

Relational database design advice for laravel 4 based e-commerce application
Each attribute with multiple values should have its own table, where the foreign key is the base item -- for example, you could have iPhone in the base table, with color, memory size, etc. as their own tables. The pricing table then contains the price and all of the foreign keys that completely describe the item (a white, 64GB, iPhone). You might want to look up "database normalization" while you are at it.

Categories : Database

Least worst option to secure database connection string for distributed wpf application to users with local admin rights
You are right: you cannot prevent a determined local admin to get access to this database. Here's what I -- as a determined user -- would do (I have done it in the past with other programs): I would attach a debugger to the running process and look at the memory to find the plain connection string (of course I am simplifying -- but it works). Another option would be to use the debugger to hijack your IDbCommand objects to execute arbitrary SQL code, no need for me to find the connection credentials, your application manages the connection for me. So it really comes down to: how competent and determined are your users? how important is your database? how determined are you? It's the classical hacker trade-off: how much effort do you want to put into this to discourage your users from cra

Categories : C#

Required advice on choosing proper data type and algorithm for inserting data into database
In my view using a vector for the single years data is wrong. A vector should be used when you have variable length data all of similar type. Neither of these is true in your case, you always have 13 data elements, and the first (the year) is not of the same type as the rest (the monthly values). I would declare a simple struct with a constructor for the default initialisation you seem to require struct YearlyData { YearlyData() { year = -1; for (int i = 0; i < 12; ++i) months[i] = -1; } int year; double months[12]; } Then your initialization code is simple ConsumtionForAllYears.assign(nYears, YearlyData()); and your reset code is exactly the same ConsumtionForAllYears.assign(nYears, YearlyData()); and there's no need for DataForSingleYear.

Categories : C++

SQL Server 2008 R2 custom database as system database
Thanks to cgsmks, the answer was to disable replication. The database had been marked as the distributor database during replication configuration, which moves it to the system folder! From the link http://www.sqlservercentral.com/Forums/Topic1381740-1292-1.aspx posted by cgsmks: To undo the operation, I right clicked on the Replication Folder and selected Disable Publishing and Distribution. I then selected the Yes, Disable Publishing on this Server option and completed the wizard.

Categories : Sql Server

Database retrieval system
Your query is incorrect to begin with. You cannot have two WHERE in a single statement. The following is one of your query statement SELECT tbl_books.ISBN, tbl_books.Title, tbl_books.Author, tbl_books.Book_Image, tbl_book_type.Name, tbl_categories.Name FROM tbl_books, tbl_book_type, tbl_categories WHERE (tbl_books.Type_id = tbl_book_type.Type_id) AND (tbl_books.Category_id = tbl_categories.Category_id) WHERE tbl_books.Title LIKE '%$Search%' Do you see you use WHERE two times? Additionally, your code is not secure. You should use PDO or at least use mysql_real_escape_string.

Categories : PHP

How to add ODBC System DSN for Access Database?
Without seeing your <DllImport> statement, it's difficult to give you an exact answer, but I'm making an educated guess (based on sqlconfigdatasource (odbccp32) at pinvoke.net) and the code you provided that you've defined your SQLConfigDataSource function as something like this: Public Shared Function SQLConfigDataSourceW(ByVal hwndParent As Long, ByVal fRequest As Integer, ByVal lpszDriver As String, ByVal lpszAttributes As String) As Integer When in reality hwndParent is an 32-bit integer (Integer in VB.NET), so it should look something like this: Public Shared Function SQLConfigDataSourceW(ByVal hwndParent As Integer, ByVal fRequest As Integer, ByVal lpszDriver As String, ByVal lpszAttributes As String) As Integer The you would call it like this: ret = SQLConfigDataSource(

Categories : Vb.Net

Making one or separate database for two system?
I would not recommend to use only one DB. Each CMS (I assume vb forum IS a CMS) should have its dedicated database (but the DBs can be hosted on the same serv). Each CMS uses plugins and has a very special way to work with the database, so basicaly they would not be able to share information directly via database. Many CMS on the same DB = risk of conflict. (depending what do you need to integrate) You need to use a bridge, that's safer.

Categories : Database

Database Structure for Web Messaging System
After learning the hard way (times ago, during my final project...), I can advise you to separate and organize the things whenever possible. Self-relationship is a nice thing not to be near, when possible (there are rare exceptions). Design your classes at first instance; build then a database in which things fit well, but keeping things simple as they should be. My preference is... better drawn than said, You may prefer to see the code. It's here. A possible query to list messages from a certain header would be SELECT h.id AS `header_id`, h.`subject`, h.`status`, m.id AS `message_id`, m.content, m.`time`, IF(m.is_from_sender, x.`name`, y.`name`) AS `written_by` FROM (SELECT * FROM header WHERE id = @VAR) h INNER JOIN message m ON (h.id = m.header_id) INNER JOIN user x O

Categories : Mysql

JSON-based database system
I know MongoDB (and possibly others) is using binary JSON format. I would look into that to make sure you are not reinventing the wheel. At the very least I would say that since there is a Node.js-library for MongoDB, it might be a good trade-off between having the sort of efficiency you require and ease of implementation (since you won't need to write the database software, hence allowing you to focus more on the application itself).

Categories : Database

Creating a login system in C#. .mdf database?
Enter SQL Server Express Management Studio and recreate your schema there. SQL Server Express creates .mdf databases. Microsoft has a good tutorial here: http://msdn.microsoft.com/en-us/library/ms186312(v=sql.105).aspx You can most likely export your scripts for your database creation from visual studio and run them right in SQL Server Management Studio

Categories : C#

How should a Facebook-Timeline system look on the database?
users id | name | posts | id | u_id | content | wall | id | u_id | post_id | u_id from posts is users.id where it's the Author u_id from wall is users.id where it's the Target (on which wall is posted) you can name it much more clear i.e. poster_id, target_id Another way is to have post | id | poster_id | wall | id | post_id | target_id | content | post_id | content | You can also add another specific things, such as if the post is a comment or something, in another table, or a column in post table function getUsersWallPosts($target_id) { $query = "SELECT c.content FROM content AS c, INNER JOIN wall AS w ON w.post_id = c.post_id WHERE w.target_id = $target_id"; $result = someUserDefinedFunctionForQueryAndFetch($query); retu

Categories : PHP

What is the best database structure for a rental system?
Use a table for your items with a reference to an ItemType table: Item ItemId ItemType HireDate Hirer 1 2 1 Jan 200 2 3 3 Jan 201 3 6 4 Jan 207 ItemType ItemTypeID Desc 2 Boat 3 Car 4 Bike

Categories : Database

MySql database version control system
Have a look at Doctrine Migrations http://www.doctrine-project.org/projects/migrations.html I've been using it in one of my projects, and it is working quite nicely. You just maintain php files that are classes that have the sql files to run against the DB. There is one simple table that tracks what version the db is currently on.

Categories : PHP

what are the contents of System.out.println of Database object
Because DatabaseConnection class doesn't override, Object class toString() method will be used : public String toString() { return getClass().getName() + "@" + Integer.toHexString(hashCode()); } It is Hex String of hashcode. As Paul commented, it is useless for programmer.

Categories : Java

How to create a system to store and load any struct from database?
Note: I deleted my previous answer since it was on an entirely different interpretation of the question; I still leave it (deleted) as reference if anybody wishes to see it. What you are asking for could be done in a language having reflection. Full blown reflection fortunately is not required, still C++ does not offer any out of the box. Warning: I personally consider the need dubious. Asking for a 1-to-1 mapping between a structure (and its field names) and the database table (and its column names) may cost more in terms of maintenance than it is worth. The notable question is how to retain backward/forward compatibility when changing the database schema. /Warning A first standard way to add in reflection is to consider BOOST_FUSION_ADAPT_STRUCT. struct Person { struct Name: Fi

Categories : C++

Creating a relational database in MySQL for a shopping system
Faced with something with per item properties that may have nothing to do with one another, and need to be added dynamically when you add new items to the 'store' I would put general information in my tables and item specific stuff in an XML (with a schema custom to that item or possibly sub-type). Alternately you could have a key-value look up table to accomplish something similar. For certain known business functions (price calculation) you could store the formula in a per-defined format in the item record and have it reference the specific properties (from the XML or key-value table) which need to be used to calculate them. Same for other common functions against custom / not known beforehand properties. I did something similar to allow on custom processing of survey answers for user

Categories : Mysql

Greenplum database is not expanding dynamically to our Linux system
gp_disk_free simply runs the df command on each segment. It reports the free size in kilobytes. You have 4 segments on 2 segment servers. Each segment is using a different disk; that is a good strategy. Segment 2, which is running on sdw2 and using /dev/md126 is the segment that is low on disk. It has only 1.1 MB. If I assume that nothing other than the database is using disk space, then there is a problem with skew. Some of your tables have distribution policies that are causing many more rows to be placed on segment 2 than on the other segments. You can investigate this with something like this: select gp_segment_id, count(1) from <your_table_name> group by 1 order by 1 ; The solution is to change your distribution policy. Either choose a different column to place

Categories : Postgresql

System.Delegate System.Reflection.MethodInfo.CreateDelegate(System.Type)
That method not exists in .net 4.5 - before then, Delegate.CreateDelegate should be used instead. It sounds to me like maybe NInject is incorrectly using that method in a 4.0 nuget package, in which case you should report that as a bug in NInject. The first thing to do is to check you are using the correct version of the dll, i.e. specifically a 4.0 build. After that, one of: roll back to an earlier NInject version upgrade your .net framework version download the code, fix it, and submit a patch

Categories : C#

System generated integer entity ID's using DDD-style repositories with EF database first
No, Entity Framework does not support system generated ID's. If you want to that you have to implement it yourself perhaps overriding SaveChanges in derived DbContext but I would not recommend you to go down this road

Categories : Sql Server

Database design for a reservation system with assets which can travel between locations
What I see is 4 entities to start with : Asset, Location, Customer and Booking. Use Booking to show what time what asset is booked by a customer from one location to another.

Categories : Database

System.Web.HttpInputStream instead of the correct sharepoint pic library URL when storing the image url in the database
If you want the Sharepoint URL in the database, you should add it to the List first, as you are doing, then you can get the URL to put in the database. You can do something like: SPListItem li = pics.RootFolder.Files.Add(FileUpload1.FileName, StreamImage).GetListItem(); string absURL = li["EncodedAbsUrl"].ToString(); This will give you the full path to the file in absURL which you can insert into your table.

Categories : C#

Cannot implicitly convert type 'System.Linq.IQueryable' to 'bool'
context.SomeTables.Where(p => p.FileName == System.IO.Path.GetFileName(file)) returns an IQueryable, not a bool. You need something that returns a bool, like context.SomeTables.Any(p => p.FileName == System.IO.Path.GetFileName(file)) as your condition for the if statement. See Also Enumerable.Any Method (IEnumerable)

Categories : C#

How to insert the current system timestamp into db2 database base column when .csv file is loaded
SimpleDateFormat cDate = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss"); Date now = new Date(); String ccDate = cDate.format(now); Will get the current time and insert the string ccDate into the DB. Example

Categories : Java

Any obvious drawbacks for using a code versioning system to store history of changes to a database record
Instead of exporting data into JSON (via BSON, as that is what mongodump provides), I would suggest you create "archive" collections for each collection in MongoDB. You can then move outdated versions of your documents to this archive collection in the same format that you have them in your normal collection. As long as you store a date with the documents, you can very easily retrieve earlier versions without having to use a cumbersome solution such as a GIT/HG repository. Comparing versions is something you will probably need to visualize anyway, so doing that with JSON representations of documents instead of the real documents isn't a real benefit anyway.

Categories : GIT



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