Thursday, April 21, 2011

Cold Shooting Through Foot

Generate Excel files with Python


pyExcelerator is a Python module created by Roman V. Kiselyov to read and write data in Excel format. You need a superior to the 2.4 version of python. The advantage (say) to use this module to other as CSV is that it allows unicode formats, reads / writes well in both OpenOffice and Microsoft Office and has a very simple API.


Install module Ubuntu

$ sudo apt-get install python-Excelerator


Basics

Once installed, go back to basics. Begin to write something. Saying that if we unload the module http://sourceforge.net/projects/pyexcelerator/ in it there are many examples that can guide us to what we will do. ____________________________________________



import from pyExcelerator

* # Instance objects
the workbook = Workbook () worksheet = workbook.add_sheet
( "my first sheet" )

# Write a row
worksheet.write ( 1 , 1 , "Example" )
# Save the content
workbook.save ( 'file.xls' ) ______________________________________



What you do is instantiate a workbook and a sheet. We can create as many worksheets as you want. Then write in the position (1.1) Example word and save the name file.xls.


Format

can also write in different fonts, colors, italics , etc. This can be done by the Font class module. With the font, we show you all properties necesarias. 

______________________________________
 
from  pyExcelerator import  *

# Instance the objects
workbook = Workbook()
worksheet = workbook.add_sheet( "my first sheet" )


# Style  

font = Font()
font.name  = "Arial"
font.colour_index = 1
font.bold = True
style = XFStyle()
style.font = font
# Write

worksheet.write ( 1 , 1 , "Example" , style)

# Save the content
workbook.save ( 'file.xls' )

______________________________________

This can also be done on the style object, as used internally Font.


Reading CSV

able to read and process the data, we parse_xls function, which we pass a file and coding, which can be utf-8. This function returns all the leaves worksheet and values, so we have to go and for example, inserted into an array. Listed below are a complete example of how to do this. The following code is an adaptation of the author's code examples directory.


Complete Example ______________________________________

# -*- coding: utf-8 -*-

# This example adapted from WAS Roman V. Kiselyov
# in examples section project

from  pyExcelerator import  *

