Search Results

Search found 93 results on 4 pages for 'nikhil vaghela'.

Page 1/4 | 1 2 3 4  | Next Page >

  • Equal Gifts Algorithm Problem

    - by 7Aces
    Problem Link - http://opc.iarcs.org.in/index.php/problems/EQGIFTS It is Lavanya's birthday and several families have been invited for the birthday party. As is customary, all of them have brought gifts for Lavanya as well as her brother Nikhil. Since their friends are all of the erudite kind, everyone has brought a pair of books. Unfortunately, the gift givers did not clearly indicate which book in the pair is for Lavanya and which one is for Nikhil. Now it is up to their father to divide up these books between them. He has decided that from each of these pairs, one book will go to Lavanya and one to Nikhil. Moreover, since Nikhil is quite a keen observer of the value of gifts, the books have to be divided in such a manner that the total value of the books for Lavanya is as close as possible to total value of the books for Nikhil. Since Lavanya and Nikhil are kids, no book that has been gifted will have a value higher than 300 Rupees... For the problem, I couldn't think of anything except recursion. The code I wrote is given below. But the problem is that the code is time-inefficient and gives TLE (Time Limit Exceeded) for 9 out of 10 test cases! What would be a better approach to the problem? Code - #include<cstdio> #include<climits> #include<algorithm> using namespace std; int n,g[150][2]; int diff(int a,int b,int f) { ++f; if(f==n) { if(a>b) { return a-b; } else { return b-a; } } return min(diff(a+g[f][0],b+g[f][1],f),diff(a+g[f][1],b+g[f][0],f)); } int main() { int i; scanf("%d",&n); for(i=0;i<n;++i) { scanf("%d%d",&g[i][0],&g[i][1]); } printf("%d",diff(g[0][0],g[0][1],0)); } Note - It is just a practice question, & is not part of a competition.

    Read the article

  • Ubuntu 11.04 does not detect my tata photon +

    - by nikhil
    I am trying to connect to the Internet via my photon+ from the past day and have tried various suggestions on the Internet and have tried to zero in to the main cause of the problem which is that my device is not detected. I have tried the following ways: 1) After connecting the device, I tried to create a mobile broadband connection via System Preferences Network Connections and selected tata photon plus. But there was no connection. 2) I did sudo apt-get install usb-modeswitch-data and sudo apt-get install usb-modeswitch But the prompt said that they are at their newest version. 3) I tried to edit the file sudo gedit /etc/usb_modeswitch.d/12d1:1446, but this file did not exist. 4) my lsusb output is nikhil@nikhil:~$ lsusb Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 003: ID 22f4:0021 Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 002: ID 04f2:b159 Chicony Electronics Co., Ltd Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Any Ideas ??

    Read the article

  • Silverlight TV 18: WCF RIA Services Validation

    Just prior to MIX10, Nikhil Kothari appears on the show to demonstrate some of the key advantages around validation when using WCF RIA Services. He demonstrates how to use a Domain Service to expose your domain model and how to create a custom service method to further filter your data server side. Nikhil also shows how the Domain Services generates validation rules using the database attributes such as required fields or maximum string lengths. Other topics Nikhil covers: Domain service generated...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • what is the difference between response.redirect and response status 301 redirects in asp ?

    - by Nikhil Vaghela
    Our asp application is moving to new server and i want to implement a permenant url redirection. I am aware of following two approaches , i need to understand which one to user over other and when ? Option 1: <%@ Language=VBScript %><% Response.Redirect “http://www.new-url.com” %> Option 2: <%@ Language=VBScript %><% Response.Status="301 Moved Permanently" Response.AddHeader "Location","http://www.new-url.com/" %> Thanks, Nikhil.

    Read the article

  • how to hook up default beforeunload event on an aspx page ?

    - by Nikhil Vaghela
    I have a custom web part placed on one of the application page in SharePoint. This page it seems already have a function which gets executed on windows beforeunload javascript event. My problem is that i too need to execute some client side code (to prompt user for any unsaved changes in my web part) on windows beforeunload event. How can i achieve this ? I mean let the default event be fired as well as call my function also ? Appreciate any help. Nikhil.

    Read the article

  • Starting php-cgi at boot on mac os x 10.6.8

    - by nikhil
    I'm new to mac os, I have installed and configured nginx with php-fastcgi. I need to run this command in a terminal and keep that terminal open to access php files from my browser. php-cgi -b 127.0.0.1:9000 -q Here's the plist that I wrote by looking up sources on the internet <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Debug</key> <false/> <key>EnvironmentVariables</key> <dict> <key>PHP_FCGI_CHILDREN</key> <string>2</string> <key>PHP_FCGI_MAX_REQUESTS</key> <string>1000</string> </dict> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> <true/> <key>UserName</key> <string>nikhil</string> <key>Label</key> <string>php-fastcgi</string> <key>ProgramArguments</key> <array> <string>/usr/bin/php-cgi</string> <string>-b 127.0.0.1:9000</string> <string>-q</string> </array> </dict> </plist> I'm loading it using launchctl load -w ~/Library/LaunchAgents/php-fastcgi.plist without any success, can anyone tell me how this can be done.

    Read the article

  • enable profiler / Traceon after SQL server restart automatically

    - by Nikhil
    hi, My client is facing some deadlocks while using our application. I want to track all the deadlocks for my research and to solve the deadlocks. i am currently run the SQL profiler for the event deadlock graph to capture the deadlock scenario. the actual problem is that the SQL server gets restarted every day at 2 am, and the profiler stops capturing the events after the restart. by the time i come to office at start the profiler at say 10 am, there could be deadlocks which i could have missed between 2 am and 10 am. so i am looking for a way so i can capture the deadlocks without me starting manually. i thought i could use TRACEON(1204,-1) so that the deadlock events get captured in the SQL Server error logs. But i found that the TRACE capturing too gets disabled after the restart. Is there a way i can capture the deadlocks either by SQL profiler or by using TRACEON without me manually starting the capturing? Nikhil

    Read the article

  • RevoluteJoint Stop Rotating when Some Physics Body Collide in Andengine + Box2d?

    - by Nikhil Lamba
    I am making a Game from andengine + box2d in Which i am using RevoluteJoint in that case i am facing some problem that when physics body or Sprite Collide with this Revolute joint body then Revolute body stop rotating then after some time it start rotating I am using below code for this : this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(movingFace, movingBody, true, true)); final RevoluteJointDef revoluteJointDef = new RevoluteJointDef(); revoluteJointDef.initialize(anchorBody, movingBody, anchorBody.getWorldCenter()); revoluteJointDef.enableMotor = true; revoluteJointDef.motorSpeed = 100; revoluteJointDef.maxMotorTorque = 200; this.mPhysicsWorld.createJoint(revoluteJointDef); EDIT Here is a screenshot:

    Read the article

  • PhysicsMouseJoint problem in andengine + Box2d

    - by Nikhil Lamba
    What we can remove from this code i.e from PhysicsMouseJointExample to remove the functionality of drag and drog of sprite but i need all functionality except this only user move the sprite with some force and velocity of fling but user can't move the ball as like drag and drop like moving a finger on screen and sprite move with finger plz plz help me I am Using Below method for Mouse Joint CODE : public MouseJoint createMouseJoint(final IShape pFace, final float pTouchAreaLocalX, final float pTouchAreaLocalY) { final Body body = (Body) pFace.getUserData(); final MouseJointDef mouseJointDef = new MouseJointDef(); final Vector2 localPoint = Vector2Pool.obtain((pTouchAreaLocalX - pFace.getWidth() * 0.5f) / PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT, (pTouchAreaLocalY - pFace.getHeight() * 0.5f) / PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT); this.groundBody.setTransform(localPoint, 0); mouseJointDef.bodyA = this.groundBody; mouseJointDef.bodyB = body; mouseJointDef.dampingRatio = 0.95f; mouseJointDef.frequencyHz = 30; mouseJointDef.maxForce = (200.0f * body.getMass()); mouseJointDef.collideConnected = true; mouseJointDef.target.set(body.getWorldPoint(localPoint)); Vector2Pool.recycle(localPoint); return (MouseJoint)mPhysicsWorld.createJoint(mouseJointDef); }

    Read the article

  • Firefox is pounding my system what should I do

    - by nikhil
    I'm running the latest version of firefox 17.0.1 on ubuntu 12.10 on a Acer Aspire One 722 Netbook. It has an amd dual core C60 processor and 2GB RAM. As you can see, firefox is absolutely killing my system, it responds really slowly and opening tabs is a royal pain. I have on an average 4-5 open tabs at a given time. Is there something that I can do to make my browsing experience more zippy? Additionally I run the following addons Firebug HTTPS Everywhere Ad block plus

    Read the article

  • Rain effect looks like snowfall effect?

    - by Nikhil Lamba
    i am making a game in that game i want rain effect i am little bit far from this right now i am doing like below particleSystem.addParticleInitializer(new ColorInitializer(1, 1, 1)); particleSystem.addParticleInitializer(new AlphaInitializer(0)); particleSystem.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE); particleSystem.addParticleInitializer(new VelocityInitializer(2, 2, 20, 10)); particleSystem.addParticleInitializer(new RotationInitializer(0.0f, 30.0f)); particleSystem.addParticleModifier(new ScaleModifier(1.0f, 2.0f, 0, 150)); particleSystem.addParticleModifier(new ColorModifier(1, 1, 1, 1f, 1, 1, 1, 3)); particleSystem.addParticleModifier(new ColorModifier(1, 1, 1f, 1, 1, 1, 1, 6)); particleSystem.addParticleModifier(new AlphaModifier(0, 1, 0, 3)); particleSystem.addParticleModifier(new AlphaModifier(1, 0, 1, 125)); particleSystem.addParticleModifier(new ExpireModifier(50, 50)); scene.attachChild(particleSystem); But its looks like snowfall effect what changes i can do for make it rain effect please correct me EDIT : here is link for snapshot http://i.imgur.com/bRIMP.png

    Read the article

  • Understanding Backtracking in C++

    - by nikhil
    I have a good basic understanding of the fundamentals of C++, I also have an understanding of how recursion works too. I came across certain problems like the classic eight queens problem and solving a Sudoku with Backtracking. I realize that I'm quite lost when it comes to this, I can't seem to be able to get my mind around the concept of going back in the recursion stack and starting again in order to solve the problem. It seems easy with a pen and paper but when it comes to writing code for this, I'm confused on how to begin attacking these problems. It would be helpful if there were a tutorial aimed at beginners to backtracking or if there were a good book where this was covered. If somebody can shed light on this topic or give me some links to decent references, I'd be really grateful. And yes I do know that it would be easier in functional languages but I'd like to understand the implementation in imperative languages too.

    Read the article

  • How do I make my rain effect look more like rain and less like snowfall?

    - by Nikhil Lamba
    I am making a game in that game I want a rain effect. I am little bit far from this right now. I am creating the rain effect like below: particleSystem.addParticleInitializer(new ColorInitializer(1, 1, 1)); particleSystem.addParticleInitializer(new AlphaInitializer(0)); particleSystem.setBlendFunction(GL10.GL_SRC_ALPHA, GL10.GL_ONE); particleSystem.addParticleInitializer(new VelocityInitializer(2, 2, 20, 10)); particleSystem.addParticleInitializer(new RotationInitializer(0.0f, 30.0f)); particleSystem.addParticleModifier(new ScaleModifier(1.0f, 2.0f, 0, 150)); particleSystem.addParticleModifier(new ColorModifier(1, 1, 1, 1f, 1, 1, 1, 3)); particleSystem.addParticleModifier(new ColorModifier(1, 1, 1f, 1, 1, 1, 1, 6)); particleSystem.addParticleModifier(new AlphaModifier(0, 1, 0, 3)); particleSystem.addParticleModifier(new AlphaModifier(1, 0, 1, 125)); particleSystem.addParticleModifier(new ExpireModifier(50, 50)); scene.attachChild(particleSystem); But it looks like snowfall! What changes can I do for it to look more like rain? EDIT Here is a screenshot:

    Read the article

  • How can I recursively change the permissions of files and directories?

    - by Nikhil
    I have ubuntu installed on my local computer with apache / php / mysql. I now have a directory at /var/www - inside which I have several of my ongoing projects. I also work with opensource ( drupal, magento, sugarcrm ). The problem I am facing is changing file permission with terminal. Sometime I need to change the permission of entire folder and its subsequent sub-folders and files. I have to individually change using sudo chmod 777 foldername How can I do this recursively. Also why do I have to always do it 777, I tried 755 for folders and 644 for files, but that won't work.

    Read the article

  • How do I remove obsolete packages after upgrading to 14.04?

    - by Nikhil Mahajan
    While upgrading to 14.04, I got a prompt asking if I wanted to remove obsolete packages and that it would take hours to do so. So, I said "No" and decided to do it later. However, after the upgrade when I run sudo apt-get autoremove, it removes no packages at all. But when I run aptitude search '~o' I get a list of many obsolete packages. How do I remove all the obsolete packages in a proper manner?

    Read the article

  • Understanding Data Binding for Windows Phone 7

    - by nikhil
    I want to develop a simple app for the Windows Phone 7 platform. It's basically a vocabulary based game that involves the user moving word tiles from one area to another to score points. I want to know what is the best way of tying the UI to the game's backend? I saw the Windows Phone 7 jumpstart videos, there they touch up on Data Binding but don't really go into any depth. I'm a newbie and don't have any experience with designing the architecture for a phone app, It'd be great if someone could explain what steps I should be taking or guide me to a resource from where I could learn more.

    Read the article

  • Cannot copy anything onto WD Elements 1TB External USB HDD

    - by Aashish Vaghela
    I have a Western Digital 1023 Elements 1TB External USB HDD. Recently, it has started an unusual problem. I cannot copy any file of any size on to that 1TB hard-drive, eventhough it has more than 400 GB free (out of 931GB actual size). I tried copying movies from one friends laptop, which did not work. I also tried another desktop to copy some study material e-books (in PDF), which also did not work. I get same CRC error when I try to copy anything from a computer's hard-drive onto this WD 1TB hard-drive. Vice-versa it's working. I mean, I can copy any file from the USB HDD onto local machine's HDD on any computer. It's like one-way traffic. This HDD is only 1 year old. What are my options ? Any suggestions ? Regards, Aashish.V

    Read the article

  • How do I make UITableViewCellAccessoryDisclosureIndicator visible in black background?

    - by Amit Vaghela
    Hi I wrote this cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; in this method - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; but I can only see it when I select that cell otherwise it's not visible.and it work perfectly when background is white. I am sure that I need to set a property, but I don't know which property I need to change to make this thing work. thanks in advance. cheers.

    Read the article

  • How to read time phased data from Project Server 2007 directly from Project Server Database ?

    - by Nikhil Vaghela
    I am working on a custom web part for Project Web Access, for Project Server 2007. We are so far using PSI web services only to read and write data from and to Project Server 2007 databases. But there is a signinficant performance issue when you retrieve time phased data through Statusing web service, it is basically an expensive call for querying time phased data for each tasks. I want to access Time phased data entered by user for each tasks by directly hitting the Project Server Database. [ I do not want the solution suggested at this link : http://blogs.msdn.com/project_programmability/archive/2007/05/24/getting-at-the-task-time-phased-data.aspx as it reads data from reporting database which gets entry only after the project is published. ] I want to get time phased data as soon as user enters it. Any idea ? Thanks.

    Read the article

  • how to get group total in self refrenced data in data table ?

    - by Nikhil Vaghela
    I have three columns in my data table. 1) ProductID 2) ProductParentID 3) ProductTotal ProductID and ProductParentID are self refrencing columns where i can set parent child relationship and get child rows based on my relationship. Let us say i have following data Product1     Product11     Product12     Product13         Product131         Product132         Product133 Product2     Product21     Product22     Product23 Next to above hierarchy in Product total column what i want is total of each child rows and sum of those child rows product total should be rolled up to it parent product. E.g if Product 131 total is 10,Product 13 total is 15 and Product 133 total is 5 then the product 13 total should be 30. The logic should work for n number of self hierarchy. Is there any functionality in data table itself where i can achieve this without iterating through each row and do it manually ? Thanks.

    Read the article

  • Data table to Excel conversion leaves my server side button non responsive in SharePoint WebPart

    - by Nikhil Vaghela
    We have a web part on which we display some data in a grid. We are exporting grid's underlying datatable to Excel and displaying Open - Save - Cancel dialouge box on click of a server side button. Following is the code we are executing on click of server side button. this.Page.Response.Clear(); this.Page.Response.AppendHeader("Content-Disposition", "attachment; filename=MyTasks.xls"); this.Page.Response.ContentType = "application/ms-excel"; this.Page.Response.Write("...here goes my well formated html...."); this.Page.Response.End(); Problem is that when i click on Cancel in the diaglouge box then dialogue box to Open/Save excel disappears but all the server side buttons placed on my web part becomes non responsive, on click of any of those buttons their server side click event does not get fired !!! Any idea ? Thanks.

    Read the article

  • Programmatically select a tabbaritem in "More"

    - by Amit Vaghela
    I am using UITabbarController with 8 to 9 items (these are UINavigation controllers) It is easy to select an item programmatically using tabbarcontroller.selectedIdex = x; if x value is between 0 to 4 then it's work as expected but if it's greater than 4 then it's select "More" as a view controller. How can we programmatically select an item under "More" list ? any help would be appreciated.. Thanks in advance

    Read the article

  • how to split a string by another string ?

    - by Nikhil Vaghela
    I have a string in following format "TestString 1 <^ TestString 2 <^ Test String3 Which i want to split by "<^" string. Using following statement it gives the output i want "TestString 1 <^> TestString 2 <^> Test String3" .Split("<^>".ToCharArray(), StringSplitOptions.RemoveEmptyEntries) But if my string contains "<" , "" or "^" anywhere in the text then above split statement will consider that as well Any idea how to split only for "<^" string ?

    Read the article

  • How do i deploy UAT and Development SharePoint solution on the same server ?

    - by Nikhil Vaghela
    I am working on a SharePoint 2010 Server and i have following items in my SharePoint solution Couple of web parts State Machine Work flow (which will be integrated to an Infopath form library) Infopath task edit forms Lets say this solutions is deployed to http://[SharePoint201Server]:[PortNumber-x]/ This is the only server i have (No extra server for UAT), and what ever has been done so far needs to be given for user acceptance testing (UAT). I may create one more site at http://[SharePoint201Server]:[PortNumber-y]/ for it. My problme is that how do i maintain two copies of my source code ? I will have to continue development on the same set of source code for next UAT release. I simply can not create simple copies of the source code as it will have same Assembly name and feature id, etc..As if i do so, any changes on under Development source code would affect UAT assemblies. One thing i can do is to create seperate projects for UAT and Development with different Features and Assembly names, but is not that too much of an unneccesory work ? What can be the best approach in such situation ?

    Read the article

1 2 3 4  | Next Page >