If you want to put 2 zeros before the number 7, do this:
print "%03d Agent!!" % ( 7 )
The output will be: 007 Agent!!
Just a little tip =)
Tips 2 Solve
Friday, June 11, 2010
Thursday, May 20, 2010
Java Applet not working on Mac Leopard and Firefox 3
You must update the java plugin at sourceforge.
Steps..
1 - Download the latest plugin here;
2 - Unzip and move the extracted files to /Applications/Firefox.app/Contents/MacOS/plugins overwriting the existent files;
3 - Restart the browser;
Solved!
Steps..
1 - Download the latest plugin here;
2 - Unzip and move the extracted files to /Applications/Firefox.app/Contents/MacOS/plugins overwriting the existent files;
3 - Restart the browser;
Solved!
Monday, April 26, 2010
[JSTL] According to TLD or attribute directive in tag file, attribute items does not accept any expressions
The cause:
Version incompatibility between JSP, Servlet and JSTL.
Solution:
You will have to open the web.xml file in WEB-INF folder and check if the DTD version is correct.
Example:
<web-app xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" c="http://java.sun.com/jsp/jstl/core" schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
</web-app>
The version above is 2.5 so you have to change to 2.4 or 2.3.
Matching versions are listed below:
- JSP 1.2 , Servlet 2.3 , JSTL 1.0;
- JSP 2.0 , Servlet 2.4 , JSTL 1.1;
Using the correct Servlet version the error won't be displayed anymore.
Solved!
Version incompatibility between JSP, Servlet and JSTL.
Solution:
You will have to open the web.xml file in WEB-INF folder and check if the DTD version is correct.
Example:
<web-app xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" c="http://java.sun.com/jsp/jstl/core" schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
</web-app>
The version above is 2.5 so you have to change to 2.4 or 2.3.
Matching versions are listed below:
- JSP 1.2 , Servlet 2.3 , JSTL 1.0;
- JSP 2.0 , Servlet 2.4 , JSTL 1.1;
Using the correct Servlet version the error won't be displayed anymore.
Solved!
Sunday, April 25, 2010
The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application
The problem happens because you didn't declare the tag libs in your web.xml file.
Follow the steps:
1 - If you are using the newest version of JSTL ( 1.0.6 ) then you can find the tld files at "tld" folder, else you have to extract the standard jar and search into folders;
2 - Put the tld file in WEB-INF folder;
3 - Open web.xml at WEB-INF folder and write the declaration below:
<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/fmt.tld</taglib-location>
</taglib>
4 - Make sure that you are calling:
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
on top of your JSP page;
5 - Restart your server if it's running and..
Solved!
Follow the steps:
1 - If you are using the newest version of JSTL ( 1.0.6 ) then you can find the tld files at "tld" folder, else you have to extract the standard jar and search into folders;
2 - Put the tld file in WEB-INF folder;
3 - Open web.xml at WEB-INF folder and write the declaration below:
<taglib>
<taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
<taglib-location>/WEB-INF/fmt.tld</taglib-location>
</taglib>
4 - Make sure that you are calling:
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
on top of your JSP page;
5 - Restart your server if it's running and..
Solved!
Saturday, April 24, 2010
How to remove MySQL Server completely from Mac OS X Leopard
The process isn't deductible so you need to know the files and folders that the MySQL installer changes.
To remove completely, make sure MySQL Server is not running and follow the instructions below:
Part 1:
1 - Open Terminal;
2 - sudo nano /etc/hostconfig;
3 - Enter your password;
4 - Delete the following line: “MYSQLCOM=-YES-”;
5 - Control + X ( to close );
6 - Enter Y ( to save );
--
Part 2:
Open Terminal and run the following commands:
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm /etc/my.cnf
Solved!
This solution was found in Tom Keur's Blog.
To remove completely, make sure MySQL Server is not running and follow the instructions below:
Part 1:
1 - Open Terminal;
2 - sudo nano /etc/hostconfig;
3 - Enter your password;
4 - Delete the following line: “MYSQLCOM=-YES-”;
5 - Control + X ( to close );
6 - Enter Y ( to save );
--
Part 2:
Open Terminal and run the following commands:
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
sudo rm /etc/my.cnf
Solved!
This solution was found in Tom Keur's Blog.
Wednesday, April 21, 2010
SQL Server 2008 Designer Behavior Change: Saving Changes Not Permitted
Are you having this message when you are trying to change a table Design (columns type, name and etc..)?
It's easy to resolve:
In Microsoft SQL Server Management Studio click on "Tools > Options".
Expand "Designers" and click on "Table and Database Designers".
Uncheck the option "Prevent saving changes that require table re-creation".
Try again,..
and..
Solved!
It's easy to resolve:
In Microsoft SQL Server Management Studio click on "Tools > Options".
Expand "Designers" and click on "Table and Database Designers".
Uncheck the option "Prevent saving changes that require table re-creation".
Try again,..
and..
Solved!
Constructor method is not setting the attributes - iPhone Development
Are you facing with "out of scope" message when you debug your code and after the class allocation you call the constructor method passing some initialization variables?
I'll show you a wrong and a correct method respectively:
-(void)initWithName:(NSString*)n andNickName(NSString*)n2
{
// this is a wrong method.
self.name = n;
self.nickName = n2;
}
--
-(void)initWithName:(NSString*)n andNickName(NSString*)n2
{
// this is a correct method.
self = [super init];
self.name = n;
self.nickName = n2;
[self retain];
}
If you don't know about "retain and memory management" click here.
Solved.
I'll show you a wrong and a correct method respectively:
-(void)initWithName:(NSString*)n andNickName(NSString*)n2
{
// this is a wrong method.
self.name = n;
self.nickName = n2;
}
--
-(void)initWithName:(NSString*)n andNickName(NSString*)n2
{
// this is a correct method.
self = [super init];
self.name = n;
self.nickName = n2;
[self retain];
}
If you don't know about "retain and memory management" click here.
Solved.
Labels:
debug,
debugging,
initWithName,
iPhone,
memory management,
Objective C,
Objective-C,
out of scope,
release,
retain,
scope,
super init
Subscribe to:
Posts (Atom)