Skip to content


Assembla Subversion Repository moving code to trunk

A colleague set up a new subversion repository on assembla and invited me in. Unfortunately he missed importing the code into the trunk directory and as a result all the code was out in the root of the repo.

A bit of googling gave the solution at http://svn.haxx.se/users/archive-2007-10/0600.shtml

Simply put

cd ~/localdir
svn checkout https://path/to/assembla/repo localdir
cd localdir
svn mkdir trunk
for f in *; do svn mv $f trunk; done
svn mkdir branches tags
svn commit -m 'Finally got organized'

Posted in Troubleshooting.

Tagged with , .


Gallery Upgrade Issues

I had an issue today with a gallery upgrade in that I upgraded the gallery to 2.3.1 version as per the documentation. However, the galleries (there were about 14k images in about 9GB) displayed ok, while a couple of them had broken thumbnail placeholders. Gallery’s logs were no help and neither were apache’s logs.

I tried to use the maintenance section of the site admin to regenerate all thumbnails and derivatives, but got various errors including ERROR_STORAGE_FAILURE and ERROR_LOCK_FAILURE among a few others. I was also getting quite a lot of mysql server has gone away errors which probabaly were due to mysql query restrictions on the server to prevent abuse.

After a lot of googling and running through the faqs and troubleshooting sections of menalto’s gallery site, finally figured out a set of actions that seemed to temporarily fix the issue.
1. Go to http://site/lib/support, enter the setup password, and click on cache maintenance. Leave the logs and the thumbnails unchecked and run it.
2. In http://site/main.php after login, go to Site Admin>Maintenance>Delete Template Cache. If this gives some errors, it seemed ok to ignore it.
3. Open the database via phpmyadmin and run find the max value of g_id in g2_Entity. Increment the value by 1 and insert that value to the row in g2_Sequenceid (There should be only one row and if the value of the query ’select max(g_id) from g2_Entity’ is 34523, the row in g2_Sequenceid should be 34524)

Now rerun the generate all thumbnails and derivatives from Site Admin>Maintenance

I still have issues running it as the memory limit seems to setup at 32mb. Working on fixing that.

Posted in Troubleshooting.


ExtJS line Charts and improper string data from PHP

While working on the main dashboard for the current extjs project I am working I had to create a line chart which showed the performance over the last 1 week. This was across 3 different variables.

The code to show that with tips and all as an item in an ExtJS Panel is

new Ext.chart.LineChart({
                    store: new Ext.data.JsonStore({
                        url:PHP_AJAX_URL + '/hometab.php',
                        baseParams:{
                            task:'graphdata'
                        },
                        idProperty: 'gdate',
                        root:'data',
                        fields: ['gdate', 'f1', 'f2','f3'],
                        autoLoad: true
                    }),
                    xField:'gdate',
                    series:[
                    {
                        type:'line',
                        displayName: 'FONE',
                        yField: 'f1',
                        style: {
                            color: 0x889fbb
                        }
                    }, {
                        type: 'line',
                        displayName: 'FTWO',
                        yField: 'f2',
                        style: {
                            color: 0x889fcc
                        }
                    }, {
                        type:'line',
                        displayName: 'FTHREE',
                        yField: 'f3',
                        style: {
                            color: 0x6666bb
                        }
                    }
                    ],
                    tipRenderer: function (chart, record, index, series){
                        if (series.yField=='f1')
                            return Ext.util.Format.number(record.data.f1, '0,0') +
                            ' f1 on ' + record.data.gdate;
                        if (series.yField=='f2')
                            return Ext.util.Format.number(record.data.f2, '0,0')+
                            ' f2 on ' + record.data.gdate;
                        if (series.yField=='f3')
                            return Ext.util.Format.number(record.data.f3, '0,0') +
                            ' f3 on ' + record.data.gdate;

                    },
                    extraStyle: {
                        padding: 10,
                        animationEnabled: true,
                        legend:{
                            display:'bottom'
                        },
                        xAxis: {
                            color: 0x3366cc,
                            majorGridLines: {
                                size: 0,
                                color: 0xdddddd
                            }
                        },
                        yAxis: {
                            color: 0x3366cc,
                            majorTicks: {
                                color: 0x3366cc,
                                length: 0
                            },
                            minorTicks: {
                                color: 0x3366cc,
                                length: 0
                            },
                            majorGridLines: {
                                size: 0,
                                color: 0xdddddd
                            }
                        }
                    }
                })

