Search Results

Search found 19539 results on 782 pages for 'pretty print'.

Page 97/782 | < Previous Page | 93 94 95 96 97 98 99 100 101 102 103 104  | Next Page >

  • How is this recursion properly working when it is iterated through [on hold]

    - by Rakso Zrobin
    Here is my code right now: hasht= {"A":["B", "D", "E"], "B":["C"], "C":["D", "E"], "D":["C", "E"], "E":["B"]} paths=[] def recusive(start, finish, started=true): if start==finish and !started: return start else: for i in hasht[start]: path= start+ recusive(i,finish,false) paths.append(path) print (recusive("C","C",1)) print paths # [CDC, CDEBC, CEBC] I am trying to generate a table like the one on the bottom, but am running into the problem of the string and the array not being able to concatenate. When I just return however, it returns CDC and works, however, exiting the function as return is meant to do. I am wondering how I can improve my code here to (1) make it work, (2) why my logic was faulty. For example, I understand that it generates say [DC], but I am confused as to how to go around that. perhaps index the value returned?

    Read the article

  • k-d tree implementation [closed]

    - by user466441
    when i run my code and debugged,i got this error - this 0x00093584 {_Myproxy=0x00000000 _Mynextiter=0x00000000 } std::_Iterator_base12 * const - _Myproxy 0x00000000 {_Mycont=??? _Myfirstiter=??? } std::_Container_proxy * _Mycont CXX0017: Error: symbol "" not found _Myfirstiter CXX0030: Error: expression cannot be evaluated + _Mynextiter 0x00000000 {_Myproxy=??? _Mynextiter=??? } std::_Iterator_base12 * but i dont know what does it means,code is this #include<iostream> #include<vector> #include<algorithm> using namespace std; struct point { float x,y; }; vector<point>pointleft(4); vector<point>pointright(4); //we are going to implement two comparison function for x and y coordinates,we need it in calculation of median (we should sort vector //by x or y according to depth informaton,is depth even or odd. bool sortby_X(point &a,point &b) { return a.x<b.x; } bool sortby_Y(point &a,point &b) { return a.y<b.y; } //so i am going to implement to median finding algorithm,one for finding median by x and another find median by y point medianx(vector<point>points) { point temp; sort(points.begin(),points.end(),sortby_X); temp=points[(points.size()/2)]; return temp; } point mediany(vector<point>points) { point temp; sort(points.begin(),points.end(),sortby_Y); temp=points[(points.size()/2)]; return temp; } //now construct basic tree structure struct Tree { float x,y; Tree(point a) { x=a.x; y=a.y; } Tree *left; Tree *right; }; Tree * build_kd( Tree *root,vector<point>points,int depth) { point temp; if(points.size()==1)// that point is as a leaf { if(root==NULL) root=new Tree(points[0]); return root; } if(depth%2==0) { temp=medianx(points); root=new Tree(temp); for(int i=0;i<points.size();i++) { if (points[i].x<temp.x) pointleft[i]=points[i]; else pointright[i]=points[i]; } } else { temp=mediany(points); root=new Tree(temp); for(int i=0;i<points.size();i++) { if(points[i].y<temp.y) pointleft[i]=points[i]; else pointright[i]=points[i]; } } return build_kd(root->left,pointleft,depth+1); return build_kd(root->right,pointright,depth+1); } void print(Tree *root) { while(root!=NULL) { cout<<root->x<<" " <<root->y; print(root->left); print(root->right); } } int main() { int depth=0; Tree *root=NULL; vector<point>points(4); float x,y; int n=4; for(int i=0;i<n;i++) { cin>>x>>y; points[i].x=x; points[i].y=y; } root=build_kd(root,points,depth); print(root); return 0; } i am trying ti implement in c++ this pseudo code tuple function build_kd_tree(int depth, set points): if points contains only one point: return that point as a leaf. if depth is even: Calculate the median x-value. Create a set of points (pointsLeft) that have x-values less than the median. Create a set of points (pointsRight) that have x-values greater than or equal to the median. else: Calculate the median y-value. Create a set of points (pointsLeft) that have y-values less than the median. Create a set of points (pointsRight) that have y-values greater than or equal to the median. treeLeft = build_kd_tree(depth + 1, pointsLeft) treeRight = build_kd_tree(depth + 1, pointsRight) return(median, treeLeft, treeRight) please help me what this error means?

    Read the article

  • Is it possible that Unity would some day switch back to Mutter?

    - by David
    I remembered that the first Unity was indeed built on Mutter, but later ported to Compiz due to poor performance. I also know Canonical practically incorporated Compiz to work closely for future Unity, so this is getting less likely. But Compiz just seems pretty outdated now that GNOME3/GTK3/Mutter is becoming more mainstreamed, and it is known to deliver some performance issue, but on the other hand Mutter seems pretty good and is still steadily developing now, I'm just wondering if anyone related to the project is still testing and evaluating the possibility of Unity on Mutter? Not that you have to tell me now if you're going to do it or not. I just wanna know if anyone is considering it. Thanks.

    Read the article

  • How to capture the screen in DirectX 9 to a raw bitmap in memory without using D3DXSaveSurfaceToFile

    - by cloudraven
    I know that in OpenGL I can do something like this glReadBuffer( GL_FRONT ); glReadPixels( 0, 0, _width, _height, GL_RGB, GL_UNSIGNED_BYTE, _buffer ); And its pretty fast, I get the raw bitmap in _buffer. When I try to do this in DirectX. Assuming that I have a D3DDevice object I can do something like this if (SUCCEEDED(D3DDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackbuffer))) { HResult hr = D3DXSaveSurfaceToFileA(filename, D3DXIFF_BMP, pBackbuffer, NULL, NULL); But D3DXSaveSurfaceToFile is pretty slow, and I don't need to write the capture to disk anyway, so I was wondering if there was a faster way to do this

    Read the article

  • Recommended flexible website solution?

    - by Omega
    My site has a MyBB forums installation, and that is pretty much all I need. Forums. However, I need a homepage and a couple other static pages, for showing relevant information, links, etc. I don't need something fancy, all I need is something very flexible regarding theme and style editing, and just a couple simple modules, like public polls. That's all. I am very graphical, and I am looking for something to let me edit pretty much every aspect of the site. These are static pages, mainly, so I don't need something very complex. Some people tell me to use Dreamweaver, but quite honestly, that is not what I am looking for, even thought it does offer a lot of flexibility. I want something like, you know, Drupal or.. some other simple, deeply-editable in terms of graphics and style web platform. What would you recommend to me? Thank you.

    Read the article

  • Chapter One - Concepts/Requirements (The Fundamentals)

    - by drsql
    So here we are, the starting chapter with the obligatory introductory material that I hope people will read, digest, memorize and really take to heart.  I also realize that that is pretty unlikely. In fact, the first two chapters are kind of like that. First I introduce concepts, and in the next chapter I show how to draw pretty pictures of those concepts. Then comes normalization and after that we really start doing some modeling. In this chapter I am going to cover the basic stuff that you...(read more)

    Read the article

  • Checking whether the user input is a str in Python [migrated]

    - by Sahil Babbar
    I checked various questions on Stack Overflow but one thing every logic lacks. Let me demonstrate using Python: while True: user_input = raw_input() if type(user_input) == str: print 'ERROR' else: print 'BINGO' Also, we cannot use input() in place of raw_input() as it gives the error:Traceback (most recent call last): File ".\test.py", line 3, in <module> user_input = int(input()) File "<string>", line 1, in <module> NameError: name 'asdf' is not defined The problem here is that raw_input converts the user input into string so it always prints 'ERROR' and if I change the second line to user_input = int(raw_input) then, it gives an error: Traceback (most recent call last): File ".\test.py", line 3, in <module> user_input = int(raw_input()) ValueError: invalid literal for int() with base 10: 'asdf' I tried this with try and except but it shall work fine to check integer but not a string. I feel that this question may be marked as a duplicate but I think that this query is important, if logically taken.

    Read the article

  • Why does the first partition start at sector 34 when I choose "Guided - Use entire disk" during install?

    - by Kent
    After choosing "Guided - Use entire disk" during installation I find that the first partition starts on sector 34. Why that specific sector and not the first one? (parted) print Model: ATA WDC WD30EZRX-00M (scsi) Disk /dev/sda: 5860533168s Sector size (logical/physical): 512B/4096B Partition Table: gpt Number Start End Size File system Name Flags 1 34s 390659s 390626s fat32 boot 2 390660s 890660s 500001s ext2 3 890661s 5860533118s 5859642458s (parted) In case you prefer bytes as the unit: (parted) unit B (parted) print Model: ATA WDC WD30EZRX-00M (scsi) Disk /dev/sda: 3000592982016B Sector size (logical/physical): 512B/4096B Partition Table: gpt Number Start End Size File system Name Flags 1 17408B 200017919B 200000512B fat32 boot 2 200017920B 456018431B 256000512B ext2 3 456018432B 3000592956927B 3000136938496B

    Read the article

  • Build My Own Advertising Network

    - by clifgray
    I have a few ideas that I think would be pretty game changing for online advertising and I would like to build my own network but I don't know where to start. I know it will take a lot of time for major publishers to get on board but I am more curious about the technical side. What language/database model and framework are modern ad networks built on? Basically I want to build an advertising network that registers views per page and allows publishers to manage the look of their own ads and let's the users interact with the ads. Is there any good information on doing something like this or any framework you can suggest to build on? I know this would get complicated pretty fast so if you have suggestions for ad networks that let you customize them heavily I would be glad to hear your suggestions.

    Read the article

  • Trouble using Canon MG 2440 printer in UBUNTU 14

    - by user264795
    I connected usb serial cable from printer to computer. The drivers has been installed automatically. I printed the test page - it was printed. I tryed to print an image - it stays with status - processing... and dont work. Test page also cant be printed. What a problem? I dont know exactly, but I think I use "CUPS" manager and drivers... now status Waiting for printer to become available. And do not print.

    Read the article

  • Bomb timer adventure game win32 c++ [on hold]

    - by user3491746
    I'm working on an adventure game in win32 and opengl for my 2nd year university project for class. I am pretty much finished my game but I'm stuck on the concept of how to program a timer which outputs hh : mm : ss -- but which countdown, not up. I've made a clock which counts up using vector matrices and the segxseg matrix algorithm but I cannot figure out how to make a clock (it can be simple even text using wsprintf) that counts down in that format. Can anyone possible give me an example or some literature that I can read on how to do this? Please dont suggest for me to use another environment, I've already been working here for 2 months on this game, and I'm pretty much done so i'm at no point to switch over. Can anyone show me how I can take a shot at this component of my project? Thanks a bunch! Anything that I can get is appreciated.

    Read the article

  • How to detect GLSL warnings?

    - by msell
    After compiling a shader with glCompileShader, I can call glGetShaderiv with GL_COMPILE_STATUS to check if the shader compiled successfully. I can also call glGetShaderInfoLog to get information about possible errors, warnings or other info. The information log returned by this function is unspecified. In a tool where users can write their own shaders, I would like to print all errors and warnings from the compilation, but nothing if no warnings or errors were found. The problem is that the GL_COMPILE_STATUS returns only false if the compilation failed and true otherwise. If no problems were found, some drivers return empty info log from glGetShaderInfoLog, but some drivers can return something else such as "No errors.", which I do not want to print to the user. How is this problem generally solved?

    Read the article

  • How to access / query Team Foundation Server 2012 with Odata?

    - by cseder
    I've tried to find a solution for this for hours now, and I'm getting the same results in the end, asking me to install a lot of Azure and other stuff, plus running some example project .sln that I can't open with my 2012 version of Visual Studio. So, I'm pretty much stuck, and have some pretty straight forward questions regarding this: Does TFS 2012 include the Odata service in any way, so that I don't have to install it? If not, how can I install a NATIVE 2012 version of the Odata service for TFS 2012? Is it possible that I'm aiming for the wrong target here? I'm looking for a solution to the following: I have a TFS 2012 Server that I need to be able to create Work Items on programatically, based on data from our Help Desk system. Then I need to query these Work Items for changed status since its creation, and update the Help Desk Database. Am I better off using the "regular" TFS API? I was kinda thinking that the Odata way was more "future proof", but I'm not sure...

    Read the article

  • How do you change your screen's color temperature in Ubuntu?

    - by RPG Master
    I edit my photos on my laptop (yes, I know they have crap displays) and I recently had to replace the screen because the old one just randomly died. The old one had decent color reproduction by default, but this new one is VERY blue. After playing with the Gamma I've gotten it to be a bit better, but it's still pretty blue. So, my question is, how do I go about changing my laptop's display's color temperature? And I don't mean through something like the Red, Green, Blue sliders in the NVIDIA config menu. I'm talking about like adjusting in degrees, like editing a photo's white balance. EDIT: So now I've found Redshift and it's doing me pretty good. I thought it might be helpful if I out here the command I'm using. redshift -t 5000:5000 -g .5 By adding this to my start up commands I should be good. I'm still open to other suggestions, because I'd like something that actually edited my xorg.conf or something like that.

    Read the article

  • where does the discrepancy between \# in PS1 and n in !n come from?

    - by Cbhihe
    Something has been gnawing at me for a while now and I can't seem to find a relevant answer either in man pages or using your 'Don't be evil' search engine. My .bashrc has the following: shopt -s histappend HISTSIZE=100 HISTFILESIZE=0 # 200 previous value Putting HISTFILESIZE to 0 allows me to start with a clean history slate with each new term window. I find it practical in conjunction with using a prompt that contains \#, because when visualizing a previous command before recalling it with !n or !-p, one can just do: $ history | more to see its relevant "n" value In my case, usually the result of: $ \history | tail -1 | awk '{print $1}' # (I know this is an overkill, don't flame me) equals the expanded value of # in PS1 minus 1, which is how I like it to be at all times. But then, sometimes not. At times the expanded value of # sort of "runs away". It's incremented in such a a manner that it becomes than $(( $(\history | tail -1 | awk '{print $1}')+1 )) Any pointers, anyone?

    Read the article

  • "find" command and piping its output through another program

    - by Charbel
    this is not an Ubuntu specific quesion, it applies to all unix/linux. how can I run a command like this: find . -maxdepth 1 -type d -print -exec svn info "{}" | grep URL \; the command above doesn't do what I want, I can't seem to pipe the output of the svn info to grep. This works, but the output contains much more than I need: find . -maxdepth 1 -type d -print -exec svn info "{}" \; Any ideas?

    Read the article

  • Canon Pixma MP150 printer stops before the job is done

    - by aserwin
    I have a Canon Pixma MP150. It's old but it still works well. The problem is that since I have been running Ubuntu 12.04 the printer exhibits odd behavior. Usually right at the end of a job, it will stop. The printing is done, but the printer is still "working" and it won't release the paper. If I pull it out and test the printer, it will start over and print the same job. Once I just let it be and about an hour or so later it finished with no problems. My question is, could the be an issue with the printer (it is old) or is it the drivers in Ubuntu? Any advice (or suggestions on debugging) would be greatly appreciated as I print a lot and don't really want to buy a new printer.

    Read the article

  • Printer Sharing Issue

    - by Sean Webber
    So I set up my printer on 12.10 to share via SAMBA. Windows 'sees' it, it will install it on windows (I have the printer driver installs but it asks for it in Windows default list.. ?), then I can print a test page to the ubuntu printer from Windows. But If I try to print something in Notepad/Wordpad it says 'Printing' but doesn't add it to the "See whats printing" list. If you do it in Google Chrome, however, it works. Any ideas?

    Read the article

  • New to Java Programming - Error help

    - by JJJ
    I am going through a Java book and drafting the examples and have run into the following error when compiling this code. Any help would be appreciated thank you. Error: Main.java:3: class Addition is public, should be declared in a file named Addition.java public class Addition        ^ 1 error Code: import java.io.*; import java.util.Scanner; public class Addition {   public static void main(String[] args) { java.util.Scanner input = new java.util.Scanner(System.in);  int number1; int number2; int sum; System.out.print( "Enter first digit: " ); number1 = input.nextInt(); System.out.print( "Enter second digit:" ); number2 = input.nextInt(); sum = number1 + number2; System.out.printf( "Sum is %d\n, sum" );      } }

    Read the article

  • copying same file name from client to server using tcp protocol with same size of file

    - by user3686570
    This is the client and server program where a client sends a file to server to save in the server. There is a issuse in that same file name is not getting copied on the server with same file size Please help me in this Client program import socket import sys s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(("localhost",9999)) path=raw_input("Please enter the complete PATH of your file : ") f=open (path, "rb") l = f.read(256) while (l): s.sendall(l) l = f.read(10000) s.close() Server Program import socket import sys s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(("localhost",9999)) s.listen(10) while True: s, address = s.accept() print address i=1 f = open( str(i),'wb') #open in binary #i=i+1 while (True): l=s.recv(256) #while (l): f.write(l) l=s.recv(256) print 'File recieve succesfully' f.close() #sc.close() s.close() Thanks in advance

    Read the article

  • how to modify another user's .profile from the recovery console?

    - by Pinpin
    Pretty much everything is in the title, really! ;) I installed a few components to compile go programs, and the last step was to add the go directory to the path. Being a total ubuntu noob, I added the line PATH="Path/To/Folder", after the one that was already there. After the first reboot I can no longer log into ubuntu (the screen black-out for a while and then I'm back to the login screen, and the same chime greets me.) I've been able to boot in recovery mode, open the root's profile with vi, but I cant find my other user's profile, nor pretty much anything.. Any hint would be greatly appreciated! Pascal

    Read the article

  • Writing drivers for a printer?

    - by user828584
    My goal is to be able to fax 20 page pdf documents for free. I've looked online, and there are some free fax services, but all of them have their limits. I do have an old fax machine, but the documents that need to be faxed are on the computer, and to print them would be far from free. Unfortunately, the only way to send a fax with the machine is by scanning it. What's strange is that it can scan to the computer and print from it, but it won't fax from it... :(. Is it possible to write something (preferably C#, but it's going to take some learning anyway) that will allow me to send a fax from the computer? I have very little software experience, and none in anything like this, so I have no idea where to start. If it is possible, where can I find all the information needed to write the program?

    Read the article

  • Unity3D or UDK or OPENGL from scratch?

    - by Legolas
    I am just very confused which I should choose in terms of high end game development. The application that I am designing is pretty simple, requires some 3D, and some effects. I am looking at a game similar to ping pong, but with high textures and graphics. I will just need web services to submit high scores. From my description, you can see that its pretty straight forward and I am confused whether I should use Unity3D or UDK or write the entire application myself with openGL (which will take a lot of time though). If you had faced this dilemma before, and chose for a particular graphics engine, please provide your suggestions and reasons as to why that was better. It would be helpful. Also, how can this affect in terms of investment and revenue ?

    Read the article

  • Why is ComboBoxText giving me a "no attribute" error?

    - by boywithaxe
    I'm trying to add a text Combo Box into my app. I've created in and populated the list but when I I try to print out the active text I get an error. Here's the part of the code in question: def on_netif_changed(self, widget): netif = widget.gtk_combo_box_text_get_active_text() print netif And the error I get: Traceback (most recent call last): File "/home/boywithaxe/Developer/Quickly/broadcast/broadcast/BroadcastWindow.py", line 44, in on_netif_changed netif = widget.gtk_combo_box_text_get_active_text() AttributeError: 'ComboBoxText' object has no attribute 'gtk_combo_box_text_get_active_text' I'm a bit at a loss here, I've no problem betting text from text boxes, but this seems a completely different issue. I tried RTFMing but came up short. I would appreciate any suggestions.

    Read the article

< Previous Page | 93 94 95 96 97 98 99 100 101 102 103 104  | Next Page >