Wednesday, March 30, 2011

Webware taskkit keep process executing without loading system

Here is my taskkitsample.py:

from TaskKit.Scheduler import Scheduler
from TaskKit.Task import Task
from time import time, strftime, localtime, sleep
     
class SimpleTask(Task):
    def run(self):
      print "hola "
      print self.name(), strftime("%H:%M:%S", localtime(time()))

def main():
    scheduler = Scheduler()
    scheduler.start()
    scheduler.addPeriodicAction(time(), 1 , SimpleTask(), 'Test')

main()




If I run from command line:

python taskkitsample.py

The process stops inmmediately: 



one common way to keep the process running is by adding the while True loop:

def main():
    scheduler = Scheduler()
    scheduler.start()
    scheduler.addPeriodicAction(time(), 1 , SimpleTask(), 'Test')

    while True:
        pass



Yeah, It works:



But If you take a look to the Task Administrator, there is a big problem: the CPU % use!!!:

The solution is quite simple, do not insert the while True: sentence in your code and run the python file using -i:


Works Much Better :D

Reference: http://stackoverflow.com/questions/1000900/how-to-keep-a-python-script-output-window-open

Tuesday, March 29, 2011

Dell Laptops: home vs business

Some time ago I had a question. What are the diferences between home and business dell laptops.


Here is a link to an article that explains that:
http://www.ehow.com/about_6122110_dell-consumer-vs_-business-laptops.html


Saturday, March 26, 2011

objectve c split string by end on line \n

NSString* answer;
......
...... (answer var is set and has a \n )
......

NSArray *firstSplit = [answer  componentsSeparatedByString:@"\r\n"];

Friday, March 25, 2011

printing addressBook multivalue identifier

ABMultiValueIdentifier identifier;

....
....
....


NSLog(@"identifier");
NSLog(@"%i" , identifier);

source: http://www.roseindia.net/tutorial/iphone/examples/nslog/nslogintegerexample.html

Assertion failed: (((ABCMultiValue *)multiValue)->flags.isMutable), function ABMultiValueAddValueAndLabel

I Had this code

ABMultiValueRef multiPhone = ABRecordCopyValue(person, kABPersonPhoneProperty);
// here y was getting the error: Assertion failed: (((ABCMultiValue *)multiValue)->flags.isMutable), //function ABMultiValueAddValueAndLabel
ABMultiValueAddValueAndLabel(multiPhone, @"1111111111", kABOtherLabel ,NULL);

It was because, in order to add some values to multiPhones var, this had to be mutable, it means to be ABMutableMultiValueRef type, so:

ABMultiValueRef multiPhones = ABRecordCopyValue(person, kABPersonPhoneProperty);
ABMutableMultiValueRef multiPhone = ABMultiValueCreateMutableCopy(multiPhones);
ABMultiValueAddValueAndLabel(multiPhone, @"1111111111", kABOtherLabel ,NULL);

that's all.









Wednesday, March 23, 2011

Jasper Report Headings missing in Excel

When I export a report to excel from jasperserver there are no headers shown.

If you look in jasperreports.properties in the relevant server directory - for Tomcat it's in /webapps/jasperserver/WEB-INF/classes - you'll see the following lines:
#suppress page and column headers and footers when exporting to XLS
net.sf.jasperreports.export.xls.exclude.origin.band.1=pageHeader
net.sf.jasperreports.export.xls.exclude.origin.band.2=pageFooter
net.sf.jasperreports.export.xls.exclude.origin.band.3=columnHeader
net.sf.jasperreports.export.xls.exclude.origin.band.4=columnFooter
Comment these lines out and and re-run your reports and you should see the headers and footer.

Source: http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=72256