Search Results

Search found 25 results on 1 pages for 'detly'.

Page 1/1 | 1 

  • How do I refresh Disk Utility?

    - by detly
    I do a lot of live system building, which eventually involves imaging a USB drive with the built binary image: dd if=binary.img of=/dev/sdX sync ...where /dev/sdX is a USB drive. As part of my workflow, I like to have Ubuntu's Disk Utility open so I can verify the drive letter and unmount anything that gets mounted automatically. I also use it to create extra partitions for persistence. The trouble is, after writing the image to the device — and even after the sync operation — Disk Utility doesn't show the new partition. It just shows free space. GParted sees it and fdisk sees it. Even after closing and opening Disk Utility, it still shows only free space. If I click "Safe Removal" and physically unplug and replug the USB drive, Disk Utility will then see the partition. Why do I need to remove and re-insert the drive for Disk Utility to see the partitions on it? Can I force Disk Utility to update its information without needing to do this? (using Disk Utility 3.0.2 under Ubuntu 11.10.)

    Read the article

  • How can I disable recent documents in Unity?

    - by detly
    How do I disable the tracking and display of recently opened files (and whatever else is remembered) in a default installation of Ubuntu 11.10? (Note that this is not a duplicate of How can I keep recent files from appearing in Unity?, since that question and its answers are concerned with temporary and specific filtering. I want to disable it completely for a single user account.) Okay, to deflect the inevitable and expand on my motivation... While trawling the usual forums and Google results for a solution, it (unsurprisingly) seems that the near-universal use cases for this request are either browsing porn or Warhammer research. And the obvious solution to this is to create another user account to contain all evidence. However, this is not why I'm asking, and I don't say that to get all high and mighty about it, it's because this answer won't help. (Even though I really don't have any interest in Warhammer, and I have no idea how that paint pot and brush ended up in my drawer, no that's not glue on my thumb, etc.) My actual use case is that I use my personal laptop for presentations in different circles of my life. I have a user account set up with all the settings I like for presentations (shortcuts, small launcher, default associations, etc). But I don't want an accidental keystroke (or the find dialog) to display other recent presentations I've given, or the files I used in composing the presentation, or whatever. I also don't want to have to recreate this profile for every single presentation I might give. I just want a nice little isolated, memoryless, clean corner of my notebook for public display.

    Read the article

  • Is there an equivalent of RDP?

    - by detly
    The "Desktop Sharing" settings that come installed by default seem to use VNC. VNC is a bit of a bandwidth hog, can only work at the resolution of whatever screen is attached to the host, and mirrors every action on the host. (It also seems to work poorly with compositing, but maybe that's been fixed.) I know about X tunnelling, but that's annoying to use and doesn't always work properly (or, more accurately, some apps don't work properly). Is there any kind of protocol in between the two, similar to RDP used for Windows? Specifically, something that can run at a different resolution to the host screen and is a little lighter on the network? (Ideally, the more the protocol could have in common with RDP, the better.)

    Read the article

  • How can I use a CanoScan N640Pex scanner over a USB/parallel cable?

    - by detly
    I have an old CanoScan N640Pex flat bed scanner and a USB-to-parallel port cable through which I can connect it to my PC. Unfortunately neither Simple Scan nor XSane detect the scanner. I'm running Ubuntu 12.04 (plus updates and backports) with kernel 3.2.0-31-generic. dmesg tells me this when I plus the cable in: [256411.641910] usb 7-1: new full-speed USB device number 10 using uhci_hcd [256411.872392] usblp0: USB Bidirectional printer dev 10 if 0 alt 1 proto 2 vid 0x067B pid 0x2305 [256411.872417] usbcore: registered new interface driver usblp lsusb shows this device for my cable: Bus 007 Device 010: ID 067b:2305 Prolific Technology, Inc. PL2305 Parallel Port The device node created is /dev/usb/lp0 crw-rw---- 1 root lp 180, 0 Sep 9 17:46 /dev/usb/lp0 There is no extra information from any of these commands when I attach the scanner to the cable and power it on, though. I suspect I might need to change something in /etc/sane.d/canon_pp.conf, but I have no idea what to put for the ieee1284 line, since there is pretty much zero documentation for that parameter. So how can I get it to work?

    Read the article

  • How can ShadowProtect SBS backup to alternating external drives?

    - by detly
    I am trying to configure ShadowProtect SBS (v. 4.1.5.10129) in Windows Server 2003 SBS to backup my server hard drives to two alternating external drives. What I want is to be able to swap one drive for another every Friday, and have ShadowProtect continue on the same schedule. Ideally, this would require absolutely no user interaction whatsoever, apart from physically unplugging one drive and reconnecting the other. The trouble is, Windows Server 2003 does not allow you to assign the same drive letter to two different devices. So if I plug in drive #1 and assign it drive letter "X:", the next week when I unplug it and plug in drive #2, it gets some other letter. But since ShadowProtect is set to backup to "X:\", it can't find it and the backup fails. The drives are Samsung STORY Station 3.0 2TB drives. How can I configure things so I can just swap the drives over every week and not worry about having to reconfigure drive letters every time?

    Read the article

  • What's the simplest configuration of SVN on a Windows Server to avoid plain text password storage?

    - by detly
    I have an SVN 1.6 server running on a Windows Server 2003 machine, served via CollabNet's svnserve running as a service (using the svn protocol). I would like to avoid storing passwords in plain text on the server. Unfortunately, the default configuration and SASL with DIGEST-MD5 both require plain text password storage. What is the simplest possible way to avoid storing passwords in plain text? My constraints are: Path-based access control to the SVN repository needs to be possible (currently I can use an authz file). As far as I know, this is more-or-less independent of the authentication method. Active directory is available, but it's not just domain-connected windows machines that need to authenticate: workgroup PCs, Linux PCs and software that uses PySVN to perform SVN operations all need to be able to access the repositories. Upgrading the SVN server is feasible, as is installing additional software.

    Read the article

  • Looking for a "light" compositing manager for GNOME

    - by detly
    I have an HP Pavilion DM3 (graphics is nVidia GeForce G105M), running Debian Squeeze with GNOME 2.30. My preference for DE is Gnome + Metacity + Nautilus. I'd like to use Docky, but it requires compositing. So I'm looking for a relatively "light" compositing manager. I realise that "light" is ambiguous, but I basically want something that won't chew through my notebook's batteries because of CPU or GPU usage. I know that Metacity is capable of compositing, but as far as I'm aware it's still testing. Some people report that it's smooth and lightweight, others claim that it eats up processor time. I've also seen references to a problem with nVidia, but no actual details. I'm not averse to Compiz, but I haven't used it before and I don't know what to expect in terms of "weight." And maybe there's something else I haven't heard of. So can anyone recommend anything? Or dispel my idea that Metacity is not the right tool for the job? (Originally posted on GNOME forums.)

    Read the article

  • CherryPy sessions for same domain, different port

    - by detly
    Consider the script below. It will launch two subprocesses, each one a CherryPy app (hit Ctrl+C or whatever the KeyboardInterrupt combo is on your system to end them both). If you run it with CP 3.0 (taking care to change the 3.0/3.1 specific lines in "StartServer"), then visit: http://localhost:15002/ ...you see an empty dict. Then visit: http://localhost:15002/set?val=10 http://localhost:15002/ ...and you see the newly populated dict. Then visit: http://localhost:15012/ ...and go back to http://localhost:15002/ ...and nothing has changed. If you try the same thing with CP 3.1 (remember the lines in "StartServer"!), when you get to the last step, the dict is now empty. This happens in Windows and Debian, Python 2.5 and 2.6. You can try all sorts of things: changing to file storage, separating the storage paths... the only difference it makes is that the sessions might get merged instead of erased. I've read another post about this as well, and there's a suggestion there to put the session tools config keys in the app config rather than the global config, but I don't think that's relevant to this usage where the apps run independently. What do I do to get independent CherryPy applications to NOT interfere with each other? Note: I originally asked this on the CherryPy mailing list but haven't had a response yet so I'm trying here. I hope that's okay. import os, os.path, socket, sys import subprocess import cgi import cherrypy HTTP_PORT = 15002 HTTP_HOST = "127.0.0.1" site1conf = { 'global' : { 'server.socket_host' : HTTP_HOST, 'server.socket_port' : HTTP_PORT, 'tools.sessions.on' : True, # 'tools.sessions.storage_type': 'file', # 'tools.sessions.storage_path': '1', # 'tools.sessions.storage_path': '.', 'tools.sessions.timeout' : 1440}} site2conf = { 'global' : { 'server.socket_host' : HTTP_HOST, 'server.socket_port' : HTTP_PORT + 10, 'tools.sessions.on' : True, # 'tools.sessions.storage_type': 'file', # 'tools.sessions.storage_path': '2', # 'tools.sessions.storage_path': '.', 'tools.sessions.timeout' : 1440}} class Home(object) : def __init__(self, key): self.key = key @cherrypy.expose def index(self): return """\ <html> <body>Session: <br>%s </body> </html> """ % cgi.escape(str(dict(cherrypy.session))) @cherrypy.expose def set(self, val): cherrypy.session[self.key.upper()] = val return """\ <html> <body>Set %s to %s</body> </html>""" % (cgi.escape(self.key), cgi.escape(val)) def StartServer(conf, key): cherrypy.config.update(conf) print 'Starting server (%s)' % key cherrypy.tree.mount(Home(key), '/', {}) # Start the web server. #### 3.0 # cherrypy.server.quickstart() # cherrypy.engine.start() #### #### 3.1 cherrypy.engine.start() cherrypy.engine.block() #### def Main(): # Start first webserver proc1 = subprocess.Popen( [sys.executable, os.path.abspath(__file__), "1"]) proc2 = subprocess.Popen( [sys.executable, os.path.abspath(__file__), "2"]) proc1.wait() proc2.wait() if __name__ == "__main__": print sys.argv if len(sys.argv) == 1: # Master process Main() elif(int(sys.argv[1]) == 1): StartServer(site1conf, 'magic') elif(int(sys.argv[1]) == 2): StartServer(site2conf, 'science') else: sys.exit(1)

    Read the article

  • PyGTK: dynamic label wrapping

    - by detly
    It's a known bug/issue that a label in GTK will not dynamically resize when the parent changes. It's one of those really annoying small details, and I want to hack around it if possible. I followed the approach at 16 software, but as per the disclaimer you cannot then resize it smaller. So I attempted a trick mentioned in one of the comments (the set_size_request call in the signal callback), but this results in some sort of infinite loop (try it and see). Does anyone have any other ideas? (You can't block the signal just for the duration of the call, since as the print statements seem to indicate, the problem starts after the function is left.) The code is below. You can see what I mean if you run it and try to resize the window larger and then smaller. (If you want to see the original problem, comment out the line after "Connect to the size-allocate signal", run it, and resize the window bigger.) The Glade file ("example.glade"): <?xml version="1.0"?> <glade-interface> <!-- interface-requires gtk+ 2.16 --> <!-- interface-naming-policy project-wide --> <widget class="GtkWindow" id="window1"> <property name="visible">True</property> <signal name="destroy" handler="on_destroy"/> <child> <widget class="GtkLabel" id="label1"> <property name="visible">True</property> <property name="label" translatable="yes">In publishing and graphic design, lorem ipsum[p][1][2] is the name given to commonly used placeholder text (filler text) to demonstrate the graphic elements of a document or visual presentation, such as font, typography, and layout. The lorem ipsum text, which is typically a nonsensical list of semi-Latin words, is a hacked version of a Latin text by Cicero, with words/letters omitted and others inserted, but not proper Latin[1][2] (see below: History and discovery). The closest English translation would be "pain itself" (dolorem = pain, grief, misery, suffering; ipsum = itself).</property> <property name="wrap">True</property> </widget> </child> </widget> </glade-interface> The Python code: #!/usr/bin/python import pygtk import gobject import gtk.glade def wrapped_label_hack(gtklabel, allocation): print "In wrapped_label_hack" gtklabel.set_size_request(allocation.width, -1) # If you uncomment this, we get INFINITE LOOPING! # gtklabel.set_size_request(-1, -1) print "Leaving wrapped_label_hack" class ExampleGTK: def __init__(self, filename): self.tree = gtk.glade.XML(filename, "window1", "Example") self.id = "window1" self.tree.signal_autoconnect(self) # Connect to the size-allocate signal self.get_widget("label1").connect("size-allocate", wrapped_label_hack) def on_destroy(self, widget): self.close() def get_widget(self, id): return self.tree.get_widget(id) def close(self): window = self.get_widget(self.id) if window is not None: window.destroy() gtk.main_quit() if __name__ == "__main__": window = ExampleGTK("example.glade") gtk.main()

    Read the article

  • Tabular (X)HTML forms

    - by detly
    I have a set of items that can be in various states. I want to allow a user to use an (X)HTML form to change the state, and easily view the state of a group of objects ...so to this end, I'd like a layout like: | item1 | radio button for state 1 | radio for state 2 | ... | [update button] | | item2 | radio button for state 1 | radio for state 2 | ... | [update button] | etc. I prefer the radio buttons to list boxes so that it's easy for a user to visually scan for things in a certain state. It seemed like perfectly tabular data to me. The only problem is, you can't have forms inside a table that cross table cells (ie. <tr> <form> <td> ... is invalid). I thought, "hey, I could have one giant form wrapping a table, and make the [update button] value contain the IDs for each row!" Turns out certain versions of IE send ALL THE SUBMIT BUTTON VALUES on any single form. So I thought perhaps to to lay it out with <div>s and place the forms inside a single <td>. But then they break a line on each <div>. So I fixed their width and made them float: left. But then they wrap inside the table cells if the table row is wider than the page, and the radio controls don't line up with the headings. Is it possible to lay this out as I intend? The XHTML below shows the intended structure. Observe what happens if you resize the browser window below the width of the table (ideally, the name would break or the table would show a scroll bar). <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head><title>Test</title> <style type="text/css"> .state-select, .thing-state-name, .update { float: left; width: 8em; } .state-select { text-align: center; } </style> </head> <body> <table> <thead> <tr> <th class="thing-name-header">Thing</th> <th> <div class="thing-state-name">Present</div> <div class="thing-state-name">Absent</div> <div class="thing-state-name">Haven't looked</div> </th> </tr> </thead> <tbody> <tr> <td>Apple</td> <td> <form action="something" method="post"> <input type="hidden" name="id" value="1" /> <div class="state-select"><input type="radio" name="presence" value="present" checked="checked" /></div> <div class="state-select"><input type="radio" name="presence" value="absent" /></div> <div class="state-select"><input type="radio" name="presence" value="unknown" /></div> <div class="update"><input type="submit" value="Update" /></div> </form> </td></tr> <tr> <td>Orange</td> <td> <form action="something" method="post"> <input type="hidden" name="id" value="2" /> <div class="state-select"><input type="radio" name="presence" value="present" /></div> <div class="state-select"><input type="radio" name="presence" value="absent" checked="checked" /></div> <div class="state-select"><input type="radio" name="presence" value="unknown" /></div> <div class="update"><input type="submit" value="Update" /></div> </form> </td></tr> <tr> <td>David Bowie</td> <td> <form action="something" method="post"> <input type="hidden" name="id" value="3" /> <div class="state-select"><input type="radio" name="presence" value="present" /></div> <div class="state-select"><input type="radio" name="presence" value="absent" /></div> <div class="state-select"><input type="radio" name="presence" value="unknown" checked="checked" /></div> <div class="update"><input type="submit" value="Update" /></div> </form> </td></tr> </tbody> </table> </body> </html>

    Read the article

  • Free static checker for C99 code

    - by detly
    I am looking for a free static checker for C99 code (including GCC extensions) with the ability to explicitly say "these preprocessor macros are always defined." I need that last part because I am compiling embedded code for a single target processor. The compiler (Microchip's C32, GCC based) sets a macro based on the selected processor, which is then used in the PIC32 header files to select a processor-specific header file to include. cppcheck therefore fails because it detects the 30 different #ifdefs used to select one of the many possible PIC32 processors, tries to analyse all possible combinations of these plus all other #defines, and fails. For example, if splint could process C99 code, I would use splint -D__PIC32_FEATURE_SET__=460 -D__32MX460F512L__ \ -D__LANGUAGE_C__ -I/path/to/my/includes source.c

    Read the article

  • Python lazy property decorator

    - by detly
    Recently I've gone through an existing code base and refactored a lot of instance attributes to be lazy, ie. not be initialised in the constructor but only upon first read. These attributes do not change over the lifetime of the instance, but they're a real bottleneck to calculate that first time and only really accessed for special cases. I find myself typing the following snippet of code over and over again for various attributes across various classes: class testA(object): def __init__(self): self._a = None self._b = None @property def a(self): if self._a is None: # Calculate the attribute now self._a = 7 return self._a @property def b(self): #etc Is there an existing decorator to do this already in Python that I'm simply unaware of? Or, is there a reasonably simple way to define a decorator that does this? I'm working under Python 2.5, but 2.6 answers might still be interesting if they are significantly different.

    Read the article

  • PyGTK/GIO: monitor directory for changes recursively

    - by detly
    Take the following demo code (from the GIO answer to this question), which uses a GIO FileMonitor to monitor a directory for changes: import gio def directory_changed(monitor, file1, file2, evt_type): print "Changed:", file1, file2, evt_type gfile = gio.File(".") monitor = gfile.monitor_directory(gio.FILE_MONITOR_NONE, None) monitor.connect("changed", directory_changed) import glib ml = glib.MainLoop() ml.run() After running this code, I can then create and modify child nodes and be notified of the changes. However, this only works for immediate children (I am aware that the docs don't say otherwise). The last of the following shell commands will not result in a notification: touch one mkdir two touch two/three Is there an easy way to make it recursive? I'd rather not manually code something that looks for directory creation and adds a monitor, removing them on deletion, etc. The intended use is for a VCS file browser extension, to be able to cache the statuses of files in a working copy and update them individually on changes. So there might by anywhere from tens to thousands (or more) directories to monitor. I'd like to just find the root of the working copy and add the file monitor there. I know about pyinotify, but I'm avoiding it so that this works under non-Linux kernels such as FreeBSD or... others. As far as I'm aware, the GIO FileMonitor uses inotify underneath where available, and I can understand not emphasising the implementation to maintain some degree of abstraction, but it suggested to me that it should be possible. (In case it matters, I originally posted this on the PyGTK mailing list.)

    Read the article

  • PySVN: is property status "none" equivalent to unchanged?

    - by detly
    I know the practical difference between a PySVN property status of "normal" (has properties, not changed locally) and "none" (has no properties). My question is this: is it ever possible for there to be local modifications to an items properites, and have PySVN report the property status as "none"? I would say no, but maybe there's some corner case I'm missing.

    Read the article

  • Compile time float packing/punning

    - by detly
    I'm writing C for the PIC32MX, compiled with Microchip's PIC32 C compiler (based on GCC 3.4). My problem is this: I have some reprogrammable numeric data that is stored either on EEPROM or in the program flash of the chip. This means that when I want to store a float, I have to do some type punning: typedef union { int intval; float floatval; } IntFloat; unsigned int float_as_int(float fval) { IntFloat intf; intf.floatval = fval; return intf.intval; } // Stores an int of data in whatever storage we're using void StoreInt(unsigned int data, unsigned int address); void StoreFPVal(float data, unsigned int address) { StoreInt(float_as_int(data), address); } I also include default values as an array of compile time constants. For (unsigned) integer values this is trivial, I just use the integer literal. For floats, though, I have to use this Python snippet to convert them to their word representation to include them in the array: import struct hex(struct.unpack("I", struct.pack("f", float_value))[0]) ...and so my array of defaults has these indecipherable values like: const unsigned int DEFAULTS[] = { 0x00000001, // Some default integer value, 1 0x3C83126F, // Some default float value, 0.005 } (These actually take the form of X macro constructs, but that doesn't make a difference here.) Commenting is nice, but is there a better way? It's be great to be able to do something like: const unsigned int DEFAULTS[] = { 0x00000001, // Some default integer value, 1 COMPILE_TIME_CONVERT(0.005), // Some default float value, 0.005 } ...but I'm completely at a loss, and I don't even know if such a thing is possible. Notes Obviously "no, it isn't possible" is an acceptable answer if true. I'm not overly concerned about portability, so implementation defined behaviour is fine, undefined behaviour is not (I have the IDB appendix sitting in front of me). As fas as I'm aware, this needs to be a compile time conversion, since DEFAULTS is in the global scope. Please correct me if I'm wrong about this.

    Read the article

  • List available languages for PyGTK UI strings

    - by detly
    I'm cleaning up some localisation and translation settings in our PyGTK application. The app is only intended to be used under GNU/Linux systems. One of the features we want is for users to select the language used for the applications (some prefer their native language, some prefer English for consistency, some like French because it sounds romantic, etc). For this to work, I need to actually show a combo box with the various languages available. How can I get this list? In fact, I need a list of pairs of the language code ("en", "ru", etc) and the language name in the native language ("English (US)", "???????"). If I had to implement a brute force method, I'd do something like: look in the system locale dir (eg. "/usr/share/locale") for all language code dirs (eg. "en/") containing the relative path "LC_MESSAGES/OurAppName.mo". Is there a more programmatic way?

    Read the article

  • Swapping an image during web development

    - by detly
    I'm trying to see what a certain webpage would look like if I replaced a certain image with another. Rather than upload the image, edit the site, etc, each time I tweak it, I'd like to know if there's a way to change the image in the page to my local version while viewing the remote page. I use Firebug for debugging web development usually, but I'm open to any other tool that might do this. (It is absolutely impossible to search for this and find anything but questions about dynamic image swapping on a deployed website, so sorry if this is a duplicate.)

    Read the article

  • Python/C "defs" file - what is it?

    - by detly
    In the nautilus-python bindings, there is a file "nautilus.defs". It contains stanzas like (define-interface MenuProvider (in-module "Nautilus") (c-name "NautilusMenuProvider") (gtype-id "NAUTILUS_TYPE_MENU_PROVIDER") ) or (define-method get_mime_type (of-object "NautilusFileInfo") (c-name "nautilus_file_info_get_mime_type") (return-type "char*") ) Now I can see what most of these do (eg. that last one means that I can call the method "get_mime_type" on a "FileInfo" object). But I'd like to know: what is this file, exactly (ie. what do I search the web for to find out more info)? Is it a common thing to find in Python/C bindings? What is the format, and where is it documented? What program actually processes it? (So far, I've managed to glean that it gets transformed into a C source file, and it looks a bit like lisp to me.)

    Read the article

  • Web-based code interpreter

    - by detly
    I remember coming across a website where I could type in some code and it would compile and run it (or error out), displaying any console output. It accepted a variety of interpreted and non-interpreted languages — I specifically remember that I could use C (maybe Python too... I'm not completely sure). Does anyone know what site I'm talking about?

    Read the article

  • Separate specific #ifdef branches

    - by detly
    In short: I want to generate two different source trees from the current one, based only on one preprocessor macro being defined and another being undefined, with no other changes to the source. If you are interested, here is my story... In the beginning, my code was clean. Then we made a new product, and yea, it was better. But the code saw only the same peripheral devices, so we could keep the same code. Well, almost. There was one little condition that needed to be changed, so I added: #if defined(PRODUCT_A) condition = checkCat(); #elif defined(PRODUCT_B) condition = checkCat() && checkHat(); #endif ...to one and only one source file. In the general all-source-files-include-this header file, I had: #if !(defined(PRODUCT_A)||defined(PRODUCT_B)) #error "Don't make me replace you with a small shell script. RTFM." #endif ...so that people couldn't compile it unless they explicitly defined a product type. All was well. Oh... except that modifications were made, components changed, and since the new hardware worked better we could significantly re-write the control systems. Now when I look upon the face of the code, there are more than 60 separate areas delineated by either: #ifdef PRODUCT_A ... #else ... #endif ...or the same, but for PRODUCT_B. Or even: #if defined(PRODUCT_A) ... #elif defined(PRODUCT_B) ... #endif And of course, sometimes sanity took a longer holiday and: #ifdef PRODUCT_A ... #endif #ifdef PRODUCT_B ... #endif These conditions wrap anywhere from one to two hundred lines (you'd think that the last one could be done by switching header files, but the function names need to be the same). This is insane. I would be better off maintaining two separate product-based branches in the source repo and porting any common changes. I realise this now. Is there something that can generate the two different source trees I need, based only on PRODUCT_A being defined and PRODUCT_B being undefined (and vice-versa), without touching anything else (ie. no header inclusion, no macro expansion, etc)?

    Read the article

  • Compiler error when casting to function pointer

    - by detly
    I'm writing a bootloader for the PIC32MX, using HiTech's PICC32 compiler (similar to C90). At some point I need to jump to the real main routine, so somewhere in the bootloader I have void (*user_main) (void); user_main = (void (*) (void)) 0x9D003000; user_main(); (Note that in the actual code, the function signature is typedef'd and the address is a macro.) I would rather calculate that (virtual) address from the physical address, and have something like: void (*user_main) (void); user_main = (void (*) (void)) (0x1D003000 | 0x80000000); user_main(); ...but when I try that I get a compiler error: Error #474: ; 0: no psect specified for function variable/argument allocation Have I tripped over some vagarity of C syntax here? This error doesn't reference any particular line, but if I comment out the user_main() call, it goes away. (This might be the compiler removing a redundant code branch, but the HiTech PICC32 isn't particularly smart in Lite mode, so maybe not.)

    Read the article

  • Using Sphinx with a distutils-built C extension

    - by detly
    I have written a Python module including a submodule written in C: the module itself is called foo and the C part is foo._bar. The structure looks like: src/ foo/__init__.py <- contains the public stuff foo/_bar/bar.c <- the C extension doc/ <- Sphinx configuration conf.py ... foo/__init__.py imports _bar to augment it, and the useful stuff is exposed in the foo module. This works fine when it's built, but obviously won't work in uncompiled form, since _bar doesn't exist until it's built. I'd like to use Sphinx to document the project, and use the autodoc extension on the foo module. This means I need to build the project before I can build the documentation. Since I build with distutils, the built module ends up in some variably named dir build/lib.linux-ARCH-PYVERSION — which means I can't just hard-code the directory into a Sphinx' conf.py. So how do I configure my distutils setup.py script to run the Sphinx builder over the built module? For completeness, here's the call to setup (the 'fake' things are custom builders that subclass build and build_ext): setup(cmdclass = { 'fake': fake, 'build_ext_fake' : build_ext_fake }, package_dir = {'': 'src'}, packages = ['foo'], name = 'foo', version = '0.1', description = desc, ext_modules = [module_real])

    Read the article

  • Looking for a good explanation of the table generation macro idiom

    - by detly
    I want to make this clear up front : I know how this trick works, what I want is a link to a clear explanation to share with others. One of the answers to a C macro question talks about the "X macro" or "not yet defined macro" idiom. This involves defining something like: #define MAGIC_LIST \ X(name_1, default_1) \ X(name_2, default_2) \ ... Then to create, say, an array of values with named indices you do: typedef enum { #define X(name, val) name, MAGIC_LIST #undef X } NamedDefaults; You can repeat the procedure with a different #define for X() to create an array of values, and maybe debugging strings, etc. I'd like a link to a clear explanation of how this works, pitched at someone who is passably familiar with C. I have no idea what everyone usually calls this pattern, though, so my attempts to search the web for it have failed thus far. (If there is such an explanation on SO, that'd be fine...)

    Read the article

  • How can I tell SVN that a file was renamed by another tool?

    - by detly
    I am using Subversion with some files that are managed by another application. I would like to rename the files, but the rename must be done from within the application so that it correctly updates its own metadata. This means that I cannot simply use SVN's rename command — the application's metadata will become inconsistent. So how can I can I tell SVN that the files in the working copy have been renamed by this application, so that it preserves history in the same way as per the rename command?

    Read the article

1