Search Results

Search found 1506 results on 61 pages for 'ben andken'.

Page 31/61 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • node.js / socket.io, cookies only working locally

    - by Ben Griffiths
    I'm trying to use cookie based sessions, however it'll only work on the local machine, not over the network. If I remove the session related stuff, it will however work just great over the network... You'll have to forgive the lack of quality code here, I'm just starting out with node/socket etc etc, and finding any clear guides is tough going, so I'm in n00b territory right now. Basically this is so far hacked together from various snippets with about 10% understanding of what I'm actually doing... The error I see in Chrome is: socket.io.js:1632GET http://192.168.0.6:8080/socket.io/1/?t=1334431940273 500 (Internal Server Error) Socket.handshake ------- socket.io.js:1632 Socket.connect ------- socket.io.js:1671 Socket ------- socket.io.js:1530 io.connect ------- socket.io.js:91 (anonymous function) ------- /socket-test/:9 jQuery.extend.ready ------- jquery.js:438 And in the console for the server I see: debug - served static content /socket.io.js debug - authorized warn - handshake error No cookie My server is: var express = require('express') , app = express.createServer() , io = require('socket.io').listen(app) , connect = require('express/node_modules/connect') , parseCookie = connect.utils.parseCookie , RedisStore = require('connect-redis')(express) , sessionStore = new RedisStore(); app.listen(8080, '192.168.0.6'); app.configure(function() { app.use(express.cookieParser()); app.use(express.session( { secret: 'YOURSOOPERSEKRITKEY', store: sessionStore })); }); io.configure(function() { io.set('authorization', function(data, callback) { if(data.headers.cookie) { var cookie = parseCookie(data.headers.cookie); sessionStore.get(cookie['connect.sid'], function(err, session) { if(err || !session) { callback('Error', false); } else { data.session = session; callback(null, true); } }); } else { callback('No cookie', false); } }); }); var users_count = 0; io.sockets.on('connection', function (socket) { console.log('New Connection'); var session = socket.handshake.session; ++users_count; io.sockets.emit('users_count', users_count); socket.on('something', function(data) { io.sockets.emit('doing_something', data['data']); }); socket.on('disconnect', function() { --users_count; io.sockets.emit('users_count', users_count); }); }); My page JS is: jQuery(function($){ var socket = io.connect('http://192.168.0.6', { port: 8080 } ); socket.on('users_count', function(data) { $('#client_count').text(data); }); socket.on('doing_something', function(data) { if(data == '') { window.setTimeout(function() { $('#target').text(data); }, 3000); } else { $('#target').text(data); } }); $('#textbox').keydown(function() { socket.emit('something', { data: 'typing' }); }); $('#textbox').keyup(function() { socket.emit('something', { data: '' }); }); });

    Read the article

  • Simple Fundamental Algorithm Question, binary tree traversal

    - by Ben
    I'm trying to explain to non-computer science major student with many questions. (1)What traverses tree? Is it just logic or actual on off switch generates 1s and 0s traveling the circuit board? where is this tree and node exists CPU/Memory in between? (2)If it is 1s and 0s HOW the circuits understand the line for example p=p.getLeft(); I said search the google or wiki.

    Read the article

  • learning the Lower levels of computing

    - by Ben
    I am a software developer with four years experience in .Net development, I always like to keep up to date with the latest technologies (.net related normally) being released and love learning them. I didn't however go to university and learnt all I know through helpful colleagues, .Net courses, the internet and good old books. I feel that I am a good developer, but without learning the lower levels of a computer as you would in the first year of a computer related Uni course, I get lost when talking to people about a lot of more technical lower level computing. Is there a book(s) that anyone could recommend, that would cover the lower levels of what is going on when I click "Run" in Visual Studio? I feel out of my depth when my boss says to me "Thats running in the CPU cache" or "you're limited by disk reads there", and would like to feel more confident when talking about how the hardware talks to each other (CPU to RAM etc). Apologise if thats a vague question, or has been asked before (i did check and couldn't find anything on here that answers my question).

    Read the article

  • ghc-pkg vs cabal

    - by Ben Lever
    In relation to how packages are created, installed and used in Haskell, what are the differences between ghc-pkg and cabal? When would you use one or the other or both? Are they complementary tools, competitive tools, or simply tools that do different jobs?

    Read the article

  • Floating DIV elements is not lining up...

    - by Ben Sinclair
    I have dives that I am floating so that they show side by side. Here is my code: .serviceMembersPosition { width: 190px; float: left; display: inline; border: 1px solid #999; margin: 5px 5px 5px 0; padding: 5px; } It works however if one of the DIV's has more info than the others, it stuffs up the floats. See how there is a gap in my screenshot below. Is there any way to overcome this? I am using JQuery with my website. Maybe there is some code for this?

    Read the article

  • Javascript event detection

    - by Ben Shelock
    I can't find any good documentation on this suprisingly so I'm posting it here. What's the raw javascript equivilent to this: $(elem).click(function(){ alert(this.text()); }); All I can find is this <elem onlick="func()" /> which is not what I want, I want to be able to do it just with javascript not within the context of an element.

    Read the article

  • RMI no such object in table, Server communication error

    - by ben-casey
    My goal is to create a Distributed computing program that launches a server and client at the same time. I need it to be able to install on a couple of machines and have all the machines communicating with each other, i.e. Master node and 5 slave nodes all from one application. My problem is that I cannot properly use unicastRef, I'm thinking that it is a problem with launching everything on the same port, is there a better way I am overlooking? this is part of my code (the part that matters) try { RMIServer obj = new RMIServer(); obj.start(5225); } catch (Exception e) { e.printStackTrace(); } try { System.out.println("We are slave's "); Registry rr = LocateRegistry.getRegistry("127.0.0.1", Store.PORT, new RClient()); Call ss = (Call) rr.lookup("FILLER"); System.out.println(ss.getHello()); } catch (Exception e) { e.printStackTrace(); } } this is my main class (above) this is the server class (below) public RMIServer() { } public void start(int port) throws Exception { try { Registry registry = LocateRegistry.createRegistry(port, new RClient(), new RServer()); Call stuff = new Call(); registry.bind("FILLER", stuff); System.out.println("Server ready"); } catch (Exception e) { System.err.println("Server exception: " + e.toString()); e.printStackTrace(); } } I don't know what I am missing or what I am overlooking but the output looks like this. Listen on 5225 Listen on 8776 Server ready We are slave's Listen on 8776 java.rmi.NoSuchObjectException: no such object in table at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255) at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:359) at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) at Main.main(Main.java:62) line 62 is this ::: Call ss = (Call) rr.lookup("FILLER");

    Read the article

  • Rails initializes extremely slow on ruby 1.9.1

    - by Ben Johnson
    I just got my rails 2.3.8 app running on ruby 1.9.1. To get into the console, start the webserver, anything that initializes rails, takes 3 - 4 times longer in ruby 1.9 than in ruby 1.8.7. I'm using ruby version managers so I can easily switch between ruby 1.9 and ruby 1.8.7. The speed difference happens in both production and development. I want to use 1.9 because its must faster once everything is running, but the startup time is so bad the app is timing out on Heroku on the first request. Any ideas why ruby 1.9 would be 3 - 4 times slower? I can't figure it out for the life of me.

    Read the article

  • Which third party website thumbnailing services do you use?

    - by Ben Delarre
    I've got a requirement for showing thumbnails of arbitrary websites. I need to be able to show small thumbnails (120px by 90px), and larger thumbnails of around 480px wide. I'll need to specify the queue and invalid placeholder images and preferably have a pingback when the queued images are processed so I can respond appropriately. I'd also need a simple API I can use either directly embedded in my HTML, or from a simple web request to queue the images. I've been looking at various services ranging from low-fi services, to large scale ones - here's some examples: www.bitpixels.com Uses Google AppEngine, seems like a prototype or a toy. Free! www.websnapr.com Tried using this, made a free account and requested a thumbnail. Waited a few minutes and refreshed a couple of times, and ended up having the account banned. Free is tricky yes, but if I can't try it out successfully I'm disinclined to pay. www.shrinktheweb.com Free account seems to be very quick. Lots of documentation on the site, and even covers local caching of the images to your own server (documentation mostly in PHP). Quality of thumbnails look good, and there appear to be sufficient options for setting thumbnail placeholder images and parameters for altering how the thumbnailing is done. Also supports large 'screenshots' of URLs - very useful for me. Discovered the PRO pricing is an à la carte menu, allowing me to select just the features I want and keep the monthly cost low. Excellent stuff, have decided to use this service. www.thumbalizr.com Good coverage of thumbnail sizes and control options - even allowing specification for browser width when thumbnailing. No ping-back, but I can live without that. Supports local caching of images with PHP API, would prefer .NET, but can port it if necessary. Looks like a fairly professional service but seems fairly expensive for the number of thumbnails you get to generate. apologies for lack of proper linking - spam protection! I'm not entirely convinced by any of them, and since this will be a long term service I'd like some stability and support. I'm willing to pay for the service, but I'd want something that fulfills most if not all of my requirements for that. I should also mention that we're hosted on Windows under IIS, so local solutions involving Xvfb and the like sadly can't be used for this project. So my question is: what services do you use? How have they panned out, are you happy with them?

    Read the article

  • How to treat an instance variable as an instance of another type in C#

    - by Ben Aston
    I have a simple inheritance heirarchy with MyType2 inheriting from MyType1. I have an instance of MyType1, arg, passed in as an argument to a method. If arg is an instance of MyType2, then I'd like to perform some logic, transforming the instance. My code looks something like the code below. Having to create a new local variable b feels inelegant - is there a way of achieving the same behavior without the additional local variable? public MyType1 MyMethod(MyType1 arg) { if(arg is MyType2) { MyType2 b = arg as MyType2; //use b (which modifies "arg" as "b" is a reference to it)... } return arg; }

    Read the article

  • How do I create an empty array/matrix in NumPy?

    - by Ben
    I'm sure I must be being very dumb, but I can't figure out how to use an array or matrix in the way that I would normally use a list. I.e., I want to create an empty array (or matrix) and then add one column (or row) to it at a time. At the moment the only way I can find to do this is like: mat = None for col in columns: if mat is None: mat = col else: mat = hstack((mat, col)) Whereas if it were a list, I'd do something like this: list = [] for item in data: list.append(item) Is there a way to use that kind of notation for NumPy arrays or matrices? (Or a better way -- I'm still pretty new to python!)

    Read the article

  • What is happening in this T-SQL code?

    - by Ben McCormack
    I'm just starting to learn T-SQL and could use some help in understanding what's going on in a particular block of code. I modified some code in an answer I received in a previous question, and here is the code in question: DECLARE @column_list AS varchar(max) SELECT @column_list = COALESCE(@column_list, ',') + 'SUM(Case When Sku2=' + CONVERT(varchar, Sku2) + ' Then Quantity Else 0 End) As [' + CONVERT(varchar, Sku2) + ' - ' + Convert(varchar,Description) +'],' FROM OrderDetailDeliveryReview Inner Join InvMast on SKU2 = SKU and LocationTypeID=4 GROUP BY Sku2 , Description ORDER BY Sku2 Set @column_list = Left(@column_list,Len(@column_list)-1) Select @column_list ---------------------------------------- 1 row is returned: ,SUM(Case When Sku2=157 Then Quantity Else 0 End) As [157 -..., SUM(Case ... The T-SQL code does exactly what I want, which is to make a single result based on the results of a query, which will then be used in another query. However, I can't figure out how the SELECT @column_list =... statement is putting multiple values into a single string of characters by being inside a SELECT statement. Without the assignment to @column_list, the SELECT statement would simply return multiple rows. How is it that by having the variable within the SELECT statement that the results get "flattened" down into one value? How should I read this T-SQL to properly understand what's going on?

    Read the article

  • Time Zones for different users

    - by Ben Sinclair
    I am creating a script that allows the user to choose their own timezone... If I am to make this work, how do I store dates in the database so that every timezone will read it, and show the correct date in their timezone? Do I store the date as GMT and then when a user with the timezone GMT +10 selected views the item within my script, I show that date in GMT +10 time? Is there a better way to do this? Examples would be great :)

    Read the article

  • Atlas style map index for static google map

    - by Ben Holland
    Hello, I'm using a static google map, but really this problem could apply to any maps project. I want to divide a map into multiple quadrants (of say 50x50 pixels) and label the columns as A, B, C.... and the rows as 1, 2, 3... Next I plan to do something like, 1) Find the markers which are the farthest north, east, south, and west 2) Use that info to to define the bounding boxes of each row and column box 3) Classify each marker by its row and column (Example Marker 1 = [A,2]) A few requirements, I don't know the zoom level because I let Google set the zoom level appropriately for me and I would rather not use an algorithm that is dependent on a zoom level. I do however know the locations of all of the markers that are shown on the map. Here is an example of a map that I would like to classify the markers for, static map example link. I found these which look like a good start, Resource 1, Resource 2 But I think I'm still in need of some help getting started. Can anyone help write out some pseudo code or post a few more resources? I'm kind of in a rut at the moment. Thanks! Much appreciated of any help!

    Read the article

  • Hibernate - PropertyNotFoundException: Could not find a getter for ...

    - by Ben Noland
    I have a class that looks like the following: public class MyClass { private String dPart1; public String getDPart1() { return dPart1; } public void setDPart1(String dPart1) { this.dPart1 = dPart1; } } My hibernate mapping file maps the property as follows: <property name="dPart1" not-null="true"/> I get the following error: org.hibernate.PropertyNotFoundException: Could not find a getter for dPart1 in class com.mypackage.MyClass at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:282) at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:275) at org.hibernate.mapping.Property.getGetter(Property.java:272) at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:247) at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:125) at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:55) at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:56) at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:302) at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:434) at It appears that hibernate doesn't like my capitalization. How should I fix this?

    Read the article

  • Problem in matlab with too many outputs

    - by Ben Fossen
    I am writing a Matlab program for simpson's rule I keep getting an error about to many outputs when the program gets to left_simpson = Simpson(a,c,(e1)/2,level, level_max); What is wrong with settinf left_simpson to Simpson(a,c,(e1)/2,level, level_max);? function Simpson(a,b,e1,level, level_max) level = level + 1; h = b - a; c = (a+b)/2; one_simpson = h*(f(a) + 4*f(c) + f(b))/6; d = (a+c)/2; e = (c+b)/2; two_simpson = h*(f(a) + 4*f(d) + 2*f(c) + 4*f(e))/2; if level >= level_max disp('h') simpson_result = two_simpson; disp('maximum levels reached') disp(simpson_result); if abs(two_simpson - one_simpson) < 15*e1 simpson_result = two_simpson + (two_simpson - one_simpson)/15; else left_simpson = Simpson(a,c,(e1)/2,level, level_max); right_simpson = Simpson(c,b,(e1)/2,level, level_max); simpson_result = left_simpson + right_simpson; end end

    Read the article

  • Higher than high-level web frameworks or CMS's?

    - by Ben
    I'm looking for options that allow very high-level web site development with these special characteristics: not requiring the user to program in a complex programming language not requiring the user to use GUI-like administration areas allow the user to "program" in a lightweight markup language The last point is not only about look and structure of the output but also about creating simple dynamic output. For example: listing pages fetching the content of other pages doing a site search and displaying its output dynamically show or hide parts of the page depending on login status Of course, I am not expecting a solution that provides the same possibilities like a Ruby, Python or PHP web framework. Rather I am looking for support of the "basics" that are common for web sites. Until now, I have found only one piece of software that fulfills these requirements but while it's free, it's not open source: BoltWire at http://www.boltwire.com/. Being open source is required.

    Read the article

  • cURL PHP: Connecting to Invoicing System

    - by Ben
    I am attempting to use cURL to connect to a page like this: https://clients.mindbodyonline.com/asp/home.asp?studioid=851 with the following code; <?php $curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_URL,'https://clients.mindbodyonline.com/asp/home.asp?studioid=851'); //curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2); curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1); curl_setopt($curl_handle,CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($curl_handle,CURLOPT_COOKIEJAR, '/tmp/cookies.txt'); curl_setopt($curl_handle,CURLOPT_COOKIEFILE, '/tmp/cookies.txt'); //curl_setopt($curl_handle,CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl_handle,CURLOPT_SSL_VERIFYHOST, false); curl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, 1); //curl_setopt($curl_handle,CURLOPT_HEADER, 1); //curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER, 1); //curl_setopt ($curl_handle,CURLOPT_POST, 1); $buffer = curl_exec($curl_handle); curl_close($curl_handle); if (empty($buffer)) { print "Sorry, The booking system appears to be unavailable at this time.<p>"; } else { print $buffer; } ?> I've fiddled the settings and the only three responses I get are; Nothing is loaded and the error message is called A redirect to /asp/home... locally Returns '1' and that's all Thanks for your time!

    Read the article

  • NSUserDefaults not present on first run on simulator

    - by Ben Collins
    I've got some settings saved in my Settings.bundle, and I try to use them in application:didFinishLaunchingWithOptions, but on a first run on the simulator accessing objects by key always returns nil (or 0 in the case of ints). Once I go to the settings screen and then exit, they work fine for every run thereafter. What's going on? Isn't the point of using default values in the Settings.bundle to be able to use them without requiring the user to enter them first?

    Read the article

  • Is there added overhead to looking up a column in a DataTable by name rather than by index?

    - by Ben McCormack
    In a DataTable object, is there added overhead to looking up a column value by name thisRow("ColumnA") rather than by the column index thisRow(0)? In which scenarios might this be an issue. I work on a team that has lots of experience writing VB6 code and I noticed that didn't do column lookups by name for DataTable objects or data grids. Even in .NET code, we use a set of integer constants to reference column names in these types of objects. I asked our team lead why this was so, and he mentioned that in VB6, there was a lot of overhead in looking up data by column name rather than by index. Is this still true for .NET? Example code (in VB.NET, but same applies to C#): Public Sub TestADOData() Dim dt As New DataTable 'Set up the columns in the DataTable ' dt.Columns.Add(New DataColumn("ID", GetType(Integer))) dt.Columns.Add(New DataColumn("Name", GetType(String))) dt.Columns.Add(New DataColumn("Description", GetType(String))) 'Add some data to the data table ' dt.Rows.Add(1, "Fred", "Pitcher") dt.Rows.Add(3, "Hank", "Center Field") 'Method 1: By Column Name ' For Each r As DataRow In dt.Rows Console.WriteLine( _ "{0,-2} {1,-10} {2,-30}", r("ID"), r("Name"), r("Description")) Next Console.WriteLine() 'Method 2: By Column Name ' For Each r As DataRow In dt.Rows Console.WriteLine("{0,-2} {1,-10} {2,-30}", r(0), r(1), r(2)) Next End Sub Is there an case where method 2 provides a performance advantage over method 1?

    Read the article

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