Datareport textbox change event

Question: We are doing some reporting using the VB6 DataReport. I have set the CanGrow property of some RptTextBox controls to True, and I have used RptLine controls between RptTextBox controls.
My problem is that the RptLine control doesn't have the CanGrow property, so it will not grow in tandem with a RptTextBox control. If there is any event triggering when a RptTextBox changes, I can use that to get the RptTextBox Height property, and can assign that to RptLine.
Are there any events I can use? Or is there any other way to make RptLine controls have same height as RptTextBox?
EDIT:
1)RptTextBox height=RptShape height

2)RptTextBox height < RptShape height
Answer: Unfortunately, there are no events which can be used to make each instance of the control different from each other. So the only way you can do this is to take advantage of the way the controls work.
The workaround is to create a duplicate RptTextBox control of the one which you want to use. We are only interested of the right hand (or left hand) edge of the control.
Ensure the following properties on the duplicate control are set:

BackColor : &H00FFFFFF&    (This should be the same as the background)
BackStyle : 1 - rptBkOpaque
BorderColor : &H00000000&   (or whatever colour you want to use)
BorderStyle : 1 - rptBSSolid
CanGrow : True
DataField : <same as the control you copied>
ForeColor : &H00FFFFFF&    (This should be the same as the background)

Create a RptShape control, and set the following properties:

BackColor : &H00FFFFFF&    (This should be the same as the background)
BackStyle : 1 - rptBkOpaque
BorderStyle : 0 - rptBSTransparent
Height : <As large as possible>
Left : <same as the duplicate control>
Width : <same as the control you copied>

Right click on the Shape, and select "Bring to Front"
Essentially, the duplicate control will resize to the identical size as the original field, so its height will always been the same. The RptShape appears above this control, with the foreground and background colours being white, so it is being used to blank out the left, top, and bottom borders of the RptTextBox control. If you want to have a line to the left of your text, you will have to move the shape to the right until the left side is seen.
Comment: Sorry,I am not getting exactly what you are saying. And there is no ForeColor property for RptShape control. In my report all RptTextBox controls doesn't have same width.Although i tried your workaround but not getting expected result.
Comment: And its not possible to set RptShape  height As large as possible.I can only set the height as initial RptTextBox height which will leave some part of border line of grown RptTextBox unblanked.
Comment: @shreeshanks - Yes, RptShape.ForeColor was a mistake. As for the Width of a RptTextBox - if you use CanGrow, then the Width is constant for each record. And you should be able to use the Height property of the RptShape control. Type the value into the properties box, and it will not resize to the nearest grid position.
Comment: If you have left space for the text box to grow in height, then this should work ok.
Comment: Sadly that link only ends up showing my own files. Maybe you haven't shared it?
Comment: That obviously take more space right??(extra space for extra height of RptShape).Please see images on my edited post.
Comment: Is there any way to vertically align text in RptTextBox ?
Comment: Did you see my images ??

Datareport textbox change event


In jsFiddle, why do I have to click twice to change the text in directive?

Question: I have same directive's example in jsFiddle and another one in plnkr. In jsFiddle, I have to click the text twice to change the text while in plnkr it works like expected with one . Can someone point it out if this is an expected behavior or just a bug in fiddle.
http://jsfiddle.net/z6bfC/
http://plnkr.co/edit/2Z1u2PzbRzPYzjPv4miG?p=preview
HTML:

{{test}}

            <test-directive class="width" bindme="test" style="color: red;">Click Me Twice!!</test-directive>

Directive/Controller:
angular.module('testModule', []).directive('testDirective', function () {
    return {
        restrict: 'E',
        scope: {
            bindme: "="
        },
        link: function (scope, element, attr) {

            element.bind('click', function () {
                scope.bindme = "Changed";
                if (!scope.$$phase) {
                    console.log(scope.bindme);
                    scope.$apply();
                } else {
                    console.log("Something");
                }
            });

        }
    };
}).
controller('MyCtrl', function ($scope) {
    $scope.test = "Some string";
});

