-
Posts
4,704 -
Joined
-
Last visited
-
Days Won
179
Everything posted by kicken
-
You're approaching the problem the wrong way. There is not any way (yet) in css to just disable another previously applied rule. Sometimes you can undo it by replacing it with a new rule, but not always. What you should be doing is having completely separate @media rules for your desktop styles and mobile styles. That way your desktop shadow styles are never applied in the first place when using the mobile view. The only styles that you'll want to have outside of one of the @media rules are styles that you truly want to be applied in all situations. Any styles you applied "only on desktops" or "only on mobile" belong inside a corresponding @media rule.
-
Pretty sure apache initially opens the it's log files as root, then the child processes handling requests inherit the open file handles. PHP on the other hand would be running as whatever user/group the child processes run as which would result in permission errors. If you pre-create your validation.log file, then you should just need write permission on it, and at least execute permission on directories leading up to it. If you expect PHP to create it if it does not exist, then you'd need write permission on the files directory as well.
-
Sounds like you have a bug in your wsBuildClientFrame function which is causing it to go into a recursion loop. You should address that issue before adding rate limiting. To add rate limiting, you count the # of requests along with keeping track of a timestamp. On each request compare the current # of requests to the # at the last timestamp and see if it's above your limit. If so, deny the request. Something like this //$lastTimestamp = timestamp of last check //$lastCount = whatever $count was at last check $now = time(); $count++; $timeDiff = $now - $lastTimestamp; if ($timeDiff > 1){ //Ensure timestamps have changed $countDiff = $count - $lastCount; $lastTimestamp = $now; $lastCount = $count; if ($countDiff/$timeDiff > 5){ //if more than 5 requests per second denyRequest(); } }
-
Using something like Gearman to launch the process from a separate worker thread would be the most ideal solution. Other than that launching the process in the background while redirecting both stdout and stderr should work ok. Your command line format for linux is not correct. The proper format would be: command >/dev/null 2>&1 & Make sure what you execute matches that format.
-
It would affect any element that has javascript events attached to it. The reason why is because when you set innerHTML you are destroying the original elements and creating new fresh elements. This means they will no longer have any of their event handling because the new elements never had any event handling attached to them. What you need to do is accomplish what you want without destroying the elements. Either that or re-attach the event handling after you've re-generated the document. The first thing I would suggest looking into is a print stylesheet. This will let you modify how the document looks when someone prints it automatically without any need for javascript manipulation. The second option would be a better print function that doesn't use innerHTML to re-create the document but rather just moves the existing nodes around. function printContent(el){ var printElement = document.getElementById(el); var newBody = document.createElement('body'); var oldBody = document.body; var marker = document.createElement('span'); printElement.parentNode.replaceChild(marker, printElement); newBody.appendChild(printElement); oldBody.parentNode.replaceChild(newBody, oldBody); window.print(); newBody.parentNode.replaceChild(oldBody, newBody); marker.parentNode.replaceChild(printElement, marker); } JSFiddle Demo What that does is move the target div into a new body element, then replace the existing body element with the new one. After printing, it then move the element back to where it was in the original body and puts the original body element back in place. This means the original elements never get destroyed so they never lose there event handling.
-
How are you adjusting the order? If your using some kind of Javascript to re-order things on the website, then just have that code re-number everything when the order changes and on submit update each item in the database with the new order.
-
tr.find('td').first().data('agencies') will get your json encoded array out of the data attribute on the first TD element. So long as it's valid JSON jQuery will automatically decode it into an array so you can pass it to your format function. // Open this row var agencies = tr.find('td').first().data('agencies'); var html = format(agencies); row.child(html).show(); tr.addClass('shown');
-
Whats the best way of managing website contact information
kicken replied to watson1001's topic in Application Design
Unless you need a web-based front end for managing replies and reviewing contact history (such as for your customers to use) then I'd probably just stick with email. Use a decent email client that supports a threaded view of messages and filtering, such as Thunderbird. If you do what to store things in a database and make a front end though, then you only need one table to store the messages. For reply messages you would just store the parent message's ID in another column. For original messages that column would be NULL. -
You use .message in your jQuery code which is going to look for elements with class="message". Your element however is id="message which means you need to be using #message to reference it. You're also generating invalid HTML since your adding <li> tags inside a <div> tag which is not allowed. Either make your div a list (ul or ol) or use something other than li tags.
-
Switching your database to a nested set model may be beneficial. It makes it easier to query for things like the path to the root (ie, referral path) or tree depth (how many levels of referrals a person has). It's a little more complex to manage and maintain, but tends to make working with the data more efficient and sometimes easier. It may help to explain more specifically what kind of things you'd like to do. Like for example you say you want to award points. How exactly do you want to award points?
-
Run it through some kind of javascript engine that emulates a browser.
-
Duplicate every row of table AND also change one field?
kicken replied to galvin's topic in MySQL Help
INSERT INTO table (userid, comment, weeknumber) SELECT userid, comment, 4 FROM table That should do it. -
You might have some kind of opcode cache running that is stripping comments. Not sure if that would affect the line numbers in the errors or not.
-
As show previously, the correct way to handle this is to use delegation as provided by .on(). Basically you attach the click event to some parent element which will never be removed and then have it filter events based on a selector. So given this code: $('body').on('click', '.likestatusclass', function(e){ ... }); Every time some clicks on an element which is or is a child of the body element (which is everything basically) jQuery will catch that event. It then will check if the actual element clicked matches the .likestatusclass selector. If it does, it will execute your callback function. If it does not, the event is ignored. So what this means is you can add/remove as many elements as you want with the .likestatusclass and clicking them will still work because the click event handler is actually bound to the body element, not each individual element. Doing this has other benefits as well such as using less memory as you only have one click handler rather than one for each separate .likestatusclass element. In order to avoid catching unnecessary events, you should bind the handler to the closest parent that does not change, rather than just using the body or document elements all the time. So: $('#statusContainer').on('click', '.likestatusclass', function(e){ alert('You clicked like!'); });
-
Probably the easiest thing to do would be to use something like LibreOffice to convert the document to HTML, load it in a TinyMCE instance, then on save convert it back to a word document (assuming that is possible using LibreOffice). That would provide basic editing capabilities, but nothing fancy and may not work with every document. Word allows you to do quite a bit of stuff that doesn't easily translate to a web interface.
-
SSL Certificate, Addon Domains, and ModRewrite
kicken replied to NeoVidaMedia's topic in Apache HTTP Server
RewriteCond %{HTTP_HOST} ^realbanknotes\.com$ [NC] RewriteRule ^(.*)$ https://www.realbanknotes.com/%{REQUEST_URI} [L,R=301] RewriteCond %{HTTP_HOST} ^(www\.)?realbanknotes\.com$ [NC] RewriteCond %{HTTPS} =off RewriteRule ^(.*)$ https://www.realbanknotes.com/%{REQUEST_URI} [L,R=301] Untested, but I think something like that should work to redirect only the one domain but not it's blog subdomain. If you want to try and exclude the /forums folder, you'd have to add another condition matching the request URI, however there's not really much reason to exclude specific folders from these conditions. -
You'd have a shoe_types table just like you have a shoe_colors table. If not every color is available in every type, then you'd want to combine the shoe_colors table and shoe_types table into something like a shoe_style table which would look like: - ShoeID - ColorID - TypeID If you come up with any other options you'd add them to that table as well.
-
That is exactly what a LEFT JOIN does. It returns all rows from the source (left) table, and either the matching rows or NULL for the join (right) table. To limit the join to just Period 3, you'd add that to the join condition. You'll need to use an ON clause rather than USING. SELECT s.studentid , s.lastname , c.classname , g.grade FROM students s INNER JOIN classes c USING (studentid) LEFT JOIN grades g ON g.studentid=s.studentid AND g.period=3 GROUP BY s.lastname If a row exists, it will return that row's grade column. If no rows exist, it will return NULL. Notice that the period=3 condition is part of the join condition, not in the WHERE clause.
-
You shouldn't really focus too much on making sure nobody can find it. Just make sure that nobody can use it if they do without proper authorization. So long as you don't publicly publish any links to the page it will generally not get found/accessed. You can of course add the noindex directive to request search engines do not index it as well, just incase they happen to find it somehow. The important thing is that it does nothing unless the person has the proper authorization. You should be able to publish it as a giant CLICK HERE link on your home page without risk. All that said, what exactly does this script do? Can you move it out of the web root and make it completely inaccessible and still function? If it's for a cron job for example, it should be inaccessible from the web and run via php's CLI executable.
-
[C++] Trying to zoom and pan an object
kicken replied to Noskiw's topic in Other Programming Languages
For panning, just alter the center point so that rather than start each section at 0,0 you start them at centerX,centerY. Add some code to change what centerX and centerY are if they click and drag the mouse. For zoom you could probably just increase/decrease the radius value. -
Presumably you'd want to find a lawyer that specializes in Copyright / Intellectual Property law. From what I understand just having a terms of service users agree too does not automatically make you immune from any lawsuit, but it's a major step in the right direction at least.
-
How to Set form fields into an array using javascript
kicken replied to IlaminiAyebatonyeDagogo's topic in Javascript Help
Note that simply iterating over the elements array and grabbing each name/value pair is only going to work for simple forms with text boxes. If you have things like radio buttons/checkboxes/buttons then you need to do additional checking to determine if that item is valid or not. Unless you have some good reason for not wanting to use jQuery, I would suggest you just stick with it so it will handle all these conditions for you. Even if you do stick with jQuery though your above code is not correct and suffers the same problem of not properly handling radio's and checkboxes. The proper way to do this is to use the jQuery.serializeArray function. var formFields = $('form').serializeArray(); //This returns them in the form of //formFields[0]['name'] = blah; formFields[0]['value'] = blah //formFields[1]['name'] = blah; formFields[1]['value'] = blah //If you want formFields[name] = value instead, you'll have to convert it var converted = {}; $.each(formFields, function(idx,obj){ converted[obj.name] = obj.value; }); -
Then you should ask a lawyer, not the internet. That said, it probably comes down mostly to having the end users agree to not upload anything they do not have rights to in your terms of service. That shifts the responsibility from you to them. You'd probably also need some kind of policy for allowing copyright owners to request removal of content.
-
Object of class mysqli_result could not be converted to int
kicken replied to bravo14's topic in PHP Coding Help
Your closing parenthesis for the function call is in the wrong spot. You're trying to call mysqli_num_rows on the result of the $result==1 comparison.