Search Results

Search found 191 results on 8 pages for 'brent with a mustache'.

Page 5/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • How to properly read 16 byte unsigned integer with BinaryReader

    - by Brent
    I need to parse a binary stream in .NET to convert a 16 byte unsigned integer. I would like to use the BinaryReader.ReadUIntXX() functions but there isn't a BinaryReader.ReadUInt128() function available. I assume I will have to roll my own function using the ReadByte function and build an array but I don't know if this is the most efficient method? Thanks!

    Read the article

  • C++ EZWindows Linker Errors when trying to run demos

    - by Brent Nash
    I'm attempting to download and use the EZWindows ( http://www.cs.virginia.edu/c++programdesign/software/ ) SPARC installation (the http://www.cs.virginia.edu/c++programdesign/software/EzWindows2a-SPARC.tar.gz file). When trying to build some of the examples that come with it, I'm getting some linker errors that I just can't figure out. Here's the result of the uname -a command on the machine I'm running on (on which I am NOT an administrator): SunOS AAA.BBB.edu 5.10 Generic_138888-07 sun4v sparc SUNW,T5240 And here is the result of the g++ -v command: gcc version 2.95.2 19991024 (release) If you untar/unzip the package, I'm trying to compile the example in samples/chap03/lawn by simply doing "gmake" in that directory, here's what I get. Here's the error I get: bash-3.00$ gtar xfz EzWindows2a-SPARC.tar.gz gtar: Removing leading `./' from member names bash-3.00$ cd chap03/lawn bash-3.00$ gmake clean ; gmake rm -f *.o *~ lawn make lawn g++ -I/X11.6/include -I../../EzWindows/include -c prog3-5.cpp prog3-5.cpp: In function `int ApiMain()': prog3-5.cpp:75: warning: initialization to `long int' from `const float' prog3-5.cpp:85: warning: initialization to `int' from `float' prog3-5.cpp:86: warning: initialization to `int' from `float' g++ -o lawn prog3-5.o -L/X11.6/lib -R/X11.6/lib -lX11 -lsocket -L../../EzWindows/lib -lezwin -lXpm ld: warning: symbol `clog' has differing types: (file /usr/usc/gnu/gcc/2.95.2/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so type=OBJT; file /lib/libm.so type=FUNC); /usr/usc/gnu/gcc/2.95.2/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/libstdc++.so definition taken Undefined first referenced symbol in file __dl__Q2t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i03RepPv ../../EzWindows/lib/libezwin.a(WindowManager.o) __eh_pc ../../EzWindows/lib/libezwin.a(WindowManager.o) clone__Q2t12basic_string3ZcZt18string_char_traits1ZcZt24__default_alloc_template2b0i03Rep ../../EzWindows/lib/libezwin.a(WindowManager.o) ld: fatal: Symbol referencing errors. No output written to lawn collect2: ld returned 1 exit status *** Error code 1 make: Fatal error: Command failed for target `lawn' Current working directory /export/samfs-bcf/rcf-11/bnash/sparc/chap03/lawn gmake: *** [default] Error 1 This particular run was built using g++ 2.95.2, but I've also tried with versions 3.3.2 and 4.2.1 with other equally strange errors. I'm pretty sure that EZWindows requires a 2.x version of gcc & g++. I've tried to make sure that my LD_LIBRARY_PATH and PATH are setup to include everything that's needed, but it seems that may be incorrect. I'm running out of ideas. Anyone have any other ones?

    Read the article

  • How can I catch an invalid fgetpos call as a C++ exception on Windows?

    - by Brent Arias
    In Visual C++ 2008, I want to "catch" an exception generated as shown here: try { int foo = 20; ::fgetpos(0, (fpos_t*)&foo); } //... Here are adjustments I've made to attempt a successful catch: SEH is activated (/eha) I've added a catch(...) I've added a _set_se_translator vector. I've added/adjusted to SEH syntax: __try / __except(EXCEPTION_EXECUTE_HANDLER) In short, I've tried "everything in the book" and I still can't catch the exception. If I replace the call to ::fgetpos with int hey = foo / 0 then suddenly all of the above techniques work as expected. So the exception I'm dealing with from ::fgetpos is somehow "extra special." Can someone explain why this ::fgetpos error seems uncatchable, and how to work around it? update When executed in the VS IDE, the output window doesn't name an exception. All it says is this: Microsoft Visual Studio C Runtime Library has detected a fatal error in MyProgram.exe. Not very helpful. When I run the console app from the command line, I get a crash dialogue. The "problem details" section of the dialogue includes this information: Problem Event Name: BEX Exception Offset:0002fd30 Exception Code: c0000417 Exception Data: 00000000 Additional Information 1:69ad Additional Information 2:69addfb19767b2221c8e3e7a5cd2f4ae Additional Information 3:b1ff Additional Information 4:b1ffca30cadddc78c19f19b6d150997f

    Read the article

  • Looking for regex to extract email addresses from /etc/passwd

    - by Brent
    Most of my users have email addresses associated with their profile in /etc/passwd. They are always in the 5th field, which I can grab, but they appear at different places within a comma-separated list in the 5th field. Can somebody give me a regex to grab just the email address (delimeted by commas) from a line in this file? (I will be using grep and sed from a bash script) Sample lines from file: user1:x:1147:5005:User One,Department,,,[email protected]:/home/directory:/bin/bash user2:x:1148:5002:User Two,Department2,[email protected],:/home/directory:/bin/bash

    Read the article

  • Is there a simple way to make lists behave as files (with ftplib)

    - by Brent.Longborough
    I'd like to use ftplib to upload program-generated data as lists. The nearest method I can see for doing this is ftp.storlines, but this requires a file object with a readlines() method. Obviously I could create a file, but this seems like overkill as the data isn't persistent. Is there anything that could do this?: session = ftp.new(...) upload = convertListToFileObject(mylist) session.storlines("STOR SOMETHING",upload) session.quit

    Read the article

  • Why do I get a segmentation fault while redirecting sys.stdout to Tkinter.Text widget in Python?

    - by Brent Nash
    I'm in the process of building a GUI-based application with Python/Tkinter that builds on top of the existing Python bdb module. In this application, I want to silence all stdout/stderr from the console and redirect it to my GUI. To accomplish this purpose, I've written a specialized Tkinter.Text object (code at the end of the post). The basic idea is that when something is written to sys.stdout, it shows up as a line in the "Text" with the color black. If something is written to sys.stderr, it shows up as a line in the "Text" with the color red. As soon as something is written, the Text always scrolls down to view the most recent line. I'm using Python 2.6.1 at the moment. On Mac OS X 10.5, this seems to work great. I have had zero problems with it. On RedHat Enterprise Linux 5, however, I pretty reliably get a segmentation fault during the run of a script. The segmentation fault doesn't always occur in the same place, but it pretty much always occurs. If I comment out the sys.stdout= and sys.stderr= lines from my code, the segmentation faults seem to go away. I'm sure there are other ways around this that I will probably have to resort to, but can anyone see anything I'm doing blatantly wrong here that could be causing these segmentation faults? It's driving me nuts. Thanks! PS - I realize redirecting sys.stderr to the GUI might not be a great idea, but I still get segmentation faults even when I only redirect sys.stdout and not sys.stderr. I also realize that I'm allowing the Text to grow indefinitely at the moment. class ConsoleText(tk.Text): '''A Tkinter Text widget that provides a scrolling display of console stderr and stdout.''' class IORedirector(object): '''A general class for redirecting I/O to this Text widget.''' def __init__(self,text_area): self.text_area = text_area class StdoutRedirector(IORedirector): '''A class for redirecting stdout to this Text widget.''' def write(self,str): self.text_area.write(str,False) class StderrRedirector(IORedirector): '''A class for redirecting stderr to this Text widget.''' def write(self,str): self.text_area.write(str,True) def __init__(self, master=None, cnf={}, **kw): '''See the __init__ for Tkinter.Text for most of this stuff.''' tk.Text.__init__(self, master, cnf, **kw) self.started = False self.write_lock = threading.Lock() self.tag_configure('STDOUT',background='white',foreground='black') self.tag_configure('STDERR',background='white',foreground='red') self.config(state=tk.DISABLED) def start(self): if self.started: return self.started = True self.original_stdout = sys.stdout self.original_stderr = sys.stderr stdout_redirector = ConsoleText.StdoutRedirector(self) stderr_redirector = ConsoleText.StderrRedirector(self) sys.stdout = stdout_redirector sys.stderr = stderr_redirector def stop(self): if not self.started: return self.started = False sys.stdout = self.original_stdout sys.stderr = self.original_stderr def write(self,val,is_stderr=False): #Fun Fact: The way Tkinter Text objects work is that if they're disabled, #you can't write into them AT ALL (via the GUI or programatically). Since we want them #disabled for the user, we have to set them to NORMAL (a.k.a. ENABLED), write to them, #then set their state back to DISABLED. self.write_lock.acquire() self.config(state=tk.NORMAL) self.insert('end',val,'STDERR' if is_stderr else 'STDOUT') self.see('end') self.config(state=tk.DISABLED) self.write_lock.release()

    Read the article

  • Is there a modern free D?VCS that can ignore mainframe sequence numbers?

    - by Brent.Longborough
    I'm looking at migrating a large suite of IBM Assembler Language programs, from a vcs based on "filenames include version numbers", to a modern vcs which will give me, among other things, the ability to branch and merge. These files have 80-column records, the last 8 columns being an almost-meaningless sequence number. For a number of reasons which I don't really want to waste space by going into, I need the vcs to ignore (but hopefully preserve in some well-defined manner) the sequence number columns, and to diff and patch based only on the contents of the first 72 columns. Any ideas? Just to clarify "ignore but preserve": I accept it's a bit vague, as I haven't fully collected my ideas yet. It would be something along the lines of this: "When merging/patching, if one side has sequence numbers, output them; if more-than-one side has sequence numbers, use those present in file (1|2|3)" Why do I want to preserve sequence numbers? First, they really are sequence numbers. Second, I want to reintegrate this stuff back onto the mainframe, where sequence numbers can be terribly significant. (Those of you who know what "SMP/E" means will understand. Those who don't, be happy, but tremble...) I've just realised I hadn't accepted an answer. Difficult choice, but @Noldorin comes closest to where I have to go.

    Read the article

  • How do I get Cabal to bypass my Windows proxy settings?

    - by Brent.Longborough
    When retrieving packages with Cabal, I frequently get errors with this message: user error (Codec.Compression.Zlib: premature end of compressed stream) It looks like Cabal is using my Windows Networking proxy settings (for Privoxy). From digging around Google, Cabal or its libraries appear to have (had) a problem in this area. Possible solutions I can see are: Turn off proxying while using Cabal (not very keen on this one); or Get a patch and start hacking. I'm hesitant to go down this path, as I'm a complete Haskell noob and I'm not yet comfortable with Darcs; or Give it the magic "can I haz no proxy" parameter. Hence the question.

    Read the article

  • Need Opinions: Should an ASP.NET Application allow administrators to change MSSQL connection?

    - by Brent Pabst
    As the title suggests: What is your opinion on allowing administrators to update the SQL Connection string dynamically from the application versus just showing them the connection details in the application? Because the database connection is so important and on a heavily used system the abrupt change to the connection seems like it could cause problems. However I would think displaying the server and catalog and whether the connection is using SSPI or SQL Auth could be helpful for administrators who don't like playing with .NET config files. Thoughts?

    Read the article

  • Setting up relations/mappings for a SQLAlchemy many-to-many database

    - by Brent Ramerth
    I'm new to SQLAlchemy and relational databases, and I'm trying to set up a model for an annotated lexicon. I want to support an arbitrary number of key-value annotations for the words which can be added or removed at runtime. Since there will be a lot of repetition in the names of the keys, I don't want to use this solution directly, although the code is similar. My design has word objects and property objects. The words and properties are stored in separate tables with a property_values table that links the two. Here's the code: from sqlalchemy import Column, Integer, String, Table, create_engine from sqlalchemy import MetaData, ForeignKey from sqlalchemy.orm import relation, mapper, sessionmaker from sqlalchemy.ext.declarative import declarative_base engine = create_engine('sqlite:///test.db', echo=True) meta = MetaData(bind=engine) property_values = Table('property_values', meta, Column('word_id', Integer, ForeignKey('words.id')), Column('property_id', Integer, ForeignKey('properties.id')), Column('value', String(20)) ) words = Table('words', meta, Column('id', Integer, primary_key=True), Column('name', String(20)), Column('freq', Integer) ) properties = Table('properties', meta, Column('id', Integer, primary_key=True), Column('name', String(20), nullable=False, unique=True) ) meta.create_all() class Word(object): def __init__(self, name, freq=1): self.name = name self.freq = freq class Property(object): def __init__(self, name): self.name = name mapper(Property, properties) Now I'd like to be able to do the following: Session = sessionmaker(bind=engine) s = Session() word = Word('foo', 42) word['bar'] = 'yes' # or word.bar = 'yes' ? s.add(word) s.commit() Ideally this should add 1|foo|42 to the words table, add 1|bar to the properties table, and add 1|1|yes to the property_values table. However, I don't have the right mappings and relations in place to make this happen. I get the sense from reading the documentation at http://www.sqlalchemy.org/docs/05/mappers.html#association-pattern that I want to use an association proxy or something of that sort here, but the syntax is unclear to me. I experimented with this: mapper(Word, words, properties={ 'properties': relation(Property, secondary=property_values) }) but this mapper only fills in the foreign key values, and I need to fill in the other value as well. Any assistance would be greatly appreciated.

    Read the article

  • How do I retain a requested url with parameters after redirecting to a login page?

    - by Brent Parker
    I have been asked to set up some authentication for some content on our website using JSP. What I would like to do seems simple to me but I can't quite figure out how to do it in JSP. What I would like to do is this: When a user requests a page that you must be logged in to see, I have a tag that checks their cookies for an authentication token. If it is not there, they are redirected to a login page. After they log in, I want to redirect them back to the page they first requested along with any parameters they were sending. Now, I have the tag that is checking their authentication and redirecting them to the login page. That part is working just fine. But I'm not sure how to maintain the first requested url and parameters so they can be redirected after they login. How might I accomplish this?

    Read the article

  • .Net Windows Service to monitor mailbox

    - by Brent
    Hi there, I need to create a .Net windows service to monitor a mailbox and process attachments (if found) on the emails and then delete the email from the server. I have two questions I'd like your thoughts on: POP3 or IMAP to connect to the mail server? Which POP3/IMAP library should I use. At this stage we're just doing a proof of concept, so a free one would be my preference. Cheers!

    Read the article

  • Is calling of overload operator-> resolved at compile time?

    - by Brent
    when I tried to compile the code: (note: func and func2 is not typo) struct S { void func2() {} }; class O { public: inline S* operator->() const; private: S* ses; }; inline S* O::operator->() const { return ses; } int main() { O object; object->func(); return 0; } there is a compile error reported: D:\code>g++ operatorp.cpp -S -o operatorp.exe operatorp.cpp: In function `int main()': operatorp.cpp:27: error: 'struct S' has no member named 'func' it seems that invoke the overloaded function of "operator-" is done during compile time? I'd added "-S" option for compile only.

    Read the article

  • Is there a more modern regexp handler for Open Object Rexx

    - by Brent.Longborough
    The regular expression class (rxregexp.dll) that comes with ooRexx (I'm on 4.0.0) is relatively low on function compared, say, with Python's re module (even at 2.5.2). It appears to have no assertions, no facilities for group extraction, or for substitution. Greedy or lazy matching is a global pattern option, rather than flagged by an additional "?". Basically, a pre-PCRE regular expression engine. Does anyone know if anything with more up-to-date function is available?

    Read the article

  • NSNotifications vs delegate for multiple instances of same protocol

    - by Brent Traut
    I could use some architectural advice. I've run into the following problem a few times now and I've never found a truly elegant way to solve it. The issue, described at the highest level possible:I have a parent class that would like to act as the delegate for multiple children (all using the same protocol), but when the children call methods on the parent, the parent no longer knows which child is making the call. I would like to use loose coupling (delegates/protocols or notifications) rather than direct calls. I don't need multiple handlers, so notifications seem like they might be overkill. To illustrate the problem, let me try a super-simplified example: I start with a parent view controller (and corresponding view). I create three child views and insert each of them into the parent view. I would like the parent view controller to be notified whenever the user touches one of the children. There are a few options to notify the parent: Define a protocol. The parent implements the protocol and sets itself as the delegate to each of the children. When the user touches a child view, its view controller calls its delegate (the parent). In this case, the parent is notified that a view is touched, but it doesn't know which one. Not good enough. Same as #1, but define the methods in the protocol to also pass some sort of identifier. When the child tells its delegate that it was touched, it also passes a pointer to itself. This way, the parent know exactly which view was touched. It just seems really strange for an object to pass a reference to itself. Use NSNotifications. The parent defines a separate method for each of the three children and then subscribes to the "viewWasTouched" notification for each of the three children as the notification sender. The children don't need to attach themselves to the user dictionary, but they do need to send the notification with a pointer to themselves as the scope. Same as #4, but rather than using separate methods, the parent could just use one with a switch case or other branching along with the notification's sender to determine which path to take. Create multiple man-in-the-middle classes that act as the delegates to the child views and then call methods on the parent either with a pointer to the child or with some other differentiating factor. This approach doesn't seem scalable. Are any of these approaches considered best practice? I can't say for sure, but it feels like I'm missing something more obvious/elegant.

    Read the article

  • When can Java produce a NaN (with specific code question)

    - by Brent
    I'm a bit perplexed by some code I'm currently writing. I am trying to preform a specific gradient descent (main loop included below) and depending on the initial conditions I will alternatively get good looking results (perhaps 20% of the time) or everything becomes NaN (the other 80% of the time). However it seems to me that none of the operations in my code could produce NaN's when given honest numbers! My main loop is: // calculate errors delta = m1 + m2 - M; eta = f1 + f2 - F; for (int i = 0; i < numChildren; i++) { epsilon[i] = p[i]*m1+(1-p[i])*m2+q[i]*f1+(1-q[i])*f2-C[i]; } // use errors in gradient descent // set aside differences for the p's and q's float mDiff = m1 - m2; float fDiff = f1 - f2; // first update m's and f's m1 -= rate*delta; m2 -= rate*delta; f1 -= rate*eta; f2 -= rate*eta; for (int i = 0; i < numChildren; i++) { m1 -= rate*epsilon[i]*p[i]; m2 -= rate*epsilon[i]*(1-p[i]); f1 -= rate*epsilon[i]*q[i]; f2 -= rate*epsilon[i]*(1-q[i]); } // now update the p's and q's for (int i = 0; i < numChildren; i++) { p[i] -= rate*epsilon[i]*mDiff; q[i] -= rate*epsilon[i]*fDiff; } This behavior can be seen when we have rate = 0.01; M = 30; F = 30; C = {15, 25, 35, 45}; with the p[i] and q[i] chosen randomly uniformly between 0 and 1, m1 and m2 chosen randomly uniformly to add to M, and f1 and f2 chosen randomly uniformly to add up to F. Does anyone see anything that could create these NaN's?

    Read the article

  • Backbone View: Inherit and extend events from parent

    - by brent
    Backbone's documentation states: The events property may also be defined as a function that returns an events hash, to make it easier to programmatically define your events, as well as inherit them from parent views. How do you inherit a parent's view events and extend them? Parent View var ParentView = Backbone.View.extend({ events: { 'click': 'onclick' } }); Child View var ChildView = ParentView.extend({ events: function(){ ???? } });

    Read the article

  • .NET Based Radio Automation

    - by Brent Pabst
    I'm curious if anyone has seen an Open Source radio automation package (I found one in Russian on CodePlex) built on .NET In addition if I wanted to build something like this in a client server environment is WCF and WPF the best way to do it? Is it fast enough to trigger songs to play/encode on the server from a remote WPF client? Sort of vague questions but I wanted to get some community feedback.

    Read the article

  • Nesting QDockWidgets

    - by Brent Parker
    Right now I have four customized QDockWidgets on the left side of my application. When you start the application, each one is visible, but very small because of the visibility of each one. I would like for three of the QDockWidgets to nest behind one primary one to give that one priority and the entire left side of the screen. Does anyone know how to tell QDockWidgets to nest when they are created?

    Read the article

  • Casting a Calculated Column in a MySQL view.

    - by Chris Brent
    I have a view that contains a calculated column. Is there are a way to cast it as a CHAR or VARCHAR rather than a VARBINARY ? Obviously, I have tried using CAST(... as CHAR) but it gives an error. Here is a simple replicable example. CREATE VIEW view_example AS SELECT concat_ws('_', lpad(9, 3,'0'), lpad(1,3,'0'), date_format(now(),'%Y%m%d%H%i%S')) AS calculated_field_id; This is how my view is created: describe view_example; +---------------------+---------------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +---------------------+---------------+------+-----+---------+-------+ | calculated_field_id | varbinary(27) | YES | | NULL | | +---------------------+---------------+------+-----+---------+-------+ select version(); +-----------------------+ | version() | +-----------------------+ | 5.0.51a-community-log | +-----------------------+

    Read the article

  • Write to PDF using PHP from android device

    - by Brent Mitchell
    I am trying to write to a pdf file on php server. I have sent variables to the server, create the pdf document, then have my phone download the document to view on device. The variables seem not to write on the php file. I have my code below public void postData() { try { Calculate calc = new Calculate(); HttpClient mClient = new DefaultHttpClient(); StringBuilder sb=new StringBuilder("myurl.com/pdf.php"); HttpPost mpost = new HttpPost(sb.toString()); String value = "1234"; List nameValuepairs = new ArrayList(1); nameValuepairs.add(new BasicNameValuePair("id",value)); mpost.setEntity(new UrlEncodedFormEntity(nameValuepairs)); } catch (UnsupportedEncodingException e) { Log.w(" error ", e.toString()); } catch (Exception e) { Log.w(" error ", e.toString()); } } And my php code to write the variable "value" onto the pdf document: //code to reverse the string if($_POST[] != null) { $reversed = strrev($_POST["value"]); $this->SetFont('Arial','u',50); $this->Text(52,68,$reversed); } I am just trying to write the variable in a random spot, but the variable the if statement is always null and I do not know why. Thanks. Sorry if it is a little sloppy.

    Read the article

  • does overload operator-> a compile time action?

    - by Brent
    when I tried to compile the code: struct S { void func2() {} }; class O { public: inline S* operator->() const; private: S* ses; }; inline S* O::operator->() const { return ses; } int main() { O object; object->func(); return 0; } there is a compile error reported: D:\code>g++ operatorp.cpp -S -o operatorp.exe operatorp.cpp: In function `int main()': operatorp.cpp:27: error: 'struct S' has no member named 'func' it seems that invoke the overloaded function of "operator-" is done during compile time? I'd add "-S" option for compile only.

    Read the article

  • asp.net web application - server side canceling Submit PostBackUrl if not(!) Page.IsValid

    - by Brent
    Thanks for any help I have a web application, and the submit uses the PostBackUrl to display data if the form is valid. I need to use different (server side) validation groups, depending on what radiobutton is selected. That is, manually call Page.Validate('ValidationGroupA'). The validation itself is working fine, in terms of Page.IsValid correctly assigned true or false. however, if the page is not valid, the page redirects to the page specified by PostBackUrl on the submit button, where the page is found not to be valid, and the client redirected back with: if (!PreviousPage.IsValid){Response.Redirect("DataEntryPage.aspx");}) However, by getting to here and back again, all form data is lost, and the relevant validation controls and summaries are not displayed. is there an equivalent of javascripts evt.preventDefault() or some other way, once it is detected validation has failed after a manual call to Page.Validate to post the form back with appropriate validation errors displayed? Thank you.

    Read the article

  • Parsing SQLIO Output to Excel Charts using Regex in PowerShell

    - by Jonathan Kehayias
    Today Joe Webb ( Blog | Twitter ) blogged about The Power of Regex in Powershell, and in his post he shows how to parse the SQL Server Error Log for events of interest. At the end of his blog post Joe asked about other places where Regular Expressions have been useful in PowerShell so I thought I’d blog my script for parsing SQLIO output using Regex in PowerShell, to populate an Excel worksheet and build charts based on the results automatically. If you’ve never used SQLIO, Brent Ozar ( Blog | Twitter...(read more)

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >