Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Zhentar
Sep 28, 2003

Brilliant Master Genius

Smugdog Millionaire posted:

Using ILSpy I haven't been able to track down which part of my code actually spawns the objects in question, so I can't try to write my way around it.

Just set a breakpoint in the object's constructor then (use WinDbg if Visual Studio won't do it).

Adbot
ADBOT LOVES YOU

Zhentar
Sep 28, 2003

Brilliant Master Genius
Visual Studio 2012 question: In VS2010, when you opened a web project set to use IIS Express and the site wasn't mapped to that project, it would ask you if you wanted to remap it. In VS2012, it just automatically remaps it without asking. Is there some way to get the 2010 behavior back? I'm getting my site remapped without realizing it on a near daily basis, and it's really disruptive.

ljw1004
Jan 18, 2005

rum

Smugdog Millionaire posted:

I'm trying to build the sequel to dotnetpad, dotnetrepl. It'd be a REPL for C#/VB using the Roslyn libraries. However, I'm running into a security issue.
I'm creating a locked down AppDomain to execute the code fragments, which is going swimmingly. However, the Roslyn code is spawning Roslyn.Compilers.MetadataReader.MemoryMappedFile objects which have a finalizer that requires full trust (they un-mmap the file, I guess).

In future you should ask this sort of question in the Roslyn forums. That's where the Roslyn team members hang out (including Bill Chiles, who's in charge of the REPL experience). For this time I asked the REPL team directly. Here are the answers:

* Roslyn currently depends on a few components that use pointers or P/Invokes: CCI metadata reader, CCI metadata writer, fusion, PDB writer and key container APIs. Until we replace them (or implement alternatives) we require full trust. Some of them could be avoided – CCI metadata writer and PDB writer is avoided using Ref.Emit. Key container APIs are avoided if your compilation doesn’t use key containers. The other components can’t at the moment.

* Security-transparency hasn't been an important goal yet. Given the above list, it'll take a lot of effort (and a lot of evidence of user-demand...)

* One idea: "One thing they can do as a workaround could be to expose compilation APIs from their host as security safe critical. That would mean that the transparent code in the domain could call these APIs that would then call, e.g. CompileSubmission, and returned back the Submission object to the transparent code. Then the transparent code could execute it.

However I wouldn’t recommend it because we haven’t done any security review on Roslyn. Especially CCI, from my experience is very prone to integer overflows which might be exploited. So by exposing compilation APIs to transparent code one might open a security hole."

Smugdog Millionaire
Sep 14, 2002

8) Blame Icefrog

ljw1004 posted:

In future you should ask this sort of question in the Roslyn forums. That's where the Roslyn team members hang out (including Bill Chiles, who's in charge of the REPL experience). For this time I asked the REPL team directly. Here are the answers:

* Roslyn currently depends on a few components that use pointers or P/Invokes: CCI metadata reader, CCI metadata writer, fusion, PDB writer and key container APIs. Until we replace them (or implement alternatives) we require full trust. Some of them could be avoided – CCI metadata writer and PDB writer is avoided using Ref.Emit. Key container APIs are avoided if your compilation doesn’t use key containers. The other components can’t at the moment.

* Security-transparency hasn't been an important goal yet. Given the above list, it'll take a lot of effort (and a lot of evidence of user-demand...)

* One idea: "One thing they can do as a workaround could be to expose compilation APIs from their host as security safe critical. That would mean that the transparent code in the domain could call these APIs that would then call, e.g. CompileSubmission, and returned back the Submission object to the transparent code. Then the transparent code could execute it.

However I wouldn’t recommend it because we haven’t done any security review on Roslyn. Especially CCI, from my experience is very prone to integer overflows which might be exploited. So by exposing compilation APIs to transparent code one might open a security hole."


Thanks for the information. I think the outlined approach is effectively what I'm trying to do:
code:
new PermissionSet(PermissionState.Unrestricted).Assert();
var engine = new ScriptEngine();
foreach (var assembly in references)
    engine.AddReference(assembly);
foreach (var name in namespaces)
    engine.ImportNamespace(name);

var session = engine.CreateSession();

var submission = session.CompileSubmission<object>("Tuple.Create(4,20)");
CodeAccessPermission.RevertAssert();
var result = submission.Execute();
where that code executes in the locked-down AppDomain.

Which works fine, until later when some MemoryMappedFile object gets garbage collected and tries to un-mmap whatever it's wrapping, at which point it needs full trust and can't get it.

I tried doing something like
code:
new PermissionSet(PermissionState.Unrestricted).Assert();
GC.Collect(4, GCCollectionMode.Forced, true);
CodeAccessPermission.RevertAssert();
but that particular class of objects weren't collected. Perhaps the objects live forever and I can just let the process crash at the end when I'm planning on killing it anyway.

Knyteguy
Jul 6, 2005

YES to love
NO to shirts


Toilet Rascal
Sup Goons, I'm building a portfolio website of all my work because my job pays me $12.50 an hour 20 hours a week to program software, program web, design web, computer troubleshooting, and manage a website. So... I figured it might be time to move onto greener pastures :unsmith: Anyway while I figure out what position I might be applying for, I'm trying to clean up some of my slightly older program code to conform with better practices I've learned since.

Going back, I would have written this top function buttonParseProcommD2M_Click to work with an unlimited amount of systems by using sender, but I didn't. Barring that, does anyone see anything that screams "oh poo poo this is terrible!"? It runs wonderfully daily in a commercial environment, but I would like to move up a tier in the programming business if possible. (This is just 2 functions I used as a code sample, not the entire program (obviously...))

Formatting got a little screwed up, and I had add some return characters to stop it from breaking tables.

code:
        private void buttonParseProcommD2M_Click(object sender, EventArgs e)
        {

            if (procommFile.Text == null || !procommFile.Text.EndsWith(".xls"))
            {
                MessageBox.Show("Please select a valid report file first!", "Error", MessageBoxButtons.OK, 
		MessageBoxIcon.Error);
            }
            else
            {
                // Ensure the program does not run multiple times unnecessarily from user error
                buttonParseProcommD2M.Hide();

                progressBarD2M1.Show();

                statusTextD2M.Text = "Parsing...";

                string thisSystem = "D2M";

                // Start Parsing
                openReport(thisSystem);
            }
	}

	private void openReport(string whatSystemIsIt)
        {
            //whatSystemIsIt is to identify if it is Amazon, LPSD, etc.

            // Start Excel
            Excel.Application xlApp;
            Excel.Workbook xlWorkBook;
            Excel.Worksheet xlWorkSheet;
            object misValue = System.Reflection.Missing.Value;

            xlApp = new Excel.Application();
            xlWorkBook = xlApp.Workbooks.Open(textBoxReportFile.Text,
		 0, 
		 true, 
		 5, "", "", 
		 true,
		 Microsoft.Office.Interop.Excel.XlPlatform.xlWindows,
		 "\t", false, false, 0, true, 1, 0);
            xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);

	    // Parse Procomm data into an array to manipulate
	    // Consider using 'Task Parallel' in future update
            for (int i = 9; i < 12000; i++)
            {
                // Excel Columns A & C from ProComm represent SKU & Inventory Quantity
		// Start with excel columns A(i), C(i) and move on
                string columnA = "A" + i;
                string columnC = "C" + i;

                // Update status bar, update per 10 to keep graphics update smooth on a single thread app
                if (i % 10 == 0)
                {
                    if (whatSystemIsIt == "Amazon")
                    {
                        progressBarAmazon.Value = i;
                    }
                    else if (whatSystemIsIt == "LPSD")
                    {
                        progressBarLPSD.Value = i;
                    }
                    else if (whatSystemIsIt == "D2M")
                    {
                        progressBarD2M.Value = i;
                    }
                }

                // Ensure that we don't try to bind a null/blank cell
                if (xlWorkSheet.get_Range(columnA, columnA).Value != null && 
		xlWorkSheet.get_Range(columnC, columnC).Value != null)
                {
                    // Put the found SKU cell data into a workable format
                    string procommSkuAndInventory = xlWorkSheet.get_Range(columnA, columnA).Value2.ToString();

                    // Only proceed if the cell SKU has a "-" (All products from the past 17 years have dashes)
		    // Get data
                    if (procommSkuAndInventoryCount.Contains('-'))
                    {
			// Add inventory data
                        procommSkuAndInventory += '\t' + xlWorkSheet.get_Range(columnC, columnC).Value2.ToString();
                        // Store excel data in the global array from earlier
                        procommSkuAndInventoryArray[i] = procommSkuAndInventory;
                    }
                }
            }

            // Clean up
            xlWorkBook.Close(true, misValue, misValue);
            xlApp.Quit();

            releaseObject(xlWorkSheet);
            releaseObject(xlWorkBook);
            releaseObject(xlApp);

            // Appropriate labels to give feedback to users 
            // Hide all progress bars since the procomm file does not need to be run for each system
            //Amazon
            labelAmazonParseProcomm.Text = "2) Parse Pro Comm Report";
            labelAmazonParseProcomm.ForeColor = Color.Silver;
            progressBarAmazon.Visible = false;
            progressBarAmazon.Value = 0;
            pictureBoxCheckBoxAmazon1.Visible = true;

            //LPSD
            labelLPSDParseProcomm.Text = "2) Parse Pro Comm Report";
            labelLPSDParseProcomm.ForeColor = Color.Silver;
            progressBarLPSD1.Visible = false;
            progressBarLPSD1.Value = 0;
            pictureBoxCheckBoxLPSD1.Visible = true;

            //D2M
            labelD2MParseProcomm.Text = "2) Parse Pro Comm Report";
            labelD2MParseProcomm.ForeColor = Color.Silver;
            progressBarD2M.Visible = false;
            progressBarD2M.Value = 0;
            pictureBoxCheckBoxD2M1.Visible = true;

        }

Knyteguy fucked around with this message at 21:31 on Sep 25, 2012

CapnAndy
Feb 27, 2004

Some teeth long for ripping, gleaming wet from black dog gums. So you keep your eyes closed at the end. You don't want to see such a mouth up close. before the bite, before its oblivion in the goring of your soft parts, the speckled lips will curl back in a whinny of excitement. You just know it.
You're doing a slightly strange mixture of using .Show() and .Hide() vs. directly setting .Visible, I don't see where you show the button after you hid it at the start of the click event, and for personal preference I'd set .Enabled to false rather than hiding the button; greying it out is more visually understandable as "okay, you can still use this, just not now" whereas things disappearing when you click them can be a little startling.

Knyteguy
Jul 6, 2005

YES to love
NO to shirts


Toilet Rascal

CapnAndy posted:

You're doing a slightly strange mixture of using .Show() and .Hide() vs. directly setting .Visible, I don't see where you show the button after you hid it at the start of the click event, and for personal preference I'd set .Enabled to false rather than hiding the button; greying it out is more visually understandable as "okay, you can still use this, just not now" whereas things disappearing when you click them can be a little startling.

That's a great idea, I think I'll implement that thanks :).

epswing
Nov 4, 2003

Soiled Meat

epalm posted:

Any book recommendations for MSMQ and/or WCF?

No seriously, is anyone using MSMQ? If so, do you love it? If so, do you have a favourite MSMQ book?

Quebec Bagnet
Apr 28, 2009

mess with the honk
you get the bonk
Lipstick Apathy

epalm posted:

No seriously, is anyone using MSMQ? If so, do you love it? If so, do you have a favourite MSMQ book?

I found it fairly straightforward to send and receive messages. What are you trying to do with it?

epswing
Nov 4, 2003

Soiled Meat
Well I'm trying to read from remote queues and even with EVERYONE and ANONYMOUS_LOGON having full permissions I'm still getting Access Denied exceptions, and I had to resort to this registry hack to make it work. I'm not even sure I should be reading from remote queues.

Sure I can walk in circles blindfolded until I read enough blog posts and stack overflow questions to make it work, but this needs to work in production and I want to set things up The Right Way instead of trying to fight with MSMQ every step of the way simply due to my ignorance.

epswing fucked around with this message at 23:52 on Sep 25, 2012

Hibame
Feb 20, 2008
I don't know how set on MSMQ you are but I found RabbitMQ to be very straight forward and it has been rock solid from day 1.

Quebec Bagnet
Apr 28, 2009

mess with the honk
you get the bonk
Lipstick Apathy
See if your server or client machine is configured to disallow unencrypted or low-encryption connections or otherwise have trust (e.g. they are in the same domain or trusted forest). This states that MSMQ tries to use an encrypted RPC channel, which will fail if the allowed encryption methods don't line up or there is not sufficient trust.

You can also look at the problem a different way and see if you can configure message routing on the remote machine to send messages that you're interested in to your local machine.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Knyteguy posted:

Barring that, does anyone see anything that screams "oh poo poo this is terrible!"? I

Yes. Do not submit this code to a potential employer as it is.

Here's my short list, without digging into the actual functionality:
  • You're not separating your concerns. Presentation logic and application logic should not be mixed. This is a huge problem -- it shows that either you lack a fundamental understanding of object oriented programming (which is bad), or that you don't give a poo poo about doing it right (which is worse).
  • Where are your unit tests? How do you know your application functions properly? How do you know that you're not breaking existing functionality when making changes? Having unit tests earns you points with a lot of employers. It certainly does with me!
  • You do not follow Microsoft's naming conventions. I'm a stickler for this one, especially in sample code. Other people will tell you it doesn't matter, but my position is that Microsoft took the trouble to create a style guide, it makes a lot of sense, and there are lots of tools that can help enforce it. If you have a good reason for not following the guide and can articulate it and convince me, that's fine. If you don't have a good reason, then I chalk it up to sloppiness and/or not giving a poo poo.

Question: Does your application even update the progress bar visually? You're blocking the UI thread as far as I can tell.

epswing
Nov 4, 2003

Soiled Meat

Hibame posted:

I don't know how set on MSMQ you are but I found RabbitMQ to be very straight forward and it has been rock solid from day 1.

Interesting, I'll look into it. The Publish/Subscribe use case seems to be exactly what I want.

i barely GNU her! posted:

See if your server or client machine is configured to disallow unencrypted or low-encryption connections or otherwise have trust (e.g. they are in the same domain or trusted forest).

I want to use message queues over the internet. My MSMQ options seem to be (A) use HTTP MSMQ, but this involves IIS and I don't think I want to introduce that dependency on client machines, or (B) use standard MSMQ and open 3 or 4 ports and hope it works.

Again, I'm not a message queue expert, which is why I'm looking for a good book. The one thing I do know is that holding TCP sockets open between server and clients using hand rolled code is error prone (no built in buffering, reconnection logic, guaranteed delivery, transmission acknowledgements, transactions, etc). We're using a hand rolled solution now, and it needs work. Looking at the necessary development work, it seems to me that I'd be building a message queue, and heyooo, they already exist.

epswing fucked around with this message at 01:48 on Sep 26, 2012

wwb
Aug 17, 2004

I would try and avoid sending non-WAN protocols (raw MSMQ) over the WAN. HTTP, or some other wrapper, is probably a necessary evil. Now, you could do something like self-host the ASP.NET web API and pass messages to MSMQ.

PS: just recalled one other option -- https://github.com/ayende/rhino-queues ; also self-hostable IIRC. Slightly dated but still solid.

wwb fucked around with this message at 01:53 on Sep 26, 2012

Quebec Bagnet
Apr 28, 2009

mess with the honk
you get the bonk
Lipstick Apathy
Unless I'm reading wrong I'm not seeing how you need IIS on the client, you should only need it on the server.

jonnii
Dec 29, 2002
god dances in the face of the jews

Hibame posted:

I don't know how set on MSMQ you are but I found RabbitMQ to be very straight forward and it has been rock solid from day 1.

This. Also, I've been working on a rabbitmq library called Chinchilla (https://github.com/jonnii/chinchilla). It should help with the pub/sub stuff, it's a nuget package. There are better libraries out there, specifically easynetq (http://easynetq.com/) and masstransit (masstransit-project.com), but none of them fit my use case exactly.

I highly recommend RabbitMQ over MSMQ. It's a superior product in every possible way.

Smugdog Millionaire
Sep 14, 2002

8) Blame Icefrog
.

Knyteguy
Jul 6, 2005

YES to love
NO to shirts


Toilet Rascal

Ithaqua posted:

Yes. Do not submit this code to a potential employer as it is.

Here's my short list, without digging into the actual functionality:
  • You're not separating your concerns. Presentation logic and application logic should not be mixed. This is a huge problem -- it shows that either you lack a fundamental understanding of object oriented programming (which is bad), or that you don't give a poo poo about doing it right (which is worse).
  • Where are your unit tests? How do you know your application functions properly? How do you know that you're not breaking existing functionality when making changes? Having unit tests earns you points with a lot of employers. It certainly does with me!
  • You do not follow Microsoft's naming conventions. I'm a stickler for this one, especially in sample code. Other people will tell you it doesn't matter, but my position is that Microsoft took the trouble to create a style guide, it makes a lot of sense, and there are lots of tools that can help enforce it. If you have a good reason for not following the guide and can articulate it and convince me, that's fine. If you don't have a good reason, then I chalk it up to sloppiness and/or not giving a poo poo.

Question: Does your application even update the progress bar visually? You're blocking the UI thread as far as I can tell.

Thanks I'll make some changes - I want it to be as well done as possible.

MVC (this is MVC related right?) is something I've only briefly touched upon. It sounds like I should probably do some more reading on it and understand what it actually represents, and how to implement it correctly.

Unit tests I've never done. I just found a basic tutorial for VS/C# so I'll look into this.

Naming conventions... I'll read what the standard is. I'm certain I can learn this fairly quickly.

Question: Does your application even update the progress bar visually? You're blocking the UI thread as far as I can tell.

It does on this sample code. It doesn't in a second part of the program (which I've been meaning to fix for my co-worker in an update) that also uses a progress bar. I've gotten my feet wet with multi-threading/task parallel so it sounds like I should just update it in the program and the sample code.

Thank you for the input :).

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



jonnii posted:

I highly recommend RabbitMQ over MSMQ. It's a superior product in every possible way.

Could anyone elaborate on this? We use MSMQ here, but mostly because it's just there by default, and I'd like to have some alternatives.

Sedro
Dec 31, 2008

GrumpyDoctor posted:

I just got a chance to implement this, and the literal "put text in the text box" part works, but it's not updating the bound-to properties on my view model (the setter is never reached and nothing is changing). I'm clearly missing something about how data binding works.

Additionally, after TextBox_PreviewDrop returns, an exception is raised:

I can make it go away by adding e.Handled = true but I don't know if I should be doing that.

Thanks for your help!

I see what you mean about the binding. I don't have time to figure out why but as a workaround you can force an update:
C# code:
var tb = (TextBox)sender;

// Your logic: what to do with the file names?
tb.Text = filenames[0];

// Force a model update
var expr = tb.GetBindingExpression(TextBox.TextProperty);
if (expr != null) expr.UpdateSource();
I don't see any exception but it sounds like it's not being thrown in your code.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Knyteguy posted:

Thanks I'll make some changes - I want it to be as well done as possible.

MVC (this is MVC related right?) is something I've only briefly touched upon. It sounds like I should probably do some more reading on it and understand what it actually represents, and how to implement it correctly.

No. MVC is a pattern that can be applied to help with keeping your presentation logic separate. Read up on tiered architectures.

In general, you have a presentation layer, an application logic layer, and a data layer. The data layer handles pulling your data from a source of some kind (a database, a spreadsheet, an XML file, whatever). The application layer applies business rules to the data and shapes it for display. The presentation layer actually handles displaying the data shaped by the application layer.

That's very general, and it won't apply to all projects all the time.

jonnii
Dec 29, 2002
god dances in the face of the jews

Munkeymon posted:

Could anyone elaborate on this? We use MSMQ here, but mostly because it's just there by default, and I'd like to have some alternatives.

To be honest they are two very different technologies. One is a message queue, the other is a message bus. I'll try to be as objective as possible, which is hard because of how much I dislike msmq, so here goes:

MSMQ

+ Has really good integration with active directory
+ Uses built in windows security
+ Comes built in with windows
+ Supports message priorities
+ Has some great libraries around it to hide some of the warts (masstransit/nservicebus)
+ Has a way to do HA transactional/non-transactional clustering (if you can set it up)
+ Machine to machine queues
- Permissions can be a pain to get right
- Supports message priorities (lol lets make everything high priority)
- Doesn't natively support pub/sub
- Has message limits (i believe this was 4mb, now i dunno, might be higher now)
- No easy way to see centrally how your queues are configured
- Machine to machine queues
- Competing consumers isn't supported out of the box

RabbitMq

+ Easy to install
+ All messages go through a broker
+ Has great management plugins for interacting with the broker
+ Performance can be pretty astounding
+ Message TTLs
+ Topic based routing with exchanges/queues
+ Persistant and non-persistant messages
+ Moden C# API
+ Transient queues (if you need to do server/client (but don't do client/server over a message bus))
+ Great wrapper libraries (masstransit/easynetq)
- HA options are available, but you'll need to use your brain
- You'll need install erlang
- I don't think distributed transactions are supported out of the box

Hopefully this was helpful. Let me know if you have any other questions.

raminasi
Jan 25, 2005

a last drink with no ice

Sedro posted:

I see what you mean about the binding. I don't have time to figure out why but as a workaround you can force an update:
C# code:
var tb = (TextBox)sender;

// Your logic: what to do with the file names?
tb.Text = filenames[0];

// Force a model update
var expr = tb.GetBindingExpression(TextBox.TextProperty);
if (expr != null) expr.UpdateSource();
I don't see any exception but it sounds like it's not being thrown in your code.

Great, thanks! And yeah, it was a framework exception.

Sagacity
May 2, 2003
Hopefully my epitaph will be funnier than my custom title.

jonnii posted:

RabbitMq

+ All messages go through a broker
Just curious: Why is this considered a plus?

jonnii
Dec 29, 2002
god dances in the face of the jews

Sagacity posted:

Just curious: Why is this considered a plus?

It would be a negative if the broker was a single point of failure, but you can run rabbitmq clustered/federated. I think it's a plus because you can see at a glance what your messaging topology is doing. That kind of insight is much harder when your queues are machine-machine.

Sab669
Sep 24, 2009

Maybe I'm using the wrong control for this, but I can't seem to figure out how to do something my boss wants.

I've got a ListView and a ComboBox on a form.
The ListView shows some products and prices. The price changes based on the currently selectd ComboBox value (which represents the quantity of products).

Instead of having the ComboBox my boss just wants the ListView to be more... table like? I'm not sure how to describe it. Basically, say there's only 5 products listed, it would say "Price Tier 1" or something in the ListView, then print out all the items at their price, then "Price Tier 2" on another row, show the new price for that bracket etc.

What I would *think* to do is simply put that text in one of the columns, set the background color to something different to section off the chunks. But I can't seem to figure out how to loop through the data and put it in the ListView multiple times like that.

Also is it just me or would that be really loving ugly and bloated? As a user I wouldn't want to have to scroll through some massive list of products to find a particular price bracket.

Dietrich
Sep 11, 2001

ListView sucks. Use DataGridView.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



jonnii posted:

Hopefully this was helpful. Let me know if you have any other questions.

That's helpful just because you pointed out that Masstransit works with MSMQ. Using a friendlier interface that allows us to easily swap out the back end would be a huge improvement.

Do the RabbitMQ command line utilities let you check the status of any queue from any machine or do you have to be remoted into one of the brokers to get information out of them? We have some third party MSMQ browsing software that we use for that currently but it's still kind of a pain in the rear end.

Tres Burritos
Sep 3, 2009

Dietrich posted:

ListView sucks. Use DataGridView.

This man speaks wisdom.

Sab669
Sep 24, 2009

Using some third party framework on top of .NET that doesn't integrate nicely with the Data Grids :(
Suppose I could see if it'd be alright to say gently caress it and use the regular .NET one anyways.

Is what he wanted even possible though, with the ListViews? :v:

CapnAndy
Feb 27, 2004

Some teeth long for ripping, gleaming wet from black dog gums. So you keep your eyes closed at the end. You don't want to see such a mouth up close. before the bite, before its oblivion in the goring of your soft parts, the speckled lips will curl back in a whinny of excitement. You just know it.

Sab669 posted:

Maybe I'm using the wrong control for this, but I can't seem to figure out how to do something my boss wants.

I've got a ListView and a ComboBox on a form.
The ListView shows some products and prices. The price changes based on the currently selectd ComboBox value (which represents the quantity of products).

Instead of having the ComboBox my boss just wants the ListView to be more... table like? I'm not sure how to describe it. Basically, say there's only 5 products listed, it would say "Price Tier 1" or something in the ListView, then print out all the items at their price, then "Price Tier 2" on another row, show the new price for that bracket etc.

What I would *think* to do is simply put that text in one of the columns, set the background color to something different to section off the chunks. But I can't seem to figure out how to loop through the data and put it in the ListView multiple times like that.

Also is it just me or would that be really loving ugly and bloated? As a user I wouldn't want to have to scroll through some massive list of products to find a particular price bracket.
It is in theory possible -- you're getting that data being stored in the ListView from somewhere, right? So you can loop through that and build your own list out of it and then assign that to the ListView.

But your final question is dead on. It sounds insanely ugly and bloated and is a really, really bad idea.

osigas
Mar 4, 2006

Then maybe you shouldn't be living here
I'm stumped, we're migrating a customer's site on to a new server with hugely higher specification than their previous.

The only major change is that we've gone from 2 servers (1 hosting the site, the other the database) to 1 single server (with both IIS and SQL up). Site is .Net 4 MVC 3. OS, IIS and SQL versions are the same, just a lot more juice in the processor and memory department.

However, the new server runs slower, a lot slower, like an extra 3 seconds on every page click.

The old servers we're struggling at busy periods so we are wanting a server with a lot more beans, which this one certainly has, but I can't pin point the delay anywhere. SQL calls are coming back instantly, the processor/memory usage is minimal, we've got no permission problems that I can see.

The only thing I can think of is if .Net is missing a configuration setting somewhere. I could understand it if there was some sloppy code, but the same code on two different servers is running completely differently?

wwb
Aug 17, 2004

That really feels like something wonky is happening and the app pool is recycling on every request. Pretty easy to insturment that -- you just need to enable that logging.

Request tracing could also shed some light on things. IIS7's is pretty fancy.

I'd also look at the SQL trace utility for the app as it is running to see if there is a smoking gun there.

jonnii
Dec 29, 2002
god dances in the face of the jews

Munkeymon posted:

That's helpful just because you pointed out that Masstransit works with MSMQ. Using a friendlier interface that allows us to easily swap out the back end would be a huge improvement.

Do the RabbitMQ command line utilities let you check the status of any queue from any machine or do you have to be remoted into one of the brokers to get information out of them? We have some third party MSMQ browsing software that we use for that currently but it's still kind of a pain in the rear end.

A cautionary tale. We used to use masstransit with rabbit (never with msmq) and eventually switched away from it because the abstraction it provides doesn't expose some of the best features of rabbit like auto delete queues/exchanges, TTL etc... It's a good way to get started, but you might find yourself wanting more.

To check the status of a queue you have a few options.

1. Management plugin (which is awesome).
2. Http API
3. rabbitmqctl command line tools

list all the queues and some info
>rabbitmqadmin list queues vhost name node messages message_stats.publish_details.rate

Sab669
Sep 24, 2009

Haha, what the gently caress. Just looking over this application, I noticed some random Radio button that was placed over one that is supposed to be there. Deleted it, there was another unnamed Radio Button underneath it. Delete that, there were all-in-all about 15 unused, generic radio buttons :psyduck:

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Unrelated to my response, I'm trying to make a (what I would think is) fairly simple XML transformation happen in a web.config for local debugging.

web.config

XML code:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
	<configSections>
		<section name="SomeConfigSource" blah blah blah/>
<!-- etc -->
	</configSections>
<!-- etc -->
	<SomeConfigSource application="bin\Moar.config" />
<configuration/>
web.debug.config

XML code:
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
	<SomeConfigSource xdt:Transform="Replace" application="C:\Long\Path\To\My\Local\bin\Moar.config"/>
</configuration>
Am I nuts or should this work?

jonnii posted:

A cautionary tale. We used to use masstransit with rabbit (never with msmq) and eventually switched away from it because the abstraction it provides doesn't expose some of the best features of rabbit like auto delete queues/exchanges, TTL etc... It's a good way to get started, but you might find yourself wanting more.

To check the status of a queue you have a few options.

1. Management plugin (which is awesome).
2. Http API
3. rabbitmqctl command line tools

list all the queues and some info
>rabbitmqadmin list queues vhost name node messages message_stats.publish_details.rate

That'd be fine since we only use MSMQ now. Anything to make it less annoying would be great.

Munkeymon fucked around with this message at 17:52 on Sep 28, 2012

Bozart
Oct 28, 2006

Give me the finger.
I've got it stuck in my head to learn how to do matrix multiplication in a few different languages. I'm having some trouble with F# (which I am also learning):

code:
#light
module FSharpBlotter.MatrixMult
   // define two matrixes for multiplication
   let A = [[1; 2; 3]; 
            [3; 2; 1]]
   
   let B = [[1; 2]; 
            [3; 4]; 
            [5; 6]]
   
   // function to pull out a specific row and return as a list of int
   let Row (lst:_ list) (i: int) = 
      lst.[i]

   // function to pull out a specific column and return as a list of int
   let Col (lst:(int list) list) (i: int) = 
      [for R in lst do R.[i]]
      
   
   let A1 = A.[1]
   let A2 = Row A 1
   
   //error:
   //stdin(129,8): error FS0030: Value restriction. The value 'A3' has been inferred to have generic type
   let A3 = Col A 1
   
   // and then:
   // dot product function for two lists of ints
   
   // putting it together with a fold

Any ideas on how to get the Col function to work correctly? Also, while I want to implement this as a function of lists (and plan on completing this implementation) is there another way I should represent matrices in F#?

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Bozart posted:

I've got it stuck in my head to learn how to do matrix multiplication in a few different languages. I'm having some trouble with F# (which I am also learning):

Any ideas on how to get the Col function to work correctly? Also, while I want to implement this as a function of lists (and plan on completing this implementation) is there another way I should represent matrices in F#?

Check this out:
http://msdn.microsoft.com/en-us/library/hh304369(v=vs.100).aspx

Adbot
ADBOT LOVES YOU

Hughmoris
Apr 21, 2007
Let's go to the abyss!
Since the OP hasn't been updated in 3 years, are there any new recommended books for people looking to pick up C# as a first language?

  • Locked thread