« first day (995 days earlier)      last day (3320 days later) » 
00:00 - 23:0023:00 - 00:00

00:00
RELOAD! There are 1705 unanswered questions (94.4481% answered)
00:48
0
Q: Web Scrape, and Save To SQLite DB

user95602Now I am pretty crappy at software architecture. I think I was able to make this relatively concise. Please, any input is helpful! var cheerio = require("cheerio"), request = require("request"), sqlite3 = require("sqlite3").verbose(), colors = require("colors"),...

01:18
... Sure, the peer review of RNCryptor in all it's languages could be better but that is not easy, even mainstream libraries like OpenSSL had major issues such as Heartbleed. IMO suggesting RNCryptor is a win for the developers asking here, they will be much better off than writing their own implementations. Is RNCryptor is not the answer for all uses and/or developers, particularly knowledgeable developers will probably write their own solution that more closely meet their one requirements—and may well contain similar errors. Personally I have my security code reviewed by a SME. — zaph 7 secs ago
@Mat'sMug do you follow ?
1
Q: Roman numerals with ANTLR

rookieI've written a simple interpreter with ANTLR for evaluating Roman numerals. Here's the contents of the grammar file (Roman.g4). grammar Roman; root : (oneThousand)* hundreds? tens? units?; // --- I, II, III, IV, IX or V VI, VII, VIII units : one ((one)* | five | ten) | five (one)*; // ---...

Cool question ^.
Hi, @RubberDuck. You've been around more lately.
How are things going?
Going all right. Trying to work less.
Would you mind reviewing my Clone PR?
I didn't provide unit tests because I would need to mock and parse a project, which doesn't work now.
I added it to the issue about creating the tests.
I can do it early in the morn. Heading to bed shortly. But yeah. Sure. I can pull it down in the morning.
01:23
NP. I won't be here then - going up north to bird.
To bird?
quack
Tweet
@Hosch250 - if you head north of the border, I'll take you to some snowy owls....
@rolfl We usually see them at the MSP airport, although we've not had any luck this year (two tries so far).
But no, we are only going to the Sax-Zim bog.
Hi, @scottyu.
Heh, my mom's a birder, but her friends are worse..... the one has just passed 7,000 birds world-wide.
Another has photos of >5000 species.
01:29
Interesting.
Yeah, my mom walking through the marsh areas in central ethiopia to see a shoebill. She's not that sort of person, but will crawl through mud to see an angola pita
We saw a Wood Stork a few years ago, which is very rare for MN.
Oh! Bird watching
Funny how, having lived in a few continents, that these things make people feel.... like some folk saw some cattle egret a few months back near Toronto....
We call that hiking where I'm from. =P
01:33
Big rare sighting ..... of a bird I used to chase when cow-tipping in South Africa
I have not seen a wood-stork, but I thought it was something else.
01:48
Hi.
How's it going?
If the code works as-is, it should be posted at codereview.stackexchange.comcricket_007 19 secs ago
I don't spend much time here in the 2nd Monitor anymore; I'm kinda busy...
02:14
0
Q: Creates a menu and sidebar in Google Spreadsheets

BlexyIn an effort to make my code more testable, I'm trying to make use of constructors and prototypes. Here is a working Google Apps Script (GAS) for creating a new submenu under the Addon main menu in a Google Spreadsheet, and if a user clicks the 'Show' menu item, a sidebar will appear. var UI = ...

02:34
@rolfl Every owl is a snowy owl in this weather
-1
Q: Code for cards and finding probability

Bobuthis program is supposed to find the probability of a another player having pockets pairs (Ex: 8 of Diamonds and 8 of Hearts) given that one player already has a pair in hand. I had both the Cards array list and the diffNum array list functioning but did not have the process repeating. Once addin...

0
Q: Save and find methods for different JavaScript/Parse objects

janoChenThis file defines the save/find methods for the Document object and exports it: store/document.js import Parse from 'parse' import _ from 'lodash' Parse.initialize('APP_ID', 'CLIENT_ID') const Document = {} const ParseDocument = Parse.Object.extend('Document') Document.save = (json) => { c...

03:41
0
Q: Amazon ASIN lookup tool

Chris EmbryI am trying to code my site,I am needing help with trying to figure out a way to be able to have a way for sellers to enter in there ASIn via a search feature and then after they enter in there ASIN.It fills in the form with the matching info for that ASIN I am new to coding something this comp...

04:01
If there is a mod around, these comments here should be cleaned up. I'll flag one of them but there are many
 
1 hour later…
05:10
0
Q: Listing all primes up to a given limit

zzgI started writing Rust by doing a simple program that will print all prime numbers until it reaches the upper bound that is provided through standard input. Here is my code use std::io; fn main() { println!("Enter a number: "); let mut limit = String::new(); io::stdin().read_line(&m...

-1
Q: Loading Barbells with Weight

Kitty KateI'm trying to program in java an algorithm that will list all of the ways that different weights can be added to a barbell to achieve the desired total weight. The weight sizes will be supplied in an array: possibleWeights = {1, 8, 20, 40} or possibleWeights = { 2, 6, 10, 25 }. The point is the...

05:23
... Sure, the peer review of RNCryptor in all it's languages could be better but that is not easy, even mainstream libraries like OpenSSL had major issues such as Heartbleed. IMO suggesting RNCryptor is a win for the developers asking here, they will be much better off than writing their own implementations. RNCryptor is not the answer for all uses and/or developers, particularly knowledgeable developers will probably write their own solution that more closely meet their one requirements—and may well contain similar errors. Personally I have my security code reviewed by a SME. — zaph 59 secs ago
0
Q: NodeJs Code Optimization

Dhiraj AggarwalBelow code is Reading text from web using WebDriver element and writing data in Json file. I just want you to optimize the below snippet as I am new to NodeJs. I had to used if-else(to write only last line in the Json file) just because of Asynchronous behaviour of nodeJs otherwise I was trying ...

06:02
monking
06:14
0
Q: Fading in and out particles

Elegant.ScriptingI'm trying to make a basic particle emitter in JavaScript with canvas. I have the basics down, but one thing I can't figure out is how to smoothly fade in the particles after creation, and fade out the particles before deletion. Here's a basic version of my Particle object on creation: { al...

06:42
0
Q: How to Authorize an entire ios Swift app for an API, not just a singular resource owner

AndoI feel like I must be missing something simple here, but I can't find any solutions anywhere. I'm linking an ios Swift app to an api that requires oauth2 to access. The api library has no user-owned resources. All visitors to the api have access to all collections, items, contributors, etc. I've ...

07:03
0
Q: JavaScript text justification

dpg5000I'm constructing a JavaScript function that takes a single-lined string of text and a length variable that is the expected justification width (longest word will never exceed this width). Here are more requirements: use spaces to fill in gaps between words each line needs to contain as many wor...

07:53
0
Q: Background task with instant abort capability in c#

user1306322I'm looking for a better way to make a background operation with abort/cancel support. Right now I use this approach: Task.Factory.StartNew(() => { var cts = new System.Threading.CancellationTokenSource(); var ct = cts.Token; try { var t = System.Threading.Thread.Cur...

08:17
this might be better placed over on codereview.stackexchange.comtom 13 secs ago
0
Q: Aggregate wrapper

OrientHandy wrapper for aggregates to use with emplace*() container's member functions: #include <type_traits> #include <utility> template< typename type > struct aggregate_wrapper : type { aggregate_wrapper() = default; template< typename argument, bool is_noexcept = noex...

08:34
@GroovyDotCom, what you have selected is a free [Code Review](codereview.stackexchange.com). In amongst it is an answer to the question! — Roamer-1888 27 secs ago
08:45
possible answer invalidation by user1306322 on question by user1306322: codereview.stackexchange.com/posts/117743/revisions
09:00
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: Executing periodic tasks
while(_sem == null) is a wrong way to do it - en.wikipedia.org/wiki/Busy_waiting. In any case the provided duplicate will give you some ideas for sure - personally I would have used Tasks(async await) for this case, though using WaitForMultipleObjects is a bit more useful from educational point of view. You may also try to post your code on codereview.stackexchange.com, but I'm not exactly certain that it would be completely on-topic there. — Eugene Podskal 52 secs ago
If your solution works, then this question is more suitable for codereview.stackexchange.comIdos 8 secs ago
@Theraot Should i remove the question and repost it to codereview. — Sachin Mour 33 secs ago
09:33
0
Q: Program to count the number of words starting with a vowel in a text file?

CoderThis is a question from chapter Data File Handling (class XII).

10:10
0
Q: Find those numbers between 1 to 10000 whose sum of digits are prime and save it to a file in c

user95626#include<stdio.h> #include<conio.h> int sum_of_digits(int); int check_prime(int); void save_to_file(int); int main() { int i, num, isPrime; for(i=2; i<=10000; i++) { num = sum_of_digits(i); isPrime = check_prime(num); if(isPrime) { printf("...

10:41
0
Q: Given ONE integer input, find: sum of all evens and product of all odds

flycingI dont know how to program this because im having a problem on iterations. MY professor says that you can use while and do only. the method is: 1) input a positive integer (ex. 5) 2)then it will give its factorials (ex. 5= 5 4 3 2 1) 3) Add all the evens (ex. 4 + 2) 4) multiply all the odds ...

10:53
Bots everywhere!!
Monking
11:05
@CaptainObvious Hammertime?
0
Q: Should I stream html files instead of just render?

slevinI am experimenting with node.js/express.js and thought to pipe html files to a request instead of just render. I hope to achieve better performance, and html files will load faster, the first time. //instead of res.render('form',{title:'Login',userField:'Username',passField:'Password',photo: p...

I'm voting to close this question as off-topic because it belongs to the codereview site. — skypjack 24 secs ago
11:22
@skypjack just because the word "review" appears in the question body, that doesn't mean the question belongs on Code Review. In this case your suggestion is wildly inappropriate. Please do not suggest moving code that doesn't work as the OP intended. For more information, see "A Guide to Code Review for Stack Overflow users"Vogel612 21 secs ago
@Quill dafuq?
no idea... was just in my images folder
0
Q: Somewhat Advanced C++ Calculator

john01davI am currently in the process of learning C++ from C++ Primer. I have found the exercises in this book to be somewhat dull in that they only test syntax and not reasoning. As such, I have recently written a somewhat advanced C++ calculator. It is advanced in that it can interpret more complex ide...

11:38
@CaptainObvious wtf upvote?
0
Q: SPOJ: To and Fro without table

Antoni4040I've been trying to solve this problem: http://www.spoj.com/problems/TOANDFRO/ Here's my solution in C: #include <stdio.h> int main(){ char N[202]; int n, i, j, l; scanf("%d", &n); while(n != 0){ i = 0; j = 0; l = 0; scanf("%s", N); while(N[i]){ ...

@Vogel612 The question does not describe an actual error nor a wrong behavior, the OP is simply asking to review his code because of an unknown reason. If it doesn't fit the requirements for codereview I apologize, but it doesn't fit the requirements of SO as well. Am I wrong? — skypjack 47 secs ago
11:59
Good morning
(It's 11:59, so it's still morning)
morning
Working code doesn't belong on stackoverflow. You may want to put this on codereview.stackexchange.com instead — Sam Segers 33 secs ago
arghhhh
how many stackoverflow people actually know the SO scope??
lol, not enough
it looks like this morning there's none
12:13
@SamSegers that is wrong on so many levels. The help center nowhere states that working code doesn't belong on stackoverflow. While this question is too broad for Stack Overflow there's questions that can be asked about working code that are on-topic for Stack Overflow. Please reread the rules. Regarding the differences between Stack Overflow and Code Review you may want to read "A Guide to Code Review for Stack Overflow users"Vogel612 21 secs ago
1
Q: Reduce number of calls to Collections.sort() for Custom Sorting of list of Objects

digzouI have implemented a class which implements a list of my custom DateObj. I have sorted the list in peculiar manner based on the current month. Achieved my desired results, but I required to call the Collections.sort() four times to achieve so. I feel this could be improved. Any thoughts? Here is ...

@Vogel612 I see your point, but based on what I've seen migrated so far and the specifications you just linked I think it would be a fit for codereview as well (why not?). But I must have been wrong in my statement that working code doesn't belong here. Although I've read that a lot of times too. — Sam Segers 24 secs ago
@SamSegers while this question is okay for code review (and has actually been cross-posted already, it's important to migrate for the right reasons. Just because a question is on topic for another site it's not necessary to migrate it, if it's in scope for the current site — Vogel612 7 secs ago
@Vogel612 I confirm that the OP is not describing an actual error nor a wrong behavior, at least from my point of view. He was asking to review his code for an unknown reason and, even worse, you pointed out my attention (thank you for that) to the fact that he was looking for someone who is able to write that code for him. You are right in saying that maybe it is not a question for codereview, but still I think that it must be closed. I'll ignore the comment - I attribute the misleading use of review to a problem with the English language. — skypjack 10 secs ago
12:28
wow
Is he dense?
I mean that in the nicest way
as dense as a good chocolate fudge
@Quill ohhh the other guy...
irony or sarcasm, take your pick
Yeah, I didn't mean you, @Vogel612
12:42
@DanPantry I'm in two discussions on SO right now,so I thought you meant the other on
Since this was cross-posted to codereview, maybe this question can be deleted? — Tunaki 26 secs ago
13:06
Monking
0
Q: Simple minesweeper game javascript

Sudhanshu BarthwalI created a simple minesweeper game as I am trying to get my hands dirty in javascript. I have tried to use the oops while doing this. I am posting 3 files- 1. index.html 2. minesweeper.js 3. minesweeper.css Also I have hosted the game at- ... It would be great if I can receive some critical c...

13:38
I'm voting to close this question as off-topic because is asking for a code review and recommendations which is off-topic. — Jarrod Roberson 43 secs ago
13:58
@JarrodRoberson Whether or not this question is a duplicate, I don't know--I don't follow this tag. If it is, you should mark it as a duplicate and link to that duplicate. However, I don't agree that this question is about a code review. There is a very clear & specific problem statement with a description of the actual & intended behavior of the code. — nhgrif 49 secs ago
0
A: Updating number of votes with a "Like" button

nhgrifOn the whole, there are several indentation problems through out your code. Here is made the most obvious example: if let pfObject = objectArray?[indexPath.row] { cell?.parseObject = object var votes: Int? = pfObject["votes"] as? Int The second line has two extra...

@Quill thanks for being nice about it! I guess I just misunderstood the purpose of this site. I'll be posting this on SO then. — Elegant.Scripting 29 secs ago
0
Q: Is a valid sudoku?

JnxFStatement A sudoku puzzle is a 9 Ă— 9 grid with some numbers between 1 and 9 in it, that has to be filled in so that every row, every column, and each of the nine 3 Ă— 3 blocks contain all the numbers from 1 to 9. For example the following matrix is not a valid solution of a sudoku puzzle: t...

0
Q: Option<T> functional type implementation and scenarios

Dmitry NoginHave you ever being implementing Option<T> functional type? It is discussed here: https://app.pluralsight.com/library/courses/tactical-design-patterns-dot-net-control-flow/table-of-contents Basically it is about using IEnumerable<T> with no or only one element instead of potentially nullable ob...

14:36
expanded this answer now...
1
A: Updating number of votes with a "Like" button

nhgrifFormatting On the whole, there are several indentation problems through out your code. Here is made the most obvious example: if let pfObject = objectArray?[indexPath.row] { cell?.parseObject = object var votes: Int? = pfObject["votes"] as? Int The second line h...

0
Q: Way to get DataTable

corsoI was wondering which way is "the better way" of getting Data Table object. I wrote two examples. In first example connection is opened inside class ConnectionDatabaseOne. In second example connection is opened in class where it is used. What's your opinion? First way: MySqlConnection c1 = ne...

0
Q: Simple 8 Puzzle - ASCII - follow up

MORTALBased on previous question i have implemented all suggestions with slightly modified them, the game seems fine, only part that I'm not sure about it is wither my simplification on loop counter correct or not, i have pointed it out as comment in code. Also is there any further improvement need in ...

 
2 hours later…
0
Q: Using mongoose aggregate function and saving to user model

Peter SmithAny thoughts on making this better? Score.aggregate([ { $match: { user_id: req.user._id }}, { $group: { _id: req.user._id, total_games_played: { $sum: 1 }, total_mass_eaten: {$sum: '$mass_eaten'}, average_score: { $avg: '$highest_mass' }, ...

0
Q: Binary search traversal with in/pre/post order and b/dfs

sivaI have the following code for the BST for the inorder, postorder, preorder, breadth first and depth first traversals. Can you guys review and let me know the optimisation points and issues if any import java.util.ArrayDeque; import java.util.Queue; import java.util.Scanner; import java.util.Stac...

@CaptainObvious I guess we're running out of Sudoku titles, too.
3
@Jamal. Sorry, I can't understand you... I do not really know what title should my post have. As I can infer, "Is it a valid sudoku?" and "Checking if a sudoku solution is correct or not" are bad titles. Which one should be good? Please, let me know. — JnxF 38 secs ago
codereview.stackexchange.com/questions/87016/… here's a good explanation for callbacks. — lukesIvi 33 secs ago
16:54
Is running out of titles becoming a problem?
add more spaces
0
Q: What is the efficiency of the code of PRIME GEN?

Vinay5forPrimeThis code produces Prime Number from 5. #include iostream.h #include conio.h #include fstream.h void main() { long int n=5; ofstream fout; fout.open("Prime1.txt",ios::out|ios::app); while(n<36000) { int flag=1; for(int i=n-1;i>=2;i--) { if(n%i==0) ...

it's more like we're running out of toy problems like sudoku,fizzbuzz and the like
17:09
Another one-away. And I've finally made it to 27k. :D
@Vogel612 Simon-says hasn't been done to death yet, but that's more of a GUI thing.
Battleship is a bit complex for a beginner problem, so that won't work either.
Let me find one of my challenges-books.
There's always the linked-list, binary search tree, sorting, string representations (including numeral conversions), etc.
I am just shy of 20k
I think this is the second time I got "mail" on my Debian VM about a Mozilla certificate authority. I don't even use Firefox on there.
Firefox isn't Mozilla's only product.
But also, the message is about a CA not about a cert.
I assumed it was referring to that. It does say "Mozilla certificate authority bundle."
17:26
I'm doing a migration on the Users table for @StackOverflow, apologies if we have to go read-only for 20-30 seconds here in a few minutes.
Zak
Zak
@Mat'sMug @RubberDuck @amyone else who's interested. Just a reminder that the 200 bounty on my VBA question expires this evening. IIRC, in about 3 hours or so.
Nice. Debian Jessie 8.3 released. Now I just have to wait for a new Vagrant box to be uploaded. It also appears that it'll take care of that CA update.
@Zak 2 hours. And it is morning over here.
#TimeZonesAreFun
@Zak Pimgd's answer isn't worthy?
Migration complete for @StackOverflow, we're back.
@Judge2020_ Network-wide migration for the databases made much faster with a momentary read-only. Maintenance complete already.
Zak
Zak
17:40
@Mat'sMug I'm not saying that (though I was certainly hoping for more / more comprehensive answers than just that). Just saying that if you *are* going to review it, now would be the time to do so.
@CaptainObvious @Jamal Now we know there's an issue with his code, feel free to close it.
18:04
0
Q: Program to calculate Palindrome of 3 digits

Vinay5forPrime#include<iostream.h> #include<conio.h> #include<stdio.h> void main() {clrscr(); int n,rem=0,num=0; cout<<"Enter the numbae(3 digit)"<<endl; cin>>n; for(int i=0;i<3;i++) { rem=n%10; num=(num*10)+rem; } if(n==num) cout<<"the number is a pallindrome"<<endl; else cout<<"the nu...

0
Q: Working 2048 Game with Java code with a few bugs

The Programmer GI recently made a basic 2048 game without scores, death, or victory yet. The code is fully working but with a bug (maybe more). The bug is that when you press and hold the down arrow until all cells are full and then you press left to merge some of the possible cells, the cells won't merge. I deb...

@CaptainObvious Somebody must have skipped the tour.
@CaptainObvious Also broken.
18:27
@Zak I posted one, but really it simply expands on my previous answer in the previous post. pimgd deserves the bounty
gotta go
18:56
0
Q: Moving across my (sturdier?) Bridge

syb0rgBuilding on top of the classes in this question of mine, I've made this class to support the moving of the entities for my given assignment: Welcome to the Bridge Crossing Problem. Person Pn can cross the bridge in n minutes. Only one or two persons can cross at a time because it is dark,...

Maybe you can go here but only if you post simple concise code — Reimeus 37 secs ago
@Reimeus: AFAIK it's off topic on codereview, if it's not working. — fabian 45 secs ago
19:14
0
Q: Full Screen Video BootStrap

Velibor NikolicI am having an issue with the resizing of a full screen video, within a bootstrap template. Here is the live example? http://velnikolic.com/toad/index.php# below 1400px and in safari browsers the video ratio gets very distorted. <div class="fullscreen-bg"> <video loop muted autoplay poster=...

Zak
Zak
@Mat'sMug Thanks for that. You make good points. I definitely need to work on abstracting things more.
0
Q: How many actions to 'try' before calling 'except'?

PydermanGiven the following working code: def get(self, key, default=None, type=None): """Return the default value if the requested data doesn't exist. If `type` is provided and is a callable it should convert the value, return it or raise a :exc:`ValueError` if that is not possible. In ...

19:50
0
Q: Google maps coordinations json to object

EdgarI am trying to write parser from JSon data which I get from google requesting coordinates of city, which will create my specified object structure. For parsing I write custom TypeAdapter. It is my first time working with Gson, so probably my parsing method can be improved, any suggestions? JSO...

This is off topic. You should try code-review: codereview.stackexchange.comReut Sharabani 5 secs ago
If you want a code review, it belongs to CodeReview.SE. If you want a wiki type post, ask the question - and answer your own question as an answer. — amit 37 secs ago
20:21
0
Q: Is this activity resting code efficient?

Ruchir BaroniaI have an activity with a timer in it, which starts an activity when the timer goes down. Before, when onPause() would get called after a phone call, my activity would hang because the timer would also stop. My objective was to completely restart the activity from new when this happened, so I cam...

Shouldn't this be moved to codereview.stackexchange.com? — jpo38 24 secs ago
0
Q: C# Extension Properties

Dmitry NoginI am doing some math - combining, reusing, extending different analyses methods over the same original data set. It would be reasonable to use C# extension methods in my case instead of defining everything in one class. The same time there are too much stuff to be constantly recalculated in this ...

@CaptainObvious Very iffy.
In case it is working correctly, I think this question is better fit for the [codereview.stackexchange.com]. (Otherwise please be more specific what is the problem and show only the relevant parts. How to Ask) — Gábor Bakos 51 secs ago
@Duga Holy mother of needless code repetition...
Zak
Zak
Oh stable internet connection, how I have missed thee.
21:31
0
Q: Looking for feed back on Todo list with calandar, first App

monkeyman905so just looking for some feed back on my code. This is my first App I have coded and I'm looking for some constructive criticism on my Javascript code structure and how I could improve it so i can improve future apps. The app is a todo list with a three day calendar. Uses can add and remove list...

0
Q: Quadratic function solver

mattskyI wrote simple Quadratic function solver with unit test. Can anyone check if that's ok ? The source is available on github: source code

That moment when you're sure you've wrote a specific function before but can't find it.
Should've put it under VCS...
I think "neat" is pretty subjective; I don't see the "neat"-ness of that code. This might also be better on Code Review. — ChiefTwoPencils 20 secs ago
0
Q: Getting last & this monday as unix timestamp in javascript

LatheesanThis is how I achieved it. <script type="text/javascript"> // Get this monday var dif, d = new Date(); dif = (d.getDay() + 6) % 7; d = new Date(d.getTime() - dif * 24*60*60*1000); d.setHours(0,0,0); var thisMondayUnixtimestamp = Math.round((d.getTime() / 1000)); console.log('thisMondayUnixtime...

TypeError:
str.split(...).push(...).join is not a function
JS allows all kinds of crap but not that?
21:50
This question might be best on Code Review instead of Stack Overflow. — cybermonkey 52 secs ago
@Mast yeah .push doesn't return a mutable object like .split does, push returns the array length
@Quill There's no way of chaining it anyway?
I don't think so
well, I mean you could have a modified push prototype, but that's bad practice
Array.prototype.push = function(item){
    this[this.length] = item;
    return this;
}
Yea, that's a bad idea.
that'd let you do it, but it's probably easier just to use a helper function, I suppose
22:01
@Quill Wouldn't it be better to call the original Array.prototype.push then and return the result of that?
Or no, still return the Array itself of course
^ yeah, it doesnt return the array
Array.prototype.push = function(item) {
    OriginalArray.prototype.push(this, item);
    return this;
}
Is what I meant... though no clue how to write that line
um, no
Though it's quite unlikely that the Array.prototype.push implementation would change...
having them "named differently" is not good practice, still
22:19
It's so easy to write crap in JS.
it's pretty easy to write crap in other languages too
Yea, but in other languages I spot the crap more easily.
Don't modify Array.
If you want a chainable push, use lodash
In JS it's hard to distinguish between crap and neat code.
No, it's not
Crap code looks crap
Neat code looks neat and doesn't modify the prototype
ಠ_ಠ
22:21
exactly
@DanPantry Blame skiwi for that one, not my proposal ^^
Or Quill.
When in doubt we always blame Quill.
4
Or caching.
hey, sometimes you gotta play with explosives to learn
No other language.. aside from maybe functional ones... returns the instance of the Array after using insert/push (or similar)
What you really want is concat, not push
str.split(...).concat(...).join('') is legal
play in console to learn
and immutable, for that matter
22:22
also .join`` for that matter
note that concat only takes arrays as arguments, so if you have a single element you'll want to .concat([element])
That sounds like a good idea, concat
Now I just need to remove a bunch of if/else crap so it will fit in one line again.
So many options to choose from, so little knowledge about what I'm actually doing.
I'm doing a scraper project at work... for some reason the data relating to Panama crashes my code
it's always Panama
0
Q: Replace spaces with '%20'

user95657This is my attempted solution to Question 1.3 from CTCI, 6th ed. Question: Write a method to replace all spaces in a string with '%20'. You may assume that the string has sufficient space at the end to hold the additional characters, and that you are given the true length of the string. #include <

22:44
This is off-topic for Stack Overflow and should be posted on Code ReviewBorodin 37 secs ago
This is crazy, I've been writing JS for a couple hundred hours now and I still have no idea what I'm doing.
5
Stuff works though.
@DanPantry That's an extremely broad statement...
Apologies fairly new to stack exchange and didn't know code review existed! Will move now — D.Singleton 7 secs ago
@DanPantry concat is the obvious choice when chaining, what if there's no chaining going on? What would be the preferred choice in that case?
@Mast well concat literally joins two arrays, so push is better, as you're only appending an item, versus an on the fly array
@Mast MDN will help you greatly
22:52
@Mast hi Mast
Monking @Caridorc
I agree that:
@Quill Yea, it's the goto documentation.
 "Javascript is " + ([]+{}).slice(1, 7)+"ively crazy"
@Caridorc shoulda seen that coming
22:53
@Quill so you already got it?
yes
Saw it in the "wat" video recently.
@Mast devdocs.io is cool too
@Quill And conditionals inside a concat/push are probably a bad idea, right?
that depends on how you structure it
22:55
what are we even talking about exactly?
@Mast do you mean ternaries?
[].push(
    4 == 4
        ? 8
        : 2
)
of course have a real condition, and a real array in there
@Caridorc Yea.
@nhgrif how crap wonderfully pleasant JavaScript is
Looks fine to me, but I am very much pro-ternaries sooo
22:57
Why are you nesting that...
@nhgrif Modifying strings by turning them into arrays first and going back later.
Why would you not modify via regex or something?
^ that, regex seems more sane
Regex sane?
I could probably do that, did something similar in Ruby not too long ago.
@Mast more sane this is Javascript, remember
22:58
0
A: Swift menu code

nhgrifThere is a whole lot of code here, but I actually want to focus strictly on the protocol that we've created for delegates of this menu. There are a few things that immediately jump out to me, but the first thing, I'll illustrate with a screenshot. The protocol has a total of 17 methods. Al...

why would you need regex for a conditional, it's not always going to be testing against 4
I mean... what's the concrete example of what we're trying to do
function translate(str) {
  vowels = ['a', 'e', 'i', 'o', 'u', 'y'];
  var arr = str.split();
  if (vowels.indexOf(str[0]) >= 0) {
    arr = arr.concat(['way']);
  } else if (vowels.indexOf(str[0]) === -1 && vowels.indexOf(str[1]) === -1) {
    arr = arr.concat([str[0], str[1]]);
    arr[0] = arr[0].slice(2, arr[0].length);
    arr = arr.concat(['ay']);
  }
  else {
    arr = arr.concat([str[0]]);
    arr[0] = arr[0].slice(1, arr[0].length);
    arr = arr.concat(['ay']);
  }
  str = arr.join('');
00:00 - 23:0023:00 - 00:00

« first day (995 days earlier)      last day (3320 days later) »