« first day (1153 days earlier)      last day (1263 days later) » 

12:00 AM
RELOAD! There are 2490 unanswered questions (92.9562% answered)
 
> Project Euler: 1-100
Overly optimized and generalized solutions
Øistein Søvik
June 30, 2016
 
Yeah, was thinking that.
I have much more fun squeezing out the optimizations than solving these tbh.
 
I can see that, reading your PE1 notes ATM
 
It is just a very rough sketch :p Many spelling mistakes and errors in the formulas. Just wanted to show off the layout. Happy that LaTex can automatically reffer to the PE site.
 
Looks quite nice indeed
I'm trying to wrap my mind around that Sigma symbol, I've seen it so much but never really bothered to try to understand what it means until now
 
12:12 AM
That was another convern a lot of these solutions will use quite a bit of heavy maths. I sometimes forget people are not used to the same notation as me
@Phrancis Sigma is the same as a for loop if that makes sense
count = 0
for i in range(333):
    count += 3*i
 
Except that it sums up every result
 
Equation (1) in the document is the same as the for loop above. Sigma starts with an S for sum.
 
\$\sum_{i=0}^5 ^n\$
Meh
is the same as int n = 0; for(int i = 0; i < 5; i++) { n += i; }
 
@Phrancis Less than or equal
 
Ah ok
 
12:21 AM
\$\sum_{i=0}^5 = 0 + 1 + 2 + 3 + 4 + 5\$
 
I guess that MathJax plugin for chat can't render that formula
 
0 + 1 + 2 + 3 + 4 + 5
5 + 4 + 3 + 2 + 1+ 0
6 + 6 + 6 + 6 + 6 +6
 
Or maybe it can... how did you do it?
 
Oh I just read the source code, not bothered installing the plugin.
 
12:23 AM
I speak better LaTex than I do German and French. LOL
Oh I forgot the counter
$
\sum_{i=0}^5 i = 0 + 1 + 2 + 3 + 4 + 5
$
 
Now that one is not rendering :(
What did you do differently?
 
Better?
 
No same
\$\sum_{i=0}^5 i = 0 + 1 + 2 + 3 + 4 + 5\$
There we go
\$\sum_{i=0}^5 i = 0 + 1 + 2 + 3 + 4 + 5\$
Looks like the chat plugin doesn't allow "big formula" syntax, only inline formula
 
If we add
0 + 1 + 2 + 3 + 4 + 5
to itself backwards we get
6 + 6 + 6 + 6 + 6 + 6
So 0 + 1 + 2 + 3 + 4 + 5 is the same as half of 6 + 6 + 6 + 6 + 6 + 6
 
So it basically reads, in plain English, from "i" starting at zero up to five, do "thing"
 
12:28 AM
In chat thingy

\$
\sum_i^5 i = 0 + 1 + 2 + 3 + 4 + 5 = \frac{6 + 6 + 6 + 6 + 6 + 6}{2} = \frac{5 \cdot 6}{2} = \frac{5\cdot(5+1)}{2}
\$
As wanted
@Phrancis Yes
 
@N3buchadnezzar Make sure you wrap them with \$ on each end instead of just $ (CR-specific syntax)
 
Like that?
 
Yes
It's purdy isn't it
 
No :p
 
BTW thanks for explaining this summation notation to me, makes a whole lot more sense now
 
12:31 AM
We also have the same for products
 
I didn't know formal math used loop structures like code does, very good to know
 
\$\prod_{i=1}^n i = 1 \cdot 2 \cdot \cdots \cdot (n - 1) \cdot n = n!\$
Maths is just language for lazy people. "How can we say this complicated thing as short as possible?" Well we can define it as X. Where X means a Y of Z and Y and Z are again defined by A, B and C, D which really are quite easy structures to explain.
 
Hm
 
@Phrancis Formal maths actually uses very little symbols. It can look a bit like this en.wikipedia.org/wiki/Compact_space.
Funny that people think maths is all about long complicated formulas.
 
So this product symbol is, for all intents and purposes, identical to the sum symbol other than the thing it does with \$i\$
 
12:39 AM
Yeah. It is just like the summation only now we multiply the numbers instead of adding them.
 
Sweet
@N3buchadnezzar is this intentional or error?
 
@Phrancis Yeah. There are loads of them :p
The formula is correct though. I just switched the counting index (which you should know from programing is just arbitary).
 
Sure
Hey, I'll be happy to proof-read what I can, if you let me know when you update the document
 
Will probably be a few days =) I need to move tommorow. Then I will spend a week with a friend teaching kids how to program
 
\$i=1\$ would be just as correct as \$i=0\$ in your use case right?
 
12:47 AM
@Phrancis Yeah!
 
Since 0 has no multiples or factors or anything like that, could be skipped entirely
 
As a programmer I tend to start things at zero :p
 
0
Q: Bootstrapped tabbed table view

MonsterMMORPGThis produces tabbed tables. Here's how it looks: Each table displays comments of E-commerce products. The variable dtProductComments is DataTable. The other variables are self explaining. <%if (dtProductComments.Rows.Count > 0) { %> <div class="margin-top-20"> <ul class="nav nav-tabs">...

 
As a popquiz what is \$\prod_{i=0}^{5}i\$ ?
 
Zero?
 
12:49 AM
You win!
 
Anything times zero is always going to be zero
Is there an equivalent operator for subtraction and division? I realize subtraction could just be from 0 to -5 or whatever
 
@Phrancis I am thinking of adding this picture i.stack.imgur.com/zeeyN.png to explain the adding and subtracting.
 
(or maybe not)
 
Subcration is as you say done with minus, nothing as far as division goes.
 
What is that upside-down U symbol?
 
12:51 AM
@Phrancis It means everything in both
It is like the set operation
 
So the set where \$A=B\$ ?
 
[1, 2] U [3, 4] = [1, 2, 3, 4]
 
Ohhhh
 
[1, 2, 3] U [1, 2] = [1, 2, 3]
 
Okay that makes sense
What's the LaTeX symbol/command for it?
 
12:53 AM
19
Q: TikZ labelling venn diagram

yoloI have a 3-circle venn diagram \def\firstcircle{(0,0) circle (2cm)} \def\secondcircle{(55:2.67cm) circle (2cm)} \def\thirdcircle{(0:3cm) circle (2cm)} % Now we can draw the sets: \begin{tikzpicture} \draw \firstcircle node[below] {$A$}; \draw \secondcircle node [above] {$B$}; \draw ...

 
Dang, LaTeX looks powerful
\$A \cap B\$
Nice
 
the idea would be that each circle would represent all the numbers divisible by that number
Eg red circle would be 3, blue circle 5 and green 7
We are trying to find the union (the total) of these three sets of numbers.
 
So just combining the sets and then adding whatever numbers are in there would give the solution to PE1
 
But you see there is a lot of overlap between the circles right?
 
Ohhh I know union, used it in SQL plenty of times :D
 
12:57 AM
We have to subtract the overlap
=D
 
Wouldn't union eliminate the overlap?
 
monking
 
e.g., \$[3,6,9,12,15] \cap [5,10,15] = [3,5,6,9,12,15]\$
 
@Phrancis not quite
\$\cap\$ means in both, \$\cup\$ means in either.
\$[3,6,9,12,15] \cap [5,10,15] = [15]\$
 
OK
 
1:02 AM
Usually this is what is taught at the introductory courses in mathematics. Just drilling the students in new and "confusing" notation :p
But nighty night all =)
 
@N3buchadnezzar Good night, thanks again :D
So then it's like this:
Chat plugin seems to break trying to render those
 
1:26 AM
0
Q: Basic call-and-response Slack bot

