Search Results

Search found 1742 results on 70 pages for 'combine'.

Page 46/70 | < Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >

  • Combining the value of GetLastError and a custom error message

    - by Jessica
    I have a function that returns a different DWORD value for each case there is an error. So I have the following defines: #define ERR_NO_DB_CONNECTION 0x90000 #define ERR_DB_NOT_OPEN 0x90001 #define ERR_DB_LOCKED 0x90002 #define ERR_DB_CONN_LOST 0x90003 Now, I return those values when an error occurs. I need to also return the value of GetLastError in the same return. No, I can't read it later. I tried combining it different ways, eg: return ERR_DB_NOT_OPEN + GetLastError(); and then extract the error by subtracting the value of ERR_DB_NOT_OPEN but since I need to use this in functions where there can be several return values it can get quite complex to do that. Is there any way to achieve this? I mean, combine the value + GetLastError and extract them later? Code is appreciated. Thanks Jess.

    Read the article

  • Express XPath as an expression tree

    - by 47d_
    If I have an XPath query like NodeA/NodeB[@WIDTH and not(@WIDTH="20")] | NodeC[@WIDTH and not(@WIDTH="20")]/NodeD Is there any API available to visualize this XPath query as a stack of atomic expressions, something like (following is generic) Get results of NodeA, call it "first set" Get results of NodeB from "first set" Filter where [@WIDTH and not(@WIDTH="20")] Filter NodeD, call this "node d for B" Get results of NodeC from "first set" Filter where [@WIDTH and not(@WIDTH="20")] Filter NodeD, call this "node d for C" Combine "node d for B" and "node d for C" I am trying to see if we can convert the XPath expression into custom expression which is close to english and vice versa. If no API is available, what would be the best approach? Thanks in advance.

    Read the article

  • Combining entries, filtering of Python dictionaries

    - by matt
    I have two large lists that are filled with dictionaries. I need to combine the entries if a value from dict2==dict1 and place the newly combined matches somewhere else. I'm having trouble explaining it. List one contains: {'keyword':value, 'keyword2':value2} List two: {'keyword2':value2, 'keyword3':value3} I want a new list with dictionaries including keyword1, keyword2, and keyword3 if both lists share the same 'keyword2' value. What's the best way to do this? When I try, I only come up with tons of nested for loops. Thanks

    Read the article

  • Get previous element in IObservable without re-evaluating the sequence

    - by dcstraw
    In an IObservable sequence (in Reactive Extensions for .NET), I'd like to get the value of the previous and current elements so that I can compare them. I found an example online similar to below which accomplishes the task: sequence.Zip(sequence.Skip(1), (prev, cur) => new { Previous = prev, Current = cur }) It works fine except that it evaluates the sequence twice, which I would like to avoid. You can see that it is being evaluated twice with this code: var debugSequence = sequence.Do(item => Debug.WriteLine("Retrieved an element from sequence")); debugSequence.Zip(debugSequence.Skip(1), (prev, cur) => new { Previous = prev, Current = cur }).Subscribe(); The output shows twice as many of the debug lines as there are elements in the sequence. I understand why this happens, but so far I haven't found an alternative that doesn't evaluate the sequence twice. How can I combine the previous and current with only one sequence evaluation?

    Read the article

  • .htaccess url rewrite with ssl redirection

    - by Stuart McAlpine
    I'm having trouble combining a url query parameter rewrite (fancy-url) with a .htaccess ssl redirection. My .htaccess file is currently: Options +FollowSymLinks Options -Indexes ServerSignature Off RewriteEngine on RewriteBase / # in https: process secure.html in https RewriteCond %{server_port} =443 RewriteCond $1 ^secure$ [NC] RewriteRule ^(.+).html$ index.php?page=$1 [QSA,L] # in https: force all other pages to http RewriteCond %{server_port} =443 RewriteCond $1 !^secure$ [NC] RewriteRule ^(.+).html$ http://%{HTTP_HOST}%{REQUEST_URI} [QSA,N] # in http: force secure.html to https RewriteCond %{server_port} !=443 RewriteCond $1 ^secure$ [NC] RewriteRule ^(.+).html$ https://%{HTTP_HOST}%{REQUEST_URI} [QSA,N] # in http: process other pages as http RewriteCond %{server_port} !=443 RewriteCond $1 !^secure$ [NC] RewriteRule ^(.+).html$ index.php?page=$1 [QSA,L] The fancy-url rewriting is working fine but the redirection to/from https isn't working at all. If I replace the 2 lines containing RewriteRule ^(.+).html$ https://%{HTTP_HOST}%{REQUEST_URI} [QSA,N] with RewriteRule ^(.+).html$ https://%{HTTP_HOST}/index.php?page=$1 [QSA,L] then the https redirection works fine but the fancy-url rewriting doesn't work. Is it possible to combine these two?

    Read the article

  • Unexpected result from reduce function

    - by StackedCrooked
    I would like to get the smallest element from a vector. For this I use combine the reduce and min functions. However, when providing my own implementation of min I get unexpected results: user=> (reduce (fn [x y] (< x y) x y) [1 2 3 2 1 0 1 2]) 2 user=> (reduce min [1 2 3 2 1 0 1 2 3]) 0 The reduce with standard min returns 0 as expected. However, when I provide my own implementation it returns 2. What am I doing wrong?

    Read the article

  • How do i pass a number from a list as a parameter in scheme?

    - by wyatt
    I need to take a number from a list and convert it to a number so that i can pass it as a parameter. im trying to make a 1-bit adder in scheme. i've written the code for the or gate and the xor gate and also the half adder and now im trying to combine them all to make a full adder. im not sure if im going about it the right way. any input will be appreciated thank you. (define or-gate (lambda (a b) (if (= a 1) 1 (if (= b 1) 1 0)))) (define xor-gate (lambda (a b) (if (= a b) 0 1))) (define ha (lambda (a b) (list (xor-gate a b)(and-gate a b)))) (define fa (lambda (a b cin) (or-gate (cdr(ha cin (car (ha a b))))(cdr(ha a b))))) the issue i get when i run the program is that the half adder (ha) function outputs a list as a value and that makes the values incompatible with my other procedures because they require numbers and not lists. i feel like there is a simple solution but i dont know it.

    Read the article

  • Modulation of adding new Strings -> Method calls.

    - by guesswork
    If I have a program that does the following: if(input=='abc'){do x} if(input=='def'){do y} In the future, I may want to add another piece of code like so: if(input=='ghy'){do x} As you can see, I am adding a new 'if' statement for a different conditional BUT using the SAME function X. The code in future has potential to have lots of different IF statements (or switches) all of which are comparing a string vs a string and then performing a function. Considering the future expansion, I was wondering if there is a possible 'neater', 'modular' way of achieving the same results. It's a shame I can't combine the String with a Method call in a hashtable (String, method) in Java. That way I could just store any new procedures inside a hashtable and grab the relevant method for that String. Any ideas? Thank you

    Read the article

  • what are most important things that i must know in order to jump into silverlight development

    - by Poni
    I have vast programming knowledge; C++/C#/ActionScript/ASM/PHP..... so learning the language of SilverLight itself isn't of an issue. To keep long story short, when asking this question I'm asking it as a developer who's coming from Flash world - great graphics/sounds/media support, fully cross-platform, ability to combine several SWFs within a "movie" (which also implies code reusability). A Flash developer have pretty much freedom. What are most important things that i must know in order to jump into silverlight development? Did you already make the move to SilverLight from Flash yourself? Are you a "guru" at both? Great, let's hear what you have to say - developer to developer! =)

    Read the article

  • Reading programming tutorials while at work

    - by Teifion
    I work in a call centre and have been told by my manager that when there are no calls coming through they're happy for me to read stuff on the internet. There is a net filter in place but I can access SO from work which is always handy. I'm searching for articles that will make me a generally better programmer. I code in Python but combine it with Postgres and JS quite a lot if that helps. I'm currently reading Dive into python3 but I fear it won't last me much longer and would really like to expand my programming ability.

    Read the article

  • An example of advanced database search

    - by Phil
    Hi there, im looking for an example script. I saw one yesterday but for the life of me I can't find it again today. The task I have is to allow the user to search 1 database table via input controls on an aspx page where they can select and , or , equals to combine fields, generating the sql on the fly with a stringbuilder or similar. (it runs behind the corp firewall) Please can someone point me in the right direction of an example or tutorial I've been working on the page, but have run into problems. Here is a snippet; If NameSearch.Text IsNot String.Empty And andor1v IsNot "0" Then sql += "Surname LIKE '%" & name & "%' " & andor1v & " " ElseIf NameSearch.Text IsNot String.Empty And andor1v Is "0" Then sql += "Surname LIKE '%" & name & "%' " End If

    Read the article

  • ASP.NET MVC 2 project default script files. What do you use?

    - by Andrew Florko
    Many js files are included into Scripts folder by default in ASP.NET MVC 2 Projects. I suppose developers use jquery library nearly every time they program a site, but what about other files? Please, can you tell scenarios and reasons when you: Use Microsoft.Ajax instead of jquery or mix both libraries? Do you use JQuery validation infrastructure instead of asp.net mvc one, or combine them both? Thank you in advance! P.S. there are also diferrent editions of the same file. Do you include different editions depenending on debug/release build?

    Read the article

  • MySQL: selecting totals as three fields from same table as one query?

    - by coderama
    I have a table with various orders in it: ID | Date | etc... 1 | 2013-01-01 | etc 2 | 2013-02-01 | etc 3 | 2013-03-01 | etc 4 | 2013-04-01 | etc 5 | 2013-05-01 | etc 6 | 2013-06-01 | etc 7 | 2013-06-01 | etc 8 | 2013-03-01 | etc 9 | 2013-04-01 | etc 10 | 2013-05-01 | etc I want a query that ends wit the result: overallTotal | totalThisMonth | totalLastMonth 10 | 2 | 1 But I want to do this in one query! I am trying to find a way to use subqueries to do this. SO far I have: SELECT * from ( SELECT count(*) as overallTotal from ORDERS ) How can I combine this with other subqueries so I can get the totals in one query?

    Read the article

  • How to resize pdf graphics produced in R using Illustrator

    - by user1648516
    I am making plots in R using the pdf() command. Graphs look perfect and resize nicely in Acrobat Reader. My usual workflow includes manipulating labels etc. in Illustrator, saving as .eps for submission to publishers or inserting in Word. All works fine for single graphs. Now I am trying to combine 4 graphs into one by manually putting them together in an A4 Illustrator document. However, when I resize the standard 7x7 inches pdf graph in Illustrator to fit in one column of an A4 page (ca 3.4 inches wide), all proportions get screwed up, e.g. lines and symbols outlines become way too thick. Using pdf(..., width=3.4, height=3.4) in R messes up all the symbol and font sizes so carefully chosen to produce the original graph. Why can't I resize the graph within Illustrator the same way I can resize the pdf e.g. in Acrobat Reader?

    Read the article

  • Is there an Objective-C algorithm like `transform` of the C++ STL?

    - by pesche
    My goal is to have an array that contains all filenames of a specific extension, but without the extension. There's an elegant solution to get all filenames of a specific extension using a predicate filter and instructions on how to split a path into filename and extension, but to combine them I would have to write a loop (not terrible, but not elegant either). Is there a way with Objective-C (may be similar to the predicate mechanism) to apply some function to every element of an array and put the results in a second array, like the transform algorithm of the C++ STL does?

    Read the article

  • Combining bordering shapefiles in R

    - by Stedy
    I have five shapefiles of bordering counties in California that I am trying to combine into one large shapefile and maintain the original borders of the counties. I then want to plot points such as this so the map only needs to be a simple map of county boundaries. Is there a way to do this in R or will I have to use something like ArcGIS? There is extensive documentation about merging within a shapefile such as here where both shapefiles have the same coordinates. But no documentation on shapefiles that only partially share coordinates.

    Read the article

  • MATLAB - Index exceeds matrix dimensions

    - by Jessy
    Hi I have problem with matrix.. I have many .txt files with different number of rows but have the same number of column (1 column) e.g. s1.txt = 1234 rows s2.txt = 1200 rows s2.txt = 1100 rows I wanted to combine the three files. Since its have different rows .. when I write it to a new file I got this error = Index exceeds matrix dimensions. How I can solved this problem? .

    Read the article

  • TypeError: Result of expression 'printWindow' [undefined] is not an object.

    - by orangebrainer
    I'm trying to create hidden iframes in my page dynamically to load 3 other pages so that i can grab all the HTML and combine them into 1 in a new window. However i'm stuck at this. tHe frames are created fine. But whenever the javascript runs to the part of function openNewWindow() { var printWindow = window.open("",""); printWindow.document.open(); printWindow.document.write(HTMLfromFrames); printWindow.document.close(); } i get this error: TypeError: Result of expression 'printWindow' [undefined] is not an object. but if i generate a button to call this function seperately, it works fine. however i need it to run all in one click event Anybody has any idea what's wrong? Thanks!

    Read the article

  • In jquery Set a delay to fade out or fadeout right away on click

    - by JClu
    I am trying to right a script for a notification popup. I wan't the popup to fade out after X seconds or fadeout when the user clicks on the message. I can get both effects to work individually but when I try to combine them fadeOut works. This is my code so far: function notify(data, type) { switch(type) { case "success": $('#notify').html(data) .removeAttr("style") .addClass('notifySuccess') .click(function() { $("#notify").fadeOut(); }) .delay(5000).fadeOut(); break; case "error": $('#notify').html(data) .removeAttr("style") .addClass('notifyFailure') .click(function() { $("#notify").fadeOut(); }) .delay(5000).fadeOut(); break; } }

    Read the article

  • CSS position relative (?) and z-index

    - by user318704
    Greetings good people - I need some help. I have until now buildt web-pages with floats, but now I need z-index, and therefore I need to use position The test page is here http://www.it-stud.h...hovedp/combine/ The problem being the timelines (vertical multicoloured lines on the right), and this looks and works fine in FireFox and Opera for Mac and Pc, IE8, but scary things happens in Chrome and Safari. It validates XHTML Transitional. I have position inherit on some of the elements, but I have problems finding a solution. Any help would be greatly appreciated, as I am out to sea on this one. All the best -

    Read the article

  • (iphone) maintaining CGContextRef or CGLayerRef is a bad idea?

    - by Eugene
    Hi, I need to work with many images, and I can't hold them as UIImage in memory because they are too big. I also need to change colors of image and merge them on the fly. Creating UIImage from underlying NSData, change color, and combine them when you can't have many images on memory is fairly slow. (as far as I can get) I thought maybe I can store underlying CGLayerRef(for image that will be combined) and CGContextRef(the resulting combined image). I am new to drawing world, and not sure if CGLayerRef or CGContextRef is smaller in memory than UIImage. I recently heard that w*h image takes up w*h*4 bytes in memory. Does CGLayerRef or CGContextRef also take up that much memory? Thank you

    Read the article

  • Single logical SQL Server possible from multiple physical servers?

    - by TuffyIsHere
    Hi, With Microsoft SQL Server 2005, is it possible to combine the processing power of multiple physical servers into a single logical sql server? Is it possible on SQL Server 2008? I'm thinking, if the database files were located on a SAN and somehow one of the sql servers acted as a kind of master, then processing could be spread out over multiple physical servers, for instance even allowing simultaneous updates where there was no overlap, and in the case of read-only queries on unlocked tables no limit. We have an application that is limited by the speed of our sql server, and probably stuck with server 2005 for now. Is the only option to get a single more powerful physical server? Sorry I'm not an expert, I'm not sure if the question is a stupid one. TIA

    Read the article

  • modifying constants in objective c during run time

    - by moshikafya
    I am trying to solve the following problem. I have the following constants in my header file: #define PREFS_MY_CONSTANT_1 @"bla1" #define PREFS_MY_CONSTANT_2 @"bla2" #define PREFS_MY_CONSTANT_3 @"bla3" ... In one of my functions, I'd like to print to the UIbutton one of those strings based on user input, so say the user inputs '1', i would show bla1. Instead of creating a huge switch (i have 100 of those), I am looking for a way to combine the constant with the variable holding the user input, so something like that ideally: NSInteger input; [button setTitle:PREFS_MY_CONSTANT_{$input} forState: UIControlStateNormal]; Is something like that possible? what would be the best way to solve this?

    Read the article

  • iPhone Gestures Adding 2 at once

    - by BahaiResearch.com
    Objective C answers are fine too. Currently I am using this code to add 2 gestures (left / right) to my WebView. Works fine. Can I combine this into less code though to indicate that both gestures go to the same action? //LEFT UISwipeGestureRecognizer sgr = new UISwipeGestureRecognizer (); sgr.AddTarget (this, MainViewController.MySelector); sgr.Direction = UISwipeGestureRecognizerDirection.Left; sgr.Delegate = new SwipeRecognizerDelegate (); this.View.AddGestureRecognizer (sgr); //RIGHT UISwipeGestureRecognizer sgrRight = new UISwipeGestureRecognizer (); sgrRight.AddTarget (this, MainViewController.MySelector); sgrRight.Direction = UISwipeGestureRecognizerDirection.Right; sgrRight.Delegate = new SwipeRecognizerDelegate (); this.View.AddGestureRecognizer (sgrRight);

    Read the article

  • Assign grid.arrange to object

    - by Tyler Rinker
    I want to arrange plots with grid.arrange to make more complex coplots and then use grid.arrange to combine these complex coplots. I am using the following solution (http://stackoverflow.com/a/13295880/1000343) in this task to arrange mutliple plots and ensure they have equal widths. Here is a demo of the code: library(ggplot2); library(gridExtra) gA <- ggplotGrob(A) gB <- ggplotGrob(B) maxWidth = grid::unit.pmax(gA$widths[2:5], gB$widths[2:5]) gA$widths[2:5] <- as.list(maxWidth) gB$widths[2:5] <- as.list(maxWidth) x <- grid.arrange(gA, gB, ncol=1) y <- grid.arrange(gA, gB, ncol=1) grid.arrange(x, y, ncol=2) To be clear in my case x and y are slightly different plots with different values. I know grid.arrange isn't returning the plot as other grid based functions.

    Read the article

< Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >