Hello, i know this question has been asked a million times but I just cant seem to get it right. I googled and found [this](https://stackoverflow.com/questions/19611599/html5-phone-number-validation-with-pattern#19611675) and tried to use the pattern given but still the pop up still shows. I don't know what im doing wrong but its getting frustrating as obviously it worked for the person but not for me unfortunately. <input type="tel" name="phone" placeholder="+60##-#######" pattern="/^(7|8|9)\d{9}$/" title="7878787878" required> as you can see what i wanted is a pattern for +60##-####### but couldn't figure it out so as i said i tested with the one from the link but when …

Member Avatar
Member Avatar
+0 forum 5

Hi all. I am new in C language. I am learning to program by using C for my first step. Now I am reading a chapter about looping (while, for, do.. while, nested loop). In my exercise book, the question is about to: Using nested loop to print out this one, ![678cd8de74d71462869e5d8593263743](/attachments/small/3/678cd8de74d71462869e5d8593263743.JPG "align-left") But, I managed to print like this one, ![d4a699824481fc0c48c1c5809093577a](/attachments/small/3/d4a699824481fc0c48c1c5809093577a.JPG "align-left") by using this code, #include <stdio.h> int main(void) { int x; int y; for(x=1; x<=5; ++x) { for(y=x; y<=5; ++y) { printf("*"); } printf("\n"); } return 0; } How can I print out like a first one?? …

Member Avatar
Member Avatar
+0 forum 6

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: ********** ********* ******** ******* ****** ***** **** *** ** * and backwards: ********** _********* __******** ___******* ____****** _____***** ______**** _______*** ________** _________* and _________* ________** _______*** ______**** _____***** ____****** ___******* __******** _********* ********** this is the code i have for the first one: [CODE] for (int i =0; i < 10; i++) { for (int …

Member Avatar
Member Avatar
+0 forum 16

Hi All, Usually in factory method we need to check the existance of object based on given argument and then need to return the object and due to this we need to have multiple if and else statement and while adding one more type then again one more else block with comparision block need to be added there. can anybody let me know how to achieve same without adding if-, else block or switch statement and even i needn't to compile the code. Circle* Circle::create_instance(string name) { if(name == "BlueCircle") { return new BlueCircle; } else if(name == "GreenCircle") { …

Member Avatar
Member Avatar
+0 forum 3

If you draw a series of close spaced shapes your eyes get fooled to see Moire patterns. Here is one example of this.

Member Avatar
+2 forum 0

I have a program that creates a right triangle from a loop reading "*". I have used the code to complete the first part, but the second part calls for a manipulation to take the current pattern, flip it upside down, and then add it to the first pattern. Here is the code I have so far. Can anyone guide me through how to do the reverse loop, I was thinking another loop and a nested loop within to call the opposite pattern? public static void main (String[] args) { final int LIMIT = 10; for (int row = 1; …

Member Avatar
Member Avatar
+0 forum 15

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 = "test [text1] text [text2]"; Pattern p = Pattern.compile("(\\[\\w+\\])"); Matcher m = p.matcher(str); if (m.find()) { System.out.println(m.group()); } This returns the output: [text1] My input string can contain any combination of tokens i.e. [text] can be anywhere in the string. Could anyone please let me know what am I missing in …

Member Avatar
Member Avatar
+0 forum 2

I have been looking for a solution to isolate markings and have not found anything on the internet that is close to for what I am looking. I am trying to isolate the markings in a series of pictures. I have one, unmarked image. I then have a series of identical images with markings. I would like to remove the original image from the succeeding images leaving only the markings "floating" on a white background. I have removed the color from the images, but that leaves the black and white original markings. I am looking for any hints, ideas, comments, …

Member Avatar
Member Avatar
+0 forum 5

Hi all, I would like to pose a design pattern to discussion that is achieved in two different ways. Imagine the situation where you have an interface "IFoo" (aka virtual) and implementations "FooA", "FooB", ... that inherit and implement "IFoo". Now you want the user (of the library you are creating, thus user of the source code) to use the "FooA", "FooB", ... but you dont want the user to have to mess with all the different "FooX"s. Instead you want to create a "wrapper" / "top" "Foo" which shall be used by the users and that "Foo" shall handle …

Member Avatar
Member Avatar
+0 forum 8

Hey Daniweb! What's a good site, or maybe someone could write up a quick-and-dirty example of a desktop app showing how to use the Model View Controller pattern? I'm no slouch at google-fu and found this lovely example through Wikipedia: http://www.songho.ca/opengl/gl_mvc.html which I'll look at after class tonight. I'd still like any examples you could provide. Thanks, Daniweb!

Member Avatar
Member Avatar
+0 forum 1

Hi guys I want to develop a pattern recognition system for my final year project. The system will be an interface between a blind person and a mute person; I have chosen android platform for the system as most smart phones use it. I want the smart phone to use its camera to record the signs done by the mute person and then give audio as output. May you please advise how best can I capture the signs and give audio as output; or provide links that you think might be of help. Thank you in advance.

Member Avatar
Member Avatar
+0 forum 2

Guys, I need to write thread safe singleton class for my assignment. below is the code snippet for factory method in singleton class, I will appreciate if anyone is having suggestion for the same. *MySingleton * MySingleton::GetInstance() { if (m_pOnlyOneInstance == NULL) { pthread_mutex_lock(&mutex); m_pOnlyOneInstance = new MySingleton(); pthread_mutex_unlock(&mutex); } return m_pOnlyOneInstance; }

Member Avatar
Member Avatar
+0 forum 14

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 was made by someone else and has his style applied to it and a mvc pattern you build your own classes and templates and create it in your own style. My concern regarding the mvc pattern is that a application build from scartch is harder to do and create a …

Member Avatar
Member Avatar
+0 forum 5

// CS 1063 Project 1: Print Text Patterns The Patterns Class Objectives This is one of three major programming projects this semester. You may NOT collaborate on this project. While you may ask for assistance in debugging, this project should be ENTIRELY your own work. [EDITED BY ADMIN ON COPYRIGHT GROUNDS...]

Member Avatar
Member Avatar
-2 forum 5

is it possible to input your name, middle name and surname and then will display initilas in large block letter made up of same character it represents???

Member Avatar
Member Avatar
+0 forum 6

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 a little bit of SQL so that for example my-example-post-2 becomes my-example-post and so on. The table is wp-posts and the field is post_name. I tried update wp_posts set post_name = replace(post_name,'-2',''); but this didn't work, I suspect but not sure, it may be because it looking for an actual …

Member Avatar
Member Avatar
+0 forum 2

I found some reading materials about factory design pattern (parallel hierarchy) whereby a class in a hierarchy has a corresponding class in the another hierarchy. So I wrote the code as below: package com.factory3; public abstract class Subject { abstract SubjectPlanner createPlanner(); } package com.factory3; public class English extends Subject{ public SubjectPlanner createPlanner(){ return new EnglishPlanner(this); } } package com.factory3; public class Mathematic extends Subject{ public SubjectPlanner createPlanner(){ return new MathematicPlanner(this); } } package com.factory3; import java.util.Date; public abstract class SubjectPlanner { private Subject s; public SubjectPlanner(Subject s){ this.s = s; } public abstract Date getAvailable(); } package com.factory3; import …

Member Avatar
+0 forum 0

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; public class CreditCheckOffline implements CreditCheck{ public Double creditLimit(int id){ return 21.00; } } package com.factory2; public class CreditCheckOnline implements CreditCheck{ public Double creditLimit(int id){ return 20.00; } } package com.factory2; public class Test { public static void main(String[] args){ CreditCheckFactory ccf = new CreditCheckFactory(); CreditCheck cc1 = ccf.createCreditCheck(); System.out.println(cc1.creditLimit(8)); CreditCheck …

Member Avatar
Member Avatar
+0 forum 1

I wanted to verify is this a good example of a flyweight design pattern: package com.flyweight; public interface Chemical { String getName(); String getSymbol(); Double getAtomicWeight(); } package com.flyweight; import java.util.HashMap; import java.util.Map; public class ChemicalFactory { private static Map chemicals = new HashMap(); private static ChemicalFactory factory = new ChemicalFactory(); class ChemicalImpl implements Chemical{ private String name; private String symbol; private Double atomicWeight; public ChemicalImpl(String name, String symbol, Double atomicWeight){ this.name = name; this.symbol = symbol; this.atomicWeight = atomicWeight; } public String getName() { return name; } public String getSymbol() { return symbol; } public Double getAtomicWeight() { return …

Member Avatar
Member Avatar
+0 forum 3

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 com.chain; public class ProcessPositive implements Chain{ private Chain chain; public void setNext(Chain chain){ this.chain = chain; } public void process(int number){ if(number>0){ System.out.println("Positive"); }else{ chain.process(number); } } } package com.chain; public class ProcessZero implements Chain{ private Chain chain; public void setNext(Chain chain){ this.chain = chain; } public void process(int number){ …

Member Avatar
Member Avatar
+0 forum 3

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; protected String fileName; protected JFrame callBackFrame; public ImageIconProxy(String fileName){ super(ONE.getImage()); this.fileName = fileName; } public void load(JFrame callBackFrame){ this.callBackFrame = callBackFrame; CURRENT = TWO; callBackFrame.repaint(); new Thread(this).start(); } public void run(){ CURRENT = new ImageIcon(fileName); callBackFrame.pack(); } public int getIconWidth() { return CURRENT.getIconWidth(); } public int getIconHeight(){ return CURRENT.getIconHeight(); } …

Member Avatar
Member Avatar
+0 forum 4

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 class Consumer extends BaseMediator { private BaseMediator b; public Consumer(BaseMediator b){ this.b = b; } } package com.mediator; public class Producer extends BaseMediator { private BaseMediator b; public Producer(BaseMediator b){ this.b = b; } } package com.mediator; public class Driver { public static void main(String[] args){ BaseMediator mediator = new …

Member Avatar
Member Avatar
+0 forum 2

Hi I have a scenario that i need to implement. the scenario is below. I have a class handler and a class Healthmonitor. every 10 seconds i have to send a msg to HealthMonitor to update a variable. in one point if it didnt send a msg in a multiple of 10 seconds HealthMonitor DO SOMETHING ELSE How do i implement this. can someone give an idea to achieve this appreciate it thanks

Member Avatar
Member Avatar
+0 forum 5

If you draw shapes that are closely spaced and shifted, you can create interesting interference patterns, so called moire patterns. Here is an example using the Python module PyGame to do the drawing.

Member Avatar
+2 forum 0

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 04 03 02 11 05 00 01 10 06 07 08 09

Member Avatar
Member Avatar
+0 forum 7

What would be the best way (or any way) to print out a pattern, that may cut off at any point dependant on the x & y length? for example, if i wanted a pattern 4 up (y = 4) and 14 across (x = 14) I would need it to print: m//m//m//m//m/ m//m//m//m//m/ m//m//m//m//m/ m//m//m//m//m/ I'm thinking a nested for loop so: for(i=1; i<y; i++){ //then another thing inside so that would make 4 lines total, but with the pattern printing along the x axis… but how?? Thanks in advance for any help given. Michael

Member Avatar
Member Avatar
+0 forum 8

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 and this 1 2 3 4 2 3 4 5 3 4 5 6 4 5 6 7

Member Avatar
Member Avatar
+0 forum 11

I am trying to make this pattern in python but stuck, any help please? Ashley http://images.colourbox.com/thumb_COLOURBOX3492089.jpg

Member Avatar
Member Avatar
+0 forum 2

Hi All, I have a factory which has some concrete sub classes for generating reports (.txt, .csv,.xls) I want to make the interface of the concrete classes to be generic so that i can pass in diff types of parameters (Instead of DataTable i need to use DataSet or some other class instance as argument). Here is my previous interface. interface IReportCreator { bool Create(DataTable dt); } I made the interface as generic..like the one below interface IReportCreator<T> { bool Create(T args); } Now my question is how can i return the generic interface from the Factory My previous factory …

Member Avatar
Member Avatar
+0 forum 1

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~ do? What does this ~ mean? Is that just the start and end delimeter used i this case? So that could also be // (start, end)? Finally, any good simple source where I can read up on these expressions, from beginner to more advanced level? All the best, Klemme

Member Avatar
Member Avatar
+0 forum 3

The End.