AmandaI'd love thoughts on how to make this more elegant. I'm planning to add some additional functionality, but basically this is just my first pass at creating a pythonic Slack bot from scratch. You need Slack API token to run it. I am deploying to Heroku, so I have it looking for an environment va...

 
Yes, the code review is still 'Associate'' in pending changes. But with this item selected, once you perform a check-in, the code review will have a “Resolve” action. — Cece - MSFT 34 secs ago
 
1:41 AM
The set of Real numbers \$\mathbb{R}\$ contains all numbers, decimal/float and whole?
Well, that was supposed to be the hollow R symbol
 
2:11 AM
Pretty darn late, but IEnumerables just seem like stacks of promise callbacks
you apply a whole bunch of expressions to the result of a core async action
JavaScript's promises are similar in that they don't stack, they're just callbacks, theoretically, you could make a jenga tower out of callbacks and have a similar thing to stacking enumerable expressions, but the language syntax isn't build for that
the C# compiler or whatever optimises their expressions into a much more performant usage, but nonetheless
 
2:49 AM
0
Q: Make Macro Work Faster

P.AlvsGood Day! I just to ask if there is any alternative way to make my macro work fast? I only use Record Macro. what my macro do is Find The Word "JOBSPECIALTYCODE" in the sheet then select and delete. then move to next sheet. just like the image a provided PLEASE CLICK Sub aHaveProgess() ' ' ' ' ...

 
3:01 AM
0
Q: Validate where a ransom note can be made from a dictionary of words