Thanks!
Answer: It seems the AngularJS 1.1.0 does some funky stuff.
Try 1.1.1. http://code.angularjs.org/1.1.1/angular.min.js
Comment: You honestly should skip the whole 1.1.x line — [1.2.0rc1](http://code.angularjs.org/1.2.0rc1/angular.min.js) is out, and it's going to be the stable version of the 1.1.x line.
Comment: I actually only recommend to use the stable version which is 1.0.7


Javascript Error Tracking Tools

Question: can anyone suggest any Javascript Error Tracking Tools that they have used.
We are using ExceptionHub but it doesn't quite work with knockoutJS in ie.
Suggestions are appreciated. Thanks
Comment: `Google` best tool to find answer to your question.Try `firebug`
Comment: Nowadays, most of the browsers having very good debugging capabilities natively. But you need to learn it first before you can try your hand on it.
Comment: You can try https://www.atatus.com
Answer: console.log() is the best one for error tracking.We need to install firebug for this.
Answer: I would suggest Firebug. Or Chrome Developer Tools - just hit F12 in Chrome to show the Developer Tools.
Comment: Thanks for your comments. We are looking for a tool that sends emails every time an unexpected error happens on our production system. Obviously we try to have a bug free code but want to know of any unexpected javascript errors. Firebug is quite useful while developing not for reporting purposes. –
Answer: You can give RootCause a try. They have a 30 day free trial
Disclaimer: I work for RootCause. Our software automatically reproduces JavaScript errors and lets you replay user sessions live in your browser with the click of a button.

Javascript Error Tracking Tools


Adding months to a existing date?

Question: I have a date where I need to add months to, but somehow it returns the epoch date
<code>$duration = 28;
$row['end_date'] = '2010-09-22 0000:00:00';

$newEndDate =  date("Y-m-d", strtotime(" +".$duration." month",substr($row['end_date'],0,10)));
</code>
Answer: <code>$newEndDate = strtotime(date("Y-m-d", strtotime($date)) . " +1 month");
</code>
Answer: Use this instead:
<code>$date = date("Y-m-d");// current date

$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 day");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 week");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +2 week");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +1 month");
$date = strtotime(date("Y-m-d", strtotime($date)) . " +30 days");
</code>

Adding months to a existing date?


Mysql where clause not work in codeigniter

Question: I have MySQL Query like this: (I use CodeIgniter)
$report = $this->db->query("
          SELECT c.categoryName,
            note1.*,
            ((SELECT SUM(noteAmount)
              FROM notes
              WHERE DATE_FORMAT(noteDate, '%d-%m-%Y') = DATE_FORMAT(note1.noteDate, '%d-%m-%Y') AND noteType = 'cash_in')
            -
            (SELECT SUM(noteAmount)
             FROM notes
             WHERE DATE_FORMAT(noteDate, '%d-%m-%Y') = DATE_FORMAT(note1.noteDate, '%d-%m-%Y') AND noteType = 'cash_out')) as trxCount
           FROM notes AS note1
           JOIN
             (SELECT noteDate
              FROM notes
              GROUP BY noteDate
              HAVING COUNT(noteDate) > 0)
            AS note2
              ON note1.noteDate = note2.noteDate
            JOIN category c
              ON c.categoryID = note1.categoryID
            WHERE note1.noteType = 'cash_in'
            ORDER BY note1.noteDate DESC
            LIMIT $start, $per_page
          ")->result();

See on WHERE Clause: WHERE note1.noteType = 'cash_in'

I only want to take the cash data, but why do I get all the data? (including cash out and others). My table also have cash out data

notes table:

noteID | noteTitle | noteDate | noteAmount | categoryID | noteType

category table

categoryID | categoryName | parentID
Comment: What error are you getting? Also please post some sample data from the notes and category table as well as an expected output please.
Comment: No error. But the query return all data (cash out and cash in). I only want to get cash in
Comment: Add sample data to your tables
Answer: The query
SELECT noteDate
          FROM notes
          GROUP BY noteDate
          HAVING COUNT(noteDate) > 0

is selecting the entire notes tables as note2 (including cash_out entries) and filtering is being done only on entries where note1.noteType = 'cash_in'. This will give both cash_in and cash_out entries as the join condition only checks for note1.noteDate = note2.noteDate which will always have some match.
Probably add where condition inside the on condition and see if that is what you want.
Answer: I believe you are missing a where on your JOIN statement. If this went on the ON element or within the SELECT itself I believe that would fix your problem.
Answer: Possibly a typo with cash_in and in.
$report = $this->db->query("
          SELECT c.categoryName,
            note1.*,
            ((SELECT SUM(noteAmount)
              FROM notes
              WHERE DATE_FORMAT(noteDate, '%d-%m-%Y') = DATE_FORMAT(note1.noteDate, '%d-%m-%Y') AND noteType = 'in')
            -
            (SELECT SUM(noteAmount)
             FROM notes
             WHERE DATE_FORMAT(noteDate, '%d-%m-%Y') = DATE_FORMAT(note1.noteDate, '%d-%m-%Y') AND noteType = 'out')) as trxCount
           FROM notes AS note1
           JOIN
             (SELECT noteDate
              FROM notes
              GROUP BY noteDate
              HAVING COUNT(noteDate) > 0)
            AS note2
              ON note1.noteDate = note2.noteDate
            JOIN category c
              ON c.categoryID = note1.categoryID
            WHERE note1.noteType = 'in'
            ORDER BY note1.noteDate DESC
            LIMIT $start, $per_page
          ")->result();