24 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for letters1417

Hello! I have to print patterns using '*' and I am at a loss how to get these patterns printed! I figured out the first one, * ** *** **** ***** ****** ******* ******** ********* ********** and now i have to do it upside down: ********** ********* ******** ******* ****** …

Member Avatar for JamesCherrill
0
2K
Member Avatar for nikk8a

Hello, I have a string which consists of tokens enclosed in square brackets []. I need to identify these and process the string to replace them with some other derived values. I am unable to get list of tokens via Pattern matching. Below is my code snippet. String str = …

Member Avatar for nikk8a
0
239
Member Avatar for sarthak25
Member Avatar for dany12

Hy I want to understand what is a better approach on problem solving point of view for a php project , a framework or the mvc pattern? I would like to add that I know that both principels are quite the same but with a minor diffrence that a framework …

Member Avatar for dany12
0
368
Member Avatar for PhilEaton

Here is the code: var Circle = function( radius ) { var _radius = radius, _area = function() { return Math.PI * _radius * _radius; }, _perimeter = function() { return 2 * Math.PI * _radius; }; this.radius = _radius; this.area = "Area" + _area(); this.perimeter = "Perimeter" + _perimeter(); …

Member Avatar for PhilEaton
0
153
Member Avatar for magicmarkuk

Hi I have a site built on Wordpress which has a over 4,000 posts all with the suffix -2 at the end of the post name (due to me forgetting to clear the trash) before running an import). I would like to remove the -2 from the post names with …

Member Avatar for magicmarkuk
0
279
Member Avatar for solomon_13000

I wrote a code to represent the factory design pattern as below: package com.factory2; public interface CreditCheck { Double creditLimit(int id); } package com.factory2; public class CreditCheckFactory { public boolean isAgencyUp(){ return true; } public CreditCheck createCreditCheck(){ if(isAgencyUp()){ return new CreditCheckOnline(); }else{ return new CreditCheckOffline(); } } } package com.factory2; …

Member Avatar for JamesCherrill
0
280
Member Avatar for solomon_13000

I wrote the following code: package com.chain; public interface Chain { void setNext(Chain chain); void process(int number); } package com.chain; public class ProcessNegative implements Chain{ private Chain chain; public void setNext(Chain chain){ this.chain = chain; } public void process(int number){ if(number < 0){ System.out.println("Negative"); }else{ chain.process(number); } } } package …

Member Avatar for solomon_13000
0
235
Member Avatar for solomon_13000

I am attempting to load an 3 icon image but my code doesn't do so: package com.proxy; import java.awt.Component; import java.awt.Graphics; import javax.swing.ImageIcon; import javax.swing.JFrame; public class ImageIconProxy extends ImageIcon implements Runnable{ static final ImageIcon ONE = new ImageIcon("/IFDesign/images/green.jpg"); static final ImageIcon TWO = new ImageIcon("/IFDesign/images/yellow.jpg"); ImageIcon CURRENT = ONE; …

Member Avatar for solomon_13000
0
361
Member Avatar for solomon_13000

Base on my understand a mediator is a central authority that varies the interaction between objects in the same group. So can I classify the code below as a mediator? package com.mediator; public class BaseMediator { public void store(){ System.out.println("store"); } public void retrieve(){ System.out.println("retrieve"); } } package com.mediator; public …

Member Avatar for solomon_13000
0
223
Member Avatar for Bchandaria

Any one can help me out i want to display a spiral of n*n size with out using arrays? out put when n=2 should be 3 2 0 1 when n=3 should be 8 7 6 1 0 5 2 3 4 when n=4 should be 15 14 13 12 …

Member Avatar for ahmedhamdy
0
3K
Member Avatar for klemme

I have this pattern which finds links, inside a text string from file_get_contents function. Works fine, it seems. But I am curious to understand the expression, each charachter of it, what it does etc. Here you go: preg_match_all('~href=("|')(.*?)\1~', $var, $out); I know what it does obviously, but what does (.*?)\1~ …

