Tag Info

New answers tagged

0

I'm having a hard time seeing the benefit from this extra code. Code is a liability and unless there is an actual problem I probably wouldn't want to spend time on it. I would just create the app.config file and call it a day.


4

Systems such as RabbitMQ (or in your case maybe look into Kafka) can offer persistence, or guaranteed delivery, as well as configurable TTL on messages. However, they are not designed as a long-term persistent storage solution, and if we're talking about days, I would actually store the job in a DB as you suggest.


-1

MongoDB would allow you to create an index on Interests. When you create an index for a field which includes arrays, each array entry gets a separate index entry. So when your documents look like this: { _id:<<Objectid>> interests: [ "Programming", "Knitting", "Paragliding" ] } a query like ...


0

Here's what I would do: make no distinction between categories and subcategories. Each category would have parent category associated with it, which may be null (category and not subcategory). If I understand correctly, categories are not children of users, so if a user gets deleted, it won't delete its categories. In that case, you will need a child ...


3

An alternative to @Thomas comment (which is viable, although imo recursive foreign keys add too much complexity if you do not need the additional power they give) would be to create separate tables for each foreign-key type (one for students, one for groups), allowing for enforceable foreign keys: Rules: |id|rule | |--|----------| | 1|Bus at 7am| -- ...


0

Besides row locking, second technique is row versioning. If only you database is ACID, than it all comes down to having a field attached to each record which keeps some sort of unique timestamp which is updated in each operation. If two or more processes try to read and update same record, they all read same timestamp, but when updating, only first of them ...


1

Typically fetching is not an issue for concurrent read requests. When it comes to thousands of concurrent writes usually the systems are designed to prevent from more than a few concurrent write access to given record at any given time. When it comes to concurrent write access it's mostly boils down to DBMS record locking, via transactions.


3

It is a matter of opinion. You might use postfix representation (à la RPN, or even some stack-oriented programming language), or some bytecode (specific to your expression language), or some s-expr syntax, if you want some more compact representation. JSON is probably a less compact textual representation but it is very widely used (and you've got many ...


5

I do not have enough brownie points to comment so I will leave an answer. Keep in mind that the works of Shakespeare were written by a single human for human consumption. I think you should expand your horizons a little and consider machine generated text of which humans are only intended to read parts of. For example, looking inside the /var/log/ ...


2

Calculate your storage costs. Add the cost of high(er) availability, backups, version control. Look what S3 or Backblaze or whatever else would charge for this amount and traffic; compare to having your own servers / NAS / SAN / datacenter (I don't know your volumes). Then compare that to the cost of hiring a qualified developer / sysadmin to create and ...


3

In an app like this the "tiers" are usually various parts of the same application. You could write it as multiple JARs packaged into a single deployment, but the different tiers are more about separating the different concerns in the code than putting physical distance between them. If you were to put the data access on a separate machine, you would need ...


1

... i could generate the data when the user is registered and then store it to database, or generate it every time it is requested. This sounds like two completely different operations to me: 1) Generate [static] "image" data when the user registers and store it in a database. 2) Generate some dynamic "image" data whenever the user visits a page. ...


0

Nosthertus, please clarify your question more. I'll answer based on what I can understand now but will change/update it once you clarify. If you generate once and read many times, then storing is a good idea. Storing directly in the database is a bit more programming but has the benefits of putting everything in logically a single view that any app can ...


1

I would say the easiest way is to store it physically : you don't need any kind of handler or database call to retrieve the image, further managing will most probably be easier aswell as client-cache handling. There's actually not a lot of good reasons to clutter your database with images, so I would say this alternative is only just acceptable in some ...


1

What you probably want to do here is use a repository... This would have your querying methods directly related to your Object and would use and instance of the DB as part of its constructor: $repo = new MovieRepository($db); $movies = $repo->findAll(); And or writing you might have: $repo = new MovieRepository($db); $movie = $repo->findById($id); ...


3

Config files should almost be the last places to put business rules or parameters. Config files should in general used only for administrative functions - things that DB admin or IT admin would control - certainly not the business logic. One of the key reasons why config files for business logic is bad is because typically business rules not only change in ...


1

I agree with Snowman and think you should do all the queries. Along with performance being negligible, you can gain some insights about the data changes that may benefit you and/or users: New Categories Removed Categories Categories that have changed. Someone is eventually going to ask what happened. "We got a new file," won't be enough.


2

