Sera que finalmente se arma la de San Quintin? Le tiraran un madrugonazo? Sera que finalmente se arrechan los Venezolanos y sacan al loco (loco pila que tiene mas billete que bill gates) ?
Here’s some code for my future reference on how to use QMutex or QMutexLocker.
* Use QMutex to protect data, not code. Try not to lock hughe amounts of code within a function with mutex.lock(), mutex.unlock(), if for any reason you forget to release the lock you’ll be in trouble. Use the mutex directly only when you know what it is that you want to protect concurrent access from.
* When you have a complex function and you don’t want to worry about what to protect and when to release the lock (on exceptions thrown, before returns,etc), you can create an instance of QMutexLocker and it should release the mutex lock upon destruction… this takes us to the next lesson
* When using a QMutexLocker, DO NOT make the QMutexLocker an attribute of your class, otherwise, the reference will live after the method finishes and the lock won’t be released.
Here’s some code.
from PyQt4.Qt import QObject, QMutex, QApplication, QThread, QMutexLocker import sys class MutexTestSubject(QObject): ''' Class that uses a QMutex to synchronize access to its add(),substract() methods. This works perfectly fine. ''' def __init__(self): QObject.__init__(self) self.MAX_LIMIT = 100 self.MIN_LIMIT = 0 self.counter = 50 self.mutex = QMutex() def add(self): self.mutex.lock() if self.counter < self.MAX_LIMIT: self.counter = self.counter + 1 self.mutex.unlock() def substract(self): self.mutex.lock() if self.counter > self.MIN_LIMIT: self.counter = self.counter - 1 self.mutex.unlock() def printStatus(self,thread): print "Counter:",self.counter," - Thread:",id(thread) if self.counter > self.MAX_LIMIT+1 or self.counter < self.MIN_LIMIT: print "Stopping Threads, Max Surpassed, Not Thread Safe. Last Thread:",id(thread) sys.exit() class MutexLockerTestSubject(QObject): ''' Class that attemps to synchronize thread access to its add(),substract() methods with the QMutexLocker object. ''' def __init__(self): QObject.__init__(self) self.MAX_LIMIT = 100 self.MIN_LIMIT = 0 self.counter = 50 self.mutex = QMutex() def add(self): #VIP: DO NOT MAKE mutexLocker an attribute of your class. #other wise it won't be destroyed and the lock will never be released. mutexLocker = QMutexLocker(self.mutex) if self.counter < self.MAX_LIMIT: self.counter = self.counter + 1 def substract(self): mutexLocker = QMutexLocker(self.mutex) if self.counter > self.MIN_LIMIT: self.counter = self.counter - 1 def printStatus(self,thread): print "Counter:",self.counter," - Thread:",id(thread) if self.counter > self.MAX_LIMIT+1 or self.counter < self.MIN_LIMIT: print "Stopping Threads, Max Surpassed, Not Thread Safe. Last Thread:",id(thread) sys.exit() class AdderWorker(QThread): def __init__(self, mutexTestObject): self.mutexTestObject = mutexTestObject QThread.__init__(self) def run(self): while(True): self.mutexTestObject.add() self.mutexTestObject.printStatus(self) class SubstractorWorker(QThread): def __init__(self, mutexTestObject): self.mutexTestObject = mutexTestObject QThread.__init__(self,mutexTestObject) def run(self): while(True): self.mutexTestObject.substract() self.mutexTestObject.printStatus(self) if __name__ == "__main__": USE_MUTEX_LOCKER = True #switch this to use regular mutexes vd QMutexLocker app = QApplication(sys.argv) mutexTestObject = MutexTestSubject() if not USE_MUTEX_LOCKER else MutexLockerTestSubject() adderThread = AdderWorker(mutexTestObject) substracterThread = SubstractorWorker(mutexTestObject) adderThread.start() substracterThread.start() sys.exit(app.exec_())
On November 20th, FrostWire gets a very positive review by CNET’s download.com, and makes it to the home page of download.com as the Killer Download of the Day
Their review makes us very happy, at the same time, it pushes us to include new killer features that LimeWire may not be able to have in the near future, however if you follow LimeWire’s code base, it seems they’re working hard to release a web based Music Store that will be included on an embedded browser inside their client, probably in the fashion of the online iTunes store, but probably powered by P2P (we hope, if they stick to their p2p philosophy and hopefully without DRM so that files can be shared or bought, at least this worked beautifully for Radiohead).
It’d probably be a smart move by the LimeWire store to include the possibility to buy their music from outside their site (with commissions on sales of course), that way, other music sites could trigger purchases based on search, as well as other p2p clients such as FrostWire.
Dale Play aqui mismo
Guarda TODOS tus archivos gratis en MyBloop.com!
- Todo lo que sabemos hasta el momento de ANDROID, el sistema operativo basado en Linux patrocinado por Google y el Open Handset Alliance
- Eco Green PCs de $200 con Linux se agotan en Walmart
- 7 formas de reducir tus emisiones de carbon
- Viene una Pelicula de Halo 3?
- Titulares Apple desde Mackinando.com
Patrocinantes de este Episodio
Con la melodia de “Y Viva Espana”, demasiado comico.
A few things about effing Hugo Chavez and why the US should take this guy as a threat worse than Al-Qaeda:
– Openly hates and resents the US and has insulted the Bush administration in every way possible
– Recently Spent over USD $3 billion in weapons
– Friends of Fidel Castro, Iran, China
– Helps the FARC infiltrate back to Colombia with Air Support (might be planning a war against Colombia to destabilize the region)
– Allows Al-Qaeda terrorist cells to operate freely in the country
– Legislates at his own will in over 50 matters (by decree)
– Recently trying to change the constitution to have infinite re-election
– Nationalized Oil, Electricity, and Telecommunications industries.
– Controls the media (shutdown RCTV), and is about to launch another TV Channel by the government
– Has a direct air traffic bridge from Caracas-Teheran with IranAir, flying known islamic terrorists and printing venezuelan IDs for them, which later allow them to obtain American Visas and enter the US legally
– Has lobbyists in Washington which he controls by offering profits from the Venezuelan oil industry
– 1 venezuelan is murdered every 30 minutes (crime related and violence related deaths, there is no security in Venezuela)
and the list goes on and on…
Embed this video on your blog or send this article to all your friends, the truth about this danger to the western hemisphere should be known. My country has no future unless this regime disapears completely, freedom for Venezuela.
<embed style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId=5911805686509043935&hl=en" flashvars=""> &;t;/embed>
So after spending like 2 hours, I finally figured out some missing information from all the pages out there that tell you how to enter cheat codes on the Xbox 360 if you use a compatible Xbox Game
The xbox 360 controller lacks the white and black buttons (this is explained everywhere), so on the cheat codes when they refer to the Black button, this means you gotta hit the Right Bumper (which is the button right above the Right Trigger).
Now, what they don’t tell you is, that when they say “Left” or “Right”, they mean “Left Trigger” and “Right Trigger”, sons of bitches.
Here are all the Cheat Codes, you can enter them during regular Game Play, meaning, when your Sim is walking around.
When you enter a Cheat Code correctly you will hear the voice of a woman Yawning, if you enter the same cheat code again, you will hear a “Uh-Uh” voice with a negative sound to it.
Once a first code is entered, you’ll see a small white pole in the front of your property, this is called the “Cheat Gnome“.
Left -> Left Trigger
Right -> Right Trigger
White -> Left Bumper
Black -> Right Bumper
When they say D-Pad, they mean the Directional pad on the center of your Xbox 360, the one that looks like the good old directional pad of the old NES.