Categories
askquestion

Integrate TortoiseSVN with Redmine

Integrate TortoiseSVN with Redmine

Ask Question

Asked
11 years ago

Active
5 years, 9 months ago

Viewed
10k times

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

4

10

I’m trying to integrate Redmine with TortoiseSVN, but I was not able to do that because TSVN always gives me this error:

“There are no issue-tracker providers available.”

I followed these steps:

In my project folder properties, I added ‘bugtraq:url -> http://myweb/../issues/show/%BUGID%’
In Redmine settings, I added SVN in the repository tab, and Redmine showed my repository without any problems.

I’m not sure if there are any missing steps or what I have to do to make the integration.

Or should I look at trac, because it seems more stable and has better support?

svn tortoisesvn trac redmine issue-tracking

share|improve this question

edited May 6 ’14 at 13:45

Chris Forrence

9,22588 gold badges4040 silver badges5656 bronze badges

asked Feb 5 ’09 at 16:03

Mohammed NasmanMohammed Nasman

10.6k66 gold badges4040 silver badges6666 bronze badges

add a comment
 | 

3 Answers
3

active

oldest

votes

9

Slightly more detail on Stefan’s post:

With what you’re trying to do, setting the bugtraq:url alone isn’t enough. You need to either set the ‘bugtraq:message’ property or the ‘bugtraq:logregex’ property as well.
As an example, on our redmine setup we allow the following items in the commit message:

References: refs,references,IssueID
Fixes: fixes,closes,Fixes Bug

So we use a bugtraq:logregex for maximum flexibility of:

([Cc]loses|[Ii]ssue[Ii][Dd]|[Rr]eferences|[Rr]efs|[Ff]ixes(s[Bb]ug)?)s?#(d+)
d+

Which covers all our options.

By doing this, tortoise highlights the part of the commit comment which links into redmine and turns the number into a link which you can click on to go to the actual redmine issue.

The more advanced option is to allow you to choose an open bug directly from redmine. It’s this feature that needs a specific plugin installed on your machine, but as far as I can tell, such a plugin for redmine doesn’t exist, so we’re kind of stuck with the basic option at the moment. When someone writes such a plug-in, and you install it, you’ll then be able to go into “Issue tracker Integration” as you’re currently trying to and things will work fine.

share|improve this answer

answered Feb 9 ’09 at 14:46

Jim TJim T

11.6k55 gold badges2424 silver badges4040 bronze badges

Jim, thanks great info, I want to ask if I could closes an issue in redmine when I commit with TSVN, is that possible?

– Mohammed Nasman
Feb 10 ’09 at 16:07

3

Yes certainly, but only if you use the bugtraq:logregex method. If you go to Administration->Settings->Repositories you’ll find two config options: Referencing keywords and Fixing keywords. Use on of the fixing keywords in your commit log to close your issue, ie: fixes #55

– Jim T
Feb 11 ’09 at 15:50

Thanks Jim, You put me in the right direction, everything is working fine now 🙂

– Mohammed Nasman
Feb 12 ’09 at 16:42

add a comment
 | 

7

Please read the docs.

The error “There are no issue-tracker providers available” means that you have not installed an issue tracker plugin for TSVN.

The bugtraq: properties don’t require a plugin. You can use those without a plugin (but you won’t be able to fetch a list of open issues in the commit dialog).

share|improve this answer

answered Feb 5 ’09 at 17:19

StefanStefan

40.8k99 gold badges6969 silver badges114114 bronze badges

I have already read all these links, but I think the missing part is the COM plug-ins by redmine, right?

– Mohammed Nasman
Feb 10 ’09 at 16:05

Yes, if they don’t provide a COM plugin, you have to write your own 🙂

– Stefan
Feb 10 ’09 at 17:12

Stefan, Can I close an issues from TSvn directly when I made a commit?, also where Can I find a resource to write COM plug-ins for TSVN?

– Mohammed Nasman
Feb 10 ’09 at 19:38

1

Closing issues directly from TSVN will be possible in the next version (and of course if the plugin supports it). You can find docs on how to implement such a COM plugin here: tortoisesvn.tigris.org/svn/tortoisesvn/trunk/contrib/… (username: ‘guest’, leave password empty)

– Stefan
Feb 10 ’09 at 20:44

Thanks Stefan, you have made a great work for all the developers with TSVN 🙂

– Mohammed Nasman
Feb 12 ’09 at 16:43

add a comment
 | 

