• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 13:15
CET 19:15
KST 03:15
  • 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
TL.net Map Contest #21: Winners11Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13TL.net Map Contest #21: Voting12[ASL20] Ro4 Preview: Descent11
Community News
StarCraft, SC2, HotS, WC3, Returning to Blizzcon!45$5,000+ WardiTV 2025 Championship7[BSL21] RO32 Group Stage4Weekly Cups (Oct 26-Nov 2): Liquid, Clem, Solar win; LAN in Philly2Weekly Cups (Oct 20-26): MaxPax, Clem, Creator win10
StarCraft 2
General
SC: Evo Complete - Ranked Ladder OPEN ALPHA Mech is the composition that needs teleportation t TL.net Map Contest #21: Winners StarCraft, SC2, HotS, WC3, Returning to Blizzcon! RotterdaM "Serral is the GOAT, and it's not close"
Tourneys
Constellation Cup - Main Event - Stellar Fest Sparkling Tuna Cup - Weekly Open Tournament $5,000+ WardiTV 2025 Championship Merivale 8 Open - LAN - Stellar Fest Sea Duckling Open (Global, Bronze-Diamond)
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection
Brood War
General
FlaSh on: Biggest Problem With SnOw's Playstyle BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ask the mapmakers — Drop your questions BW General Discussion Where's CardinalAllin/Jukado the mapmaker?
Tourneys
[Megathread] Daily Proleagues [ASL20] Grand Finals [BSL21] RO32 Group A - Saturday 21:00 CET [BSL21] RO32 Group B - Sunday 21:00 CET
Strategy
PvZ map balance Current Meta How to stay on top of macro? Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Stormgate/Frost Giant Megathread Should offensive tower rushing be viable in RTS games? Nintendo Switch Thread Path of Exile Dawn of War IV
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
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread US Politics Mega-thread The Games Industry And ATVI
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread Movie Discussion! Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Learning my new SC2 hotkey…
Hildegard
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Reality "theory" prov…
perfectspheres
Our Last Hope in th…
KrillinFromwales
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1430 users

The Big Programming Thread - Page 920

Forum Index > General Forum
Post a Reply
Prev 1 918 919 920 921 922 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.
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
November 21 2017 01:19 GMT
#18381
On November 21 2017 10:08 Hanh wrote:
Nice! Was it because the credentials were not passed to the transaction 'send funds'?

Nope, it turns out that for ECKeys if you pass in the private key it can generate the address. I was putting a fake password in for testing("pass") and it was giving me the wrong address. I just could not wrap my head around why it was getting the wrong address, or how it got an address at all.

Finally I started digging deeper into the code for ECKeys and Credentials(I ended up digging pretty damn deep) and realized that it just... didn't need an address anywhere in there(though you could put one if you wanted). I googled some terms related to ECKeys and found a post that mentioned that you can derive the address from the private key and it all clicked(aha!).
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
WarSame
Profile Blog Joined February 2010
Canada1950 Posts
November 21 2017 04:34 GMT
#18382
As a follow on to that previous post, if you can generate an address from a private key what's to stop you from simply running through a ton of private keys, generating their addresses, and taking that ethereum?
Can it be I stayed away too long? Did you miss these rhymes while I was gone?
Hanh
Profile Joined June 2016
146 Posts
November 21 2017 07:15 GMT
#18383
On November 21 2017 13:34 WarSame wrote:
As a follow on to that previous post, if you can generate an address from a private key what's to stop you from simply running through a ton of private keys, generating their addresses, and taking that ethereum?


There are too many addresses out there, ~2^160 or about the number of atoms in the world. Though it is theoretically possible to have a collision, the odds are so low that there is no practical chance to find a non-empty address by luck.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
November 21 2017 08:26 GMT
#18384
On November 21 2017 09:53 WarSame wrote:
I got the code I was working on to finally work muthafuckas!!!

@Blisse, is that because it slots into Java really nicely? I glanced through their pages and didn't see anything that made it a must-have, but then again I also don't know much.


Retrofit and RxJava (together and individually) are better ways to write Android code.
There is no one like you in the universe.
R1CH
Profile Blog Joined May 2007
Netherlands10341 Posts
November 22 2017 10:56 GMT
#18385
On November 21 2017 13:34 WarSame wrote:
As a follow on to that previous post, if you can generate an address from a private key what's to stop you from simply running through a ton of private keys, generating their addresses, and taking that ethereum?


I always liked this image.

https://i.imgur.com/MUQoSzy.jpg
AdministratorTwitter: @R1CH_TL
TL+ Member
Hanh
Profile Joined June 2016
146 Posts
November 22 2017 12:02 GMT
#18386
On November 22 2017 19:56 R1CH wrote:
Show nested quote +
On November 21 2017 13:34 WarSame wrote:
As a follow on to that previous post, if you can generate an address from a private key what's to stop you from simply running through a ton of private keys, generating their addresses, and taking that ethereum?


I always liked this image.

https://i.imgur.com/MUQoSzy.jpg


Brute forcing the keys won't work but it doesn't mean that other methods can't succeed. For instance, according to https://eprint.iacr.org/2017/598 (p20, table 2), you would need 2330 q-bits to crack Bitcoin ECDSA (it uses secp256k1). So far, IBM has achieved 17 q-bits so we are still way off.
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
Last Edited: 2017-11-22 19:42:59
November 22 2017 19:42 GMT
#18387
Question on C#.NET and Entity Framework.

I'm trying to implement this: https://github.com/mehdime/DbContextScope. Basically an easy way to create and manage DbContext. The problem is that my DbContext requires a connection string to be provided programmatically rather than directly from the config file. He's got a factory interface that I can implement to provide my own DbContext. I can't seem to figure out how to get it to work though. I'm pretty sure this is probably just a problem with my understanding of generic interfaces.

Here's a sample of what I'm trying to do:
    // This is the DbContext factory. MSEntities is my DbContext, which requires a ConnectionToken.
public class MSEntitiesContextFactory : IDbContextFactory<MSEntities> {
private ConnectionToken _token;

public MSEntitiesContextFactory(ConnectionToken token) {
_token = token;
}

public MSEntities Create() {
return new MSEntities(_token);
}
}

public class Test {
public void PerformTest(ConnectionToken token) {
IDbContextFactory<MSEntities> dbContextFactory = new MSEntitiesContextFactory(token);
using (DbContextScope scope = new DbContextScope(dbContextFactory)) {
// Do stuff
}
}
}

I get an error on the "using" line saying: "cannot convert from 'System.Data.Entity.Infrastructure.IDbContextFactory<MSEntities>' to 'EntityFramework.Db.ContextScope.Interfaces.IDbContextFactory'".

The constructor for DbContextScope requires just the IDbContextFactory. But the IDbContextFactory is a generic interface. How do I implement that interface using my custom DbContext (MSEntities)?

Here is the IDbContextFactory interface, for reference:
    public interface IDbContextFactory<out TContext> where TContext : DbContext {
//
// Summary:
// Creates a new instance of a derived System.Data.Entity.DbContext type.
//
// Returns:
// An instance of TContext
TContext Create();
}
mantequilla
Profile Blog Joined June 2012
Turkey779 Posts
November 22 2017 21:41 GMT
#18388
what do I need to become to understand Shor's algorithm as easily as I understand baked chicken with potatoes recipe?
Age of Mythology forever!
ZigguratOfUr
Profile Blog Joined April 2012
Iraq16955 Posts
November 22 2017 23:39 GMT
#18389
On November 23 2017 06:41 mantequilla wrote:
what do I need to become to understand Shor's algorithm as easily as I understand baked chicken with potatoes recipe?


Depends on how good of a cook you are, and how deeply you want to understand Shor's. There's a ton of tutorials if you look around--which one you read hinges on how much math you're willing to look at.
Hanh
Profile Joined June 2016
146 Posts
November 23 2017 02:20 GMT
#18390
On November 23 2017 04:42 enigmaticcam wrote:
Question on C#.NET and Entity Framework.

