hits counter

Tech Talk


Tech Talk17 Jun 2010 03:54 pm

Just re-encountered this issue. If you have a table where there is an attribute of type varchar(2000) for instance (really just anything greater than 255), when you pull it out using sybase_connect, it will only return 255 characters. This is outlined as a bug on php.net. To get around this issue, use a convert to text or update the attribute to be of type text if you can.

select convert(text, reallybigvarcharattribute) from table

Written by Milton Lai

Tech Talk12 May 2010 11:08 am

I’m currently setting up a new server to play with and apart from the usual nightmare of compiling everything and finding all their dependencies and what not, I did hit an issue which I couldn’t find a clear answer online for. I used the following to configure PHP 5.3.2:

./configure –with-apxs2=/usr/local/apache2/bin/apxs –with-gettext –with-zlib –with-jpeg-dir –with-png-dir –with-ldap –with-openssl=/usr/local/ssl –with-curl –enable-exif –enable-ftp –with-gd –with-xsl –with-libxml-dir –with-libxml-dir –with-gd –with-sybase-ct=/home/sybase/sybase64/OCS-15_0

This worked a treat, but it was when I called “make” that the following appeared.

	ld: fatal: library -lcomn: not found
	ld: fatal: library -lct: not found
	ld: fatal: library -lcs: not found

The first approach I had was to edit the Makefile that configure creates to change lcomn to lsybcomn, lct to lsybct and lcs to lsybcs. You should be able to notice that within your sybase/OCS-15_0/lib folder, there are files which reflect the later name changes – libsybcomn.so .
This worked. I then was told (since it was scribbled on a piece of paper somewhere) about sybase/OCS-15_0/scripts/lnsyblibs which creates softlinks with the expected library file names. So now there are a bunch of files looking like libcomn.so -> libsybcomn.so .

Written by Milton Lai

Tech Talk28 Apr 2010 01:10 pm

We just recently hit the following error from Sybase:

“There is insufficient heap memory to allocate -1562977772 bytes. Please increase configuration parameter ‘heap memory per user’ or try again when there is less activity on the system”

when trying to get the results out of Sybase as xml using the “for xml all” function. It works fine normally, until your result sets hit over 500 rows or so. This is due to the heap memory space which most people would be reluctant to change – the query returns your data, by default, as one big row and normally of type TEXT. To get around this, “for xml option “incremental=yes root=yes”" will set each row of results as a separate row coming back. This means that instead of a huge chunk of TEXT coming back, it’ll appear like a normal record set, but instead of the normal data, it’ll appear as xml data.

For more information on XML for Sybase head to http://manuals.sybase.com/onlinebooks/group-as/asg1251e/xmlb/@Generic__BookTextView/4521. The following section is taken from that page and helps explain the “incremental” option.

The result set that a for_xml_select statement returns depends on the incremental option:

incremental = no returns a result set containing a single row and a single column. The column datatype is text. The value of that text column is the SQLX-XML representation of the result of the basic select statement. This is the default option.

incremental = yes returns a result set containing a row for each row of the basic select statement. If the root option specifies yes (the default option), an initial row specifies the opening XML root element, and a final row specifies the closing XML root element.

For example, these select statements return two, one, two, and four rows, respectively:

select 11, 12 union select 21, 22
select 11, 12 union select 21, 22 for xml
select 11, 12 union select 21, 22 for xml option "incremental=yes root=no"
select 11, 12 union select 21, 22 for xml option "incremental=yes root=yes"

Written by Milton Lai.

Personal and Tech Talk30 Nov 2009 07:56 am

The past few weeks have been a bit intense with work and personal projects, I’ve been at the keyboard quite a far bit to get my first real app out. I’ll have another post later on, closer to the date when I can actually release it. Of course, it won’t be the cleanest release, but there will be regular updates (in fact that means I need an updating mechanism which will make life easier for the people who do end up using the software). I’ve spent a bit of time refactoring my current project before I started the new tasks. I felt that there was a bit of code smell and well as performance issues. One simple example would be to create a local instance for any values which are calculated within loops.

dim a(100) as string
for i = 0 to Ubound(a)
	//do something
next

Instead of doing that, it would make the loop just a tad bit faster by creating j to be the value of Ubound(a) UNLESS of course, you are changing the length of the array within the loop itself (which I then recommend at least changing the for loop from going “to” to “downto”. This step also allows for you to run through the debugger and find out what j is at that particular time.

dim a(100) as string
dim i as integer = 0
dim j as integer = Ubound(a)
for i = 0 to j
	//do something
next

OR if you are changing the number of elements to the array

dim a(100) as string
dim i as integer = 0
dim j as integer = Ubound(a)
for i = j  downto 0
	if a(i) <> nil then
		if a(i) <> "aaa" then
			a(i).remove
		end
	end
next

I’ve got an app which demonstrates small changes to your code which will improve your performance (if you haven’t adopted these practices already). I used it as a demonstration at work and it is similar to what was presented at the REALBasic Summit. I’ll upload that in time.

I’ve just put down a deposit to get a new mountain bike (Kona Caldera 2009 model) from the Bike Barn out at Paramatta. They were having a sale on Kona 09 models and so I picked it up for $1000. I’ll get it at the end of the work and give it a work out then.

Written by Milton Lai

Tech Talk29 Sep 2009 12:24 pm

This summit ran between the 24th and 26th of September. Hosted by InspiringApps in conjunction with ARBP and held in Boulder, Colorado. This town is a great place to visit, especially when you’re into anything outdoors (except for surfing – although there was a surfing diner somewhere in Boulder).
The sessions that ran were all quite relevant to almost everything that I do, and of course, some more than others.

psrb01
The view from St. Julien Hotel & Spa.

psrb12
InspiringApps

psrb02
Reporting Tools, Options, and Techniques – Bob Keeney

psrb03
Cocoa and Reporting Features in REALbasic – Geoff Perlman

psrb04
SQLite Power Tools – Ryan Vail

psrb05
OO Database Framework and Introspection – Seth Verrinder

psrb06
Profiling and Performance Tweaking – Joe Strout

psrb07
Version Control, And Why it Rocks – Aaron Gerber and Mathias Gran

psrb09
Building REALbasic Plugins – Christian Schmitz

psrb10
Usability & Design Techniques – Jay Crain

psrb11
Facilitated RB/RS/Summit Feedback Session – Brad Weber

psrb13
The few remaining members on the final day up in Estes Park.
Milton Lai, Seth Verrinder, Frederick W. Roller, Rick, Gerard Hammond, Bob Keeney, Norman Palardy

Written by Milton Lai

Next Page »