Sense

1

votes
1

answer
58

views

Socket Exceptions due to density in Nodejs with WebSocket

I have node js server that is connected the 10k-14k client with WebSocket. When client count is up to above about ~14k, new clients begin to get the exception that: 'System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it' As far as I know, this...
Qwer Sense
1

votes
1

answer
481

views

Best way to keep WebSocket connection alive in Akka HTTP?

If there is no message sent or received, the connection is closed after one minute. I don't want to continuously send a text message to keep the connection open like this: keepAlive(maxIdle = 10.seconds, () => TextMessage.Strict('Keep-alive message') Is there anything in Akka HTTP that provides the...
Qwer Sense
18

votes
7

answer
3k

views

Is it possible to attack a user password with known salt

I've been told that email is a bad salt, because it's not unique and connected to the user. And if a user uses the same password on 2 sites, there will be equal hash. So, what's wrong with it? what is attack scenario? Suppose we have both hash and salt. So, other site has the same hash in their dat...
Your Common Sense
19

votes
3

answer
2.2k

views

Is it possible to make MySQL use an index for the ORDER by 1 DESC, 2 ASC?

I have a materialized path-driven bulletin board. It is using the following query to get the messages in order, SELECT * FROM Board ORDER by root DESC, path ASC LIMIT 0,100 where root is an id of the root message for the thread, and path is a materialized path. However, none of my efforts to make th...
Your Common Sense
21

votes
7

answer
43.7k

views

file_get_contents returns empty string

I am hesitated to ask this question because it looks weird. But anyway. Just in case someone had encountered the same problem already... filesystem functions (fopem, file, file_get_contents) behave very strange for http:// wrapper it seemingly works. no errors raised. fopen() returns resource. it r...
Your Common Sense
5

votes
5

answer
448

views

ASP.NET MVC application to learn from. [closed]

I'm learning web development with ASP.NET MVC framework as I'd like to create os forum engine. Basic stuff and technology can be learnt from books but it would be useful to check real applications. Can you please advise good examples of real ASP.NET MVC solutions with good code and practices, intere...
make_sense
5

votes
2

answer
5.4k

views

How to make mysqli throw exceptions using MYSQLI_REPORT_STRICT?

There is a function in mysqli, called mysqli_report(), which looks like a counterpart for PDO's setAttribute() method with its ERRMODE_* constants. The manual says: MYSQLI_REPORT_STRICT Throw mysqli_sql_exception for errors instead of warnings So, having PDO::ERRMODE_EXCEPTION in mind, i tried this...
Your Common Sense
2

votes
2

answer
1.4k

views

How to implement Ping/Pong request for webSocket connection alive in javascript?

I use websocket in javascript. But the connection close after one minute. I am wondering somethings: 1- Is not Websocket naturaly providing with Ping/Pong messages not to close the connection? I think it have to. Otherwise what is the difference between websocket and TCP connection? 2- If I have to...
Qwer Sense
22

votes
10

answer
7.6k

views

How to start on scala [closed]

I am .NET developer and I'd like to broaden my horizons a bit and after checking out modern tendencies decided to try Scala. Can you please advise a good strategy to start on it? Should I learn Java first? What source or handbook should I read? Is there any OS projects to practice Scala and grow on...
make_sense
2

votes
3

answer
1.5k

views

How ASP.NET form authentication works: recognising cookies from request

I am reading on form authentication in ASP.NET and cannot understand some moment: James enters a username-password, they are saved in the db. A cookie from username is created, encrypted and attached to a response. As I understand then, when we get a request we need to recognise that cookie receive...
make_sense
2

votes
1

answer
493

views

To parse SQL with regex, excluding quoted literals

For my DBAL I need to parse supplied SQL [mysql dialect, specifically] string to find all the placeholders. But, of course, I don't want to parse any placeholder-like combinations, that occasionally may occur inside of quoted literals - either single quoted or double quoted or backtick-quoted. Say...
Your Common Sense
6

votes
11

answer
1.4k

views

Difference between GOTO and THROW?

Many people accused me recently for just mentioning a single word - 'goto'. It makes me wonder, why it is considered such a nasty word. I am aware of several previous discussions on the topic, but it doesn't convince me - some of the answers just says 'it's bad' not even trying to explain and some b...
4

votes
3

answer
1.6k

views

Are constants as evil as global variables and singletons?

