Jackben
bitch I'm taking calls.
This looks great, thanks for the recommendation.
This looks great, thanks for the recommendation.
import cherrypy
from ws4py.server.cherrypyserver import WebSocketPlugin, WebSocketTool
from ws4py.websocket import EchoWebSocket
cherrypy.config.update({'server.socket_port': 9090})
WebSocketPlugin(cherrypy.engine).subscribe()
cherrypy.tools.websocket = WebSocketTool()
class Root(object):
@cherrypy.expose
def index(self):
return 'some HTML with a websocket javascript connection'
@cherrypy.expose
def ws(self):
# you can access the class instance through
handler = cherrypy.request.ws_handler
cherrypy.quickstart(Root(), '/', config={'/ws': {'tools.websocket.on': True,
'tools.websocket.handler_cls': EchoWebSocket}})
127.0.0.1 - - [25/Aug/2013:13:39:05] "GET / HTTP/1.1" 200 48 "" "Mozilla/5.0 (Wi
ndows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/
537.36"
I totally forgot about the programming thread and made a thread about an issue im having writing a websocket server on Python.
This is my server code (Example server)
Code:import cherrypy from ws4py.server.cherrypyserver import WebSocketPlugin, WebSocketTool from ws4py.websocket import EchoWebSocket cherrypy.config.update({'server.socket_port': 9090}) WebSocketPlugin(cherrypy.engine).subscribe() cherrypy.tools.websocket = WebSocketTool() class Root(object): @cherrypy.expose def index(self): return 'some HTML with a websocket javascript connection' @cherrypy.expose def ws(self): # you can access the class instance through handler = cherrypy.request.ws_handler cherrypy.quickstart(Root(), '/', config={'/ws': {'tools.websocket.on': True, 'tools.websocket.handler_cls': EchoWebSocket}})
Now, when a client tries to connect i get this message and the connection is never made
Code:127.0.0.1 - - [25/Aug/2013:13:39:05] "GET / HTTP/1.1" 200 48 "" "Mozilla/5.0 (Wi ndows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.95 Safari/ 537.36"
I also tried Tornado but i get a weird "Warning:Access.404" everytime the client tries to connect.
Hi guys,
PHP/jQuery/C# .NET developer here... rather jaded in my current job and really hoping to self teach and create a game or two
What platform/framework/language should I start off with? I'm happy to develop for any platform, but due to the app stores I am tempted to aim for the Android/iOS markets...
Thanks!
I'm going through some project euler challenges and one of them (#26) is asking for the value that has longest recurring decimal cycle with 1/d being the format and d < 1000 (E.X. 1/3 is 1 with 0.6666 and 1/7 is 6 with 0.142857). I'm assuming the longest it can be is 8 since doubles are precise only to 16 digits but the implementation is tripping me up.
For C++ how would one go about combing through the decimal for repetition without putting the answer in a string and using various string techniques? My knowledge is pretty limited of various library functions and my google search skills are failing me :/
For C++ how would one go about combing through the decimal for repetition without putting the answer in a string and using various string techniques? My knowledge is pretty limited of various library functions and my google search skills are failing me :/
double my_val = <value you want to check>
// Multiply it by 10^16, this is equivalent to a 16 digit decimal left shift.
my_val *= 10e+16;
// Cast it to a 64-bit integer, truncating it.
uint64_t transformed_val = static_cast<uint64_t>(my_val);
// Separate the decimal digits.
uint64_t upper_8_digits = transformed_val / (10e+8);
uint64_t lower_8_digits = transformed_val % (10e+8);
bool has_8_digit_cycle = (upper_8_digits == lower_8_digits);
for(i = 0; i < 30; i++)
{
temp = dividend / divisor;
remainder = dividend % divisor;
if(i > 0)
{
answer[i - 1] = temp;
}
dividend = (10 * remainder);
}
Hi guys,
PHP/jQuery/C# .NET developer here... rather jaded in my current job and really hoping to self teach and create a game or two
What platform/framework/language should I start off with? I'm happy to develop for any platform, but due to the app stores I am tempted to aim for the Android/iOS markets...
Thanks!
Where would the notification come from? What is scanning threads to get the information?I have an idea for a NeoGAF focused chrome app - basically something that sends a notification when you get quoted, or your username is in a post. I might be getting good enough to make something like that. Might be.
Where would the notification come from? What is scanning threads to get the information?
In that scenario, the browser is the one that's loading the page and scanning for changes. So to get notified when you're quoted, your browser has to periodically load new posts in every thread you've posted in.That's what I am trying to figure out how to implement actually.
This chrome extension was my inspiration, so I am sure it's possible - I just don't know how to do it.
In that scenario, the browser is the one that's loading the page and scanning for changes. So to get notified when you're quoted, your browser has to periodically load new posts in every thread you've posted in.
To get notified of posts that mention your name, your browser would have to periodically load every new post on the forum.
Every person who runs the extension has their browser loading every post on neogaf.
If you want to be a completionist, to capture mentions in edits of posts you'd have to load every post ever made on neogaf periodically.
In that scenario, the browser is the one that's loading the page and scanning for changes. So to get notified when you're quoted, your browser has to periodically load new posts in every thread you've posted in.
To get notified of posts that mention your name, your browser would have to periodically load every new post on the forum.
Every person who runs the extension has their browser loading every post on neogaf.
If you want to be a completionist, to capture mentions in edits of posts you'd have to load every post ever made on neogaf periodically.
What are some good and still-active xna tutorials for beginners?
I'm looking into getting involved in Android app development. Should I learn Javascript first or just go balls-deep into Android programming tutorials?
Android apps are written in Java. You should probably learn that.
I'm looking into getting involved in Android app development. Should I learn Javascript first or just go balls-deep into Android programming tutorials?
LOL, true enough. Good thing I had already started on the MSDN js tutorials then.
Javascript ≠ Java. Javascript is for web. Java is a full featured programming language.
You want the latter.
Yeah, Java is what I was referring to, just mixed up the names.
This sounds absolutely perfect for me, thank you!Unity3D, free, really straight forward, C# and one click deploy to Android/iOS
This sounds good too, thanks Lasthope, but I think it's maybe something I'll hopefully build myself up to when I have more of an idea of what I'm doing. Simple/straightforward/C# of Unity3D sounds great!I'm currently learning Monogame, which is an open source implementation of XNA. Microsoft has stopped supporting XNA, but Monogame I believe is going to become even better than XNA ever was. It has support for Android, iOS, PS mobile, and many others. There are plans to support Xbone and PS4. From what I read, all the documentation, tutorials, code, etc. for XNA is 99.9% applicable to Monogame.
Also, Cocos-2dxna is a port of the widely used Cocos-2d framework. And from my research learning XNA/Monogame will help you if you ever decide to transition to Unity.
Has anyone taken Interactive Python on Coursera? Is it any good/worth the time?
There is only one way to find out right?
I have taken both Udacity's CS101 and EdX 6.00x courses which also introduce programming with Python. I would say those two are very very good. Of the two, 6.00x feels like a real college class. The pace is unrelenting, it is rigorous and you will learn a lot about CS. A lot of people complain that 6.00x might be too hard, but I would argue that if you can successfully complete the course, you will have all the necessary skills to become a software engineer.
Good point. I'm already signed up for the class, but I thought I'd get opinions in case there is a better option.
I should have given some background. I'm a reasonably experienced programmer, but I haven't done much Python (Unity3D C# mostly at work and some classes in C++ lately). I was considering this class or just going through learn Python the hard way, but this seems a little more fun with the assignments being games.
Imo Python The Hard Way is a good place to learn Python as a programmer. Just skip the assignments which are too easy. You'll probably breeze through it in one sitting (or two "recreational" evenings) and have a pretty good understanding about Python.
1. The end of the year holiday season is approaching, and you have to get gifts for various people. What are the inputs, what processing has to be done to generate the output: each gift recipient joyfully opens his or her gifts?
2. You are an instructor for a course that evaluates the students by means of 4 quizzes and 2 exams; each quiz is worth 10% of the grade, and each exam is worth 30% of the grade. Design an algorithm that produces final grades for each student in the course.
3. Now that you have the final grades for each student in the course, design an algorithms that computes the statistical mean and standard deviation of the set of final grades.
OK I need some serious help...
I'm in school right now and I'm taking an intro to Computer Science class. We're working with C++ in Microsoft Visual Studio 2012. First day of class was two days ago and we just went over the basics and looked at some basic code for a program like Hello World and some Print Name program.
Now we have an assignment due next Tuesday, and I took a look at one of the parts of the assignment and it seems I have to code three things:
I look at #1 and...literally have no idea how to even start this. I remember taking a C++ class way back in 6th (!) grade and had no idea how to do anything and now I'm having the same problem. What am I supposed to do?
If I don't understand how to even do this I'll have to drop the class ASAP (before 9/4).
OK I need some serious help...
I'm in school right now and I'm taking an intro to Computer Science class. We're working with C++ in Microsoft Visual Studio 2012. First day of class was two days ago and we just went over the basics and looked at some basic code for a program like Hello World and some Print Name program.
Now we have an assignment due next Tuesday, and I took a look at one of the parts of the assignment and it seems I have to code three things:
I look at #1 and...literally have no idea how to even start this. I remember taking a C++ class way back in 6th (!) grade and had no idea how to do anything and now I'm having the same problem. What am I supposed to do?
If I don't understand how to even do this I'll have to drop the class ASAP (before 9/4).
The method of problem analysis presented in this module can be used to design algorithms not all of which are programmable into a computer. In the following exercises use this method to design an algorithm to solve the problem.
OK before the questions was this:
So now I'm confused as to whether I have to program anything at all.
OK before the questions was this:
So now I'm confused as to whether I have to program anything at all.
Inputs:
Person A, Person B, Person C, Person D, Person E
Present A, Present B, Present C, Present D, Present E
If satisfied return true
If not satisfied return false
Alright, so...bear with me if I'm being dumb lol. So for #1...
However is there a way to link the people and specific presents, or is the way I wrote this more general (anyone can get any one present)? I feel like I'm doing something wrong.
Gotcha. If you already have programming experience, you should be fine with just the official python tutorial. I also highly recommend the book Quick Python. Las year I was in the same boat as you. That's why signed up for the two classes I mentioned in my previous post, but I didn't really needed them after reading the tutorial. I took them because I was interested in how those two courses compared to the ones I took during undergrad.
Python The Hard Way is ok for beginners, but I feel you will find it pretty trivial.
Imo Python The Hard Way is a good place to learn Python as a programmer. Just skip the assignments which are too easy. You'll probably breeze through it in one sitting (or two "recreational" evenings) and have a pretty good understanding about Python.
So, I'm diving back into my personal Python project and need a good database to hold questions and answers for various tests. I don't necessarily want to host it online as of yet, probably want to start locally. Any recommendations? I've got Microsoft SQL server and see there are various ways to connect it, but I might be able to get by with something simpler.
I've got a question regarding CVs. I'm currently developing an Android App which is pretty much finished, but missing the final polish and thorough testing for publishing it to the Play Store. Would it be a good idea to put it into the "Projects" section of my CV regardless, and instead of an URL write something like "Prototype, demonstration possible"? So I could theoretically pull out my tablet in an interview and show the App and explain how I implemented certain things (possibly along with code). It's not for an actual interview at the moment, but I plan to apply for a full or part-time job in the next weeks/months.