• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 02:35
CET 08:35
KST 16:35
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
RSL Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
Weekly Cups (Dec 15-21): Classic wins big, MaxPax & Clem take weeklies3ComeBackTV's documentary on Byun's Career !11Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win4Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump1Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2
StarCraft 2
General
ComeBackTV's documentary on Byun's Career ! Team TLMC #5: Winners Announced! What's the best tug of war? The Grack before Christmas Weekly Cups (Dec 15-21): Classic wins big, MaxPax & Clem take weeklies
Tourneys
OSC Season 13 World Championship $5,000+ WardiTV 2025 Championship $100 Prize Pool - Winter Warp Gate Masters Showdow Sparkling Tuna Cup - Weekly Open Tournament Winter Warp Gate Amateur Showdown #1
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 505 Rise From Ashes Mutation # 504 Retribution Mutation # 503 Fowl Play Mutation # 502 Negative Reinforcement
Brood War
General
BW General Discussion How soO Began His ProGaming Dreams Klaucher discontinued / in-game color settings BGH Auto Balance -> http://bghmmr.eu/ Recommended FPV games (post-KeSPA)
Tourneys
[Megathread] Daily Proleagues [BSL21] LB SemiFinals - Saturday 21:00 CET [BSL21] WB & LB Finals - Sunday 21:00 CET Small VOD Thread 2.0
Strategy
Simple Questions, Simple Answers Game Theory for Starcraft Current Meta Fighting Spirit mining rates
Other Games
General Games
Nintendo Switch Thread Mechabellum Stormgate/Frost Giant Megathread Beyond All Reason Path of Exile
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas Survivor II: The Amazon Sengoku Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread 12 Days of Starcraft The Games Industry And ATVI Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List TL+ Announced Where to ask questions and add stream?
Blogs
National Diversity: A Challe…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Saturation point
Uldridge
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1324 users

The Big Programming Thread - Page 737

Forum Index > General Forum
Post a Reply
Prev 1 735 736 737 738 739 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
DrywMz
Profile Blog Joined May 2007
United States394 Posts
Last Edited: 2016-06-17 05:09:03
June 17 2016 05:06 GMT
#14721
On June 17 2016 06:48 Frudgey wrote:
So I'm messing around with C# and I'm building a financial calculator (using a form) and I had a question.

So basically I want to calculate the rate of return, but I wish to do so dynamically. So what I would want is that the user inputs data into available text boxes, and then as soon as the user inputs values into those text boxes, the program would populate another text box using that information. Note that this would be done without pressing a button (e.g., hitting a "calculate" button to calculate the value) and would happen as soon as the data is entered.

I was thinking of having a thread or something help me out with this, and I did some looking online and "DoEvents" seemed like a possibility. However I did some reading up on it and now I'm not so sure if that's the best course of action.

If anyone knows what I'm talking about (sorry if I'm unclear) and knows what I want to accomplish and could point me in the right direction, I'd be super grateful.


Use the keypress event for the textbox you're typing in.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
June 17 2016 06:30 GMT
#14722
--- Nuked ---
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
Last Edited: 2016-06-17 06:51:28
June 17 2016 06:47 GMT
#14723
https://msdn.microsoft.com/en-us/library/system.windows.controls.textbox.textchanged(v=vs.95).aspx

User input or setting the Text property to a new value raises the TextChanged event.
If the Text property is set to the same string as the content in the TextBox, the event is not raised.
The TextChanged event is asynchronous. The event cannot be canceled.


EDIT: Actually, looks like that documentation is for silverlight. Should still be pretty much the same in windows forms and wpf.
Silvanel
Profile Blog Joined March 2003
Poland4736 Posts
Last Edited: 2016-06-17 11:14:52
June 17 2016 11:09 GMT
#14724
On June 17 2016 02:12 Nesserev wrote:
Show nested quote +
On June 17 2016 00:14 Silvanel wrote:
Anyone here with experience with selenium?

Yes.


webdriver
python3.5
firefox

I am trying to use webdriver with python. I have problem with opening browser (it opens briefly but then shut down with error immiediately without going to desired webpage with error:
"ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host".

From what i have read on net this is most likely issue with proxy (is it true?). I tried to setup proxy in my python code but this doesnt solve the issue (i use adress of automatic configuration).

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.proxy import *

proxy = Proxy({
'proxyType' : ProxyType.PAC,
'proxyAutoconfigUrl' : 'some_adress'})

driver = webdriver.Firefox(proxy=proxy)
driver.get(some_web_page)


And another question, if i dont use proxy for connection to net do i still need to setup proxy in code? Or should it work fine? I still get an error (but different).
Pathetic Greta hater.
Acrofales
Profile Joined August 2010
Spain18159 Posts
June 17 2016 11:28 GMT
#14725
On June 17 2016 15:30 Nesserev wrote:
Show nested quote +
On June 17 2016 14:06 DrywMz wrote:
On June 17 2016 06:48 Frudgey wrote:
So I'm messing around with C# and I'm building a financial calculator (using a form) and I had a question.

So basically I want to calculate the rate of return, but I wish to do so dynamically. So what I would want is that the user inputs data into available text boxes, and then as soon as the user inputs values into those text boxes, the program would populate another text box using that information. Note that this would be done without pressing a button (e.g., hitting a "calculate" button to calculate the value) and would happen as soon as the data is entered.

I was thinking of having a thread or something help me out with this, and I did some looking online and "DoEvents" seemed like a possibility. However I did some reading up on it and now I'm not so sure if that's the best course of action.

If anyone knows what I'm talking about (sorry if I'm unclear) and knows what I want to accomplish and could point me in the right direction, I'd be super grateful.


Use the keypress event for the textbox you're typing in.

Not familiar with the options available in C# forms (never touched C# in fact), but aren't there better alternatives than using 'keypress' events to trigger this functionality? For example pasting a value probably won't trigger a keypress event (well, it shouldn't). Isn't there an 'input' or 'change' event?

Show nested quote +
On June 17 2016 10:58 Acrofales wrote:
On June 17 2016 08:23 RoomOfMush wrote:
Why not react to changes being made to the textfields? Every time the user inputs some numbers you update the other textfield. I dont see why you would ever need multi threading for this.

Pretty much this. I don't know anything about C#, but if it requires multithreading to react to user input, it seems terrible... and what I have heard is that C# is not terrible.

A lot of event-driven application frameworks use multi-threading under the hood, but this isn't always the case. Some use the GUI's mainloop to react to events and call the 'event handlers' in the mainloop. This way, the decision to do a simple and fast calculation, or to create and start a new thread for heavier calculations, or do anything else, is relayed to the programmer.

Whether or not there is a single case in which this approach leads to any substantial advantages... I genuinely do not know.


If the compiler "under the hood" decides to make things multithreaded, doesn't that play havoc with variables? The compiler would have to "know" what parts of the code should be synchronized, and which are inherently threadsafe. A "dumb" compiler would have to add monitors (or whatever other mechanism) to any non-local variable, which seems far from optimal.

Leaving it to the programmer (e.g. Android philosophy) seems like a far smarter approach. But language and compiler design is not my specialty.
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
June 17 2016 11:38 GMT
#14726
On June 17 2016 20:28 Acrofales wrote:
Show nested quote +
On June 17 2016 15:30 Nesserev wrote:
On June 17 2016 14:06 DrywMz wrote:
On June 17 2016 06:48 Frudgey wrote:
So I'm messing around with C# and I'm building a financial calculator (using a form) and I had a question.

So basically I want to calculate the rate of return, but I wish to do so dynamically. So what I would want is that the user inputs data into available text boxes, and then as soon as the user inputs values into those text boxes, the program would populate another text box using that information. Note that this would be done without pressing a button (e.g., hitting a "calculate" button to calculate the value) and would happen as soon as the data is entered.

I was thinking of having a thread or something help me out with this, and I did some looking online and "DoEvents" seemed like a possibility. However I did some reading up on it and now I'm not so sure if that's the best course of action.

If anyone knows what I'm talking about (sorry if I'm unclear) and knows what I want to accomplish and could point me in the right direction, I'd be super grateful.


Use the keypress event for the textbox you're typing in.

Not familiar with the options available in C# forms (never touched C# in fact), but aren't there better alternatives than using 'keypress' events to trigger this functionality? For example pasting a value probably won't trigger a keypress event (well, it shouldn't). Isn't there an 'input' or 'change' event?

On June 17 2016 10:58 Acrofales wrote:
On June 17 2016 08:23 RoomOfMush wrote:
Why not react to changes being made to the textfields? Every time the user inputs some numbers you update the other textfield. I dont see why you would ever need multi threading for this.

Pretty much this. I don't know anything about C#, but if it requires multithreading to react to user input, it seems terrible... and what I have heard is that C# is not terrible.

A lot of event-driven application frameworks use multi-threading under the hood, but this isn't always the case. Some use the GUI's mainloop to react to events and call the 'event handlers' in the mainloop. This way, the decision to do a simple and fast calculation, or to create and start a new thread for heavier calculations, or do anything else, is relayed to the programmer.

Whether or not there is a single case in which this approach leads to any substantial advantages... I genuinely do not know.


If the compiler "under the hood" decides to make things multithreaded, doesn't that play havoc with variables? The compiler would have to "know" what parts of the code should be synchronized, and which are inherently threadsafe. A "dumb" compiler would have to add monitors (or whatever other mechanism) to any non-local variable, which seems far from optimal.

Leaving it to the programmer (e.g. Android philosophy) seems like a far smarter approach. But language and compiler design is not my specialty.


A few years ago when I last did UI stuff with C#, changing the UI directly caused thread exceptions, because you tried to change variables in a different thread and C# caught that. You had to explicitely use Invoke() to execute code - like changing a value - in the UI scope. I imagine that it's still the same.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2016-06-17 12:16:30
June 17 2016 12:15 GMT
#14727
--- Nuked ---
Silvanel
Profile Blog Joined March 2003
Poland4736 Posts
Last Edited: 2016-06-17 12:36:11
June 17 2016 12:33 GMT
#14728
I am trying to run it on my computer with my own browser. Remote is for running selenium instances on servers isnt it?

I think i will try to downgrade python to 3.4 i remember that it worked with it (altough i wasnt usuing automatic proxy configuration url back then also).
Pathetic Greta hater.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
June 17 2016 12:46 GMT
#14729
--- Nuked ---
Mnemic
Profile Joined April 2010
Botswana80 Posts
June 17 2016 12:48 GMT
#14730
On June 17 2016 15:30 Nesserev wrote:
Show nested quote +
On June 17 2016 14:06 DrywMz wrote:
On June 17 2016 06:48 Frudgey wrote:
So I'm messing around with C# and I'm building a financial calculator (using a form) and I had a question.

So basically I want to calculate the rate of return, but I wish to do so dynamically. So what I would want is that the user inputs data into available text boxes, and then as soon as the user inputs values into those text boxes, the program would populate another text box using that information. Note that this would be done without pressing a button (e.g., hitting a "calculate" button to calculate the value) and would happen as soon as the data is entered.

I was thinking of having a thread or something help me out with this, and I did some looking online and "DoEvents" seemed like a possibility. However I did some reading up on it and now I'm not so sure if that's the best course of action.

If anyone knows what I'm talking about (sorry if I'm unclear) and knows what I want to accomplish and could point me in the right direction, I'd be super grateful.


Use the keypress event for the textbox you're typing in.

Not familiar with the options available in C# forms (never touched C# in fact), but aren't there better alternatives than using 'keypress' events to trigger this functionality? For example pasting a value probably won't trigger a keypress event (well, it shouldn't). Isn't there an 'input' or 'change' event?


There is. Check the INotifyPropertyChanged Interface.
Hhanh00
Profile Joined May 2016
34 Posts
June 17 2016 14:15 GMT
#14731
On June 17 2016 21:46 Nesserev wrote:
In the second case (multi-threaded), the framework usually calls a new thread for every eventhandler anwyay. The programmer doesn't have to manually manage the threads anymore. Think of JavaScript in your browser.