I'm trying to implement this: https://github.com/mehdime/DbContextScope. Basically an easy way to create and manage DbContext. The problem is that my DbContext requires a connection string to be provided programmatically rather than directly from the config file. He's got a factory interface that I can implement to provide my own DbContext. I can't seem to figure out how to get it to work though. I'm pretty sure this is probably just a problem with my understanding of generic interfaces.

Here's a sample of what I'm trying to do:
    // This is the DbContext factory. MSEntities is my DbContext, which requires a ConnectionToken.
public class MSEntitiesContextFactory : IDbContextFactory<MSEntities> {
private ConnectionToken _token;

public MSEntitiesContextFactory(ConnectionToken token) {
_token = token;
}

public MSEntities Create() {
return new MSEntities(_token);
}
}

public class Test {
public void PerformTest(ConnectionToken token) {
IDbContextFactory<MSEntities> dbContextFactory = new MSEntitiesContextFactory(token);
using (DbContextScope scope = new DbContextScope(dbContextFactory)) {
// Do stuff
}
}
}

I get an error on the "using" line saying: "cannot convert from 'System.Data.Entity.Infrastructure.IDbContextFactory<MSEntities>' to 'EntityFramework.Db.ContextScope.Interfaces.IDbContextFactory'".

The constructor for DbContextScope requires just the IDbContextFactory. But the IDbContextFactory is a generic interface. How do I implement that interface using my custom DbContext (MSEntities)?

Here is the IDbContextFactory interface, for reference:
    public interface IDbContextFactory<out TContext> where TContext : DbContext {
//
// Summary:
// Creates a new instance of a derived System.Data.Entity.DbContext type.
//
// Returns:
// An instance of TContext
TContext Create();
}


Looks like it is not the same name space even. Does he have his own definitions of entity framework types?
Manit0u
Profile Blog Joined August 2004
Poland17423 Posts
November 23 2017 09:17 GMT
#18391
[image loading]

Most awesomest easter egg ever.
Time is precious. Waste it wisely.
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
November 23 2017 15:29 GMT
#18392
On November 23 2017 11:20 Hanh wrote:Looks like it is not the same name space even. Does he have his own definitions of entity framework types?

No, I would provide those definitions through the DbContextScope class via generic function. But IDbContextFactory is a generic interface.

His code supports multiple DbContext's. I have the option of providing a single class that uses this generic interface that will instantiate any of the DbContext's. In my case, I just have one. But I don't know how to implement that interface properly to provide the class.
Fwmeh
Profile Joined April 2008
1286 Posts
Last Edited: 2017-11-23 16:55:41
November 23 2017 16:55 GMT
#18393
On November 23 2017 04:42 enigmaticcam wrote:
Question on C#.NET and Entity Framework.

I'm trying to implement this: https://github.com/mehdime/DbContextScope. Basically an easy way to create and manage DbContext. The problem is that my DbContext requires a connection string to be provided programmatically rather than directly from the config file. He's got a factory interface that I can implement to provide my own DbContext. I can't seem to figure out how to get it to work though. I'm pretty sure this is probably just a problem with my understanding of generic interfaces.

Here's a sample of what I'm trying to do:
    // This is the DbContext factory. MSEntities is my DbContext, which requires a ConnectionToken.
public class MSEntitiesContextFactory : IDbContextFactory<MSEntities> {
private ConnectionToken _token;

public MSEntitiesContextFactory(ConnectionToken token) {
_token = token;
}

public MSEntities Create() {
return new MSEntities(_token);
}
}

public class Test {
public void PerformTest(ConnectionToken token) {
IDbContextFactory<MSEntities> dbContextFactory = new MSEntitiesContextFactory(token);
using (DbContextScope scope = new DbContextScope(dbContextFactory)) {
// Do stuff
}
}
}

I get an error on the "using" line saying: "cannot convert from 'System.Data.Entity.Infrastructure.IDbContextFactory<MSEntities>' to 'EntityFramework.Db.ContextScope.Interfaces.IDbContextFactory'".

The constructor for DbContextScope requires just the IDbContextFactory. But the IDbContextFactory is a generic interface. How do I implement that interface using my custom DbContext (MSEntities)?