class   Excel ( object ):
     def   __init__ (self, name_space= '0' ):
        self.column = 0
        self.row = 0
        self.workbook = Workbook()
        self.worksheet = self.workbook.add_sheet(name_space)

     def   write_row (self, content):
        self.column = 0
         for  i in  content:
            self.worksheet.write(self.row, self.column, i)
            self.column += 1
        self.row += 1

     def   write_with_format (self, content, bold= False , name= 'Arial' , colour_index= 4 ):
        font = Font()
        font.name = name
        font.colour_index = colour_index
        font.bold = bold
        style = XFStyle()
        style.font = font
        self.column = 0
         for  i in  content:
            self.worksheet.write(self.row, self.column, i, style)
            self.column += 1
        self.row += 1    

     def   save (self, filename= 'file.xls' ):
        self.workbook.save(filename)

     @ classmethod
     def   read (self, filename, coding= 'utf-8' , verbose= False ):
         for  sheet_name, values in  parse_xls(filename, coding):
            matrix = [[]]
             if  verbose:
                 print   'Sheet = "%s"'  % sheet_name.encode(coding,   'backslashreplace' )
                 print   '----------------'
             for  row_idx, col_idx in   sorted (values.keys()):
                v = values[(row_idx, col_idx)]
                 if   isinstance (v, unicode ):
                    v = v.encode(coding, 'backslashreplace' )
                 else :
                    v = `v`
                v = '%s'  % v.strip()
                last_row, last_col = len (matrix), len (matrix[- 1 ])
                 while  last_row <= row_idx:
                    matrix.extend([[]])
                    last_row = len (matrix)
                 while  last_col < col_idx:
                    matrix[- 1 ].extend([ '' ])
                    last_col = len (matrix[- 1 ])
                matrix[- 1 ].extend([v]    
             if  verbose:
                 for  row in  matrix:
                    csv_row = ', ' .join(row)
                     print  csv_row
         return  matrix

if  __name__ == '__main__' :
     print 'Generating xls ........... ' ,
header = [ ' Name ' , ' Surname ' , ' ID ' ]
excel = Excel ()
excel.write_with_format (header, bold = True )
data = [ u'Tutú ' , u'Tiñi ' , '1239812H ' ]
excel.write_row (data) data =
[ u'Kaká' , u 'Asd' , '8712382H ' ]
excel.write_row (data)
excel.save ()
print 'ok'

print 'Reading data ........... '
Excel.read ( ' file.xls' , verbose = True )
print '................... ok '
______________________________________

This module contains many more things. Formula writing, images, styles, conversion to html, etc. In the examples section of the project can be seen in detail all this.


References
  • pyExcelerator project

Thursday, March 24, 2011

Dressy Dresses And Booties

Schizotypal personality TRANSTRON

It is a mental health condition in which a person has difficulty with interpersonal relationships and disturbances in thought patterns, appearance and behavior.
Causes and risk factors

The exact cause is unknown. It is believed that genes are involved, because this condition is more common in relatives of schizophrenics.

The schizotypal personality disorder should not be confused with schizophrenia. People with this personality disorder may have bizarre beliefs and behaviors, but are not disconnected from reality and usually do not hallucinate.

hallucinations, delusions (fixed beliefs and false) and lost contact with reality are hallmarks of psychosis. People with schizotypal personality disorder generally do not have psychotic symptoms.

Between 30 and 50% of people with schizotypal personality disorder also suffer from major depressive disorder. A second personality disorder, and paranoid personality disorder is also common with this condition.


Symptoms People suffering from schizotypal personality disorder can be very disturbing and odd behavior may resemble that of people with schizophrenia. For example, can also unusual preoccupations and fears, like fear of being monitored by government agencies.

However, it is more common for people with this disorder behave in a slightly strange and have unusual beliefs (aliens, witchcraft, etc..). These They cling so tightly to these beliefs that this prevents them from developing interpersonal relationships.

People with schizotypal personality disorder become disturbed by the difficulty in establishing and maintaining close relationships. This is different from people with schizoid personality disorder, not wishing to engage in interpersonal relationships. Signs and tests


Some of the common signs of schizotypal personality disorder include:


discomfort in social situations Inappropriate displays of feelings of close friends
No Odd behavior or appearance

beliefs, fantasies, or preoccupations


foreign language Treatment

Some people may serve antipsychotic medications. Psychological therapy (psychotherapy) is a large part of treatment. The guidance in social skills can help some people cope with social situations.
Expectations (prognosis)

The schizotypal personality disorder is usually a long-term (chronic). The outcome of treatment varies with the severity of the disorder. Complications


Poor social skills Lack of interpersonal relationships


Call

care Talk to your doctor or a mental health professional if:

have trouble forming and keeping relationships due to unusual beliefs.
suspect that your child may have this problem.



Prevention There is no known prevention. Be aware risks, such as family history of schizophrenia, may allow early diagnosis.

2010 Yamaha Waverunner® Vx110 Deluxe

DEPENDENT PERSONALITY DISORDER

is a long-term condition (chronic) condition in which people depend too much on others to meet their physical and emotional needs.
Causes and risk factors

The dependent personality disorder usually begins in childhood and their causes are unknown. One of the personality disorders more frequent and is equally common in men and women. Symptoms


People with this disorder do not trust their own ability to make decisions. You may be devastated by separation and the loss of someone and can do whatever, even suffering abuse, to stay in a relationship.

symptoms of dependent personality disorder may include:


Avoid being alone avoid personal responsibility
be easily hurt by criticism or disapproval
Focusing too much on the fears of being abandoned
Becoming very passive in interpersonal relationships
Feeling very upset or helpless when relationships end
Having difficulty making decisions without the support of other
Have problems expressing disagreements with others



Signs and tests Like other personality disorders, the dependent personality disorder is diagnosed based on a psychological evaluation as well as the history and severity of symptoms. Treatment


psychological therapy (psychotherapy) is considered the most effective treatment gradually help people with this condition make more independent choices in life. Medication can help treat other conditions such as anxiety or depression.
Expectations (prognosis)

Improvements are usually seen only with long-term therapy. Complications

Alcohol or drug


Depression Increased likelihood of sexual abuse or physical and emotional abuse

Call

care for an appointment with a physician or mental health professional if you or your teenager has symptoms of dependent personality disorder. Alternative Names


personality disorder-type dependent

Lauren London Natural Hair

DISORDER OF DEPRESSION

rastorno avoidant personality
version Print itSend this page to a
amigoCompartir
is a psychiatric condition in which a person has a lifelong pattern of being very shy inadequate, and sensitive to rejection.
Causes factors
risk
Personality disorders are patterns of behavior for life that cause problems in relationships and at work.

Approximately 1% of the population has avoidant personality disorder and occurs equally in men and women. The cause is unknown. Symptoms


People with personality disorders Avoidant can not stop thinking about their own shortcomings and form relationships with others only if they believe they will be rejected. Loss and rejection are so painful that these people prefer to be alone rather than risk trying to connect with others. Signs and tests


disorder A person with avoidant personality may:

Be easily hurt when people are critical or disapproving
Refrain too intimate
be reluctant to engage with people
Avoid activities or occupations that involve contact with others
Be shy in social situations for fear of making a mistake Make
potential difficulties seem worse than they are
maintain the view that it is socially good, which is not as good as other people or that is unattractive



Treatment Antidepressants can often cause people to be less sensitive to rejection. However, psychological therapy (psychotherapy) is considered the most effective treatment for this condition.

Psychodynamic therapy, which helps patients understand their thoughts and feelings, and cognitive behavioral therapy (CBT) can help. Also, a combination of medication and psychotherapy may be more effective than either treatment alone.
Expectations (prognosis)

People with this disorder may develop some ability to relate to others and this can be improved with treatment. Complications


Without treatment, a person with this disorder may become resigned a life characterized by total or near total isolation. They may go on to develop a second psychiatric disorder such as substance abuse or a mood disorder like depression. Call
care

Ask your doctor or psychiatrist if shyness or fear of rejection overwhelms your ability to function in life and in interpersonal relationships. Alternative Names


avoidant personality disorder