Jump to content

The Little Guy

Members
  • Posts

    6,675
  • Joined

  • Last visited

Posts posted by The Little Guy

  1. 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!

  2. 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();
       });
    });

  3. <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

  4. 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;
        });
    });

  5. 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?

  6. ...I mean seriously...who the fuck are you to decide what's best for someone else? 

    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?

  7. (I think Win8 is going to bomb spectacularly)

     

    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.

  8. My point is that it's simply not fair to keep blackballing IE, treating it like the redheaded stepchild nobody loves, because they have gotten their shit together and to a point where IE is currently on par with the other browsers.  But again, it's not going to be exactly the same, there will never be some single magic wand line of code or html or css rule etc.. that will work with all browsers, because they are different products made by different companies (even though these days, most of the time there actually is).  I have had PLENTY of "works in FF but not Chrome" issues, where I've had to tweak accordingly.  Each browser has its caveats, because they are different browsers

     

    And who gives a shit if Firefox or Chrome has been supporting feature xyz since version 1.0 alpha, and IE is "just now catching up...." you are missing the point that IE has caught up!  People keep complaining about how IE sucks and what they are really complaining about is having to support older versions of IE! 

     

    Please do not mistake me for an IE fanboy.  My personal go-to browser is FireFox, though Philip is slowly but surely seducing me to use Chrome full-time.  Once upon a time it was actually fair to say IE sucked.  Now it's not.  It's just that we, as developers, have to keep putting up with older versions of IE, because of users not upgrading.  People who complain about IE still sucking...I mean really, I have to question how much client-side dev work you really do...because I mean just getting rid of IE6 support (even still supporting 7+) is a HUGE step forward, to the point that most professional devs will be more than happy if they could at least ditch IE6 support. 

     

    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.

  9. The only thing I like about IE, is that it displays cleaner css3 stuff (rounded corners, gradients, etc.)

     

    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

  10. 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.