What do you mean by that? Javascript is single-threaded or to be more precise event-loop and callback based.
Silvanel
Profile Blog Joined March 2003
Poland4736 Posts
June 17 2016 16:06 GMT
#14732
If anyone is intrested i figured out what was wrong. Apparently selenium (webdriver in particular) doesnt support firefox 47. A simple downgrade of firefox helped.
Pathetic Greta hater.
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
June 18 2016 00:53 GMT
#14733
--- Nuked ---
Hhanh00
Profile Joined May 2016
34 Posts
June 18 2016 01:26 GMT
#14734
On June 18 2016 09:53 Nesserev wrote:
Show nested quote +
On June 17 2016 23:15 Hhanh00 wrote:
On June 17 2016 21:46 Nesserev wrote:
In the second case (multi-threaded), the framework usually calls a new thread for every eventhandler anwyay. The programmer doesn't have to manually manage the threads anymore. Think of JavaScript in your browser.


What do you mean by that? Javascript is single-threaded or to be more precise event-loop and callback based.

Oops, yeah... guess I shouldn't have used an example that I know nothing about.

What I was trying to get at is that in some cases, the frameworks do not provide you with the necessary abstractions to handle events efficiently, in which case you have to resort to using your own threads, and some do.

I think I started talking about single-threaded vs multi-threaded because of the examples in my mind.


I see. Every even-driven framework will run the callback or even-loop in a single thread (not necessarily always the same one). It's simply a model that makes sense since we can run multiple event loops if we want. At a higher level than a simple message loop, there is the actor model that adds fail-fast and recovery (baked in Erlang and ported to many other languages) or CSP (natively in Go and also ported to other languages). But if one prefers to stick with the bare metal, there are still a few wrappers that introduce very little overhead such as libevent, libev or libuv.
Basically, this stuff is hard and bugs are even harder to figure out. For instance, spawning a new thread in a event handler is generally bad. Threads aren't that cheap. It would be preferable to have a scheduler with some work stealing algorithm.
waffelz
Profile Blog Joined June 2012
Germany711 Posts
June 18 2016 11:40 GMT
#14735
Oh the joy of network communication... I have 2 components that communicate via TCP, everything works fine. Now another method of communication gets added and I have to change settings in the VM accordingly for the new method. Result: new method works fine, old method is partially broken, despite not having changed anything in the code. C2 somehow refuses all connections from C1, C1 still accepts all connections/messages from C2 and both have the exact same code for their client/server. There is no conflict with ports, I ruled out wrong adress, changing the VM on which C1/C2 runs doesn’t matter either. If I run C1 and C2 on the same VM and use localhost:port/0.0.0.0:port as addresses everything works. So why in the horned compilers name does C1 -> C2 doesn't work while C2 -> C1 does... Not asking for help, just having to vent a bit before I go for a walk... I love programming, I really do at least I will again after I figured this one out.
RIP "The big travis CS degree thread", taken from us too soon | Honourable forum princess, defended by Rebs-approved white knights
Hanh
Profile Joined June 2016
146 Posts
June 18 2016 14:26 GMT
#14736
Maybe a firewall issue? C2 may not accept incoming connections but is OK connecting out.
waffelz
Profile Blog Joined June 2012
Germany711 Posts
Last Edited: 2016-06-18 15:07:18
June 18 2016 15:00 GMT
#14737
Yeah but since the VMs are clones all settings are the same and it didn’t matter if C1 was running on VM1 or VM2. In the end apparently it was a router malfunction, checked my router and had weird logs, restarted it and everything works now.

To further bring you the joy of my programming life, over the last semester I did an awesome internship at a big software company where in the end I was practically treated like a proper member of their design team. I learned a lot, especially how important it is to really really define what you will deliver to the customer and have him agree to it. I tutor a course this semester and the prof asked me to hold a lecture about my internship and what I learned there which I apparently did to good of a job on.

The students had an assignment which unfortunately didn't listed the functions in the goal section but rather in the explanation of how it should works while in the goal section it is only stated that the program should never ever crash, while not stating that it should still give the proper result or even results at all.
The end result was a flashback to this stackoverflow.com, namely:

