Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Pinako

Pages: [1] 2 3 ... 74
1
General Chat / Re: jam with me? redux
« on: April 16, 2014, 08:15:24 PM »
raspirateradio?

What do you think of a mixxx+icecast combination?

2
General Chat / Re: jam with me? redux
« on: April 15, 2014, 11:19:45 PM »
mpd is really designed for driving audio output at the host -- party at the datacenter -- so it naturally handles only one playlist at a time. Icecast is a multitenant server that's able to stream different content simultaneously.

3
General Chat / Re: jam with me? redux
« on: April 15, 2014, 08:45:34 PM »
So the limitation with mpd is that it only does single streams. I really wanted to stream selectively today.

At any rate... the party's on :)

4
General Chat / Re: jam with me? redux
« on: April 14, 2014, 11:45:03 PM »
Yay :)

Screenshot time. Not nearly as attractive as fun as EpicCyndaquil console, though!


5
General Chat / Re: I was jealous of all of Pinako's projects...
« on: April 14, 2014, 10:58:01 PM »
That *is* pretty sexy! I approve of this project... might have to imitate this someday :)

DAT WOOD.

6
General Chat / jam with me? redux
« on: April 14, 2014, 10:40:25 PM »
Remember that? Icecast is too mainstream. I'm experimenting with mpd's httpd interface :)

Now playing: uplifting trance
http://bluenet.inportb.com:8000/mpd.mp3

7
General Chat / Re: TLD's hitting all time low...
« on: April 14, 2014, 12:52:30 AM »

8
General Chat / Re: Recommendation on a database software?
« on: April 12, 2014, 01:24:42 AM »
From your description, I gather that you have a single table with a flat structure -- Excel should work just fine.

I know that you really want to use a database, but do you need to?

If the problem is that a spreadsheet is too complicated, I'm not sure if switching to a database would improve the situation; if anything, I'd expect it to make things worse. Consider using a database if you could benefit from centralization (using the same database from different places or contexts), normalization (reducing data duplication, joining many tables), or validation (enforcing constraints on the fields).

9
Nano works great for text editing :)

So yeah, org mode is awesome, but why would you do ALL the things using the same text editor? Keep emacs for structural editing, but use something else for code. And when you get the hang of the basic commands, edit more stuff using emacs. Or vim. Or whatever.

10
General Chat / Re: Small announcement.
« on: April 05, 2014, 10:35:54 PM »
Come now, Egg-Roll, you could always visit paulspage's airport!

Congrats, man.

11
General Chat / Re: [110mb Gossip] So this is new
« on: March 02, 2014, 03:28:13 AM »
Yay bootstrap?

12
General Chat / Re: I have a bazar request...
« on: February 18, 2014, 11:18:35 PM »
For what use case? If it's for personal financial management, I'd go for something well-established such as GnuCash. Wanna use it over the network? There's RDP for that (or X11 if you're a Linux guy). I've used both GnuCash and QuickBooks Pro, and I think GnuCash stacks up quite well against the proprietary alternatives for personal use, as long as you're willing to learn some accounting logic.

13
Welcome to the forum, g4borg.

Thank you for reporting the bug. It appears that Twisted's use of self._buffer now overlaps with ours, and it doesn't like how we're using it. Fortunately, the fix is simple: refactor that field:

Code: [Select]
# CC-BY-NC-3.0

import json
from twisted.protocols.basic import LineReceiver
from twisted.internet import defer

class Request(object):
 def __init__(self,protocol,method):
  self.protocol = protocol
  self.method = method
 def __call__(self,*args,**kwargs):
  return self.protocol.callRemote(self.method,*args,**kwargs)
 def notify(self,*args,**kwargs):
  return self.protocol.notifyRemote(self.method,*args,**kwargs)

class Response(Exception):
 def __init__(self,value=None):
  self.value = value
 def format(self,ctx):
  return {'jsonrpc':'2.0','response':self.value,'id':ctx}

class ProtocolException(Exception):
 def __init__(self,code,message,data=None):
  self.code = int(code)
  self.message = unicode(message)
  self.data = data
 def __repr__(self):
  return 'ProtocolException(%d,%s,%s)'%(self.code,repr(self.message),repr(self.data))
 def format(self,ctx=None):
  e = {'code':self.code,'message':self.message}
  if self.data is not None:
   e['data'] = self.data
  return {'jsonrpc':'2.0','error':e,'id':ctx}
 @staticmethod
 def stringify(self,ex):
  return json.dumps({'jsonrpc':'2.0','error':{'code':-32000,'message':ex.__class__.__name__,'data':str(ex)},'id':None},separators=(',',':'))
class ParseError(ProtocolException):
 def __init__(self,message='Parse error.',data=None):
  ProtocolException.__init__(self,-32700,message,data)
class InvalidRequest(ProtocolException):
 def __init__(self,message='Invalid request.',data=None):
  ProtocolException.__init__(self,-32600,message,data)
class MethodNotFound(ProtocolException):
 def __init__(self,message='Method not found.',data=None):
  ProtocolException.__init__(self,-32601,message,data)
class InvalidParams(ProtocolException):
 def __init__(self,message='Invalid parameters.',data=None):
  ProtocolException.__init__(self,-32602,message,data)
class InternalError(ProtocolException):
 def __init__(self,message='Internal error.',data=None):
  ProtocolException.__init__(self,-32603,message,data)
class PythonError(ProtocolException):
 def __init__(self,ex):
  ProtocolException.__init__(self,-32000,ex.__class__.__name__)

class Protocol(LineReceiver):
 delimiter = '\n'
 def __init__(self):
  self._buf = None
  self._request = {}
  self._deferred = {}
 def lineReceived(self,line):
  try:
   try:
    data = json.loads(line)
   except ValueError:
    data = (None,)
    raise ParseError()
   res = defer.maybeDeferred(self.jsonReceived,data)
   res.addCallback(self.sendJson)
  except ProtocolException,ex:
   self.sendJson(ex.format(None))
 def jsonReceived(self,data):
  if isinstance(data,dict):
   data_id = None
   try:
    if data.get('jsonrpc',None) != '2.0':
     raise InvalidRequest()
    if 'method' in data:
     if 'id' in data:
      data_id = data['id']
      if not (isinstance(data_id,basestring) or isinstance(data_id,float) or isinstance(data_id,int) or data_id is None):
       data_id = None
       raise InvalidRequest()
     else:
      data_id = False
     data_method = data['method']
     if not isinstance(data_method,basestring):
      raise InvalidRequest()
     try:
      fn = getattr(self,'jsonrpc_'+data_method)
     except AttributeError:
      raise MethodNotFound()
     if 'params' in data:
      data_params = data['params']
      if isinstance(data_params,list):
       try:
        response = fn(*data_params)
       except Error,ex:
        raise PythonError(ex)
      elif isinstance(data_params,dict):
       try:
        response = fn(**data_params)
       except Error,ex:
        raise PythonError(ex)
      else:
       raise InvalidRequest()
     else:
      try:
       response = fn()
      except Error,ex:
       raise PythonError(ex)
     if data_id is not False:
      raise Response(response)
    elif 'response' in data:
     if 'error' in data or 'id' not in data:
      raise InvalidRequest()
     data_id = data['id']
     try:
      deferred = self._deferred[data_id]
      del self._deferred[data_id]
     except KeyError:
      return
     deferred.callback(data['response'])
    elif 'error' in data:
     if 'response' in data or 'id' not in data:
      raise InvalidRequest()
     data_id = data['id']
     try:
      deferred = self._deferred[data_id]
      del self._deferred[data_id]
     except KeyError:
      return
     deferred.errback(data['error'])
   except (Response,ProtocolException),ex:
    if data_id is not False:
     return ex.format(data_id)
  elif isinstance(data,list):
   @defer.inlineCallbacks
   def runall():
    responses = []
    for request in data:
     if isinstance(request,dict):
      response = yield defer.maybeDeferred(self.jsonReceived,request)
      if response is not None:
       responses.append(response)
    defer.returnValue(responses)
   return runall()
 def sendJson(self,data):
  if isinstance(data,dict) or isinstance(data,list):
   self.sendLine(json.dumps(data,separators=(',',':')))
 def callRemote(self,_method,*args,**kwargs):
  largs = len(args)
  lkwargs = len(kwargs)
  if largs > 0 and lkwargs > 0:
   raise TypeError('cannot use both positional and named parameters')
  elif largs > 0:
   params = args
  elif lkwargs > 0:
   params = kwargs
  else:
   params = None
  d = defer.Deferred()
  try:
   ctx = max(self._deferred)+1
  except ValueError:
   ctx = 0
  o = {'jsonrpc':'2.0','method':_method,'id':ctx}
  if params is not None:
   o['params'] = params
  self._deferred[ctx] = d
  if isinstance(self._buf,list):
   self._buf.append(o)
  else:
   self.sendJson(o)
  return d
 def notifyRemote(self,_method,*args,**kwargs):
  largs = len(args)
  lkwargs = len(kwargs)
  if largs > 0 and lkwargs > 0:
   raise TypeError('cannot use both positional and named parameters')
  elif largs > 0:
   params = args
  elif lkwargs > 0:
   params = kwargs
  else:
   params = None
  o = {'jsonrpc':'2.0','method':_method}
  if params is not None:
   o['params'] = params
  if isinstance(self._buf,list):
   self._buf.append(o)
  else:
   self.sendJson(o)
  return self
 def beginQueue(self):
  self.endQueue()
  self._buf = []
  return self
 def endQueue(self):
  if isinstance(self._buf,list):
   self.sendJson(self._buf)
  self._buf = None
  return self
 def __getattr__(self,key):
  if key.startswith('_'):
   raise AttributeError('%s instance has no attribute \'%s\''%(self.__class__.__name__,key))
  try:
   return self._request[key]
  except KeyError:
   self._request[key] = Request(self,key)
   return self._request[key]

if __name__ == '__main__':
 from twisted.internet.protocol import ServerFactory, ClientFactory
 from twisted.internet import reactor
 class EchoServer(ServerFactory):
  class protocol(Protocol):
   def jsonrpc_echo(self,*args):
    largs = len(args)
    if largs == 1:
     print self.factory.__class__.__name__,'receive:',args[0]
     return args[0]
    elif largs > 1:
     print self.factory.__class__.__name__,'receive:',args
     return args
   def jsonrpc_bounce(self,*args):
    print self.factory.__class__.__name__,'bounce'
    self.notifyRemote('echo',*args)
    largs = len(args)
    if largs == 1:
     return args[0]
    elif largs > 1:
     return args
 class EchoClient(ClientFactory):
  class protocol(Protocol):
   end = 'Goodbye!'
   def connectionMade(self):
    @defer.inlineCallbacks
    def runall():
     res = yield self.callRemote('echo','Hello, world!')
     print self.factory.__class__.__name__,'receive:',res
     res = yield self.echo('What a fine day it is.')
     print self.factory.__class__.__name__,'receive:',res
     res = yield self.echo('Who?','What?','When?','Where?','Why?','How?')
     print self.factory.__class__.__name__,'receive:',res
     res = yield self.bounce('Call me back!')
     defer.returnValue(None)
    def callback(res):
     self.beginQueue().bounce.notify('Bounce!').bounce.notify(self.end).endQueue()
    runall().addCallback(callback)
   def connectionLost(self,reason):
    print 'connection lost (protocol)'
   def jsonrpc_echo(self,*args):
    largs = len(args)
    if largs == 1:
     print self.factory.__class__.__name__,'receive:',args[0]
     if args[0] == self.end:
      self.transport.loseConnection()
     return args[0]
    elif largs > 1:
     print self.factory.__class__.__name__,'receive:',args
     return args
  def clientConnectionFailed(self,connector,reason):
   print 'connection failed:',reason.getErrorMessage()
   reactor.stop()
  def clientConnectionLost(self,connector,reason):
   print 'connection lost:',reason.getErrorMessage()
   reactor.stop()
 reactor.listenTCP(8000,EchoServer())
 reactor.connectTCP('localhost',8000,EchoClient())
 reactor.run()

This works with Twisted 13.2.0.

14
General Chat / Re: Anyone still visit 110mb?
« on: December 30, 2013, 08:45:51 PM »
I've always been a champion of the community, so I'd recommend nurturing the community and finding a way to profit from it in return :D
On the tech side, there are some fun things that I'd like to try in pilot mode before putting them in production...

Incidentally, any updates on the lost doges?

15
Hosting Choices / Re: ChunkHost (freemium Xen PV)
« on: December 18, 2013, 12:56:47 AM »
It's been a year, and ChunkHost has gone paid. I figured I'd post a followup about my free chunk. Here goes: http://serverbear.com/benchmark/2013/12/18/00LY2z1ykeRIT7XW

As you can see, it's now running on a different machine.
  • random access is much faster, presumably because of SSD caching
  • sequential access now sucks
  • network bandwidth has improved a little

Is it worth the fee? Well, I'm not quite ready to fork over the cash just yet.

16
Mobile Devices / Re: So I got this new pair of glasses...
« on: December 13, 2013, 07:53:18 PM »
Fun! From my chats with Samsung Telecommunications folks, I understand that frequently refocusing your vision on a near target on one side of the face may be problematic; of course, they'd rather interest me in a Galaxy Gear at this point (though the wrist does seem far more sensitive to vibrations). Is this an issue for you?

17
General Chat / Re: TheHostHelpers IRC
« on: December 02, 2013, 12:41:21 AM »
The webchat works great!

... but if you'd like a "real" client, try PChat for Windows or Colloquy for Mac or X-Chat for Linux. Or if you have a Web browser... try connecting ChatZilla or CIRC to #thh on irc.freenode.net port 6667 ;)

18
General Chat / Re: Ubuntu Kylin
« on: November 30, 2013, 07:00:33 PM »
Still, it must be better than a Microsoft product that might just be calling the homeland behind the government's back. National security concerns probably trumps the increased risk of firewall subversion.

19
General Chat / Re: buying a new laptop computer
« on: November 30, 2013, 06:55:07 PM »
mmm batteries. lets hope that this unit also has a good battery :)

Incidentally, I've already noticed a physical defect in one of the keys; but it's a minor cosmetic thing that doesn't bother me enough to swap it for a unit that might have more serious issues elsewhere ;)

Speaking of keys, I'm loving the backlit keyboard. Yay for... midnight coding? (badum tsh...)

20
Since we're talking about backups, I use Bittorrent Sync on multiple machines, including a VPS I pay an extremely low fee for. It's by far the best DIY-dropbox I've found (though the sharing options are a tad more limited).

I've been wanting to do this, and I'd even map a public directory to a Web server on the VPS. I'm glad to see validation in this technique!
The only dealbreaker so far is the proprietary app. I know that Dropbox (which I use) is also proprietary... but at least I know that all my base are belong to Dropbox (instead of, say, anons).

Pages: [1] 2 3 ... 74