-
Posts
15,266 -
Joined
-
Last visited
-
Days Won
431
Everything posted by requinix
-
Reconciling Data from two Imports without Unique Identifier
requinix replied to akphidelt2007's topic in MySQL Help
Do an outer JOIN on the matching fields, then restrict the results to WHERE some non-nullable field IS NULL - which would only happen if the join failed. LEFT JOIN existing_table t2 ON t2.a = t1.a AND t2.b = t1.b AND... WHERE t2.some_non_nullable_column IS NULLOr you could just put a UNIQUE key on those columns, do an INSERT IGNORE, and let MySQL skip the duplicates for you. Which would be easier. -
Reconciling Data from two Imports without Unique Identifier
requinix replied to akphidelt2007's topic in MySQL Help
You don't have to concatenate anything. Just search multiple columns. You can create an index on all the relevant columns to help with that... a rather large index, but would probably be worth it. -
Reconciling Data from two Imports without Unique Identifier
requinix replied to akphidelt2007's topic in MySQL Help
You have to make a decision about what constitutes a duplicate record. One that is "already in the database", as you say. I'm guessing project+employee+expenditure+date? Maybe +hours? That information combined creates uniqueness and that's what you search for. -
Probably the glaring syntax error. You're also missing a colon.
-
How do I turn off error reporting in the php.ini file
requinix replied to ronc0011's topic in PHP Coding Help
PHP's normal error output is very minimal. You have Xdebug installed - that's what's doing the orange and exclamation marks. Anyway, set display_errors=off and restart Apache. -
What does EXPLAIN SELECT ORD_Item, ...output?
-
Convert from Hard-coding to Algorithmic Coding
requinix replied to illdefinedartistry's topic in PHP Coding Help
That means the $page->post_title is an array (I think that's what's going on). So what's in the array? Use something like print_r() or var_dump() or even json_encode() to see, if you're not sure. -
... How about sorting by the zone?
-
MySQL: add row if it doesn't exist otherwise don't
requinix replied to Mahmood-Saleh's topic in PHP Coding Help
1. It looks like you're checking to see if the person exists, and if so, doing the insert. Got that backwards. 2. If this script executes twice at once, with the same person name, then one may both think the person doesn't exist and both try to insert the person. The name is the unique value, right? Make sure your table has a UNIQUE constraint on the name, then do an INSERT IGNORE without bothering to check if the person exists yet. If they do then the insert won't do anything, and if they don't then you've checked and inserted at the same time (which address problem #2). -
You'll have to figure out what is taking so long (infinite loop?) in PHP - what the browser says is irrelevant. Nothing in the code you've posted would be at fault so look elsewhere. Maybe AddToCart? The rest of the code you didn't post?
-
Assuming you don't have a problem getting to the "params" property, The RokCommon_Registry class controls access to its "data" property. An educated guess says that the class will have some method you can call to get the "joomla_articles" value. Get it, unset what you want to unset, then use a corresponding method to set the value back.
-
That's a bad thing to do. What is the problem you're trying to solve?
-
There is no "most efficient way". It's like asking what's the most efficient way of opening a door. Or the most efficient way of pushing a button. Your site needs to make sure that people can only do stuff with projects they're involved with, so... you make sure that people can only do stuff with projects they're involved with. Say you've got a page to edit a project. Probably got a project ID in the URL or something. Make sure that you only present the page if the user belongs to the project. As in you do a SQL query to see if there's a record in that third table for the logged-in user and the desired project.
-
I can't think of anything unique. Not without resorting to something like Java or Flash to get actual computer information. And no, you cannot get the MAC address with Javascript.
- 4 replies
-
- php
- javascript
-
(and 1 more)
Tagged with:
-
Replace Characters Algorithm with O(n) Time/Complexity Notation
requinix replied to rwhite35's topic in PHP Coding Help
I don't know where you are in the book, but the errata (3rd edition) mentions an instance of O(n) on page 26 that's supposed to be O(n^2). -
Replace Characters Algorithm with O(n) Time/Complexity Notation
requinix replied to rwhite35's topic in PHP Coding Help
I don't know of an O(n) solution. The "normal" solution would be O(n*m) and a slightly better one would be O(n*log m). $string = preg_filter($pattern, $replacement, $string); // O(1)It's not actually O(1) since you have to consider what that function is doing: loop through the inputs (n) and test the pattern, where the pattern is a set of alternations (m). Thus that's O(n*m), but will be faster than your PHP since it's compiled code. However efficiency isn't determined by runtime but by complexity. The normal solution is like output = "" for each character in input { // O(n) if character is not found in search string { // O(m) output += character } } // O(n*m)The faster solution is sort the search string // O(log m) output = "" for each character in input { // O(n) if character is not found in search string using a binary search { // O(log m) output += character } } // O(n*log m) -
How to catch all PHP errors in CodeIgniter Framework
requinix replied to lilmer's topic in Frameworks
ignore_repeated_errors can help with that. Another trick is to use Linux's logrotate: it can keep individual error files small by rotating them: error.log becomes error.log.1 becomes error.log.1.gz and so on. You can have it email you the error file at the same time. -
How to catch all PHP errors in CodeIgniter Framework
requinix replied to lilmer's topic in Frameworks
set_error_handler Not quite the same thing but it will let you catch most errors. Not the very fatal ones, though. -
Almost. There is a class somewhere named "Table" in the "Cake\ORM" namespace. Odds are it will be in a file Cake\ORM\Table.php (or .class.php or whatever) but that is not always true. Normally to refer to that class in code you would have to write the full path, like $table = new \Cake\ORM\Table();With a use you can tell PHP that any mention of "Table" actually refers to Cake\ORM\Table, so you can write the shorter $table = new Table();
-
http://www.xy vs. www.xy how to adjust the webmin-apache?
requinix replied to dil_bert's topic in Miscellaneous
Your browser goes not think that www.xy is a website. It doesn't know the .xy TLD. Use a different domain name, one with a known TLD, or you can probably get away with typing the shorter "www.xy/". -
emergency-safing: how to do a full copy of all data on board
requinix replied to dil_bert's topic in Miscellaneous
Simply dd-ing won't work if the disk is still in use. Get a boot disc to run a "live" whatever, then dd inside of that. rsync is also popular. Advice: times change. Copy the files you need personally, copy any particular settings you've made for the system and applications, then wait for it to die. Don't worry about making an image of everything. Reinstall stuff as you need it. It's spring cleaning for your computer. -
I don't know where valid or obj.office are coming from, but what I meant was a simple document.listingform.office.value == ""
-
"isset" isn't the thing you're looking for, then. Because the thing exists. Just check for an empty value.
-
So you're trying to add ? Copy the line for and change it to a capital D.