catch all exceptions in the COM interface of our COM modules, and dispose them silently (this way, instead of crashing, a module would only appear to be faster... Shiny!... As we used the über error handling described above, it even took us some time to understand what was really happening... You can't have both speed and correct results, can you?).

Ever seen a main with a try-catch? Basically I have read multiple programs where either everything is in a try-catch block or the program simply restarts itself if feed with wrong input/something isn’t working for some reason.
The icing on the cake was one program which did everything asked in the assignment perfectly and the only one so far which could be described as a perfect solution but also featuring a try-catch block in the main, commented as "just to be sure" and "thanks for the lecture on change-request management / requirement-management mr. waffelz" followed by a nice ascii-art.

So after a very entertaining talk with the professor, I now will give everyone at least a passing grade on this assignment and after that I have to review each and every one of his assignments and rework it regarding its requirements if needed xD
RIP "The big travis CS degree thread", taken from us too soon | Honourable forum princess, defended by Rebs-approved white knights
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
Last Edited: 2016-06-18 15:27:49
June 18 2016 15:27 GMT
#14738
Hey folks, I'm trying to get Ubuntu set up again and I'm having trouble with the wireless for it.

This is an almost fresh install of Ubuntu over top of Windows on a fairly new computer. I have a USB wireless adapter, but it can not pick up any wireless signals. It works perfectly in Windows, and wired connections work fine.


lsusb
Bus 001 Device 004: ID 13b1:003f Linksys WUSB6300 802.11a/b/g/n/ac Wireless Adapter [Realtek RTL8812AU]



sudo lshw -C network
*-network DISABLED
description: Wireless interface
physical id: 1
bus info: usb@1:3
logical name: enxc8d719c160f1
serial: c8:d7:19:c1:60:f1
capabilities: ethernet physical wireless
configuration: broadcast=yes driver=rtl8812au multicast=yes wireless=unassociated


If you could help me with this I'd appreciate it. I've spent hours digging through forum threads but all of them seem to be for Ubuntu 14, and I'm using Ubuntu 16.04.
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
Last Edited: 2016-06-19 02:26:21
June 19 2016 02:25 GMT
#14739
--- Nuked ---
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
June 19 2016 06:10 GMT
#14740
To be honest, I couldn't properly explain because it was mostly blindly following instructions online

I have enabled my wireless in the past and that didn't work.

I will try that tomorrow and report back. Thanks for the recommendation
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Prev 1 735 736 737 738 739 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 2h 25m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
WinterStarcraft637
NeuroSwarm 220
StarCraft: Brood War
actioN 2225
Larva 489
Stork 376
Shuttle 112
NotJumperer 31
Sharp 17
eros_byul 0
League of Legends
JimRising 681
C9.Mang0451
Counter-Strike
summit1g7531
Other Games
XaKoH 178
RuFF_SC2135
minikerr57
Organizations
Other Games
gamesdonequick975
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• practicex 47
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Rush1343
• Lourlo1070
Other Games
• Scarra1928
Upcoming Events
Sparkling Tuna Cup
2h 25m
Krystianer vs Classic
TriGGeR vs SKillous
Percival vs Ryung
ByuN vs Nicoract
OSC
10h 25m
BSL 21
12h 25m
Cross vs Dewalt
Replay Cast
1d 1h
Wardi Open
1d 4h
OSC
2 days
Solar vs MaxPax
ByuN vs Krystianer
Spirit vs TBD
OSC
5 days
Korean StarCraft League
5 days
OSC
6 days
OSC
6 days
Liquipedia Results

Completed

Escore Tournament S1: W1
WardiTV 2025
META Madness #9

Ongoing

C-Race Season 1
IPSL Winter 2025-26
BSL Season 21
CSL Season 19: Qualifier 2
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025

Upcoming

CSL 2025 WINTER (S19)
Escore Tournament S1: W2
Escore Tournament S1: W3
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
OSC Championship Season 13
Nations Cup 2026
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.