Here is the IDbContextFactory interface, for reference:
    public interface IDbContextFactory<out TContext> where TContext : DbContext {
//
// Summary:
// Creates a new instance of a derived System.Data.Entity.DbContext type.
//
// Returns:
// An instance of TContext
TContext Create();
}


I'll start with recommending not using that abstraction. I have some experience with it, but only found it clumsy.

That being said, what you want to do is something like this


public class MSEntitiesContextFactory : IDbContextFactory
{
private readonly ConnectionToken _token;

public MSEntitiesContextFactory(ConnectionToken token)
{
_token = token;
}
public TDbContext CreateDbContext<TDbContext>() where TDbContext : class, IDbContext
{
return typeof(TDbContext) == typeof(MSEntities)
? new MSEntities(token: _token) as TDbContext
: Activator.CreateInstance<TDbContext>();
}
}
}

public void PerformTest(ConnectionToken token)
{
var myFactory = new MSEntitiesContextFactory(new ConnectionToken());
var scopeFactory = new DbContextScopeFactory(myFactory);
//if you want to use the ambient scope
var ambientScope = new DbContextScope(myFactory);
using (IDbContextScope scope = scopeFactory.Create())
{
var asd = scope.DbContexts.Get<MSEntities>().Persons.Add(new Person());
// Do stuff
}
}



It seems that in the version I tried this with, you have to let MSEtities implement IDbContext, but you should not have to do anything further other than implementing it.
A parser for things is a function from strings to lists of pairs of things and strings
enigmaticcam
Profile Blog Joined October 2010
United States280 Posts
November 23 2017 17:14 GMT
#18394
Thank you! That was the syntax I needed, and that works. Really appreciate it!

On November 24 2017 01:55 Fwmeh wrote:I'll start with recommending not using that abstraction. I have some experience with it, but only found it clumsy.

You mean not using the DbContextScope? Since I was about to start using it, I'm curious as to why you thought it was clumsy. Any recommendations as to how to manage DbContext correctly?
Fwmeh
Profile Joined April 2008
1286 Posts
November 23 2017 18:01 GMT
#18395
On November 24 2017 02:14 enigmaticcam wrote:
Thank you! That was the syntax I needed, and that works. Really appreciate it!

Show nested quote +
On November 24 2017 01:55 Fwmeh wrote:I'll start with recommending not using that abstraction. I have some experience with it, but only found it clumsy.

You mean not using the DbContextScope? Since I was about to start using it, I'm curious as to why you thought it was clumsy. Any recommendations as to how to manage DbContext correctly?


Well, it is hard to give advise even when you know the particulars, and really hard when you don't.

I just feel that this pattern is overly complicated for what it solves. Also, the use of service-location makes it really easy to take on too many dependencies without noticing it. I'm a big proponent of constructor injection, and always refactor when I see them taking too many arguments. With service location, that is more hidden. Plus, I found it really unwieldy to unit test.

I would probably do something like make my DbContext's work as repositories (making sure not to have any "business logic" in there, only CRUD), use a separate Unit of work-abstraction, which creates the DbContext's on demand and in transactions as required. Like one UnitOfWork : IUnitOfWOrk<ContextA>, IUnitOfWork<ContextB>, etc, and letting any service depend on them explicitly. You could even implement that using DbContextScope, confine it to that one class, so you don't end up with IAmbientDbContextLocator's all over the code.
A parser for things is a function from strings to lists of pairs of things and strings
phar
Profile Joined August 2011
United States1080 Posts
November 23 2017 18:02 GMT
#18396
On November 23 2017 18:17 Manit0u wrote:

Most awesomest easter egg ever.


Idk I still think that the fully functional flight simulator they built into Excel is a way more awesome and intensive Easter egg.
Who after all is today speaking about the destruction of the Armenians?
Manit0u
Profile Blog Joined August 2004
Poland17423 Posts
November 27 2017 09:04 GMT
#18397
On November 24 2017 03:02 phar wrote:
Show nested quote +
On November 23 2017 18:17 Manit0u wrote:

Most awesomest easter egg ever.


Idk I still think that the fully functional flight simulator they built into Excel is a way more awesome and intensive Easter egg.