Neelesh SalianFor simplicity, it is checking whether the characters in a string (that needs to be created) are present in a larger string (dictionary). Would a character array of the letters make sense here, or would it be better with a Map<Character, Integer>? public class RansomNoteProblem { public static v...

 
3:14 AM
It might be a good idea to ask for a code review on codereview.stackexchange.com, I'm seeing quite a few things that seem a little unusual in the code you posted. They aren't specific to the error you're seeing, just general items. — D.B. 54 secs ago
 
3:31 AM
-1
Q: how to connect classes in java

live18hi how are u everyone I have some questions and i hope help me first question : there are 3 classes here : Student Class: Data members: name, uniqueStudentID, eMail, mobileNumber, semesterNumber, numberOfStudents (static) Methods: Accessor/Mutator methods,... Course Class: Data members: cou...

 
Your answer would be valid if the site was called "code review" but this is not what the OP is asking about — Soren 8 secs ago
 
4:31 AM
Monking
 
4:58 AM
-1
Q: Execel Formula How to Plot Work Hour Per day

P.AlvsIm came here to seek some help with my Execel Formula. Please Check this Image for more details PLEASE CLICK In my Document i state the number of report that i have and the time i recieved it and the deadline. just to monitor how many days and hour to finish that. i make some file like this. I u...

 
5:17 AM
0
Q: Find 2 and 3 numbers in an array of integers that add up to specific given sum

Neelesh SalianNeed to find 2 numbers or 3 numbers from an array of integers. I have methods for both. I am not sure if this is the best approach to do so. public class GroupSum { static HashMap<Integer,Integer> map = new HashMap<Integer, Integer>(); public static void fillHashMap(int a[]){ for(int i=0;i<...

 
6:16 AM
@Matthias I can't be bothered to decode this, but there is zero relation between the number of lines of source code and memory used. There is no performance what-so-ever gained from squeezing in all these operations on a single line of code. I'd recommend studying assembler and how the compiler actually translates C code into machine code. Once you got this program up and running, you could also post it at codereview.stackexchange.com for advise how to rewrite it properly. — Lundin just now
 
6:31 AM
0
Q: CS50 PSet1; Greedy

Nospmoht ToilleI have come up with this code for greedy.. but my code just stops at line 18 (x = change*100) and goes no further. What simple thing am I forgetting? Thanks. #include <cs50.h> #include <stdio.h> #include <math.h> int main(void) { float change; int coins=0; int x; do { ...

 
Monking!
 
6:43 AM
SO is a site where people ask questions about programming problems, if you dont have any question but just need some code review maybe it will be more useful to post here: codereview.stackexchange.comPawel Miech 53 secs ago
 
@Quill No. The best analogy I can give to LINQ queries in JS would be some layer laid on top of generator functions
A Promise is more analogous to a Task
Monking @Gemtastic :)
TTGTW
 
I'm voting to close this question as off-topic because user is asking for code review and it would be better for him to post in codereview.stackexchange.comPawel Miech 17 secs ago
 
7:21 AM
0
Q: Scraping after login using scrapy

OutOfTheBoxI just finished a scraper in python using scrapy. The scraper logs in to a certain page and then scrapes a list of other pages using the authenticated session. It retrieves the title of these pages and puts it in a list of items together with the page name. Because there are little examples to f...

 
7:32 AM
0
Q: SqlCommand filter by dates are slow

PopI have these codes: string commandText = "SELECT TOP(@maximumRows) * " + "FROM " + "( " + "SELECT *, ROW_NUMBER() OVER (ORDER BY " + sortExpression.Trim() + ") as rowNumber " + "FROM " + "( " + ...

 
7:55 AM
TTGTW? Ta-Tah got to work?
 
Time to :)
@Quill @Mat'sMug @Phrancis @JeroenVannevel Here's an example of LINQ-y.. things in JS
function* range (min, max) {
  for(let i = min; i <= max; i++) {
    yield i
  }
}

function* map (iter, functor) {
  for(let el of iter) {
    yield functor(el)
  }
}

const generator = map(range(1, 5), i => i * 2)
console.log(generator)

for(let element of generator) {
  console.log(element)
}
generator would be your IEnumerable<T>.
Nothing is evaluated until generator is iterated, so you could essentially pass an infinite generator to map if you wanted and nothing would happen until you iterate over it
 
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: jQuery toggle buttons to show matching content in sliding panel
 
function* range (min: number, max: number): Generator<number> {
  for(let i = min; i <= max; i++) {
    yield i
  }
}

type MapPredicate<T, K> = (input: T, output: K);
function* map<T, K>(iter: Generator<T>, functor: MapPredicate<T, K>): Generator<K> {
  for(let el of iter) {
    yield functor(el)
  }
}

const generator = map(range(1, 5), i => i * 2)
console.log(generator)

for(let element of generator) {
  console.log(element)
}
with types because I know you guys are all about types..
 
Zak
Monking @all
 
monking @Zak
 
8:01 AM
@DanPantry ah, I see
kids and your lingo :P
 
May I suggest you post your final code to codereview.stackexchange.com, there is many improvements that can be done, and it will be a great source of learning for you. — Cyrbil 56 secs ago
I think this would be a better fit for "Code Review" codereview.stackexchange.comJesper Juhl 9 secs ago
 
holy crap, Redgate tools are awesome
Paging SQL devs: @Zak @Mat'sMug - either of you two use Redgate?
@Gemtastic don't forget to accept your own answer
@MichaelBrandonMorris Psssht speak for yourself. If I could afford it I totally would. IN SLi.
 
0
Q: Custom implementation to achieve Inversion of Control

Xavier PeñaI am writing a simple app, a "proof of concept" in Xamarin Forms. I am familiar with the Inversion of Control but I have not really architectured any Dependency Injection framework to this day, so I would like to avoid them because: It would make me prone to make design errors It would slow d...

0
Q: Python : Find digits in a given number

srkHere is my code that finds the number of digits in a given integer (either positive or negative). The code works and results in expected output. ''' Program that returns number of digits in a given integer (either positive or negative) ''' def ndigits(x): # Assume for the input 0 the output...

 
@CaptainObvious no code no upvotes
 
@DanPantry I kept it open in case someone else has a good answer
But you can change the accepted answer
 
8:16 AM
Math.pow(2, 1208)
> Infinity
wtf js
 
Ubuntu is teaching me so much about itself by having so many things not working out of the box XD
 
Zak
@DanPantry "From £1,095" - Nope. Definitely not.
That's my answer that got linked ^^, don't think I've had that happen before
 
@Zak reap those long hanging fruits
 
8:31 AM
@Zak It's definitely worth it if your business pays for it.
The SQL Source control is all I use and it is so incredibly good.
 
Zak
@DanPantry I expect I'll have to build the thing first. Once it's there and making a noticeable improvement to our operations, I can probably make a convincing case for investing in improving it.
 
@Zak I believe there's an evaluation version FYI.
 
Zak
@DanPantry For 2 weeks or so.
 
@Zak really? I thought it was 30 days...
definitely keep your eye on it though, the amount of stuff it adds that isn't in the default set is mindblowing
i.e, a really nice thing the source control plugin does is migrations and synchronising any given db with source control
it can also do data migrations - not just schema ones
 
8:48 AM
Suggestions for how to summarize Code Review Stack Exchange in two sentences?
At a little event in October, I will talk about 15 minutes about CR. In the ad for this event, I need to summarize CR in two sentences.
 
Zak
@SimonForsberg Your Code, Better.
 
That's not even one sentence!
 
Zak
@SimonForsberg Your description, Better.
 
@SimonForsberg Bad titles, good reviews. /s
2
@SimonForsberg "Code review makes bad code better, and good programmers great" (though this sounds a bit.. cheesy)
 
Zak
@DanPantry I like it.
 
8:59 AM
Yes, but it doesn't really explain what we do, it's almost a tag line you'd expect on a car ad. Like that "American, F yeah" song
Side note: A song like "America F Yeah", but for Code Review, would be amazing.
Another cool thing about generators... infinite sequences
function* infinite() {
  let previous = 0
  while (true) {
    previous++
    yield previous
  }
}

function* take(generator, max) {
  let haveTaken = 0
  for (let el of generator) {
    if (max <= haveTaken) {
      return
    }

    yield el

    haveTaken++
  }
}

for (let el of take(infinite(), 5)) {
  console.log(el)
}
 
@ZAK Application.EnableEvents = false... is this really a good idea?
I guess for most simple apps it doesn't matter.
 
Zak
@Gareth It depends, does your macro rely on worksheet (or other) events firing?
If not, it's a great idea.
Ditto for functions re-calculating and Application.Calculation
 
It's a discussion. I'm convinced it's not a good idea in the general, but you often put it into your code reviews.
 
@DanPantry What does Code Review do with bad programmers then?
 
I'd think the question would be better on codereview.stackexchange.comMaximilian Ast 13 secs ago
 
9:11 AM
your macro might not rely at all on events firing, but you might have events firing from other addins
 
@SimonForsberg Gives them the tools to improve.
 
@DanPantry Never heard that song...
 
Just thought I'd throw it out there.
 
@DanPantry @Zak Yeah, I'd like a more informative description about what CR.SE actually is.
 
Zak
9:12 AM
@Gareth A lot of (well-written) Macros shouldn't require workbook events at all. Especially at the simpler data manipulation/calculation end. IMO, in practice, most code works perfectly fine without it, and it can make a big performance difference, so I like to improve it. If OPs find it causes problems, they'll figure it out soon enough.
 
@SimonForsberg The two line line description makes it rather difficult, though I suppose that's why you're asking here... what kind of image are you trying to paint to the audience?
 
Zak
Step 1: Post working code to CR
Step 2: Receive peer-reviewed feedback and suggestions
Step 3: A more informed, better programmer with better Code.
 
On the other hand if there are no events being caught then you aren't saving any time. But if there are events being caught you are by passing someones code
 
@MaximilianAst I did consider code review site and you are probably correct it would be more suited for it but it doesn't really seem to get as much traffic — Ctrl_Alt_Defeat 28 secs ago
 
@Zak, My discussion is on the use of/or not, and not on the review process.
 
Zak
9:14 AM
@Gareth Depends. Do you have any idea how many workbook events trigger when you do anything to/with a worksheet?
 
none if you don't hook into them
yes there's a ton of hooks
 
Zak
Code that doesn't interact at all with any workbook (or other MS application) has no business being written in VBA.
 
? Not sure what you mean
 
Zak
@Gareth If your code never does anything that would trigger a workbook event, then what on earth is it doing?
 
@Zak I might have an add-in that changes my hot keys depending on the active workbook, or active cell range.
 
Zak
9:17 AM
@Gareth Sure, but why would this matter *while* the code is executing
 
@Zak I might turn that around on you and say, how would you know it doesn't. Very specifically you are suggesting disabling events on a workbook open event. Application.EnableEvents has global impact, not local to macro.
 
@DanPantry @Zak So far my best attempt is something like "Code Review Stack Exchange, a sister site to Stack Overflow, for programmers that have working code that they want to improve any aspects of"
 
Zak
@Gareth This is generally why I remind people that it's important to scope Application changes and always reset them when you're done with them.
 
In any case, just a discussion point on your template answer. I don't think EnableEvents = false belongs there, or if you do add it you should caveat what it does.
 
Zak
@Gareth That's a fair point.
 
9:21 AM
That's another thing. Resetting is counter intuitive. Rather wrap in a class, and reset by way of the class going out of scope. But that's way too complicated for the standard user.
 
Zak
@Gareth Yeah. One step at a time. I still remember (I think) what it was like when I was learning. So I try not to leap over intermediate steps and concepts from where the OP currently is.
 
totally
 
Zak
And often, that's only a couple of steps above the Macro Recorder.
@Gareth I think you've got a good point though. I should explain a bit more about what effects Application.[Settings] have in my reviews.
 
In other news, if anyone knows about Apache Karaf, please see this:
2
Q: Apache Karaf feature prerequisite

stromvapKaraf 4.0.3 I have the following pseudo-feature: <features name="my-feature" xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.3.0 http://karaf.apac...

 
If your code is functioning, a better place to ask this question would be codereview.stackexchange.com where they specifically focus on improving and optimizing working code — RGA 36 secs ago
 
9:28 AM
@zak just one other point to make on it is that nested methods would also kill it. So I'm finished dishing you :). But hope that was ok as a review of a template answer.
 
9:47 AM
monking
4 items in the CV-Queue
 
Need 301 more rep to view that queue, I should get reviewing
 
10:04 AM
Personally think this is probably better placed on codereview. — Jon Stirling 1 min ago
 
@Vogel612 npoljoh
@DanPantry Reviewing code?
Or new posts/late reviews?
 
new posts
and zombies
 
10:21 AM
what the actual flying???...
could someone check mse/questions whether that happens for you, too?
because 4 isn't really 15...
 
no repro here
@DanPantry babel compiles async functions down to generators ;-)
 
1
Q: Use of Async/Await for EventHandlers

KillercamI have a MVC WinForms application. I am using Dependency Injection with Ninject as the IoC container. public class SqlObjectExplorerController : ToolController, ISqlObjectExplorerController { private ISqlObjectExplorerView view = null; private SqlServerStructureProvider structureProvide...

0
Q: Extract the largest value for each day from a matrix

Stewie GriffinI have a matrix in which the right-most elements are repeated YYYYMMDD dates in descending order, for example: 40 1122 1711 20160326 169 700 950 20160326 40 1630 1711 20160326 182 700 950 20160327 40 1029 ...

 
@JonStirling thanks, never knew there is codereview section before — oit oit 56 secs ago
 
10:36 AM
0
Q: Reusable code snippet to start activity

Hardik TrivediWe all do startActivity() to start new activity from anywhere. Now how good practice it is to have ActivityUtils and that has different methods to deal with startActivity() / startActivityForResult(). And Activity/Fragment can pass Intent with class reference set and bundle if required. Note : W...

 
Zak
11:26 AM
For anyone who likes their political intrigue, UK politics is resembling a Shakespearean epic more and more every day.
 
@Zak Boris Juliette and Romeo Cameron?
@Quill Yes, but they do that as a hack ^^
Generators are a great way of making a state machine, but a Promise is not at all analogous to LINQ. If anything, a Promise is more like a Stream (List over time) that produces a single value
 
Zak
@DanPantry I was actually thinking more Richard Michael III
 
"Boris announces he will not stand for PM" wot
I expect he will have another announcement stating he will run as Glorious Blonde Dictator instead.
We should discuss this in Nth
 
Zak
indeed we should
 
0
Q: Reusable code snippet to start activity

Hardik TrivediWe all do startActivity() to start new activity from anywhere. Now how good practice it is to have ActivityUtils and that has different methods to deal with startActivity() / startActivityForResult(). And Activity/Fragment can pass Intent with class reference set and bundle if required. Note : W...

not closed why
 
11:42 AM
@Pimgd answered why
 
that too
I don't have any reason to downvote it though
 
I downvoted OP because it's off-topic
I've been downvoted quite hard in the past for answering off-topicq uestions
 
Monking
 
11:59 AM
0
Q: clean up data validation

user3610360I am checking data output in some testing code, and only some fields can be None, but I think this can be better: for key in data[0].keys(): self.assertIn(key, data_model) if data[0][key] is None: self.assertTrue('rate' in key or 'percentage' in key or 'ratio' in key)...

0
Q: Retrieve data from json file and avoid HTML/JS tight coupling

AzzolinaI am retrieving data from a json object and even though code works I am not sure if I am following best practices. In particular some of the objects seems too deep (like value.metadata.connections.comments.total) and not sure if there is a better way to avoid creating all my markup in JS. (fun...

0
Q: A plot for f versus t in matlab for a non-linear Frequency modulation signal

GowthamiI have the mathematical equation for time- frequency relationship as below: t = Tp.*(f/Bp + (1/(2*pi).* sin((2*pi*f)./Bp))); where Bp is the Bandwidth, Tp is the pulse duration. can anybody help me to write this equation in terms of f. I want to use the f to compute the phase and the signal ...

0
Q: Divide number by factors

bezieurI'm learning F#. The code below gets a number e.g. 100 and list of factors and should divide that number by the factors without any rest. (There is an actual code I've got in C#, but this is F# port). I especially didn't liked equalsDifference function.. any better solution? namespace Rozbijacz...

 
12:15 PM
Monking
 
Wow
29
Q: Get last element of Stream/List in a one-liner

skiwiHow can I get the last element of a stream or list in the following code? Where data.careas is a List<CArea>: CArea first = data.careas.stream() .filter(c -> c.bbox.orientationHorizontal).findFirst().get(); CArea last = data.careas.stream() .filter(c -> c.bbox.orientationHorizontal).collect(Co...

> You've earned the "Famous Question" badge (Questions with 10,000 views) for "Get last element of Stream/List in a one-liner".
 
12:36 PM
I'm voting to close this question as off-topic because code reviews (assuming it works) should be posed to codereview.stackexchange.comRichard 59 secs ago
 
0
Q: Custom Python 'Server Status Checker'

Thomas W.I've written a home-grown solution for checking the status of my servers. This is both an exercise for me in learning further about Python, but it's also critical to status-checking critical things on my "network" of servers - both running against both an internal ("home") network against 18 or ...

 
hey look it's Thomas W
 
1:13 PM
Monking.
 
Post to Code Review instead. — Juhana 26 secs ago
 
@skiwi congrats!
 
^^ thanks, I didn't expect that question to get that huge
 
I'm just biting my tongue to avoid saying "just do myList.Last() in C#" ...wait I said it did I?
 
Like any language has first() and last() :|
Only Java says screw you
On another note: WPF is fun /s
 
1:23 PM
:)
 
I mean, I need to abuse (imo) style triggers to set visibility of an element dependent on another element, but that style trigger overrides all other styles that are associated with your element :|
 
make a new style BasedOn the original one, and add the trigger there
 
Except the trigger depends on one specific field, it's not a "general style"
 
oh, fun
 
I'm almost there, but not quite
I'm working in a <TextBox.Style> inside <TextBox> right now, but haven't found a way to set TargetType={This} equivalent, and if I use TargetType={x:Type TextBox} then all textboxes style are overridden
TargetType also kind of implies that you target a type
 
1:28 PM
if you're in TextBox.Style then you don't need a target type
 
Except if you're using BasedOn
 
what's the other style doing anyway?
 
Adding a margin to all TextBoxes
 
hmm imo that's where style abuse is happening
you could control layout from the parent's Padding instead
 
@Mat'sMug pastebin.com/XxqDTxXC Yes this might be abuse
@Mat'sMug Unless the parent happens to be a Grid that doesn't have a Padding property :D
 
1:31 PM
yup, looks like it :)
 
I'm trying to style that fuel cost related text box properly >.> That's all I want :P
All I want is for my code to work!
cries
 
@skiwi perhaps a Grid isn't the best layout option then?
I rarely use a grid
you want:
 
What should I use then if I want my data to be layed out in a grid?
 
label textbox
label textbox
you could have a vertically-stacked StackPanel, where each "row" consists of a horizontally-stacked StackPanel, if they don't need to line up - or, a 2-column Grid if they do
 
I do want them to line up so I thought a stack panel wouldn't be the greatest
Looks like the bigger problem is with conditional elements though, if that part could be solved I'm also out of this mess for now
 
That looks pretty damn nat
 
pretty much all @Hosch250's work
 
someone made a cool git commit tree graph visualiser program called Gource, it's pretty good to visually watch the history of the repo
 
/s/nat/neat/
@Quill That's an awesome program yep :)
 
I ran it over a few high profile SE projects and watching the history was pretty interesting
 
1:42 PM
@Mat'sMug Do you think that setting element visibility should be done in C# back code instead of XAML if it ends up cluttering XAML this much?
 
Monking!
I just moved out
 
I tend to avoid plain C# if it can be done with XAML. Sometimes I'll just write it in C# anyway, move on to something else, and then eventually figure out the markup and remove the C# code-behind
@N3buchadnezzar monking!
 
Hmm okay
Interestingly the text boxes are still messed up now I removed the styles to conditionally show then, so perhaps something else is up
 
Zak
my PC has suddenly become unbearably slow this week. It just took it an entire minute to open chrome.
 
...really, by adding x:Key="TextBoxMarginStyle" (simply naming the style) to my Style it stopped working
@Zak That doesn't sound too good :/
 
1:46 PM
hi @enderland!
 
HAI ENDERLAND
 
hey @enderland
 
hello enderland
 
seeing @enderland's avatar always makes me feel happy. don't know why.
4
 
@Mat'sMug Maybe because it is a smiley? It is a human reacton to be happy when others are happy.
 
1:50 PM
OMG IT WORKS
 
@N3buchadnezzar but... I'm a mug!
 
@Mat'sMug The issue was that the style defined in Grid.Resources wasn't working at all
 
;^)
 
-1
Q: Making a object move when pressing a key. Python Tkinter: PONG game

kaspersinoSo I'm trying to do a Pong game but I'm stuck with the "moving of paddle" thing. I've managed to do so that the method "moving" recognizes with i've pressed w or s for up or down commands. But I can't seem to get the paddle to move with the .move command and I can't find what's wrong. Thanks for ...

0
Q: PHP Permutations Script Needs Optimization

oit oitI have functions of permutation : function permutations($letters,$num) { $last = str_repeat($letters[0],$num); $result = array(); while($last != str_repeat($this->lastchar($letters),$num)) { $result[] = $last; $last = $this->char_add($letters,$last,$num-1); } $res...

 

« first day (1153 days earlier)      last day (1263 days later) »