I've heard many times on this forum that using global variable is a dead sin and implementing singleton is a crime. It just came to my mind that old good constants bear all the features of these dishonored practices: they are globally accessed and no doubt they introduce globallest state ever. So,...
Your Common Sense
3

votes
2

answer
1.8k

views

How to completely turn off vim's abilty to recode files?

Every encodings related question I've found is about how to recode files. However, mine is quite contrary one - is it possible to make vim not to recode files at all? (and how, if so?) Sometimes it is writing [converted] at the status line, and always miss. However, I have my terminal set at the sam...
Your Common Sense
3

votes
1

answer
283

views

How to create a custom form in Symfony 2

I have three entities : Service, Group, Agent. Service => oneToMany => Group => oneToMany => Agent Each of these entities already have a form. By the way, I would like to create a custom mergeForm which will contains a select field Service to choose and a select field Groupe in order to merge some...
Sense
3

votes
2

answer
120

views

Event to subscribe if I need to log the user's last activity time?

I need to log the last user's activity time, every page load or ajax call counts. I suppose I need to subscribe to some event, But I just have no idea to which one. InteractiveLoginEvent mentioned in this answer, to my understanding is fired in the event of the interactive login only. But, given a...
Your Common Sense
13

votes
11

answer
13.3k

views

Insert/update helper function using PDO

I have a very simple helper function to produce SET statement for traditional plain mysql driver usage: function dbSet($fields) { $set=''; foreach ($fields as $field) { if (isset($_POST[$field])) { $set.='`$field`=''.mysql_real_escape_string($_POST[$field]).'', '; } } return substr($set, 0, -2); }...
Your Common Sense
13

votes
3

answer
7.1k

views

Is mysql_real_escape_string() broken?

Some people believe that mysql_real_escape_string() has some flaws and cannot protect your query even when properly used. Bringing some fossilized articles as a proof. So, the question is: is mysql[i]_real escape_string() totally unacceptable? Or is it's still possible to use this function to create...
Your Common Sense
2

votes
1

answer
86

views

How to do sequentially and conditionally reactive programming?

I want to execute two or more operation as sequentially and conditionally.The operations should execute sequentially. The following example already can do this. But I can not do that. According to the result of the first operation, I want to decide whether or not the second operation should work. Ac...
Qwer Sense
1

votes
3

answer
187

views

How to use the rule validation in FormRequest class?

I have a Company, where I like to validate the update request. Until now I validated the request inside the update() action but I like to move this to its own CompanyUpdateRequest. In the validation I check of the uniqueness of the tax number but of course I like to allow the same tax number for th...
common sense
7

votes
3

answer
1.7k

views

What is password strength considered enough for use with password_hash function?

As far as I understand, one of the most important features of the new PHP password hashing extension (or bcrypt in general) is algorithm's speed, which slows brute-force attack method a lot. But still it runs at some speed, surely enough for the dictionary attack and to brute-force weak passwords, [...
Your Common Sense
2

votes
2

answer
1.2k

views

Type mapping in Doctrine 2 DBAL

I am using only the DBAL part of Doctrine for my project. So I have to care over the mapping myself. I figured out that Doctrine remaps database types to a generic PHP type as you can read here [1]. Now I came across the fact that Doctrine maps the DB type TinyInt(4) to Boolean. According to the My...
common sense
1

votes
3

answer
5.7k

views

Apply half-transparent watermark to image in Node.js

I have an image and would like to apply a watermark (another image) over it using Node.js. The requirement is watermark shouldn't be a solid picture (what I can do with gm library's draw()) but half transparent. Can you please advise any tool to use?
make_sense
3

votes
1

answer
1.3k

views

How to determine if the guest web browser supports html5 <video>

I am currently deploying a video platform. Videos are currently listed with the JWPlayer's plugin integration. I would like to set by default the html5 tag, only if the guest's web browser supports it. How can I do to check if the .flv (encoded video format) is supported by the tag of the guest's...
Sense
3

votes
1

answer
740

views

How to make Zend Soap Server autodiscover basic xsd types?

I am working on the Zend-framework-based Soap server, using AutoDiscovery to create wsdl file. It works all right for the either basic integers and strings or complex types based on these two primitives. However, I am unable to define my variables as date type Here is an example data file
6

votes
2

answer
1k

views

What are Mysqli's enhanced debugging capabilities?

On the mysqli overview page there is a list of benefits, intended to lure me into mysqli realm. I don't even understand the meaning of many of them, but one is really interesting to me: enhanced debugging capabilities. According to my experience, prepared statements (which considered to be main an...
Your Common Sense
8

