Search Results

Search found 2409 results on 97 pages for 'the green frog'.

Page 15/97 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • macro returning length of arguments in C

    - by anon
    Is it possible to write a C macro that returns the length of its arguments? I want something that does: foo(1) -> 1 foo(cat, dog) -> 2 foo(red, green, blue) -> 3 Even better if this macro can be defined in such a way that it works with ## so that foo(1) -> bar1(1) foo(cat, dog) -> bar2(cat, dog) foo(red, green, blue) -> car3(red, green, blue) Thanks! EDIT: I really want a macro, not a function. Suggestions to use functions will be downvoted.

    Read the article

  • Careers in Computer Security? [closed]

    - by Joey Green
    I have the opportunity to go back for MSCS and the closest college's main research is in computer security and forensics. I've always been interested in computer networks and security but I have no interest whatsoever to run cables or add users to the network( which is what the network people do where I currently work ). I wanted to know how may I find out the types of day to day task a computer security expert does? I don't mean the jobs you find on dice or indeed. I'm talking about the type of careers that start out at the NSA or DIA. Also, I'm wondering what the pay is like for these types of fields? Thanks to all that reply.

    Read the article

  • Serial port determinism

    - by Matt Green
    This seems like a simple question, but it is difficult to search for. I need to interface with a device over the serial port. In the event my program (or another) does not finish writing a command to the device, how do I ensure the next run of the program can successfully send a command? Example: The foo program runs and begins writing "A_VERY_LONG_COMMAND" The user terminates the program, but the program has only written, "A_VERY" The user runs the program again, and the command is resent. Except, the device sees "A_VERYA_VERY_LONG_COMMAND," which isn't what we want. Is there any way to make this more deterministic? Serial port programming feels very out-of-control due to issues like this.

    Read the article

  • Highlighting company name in Eclipse stack traces

    - by Robin Green
    Is there a way to make Eclipse highlight com.company (where for company substitute the name of the company you work for) in stack traces? It would make it fractionally easier and faster to home in on which parts of the stack trace were ours, and which were third-party code. I tried the logview plugin here, and while it does work, it makes the location information in the stack traces unclickable, which means I would waste more time than I would save.

    Read the article

  • Why does null need to be casted?

    - by BlueRaja The Green Unicorn
    The following code does not compile: //int a = ... int? b = (int?) (a != 0 ? a : null); In order to compile, it needs to be changed to int? b = (a != 0 ? a : (int?) null); Since both b = null and b = a are legal, this doesn't make sense to me. Why does null need to be casted, and why can't we simply cast the whole expression (which I know is legal in other cases)?

    Read the article

  • Set selected using jQuery

    - by Charles Marsh
    Evening All, Happy new year! I'm trying to change the selected option within this list.. Its only working for some and not others? selectedVal will either be Kelly Green, Navy etc... var selectedVal = $(this).text(); $("#product-variants-option-0 option[text=" + selectedVal+"]").attr("selected","selected") ; This is the select list: <select class="single-option-selector" id="product-variants-option-0"> <option value="Gunmetal Heather">Gunmetal Heather</option> <option value="Kelly Green">Kelly Green</option> <option value="Navy">Navy</option> </select>

    Read the article

  • Polygon with different line width (in R)

    - by Tal Galili
    Hi all, I would like to use a command like this: plot(c(1,8), 1:2, type="n") polygon(1:7, c(2,1,2,NA,2,1,2), col=c("red", "blue"), # border=c("green", "yellow"), border=c(1,10), lwd=c(1:10)) To create two triangles, with different line widths. But the polygon command doesn't seem to recycle the "lwd" parameter as it does the col or the border parameters. I would like the resulting plot to look like what the following code will produce: plot(c(1,8), 1:2, type="n") polygon(1:3, c(2,1,2), col=c("red"), # border=c("green", "yellow"), border=c(1,10), lwd=c(1)) polygon(5:7, c(2,1,2), col=c( "blue"), # border=c("green", "yellow"), border=c(1,10), lwd=c(10)) So my questions are: Is there something like polygon that does what I asked for? (If not, I would do it by creating a new polygon function that will break the original x,y by their NA's, although I am not yet sure what is the smartest way to do that...) Thanks, Tal

    Read the article

  • Android application chrashes after "share" intent

    - by Johe Green
    Hi, My app offers a "share/tell-a-friend" function. When the "share" button is pressed the following method is being called to open a list of apps, which can perform the action (Eg. Gmail, Twittroid, Facebook...): public void share() { Intent shareIntent = new Intent(android.content.Intent.ACTION_SEND); shareIntent.setType("text/plain"); shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, getText(R.string.menu_share_subject)); shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, getText(R.string.menu_share_body)); startActivity(Intent.createChooser(shareIntent, getText(R.string.menu_share_intent))); } The sharing functionality works basically. But when the sharing app (Facebook, Twitter, ...) tries to return to my app, a force close is thrown. I guess that my app gets closed in the background during the sharing process... at least that is what the debugger sais... Any ideas?

    Read the article

  • Do I need to use decimal places when using floats? Is the "f" suffix necessary?

    - by Paulo Fierro
    I've seen several examples in books and around the web where they sometimes use decimal places when declaring float values even if they are whole numbers, and sometimes using an "f" suffix. Is this necessary? For example: [UIColor colorWithRed:0.8 green:0.914 blue:0.9 alpha:1.00]; How is this different from: [UIColor colorWithRed:0.8f green:0.914f blue:0.9f alpha:1.00f]; Does the trailing "f" mean anything special? Getting rid of the trailing zeros for the alpha value works too, so it becomes: [UIColor colorWithRed:0.8 green:0.914 blue:0.9 alpha:1]; So are the decimal zeros just there to remind myself and others that the value is a float? Just one of those things that has puzzled me so any clarification is welcome :)

    Read the article

  • PHP Encrypt/Decrypt with TripleDes, PKCS7, and ECB

    - by Brandon Green
    I've got my encryption function working properly however I cannot figure out how to get the decrypt function to give proper output. Here is my encrypt function: function Encrypt($data, $secret) { //Generate a key from a hash $key = md5(utf8_encode($secret), true); //Take first 8 bytes of $key and append them to the end of $key. $key .= substr($key, 0, 8); //Pad for PKCS7 $blockSize = mcrypt_get_block_size('tripledes', 'ecb'); $len = strlen($data); $pad = $blockSize - ($len % $blockSize); $data .= str_repeat(chr($pad), $pad); //Encrypt data $encData = mcrypt_encrypt('tripledes', $key, $data, 'ecb'); return base64_encode($encData); } Here is my decrypt function: function Decrypt($data, $secret) { $text = base64_decode($data); $data = mcrypt_decrypt('tripledes', $secret, $text, 'ecb'); $block = mcrypt_get_block_size('tripledes', 'ecb'); $pad = ord($data[($len = strlen($data)) - 1]); return substr($data, 0, strlen($data) - $pad); } Right now I am using a key of test and I'm trying to encrypt 1234567. I get the base64 output from encryption I'm looking for, but when I go to decrypt I get a blank response. I'm not very well versed in encryption/decryption so any help is much appreciated!!

    Read the article

  • How can I use images provided by the iPhone OS?

    - by Topher Fangio
    Hello all, First, let me state what brought this question about: I saw the green checkmark icon in this post and I would like to use it in my own application. However, since it looks so much like the UITableViewCellAccessoryDetailDisclosureButton my assumption is that this green checkmark icon is provided by the iPhone OS in some form or fashion. So, my question is: how can I use the green checkmark icon and/or other OS-provided images in my own applications? As a side question: where can I find a list of the OS-provided images (if they even exist)? Thanks very much for any input :-)

    Read the article

  • Visual Studio 2008 - formatting/control characters/marks

    - by AL
    Hi, I don't know what I did but somehow the IDE has started displaying a green dot whenever I press spacebar and a green arrowhead whenever I press TAB. The source has become littered with these characters all over and I am finding it very difficult to code in the presence of so many formatting marks. I have tried to search a solution on Google but couldn't perhaps enter the right keywords so haven't been able to fix the behavior. Is there any way I can stop VS2008 IDE from littering my source code with these green dots and arrowheads whenever I press spacebar/tab? I would be really thankful for this help. Thanks, -AL PS: Re-posting the question as I am new to this forum and probably couldn't see the email notification option earlier. My apologies for this inconvenience.

    Read the article

  • refactoring in iSeries (RPG), is it realistic

    - by albert green
    Implementing agile in projects requires the ability to do refactoring. It is not really a must, but code refactoring has proven to be a good engineering practice. In an agile (Scrum) project on the iSeries platform, which requires development (new code and modifications to legacy code) in RPG, RPG LE, is it possible to implement refactoring? If so what are the techniques to do it? If someone who has tried it could share their experience or just point to references, I would greatly appreciate it.

    Read the article

  • page transitions using javascript

    - by hasan
    hey, i saw this on a site a couple of days ago and i cant seem to find it again. in any case, this is what was on the site: the page opened regularly when you entered the url. upon clicking one of the links on the page, it "transitioned" to the next page (there was a color change). and the url in the address bar was changed to reflect that. eg: if the background was blue on site.com, when clicking on the about link, the background would change to green and the browser would show site.com/about. and so on. also, if the url entered was site.com/about, the bg would be green and on cliking the home page, the site would transition from green to blue and browser would show site.com im interested in finding out how this was done. searching on google got me the meta-refresh tag, but the ffect was much more complex and worked on all browsers. is there any other method out there?

    Read the article

  • The CLR has been unable to transition from COM context [...] for 60 seconds

    - by BlueRaja The Green Unicorn
    I am getting this error on code that used to work. I have not changed the code. Here is the full error: The CLR has been unable to transition from COM context 0x3322d98 to COM context 0x3322f08 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations. And here is the code that caused it: var openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); openFileDialog1.DefaultExt = "mdb"; openFileDialog1.Filter = "Management Database (manage.mdb)|manage.mdb"; //Stalls indefinitely on the following line, then gives the CLR error //one minute later. The dialog never opens. if(openFileDialog1.ShowDialog() == DialogResult.OK) { .... } Yes, I am sure the dialog is not open in the background, and no, I don't have any explicit COM code or unmanaged marshalling or multithreading. I have no idea why the OpenFileDialog won't open - any ideas?

    Read the article

  • Why does LINQ-to-Entites recognize my custom method?

    - by BlueRaja The Green Unicorn
    This works: (from o in Entities.WorkOrderSet select o) .Where(MyCustomMethod); This does not: (from o in Entities.WorkOrderSet select new { WorkOrder = o }) .Where(o => MyCustomMethod(o.WorkOrder); I understand why the second doesn't work - but why in the world does the first work!? Shouldn't I get a "custom method not recognized?" For reference, here is MyCustomMethod public bool MyCustomMethod(WorkOrder workOrder) { return !workOrder.WorkOrderNum.StartsWith("A", StringComparison.CurrentCultureIgnoreCase); }

    Read the article

  • How can I stop and start individual websites in IIS using PowerShell?

    - by Joey Green
    I have multiple sites configured in IIS7 on my Windows7 development machine to run on the same port and usually only run one at a time depending on what I'm working on. I would like to be able to start and stop my development sites from PowerShell instead of having the IIS manager opened. Does anyone have a good resource to point me in the right direction or a script that already accomplishes this? Thanks

    Read the article

  • c++ - strange problem with polymorphism - cellular automaton

    - by Green
    Hello, I am making "game of life" implementation that, when cell has: two live neighbours I make object of class CCellB two live neighbours I make object of class CCellA when has 3 or <2 I make object of class CCellX (dead) Class CCell is base of CCellA, CCellB, CCellX My problem is: That works fine, until I change new CCell(); to new CCellB();: CCell ***temp = allocateArray(); for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { c = arr[i][j]->countAliveNeighbor(); if(c == 3) { temp[i][j] = new CCellA(); temp[i][j]->alive = 1; }else if(c == 2) { temp[i][j] = new CCell(); // HERE, WHEN I CHANGE IT TO CCELLB IT DON'T WORKS temp[i][j]->alive = tab[i][j]->alive; }else if((c >= 4)||(c < 2)) { temp[i][j] = new CCellX(); } } } Then it seems don't work properly... Seems like neighbours are not count properly, Cell with 4,5 neighbours still alive alive var is member of base class - CCell, all is public, please help!

    Read the article

  • Consulting a Prolog Source Code from within a VS2008 Solution File

    - by Joshua Green
    I have a Prolog file (Hanoi.pl) containing the code for solving the Hanoi Towers puzzle: hanoi( N ):- move( N, left, middle, right ). move( 0, _, _, _ ):- !. move( N, A, B, C ):- M is N-1, move( M, A, C, B ), inform( A, B ), move( M, C, B, A ). inform( X, Y ):- write( 'move a disk from ' ), write( X ), write( ' to ' ), writeln( Y ). I also have a C++ file written in VS2008 IDE: #include <iostream> #include <string> #include <stdio.h> #include <stdlib.h> using namespace std; #include "SWI-cpp.h" #include "SWI-Prolog.h" predicate_t phanoi; term_t t0; int main(int argc, char** argv) { long n = 5; int rval; if ( !PL_initialise(1, argv) ) PL_halt(1); PL_put_integer( t0, n ); phanoi = PL_predicate( "hanoi", 1, NULL ); rval = PL_call_predicate( NULL, PL_Q_NORMAL, phanoi, t0 ); system( "PAUSE" ); } How can I consult my Prolog source code (Hanoi.pl) from within my C++ code? Not from the Command Prompt - from the code, something like include or consult or compile? It is located in the same folder as my cpp file. Thanks,

    Read the article

  • How to avoid using the plld.exe utility in VS2008 (for linking C++ and Prolog codes)

    - by Joshua Green
    Here is my code in its entirety: Trying "listing." at the Prolog prompt that pops up when I run the program confirms that my Prolog source code has been loaded (consulted). #include <iostream> #include <fstream> #include <string> #include <math.h> #include <stdio.h> #include <stdlib.h> #include <stdafx.h> using namespace std; #include "Windows.h" #include "ctype.h" #include "SWI-cpp.h" #include "SWI-Prolog.h" #include "SWI-Stream.h" int main(int argc, char** argv) { argc = 4; argv[0] = "libpl.dll"; argv[1] = "-G32m"; argv[2] = "-L32m"; argv[3] = "-T32m"; PL_initialise(argc, argv); if ( !PL_initialise(argc, argv) ) PL_halt(1); PlCall( "consult(swi('plwin.rc'))" ); PlCall( "consult('hello.pl')" ); PL_halt( PL_toplevel() ? 0 : 1 ); } So this is how to load a Prolog source code (hello.pl) at run time into VS2008 without having to use plld at the VS command prompt.

    Read the article

  • Factorial in Prolog and C++

    - by Joshua Green
    I would like to work out a number's factorial. My factorial rule is in a Prolog file and I am connecting it to a C++ code. Can someone tell me what is wrong with my C++ interface please? % factorial.pl factorial( 1, 1 ):- !. factorial( X, Fac ):- X > 1, Y is X - 1, factorial( Y, New_Fac ), Fac is X * New_Fac. // factorial.cpp # headerfiles term_t t1; term_t t2; term_t goal_term; functor_t goal_functor; int main( int argc, char** argv ) { argc = 4; argv[0] = "libpl.dll"; argv[1] = "-G32m"; argv[2] = "-L32m"; argv[3] = "-T32m"; PL_initialise(argc, argv); if ( !PL_initialise(argc, argv) ) PL_halt(1); PlCall( "consult(swi('plwin.rc'))" ); PlCall( "consult('factorial.pl')" ); cout << "Enter your factorial number: "; long n; cin >> n; PL_put_integer( t1, n ); t1 = PL_new_term_ref(); t2 = PL_new_term_ref(); goal_term = PL_new_term_ref(); goal_functor = PL_new_functor( PL_new_atom("factorial"), 2 ); PL_put_atom( t1, t2 ); PL_cons_functor( goal_term, goal_functor, t1, t2 ); PL_halt( PL_toplevel() ? 0 : 1 ); }

    Read the article

  • Are document-oriented databases any more suitable than relational ones for persisting objects?

    - by Owen Fraser-Green
    In terms of database usage, the last decade was the age of the ORM with hundreds competing to persist our object graphs in plain old-fashioned RMDBS. Now we seem to be witnessing the coming of age of document-oriented databases. These databases are highly optimized for schema-free documents but are also very attractive for their ability to scale out and query a cluster in parallel. Document-oriented databases also hold a couple of advantages over RDBMS's for persisting data models in object-oriented designs. As the tables are schema-free, one can store objects belonging to different classes in an inheritance hierarchy side-by-side. Also, as the domain model changes, so long as the code can cope with getting back objects from an old version of the domain classes, one can avoid having to migrate the whole database at every change. On the other hand, the performance benefits of document-oriented databases mainly appear to come about when storing deeper documents. In object-oriented terms, classes which are composed of other classes, for example, a blog post and its comments. In most of the examples of this I can come up with though, such as the blog one, the gain in read access would appear to be offset by the penalty in having to write the whole blog post "document" every time a new comment is added. It looks to me as though document-oriented databases can bring significant benefits to object-oriented systems if one takes extreme care to organize the objects in deep graphs optimized for the way the data will be read and written but this means knowing the use cases up front. In the real world, we often don't know until we actually have a live implementation we can profile. So is the case of relational vs. document-oriented databases one of swings and roundabouts? I'm interested in people's opinions and advice, in particular if anyone has built any significant applications on a document-oriented database.

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >