-
Posts
14,780 -
Joined
-
Last visited
-
Days Won
43
Everything posted by .josh
-
How do i amend a line in a delimited text file using php?
.josh replied to davocold's topic in PHP Coding Help
a) make sure you are not using 'a' or 'a+' with fopen, because fwriting will always append it to the end of the file, regardless of what you do b) you need to use ftell to get the current location of each line as you fread or fget it c) you need to use fseek to move the pointer to the relevant location in the file before fwriting the line. You would find the beginning of the target line by the previous line's ftell result + the strlen of that previous line d) make sure when fwriting you pad with whitespace the difference in line length or else remove any trailing existing stuff. IOW if what you are changing is shorter than what was there before, you're gonna see that extra stuff still there. -
Studies have shown that real regex men use hash instead (and I'm not only refering to delimiters either). ooh I think you finally won me over to using # instead of ~ I can say "I like hash"
-
took me a min... I was about to vote for suggesting he trim $email then at last second noticed.
-
not escaping the dot would not break it per se (it wouldn't break it in this instance, anyways). It'll match (most) anything including a literal dot. Danger of not escaping it is that it can match more than a literal dot. anywhoo...your regex is failing because of this: '$email' You have $email wrapped in single quotes which causes ereg to interpret literally. Remove the quotes. Also as cags mentioned, move to preg_match instead of ereg. Only thing you really need to change for that is you need to add delimeters to your regex.
-
FF is the main browser I use. It is a good browser, with a lot of very nice plug-ins that make my job a lot easier. I rarely use IE except for testing cross browser compatibility, and the web developer tool in IE was a huge blessing. Now if only MS made their compatibility mode do IE6 also (or conversely, take a more active role in enforcing upgrades...), I'd be a happy camper. Since a lot of my job involves having to constantly delete cookies and stuff for QA purposes, I generally use chrome to keep windows open to things I'm logged into so I don't have to keep logging into shit. Off the clock though, I mostly use FF.
-
The spacing between each letter. A blank space is X pixels wide, depending on the font you are using. The way you did it, it will be a set X pixel space (whatever the width of the space is for your font you are using. With the way I suggested, you can specify how many pixels worth of space are inbetween each letter. You can even use like rand(1,10) or something to make the amount of space between each letter vary.
-
there's some limitations to the regex i supplied. 1) it assumes your href attrib is wrapped in double quotes. 2) if there are nested double quotes inside it (escaped, like if there's some js in there...) it's gonna break 3) if you have a relative path with a leading / it's going to replace as http://www.site.com//blahblah (which won't actually break the url, but just thought i'd mention it)
-
yeah, suppose you could do that if you want it to be spaced by a whole blank space. The way I mentioned would allow you to control the spacing by the pixel.
-
you would basically loop through your script (up to the imagettftext part) doing 1 letter at a time but with an added offset amount to $x in imagettftext
-
PHP error handling to limit characters in textarea.
.josh replied to codeboy89's topic in PHP Coding Help
if (strlen($string) > 3000) { // longer than 3000 } -
$raw = preg_replace('~href\s?=\s?"((?!https?://)[^"]*)"~i','href="http://www.domain.com/$1"',$raw);
-
yeah...every time you ask for suggestions you throw a fit when you get them.
-
lmfao, everything from garbage man, cook, to atm technician and tech support.@32. but i guess that doesnt count. :'( All I'm saying is that your OP screams "I haven't really had to deal with projects/clients asking for really difficult/impossible stuff, done in really difficult/impossible time frames." Times 10 projects/clients at a time... yes.
-
yeah...see how far that outlook gets you when (if) you start working in the real world.
-
I agree. That statement is garbage.
-
when browsers first started doing the whole tab thing, it took me a while to get into it. I continued to open a new window for a while. I can't really remember why I had misgivings about it, really... there's really no downside to tabs vs. multiple browser instances open, but on the other hand, having multiple browser instances open takes up more memory, and more taskbar real-estate. Eventually I gave it a serious try and it took some getting used to, but it grew on me, and now I'll never go back if I can help it.
-
http://www.phpfreaks.com/tutorial/php-basic-database-handling
-
"level system" is pretty ambiguous... care to be more specific?
-
http://www.phpfreaks.com/tutorial/php-add-text-to-image
-
GENERAL RULES AND GUIDELINES FOR POSTING This forum is not meant to be a formal freelance service system. It is available for those who wish to seek out services or work from other people, as a courtesy to the members of the phpfreaks community. phpfreaks.com does not specialize in freelance services. This forum is an informal mechanism, as a courtesy to the community. We have no formal mechanism in place (like escrow) to guarantee payment, refund, work done, etc... phpfreaks.com shall not be held responsible for any losses you incur. we have never and continue to not act as any kind of mediator or verification/compensation source for people/organizations who use those forums. We will not be held responsible/liable for any damages, loss, etc. that occur from use of those forums. If you hire someone and they rip you off, don't come crying to us. If someone hires you and they rip you off, don't come crying to us. Those forums are a convenience. If you want something more official that offers guarantees, go to a real freelance site! If you have any questions regarding the freelance forum, feel free to ask them here. RULES: WHERE TO POST:If you want to offer your services, post in the Service Offerings sub-forum.If you want to offer a job or position of employment, post in the Job Offerings sub-forum. DO NOT post your 'resume' in job posting threads. You must directly contact the person you wish to reply to. The only reason replies are allowed is to ask for clarification/details about the job. Failure to adhere to this rule will result in all kinds of things, like you getting banned, or us disallowing replies. DO NOT make more than one thread offering your services. You can edit/reply to your thread to reflect additions/changes. DO NOT post advertisements to other sites offering freelance system services. For example, rentacoder.com, odesk.com, etc.. we have no partiality for or against those sites, but posts such as those are regarded as advertisement, which is against our main site rules. We fully acknowledge that this freelance system is limited, but we aren't here to provide free advertising for other places. If you prefer to do actual business through one of those sites, please specify in direct contacts with the person. You are allowed, as a freelancer or freelance company, to post a link to your personal portfolio/company to those sites, or a site that you own. But general promotions to those other sites are not allowed. GUIDELINES: When posting in the freelancing forum it's important that you provide a way for users to contact you. They will not be able to reply to your topics so they need a way to contact you privately. This can be using PMs, emails, any type of instant messaging service (MSN, Gtalk, AIM, Jabber, etc.) or however you see fit.The more specific you are about your skills, previous experience(s), availability, rates, etc.. the better your chances of getting serious inquiries. Posting vague "I'm available for anything and everything" might get more inquiries on average, but there's a good chance that it will come to nothing, based on any number of things that you could have posted here in the first place. Better to receive 10 emails from people who have some idea of your qualifications/terms, than 100 emails that don't.Be honest about your skills. All day long we see people posting about how they jumped on a job and bit off more than they could chew. They tell the client they can do everything they need and more, promise them the moon, and then promptly crap their pants about 5 minutes into it. Don't be that person! Some people get lucky and figure it out. Some people get lucky and get help that figures it out. Most people end up having to give up the project. Which leads us to....Wasting people's time and money. You waste the client's time. You waste your own time. That bad rep will more than likely come back to haunt you. All day long we get people trying to get us to delete their posts because they don't want their skeletons to come out of the closet (no we won't hide them for you). So be smart! Do the simplest easiest thing to avoid all this headache: be truthful about your skills. If you feel that being truthful will limit your potential clients, then get off your bum and hit the books. You can't seriously be in the business of trying to con people, are you?Be very clear about what you are doing. Some clients know your job, and are just looking for extra set of hands. Most do not, and therefore seek someone who does. Therefore, if you want to avoid headaches, it is your responsibility to be very clear about what it is you're going to do. What you're willing to do. What kind of support you offer after the fact, etc... on that note..Be up front and thorough about your prices. Take a look at the situation. Quote a price for it. Quote prices for things that might come up later. The more you have to go back later saying that xyz was unforseen or xyz wasn't part of the deal, regardless of whether or not you are in the right, the more you are going to come off as shady, to the client. It's like when you take your car to a mechanic and that funny noise goes from being one little $50 thing to a $2000 rebuild because the mechanic kept coming back to you saying something else is wrong. That stuff may indeed be needed, but the fact that you didn't think about it and let them know ahead of time speaks volumes about your skills as a coder. Some things just aren't foreseeable. Most things are.
-
I believe thorpe is working on something like that right now. Don't have an ETA or anything.
-
How about a captcha tutorial? Lots of them around, but we're supposed to be a resource, right? I may do it myself, if someone else doesn't volunteer.
-
Honestly I don't really see anybody writing a tutorial like that on a technical level (actual code). Maybe on some kind of abstract level, like conveying general principles and program flow and good design, advice and pitfalls, etc.. but most tutorials that involve actual code are for teaching how to make building blocks. Things like forums and blogs and cms' are more like actual buildings, not building blocks. If you sit down and break down for instance all the things in a forum, you will quite easily find tutorials for just about all of those 'building blocks.' I suggest you either do that, or maybe find an open source version of one of those things and jump into it, instead.