No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
18 Posted Topics
There are two methods in different classes public EmployeeBean viewEmployeeByID(String EmployeeID) public EmployeeBean findByID(String id) Given, the description of each method of what it supposed to do public EmployeeBean findByID(String id) This method should use the JDBC select statements to retrieve the record based on the given Employee ID, Store … | |
Actually when the main function is running in a class, it implictly speaks a Main thread is in running in background. public static void main(String[] args){ ...... } Now when we create a thread objects in the above function like this . For example : public class NewThread extends Thread … | |
I have three files 1. Bank Instance 2. Bank 3. Main // Bank Instance.java public class BankInstance implements Runnable { public Bank bank; public Thread t; public BankInstance(Bank bank,String nameOfCustomer){ this.bank = bank; t = new Thread(this,nameOfCustomer); t.start(); } public void run() { System.out.println("========================================================"); System.out.println("Initial amount in bank"+bank.displayAmount()); System.out.println("Amount after … | |
My Question was Write a program to collect and store all the cards to assist the users in finding all the cards in a given symbol. This cards game consist of N number of cards. Get N number of cards details from the user and store the values in Card … | |
#include <stdio.h> #include <stdlib.h> char* format(char* buffer,size_t size, const char* name,int quantity,int weight){ snprintf(buffer,size,"Item: %s Quantity: %d Weight: %d",name,quantity,weight); return buffer; } int main() { char *buffer = (char*)malloc(90); printf("%s\n",format(buffer,sizeof(buffer),"Axle",25,45)); return 0; } When i run the above program, i expect the output Item: Axle Quantity: 25 Weight: 45 But … | |
I have four files in c++ 1. BankAccount.h 2. BankDatabase.h 3. Main.cpp BankAccount.h #include <string> class BankAccount { public: BankAccount(int accNumber,const std::string& accName); void setAccNumber(const int accNumber); int getAccNumber() const; void setAccName(const std::string& clientName); std::string getAccName() const ; protected: int mAccNumber; std::string mAccName; }; BankAccount::BankAccount(const int accNumber, const std::string& accName):mAccNumber(accNumber),mAccName(accName){} … | |
I have four files in c++ 1. BankAccount.h 2. BankDatabase.h 3. Main.cpp //BankAccount.h #include <string> class BankAccount { public: BankAccount(int accNumber,const std::string& accName); void setAccNumber(const int accNumber); int getAccNumber() const; void setAccName(const std::string& clientName); std::string getAccName() const ; protected: int mAccNumber; std::string mAccName; }; BankAccount::BankAccount(const int accNumber, const std::string& accName):mAccNumber(accNumber),mAccName(accName){} … | |
There was a question in topcoder. Question: Three kids are playing the following game: A word is written on a sheet of paper, and one after another, the players take turns adding letters to the word. During each turn, a player must add a single letter to either the beginning … | |
Q 1) In this small snippet #include <stdio.h> void passingAddressOfConstants(const int* num1 , int* num2) { *num1 = num2; } int main(){ const int limit = 100; int result = 5; passingAddressOfConstants(&limit,&limit); } Error : error: invalid conversion from 'const int*' to 'int*' Here I defined "limit" is of type … | |
import java.util.*; class occult { public static void main(String[] args){ int n = 2; for (int i = 0; ; i++){ if(Integer.toString(i).contains("666")){ if ( n == 1 ) System.out.println(i); n -= 1; } } } } I have written the above java code into c++ . i wanted to know … | |
records = [ ('foo',1,2), ('bar','hello'), ('foo',3,4), ] def do_foo(x,y): print 'foo\t{0}{1}'.format(x,y) def do_bar(s): print 'bar\t{0}'.format(s) for tag , *args in records: if tag == 'foo': do_foo(*args) elif tag == 'bar': do_bar(*args) when i run the above program , i get invalid syntax .I dono why this happens? Can someone help … | |
Re: Can you explain me how this part "[1,0][n>1]" works ? | |
from collections import deque def search(lines,pattern,history=5): previous_lines = deque(maxlen=history) for line in lines: if pattern in line: yield line,previous_lines previous_lines.append(line) if __name__ == "__main__": with open('history') as f: for line,prevlines in search(f,'python',5): for pline in prevlines: print( pline , end ='') print('-' * 20) Can someone help me to understand … | |
The perl command is perl /opt/translation/moses/scripts/tokenizer/tokenizer.perl -l en < Eng-hin.translation.en > Input/tokenization/Eng-hin.translation.tok.en I want to execute the above perl command in python script ,Here the perl command is executed successfully in Popen() but no output file is created at location "Input/tokenization/Eng-hin.translation.tok.en". var = "-l en < Input/Corpus/"+inputfilename+" > Input/tokenization/Eng-hin.translation.tok.en" pipe … | |
header : [u'ID', u'Hindi', u'Telugu'] 1 .[u'hhd1', u'\u0924\u093e\u091c\u093e\\JJ \u0938\u093e\u0901\u0938\u0947\u0902\\N_NN \u0914\u0930\\CC_CCD \u091a\u092e\u091a\u092e\u093e\u0924\u0947\\JJ \u0926\u093e\u0901\u0924\\N_NN \u0906\u092a\u0915\u0947\\PR_PRP \u0935\u094d\u092f\u0915\u094d\u0924\u093f\u0924\u094d\u0935\\N_NN \u0915\u094b\\PSP \u0928\u093f\u0916\u093e\u0930\u0924\u0947\\V_VM \u0939\u0948\u0902\\V_VAUX \u0964\\RD_PUNC', u'\u0c24\u0c3e\u0c1c\u0c3e\u0c36\u0c4d\u0c35\u0c3e\u0c38\\JJ \u0c2e\u0c30\u0c3f\u0c2f\u0c41\\CC_CCD \u0c2e\u0c3f\u0c32\u0c2e\u0c3f\u0c32\\JJ \u0c2e\u0c46\u0c30\u0c3f\u0c38\u0c47\\V_VM_VNF \u0c26\u0c66\u0c24\u0c3e\u0c32\u0c41\\N_NN \u0c2e\u0c40\\PR_PRP \u0c35\u0c4d\u0c2f\u0c15\u0c4d\u0c24\u0c3f\u0c24\u0c4d\u0c35\u0c3e\u0c28\u0c4d\u0c28\u0c3f\\N_NN \u0c35\u0c3f\u0c15\u0c38\u0c3f\u0c66\u0c2a\u0c1c\u0c47\u0c38\u0c4d\u0c24\u0c3e\u0c2f\u0c3f\\V_VM_VF .\\RD_PUNC'] Data explanation The first column is the id of the sentence The second column is the sentence in hindi language The third column … | |
How to seperate two languages(English,Hindi) in python This is my Sample data 1 . wikiner2013inflected 1-1 1.000 Sharaabi शराबी 2 . ted 1-1 1.0 politicians do not have permission to do what needs to be done. राजनीतिज्ञों के पास जो कार्य करना चाहिए, वह करने कि अनुमति नहीं है . … | |
Is there any way to reflect the value of n in cost function globally . so that the value of n in getLeastCost function with be changed instead of n = 0 class TheShuttles: def getLeastCost(self,baseCost,seatCost,cnt): n = 0 def cost(x): n = sum( m / x + (m % … | |
Value of set(sum(french,())) = set(['mardi', 'pass\xc3\xa9', 'voyez', 'envoy\xc3\xa9', 'membres', 's\xc3\xa9lection', 'peut', 'remplissaient', '\xc3\xa9t\xc3\xa9', 'prononcent', 'travaux', 'd\xc3\xa9terminent', 'trop', 'lib\xc3\xa9raux', 'd\xc3\xa9clar\xc3\xa9', 'dont', 'le', 'mais', 'la', '(', ',', 'internationales', 'Les',.....]) tm = {('se', 'est', '-', 'il', 'pass\xc3\xa9'): [phrase(english='has happened', logprob=0.0)], ('pos\xc3\xa9e',): [phrase(english='asked', logprob=-0.261521458626)], ('le', 'cours', 'de', 'les', 'deux', 'prochaines'): [phrase(english='the next two', logprob=0.0)], … |
The End.