Like all other parts of the backend the code was being pulled via a quick mysql_query from the database and provided to the ExtJS frontend via JSON.

        $graph_query="select
				date(f_date) as gdate,
                sum(f1) as f1,
                sum(f2) as f2,
                sum(f3) as f3
                from stats
				where id=user
                and date(f_date)>date_sub(current_date, interval 7 day)
                group by date(f_date)";
        $graph_recordset=mysql_query($graph_query);
		while($graph_row=mysql_fetch_assoc($graph_recordset)){
			$response['data']=$graph_row;
		}
		$response['success']=true;
		print json_encode($response);

However, the LineChart wasn’t rendering properly and it was showing wierd values for some and not rendering at all for the others. The axes were fine and firebug showed proper values for the JSON string.

After a bit of looking around, it seems that ExtJS does not convert from string numeric values to numeric values. Remember that mysql_fetch_assoc provides an associative array with string values. All that was needed was to manually cast to integer/float values that the LineChart needs.

The bit of modified code is below. Note the casts inside the while loop

        $graph_query="select
				date(f_date) as gdate,
                sum(f1) as f1,
                sum(f2) as f2,
                sum(f3) as f3
                from stats
				where id=user
                and date(f_date)>date_sub(current_date, interval 7 day)
                group by date(f_date)";
        $graph_recordset=mysql_query($graph_query);
		while($graph_row=mysql_fetch_assoc($graph_recordset)){
			$graph_row['f1']=intval($graph_row['f1']); //or floatval as needed;
			$graph_row['f2']=intval($graph_row['f2]); //or floatval as needed;
			$graph_row['f3']=intval($graph_row['f3]); //or floatval as needed;
			$response['data']=$graph_row;
		}
		$response['success']=true;
		print json_encode($response);

Posted in Troubleshooting.

Tagged with , , .


Paypal India outage more confusing now

pparently, resolved in this case seems to mean that paypal has assured the freelancing sites of something positive. Rentacoder has sent reversed payments back to paypal and elance has posted that the issue has been resolved. To clarify about rentacoder, my paypal balance is 0 now again back from the negative value, because RAC has sent the payment to paypal again.
But the issue is not actually resolved as far as withdrawing is concerned. That seems to be the current status. And yes, the withdrawals to the bank is still showing as completed while the bank accounts do not show the transaction.
Links:
Elance: See the update on the top http://elance.zendesk.com/forums/30972/entries/108402
Paypal: https://www.thepaypalblog.com/2010/02/personal-payments-and-local-bank-transfers-in-india/

Elance seemed to say that the paypal payment reversing issue has been resolved. However, resolved in this case seems to mean that paypal has assured the freelancing sites of something positive. Rentacoder has sent reversed payments back to paypal and elance has posted that the issue has been resolved. To clarify about rentacoder, my paypal balance is 0 now again back from the negative value, because RAC has sent the payment to paypal again.

But the issue is not actually resolved as far as withdrawals to the bank is concerned. That seems to be the current status. And yes, the withdrawals to the bank is still showing as completed while the bank accounts do not show the transaction. If the withdrawal that I made in the beginning of feb are actually completed, then rac has sent me double the amount they owe me, which does not seem likely. Paypal should atleast update the status of the bank transactions they show to ‘failed’ or something. Do let me your situations in the comments.

Links:

Elance: See the update on the top http://elance.zendesk.com/forums/30972/entries/108402

Paypal: https://www.thepaypalblog.com/2010/02/personal-payments-and-local-bank-transfers-in-india/

Posted in Uncategorized.