You mean this buggy crap that was warping all the time? The dev hunter from Excel 2006 was much better.
Time is precious. Waste it wisely.
Manit0u
Profile Blog Joined August 2004
Poland17423 Posts
November 27 2017 12:42 GMT
#18398
Ha! I've just created merge request #666 in one of our projects, in which I delete 119 files.

Feels good.
Time is precious. Waste it wisely.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
November 27 2017 13:19 GMT
#18399
I mentioned prolog earlier in the forum and it seems like it got a lot of love from some of you.

After working with it a bit, I can say that this *feels* like the most skill based language I have programmed with it. I am able to cleverly solve my assigned problems, but I just know that each time I do so - there is probably another way that is way shorter.
sc-darkness
Profile Joined August 2017
856 Posts
Last Edited: 2017-11-28 17:32:20
November 28 2017 17:31 GMT
#18400
I'd applied for a C++ job and I got test questions. Guess what! ANSI C questions instead. Yay! :D
I can manage it, it's just not expected. I feel way more comfortable with C++ though. I'm going to tell recruiter that as well.
Prev 1 918 919 920 921 922 1032 Next
Please log in or register to reply.
Live Events Refresh
Wardi Open
12:00
#60
WardiTV2250
IndyStarCraft 235
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
IndyStarCraft 235
UpATreeSC 87
StarCraft: Brood War
Rain 3549
Horang2 1587
Shuttle 779
firebathero 160
scan(afreeca) 52
sSak 37
Mong 30
Aegong 22
JulyZerg 17
ivOry 6
[ Show more ]
SilentControl 5
Dota 2
Gorgc5362
qojqva3580
420jenkins277
BananaSlamJamma178
XcaliburYe153
League of Legends
rGuardiaN20
Counter-Strike
fl0m572
byalli525
Other Games
FrodaN1033
Beastyqt715
ceh9567
KnowMe280
Lowko263
Sick257
Hui .188
Mew2King150
Liquid`VortiX147
ArmadaUGS79
QueenE48
Trikslyr46
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• kabyraGe 105
• Reevou 1
• IndyKCrew
• LaughNgamezSOOP
• sooper7s
• AfreecaTV YouTube
• Migwel
• intothetv
• Kozan
StarCraft: Brood War
• Michael_bg 9
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• WagamamaTV218
League of Legends
• Nemesis3571
• TFBlade957
• imaqtpie471
Other Games
• Shiphtur284
Upcoming Events
Replay Cast
4h 45m
WardiTV Korean Royale
17h 45m
OSC
22h 45m
Replay Cast
1d 4h
Replay Cast
1d 14h
Kung Fu Cup
1d 17h
Classic vs Solar
herO vs Cure
Reynor vs GuMiho
ByuN vs ShoWTimE
Tenacious Turtle Tussle
2 days
The PondCast
2 days
RSL Revival
2 days
Solar vs Zoun
MaxPax vs Bunny
Kung Fu Cup
2 days
[ Show More ]
WardiTV Korean Royale
2 days
PiGosaur Monday
3 days
RSL Revival
3 days
Classic vs Creator
Cure vs TriGGeR
Kung Fu Cup
3 days
CranKy Ducklings
4 days
RSL Revival
4 days
herO vs Gerald
ByuN vs SHIN
Kung Fu Cup
4 days
BSL 21
5 days
Tarson vs Julia
Doodle vs OldBoy
eOnzErG vs WolFix
StRyKeR vs Aeternum
Sparkling Tuna Cup
5 days
RSL Revival
5 days
Reynor vs sOs
Maru vs Ryung
Kung Fu Cup
5 days
WardiTV Korean Royale
5 days
BSL 21
6 days
JDConan vs Semih
Dragon vs Dienmax
Tech vs NewOcean
TerrOr vs Artosis
Wardi Open
6 days
Monday Night Weeklies
6 days
Liquipedia Results

Completed

Proleague 2025-11-07
Stellar Fest: Constellation Cup
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
BSL Season 21
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual

Upcoming

SLON Tour Season 2
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
RSL Revival: Season 3
META Madness #9
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
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.