Search Results

Search found 3160 results on 127 pages for 'nomad zero'.

Page 69/127 | < Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >

  • Strlen of MAX 16 chars string using bitwise operators

    - by fabrizioM
    The challenge is to find the fastest way to determine in C/C++ the length of a c-string using bitwise operations in C. char thestring[16]; The c-string has a max size of 16 chars and is inside a buffer If the string is equal to 16 chars doesn't have the null byte at the end. I am sure can be done but didn't got it right yet. I am working on this at the moment, but assuming the string is memcpied on a zero-filled buffer. len = buff[0] != 0x0 + buff[1] != 0x0 + buff[2] != 0x0 + buff[3] != 0x0 + buff[4] != 0x0 + buff[5] != 0x0 + buff[6] != 0x0 + buff[7] != 0x0 + buff[8] != 0x0 + buff[9] != 0x0 + buff[10] != 0x0 + buff[11] != 0x0 + buff[12] != 0x0 + buff[13] != 0x0 + buff[14] != 0x0 + buff[15] != 0x0;

    Read the article

  • DSP - How are frequency amplitudes modified using DFT?

    - by Trap
    I'm trying to implement a DFT-based equalizer (not FFT) for the sole purpose of learning. To check if it works I took an audio signal, analyzed it and then resynthesized it again with no modifications made to the frequency spectrum. So far so good. Now I tried to silence some frequency bands, just by setting their amplitudes to zero before resynthesis, but definitely it's not the way to go. What I get is a rather distorted signal. I'm using the so-called 'standard way of calculating the DFT' which is by correlation. I first tried to modify the real part amplitudes only, then modifying both the real and imaginary part amplitudes. I also tried to convert the DFT output to polar notation, then modifying the magnitude and convert back to rectangular notation, but none of this is working. Can someone show me what I'm doing wrong? I tried to find info on this subject in the internet but couldn't find any. Thanks in advance.

    Read the article

  • Writing a rails validator with integer

    - by user297008
    I was trying to write a validation for Rails to ensure that a price entered on a form was greater than zero. It works…sort of. The problem is that when I run it, val is turned into an integer, so it thinks that .99 is less than .1. What's going on, and how should I fix the code? class Product < ActiveRecord::Base protected def self.validates_greater_than_zero(*attr_names) validates_each(attr_names) do |record, attr, val| record.errors.add(attr, "should be at least 0.01 (current val = #{val.to_f})") if val.nil? || val < 0.01 end end public validates_presence_of :title, :description, :image_url validates_numericality_of :price validates_greater_than_zero :price end

    Read the article

  • Are these good interview questions for Flex developer?

    - by Ivan Belov
    I am responsible for creating a team, which will build a Flex application. Unfortunately I have zero experience with Flex. So I found an expert within our company to interview candidates. Our expert came up with the following questions: how to write item renderers explain methods commitProperties, updateDisplayList, measure binding positive / negative parts, problems with binding what is ClassFactory ? And why is it needed ? how callLater works ? what is layoutChrome ? what is skin ? did you use autogeneration for Java backend ? how to override managers ? like PopupManager . These sound a little too specific for my taste. Would you say they are decent questions? Is it fair to say, for example, that if Flex developer does not know how to write item renderer, he has very little knowledge of Flex?

    Read the article

  • Seemingly useless debugging environment for Android

    - by mikeY
    I've just started debugging my first three line long android app and I can't seem to use the debug tool like I want to. Here's my code: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); int a = 1 / 0; } Now I expect the debugger to halt the thread and show me the line number of statement where the division by zero occurs. No, instead it shows some other method internal to the system for which I have no source. To make the matters worse, there is no exception message either. Prior to this app, I created one which would do something when a button was pressed. If any exception was raised, again no useful line number or exception message would be shown. As of right now, there is no way to debug my app. Any ideas? I'm using the latest SDK along with Eclipse ADT plugin and debugging on a real device (Nexus One).

    Read the article

  • Returning Index in Enumerable Select

    - by Jon
    I have a List<MyClass> with 2 items which have a SequenceNumber property. If I use this code below the returned index is 0 not 1: var test = TrackingCollection .Where(x => x.SequenceNumber == 2) .Select((item, index) => new { index, item.SequenceNumber }); Is this because that refers to 0 as the index in my new anonymous type or is it some zero index based weirdness that I just need to increment. What I'm after is to return the index in TrackingCollection where the sequence number is 2 or 887 or any other correct index in the original collection...

    Read the article

  • Large Scale VHDL modularization techniques

    - by oxinabox.ucc.asn.au
    I'm thinking about implimenting a 16 bit CPU in VHDL. A simplish CPU. ADD, MULS, NEG, BitShift, JUMP, Relitive Jump, BREQ, Relitive BREQ, i don't know somethign along these lines Probably all only working with 16bit operands. I might even cut it down and use only a single operand and a accumulator. With Some status regitsters, Carry, Zero, Neg (unless i use a Accumlator), I know how to design all the parts from logic gates, and plan to build them up from first priciples, So for my ALU I'll need to 'build' a ADDer, proably a Carry Look ahead, group adder, this adder it self is make up oa a couple of parts, wich are themselves made up of a couple of parts. Anyway, my problem is not the CPU design, or the VHDL (i know the language, more or less). It's how i should keep things organised. How should I use packages, How should I name my processes and port maps? (i've never seen the benifit of naming the port maps, or processes)

    Read the article

  • struct method linking

    - by James
    I'm updating some old code that has several POD structs that were getting zero'd out by memset (don't blame me...I didn't write this part). Part of the update changed some of them to classes that use private internal pointers that are now getting wiped out by the memset. So I added a [non-virtual] reset() method to the various structs and refactored the code to call that instead. One particular struct developed an "undefined reference to `blah::reset()'" error. Changing it from a struct to a class fixed the error. Calling nm on the .o file h, the mangled function names for that method look the same (whether it's a class or a struct). I'm using g++ 4.4.1, on Ubuntu. I hate the thought that this might be a compiler/linker bug, but I'm not sure what else it could be. Am I missing some fundamental difference between structs and classes? I thought the only meaningful ones were the public/private defaults and the way everyone thinks about them.

    Read the article

  • C# 4: conflicting overloaded methods with optional parameters

    - by Thomas
    I have two overloaded methods, one with an optional parameter. void foo(string a) { } void foo(string a, int b = 0) { } now I call: foo("abc"); interestingly the first overload is called. why not the second overload with optional value set to zero? To be honest, I would have expect the compiler to bring an error, at least a warning to avoid unintentional execution of the wrong method. What's the reason for this behaviour? Why did the C# team define it that way? Thanks for your opinions!

    Read the article

  • How to implement a Counter Cache in Rails?

    - by yuval
    I have a posts controller and a comments controller. Post has many comments, and comments belong to Post. The associate is set up with the counter_cache option turned on as such: #Inside post.rb has_many :comments #Inside comment.rb belongs_to :post, :counter_cache => true I have a comments_count column in my posts table that is defaulted to zero, as such: add_column :posts, :comments_count, :integer, :default => 0 In the create action of my comments controller, I have the following code: def create @posts = Post.find(params[:post_id]) @comment = @post.comments.build(params[:comment]) if @comment.save redirect_to root else render :action => 'new' end end My problem: when @comment.save is called, I get the following error: ArgumentError in CommentsController#create wrong number of arguments (2 for 0) Removing :counter_cache => true from comment.rb completely solves the problem, so I'm assuming that it is the cause of this vague error. What am I missing here? How can I save my comment and still have rails take care of my counter_cache for my post? Thanks!

    Read the article

  • System.AccessViolation in DllImport method after redeploy

    - by gall
    Hi Everyone, My environment: Windows 2003, VS 2008, .NET 3.5 C# .NET application. During loading my application I call method from C++ dll (Knowl.dll) through my third-party dll library (Common.dll) written in C#. After first deploy (from VS to Developing server) evrything works fine. Then I stops Developing Server, doesn't any changes in code and redeploy. Throws AccessViolationException on this imported method. What is it? On second and after redeplies - the same error. Only after deletin source code and recheckout it from CVS I can normally start server. Dll import: [DllImport("Knowl.dll", EntryPoint = "GetBaseName")] private static extern IntPtr getNameDll(); public static string GetName() { IntPtr p = IntPtr.Zero; p = getNameDll(); return Marshal.PtrToStringUni(p); }

    Read the article

  • How to create Encryption Key for Encryption Algorithms?

    - by Akash Kava
    I want to use encryption algorithm available in .Net Security namespace, however I am trying to understand how to generate the key, for example AES algorithm needs 256 bits, that 16 bytes key, and some initialization vector, which is also few bytes. Can I use any combination of values in my Key and IV? e.g. all zeros in Key and IV are valid or not? I know the detail of algorithm which does lots of xors, so zero wont serve any good, but are there any restrictions by these algorithms? Or Do I have to generate the key using some program and save it permanently somewhere?

    Read the article

  • Unselected UIPickerView value

    - by morticae
    According to the documentation, if a UIPickerView has no selected value, the expected return from selectedRowInComponent: should be: "A zero-indexed number identifying the selected row, or -1 if no row is selected." However, if I check the value the very line after initializing one, its value is 0. Even if I then manually set it to -1, it still returns 0. I would like to be able to detect whether the user has chosen a value yet or not, without recording it in a local variable. Is this possible? example: UIPickerView *picker = [[UIPickerView alloc] initWithFrame:CGRectMake(0.0, 46.0, 320.0, 216.0)]; [picker selectRow:-1 inComponent:0 animated:NO]; NSLog(@"SELECTED %d", [picker selectedRowInComponent:0]); expected output: SELECTED -1 actual output: SELECTED 0

    Read the article

  • jQuery AJAX not redirecting?

    - by MidnightLightning
    I have a simple PHP page (for testing) that simply calls header("Location: http://www.example.com");exit;, which resides on the same server, in the same directory as another file with the following jQuery Javascript: $(document).ready(function() { jQuery.ajax({ type : 'GET', url : 'bounce.php', error : function(xhr, status, error) { console.log("ERROR: ", xhr, xhr.status, xhr.getAllResponseHeaders()); }, complete : function(xhr, status) { // Get headers of the response console.log("COMPLETE: ", xhr, xhr.status, xhr.getAllResponseHeaders()); } }); }); I was expecting (from several other StackOverflow responses) for the xhr.status to return "302", but instead the AJAX call is triggering the "error" event (and then the "complete" event), and xhr.status is returning 0 (zero), and .getAllResponseHeaders() is coming back null (in both the error, and complete functions). Firebug is showing the "302 Moved Temporarily", and the response headers. So why is this triggering the error event, and not passing along the proper 302 code, and headers? Is this something to do with the Same Origin since the bouncing script and the fetching script are both on the same server? Is this jQuery or Javascript's fault?

    Read the article

  • MATLAB using MAT2CELL

    - by Ali
    i have the following matrices letter=[A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ... a b c d e f g h ii jj k l m o p q r s t u v w x y z]; number=[one two three four five six seven eight nine zero]; character =[number letter]; Character becomes a matrix of 42 by 1464, but i would like to break it into cells of 42 by 24 using mat2cell. How can i please do it, every time i try i get an error????

    Read the article

  • Joda-Time: Period to string

    - by tt
    I'm using the Joda-Time library with Java. I'm having some difficulty trying to turn a Period object to a string in the format of "x days, x hours, x minutes". These Period objects are first created by adding an amount of seconds to them (they are serialized to XML as seconds and then recreated from them). If I simply use the getHours() etc. methods in them, all I get is zero and the total amount of seconds with getSeconds. How can I make Joda calculate the seconds into the respective fields, like days, hours, etc...?

    Read the article

  • Code Golf: Beehive

    - by LiraNuna
    The challenge The shortest code by character count that will generate a beehive from user input. A beehive is defined a a grid of hexagons in a size inputted by the user as two positive numbers greater than zero (no need to validate input). The first number (W) represents the width of the beehive - or - how many hexagons are on each row. The second number (H) represents the height of the beehive - or - how many hexagons are on each column. A Single hexagon is made from three ASCII characters: _, / and \, and three lines: __ / \ \__/ Hexagons complete each other: the first column of the beehive will be 'low', and the second will be high - alternating and repeating in the same pattern forming W hexagons. This will be repeated H times to form a total of WxH hexagons. Test cases: Input: 1 1 Output: __ / \ \__/ Input: 4 2 Output: __ __ __/ \__/ \ / \__/ \__/ \__/ \__/ \ / \__/ \__/ \__/ \__/ Input: 2 5 Output: __ __/ \ / \__/ \__/ \ / \__/ \__/ \ / \__/ \__/ \ / \__/ \__/ \ / \__/ \__/ Input: 11 3 Output: __ __ __ __ __ __/ \__/ \__/ \__/ \__/ \__ / \__/ \__/ \__/ \__/ \__/ \ \__/ \__/ \__/ \__/ \__/ \__/ / \__/ \__/ \__/ \__/ \__/ \ \__/ \__/ \__/ \__/ \__/ \__/ / \__/ \__/ \__/ \__/ \__/ \ \__/ \__/ \__/ \__/ \__/ \__/ Code count includes input/output (i.e full program).

    Read the article

  • why create "EventType clr20r3, P1 w3wp.exe" but don't have detail description of this unhandled exce

    - by Weixiao.Fan
    On the production server, I can see event from system Event Viewer when an asp.net app crash: *EventType clr20r3, P1 w3wp.exe, P2 6.0.3790.3959, P3 45d691cc, P4 app_web_default.aspx.cdcab7d2, P5 0.0.0.0, P6 4b2e4bf0, P7 4, P8 4, P9 system.dividebyzeroexception, P10 NIL.* it belongs to ".NET Runtime 2.0 Error Reporting" category. but I can't find a event which belongs to "ASP.NET 2.0.50727.0" which can give me this exception a detail view: *An unhandled exception occurred and the process was terminated. Application ID: /LM/W3SVC/505951206/Root Process ID: 1112 Exception: System.DivideByZeroException Message: Attempted to divide by zero. StackTrace: at _Default.Foo(Object state) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack) at System.Threading.ThreadPoolWaitCallback.PerformWaitCallback(Object state) For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp I can find these two event on my dev machine, because of Visual Studio installing? If so, how can I disable this so I can emulate production environment? Great thanks and best regards, Fan

    Read the article

  • Where to specify line height for sIFR

    - by Darren
    I have not had any luck changing the line height for sIFR. I have tried changing the sIFR css and config file as well as my general style sheet. Is there a special trick? GENERAL CSS h1 { font-family: Georgia, Times, serif; font-size: 24px; font-style: normal; line-height: 16px; (has had zero impact, even when I go negative) color: #000000; text-transform: uppercase; margin: 0; padding: 0; outline: none; } CONFIG FILE sIFR.replace(minionpro, { selector: 'h1', wmode: 'transparent', css: '.sIFR-root { color:#000000; text-transform: uppercase; }' });

    Read the article

  • PyQt: Get the position of QGraphicsWidgets in a QGraphicsGridLayout

    - by Chris Phillips
    I have a fairly simple PyQt application in which I'm placing instances of a QGraphicsWidget in a QGraphicsGridLayout and want to connect the widgets with lines drawn with a QGraphicsPath. Unfortunately, no matter what I try, I always get (0, 0) back as the position for both the start and end widgets. I'm constructing the graph with a recursive function that adds widgets to the scene and layout. Once the recursive function is complete, the layout is added to a new widget, which is added to the scene to show everything. The edges are added to the scene as widgets are created. How do I get a non-zero position of any of the widgets in the grid layout?

    Read the article

  • If the UIApplicationMain() never returns then when does the autorelease pool gets released?

    - by sid
    For code: int main(int argc, char *argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, nil, nil); [pool release]; return retVal; } Apple's doc clearly specifies: Return Value: Even though an integer return type is specified, this function never returns. When users terminate an iPhone application by pressing the Home button, the application immediately exits by calling the exit system function with an argument of zero. Secondly, in int UIApplicationMain ( int argc, char *argv[], NSString *principalClassName, NSString *delegateClassName ); how can we access the argv from our UIApplication subclass?

    Read the article

  • valueOf() vs. toString() in Javascript

    - by brainjam
    In Javascript every object has a valueOf() and toString() method. I would have thought that the toString() method got invoked whenever a string conversion is called for, but apparently it is trumped by valueOf(). For example, the code var x = {toString: function() {return "foo"; }, valueOf: function() {return 42; }}; window.console.log ("x="+x); window.console.log ("x="+x.toString()); will print x=42 x=foo This strikes me as backwards .. if x were a complex number, for example, I would want valueOf() to give me its magnitude (so that zero would become special), but whenever I wanted to convert to a string I would want something like "a+bi". And I wouldn't want to have to call toString() explicitly in contexts that implied a string. Is this just the way it is?

    Read the article

  • iPhone UIImage initWithData fails

    - by DD
    Hello all, I'm trying to code up an async image downloader. I use NSURLConnection to get the data into an NSMutableData and use that data once it is complete to initialize a UIImage. I checked the bytes and it downloads the entire image correctly (right number of bytes at least), however; when I call [UIImage imageWithData:data] and then check the properties of the image, it is zero width and a garbage number for height, in fact, same number no matter what the image is. I tried with bunch of different images, png, jpg, different urls, it always downloads the image completely but UIImage can't initialize with that data. What could I be doing wrong here? Thanks.

    Read the article

  • lmerTest package install failing on Ubuntu 12.04

    - by Alexandra Tyers
    I'm running Ubuntu 12.04.5 LTS precise 32-bit and trying to install the lmerTest package for R version 2.14.1... When I try to install from the CRAN repository or R-forge: install.packages("lmerTest") or install.packages("lmerTest", repos="http://R-Forge.R-project.org"), I get the error: Warning in install.packages : package ‘lmerTest’ is not available (for R version 2.14.1) So I downloaded the Package Archive File from CRAN and tried to install from this Package source: lmerTest_2.0-11.tar.gz ,but get the error: "installation of package /home/.../lmerTest_2.0-11.tar.gz’ had non-zero exit status" I had a similar problem when trying to install lme4, and using the advice from lme4 package install failing on Ubuntu 12.04 was able to download the package using "sudo apt-get install r-cran-lme4" after which it appeared in my R package list and installed fine from there. I tried a similar tactic with lmerTest "sudo apt-get install r-cran-lmerTest" but just get "Unable to locate package r-cran-lmerTest", so really don't know what to do now, bearing in mind that I'm a novice with both Ubuntu and R, any suggestions/help would be much appreciated

    Read the article

  • May the FileInputStream.available foolish me?

    - by Tom Brito
    This FileInputStream.available() javadoc says: Returns an estimate of the number of remaining bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream. The next invocation might be the same thread or another thread. A single read or skip of this many bytes will not block, but may read or skip fewer bytes. In some cases, a non-blocking read (or skip) may appear to be blocked when it is merely slow, for example when reading large files over slow networks. I'm not sure if in this check: if (new FileInputStream(xmlFile).available() == 0) can I rely that empty files will always return zero?

    Read the article

< Previous Page | 65 66 67 68 69 70 71 72 73 74 75 76  | Next Page >