Search Results

Search found 1725 results on 69 pages for 'equation solving'.

Page 41/69 | < Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >

  • Find next lower item in a sorted list

    - by Sebastian
    Hey guys, let's say I have a sorted list of Floats. Now I'd like to get the index of the next lower item of a given value. The usual for-loop aprroach has a complexity of O(n). Since the list is sorted there must be a way to get the index with O(log n). My O(n) approach: index=0 for i,value in enumerate(mylist): if value>compareValue: index=i-1 Is there a datatype for solving that problem in O(log n)? best regards Sebastian

    Read the article

  • Protocol buffer deserialization and a dynamically loaded DLL in Compact Framework

    - by cloudraven
    I saw a question related to this on the full framework here. Since it seems to have stayed unresolved for quite a while and this is for the compact framework, I though it would be better to create a new question for it. I want to deserialize types for which I am loading assemblies dynamically (with Assembly.LoadFrom) and I am getting a "Unable to identify known-type for ProtoIncludeAttribute" error. In the related question I mentioned, it was hinted that hooking AppDomain.AssemblyResolve event would help solving the problem. It makes sense for the full framework, but that event is not available in the CF. I wonder if there is a way to do this with CF. The structures I am using look a lot like this and all the classes required for deserialization are loaded from the same Assembly. If the assembly is referenced instead of dynamically loaded it works fine, but fails if done dynamically.

    Read the article

  • Determine calling executable in Python

    - by Brian Rosner
    I am trying to find the best way of re-invoking a Python script within itself. Currently it is working like http://github.com/benoitc/gunicorn/blob/master/gunicorn/arbiter.py#L285. The START_CTX is created at http://github.com/benoitc/gunicorn/blob/master/gunicorn/arbiter.py#L82-86. The code is relying on sys.argv[0] as the "caller". However, this fails in cases where it is invoked with: python script.py ... This case does work: python ./script.py ... because the code uses os.chdir before running os.execlp. I did notice os.environ["_"], but I am not sure how reliable that would be. Another possible case is to check if sys.argv[0] is not on PATH and is not executable and use sys.executable when calling os.execlp. Any thoughts on a better approach solving this issue?

    Read the article

  • Where can I learn more about datastructure tricky questions?

    - by Sandbox
    I am relatively new to programming (around 1 year programming C#-winforms). Also, I come from a non CS background (no formal degree) Recently, while being interviewed for a job, I was asked about implementing a queue using a stack. I fumbled and wan't able to answer the question. After, the interview I could do it(had to spend some time). I have learnt (and think that I know it well) basic algorithms in datastructures using the book Data Structures: A Pseudocode Approach with C - Richard F. Gilberg (Author) . I want to know about sites/ books which have such questions along with answers. I think this will allow me to develop my CS specific problem solving skills. Any help is appreciated. BOUNTY: I am looking at some blog/website with datastructure and algorithms Q&A.

    Read the article

  • How to monitor MySQL query errors, timeouts and logon attempts?

    - by Abel
    While setting up a third party closed source CMS (Sitefinity) the setup doesn't create all tables and procedures necessary to run it. The software lacks a logging system itself and it made me wonder: could I trace and monitor failing SQL statements from MySQL? This serves more than only the purpose of solving my issue with Sitefinity. More often I wonder what's send to the MySQL server, not wanting to dive into the software products or setup a debugging environment etc. I tried JetProfiler (only performance) and looked through a few others, but although they monitor a lot, they don't monitor query failures, timeouts or logon attempts. Does anyone know a profiler, tracer, monitoring tool, commercial or free, that can show me this information?

    Read the article

  • Different background colors for the top and bottom of a UITableView

    - by Aaron Brethorst
    If you look at your Inbox in iPhone OS 3.0's Mail app, you'll see that swiping down displays a grayish background color above the UISearchBar. Now, if you scroll down to the bottom of the table, you'll see that the background color at that end is white. I can think of a couple ways of solving this problem, but they're pretty hacky: Change the table view's background color depending on the current scrollOffset by overriding -scrollViewDidScroll: Give the UITableView a clear background color and then set its superview's backgroundColor to a gradient pattern image. Does anyone know what the "best practice" solution is for this problem? thanks.

    Read the article

  • Get the entire string of a jquery DOM object

    - by Scozzard
    Hi, I have had a bit of a look around and am having some difficulty solving a wee issue I am having. I basically have a string of HTML, I convert that to a JQuery DOM object so that I can easily remove all elements that have a certain class using JQuery's .remove(). I.e., var radHtml = editor.get_html(); var jqDom = $(radHtml); $(".thickbox", jqDom).remove(); editor.set_html(jqDom.html()); The only problem is that .html() only gets the first element, not the entire DOM. In reference to my code I am basically wanting radHhtml - elements with class "thickbox" (returned as string). I was wondering if there was an easy way to do this - have some html and remove all elements (in this case divs) that have a certain class (but leaving their contents). JQuery doesnt have to used, but I would like to. Any help would be much appreicated. Thanks.

    Read the article

  • Importing ctype; embedding python in C++ application

    - by Drew
    I'm trying to embed python within a C++ based programming language (CCL: The compuatational control language, not that any of you have heard of it). Thus, I don't really have a "main" function to make calls from. I have made a test .cc program with a main, and when I compile it and run it, I am able to import my own python modules and system modules for use. When I embed my code in my CCL-based program and compile it (with g++), it seems I have most functionality, but I get the import error: ImportError: /usr/lib/python2.6/lib-dynload/_ctypes.so: undefined symbol: PyType_GenericNew Can someone explain this to me and how to go about solving it? It seems like I've linked the objects correctly. Thanks.

    Read the article

  • How to build Object Oriented Skills?

    - by cedar715
    Being a core developer for couple of years, coding applications seeing the class diagrams, sequence diagrams, I decided to improve my self, taking the next step of designing. As I'm an OO developer, I'm interested in improving my design skills. For Example, I had a hard time designing a currency converter. My questions to the SO: Is it by experience the design skills can be acquired? Will learning books/blog/material over internet etc help? Is it that one needs the domain knowledge of the application being developed? Knowing Design patterns, principles? Studying 'Code Complete' book ? Need to have Problem-solving skills? In short, given a problem, I just want to solve it in Object-oriented way??

    Read the article

  • Compass accuracy dilemma

    - by mob1lejunkie
    I need to build compass for my application. From reading the documentation it seems there are two reasonable ways of doing this: Sensor.TYPE_ORIENTATION method: This is the easy way of doing it. The problem with this is it is not accurate. When I compare my reading with Snaptic Compass it is about 10-15 degress off which for my purposes is unacceptable. Sensor.TYPE_ACCELEROMETER, Sensor.TYPE_MAGNETIC_FIELD and getRotationMatrix() in conjunction with remapCoordinateSystem() and getOrientation() method: The documentation says this "is usually more accurate". The problem is regardless of the delay I register with listener the compass goes crazy even when the device is stationary on flat surface. Any suggestions for solving this problem will be greatly appreciated.

    Read the article

  • Creating Dynamic variables from json response

    - by c0mrade
    My JSON response looks like this : {"sample":[{"id":"2","name":"branch name"},{"id":"3","name":"branch name 2"}]} My function looks like this : function getJSONObjects(){ $.getJSON("http://localhost/api/branches", function(data){ $.each(data.sample, function(i,item){ var loc = "branch"; eval("var " + loc + item.id + "=123;"); alert(loc + item.id); }); }); } The idea is to create branch + id object so I can do something with it(create marker on a map), so I tried to assign it any value to see if this was working. I wanted both branch2 and branch3 to alert 123 so I have something to start with. But currently this alerts branch2 and branch3 instead of 123. I have little experience with creating dynamic variables/objects can someone tell me what I'm doing wrong or maybe another approach towards solving this?

    Read the article

  • After MS Access Conversion 97 --> 2002 I get 'Enter Parameter Value' when exitting a form.

    - by user270370
    Hi, So when I exit a form from my newly converted .mdb it asks to Enter Parameter Value. It goes through (ie if i enter a value, it asks for another) the values required for a query that is run on a List Box on the page. The query has not been changed during the conversion. The values it is getting for the query are from text boxes on the same form. There are a few Requeries in the form (run from VB) so I imagine that it is rerunning again on Exit (although this isnt explicit in the form properties). I'm not quite sure how to go about solving this. Your help would be great. Thanks

    Read the article

  • how much concurrent http request can erlang handle

    - by user209123
    I am developing a application for benchmarking purposes, for which I require to create large number of http connection in a short time, I created a program in java to test how much threads is java able to create, it turns out in my 2GB single core machine, the limit is variable between 5000 and 6000 with 1 GB of memory given to JVM after which it hits outofmemoryerror with heap limit reached. It is suggested around that erlang will be able to generate much more concurrent processes, I am willing to learn erlang if it is capable of solving the problem , although I am interested in knowing can erlang be able to say generate somewhere around 100000 processes which are essentially http requests waiting for responses, in a matter of few seconds without reaching any limit like memory error etc.,

    Read the article

  • Managing StringBuilder Resources in C#

    - by Jim Fell
    Hello. My C# (.NET 2.0) application has a StringBuilder variable with a capacity of 2.5MB. Obviously, I do not want to copy such a large buffer to a larger buffer space every time it fills. By that point, there is so much data in the buffer anyways, removing the older data is a viable option. Can anyone see any obvious problems with how I'm doing this (i.e. am I introducing more performance problems than I'm solving), or does it look okay? tText_c = new StringBuilder(2500000, 2500000); private void AppendToText(string text) { if (tText_c.Length * 100 / tText_c.Capacity > 95) { tText_c.Remove(0, tText_c.Length / 2); } tText_c.Append(text); } Thanks.

    Read the article

  • validations in XML

    - by charan
    hi all.. i have a address.java file with a textField as PostCode. in that only number should accepted. if i try to enter characters in that it sould popup a message. these validation must be done in address.xml file only i tried by giving the validation as <testcase> <messageType>error</messageType> <validationType>isDigit</validationType> <validationRule>5</validationRule> </testcase> but its not working. plz anybody can help me in solving this

    Read the article

  • Cannot copying tables when compiling on Device

    - by Amarpreet
    Hi guys, I am working on sqlite application with around 10 tables in database. it works fine when i run on simulator. And when i open the sqlite file from Applications folder of simulator it shows me all the tables and data. the problem arises when i run app on device. I downloaded the application from device and i checked the sqlite database files there were no tables in it. please help me solving this problem. thanks.

    Read the article

  • Which JMS broker implementations allowing resending messages saved in dead message queue?

    - by marabol
    I wonder, if there JMS broker, that allows administrators to resend (via GUI or any tool) messages, saved in a ded message queue or dead letter queue, after solving the causing problem (e.g. database is down, not enough space...). WebSphere provide a feature to resend messages saved in dead letter queue: 1 Glassfish 2.1.1 using Sun Java System Message Queue 4.4 has no feature to do this, I think so. What are the options on other JMS brokers? Or is the best way, not to use the DMQ/DLQ feature, if you are depend on a message? Thanks a lot

    Read the article

  • Extracting rightmost N bits of an integer

    - by srandpersonia
    In the yester Code Jam Qualification round http://code.google.com/codejam/contest/dashboard?c=433101#s=a&a=0 , there was a problem called Snapper Chain. From the contest analysis I came to know the problem requires bit twiddling stuff like extracting the rightmost N bits of an integer and checking if they all are 1. I saw a contestant's(Eireksten) code which performed the said operation like below: (((K&(1<<N)-1))==(1<<N)-1) I couldn't understand how this works. What is the use of -1 there in the comparison?. If somebody can explain this, it would be very much useful for us rookies. Also, Any tips on identifying this sort of problems would be much appreciated. I used a naive algorithm to solve this problem and ended up solving only the smaller data set.(It took heck of a time to compile the larger data set which is required to be submitted within 8 minutes.). Thanks in advance.

    Read the article

  • Iphone application requiring user registeration?

    - by Lucky
    I am creating an iphone application that requires the users to have an account at my website. But if i have to distribute it through apple store, how should I make the users of this Iphone Application first create an account with my website. There could be a few options like : 1) Ask the user to create an account when he/she tries to run the application on iphone. 2) Provide a 'Sign-Up' page in the Iphone application itself. My question is "Is there any mechanism provided by Apple Store to make the user sign-up to my website before he/she can download the application". Kindly give in your suggestions for the same. Which would be the best approach for solving my problem. Thanks, LG

    Read the article

  • Reducing a normalized table to one value

    - by Dio
    Hello, I'm sure this has been asked but I'm not quite sure how to properly search for this question, my apologies. I have two tables, Foo and Bar. For has one row per Food, bar has many rows per food matching descriptors. Foo name id Apple 1 Orange 2 Bar id description 1 Tasty 1 Ripe 2 Sweet etc (sorry for the somewhat contrived example). I'm trying to return a query where if, for each row in Foo, Bar contains a descriptor in ('Tasty', 'Juicy') return true ex: Output Apple True Orange False I had been solving this somewhat trivially with a case when I only had one item to match select Foo.name, case bar.description when 'Tasty' then True else 'False' end from Foo left join Bar on foo.id = bar.id where bar.description = 'Tasty' But with multiple items, I keep ending up with extra rows: Output Apple True Apple False etc etc Can someone point me in the right direction on how to think about this problem or what I should be doing? Thank you.

    Read the article

  • Working with QWords

    - by Glenn1234
    I'm learning and in the course of that working on an assembler conversion which uses QWORDs a lot (x86-32bit). Now my reference material doesn't have anything on working with such values beyond the obvious of splitting them up into the 32-bit registers. I guess they're on the old side. The newer processors have mmx and sse instructions and the like. Would I be served well to look into those instructions for solving this? What is the best way to handle doing work on QWORD values?

    Read the article

  • The Java interface doesn't declare any exception. How to manage checked exception of the implementat

    - by Frór
    Let's say I have the following Java interface that I may not modify: public interface MyInterface { public void doSomething(); } And now the class implementing it is like this: class MyImplementation implements MyInterface { public void doSomething() { try { // read file } catch (IOException e) { // what to do? } } } I can't recover from not reading the file. A subclass of RuntimeException can clearly help me, but I'm not sure if it's the right thing to do: the problem is that that exception would then not be documented in the class and a user of the class would possibly get that exception an know nothing about solving this. What can I do?

    Read the article

  • Page inheritance in mixed asp.net Forms and MVC application

    - by Rising Star
    I'm working on a web application. One of my co-workers has written some asp.net forms pages. The page classes all inherit from BasePageClass, which of course inherits from the Page class. I wish to add some MVC controllers that I've been told need to use the same logic implemented in the BasePageClass. Ordinarily, I would want to inherit the functions in the BasePageClass in the controller classes, but this breaks the inheritance heirarchy. What is the best practice for solving this problem?

    Read the article

  • What are the standard/practical steps required before moving to implementation of any Project/Task?

    - by jkm
    What are the standard/practical steps required before moving to implementation of any Project/Task? Hi everyone, I liked stackoverflow very much and just got registered. As I am a beginner in programming, most of the time i just implement/code my tasks directly not even thinking of creating any dfd's, flowcharts or other tools for my new classes and methods. In some interviews i was asked what process you follow and i was confused as i am not very used to follow any standards. So If some experts can help me that what steps and in what order are the best practices for solving/approaching any task in programming. And how important these are? Thanks in advance! and sorry if this question is trivial one/already asked.

    Read the article

  • Where is a Web Development Career fueled by Passion? [closed]

    - by JMC Creative
    Quick Background Since learning basic html 5 years ago, I've become completely obsessed with the technology, the logic, and the thrill of solving problems involved with building websites. I am still stuck at a thoroughly non-programming type job, but would really like to move into the field of web programming/design. I have no educational background in the field (was trained as a fine artist and tutor), but in the past few years have progressed fully self-taught (and self-motivated) from html to css to php, mysql, jquery, and am now building rich web applications. The Question How can I prove to a company that even though I have no education, I have a passion to learn whatever is thrown my way? ...That essentially I would come at every issue with not only knowledge, but with a passionate desire to solve it, whether that means tackling a new language or debugging code for hours at a time? p.s. Sorry for the stupid title.

    Read the article

< Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >