Categories
askquestion

IIS 6.0 Application Pool crash

IIS 6.0 Application Pool crash

Ask Question

Asked
11 years ago

Active
8 years, 8 months ago

Viewed
36k times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

14

5

Have a lot of troubles on production server. Some routing cause crashing of Application Pool with event id 1011:

Event Type: Warning
Event Source: W3SVC
Event Category: None
Event ID: 1011
Date: 1/21/2009
Time: 9:08:17 AM
User: N/A
Computer: xxxxxxxxxxxxx
Description:

A process serving application pool ‘DefaultAppPool’ suffered a fatal communication error with the World Wide Web Publishing Service. The process id was ‘3788’. The data field contains the error number.
8007006d

I have a few very hard hours for me before I found a problem.
Thanks to Tess Ferrandez and her blog post I found it.

Always double check Your multithreaded code in asp.net application. When Unhandled exceptions occurs application pool crashes and it’s damn hard to find WHY.

iis iis-6 debugging crash application-pool

share|improve this question

edited May 27 ’10 at 20:53

community wiki

4 revs, 3 users 66%AlfeG

1

Tess’s blog is outstanding. We had a culprit clobbering one of our shared server shared app pools on IIS6, turned out to be that exact problem. The next problem was trying to get said customer to comprehend issue though 🙂

– Kev
Jan 24 ’09 at 19:00

add a comment
 | 

1 Answer
1

active

oldest

votes

5

Tess’s blog was a little advanced for me. I had to search around for quite a bit before I found the right articles that helped me debug my dump files. This article will help others who want to debug their crashing asp.net application pools but don’t know how to start.

share|improve this answer

answered Jun 2 ’11 at 1:24

community wiki

user780385

add a comment
 | 

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Submit

Post as a guest

Name

Email
Required, but never shown

Post Your Answer

Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged iis iis-6 debugging crash application-pool or ask your own question.

Blog

Ben Popper is the worst coder in the world: Something awry with my array

This week, #StackOverflowKnows fast planes, math with dates, and code comments

Featured on Meta

TLS 1.0 and TLS 1.1 removal for Stack Exchange services

How do the moderator resignations affect me and the community?

Linked

0

How to isolate IIS Thread Pool Crashing

Related

732How do I obtain crash-data from my Android application?1558How do I debug Node.js applications?245What is an IIS application pool?2is there a relationship between an application pool and a windows service3’DefaultAppPool’ suffered a fatal communication error with the World Wide Web Publishing Service0Application Pool crashing?0Application crashes on app pool 1, but doesn’t on app pool 269The service cannot accept control messages at this time0IIS app pool keeps crashing

Hot Network Questions

Why is learning mathematics compulsory?

Why is iso-octane different from other iso-s?

How does apt upgrade running programs?

Airline schedule flights to arrive at the same time its scheduled to depart

Why did equal temperament become the standard tuning system for keyboard instruments?

Providing the spymaster with cues for clues in Codenames

“electricity was suddenly turned off” or ” electricity suddenly turned off ”

Am I understanding buffering capacity against strong acid/base correctly?

Is there a name for a chess variant where you are allowed to capture your own pieces?

How do I sail rafts in Breath of the Wild?

Fastest yes in the west

I’m not able to delete -> in {{x -> a}, {x -> b}, {x -> c,x->d}}

How do cars drive through deep water as shown on many videos online?

Copying & pasting multiple commands to Minecraft terminal

Is there a term for creatures that are not spellcasters?

Who was the last European king to actively engage in combat?

Position of a nested list

How do Aarakocra fly with a backpack?

Why can a MCU input floating pin easily change state?

Sound driver for DOS or Windows 3.x that used the PC speaker?

How did Canada come to be the robotic arm people?

When is it appropriate to introduce a new layer of abstraction into a class hierarchy?

Why do goblins never form societies bigger than about 500 members?

Universe expansion acceleration

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Categories
askquestion

How to dynamically create sub-domains with different IP than the original domain correctly and efficiently?

How to dynamically create sub-domains with different IP than the original domain correctly and efficiently?

Ask Question

Asked
11 years ago

Active
11 years ago

Viewed
710 times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

1

How to efficiently create subdomains dynamically that are resolved to different IP than the original domain?

Most dynamic subdomain creation solutions I’ve found here would add a *.domain.com A-record to the DNS server (usually using BIND), but that’s not what I want.

Does that mean the zone file needs to be set to always Expire? Wouldn’t that tax our DNS server heavily?

However, what if the client ISP doesn’t go and fetch the new zone file I just dynamically changed? Wouldn’t they not able to resolve our new sub-domain entry?

Would setting up DDNS in BIND be the logical path for implementing such system? DDNS would allow me dynamically insert A-record without restarting BIND, right?

I’m sure there are some way to do this, since most large blogging service that doesn’t point all account to the same IP as the blogging engine, are doing something similar to what I need.

Thank you!

networking dns subdomain infrastructure

share|improve this question

edited Jan 24 ’09 at 19:56

Ishmaeel

13.1k77 gold badges5959 silver badges7979 bronze badges

asked Jan 24 ’09 at 18:47

HenryHenry

31.2k1717 gold badges101101 silver badges205205 bronze badges

This question belongs on a networking site.

– NotMe
Jan 24 ’09 at 20:21

this is just the same question as yesterday, phrased a different way. Seriously, the front-end reverse proxy and wildcard DNS really is the way to do this. And you needn’t deploy that from day 1, if cost is an issue.

– Alnitak
Jan 25 ’09 at 13:39

add a comment
 | 

2 Answers
2

active

oldest

votes

2

Yes, you could use dynamic DNS updates to push zone file changes into your zone without having to put them into a text zone file and reloading BIND each time.

Many large domain name registries use exactly that technique whenever a domain name is registered.

That doesn’t mean, though, that it’s the right technique for your application. As recommended yesterday to your other question, there’s really no reason not to go with the wildcard option.

A low-end server running Apache would be more than enough to front-end reverse proxy your first few thousand sites, and better still you don’t even need to deploy it until you get enough users to set up your second partitioned cluster.

share|improve this answer

answered Jan 25 ’09 at 13:48

AlnitakAlnitak

293k6464 gold badges365365 silver badges449449 bronze badges

add a comment
 | 

2

I would imagine that most services that do this have their wildcard (*.) DNS entry setup for these accounts, and probabley point it to a load balancer, that distributes requests based on host name etc. They then have the non-standard entrys setup as normal A records in DNS.

share|improve this answer

answered Jan 24 ’09 at 19:43

Sam CoganSam Cogan

3,30566 gold badges3636 silver badges6565 bronze badges

add a comment
 | 

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Submit

Post as a guest

Name

Email
Required, but never shown

Post Your Answer

Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged networking dns subdomain infrastructure or ask your own question.

Blog

Ben Popper is the worst coder in the world: Something awry with my array

This week, #StackOverflowKnows fast planes, math with dates, and code comments

Featured on Meta

TLS 1.0 and TLS 1.1 removal for Stack Exchange services

Did Stack Exchange cut the number of negative comments nearly in half between…

An account of my meeting with the Stack Overflow management team

Visit chat

Related

4How would you create sub-domains with DNS automatically?0How to Redirect New Domain to a different Sub Domain?0creating unlimited sub domains through api from premium DNS hosting provider1create subdomain to forward to sub-folder on a different domain0Dynamic sub domain via Apache0ns records for subdomain in aws route 530Dynamic Route53 sub-domain forwarding6How to test sub-domains on my localhost on a mac?3Creating a sub-subdomain on AWS Route 53

Hot Network Questions

How do Trump’s public statements make DOJ’s job impossible?

Can you Rappel with an Old Climbing Rope?

Can’t ping EC2 instance after enabling ICMP packets

How did Canada come to be the robotic arm people?

How do I show students the Beauty of Mathematics?

Is the electrical outlet by my kitchen sink supposed to be protected by a GFCI?

Providing the spymaster with cues for clues in Codenames

Can Harry Potter swim?

Find common substring that starts a set of strings

Using self-service gas pumps in Israel – with Hebrew-only interface

Intensifying sensations during meditation after switching to an Ayuverdic lifestyle

Simulation from a multivariate distribution (How does it work in practice?)

Pulling back a functor, it becomes monadic

Do metals form covalent bonds besides ionic and cordinate bond?

What are the least powerful airplanes that ever flew?

The “Chaos Game” as a particular series of i.i.d. random variables

Airline schedule flights to arrive at the same time its scheduled to depart

How to pass data pointer to subroutine to use with Absolute,Y addressing?

Why is iso-octane different from other iso-s?

What this Dog Grill Grilling Machine called in everyday spoken english?

When is it appropriate to introduce a new layer of abstraction into a class hierarchy?

Why is learning mathematics compulsory?

Has a woman ever defeated a reigning undisputed World Chess Champion in classical chess?

Is there a name for a chess variant where you are allowed to capture your own pieces?

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

Categories
askquestion

Python Regular Expression to add links to urls

Python Regular Expression to add links to urls

Ask Question

Asked
11 years ago

Active
1 year, 3 months ago

Viewed
3k times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

4

2

I’m trying to make a regular expression that will correctly capture URLs, including ones that are wrapped in parenthesis as in (http://example.com) and spoken about on coding horror at https://blog.codinghorror.com/the-problem-with-urls/

I’m currently using the following to create HTML A tags in python for links that start with http and www.

r1 = r”(b(http|https)://([-A-Za-z0-9+&@#/%?=~_()|!:,.;]*[-A-Za-z0-9+&@#/%=~_()|]))”
r2 = r”((^|b)www.([-A-Za-z0-9+&@#/%?=~_()|!:,.;]*[-A-Za-z0-9+&@#/%=~_()|]))”
return re.sub(r2,r'<a rel=”nofollow” target=”_blank” href=”http://1″>1</a>’,re.sub(r1,r'<a rel=”nofollow” target=”_blank” href=”1″>1</a>’,text))

this works well except for the case where someone wraps the url in parens. Does anyone have a better way?

python regex url

share|improve this question

edited Oct 21 ’18 at 5:41

Cœur

26.8k1414 gold badges148148 silver badges203203 bronze badges

asked Jan 24 ’09 at 18:48

lokelolokelo

7111 silver badge55 bronze badges

add a comment
 | 

1 Answer
1

active

oldest

votes

4

Problem is, URLs could have parenthesis as part of them… (http://en.wikipedia.org/wiki/Tropical_Storm_Alberto_(2006)) . You can’t treat that with regexp alone, since it doesn’t have state. You need a parser. So your best chance would be to use a parser, and try to guess the correct close parenthesis. That is error-prone (the url could open parenthesis and never close it) so I guess you’re out of luck anyway.

See also http://en.wikipedia.org/wiki/, or (http://en.wikipedia.org/wiki/)) and other similar valid URLs.

share|improve this answer

edited Jan 24 ’09 at 19:03

answered Jan 24 ’09 at 18:57

nosklonosklo

172k4949 gold badges262262 silver badges279279 bronze badges

add a comment
 | 

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Submit

Post as a guest

Name

Email
Required, but never shown

Post Your Answer

Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged python regex url or ask your own question.

Blog

Ben Popper is the worst coder in the world: Something awry with my array

This week, #StackOverflowKnows fast planes, math with dates, and code comments

Featured on Meta

TLS 1.0 and TLS 1.1 removal for Stack Exchange services

Did Stack Exchange cut the number of negative comments nearly in half between…

An account of my meeting with the Stack Overflow management team

Related

4530How do I merge two dictionaries in a single expression?4706Calling an external command from Python5539What are metaclasses in Python?4285What is the difference between a URI, a URL and a URN?3244How to validate an email address using a regular expression?5780Does Python have a ternary conditional operator?4190Regular expression to match a line that doesn’t contain a word4746What is the maximum length of a URL in different browsers?2936Get the current URL with JavaScript?3673How to change the URI (URL) for a remote Git repository?

Hot Network Questions

How do cars drive through deep water as shown on many videos online?

What are the most powerful airplanes that ever flew?

How do Aarakocra fly with a backpack?

How to fit a line in latex?

How to create suspense when the conclusion is known?

Resigning a couple of months before an event : is it abusive resignation?

How do Trump’s public statements make DOJ’s job impossible?

Why the name “Gumdrop” for the vintage car?

“electricity was suddenly turned off” or ” electricity suddenly turned off ”

What this Dog Grill Grilling Machine called in everyday spoken english?

Airline schedule flights to arrive at the same time its scheduled to depart

When (if ever) can ATC order an aircraft to go around?

Why can a MCU input floating pin easily change state?

How did Canada come to be the robotic arm people?

When is it appropriate to introduce a new layer of abstraction into a class hierarchy?

Copying & pasting multiple commands to Minecraft terminal

How to say “armor” (a term from hydrology) in Russian?

Find common substring that starts a set of strings

Eldritch knight dual wield: do I get multiple attacks on my bonus action?

In what cases should I completely state a theorem I’m about to use?

Is the conflict between Captain America and Tony Stark in “The Avengers” Blue Collar versus Educated Elite?

Answer templating

Why can’t Ditto copy eyes properly?

Detect manual changes to an autogenerated C header

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

lang-py

Categories
askquestion

Problem applying texture to square in OpenGL

Problem applying texture to square in OpenGL

Ask Question

Asked
11 years ago

Active
9 years, 2 months ago

Viewed
3k times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

0

I’m stuck at not being able to map texture to a square in openGLES. I’m trying to display a jpg image on the screen, and in order for me to do that, I draw a square that I want to then map image onto. However all I get as an output is a white square. I don’t know what am I doing wrong. And this problem is preventing me from moving forward with my project. I’m using Managed OpenGL ES wrapper for Windows Mobile.
I verified that the texture is loading correctly, but I can’t apply it to my object. I uploaded sample project that shows my problem here. You would need VS2008 with Windows Mobile 6 SDK to be able to run it. I’m also posting the code of the Form that renders and textures an object here. Any suggestions would be much appreciated, since I’ve been stuck on this problem for a while, and I can’t figure out what am I doing wrong.

public partial class Form1 : Form
{
[DllImport(“coredll”)]
extern static IntPtr GetDC(IntPtr hwnd);

EGLDisplay myDisplay;
EGLSurface mySurface;
EGLContext myContext;

public Form1()
{
InitializeComponent();
myDisplay = egl.GetDisplay(new EGLNativeDisplayType(this));

int major, minor;
egl.Initialize(myDisplay, out major, out minor);

EGLConfig[] configs = new EGLConfig[10];
int[] attribList = new int[]
{
egl.EGL_RED_SIZE, 5,
egl.EGL_GREEN_SIZE, 6,
egl.EGL_BLUE_SIZE, 5,
egl.EGL_DEPTH_SIZE, 16 ,
egl.EGL_SURFACE_TYPE, egl.EGL_WINDOW_BIT,
egl.EGL_STENCIL_SIZE, egl.EGL_DONT_CARE,
egl.EGL_NONE, egl.EGL_NONE
};

int numConfig;
if (!egl.ChooseConfig(myDisplay, attribList, configs, configs.Length, out numConfig) || numConfig < 1)
throw new InvalidOperationException(“Unable to choose config.”);

EGLConfig config = configs[0];
mySurface = egl.CreateWindowSurface(myDisplay, config, Handle, null);
myContext = egl.CreateContext(myDisplay, config, EGLContext.None, null);

egl.MakeCurrent(myDisplay, mySurface, mySurface, myContext);
gl.ClearColor(0, 0, 0, 0);
InitGL();
}

void InitGL()
{
gl.ShadeModel(gl.GL_SMOOTH);
gl.ClearColor(0.0f, 0.0f, 0.0f, 0.5f);
gl.BlendFunc(gl.GL_SRC_ALPHA, gl.GL_ONE_MINUS_SRC_ALPHA);
gl.Hint(gl.GL_PERSPECTIVE_CORRECTION_HINT, gl.GL_NICEST);
}

public unsafe void DrawGLScene()
{
gl.MatrixMode(gl.GL_PROJECTION);
gl.LoadIdentity();
gl.Orthof(0, ClientSize.Width, ClientSize.Height, 0, 0, 1);
gl.Disable(gl.GL_DEPTH_TEST);

gl.MatrixMode(gl.GL_MODELVIEW);
gl.LoadIdentity();

Texture myImage;
Bitmap Image = new Bitmap(@”Storage CardTexture.jpg”);
using (MemoryStream ms = new MemoryStream())
{
Image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
myImage = Texture.LoadStream(ms, false);
}

float[] rectangle = new float[] {
0, 0,
myImage.Width, 0,
0, myImage.Height,
myImage.Width, myImage.Height
};

float[] texturePosition = new float[] {
0, 0,
myImage.Width, 0,
0, myImage.Height,
myImage.Width, myImage.Height
};

//Bind texture
gl.BindTexture(gl.GL_TEXTURE_2D, myImage.Name);
gl.TexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MIN_FILTER, gl.GL_LINEAR);
gl.TexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MAG_FILTER, gl.GL_LINEAR);
gl.EnableClientState(gl.GL_TEXTURE_COORD_ARRAY);
gl.EnableClientState(gl.GL_VERTEX_ARRAY);

//draw square and texture it.
fixed (float* rectanglePointer = &rectangle[0], positionPointer = &texturePosition[0])
{
gl.TexCoordPointer(2, gl.GL_FLOAT, 0, (IntPtr)positionPointer);
gl.VertexPointer(2, gl.GL_FLOAT, 0, (IntPtr)rectanglePointer);
gl.DrawArrays(gl.GL_TRIANGLE_STRIP, 0, 4);
}

gl.DisableClientState(gl.GL_TEXTURE_COORD_ARRAY);
gl.DisableClientState(gl.GL_VERTEX_ARRAY);

}

protected override void OnPaintBackground(PaintEventArgs e)
{

}

protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
gl.Clear(gl.GL_COLOR_BUFFER_BIT);

DrawGLScene();
egl.SwapBuffers(myDisplay, mySurface);
gl.Clear(gl.GL_COLOR_BUFFER_BIT);
}

protected override void OnClosing(CancelEventArgs e)
{
if (!egl.DestroySurface(myDisplay, mySurface))
throw new Exception(“Error while destroying surface.”);
if (!egl.DestroyContext(myDisplay, myContext))
throw new Exception(“Error while destroying context.”);
if (!egl.Terminate(myDisplay))
throw new Exception(“Error while terminating display.”);
base.OnClosing(e);
}
}

c# .net windows-mobile opengl-es

share|improve this question

edited Dec 14 ’10 at 20:19

genpfault

44.8k99 gold badges6060 silver badges106106 bronze badges

asked Jan 24 ’09 at 18:51

Ilya VolodinIlya Volodin

8,49111 gold badge3636 silver badges4343 bronze badges

add a comment
 | 

4 Answers
4

active

oldest

votes

2

You need to enable texturing:

glEnable( GL_TEXTURE_2D );

before rendering the square.

share|improve this answer

answered Jan 24 ’09 at 19:19

codelogiccodelogic

59.1k99 gold badges5454 silver badges5454 bronze badges

add a comment
 | 

1

If you work with OpenGL|ES also take a look if the glDrawTexImage-Extension is supported (well – it should, it’s a core-extension and required, but you never know…)

It won’t help you with your problem directly (e.g. you have to enable texturing as well), but glDrawTexImage is a hell lot more efficient than polygon rendering. And it needs less code to write as well.

share|improve this answer

answered Jan 24 ’09 at 21:01

Nils PipenbrinckNils Pipenbrinck

72k2323 gold badges139139 silver badges212212 bronze badges

Unfortunatly it’s not supported in the wrapper I am using. It’s possible that it is supported in Windows Mobile implementation of OpenGLES, but not in the wrapper. Would be nice though…

– Ilya Volodin
Jan 24 ’09 at 21:07

I can’t seem to find any resources online that talks about glDrawTexImage. Do you happen to have a link?

– codelogic
Jan 25 ’09 at 11:38

add a comment
 | 

1

If you are loading textures from PNG or JPG files using UIImage, CGImage and CGContext, it is very important to set GL_TEXTURE_MIN_FILTER to GL_LINEAR or GL_NEAREST before creating textures, because if you don’t do it, all your textures except the last bound will be set to blank white.

share|improve this answer

answered Sep 2 ’09 at 17:06

mcfreimcfrei

add a comment
 | 

0

Thanks for the help! However your suggestion didn’t fix the issue. Now the square is black instead of white, but still no texture. I’ve tried adding gl.Enable(gl.GL_TEXTURE_2D) at every possible position, but the result is still black square.

EDIT:
Upps, sorry, top-left corner of my image was black that’s why I didn’t see anything. Changed the image to have different colors, and now I can see part of the image rendered. It’s not mapped propertly, but I can figure that part out.
Thanks a lot of the help!!!

share|improve this answer

edited Jan 24 ’09 at 20:09

answered Jan 24 ’09 at 20:02

Ilya VolodinIlya Volodin

8,49111 gold badge3636 silver badges4343 bronze badges

add a comment
 | 

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Submit

Post as a guest

Name

Email
Required, but never shown

Post Your Answer

Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged c# .net windows-mobile opengl-es or ask your own question.

Blog

Ben Popper is the worst coder in the world: Something awry with my array

This week, #StackOverflowKnows fast planes, math with dates, and code comments

Featured on Meta

TLS 1.0 and TLS 1.1 removal for Stack Exchange services

Did Stack Exchange cut the number of negative comments nearly in half between…

An account of my meeting with the Stack Overflow management team

Related

1Texture mapping problem in OpenGLES3Texturing a square in OpenGL ES on Android1How to Preserve aspect ratio of a button image .net3OpenGL texture blending problems0how to apply texture to grid of squares using OpenGL55Android OpenGL Texture Compression3OpenGL and QtQuick Texture Problems

Hot Network Questions

Why can’t Ditto copy eyes properly?

Fastest yes in the west

Why can a MCU input floating pin easily change state?

Food ingredients in the medieval ages compared to their modern counterparts?

Was it possible to listen to music and work on old PCs? When was it possible to for the first time?

Camera Lense effect on the physical camera

Are there any dangerous commands in LaTeX?

Why are there waves in seas towards shore – even in night?

Drawing one-liner

Does this design smell bad? Can I pull a pin simultaneously down and up?

How did Canada come to be the robotic arm people?

What are the least powerful airplanes that ever flew?

How to pass data pointer to subroutine to use with Absolute,Y addressing?

How to create suspense when the conclusion is known?

How do cars drive through deep water as shown on many videos online?

“electricity was suddenly turned off” or ” electricity suddenly turned off ”

identify a book – anthology series with suspended animation and a galaxy wide empire?

How to disconnect air conditioner lines from outdoor unit?

How do I score this field in Carcassonne?

What are some key strengths of BERT over ELMO/ULMFiT?

Resigning a couple of months before an event : is it abusive resignation?

How to solve this probability problem analytically (instead of using simulation)? Probability of Bill wins the game if he goes first

Can a wizard cast Blink, then Polymorph into a TRex to become a blinking TRex?

There exists an algorithm to find grammar of complement of a function?

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

lang-cs

Categories
askquestion

Calling mono c# code from Microsoft .net?

Calling mono c# code from Microsoft .net?

Ask Question

Asked
11 years ago

Active
10 years, 11 months ago

Viewed
2k times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

7

3

I have some neural net code written in c# that would benefit from using SIMD support. Mono 2.2 just came out that supports SIMD but Microsoft’s c# does not support this yet. Being happy with my c# setup I was wondering if I could write a lib in mono for that piece and call it from .net.

Edit:
I guess what I really want to know is it possible to compile mono down to something like a DLL that I then can call from dotnet. I heard Miguel de Icaza on a podcast saying that for the iphone the mono compiler would allow them to compile down to an exe for moonlight so it did not violate the terms of service for iphone so it got me thinking what else can you compile to.

I heard Miguel de Icaza on another pod cast Herding Code Episode 28 say that you could use the mono complier to compile to an exe not just to intermediate code. What are the implications of this?

This got my curiosity up so I thought that I would throw a bounty at it.

c# compiler-construction mono

share|improve this question

edited Feb 26 ’09 at 21:52

Rex Logan

asked Jan 24 ’09 at 18:52

Rex LoganRex Logan

19.5k99 gold badges3131 silver badges4747 bronze badges

add a comment
 | 

3 Answers
3

active

oldest

votes

5

+100

Essentially, if you write it with Simd and distribute the dll with your code, it will use acceleration if the target VM supports it. If not, it doesn’t break. So you can use the library and give any users of your program who run .NET apps with Mono a speed boost.

Microsoft has been said to be planning to add such support in its next release of its runtime, though I cannot find the link and don’t have it handy right this sec—can dig the link out of a historic backup if anyone is interested enough.

share|improve this answer

answered Feb 26 ’09 at 22:08

Michael TrauschMichael Trausch

2,98711 gold badge1717 silver badges2828 bronze badges

add a comment
 | 

11

From Miguel de Icaza’s blog:

Our library provides C# fallbacks for
all of the accelerated instructions.
This means that if your code runs on a
machine that does not provide any SIMD
support, or one of the operations that
you are using is not supported in your
machine, the code will continue to
work correctly.

This also means that you can use the
Mono.Simd API with Microsoft’s .NET on
Windows to prototype and develop your
code, and then run it at full speed
using Mono.

As I understand it, this means that you can write code that uses Mono.Simd, and will be able to run it under .Net, but it won’t be any faster than regular code, because the .Net runtime doesn’t support SIMD yet.

share|improve this answer

answered Jan 24 ’09 at 19:18

oefeoefe

16k77 gold badges3939 silver badges6363 bronze badges

add a comment
 | 

5

In order to take advantage of SIMD features, the runtime should be able to natively support it. Basically, Mono treats Mono.Simd namespace specially in the runtime. Obviously, Microsoft .NET runtime does not support this feature. However, the Mono.Simd assembly provided is a completely valid and normal .NET assembly written in managed code and therefore it can run on .NET CLR, but it would be just a software emulation of what SIMD instructions do.

You can run Mono runtime on Windows and take advantage of those features but there is no direct way to run half of application on .NET and the other half on Mono (you could, of course, use communication mechanisms as two distinct applications can use, but it doesn’t make sense for this scenario at all).

share|improve this answer

answered Feb 26 ’09 at 21:58

Mehrdad AfshariMehrdad Afshari

367k8080 gold badges804804 silver badges769769 bronze badges

add a comment
 | 

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Submit

Post as a guest

Name

Email
Required, but never shown

Post Your Answer

Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged c# compiler-construction mono or ask your own question.

Blog

Ben Popper is the worst coder in the world: Something awry with my array

This week, #StackOverflowKnows fast planes, math with dates, and code comments

Featured on Meta

TLS 1.0 and TLS 1.1 removal for Stack Exchange services

Did Stack Exchange cut the number of negative comments nearly in half between…

An account of my meeting with the Stack Overflow management team

Linked

3

Fast method of calculating square root and power?

3

Is it possible to make the CLR JIT use SIMD from C# in WP7?

4

Using SSE 4.2 crc32 algorithm in c# ? Is it possible?

Related

1443Calling the base constructor in C#1841How do I create an Excel (.XLS and .XLSX) file in C# without installing Microsoft Office?18Mono created features available on .NET?1754Get int value from enum in C#780Reading settings from app.config or web.config in .NET957Call one constructor from another897How do I turn a C# object into a JSON string in .NET?802How to call asynchronous method from synchronous method in C#?246.NET Core vs Mono

Hot Network Questions

Are there any dangerous commands in LaTeX?

Using self-service gas pumps in Israel – with Hebrew-only interface

Is the Arctic sea ice disappearing in a linear or non-linear way?

How to duplicate an object along an edge without warping or rotating it

Negative reviews on Glassdoor look like I wrote them

How can Michael Bloomberg become the Democratic nominee for President when he has not appeared on any primary ballot so far?

Hexagon column tessellation

How do I show students the Beauty of Mathematics?

Why must function declarations be followed by brackets when no parameters are passed?

How to say “armor” (a term from hydrology) in Russian?

Do isotopic groups cause optical activity?

Where to store passport during day trip in foreign country

Can Harry Potter swim?

Does this design smell bad? Can I pull a pin simultaneously down and up?

How do Trump’s public statements make DOJ’s job impossible?

Can you Rappel with an Old Climbing Rope?

Is there a term for creatures that are not spellcasters?

Fastest yes in the west

How to solve this probability problem analytically (instead of using simulation)? Probability of Bill wins the game if he goes first

How did Andrea Mengucci receive a game loss for incorrectly registering his card on arena?

Why did Michael Corleone only kill Carlo in the car?

Naturality up to (inner) automorphism?

In what cases should I completely state a theorem I’m about to use?

Airline schedule flights to arrive at the same time its scheduled to depart

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

lang-cs

Categories
askquestion

How to use std::foreach with parameters/modification

How to use std::foreach with parameters/modification

Ask Question

Asked
11 years ago

Active
7 years, 10 months ago

Viewed
22k times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

20

16

I’ve found myself writing

for(int i=0;i<myvec.size();i++)
myvec[i]->DoWhatever(param);

a lot, and I’d like to compress this into a foreach statement, but I’m not sure how to get param in there without going super-verbose. I’ve also got things like

for(int i=0;i<myvec.size();i++)
if(myvec[i]->IsOK())
myvec[i]->DoWhatever(param);

and I’d like to rewrite that guy too. Any thoughts?

Oh, also, for various reasons, I don’t want to use boost.

c++ stl loops enumeration

share|improve this question

edited Apr 28 ’09 at 23:23

Rex M

128k2828 gold badges265265 silver badges304304 bronze badges

asked Jan 24 ’09 at 18:53

Jesse BederJesse Beder

27.5k1717 gold badges9090 silver badges134134 bronze badges

add a comment
 | 

6 Answers
6

active

oldest

votes

15

#include <vector>
#include <algorithm>
#include <functional>

class X
{
public:
void doWhat(int x) {}
bool IsOK() const {return true;}
};
class CallWhatIfOk
{
public:
CallWhatIfOk(int p): param(p) {}

void operator()(X& x) const
{ if (x.IsOK()) {x.doWhat(param);}}
private:
int param;
};

int main()
{
std::vector<X> myVec;

std::for_each( myVec.begin(),
myVec.end(),
std::bind2nd(std::mem_fun_ref(&X::doWhat),4)
);

std::for_each( myVec.begin(),
myVec.end(),
CallWhatIfOk(4)
);
}

share|improve this answer

edited Jan 24 ’09 at 19:19

answered Jan 24 ’09 at 19:05

Martin YorkMartin York

217k7070 gold badges285285 silver badges505505 bronze badges

add a comment
 | 

6

Oh, also, for various reasons, I don’t want to use boost.

Valid decision, but most likely the wrong one. Consider Boost as an extension to the STL. C++ is a library-driven language. If you don’t take this into account, your code will be qualitatively inferior.

While std::for_each can be used here, the absence of lambda expressions in C++ until C++0x makes this tedious. I advocate using Boost.ForEach! It makes this much easier:

foreach (yourtype x, yourvec)
if (x.IsOK())
x.Whatever();

share|improve this answer

answered Jan 24 ’09 at 19:06

Konrad RudolphKonrad Rudolph

438k109109 gold badges840840 silver badges10801080 bronze badges

Alas, it’s not my decision whether to use boost.

– Jesse Beder
Jan 24 ’09 at 19:12

8

Might want to say that you can’t use boost then. Saying you don’t want to is just asking for an argument… 😉

– jalf
Jan 25 ’09 at 6:25

add a comment
 | 

4

My preferred solution is usually to write a functor to do what I need:

struct doWhatever {
doWhatever(const Param& p) p(p) {}
void operator(MyVec v&, Param p) {
v.DoWhatever(param);
}

private:
Param p;
};

And then the loop:

std::for_each(myvec.begin(), myvec.end(), doWhatever(param));

Depending on how many variations of this you have, this might be a bit too verbose.
There are plenty of options for doing it inline though.
boost::lambda would let you construct the function you need at the call-site. boost::bind (or the standard library bind functions) would let you bind the parameter param to the function so you don’t need to supply it as an argument every time.

boost::lambda is probably the most concise and flexible approach. I usually use the plain functor approach because the syntax is easier to remember. 😉

share|improve this answer

answered Jan 24 ’09 at 19:14

jalfjalf

218k4545 gold badges309309 silver badges528528 bronze badges

This is what I had (and was hoping to avoid) 🙂

– Jesse Beder
Jan 24 ’09 at 19:15

hm, without boost (ouch), I don’t think you can do it much shorter. In some of the cases, the std::bind_* stuff might help you, but there aren’t any miraculous silver bullets. (At least until c++0x with the addition of lambda expressions)

– jalf
Jan 25 ’09 at 6:27

add a comment
 | 

3

well when we have compilers that support C++0x lambda expresions, this becomes straightforward and minimally invasive:

std::for_each(myvec.begin(),myvec.end(),[&](X& item){
item->DoWhatever(param);
});

and the second example may look like this:

std::for_each(myvec.begin(),myvec.end(),[&](X& item){
if(item->IsOK())
myvec[i]->DoWhatever(param);
});

share|improve this answer

answered Feb 18 ’09 at 9:18

RickRick

3,0851313 silver badges1616 bronze badges

That is so pity, it does not work on g++ :(. I hope in some point I will be able to use those constructions…

– Arman
May 12 ’10 at 9:22

add a comment
 | 

3

#include <vector>
#include <algorithm>
#include <boost/bind.hpp>
#include <boost/lambda/if.hpp>
#include <boost/lambda/bind.hpp>

struct A
{
bool IsOK () { return true; }
void DoWhatever (int param) {}
};

struct B
{
bool IsOk (A * a) { return true; }
void DoWhatever (A * a, int param) {}
};

typedef std::vector<A *> Myvec;

void main()
{
Myvec myvec;
int param = 1;
B b;

// first challenge using boost::bind (fnct in the same class)
std::for_each (myvec.begin(), myvec.end(),
boost::bind (&A::DoWhatever, _1, param));

// first challenge using boost::bind (fnct in an external class)
std::for_each (myvec.begin(), myvec.end(),
boost::bind (&B::DoWhatever, &b, _1, param));

// second challange using boost::lambda (fnct in the same class)
std::for_each (myvec.begin(), myvec.end(),
boost::lambda::if_then(
boost::lambda::bind (&A::IsOK, boost::lambda::_1),
boost::lambda::bind (&A::DoWhatever, boost::lambda::_1, param)
)
);

// second challange using boost::lambda (fnct in an external class)
std::for_each (myvec.begin(), myvec.end(),
boost::lambda::if_then(
boost::lambda::bind (&B::IsOK, &b, boost::lambda::_1),
boost::lambda::bind (&B::DoWhatever, &b, boost::lambda::_1, param)
)
);

}

You can simplify it by using namespaces…

share|improve this answer

edited Apr 14 ’10 at 7:56

answered Apr 13 ’10 at 22:33

psaghelyipsaghelyi

36033 silver badges1111 bronze badges

add a comment
 | 

0

If you are using GCC you can define something like:

#define foreach(element, array)
for(typeof((array).begin()) element = (array).begin(), __end_##element = (array).end();
element != __end_##element;
++element)

and use it after like this:

foreach(element, array){
element->DoSomething(); //or (*element)->DoSomething() if type is already a pointer
}

I use this on a custom array but it works fine with std::vector too.

share|improve this answer

edited Apr 12 ’12 at 12:02

Soup

1,5491313 silver badges2727 bronze badges

answered Jun 1 ’10 at 17:27

Mircea IspasMircea Ispas

16.7k2323 gold badges9797 silver badges187187 bronze badges

add a comment
 | 

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Submit

Post as a guest

Name

Email
Required, but never shown

Post Your Answer

Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged c++ stl loops enumeration or ask your own question.

Blog

Ben Popper is the worst coder in the world: Something awry with my array

This week, #StackOverflowKnows fast planes, math with dates, and code comments

Featured on Meta

TLS 1.0 and TLS 1.1 removal for Stack Exchange services

Did Stack Exchange cut the number of negative comments nearly in half between…

An account of my meeting with the Stack Overflow management team

Linked

3

C++0x lambda vs #define

8

std::for_each, calling member function with reference parameter

Related

2500How do you set, clear, and toggle a single bit?3683How to enumerate an enum648Concatenating two std::vectors2934How do I iterate over the words of a string?2757How do I loop through or enumerate a JavaScript object?1784How do I break out of nested loops in Java?2544Why is “using namespace std;” considered bad practice?1967How does PHP ‘foreach’ actually work?1615Image Processing: Algorithm Improvement for ‘Coca-Cola Can’ Recognition1396Replacing a 32-bit loop counter with 64-bit introduces crazy performance deviations with _mm_popcnt_u64 on Intel CPUs

Hot Network Questions

When is it appropriate to introduce a new layer of abstraction into a class hierarchy?

Light task-processing systems with zero dependency for Linux systems

There exists an algorithm to find grammar of complement of a function?

Find common substring that starts a set of strings

Camera Lense effect on the physical camera

Rowstyle – Polyglossia Latin clash: illegal pream-token

A question about Gershwin interpretation

Draw P and S waves illustration

Is there a term for creatures that are not spellcasters?

When Was The Gospel of Luke Written?

How to solve this probability problem analytically (instead of using simulation)? Probability of Bill wins the game if he goes first

Player has trouble imagining the ingame situation

Negative reviews on Glassdoor look like I wrote them

What are the least powerful airplanes that ever flew?

What this Dog Grill Grilling Machine called in everyday spoken english?

How to use gas pump in Israel?

Why isn’t “Star Trek: Picard” shot in wide-screen 16:9?

Why are no recent small aircraft designed to be “characteristically incapable of spinning” as the Ercoupe was?

In what cases should I completely state a theorem I’m about to use?

HIghlight integer coordinates in continuous plot

When (if ever) can ATC order an aircraft to go around?

How do I show students the Beauty of Mathematics?

Are there any dangerous commands in LaTeX?

How to create suspense when the conclusion is known?

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

default

Categories
askquestion

Naming conventions in C# compared to Java

Naming conventions in C# compared to Java

Ask Question

Asked
11 years ago

Active
6 years, 2 months ago

Viewed
4k times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

4

6

The standard naming convention in the Java world is to name packages, classes and methods according to:

com.domainname.productname (package)
com.domainname.productname.ClassName (class)
com.domainname.productname.ClassName.isUpperCase(String str) (method)

What is the C#/.NET standard naming convention for the above cases?

c# java naming-conventions

share|improve this question

asked Jan 24 ’09 at 19:01

knorvknorv

42.3k6969 gold badges203203 silver badges288288 bronze badges

add a comment
 | 

2 Answers
2

active

oldest

votes

6

AKU’s answer should help you out:

.NET namespaces

He links to Microsoft’s guidelines:

http://msdn.microsoft.com/en-us/library/893ke618(VS.71).aspx

You should consider reading the the rest of the guidelines starting here:

http://msdn.microsoft.com/en-us/library/czefa0ke(VS.71).aspx

The remainder of the post is also very informative:

.NET namespaces

In your case you would go with:

CompanyName.ProductName
CompanyName.ProductName.ClassName
CompanyName.ClassName.IsUpperCase(string str)

The .NET guidelines don’t follow the Java style of using reversed FQ domain names to specify namespaces, and I’ve yet to see a commercial component such as Telerik or Infragistics for example follow anything other the guidelines than the MS ones.

share|improve this answer

edited May 23 ’17 at 11:45

Community♦

111 silver badge

answered Jan 24 ’09 at 19:03

KevKev

108k4747 gold badges276276 silver badges363363 bronze badges

add a comment
 | 

3

It is rare to see “com.” in C# or .NET:

DomainName.ProductName (namespace)
DomainName.ProductName.ClassName (class)
DomainName.ProductName.ClassName.IsUpperCase(String str) (method)

See the .NET Library Design Guidelines from Microsoft for the full scoop (this is really a .NET question more than a C# question).

share|improve this answer

answered Jan 24 ’09 at 19:18

Joe EricksonJoe Erickson

6,60811 gold badge2828 silver badges3131 bronze badges

I’ve wondered why so many Java packages start with com.. Since almost all company domain names end in .com, it seems redundant.

– David R Tribble
Dec 11 ’09 at 22:08

As far as I can remember – and I started using Java in 1995 or 1996 – it is simply the convention that Sun followed and everybody else followed along.

– Joe Erickson
Dec 12 ’09 at 22:17

I’ve actually seen a lot of org.* and some edu.* packages. It fits with Java’s “assume and write for the most unusual situation” inclinations.

– ehdv
Mar 2 ’10 at 15:39

1

@DavidRTribble, the convention comes from trying to differentiate company.com from company.org, etc. Java took the position that no domain name would indicate more than one company, so it was a fairly explicit, ubiquitous and universal “identifier”. It’s actually a cleaner technique in my opinion that “CompanyName” only in there is no guarantee that a two similarly named companies won’t accidentally name something the same. For instance, before the World Wrestling Federation lost “WWF” to the World Wildlife Fund, they might both chose WWF.ProductName. If of course they were into software.:)

– user4229245
Jan 25 ’15 at 20:15

add a comment
 | 

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Submit

Post as a guest

Name

Email
Required, but never shown

Post Your Answer

Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged c# java naming-conventions or ask your own question.

Blog

Ben Popper is the worst coder in the world: Something awry with my array

This week, #StackOverflowKnows fast planes, math with dates, and code comments

Featured on Meta

TLS 1.0 and TLS 1.1 removal for Stack Exchange services

Did Stack Exchange cut the number of negative comments nearly in half between…

An account of my meeting with the Stack Overflow management team

Linked

8

.NET namespaces

Related

6357What is the difference between String and string in C#?6380Is Java “pass-by-reference” or “pass-by-value”?1225How to round a number to n decimal places in Java743What is the naming convention in Python for variable and function names?2161How do I get a consistent byte representation of strings in C# without manually specifying an encoding?1683Comparing Java enum members: == or equals()?3151How to create a memory leak in Java?925Static Classes In Java

Hot Network Questions

Answer templating

Why do goblins never form societies bigger than about 500 members?

Why isn’t “Star Trek: Picard” shot in wide-screen 16:9?

Why are no recent small aircraft designed to be “characteristically incapable of spinning” as the Ercoupe was?

Negative reviews on Glassdoor look like I wrote them

How do I sail rafts in Breath of the Wild?

What is right way to setup King & Queen In the beginning of game?

What math classes are relevant for machine learning?

Food ingredients in the medieval ages compared to their modern counterparts?

How do I show students the Beauty of Mathematics?

Can a wizard cast Blink, then Polymorph into a TRex to become a blinking TRex?

Fastest yes in the west

Why is China interested in Socotra Rock?

Square D QOC 12 125: Is it possible to bring this subpanel up to code?

How does an Atlas V control roll?

How to disconnect air conditioner lines from outdoor unit?

When (if ever) can ATC order an aircraft to go around?

What does “Manistan” mean?

Why did Michael Corleone only kill Carlo in the car?

Providing the spymaster with cues for clues in Codenames

Split expression into list of terms

What is ‘the secret of Da Vinci’s drains’ in ‘Aurora Leigh’?

When is it appropriate to introduce a new layer of abstraction into a class hierarchy?

How do I understand White’s +6 advantage here?

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

default

Categories
askquestion

Resolving a relative url path to its absolute path

Resolving a relative url path to its absolute path

Ask Question

Asked
11 years ago

Active
1 month ago

Viewed
26k times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

60

13

Is there a library in python that works like this?

>>> resolvePath(“http://www.asite.com/folder/currentpage.html”, “anotherpage.html”)
‘http://www.asite.com/folder/anotherpage.html’
>>> resolvePath(“http://www.asite.com/folder/currentpage.html”, “folder2/anotherpage.html”)
‘http://www.asite.com/folder/folder2/anotherpage.html’
>>> resolvePath(“http://www.asite.com/folder/currentpage.html”, “/folder3/anotherpage.html”)
‘http://www.asite.com/folder3/anotherpage.html’
>>> resolvePath(“http://www.asite.com/folder/currentpage.html”, “../finalpage.html”)
‘http://www.asite.com/finalpage.html’

python url path

share|improve this question

edited Nov 13 ’10 at 23:43

Paused until further notice.

270k7878 gold badges332332 silver badges400400 bronze badges

asked Jan 24 ’09 at 19:09

Eric Palakovich CarrEric Palakovich Carr

18.3k66 gold badges4444 silver badges5151 bronze badges

add a comment
 | 

2 Answers
2

active

oldest

votes

104

Yes, there is urlparse.urljoin, or urllib.parse.urljoin for Python 3.

>>> try: from urlparse import urljoin # Python2
… except ImportError: from urllib.parse import urljoin # Python3

>>> urljoin(“http://www.asite.com/folder/currentpage.html”, “anotherpage.html”)
‘http://www.asite.com/folder/anotherpage.html’
>>> urljoin(“http://www.asite.com/folder/currentpage.html”, “folder2/anotherpage.html”)
‘http://www.asite.com/folder/folder2/anotherpage.html’
>>> urljoin(“http://www.asite.com/folder/currentpage.html”, “/folder3/anotherpage.html”)
‘http://www.asite.com/folder3/anotherpage.html’
>>> urljoin(“http://www.asite.com/folder/currentpage.html”, “../finalpage.html”)
‘http://www.asite.com/finalpage.html’

for copy-and-paste:

try:
from urlparse import urljoin # Python2
except ImportError:
from urllib.parse import urljoin # Python3

share|improve this answer

edited Jun 5 ’16 at 17:08

Martin Thoma

70.6k8484 gold badges408408 silver badges634634 bronze badges

answered Jan 24 ’09 at 19:20

James BradyJames Brady

20k77 gold badges4747 silver badges5656 bronze badges

For a RFC 3986 and unicode compliant replacement, see uritools.

– Marian
Feb 22 ’16 at 9:43

This doesn’t work if the second component is absolute, sadly. For example, urljoin(“http://example.com/blah.html”, “./././whoa.html”) does remove the dots, while urljoin(“http://example.com/blah.html”, “/./././whoa.html”) doesn’t.

– obskyr
Nov 9 ’16 at 19:48

add a comment
 | 

1

You can also call the urljoin function through Python’s requests library.

This code:

import requests

requests.compat.urljoin(‘http://example.com/foo.html’, ‘bar.html’)

Will return a value of http://example.com/bar.html

share|improve this answer

edited Dec 30 ’19 at 2:18

answered Sep 24 ’19 at 9:28

Pikamander2Pikamander2

3,55422 gold badges2626 silver badges4242 bronze badges

add a comment
 | 

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Submit

Post as a guest

Name

Email
Required, but never shown

Post Your Answer

Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged python url path or ask your own question.

Blog

Ben Popper is the worst coder in the world: Something awry with my array

This week, #StackOverflowKnows fast planes, math with dates, and code comments

Featured on Meta

TLS 1.0 and TLS 1.1 removal for Stack Exchange services

Did Stack Exchange cut the number of negative comments nearly in half between…

An account of my meeting with the Stack Overflow management team

Linked

0

Python Requests – Forbidden Error (Directory issue i.e. ../ reduction )

Related

682How to get an absolute file path in Python4284What is the difference between a URI, a URL and a URN?751Import a module from a relative path2421Encode URL in JavaScript?1796Get current URL with jQuery?4746What is the maximum length of a URL in different browsers?2107Convert bytes to a string2685How to make a chain of function decorators?2935Get the current URL with JavaScript?3673How to change the URI (URL) for a remote Git repository?

Hot Network Questions

Can a horse really travel over 65 miles per day, according to the rules?

I am musical in function

What are the least powerful airplanes that ever flew?

What does “калмыжка” mean in this context?

Answer templating

How did Andrea Mengucci receive a game loss for incorrectly registering his card on arena?

Resigning a couple of months before an event : is it abusive resignation?

Is there necessarily an infinite number of inputs to any given output in a crypto hash function?

Why do goblins never form societies bigger than about 500 members?

Why is China interested in Socotra Rock?

Why do the rich want to live on the ground?

identify a book – anthology series with suspended animation and a galaxy wide empire?

Is it unethical for a professor to misrepresent the format of an exam?

How do cars drive through deep water as shown on many videos online?

Why would humans be the dominant species?

Rowstyle – Polyglossia Latin clash: illegal pream-token

Can you Rappel with an Old Climbing Rope?

How do Trump’s public statements make DOJ’s job impossible?

How to create suspense when the conclusion is known?

Airline schedule flights to arrive at the same time its scheduled to depart

Split expression into list of terms

Why don’t organs have weighted keys?

Square D QOC 12 125: Is it possible to bring this subpanel up to code?

Who was the last European king to actively engage in combat?

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

lang-py

Categories
askquestion

What generic collections in C# are IXmlSerializable?

What generic collections in C# are IXmlSerializable?

Ask Question

Asked
11 years ago

Active
10 years, 11 months ago

Viewed
3k times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

3

2

Are any of the .NET generic collections marked as IXmlSerializable? I’ve tried List<T> and Collection<T> but neither work out of the box.

Before I roll my own collection<T>, list<T>, or dictionary<T> class, I thought I’d check to see whether Microsoft had included something that does this already. It seems like basic functionality.

EDIT: By “rolling my own” I mean creating a class that inherits from a generic collection class and also implements IXmlSerializable. Here’s one example: http://www.codeproject.com/KB/XML/IXmlSerializable.aspx. And here’s another example: http://weblogs.asp.net/pwelter34/archive/2006/05/03/444961.aspx.

I’m using the DataContractSerializer within a method whose signature looks like this:

public static Stream GetXmlStream(IXmlSerializable item)

The problem is that while there are many classes in the .NET framework that are serializable, not all of them have explicitly implement the IXmlSerializable interface.

c# generics serialization collections

share|improve this question

edited Jan 24 ’09 at 21:21

dthrasher

asked Jan 24 ’09 at 19:24

dthrasherdthrasher

34.2k3131 gold badges102102 silver badges133133 bronze badges

add a comment
 | 

4 Answers
4

active

oldest

votes

4

As far as I know, there aren’t any. You could take a look at the attached link, though. I think you’ll find it useful.

Serialize and deserialize objects as Xml using generic types in C# 2.0

share|improve this answer

answered Jan 24 ’09 at 19:32

MikeMike

2,0601616 silver badges2828 bronze badges

This article you linked to shows how to use generics to perform serialization. I want a generic collection that can be serialized.

– dthrasher
Jan 24 ’09 at 20:41

add a comment
 | 

5

There is no requirement to implement IXmlSerializable to be xml serializable.

public class Foo
{
public List<string> Names { get; set; }
}

will xml serialize just fine producing something like:

<?xml version=”1.0″ encoding=”utf-16″?>
<Foo
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
<Names>
<string>a</string>
<string>b</string>
<string>c</string>
</Names>
</Foo>

whereas

public class Foo<T>
{
public List<T> Names { get; set; }
}

will produce

<?xml version=”1.0″ encoding=”utf-16″?>
<FooOfString
xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
<Names>
<string>a</string>
<string>b</string>
<string>c</string>
</Names>
</FooOfString>

share|improve this answer

edited Feb 17 ’09 at 8:54

answered Feb 16 ’09 at 23:15

ShuggyCoUkShuggyCoUk

33.4k66 gold badges7070 silver badges9797 bronze badges

add a comment
 | 

2

Related to your question, if you want to serialize/deserialize an IDictionary see this useful post. I’d use the pattern shown here for your read and write methods though, as they deal better with different situations.

share|improve this answer

edited May 23 ’17 at 12:13

Community♦

111 silver badge

answered Feb 27 ’09 at 19:27

RoryRory

34.6k4444 gold badges145145 silver badges218218 bronze badges

That’s a great link. I wound up doing something very similar. +1

– dthrasher
Mar 2 ’09 at 21:27

Also see the second link i added. I had some problems with the code on the first one, particularly if the collection is empty…

– Rory
Mar 3 ’09 at 22:00

add a comment
 | 

1

After some further research on my own, I came to the same conclusion. None of the .NET generic collections are IXmlSerializable as of .NET 3.5 SP1.

share|improve this answer

answered Feb 16 ’09 at 2:12

dthrasherdthrasher

34.2k3131 gold badges102102 silver badges133133 bronze badges

add a comment
 | 

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Submit

Post as a guest

Name

Email
Required, but never shown

Post Your Answer

Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged c# generics serialization collections or ask your own question.

Blog

Ben Popper is the worst coder in the world: Something awry with my array

This week, #StackOverflowKnows fast planes, math with dates, and code comments

Featured on Meta

TLS 1.0 and TLS 1.1 removal for Stack Exchange services

Did Stack Exchange cut the number of negative comments nearly in half between…

An account of my meeting with the Stack Overflow management team

Linked

150

Proper way to implement IXmlSerializable?

Related

6357What is the difference between String and string in C#?1409What does the [Flags] Enum Attribute mean in C#?1829What is the best way to give a C# auto-property an initial value?1146Create Generic method constraining T to an Enum2528What is the best way to iterate over a dictionary?2478What are the correct version numbers for C#?2927What is a serialVersionUID and why should I use it?1570What do two question marks together mean in C#?1’Semi’ Generic Dictionary Serialization. (C#)1342Why not inherit from List<T>?

Hot Network Questions

What are these black lines under the tabs?

Distribution of signs of automorphic forms

When should a company hire developers versus outsourcing them?

Light task-processing systems with zero dependency for Linux systems

Are there any dangerous commands in LaTeX?

Player has trouble imagining the ingame situation

Find common substring that starts a set of strings

How do I pick a location to play a tabletop RPG?

Hexagon column tessellation

Airline schedule flights to arrive at the same time its scheduled to depart

Eldritch knight dual wield: do I get multiple attacks on my bonus action?

How do I define smells I have never experienced?

Sort list by types

Is it legal to sell suspected or proven counterfeit US currency?

Why don’t organs have weighted keys?

Why do the rich want to live on the ground?

How to know if a usb cable has 4 wires not 2 (other then cutting it)

How do I show students the Beauty of Mathematics?

Your Task Is to Create the World’s Hardest Irregular Sudoku!

What were some of the earliest common webservers and how did they work?

How to use gas pump in Israel?

Athmosperic reentry drag and friction

On tenure track and department chair wants me to consider leaving

Was it possible to listen to music and work on old PCs? When was it possible to for the first time?

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

lang-cs

Categories
askquestion

What are some good sql databases for home Vista computer?

What are some good sql databases for home Vista computer?

Ask Question

Asked
11 years ago

Active
11 years ago

Viewed
313 times

.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}

2

I have been trying for a long time to get SQL Server Express on my computer to practice my C#/SQL with and I still haven’t gotten it to work.

Are there other programs I can use to setup an SQL database to practice with? If so, which are the best ones for Vista?

EDIT:
To be clear I am not new to SQL programming, I just haven’t done any in a while and want to stay fresh. So I would like something that has most of the features of forms of SQL I would use professionally.

c# .net sql

share|improve this question

edited Jan 24 ’09 at 19:44

Alex Baranosky

asked Jan 24 ’09 at 19:30

Alex BaranoskyAlex Baranosky

40.9k3636 gold badges9090 silver badges144144 bronze badges

Which version of SQL Express can’t you get to work? What version of Vista? Home, Premium, Ultimate…? And what problems are you having, can you link to the MSDN threads you mentioned/commented on GregD’s post?

– Kev
Jan 24 ’09 at 19:41

here you go: social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/…

– Alex Baranosky
Jan 24 ’09 at 19:42

btw, Juniordeveloper.net returns an error: Looks like someone didn’t set up their blogengine.net successfully. :-/

– George Stocker
Jan 24 ’09 at 20:02

Gortok, whose site is JuniorDeveloper.net?

– Alex Baranosky
Jan 24 ’09 at 20:15

add a comment
 | 

8 Answers
8

active

oldest

votes

7

MySQL or Postgresql are both full fledged DB’s and good for education/experimentation. You can also check out Oracles free version.

share|improve this answer

answered Jan 24 ’09 at 19:33

Fredrik JanssonFredrik Jansson

3,32333 gold badges2525 silver badges3232 bronze badges

Since PostgreSQL supports a broader part of and adheres more to the SQL standard, maybe it should be mentioned first, especially from the educational point of view. 🙂 (Seriously, I’ve had a hard time to get over some bad old MySQL habits)

– vog
Jan 24 ’09 at 19:36

I can use PostgreSQL with C#.NET?

– Alex Baranosky
Jan 24 ’09 at 19:39

-1 for MySQL. Although the latest version can finally be considered a RDBMS it’s peculiarities still mitigate it’s use as a generic example database

– Cruachan
Jan 24 ’09 at 20:02

add a comment
 | 

3

SQLite is good if you need something fast, small and powerful… its a fast download also.

SQLite

SQLite with C#

share|improve this answer

answered Jan 24 ’09 at 19:43

user58163user58163

add a comment
 | 

3

What aren’t you getting to work for Sql Express. It works on Vista. I use it on a daily basis. It no longer comes standard with a “northwind” database, but you an download the AdventureWorks DB. Can you be more specific about “I still haven’t gotten it to work”?

I’ve also heard good things about firebird

Although I still believe that C# and SQL Express is the best way to go.

share|improve this answer

edited Jan 24 ’09 at 19:48

answered Jan 24 ’09 at 19:33

GregDGregD

6,34555 gold badges2929 silver badges5959 bronze badges

I’ve had trouble installing it. I have been asking the folks on msdn.com to help me and it just hasn’t gotten anywhere, so rather than wait around I figured I would ask if there was some easier option.

– Alex Baranosky
Jan 24 ’09 at 19:35

Why was this downvoted? It was a perfectly reasonable question?

– Kev
Jan 24 ’09 at 19:38

Maybe they didn’t like the AdeventureWorks DB?

– Alex Baranosky
Jan 24 ’09 at 19:48

I’ve been running SQL Express 2008 just fine on Vista. Maybe it’s a problem with your version of vista? I’m running ultimate 64 with sql 2008 express x64 and it’s running flawlessly.

– Chris Conway
Jan 24 ’09 at 19:52

Can we trade computers? hehe.

– Alex Baranosky
Jan 24 ’09 at 20:16

add a comment
 | 

2

SQL Server Express generally should be the natural choice for practice with .NET and C#.

If you have no prior experience in working with SQL Server and its Express version one most confusing thing is that SQL Server Express is not installed as default instance, but as SQLEXPRESS instance. So you have to use “Data Source=.SQLEXPRESS” in your connection string.

In case you can not overcome issues with SQL Express you can try Postgres, but you will need to download and use .NET Data Provider for Postgres.

share|improve this answer

answered Jan 24 ’09 at 19:54

Dima MalenkoDima Malenko

2,68511 gold badge2222 silver badges2323 bronze badges

add a comment
 | 

1

I preferr Firebird its a madure BD and its O.S. very stable btw.

http://www.firebirdsql.org/

and try ibexpert for manager this bd.

http://ibexpert.net/ibe/

share|improve this answer

answered Jan 25 ’09 at 1:29

KipowKipow

5122 bronze badges

add a comment
 | 

1

Both Oracle and IBM offer offer versions of their flagship databases for free in a similar manner to SQL Server Express. Both are excellent products if you wish to play with a ‘real’ database system.

Oracle 10g Express

IBM DB2 Express

Postgres is also well worth considering as it is also a ‘real’ relational database, having originally started as the much respected Ingres RDBMS in the 1980s. However Postgress until recently was Unix-based and I’ve never found it particularly reliable installing on Windows.

Personally I would not recommend MySQL for your scenario – although the latest edition can finally be described as a RDBMS having evolved from what really was a collection of flat files with a limited SQL query interface it’s peculiarities probably mitigate against it’s use as a learning tool unless you are actually focused on MySQL. To placate all those thinking of giving me a down vote for this – yes I do use MySQL, and yes it is (now) and excellent product in its place – just not here.

There are a number of other less popular RDMSs you could consider. Firebird has always been something of a favourite of mine as I used to code a lot of Delphi, and SQLite is a joy to work with in many circumstances. It’s also a pity you cannot use SQL Server Express as the SQL Server product range is simply the most solid product Microsoft produces and usually my database of choice on anything but the smallest, largest or most unsual installations

share|improve this answer

edited Jan 25 ’09 at 10:16

Mike Woodhouse

46.5k1212 gold badges8383 silver badges122122 bronze badges

answered Jan 24 ’09 at 19:57

CruachanCruachan

15.1k44 gold badges5555 silver badges106106 bronze badges

If you use Oracle or DB2 (or MySQL), I recommend the freeware TOAD (Tool for Oracle Application Developers :D) at toadsoft.com. I don’t work for them, but seriously, it is a lot better than PHPMyAdmin!

– Lucas Jones
Jan 25 ’09 at 11:24

add a comment
 | 

0

Vista DB is quite a nice lightweight managed flatfile database (not related to Windows Vista).

share|improve this answer

answered Jan 24 ’09 at 19:33

RSlaughterRSlaughter

1,13133 gold badges1111 silver badges2222 bronze badges

Why was this voted down? I’d understand if it’s due to it being a brief post, but the one about SQLite has been voted up and that’s no different…

– RSlaughter
Jan 25 ’09 at 1:24

add a comment
 | 

0

For something very simple look at sqlite It supports most SQL syntax and stores it’s database in a single file so has very little setup. You’ll need an ado.net data provider for it which you can find here Although it isn’t a good choice for multi user systems with lots of data it should be fine for an introduction to database programming.

share|improve this answer

answered Jan 24 ’09 at 19:41

JaredJared

37.1k2828 gold badges102102 silver badges140140 bronze badges

add a comment
 | 

Your Answer

Thanks for contributing an answer to Stack Overflow!Please be sure to answer the question. Provide details and share your research!But avoid …Asking for help, clarification, or responding to other answers.Making statements based on opinion; back them up with references or personal experience.To learn more, see our tips on writing great answers.

Draft saved
Draft discarded

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Submit

Post as a guest

Name

Email
Required, but never shown

Post Your Answer

Discard

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you’re looking for? Browse other questions tagged c# .net sql or ask your own question.

Blog

Ben Popper is the worst coder in the world: Something awry with my array

This week, #StackOverflowKnows fast planes, math with dates, and code comments

Featured on Meta

TLS 1.0 and TLS 1.1 removal for Stack Exchange services

Did Stack Exchange cut the number of negative comments nearly in half between…

An account of my meeting with the Stack Overflow management team

Related

374What Are Some Good .NET Profilers?439What is the syntax for an inner join in LINQ to SQL?186In C#, What is a monad?0SQL server express edition a pre-requisite for using a SQL Database0Unable to update SQL Database, Using C# Win Form

Hot Network Questions

What is ‘the secret of Da Vinci’s drains’ in ‘Aurora Leigh’?

Why is the hostname declared invalid when creating a URI

Eldritch knight dual wield: do I get multiple attacks on my bonus action?

Providing the spymaster with cues for clues in Codenames

How to disconnect air conditioner lines from outdoor unit?

How to know if a usb cable has 4 wires not 2 (other then cutting it)

Is this a game to you?

How to draw “clean and simple” vectors on a plane in LaTeX?

How can I statistically test if the line in a graph is moving upwards, downwards or sideways?

Was it possible to listen to music and work on old PCs? When was it possible to for the first time?

Can you Rappel with an Old Climbing Rope?

Why don’t you need to pay taxes on cash back bonuses?

What prevents me from setting up an A name entry for “google.ca” to whatever IP address I want?

How do Trump’s public statements make DOJ’s job impossible?

How do cars drive through deep water as shown on many videos online?

Why are no recent small aircraft designed to be “characteristically incapable of spinning” as the Ercoupe was?

Why are even primes notable?

Drawing one-liner

Light task-processing systems with zero dependency for Linux systems

Distribution of signs of automorphic forms

In what cases should I completely state a theorem I’m about to use?

How to determine if given OpAmp model supports single supply (Ex. OPA167x)

How to find a CDF of Y(X) given that we know a probability distribution of X?

Can a horse really travel over 65 miles per day, according to the rules?

more hot questions

Question feed

Subscribe to RSS

Question feed
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.

default