Search Results

Search found 1056 results on 43 pages for 'spot'.

Page 23/43 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • Profiling help required

    - by Mick
    I have a profiling issue - imagine I have the following code... void main() { well_written_function(); badly_written_function(); } void well_written_function() { for (a small number) { highly_optimised_subroutine(); } } void badly_written_function() { for (a wastefully and unnecessarily large number) { highly_optimised_subroutine(); } } void highly_optimised_subroutine() { // lots of code } If I run this under vtune (or other profilers) it is very hard to spot that anything is wrong. All the hotspots will appear in the section marked "// lots of code" which is already optimised. The badly_written_function() will not be highlighted in any way even though it is the cause of all the trouble. Is there some feature of vtune that will help me find the problem? Is there some sort of mode whereby I can find the time taken by badly_written_function() and all of its sub-functions?

    Read the article

  • HTML reuse, create template

    - by nanonerd
    After about a year doing Asp.net web forms, I stepped out (for the most part) from the .net world. I'm now working on a webapp that uses a lot of client side scripting and uses WebAPI for data access. I have a HTML section that allows note taking. I would like to make this HTML section into a template that I can reuse elsewhere on the site (e.g., insert this piece of HTML code into another web page). I'm a bit befuddled on how to go about this. Think of my problem as trying to create a "user control" in asp.net web forms ... only that I am not using web forms. Just good old fashioned HTML, CSS, Javascript, jquery, and knockout. Conceptually, I'd think that others have been in the same spot as myself. Can anyone elaborate a solution or at least provide some pointers? Thanks !

    Read the article

  • Align jQuery List

    - by William Lewis
    I'm creating a mobile website with jQuery, and I was wondering if there was a way to align a list to the bottom of a page, I just want the list to stay at the very bottom of the page, and be fixed in the spot. Thanks This is the list im trying to get fixed on the bottom of the page: <div data-role="content"> <div class="content-primary"> <ul data-role="listview"> <li><a href="link.html"><img src="file.jpg" /><h3>List name</h3></a> </li> </div>

    Read the article

  • Forcing an app to run single core only?

    - by Kevin
    I have this strange issue with some third party DLL's. The third party provider references some open source DLL's that have a memory exception whenever I try to use a certain method. This issue does not appear when the app is run on a single core machine, but obviously we cannot assume a user will have that. Is there a way to force an app, or even better yet a referenced DLL to run on a single core? Any other way to possibly fix this? Getting the third party to rebuild the OS dll's is apparently out of the question (its a bit of a sore spot with me currently :) ) so I have to handle it myself or just forget about providing this functionality.

    Read the article

  • Are there design-time watch windows for Visual Studio 2008/2010?

    - by Jeff
    There are many times when I need to test a little snippet of .net code but rebuilding and publishing the entire project or writing a suite of unit tests just seems like overkill. For example, I am writing a regular expression right now and I want to see if it the pattern is matching on the right parts. I could go and find a million other utilities that do that sort of thing, but that is not exactly my point. FireBug has an exact analogue to what I want - the FireBug console. There is a text box where the user can enter some JavaScript and FireBug will execute it on the spot and display the return value. I would love to be able to enter something like (new Regex("b+")).Replace("abc", "x") and see the results without having to do all the overhead. Does VS have anything like this?

    Read the article

  • 3x3 Average filter in matlab

    - by turingcomplete
    I've written code to smooth an image using a 3x3 averaging filter, however the output is strange, it is almost all black. Here's my code. function [filtered_img] = average_filter(noisy_img) [m,n] = size(noisy_img); filtered_img = zeros(m,n); for i = 1:m-2 for j = 1:n-2 sum = 0; for k = i:i+2 for l = j:j+2 sum = sum+noisy_img(k,l); end end filtered_img(i+1,j+1) = sum/9.0; end end end I call the function as follows: img=imread('img.bmp'); filtered = average_filter(img); imshow(uint8(filtered)); I can't see anything wrong in the code logic so far, I'd appreciate it if someone can spot the problem.

    Read the article

  • Having trouble applying style to SVG using JavaScript upon object creation

    - by Jack Roscoe
    Hi, I have a function which creates an SVG text object using JavaScript. As soon as the object is created, I want it to have the style attribute which in CSS would be text-anchor: left. Currently, it doesn't work. I have tried many variations, and I also read that when using styles in JavaScript you must remove any '-' dashes and format the attribute name in camel casing (is this true?). Can anybody spot my mistake? Here's my code: RenderTextBox:function() { this.textBox = paper.text(this.x, this.y, this.htmlTextBox); this.textBox.style.textAnchor="left"; }

    Read the article

  • How to maintain 2 lists of object

    - by michael
    Hi, My c++ program needs to maintain 2 list of objects. list inuse; list free; So objects A can even in 'inuse' list or in 'free' list, but not both. http://www.cplusplus.com/reference/stl/list/ I am think of using 'list' as the data structure for my lists. My questions are 1. why i can't randomly access an elmenet in the list, I look at the above api, I don't see a way to get inuse[2]; 2. How can I remove an element in the list? There is an erase(), but how can I use it to remove element #2? And after I remove element 2? will STL list fill the erased spot automatically? e.g. #3 will become #2, #4 will become #3 and so on? Thank you.

    Read the article

  • How can I display more info in an error message when using NUnit Assert in a loop?

    - by Ian
    Consider the following code: [Test] public void WidgetTest() { foreach (Widget widget in widgets) { Assert.AreEqual(0, widget.SomeValue); } } If one of the asserts fails, I will get a very unhelpful error message like the one below: 1) Test Failure : WidgetTest.TestSomeValue Expected: 0 But was: 1 at WidgetTest.TestSomeValue() So, the question is, how can I get NUnit to display more useful info, such as the name of the widget, or the iteration of the loop, etc? Even a line number would be more helpful, since this is run in automated manner and I'd like to be able to spot the failing assert without debugging into the code.

    Read the article

  • Get data from Joomla jos_users table

    - by RobertR
    Hello, world! I'm trying to build a little bit advanced users system using Joomla, but I stuck at one spot. I added new field on Joomla's jos_users table, but when I wanted to get that field out, like "echo" - it didn't worked at all. Any other data, even password field I can get without problems. Of course, I added new value in /var/www/<project>/libraries/joomla/user/user.php like this after line 40. /** * The users address name * @var string */ var $address = null; What might be the problem here? Or what I did wrong, or what I didn't do at all? Thanks for replies! Cheerio

    Read the article

  • will destroyed() be emitted if the constructor of a class derived from QObject throws?

    - by PorkyBrain
    Ive seen Qt GUI syntax like the following all over the place: myDialog::myDialog(QWidget *parent, Qt::WFlags flags):QDialog(parent, flags) { QPushButton *button = new QPushButton("&Download", this); QVBoxLayout *layout = new QVBoxLayout(this); //something that can throw here layout ->addWidget(button ); setLayout(layout); } I've always wondered if this can leak in the event of an exception because the "this" I'm giving as a parent to button and layout is not fully constructed so it might not destroy its children. I tried it out in MSVC2010 Qt4.8.3 and it looks like as soon as the base QObject class is fully created (which is done first of course) it is ok to pass "this" to other objects in the constructor, they will destroyed correctly. I haven't found the spot in the Qt docs guaranteeing this though, can someone point me to it so I have assurance that this will not change in the future?

    Read the article

  • Unreachable code detected

    - by habbo95
    Hi all, I'm getting a "Unreachable code detected" message in Visual Studio at the point con.close() in my code below. Can you spot what I've done wrong? Thanks private int chek1(String insert) { OleDbConnection con = new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=d:\\sdb.mdb"); OleDbCommand com = new OleDbCommand("select count(*) from sn where sn='" + insert + "\'", con); con.Open(); int po = (int)com.ExecuteScalar(); if (po > 0) return 1; else return 0; con.Close(); }

    Read the article

  • Jquery ajax get - how to output data based on condition?

    - by arunas_t
    Hello, there, I have a such piece of code: $("#choose").change(function(){ $.get("get_results.php", {name: $("#choose").val()}, function(data){ if(data !== ""){ $("#results").html(data); }else{ $("#results").html('<strong>Sorry, no records.</strong>'); } }); }); Now the problem is that the first condition ( if(data !== "") ) is always evaluated correctly and executed, but the else clause ('Sorry, no records') never shows up. Can anyone spot the error? Data passed for the else clause is specifically "". Thank You.

    Read the article

  • Error message: "$(window).width is not a function"

    - by Crippletoe
    Hi all, i am trying to use a jQuery scrollbar called "Jscrollhorizontalpane". when i am trying to use it i get the following error message: "$(window).width is not a function" in firebug's console. i am new to jQuery do this might be very basic but still, i dont know what that means and why there is a problem. the scroller comes in a bundle with a few files, one of which is called "jScrollHorizontalPane.js" and i believe it holds the code for the scroller. i tried replacing $ signs there with the word "jQuery" (in case there is a conflict) but it didnt seem to help. also important to add that on the same page i am using another jQuery scroller (a vertical one as opposed to the horizontal on mentioned above) which works just fine and when i examined it's .js file, i could spot lines with "$(window).width". any ideas?

    Read the article

  • Feedback + Bad output

    - by user1770094
    So I've got an assignment I think I'm more or less done with, but there is something which is messing up the output badly somewhere down the line, or even the calculation, and I don't see where the problem is. The assignment is to make a game in which a certain ammount of players run up through a tunnel towards a spot,where they will stop and spin around it,and then their dizziness is supposed to make them randomly either progress towards goal or regress back towards start.And each time they get another spot closer to goal,they get another "marking",and it goes on like this until one of them reaches goal. The program includes three files: one main.cpp,one header file and another cpp file. The header file: #ifndef COMPETITOR_H #define COMPETITOR_H #include <string> using namespace std; class Competitor { public: void setName(); string getName(); void spin(); void move(); int checkScore(); void printResult(); private: string name; int direction; int markedSpots; }; #endif // COMPETITOR_H The second cpp file: #include <iostream> #include <string> #include <cstdlib> #include <ctime> #include "Competitor.h" using namespace std; void Competitor::setName() { cin>>name; } string Competitor::getName() { return name; } void Competitor::spin() { srand(time(NULL)); direction = rand()%1+0; } void Competitor::move() { if(direction == 1) { markedSpots++; } else if(direction == 0 && markedSpots != 0) { markedSpots--; } } int Competitor::checkScore() { return markedSpots; } void Competitor::printResult() { if(direction == 1) { cout<<" is heading towards goal and has currently "<<markedSpots<<" markings."; } else if(direction == 0) { cout<<"\n"<<getName()<<" is heading towards start and has currently "<<markedSpots<<" markings."; } } The main cpp file: #include <iostream> #include <string> #include <cstdlib> #include <ctime> #include "Competitor.h" using namespace std; void inputAndSetNames(Competitor comps[],int nrOfComps); void makeTwist(Competitor comps[],int nrOfComps); void makeMove(Competitor comps[],int nrOfComps); void showAll(Competitor comps[],int nrOfComps); int winner(Competitor comps[],int nrOfComps, int nrOfTwistPlaces); int main() { int nrOfTwistPlaces; int nrOfComps; int noWinner = -1; int laps = 0; cout<<"How many spinning places should there be? "; cin>>nrOfTwistPlaces; cout<<"How many competitors should there be? "; cin>>nrOfComps; Competitor * comps = new Competitor[nrOfComps]; inputAndSetNames(comps, nrOfComps); do { laps++; cout<<"\nSpin "<<laps<<":"; makeTwist(comps, nrOfComps); makeMove(comps, nrOfComps); showAll(comps, nrOfComps); }while(noWinner == -1); delete [] comps; return 0; } void inputAndSetNames(Competitor comps[],int nrOfComps) { cout<<"Type in the names of the "<<nrOfComps<<" competitors:\n"; for(int i=0;i<nrOfComps;i++) { comps[i].setName(); } cout<<"\n"; } void makeTwist(Competitor comps[],int nrOfComps) { for(int i=0;i<nrOfComps;i++) { comps[i].spin(); } } void makeMove(Competitor comps[],int nrOfComps) { for(int i=0;i<nrOfComps;i++) { comps[i].move(); } } void showAll(Competitor comps[],int nrOfComps) { for(int i=0;i<nrOfComps;i++) { comps[i].printResult(); } cout<<"\n\n"; system("pause"); } int winner(Competitor comps[],int nrOfComps, int nrOfTwistPlaces) { int end = 0; int score = 0; for(int i=0;i<nrOfComps;i++) { score = comps[i].checkScore(); if(score == nrOfTwistPlaces) { end = 1; } else end = -1; } return end; } I'd be grateful if you would point out other mistakes if you see any.Thanks in advance.

    Read the article

  • ActiveRecord date format

    - by Mongus Pong
    I've run into a spot of bother with date formats in our Rails application. I have a date field in our view which I want to be formatted as dd/mm/yy. This is how the user will expect to enter their dates, and the datepicker control uses this format. However, Active Record seems to be expecting mm/dd/yy. If I enter 01/03/2010, this gets put in as 03 January 2010. If I enter 25/03/2010, this gets put in a null. How do I get ActiveRecord to expect Her Majesties date format?

    Read the article

  • Is it possible to make an online registration process for a course in Google Docs with a cap on registrations?

    - by user61551
    I am trying to build an online registration form for an institute I intern at that is running a training programme with multiple courses and hundreds of applicants. I've done registration forms with Google Docs Forms before, but the tricky spot this time round is that I'm trying to put a registration cap on each of the courses. Every person needs to register for one course in every timeslot, and there are seven or so timeslots. However, as seating space in every venue is limited, we would like to cap registrations per course (venue) to 200 per course, after which either a) the applicant will be informed that they need to register for another course in that timeslot if they apply to a full course, or b) ideal case scenario, the option will be greyed out. Is this possible using Google Docs Forms at all? If not, is there a free alternative that might do the job properly?

    Read the article

  • Jquery Templeate, droping last item off in the each

    - by Lawrence
    Currently I am using jquery templating with some json data, I have a couple images that I am getting and I would like to drop the last image that I am getting from my json data. Right now I have this coded ( this only a snippet of the spot I am having the problem at): <div class="altViews"> <ul class="clearfix"> {{each(i,addImage) AdditionalImages}} <li class="altImage"> <img src="http://images.url.com/images/products/${addImage}" alt="${Name}" id="${addImage}"/> </li> {{/each}} </ul> </div> SO the main help I need is to be able to drop the last li, I just dont know how to use my index to do that.

    Read the article

  • Having trouble getting GET variables from url.

    - by mchl
    Hey everyone, I'm having trouble with this algorithm to extract the get variables from a url and print them each on a new line like: x=y z=hello etc. but instead it prints a seemingly random section of the url with no newlines to the file. There must be a logic error of some kind but i just can't spot it. for(i_m=0;i_m<len_m;i_m++) { if(var_m[i_m]=='&') { fwrite(var_m+offset_m, 1, amp_m, echo_out); fputc('\n',echo_out); offset_m+=amp_m; amp_m=0; } amp_m++; } any help appreciated.

    Read the article

  • Handling ?aspxerrorpath=<script

    - by user1074559
    I have an issue where adding this to any asp.net request causes and unhandled error (regardless of CustomErrors setting): ?aspxerrorpath=<script The weird thing is that I have two applications that are totally immune to the problem, but I can't spot the difference. I'm running on IIS 7 and using the 4.0 Framework. But this also happens on my 3.5 IIS 6 apps. Again, I have two sites that are fine (IIS 7, 4.0) but can't determine why. I have tried turning off request validation to no avail. Has anyone encountered something similar? FIXED: This looks like it was an Umbraco issue. It was ignoring my validateRequest="false" in the web.config. Adding this to the template fixed it:

    Read the article

  • Rotation in a Vector2d class in Java

    - by wanstein
    I've been working on this for one hour, just can't get it. I have a Vector2d class: public class Vector2d { public double x = 0.0; public double y = 0.0; .... } This vector class has a rotate() method which is causing me trouble. The first snippet seems to make the x and y values smaller and smaller. The second one works just fine! Am I missing something simple here? public void rotate(double n) { this.x = (this.x * Math.cos(n)) - (this.y * Math.sin(n)); this.y = (this.x * Math.sin(n)) + (this.y * Math.cos(n)); } This works: public void rotate(double n) { rx = (this.x * Math.cos(n)) - (this.y * Math.sin(n)); ry = (this.x * Math.sin(n)) + (this.y * Math.cos(n)); x = rx; y = ry; } I just can't spot any difference there

    Read the article

  • C++: Copying to dereferenced pointer...

    - by bbb
    Hi. I currently have a weird problem with a program segfaulting but im not able to spot the error. I think the problem boils down to this. struct S {int a; vector<sometype> b;} S s1; // fill stuff into a and b S* s2 = new S(); *s2 = s1; Could it be that the final copying is illegal in some way? Im really confused right now... Thanks

    Read the article

  • PHP: Remove all fcn not acting as expected, Code Inside

    - by Josh K
    I made this simple function (remove all $elem from $array): function remall($array, $elem) { for($i=0; $i < count($array); $i++) if($array[$i] == $elem) unset($array[$i]); $newarray = array_values($array); return $newarray; } But it isn't working perfectly, here are some inputs and outputs $u = array(1, 7, 2, 7, 3, 7, 4, 7, 5, 7, 6, 7); $r = remall($u, 7); Output of $r: 12345767 $n = array(7, 7, 1, 7, 3, 4, 6, 7, 2, 3, 1, -3, 10, 11, 7, 7, 7, 2, 7); $r = remall($n, 7); Output of $r: 1346231-30117727 Notice how there are still 7s in my outputs. Also, My function will only be removing numbers from an array. Let me know if you spot something, thanks.

    Read the article

  • Ignoring specific differences in diff

    - by naumcho
    When doing recursive diffs I want to ignore expected differences/translations - is there a way to do that with standard unix tools? E.g. file1: 1 ... 2 /path/to/something/ver1/blah/blah 3 /path/to/something/ver1/blah/blah 4 ... file2: 1 ... 2 /path/to/something/ver2/blah/blah 3 /path/to/something/ver3/blah/blah 4 ... I want to be able to do something like: diff file1 file2 --ignore-transltion "ver1>ver2" This should show only show me that line 3 is different Does anyone know of a good way to do that? I can easily write a perl script to do it but i will end up re-implementing most of the rest of the functionality of 'diff'. Update: My goal is to run this on directories with different versions of the same files with "diff -r" so I can spot unexpected differences in versions.

    Read the article

  • Can you ask Google how common a search is?

    - by John
    I'm not familiar with Google Analytics but I think you can use it to see how many people get to your site using different search strings. But if you don't yet have the site, can you simply ask Google how popular a search is? For instance say you're choosing a new product name/slogan/etc. First of all, you want to see if that is already very crowded, which is easy through just Googling it. But now you might want to see if anyone is actually searching for this... an ideal situation would be to find a search-string lots of people are using, which doesn't put your competitors on the #1 spot. Is this possible? Not exactly programming-related, but closely related to web-development IMO... please vote to close if you disagree, I won't be offended!

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >