Jump to content

blackcell

Members
  • Posts

    439
  • Joined

  • Last visited

Everything posted by blackcell

  1. I need to send a cURL request containing a file to upload as well as a JSON string. I can get a properly formatted request when sending the JSON, but the file is throwing it off. $curl_file_object = '@'.$tmp_name $postData= array( 'JSON'=> json_encode($jsonParams), $reference => $curl_file_object, ); $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $target); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // stop verifying certificate curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, true); curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: multipart/form-data;")); curl_setopt($curl, CURLOPT_POST, true); // enable posting curl_setopt($curl, CURLOPT_POSTFIELDS, $postData); // post data curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); // if any redirection after upload $response = curl_exec($curl); $info = curl_getinfo($curl); curl_close($curl); debug($info); Am I the first one needing to send file binary data along with a json string to a server at the same time?
  2. To answer your question without posting completely off the topic... The best source is the cookbook: https://www.google.com/webhp?sourceid=chrome-instant&rlz=1C1CHWA_enUS627US627&ion=1&espv=2&ie=UTF-8#safe=off&q=cakephp+cookbooks One of the first three links depending on version. Welcome — CakePHP Cookbook 3.x documentationWelcome — CakePHP Cookbook 2.x documentation
  3. Yep. That was it. Thanks max_gyver. I've been out of coding for about half a year now so things are a bit rusty.
  4. <?php ini_set("error_reporting","-1"); ini_set("display_errors","on"); $Pay_freq = $_REQUEST['Pay_freq']; $Start_value = $_REQUEST['Start_value']; $Start_date = $Start_date_ori = $_REQUEST['Start_date']; $Pay_earnings = $_REQUEST['Pay_earnings']; $Perc_contr = $_REQUEST['Perc_contr']/100; $Perc_emp_contr = $_REQUEST['Perc_emp_contr']/100; if($Perc_contr > .08){ $perc_non_matched = $Perc_contr - .08; $Perc_contr = .08; }else{ $non_matched_contri = 0; } $yourContrib = number_format(round( (($Pay_earnings*$Perc_contr)+($Pay_earnings*$perc_non_matched)), 2)); $empContrib = number_format(round(($Pay_earnings*$Perc_contr)*$Perc_emp_contr,2)); $totalContrib = number_format($yourContrib+$empContrib); $projection = " <br /> <table class='Standard' align='center' width='900' border='1'> <tr bgcolor='#CCCCCC'> <td colspan='3' align='center'><h1>Per Paycheck Contribution</h1></td> </tr> <tr> <td width='' align='center'><b><big>Your Contribution</big></b></td> <td width='' align='center'><b><big>Employer Matched Contribution</big></b></td> <td width='' align='center'><b><big>Total Contribution</big></b></td> </tr> <tr> <td width='' align='center'>$"."$yourContrib</td> <td width='' align='center'>$"."$empContrib</td> <td width='' align='center'>$"."$totalContrib</td> </tr> <tr bgcolor='#CCCCCC'> <td colspan='3' align='center'><h1>Projection Base(Without Investment Return)</h1></td> </tr> "; $totalValue = $Start_value; if($Pay_freq == "Bi-Weekly")$incPeriod = 1209600; if($Pay_freq == "Weekly")$incPeriod = 604800; $payPeriod = 0; $year_last = 1900; while($payPeriod <= 520){ $totalValue = $totalValue + $totalContrib; $year = date("Y",strtotime($Start_date)); if($year != $year_last){ $projection .= " <tr bgcolor='#6699FF'> <td colspan='3' align='left'><h2><b>$year</b></h2></td> </tr> "; $year_last = $year; } $projection .= " <tr class='Hover'> <td colspan='1' align='left'>$Start_date</td> <td colspan='2' align='left'>$".round($totalValue,2)."</td> </tr> "; $payPeriod++; $Start_date = date("Y-m-d",strtotime($Start_date)+$incPeriod); } $projection .= " </table> "; echo json_encode(array("projection"=>$projection,"date"=>$Start_date_ori)); ?>
  5. I figured the problem resided in the initial calculations since the shift from 39 to 40 causes an overall contribution issue before even entering the loop.
  6. Of course. Sorry I should have included this. Sorry have a ton going on the past week. $totalValue = $Start_value; if($Pay_freq == "Bi-Weekly")$incPeriod = 1209600; if($Pay_freq == "Weekly")$incPeriod = 604800; $payPeriod = 0; $year_last = 1900; while($payPeriod <= 520){ $totalValue = $totalValue + $totalContrib; $year = date("Y",strtotime($Start_date)); if($year != $year_last){ $projection .= " <tr bgcolor='#6699FF'> <td colspan='3' align='left'><h2><b>$year</b></h2></td> </tr> "; $year_last = $year; } $projection .= " <tr class='Hover'> <td colspan='1' align='left'>$Start_date</td> <td colspan='2' align='left'>$".round($totalValue,2)."</td> </tr> "; $payPeriod++; $Start_date = date("Y-m-d",strtotime($Start_date)+$incPeriod); }
  7. I tried error reporting and nothing. Attached is three SS. Anything <= 38 works like it should. 39 starts going crazy. Calculates the correct monthly contribution but not the correct monthly values. Anything >= 40 totally goes wrong. http://progtronics.com/files/38.PNG http://progtronics.com/files/39.PNG http://progtronics.com/files/40.PNG
  8. //I am calculating payroll contributions to 401k to give employees a baseline outlook for 20 years to check against their portfolio quarterly reports. It all works until numbers start getting larger. Nothing //ginormous...this is the reason I am at a loss. Is there a setting in php.ini that would be bombing? Sorry...the code formatting tool is acting dumb. $Pay_earnings = $_REQUEST['Pay_earnings']; $Perc_contr = $_REQUEST['Perc_contr']/100; $Perc_emp_contr = $_REQUEST['Perc_emp_contr']/100; if($Perc_contr > .08){ $perc_non_matched = $Perc_contr - .08; $Perc_contr = .08; }else{ $non_matched_contri = 0; } $yourContrib = number_format(round( (($Pay_earnings*$Perc_contr)+($Pay_earnings*$perc_non_matched)), 2)); $empContrib = number_format(round(($Pay_earnings*$Perc_contr)*$Perc_emp_contr,2)); $totalContrib = number_format($yourContrib+$empContrib); echo " <br /> <table class='Standard' align='center' width='900' border='1'> <tr bgcolor='#CCCCCC'> <td colspan='3' align='center'><h1>Per Paycheck Contribution</h1></td> </tr> <tr> <td width='' align='center'><b><big>Your Contribution</big></b></td> <td width='' align='center'><b><big>Employer Matched Contribution</big></b></td> <td width='' align='center'><b><big>Total Contribution</big></b></td> </tr> <tr> <td width='' align='center'>$"."$yourContrib</td> <td width='' align='center'>$"."$empContrib</td> <td width='' align='center'>$"."$totalContrib</td> </tr> <tr bgcolor='#CCCCCC'> <td colspan='3' align='center'><h1>Projection Base(Without Investment Return)</h1></td> </tr> This works find until my $Perc_contr rises above 40. Then my $totalContrib toward the bottom does not reflect my $yourContrib in the addition. But the actual TD holding the $yourContrib is fine. I am frikin dumbfounded....
  9. I've been looking at Drive Bender by the way. I'm not sure about reliability and support though. http://www.drivebender.com/index.php/features/105.html
  10. I have a bunch of old 7200 RPM drives at work. I am in need of space for user files that need redundancy. I link users' personal drive on logon and would like to remap these to a standalone system other than the company shared network drives on replicated servers at two locations. Would there be anyway software that would enable sata drives to be popped in to RAID to create a new aggregate and use as user storage? I know you can go buy Netapps for buckoo bucks but would rather have the ability to pop sata drives in on failure to a standalone system.
  11. Thanks a ton! This is an expression match on an exchange server. So the backslash wasn't accepted for some weird reason.
  12. Hello guys(and girls), I am finding more of a need to learn RegEx. I have a very basic knowledge of it(basically what it is used for and how to make literal text matches with no considerations. I have been trying to figure out how to go about writing a regex to block emails originating from anyone@domain.in but I don't want to block jim.inners@somewhere.com What do I use to restrict the match to must not have anything following it?
  13. blackcell

    Stack

    You can try to specify a width but I am not sure css divs are meant for that. That is more along the lines of tabular data and tables need to be used. I have run into this same issue. I div/span everything until I need data displayed in table form and then use tables.
  14. I have tried this: in the head and it doesn't seem to work. Is there a problem with subdomains or smf forum theme interfacing?
  15. I think I found it: SELECT * FROM vsws_objects INNER JOIN vsws_basic ON object_part = basic_part AND object_task = basic_task WHERE basic_comment LIKE '%criteria%' Apologies but I am edgy right now because my boss has taught me the lazy way of doing this(taking care of it with multiple nested loops in PHP) for years and I didn't know any better. Now I am 2 years of experience down on proper query writing because of that. Please understand the frustration.
  16. Huh? I think the ...help to those that... threw me off. If you have anything more to say than a simple, "Could you post some real table names and a little data with expected output?" Then forget this thread I DO NOT want your help. I have few people who condescend in my daily routine and quite frankly want no more of them. I don't care if you are a SQL wizard, you just pissed me off, it will affect the rest of my day, and thanks. I'll wait on another person with more patience than you. Perhaps I am taking this completely out of context, if so let me know. Next step...crayons. Edit: Oh check out: http://dev.mysql.com/doc/refman/5.0/en/join.html I am pretty sure they use generic names and they seem to be successful...go figure right? I don't understand because I have no idea which kind of join to use, or perhaps I am not smart enough to figure it out.
  17. Well, I suppose I should understand that I think the previous description is clear because I work within the data on a daily basis. Because I did not provide you with simple explanation... Tables: vsws_basic vsws_objects Fields I am concerned with basic_part <-Belongs to vsws_basic basic_task <-Belongs to vsws_basic object_part <-Belongs to vsws_objects object_task <-Belongs to vsws_objects I want to do a count of the number of objects with the same part and task as a vsws_basic record with corresponding part and task. So yes, a where clause will need to go in. [attachment deleted by admin]
  18. I am sorry for a less than adequate description on the subject line. I have two tables. These two tables both have identical fields linking them. Well there is much more but I am only concerned with this much so far. table1 ---------------------- | field1 | field2 | ---------------------- table2 ---------------------- | field1 | field2 | ---------------------- Table 1 will have one record with multiple records existing in table 2 that uniquely key to it from identical field1 and field2 values. So something like: Table1.record1 Table2.record1 Table2.record2 Table3.record3 Table4.record4 Table5.record5 Table6.record6 Table1.record2 Table2.record1 Table2.record2 Table3.record3 Table4.record4 Table5.record5 Table6.record6 Table1.record3 Table2.record1 Table2.record2 Table3.record3 Table4.record4 Table5.record5 Table6.record6 Again, the indented records are linked to the field1 and field2 matching values in both tables. I am sorry if this is a horrible explanation. This is the first time I have ever needed help with mySql. Before this, I was taught to handle this kind of thing with multiple queries in nested loops within PHP(which I now realize is asinine) and I am trying to unlearn the bad and intake the good.
  19. If you want to get really low, go pick up Kip Irvin's Assembly language programming.
  20. Why hasn't W3C picked either of these up yet? This is awesome!
  21. Hey gents(and ladies), I was refining the resume today and a question popped into my mind. What do I call myself if I am still 1.5 years from graduating with a computer engineer degree? I have been working in the capacity as a computer engineer for my company about 4 years. I am by no means an expert in the field, but I have an understanding of how to develop solutions to cut costs and raise revenue using technology. This is what I do, whether it is programming, hardware implementation or even a mixture of the two. Simply put...is it correct to put Computer Engineer and if not, what? Also, I am open to suggestions for more precise job titles. Thanks in advance.
  22. Well, I mean the buttons you click with no redirect. I can do that much. I want them to click, and it's done.
  23. Awesome man. Thanks. I needed to change web properties back.
  24. How do the social sharing toolbars work? I want one that is neat and simple, just rows of icons because my conglomerate of piece mill coded ones won't align right. I am afraid of some of these sites disclaimers that build them for you. What do you guys use?
×
×
  • 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.