Since you have the primary key of each record, I highly recommend using the approach of examining each record individually. Primary key lookups are extremely fast in any professional-grade database. Updating a record based on primary key has a very granular lock level and is fast. By inserting or updating rather than delete/insert, you maintain the ...


0

I would look at reworking the way you save your data. Profile can exist without picture, while picture can't exist without profile. So, once people are done with their profile, save it. Once they are done with picture, save it separately. Why separate the registration into a number of pages, if you don't save the data independently?


2

No Technically, it looks like there are some ways to connect directly to your database via HTTP (google "sql server http endpoint deprecated" and "ado.net data services") but you cannot hide the connection information if it is on the client. This is a crazy bad idea -- don't do it. One of the first rules of web app programming is that the client cannot be ...


1

For a desktop application, it's usually better to deliver everything the end user will need in a single package. End users tend to dislike dependency requirements, because it only takes one or two conflicting packages requiring different versions of the same thing to completely ruin your day. For a single-user application, you're probably best off using an ...


2

As pvg has mentioned, a good option to use is an embedded database. The reason here is that the database can be included as a single JAR file, rather than needing to be installed on the system's user. Usually, you can access the databases using the standard JDBC API, so it really can act as a replacement for your current MySQL DB. The library will manage ...


1

If you're just learning, I recommend that you put the details of deployment to one side at first and just assume that the database will always be there and will always be in the correct format. Once you've got your application to a state where you're reasonably happy with it, then you can address your concerns regarding the database. When you do get to ...


3

You should look into one of the many embeddable pure java SQL dbs which you can embed and distribute with your app. Your existing SQL should work with those either as is or with minor modifications. Take a look at: http://hsqldb.org and http://db.apache.org/derby/


1

Yes, I have seen significant performance problems result from this sort of pattern. If you have branches in your sproc that result in making significantly different queries, under certain circumstances this can cause huge performance problems. SQL server will build an execution plan for a sproc when it needs to based on the values of the parameters passed ...


-1

SQL is the query language used in all Relational Database Management Systems. Different systems often have different extensions to the SQL language, but there is a standardized core which is the same across all. The extended version of SQL used in Microsoft SQL server is called T-SQL or Transact-SQL. It is a superset of standard SQL: In addition to the ...


0

There should not be any significant performance impact A clustered index is basically free - why not use it? Insert check for unique is an index seek It is very very fast for single or composite key Even if there performance implication for me data integrity wins every time If the data has a natural composite key then you should use a composite key ...


0

Using a hash is a good idea. Since security is not the goal in this case, choose a hash function that is fast (md5 is fine). Unless you plan to split the hash calculation across multiple threads/processes, you don't really need to store the current hash value in the database. If your process is a single script, you will just have the current hash in memory, ...


2

The data sync would be much better and faster, if it can be done on the basis of some kind of delta identifier or flag. Basically, you should update the target db data rows only when it is out of sync with the source db. In SQL server db, you can take the help of the Checksum fn also to build the delta based identifier. You should develop a SQL based job ...


2

The scenario itself: "a user views a video should increase view count" is a client side activity resulting in backend data changes. It is initiated by the user using the client app, so it is okay to put the code that initiates and increases of view count in the client app. However, here are some other/different ideas to consider: Keep using the client ...


0

This is going to depend on what language you're using, but you should have one configuration for debug and one for production. You can either focus on ensuring the wrong config is never deployed with your project, you can never run the project on the same server as the database is on (assuming you have disabled remote DB connections), or you can make sure ...


1

A number of options: Using firewall, block anything from accessing production database except a few servers that are allowed. This should be done always in production. Define production configuration on the production server and don't check it in source control. Source control should maintain only development configuration file with the development ...


0

You've got a holiday and the basic information about it. Holiday: holidayId (pk) name What types of holidays do we have? There are the fixed holidays, the moving holidays and the "I'm not even going to bother calculating" holidays (Easter, I'm looking at you). For this, you would have subtables. There are the fixed, repeating holidays. Things like ...


0

I have figured that it's best to store the day count which the event/holiday is on. I had a look at the Queens birthday in Australia and its every 2nd Monday of June, it doesn't move on to the next month. For most of Australia accept Western Australia that's the queen's birthday. in western Australia the queen's birth day is on every 5th Monday of September, ...


2

What you have is not flexible enough. The basic requires are you need to be able to express e.g. the following: U.S. Memorial Day is the last Monday of May. U.S. Thanksgiving is the fourth Thursday of November. Christmas is the 25th day of December. Easter is... maybe just scrape Wikipedia? One simple way to express this is to add fields for the ...



Top 50 recent answers are included