I think both are good. But I'm biased since I started on JS. I really do think it's super simple though, I think once you get into the libraries and frameworks it can get messy, but I don't think I've ever gone deep enough to know the horrors which make you cringe.
I started with C++. So my bias opinion is to start with that. You can use just really simple stuff, or go more advanced. And unlike Java, you don't have to start out with classes.
I have a file on my server which contains a running output of a script. This file is constantly changing and fluctuates in size between 0 - 1Mb. Now I want to take this file and make it viewable from the web. Currently I am using jQuery to get the file then I set a textarea's value to be the file...
AIM: Best practices and design pattern usage / Correctness in unanticipated cases
Hi all, I have been busy building my first database using SQLAlchmey. I am concerned the design of my custom API query can become a cause for error. The tables are declarative, some have relationships, and it is my...
To remove vowels from a string
I have implemented the following code in c++ for the same:
#include<bits/stdc++.h>
using namespace std;
int main()
{
string s;
string l="";
cin>>s;
for(int i=0;i<s.size();i++){
switch(s[i])
{
case 'a':
case 'e':
case 'i':
c...
I've so many languages on my to learn list. One reason I like this place is sometimes it provides the semblance of direction I often lack being largely self taught. Education paradox super frustrating.
Some stuff takes a while. A lot of the answers on here require a fully study, and going back over it time and time again, I favorite them in that case.
I don't know how bad, because I actually worked on the material hard.
I did the book like I was doing it myself, and just turned in the material required (which was posted after I had already work through the book chapter).
Specifically, why you made it a tag, is there a reason, and does the imply that there's more than one? I remember seeing it a while ago, probably when we first encountered.
PHP and Javascript
This is a polyglot:
You can run this code in both languages:
if("\0"=='\0')
{
function printf(){
$b=Array();
$a=$b['slice']['call'](arguments);
$a=$a['join']('');
console.log($a);
return $a.length;
};
function strtoupper($...
Incidentally, I thought I upvoted it before, but there you go, hehe.
@SimonAndréForsberg somebody pin that! Good grief I've spent more time trying to get people to press that button than actually coding in the last 5 years.
I am trying to add the values of result set to a list. But all the values in my list are getting overridden by the most recent one. So at the end of the loop when I am returning the list it has all duplicate items. how to correct it.
public List getTransactions(){
try (Connection connection = t...
It's easy to look at numbers; numbers tell us that billions of developers have been helped by what we built. That alone is very warming and makes us feel exceptionally great about what we're doing, wouldn't it be nice to take a little time on a Friday to share some stories that the numbers can't ...
Improving working code is a better fit for Code Review, I would recommend you to move the question there, — Keppil43 secs ago
If you have working code, the Code Review stack exchange is a better place for your question. However, before posting there, I suggest you improve your title (maybe, "Palin Pairs program improvement"?) and remove the unnecessary bolding. The more effort you put into your post, the more likely it is that you'll be helped. — Trobbins56 secs ago
I have an ajax request from a page where the user is being asked to enter their date of birth. The request url file has the code below and works all good. However, I'll be rewriting all mysql/mysqli functions used on the same website and this is generally how I use prepared statements. Should I a...
In an array of strings 'a' having 'n' strings i have to select the Palin Pairs from the given strings .for ex for input 3 bba abb abb Output=2
I am getting correct output but want to reduce time complexity....what other logic or enhancement I can use to optimize the code
import java.io.Buffered...
@EBrown lots of specialized code that I'm not familiar with (XNA). All I could do is throw stones at you for omitting braces and not using var, but I won't
As part of learning Rails framework, I have small app in progress. Basically idea is, user can create IP address, define is it in use, to which server is assigned, which user is it using and role of IP address in web hosting environment. I have 3 models, IpAddress, IpAddressRole and IpAddressUser...
Properties need UI annotations, validation annotations and DB annotations and you just know there is bound to be a circular dependency at some point between your projects
Few points:
Try to avoid long or nested if/else
Sub-divide tasks in smaller functions(clean and more readable code + easier unit testing)
Minimize variable scope(try to declare variables in the scope where you really need them)
Think about Exception in context of your business domain, may be u...
Before you clarify what "better" means for you this question is likely "opinion based"... Please consider clarifying what kind of improvement to algorithm you hope to find OR possibly move question to codereview site. — Alexei Levenkov53 secs ago
I'm working on a plain Ruby class within a Rails application.
For the total_leg_count method---is that the best way to go about achieving what I want? I feel like there's potentially a better way.
class AircraftTimeReport
...
def total_leg_count
count = 0
active_flights_within_tim...
I wanted an easy way to augment objects, by adding functionality from any other object(s). More importantly, I needed a way to augment the object from multiple sources in a clean one-line solution.
The inheritance is done with this:
function extend(proto, args){
this[proto.id] = Object.cre...
This is one of the best examples of codeless answers I've seen in a long while. ++ for beating me to the interface:class ratio in regards to the IoC container. — RubberDuck20 secs ago
Ugh... @Mat'sMug why? Nobody cares what the fox says. Honest. =;)-
Swift: Class does not implement its superclass's required members
Hanging out in The 2nd Monitor on the Code Review chat has it's benefits, one of them was the discovery of this gem by nhgrif. If you read through the question, and all the comments, it tells it's own story:
The OP had writte...
@Hosch250 I really thought I wasn't going to be the smartest guy in the room when I took this new job. So far, I think I was wrong, but at least I'm learning new things.
I found out something cool you can do yesterday, did you know you could use execute like this?
if object_id('tempdb..#test') is not null drop table #test
begin transaction
create table #test ( foo varchar(max) )
insert into #test values ('hello'), ('world')
declare @query varchar(max) = 'select * from #test'
declare @table table ( bar varchar(max) )
insert into @table (bar)
execute (@query)
select * from @table
rollback transaction
I'm guessing you could also do that with sprocs if they return tabular data
It seems that your code currently works, and you are looking to improve it. Generally these questions are too opinionated for this site, but you might find better luck at CodeReview.SE. Remember to read their requirements as they are a bit more strict than this site. — Kyll45 secs ago
The day StackOverflow made me understand open source
The Details
The Question: How to close PST file in Java?
My Answer: http://stackoverflow.com/a/27164871/2422776
The Story behind them
This isn't an especially highly voted, or even a very popular question, nor is my answer, but it's a great e...
It seems that your code currently works, and you are looking to improve it. Generally these questions are too opinionated for this site, but you might find better luck at CodeReview.SE. Remember to read their requirements as they are a bit more strict than this site. — Kyll54 secs ago
I wanted an easy way to augment objects, by adding functionality from any other object(s). More importantly, I needed a way to augment the object from multiple sources in a clean one-line solution.
The inheritance is done with this:
function extend(proto, args){
this[proto.id] = Object.cre...
I have a large table of text items.
When I click on a class I would like to add a certain class to it, but also remove that class from previously clicked items.
I don't want to have to scan through each item to check if it is there and remove it so I came up with this although I feel it may be ...
Since rsync lacks compression and I'm not a big fan of rdiff I thought I try my own little backup script. Since I'm very inexperienced with file management in python I'm sure there is lot of room for improvement...
The script creates the entire folder structure within the backup folder and then ...
Every time I run across a C# class with a GetEnumerator function that does not implement IEnumerable (or better, IEnumerable<T>), I die a little inside :|
An answer I think deserves recognition is this:
Is VBA an OOP language, and does it support polymorphism?
As a kid, I'd written many VBA scripts for little things like changing settings files out, and from I what had seen, I thought VBA was OOP, and despite that the answer wasn't to a question ...
@200_success I'm guessing you mean that as a good thing, right? I don't know a thing about Ruby but if it's anything like Groovy, must not be bad at all
I've been applying functional programming to my JS code with a heavy emphasis on using underscore's compose along with a simple map function which looks like this:
// map allows me to compose better than _.map which takes the arr
// arg first instead of last
let map = (f) => (xs) => xs.map(f);
...
SO is generally meant for problems or errors with code, I think its a better fit to ask your question at Code Review which is the SE place for reviewing code and giving improvement tips :) — DragonSamu45 secs ago
> Internet companies across China are embracing programming cheerleaders, pretty, talented girls that help create a fun work environment. Their job includes buying programmers breakfast, chitchatting and playing ping-pong with them.
@Phrancis About making sure you tick answers that help people out