Vishal Bhadur Verma

+ Follow
since Apr 01, 2015
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vishal Bhadur Verma


I am involved in a product development project where we create MSI file of the project through WIX code using #SharpDevelop. We rebuild the solution from sharp develop and it generates a msi file in target floder.
The input to sharp develop is a .sln file on which we run rebuild solution . Now we are in a process to create this msi through jenkins. So I am looking for options where i can build a MSI file using .sln file as input through command line.

Any help is most welcomed.

5 years ago
Hi All,

As i am new to JSF-Primefaces , I was trying to make two drop down. first is for the country and on change of the country i will list cities in the next drop down. But my p;ajax action is not getting invoked.
Please find the below code snippet :

ajaxFirst.xhtml ;

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns=""

<h3>AJAX TEST 123</h3>
<h:outputText value="Country: " />
<h:selectOneMenu id="countries" value="#{}">
<f:selectItems value="#{}" />
<p:ajax listener="#{partialProcessingController.handleCountryChange}" event="valueChange" process="@this"/>
<f:attribute name="item" value="#{problem}"/>
<h:outputText value="City: " />
<h:selectOneMenu id="cities" value="#{}">
<f:selectItems value="#{}" />
<h:outputText value="Email: " />
<h:inputText value="#{}"
required="true" />

Bean = "partialProcessingController"

import java.util.ArrayList;
import java.util.List;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.event.ValueChangeEvent;

public class CountryStates implements Serializable {

private List<String> country = new ArrayList<String>();
public List<String> getCountry() {
return country;

public void setCountry(List<String> country) { = country;

public List<String> getCity() {
return city;

public void setCity(List<String> city) { = city;

private List<String> city = new ArrayList<String>();
private String email;

public void countryList(){

public void handleCountryChange(ValueChangeEvent event)
String problem = (String) event.getComponent().getAttributes().get("item");
if (problem=="India")
if (problem=="USA")
if (problem=="Russia")


public String getEmail() {
return email;

public void setEmail(String email) { = email;

I have tried using f:ajax , still action not getting invoked. Then i tried with valueChangeListener and still the same result. Please help in this concern.

6 years ago
I have deleted it and started with a new approach which has been stated above.
6 years ago
Hi Piet,

Thanks for your suggestion. But I found a way to my problem that is using Fibonacci series I can get the number of combinations of step I need to take.
But in my case I have a little twist, I need to print the combinations . That is for 4 steps I need to print 5 way those are :
1 1 1 1
1 2 1
1 1 2
2 1 1
2 2

I tried it with recursion but was unsuccessful so erased it and started with non recursive mode. I need help in writing a code for this.
6 years ago

Jesper de Jong wrote:Ok, so you already have an idea about how to solve the problem. Good that you thought about that before writing code - one mistake that many people make is trying to write code immediately, before they have even thought about what they need to do.

What's stopping you from writing code for this? Did you try writing anything? If yes, then please post your try here. Please explain us what part exactly you're having trouble with.

static Set set = new HashSet();
public static int countWaysToJump(int N) {

int[] a = new int[N-1];
String s ="";
for (int i=0;i<N;i++)

for (int j=0;j<N;j++)
int sum =0;
sum =a[j];
int k =j+1;
if ((N-1)-k>=2)// taking it as 2 beacause we can skip at max 2 steps
s =s+(a[k]+a[k+1]);
int l= (k+1)+1;


return 1;


I started like this but with this I am getting [1111],[121] but for getting [112] I need another iteration. I am thinking I will mess this code by doing this. That's why searching for suggestions ?
6 years ago
Hi All,

A set of stairs has N steps.You can jump either 1 or 2 steps at a time.For example, if the stairs is N=4 steps, you can reach the end in 5 possible ways: 1-1-1-1, or 1-2-1 or 1-1-2 or 2-1-1 or 2-2
I have to write a code to print all the possible ways.

My Approach to this is : I first created a array with size N (4 in this case) and fill all indexes of the array with 1.
1 1 1 1
now I will iterate a loop with max size of N and start with index 0. I will check that if the array.lenght - I > 2 , I will add the array[I+1] + array[I+2] with condition max addition can be done for 2 places only.

but I am not able to write a proper program for this.. Anyone can help me on this.
6 years ago
I found the solution for this and this is working fine :

public class ReversingHashMap {

* @param args
public static void main(String[] args) {
Map<String,String> map = new HashMap<String,String>();
Map<String, Set<String> > newmap = new HashMap<String, Set<String> >();

map.put("1", "a");
map.put("2", "a");
map.put("3", "b");
map.put("4", "b");
System.out.println("before Reversing");
for (Map.Entry<String, String> entry : map.entrySet())
System.out.println("The key ::"+entry.getKey()+":: The value"+entry.getValue());

for (Map.Entry<String, String> entry : map.entrySet())
String oldVal = entry.getValue();
String oldKey = entry.getKey();
Set<String> newVal = null;

if (newmap.containsKey(oldVal))
newVal = newmap.get(oldVal);
newVal= new HashSet<>();

newmap.put(oldVal, newVal);


System.out.println("After Reversing");
for (Map.Entry<String, Set<String>> entry : newmap.entrySet())
System.out.print("The key ::"+entry.getKey()+":: The value"+entry.getValue());

6 years ago
Hi All,

I have interesting question on hash map and it says :

I have a hash map with values : {"1-a","2-a","3-b","4-b"}
Keys Values
1 a
2 a
3 b
4 b

I need to swap the key values with losing the data , means the new hash map should be :
Keys Values
a 1,2
b 3,4

Any suggestion on this ?
6 years ago
Is it throwing any error ? If yes. Please post it

I think you have use @Path("/city").
6 years ago

Campbell Ritchie wrote:That is of course the correct thing to do in an interview. Interview questions are different from real‑life questions.

I was terrified with few question , SO never asked him for clarification. In addition to this he asked me this :

"How we can create jars from the client stubs?" and I was like why I will do that. I nodded my head as no to this.
I don't know how to create jars from the client stubs...
6 years ago

Chan Ag wrote:Yea, the requirement that 'in it when some element is put then we can get different element' sounds vague. I'm guessing either the interviewer didn't frame the question well or perhaps the OP hasn't stated exactly what was asked.

The idea of adding an element and getting a different element as a result of adding an element sounds uncommon, if not weird. However if the interviewer just meant that the data structure should allow you to return an element at random ( any element -- in no specific order ) from the data structure, you could use a randomization logic for returning the element from any datastructure based on the linked lists ( the general term ) / arrays. You could even use a shuffling operation.

Why do you think you might require data manipulation for returning an item?

By Manipulation I meant while storing the element I would have change the inserting element into some random element.. Like if I am storing integers in array and while inserting I would have multiplied the inserting integer with a random number and would have stored it. So if in case it will return a different number.
6 years ago
Hi All,

Recently asked this question : "What features make spring a framework?"
I know this is very simple question but never considered it .

According to me : Spring IOC makes spring as framework as it take care of the bean life cycle.

Please correct me if wrong
6 years ago

Tim Cooke wrote:That's quite vague.

What was your answer?

I answered him : That for getting a different element we need to perform some data manipulation while storing the value or we need to give out a different element on enquiring of some other element. Which will be wrong as per implementation.
So what I can do for above requirement is just manipulate the value while insertion. He then moved to another question.
6 years ago
Hi All,

I was asked this question in recent interview ?

"Create a data structure named “Magic box” in it when some element is put then we can get different element"

Any Idea ?
6 years ago

Tim Cooke wrote:I think what your interviewer was getting at is more like this scenario:

When you want to populate the dependency in another class.

How do you use Spring's Autowire feature to specify what implementation of Country gets injected?

ooh Got it.. I can use @Qualifier tag in this case
But all three beans will declared individually in application context with different bean id .. Right ?
6 years ago