
hadoob024
Members-
Posts
192 -
Joined
-
Last visited
Everything posted by hadoob024
-
How to split a string cleanly into at most 2 strings
hadoob024 replied to hadoob024's topic in PHP Coding Help
Cool! I had no idea you could do that. Guess you learn something new everyday. Thanks for the tips! -
How to split a string cleanly into at most 2 strings
hadoob024 replied to hadoob024's topic in PHP Coding Help
Doesn't wordwrap() return just 1 string containing the original string with the breaks in it ready to display? I need to split my original string up into 2 strings because I'm displaying them using ezPDF creator's addText() method. Or maybe I'm misunderstanding the usage of wordwrap()? -
How to split a string cleanly into at most 2 strings
hadoob024 replied to hadoob024's topic in PHP Coding Help
My bad. It is in my first post. Forgot to post it originally, so went back and edited my post to include the code. Guess you had already replied prior to me editing my post. Damn you for being too fast Thanks though! -
How to split a string cleanly into at most 2 strings
hadoob024 replied to hadoob024's topic in PHP Coding Help
Cool. Thanks. Yeah. I ended up using that. I think my concern was splitting the string cleanly so that I'm not cutting it in the middle of the string. I used strrpos() to get the last instance of a space (within the first 25 characters of the string). Then I store the value of the string from the beginning until the value returned by strrpos(). Then I store the value from strrpos()+1 to the length of the string in the second variable. It seems to work. Looking for ways that it might fail though. -
I almost have this working but am missing something. I have a string that I need to split into at most 2 smaller strings. It has to be split cleanly (not in the middle of text), and the first string cannot be longer than 25 characters. So for example, the following: $mystring = "This Is My Manufacturer Name That Can Be Long" Should be stored into 2 smaller strings like: $mystring1 = "This Is My Manufacturer" $mystring2 = "Name That Can Be Long" I was going to use wordwrap() but that won't work because I need the values to be stored in 2 separate string variables. Is using explode() the way to go? Btw, this is what I have. Is this the best way to do it? $mfg_name_length = strlen($manu->name); if ($mfg_name_length >= 25) { $mfg_name_array = explode(" ", $manu->name); $space_loc = strrpos(substr($manu->name, 0, 25), " "); $pdf->addText(45,675,14,"Manufacturer: ".substr($manu->name, 0, $space_loc)); $pdf->addText(45,660,14,"Manufacturer: ".substr($manu->name, $space_loc+1, $mfg_name_length));
-
Cool. Thanks for the tip! Yup. Can't wait. Also can't wait for the race in Austin in 2012! Right now I'm on cruise control until the weekend.
-
Nice! So that will handle cases with multiple newlines/return carriages, right? Looks good. Just trying to think of a scenario where this won't, but can't seem to think of one. Btw, love the avatar. Headed to Montreal this weekend for the race.
-
I don't know why I'm blanking on this one. Basically, I have a string containing serial numbers. This string can have multiple newlines and carriage returns actually separating the serial numbers. I want to clean the string so that multiple newlines and carriage returns are removed. However, I still need to separate the remaining serial numbers with a comma. There isn't a consistent naming convention used, and there can be multiple occurrences of these carriage returns and newlines, so I can't just do something like: str_replace("\r\n", "", $mystring) or str_replace("\r\n", ", ", $mystring) So I need something like this: V423060018 V311911037 -or- V265141004 V265141004 V241889035 to be returned as: V423060018, V311911037 -and- V265141004, V265141004, V241889035 respectively. Any thoughts?
-
THANK YOU!!! That was it! I think I was missing the fact that an array was being returned. It works beautifully now!!! Thanks again!
-
Thanks. Yeah, I spoke with my manager about this. The problem with updating that file is that it's a core Sugar file, so when we upgrade Sugar, these changes will be overwritten. He wants me to come up with an upgrade-safe solution, which I understand but which also makes it so that I'm not done with this yet
-
That's what I wanted to do, but we're using that SugarCRM platform, so these are buttons generated by it, and I haven't figured out how (or even if I can) to add an ID attribute to the button.
-
Is the hiding/showing of text fields done differently than for buttons? I ask because I have the following text field: <input type="text" name="case_id_c" class="sqsEnabled" tabindex="0" id="case_id_c" size="" value="" > And if I call the following javascript, this field disappears: document.getElementById('case_id_c').style.display = 'none'; However, I have the following button: <input type="button" name="btn_clr_case_id_c" tabindex="0" title="Clear [Alt+C]" accessKey="C" class="button" onclick="this.form.case_id_c.value = ''; value="Clear"> And if I run the following code, nothing happens: document.getElementsByName("btn_clr_case_id_c").style.display = 'none'; Not sure what's going on. Any thoughts???
-
I have a custom field that I want to put inside a DIV tag. How do i go about that? I figure I need to add a customCode section to that field's definitions under editviewdefs.php, right? Here's my field definition so far: 5 => array ( 0 => array ( 'name' => 'case_id_c', 'label' => 'LBL_CASE_ID', ), ), I tried something like this but with no luck: 5 => array ( 0 => array ( 'name' => 'case_id_c', 'label' => 'LBL_CASE_ID', 'customCode' => '<div id = \'TESTINGTESTING\'>{$fields.case_id_c}</div>', ), ),
-
Nevermind. I just found the following: "1. In EZPDF you can set the colour of the text, shapes, lines etc., the colour needs to be specified in RGB triplet, each in the range 0 to 1. Most of the tools(eg:- Colour picker, Adobe Photoshop) shows the colour in the range of 0-255 or in Hexadecimal format. If you want the colour values in the range of 0-1, divide the colour values by 255. For example Blue is rgb(0, 155, 255). You can convert it in to 0-1 range by dividing each values by 255. So the blue is rgb(0, 0.61, 1) in 0-1 range."
-
I was wondering if anyone knows how to change colors of text, shapes, etc. with ezPDF? I read through their documentation and it says that: "(r,g,b) array, defining the colour of the shading, values from 0 to 1, default is (0.8,0.8,0." I'm confused though. If it's rgb colors, then I assumed that the value range would be from 0 to 255. I'm trying to make a particular blue color. As of now, I have the following bit of code for color: 'shadeCol2' => array (0,0,0.4) This gets me a blue color, but the wrong shade. And it's hard to figure out the correct shade when I don't know how to manipulate these numbers. Anyone come across this?
-
Senior PHP Developer Position Interview Questions
hadoob024 replied to hadoob024's topic in Miscellaneous
That the interview is going to be more focused on how I approach problems as opposed to knowing functions and syntax. -
Senior PHP Developer Position Interview Questions
hadoob024 replied to hadoob024's topic in Miscellaneous
That's what I was hoping. I guess we'll see what happens. -
Senior PHP Developer Position Interview Questions
hadoob024 replied to hadoob024's topic in Miscellaneous
The candidate. Sorry if it wasn't clear. Yeah, it's going to be a technical interview I'm sure. I already meet with the recruiter for what I believe was the business interview. I guess she does all the pre-screenings before passing on along the info to the client. She said that I'd be having a technical interview with them, so I wasn't sure what to expect since I've never gone in for a "technical interview" before. -
Senior PHP Developer Position Interview Questions
hadoob024 replied to hadoob024's topic in Miscellaneous
Cool. Thanks a ton for all the advice. We'll see. The person who I'm supposed to interview with was out of town this past week, so I should be having it this upcoming week. Will post again after the interview. Thanks again! -
Senior PHP Developer Position Interview Questions
hadoob024 replied to hadoob024's topic in Miscellaneous
Hmmmm... That all makes sense. I mean, I have the experience. I'm 33 now. Got my first T.I. and a Basic programming book when I was 8, and been doing it ever since. Been doing web development since 1994, and I've continually been adding new skills. Started with just HTML. Then over the years started adding stuff like JavaScript, CSS, PL/SQL, ASP, etc. For something like this, how important is it to know details about specific functions? Like if a question involves calculating a result and then sending an email, do you think it's a big deal to know exactly the parameters that are going to be fed to the mail() function? Or do you think it's more about seeing how someone is actually tackling a problem? I guess my main problem is that I've programmed in so many different languages, that I'm always having to look up specifics like that. I hope that won't be an issue. Maybe I should be upfront about that before the interview. -
Hello all. I'm going in for a technical interview next week for a Senior PHP Developer position, and was wondering if anyone here has gone through one or has given one. In either case, what kinds of questions/problems did you encounter? I want to make sure to nail this interview and am just trying to prepare myself for it, but am not sure exactly how to do so. Any thoughts?
-
Splitting up text into chunks (no split words)
hadoob024 replied to hadoob024's topic in PHP Coding Help
Sweet. Both of those work too. Thanks everyone! -
Splitting up text into chunks (no split words)
hadoob024 replied to hadoob024's topic in PHP Coding Help
Just figured it out. The following line: $tmp_body = substr($tmp_body, $tmp_start, 130 + $inc); needed to be this instead: $tmp_body = substr($tmp_body, 1, 130 + $inc); -
Splitting up text into chunks (no split words)
hadoob024 replied to hadoob024's topic in PHP Coding Help
Cool. Thanks. Yeah, the words can't be split. Basically, I'm taking a chunk of text, and sending out SMS's in 130 character chunks. Words can't be split in the middle, and a chunk can't be larger than 130 characters. I just looked at wordwrap(). Quick follow-up though. Instead of just echo-ing out each chunk, I need to store each chunk into a variable. Wordwrap() doesn't seem to allow this, does it?