Welcome to Software Development on Codidact!
Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.
Activity for Charlie Brumbaughâ€
Type | On... | Excerpt | Status | Date |
---|---|---|---|---|
Question | — |
How to create a MySQL generated column that uses a join in a concat? I have a column that is a concatenation of 5 other columns plus a join to a different table. UPDATE db.a JOIN db.b ON fkb = b.pk SET concatfield = CONCAT(field1,field2,field3,b.field,field4,field5) What I would like to do is set the ``concatfield`` to a generated column, co... (more) |
— | almost 3 years ago |
Question | — |
Is it possible to disable the "mysql: [Warning] Using a password on the command line interface can be insecure" warning? For my purposes, it is secure enough to use passwords to execute MySQL commands on the command line, what I would like to do is disable the warning that says, `mysql: [Warning] Using a password on the command line interface can be insecure` because that warning distracts from more pertinent err... (more) |
— | about 3 years ago |
Answer | — |
A: Is it wrong to demand features in open-source projects? It is not wrong to ask for changes or features or report problems, so long as you realize that the maintainer of the project is under no obligation to make those changes. You aren't paying them, so you can't tell them what to do. Asking you to make those changes instead of them, plays by the same rul... (more) |
— | about 3 years ago |
Question | — |
What are the pros and cons of using objects vs associative arrays for JSON results of a CURL request in PHP? I have a PHP script that uses CURL to return a JSON result that looks ``` //Curl set up code $result = curlexec($ch); //Error checking code $json = jsondecode($result, true); //Code to process result. ``` Now with the `jsondecode` function, I could set it to return process the JSON into a ... (more) |
— | over 3 years ago |
Answer | — |
A: How can I make --reset-author the default? You should be able to alias the string to something short. For example, I have ``` git config --global alias.a 'add .' git config --global alias.ci commit ``` and so instead of ``` git add . git commit -m'Message' ``` I can do ``` git a git ci -m'Message' ``` In your case, ... (more) |
— | over 3 years ago |
Question | — |
Multiple code blocks have the code in different colors On this question https://software.codidact.com/questions/279097 there are two code blocks, but the color of the text is different. Image alt text I directly copied and pasted the code so I don't see why some of the code would be red in the second block and not the first. Is this a bug in how... (more) |
— | over 3 years ago |
Question | — |
In PHP what is the use case for include instead of require when including PHP scripts? In PHP one can either use `include` or `require` to include files, the difference is that if the file doesn't exist it will emit a fatal error and halt with a `require` and only emit a warning with `include`. Normally would rather my code fail if code is missing and require that it be fixed rather... (more) |
— | over 3 years ago |
Question | — |
Is there a way to automatically fix MySQL tables where the auto_increment has fallen behind the correct value? Due to a series of unfortunate events I have some tables where the autoincrement value got behind what it should be. If the autoincrement value is 9 and there are 20 rows in the table the next 11 INSERTs will fail because the primary key value already exists. It's possible to fix this manually... (more) |
— | over 3 years ago |
Question | — |
In MySQL is there a limit to the number of keys in a IN() clause? I have a PHP program that does a SELECT and then updates some of the values based on an algorithm. Rather than updating one row at a time ``` UPDATE exampletable SET COLUMNA = 1 WHERE primarykeycolumn = 10; ``` I was thinking of doing many updates at once like ``` UPDATE exampletable S... (more) |
— | over 3 years ago |
Question | — |
Are there best practices for sticking conditions in WHERE clauses vs the JOIN statement? Lets say I have two tables, A and B and I need to join a subset of them. Is there best practices of sticking the conditions in the WHERE clause like this, ```sql SELECT FROM A JOIN B on a.fkb = b.pk WHERE a.pk <10000 ``` versus sticking the condition in the JOIN like this, ```sql S... (more) |
— | over 3 years ago |
Question | — |
Iterating through a MySQL table with a LIMIT clause and PHP gets progressively slower I have a very large table that I need to iterate through with a PHP script and I can't do all of the results at once so I do it in sections with a LIMIT like ``` for ($x = 0; $x results($sql); //Do stuff with results } ``` At first the select returns the data very quickly but as time goes... (more) |
— | over 3 years ago |
Question | — |
Why would an unique index get moved to the primary key after the underlying column is dropped? So I had a table with a primary key and a bunch of different columns. Columns A, B, and C were all unsigned ints (like the primary key column) and each column had a unique constraint I dropped the A, B, and C columns, and then I got a warning that there were now duplicate unique constraints. When ... (more) |
— | over 3 years ago |
Answer | — |
A: How to drop all stored procedures from a MySQL database The easy way is to run this query. ``` SELECT concat('DROP PROCEDURE IF EXISTS exampledatabase.',routinename ,';') FROM INFORMATIONSCHEMA.Routines WHERE ROUTINESCHEMA = 'exampledatabase'; ``` For each stored procedure the above select will return a line like, ``` DROP PROCEDURE IF EXIS... (more) |
— | over 3 years ago |
Question | — |
How to drop all stored procedures from a MySQL database I need to drop all of the stored procedures from my MySQL database before I recreate them. How can I do so? (more) |
— | over 3 years ago |
Question | — |
Is it possible in MySQL to require each row in a table have at least one foreign key record in a join table? I have tables A and B and then I have a many to many join table with foreign keys to both called ab. Neither foreign key can be null and the combinations for the foreign keys to A and B are unique. In the business logic for the program, every record in the A table must have a relationship to at le... (more) |
— | over 3 years ago |
Question | — |
What is the point of tagging a question with both a parent and a child tag? On the old sites, if you wanted to tag something with [sql] and [mysql] that required two tags. However, because we have hierarchal tags where [mysql] is a child of [sql] you only need to tag it with [mysql] to have it come up in the search for the [sql] tag. I am wondering what the use case here ... (more) |
— | over 3 years ago |
Question | — |
How much memory is allocated for a MySQL VARCHAR variable in a stored procedure? In a stored procedure let's say I have a VARCHAR variable, ``` DECLARE examplevariable VARCHAR(100); ``` how much memory is allocated to it and is that independent of the length of the data in the variable? The reason I ask is that I had a stored procedure that would run out of memory until ... (more) |
— | over 3 years ago |
Question | — |
For scripting what are the pros and cons of command line arguments versus capturing input at the start? Let's say I have a script that needs the user to set X number of variables at the start. One can either - Pass the arguments in on the command line. - Start the program and then have the user input the variables with Python's ```input()``` function or PHP's ```fopen("php://stdin", "r")``` for e... (more) |
— | over 3 years ago |
Question | — |
PHP script to create a KML square centred on a point. The objective here is to create a set of square kml coordinates centered on a point. I use this to create a square map centered on a mountain peak and then turn that into a STL that I can 3D print. ``` "; $drad = $meter / 6378137; $i = 45; for ($loop = 0; $loop \n"; echo $kml; ``` (more) |
— | over 3 years ago |
Question | — |
Is an ORDER BY required when looping through MySQL records with LIMIT? Let's say I have a table with 10,000 rows and instead of selecting all of the rows at once I select 1,000 at a time like ``` LIMIT 0,1000 LIMIT 1000,1000 ``` etc. Without an ORDER BY statement the order of results in MySQL is not guaranteed, could I possibly miss records if I do not specify... (more) |
— | over 3 years ago |
Question | — |
What would the pros and cons of storing the compiled CSS output of SASS in version control? If one is using SASS to build a websites CSS and using version control one can either, - Keep both the SASS and the resulting CSS files in version control. - Only storing the SASS files in version control. What would the pros and cons of each method be? (more) |
— | over 3 years ago |
Question | — |
How do I track down intermittent locks in a MySQL database? Currently, we have a CRUD plus reporting application that talks to one MySQL database. Intermittently users will report locks when searching, currently, I can only get the approximate time of when that happens (accurate to the minute). The stored procedures on the other hand are logged to the millise... (more) |
— | over 3 years ago |
Question | — |
Is it possible to rebuild a STL file from gcode? I have a couple of 3d example projects in gcode for my printer but the printer bed has a couple of bumps in the center (where things are printed by default) and in order to print the objects I would need to move them off-center slightly. Would it be possible to turn the gcode back into a stl that ... (more) |
— | over 3 years ago |
Question | — |
Is there an equivalent way of returning early in a MySQL stored procedure? In programming instead of arrowcode where one has many layers of indented if statements, you can return a result as soon as possible. So instead of, ``` if if end if end if ``` It looks like ``` if return end if if return end if ``` A MySQL stored procedure does not retu... (more) |
— | over 3 years ago |
Question | — |
What is happening under the hood to the selected data in a MySQL cursor? I have a number of MySQL stored procedures that use a cursor to go through a select and then pass the results to other stored procedures one row at a time. This can take a while to run, what is happening under the hood while the cursor is looping through? Is the select discarded and the results ke... (more) |
— | over 3 years ago |
Question | — |
In MySQL, is it possible to disable triggers for only certain queries or users? Almost every table in my DB has triggers that fire on INSERT, UPDATE, DELETE and write the changes to a separate read only DB. This makes it possible to track changes and undo things well after the fact, but also makes operations slower. For changes that don't need an audit trail, would it be poss... (more) |
— | over 3 years ago |
Question | — |
Is there a way to estimate the execution time of a statement in MySQL? From time to time I will have large structural changes to make on my MySQL DB, things like adding columns, changing datatypes, adding indexes etc. These types of changes result in downtime and what I would like to be able to do is produce reasonable estimates of how long the changes will take before ... (more) |
— | over 3 years ago |
Question | — |
How long in days is a MONTH in MySQL? If one finds where the past number of months equals the past number of days like this, ``` select distinct DATESUB(now(), INTERVAL 92 DAY),DATESUB(now(), INTERVAL 3 MONTH) ``` The numbers that are currently returned are, - 1 month = 31 days - 2 month = 62 days - 3 month = 92 days - 4 mont... (more) |
— | over 3 years ago |
Answer | — |
A: How do I find all the tables in a database that don't have a specific column? The select for finding tables without a specific column name is, ``` SELECT DISTINCT tablename FROM informationschema.tables WHERE tableschema = 'DATABASENAME' AND tablename NOT IN( SELECT DISTINCT TABLENAME FROM INFORMATIONSCHEMA.COLUMNS WHERE COLUMNNAME ='COLUMNNAME' AN... (more) |
— | over 3 years ago |
Question | — |
How do I find all the tables in a database that don't have a specific column? I need to add one column with the same name to all of the tables in my database, how can I find which tables don't currently have a column with that name? (more) |
— | over 3 years ago |
Question | — |
In a stored procedure, is it possible to get the total number or rows updated by different statements? I have a bunch of stored procedures that look like something this ``` CREATE PROCEDURE example() BEGIN UPDATE STATEMENT A; UPDATE STATEMENT B; UPDATE STATEMENT C; END// ``` When I run them through MySQLWorkbench after it completes they will return a response of, ``` 5 row... (more) |
— | over 3 years ago |
Question | — |
How to protect the git respository for a public_html folder on a Linux server? On a Linux server, if you leave the .git folder unprotected in the publichtml folder, its possible that someone could download the folder and then gain access to your files. There are two ways I have seen of preventing this, - Move it up one level and then in the .gitignore ignore all folders ... (more) |
— | over 3 years ago |
Answer | — |
A: How to temporarily disable a MySQL user? The easiest way to temporarily disable a MySQL user is to the change the value of the Host column in the mysql.user table to an invalid host. ``` UPDATE mysql.user SET HOST = 'blocked' WHERE #your condition here ``` To do this through MySQLWorkbench, - go to Management - Users and Pri... (more) |
— | over 3 years ago |
Question | — |
How to temporarily disable a MySQL user? Sometimes I will need to temporarily lock out other MySQL users when I am making large structure changes and want to make sure that nobody else is inputting or changing the data. The other use case is temporarily locking out a single user if you are sure if that user is being used anymore. How can... (more) |
— | over 3 years ago |
Answer | — |
A: How does the community feel about resource requests? I would like to see questions asking for help finding resources be considered on topic, but I would suggest creating a seperate category for them, like how Photography and Outdoors have one for Gear Reccomendations. We should also think about some community wiki style posts with links to tutorial... (more) |
— | over 3 years ago |
Question | — |
Is it unsecure to use a password on the command line to run a MySQL script on Windows? Its possible to execute a MySQL file from the command line like so, ``` mysql -u USER -pPASSWORD < FILENAME ``` which triggers a warning, ``` mysql: [Warning] Using a password on the command line interface can be insecure. ``` Given that its possible to go back through command line hist... (more) |
— | over 3 years ago |
Question | — |
Can renaming a MySQL column be sped up by dropping indexes or foreign keys? I need to rename one column in 170 tables in a MySQL database and its going really slow. The columns all have an index plus a foreign key on them, would dropping the index/temporarily removing the foreign key speed up the process? (more) |
— | over 3 years ago |
Question | — |
What are the pros and cons of a composite primary key versus a unique constraint? Let's say we have two tables A and B and a join table C that has foreign keys to both A and B and the combination of those foreign keys is unique. One could either do a unique constraint or a composite primary key on those columns. What would the pros and cons of either solution to this be? (more) |
— | over 3 years ago |
Question | — |
Would a MySQL database run more efficiently with smaller varchar lengths? I have a database with quite a few VARCHAR fields. When the database was first built the lengths of the columns were set a bit larger than absolutely necessary. Now after, having used the DB for a while and run a lot of data through it, I have a better idea of how long the fields need to be and am... (more) |
— | over 3 years ago |
Question | — |
How to calculate how much data is stored in a MySQL column? I am considering either removing some columns or changing the datatypes if I could significantly reduce the amount of storage that is currently used by those columns. Some of the columns are ints and some are varchar. How do I calculate (preferably in megabytes) the amount of storage a column uses... (more) |
— | over 3 years ago |
Question | — |
How to store credentials for PHP scripts on a Windows machine? I have a number of command line PHP scripts that are either run by a user or by Windows Task Scheduler. These scripts use DB and API credentials and I am wondering if there is a better way of storing said credentials than configuration files outside of the Git repository? (more) |
— | over 3 years ago |
Question | — |
Is there a naming convention for table aliases? Sometimes, either to reduce the amount of typing big table names or when joining a table to itself one will need to alias a table. Personally I find SQL statements with aliases harder to read and avoid using them if possible. Is there a naming convention for choosing the alias names for ease of co... (more) |
— | over 3 years ago |
Question | — |
Why would excluding records by creating a temporary table of their primary keys be faster than simply excluding by value? I have two tables with millions of records. Every so often I need to join them and exclude just a handful of records where a bit(1) column is set to 1 instead of 0. I can do it with either, ```sql WHERE isexcluded !=1 ``` or ```sql WHERE exampletable.pk NOT IN ( SELECT pk FROM( ... (more) |
— | over 3 years ago |