Tuesday, 17 September 2013

Cannot pop() more than once from the static stack

Cannot pop() more than once from the static stack

I need to use a static stack in one of my android application. Here's how
i used it:
In the Constants File:
public static Stack<String> st = new Stack<String>();
And in the Activity File, inside the onBackPressed method following logic
is used:
if (!Constants.st.isEmpty()) {
Log.i("CHECK", "Stack is not empty.");
Log.v("CHECK", "PEEK: " + Constants.st.peek());
Constants.st.pop();
if(Constants.st.isEmpty()){
Log.i("CHECK", "Stack is empty.");
}else{
Log.v("CHECK", "PEEK after POP: " + Constants.st.peek());
}
}else{
Log.i("CHECK", "Stack is empty.");
}
Now when i press back button once it works (i mean pop() function works),
then second time it( pop() function ) doesn't. Here is the Log of the
above logic:
: Stack is not empty.
: PEEK: UI_FirstActivity
: Stack is empty.
: Stack is not empty.
: PEEK: UI_SecondActivity
: PEEK after POP: UI_FirstActivity
: Stack is not empty.
: PEEK: UI_FirstActivity
: PEEK after POP: UI_FirstActivity
PS: Another thing is that whenever all these UI.. functions contains
different dynamically created forms shown on the same activity. Now when
we enter/show any method/form its name i.e., UI.. is been pushed in the
stack.

create a global NSMutableArray

create a global NSMutableArray

I have a lot of View Controller and all use the same Class (ViewController).
In ViewController.m I have this code:
- (void)viewDidLoad
{
[super viewDidLoad];
pedidoNomeArray = [[NSMutableArray alloc] init];
pedidoValorArray = [[NSMutableArray alloc] init];
}
and when I go to View Controller number 2 my array pedidoNomeArray and
pedidoValorArray are null.
What I have to do to use the same array in all my View Controllers?
thanks

How can I chain a scope after a class method, or ignore the class method's default sorting?

How can I chain a scope after a class method, or ignore the class method's
default sorting?

I need to find a workaround so I can filter my @events by the .is_near
method then sort them by the .sort_today scope, in that order.
Individually they both work, and I can tack .is_near to the end of the
scope with no problem, but then my results are resorted by the default
sort parameters in .is_near, and I need to them to be sorted by
.sort_today.
Is there a way to ignore how .is_near returns/resorts my results? Or
someway to chain them together like
@events.is_near(session[:city]).sort_today? Currently I get this error
when chaining them like that: undefined method `sort_today' for
#Array:0x007f8ca3c673c0
Here's my models:
class Venue < ActiveRecord::Base
attr_accessible :name, :address, :latitude, :longitude
has_many :events, :dependent => :destroy
geocoded_by :address
def self.is_near(city)
self.near(city, 20, :units => :km).map(&:events).flatten
end
end
class Event < ActiveRecord::Base
attr_accessible :title, :details, :start_time, :end_time, :date, :cost,
:venue_id
belongs_to :venue
scope :is_today, where(:date => Date.today)
scope :sort_today, is_today.order(:start_time)
class << self
def is_near(*args, &block)
Venue.is_near(*args, &block)
end
end
end
So Venue is geocoded by the RubyGeocoder gem and it has all the events.
The .is_near method has to be in Venue because the latitude and longitude
properties are there. The .is_near method at the bottom of Event is
essentially a redirect. (I tried to get delegate to work, but this was the
only way I could do it)
Here's my controllers:
class EventsController < ApplicationController
def index
@events = Event.sort_today.is_near(session[:city]) #returns results
but sorted wrong
#@events = Event.is_near(session[:city]).sort_today #returns undefined
method `sort_today' error
end
end
class ApplicationController < ActionController::Base
before_filter :set_city
def set_city
unless session[:city].present?
session[:city] = request.location.city
end
end
end
The set_city method just gets what city the user enters through a input
field.

is not convertible by 'QueryStringConverter'

is not convertible by 'QueryStringConverter'

I'm still a little new to WCF, I have a service that takes as input an
object that contains a bunch of string properties, but when I try to
consume the service I get the following error:
Operation 'GetHouseholds' in contract 'IHouseholdService' has a query
variable named 'criteria' of type
'RGMPServices.Householding.Contracts.DataTransferObjcets.HouseholdSearch',
but type
'RGMPServices.Householding.Contracts.DataTransferObjcets.HouseholdSearch'
is not convertible by 'QueryStringConverter'. Variables for UriTemplate
query values must have types that can be converted by
'QueryStringConverter'.
how do I go about making an object 'QueryStringConvertable'??
I have contract which looks like this:
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json)]
HouseholdDto[] GetHouseholds(HouseholdSearch criteria);
And the implementation is this:
public HouseholdDto[] GetHouseholds(HouseholdSearch criteria)
{
IList<Household> households =
_kernel.Get<IHouseholdRepository>().Search(criteria);
IList<HouseholdDto> dtos = Mapper.Map<IList<Household>,
IList<HouseholdDto>>(households);
return dtos.ToArray();
}
And my data contract for the object to be passed in is this:
[DataContract(Namespace = "urn:RGMPServices.Householding.Services", Name =
"HouseholdSearch")]
public class HouseholdSearch : IHouseholdSearch
{
[DataMember(IsRequired = false, Name = "HouseholdNumber")]
public string HouseholdNumber { get; set; }
[DataMember(IsRequired = false, Name = "HouseholdName")]
public string HouseholdName { get; set; }
[DataMember(IsRequired = false, Name = "AccountNumber")]
public string AccountNumber { get; set; }
[DataMember(IsRequired = false, Name = "AccountName")]
public string AccountName { get; set; }
[DataMember(IsRequired = false, Name = "IaCodes")]
public string IaCodes { get; set; }
[DataMember(IsRequired = false, Name = "Category")]
public string Category { get; set; }
}

Meteor bundle ignores folder and file

Meteor bundle ignores folder and file

There exists a app/main/document/temp.bin but this file is missing after I
run meteor bundle.
When I ran meteor bundle --debug the file got put inside
`bundle/programs/client/app/main/document/temp.bin
so how can I make meteor bundle work?

Customer view for Team Foundation Service

Customer view for Team Foundation Service

My team recently migrated from onsite to the cloud Team Foundation Service
2012.
We had also maintained a separate SharePoint portal with extranet
capabilities to list projects/tasks etc. for external customers
Seeing that we're now online, I was wondering if there is a means to
restrict a view to PBIs/Certain properties of tasks [Time Elapsed, Time
Remaining] for certain accounts.
Alternatively, I recall seeing SSRS capabilities in the on site version.
Is there a means to configure reports (scheduled/manual) using the Team
Foundation Service?

Sunday, 15 September 2013

Jsp Project for data selection

Jsp Project for data selection

I will explain with an example.I have a set of 20 question,I randomly
select 5 questions.Once I select these 5 questions I dont want them to
appear in those 20 questions.Similarly next I will have 15 questions
left,if I select 10 random questions I will have just 5 remaining.At last
when I select the last 5 questions.The next time I open the page I need to
get all 20 questions back.Could someone suggest me an idea,this is a jsp
project,I am using mysql as the database.Thank you.