« first day (1623 days earlier)      last day (3316 days later) » 

12:23 AM
10000
Q: Why is processing a sorted array faster than an unsorted array?

GManNickGHere is a piece of C++ code that seems very peculiar. For some strange reason, sorting the data miraculously makes the code almost six times faster. #include <algorithm> #include <ctime> #include <iostream> int main() { // Generate data const unsigned arraySize = 32768; int data[arr...

 
fge
12:47 AM
260 rep in one day
I think I have broken my previous record
 
1:22 AM
I can't believe how many votes that question got.. It's legendary
 
See the one who answere its Mystical (one of the legendary)...
 
fge
@ChristianBongiorno well, it's certainly an excellent question, and the answer is equally interesting, so...
 
It's a detail I had long forgotten about and by no means did I think it would result in a 10x improvement in speed.
It's nutz for sure.
 
fge
Yeah, and it's a "detail" that even the almighty Hotspot JIT can do nothing about
Not that this kind of performance problem occurs frequently, but it's a good thing to keep in the corner of your mind -- with a large serving of salt, of course
 
It's a detail that you're conditioned to just forget about. Like: "If the compiler could optimize, it did"
And yet, here is an obvious case where simply order matters
 
fge
1:28 AM
Again: a large serving of salt
With today's hardware, BPB failure will incur penalties in the tens of nanoseconds range, not tens of milliseconds
So, you might, in fact, never notice
Except if your code happens to be hit billions of times a second
 
Did you read the follow-up? He used an intel compiler and it actually reordered the loop to skip the branch entirely.
This guy also computed pi to 5trillion digits
 
2:19 AM
Morning
 
 
2 hours later…
3:57 AM
yaay new badge
 
which one?
Yesterday, when you told me to print the array with a For loop, why write

For (int i = 0;...)

Why not

int i;
...
For (i=0;...

Is there a benefit to the way you said or are they both identical?
 
The benefit is one line less. In C you have to instanciate the in outside of the for loop, but in Java you don't.
The badge I got is called "curious"
 
Thanks. So less code is better code as long as it's clear to understand and it works

Ah. Asked plenty of good questions. Well done :)
 
Less isn't always more; but very often that is the case yes.
 
4:15 AM
Thanks.

noob quesiton of the day coming up. For the code below, why do i need '+' and '=' when summing the array but only * (and no =) when multiplying the total on the last line.

for (int x : array) {

total += x;
}
System.out.println("The sum of the array is " + total * 2);
 
+= is an assignment operator like = is, but it also adds the two together. Look here under assignmnet operators: tutorialspoint.com/java/java_basic_operators.htm
 
:) Thank you
 
4:42 AM
Still here Gemtas?
Can you see why my code gets the error y not resolved to a variable?

http://pastebin.com/0a3XuPgp
 
4:53 AM
You should learn to read the error messages printed to console and how to use a debugger. These tools are very vital in knowing what's wrong. The error printed to console should show you exactly what lines the error is cased, then you can read up on the theory for the code you attempted to do, unless it's something obvious like an extra or missing ; or typo.
The difference between a noob and a pro is that the pro will see the problem straight away when (s)he looks at the line causing the error. Because; in bigger applications, you'll have so many more lines to cause the issue.
 
5:20 AM
> debugger
Reminds me of something...
 
HI @ItachiUchiha
Good Morning
 
@gem
@AniketDeshmukh hey
 
@ItachiUchiha Yeah, I'm still clinging on to my console ;P
 
5:35 AM
we should have a quick session on it sometime..
 
5:48 AM
@ItachiUchiha today I don't have any task
 
Learn something new
 
yes i think same
 
6:11 AM
@ItachiUchiha I'd love to attend that :D
Though in my case it's mostly that I haven't gotten the thumb out to even look it up yet
 
a session would give you a wonderful kickstart :)
 
ADG
hello any one can help with git?
 
ASR
good moriniNG ALL
 
@ASR Morning
 
@ADG ask
 
ADG
6:20 AM
@ItachiUchiha i checkout and now want to undo it
all rest commits missing @ItachiUchiha
 
eclipse plugin?
zzzzz
switch to terminal
 
ADG
ok tell cmd commands
why? any benefits?
 
you can simply do much more with the commands
no plugin gives you as much freedom as commands in terminal do
 
ADG
ok tell cmd command to undo checkout
 
Ask @gem how switching to terminal helped her raise the bar of using git ;)
@ADG undo checking out a branch?
 
ADG
6:25 AM
yes
 
CMD has the benefit of that you actually need to memorize what to type. It gives you a better understanding of how git works and what you're doing. The terminal in any system gives you a lot more options compared to any GUI since any given GUI only does exactly what someone programmed it to do. With Git's own GUI it may be a lot fewer differences compared to something like Source tree, but you can still "hack" away with your own version and commands.
 
I've decided to stop bashing people who use Windows for using Windows. They probably don't deserve more anyway.
 
^^ ROFL
@Gemtastic ^^^^ @ADG
@ADG Checkout the old branch again
 
ADG
ok
 
and you are back
 
ADG
6:38 AM
i did show all branches and then i did
hard reset to master
is it correct
 
Do you want to rollback a commit?
 
ADG
3 things index head and .. changed
i said what i wanted is done, i accidently did it correct you can say
 
@Unihedro That's like bashing people for living in apartments.
 
@Gemtastic That's like bashing people for living in apartments when houses are cheaper and more comfortable to live in, so yes.
 
6:46 AM
Not everyone can have a house.
 
The premise here is that it's cheaper.
 
And since most people around the (first?) world live in apartments it makes sense for a architect to know what they're building by at least using one
It's not cheaper for everyone. You have to account for time here; learning to use linux costs a lot of time for some.
Ubuntu is like modlue houses; you can buy a module house that someone kinda built for you, but you still need to assemble it yourself
Unix is like building your own house
Not to mention that the houses are far away from the center of cities, which means that someone living in a house dosn't have access to all the fancy city things. In this case stores and services relates to games and programs
You can have a shitty little local store, but it's not the same as the cheap mall downtown.
 
Good morning, Java!
 
morning
 
But yes, living in a house is great; you have the freedom to do whatever you want. You can hire whatever contractor you want and you can be noisy, be up at any hour and there's so much room for activities! But it's also kinda lonly
 
6:53 AM
Support is not a requirement (see above). The very purpose and role of OSS is empowering developers (any developer) to change, repurpose, decompose, or recompose an open-source project in any way as is required. Requiring developers to use Forge in a certain way countermands what OSS means. And so my question is simply to see if anyone else has managed to isolate Forge from FML successfully. — Jonathan Neufeld 3 hours ago
^ person must be nuts
 
ADG
wierd java problem:
my small code:
System.out.println(pid);
try {
final InputStream xmlInput = activity.getAssets().open("level/level" + String.valueOf(pid) + ".tmx");
if (xmlInput != null) {
SceneManager.getInstance().loadGameScene(engine, pid);
}
} catch (final Throwable err) {
err.printStackTrace();
}
and the output is:
04-03 12:30:24.259: I/System.out(12224): 1
04-03 12:30:24.399: W/System.err(12224): java.io.FileNotFoundException: level/level0.tmx
problem:
 
java.io.File?!
 
ADG
pid is 1 but level loaded is 0?
 
@ADG The path is smelly..
 
What is the data type of pid?
 
ADG
7:02 AM
int pid
 
=javadoc String#valueOf(int)
 
Is this file present on the classpath? Because I can't see an absolute path?
 
It's probably a race condition. String.valueOf((int) 1) is "1".
 
ADG
yes level1.tmx is there
 
Since you're concatenating strings you don't need the String.valueOf chain anyway.
1 message moved to bin
 
ADG
7:05 AM
yes i am doing that
@ItachiUchiha yes the path is problematic
because in between it changes from 1 to 0
 
I already told you, it's probably a race condition.
 
ADG
loadgamescene:
 
user4330208
what happened to my message
 
ADG
public void loadGameScene(final Engine mEngine,final int pid) {
...
gameScene = new GameScene(pid);
...
}
and gamescene:
 
@carb0nshel1 Be glad I didn't flag it as spam.
 
ADG
7:08 AM
public int LEVEL_ID;
public GameScene(int id) {
this.LEVEL_ID = id;
}
 
@carb0nshel1 it is related to jaavscript. Please proceed to the chatroom.
 
user4330208
yeah. this is the java room...
 
user4330208
sun microsystems named it after javascript
 
user4330208
its related
 
lolz ^^
 
7:08 AM
That would had made so much sense except Javascript came after Java.
 
user4330208
lolol
 
user4330208
k
 
@carb0nshel1 Who brainwashed your brain?
 
user4330208
i got my anwer in the javascript room anyway. i was desperate.
 
@ItachiUchiha known troll from webdesign
 
ADG
7:09 AM
and while performing load level:
 
user4330208
i didnt do it for the lulz
 
user4330208
afk.
 
ADG
public void loadLevel() {
final SAXParserFactory factory = SAXParserFactory.newInstance();
try {
System.out.println(LEVEL_ID);
final InputStream xmlInput = activity.getAssets().open("level/level" + LEVEL_ID + ".tmx");
output is 0 from 1
:(
 
@ADG wtf are you doing? I told you java.io.FileNotFoundException: level/level0.tmx means that there is a error in the path.
 
ADG
yes i am passing pid=1 and there's a file named level1.tmx there. but don't know why it is trying to load what i don't want level0.tmx @ItachiUchiha
 
> 04-03 12:30:24.259: I/System.out(12224): 1
 
8 mins ago, by Unihedro
It's probably a race condition. String.valueOf((int) 1) is "1".
 
ADG
@ItachiUchiha do it should load level1, why don't it fffffffffff
 
@ADG I am afraid uni is correct
 
pastebin.com/reYxeREm Does it violate DRY?
 
ADG
7:13 AM
@ItachiUchiha race=??
PROBLEM SOLVED guess the simple solution?
 
fix the bug?
 
ADG
i did....
make the pid static.
 
... wth?
If you even need a static field to make sure all instances are synchronized, you're likely doing it wrong
But ok
 
ADG
i think the problem lies in this
...
i am using SceneManager.getInstance.dosometyhing
@Unihedro rather i should clean it up to do properly, because everytime i wnat to do a method from this class i get a new instance not the same one evreytime.
 
posted on April 03, 2015 by Artist

First off, let's start with everything that's great about houses and linux; There's a lot of freedom. A LOT of freedom. You can remodel and build whatever you want in it. Want a second kitchen? BAM! Just build one and you got one! You can hire any contractor you want for whatever job you want, you're not restricted by your landlord. You can be as noisy as you want, you're not dependent on anyon

 
7:24 AM
@ADG That's horrible design.
 
@gem IOS is the mobile operating system.
 
@ItachiUchiha Well, It's directed to all OS but yeah, I have no knowledge about the apple stuff XD
 
> "you'll find a local store that has the essentials, but it's far from all the luxury you would have wanted."
 
7:57 AM
You can run Gimp on linux. It's not Photoshop or Illustrator, but it gets the job done.
You may have your local pizzeria, but it's not an abundance of offers in there. Though sometimes, local pizzerias have the yummiest pizzas.
 
Hellow All :D
 
@Gemtastic I can't comment on that because my digital art are mostly crappy and I usually poke my artist to do most of the logo design, but there are linux distros that are better than their windows applications counterparts
 
@Unihedro Which is why I mentioned the pizza thing
 
8:12 AM
Oh... I was thinking about your metaphor for a while, I don't eat too much pizza to understand that. It's expensive over here. :P
 
Just because it has a fancy brand and exists in the city and is considered "luxurious" it isn't always better. My better half prefers my cooking to restaurant foods ;)
 
@deadlydragon00 Hiya!
@Gemtastic :D
 
Hi @Unihedro :D
 
@Unihedro Having pizza delivered in the cities is mad expensive, but here pizzas are like street-vendors kinda. Even the smallest village usually has one pizzeria, if not in the village it's in the neighboring one.
 
:O
 
8:16 AM
If you ever come to sweden you should try the kebab. It's heavenly. ;P
 
@Gemtastic But what about meatballs with lingonberry jam? :(
 
@OlegKuznetsov That's heavenly too
Noone said you couldn't try both ;D
Awww schucks... Now I want meatballs and lingonberry jam with mashed potatoes :(
 
^^
Me too :(
 
in Alpha Centauri on The Stack Exchange Network Chat, 15 hours ago, by Unihedro
in Ruby :: Sometimes on rails on Stack Overflow Chat, 2 mins ago, by Wayne Conrad
That would be an interesting geeky mini game. Jeopardy, but you write code. The categories are languages, and when the square is turned, you see the answer. The first contestant to write the code that gives that answer in that language wins.
^^ Thoughts about the game?
 
And all I got was a banana :(
 
8:28 AM
@Unihedro Add COBOL for questions with value of 1024 points trollface
 
good morning
 
@fahdijbeli Morning!
 
Good Morning
 
8:44 AM
@Oleg: :D
 
fge
Moo
 
I get Shocked when I saw someone get 110dol/hour for just building E-commerce app...
 
Meh.. sounds a little high.
 
Yeah ... and guest what the requirements is very easy T_T
 
The on the othe hand I know someone who got 5grand for relaunching a website with Joomla
Which probably ended up with something like 500 per
 
8:53 AM
wow too high
 
@fge Good Moorning!
 
Vitamin B hits hard there...
 
Hi guys
 
Hiya
 
Has anyone worked with Scorm packages ?
 
8:54 AM
Never heard of it...
 
Same here, need to know about it
 
I don't know either, but nice to know I'll research that in my free time
 
Hmm, It is basically used in E-Learning Systems
 
Oh E-learning
 
Main files/datas are stored on RedLms
Yes
I would love to sharp my Java skills, I like this room
 
8:59 AM
I can't find my pack of batteries.
I hope my mouse lasts another day.
@RoshanJha From adlnet, or the actual scorm?
 
I notice when I expose the Battery to sunlight for a day it recharge a bit / but not recommended
 
@deadlydragon00 It depends. If the batteries are alkaline, that would not be beneficial.
 
Actual Scorm I guess, I would have scorm package, I will download it and start playing in offline mode. I have no idea how would I store data locally
 
@RoshanJha That's the problem, with just the package but no integration, you can't do very much with it
 
9:02 AM
@Unihedro You are right
 
you need to love reading DOCUMENTATION if their is
 
It will be integrated to RedLMS
 
I use zinc-carbon batteries because they are cheap, and for those batteries, freezing (leaving them in the fridge) actually extends their life temporarily. But I definitely won't want to do that often.
 
@deadlydragon00 They are providing offline sdk (mobile devices) but it is paid around 50,000 $
 
I'm curious, why do you need to work with scorm?
It's been historically insignificant, and even Active X dropped support for it already
 
9:04 AM
@Unihedro I guess because of client's requirement
 
K
 
Its hard to learn technology that does not offer Starter Plan
 
Yup they introduced TinAPI, but as I said that is paid
 
I'm a believer of free software (that is, the freedom, not the price)
 
Same here
Every developer feels same
 
9:06 AM
no
 
@Unihedro vOv if someone worked on a program for 6..24 months over their lives, and intend to sell it, they have every right to do so.
 
@SecondRikudo True.
 
Why shouldn't they get paid for the work they did?
No one likes working for free.
 
@Vogel612 I think you are working with Apple :P
 
@SecondRikudo I actually do, but only if I live comfortably
@RoshanJha I didn't say I wasn't.
 
9:07 AM
@RoshanJha Apple's business is not software. It's hardware.
 
@SecondRikudo I have a "I am copied therefore I am" poster with the sketchy ring of a cockroach drawn on it.
 
@Vogel612 In that case, it's not working.
 
meh. just because it's voluntary work it's not less work, trust me
 
@SecondRikudo You need to pay to Apple for Apple account every year
 
I bought a mug for 2 dollars and I place the apple sticker -- I sold it for 20dol
 
9:08 AM
If your app is market
@deadlydragon00 lol
 
@RoshanJha That's trivial.
 
Well there is no doubt about quality
 
It's more of a "make sure I don't get a bazillion trolls" thing rather than an actual source of income.
 
^
 
Google does that too, do you think they live on that money?
 
9:09 AM
Google doesn't do that
 
it does
 
Nope
 
Chrome webstore, play quests & matchmaking framework SDK, ...
Get your stances checked :P
 
They take 30% on each app sale, Apple does the same. What Apple charge extra is they charge every year for Apple account which google does not
This is going to Google Vs Apple, what I was searching about Scorm
 
@RoshanJha try buying dell loptops and place an apple sticker at the back , you can sell it.
 
9:12 AM
:D
I use MacBookPro though :P
Apple is world's no.1 trusted brand
Does anyone use Yahoo Messenger ?
In that there is software clike Yahoo Booters
Can we create using Java :P
 
What's Yahoo Messenger?
 
:O, Chat Messenger
 
I stop using that 6 years ago, its image processing is so slow , transfer ratio so low, compression not good
 
never heard it
 
Same here :D
 
9:17 AM
skype sucks
 
Skype sucks
 
Skype sucks^2
 
Im bias.. so skype sucks ...
 
On Windows it's design is bad plus it has lots of ads. On Linux, it leaves "incoming call" window, if you don't accept or deny the call at the right moment.
 
And it's so vulnerable + battery-draining for an app that still survives in 2015.
It doesn't even have an API.
And before you yell at me, they dropped their API when Microsoft bought them out.
It doesn't support XMPP, custom switchable audio channels, and those kinds of essential settings either.
With Slack integration, I could plug in my e-piano and play through that.
 
9:22 AM
I have to admit: their initial architecture was state-of-art, but it's closed and heavily ciphered protocol is really scary...
 
@OlegKuznetsov Yeah, initial architecture, sure. Allow me to thank Microsoft for turning it into a horrible software that doesn't deserve to exist. :p
 
fge
9:34 AM
Ranting again, I see
 
@fge Yes! :)
 
user4735397
hey
 
Hey.
 

« first day (1623 days earlier)      last day (3316 days later) »