Search Results

Search found 9929 results on 398 pages for 'self destruction'.

Page 29/398 | < Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >

  • InstantSSL's certificate no different than a self signed certificate under Nginx with an IP accessed address

    - by Absolute0
    I ordered an ssl certificate from InstantSSL and got the following pair of files: my_ip.ca-bundle, my_ip.crt I also previously generated my own key and crt files using openssl. I concatenated all the crt files: cat my_previously_generted.crt my_ip.ca_bundle my_ip.crt chained.crt And configured nginx as follows: server { ... listen 443; ssl on; ssl_certificate /home/dmsf/csr/chained.crt; ssl_certificate_key /home/dmsf/csr/csr.nopass.key; ... } I don't have a domain name as per the clients request. When I open the browser with https://my_ip chrome gives me this error: The site's security certificate is not trusted! You attempted to reach my_ip, but the server presented a certificate issued by an entity that is not trusted by your computer's operating system. This may mean that the server has generated its own security credentials, which Google Chrome cannot rely on for identity information, or an attacker may be trying to intercept your communications. You should not proceed, especially if you have never seen this warning before for this site.

    Read the article

  • Setting up self signed cert and CA [plesk / linux]

    - by microchasm
    I'm about ready to give up and do a clean wipe of this machine and start over with ISPConfig or some other variant. I installed Plesk on this machine to help with some of the handiwork. It is the free version (single domain); I don't need it for much. It's nice, though, to use to set up db's email, etc. Anyway, I would like to set it up as a CA (which I can add to users' trusted root servers to alleviate those warnings). It seems like Plesk does all it can to obfuscate where things are. Despite trying to find the conf files, and crt/pem/key etc. I am (5 hours later) now left with a machine that won't even get to the ssl page. The browser will sit there, until a 'connection reset' error comes up. In error_log, I get messages saying CN doesn't match server name -- which it does. ssl_error_log: [Thu May 13 16:02:14 2010] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?) [Thu May 13 16:12:19 2010] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?) not very helpful. If anyone has any experience, and/or recommendations (including other software), I'd be much obliged. NB RHEL5; 1 domain, 3 subdomains; everything local only. Thanks.

    Read the article

  • Can't ping self

    - by Paddy
    I have a wireless internet connection setup on my Mac. (v10.5.6) Am connected to the internet and everything is running smoothly. I recently discovered a quirky behaviour while setting up apache web server. When i typed in my dynamic ip (http://117.254.149.11/) in the webbrowser to visit my site pages it just timed out. In terminal i tried pinging localhost and it worked. $ ping localhost PING localhost (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.063 ms 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.056 ms 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.044 ms But if i pinged my ip it would just time out. $ ping 117.254.149.11 PING 117.254.149.11 (117.254.149.11): 56 data bytes ^C --- 117.254.149.11 ping statistics --- 10 packets transmitted, 0 packets received, 100% packet loss Pinging any other site works though. I am completely stumped. Any help would be greatly appreciated.

    Read the article

  • Unable to access site over HTTPS using self signed certificate

    - by James
    I am developing a REST API which I want to secure with SSL/TLS. I have implemented a large part of the API which I have tested over HTTP, however, I am now at the stage where I want to switch it over to use HTTPS. At the moment the API is hosted on a Windows XP professional SP2 box running IIS 5.1 (development environment only) and I used the SelfSSL.exe tool from the IIS 6.0 Resource Kit Tools to generate a server certificate. I then configured my API to use this certificate which all appeared to work fine as I attempted to connect to my API using HTTP and I get a 403 response saying "... must be accessed over a secure channel...". However, the problem is when I attempt to access the same the API over HTTPS it just appears to hang! As this is a development environment at the moment I don't have a domain name (just a static IP address) and the API is running on port 81. Also (incase it matters) the API is the default site (I replaced it). Any ideas why I can't connect using HTTPS?

    Read the article

  • Self-Charging, USB Portable Speaker Recommendations

    - by Koobz
    There are lots of strictly usb powered speakers, but I don't imagine they're that good. I'd like something that I can plug in at home, have the speakers charge and when I go to the park with my friends, I'm not compromising sound quality or battery life. Does anything like this exist?

    Read the article

  • Access to self created torrent on public tracker

    - by Nick
    Not sure if this is the right site to ask this, but here it goes: Let's say I'd like to share a couple of private files with a few friends. The size of these are quite large, so I've figured the best route to distribute these is via torrent. So, on my home PC I create a torrent and start seeding and announce to a public tracker like openbittorrent and publicbt. Now, both of those are public trackers, but they don't seem to have anyway of searching through what is actually being tracked. If I'm only passing around the torrent file to a few friends, whats the chances that someone else will 'randomly' come across the torrent via the public tracker and start leeching?

    Read the article

  • Managing self-updating Windows software in GPO-deployed packages

    - by Paul
    Being very new to Windows software distribution for a small network (<50 clients) I was wondering how software packages like Adobe's Reader or Java are handled. I can deploy them as MSIs via group policies just fine. But what happens when the client software detects updates? What are common ways to handle this? Disable the software's autoupdate feature? Redeploy when the admin detects a new version? Just fishing for knowledge, thanks for any hint.

    Read the article

  • open self generated outlook-forms (office 2003) with office 2007 from any folder

    - by oktay okur
    a outlook form "c:\meinevorlage.oft" , created with office 2003 can not be opened directly in office 2007. Error: not familiar with the outlook form template .... how can I still open this template directly on computer with office 2007-installations? important: the outlook-form have to be opened by direct selecting and not via outlook-file-new, or as an hyperlink etc. heartfelt thanks in advance.

    Read the article

  • IT merger - self-sufficient site with domain controller VS thin clients outpost with access to termi

    - by imagodei
    SITUATION: A larger company acquires a smaller one. IT infrastructure has to be merged. There are no immediate plans to change the current size or role of the smaller company - the offices and production remain. It has a Win 2003 SBS domain server, Win 2000 file server, linux server for SVN and internal Wikipedia, 2 or 3 production machines, LTO backup solution. The servers are approx. 5 years old. Cisco network equippment (switches, wireless, ASA). Mail solution is a hosted Exchange. There are approx. 35 desktops and laptops in the company. IT infrastructure unification: There are 2 IT merging proposals. 1.) Replacing old servers, installing Win Server 2008 domain controller, and setting up either subdomain or domain trust to a larger company. File server and other servers remain local and synchronization should be set up to a centralized location in larger company. Similary with the backup - it remains local and if needed it should be replicated to a centralized location. Licensing is managed by smaller company. 2.) All servers are moved to a centralized location in larger company. As many desktop machines as possible are replaced by thin clients. The actual machines are virtualized and hosted by Terminal server at the same central location. Citrix solutions will be used. Only router and site-2-site VPN connection remain at the smaller company. Backup internet line to insure near 100% availability is needed. Licensing is mainly managed by larger company. Only specialized software for PCs that will not be virtualized is managed by smaller company. I'd like to ask you to discuss both solutions a bit. In your opinion, which is better from the operational point of view? Which is more reliable, cheaper in the long run? Easier to manage from the system administrator's point of view? Easier on the budget and easier to maintain from IT department's point of view? Does anybody have any experience with the second option and how does it perform in production environment? Pros and cons of both? Your input will be of great significance to me. Thank you very much!

    Read the article

  • Self hosted Wordpress freezes for 20 seconds before sending the page

    - by TheoJones
    I have a website with Wordpress and PHPBB integrated - and it's been fine for months.. then all of a sudden, it's unbelievably slow to load. There are no errors in the apache logs, but looking at the page in firebug shows a 20 second pause, before the page is delivered. more confusing, on the same server, same apache installation, PHPBB loads in 30ms, no delay. I tried the hogdetector wordpress plugin, which indicates that the delay is before the header is sent - which seems to agree with firebug. Any ideas how to troubleshoot this one further?

    Read the article

  • Windows 7 'All Programs' folders self-close on right-click

    - by Madmanguruman
    Odd issue on my Windows 7 Professional (32-bit) system. If I click on the Start 'orb' then navigate to 'All Programs', then navigate to any of the folders that appear at the bottom of the list (like Accessories) and left-click, the folder contents expand with no issue. If I right-click, the context menu appears for half-a-second or so, then the popup goes away and the entire start menu dismisses. I'm not sure how to debug this issue - I'm considering using Autoruns to try and disable things hooked into the shell one-by-one. Is there a way to use a tool like Process Explorer to narrow down the process that's actually dismissing the menus?

    Read the article

  • Self Ad serving for Linux server

    - by protecttheweb
    I am looking for ad serving software to serve my own ads. I am a newbie and just want your recommendation. Yes, I know about Google DFP but I want something non Google or something open source or for Linux servers. I want something kind of automatic like advertisers add the banner images or test ads and pay and ads are automatically served or can be set to draft until set to live. What recommendation do you have?

    Read the article

  • Slow self hosted wordpress website

    - by Integrati Marketing
    Hi All, we have a great site which has been humming along nicely for about 5 months and then in May it went from a page load speed time of 3-5 secs to now an agonising 15+ secs!!! The host has been really helpful and has even shifted the site to a new server which is faster! I guess seeing as though we do not have the insight or your expertise we would ask the Serverfault community and see what this crowd of experts could recommend? Appreciate any insight, thank you. site is here: integrati.com.au Cheers. :)

    Read the article

  • Comparing outgoing mail options, self hosted VS google apps in my situation

    - by Hoofamon
    I am setting up a small site that has the need to be able to programmatically send mail from time to time. Password resets and things like that. I'm already using google apps to handle my domains email, so now i'm left with the decision between setting up basic SMTP services on my server to send "password reset mails and things like that" OR instead to have the software use google apps to send mail. I like the google apps option as it's less stuff to worry about and seems to fit my needs, i'm trying to figure out what the downsides would be? Thanks for any thoughts

    Read the article

  • Matplotlib pick event order for overlapping artists

    - by Ajean
    I'm hitting a very strange issue with matplotlib pick events. I have two artists that are both pickable and are non-overlapping to begin with ("holes" and "pegs"). When I pick one of them, during the event handling I move the other one to where I just clicked (moving a "peg" into the "hole"). Then, without doing anything else, a pick event from the moved artist (the peg) is generated even though it wasn't there when the first event was generated. My only explanation for it is that somehow the event manager is still moving through artist layers when the event is processed, and therefore hits the second artist after it is moved under the cursor. So then my question is - how do pick events (or any events for that matter) iterate through overlapping artists on the canvas, and is there a way to control it? I think I would get my desired behavior if it moved from the top down always (rather than bottom up or randomly). I haven't been able to find sufficient enough documentation, and a lengthy search on SO has not revealed this exact issue. Below is a working example that illustrates the problem, with PathCollections from scatter as pegs and holes: import matplotlib.pyplot as plt import sys class peg_tester(): def __init__(self): self.fig = plt.figure(figsize=(3,1)) self.ax = self.fig.add_axes([0,0,1,1]) self.ax.set_xlim([-0.5,2.5]) self.ax.set_ylim([-0.25,0.25]) self.ax.text(-0.4, 0.15, 'One click on the hole, and I get 2 events not 1', fontsize=8) self.holes = self.ax.scatter([1], [0], color='black', picker=0) self.pegs = self.ax.scatter([0], [0], s=100, facecolor='#dd8800', edgecolor='black', picker=0) self.fig.canvas.mpl_connect('pick_event', self.handler) plt.show() def handler(self, event): if event.artist is self.holes: # If I get a hole event, then move a peg (to that hole) ... # but then I get a peg event also with no extra clicks! offs = self.pegs.get_offsets() offs[0,:] = [1,0] # Moves left peg to the middle self.pegs.set_offsets(offs) self.fig.canvas.draw() print 'picked a hole, moving left peg to center' elif event.artist is self.pegs: print 'picked a peg' sys.stdout.flush() # Necessary when in ipython qtconsole if __name__ == "__main__": pt = peg_tester() I have tried setting the zorder to make the pegs always above the holes, but that doesn't change how the pick events are generated, and particularly this funny phantom event.

    Read the article

  • How to update QStandartItemModel without freezing the main UI

    - by user1044002
    I'm starting to learn PyQt4 and have been stuck on something for a long time now and can't figure it out myself: Here is the concept: There is a TreeView with custom QStandartItemModel, which gets rebuild every couple of seconds, and can have a lot (hundreds at least) of entries, there also will be additional delegates for the different columns etc. It's fairly complex and the building time for even plain model, without delegates, goes up to .3 sec, which makes the TreeView to freeze. Please advice me for the best approach on solving this. I was thing of somehow building the model in different thread, and eventually sending it to the TreeView, where it would just perform setModel() with the new one, but couldn't make that work. here is some code that may illustrate the problem a bit: from PyQt4.QtCore import * from PyQt4.QtGui import * import sys, os, re, time app = QApplication(sys.argv) REFRESH = 1 class Reloader_Thread(QThread): def __init__(self, parent = None): QThread.__init__(self, parent) self.loaders = ['\\', '--', '|', '/', '--'] self.emit(SIGNAL('refresh')) def run(self): format = '|%d/%b/%Y %H:%M:%S| ' while True: self.emit(SIGNAL('refresh')) self.sleep(REFRESH) class Model(QStandardItemModel): def __init__(self, viewer=None): QStandardItemModel.__init__(self,None) self.build() def build(self): stTime = time.clock() newRows = [] for r in range(1000): row = [] for c in range(12): item = QStandardItem('%s %02d%02d' % (time.strftime('%H"%M\'%S'), r,c)) row.append(item) newRows.append(row) eTime = time.clock() - stTime outStr = 'Build %03f' % eTime format = '|%d/%b/%Y %H:%M:%S| ' stTime = time.clock() self.beginRemoveRows(QModelIndex(), 0, self.rowCount()) self.removeRows(0, self.rowCount()) self.endRemoveRows() eTime = time.clock() - stTime outStr += ', Remove %03f' % eTime stTime = time.clock() numNew = len(newRows) for r in range(numNew): self.appendRow(newRows[r]) eTime = time.clock() - stTime outStr += ', Set %03f' % eTime self.emit(SIGNAL('status'), outStr) self.reset() w = QWidget() w.setGeometry(200,200,800,600) hb = QVBoxLayout(w) tv = QTreeView() tvm = Model(tv) tv.setModel(tvm) sb = QStatusBar() reloader = Reloader_Thread() tvm.connect(tvm, SIGNAL('status'), sb.showMessage) reloader.connect(reloader, SIGNAL('refresh'), tvm.build) reloader.start() hb.addWidget(tv) hb.addWidget(sb) w.show() app.setStyle('plastique') app.processEvents(QEventLoop.AllEvents) app.aboutToQuit.connect(reloader.quit) app.exec_()

    Read the article

  • Python Socket Getting Connection Reset

    - by Ian
    I created a threaded socket listener that stores newly accepted connections in a queue. The socket threads then read from the queue and respond. For some reason, when doing benchmarking with 'ab' (apache benchmark) using a concurrency of 2 or more, I always get a connection reset before it's able to complete the benchmark (this is taking place locally, so there's no external connection issue). class server: _ip = '' _port = 8888 def __init__(self, ip=None, port=None): if ip is not None: self._ip = ip if port is not None: self._port = port self.server_listener(self._ip, self._port) def now(self): return time.ctime(time.time()) def http_responder(self, conn, addr): httpobj = http_builder() httpobj.header('HTTP/1.1 200 OK') httpobj.header('Content-Type: text/html; charset=UTF-8') httpobj.header('Connection: close') httpobj.body("Everything looks good") data = httpobj.generate() sent = conn.sendall(data) def http_thread(self, id): self.log("THREAD %d: Starting Up..." % id) while True: conn, addr = self.q.get() ip, port = addr self.log("THREAD %d: responding to request: %s:%s - %s" % (id, ip, port, self.now())) self.http_responder(conn, addr) self.q.task_done() conn.close() def server_listener(self, host, port): self.q = Queue.Queue(0) sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind( (host, port) ) sock.listen(5) for i in xrange(4): #thread count thread.start_new(self.http_thread, (i+1, )) while True: self.q.put(sock.accept()) sock.close() server('', 9999) When running the benchmark, I get totally random numbers of good requests before it errors out, usually between 4 and 500. Edit: Took me a while to figure it out, but the problem was in sock.listen(5). Because I was using apache benchmark with a higher concurrency (5 and up) it was causing the backlog of connections to pile up, at which point the connections started getting dropped by the socket.

    Read the article

  • PyQt QAbstractListModel seems to ignore tristate flags

    - by mcieslak
    I've been trying for a couple days to figure out why my QAbstractLisModel won't allow a user to toggle a checkable item in three states. The model returns the Qt.IsTristate and Qt.ItemIsUserCheckable in the flags() method, but when the program runs only Qt.Checked and Qt.Unchecked are toggled on edit. class cboxModel(QtCore.QAbstractListModel): def __init__(self, parent=None): super(cboxModel, self).__init__(parent) self.cboxes = [ ['a',0], ['b',1], ['c',2], ['d',0] ] def rowCount(self,index=QtCore.QModelIndex()): return len(self.cboxes) def data(self,index,role): if not index.isValid: return QtCore.QVariant() myname,mystate = self.cboxes[index.row()] if role == QtCore.Qt.DisplayRole: return QtCore.QVariant(myname) if role == QtCore.Qt.CheckStateRole: if mystate == 0: return QtCore.QVariant(QtCore.Qt.Unchecked) elif mystate == 1: return QtCore.QVariant(QtCore.Qt.PartiallyChecked) elif mystate == 2: return QtCore.QVariant(QtCore.Qt.Checked) return QtCore.QVariant() def setData(self,index,value,role=QtCore.Qt.EditRole): if index.isValid(): self.cboxes[index.row()][1] = value.toInt()[0] self.emit(QtCore.SIGNAL("dataChanged(QModelIndex,QModelIndex)"), index, index) print self.cboxes return True return False def flags(self,index): if not index.isValid(): return QtCore.Qt.ItemIsEditable return QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsTristate You can test it with this, class MainForm(QtGui.QMainWindow): def __init__(self, parent=None): super(MainForm, self).__init__(parent) model = cboxModel(self) self.view = QtGui.QListView() self.view.setModel(model) self.setCentralWidget(self.view) app = QtGui.QApplication(sys.argv) form = MainForm() form.show() app.exec_() and see that only 2 states are available. I'm assuming there's something simple I'm missing. Any ideas? Thanks!

    Read the article

  • Pass in a value into Python Class through command line

    - by chrissygormley
    Hello, I have got some code to pass in a variable into a script from the command line. The script is: import sys, os def function(var): print var class function_call(object): def __init__(self, sysArgs): try: self.function = None self.args = [] self.modulePath = sysArgs[0] self.moduleDir, tail = os.path.split(self.modulePath) self.moduleName, ext = os.path.splitext(tail) __import__(self.moduleName) self.module = sys.modules[self.moduleName] if len(sysArgs) > 1: self.functionName = sysArgs[1] self.function = self.module.__dict__[self.functionName] self.args = sysArgs[2:] except Exception, e: sys.stderr.write("%s %s\n" % ("PythonCall#__init__", e)) def execute(self): try: if self.function: self.function(*self.args) except Exception, e: sys.stderr.write("%s %s\n" % ("PythonCall#execute", e)) if __name__=="__main__": test = test() function_call(sys.argv).execute() This works by entering ./function <function> <arg1 arg2 ....>. The problem is that I want to to select the function I want that is in a class rather than just a function by itself. The code I have tried is the same except that function(var): is in a class. I was hoping for some ideas on how to modify my function_call class to accept this. Thanks for any help.

    Read the article

  • How to use Devicemotion/Gyroscope to move a dot from center to 8 directions of iphone screen

    - by iSeeker
    I am trying to move a dot at center to 8 directions of iphone screen using Devicemotion such that it moves faster when tilted at a faster rate. Rough sketch is below: I could find a similar implementation in an app called Gyrododge in appstore, i cant figure out how to make it work... Update: This is what i have done so far, but the response is not smooth, and is very jittery.. xdiff and ydiff are the change of device attitude in x and y directions, derived from quatenion implementation. if (currDeviceMotion.rotationRate.x < -2) { NSLog(@"To Top"); if (195+800*ydiff >=193 && 195+800*ydiff <= 197) { [self.pitchDot setFrame:CGRectMake(150, 195, 20, 20)]; }else{ if (195+800*ydiff >=390 ) { [self.pitchDot setFrame:CGRectMake(150, 390, 20, 20)]; }else if (195+800*ydiff <= 0){ [self.pitchDot setFrame:CGRectMake(150, 0, 20, 20)]; }else if(195+800*ydiff < 194){ [self.pitchDot setFrame:CGRectMake(150, 195+800*ydiff, 20, 20)]; }else if(195+800*ydiff > 196){ [self.pitchDot setFrame:CGRectMake(150, 195+800*ydiff, 20, 20)]; } } }else if (currDeviceMotion.rotationRate.x > 2){ NSLog(@"To Bottom"); if (195+800*ydiff >=193 && 195+800*ydiff <= 197) { [self.pitchDot setFrame:CGRectMake(150, 195, 20, 20)]; }else{ if (195+800*ydiff >=390 ) { [self.pitchDot setFrame:CGRectMake(150, 390, 20, 20)]; }else if (195+800*ydiff <= 0){ [self.pitchDot setFrame:CGRectMake(150, 0, 20, 20)]; }else if(195+800*ydiff < 194){ [self.pitchDot setFrame:CGRectMake(150, 195+800*ydiff, 20, 20)]; }else if(195+800*ydiff > 196){ [self.pitchDot setFrame:CGRectMake(150, 195+800*ydiff, 20, 20)]; } } }else if (currDeviceMotion.rotationRate.y < -2){ NSLog(@"To Left"); if (150+500*xdiff >= 148 && 150+500*xdiff <=152) { [self.pitchDot setFrame:CGRectMake(150, 195, 20, 20)]; }else{ if (150+500*xdiff >= 300 ) { [self.pitchDot setFrame:CGRectMake(300, 195, 20, 20)]; }else if (150+500*xdiff <= 0){ [self.pitchDot setFrame:CGRectMake(0, 195, 20, 20)]; }else if(150+500*xdiff < 148){ [self.pitchDot setFrame:CGRectMake(150+500*xdiff, 195, 20, 20)]; }else if(150+500*xdiff > 152){ [self.pitchDot setFrame:CGRectMake(150+500*xdiff, 195, 20, 20)]; } } }else if (currDeviceMotion.rotationRate.y > 2){ NSLog(@"To Right"); if (150+500*xdiff >= 148 && 150+500*xdiff <=152) { [self.pitchDot setFrame:CGRectMake(150, 195, 20, 20)]; }else{ if (150+500*xdiff >= 300 ) { [self.pitchDot setFrame:CGRectMake(300, 195, 20, 20)]; }else if (150+500*xdiff <= 0){ [self.pitchDot setFrame:CGRectMake(0, 195, 20, 20)]; }else if(150+500*xdiff < 148){ [self.pitchDot setFrame:CGRectMake(150+500*xdiff, 195, 20, 20)]; }else if(150+500*xdiff > 152){ [self.pitchDot setFrame:CGRectMake(150+500*xdiff, 195, 20, 20)]; } } }else if (currDeviceMotion.rotationRate.x < -0.20 && currDeviceMotion.rotationRate.y > 0.20 ){ NSLog(@"To Diagonal Right Top"); if (150+650*xdiff >= 148 && 150+650*xdiff <=152) { [self.pitchDot setFrame:CGRectMake(150, 195, 20, 20)]; }else{ if (150+650*xdiff >= 300 ) { [self.pitchDot setFrame:CGRectMake(300, 0, 20, 20)]; }else if(150+650*xdiff > 152){ [self.pitchDot setFrame:CGRectMake(150+650*xdiff, 195-1.3*650*xdiff, 20, 20)]; } } }else if (currDeviceMotion.rotationRate.x > 0.20 && currDeviceMotion.rotationRate.y < -0.20 ){ NSLog(@"To Diagonal Left Bottom"); if (150+650*xdiff >= 148 && 150+650*xdiff <=152) { [self.pitchDot setFrame:CGRectMake(150, 195, 20, 20)]; }else{ if (150+650*xdiff <= 0 ) { [self.pitchDot setFrame:CGRectMake(0, 390, 20, 20)]; }else if(150+650*xdiff < 148){ [self.pitchDot setFrame:CGRectMake(150+650*xdiff, 195-1.3*650*xdiff, 20, 20)]; } } }else if (currDeviceMotion.rotationRate.x < -0.20 && currDeviceMotion.rotationRate.y < -0.20 ){ NSLog(@"To Diagonal Left Top and xdiff is %f",xdiff); if (150+650*xdiff >= 148 && 150+650*xdiff <=152) { [self.pitchDot setFrame:CGRectMake(150, 195, 20, 20)]; }else{ if (150+650*xdiff <= 0 ) { [self.pitchDot setFrame:CGRectMake(0, 0, 20, 20)]; }else if(150+650*xdiff < 148){ [self.pitchDot setFrame:CGRectMake(150+650*xdiff, 195+1.3*650*xdiff, 20, 20)]; } } }else if (currDeviceMotion.rotationRate.x > 0.20 && currDeviceMotion.rotationRate.y > 0.20 ){ NSLog(@"To Diagonal Right Bottom"); if (150+650*xdiff >= 148 && 150+650*xdiff <=152) { [self.pitchDot setFrame:CGRectMake(150, 195, 20, 20)]; }else{ if (150+650*xdiff >= 300 ) { [self.pitchDot setFrame:CGRectMake(300, 390, 20, 20)]; }else if(150+650*xdiff > 152){ [self.pitchDot setFrame:CGRectMake(150+650*xdiff, 195+1.3*650*xdiff, 20, 20)]; } } }else if((currDeviceMotion.rotationRate.x < 0.20 && currDeviceMotion.rotationRate.x < -0.20) ||(currDeviceMotion.rotationRate.y < 0.20 && currDeviceMotion.rotationRate.y < -0.20) ||(currDeviceMotion.rotationRate.z < 0.20 && currDeviceMotion.rotationRate.z < -0.20)){ [self.rollDot setFrame:CGRectMake(150, 195, 20, 20)]; [self.pitchDot setFrame:CGRectMake(150, 195, 20, 20)]; } It could be great if i could make it move like the application i have stated above, called Gyrododge This link also addresses a similar question:Link. Any advice or help is greatly appreciated... Thanks.

    Read the article

  • dinamically resizing row height in QTreeWidget/QTreeView during edinitg items

    - by serge
    Hi everyone, I have some problems with sizing row's height in QTreeWidget. I use QStyledItemDelegate with QPlainTextEdit. During editing text in QPlainTextEdit i check for changes with a help of: rect = self.blockBoundingRect(self.firstVisibleBlock()) and if text it's height changes i need row in QTreeWidget also resizing. But i don't know how to inform TreeWidget or a Delegate about changes, i even tried to initialize editor with index, that i could use in a future, but it suddenly changes: class MyEditor(QPlainTextEdit): def __init__(self, index = None, parent=None): super(MyEditor, self).__init__(parent) self.index = index self.connect(self, SIGNAL("textChanged()"), self.setHeight) def setHeight(self): if self.index: rect = self.blockBoundingRect(self.firstVisibleBlock()) self.resize(rect.width(), rect.height()) self.emit(SIGNAL("set_height"), QSize(rect.width(), rect.height()), self.index) How can i bound editor's size changes with TreeWidget? And one more thing, by default all items (cells) in TreeWidget have -1 or some big value as default width. I need whole text in cell to be visible, so how can i limit it only by visible range and expand it in height? Thank you in advance, Serge

    Read the article

  • python blocking sockets, send returns immediately

    - by Mark
    Hi, I am writing a multithreaded socket application in Python using the socket module. the server listens for connections and when it gets one it spawns a thread for that socket. the server thread sends some data to the client. but the client is not yet ready to receive it. I thought this would have caused the server to wait until the client starts recv but instead returns immediately the client then calls recv which is blocking and no data is ever received. client socket constructor self.__clientSocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.__clientSocket.connect((server, port)) server socket constructor self.servSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.servSock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) #self.servSock.settimeout(None) self.servSock.setblocking(1) self.servSock.bind((self.addr,self.port)) self.servSock.listen(5) listening accept thread try: (cs, address) = self.servSock.accept() except socket.timeout: return threadName = '\r\nClient %s:%s\r\n' % (cs, address) print threadName clientSocketHandler = ClientSocket() clientSocketHandler.setClientSocket(cs) self.clients.newThread(self.clientFunc, {clientSocketHandler : "1"}, threadName).start() server and clients send/rec methods from inside ClientSocket receivedData = self.__clientSocket.recv(1024*1024) self.__clientSocket.send(s) any ideas why send() is returning straight away?

    Read the article

  • python list mysteriously getting set to something within my django/piston handler

    - by Anverc
    To start, I'm very new to python, let alone Django and Piston. Anyway, I've created a new BaseHandler class "class BaseApiHandler(BaseHandler)" so that I can extend some of the stff that BaseHandler does. This has been working fine until I added a new filter that could limit results to the first or last result. Now I can refresh the api page over and over and sometimes it will limit the result even if I don't include /limit/whatever in my URL... I've added some debug info into my return value to see what is happening, and that's when it gets more weird. this return value will make more sense after you see the code, but here they are for reference: When the results are correct: "statusmsg": "2 hours_detail found with query: {'empid':'22','datestamp':'2009-03-02',}", when the results are incorrect (once you read the code you'll notice two things wrong. First, it doesn't have 'limit':'None', secondly it shouldn't even get this far to begin with. "statusmsg": "1 hours_detail found with query: {'empid':'22','datestamp':'2009-03-02',with limit[0,1](limit,None),}", It may be important to note that I'm the only person with access to the server running this right now, so even if it was a cache issue, it doesn't make sense that I can just refresh and get different results by hitting F5 while viewing: http://localhost/api/hours_detail/datestamp/2009-03-02/empid/22 Here's the code broken into urls.py and handlers.py so that you can see what i'm doing: URLS.PY urlpatterns = patterns('', #hours_detail/id/{id}/empid/{empid}/projid/{projid}/datestamp/{datestamp}/daterange/{fromdate}to{todate}/limit/{first|last}/exact #empid is required # id, empid, projid, datestamp, daterange can be in any order url(r'^api/hours_detail/(?:' + \ r'(?:[/]?id/(?P<id>\d+))?' + \ r'(?:[/]?empid/(?P<empid>\d+))?' + \ r'(?:[/]?projid/(?P<projid>\d+))?' + \ r'(?:[/]?datestamp/(?P<datestamp>\d{4,}[-/\.]\d{2,}[-/\.]\d{2,}))?' + \ r'(?:[/]?daterange/(?P<daterange>(?:\d{4,}[-/\.]\d{2,}[-/\.]\d{2,})(?:to|/-)(?:\d{4,}[-/\.]\d{2,}[-/\.]\d{2,})))?' + \ r')+' + \ r'(?:/limit/(?P<limit>(?:first|last)))?' + \ r'(?:/(?P<exact>exact))?$', hours_detail_resource), HANDLERS.PY # inherit from BaseHandler to add the extra functionality i need to process the possibly null URL params class BaseApiHandler(BaseHandler): # keep track of the handler so the data is represented back to me correctly post_name = 'base' # THIS IS THE LIST IN QUESTION - SOMETIMES IT IS GETTING SET TO [0,1] MYSTERIOUSLY # this gets set to a list when the results are to be limited limit = None def has_limit(self): return (isinstance(self.limit, list) and len(self.limit) == 2) def process_kwarg_read(self, key, value, d_post, b_exact): """ this should be overridden in the derived classes to process kwargs """ pass # override 'read' so we can better handle our api's searching capabilities def read(self, request, *args, **kwargs): d_post = {'status':0,'statusmsg':'Nothing Happened'} try: # setup the named response object # select all employees then filter - querysets are lazy in django # the actual query is only done once data is needed, so this may # seem like some memory hog slow beast, but it's actually not. d_post[self.post_name] = self.queryset(request) # this is a string that holds debug information... it's the string I mentioned before pasting this code s_query = '' b_exact = False if 'exact' in kwargs and kwargs['exact'] <> None: b_exact = True s_query = '\'exact\':True,' for key,value in kwargs.iteritems(): # the regex url possibilities will push None into the kwargs dictionary # if not specified, so just continue looping through if that's the case if value == None or key == 'exact': continue # write to the s_query string so we have a nice error message s_query = '%s\'%s\':\'%s\',' % (s_query, key, value) # now process this key/value kwarg self.process_kwarg_read(key=key, value=value, d_post=d_post, b_exact=b_exact) # end of the kwargs for loop else: if self.has_limit(): # THIS SEEMS TO GET HIT SOMETIMES IF YOU CONSTANTLY REFRESH THE API PAGE, EVEN THOUGH # THE LINE IN THE FOR LOOP WHICH UPDATES s_query DOESN'T GET HIS AND THUS self.process_kwarg_read ALSO # DOESN'T GET HIT SO NEITHER DOES limit = [0,1] s_query = '%swith limit[%s,%s](limit,%s),' % (s_query, self.limit[0], self.limit[1], kwargs['limit']) d_post[self.post_name] = d_post[self.post_name][self.limit[0]:self.limit[1]] if d_post[self.post_name].count() == 0: d_post['status'] = 0 d_post['statusmsg'] = '%s not found with query: {%s}' % (self.post_name, s_query) else: d_post['status'] = 1 d_post['statusmsg'] = '%s %s found with query: {%s}' % (d_post[self.post_name].count(), self.post_name, s_query) except: e = sys.exc_info()[1] d_post['status'] = 0 d_post['statusmsg'] = 'error: %s' % e d_post[self.post_name] = [] return d_post class HoursDetailHandler(BaseApiHandler): #allowed_methods = ('GET',) model = HoursDetail exclude = () post_name = 'hours_detail' def process_kwarg_read(self, key, value, d_post, b_exact): if ... # I have several if/elif statements here that check for other things... # 'self.limit =' only shows up in the following elif: elif key == 'limit': order_by = 'clock_time' if value == 'last': order_by = '-clock_time' d_post[self.post_name] = d_post[self.post_name].order_by(order_by) # TO GET HERE, THE ONLY PLACE IN CODE WHERE self.limit IS SET, YOU MUST HAVE GONE THROUGH # THE value == None CHECK???? self.limit = [0, 1] else: raise NameError def read(self, request, *args, **kwargs): # empid is required, so make sure it exists before running BaseApiHandler's read method if not('empid' in kwargs and kwargs['empid'] <> None and kwargs['empid'] >= 0): return {'status':0,'statusmsg':'empid cannot be empty'} else: return BaseApiHandler.read(self, request, *args, **kwargs) Does anyone have a clue how else self.limit might be getting set to [0, 1] ? Am I misunderstanding kwargs or loops or anything in Python?

    Read the article

  • good __eq__, __lt__, ..., __hash__ methods for image class?

    - by Marten Bauer
    I create the following class: class Image(object): def __init__(self, extension, data, urls=None, user_data=None): self._extension = extension self._data = data self._urls = urls self._user_data = user_data self._hex_digest = hashlib.sha1(self._data).hexDigest() Images should be equal when all values are equal. Therefore I wrote: def __eq__(self, other): if isinstance(other, Image) and self.__dict__ == other.__dict__: return True return False def __ne__(self, other): return not self.__eq__(other) def __lt__(self, other): return self.__dict__ < other.__dict__ ... But how should the __hash__ method look like? Equal Images should return equal hashes... def __hash__(self): # won't work !?! return hash(self.__dict__) Is the way I try to use __eq__, __ne__, __lt__, __hash__, ... recommend?

    Read the article

< Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >