Search Results

Search found 6374 results on 255 pages for 'double underscore'.

Page 27/255 | < Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >

  • Avoid incompatible pointer warning when dealing with double-indirection

    - by fnawothnig
    Assuming this program: #include <stdio.h> #include <string.h> static void ring_pool_alloc(void **p, size_t n) { static unsigned char pool[256], i = 0; *p = &pool[i]; i += n; } int main(void) { char *str; ring_pool_alloc(&str, 7); strcpy(str, "foobar"); printf("%s\n", str); return 0; } ... is it possible to somehow avoid the GCC warning test.c:12: warning: passing argument 1 of ‘ring_pool_alloc’ from incompatible pointer type test.c:4: note: expected ‘void **’ but argument is of type ‘char **’ ... without casting to (void**) (or simply disabling the compatibility checks)? Because I would very much like to keep compatibility warnings regarding indirection-level...

    Read the article

  • Grammatically correct double-noun identifiers, plural versions

    - by Michal Czardybon
    Consider compounds of two nouns, which in natural English would most often appear in the form "noun of noun", e.g. "direction of light", "output of a filter". When programming we usually write "LightDirection" and "FilterOutput". Now, I have a problem with plural nouns. There are two cases: 1) singular of plural e.g. "union of (two) sets", "intersection of (two) segments" Which is correct, SetUnion and SegmentIntersection or SetsUnion and SegmentsIntersection? 2) plural of plural There are two subcases: (a) Many elements, each having many related elements, e.g. "outputs of filters" (b) Many elements, each having single related element, e.g. "directions of vectors" Shell I use FilterOutputs and VectorDirections or FiltersOutputs and VectorsDirections? I suspect correct is the first version (FilterOutupts, VectorDirections), but I think it may lead to ambiguities, e.g. FilterOutputs - many outputs of a single filter or many outputs of many filters? LineSegmentProjections - projections of many segments or many projections of a single segment?

    Read the article

  • Eclipse: Double semi-colon on an import

    - by smp7d
    Using Eclipse, if I have an extra semicolon on an import line (not the last import line), I see a syntax error in the IDE. However, this compiles fine outside of the IDE (Maven in this case). Example: import java.util.ArrayList;; //notice extra semicolon import java.util.List; Does anyone else see this behavior? Why is this showing as a syntax error? I am working with someone who keeps pushing these this to source control and it is irritating me (they clearly aren't using Eclipse). Full disclosure... I am using SpringSource Tool Suite 2.8.0.

    Read the article

  • Double Inner Join generates unexpected error

    - by Itamar Marom
    In my database I have three tables: Users: UserID (Auto Numbering), UserName, UserPassword and a few other unimportant fields. PrivateMessages: MessageID (Auto Numbering), SenderID and a few other fields defining the message content. MessageStatus: MessageID, ReceiverID, MessageWasRead (Boolean) What I need is a query to which I input a user's id and I get all the private messages he has received. In addition, I also need to receive each message's sender UserName. For this I wrote the following query: SELECT Users.*, PrivateMessages.*, MessageStatus.* FROM PrivateMessages INNER JOIN Users ON PrivateMessages.SenderID = Users.UserID INNER JOIN MessageStatus ON PrivateMessages.MessageID = MessageStatus.MessageID WHERE MessageStatus.ReceiverID=[@userid]; But for some reason when I try saving it in my Access database, I get the following error (translated to English by me, since my office is in a different language): Syntax error (missing operator) at expression: "PrivateMessages.SenderID = Users.UserID INNER JOIN MessageStatus ON PrivateMessages.MessageID = MessageStatus.MessageI". Any ideas what could cause this? Thanks.

    Read the article

  • Python - removing double quotation marks " so that script runs

    - by andrew k
    I am using Python scripts to edit the table of many shape files. The following script runs fine, but if there are any " marks in the SIT_FULL_S field, the script errors and shuts down. gp.CalculateField_management(fc + "\\Parcels.shp","SIT_FULL_S", "!SIT_FULL_S!.lstrip('0')", "PYTHON") arcgisscripting.ExecuteError: ERROR 000539: Error running expression: "9030 W SR 2 HWY "A"".lstrip('0') <type 'exceptions.SyntaxError'>: invalid syntax (<string>, line 1) Failed to execute (CalculateField). I have two options, create a new script that runs through and deletes all occurances of ", and then run the above script or modify the above script to ignore the " and contiue running. Can anyone help ?

    Read the article

  • Spaces around all hyphens in a string without double-up

    - by Dave
    I'm after a regex that puts spaces around each "-" in a string, eg. 02 jaguar-leopard, tiger-panther 08 would become 02 jaguar - leopard, tiger - panther 08 Note that if the "-" already has spaces around it, no changes are to be made, eg. 02 jaguar - leopard, tiger - panther 08 should not become 02 jaguar - leopard, tiger - panther 08 The number of hyphens are unknown in advance. Thanks for any ideas... Edit: I'm not actually using a language for this. I'm using Ant Renamer (a mass file renaming utility). There are two fields in the renamer GUI, "Expression" and "New name" to provide inputs. This is from the help file as an example: Swapping artist and title from mp3 file names: "Expression" = (.*) - (.*)\.mp3 "New name" = $2 - $1.mp3 Extract episode number and title from series video files with episode number as SnnEmm followed by title: "Expression" = Code\.Quantum\.S([0-9]{2})E([0-9]{2})\.(.*)\.FRENCH.XViD\.avi "New name" = Code Quantum - $1$2 - $3.avi

    Read the article

  • Batch file crashes when double clicked, but passes from command prompt

    - by devinb
    I have a batch file that was crashing when executing from windows explorer. I opened a command prompt and navigated to the file, but when I executed it there it did not crash. I identified the line that was crashing. SET list =(Company.Framework^ Company.SharePoint.Lists.News^ Company.SharePoint.WebControls^ Company.SharePoint.WebParts.NewsList^ Company.SharePoint.WebParts.RedirectWebPart^ Company.SharePoint.WebParts.IFrameWebPart^ Company.SharePoint.WebParts.ItemRotatorWebPart^ Company.SharePoint.WebParts.InteractiveMapWebPart^ Company.SharePoint.WebParts.SiteMapWebPart^ Company.SharePoint.Branding.PrettyUnicorns) ::Do stuff ::Failure occurs here FOR %%F in %list% DO ( ::Doesn't matter what is in here ECHO Woo! ) Is any reason why a batch file would behave differently from Windows Explorer vs Command Prompt?

    Read the article

  • (gcc) Multi-Dim Array or Double Pointer for Warning-free Compile

    - by paul simmons
    Hi, I have a function, which is called sometimes with regular, sometimes dynamic arrays. If I define the function as function_name(int[10][10] a) and send int** as a parameter, I get a warning. Opposite, if I declare function_name(int** a) and send int[][] as a parameter (after casting) I cannot access to array elements inside function. What is the correctest way?

    Read the article

  • Getting counts of 0 from a query with a double group by

    - by Maltiriel
    I'm trying to write a query that gets the counts for a table (call it item) categorized by two different things, call them type and code. What I'm hoping for as output is the following: Type Code Count 1 A 3 1 B 0 1 C 10 2 A 0 2 B 13 2 C 2 And so forth. Both type and code are found in lookup tables, and each item can have just one type but more than one code, so there's also a pivot (aka junction or join) table for the codes. I have a query that can get this result: Type Code Count 1 A 3 1 C 10 2 B 13 2 C 2 and it looks like (with join conditions omitted): SELECT typelookup.name, codelookup.name, COUNT(item.id) FROM typelookup LEFT OUTER JOIN item JOIN itemcodepivot RIGHT OUTER JOIN codelookup GROUP BY typelookup.name, codelookup.name Is there any way to alter this query to get the results I'm looking for? This is in MySQL, if that matters. I'm not actually sure this is possible all in one query, but if it is I'd really like to know how. Thanks for any ideas.

    Read the article

  • Basic help needed with pointers (double indirection)

    - by sbsp
    Hi, i asked some time ago on an account i cant remember how to manipulate basic pointers and someone gave me a really good demo for example char *ptr = "hello" (hello = a char array) so now *ptr is pointing at h ptr++ = moves the ptr to point at the next element, to get its value i do *ptr and that gives me e ok so far i hope :D but now i need to manipulate a char **ptr and was wondering how I do this in a way that mimmicks the effects of a 2d array? some basic tips would be much appreciated as I need to do an assignment that has a **ptr to imitate a 2d array and without knowing how it does this first means I cant even solve it on paper (for example, how do you dereference a **ptr, how do you get [x][y] values etc) thanks

    Read the article

  • escape double quote in vb string

    - by JKS
    i have used following piece of code to execute schtasks command from vb6 while executing it ignores folder if it contains space For example "C:\program files\test\test.exe" will be converted to "c:\program " how do i solve this issue? MyAppname = Chr(34) & App.Path & "\" & App.EXEName & ".exe" & Chr(34) StrCommand = "schtasks /create /sc ONLOGON /RL HIGHEST /tn myapp /tr " & MyAppname Shell StrCommand, vbHide thanks in advance

    Read the article

  • Is it possible that two requests at the same time double this code? (prevent double database entry)

    - by loostro
    1) The controller code (Symfony2 framework): $em = $this->getDoctrine()->getEntityManager(); // get latest toplist $last = $em->getRepository('RadioToplistBundle:Toplist')->findOneBy( array('number' => 'DESC') ); // get current year and week of the year $week = date('W'); $year = date('Y'); // if: // [case 1]: $last is null, meaning there are no toplists in the database // [case 2]: $last->getYear() or $last->getWeek() do not match current // year and week number, meaning that there are toplists in the // database, but not for current week // then: // create new toplist entity (for current week of current year) // else: // do nothing (return) if($last && $last->getYear() == $year && $last->getWeek() == $week) return; else { $new = new Toplist(); $new->setYear($year); $new->setWeek($week); $em->persist($new); $em->flush(); } This code is executed with each request to view toplist results (frontend) or list of toplists (backend). Anytime someone wants to access the toplist we first check if we should create a new toplist entity (for new week). 2) The question is: Is it possible that: User A goes to mydomain.com/toplist at 00:00:01 on Monday - the code should generate new entity the server slows down and it takes him 3 seconds to execute the code so new toplist entity is saved to database at 00:00:04 on Monday User B goes to mydomain.com/toplist at 00:00:02 on Monday at 00:00:02 there the toplist is not yet saved in database, thus UserB's request triggers the code to create another toplist entity And so.. after a few seconds we have 2 toplist entities for current week. Is this possible? How should I prevent this?

    Read the article

  • Extract two double Values from String using RegEx in Java

    - by tzippy
    I am reading a file by line and need to extract latitude and longitude from it. This how lines can looks: DE 83543 Rott am Inn Bayern BY Oberbayern Landkreis Rosenheim 47.983 12.1278 DE 21147 Hamburg Hamburg HH Kreisfreie Stadt Hamburg 53.55 10 What's for sure is, there are no dots surrounded by digits except for the ones representing the doubles. Unfortunately there are Values without a dot, so it's probably best to check for numbers from the end of the String. thanks for your help!

    Read the article

  • Haskell: Constrain function on type Double to only work with Integers

    - by thurn
    Suppose I'm writing a function that takes a list of integers and returns only those integers in the list that are less than 5.2. I might do something like this: belowThreshold = filter (< 5.2) Easy enough, right? But now I want to constrain this function to only work with input lists of type [Int] for design reasons of my own. This seems like a reasonable request. Alas, no. A declaration that constraints the types as so: belowThreshold :: [Integer] -> [Integer] belowThreshold = filter (< 5.2) Causes a type error. So what's the story here? Why does doing filter (< 5.2) seem to convert my input list into Doubles? How can I make a version of this function that only accepts integer lists and only returns integer lists? Why does the type system hate me?

    Read the article

  • Double reversals on technology decisions

    - by Kev
    Have you ever gone through a painful switch from one technology to another, only to switch back later in a project's lifetime? Was it because the technologies evolved differently than you expected, or because of something you didn't understand about them in the first place, or because they didn't fly when it came to beta testing or production? Did you regret the switch back too?

    Read the article

  • Jquery Double clicking on link removing div content

    - by ram
    I wrote this code to load the content of a DIV ,when some one clicks on a link. Now,if you click on a link twice,it is removing the content. Here is the code $('a').click(function() { var id = $(this).attr('class'); if(id == 'first') { $('.active').removeClass('active'); $('a.first').addClass('active'); } else if(id == 'second') { $('.active').removeClass('active'); $('a.second').addClass('active'); } $('#first').toggle(id == 'first'); $('#second').toggle(id == 'second'); });? <a class="first">one</a> <a class="second">two</a> <div> <li id="first"> <h2>pen</h2> <div> <div>parker</div> </div> </li> <li id="second" style="display: none;"> <h2>car</h2> <div>Bugatti</div> </div> </li> </div>? .active { color: green; }

    Read the article

  • Double use of variables?

    - by Vaccano
    I have read that a variable should never do more than one thing. Overloading a variable to do more than one thing is bad. Because of that I end up writing code like this: (With the customerFound variable) bool customerFound = false; Customer foundCustomer = null; if (currentCustomer.IsLoaded) { if (customerIDToFind = currentCustomer.ID) { foundCustomer = currentCustomer; customerFound = true; } } else { foreach (Customer customer in allCustomers) { if (customerIDToFind = customer.ID) { foundCustomer = customer; customerFound = true; } } } if (customerFound) { // Do something } But deep down inside, I sometimes want to write my code like this: (Without the foundCustomer variable) Customer foundCustomer = null; if (currentCustomer.IsLoaded) { if (customerIDToFind = currentCustomer.ID) { foundCustomer = currentCustomer; } } else { foreach (Customer customer in allCustomers) { if (customerIDToFind = customer.ID) { foundCustomer = customer; } } } if (foundCustomer != null) { // Do something } Does this secret desires make me an evil programmer? (i.e. is the second case really bad coding practice?)

    Read the article

  • Double variable argument list.

    - by Lukasz Lew
    I need something like this: class Node (left : Node*, right : Node*) I understand the ambiguity of this signature. Is there a way around it better than the following? class Node (left : Array[Node, right : Array[Node]) val n = new Node (Array(n1, n2), Array(n3)) Maybe some kind of separator like this? val n = new Node (n1, n2, Sep, n3)

    Read the article

  • Dynamic added elements double effect after page transition

    - by Emil Moe
    I have added dynamic from jQuery in my code, but when I go back one page and return to the page where the 's are added and you press them, they somehow click twice now. I have tried with an alert('something'); when I click: $(document).on('click', '#products a', function() { alert('something'); } And it's shown twice when you return to the page. I have tried $('#products a').remove(); When you click the 'Back' button, because I thought all elements where added twice, but that made no difference. I don't have anything around these lines, maybe I need $(document).ready(); or something with pageinit?

    Read the article

  • Prevent double submission of forms in jQuery

    - by Adam
    I have an form that takes a little while for the server to process. I need to ensure that the user waits and does not attempt to resubmit the form by clicking the button again. I tried using the following jQuery code: <script type="text/javascript"> $(document).ready(function(){ $("form#my_form").submit(function(){ $('input').attr('disabled','disabled'); $('a').attr('disabled','disabled'); return true; }) }); </script> When I try this in Firefox everything gets disabled but the form is not submitted with any of the POST data it is supposed to include. I can't use jQuery to submit the form because I need the button to be submitted with the form as there are multiple submit buttons and I determine which was used by which one's value is included in the POST. I need the form to be submitted as it usually is and I need to disable everything right after that happens. Thanks!

    Read the article

< Previous Page | 23 24 25 26 27 28 29 30 31 32 33 34  | Next Page >