Jump to content

The Little Guy

Members
  • Posts

    6,675
  • Joined

  • Last visited

Everything posted by The Little Guy

  1. Because I was told that I should, even after mentioning that.
  2. I mentioned that in an earlier post...
  3. I have been looking at these two different databases, and mostly was wondering about Full-Text Searches on both, which one has better performance? Any additional feedback on your thoughts about the two databases as a whole would be helpful. Thanks!
  4. I am fairly sure that regexp is much slower than "where col not like 'a%'" or even "where 'a' != left('a', 1)"
  5. I got it! I used this library: http://code.google.com/p/rangy/ and this code: function format_type(){ // Save the selection var savedSel = rangy.saveSelection(); // Do your formatting here format(); // Restore the original selection rangy.restoreSelection(savedSel); } function format(){ var el = document.getElementById('q'); var text = el.innerHTML.replace(/<b>|<\/b>/gm, ""); text = text.replace(/^(.+)( in.+)$/igm, "<b>$1</b>$2"); if(!text.match(/ in /i)){ text = text.replace(/(.+)/, "<b>$1</b>"); } el.innerHTML = text; } $(document).ready(function(){ format(); $("#q").keypress(function(e){ if(e.keyCode == 13){ return false; } }).keyup(function(e){ if(e.keyCode == 13){ window.location = "/search.php?q="+escape($(this).text())+"&ac=search"; } format_type(); }); });
  6. because you can do "in moves", "in games", "in videos" etc
  7. <style> #q{ font-size: 17px; color: #555555; border: 0; border-radius: 5px; box-shadow: inset 1px 1px 5px rgba(0,0,0,.7); padding: 8px; padding-right: 20px; width: 400px; height: 40px; background-color: #ffffff; overflow: hidden; white-space: nowrap; } </style> <div name="q" id="q" contenteditable="true"></div> if you remove: var el = document.getElementById("q"); var range = document.createRange(); var sel = window.getSelection(); range.setStart(el, caretPos); range.collapse(true); sel.removeAllRanges(); sel.addRange(range); el.focus(); you can see how it is supposed to work, only the cursor stays at the beginning of the line
  8. good point, I think I have that covered now. But how do I fix the error? var caretPos = 0; $(document).ready(function(){ $("#q").keypress(function(e){ var txt = $(this).text(); var key = String.fromCharCode(e.keyCode); txt = (txt + key).toString(); var last = txt.lastIndexOf(" in "); if(last == -1){ last = txt.length + 1; } var str = txt.substr(0, last); $(this).html("<b>"+str+"</b>"+txt.substr(last)); console.log(caretPos) var el = document.getElementById("q"); var range = document.createRange(); var sel = window.getSelection(); range.setStart(el, caretPos); range.collapse(true); sel.removeAllRanges(); sel.addRange(range); el.focus(); return false; }).keyup(function(){ var sel = window.getSelection(); range = sel.getRangeAt(0); caretPos = range.endOffset; }); });
  9. because I build the string as the user types, and every time a key is pressed I re-write what is in the editable div which then places the cursor at the beginning of the line. I need to move the cursor to some point in the text
  10. What I am trying to do, is format text in a div while a user types. Anything before the word "in" will be bold; "in" and anything after will be a normal font. Example: Hunger Games in books
  11. So, I am using this on a keypress event, the problem I am having is with range.setStart What I am trying to do is place the cursor at the end of the line when the user presses a key. $(document).ready(function(){ $("#q").keypress(function(e){ var txt = $(this).text(); var key = String.fromCharCode(e.keyCode); txt = txt + key; var last = txt.lastIndexOf("in "); if(last == -1){ last = txt.length + 1; } var str = txt.substr(0, last); $(this).html("<b>"+str+"</b>"+txt.substr(last)); var el = document.getElementById("q"); var range = document.createRange(); var sel = window.getSelection(); var length = $(this).text().length; range.setStart(el, length); range.collapse(true); sel.removeAllRanges(); sel.addRange(range); el.focus(); return false; }); }); In chrome I am getting this error Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1 The code works on the very first key press, so if i type "h" the cursor gets placed after the "h" but on the second key press I get the above error in chrome. Any suggestions?
  12. Are singleton design patterns a good or bad idea? Can I get some extra input on why you guys think about singletons? I just read this, on how to make a singleton: http://www.talkphp.com/advanced-php-programming/1304-how-use-singleton-design-pattern.html So any additional feedback would be great!
  13. I am a creator of the web. Users come to MY sites to view MY product how I designed it. Use a fucking browser that works. And this right here demonstrates your failure to understand business 101. If 50% of your customers don't like mustard as the default ingredient on your burger, you don't tell them to suck it up, you take the fucking mustard off as the default condiment. Or you watch your customers and your paycheck walk out the door as they go to other places who cater to them. You serve the customer, not the other way around. Um... wouldn't this hold true to web browsers too, and not just web developers?
  14. I applied too, but still nothing for me. If you apply more than once think you will get a better chance, or flagged for spam?
  15. I disagree, I played with it some yesterday and it had some really nice features! The removed the start menu and replaced it with the fancy start screen, that basically does the same thing just looks different. Other than that I saw all the features of Windows 7 with some cool add-ons. Like I read yesterday: It is going to take time to get used to it, just like we had to get used to windows adding the start menu in windows 95.
  16. Not sure if you read my last post but IE is built into the os, so you would need to restart the computer to see the updates take affect.
  17. I agree, but at what point do you stop supporting an IE version? IE could push out more updates if they removed it from the core of the OS and made it an install like Chrome/Firefox that would allow it to keep it up with other browsers better. Just my opinion.
  18. Yea, gotta love those squares that it displays. I don't know what your talking about... I see rounded corners... anyway... I decided to load my site in IE, and the main content doesn't show up, viewed the source to see if it was in there, and nope it is gone from there too! Viewed it in chrome / FF and its fine... oh IE... My new Poll doesn't show too... Maybe one reason no one voted for IE... because they can't see it... haha
  19. +1 The only thing I like about IE, is that it displays cleaner css3 stuff (rounded corners, gradients, etc.)
  20. http://www.computerworld.com/s/article/9231407/Google_s_dump_IE8_move_backs_Windows_XP_users_into_corner It looks like anyone who uses a browser <= IE8 will no longer be able to use Google's products... At least not to their full potential.
  21. I don't know what #11 is, the questions are displayed in a random order
  22. I have testing up for the "Beginner" test, so if you wanna give it a try, here is the link: http://phpsnips.com/test.php Eventually it will require a login, so scores can be saved to a profile, but none of that is in place atm, just the test and the percent correct at the end. @Mahngiel, Thanks for the questions, I will probably use those in the "Advanced" Test.
×
×
  • 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.