Quantcast
Channel: User Shripad Krishna - Stack Overflow
Browsing latest articles
Browse All 37 View Live

Comment by Shripad Krishna on Peculiar Map/Reduce result from CouchDB

Exactly. That was what I was doing anyways (sending the result to client to calculate avg). However, this will be helpful in a lot of places. Need some refactoring in my other views now :)

View Article



Comment by Shripad Krishna on Peculiar Map/Reduce result from CouchDB

Ah! This is nice. Works for most cases. However, in my case, i'm storing precomputed value and count and would just need to find the average. So I do the same, but for average. To elaborate: for a...

View Article

Comment by Shripad Krishna on Socket.IO Authentication

aha! That link is really good. This is outdated (uses Socket.IO 0.6.3)! Essentially the same concept. Fetch cookie, check in session store and authenticate :)

View Article

Comment by Shripad Krishna on How can I scale socket.io?

You can use 0.6 with something like HAproxy though. You can't use roundrobin to load-balance polling transports but you can balance those based on the source(ip affinity) or even go for cookie based...

View Article

Comment by Shripad Krishna on HAProxy + WebSocket Disconnection

@Diego you can use any version > 1.4

View Article


Comment by Shripad Krishna on Can I have sticky sessions with HAProxy and...

It doesn't matter which server is hit provided your auth store is separated from the app. Hopefully you are not using memory as your store for auth sessions. Use something like Redis to store the auth...

View Article

Comment by Shripad Krishna on Javascript - Fastest way of copying an array...

I know this is very late but was curious. Why not just var dst = src.concat() ? I think this is probably the fastest way to clone an array. This isn't deep copy though. For deep copy looping is the...

View Article

Comment by Shripad Krishna on What's the most efficient node.js inter-process...

UDP is unreliable (there is duplication of packets, packet ordering is not guaranteed) and is not fit for the scenario he describes. Its good for stuff like hearbeats, DNS, streaming or implementing...

View Article


Comment by Shripad Krishna on sql practice query issue

Why are some omitted? Try this: select winner, subject, count(subject) from nobel group by winner having count(subject) > 1 and you'll see that there are many more (ex: International Committee of...

View Article


Comment by Shripad Krishna on Which rule to enable to throw "Module has no...

@AdrianDiaz No clue why this isn't the default behaviour. It should be though.

View Article

Comment by Shripad Krishna on OAuth consent screen - ability to remove...

Also for Step 8, you need to ensure you have set the core/project property. Else you'll end up getting the following error: "ERROR: (gcloud.alpha.iap.oauth-brands.create) Error parsing [project]. The...

View Article

Answer by Shripad Krishna for Heroku Rails Internal Server Error

Also, heroku rake db:sessions:create. Create your sessions table.Migrate too.heroku rake db:migrate Cheers! :)

View Article

Answer by Shripad Krishna for Rails - How to differentiate an action call...

You do not mention the javascript library that you are using. This solution is jquery based. Its quite easy to do what you want using just one action destroy. But i would suggest a different technique...

View Article


Answer by Shripad Krishna for Inheriting through Module.exports in node

You can also do the following (say this code is defined in app.js):module.passwordHash = require('password-hash');app.get("/signup", routes.signup);in routes.signup:var passwordHash =...

View Article

Answer by Shripad Krishna for How can I pass a variable while using `require`...

This question is similar to: Inheriting through Module.exports in nodeSpecifically answering your question:module.client = require('./database.js').client;var user = require('./user.js');In...

View Article


Image may be NSFW.
Clik here to view.

Peculiar Map/Reduce result from CouchDB

I have been using CouchDB for quite sometime without any issues. That is up until now. I recently saw something in my map/reduce results which I had overlooked!This is before performing a sum on the...

View Article

Answer by Shripad Krishna for Being both event-driven servers, why node.js...

Cross-posted from NodeJS google groups:Okay i'll try my best to answer your question:Nginx is a web server that only proxies requests. Now if you take the example of Nginx+php+fpm or Nginx+wsgi+ruby...

View Article


Answer by Shripad Krishna for What's the most efficient node.js inter-process...

Why not use ZeroMQ/0mq for IPC? Redis (a database) is over-kill for doing something as simple as IPC.Quoting the guide:ØMQ (ZeroMQ, 0MQ, zmq) looks like an embeddable networking library but acts like a...

View Article

Answer by Shripad Krishna for node.js multi room chat example

I realized that you have not yet received a solution to your issue yet. Suggest looking at this question where i have provided the answer:node-websocket-server: possible to have multiple, separate...