votes
2

answer
735

views

The way PDO parametrized query works

PLEASE READ THE QUESTION CAREFULLY. It is not usual silly 'my code doesn't work!!!' question. When I run this code with intended error try { $sth = $dbh->prepare('SELECT id FROM users WHERE name INN(?,?) '); $sth->execute(array('I'm','d'Artagnan')); } catch (PDOException $e) { echo $e->getMessage()...
Your Common Sense
2

votes
1

answer
17.6k

views

What are the differences between On-net calls and Off-net calls?

What are the differences between On-net calls and Off-net calls? How could I make international call under On-net call?
high sense
1

votes
7

answer
117

views

Is it better to include() or to call functions?

I'm currently developing a Web platform app in HTML and PHP stuff. I have to develop a registration/login system, and I'm asking myself a question. I wrote a login form, and I would like to know if is it better to store it in a php function (with a simple echo('all my login form')) or to store it in...
Sense
15

votes
2

answer
516

views

PChart linear chart image quality

I am using PChart to create linear charts. Everything goes well beside the quality of the actual lines drawn. Of course, antialiasing is not turned off, and even explicitly turned on. Here is an example of the actual image, which looks quite ugly with all these steps. Is there a way to make the li...
Your Common Sense
3

votes
2

answer
488

views

Complete protection against mail-injection

Suppose we're sending trivial feedback and going to make these fields dynamic: sender name sender e-mail subject message body would be this PHP code enough to protect us from all kinds of mail-injections? //sanitizing email address if ($email = filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)){ //...
Your Common Sense
3

votes
1

answer
669

views

On error a Symfony application hangs with browser continuously loading the page

As it turned out, this problem appears only when there is an error in the code. A code without errors runs smooth, but as soon as there is even an 'undefined index' error, the whole server hangs, seems falling into sort of an endless loop. The environment is Windows, Apache 2.4 from ApacheFriends...
128

votes
5

answer
152.4k

views

Compiling dynamic HTML strings from database

The Situation Nested within our Angular app is a directive called Page, backed by a controller, which contains a div with an ng-bind-html-unsafe attribute. This is assigned to a $scope var called 'pageContent'. This var gets assigned dynamically generated HTML from a database. When the user flips to...
giraffe_sense
0

votes
1

answer
1.3k

views

JSON Web Token vs Bearer Token in Web Api

I'm using Asp.Net Web Api I'm confused. I already use JSON web token. I understood that. Knowns classic JSON web token. Header, payload, signature, Self-contained. The client can see claims data. But Bearer Token is what? Bearer Token is self-contained too. We can be accessing token's data through B...
Qwer Sense
670

votes
17

answer
349.1k

views

Join vs. sub-query

I am an old-school MySQL user and have always preferred JOIN over sub-query. But nowadays everyone uses sub-query, and I hate it; I don't know why. I lack the theoretical knowledge to judge for myself if there is any difference. Is a sub-query as good as a JOIN and therefore is there nothing to w...
Your Common Sense
3

votes
1

answer
46

views

aggregation functions with different where condition sentence

I have SQL query give table of 6 columns from mytable: TotalNumberOfRecords TotalDurationOfCalls AvgdurationPer TotalCallednumbers TotalCallednumbers Ratiocalledtoallcalls these columns resulted of aggregation functions. but each one have different where condition sentences in order to select fro...
high sense
56

votes
4

answer
30.8k

views

How to squeeze error message out of PDO?

I can't seem to get any error message from PDO: #$dbh->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING ); try { $sth = $dbh->prepare('@$%T$!!!'); print_r($sth); print_r($dbh->errorInfo()); } catch (PDOException $e) { echo $e->getMessage(); } It is giving out only: PDOStatement Object ( [queryS...
Your Common Sense
1

votes
1

answer
404

views

Stream live video to MediaPLayer

I'm trying to implement a video streaming between two devices with Android(API 9+) connected to the same WiFi network. First device operating as a small http server that records the video from the camera using MediaRecorder. The second device is trying to get the data using the method setDataSource...
30

votes
4

answer
911

views

How can I title a question about a problem that doesn't have a common description?

Recently I wrote a self-answered question, addressing one certain problem, that causes a lot of questions on Stack Overflow that usually get wrongly closed with incorrect dupe target. But got a message from a moderator, saying: I appreciate that you're trying to setup some authoritative dupe target...
Your Common Sense