Search Results

Search found 30014 results on 1201 pages for 'go yourself'.

Page 165/1201 | < Previous Page | 161 162 163 164 165 166 167 168 169 170 171 172  | Next Page >

  • two threads acting on the same runnable

    - by Eslam
    Given: public class Thread1 { int x = 0; public class Runner implements Runnable { public void run() { int current = 0; for (int i = 0; i < 4; i++) { current = x; System.out.print(current + " "); x = current + 2; } } } public void go() { Runnable r1 = new Runner(); new Thread(r1).start(); new Thread(r1).start(); } public static void main(String[] args) { new Thread1().go(); } } Which two are possible results? (Choose two) A. 0, 2, 4, 4, 6, 8, 10, 6, B. 0, 2, 4, 6, 8, 10, 2, 4, C. 0, 2, 4, 6, 8, 10, 12, 14, D. 0, 0, 2, 2, 4, 4, 6, 6, 8, 8, 10, 10, 12, 12, 14, 14, E. 0, 2, 4, 6, 8, 10, 12, 14, 0, 2, 4, 6, 8, 10, 12, 14, i chosed A,B but i'm not certain is those is the true or not.

    Read the article

  • how to pass in dynamic data to decorators

    - by steve
    Hi, I am trying to write a base crud controller class that does the following: class BaseCrudController: model = "" field_validation = {} template_dir = "" @expose(self.template_dir) def new(self, *args, **kwargs) .... @validate(self.field_validation, error_handler=new) @expose() def post(self, *args, **kwargs): ... My intent is to have my controllers extend this base class, set the model, field_validation, and template locations, and am ready to go. Unfortunately, decorators (to my understanding), are interpreted when the function is defined. Hence it won't have access to instance's value. Is there a way to pass in dynamic data or values from the sub class? If not, I guess I could use override_template as a workaround to expose and set the template within the controller action. How would I go about validating the form within the controller action? Thanks, Steve

    Read the article

  • Android: Deciding between SurfaceView and OpenGL (GLSurfaceView)

    - by Rich
    Is there a way to decide up front based on the expected complexity of a game/app in the planning phase whether to use regular Canvas drawing in a SurfaceView or to go with OpenGL? I've been playing around with a Canvas and only need 2D movement, and on a fairly new phone I'm getting pretty decent performance with a bunch of primitive objects and a few bitmaps running around the screen on a solid background. Is it fair to say that if I'm going to be drawing background images and increasing the number of objects being moved and drawn on top of them that I should go straight to OpenGL?

    Read the article

  • List of private iPhone APIs?

    - by diego nunes
    . . Hi there, everybody. . . I need to do an app to be distributed ad hoc (it doesn't need to go to the store) but I need to get the information about the "data usage" (gprs/3g traffic). It is available on the system, but there is no official API call to get that info. One app made it through Apple testing (it's called "Download Meter"), though, and I emailed the guys to see if they would share the call, but they were not in that mood. . . Is there any list of private APIs or anything like that? Does anyone have any ideas of how could I get that info? Again: the app doesn't need to go to the store, but I need to install it on stock iPhone (ad hoc will do). . Thanks.

    Read the article

  • bash: hwo to know NUM option in grep -A -B "on the fly" ?

    - by Michael Mao
    Hello everyone: I am trying to analyze my agent results from a collection of 20 txt files here. If you wonder about the background info, please go see my page, what I am doing here is just one step. Basically I would like to take only my agent's result out of the messy context, so I've got this command for a single file: cat run15.txt | grep -A 50 -E '^Agent Name: agent10479475' | grep -B 50 '^==' This means : after the regex match, continue forward by 50 lines, stop, then match a line separator starts with "==", go back by 50 lines, if possible (This would certainly clash the very first line). This approach depends on the fact that the hard-coded line number counter 50, would be just fine to get exactly one line separator. And this would not work if I do the following code: cat run*.txt | grep -A 50 -E '^Agent Name: agent10479475' | grep -B 50 '^==' The output would be a mess... My question is: how to make sure grep knows exactly when to stop going forward, and when to stop getting backward? Any suggestion or hint is much appreciated.

    Read the article

  • How to make my robot move in a rectangular path along the black tape?

    - by Sahat
    I am working on a robot, it's part of the summer robotics workshop in our college. We are using C-STAMP micro controllers by A-WIT. I was able to make it move, turn left, turn right, move backward. I have even managed to make it go along the black tape using a contrast sensor. I send the robot at 30-45 degrees toward the black tape on the table and it aligns itself and starts to move along the black tape. It jerks a little, probably due to my programming logic below, it's running a while loop and constantly checking if statements, so it ends up trying to turn left and right every few milliseconds, which explains the jerking part. But it's okay, it works, not as smooth as I want it to work but it works! Problem is that I can't make my robot go into a rectangular path of the black tape. As soon as it reaches the corner it just keeps going straight instead of making a left/right turn. Here's my attempt. The following code is just part of the code. My 2 sensors are located right underneath the robot, next to the front wheel, almost at the floor level. It has "index" value ranging from 0 to 8. I believe it's 8 when you have a lot of light coming into the sensor , and 0 when it's nearly pitch black. So when the robot moves into the black-tape-zone, the index value drops, and based on that I have an if-statement telling my robot to either turn left or right. To avoid confusion I didn't post the entire source code, but only the logical part responsible for the movement of my robot along the black tape. while(1) { // don't worry about these. // 10 and 9 represent Sensor's PIN location on the motherboard V = ANALOGIN(10, 1, 0, 0, 0); V2 = ANALOGIN(9, 1, 0, 0, 0); // i got this "formula" from the example in my Manual. // V stands for voltage of the sensor. // it gives me the index value of the sensor. 0 = darkest, 8 = lightest. index = ((-(V - 5) / 5) * 8 + 0.5); index2 = ((-(V2 - 5) / 5) * 8 + 0.5); // i've tweaked the position of the sensors so index > 7 is just right number. // the robot will move anywhere on the table just fine with index > 7. // as soon as it drops to or below 7 (i.e. finds black tape), the robot will // either turn left or right and then go forward. // lp & rp represent left-wheel pin and right-wheel pin, 1 means run forever. // if i change it from 1 to 100, it will go forward for 100ms. if (index > 7 && index2 > 7) goForward(lp, rp, 1); if (index <= 7) { turnLeft(lp, rp, 1); goForward(lp, rp, 1); // this is the tricky part. i've added this code last minute // trying to make my robot turn, but i didn't work. if (index > 4) { turnLeft(lp, rp, 1); goForward(lp, rp, 1); } } else if (index2 <= 7) { turnRight(lp, rp, 1); goForward(lp, rp, 1); // this is also the last minute addition. it's same code as above // but it's for the 2nd sensor. if (index2 > 4) { turnRight(lp, rp, 1); goForward(lp, rp, 1); } } I've spent the entire day trying to figure it out. I've pretty much exhausted all avenues. Asking for the solution on stackoverflow is my very last option now. Thanks in advance! If you have any questions about the code, let me know, but comments should be self-explanatory.

    Read the article

  • Do you take the pain of learning it or use an out of the box solution?

    - by Mantorok
    Hi all What I'm getting at here is being presented with a control or framework that does 95% of what you want but has its shortcomings when opposed to learning how to do it yourself. To give a good example (ASP.Net) UpdatePanel vs DIY JS/JSON. The UpdatePanel gives you AJAX instantly without doing anything additional, however I've come to learn that its shortcomings are mainly that it's a bit of a hack and performs badly on busy pages and I've found myself having to scrap UpdatePanels in favour of rolling my own JS, and I've now made it a habit to fully investigate any shortcomings in out-of-the-box solutions, as I've been stung by this experience. So I guess what I'm asking is: Is it better to find out how to DIY or is it considered a better approach to try the available solution and risk going a full circle? Obviously I've only targetted a single control, but it is a very attractive control to people learning AJAX - I'm sure there are others out there. Sorry if dupliate. Thanks

    Read the article

  • What's a good way to create an Event Calendar

    - by iFloh
    Hi, I want to create an Event Calendar for my iPhone App. In a first instance the Event Calendar is supposed to list the Events and have a Details View with additional info. It is also supposed to contain an action to trasfer a specific event to the iPhone Calendar. First thoughts go towards using a UITableView where I make the event dates as sections. Since the Calendar is supposed to span many month I am unsure whether this really is the best way to go about it. Any suggestions? Do you probably know some sample code that I might use ? thanks in advance

    Read the article

  • Log4j - Logging to multiple log files based on the project modules

    - by Veera
    Consider this scenario: I have a project with two modules and one common module as below (the package structure): com.mysite.moduleone com.mysite.moduletwo com.mysite.commonmodule In the above, the commonmodule classes can be used by other two modules. The question: I need to configureLog4J such a way that the log messages from moduleone and moduletwo goes to different log file. I can always do this using using category. But the real problem is when I want to log the messages from the commonmodule also. So, when the commonmodule classes are called from moduleone the commonmodule log messages should go to the moduleone log file. If the commonmodule is accesse from moduletwo the commonmodule log messages should go to moduletwo log file. Is it possible to configure Log4J in this fashion? Any comments? PS: I think I made my question clear. If any confusion, leave a comment, wil try to clear it. :)

    Read the article

  • Mobile Specific Site Development. Where to start?

    - by Andy
    I'm beginning the process of learning the ins and outs of developing sites for mobile web browsers. Are there any good resources/communities online that discuss mobile specific site development issues? My initial understanding is that to cover different phones you need to build one site that is enabled for browsers with the webkit engine (iphone, android, etc.) and another more basic site for other older browsers, is this assumption correct? Also what does developing for webkit mean exactly? How is it different than just using javascript/css/html? Is it the same except that you limit yourself to webkit specific functions and css? I looked on the webkit site, but it didn't explain it in those terms. Are there any other snafus I need to watch out for when developing for mobile browsers?

    Read the article

  • How to direct people to fill out a form

    - by Solmead
    What is the best way to get people to fill out a form correctly? For instance I originally had a "Name" field on a form and I want 1 person per form. People filled it out like this: "Mark & Becky Newsman". So I broke it into 2 fields, "First Name" and "Last Name", And people are still filling it out wrong, like "First Name" = "Mark & Becky", "Last Name" = "Newsman". Are there any recommendations on how better to get people to understand that only one person's name should go there? I currently have it on two lines, would it work better to put both fields on one line? If this is on the wrong site go ahead and move it to the correct site.

    Read the article

  • Cross Theaded Calls - Many controls Heavy GUI Application after .net 1.1 2.0 upgrade- best way ??

    - by keepsmilinyaar
    I have recently upgraded a .net1.1 solution to .net2.0. AS this is a very heavy GUI appilcation with loads of controls and many multithreaded operations that update the GUI. While these operations worked seamlessly in .net1.1 it is throwing up Cross Threaded Illegal operations after the upgrade. Considering the fact that tehre are numerous grids, buttons and status labels that need to be updated via these multi threaded operations, I decided to code for checking the InvokeRequired solution, however doing that for every control would probably not be the best way to go about it. I was wondering if you could suggest a better way of how I can go about it or propose any OOPS based class structure that I could code around to make the code look better. Please do let me know if my question is unclear. Thanks in advance

    Read the article

  • from ggplot2 to OOo workflow?

    - by Andreas
    This is not really a programming question, but I try here none the less. I once used latex for my reports. But the people I work with needs to make small edits and do not have latex skillz. Openoffice is then the way to go. But saving ggplot images with dpi 100 makes for really ugly graphs. dpi = 600 is a no go (e.g. huge legend). So what to do? I currently save (still via ggsave) to eps - which openoffice can import. But performance is not good at all. Googling I found a bug for the poor eps performance in OOo, and also talk about a non-implemented svg feature. But none helps me right now. If you work with ggplot2 and OOo - What do you do? I have been unsuccesfull with pdf conversion for some reason.

    Read the article

  • Create view or SP, only if the DB contains a pattern

    - by Randall Salas
    Hi all: I am working on a script, that needs to be run in many different SQL servers. Some of them, shared the same structure, in other words, they are identical, but the filegroups and the DB names are different. This is because is one per client. Anyway, I would like when running a script, If I chose the wrong DB, it should not be executed. I am trying to mantain a clean DB. here is my example, which only works for dropping a view if exists, but does not work for creating a new one. I also wonder how it would be for creating a stored procedure. Thx a lot. if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[ContentModDate]') and OBJECTPROPERTY(id, N'IsView') = 1) AND CHARINDEX('Content', DB_NAME()) 0 drop view [dbo].[ContentModDate] GO IF (CHARINDEX('Content', DB_NAME()) 0)BEGIN CREATE VIEW [dbo].[Rx_ContentModDate] AS SELECT 'Table1' AS TableName, MAX(ModDate) AS ModDate FROM Tabl1 WHERE ModDate IS NOT NULL UNION SELECT 'Table2', MAX(ModDate) AS ModDate FROM Table2 WHERE ModDate IS NOT NULL END END GO

    Read the article

  • Any editors to visually modify Wix templates?

    - by user1632018
    I have tried wixedit and sharp develop and from what I can tell they do not allow you to visually modify the premade templates with a designer. They only allow you to create your own customized dialogs that you can design yourself. So I am wondering if there is any editors that you can visually modify the design of these templates, especially the mondo template with a point and click editor. I have also tried SharpSetup and it looks promising how you can design the interface in visual studio, although since I don't know much about editing wix I am having a hard time comming up with the wix code to make it work.

    Read the article

  • JTextField that has inner fields or preformated format, something like the ip field in windows

    - by dimitar
    Hello guys, i want to create a text field that will be for date and will have dd.mm.YYYY format. Now what i want to do is the user to type only the numbers, not the dots to. So the field would be like: _ _. _ _ . _ _ _ _ So when the user wants to type the date: 15.05.2010 for example, he will only type the numbers in the sequence 15052010. Also i would like, when he preses on left or right arrow, the cursor to go from one field(not JTextField, but field in the JTextField). So lets say i have JTextField with text in it: 15.05.2010, so if user is on the beginning and he preses right arrow, the cursor to go to the .05 field. I hope you understand me 'cos right now i don't any idea how to make this, or at least how to look for it on google. Thank you.

    Read the article

  • ASP.net application advice needed

    - by c11ada
    hey all, im biulding a ASP.net application, which is connected to a database. the database design is as follows **Users Table** UserID `(PK) autonumber` Username **Question Table** QuestionID `(PK) autonumber` QuestionNumber QuestionText **Questionnaire Table** QuestionnaireID `(PK) autonumber` UserID `(FK) User Table` Date **Feedback Table** FeedbackID `(PK) autonumber` QuestionnaireID `(FK) Questionnaire Table` QuestionID `(FK) Questions Table` Answer Comment please can some one advise me on how I should go about inserting data into the questionnaire table and the feedback table. I know that the questionnaire table needs to be updated first. but the Questionnaire ID is linked to the feedback table, so how do I go about updating both tables ?

    Read the article

  • Is there a lightweight multipart/form-data parser in C or C++?

    - by Hongli
    I'm looking at integrating multipart form-data parsing in a web server module so that I can relieve backend web applications (often written in dynamic languages) from parsing the multipart data themselves. The multipart grammar (RFC 2046) looks non-trivial and if I implement it by hand a lot of things can go wrong. Is there already a good, lightweight multipart/form-data parser written in C or C++? I'm looking for one with no external dependencies other than the C or C++ standard library. I don't need email attachment handling or buffered I/O classes or a portability runtime or whatever, just multipart/form-data parsing. Things that I've considered: GMime - depends on glib, so no go. libapreq - too large, depends on APR, badly documented, no unit tests. I've also looked at writing a parser with Ragel, but I can't figure out how to do it because the grammar is not static: the boundary can change arbitrarily.

    Read the article

  • Multiple Questions per page using Drupal Quiz

    - by Andrew
    I'm using the Drupal Quiz module, and have setup some basic quizzes and stuff like that. However some further customization is required, involving more than 1 question per page, and a multi-type answer in this type of format: Question 1: Describe 4 things you did last summer a) [ short answer space - text field ] b) "I wept" c) "My whole family died so I learned self reliance" d) "I got another xbox" Question 2: Describe 2 things you hate about yourself a) "My arms are way shorter than my legs" b) "I was born without human emotion" So I guess in two parts, how to show multiple questions per page, and then how to allow multiple text fields for answers. Oh and this quiz is not graded, it's like a self assessment. Thanks!

    Read the article

  • where should I put the EF entity and data annotations in asp.net mvc + entity framework project

    - by giddy
    So I have a DataEntity class generated by EntityFramework4 for my sqlexpress08 database. This data context is exposed via a WCF Data Service/Odata to silverlight and win forms clients. Should the data entities + edmx file (generated by EF4) go in a separate class library? The problem here then is I would specify data annotations for a few entities and then some of them would require specific MVC attributes (like CompareAttribute) so the class library would also reference mvc dlls. There also happen to be entity users which will be encapsulated or wrapped into an IIdentity in the website. So its pretty tied to the mvc website. Or Should it maybe go in a Base folder in the mvc project itself? Mostly the website is data driven around the database, like approve users, change global settings etc. The real business happens in the silverlight and win forms apps. Im using mvc3 rc2 with Razor. Thanks

    Read the article

  • What are the app pool identity and account for anonymous access for?

    - by apollodude217
    I understand what the two are used for, except I don't know what each does--i.e. what one is for vs. what the other is for. (I usually set them to the same account anyway.) If you're not sure what accounts I'm talking about, in the IIS manager thingy: Right-click on the app pool in question, go to Properties, and click the Identity tab to see the App Pool Identity. Right-click a Web site, go to Properties - Directory Security, and click Edit under Anonymous Access and authentication control to view the Account for anonymous access.

    Read the article

  • Where to start on creating finger swipe navigation trough a list.

    - by Thomas Stock
    Lets say I want to make a control to select any integer number by dragging on a "bar" with numbers: (156 is selected) Mousedown on "159" and dragging towards the left and then doing mouseup changes the control to this: (160 is selected) I've been experimenting for the past 3 hours but I'm inexperienced in Silverlight so I'm having problems getting started. My current guess is I should seperate this into 2 steps: Step 1: Build this control without swiping behavior. Just 2 buttons to go up a number or go down a number Step 2: Replace the buttons by handling mouse events. With my limited knowledge I think I would manage building a crappy control that does this, with very messy xaml and c# and lots of headaches when trying to apply styling and fancy state transitions, but I was hoping some xaml wizards could get me started with the basic approach? Edit: This is an implementation of what I'm trying to achieve in Silverlight: Iphone's datepicker:

    Read the article

  • NavBar displaying back twice when app changed to landscape mode

    - by Graeme
    Hi, Not sure what's going on here, but my iPhone apps nav bar shows back and the title of my detail view controller even when I'm back to the original view. It wasn't happening earlier, it has changed recently (but not sure when exactly). E.g. I click on a row, view the didSelectRow XIB and then click back on the NavBar controller, but it still shows back even though the view does change back to the original table view. I then have to press back again and then it clears. Update: It's as if its trying to go back three times instead of two. Because, if you visit another row without removing the back button, it stores it as if you need to go back twice. It works fine in portrait mode. Any ideas?

    Read the article

  • IE Display bug - solved when using the "developer tools"?

    - by nute
    I have some Javascript/CSS issues with IE (no suprises?). So when I see the error in IE8, I go to Tools Developer Tools. Then I navigate to the correct DIV. I click on it, look around ... then I look again at my page, and the problem is fixed! This makes debugging pretty difficult... To see the display error, go to http://www.makemeheal.com/mmh/home.do in IE, and look at the "Your Recent History" module.

    Read the article

  • stripe payment issue ruby on rails

    - by Admir Huric
    So I have made a stripe payment option in my app. When I click the button pay now, it shows me that the payment is successful. and when I go to my stripe account and go to stripe-test and check logs, I can see my test payment with the code 200 OK. But this payment doesn't show in stripe-test events, or in stripe-test payments. Are the payments from logs processed the next day or am I doing something wrong? def charge Stripe.api_key = "some_test_api_key" customer = Stripe::Customer.retrieve(stripe_customer_id) if stripe_customer_id.nil? Stripe::Charge.create( :amount => 2500, :currency => "cad", :customer => stripe_customer_id, :description => "Usage charges for #{name}" ) end rescue Stripe::StripeError => e logger.error "Stripe Error: " + e.message errors.add :base, "Unable to process charge. #{e.message}." false end

    Read the article

< Previous Page | 161 162 163 164 165 166 167 168 169 170 171 172  | Next Page >