View Article

Answer by Shripad Krishna for Moving scatter plot circles with context...

I have updated the fiddle at: http://jsfiddle.net/PyvZ7/7/Don't forget to apply clip-path to the group. Your code used select instead of selectAll. So the transforms were not applying to all the...

View Article

Answer by Shripad Krishna for Load and execute external js file in node.js...

Just do a require('./yourfile.js');Declare all the variables that you want outside access as global variables.So instead ofvar a = "hello" it will beGLOBAL.a="hello" or justa = "hello"This is obviously...

View Article


Answer by Shripad Krishna for Can I access a cookie from Socket.io?

client.request.headers.cookie leads to race conditions as the cookie always points to the last logged in user.Please see: Socket.IO Authentication.

View Article


How can I disable _moz_resizing?

I am using nicEdit editor and I have added my own custom image resizing script to it. But I want to disable the default _moz_resizing that appears in Firefox. I wanted to have finer control over the...

View Article

How do i add the authenticity token?

I recently switched to Google closure for a new project. I am having trouble adding the authenticity token to the headers in a ajax call. How do i go about it?My Ajax snippet (using goog.net.XhrIo...

View Article

Pubsubhubbub on Rails. How to extract the raw POST body contents from the...

I am having trouble setting up a pubsub enabled subscriber app using rails. I have currently subscribed to the open hub pubsubhubbub.appspot.com and am receiving pings to my application's endpoint. (as...

View Article


Canvas and HTML5: Supported Browsers?

I am looking at using HTML5 Canvas element for my upcoming project. I want to know what all major browsers (including the versions!, cos i know that the latest builds do support canvas) support the...

View Article

Answer by Shripad Krishna for Node / Express: EADDRINUSE, Address already in...

LinuxRun ps and determine the PID of your node process.Then, run sudo kill PIDWindowsUse tasklist to display the list of running processes:tasklist /OThen, kill the node process like so (using the PID...

View Article

JQuery LiveValidations with Rails

I am using this plugin: https://github.com/augustl/live-validations/wiki to check if the form field entered is valid or not. How do i disable the live validation for keypress and instead make it only...

View Article

Jquery AJAX: How to display the Flash error message when validation on the...

I am using the Jquery form plugin to submit the form via ajax. I have set up validations on the server side in my models. Now when the validation fails i want to display the same flash[:error] message...

View Article



Answer by Shripad Krishna for Jquery AJAX: How to display the Flash error...

I found this.https://github.com/augustl/live-validations/wikiIf anyone has a better solution, please do post, and I will accept it.

View Article

How do I get swfupload to return image URL after upload?

I am facing a really weird problem. I am using swfupload to upload multiple images to the ImageShack server. I am also storing the returned URLs in the database. How do I show the URL returned from...

View Article

Answer by Shripad Krishna for How do I get swfupload to return image URL...

Oh, it was simple. uploadSuccess returns serverData!.bind('uploadSuccess', function(event, file, serverData){ var item=$('#log li#'+file.id), fetchedfile; item.find('div.progress').css('width',...

View Article

Image may be NSFW.
Clik here to view.

Which rule to enable to throw "Module has no exported member" in ESLint CLI...

I get a Module "x" has no exported member "y" in my editor (Visual Studio Code) whenever I change an exported member name while refactoring. This is very convenient as it helps me know which files have...

View Article


Answer by Shripad Krishna for OAuth consent screen - ability to remove...

@Samuli Asmala's answer is correct. However, Step 8 will sometimes throw the following error:ERROR: (gcloud.alpha.iap.oauth-brands.create) Error parsing [project].The [name] resource is not properly...

View Article

Answer by Shripad Krishna for Using Python 3.10, but Pyright LSP throws error...

To solve this, create a pyrightconfig.json in your project root, if you haven't already, and set the pythonVersion to the version of Python you are using. Must be 3.10 and up.Example pyrightconfig.json...

View Article

Using Python 3.10, but Pyright LSP throws error "Pyright: Alternative syntax...

Pyright LSP throws the following error:Pyright: Alternative syntax for unions requires Python 3.10 or newerwhen using unions while typing Python code. Example:class Example: def method(self) -> str...

View Article


Answer by Shripad Krishna for Tags hovering like Stack Overflow using jQuery

This should do the work.http://jsfiddle.net/5GD6r/4/I have coded it almost exactly the way Stack Overflow does. I built upon the button already created by @Reigel.HTML:<a href="#" class="post-tag"...

View Article

Browsing latest articles
Browse All 37 View Live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>