Hi,
I'm using java servlets and jsp in my application and I need to read the remote XML file and properly render it into HTML and display on a web page...What is the technology used for reading process?Should I use HTTPURLConnection class to read the contents of the xml file or there is some other way?
And also,if I use servlet as a controller and JSP as a view,what would be the responsibility of servlet and jsp in this process?Should servlet just read the whole XML file and then just pass the read output to JSP which will just print it and render properly using XSL for example?
I really hope to hear from any people who may help,
With kind regards
I've implemented the following classes to validate data
public abstract class Validated
{
public bool IsValid { get { return (GetRuleViolations().Count() == 0); } }
public abstract IEnumerable<RuleViolation> GetRuleViolations();
}
public partial class User: Validated
{
public override IEnumerable<RuleViolation> GetRuleViolations()
{
if (this.Age < 1)
yield return new RuleViolation("Age can't be less than 1");
}
}
It works great! When the form is submitted I just do
if (user.IsValid == false) blah...
But I still need to validate that the Age is an integer
int a = 0;
if (!int.TryParse(age, out a))
{
error = "Not integer";
// ...
}
How can I move this to my model?
Note below how ã changes to a. NOTE2: Before you blame this on CMD.EXE and Windows pipe weirdness, see Experiment 2 below which gets a similar problem using File::Find.
The particular problem I'm trying to fix involves working with image files stored on a local drive, and manipulating the file names which may contain foreign characters. The two experiments shown below are intermediate debugging steps.
The ã character is common in latin languages. e.g. http://pt.wikipedia.org/wiki/Cão
Experiment 1
Experiment 2
To get around my particular problem, I tried using File::Find instead of piped input. The issue actually gets worse:
Debugging update:
I tried some of the tricks listed at http://perldoc.perl.org/perlunicode.html,
e.g. use utf8, use feature 'unicode_strings', etc, to no avail.
Environment and Version Info
The OS is Windows 7, 64-bit.
The Perl is:
This is perl 5, version 12, subversion 2 (v5.12.2) built for MSWin32-x64-multi-thread
(with 8 registered patches, see perl -V for more detail)
Copyright 1987-2010, Larry Wall
Binary build 1202 [293621] provided by ActiveState http://www.ActiveState.com
Built Sep 6 2010 22:53:42
Is there an ability to import fixed width file to oracle?
Preferably through .net(c#) for catching errors during import and showing them to user.
P.S. File has 5 types of rows. For example 1 row has 5 columns, 2-nd has 50 columns.
I've got a problem with using the XPATH functions. When I try to call some functions like lower-case or upper-case etc,they are not executed and I can't figure the problem out. I included the namespace xmlns:fn="http://www.w3.org/2005/xpath-functions" at the top of my XSL stylesheet and use fn namespace to call these functions but anyway nothing is working. Can anyone explain the reason and what I should do in order to be able to use the following functions?
Cheers
Originally I though I'll just take a screenshot of my app on the iPhone then tweak it in Photoshop.
The images should be 480 x 320 according to Apple doc, and the dimensions of my screenshot are 480 x 320. But, the screenshot contains notification area (where reception bars, battery life, etc. are displayed)
So, if I chop that part off my image will be a bit shorter and not 480px high.
What do I do? Submit a shorter image? Stretch it up so it's 480px but without the notification bar? Submit it with the notification bar in the image?
How did you create your Default.png?
I have following code.
But AddGameComponent doesn't draw.
protected override void Initialize()
{
// TODO: Add your initialization logic here
base.Initialize();
var li = new LicenseInformation();
IsTrial = li.IsTrial();
if (IsTrial)
{
AdGameComponent.Initialize(this, AppID);
Components.Add(AdGameComponent.Current);
CreateAd();
}
}
private void CreateAd()
{
bannerAd = AdGameComponent.Current.CreateAd(AdUnitID, new Rectangle(x, y, width, height), true);
AdGameComponent.Current.Enabled = true;
}
I have tried to set DrawOrder to 1000, but ads still doesn't work.
Hi, I have a python subprocess call which I would like to link up to three pipes (two standard in and one standard out). I know that there is only one /dev/stdin, but there's all those other devices in /dev I don't know about, and don't know of any python os, sys or subprocess modules that will utilise them in a manner which allows me to give the device path to subprocess.Popen.
The reason I ask is because I would like to pipe information from a mysql database or tar archive rather than a directory structure I currently have which has 28,000 directories in. The directory names alone uses a LOT of space! The alternative is to tar / gunzip the entire directory structure and manoeuvre through the compressed archive. With either solution, mysql or tar, I would still like to have two pipes into subprocess.Popen and one out, so that I can bypass the HDD.
Any need for an example??
If you are familiar with Django, you know that they have a Authentication system with User model. Of course, I have many other tables that have a Foreign Key to this User model.
If I want to delete this user, how do I architect a script (or through mysql itself) to delete every table that is related to this user?
My only worry is that I can do this manually...but if I add a table , but I forget to add that table to my DELETE operation...then I have a row that links to a deleted, non-existing User.
i have a function which is a class method, and i want to test a attribute of the class which may or may not be None, but will exist always.
class classA():
def __init__(self, var1, var2 = None):
self.attribute1 = var1
self.attribute2 = var2
@classmethod
def func(self,x):
if self.attribute2 is None:
do something
i get the error
AttributeError: class classA has no attribute 'attributeB'
when i access the attribute like i showed but if on command line i can see it works,
x = classA()
x.attributeB is None
True
so the test works.
if i remove the @classmethod decorator from func, the problem disapears.
if i leave the @classmethod decorator, it only seems to affect variables which are supplied default values in the super-class's constructor.
whats going on in the above code?
In R, what is the most efficient way to count the length between 2 values. for example, i have vector x , which are all randomly choose from 1 to 100, how can i find out the length between the first"2" and first"40",
x=(1,2,3,4,5,6,7,40,1,2,3,21,4,1,23,4,43,23,4,12,3,43,5,36,3,45,12,31,3,4,23,41,23,5,53,45,3,7,6,36)
for this vector, the answer should be 5 and 6
say i have 5 summary for 5 sets of data. how can i get those number out or combine the summary in to 1 rather than 5
V1 V2 V3 V4
Min. : 670.2 Min. : 682.3 Min. : 690.7 Min. : 637.6
1st Qu.: 739.9 1st Qu.: 737.2 1st Qu.: 707.7 1st Qu.: 690.7
Median : 838.6 Median : 798.6 Median : 748.3 Median : 748.3
Mean : 886.7 Mean : 871.0 Mean : 869.6 Mean : 865.4
3rd Qu.:1076.8 3rd Qu.:1027.6 3rd Qu.:1070.0 3rd Qu.: 960.8
Max. :1107.8 Max. :1109.3 Max. :1131.3 Max. :1289.6
V5
Min. : 637.6
1st Qu.: 690.7
Median : 748.3
Mean : 924.3
3rd Qu.: 960.8
Max. :1584.3
how can i have 1 table looks like
v1 v2 v3 v4 v5
Min. :
1st Qu.:
Median :
Mean :
3rd Qu.:
Max. :
or how to save those number as vector so i can use matrix to generate a table
How do YOU debug a Scala program? I mean YOU as in the person posting the Answer :) Please answer only from personal experience, not from stuff you've heard or read on the Internet. You should not believe everything you read on the Internet, especially tales of complex open-source software configurations that actually work :-)
The are many Java tools which claim to support Scala in some way or another, but I have so far struck out in trying to get any one of them to actually let me set a breakpoint in Scala code and step through it. These are big, major open-source IDEs I'm talking about here.
The main problem in getting a debugger to work seems to be the "version hell" with fast-changing IDEs, Plug-Ins, JDKs, and the Scala language itself.
Hence the second part of my question, which is really the most important part: What is the exact version number of the IDE, Plug-In, JDK, Scala, and even Operating System, that you are successfully using?
My question is related to this one, but wider in scope:
http://stackoverflow.com/questions/2272705/how-to-debug-scala-code-when-outside-of-an-ide
Thanks
I have 2 z-index layers in a map application I'm building. I have a problem when I click on the layers to zoom in. The click handler is on the underlying z-index layer and I don't want it to fire when a control in the overlying layer is clicked.
The problem i have is that the event gets raised no matter what but the originalTarget property of the event is not the image in the underlying layer when something on the top layer is clicked. Is there anyway to change this?
Not sure if this kind of help is accepted to ask for here, tell me if it isn't.
It has to get done before tomorrow, it's not entirerly finished but it should work somewhat ok by now. I'm trying to use the Eclipse debugger (not very used to it).
I have my top-level or main class, which is Game, in which I have a constructor and a main method. In the main method I create a new "Game", initiating the constructor.
public static void main(String[] args){
Game chess = new Game();
}
public Game(){
Board board = new Board();
That's the first thing the debugger reacts to:
Thread [main] (Suspended)
ClassNotFoundException(Object).<init>() line: 20 [local variables unavailable]
ClassNotFoundException(Throwable).<init>(String, Throwable) line: 217
ClassNotFoundException(Exception).<init>(String, Throwable) line: not available
ClassNotFoundException.<init>(String) line: not available
URLClassLoader$1.run() line: not available
AccessController.doPrivileged(PrivilegedExceptionAction<T>, AccessControlContext) line: not available [native method]
Launcher$ExtClassLoader(URLClassLoader).findClass(String) line: not available
Launcher$ExtClassLoader.findClass(String) line: not available
Launcher$ExtClassLoader(ClassLoader).loadClass(String, boolean) line: not available
Launcher$AppClassLoader(ClassLoader).loadClass(String, boolean) line: not available
Launcher$AppClassLoader.loadClass(String, boolean) line: not available
Launcher$AppClassLoader(ClassLoader).loadClass(String) line: not available
Game.<init>() line: 15
Game.main(String[]) line: 11
Line 11 is the one line in my main method, line 15 is the instantiation of "board".
Hi,
I have the following problem. After I uninstall the project - all folder is removing. But it contains the files which shouldn't be deleted. What could you advice me?
Ideally I would haeve the option which will be proposed to the user while uninstall with checkbox if it is necessary to delete this folder or not.
Thank you in advance!
I'm getting really desperate trying to add a UIImageView to UITableViewCell.backgroundView. All my efforts have resulted in this crappy rendering:
It looks like the cell's label's white background is sitting on top of cell's background and covering portions of it.
I tried setting the label's background color to clear, or some other color and it does not have any event. It is always white.
The reason I know it's the text label's background causing this white area is that if I don't do [cell setText:@"Cell text here"]; the white area is gone and I see just the cell's background image.
Here's the code that I'm using. The table view is added in the .xib file and UITableView is added to UIViewController:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [myCollection.items count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSUInteger rowIndex = indexPath.row;
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"darkCellBackground.png"]];
cell.selectedBackgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"darkCellBackground.png"]];
}
[cell setText:@"Cell text here"];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here. Create and push another view controller.
// AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil];
// [self.navigationController pushViewController:anotherViewController];
// [anotherViewController release];
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
return NO;
}
I'm sure I'm doing something wrong but cant quite figure out what.
What's the best solution for embedding non-web fonts into a page without using Flash and still maintaining cross-browser support? Has anyone used any JavaScript libraries for this? Thanks.
Hi. We're building a site and wish to build for the same set of browsers Google Apps/Docs and YouTube support. Though not recommended, they seem to be detecting specific browsers/versions vs. features/functionality. What's the best way to support a minimum set of browsers while displaying a message to the users of older browsers to upgrade? What's the minimum set of browsers that the major sites are supporting? Thanks.
I'm in the process of creating an SSIS package on a server (server1) that looks at the data in a sql db on another site (server2) and copies relevant rows across.
The SQL statement required is:
SELECT *
FROM server2.ordersTable
WHERE
OrderID Not In (SELECT OrderID FROM server1.ordersTable
This selects data from server1 which isn't in the table on server2 (based on order id)
I then need to insert the result into a table on server1
How would I approach this? What components do I need etc...?