1

There is an existing Tortoise plugin for Redmine that you can try.

share|improve this answer

edited Dec 21 ’12 at 11:25

Tim Saunders

4,38433 gold badges3131 silver badges4949 bronze badges

answered Jun 10 ’09 at 11:20

Redmine userRedmine user

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 svn tortoisesvn trac redmine issue-tracking or ask your own question.

Blog

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

Community working group updates: February 2020

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?

Visit chat

Linked

16

Integrating Fogbugz with TortoiseSVN with no URL/Subversion backend

Related

1Does tortoiseSVN support multiple iBugTraqProviders for same user/machine?69An SVN error (200 OK) when checking out from my online repository469TortoiseSVN icons not showing up under Windows 7296How to change users in TortoiseSVN7Internal bug tracking tickets – Redmine, Trac, or JIRA1Redmine doesn’t access VisualSVN repository25SVN Upgrade working copy – TortoiseSVN

Hot Network Questions

Detect manual changes to an autogenerated C header

Were Vietnam veterans spat on?

Linux backup utility for incremental backups

What is this flat metallic component?

Magento2 – How to move cart total below the cart items on checkout page?

Why does the same proportion of a radioactive substance decay per time period? (half life)

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

How do I know whether an airline seat upgrade was free?

Effectiveness of a glowing hot tungsten sword against medieval era knights?

I hate Valentine’s Day

Is it common for residential foundations from the 1960s to contain asbestos?

Fastest yes in the west

Where to store passport during day trip in foreign country

What would be the best way to capture a Giant?

What does Islam say when dealing with stupid and arrogant parents?

How to change the semantic version number when reverting the last major change

Using polar coordinates to find solutions to equation

Conceptual reason that monadic functors create limits?

Can I use 12-2 wire on a 20amp breaker to power ENTIRE bathroom?

How do I show students the Beauty of Mathematics?

What early middle ages weapons would suit an extremely strong child?

Is it ever neccesary to burn a starter out?

Effect of removing an edge on Hadwiger number

What is the correct way to upgrade pip in stretch debian?

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

Why does the Standard Numeric Format for percentages include a space?

Why does the Standard Numeric Format for percentages include a space?

Ask Question

Asked
11 years ago

Active
5 years, 1 month ago

Viewed
3k times

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

9

The Back Story

I have some decimal values which I am displaying as strings on a web page as part of a larger string. I started off using a Standard Numeric Format String to output this. E.g.

myDecimal.ToString(“P0″)

The 0 after the P tells it I want no decimal places. This works as far as it goes, in that my ouput ends up looking something like:

Calculated as above based on the phased minimum Company contribution rate of 2 %

The Space Problem

I really want to get rid of that space between the number and the percentage sign as in some cases it ends up splitting across lines. And also, I prefer the % to butt up to the number.

Possible Workarounds

1. html / css solution

I could put a <nobr> tag or a <span style=”white-space: nowrap;”> around it. But, that feels awkward, and anyway I prefer the % to butt right up to the number as I think it looks better. It’s how we would write it in reports in this neck of the woods, so it’s how I want it on the web page.

2. Custom format string

I am going to end up using a Custom Numeric Format String, E.g.

myDecimal.ToString(“0%”)

The Question

Is it more common to display percentages with a space between the number and the percentage sign? This would surprise me, but it could be.

Is there a way to tell the Standard Numeric Format String I don’t want the space?

Is there any disadvantage to using a Custom Numeric Format String over a Standard Numeric Format String?

Ok – I admit it, that was more than one question – Extra Credit if you answer them all.

.net number-formatting

share|improve this question

edited Jan 6 ’15 at 8:38

easwee

14.2k99 gold badges5050 silver badges7777 bronze badges

asked Feb 5 ’09 at 16:04

Sam MeldrumSam Meldrum

12.8k66 gold badges3030 silver badges3838 bronze badges

1

Something appears to have changed in Windows 8. With Windows region settings configured to English (Australian), ToString(“P2”) gives “0.00%”, but on a Windows 7 box with same region settings, it returns “0.00 %”. Specifying the Invariant culture causes a space to be included on Win7 and 8.

– David Gardiner
Jun 5 ’14 at 0:46

Thanks, David! This was driving me crazy! I was getting different unit test results (“52.00 %” vs “52.00%”) between my local machine and build servers, and now it makes sense.

– Mike Manard
Apr 25 ’18 at 16:28

add a comment
 | 

3 Answers
3

active

oldest

votes

5

Looking at http://www.nasdaq.com/ or http://finance.yahoo.com/ it seems that the percentage sign right after the number with no space inbetween is common 🙂

Have a look at http://msdn.microsoft.com/en-us/library/system.globalization.numberformatinfo.percentpositivepattern.aspx

It probably depends on culture, the default (invariant) beeing n %

share|improve this answer

answered Feb 5 ’09 at 16:25

AlerisAleris

7,36733 gold badges3131 silver badges4141 bronze badges

Yes it depends on the culture and English has a space although there is an endless discussion about it.

– Dodger
Aug 20 ’19 at 16:19

add a comment
 | 

5

This worked for me:

System.Globalization.CultureInfo newCulture = (System.Globalization.CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone();
newCulture.NumberFormat.PercentPositivePattern = 1; // Avoid putting a space between a number and its percentage
System.Threading.Thread.CurrentThread.CurrentCulture = newCulture;

share|improve this answer

edited Dec 2 ’13 at 21:05

answered Dec 2 ’13 at 20:45

user565869user565869

add a comment
 | 

2

To change the default PercentPositivePattern value, you must create a new CultureInfo object and use it instead of the default, which is probably “en-us”. (Alternately, you can specify “en-za” as the culture in your Web.config, but I don’t recommend that for obvious reasons.)

There’s a great post on the ASP Forums explaining how to do all of this. See the code written by the third poster (m0brien). I copied his exact code into my master page’s Page_Load method, so that I don’t have to think about it anymore.

Of course, you could always just do String.Format().Replace(” “, String.Empty), but you’d have to do that throughout your site. Plus, honestly, where’s the fun in that when you could roll up your sleeves and play with your globalization values???

share|improve this answer

answered Mar 27 ’09 at 23:03

DavidDavid

1,58711 gold badge1818 silver badges3434 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 .net number-formatting 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

1

<decimal>.ToString(“P3”) returns differerent results on Win7 and Windows 10

Related

74Double to string conversion without scientific notation2Combine custom numeric format string with hex format string0Query excel spreadsheet for cell format… (percentage)5How to convert .NET standard format string to Excel format string1Custom numeric decimal format2Regex: change strings of numbers to standard parseable format1.Net – General numeric formatting does not seem to preserve zeros

Hot Network Questions

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

Apocryphal (?) tale of hard drive platter being thrown through a wall?

Why is light with a small wavelength required to have a rectilinear path?

Why is learning mathematics compulsory?

can I use ATF IV instead of Dexron for 2005 toyota camry

Is the actual VMC to IMC transition a challenge (for IFR rated pilot/craft etc) if, say, sudden or unexpected?

New published work denied brewski robbery

On tenure track and department chair wants me to consider leaving

I need to examine an 82.7G (!) text file. What can open it?

Why did the Z80 with 4-bit ALU out-perform the fully 8-bit Intel 8080?

Trumpet type or technique?

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

What would be the best way to capture a Giant?

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

Avoiding microstrip line to become CPWG

How do coordinate reference systems and projections relate to each other?

Drawing one-liner

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

Why the focus on American put options in literature?

Effectiveness of a glowing hot tungsten sword against medieval era knights?

How did the Kohanim eat in the Azara?

How do I know whether an airline seat upgrade was free?

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

Coupling Theory vs reality

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

How to retrieve metadata for return values of an sql server stored procedure

How to retrieve metadata for return values of an sql server stored procedure

Ask Question

Asked
11 years ago

Active
1 year ago

Viewed
3k times

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

1

1

I want to analyze an SQL Server stored procedure from .NET code to retrieve metadata for the data/columns it returns (not OUTPUT parameters). Like when you drag/drop a sp on a DataSet i VisualStudio and it automatically generates columns. It could be useful for me for some code generation I’m testing out.

The procedures contains simple select statements like SELECT a,b FROM c and I’d like to get metadata about a and b.

.net sql-server code-generation metadata

share|improve this question

edited Jun 1 ’09 at 18:51

GEOCHET

20k1515 gold badges6868 silver badges9595 bronze badges

asked Feb 5 ’09 at 16:05

Johan DanforthJohan Danforth

3,89944 gold badges2929 silver badges3434 bronze badges

add a comment
 | 

2 Answers
2

active

oldest

votes

2

You can use SET FMTONLY ON (and execute it) – but this is a bit hit-n-miss. It doesn’t cover all scenarios (branches, etc) – and can still execute some code (extended stored procedures etc).

Alternatively – use table-valued-functions (udfs) – they have much richer/more-formal metadata.

share|improve this answer

edited Feb 4 ’19 at 11:50

AeroX

3,04222 gold badges2020 silver badges3737 bronze badges

answered Feb 5 ’09 at 16:09

Marc Gravell♦Marc Gravell

848k220220 gold badges22842284 silver badges26622662 bronze badges

add a comment
 | 

1

In SQL Server 2012 /Denali you can use sys.dm_exec_describe_first_result_set_for_object.

This returns information about the first result set in the procedure (as long as this result set is returned by all code paths)

share|improve this answer

edited Oct 14 ’11 at 20:23

answered Apr 2 ’11 at 23:42

Martin SmithMartin Smith

374k6969 gold badges634634 silver badges735735 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 .net sql-server code-generation metadata 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

2

Sql Server – Any way to find which stored procedures return sets and which not?

Related

2700Add a column with a default value to an existing table in SQL Server1736How to return only the Date from a SQL Server DateTime datatype1816How to check if a column exists in a SQL Server table?1867How to concatenate text from multiple rows into a single text string in SQL server?250SQL Server: Query fast, but slow from procedure1545Insert results of a stored procedure into a temporary table580What is the best way to auto-generate INSERT statements for a SQL Server table?815Function vs. Stored Procedure in SQL Server3608How do I UPDATE from a SELECT in SQL Server?779Search text in stored procedure in SQL Server

Hot Network Questions

How to disconnect air conditioner lines from outdoor unit?

How do I know whether an airline seat upgrade was free?

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

What is the word for an animal species which only eats one type of food?

Detect manual changes to an autogenerated C header

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

How does apt upgrade running programs?

How do I create a 3×3 matrix of Images with a letter at the beginning of each line?

How much can I get away with making management happy but irritating co-workers?

Can you Rappel with an Old Climbing Rope?

New published work denied brewski robbery

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

Were Vietnam veterans spat on?

Linux backup utility for incremental backups

What would be the best way to capture a Giant?

Are the sum of two numbers desired?

Drawing one-liner

Is the actual VMC to IMC transition a challenge (for IFR rated pilot/craft etc) if, say, sudden or unexpected?

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

On tenure track and department chair wants me to consider leaving

How to batch rotate image to make them all landscape?

Can I use 12-2 wire on a 20amp breaker to power ENTIRE bathroom?

Why is learning mathematics compulsory?

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

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-sql

Categories
askquestion

How to transfer java array to javaScript array using jsp?

How to transfer java array to javaScript array using jsp?

Ask Question

Asked
11 years ago

Active
4 years, 4 months ago

Viewed
74k times

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

9

4

I have a list of strings on my server which I am trying to get to the client in the form of an array. The code I am attempting to use is the following:

Within the jsp I have a List<String> column

I am attempting the following code:

<%int j = 0; %>
for(var i = 0; i < <%=columns.size()%>; i++)
{
colArray[i] = “<%=columns.get(j++)%>”;
}

This code simply returns the first element in the columns list for every element in the colArray.

I have also tried:

colArray = <%=columns.toArray()%>;

which does not work either.
I feel like I am making a little mistake somewhere and am just not seeing it. Is what I am trying to do possible in the way that I am attempting?

Thanks.

java javascript arrays jsp

share|improve this question

edited May 11 ’11 at 14:49

Alex K.

149k2424 gold badges225225 silver badges254254 bronze badges

asked Feb 5 ’09 at 16:06

kgradkgrad

4,14277 gold badges3030 silver badges5656 bronze badges

add a comment
 | 

6 Answers
6

active

oldest

votes

14

You’re getting the JSP code that is executed on the server mixed up with the JavaScript code that’s executed on the client. The snippet <%=columns.get(j++)%> is executed once, on the server, and the JavaScript loop around it is irrelevant at this point. When it arrives the the client, the loop’s body just says colArray[i] = “first entry”; which of course puts the same string into every element of the array.

What you need to do instead is to have a loop execute on the server, like this:

<% for (int i=0; i<columns.size(); i++) { %>
colArray[<%= i %>] = “<%= columns.get(i) %>”;
<% } %>

My JSP skills are rusty, and the syntax may be different, but I hope you get the idea.

Edit: As was pointed out in the comments, you need to be VERY careful about escaping anything in those Strings that could cause them to be interpreted as JavaScript code (most prominently quotation marks) – especially if they contain user-generated content. Otherwise you’re leaving your app wide open to Cross-site scripting and Cross-site request forgery attacks.

share|improve this answer

edited Feb 5 ’09 at 16:51

answered Feb 5 ’09 at 16:19

Michael BorgwardtMichael Borgwardt

312k7171 gold badges448448 silver badges681681 bronze badges

This will not work if the strings contain characters such as double-quote, backslash or newline. Such characters will need to be escaped.

– Luke Woodward
Feb 5 ’09 at 16:42

I’d also add a semicolon to the end of the second line.

– Luke Woodward
Feb 5 ’09 at 16:43

add a comment
 | 

6

Try using JSON (Javascript object notation) it’d be quite simple to encode the array and decode it on javascript

check it out here

http://www.json.org/java/index.html

share|improve this answer

answered Feb 5 ’09 at 16:49

perrohunterperrohunter

2,86577 gold badges3131 silver badges5151 bronze badges

add a comment
 | 

5

Once the JavaScript reaches the client, the server code has stopped executing. The server code does not execute “in parallel” with the client code.

You have to build the entire JavaScript initialization in Java and send it, complete and executable, to the client:

<%
StringBuffer values = new StringBuffer();
for (int i = 0; i < columns.size(); ++i) {
if (values.length() > 0) {
values.append(‘,’);
}
values.append(‘”‘).append(columns.get(i)).append(‘”‘);
}
%>
<script type=”text/javascript”>
var colArray = [ <%= values.toString() %> ];
</script>

That is just one way to do it, you can also build the output “on the fly” by embedding the server code inside the [ and ]. I used this example to try to demonstrate the separation between building the string that comprises the client-side JavaScript and outputting that to the browser.

share|improve this answer

answered Feb 5 ’09 at 16:19

Grant WagnerGrant Wagner

21.6k66 gold badges4949 silver badges6060 bronze badges

add a comment
 | 

3

Exp Language:

colArray = ${columns}

share|improve this answer

edited Sep 17 ’12 at 13:32

j0k

21.1k1414 gold badges7171 silver badges8181 bronze badges

answered Sep 17 ’12 at 13:05

fmannafmanna

3111 bronze badge

it’s useful for list of numbers, strings are not surrounded by “”

– Glapa
Oct 8 ’19 at 22:41

add a comment
 | 

3

For me this solution has worked. First of all You should make a JSONArray and use it’s toJSONString() method. This method converts the list to JSON text. The result of it is a JSON array.

<%
List<String> exampleList = new ArrayList<>();
exampleList.add(“Apple”);
exampleList.add(“Orange”);
exampleList.add(“Lemon”);

JSONArray fruitList = new JSONArray();
fruitList.addAll(exampleList);
%>

In your JSP page you should invoke the toJSONString() method of the list, and pass the JSON text to a JavaScript array.

<script type=”text/javascript”> var fruitArray = <%= fruitList.toJSONString() %>;</script>

(Optionally You could make a simple getter method for the list. In case if you only instantiate the JAVA class – which has the list field – int the JSP page.)

share|improve this answer

answered Oct 8 ’15 at 14:24

F3R1F3R1

37311 gold badge33 silver badges1010 bronze badges

add a comment
 | 

2

The solutions posted above didn’t work in my case, I needed an extra Javascript variable to do the transference:

var codesJS=new Array();
<% String[] codes=(String[])request.getAttribute(“codes”);
if(codes!=null){
for(int i=0; i<codes.length; i++){ %>
var code='<%= codes[i] %>’; //–> without this doesnt work
codesJS[<%= i %>]=code;
<%}
}%>

share|improve this answer

edited Jun 5 ’13 at 21:00

Aboutblank

66722 gold badges1414 silver badges3030 bronze badges

answered Jun 5 ’13 at 20:34

José AlmeidaJosé Almeida

2111 bronze badge

How the “i” variable passes from js to java ?

– serj
Oct 2 ’15 at 10:05

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 java javascript arrays jsp 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

-1

Pass an array from .jsp file to .js file

-2

How to convert a list of java objects which came on JSP page as Spring MVC model to javascript collection to iterate them?

0

How could I get ModelAndView object in js by using for loop?

0

Pre-populating jQuery Autocomplete with data

-1

Servlet array to javascript variable

Related

7640How do JavaScript closures work?5959How do I remove a property from a JavaScript object?3879How do I check if an array includes a value in JavaScript?5022How do I include a JavaScript file in another JavaScript file?7431What does “use strict” do in JavaScript, and what is the reasoning behind it?7429How to check whether a string contains a substring in JavaScript?3030Loop through an array in JavaScript7897How do I remove a particular element from an array in JavaScript?4545For-each over an array in JavaScript?24083Why is processing a sorted array faster than processing an unsorted array?

Hot Network Questions

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

Three way switch with two common wires?

Ways to append text to a file

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

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

Why did the Z80 with 4-bit ALU out-perform the fully 8-bit Intel 8080?

how one column can be large in a table

Are the sum of two numbers desired?

How to change the semantic version number when reverting the last major change

When should a company hire developers versus outsourcing them?

First non-elected person in line of succession for British Government or Parliament?

How do I create a 3×3 matrix of Images with a letter at the beginning of each line?

Why is late Russian Empire associated with Byzantium while having little in common with it?

Book Chapter Decoration

How do I sail rafts in Breath of the Wild?

Since the caster of the Zone of Truth spell knows whether a creature failed the save, can they use it to detect hidden/invisible creatures?

Can you Rappel with an Old Climbing Rope?

How to batch rotate image to make them all landscape?

Where to store passport during day trip in foreign country

How does apt upgrade running programs?

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

Trumpet type or technique?

If a portal scroll is cheap and easily available why they are not used when one’s life is in peril?

Difference between Intel 8087 and 8089 opcodes

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

Why does RewriteRule ^page/?$ page.php [L] match site.com/page//

Why does RewriteRule ^page/?$ page.php [L] match site.com/page//

Ask Question

Asked
11 years ago

Active
11 years ago

Viewed
1k times

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

1

1

RewriteEngine on
RewriteRule ^page/?$ page.php [L]

This ends up matching the url www.site.com/page// but internally it acts differently than www.site.com/page/ because the stylesheets and images no longer appear properly. Am I doing something wrong or is this just something I need to deal with if I don’t want to go through a lot of trouble?

To me it looks like it should only match www.site.com/page or www.site.com/page/

apache .htaccess mod-rewrite

share|improve this question

edited Jan 24 ’09 at 18:53

Fabian Steeg

41k66 gold badges7676 silver badges109109 bronze badges

asked Jan 24 ’09 at 18:29

Joe PhillipsJoe Phillips

41.4k2424 gold badges8585 silver badges143143 bronze badges

add a comment
 | 

1 Answer
1

active

oldest

votes

4

Apache strips the empty path segment. So /path// is treated as /path/. But your browser doesn’t so relative URLs are resolved using /path//.

If you want to remove the multiple slashes, you can use the following rule:

RewriteCond %{THE_REQUEST} ^[A-Z]+ /(([^/ ]+/)*)/+([^ ]*)
RewriteRule ^ /%1%3 [L,R=301]

Explaination

Despite Apache removes empty path segments internal, the THE_REQUEST environment variable (holding the HTTP request line) stays untouched. So we can use this value to check for multiple slashes.

^[A-Z]+ / matches the request method, the following space and the first slash character of the URI path.
(([^/ ]+/)*) matches all following non-empty path segments (foo/, foo/bar/, foo/bar/baz/, etc.) or nothing, if there are none.
/+ matches the empty path segments as the character before this slash is always another slash (see the expressions before).
([^ ]*) matches the rest of the URI (that may contain further empty path segments).

Example: Let’s say we request http://example.com/foo/bar//baz, the request line will look like this:

GET /foo/bar//baz HTTP/1.1

The pattern would then match as follows:

0: GET /foo/bar//baz
1: foo/bar/
2: bar/
3: baz

So the requested path /foo/bar//baz would be redirected to /foo/bar/baz (/%1%3).

share|improve this answer

edited Jan 24 ’09 at 19:21

answered Jan 24 ’09 at 18:33

GumboGumbo

550k9595 gold badges704704 silver badges791791 bronze badges

Brilliant. Can you possibly explain a little bit what each of those lines do?

– Joe Phillips
Jan 24 ’09 at 18:37

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 apache .htaccess mod-rewrite 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?

Related

0MOD_REWRITE but not in sub directories0Redirect all urls with parameters to an specific page with same parameters2.htaccess rewrite without it affecting relative image/css/js URLs?9htaccess RewriteRule page with query string0If url ends with double dash, want to rewrite(Apache)0Using RewriteRule to write URL from page/unique_id to page.php?id=unique_id0htaccess – Stop processing0Using RewriteRule shows apache folder navigation or 404, why?0Apache HTTPD 2.4 URL Rewrite Rules1Multiple languages + Htaccess

Hot Network Questions

Find common substring that starts a set of strings

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

Is firing for unionizing legal? (The Office, S2E15)

Paint 21 Squares of a 7×7 Board Without Forming a Rectangle

My approach to sorting algorithm

What are the most powerful airplanes that ever flew?

How do I sail rafts in Breath of the Wild?

Providing the spymaster with cues for clues in Codenames

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

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

Ways to append text to a file

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

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

Copying & pasting multiple commands to Minecraft terminal

Why did the Z80 with 4-bit ALU out-perform the fully 8-bit Intel 8080?

How do Aarakocra fly with a backpack?

Is there any material which cannot be cut by a lightsaber?

Can a Battle Smith’s artificer Steel Defender be imbued with an infusion?

Since the caster of the Zone of Truth spell knows whether a creature failed the save, can they use it to detect hidden/invisible creatures?

Can you Rappel with an Old Climbing Rope?

Taller than normal parallel symbol ||

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

How to batch rotate image to make them all landscape?

How did Canada come to be the robotic arm people?

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

Programming style of method declaration of get/set method variables in C++?

Programming style of method declaration of get/set method variables in C++?

Ask Question

Asked
11 years ago

Active
9 years, 10 months ago

Viewed
3k times

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

6

2

Should you declare the getters/setters of the class inside the .h file and then define them in .cpp Or do both in .h file. Which style do you prefer and why? I personally like the latter wherein all of them are in .h and only methods which have logic associated with it other than setters/getters in .cpp.

c++ coding-style

share|improve this question

edited Apr 6 ’10 at 23:12

BalusC

914k321321 gold badges33323332 silver badges33423342 bronze badges

asked Jan 24 ’09 at 18:35

kalkal

24.3k4646 gold badges110110 silver badges147147 bronze badges

add a comment
 | 

8 Answers
8

active

oldest

votes

12

For me it depends on who’s going to be using the .h file. If it’s a file largely internal to a module, then I tend to put the tiny methods in the header. If it’s a more external header file that presents a more fixed API, then I’ll put everything in the .cpp files. In this case, I’ll often use the PIMPL Idiom for a full compilation firewall.

The trade-offs I see with putting them in the headers are:

Less typing
Easier inlining for the compiler (although compilers can sometimes do inlining between multiple translation units now anyway.)
More compilation dependencies

share|improve this answer

edited May 23 ’17 at 11:55

Community♦

111 silver badge

answered Jan 24 ’09 at 18:39

EclipseEclipse

41.4k1717 gold badges104104 silver badges162162 bronze badges

add a comment
 | 

8

I would say that header files should be about interface, not implementation. I’d put them in the .cpp.

share|improve this answer

answered Jan 24 ’09 at 18:42

duffymoduffymo

283k3838 gold badges332332 silver badges523523 bronze badges

add a comment
 | 

4

For me this depends on what I’m doing with the code. For code that I want maintained and to last over time, I put everything in the .cc file for the following reasons:

The .h file can remain sparse as documentation for people who want to look for function and method definitions.
My group’s coding guidelines state that we put everything in the .cpp file and like to follow those, even if the function definition only takes one line. This eliminates guessing games about where things actually live, because you know which file you should examine.
If you’re doing frequent recompiles of a big project, keeping the function definition in the .cpp file saves you some time compared to keeping function definitions in header files. This was relevant very recently for us, as we recently went through the code and added a lot of runtime assert statements to validate input data for our classes, and that required a lot of modification to getters and setters. If these method declarations had lived in .cpp files, this would have turned into a clean recompile for us, which can take ~30min on my laptop.

That’s not to say that I don’t play fast-and-dirty with the rules occasionally and put things in .h files when implementing something really fast, but for code I’m serious about I all code (regardless of length) in the .cpp file. For big projects (some of) the rules are there for a reason, and following them can be a virtue.

Speaking of which, I just thought of yet another Perl script I can hack together to find violations of the coding guidelines. It’s good to be popular. 🙂

share|improve this answer

answered Jan 25 ’09 at 7:29

James ThompsonJames Thompson

39.9k1717 gold badges6060 silver badges8080 bronze badges

In your first point, I think you meant declaration instead of definition.

– Étienne
Jun 11 ’14 at 15:35

add a comment
 | 

2

I put put all single-liners in the header as long as they do not require too much additional headers included (because calling methods of other classes).
Also I do not try to put all code in one line so I can put most of the methods in the header 🙂

But Josh mentioned a good reason to put them in the .cpp anyway: if the header is for external use.

share|improve this answer

edited Jan 24 ’09 at 19:30

answered Jan 24 ’09 at 18:49

mmmmmmmmmmmmmmmm

13k22 gold badges2626 silver badges5252 bronze badges

add a comment
 | 

2

I prefer to keep the .h file as clean as possible. Therefore, small functions that are as simple as get/set I often use to put in a separate file as inline-defined functions, and then include that file (where I use the extension .inl) into the .h header file:

// foo.h

class foo
{
public:
int bar() const;

private:
int m_bar;
};

#include “foo.inl”

// foo.inl

inline
int foo::bar() const
{
return m_bar;
}

I think that this gives the best of two worlds, at the same time hiding most of the implementation from the header, and still keep the advantage of inlining simple code (as a rule of thumb I keep it within at most 3 statements).

share|improve this answer

answered Jan 24 ’09 at 21:51

Stefan RådströmStefan Rådström

75544 silver badges77 bronze badges

“Hiding from goto-zealots” is more like it. In my limited experience, there can be LOTS of those bar() { return m_bar; } “getters”, so you are adding clutter to no benefit. A member-ref is VERY different in performance from any kind of actual calculation, do you want to hide that really ?

– pngaz
Jan 25 ’09 at 8:27

add a comment
 | 

1

I pretty much always follow the division of declaring them in the header, and defining in the source. Every time I don’t, I end up having to go back and do it any way later.

share|improve this answer

answered Jan 24 ’09 at 18:44

AdamAdam

22.6k2121 gold badges7070 silver badges8787 bronze badges

add a comment
 | 

1

I prefer to put them into the .cpp file, for the sake of fast compile/link times. Even tiny one-liners (empty virtual destructors!) can blow up your compile times, if they are instantiated a lot. In one project, I could cut the compile time by a few seconds by moving all virtual destructors into the .cpp files.

Since then, I’m sold on this, and I would only put them into the header again if a profiler tells me that I can profit from inlining. Only downside is you need more typing, but if you create the .cpp file while you write the header, you can often just copy&paste the declarations and fill them out in the .cpp file, so it’s not that bad. Worse of course if you later find out you want to move stuff into a .cpp file.

A nice side effect is that reading stuff is simpler when you have only documentation and declarations in your header, especially if new developers join the project.

share|improve this answer

answered Jan 24 ’09 at 19:43

AnteruAnteru

17.7k99 gold badges6666 silver badges112112 bronze badges

add a comment
 | 

0

I use next rule: header for declaration, code file for realization. It becomes for actual when your header would be use outside of project – than more lightweight your header is, then it’s more comfort in use

share|improve this answer

answered Jan 24 ’09 at 20:44

abatishchevabatishchev

86.9k7070 gold badges272272 silver badges410410 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++ coding-style 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

130

Why should the “PIMPL” idiom be used?

Related

3183What are the differences between a pointer variable and a reference variable in C++?258Forward declaring an enum in C++924Why can’t variables be declared in a switch statement?504Storing C++ template function definitions in a .CPP file791How do you declare an interface in C++?4245The Definitive C++ Book Guide and List186C++ code in header files172Internal typedefs in C++ – good style or bad style?1848C++11 introduced a standardized memory model. What does it mean? And how is it going to affect C++ programming?

Hot Network Questions

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

How did the Kohanim eat in the Azara?

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

Ways to append text to a file

Can Harry Potter swim?

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

WebService to calculate transaction statistics

How do I connect vertices to edges?

How do Aarakocra fly with a backpack?

Fastest yes in the west

Apocryphal (?) tale of hard drive platter being thrown through a wall?

Snapping an Extrusion

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

Find the largest recurring prime

What are the most powerful airplanes that ever flew?

Trumpet type or technique?

What is an internal exon?

Are readied items/abilities expended or lost when the Ready action’s trigger is not met?

My approach to sorting algorithm

When should a company hire developers versus outsourcing them?

Why does my cloth simulation fall even though it shouldn’t?

Pulling back a functor, it becomes monadic

Drawing one-liner

I need to examine an 82.7G (!) text file. What can open it?

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-cpp

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