Monday, May 21, 2012

Relation between dimensions of a body and pixels in box2d iphone

Could anyone tell me about the relation between the dimensions of a body and number of pixels(in box2d). How many pixels contributes to one meter length?
To be more specific, I'm using the below line of code in my program



polygon_body.SetAsBox(1, 1);



In this code what are the parameters of SetASBox. I mean whether it is a pixel value or some other units.





Getting custom linear unique id in oracle in select statement based on Date

I have an oracle table such as this.



enter image description here



I want to get a custom unique id in the format Mon-YY/unique number in the select statement



The result would look like(see the column UNIQUEORDERID)



enter image description here



Is it possible to achieve the result in select statement?
Please help me write the query.



Thanks,
Sajad





how to send an object from jsp to servlet

I have an object that is being sent successfully from a servlet to a jsp.
In that jsp page I have a button and when user click on that button the same object should be sent from that jsp page to another servlet. how can I do that ??





Wednesday, May 16, 2012

Saving SQL Server backup file in multiple parts

I am taking daily backups of a SQL Server database. Right now the .bak file is about 2GB and it is growing day by day. There is a scheduled job is running which moves this .bak file from one location to another.



Is there a way to save the .bak file in chunks - like part1.bak, part2.bak etc..



so it will be much easier to move small data and merge at destination?





How can write texts in OPENG window at c#

I want to know , how can i write texts in opengl window at c#. i use opentk tools for drawing
i would pleased for say me what code i must to use in c#.



tanx a lot





facebook like and share count shows same number

I am having fb-like and fb-share button on my page, but when i click like or share button, the count in like and share increases simultaneously.



As for example like count = 4 and share count = 3
after liking my web page Like count =5 and share count = 5



This is the problem



enter image description here





rspec let method + loop

i am having trouble running my rspec examples in a loop.



  describe "GET all providers" do
let(:current_user) { Factory(:user) }

[:twitter, :facebook, :google_oauth2].each do |provider|
before :each do
current_user.confirm!
sign_in current_user

request.env['devise.mapping'] = Devise.mappings[:user]
request.env["omniauth.auth"] = OmniAuth.config.add_mock provider, {
:uid => '123456789',
:info => {
:email => current_user.email
}
}
end

it 'should add the authorization' do
get provider # method to create the authorization
authorization = Authorization.where(:provider => request.env["omniauth.auth"][:provider], :uid => request.env["omniauth.auth"][:uid]).first
current_user.authorizations.should include authorization
end
end
end


currently these examples all pass. the problem though is that current_user is a new user instance through each iteration of the loop, despite memoizing the current_user method. so if i add a test for current_user.authorizations.count.should == 3 it fails.



this became less of needing to actually test it, and more understanding why it isnt behaving how i expect. shouldn't let(:current_user) { Factory(:user) } persist the same user instance across all examples?