-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
All I see is someone mad because they got called out on their b.s. You gonna stomp your feet and hold your breath next? You're just another one of those people who think the best way to move up in life is to attack someone else and try to make out like they are failing at what they do. People like that have no real skill of their own, which is why after they've wrongfully shafted someone else, they don't stick around very long, because you can only go so far before people realize you can't actually do anything. The only thing you have is a silver-tongue. You rely on dazzling people with big words hoping they'll make the proverbial impulse buy, and scoot them out the door before they realize you suckered them. That may work for you in your home/kindergarten life, but not around here. Around here, people recognize that shit a mile away. So all you're doing is showing yourself to be the immature ass that you are by trying to pull it, and even more laughable, trying to continue it. Seriously, the only person you're fooling is yourself. You are a social parasite, a virus, feeding off other people's work and talents because you don't really have any of your own. Seriously, you should take yourself to a place that focuses on monetary gain. They'd appreciate you more. We don't make crap around here and the only people who stand to benefit from anything are the people coming for help. So this "you guys are abusing your power, evil people blahblahblah" crap really doesn't work around here. Go be a used car salesman. They love people like you.
-
[SOLVED] Why do I have to enter captcha every time I post?
.josh replied to mandred's topic in PHPFreaks.com Website Feedback
yes. And C named ones too. But since my username starts with c, I said there's no way in hell I was down for putting the same restriction. So you can thank me that you don't get the short straw either. -
that's not possible. php cannot parse itself. you have to install the parser and have it running under something like apache or IIS in order for the script to execute.
-
okay well path of least resistance would be for you to go and hardcode anchor tags around all of your terms, including an id, and when user enters in a word, use some js regex to find the closest matching id and jump to that anchor tag. that is, get the innerHTML of the anchor (using the id), and regexing for a closest match. Or I guess you could just have your id be the same as the term.
-
[SOLVED] splitting 6 digit number into 3 groups of two.
.josh replied to Yammyguy's topic in PHP Coding Help
if you're using php5 you can use str_split -
If you're wanting to mimic the ctrl+f, don't reinvent the wheel. Simply write a message on the screen instructing users to press ctrl+f and how to use it.
-
If you run the script ON your laptop (like with wamp or something), then your laptop IS the server, so it's using your laptop's clock. php is a server-side language. It parses the script and sends the results to the client. To see what I mean, load the page up in your browser, rightclick and view source. You will not see the php script as you would with javascript.
-
so basically he's saying that all the terms and definitions are in the database, but as a single cell that stores the page as a whole. well if that's the case, there won't really be any benefit to searching with a query or with php. Unless the page is totally crap marked up. Then I'd suggest using php just because it has more powerful regex capabilities. But javascript probably would be the best bet, again, depending on how it's marked up, since it can target elements. Also to make the search more "flashy" if that gets you off.
-
what do you mean by "make the time only server side"? date draws from the server's clock.
-
so...you don't actually have any terms or definitions stored in a database anywhere...it's just hardcoded on a page? If that is the case, then yes, you can conceivably use just javascript to search the page. It really depends on how your page is marked up, as to how easy it would be to search the page, though.
-
just check if it's there: if (preg_match('~/var/iso/.*?\.pdf~',$string)) { // it's there, do something } match and capture: preg_match('~(/var/iso/.*?\.pdf)~',$string,$match); echo $match[1]; match more than once and capture: preg_match_all('~(/var/iso/.*?\.pdf)~',$string,$matches); print_r($matches);
-
the only thing javascript/ajax would be useful for is doing some kind of live/realtime interactive search. Like, dynamically showing narrowed down results as you type in a word sort of thing. It sounds to me like your web developer is trying to blow smoke up your ass because he has no clue how to do even basic server-side scripting. I suggest you find another web developer.
-
you can do a nested for loop to go pixel by pixel and populate an color=>count of all the different colors and then divide each count by total pixels * 100 to get the percentage of each color in the image. I'm quite sure I've seen plenty of scripts that already do this, if you don't wanna write that yourself. Not that this step is any kind of difficult...5-10 lines tops. create image source for loop for loop get pixel info $color[rgb]++; } } $totalpixels = array_sum($color); foreach ($color as $k => $v) { $color[$k] = $v / $totalpixels * 100; } As far as the whole scanning thing, there would be a big margin of error and unreliability, regardless of what you try to do. I personally would initially approach it by filtering the image down to only a couple of colors (think along the same lines of in paint/image editing programs, the "outline horizontile/vertical" feature, or the "emboss" feature) first. Ideally straight black and white. From there I would...try to come up with a way to find the boundaries of the shape. Maybe something involving overlaying the image with a grid and looping through x1,y1,x2,y2 cell coord for presence of pixels. As a first version, I would just compare it as if it were a solid shape. a "swiss cheese" 3 would ideally match less than a solid 3 for example, but figuring it out at that level of granularity would pretty much involve recursively repleating some of these steps.
-
You wrote it backwards. ^ inside the character class negates them. So if it matches something other than what's in your character class, it will return true, and your function will return true. If you are wanting to include a hyphen in a character class, you need to have it as the first character listed. Otherwise you can get unexpected results, because it is a special character within a character class (used to create ranges). You did escape it first, but that's not a guarantee. Depending on whether it's php's time of the month or not, it could instead interpret that as a range of backslash to unspecified and either break or count everything from that character on, who knows? It's unpredictable. Also, since you are just checking for existence and not wanting to capture anything (no 3rd param), you can put the preg_match directly into your condition. Also note that while this pattern will only allow a-z, A-Z, 0-9, - _ and @, first off, it will match true on 1 character or longer string. If that's what you want, then that's okay, but it is common to enforce a minimum character length for things...(and a maximum) Also note that while this will only allow those things, it does not restrict number of occurrences of anything. So for example, any of the following will return true: ---------------- -- --------------------------------- @@@@@@@ ab-------------cd---------xyz _______blah@@@----____blah____________________________---------123 ...and so on and so forth. function FILTER_VALIDATE_UNAME($string) { if(preg_match('/^[-\w@]+$/',$string)) { return true; } else { return false; } }
-
It happened. I'm here. Things just got violent. Crayon Violent. Here's the bottom line: The misc board is technically for asking any question under the sun if you really want to. But that doesn't mean you should. If you're going to exhibit lack of common sense and post on a coding forum about something unrelated to coding, then you can expect a negative reaction. Again, just because you can, doesn't mean you should. Ober did nothing wrong by pointing that out in his own way. Whether his way was acceptable or not is a matter of opinion. Everybody has different opinions on what constitutes an acceptable level of tactfulness. It's awfully presumptuous of you to think that your way is the only or right way. If anybody's way is the "right" way, it would be the person to whom the buck stops at. And that person is, can you take a guess? The admin. You probably think of yourself as "the little guy" (no offense The Little Guy) standing up to "the man," but all you're really doing here is making yourself look like an ass.
-
okay well basically you would have a column in your table that flags what things you want to be listed in the search and then add that filter to the query jack suggested.
-
You said you have a page of terminologies -> definitions. Like a dictionary, right? And you want to be able to type in "bat" and it returns all the entries that have "bat" somewhere in the term and/or definition, right? So you are wanting something like www.dictionary.com, except with your own words/definitions, right?
-
groovy
-
okay I think maybe you're misunderstanding or making this more complicated than it really is or something. Or else I'm just not understanding your goal here... You need a column to hold a number for each row. The script is written to where the numbers have to be 1-n, incremented by 1. So for instance, if you have 5 rows, the column you are using to keep track of the custom sort order has to be like this: position 1 2 3 4 5 That's what your position column is. But what you have done is something like this: proj_id position 1 1 1 2 1 3 1 4 1 5 2 1 2 2 3 1 3 2 3 3 And that is fine, because in your queries you are filtering position by proj_id, so when you are actually performing the swap, you are only looking at for instance (with proj_id 1): proj_id position 1 1 1 2 1 3 1 4 1 5 So overall, the swap is being based off both proj_id and position. So in the code that increments/decrements the swap and performs the queries. The $id being passed to your function needs to be what is in the position column for that row.
-
$string = preg_replace('~[\'"]~,"",$string); I promise, SQL will no longer complain about the quotes.
-
If this is so urgent, I suggest you hire someone to do it. If it's not as urgent as you're making it out to be, check to make sure your vars hold the values you expect (echoing them out, looking in the AS debugger). I notice the file you are sending this stuff to has a bunch of spaces. Perhaps you meant to include underscores or hyphens in that page name? AS sends by either GET or POST method. So unless you have register globals turned on, the vars would be accessed in php by $_GET['varnamehere'] or $_POST['varnamehere'].
-
[SOLVED] reset unordered array to ordered array
.josh replied to jagoan-neon's topic in PHP Coding Help
array_merge has a side effect of doing what you wanted. The official way to do it though is array_values -
nah man, don't be seduced by that line of reasoning. After nuclear fallout, there'll be zombies everywhere. You can't be running from them when you're all fat and shit. They'll just catch you and eat you and take forever to do it and you'll just have to sit there all that much longer. BWHAHAHAHA... I should read the misc board more often. QUOTED! my life is complete.
-
Well like I said, not zombies per se... http://en.wikipedia.org/wiki/Reaver_(Firefly) The series only mentioned them in passing a couple times. Show got discontinued before they really got into it. Movie revolves around them, though. I actually mostly liked the series...except for the opening song. Man that song sucked. I'm convinced that that song is the reason the show got canceled.
-
Not really zombies per se... Ever seen the movie Serenity?