Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
100% Quality Score
Upvotes Received
1
Posts with Upvotes
1
Upvoting Members
1
Downvotes Received
0
Posts with Downvotes
0
Downvoting Members
0
0 Endorsements
Ranked #4K
~21.7K People Reached
Favorite Forums
Favorite Tags
Member Avatar for blah32

I'm trying to convert a bitstring to a signed 32 bit integer value. The bitstring is in big-endian. I can get this to work for unsigned values, I use: [CODE] sub bin2dec { return unpack("N", pack("B32", substr("0" x 32 . shift, -32))); } [/CODE] But I can't get it to …

Member Avatar for d5e5
0
550
Member Avatar for blah32

Hello, I am getting very strange behavior on an STL set::insert() . [CODE] ... //Rebuild the P_set P_set.clear();//destroy old P set (shallow only) assert( P_set.empty() ); for(int i = 0 ; i < N ; i++){ cout<<"addr="<< &(C_array[i])<<endl; pair<set<C*>::iterator,bool> p = P_set.insert( &(C_array[i]) ); assert( p.second && "FAILED TO INSERT" …

Member Avatar for arkoenig
0
106
Member Avatar for blah32

I have never used STL sets before, but I have used some other STL stuff. I am having trouble with upper_bound. I have a class I defined, and I have a (STL set) set of pointers to different instantiations of the class. i compare using a comparison function, which takes …

Member Avatar for arkoenig
0
213
Member Avatar for blah32

Is there any built in functionality in python as to rename files smartly in windows. I am using os.rename to move files to a higher directory. The problem is, the directory I move the file to could have a file that has the same name. I want to do what …

Member Avatar for blah32
0
129
Member Avatar for WildBamaBoy

I cannot get shutil to copy one folder to another. This code results in the error below. What am I doing wrong? [CODE]if os.path.exists(backup + "\\Safety Backup"): pass else: print "Backing up original music. . ." os.mkdir(backup + "\\Safety Backup") for folder in musicFolders: shutil.copy2("C:\ABCD123", backup + "\\Safety Backup") print …

Member Avatar for WildBamaBoy
0
20K
Member Avatar for blah32

I am calling: c = Counter() ...exactly as in the collections example code here: [url]http://docs.python.org/py3k/library/collections.html?highlight=collections#collections.Counter[/url] but it gives me this error: NameError: name 'Counter' is not defined Anyone know why? Note that I have 3.1.2 and yes I include "import collections". Thanks

Member Avatar for vegaseat
1
124
Member Avatar for blah32

Does anyone know of a script or program that will convert A86 written assembly programs to any other type of assembly (such as NASM or AT&T for GCC)? I have searched online and haven't found anything very solid. Let me know, thanks.

0
56
Member Avatar for blah32

In python 3, I have to use the __ge__ __le__ and so on members in the class. MY question is, how do I combine 2 objects of the same class type using __eq__ or must it be done from outside?

Member Avatar for jlm699
0
57
Member Avatar for blah32

Hello, I am not getting this sorting in python 3 with a key. If I don't use the key I get: [CODE] sorted_ent_list = entry_list.sort() TypeError: unorderable types: entry_T() < entry_T() [/CODE] If I do use a member function to return private variable from entry_T class, then it says [CODE] …

Member Avatar for Gribouillis
0
123
Member Avatar for blah32

[CODE] def find_and_sep(inputstr, thing_to_find): #thing to find is a string that is a regular expression #finds thing_to_find and returns tuple of the rest (before, thing, after) inputstr.strip() #match it m=re.match(thing_to_find, inputstr) #match first instance if(m==None): return "" start = inputstr[:m.start()] mid = inputstr[m.start():m.end()] end = inputstr[m.end():] tuple_x = start,mid,end return …

Member Avatar for sravan953
0
103
Member Avatar for blah32

I am new to regular expressions, but I do not get why this is not working : [CODE] import re inputstr = "HI\n//asgwrg\nasdg" re.sub("\/\/(.*)(\n)", "\n", inputstr) [/CODE] I am trying to substitute everything between "//" and newline with newline. Can someone tell me whats wrong? I am using python 3.1

Member Avatar for jlm699
0
85