pattern

CRUD Pattern JSF

Hi All, i have a task of education to create an aplication that implement CRUD pattern in java with JSF framework.. is there any one help me to explain about CRUD pattern in java and example code of that (CRUD pattern code).. Thank you very much for all. ...

.NET Regular Expression: Get paragraphs

I'm trying to get paragraphs from a string in C# with Regular Expressions. By paragraphs; I mean string blocks ending with double or more \r\n. (NOT HTML paragraphs <p>)... Here is a sample text: For example this is a paragraph with a carriage return here and a new line here. At this point, second paragraph starts. A paragraph en...

Return a result set in numeric pattern / sequence

I have a problem in hand and that is to fetch a result set in a numeric pattern / sequence based on a single column's value. Say I have the following table: +-------+ | val | +-------+ | 1 | | 1 | | 1 | | 1 | | 2 | | 2 | | 2 | | 2 | | 3 | | 3 | | 3 | | 3 | +-------+ How can I make...

Save Changes Button

Hi, I'm working on a project about user contributed recipes and connecting them in different ways. One of the things that i used to do without thinking is whenever there is an edit form e.g. whenever the user is editing a recipe, i redirect the user to a relevant page, the Save Changes button would redirect to the recipe page, or the re...

Why are the parentheses so important when assigning this regex match?

I have a piece of code: $s = "<sekar kapoor>"; ($name) = $s =~ /<([\S\s]*)>/; print "$name\n"; # Output is 'sekar kapoor' If the parentheses are removed in the second line of code like this, in the variable $name: $name = $s =~ /<([\S\s]*)>/; # $name is now '1' I don't understand why it behaves like this. Can anyone...

tar: add all files and directories in current directory INCLUDING .svn and so on

Hi all, I try to tar.gz a directory and use tar -czf workspace.tar.gz * The resulting tar includes .svn directories in subdirs but NOT in the current directory (as * gets expanded to only 'visible' files before it is passed to tar I tried to tar -czf workspace.tar.gz . instead but then I am getting an error because '.' has changed...

How to decide on controllers for web application?

I use php and usually structure my application into model-view-controller so its always accessed via index.php with class and method attributes. Class attribute passed as part of URL specifies controller class and method simply method to be called. This seems to be pretty common, but then I'm always having trouble in figuring out what c...

How to add noConflict to a JS module pattern?

Hey, I use the following pattern in my JS: var lib = { module_one: { init: function () { ... } }, module_two: { init: function () { ... } } }; Question is, whats the best way to add: (function ($) { ... })(jQuery); I tried to put it around the var lib, but that di...

Getting result using patters

Hi, I have a String looks like this String read = "1130:5813|1293:5803|1300:5755|1187:5731|" As you can see that there are 4 pair of integer values are there. i want to add there values into the list something like this a = 1130 b = 5813 groupIt pair = new groupIt(a,b); List<groupIt> group = new ArrayList<groupIt>(); group.add(...

Pattern of HASH characters (#) with Java loop

Hello i need a program that reads a number and then prints a square pattern of (#) hash. But each edge needs the same number of hashes eg enter a number: 5 ##### ##### ##### ##### ##### this is what i have so far import console; print("write a number: "); int n = readInt(); int nva=0; String i="#"; while (nva<n){ print(i); ...

MIDlet as singleton

Is it safe to implement a MIDlet class as a singleton? That is, after all, the Display class is acting like a singleton for each and every midlet so is the midlet itself a singleton by behaviour so that implementing it as such wouldn't break something? In other words, it is not possible to have two instances of an app running, is it? I ...

Slow JavaScript Regex when using global attribute

I am trying to replace strings in brackets in some html string. When I use a regular replace, its fast, when I try to create a pattern for global replace, it ends up throwing a stack overflow error. It seems like somewhere along the process path, it converts my single string to an array of characters. Any ideas? var o = { bob : 'is cool...

Singleton-Pattern ASP.NET C# for each user

Hi all, i'm building a web application with asp.net c# and i have a class that i want to use in multiple pages witouth instantiate it every time. I need to load the data in it and never lose them during the user session time. I thought about the singleton-pattern but it shared the instance of the class beetween browsers. How can i solve ...

makefile pattern rules without recipes

I'm observing an interesting behavior of make and I wonder if there is a reasonable explanation to it besides a bug in gmake. Let's say we have the following in makefile: %-animal: echo "$* is an animal" %-fox: %-fox-animal %-wolf: %-wolf-animal The difference between the last two targets is that "%-wolf" does not have any ...

String chomping match expression with bound variable

Hi, The following shell sessions shows some behavior I would like to understand: 1> A = "Some text". "Some text" 2> "Some " ++ R = A. "Some text" 3> R. "text" 4> B = "Some ". "Some " 5> B ++ L = A. * 1: illegal pattern Surely statements 2 and 5 are syntacticially identical? I would like to use this idiom to extract some text from a s...

Java pattern question - builder or db code in model?

I need to build a 'MyThingie' using 'A'. MyThingie is in the model package and currently no code in model accesses the DB. My question is which of the following patterns should I use? The top or bottom? Or something completely different. package com.model; public class MyThingie { private String foo = ""; private String bar...

how can i change the pattern in php?

i got this pattern for searching purpose for mysql from third party javascript. im assuming its html pattern, which can be converted, anyone have any idea on this? pattern A%5B%D9%8B-%D9%93%D9%B0%5D*L%5B%D9%8B-%D9%93%D9%B0%5D*L%5B%D9%8B-%D9%93%D9%B0%5D* ...

Java Regular Expressions using Pattern and Matcher

Hi All, my question is related to Regular Expressions in Java, and in particular, multiple matches for a given search pattern. All of the info i need to get is on 1 line and it contains an alias (e.g. SA) which maps to an IP address. Each one is separated by a comma. I need to extract each one. SA "239.255.252.1", SB "239.255.252.2...

regex to pull out strings inside #if debug #endif block

Hi I have an application with a large number of #if debug blocks which kind of look like the the one below: #if DEBUG Console.ForegroundColor = ConsoleColor.DarkCyan; Console.WriteLine("oldXml: " + oldXml.OuterXml); Logging.Log("XmlDiff: " + diff_sb.ToString()); ...

How do I specify a negative pattern in an svn:ignore value

I'm using SVN as my VCS. I have a folder where I keep user-uploaded files. Obviously I don't need those under version control. However, there is a single file in the folder, which I need - .htaccess. It's already under version control, but how do I specify that I need all other files besides .htaccess ignored in that folder? I've come...