Member Avatar for klemme
0
182
Member Avatar for vilas_tadoori

**Pyramid Pattern** Dear Listers, I am in the process of wrting a java code that prints the following pattern 123454321 1234*4321 123***321 12*****21 1*******1 This is the code that I have written as public class Pyramid { public static void main(String[] args) { int j; for (int i=1; i<5; i++) …

Member Avatar for NormR1
0
986
Member Avatar for blackmagic01021

Hello, I have a observer pattern based JTable. With time it is poulated with new data packets. I use addRow functionalities to add my rows. But I want to put always the last coming datapackets at the top. How to do it??

0
127
Member Avatar for DanOath

I am supposed to write a method to display a pattern as follows: ________1 _______21 ______321 _____4321 ____54321 ___654321 __7654321 _87654321 987654321 (underscores are simply placeholders to show alignment on my post they are not actually part of the printout) My program works and prints the aforementioned code correctly, however …

Member Avatar for zeroliken
0
397
Member Avatar for CY0T3R

1 1 0 1 0 1 1 0 1 0 1 0 1 0 1 How To Print The Above Pattern ?? (Using For-Loops Only)

Member Avatar for ravenous
0
193
Member Avatar for letters1417

Okay so this is another question printing patterns but this time using input! I have to prompt the user and read an odd number from the input. I can only use System.out.print('*'); System.out.print(' '); and System.out.println(); I need to maximize my use of repetition and minimize the number of output …

Member Avatar for DavidKroukamp
0
511
Member Avatar for klemme

Hi guys, It is working fine, and only allowing letters and numbers. I want to a feature, so that it has to be between 3-20 charachters/numbers long. [CODE] if (!preg_match("/^[A-Za-z0-9]+$/i", $_POST['brugernavn'])){ $dosomething = ''; } [/CODE] This is not working: [CODE] if (!preg_match("/^[A-Za-z0-9]{3-20}+$/i", $_POST['brugernavn'])) [/CODE]

Member Avatar for klemme
0
4K
Member Avatar for radovanov

Hello, I'm totally out of luck with creating a working patternt to match for my preg_match. What I would like to do is, create a pattern that will match sentenses in a bunch of text.. It should recognize a word that has a capital letter and take it as the …

Member Avatar for radovanov
0
112
Member Avatar for crazy_perl

Hi, I am new to the perl scripting and need your help regarding one issue. I have a piece in my perl script which looks something like below - if ($rec{user} =~ /Major |Minor |Low |High /oxi ) { print "Reject" . $_ . "\n"; next; } Now the list …

Member Avatar for crazy_perl
0
166
Member Avatar for justinwarner

Hey, So, in our book (I'm doing them for practice, I don't know if we have to actually do them), it says to display the pattern: [CODE] J A V V A J A A V V A A J J AAAAA V V AAAAA JJ A A V A …

Member Avatar for justinwarner
0
3K
Member Avatar for kate2mba

Wirte a regular expression pattern to match all words ending in s. This is what I got but seems like im thinking to hard on it, plus of course its not working lol Please help! :) [CODE]import re str = "Subs are everwhere" print (str) matchObj = re.match(".*?s ",str,re.L|re.I) if …

Member Avatar for kate2mba
0
147
Member Avatar for Perlhelp

Hi, I want to search the log file for a string and extract all data until the end of that line where the search string is found. For example: A line in the file reads like below: [28/04/2010 11:17:53 GMT]PositionPoolCalculation.java(339):getPosCalculation[INFO]BUNP: B123456:1234567:ABCD ANP: B123456:1234567:ABCD:2 post LCN: DESabcdefgh I want to search …

Member Avatar for Perlhelp
0
128
Member Avatar for kyumi419

hello~ Write a program that will display a pattern depending on n. Assume n as a one digit odd number. Example: if n=9, display *000*000* 0*00*00*0 00*0*0*00 000***000 how will i start doing this type of problem? ^^

Member Avatar for kyumi419
0
202

The End.