Jump to content

Anti-Moronic

Members
  • Posts

    571
  • Joined

  • Last visited

About Anti-Moronic

  • Birthday 07/16/1987

Profile Information

  • Gender
    Male
  • Location
    Sheffield!

Anti-Moronic's Achievements

Regular Member

Regular Member (3/5)

0

Reputation

  1. DOH. Thanks. Really should learn my array functions!
  2. I have this array: Array ( [jan] => 2 [feb] => 1 [mar] => 2 [apr] => 1 ) ..and I want to return: Array ('jan', 'mar') As in, find the 2 elements with the highest count and put them in an array. What is the simplest way to achieve this?
  3. My friend, use jQuery instead. You will have an easier time. Even if you know little about javascript - start with jQuery. learn selectors or something. We'll need to some example html for the generated rows. Are you wanting to hide this info via AJAX or just using js like a 'quick hide' feature?
  4. Good example, but the trouble with that is if the draw() number exists it will generate another draw() number without verifying if that also exists. Would be better to define the numbers and have them removed from a number map so they cannot possibly re-occur. Of course, there may also be a better way..
  5. Say I have this array: array( 0 => time 1 => time 2 => to 3 => to 4 => to 5 => fly ); and 2 variables - $occMin and $occMax as number of occurrences. If: $occMin = 2; $occMax = 3; I want to produce sorted list with most occurrences at the top: array( 0 => array('to', 3), 1 => array('time', 2) ); My face just melted at the thought of even beginning to tackle this. Is this somewhat possible? would it require a monster function or am I missing some native php functions which could lend a hand?
  6. Thanks for the response. Strip tags only removes the tags and so would leave the link text still there. I need to remove all links or tags of a certain type and their content. That is why I would remove the links and text but not remove the content within the div. Thanks.
  7. Here is the text: <div class="left">Lorem Ipsum is simply dummy text of the printing and</div> typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scramble'd it to make-shift type <a href="google.com">specimen book</a> and something [tag]else[/tag]. Essentially what I'm trying to do is extract all of the words above while abiding by these rules: 1. word can contain dash and apostrophe (scramble'd and make-shift above) 2. word cannot be within a link tag 3. word cannot be within a block tag - [tag] 4. word cannot be part of a tag name or html (class in class=", div, a, tag etc) That's about it. Any advice on where I might start with that? I'm currently experimenting with it but all I have is this: (\s?)[a-zA-Z0-9\'\-]+(\s?|\,|\.) Shameful, I know.
  8. From my perspective, if it has code that I don't use then it is bloated. Yes, but bloated has a definition. It isn't opinion. Simple fact is: if you don't use a framework you're wasting time and losing money. If you build your own framework, unless it is for commercial reasons, you're learning, bu wasting time, and losing money. ON top of that, don't just walk into projects thinking you can use your own framework. Big clients understand the value in using a well known framework: pool of developers who are instantly qualified to make amendments. If you want less bloat, use a loosely coupled framework. Most modern frameworks are like this now - Zend Framework, Symfony2 as examples. Whatever you do, at least learn a framework I can have a blog built with admin capabilities, user registration, everything within 30 minutes by using a framework because I already have the module to plugin to that framework.
  9. There are pros and cons of using either. PHP will work regardless of the browser, PHP will likely be faster (but that doesn't mean it will *seem* faster to the client). This is important, although PHP will be parsed faster, it will not seem that way to the client if you, for example, use AJAX. If you use PHP to change some text on a page based on a value in a cookie, you really think that will be faster than using javascript to do the same thing? Not at all. JS will win in speed just because it is directly parsed by the browser in real time, even if the actual parsing takes longer. So, if you don't mind sacrificing some independence, use Javascript. Then if need be, use PHP as well. Don't forget, using PHP will also put stress on the server. Won't matter to most but when you're dealing with enterprise applications it is extremely important you don't waste resources processing something the browser can process.
  10. This is terrible. If you are developing a complex application/website, do yourself a favor and use a framework from the beginning. That will teach, almost enforce, best practice application design and coding standards. My advice: start again with a framework. Good frameworks: Zend Framework, and Symfony2 is a breeze to work with.
  11. Of course. There is no doubt about that. However, I'm looking at what is well designed in terms of plugins, regardless of the framework they are extending.
  12. I'm going to be tackling my first plugin soon and I'm looking for plugins which you feel are of very high quality, under the hood. Stuff I can use as an example while I design the framework for my plugin. Any ideas?
  13. Thanks Jay, I really appreciate your input but those are just examples. I could send over a 100 examples - the main thing I am trying to validate is point 2) above. For example, this should also match: 012-345-69 even: 0-1-2-3-4-5-6-9 or 0 1 2 3-4-5-6-9 String cannot begin or start with dash. after each number there can only be a dash, space or another number, and after each dash or space there cannot be another dash or space. Thanks again. I've validated based on specific examples, but as soon as I try to write one which matches all I get stuck.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.