302 karma · joined Jan 27, 2011 (15y ago) · 138 submissions
1.
Committee to re-legitimize bare try: except: in Python, assemble(nothing.com ↗)
1 points · by mwhite · 6y ago · discuss
comment 6y ago · link · parent
I would say that having a multi-level inheritance hierarchy with greater than "constant" number of children per parent in one package is a code smell.
comment 9y ago · link · parent
It is unfortunate that they changed the aesthetic so much with GNOME 3, particularly making it more minimalist. I prefer the prevailing toolbar aesthetic in GNOME 2 of icons with text, and the less integrated desktop management scheme at a high level in comparison respect to the Shell. Even if the old toolbar style wasted space and the new desktop scheme provides more power, they destroyed the configurable simplicity of GNOME 2 in favor of minimalism. In addition, you have to respect the history of a product's UI if you wish to retain users who want to stay comfortable in the software they use.
comment 10y ago · link · parent
> Planned out-of-hospital birth was associated with a higher rate of perinatal death than was planned in-hospital birth (3.9 vs. 1.8 deaths per 1000 deliveries, P=0.003; odds ratio after adjustment for maternal characteristics and medical conditions, 2.43; 95% confidence interval [CI], 1.37 to 4.30; adjusted risk difference, 1.52 deaths per 1000 births; 95% CI, 0.51 to 2.54). The odds for neonatal seizure were higher and the odds for admission to a neonatal intensive care unit lower with planned out-of-hospital births than with planned in-hospital birth. Planned out-of-hospital birth was also strongly associated with unassisted vaginal delivery (93.8%, vs. 71.9% with planned in-hospital births; P<0.001) and with decreased odds for obstetrical procedures
comment 10y ago · link · parent
- data (string type, int id, json fields)
- fk (string type, int subj_id, int obj_id)
select
data.id,
data.fields,
fk_1.obj_id as 'foo_id'
fk_2.obj_id as 'bar_id'
from data
join fk as fk_1 on data.id = fk_1.subj_id
join fk as fk_2 on data.id = fk_2.subj_id
where
data.type = 'my_table'
and fk_1.type = 'foo'
and fk_2.type = 'bar'
What would the performance characteristics of that be versus if "foreign keys" are stored in the same table as the data, if fk has the optimal indexes?comment 10y ago · link · parent
Storing a data type field in the generic storage table enables the same partitioning ability as a standard schema.
99% of NoSQL database users just don't want to deal with migrations, even if they're "free" (another big issue is synchronizing application code state and DB migration state of production, testing, and developer machines), so what they really need is NoDDL, YesSQL.
> Almost all database engines can add columns for "free" because they don't go mutate existing rows. Some can drop columns for "free" too by marking the field as obsolete and only bothering to remove it if the rows are touched.
Didn't know that, thanks.
> It can also introduce contention (depending on locking strategies) where there wouldn't normally be any.
Didn't think of that. I'm aiming this at 99% of NoSQL users in which doing things you could do with SQL requires much more effort, so allowing them to do it with SQL can accept a modest performance degradation, but if you have any good links relevant to how this storage design would affect lock contention, please share.
comment 10y ago · link · parent
This could be solved for relational databases if you implemented application-level abstractions that allowed you to store all your data using JSON storage, but create non-JSON views in order to query it in your application using traditional ORMs, etc.
So, store all data using these tables, which never have to be changed:
- data_type
- data (int type_id, int id, json data)
- foreign_key_type (...)
- foreign_keys (int type_id, int subject_id, int object_id)
(we'll ignore many-to-many for the moment)
And then at deploy time, gather the list of developer-facing tables and their columns from the developer-defined ORM subclasses, make a request to the application-level schema/view management abstraction to update the views to the latest version of the "schema", along the lines of https://github.com/mwhite/JSONAlchemy.
With the foreign key table, performance would suffer, but probably not enough to matter for most use cases.
For non-trivial migrations where you have to actually move data around, I can't see why these should ever be done at deploy time. You should write your application to be able to work with the both the old and new version of the schema, and have the application do the migration on demand as each piece of data is accessed. If you need to run the migration sooner, then run it all at once using a management application that's not connected to deploy -- with the migration for each row in a single transaction, eliminating downtime for migrating large tables.
I don't have that much experience with serious production database usage, so tell me if this there's something I'm missing, but I honestly think this could be really useful.
comment 10y ago · link · parent
If your code is well organized into modules broken down by functional area, it should reduce the number of potential conflicts.
Also, fear of merge conflicts is somewhat unjustified; most conflicts can be resolved and rebased against using git rebase without that much work; the git rerere option [1] and git imerge [2] can also help with this.
If developers would actually learn how to resolve merge conflicts, and not be afraid of the occasional conflict resolution which requires understanding the other change and how to write new code that incorporates both changes, it's less overhead than communicating about pending changes.
[1] https://git-scm.com/docs/git-rerere [2] https://github.com/mhagger/git-imerge
comment 10y ago · link · parent
Specifically, a JSON column should be used to store everything other than primary keys and foreign keys, and views and indexes should be automatically created based on the schema defined in the application (i.e., get the schema from the ORM at deploy time and post the data to a schema/migration management system) using something like https://github.com/mwhite/JSONAlchemy
It is entirely possible to implement the CouchDB or MongoDB API on top of Postgres JSON, for instance.
comment 10y ago · link · parent
comment 10y ago · link · parent
As I'm sure you know, English spelling is also much less phonetically obvious than Italian (and I would not be surprised to learn that English is slightly grammatically more complicated than Italian, although frankly, as far as I'm concerned, any language with grammatical gender wins for difficulty), so emphasizing correct writing might be slightly harder.
comment 10y ago · link · parent
I use Backbone models in a React app because Backbone is still the best library for models. I haven't tried Redux because it doesn't solve any problem I know I have.
Plenty of people skipped Angular because they knew it wasn't going to be on top of the hill for very long in the evolution of the frontend ecosystem.
comment 10y ago · link · parent
comment 10y ago · link · parent
comment 10y ago · link · parent
comment 10y ago · link · parent
comment 10y ago · link · parent
SPAs are only really necessary for certain use-cases, and while having a strict client-server separation does have benefits, it also incurs upfront costs.
You can still get by perfectly well generating HTML server-side with PHP or Perl and MySQL. You may want to check out MariaDB, a fork of MySQL by the original creator if you haven't heard of it. Postgres also finally just added upsert (INSERT ON DUPLICATE ...), which might be the last real barrier to migrating from MySQL, so if you don't have a ton of lingering MySQL-specific knowledge, you might want to start with Postgres, as it seems to be the default in a lot of FOSS situations these days.
There's certainly been lots of innovation in server-side web frameworks and ORMs in PHP and Perl since the 90s. I can't speak to Perl but Slim is a good PHP microframework and Propel is a nice ORM, though there are also more heavy-duty frameworks such as Laravel.
If you don't mind learning a new language, I would recommend Python for any backend web development that doesn't require squeezing out as low response times as possible, which gives you the excellent Flask + SQLAlchemy, or Django if you prefer a little more hand-holding.
You can still use JavaScript to add interactivity without making a SPA. jQuery, Backbone, and React would do that in increasing levels of abstraction.
In the grand scheme of things, the changes to HTML/CSS since the 90s have been relatively small. If you use Bootstrap you might not even have to worry about them too much.
In summary,
- MySQL or Postgres
- Generate HTML server-side starting with a PHP or Python microframework and ORM, upgrade to a batteries-included framework if you discover you need it
- Use Bootstrap
- add interactivity with jQuery or (if you want to learn it) React (React-Bootstrap is nice); switch to full SPA if you discover you need it (in that case you'll probably want react-router, SystemJS, and JSPM)
- use Heroku or equivalent to avoid system administration
- with the combination of cross-browser libraries (jQuery, React) and the latest versions of all the popular browsers having fewer and fewer inconsistencies, you actually don't need to worry too much about how to support multiple browsers unless you want to support really old browsers that only make up a few percent usage share combined.
28.
React 0.14: Why Local Component State Is a Trap(safaribooksonline.com ↗)
1 points · by mwhite · 11y ago · discuss