Search Results

Search found 332 results on 14 pages for 'anon'.

Page 5/14 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Problem with stackless python, cannot write to a dict

    - by ANON
    I have simple map-reduce type algorithm, which I want to implement in python and make use of multiple cores. I read somewhere that threads using native thread module in 2.6 dont make use of multiple cores. is that true? I even implemented it using stackless python however i am getting into weird errors [Update: a quick search showed that the stack less does not allows multiple cores So are their any other alternatives?] def Propagate(start,end): print "running Thread with range: ",start,end def maxVote(nLabels): count = {} maxList = [] maxCount = 0 for nLabel in nLabels: if nLabel in count: count[nLabel] += 1 else: count[nLabel] = 1 #Check if the count is max if count[nLabel] > maxCount: maxCount = count[nLabel]; maxList = [nLabel,] elif count[nLabel]==maxCount: maxList.append(nLabel) return random.choice(maxList) for num in range(start,end): node=MapList[num] nLabels = [Label[k] for k in Adj[node]] if (nLabels!=[]): Label[node] = maxVote(nLabels) else: Label[node]=node However in above code the values assigned to Label, that is the change in dictionary are lost. Above propagate function is used as callable for MicroThreads (i.e. TaskLets)

    Read the article

  • Inline & not-inline

    - by anon
    Suppose I have: struct Vec3 { double x; double y; double z; } ; inline double dot(const Vec3& lhs, const Vec3& rhs) { return lhs.x * rhs.x + lhs.y * rhs.y + lhs.z * rhs.z ; } Is it possible to have "dot" also exist in a non-inlined version, so that it can be in the *.so , so that when I dl open it I can call it? I.e. I want files that include the above header to use the inlined version, but I also want the function to exist in a *.so, so I can dl open it and call it dynamically.

    Read the article

  • Flash10 Triangle Rendering

    - by anon
    I know about Papervision 3D. However, alot of the realism there comes from textures. Does anyone know of a benchmark that shows how many single-color, flash-shaded 3D triagnels flash10 can reasonably render? I can't find this benchmark online or an engine for this (most seems to really value bitmaps / texture). Thanks!

    Read the article

  • Textbased issue-tracker/todo list for Git?

    - by anon
    I've been managing all of my todo-lists as ~/git-repo/todo which is kept under git. THen I add/delete files from the todo list, and have git autocommit all changes. However, I feel there should be more powerful tools. Besides "cil" and git-issues [neither of which I've tried], what tools are available? PS I want something that's entirely text/command line based. Thanks!

    Read the article

  • Python with Wiimote using pywiiuse module

    - by Anon
    After seeing the abilities and hackibility of wiimotes I really want to use it in my 'Intro to programming' final. Everyone must make a python program and present it to the class. I want to make a game with pygame incorporating a wiimote. I found pywiiuse which is a very basic wrapper for the wiiuse library using c types. I can NOT get anything beyond LEDs and vibrating to work. Buttons, IR, motion sensing, nothing. I've tried different versions of wiiuse, pywiiuse, even python. I can't even get the examples that came with it to run. Here's the code I made as a simple test. I copied some of the example C++ code. from pywiiuse import * from time import sleep #Init wiimotes = wiiuse_init() #Find and start the wiimote found = wiiuse_find(wiimotes,1,5) #Make the variable wiimote to the first wiimote init() found wiimote = wiimotes.contents #Set Leds wiiuse_set_leds(wiimote,WIIMOTE_LED_1) #Rumble for 1 second wiiuse_rumble(wiimote,1) sleep(1) wiiuse_rumble(wiimote,0) #Turn motion sensing on(supposedly) wiiuse_motion_sensing(wiimote,1) while 1: #Poll the wiimotes to get the status like pitch or roll if(wiiuse_poll(wiimote,1)): print 'EVENT' And here's the output when I run it. wiiuse version 0.9 wiiuse api version 8 [INFO] Found wiimote [assigned wiimote id 1]. EVENT EVENT Traceback (most recent call last): File "C:\Documents and Settings\Nick\Desktop\wiimotetext.py", line 26, in <mod ule> if(wiiuse_poll(wiimote,1)): WindowsError: exception: access violation reading 0x00000004 It seems each time I run it, it prints out EVENT 2-5 times until the trace back. I have no clue what to do at this point, I've been trying for the past two days to get it working. Thanks!

    Read the article

  • NPR GLSL Tutorials

    - by anon
    Anyone have a good list of tutorials on doing Non photo realistic rendering with GLSL ? I have seen books on GLSL, and books on NPR, but very few books/tutorials on doing NPR with GLSL. (I want to do it with GLSL as I want real time). Thanks!

    Read the article

  • Where is the VM in LLVM?

    - by anon
    Note: marked as community wiki. Where is the Low Level Virtual Machine in LLVM? I see that we have llvm-g++ and c-lang, but to me, a LLVM is something almost like Valgrind of a simulator, where instructions are executed on it, and I can write programs to instrument the running code / interrupt when certain conditions happen / etc ... Where are the tools like this built on LLVM? Thanks!

    Read the article

  • OpenGL Diffuse Lighting Shader Bug?

    - by anon
    The Orange book, section 16.2, lists implementing diffuse lighting as: void main() { vec3 N = normalize(gl_NormalMatrix * gl_Normal); vec4 V = gl_ModelViewMatrix * gl_vertex; vec3 L = normalize(lightPos - V.xyz); gl_FrontColor = gl_Color * vec4(max(0.0, dot(N, L)); } However, when I run this, the lighting changes when I move my camera. On the other hand, when I change vec3 N = normalize(gl_NormalMatrix * gl_Normal); to vec3 N = normalize(gl_Normal); I get diffuse lighting that works like the fixed pipeline. What is this gl_NormalMatrix, what did removing it do, ... and is this a bug in the orange book ... or am I setting up my OpenGl code improperly?

    Read the article

  • How can I generate HTML tables in Perl?

    - by anon
    I need to create a 2 tables in HTML format. Each has 5 rows: 1st Table 1st row has FRUITS in it, occupying all columns 2nd row has January(month), occupying all columns 3rd row has names of some 6 fruits (apple, orange, grapes,...)These names do not change. so this row has 6 columns 4th row has rates for each fruit ( 10,20,30..) so this has 6 columns. 5th row has corresponding message for each fruit showing as Available or not. 2nd Table If it is available the background color for the cell should be green and if not RED. 1st row has VEGETABLES in it, occupying all columns 2nd row has February(month), occupying all columns 3rd row has names of some 6 vegetables (tomato, potato..)These names do not change. so this row has 6 columns 4th row has rates for each vegetable ( 10,20,30..) so this has 6 columns. 5th row has corresponding message for each vegetable showing as Available or not.If it is available the background color for the cell should be green and if not RED. All this data is read from a file having a particular format, it is <name of fruit/vegetable price <available or not The names of fruits and vegetable do not change , it will be same for both the tables. However, it might be possible that data for a particular fruit/vegetable is not present. if it is not present the the column for that should show N/A with white background. I cannot use MIME:Lite for this. Need to use print <<ENDHTML;

    Read the article

  • JIT-ing on FPGAs ?

    - by anon
    Many VMS, JVM/LLVM/... have JITs -- as the code is being interpreted, x86 instructions are created on the fly and executed. If there something similar to this for FPGAS? Is there someway where as an FPGA is running, I reconfigure it? [If so, please provide project / paper links. If not, what is the technology bottleneck that prevents this from happening?] Thanks!

    Read the article

  • EF4 CTP5 - Map foreign key without object references?

    - by anon
    I feel like this should have a simple answer, but I can't find it. I have 2 POCOs: public class Category { public int Id { get; set; } public string Name { get; set; } } public class Product { public int Id { get; set; } public int CategoryId { get; set; } } Notice that there are no object references on either POCO. With Code-First, how do I make EF4 CTP5 define a relationship between the two database tables? (I know this is an unusual scenario, but I am exploring what's possible and what's not with Code-First)

    Read the article

  • Obtaining C++ Code Coverage

    - by anon
    I'm on Linux. My code is written in C++. My program is non-interactive; it runs as "./prog input-file", processes the file, and exits. I have various unit tests "input-file0, input-file1, input-file2, ..." For designing new unit tests, I want to know what lines of code existing tests do not cover. Question: Given that I control how "prog" is compiled/run; how can I get list of the lines of code that "./prog input-file" does not hit? Thanks!

    Read the article

  • Help with Strings in C

    - by Anon
    Given the char * variables name1 , name2 , and name3 , write a fragment of code that assigns the largest value to the variable max (assume all three have already been declared and have been assigned values). I've tried and came up with this: if ((strcmp(name1,name2)0)&&(strcmp(name1,name3)0)){ max=name1; } else if ((strcmp(name2,name1)0)&&(strcmp(name2,name3)0)){ max=name2; } else if ((strcmp(name3,name1)0)&&(strcmp(name3,name2)0)){ max=name3; } However, I get this error Your code is incorrect. You are not handling the situation                where two or more strings are equal.

    Read the article

  • 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

  • c declaring variables in blocks

    - by anon
    I know that in C++, I can declare variables pretty much everywhere. I recall once reading that in C, variables must be declared at the top of a function i.e. the following is invalid: void foo() { int good; if (...) { int bad; } } In the above code, is the declaraing of the bad varaible legal by C standards, or only legal due to a gcc extension? Thanks!

    Read the article

  • How to mix HTML in Perl

    - by anon
    Hi, I need to create a 2 tables in html format. each has 5 rows. 1st Table *) 1st row has FRUITS in it, occupying all columns *) 2nd row has January(month), occupying all columns *) 3rd row has names of some 6 fruits (apple, orange, grapes,...)These names do not change. so this row has 6 columns *) 4th row has rates for each fruit ( 10,20,30..) so this has 6 columns. *) 5th row has corresponding message for each fruit showing as Available or not. 2nd table If it is available the background color for the cell should be green and if not RED. *) 1st row has VEGETABLES in it, occupying all columns *) 2nd row has February(month), occupying all columns *) 3rd row has names of some 6 vegetables (tomato, potato..)These names do not change. so this row has 6 columns *) 4th row has rates for each vegetable ( 10,20,30..) so this has 6 columns. *) 5th row has corresponding message for each vegetable showing as Available or not.If it is available the background color for the cell should be green and if not RED. All this data is read from a file having a particular format, it is price The names of fruits and vegetable do not change , it will be same for both the tables. However, it might be possible that data for a particular fruit/vegetable is not present. if it is not present the the column for that should show N/A with white background. I cannot use MIME:Lite for this. Need to use print <

    Read the article

  • recv returns old data

    - by anon
    This loop is supposed to take data from a socket line by line and put it in a buffer. For some reason, when there is no new data to return, recv returns the last couple lines it got. I was able to stop the bug by commenting out the first recv, but then I cant tell how long the next line will be. I know it's not a while(this->connected){ memset(buf, '\0', sizeof(buf)); recv(this->sock, buf, sizeof(buf), MSG_PEEK); //get length of next message ptr = strstr(buf, "\r\n"); if (ptr == NULL) continue; err = recv(this->sock, buf, (ptr-buf), NULL); //get next message printf("--%db\n%s\n", err, buf); tok[0] = strtok(buf, " "); for(i=1;tok[i-1]!=NULL;i++) tok[i] = strtok(NULL, " "); //do more stuff }

    Read the article

  • Hooks in ghostscript

    - by anon
    Anyone know the right places to hook into ghostscript, so that when interpreting a ps file, I can get logs of all calls of the form: draw_character(float x, float y, string font_name, int char_id); ? Basically I want to take a postscript file, and get a list of where all characters are drawn to the screen. Thanks!

    Read the article

  • c declaraing varibles in blocks

    - by anon
    I know that in C++, I can declare variables pretty much everywhere. I recall once reading that in C, variables must be declared at the top of a function i.e. the following is invalid: void foo() { int good; if (...) { int bad; } } In the above code, is the declaraing of the bad varaible legal by C standards, or only legal due to a gcc extension? Thanks!

    Read the article

  • Making vim git aware.

    - by anon
    I use Vim & Git together. I tend to merge/switch Git branches alot. I tend to have lots of vim buffers open. Is there a way to tell vim: when I execute this git command (which switches branches), reload all buffers? Since I have hooks into all my vim-git interaction, letting vim know when to do the reload is not a problem. The question is: how to force vim to reload all buffers?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >