Jump to content

blackcell

Members
  • Posts

    439
  • Joined

  • Last visited

Posts 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. <?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));
    ?>
  3. 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);
        }
    
    
  4. //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....

     

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

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

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

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

  9. Huh?... what?.... posting your real tables description (the relevant part) and some data and your expected output should help to those that could try to help you

    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.

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

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

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

×
×
  • 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.