PostId int64 13 11.8M | PostCreationDate stringlengths 19 19 | OwnerUserId int64 3 1.57M | OwnerCreationDate stringlengths 10 19 | ReputationAtPostCreation int64 -33 210k | OwnerUndeletedAnswerCountAtPostTime int64 0 5.77k | Title stringlengths 10 250 | BodyMarkdown stringlengths 12 30k | Tag1 stringlengths 1 25 ⌀ | Tag2 stringlengths 1 25 ⌀ | Tag3 stringlengths 1 25 ⌀ | Tag4 stringlengths 1 25 ⌀ | Tag5 stringlengths 1 25 ⌀ | PostClosedDate stringlengths 19 19 ⌀ | OpenStatus stringclasses 5 values | unified_texts stringlengths 47 30.1k | OpenStatus_id int64 0 4 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5,540,820 | 04/04/2011 15:33:42 | 376,434 | 06/25/2010 15:46:25 | 53 | 0 | SSL on Tomcat 6.0 | I've been trying all day to set Tomcat 6.0 up for SSL. I know it shouldn't be that hard. I've followed the Tomcat documentation in creating my own Certificate, configuring the connectors in the server.xml file.
When I go to https://localhost:8443, (8443 is the port I defined in the connector) my certificate does not render on the screen, and my browser tells me that it was unable to make a secure connection to the server and that my client may not have the certificate.
My question is, why isn't my certificate rendering for the user to say "Trust" or "Not"? | java | tomcat | ssl | https | null | null | open | SSL on Tomcat 6.0
===
I've been trying all day to set Tomcat 6.0 up for SSL. I know it shouldn't be that hard. I've followed the Tomcat documentation in creating my own Certificate, configuring the connectors in the server.xml file.
When I go to https://localhost:8443, (8443 is the port I defined in the connector) my certificate does not render on the screen, and my browser tells me that it was unable to make a secure connection to the server and that my client may not have the certificate.
My question is, why isn't my certificate rendering for the user to say "Trust" or "Not"? | 0 |
5,166,678 | 03/02/2011 11:13:40 | 103,074 | 05/07/2009 18:26:02 | 51 | 3 | get facebook comment count with jquery | How would I use jQuery to get the comment count of a specific url, The url has comments added with facebook comments box
Also is there an option to get a combined comment count of all urls that start with the same domain? | jquery | facebook | facebook-fql | null | null | null | open | get facebook comment count with jquery
===
How would I use jQuery to get the comment count of a specific url, The url has comments added with facebook comments box
Also is there an option to get a combined comment count of all urls that start with the same domain? | 0 |
11,353,388 | 07/05/2012 22:27:41 | 1,505,301 | 07/05/2012 22:07:37 | 1 | 0 | Issues with System.in being a URL | I'm having an issue with BufferedReader reading System.in, getting a URL, and then using imageIO to get the image from that URL and displaying it in a new JFrame. Any help or advice would be deeply appreciated.
Here is the current snippet, but it wont work:
public static void main(String[] args) {
try {
Image image = null;
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
String rd, url = "";
while((rd = read.readLine()) != null) {
if(rd.contains("http://"))
url = rd;
else
System.err.println("Input must be a URL!");
}
image = ImageIO.read(url);
} catch (IOException e) {
e.printStackTrace();
System.err.println("Error displaying Image.");
System.exit(0);
}
JFrame frame = new JFrame();
frame.setSize(image.getWidth(null), image.getHeight(null));
JLabel label = new JLabel(new ImageIcon(image));
frame.add(label);
frame.setVisible(true);
} | java | url | bufferedreader | system.in | null | 07/13/2012 19:01:56 | not a real question | Issues with System.in being a URL
===
I'm having an issue with BufferedReader reading System.in, getting a URL, and then using imageIO to get the image from that URL and displaying it in a new JFrame. Any help or advice would be deeply appreciated.
Here is the current snippet, but it wont work:
public static void main(String[] args) {
try {
Image image = null;
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));
String rd, url = "";
while((rd = read.readLine()) != null) {
if(rd.contains("http://"))
url = rd;
else
System.err.println("Input must be a URL!");
}
image = ImageIO.read(url);
} catch (IOException e) {
e.printStackTrace();
System.err.println("Error displaying Image.");
System.exit(0);
}
JFrame frame = new JFrame();
frame.setSize(image.getWidth(null), image.getHeight(null));
JLabel label = new JLabel(new ImageIcon(image));
frame.add(label);
frame.setVisible(true);
} | 1 |
4,878,230 | 02/02/2011 18:18:11 | 365,738 | 06/13/2010 15:09:10 | 1,967 | 139 | public repository with gitolite | I installed an configured gitolite and it works for some other projects I'm working on. However, I want to set up a public repo that anyone call clone from (but not push).
I've searched everywhere and cannot find a way to do this? Has anyone managed to do this with gitoite? | git | ubuntu-10.04 | gitolite | null | null | null | open | public repository with gitolite
===
I installed an configured gitolite and it works for some other projects I'm working on. However, I want to set up a public repo that anyone call clone from (but not push).
I've searched everywhere and cannot find a way to do this? Has anyone managed to do this with gitoite? | 0 |
7,462,299 | 09/18/2011 14:58:44 | 249,695 | 01/13/2010 10:05:10 | 570 | 6 | F# 3.0 Type Providers for science | It seems that F# Type Providers are the leading feature of F# 3.0. My question is simple, what should I use it for? I am scientifically oriented (engineering). The only examples I have seen so far are related to web - is it the only real use of this feature? | f# | computer-science | type-providers | null | null | 09/19/2011 07:15:01 | not constructive | F# 3.0 Type Providers for science
===
It seems that F# Type Providers are the leading feature of F# 3.0. My question is simple, what should I use it for? I am scientifically oriented (engineering). The only examples I have seen so far are related to web - is it the only real use of this feature? | 4 |
10,631,985 | 05/17/2012 08:08:08 | 1,400,424 | 05/17/2012 07:56:49 | 1 | 0 | how determine the writing language in c# win application | <span>**I** am developing a window application and I need to know what language is the current language<br />any help please ...<br />i really need to now that</span> | c# | windows | winforms | null | null | 05/17/2012 08:12:53 | not a real question | how determine the writing language in c# win application
===
<span>**I** am developing a window application and I need to know what language is the current language<br />any help please ...<br />i really need to now that</span> | 1 |
7,409,318 | 09/13/2011 22:27:14 | 943,519 | 09/13/2011 22:27:14 | 1 | 0 | Django - When data from query is actually read | I'm a Django noob so I apologize if this is a stupidly simple question.
Here's the code:
try:
m = Message.objects.get(session=request.session.session_key)
except:
return {'message_status':'','message_text':''}
current_status = m.status
current_text = m.text
m.delete()
I'd expect current_status and current_text to be preserved, but they are not. What's wrong?
Thanks! | django | null | null | null | null | null | open | Django - When data from query is actually read
===
I'm a Django noob so I apologize if this is a stupidly simple question.
Here's the code:
try:
m = Message.objects.get(session=request.session.session_key)
except:
return {'message_status':'','message_text':''}
current_status = m.status
current_text = m.text
m.delete()
I'd expect current_status and current_text to be preserved, but they are not. What's wrong?
Thanks! | 0 |
8,643,061 | 12/27/2011 09:33:52 | 1,117,367 | 12/27/2011 09:15:52 | 1 | 0 | iPhone How to prevent my app from entering background when lock screen? | When press the lock button in app,system will call :
-(void) applicationWillResignActive:(UIApplication *)application and
-(void) applicationDidEnterBackground:(UIApplication *)application
So how can I do to make my app only resignActive but not enter background,and I can run my timer when screen locked(Timer can't execute in background mode).
One method is set the property "Application does not run in background" in .plist to YES,it worked, but my app can never enter background again,however I want it will enter background when press the home button. | iphone | background | null | null | null | null | open | iPhone How to prevent my app from entering background when lock screen?
===
When press the lock button in app,system will call :
-(void) applicationWillResignActive:(UIApplication *)application and
-(void) applicationDidEnterBackground:(UIApplication *)application
So how can I do to make my app only resignActive but not enter background,and I can run my timer when screen locked(Timer can't execute in background mode).
One method is set the property "Application does not run in background" in .plist to YES,it worked, but my app can never enter background again,however I want it will enter background when press the home button. | 0 |
5,715,533 | 04/19/2011 11:20:23 | 626,045 | 01/28/2011 04:18:00 | 1 | 0 | augmentation reality | Can somebody help me in knowing how nyARToolkit is embedded in android app as library as there is no jar file in it.It consist only of java file. I am very confused.Please help me. Thankyou | android | null | null | null | null | 04/20/2011 14:20:21 | too localized | augmentation reality
===
Can somebody help me in knowing how nyARToolkit is embedded in android app as library as there is no jar file in it.It consist only of java file. I am very confused.Please help me. Thankyou | 3 |
11,540,162 | 07/18/2012 11:22:17 | 855,763 | 07/21/2011 11:01:21 | 124 | 1 | real time quotes for stock and currency trading game website? | to be clear i have looked at yahoo and google apis that provide delayed(not in real time) stock quotes for free . I would instead like to find an apior service that provide them in real time (minute to minute or whatever the standards are). I know this wont be for free and i will have to shell out a huge chuck of money for this which i am ready to pay for. THe service should provide quotes of all the major exchanges.
if would be great if you could also provide me with approximate money i will have to shell out for the services you are providing info about and how good is their API.
Lastly if you know any service that provide this kind of functionality for this kind of service(my website) at a low cost that would be icing on the cake.
just so you know i will be using yii framework for developing the website. I know this information is of no use to the initial questions but i just thought off adding it anyway. | api | yii | real-time | stocks | stockquotes | 07/18/2012 21:00:20 | off topic | real time quotes for stock and currency trading game website?
===
to be clear i have looked at yahoo and google apis that provide delayed(not in real time) stock quotes for free . I would instead like to find an apior service that provide them in real time (minute to minute or whatever the standards are). I know this wont be for free and i will have to shell out a huge chuck of money for this which i am ready to pay for. THe service should provide quotes of all the major exchanges.
if would be great if you could also provide me with approximate money i will have to shell out for the services you are providing info about and how good is their API.
Lastly if you know any service that provide this kind of functionality for this kind of service(my website) at a low cost that would be icing on the cake.
just so you know i will be using yii framework for developing the website. I know this information is of no use to the initial questions but i just thought off adding it anyway. | 2 |
10,046,723 | 04/06/2012 17:08:28 | 1,124,056 | 12/31/2011 06:33:32 | 1 | 2 | What are the best free hosting services for wordpress | Whatare the best free hosting services for wordpress ?? | wordpress | domain | hosting | free | null | 04/06/2012 22:08:30 | off topic | What are the best free hosting services for wordpress
===
Whatare the best free hosting services for wordpress ?? | 2 |
7,560,813 | 09/26/2011 20:18:13 | 61,439 | 02/02/2009 09:55:12 | 5,094 | 195 | Why are dashes preferred for CSS selectors / HTML attributes? | In the past I've always used underscores for defining _class_ and _id_ attributes in HTML. Over the last few years I changed over to dashes, mostly to align myself with the [trend in the community][1], not necessarily because it made sense to me.
I've always thought dashes have more drawbacks, and I don't see the benefits:
### Code completion
Most editors treat dashes as word separators, so I can't tab through to the symbol I want. Say the class is "`featured-product`", I have to auto-complete "`featured`", enter a hyphen, and complete "`product`".
With underscores "`featured_product`" is treated as one word, so it can be filled in one step.
(More generally, I think of classes and ids as _tokens_, so it doesn't make sense to me that a token should be so easily splittable on hyphens.)
### Ambiguity with arithmetic operator
Using dashes breaks object-property [access to form elements][2] in JavaScript. This is only possible with underscores:
form.first_name.value='Stormageddon';
(Admittedly I don't access form elements this way myself, but when deciding on dashes vs underscores as a universal rule, consider that someone might.)
Languages like [Sass][3] (especially throughout the [Compass][4] framework) have settled on dashes as a standard, even for variable names. They originally used underscores in the beginning too. The fact that this is parsed differently strikes me as odd:
$list-item-10
$list-item - 10
### Inconsistency with variable naming across languages
Back in the day, I used to write `underscored_names` for variables in PHP, ruby, HTML/CSS, and JavaScript. This was convenient and consistent, but again in order to "fit in" I now use:
* `dash-case` in HTML/CSS
* `camelCase` in JavaScript
* `underscore_case` in PHP and ruby
This doesn't really bother me too much, but I wonder why these became so misaligned, seemingly on purpose. At least with underscores it was possible to maintain consistency:
var featured_product = $('#featured_product'); // instead of
var featuredProduct = $('#featured-product');
The differences create situations where we have to [translate strings][5] unnecessarily, along with the potential for bugs.
So I ask: Why did the community almost universally settle on dashes, and are there any reasons that outweigh underscores?
There is a [related question][6] from back around the time this started, but I'm of the opinion that it's not (or _shouldn't_ have been) just a matter of taste. I'd like to understand why we all settled on this convention if it really was just a matter of taste.
[1]: http://css-tricks.com/5016-new-poll-hyphens-or-dashes/
[2]: http://stackoverflow.com/questions/2119629/javascript-and-css-using-dashes/2119668#2119668
[3]: http://sass-lang.com/
[4]: http://compass-style.org/
[5]: http://stackoverflow.com/questions/7286607/jquery-camel-case-mapping-from-data-attribute-names-to-data-keys
[6]: http://stackoverflow.com/questions/1686337/hyphens-or-underscores-in-css-and-html-identifiers | html | css | coding-style | naming-conventions | null | 09/27/2011 12:55:11 | not constructive | Why are dashes preferred for CSS selectors / HTML attributes?
===
In the past I've always used underscores for defining _class_ and _id_ attributes in HTML. Over the last few years I changed over to dashes, mostly to align myself with the [trend in the community][1], not necessarily because it made sense to me.
I've always thought dashes have more drawbacks, and I don't see the benefits:
### Code completion
Most editors treat dashes as word separators, so I can't tab through to the symbol I want. Say the class is "`featured-product`", I have to auto-complete "`featured`", enter a hyphen, and complete "`product`".
With underscores "`featured_product`" is treated as one word, so it can be filled in one step.
(More generally, I think of classes and ids as _tokens_, so it doesn't make sense to me that a token should be so easily splittable on hyphens.)
### Ambiguity with arithmetic operator
Using dashes breaks object-property [access to form elements][2] in JavaScript. This is only possible with underscores:
form.first_name.value='Stormageddon';
(Admittedly I don't access form elements this way myself, but when deciding on dashes vs underscores as a universal rule, consider that someone might.)
Languages like [Sass][3] (especially throughout the [Compass][4] framework) have settled on dashes as a standard, even for variable names. They originally used underscores in the beginning too. The fact that this is parsed differently strikes me as odd:
$list-item-10
$list-item - 10
### Inconsistency with variable naming across languages
Back in the day, I used to write `underscored_names` for variables in PHP, ruby, HTML/CSS, and JavaScript. This was convenient and consistent, but again in order to "fit in" I now use:
* `dash-case` in HTML/CSS
* `camelCase` in JavaScript
* `underscore_case` in PHP and ruby
This doesn't really bother me too much, but I wonder why these became so misaligned, seemingly on purpose. At least with underscores it was possible to maintain consistency:
var featured_product = $('#featured_product'); // instead of
var featuredProduct = $('#featured-product');
The differences create situations where we have to [translate strings][5] unnecessarily, along with the potential for bugs.
So I ask: Why did the community almost universally settle on dashes, and are there any reasons that outweigh underscores?
There is a [related question][6] from back around the time this started, but I'm of the opinion that it's not (or _shouldn't_ have been) just a matter of taste. I'd like to understand why we all settled on this convention if it really was just a matter of taste.
[1]: http://css-tricks.com/5016-new-poll-hyphens-or-dashes/
[2]: http://stackoverflow.com/questions/2119629/javascript-and-css-using-dashes/2119668#2119668
[3]: http://sass-lang.com/
[4]: http://compass-style.org/
[5]: http://stackoverflow.com/questions/7286607/jquery-camel-case-mapping-from-data-attribute-names-to-data-keys
[6]: http://stackoverflow.com/questions/1686337/hyphens-or-underscores-in-css-and-html-identifiers | 4 |
11,433,013 | 07/11/2012 12:48:37 | 1,500,789 | 07/04/2012 07:13:15 | 26 | 0 | How to publish image folder from content manager using C# TBB? | I want to move all my images from one of the folder in content manager to one of the folder on the server, how to do it using C# TBB?
| tridion | null | null | null | null | 07/11/2012 17:40:37 | not a real question | How to publish image folder from content manager using C# TBB?
===
I want to move all my images from one of the folder in content manager to one of the folder on the server, how to do it using C# TBB?
| 1 |
5,202,013 | 03/05/2011 05:54:02 | 612,996 | 02/11/2011 11:57:28 | 1 | 0 | download image from webpage, without showing webpage to user? | is there any method to download image from webpage, without showing webpage to user?
one can do this through 'web service'. Is there any other??
| iphone | null | null | null | null | null | open | download image from webpage, without showing webpage to user?
===
is there any method to download image from webpage, without showing webpage to user?
one can do this through 'web service'. Is there any other??
| 0 |
10,070,443 | 04/09/2012 07:53:44 | 984,735 | 10/07/2011 21:18:59 | 46 | 0 | Row wise operations in octave |
Is there a way to perform row wise operations on matrices in octave ?
I have a `(mXn)` matrix of integers, can i obtain a `m dimensional` vector where each element is the maximum element of the corresponding row ? How can i do this in octave ?
| r | matlab | octave | null | null | null | open | Row wise operations in octave
===
Is there a way to perform row wise operations on matrices in octave ?
I have a `(mXn)` matrix of integers, can i obtain a `m dimensional` vector where each element is the maximum element of the corresponding row ? How can i do this in octave ?
| 0 |
10,200,876 | 04/17/2012 23:57:11 | 1,339,929 | 04/17/2012 22:38:48 | 1 | 0 | Facebook Debugger Tool Showing og:type: profile instead of og:type: musician |
We have used the Open Graph tags to classify people.
For example, Elvis is of course a musician:
http://www.famousbirthdays.com/people/elvis-presley.html
<meta property="og:type" content="musician"/>
However, when I run the Facebook object debugger - here is what it says under type
og:type: profile
any reason why it is saying profile as opposed to musician under the type on the object debugger?
| facebook | opengraph | facebook-opengraph | null | null | null | open | Facebook Debugger Tool Showing og:type: profile instead of og:type: musician
===
We have used the Open Graph tags to classify people.
For example, Elvis is of course a musician:
http://www.famousbirthdays.com/people/elvis-presley.html
<meta property="og:type" content="musician"/>
However, when I run the Facebook object debugger - here is what it says under type
og:type: profile
any reason why it is saying profile as opposed to musician under the type on the object debugger?
| 0 |
6,908,190 | 08/02/2011 06:40:43 | 522,385 | 11/27/2010 16:47:09 | 121 | 2 | EnumType foo: How do I write foo.changeme()? | Here's what I've written:
public class JavaApplication4 {
private RunMode runMode;
private enum RunMode {
STOP, START, SCE, SIE;
void reset() {
this = STOP; // <=== 'cannot assign a value to final variable this.'
}
}
}
As noted, the assignment to 'this' is flagged. Why is 'this' final, and how can I change the value of an enum variable with an enum instance method? | java | methods | enums | instance | null | null | open | EnumType foo: How do I write foo.changeme()?
===
Here's what I've written:
public class JavaApplication4 {
private RunMode runMode;
private enum RunMode {
STOP, START, SCE, SIE;
void reset() {
this = STOP; // <=== 'cannot assign a value to final variable this.'
}
}
}
As noted, the assignment to 'this' is flagged. Why is 'this' final, and how can I change the value of an enum variable with an enum instance method? | 0 |
11,083,647 | 06/18/2012 13:11:46 | 164,148 | 08/27/2009 11:33:59 | 1,751 | 37 | Explain DOM 11 error in the initialization of XMLHttpRequest with JSON -headers | I am getting this error as part of this larger puzzle [here](http://stackoverflow.com/a/11083010/164148).
var xhr = new XMLHttpRequest();
xhr.setRequestHeader( 'Content-Type', 'application/json' );
//Error: INVALID_STATE_ERR: DOM Exception 11
**For further research**
> 0. O'Reilly's book "Definite Guide to Javascript 6th Edition" on page 491 in chapter 18 "Scripted HTTP" discussed XMLHttpRequest, please,
> note that it is not only about HTTP or XML (historical relics).
>
> 1. Mozilla's dev entry about XMLHttpREquest [here](https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest)
| javascript | json | dom | xmlhttprequest | null | null | open | Explain DOM 11 error in the initialization of XMLHttpRequest with JSON -headers
===
I am getting this error as part of this larger puzzle [here](http://stackoverflow.com/a/11083010/164148).
var xhr = new XMLHttpRequest();
xhr.setRequestHeader( 'Content-Type', 'application/json' );
//Error: INVALID_STATE_ERR: DOM Exception 11
**For further research**
> 0. O'Reilly's book "Definite Guide to Javascript 6th Edition" on page 491 in chapter 18 "Scripted HTTP" discussed XMLHttpRequest, please,
> note that it is not only about HTTP or XML (historical relics).
>
> 1. Mozilla's dev entry about XMLHttpREquest [here](https://developer.mozilla.org/En/XMLHttpRequest/Using_XMLHttpRequest)
| 0 |
3,235,850 | 07/13/2010 09:36:16 | 83,004 | 03/26/2009 09:06:48 | 96 | 6 | How to enter a multi-line command | Is it possible to split a Powershell command line over multiple lines? In Visual Basic I can use the underscore "_" to continue the command in the next line. | powershell | multiline | null | null | null | null | open | How to enter a multi-line command
===
Is it possible to split a Powershell command line over multiple lines? In Visual Basic I can use the underscore "_" to continue the command in the next line. | 0 |
8,666,068 | 12/29/2011 09:35:23 | 504,037 | 11/11/2010 03:39:54 | 7 | 0 | Procedure of C++ Call Back function in .net projects | How will i Call a Call Back Function of VC++ in my .net project . | c# | null | null | null | null | 12/29/2011 17:44:41 | not a real question | Procedure of C++ Call Back function in .net projects
===
How will i Call a Call Back Function of VC++ in my .net project . | 1 |
7,054,565 | 08/14/2011 02:16:32 | 893,532 | 08/14/2011 01:26:42 | 3 | 1 | contravariance explanation is needed | By definition, contravariance is the opposite of covariance, however because I am so really new to C#, I am unable to actually understand the difference much in details. Could someone offer an indepth explanation over contravariance with examples ? I am thankful for your help. | c# | .net | null | null | null | 08/14/2011 02:47:23 | not constructive | contravariance explanation is needed
===
By definition, contravariance is the opposite of covariance, however because I am so really new to C#, I am unable to actually understand the difference much in details. Could someone offer an indepth explanation over contravariance with examples ? I am thankful for your help. | 4 |
305,046 | 11/20/2008 11:49:25 | 18,670 | 09/19/2008 08:58:53 | 38 | 2 | Current "hot" topics in parallel programming? | I hope this is the right place to ask[1], but I've read a lot of good comments on other topics here so I'll just ask. At the moment I'm searching for a topic for my dissertation (Ph.d in non-german countries I think), which must have to do something with parallelism or concurrency, etc. but otherwise I'm quite free to chose what I'm interested in. Also Everything with GPU's is not reasonable, because a colleague of me does already research on this topic and we'd like to have something else for me :)
So, the magic questions is: What would you say are interesting topics in this area? Personally I'm interested in parallel functional programming languages and virtual machines in general but I'd say that a lot of work has been already done there or is actively researched (e.g. in the Haskell community).
I'd greatly appreciate any help in pointing me to other interesting topics.
Best regards,
Michael
PS: I've already looked at http://stackoverflow.com/questions/212253/what-are-the-developments-going-on-in-all-languages-in-parallel-programming-area but there weren't a lot of answers.
[1] I've already asked at http://lambda-the-ultimate.org but the response was unfortunately not as much as expected. | parallel-processing | research | phd | null | null | 02/12/2012 01:11:12 | not constructive | Current "hot" topics in parallel programming?
===
I hope this is the right place to ask[1], but I've read a lot of good comments on other topics here so I'll just ask. At the moment I'm searching for a topic for my dissertation (Ph.d in non-german countries I think), which must have to do something with parallelism or concurrency, etc. but otherwise I'm quite free to chose what I'm interested in. Also Everything with GPU's is not reasonable, because a colleague of me does already research on this topic and we'd like to have something else for me :)
So, the magic questions is: What would you say are interesting topics in this area? Personally I'm interested in parallel functional programming languages and virtual machines in general but I'd say that a lot of work has been already done there or is actively researched (e.g. in the Haskell community).
I'd greatly appreciate any help in pointing me to other interesting topics.
Best regards,
Michael
PS: I've already looked at http://stackoverflow.com/questions/212253/what-are-the-developments-going-on-in-all-languages-in-parallel-programming-area but there weren't a lot of answers.
[1] I've already asked at http://lambda-the-ultimate.org but the response was unfortunately not as much as expected. | 4 |
40,602 | 09/02/2008 20:44:35 | 1,583 | 08/16/2008 20:54:12 | 18 | 4 | What kind of problems are state machines good for? | What kind of programming problems are state machines most suited for?
I have read about parsers being implemented using state machines, but would like to find out about problems that scream out to be implemented as a state machine. | algorithm | design | state | null | null | 07/03/2012 12:39:04 | not constructive | What kind of problems are state machines good for?
===
What kind of programming problems are state machines most suited for?
I have read about parsers being implemented using state machines, but would like to find out about problems that scream out to be implemented as a state machine. | 4 |
9,268,047 | 02/13/2012 21:08:24 | 702,693 | 04/11/2011 18:15:17 | 9 | 0 | Googleupdate.exe /c parameter is used for? | I recently installed google chrome v. 17, and among programs loaded when the system start I found the file below:
> C:\Users\Admin\AppData\Local\Google\Update\GoogleUpdate.exe" /c
This file would serve to check updates for google chrome, **but `/c` parameter is used for?** | google-chrome | null | null | null | null | 02/15/2012 07:24:25 | off topic | Googleupdate.exe /c parameter is used for?
===
I recently installed google chrome v. 17, and among programs loaded when the system start I found the file below:
> C:\Users\Admin\AppData\Local\Google\Update\GoogleUpdate.exe" /c
This file would serve to check updates for google chrome, **but `/c` parameter is used for?** | 2 |
9,423,504 | 02/24/2012 00:12:24 | 1,229,614 | 02/23/2012 23:42:51 | 1 | 0 | Plugin for Open Cart to Calculate Price based on size | OpenCart does not currently give us the ability for customers to get custom prices based on size and type of material. my Clients website sells printing and canvasitems, and many of these items can be custom sizes and the price changes based on the size. Customers to be able to enter all the specific details of their item and receive a price.
Is there a plugin for this?
I need it to be able to calculate a price based on the height and width entered like the website below
http://gemelart.com.au/Gemel-Custom-Canvas.html
Many thanks,
Deryn | opencart | null | null | null | null | 02/28/2012 14:12:32 | not constructive | Plugin for Open Cart to Calculate Price based on size
===
OpenCart does not currently give us the ability for customers to get custom prices based on size and type of material. my Clients website sells printing and canvasitems, and many of these items can be custom sizes and the price changes based on the size. Customers to be able to enter all the specific details of their item and receive a price.
Is there a plugin for this?
I need it to be able to calculate a price based on the height and width entered like the website below
http://gemelart.com.au/Gemel-Custom-Canvas.html
Many thanks,
Deryn | 4 |
9,930,036 | 03/29/2012 17:03:02 | 556,131 | 12/28/2010 15:48:06 | 358 | 6 | Paying for commercial database systems versus maintaining an open source system | I'm trying to figure out if buying a commercial database system will end up saving more money than going for an open source variant.
**Note!!!** I know this is a sensitive question and one could take it as a rant at the commercial systems (Oracle, MS-SQL Server, etc.). I'm not trying to question the quality of such systems, I'm just trying to make the most financial viable decision.
**Second note!!!** I also admit that the answer to this questions can depend a lot on the type of data I'm trying to store. For the integrity of the discussion, let's assume that the volumes of data can get pretty high (meaning more than 1 physical machine to store everything), consistency is not a critical issue (it's not a bank), security can be a big issue (simply loosing the data would not be that bad, but loosing data to hackers or some form of attackers could be catastrophic).
**Third note!!!** To further aid in the integrity of the discussion, assume that when I'm mentioning commercial systems I'm mainly reffering to Microsoft SQL Server or Oracle and when I'm saying open-source I'm reffering to MySQL or Postgre, although the potential options are not limited to these particular systems.
The aspects I want to find more information about are:
**Actual costs (taking scalability into consideration)**
As far as I can tell, commercial systems have a per hardware-piece(for e.g. per processor) and/or per user price model. This means that in order to scale up (adding more hardware) one has to buy more licenses. Is it worth it? Are the commercial systems scaling up seamelessly such that such costs are well motivated? Are the open-source systems harder to scale up (e.g. do I have to pay extra database engineers just to help maintain more physical servers?)
**Speed**
Are the commercial software systems better in this area? Are the reads/ writes/ updates faster? If I were to use a DBMS inside a speed critical application, what would make a more cost-effective choice?
**Load-performance**
Do the commercial systems function better under heavy load? E.g. will I end up saving money by buying less hardware to sustain more load?
**Ease of use and deployment**
Do I have to pay my database administrators more if going for open-source? Are the administration and or deployment tools in commercial systems easier to use (e.g. Will it lead to using less or less skillfull/costly db-admins)?
**Support level**
Is the support available for commercial systems better? Is it more cost effective? E.g. is paying annual support to the companies producing the commercial software more cost effective than hiring a dedicated employee to tackle the not-so-good support of open source variants? Is the not-so-good support level good enough (quality of manuals, tutorials, blog posts, etc.)?
**Security**
Are commercial systems more secure? Are they harder to crack? Is open-sourceness a vulnerability (e.g. everybody can see the code, thus everybody can exploit potential security vulnerabilities easier)? Is receiving security updates more costly?
**Update costs**
Is updating and eventually migrating data to newer versions easier in commercial software? Must I pay for new versions? Must I pay a lot (e.g. do companies provide some sort of special upgrade prices to new versions)?
**Personnele**
Are the people that maintain and/or use commercial systems easier to find or cheaper to employ? Does maintaining open-source db-system require more people or people that cost more?
**Interaction with programming languages and frameworks**
Are the drivers for communicating with commercial systems cheap? Are they free? Are they easier to use? Do they limit my technology choice? (e.g. can I access the data using any kind of programming language or do I have to use a certain technology - I can think that using Microsoft SQL Server is easier to do through the .NET Framework which implies costs for the operating system Windows and for the IDE - Visual Studio... sure I could access SQL Server through Python for e.g. but then I have to get Python programmers that I think cost way more than the average .NET programmer).
I'm sure that there can be other aspects that I've forgotten to take into account. Remember, I'm trying to make the most cost effective choice possible, I don't really care about coolness, publicity, branding, perceived quality etc. so please try to keep the answers in a financial direction.
Thank you | database | open-source | project-management | cost | null | 03/29/2012 18:17:22 | not constructive | Paying for commercial database systems versus maintaining an open source system
===
I'm trying to figure out if buying a commercial database system will end up saving more money than going for an open source variant.
**Note!!!** I know this is a sensitive question and one could take it as a rant at the commercial systems (Oracle, MS-SQL Server, etc.). I'm not trying to question the quality of such systems, I'm just trying to make the most financial viable decision.
**Second note!!!** I also admit that the answer to this questions can depend a lot on the type of data I'm trying to store. For the integrity of the discussion, let's assume that the volumes of data can get pretty high (meaning more than 1 physical machine to store everything), consistency is not a critical issue (it's not a bank), security can be a big issue (simply loosing the data would not be that bad, but loosing data to hackers or some form of attackers could be catastrophic).
**Third note!!!** To further aid in the integrity of the discussion, assume that when I'm mentioning commercial systems I'm mainly reffering to Microsoft SQL Server or Oracle and when I'm saying open-source I'm reffering to MySQL or Postgre, although the potential options are not limited to these particular systems.
The aspects I want to find more information about are:
**Actual costs (taking scalability into consideration)**
As far as I can tell, commercial systems have a per hardware-piece(for e.g. per processor) and/or per user price model. This means that in order to scale up (adding more hardware) one has to buy more licenses. Is it worth it? Are the commercial systems scaling up seamelessly such that such costs are well motivated? Are the open-source systems harder to scale up (e.g. do I have to pay extra database engineers just to help maintain more physical servers?)
**Speed**
Are the commercial software systems better in this area? Are the reads/ writes/ updates faster? If I were to use a DBMS inside a speed critical application, what would make a more cost-effective choice?
**Load-performance**
Do the commercial systems function better under heavy load? E.g. will I end up saving money by buying less hardware to sustain more load?
**Ease of use and deployment**
Do I have to pay my database administrators more if going for open-source? Are the administration and or deployment tools in commercial systems easier to use (e.g. Will it lead to using less or less skillfull/costly db-admins)?
**Support level**
Is the support available for commercial systems better? Is it more cost effective? E.g. is paying annual support to the companies producing the commercial software more cost effective than hiring a dedicated employee to tackle the not-so-good support of open source variants? Is the not-so-good support level good enough (quality of manuals, tutorials, blog posts, etc.)?
**Security**
Are commercial systems more secure? Are they harder to crack? Is open-sourceness a vulnerability (e.g. everybody can see the code, thus everybody can exploit potential security vulnerabilities easier)? Is receiving security updates more costly?
**Update costs**
Is updating and eventually migrating data to newer versions easier in commercial software? Must I pay for new versions? Must I pay a lot (e.g. do companies provide some sort of special upgrade prices to new versions)?
**Personnele**
Are the people that maintain and/or use commercial systems easier to find or cheaper to employ? Does maintaining open-source db-system require more people or people that cost more?
**Interaction with programming languages and frameworks**
Are the drivers for communicating with commercial systems cheap? Are they free? Are they easier to use? Do they limit my technology choice? (e.g. can I access the data using any kind of programming language or do I have to use a certain technology - I can think that using Microsoft SQL Server is easier to do through the .NET Framework which implies costs for the operating system Windows and for the IDE - Visual Studio... sure I could access SQL Server through Python for e.g. but then I have to get Python programmers that I think cost way more than the average .NET programmer).
I'm sure that there can be other aspects that I've forgotten to take into account. Remember, I'm trying to make the most cost effective choice possible, I don't really care about coolness, publicity, branding, perceived quality etc. so please try to keep the answers in a financial direction.
Thank you | 4 |
4,067,903 | 11/01/2010 09:56:44 | 109,450 | 05/19/2009 15:47:13 | 1 | 0 | sitemap.xml in robots.txt | ...
Allow: /sitemap.xml
Sitemap: http://abc.com/sitemap.xml
...
can robots scratch the sitemap.xml file for the | sitemap | robots.txt | robots | null | null | 05/21/2012 16:18:58 | not a real question | sitemap.xml in robots.txt
===
...
Allow: /sitemap.xml
Sitemap: http://abc.com/sitemap.xml
...
can robots scratch the sitemap.xml file for the | 1 |
2,907,643 | 05/25/2010 19:01:18 | 324,007 | 04/23/2010 08:46:15 | 75 | 3 | Rails application settings? | I am working on a Rails application that has user authentication which provides an administrators account. Within the administrators account I have made a page for sitewide settings.
I was wondering what the norm is for creating these settings. Say for example I would like one of the settings to be to change the name of the application name, or change a colour of the header.
What I am looking for is for someone to explain the basic process/method - not necessarily specific code - although that would be great!
Thanks,
Danny | ruby-on-rails | authentication | settings | administration | null | null | open | Rails application settings?
===
I am working on a Rails application that has user authentication which provides an administrators account. Within the administrators account I have made a page for sitewide settings.
I was wondering what the norm is for creating these settings. Say for example I would like one of the settings to be to change the name of the application name, or change a colour of the header.
What I am looking for is for someone to explain the basic process/method - not necessarily specific code - although that would be great!
Thanks,
Danny | 0 |
3,294,809 | 07/20/2010 22:10:01 | 280,043 | 02/24/2010 04:36:55 | 21 | 3 | Special case of updating a column with not null and unique constraints in PostgreSQL | This is a toy example that illustrates a real problem in PostgreSQL. The below examples are using a PostgreSQL 8.4.3 server, but I suspect other versions have the same problem.
Given the following table:
<pre>
=> create table tmp_foo (foo boolean not null unique, bar boolean not null unique);
=> insert into tmp_foo (foo, bar) values (true, true), (false, false);
=> select * from tmp_foo;
foo | bar
-----+-----
t | t
f | f
</pre>
can the table be modified to look like this:
<pre>
=> select * from tmp_foo;
foo | bar
-----+-----
t | f
f | t
</pre>
without deleting rows or modifying the table schema? This:
<pre>
=> update tmp_foo set bar = not bar;
ERROR: duplicate key value violates unique constraint "tmp_foo_bar_key"
</pre>
does not work.
If deletes are allowed, this:
<pre>
=> create temp table tmp_foo_2 as select * from tmp_foo;
=> update tmp_foo_2 set bar = not bar;
=> delete from tmp_foo;
=> insert into tmp_foo select * from tmp_foo_2;
</pre>
works. It is not the simplest solution for this example, but it is easily generalizable to more complex examples. | sql | postgresql | constraints | unique-constraint | null | null | open | Special case of updating a column with not null and unique constraints in PostgreSQL
===
This is a toy example that illustrates a real problem in PostgreSQL. The below examples are using a PostgreSQL 8.4.3 server, but I suspect other versions have the same problem.
Given the following table:
<pre>
=> create table tmp_foo (foo boolean not null unique, bar boolean not null unique);
=> insert into tmp_foo (foo, bar) values (true, true), (false, false);
=> select * from tmp_foo;
foo | bar
-----+-----
t | t
f | f
</pre>
can the table be modified to look like this:
<pre>
=> select * from tmp_foo;
foo | bar
-----+-----
t | f
f | t
</pre>
without deleting rows or modifying the table schema? This:
<pre>
=> update tmp_foo set bar = not bar;
ERROR: duplicate key value violates unique constraint "tmp_foo_bar_key"
</pre>
does not work.
If deletes are allowed, this:
<pre>
=> create temp table tmp_foo_2 as select * from tmp_foo;
=> update tmp_foo_2 set bar = not bar;
=> delete from tmp_foo;
=> insert into tmp_foo select * from tmp_foo_2;
</pre>
works. It is not the simplest solution for this example, but it is easily generalizable to more complex examples. | 0 |
4,773,424 | 01/23/2011 10:49:22 | 486,554 | 10/25/2010 14:35:57 | 63 | 1 | how to create one simple android game? | hi how to create one game in android application i am very new android any one tell me basic things....simple android game now i am using android 2.2 version | java | android | null | null | null | 01/23/2011 11:16:09 | not a real question | how to create one simple android game?
===
hi how to create one game in android application i am very new android any one tell me basic things....simple android game now i am using android 2.2 version | 1 |
4,703,323 | 01/16/2011 01:49:53 | 577,188 | 01/16/2011 01:29:07 | 1 | 0 | Need explaination of a php code snippet | I have code that transloads files to your server. I tried reading this code but was unable to understand. Can any PHP Guru spend some time to understand this code and comment it. Please I need to understand this code to modify this.
Modification required is:
at the moment it transloads files from direct links that ends up with file extension. like.
www.mysite.com?file.zip
but it wont work for download links like
www.mysite.com?download.php?fileid=3
I want it to work for all direct links.
Code is downloadable from box.net from following url as well,
http://www.box.net/shared/no21luo2m2 This url is itself eample of url for which I want this script to work.
regards,
aqif | php | null | null | null | null | 01/16/2011 02:03:00 | not a real question | Need explaination of a php code snippet
===
I have code that transloads files to your server. I tried reading this code but was unable to understand. Can any PHP Guru spend some time to understand this code and comment it. Please I need to understand this code to modify this.
Modification required is:
at the moment it transloads files from direct links that ends up with file extension. like.
www.mysite.com?file.zip
but it wont work for download links like
www.mysite.com?download.php?fileid=3
I want it to work for all direct links.
Code is downloadable from box.net from following url as well,
http://www.box.net/shared/no21luo2m2 This url is itself eample of url for which I want this script to work.
regards,
aqif | 1 |
5,610,244 | 04/10/2011 06:55:54 | 699,656 | 04/09/2011 05:09:04 | 20 | 3 | What is the really critical difference between FreeBSD and Linux? | [freebsd for linux user][1]
[1]: http://onlamp.com/pub/a/bsd/2004/11/11/FreeBSD_Basics.html
I did my search. I got this article from a link in FreeBSD Forum. But I hardly think this article give any rally useful information about the difference.
COuld anybody show me some better articles or share your opinons about this?
thank u! | linux | freebsd | null | null | null | 04/10/2011 07:04:36 | off topic | What is the really critical difference between FreeBSD and Linux?
===
[freebsd for linux user][1]
[1]: http://onlamp.com/pub/a/bsd/2004/11/11/FreeBSD_Basics.html
I did my search. I got this article from a link in FreeBSD Forum. But I hardly think this article give any rally useful information about the difference.
COuld anybody show me some better articles or share your opinons about this?
thank u! | 2 |
7,771,014 | 10/14/2011 17:00:39 | 778,380 | 05/31/2011 21:16:04 | 26 | 0 | Updating facebook status | if I want to update my facebook status using a script such that when that script runs it reads a text from a file on my system and update the status for me on facebook.I am not sure how to write the script for the same. | facebook | scripting | status | null | null | 06/21/2012 13:49:13 | not a real question | Updating facebook status
===
if I want to update my facebook status using a script such that when that script runs it reads a text from a file on my system and update the status for me on facebook.I am not sure how to write the script for the same. | 1 |
11,420,287 | 07/10/2012 19:13:33 | 1,509,521 | 03/07/2012 18:28:57 | 3 | 0 | Android: Parsing MySql database through Json using PHP problems | I've been at this for about forever now, but I can't figure out why the data will be called to the app, but Json can't convert it.
It shows in logcat that JSONObject cannot be converted to JSONArray.
Heres the class:
public class SqlTest extends Activity {
public String data;
public List<String> suggest;
public AutoCompleteTextView autoComplete;
public ArrayAdapter<String> aAdapter;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sqltest);
suggest = new ArrayList<String>();
autoComplete = (AutoCompleteTextView) findViewById(R.id.autocomplete_country);
autoComplete.addTextChangedListener(new TextWatcher(){
public void afterTextChanged(Editable editable) {
//
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
//
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
String newText = s.toString();
new getJson().execute(newText);
}
});
}
class getJson extends AsyncTask<String,String,String>{
@Override
protected String doInBackground(String... key) {
String newText = key[0];
newText = newText.trim();
newText = newText.replace(" ", "+");
try{
HttpClient hClient = new DefaultHttpClient();
HttpGet hGet = new HttpGet("http://android.mojavenuclear.com/androidscript.php");
ResponseHandler<String> rHandler = new BasicResponseHandler();
data = hClient.execute(hGet,rHandler);
suggest = new ArrayList<String>();
JSONArray jArray = new JSONArray(data);
for(int i=0;i<jArray.getJSONArray(1).length();i++){
String SuggestKey = jArray.getJSONArray(1).getString(i);
suggest.add(SuggestKey);
}
}catch(Exception e){
Log.w("Error", e.getMessage());
}
runOnUiThread(new Runnable(){
public void run(){
aAdapter = new ArrayAdapter<String>(getApplicationContext(),R.layout.list_item,suggest);
autoComplete.setAdapter(aAdapter);
aAdapter.notifyDataSetChanged();
}
});
return null;
}
}
}
and the PHP:
<?php
mysql_connect("","","");
mysql_select_db("androiddatastore");
$desc = mysql_real_escape_string($_REQUEST['newText']);
$q = mysql_query("SELECT `Shrt_Desc`, `Carbohydrt_(g)` FROM `Abbrev` WHERE `Shrt_Desc` LIKE '$desc%' LIMIT 0, 30");
while($e=mysql_fetch_assoc($q))
$output[]=$e;
print(json_encode($output));
mysql_close();
?>
LogCat output:
07-10 11:57:20.872: W/KeyCharacterMap(15730): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
07-10 11:58:37.948: W/Error(15730): Value {"Carbohydrt_(g)":"0.06","Shrt_Desc":"BUTTER,WHIPPED,WITH SALT"} at 1 of type org.json.JSONObject cannot be converted to JSONArray
07-10 11:58:38.358: W/Error(15730): Value {"Carbohydrt_(g)":"0.06","Shrt_Desc":"BUTTER,WHIPPED,WITH SALT"} at 1 of type org.json.JSONObject cannot be converted to JSONArray
07-10 11:58:38.468: W/Error(15730): Value {"Carbohydrt_(g)":"0.06","Shrt_Desc":"BUTTER,WHIPPED,WITH SALT"} at 1 of type org.json.JSONObject cannot be converted to JSONArray
07-10 11:58:38.818: W/Error(15730): Value {"Carbohydrt_(g)":"0.06","Shrt_Desc":"BUTTER,WHIPPED,WITH SALT"} at 1 of type org.json.JSONObject cannot be converted to JSONArray | php | android | mysql | json | null | null | open | Android: Parsing MySql database through Json using PHP problems
===
I've been at this for about forever now, but I can't figure out why the data will be called to the app, but Json can't convert it.
It shows in logcat that JSONObject cannot be converted to JSONArray.
Heres the class:
public class SqlTest extends Activity {
public String data;
public List<String> suggest;
public AutoCompleteTextView autoComplete;
public ArrayAdapter<String> aAdapter;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.sqltest);
suggest = new ArrayList<String>();
autoComplete = (AutoCompleteTextView) findViewById(R.id.autocomplete_country);
autoComplete.addTextChangedListener(new TextWatcher(){
public void afterTextChanged(Editable editable) {
//
}
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
//
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
String newText = s.toString();
new getJson().execute(newText);
}
});
}
class getJson extends AsyncTask<String,String,String>{
@Override
protected String doInBackground(String... key) {
String newText = key[0];
newText = newText.trim();
newText = newText.replace(" ", "+");
try{
HttpClient hClient = new DefaultHttpClient();
HttpGet hGet = new HttpGet("http://android.mojavenuclear.com/androidscript.php");
ResponseHandler<String> rHandler = new BasicResponseHandler();
data = hClient.execute(hGet,rHandler);
suggest = new ArrayList<String>();
JSONArray jArray = new JSONArray(data);
for(int i=0;i<jArray.getJSONArray(1).length();i++){
String SuggestKey = jArray.getJSONArray(1).getString(i);
suggest.add(SuggestKey);
}
}catch(Exception e){
Log.w("Error", e.getMessage());
}
runOnUiThread(new Runnable(){
public void run(){
aAdapter = new ArrayAdapter<String>(getApplicationContext(),R.layout.list_item,suggest);
autoComplete.setAdapter(aAdapter);
aAdapter.notifyDataSetChanged();
}
});
return null;
}
}
}
and the PHP:
<?php
mysql_connect("","","");
mysql_select_db("androiddatastore");
$desc = mysql_real_escape_string($_REQUEST['newText']);
$q = mysql_query("SELECT `Shrt_Desc`, `Carbohydrt_(g)` FROM `Abbrev` WHERE `Shrt_Desc` LIKE '$desc%' LIMIT 0, 30");
while($e=mysql_fetch_assoc($q))
$output[]=$e;
print(json_encode($output));
mysql_close();
?>
LogCat output:
07-10 11:57:20.872: W/KeyCharacterMap(15730): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
07-10 11:58:37.948: W/Error(15730): Value {"Carbohydrt_(g)":"0.06","Shrt_Desc":"BUTTER,WHIPPED,WITH SALT"} at 1 of type org.json.JSONObject cannot be converted to JSONArray
07-10 11:58:38.358: W/Error(15730): Value {"Carbohydrt_(g)":"0.06","Shrt_Desc":"BUTTER,WHIPPED,WITH SALT"} at 1 of type org.json.JSONObject cannot be converted to JSONArray
07-10 11:58:38.468: W/Error(15730): Value {"Carbohydrt_(g)":"0.06","Shrt_Desc":"BUTTER,WHIPPED,WITH SALT"} at 1 of type org.json.JSONObject cannot be converted to JSONArray
07-10 11:58:38.818: W/Error(15730): Value {"Carbohydrt_(g)":"0.06","Shrt_Desc":"BUTTER,WHIPPED,WITH SALT"} at 1 of type org.json.JSONObject cannot be converted to JSONArray | 0 |
1,971,918 | 12/28/2009 22:36:33 | 5,056 | 09/07/2008 15:43:17 | 5,912 | 215 | Best way to handle multiple configuration matrix with rake? | I have an application that can be built in one of 2 configurations (Company1 or Company2) and in debug or release mode.
Company1 Release
All builds done with the Release compiler flag
Build and output core dll files to build directory
Build and output Company1Plugin.dll to build directory
Copy tools\templates\log4net.config to build directory
Copy tools\templates\Company1.MyApp.exe.config to build directory
Company1 Debug
All builds done with the Debug compiler flag
Build and output core dll files to build directory
Build and output Company1Plugin.dll to build directory
Build and output MyApp.Debug.dll to build directory
Copy tools\Growl\log4net.GrowlAppender to build directory
Copy tools\templates\debug.log4net.config to build directory
Copy tools\templates\debug.Company1.MyApp.exe.config to build directory
Company2 Release
All builds done with the Release compiler flag
Build and output core dll files to build directory
Build and output Company2Plugin.dll to build directory
Build and output PrintingUtility.dll to build directory
Copy tools\templates\log4net.config to build directory
Copy tools\templates\Company2.MyApp.exe.config to build directory
Company2 Debug
All builds done with the Debug compiler flag
Build and output core dll files to build directory
Build and output Company2Plugin.dll to build directory
Build and output PrintingUtility.dll to build directory
Build and output MyApp.Debug.dll to build directory
Copy tools\Growl\log4net.GrowlAppender to build directory
Copy tools\templates\debug.log4net.config to build directory
Copy tools\templates\debug.Company2.MyApp.exe.config to build directory
I'm at a bit of a loss how to best model this matrix of dependencies in my rake file.
I would like to be able to simply do:
rake company1 #(release is the default)
rake company1 release
rake company2 debug
but cant quite figure out how to do this.
Obviously I have a build_and_output_core task that everything depends on, but then what? I can have the company1 and company2 tasks simply set some variables as to what should be done but then what triggers the actual copy activity?
I'm just getting started with both rake and ruby so any general advice is appreciated.
| rake | build-process | null | null | null | null | open | Best way to handle multiple configuration matrix with rake?
===
I have an application that can be built in one of 2 configurations (Company1 or Company2) and in debug or release mode.
Company1 Release
All builds done with the Release compiler flag
Build and output core dll files to build directory
Build and output Company1Plugin.dll to build directory
Copy tools\templates\log4net.config to build directory
Copy tools\templates\Company1.MyApp.exe.config to build directory
Company1 Debug
All builds done with the Debug compiler flag
Build and output core dll files to build directory
Build and output Company1Plugin.dll to build directory
Build and output MyApp.Debug.dll to build directory
Copy tools\Growl\log4net.GrowlAppender to build directory
Copy tools\templates\debug.log4net.config to build directory
Copy tools\templates\debug.Company1.MyApp.exe.config to build directory
Company2 Release
All builds done with the Release compiler flag
Build and output core dll files to build directory
Build and output Company2Plugin.dll to build directory
Build and output PrintingUtility.dll to build directory
Copy tools\templates\log4net.config to build directory
Copy tools\templates\Company2.MyApp.exe.config to build directory
Company2 Debug
All builds done with the Debug compiler flag
Build and output core dll files to build directory
Build and output Company2Plugin.dll to build directory
Build and output PrintingUtility.dll to build directory
Build and output MyApp.Debug.dll to build directory
Copy tools\Growl\log4net.GrowlAppender to build directory
Copy tools\templates\debug.log4net.config to build directory
Copy tools\templates\debug.Company2.MyApp.exe.config to build directory
I'm at a bit of a loss how to best model this matrix of dependencies in my rake file.
I would like to be able to simply do:
rake company1 #(release is the default)
rake company1 release
rake company2 debug
but cant quite figure out how to do this.
Obviously I have a build_and_output_core task that everything depends on, but then what? I can have the company1 and company2 tasks simply set some variables as to what should be done but then what triggers the actual copy activity?
I'm just getting started with both rake and ruby so any general advice is appreciated.
| 0 |
5,450,063 | 03/27/2011 15:04:35 | 667,286 | 03/19/2011 12:26:30 | 6 | 0 | need php code to obtain list of files stored on the server | How to display the list of files stored in the folder on the server using php and making a call to that php page using ajax so as to display the list of files to the user on the client machine? | php | ajax | null | null | null | 03/27/2011 20:32:02 | not a real question | need php code to obtain list of files stored on the server
===
How to display the list of files stored in the folder on the server using php and making a call to that php page using ajax so as to display the list of files to the user on the client machine? | 1 |
5,894,946 | 05/05/2011 08:47:31 | 145,427 | 07/26/2009 22:55:03 | 322 | 18 | How to add Git's branch name to the commit message? | I need some help with a Bash script that will automatically add the Git's branch name as a hash in commit messages. Any ideas?
Thanks! | git | bash | script | git-branch | null | null | open | How to add Git's branch name to the commit message?
===
I need some help with a Bash script that will automatically add the Git's branch name as a hash in commit messages. Any ideas?
Thanks! | 0 |
5,462,046 | 03/28/2011 16:25:15 | 314,875 | 04/12/2010 20:00:51 | 39 | 1 | MPI_Scatter Segfaulting | I'm working on a parallel sort program to learn MPI, and I've been having problems with MPI_Scatter. Every time I attempt to run, I get the following:
reading input
Scattering input
_pmii_daemon(SIGCHLD): [NID 00012] PE 0 exit signal Segmentation fault
[NID 00012] 2011-03-28 10:12:56 Apid 23655: initiated application termination
A basic look at other questions didn't really answer why I'm having troubles - The arrays are contiguous, so I shouldn't have problems with non-contiguous memory access, and I'm passing the correct pointers in the correct order. Does anyone have any ideas?
Source code is below - It's specified for a specific number because I don't want to deal with variable input and rank size just yet.
#include <mpi.h>
#include <iostream>
using std::endl;
using std::cout;
#include <fstream>
using std::ifstream;
using std::ofstream;
#include <algorithm>
using std::sort;
#define SIZEOF_INPUT 10000000
#define NUMTHREADS 100
#define SIZEOF_SUBARRAY SIZEOF_INPUT/NUMTHREADS
int main(int argc, char** argv){
MPI_Init(&argc, &argv);
int input[SIZEOF_INPUT];
int tempbuf[SIZEOF_SUBARRAY];
int myRank;
MPI_Comm_rank(MPI_COMM_WORLD, &myRank);
/*
Read input from file
*/
if(myRank == 0){
cout << "reading input" << endl;
ifstream in(argv[1]);
for(int i = 0; i < SIZEOF_INPUT; ++i)
in >> input[i];
cout << "Scattering input" << endl;
}
// Scatter, Sort, and Gather again
MPI_Scatter(input,SIZEOF_INPUT,MPI_INT,tempbuf,SIZEOF_SUBARRAY,MPI_INT,0,MPI_COMM_WORLD);
cout << "Rank " << myRank << "Sorting" << endl;
sort(tempbuf,tempbuf+SIZEOF_SUBARRAY);
MPI_Gather(tempbuf,SIZEOF_SUBARRAY,MPI_INT,input,SIZEOF_INPUT,MPI_INT,0,MPI_COMM_WORLD);
if(myRank == 0){
cout << "Sorting final output" << endl;
// I'm doing a multi-queue merge here using tricky pointer games
//list of iterators representing things in the queue
int* iterators[NUMTHREADS];
//The ends of those iterators
int* ends[NUMTHREADS];
//Set up iterators and ends
for(int i = 0; i < NUMTHREADS; ++i){
iterators[i] = input + (i*SIZEOF_SUBARRAY);
ends[i] = iterators[i] + SIZEOF_SUBARRAY;
}
ofstream out(argv[2]);
int ULTRA_MAX = SIZEOF_INPUT + 1;
int* ULTRA_MAX_POINTER = &ULTRA_MAX;
while(true){
int** curr_min = &ULTRA_MAX_POINTER;
for(int i = 0 ; i < NUMTHREADS; ++i)
if(iterators[i] < ends[i] && *iterators[i] < **curr_min)
curr_min = &iterators[i];
if(curr_min == &ULTRA_MAX_POINTER) break;
out << **curr_min << endl;
++(*curr_min);
}
}
MPI_Finalize();
}
Any help would be much appreciated.
Regards,
Zach | c++ | sorting | parallel-processing | mpi | null | null | open | MPI_Scatter Segfaulting
===
I'm working on a parallel sort program to learn MPI, and I've been having problems with MPI_Scatter. Every time I attempt to run, I get the following:
reading input
Scattering input
_pmii_daemon(SIGCHLD): [NID 00012] PE 0 exit signal Segmentation fault
[NID 00012] 2011-03-28 10:12:56 Apid 23655: initiated application termination
A basic look at other questions didn't really answer why I'm having troubles - The arrays are contiguous, so I shouldn't have problems with non-contiguous memory access, and I'm passing the correct pointers in the correct order. Does anyone have any ideas?
Source code is below - It's specified for a specific number because I don't want to deal with variable input and rank size just yet.
#include <mpi.h>
#include <iostream>
using std::endl;
using std::cout;
#include <fstream>
using std::ifstream;
using std::ofstream;
#include <algorithm>
using std::sort;
#define SIZEOF_INPUT 10000000
#define NUMTHREADS 100
#define SIZEOF_SUBARRAY SIZEOF_INPUT/NUMTHREADS
int main(int argc, char** argv){
MPI_Init(&argc, &argv);
int input[SIZEOF_INPUT];
int tempbuf[SIZEOF_SUBARRAY];
int myRank;
MPI_Comm_rank(MPI_COMM_WORLD, &myRank);
/*
Read input from file
*/
if(myRank == 0){
cout << "reading input" << endl;
ifstream in(argv[1]);
for(int i = 0; i < SIZEOF_INPUT; ++i)
in >> input[i];
cout << "Scattering input" << endl;
}
// Scatter, Sort, and Gather again
MPI_Scatter(input,SIZEOF_INPUT,MPI_INT,tempbuf,SIZEOF_SUBARRAY,MPI_INT,0,MPI_COMM_WORLD);
cout << "Rank " << myRank << "Sorting" << endl;
sort(tempbuf,tempbuf+SIZEOF_SUBARRAY);
MPI_Gather(tempbuf,SIZEOF_SUBARRAY,MPI_INT,input,SIZEOF_INPUT,MPI_INT,0,MPI_COMM_WORLD);
if(myRank == 0){
cout << "Sorting final output" << endl;
// I'm doing a multi-queue merge here using tricky pointer games
//list of iterators representing things in the queue
int* iterators[NUMTHREADS];
//The ends of those iterators
int* ends[NUMTHREADS];
//Set up iterators and ends
for(int i = 0; i < NUMTHREADS; ++i){
iterators[i] = input + (i*SIZEOF_SUBARRAY);
ends[i] = iterators[i] + SIZEOF_SUBARRAY;
}
ofstream out(argv[2]);
int ULTRA_MAX = SIZEOF_INPUT + 1;
int* ULTRA_MAX_POINTER = &ULTRA_MAX;
while(true){
int** curr_min = &ULTRA_MAX_POINTER;
for(int i = 0 ; i < NUMTHREADS; ++i)
if(iterators[i] < ends[i] && *iterators[i] < **curr_min)
curr_min = &iterators[i];
if(curr_min == &ULTRA_MAX_POINTER) break;
out << **curr_min << endl;
++(*curr_min);
}
}
MPI_Finalize();
}
Any help would be much appreciated.
Regards,
Zach | 0 |
10,310,092 | 04/25/2012 05:56:28 | 1,201,492 | 02/10/2012 07:18:15 | 673 | 10 | Jquery .click function is not working | I have created a tab and append some text in it
$("#tabcontent").append('<p id="c'+count+'"><table> <tr>Tab Content '+count+'<br><span id="addColumns" style="cursor:pointer;">Add Columns</span></p>');
there is an id `addColumns` I write a function for this id
`$('#addColumns').click(function(){
$("#tabcontent").html('');
});`
When I click on `Add Columns` Nothing is happening... | javascript | jquery | html | null | null | 04/25/2012 12:49:05 | not a real question | Jquery .click function is not working
===
I have created a tab and append some text in it
$("#tabcontent").append('<p id="c'+count+'"><table> <tr>Tab Content '+count+'<br><span id="addColumns" style="cursor:pointer;">Add Columns</span></p>');
there is an id `addColumns` I write a function for this id
`$('#addColumns').click(function(){
$("#tabcontent").html('');
});`
When I click on `Add Columns` Nothing is happening... | 1 |
2,718,373 | 04/27/2010 02:36:12 | 80,572 | 03/20/2009 16:35:32 | 6,840 | 203 | Determine if a url matches a Route, and pull out the terms if it does | I've got a big old log file I'm trying to break down in terms of routes.
Essentially, I'm getting input of a path (`/questions/31415` for example) and a list of all the registered [Routes][1]. What I want out is a `Route` and the parameters specified in the route (so in, `/questions/{id}/{answer}` I'd get `id` and `answers` out).
I've got a working solution that basically generates a nasty bit of regex on the fly with named groups to do matching and parsing all-in-one. My gut tells me this is a brittle way to do it, and frankly there has to be a better way, right?
[1]: http://msdn.microsoft.com/en-us/library/system.web.routing.route.aspx | asp.net-mvc-2 | c# | routing | null | null | null | open | Determine if a url matches a Route, and pull out the terms if it does
===
I've got a big old log file I'm trying to break down in terms of routes.
Essentially, I'm getting input of a path (`/questions/31415` for example) and a list of all the registered [Routes][1]. What I want out is a `Route` and the parameters specified in the route (so in, `/questions/{id}/{answer}` I'd get `id` and `answers` out).
I've got a working solution that basically generates a nasty bit of regex on the fly with named groups to do matching and parsing all-in-one. My gut tells me this is a brittle way to do it, and frankly there has to be a better way, right?
[1]: http://msdn.microsoft.com/en-us/library/system.web.routing.route.aspx | 0 |
7,531,552 | 09/23/2011 15:45:26 | 132,331 | 07/02/2009 14:53:31 | 892 | 18 | Page explodes from cross browser issues in IE 8 | I have a page that works fine in Safari, chrome, and firefox. In IE it absolutely explodes, I develop on a Mac so I'm not exactly sure where to begin. Any help would be great!
http://www2.currensee.com | html | css | internet-explorer | cross-browser | null | 09/23/2011 16:04:58 | not a real question | Page explodes from cross browser issues in IE 8
===
I have a page that works fine in Safari, chrome, and firefox. In IE it absolutely explodes, I develop on a Mac so I'm not exactly sure where to begin. Any help would be great!
http://www2.currensee.com | 1 |
3,558,511 | 08/24/2010 16:08:42 | 225,429 | 12/05/2009 15:09:15 | 42 | 1 | how to let wc command recursivly ? | Let it counting *.h *.cpp in Sub directory. | linux | null | null | null | null | 08/29/2011 15:56:24 | off topic | how to let wc command recursivly ?
===
Let it counting *.h *.cpp in Sub directory. | 2 |
11,309,979 | 07/03/2012 11:30:08 | 1,099,798 | 12/15/2011 12:04:19 | 1 | 0 | Stack smashing detected in booking Client-Server in C | Hi I have this problem with a client server program in C .
This should be a very simple system of booking...please somebody can help me I don't know how to fix (first project in C).
Thanks in advance
Client.c
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/signal.h>
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#define ERRORE -1
#define FLAG 0
#define SIZE 128
#define R 3
#define C 5
typedef struct {
int response_channel;
int service_code;
} request;
typedef struct {
long mtype;
request req;
} request_msg;
typedef struct {
long mtype;
int posti[R][C];
} response_msg;
/*strutture per cancella*/
typedef struct {
int response_channel;
int service_code;
char codice[5];
} request_canc;
typedef struct {
long mtype;
request_canc req;
} request_msg_canc;
typedef struct {
long mtype;
char risp[256];
} response_msg_canc;
//************************************************//
/* strutture per prenota*/
typedef struct {
int response_channel;
int service_code;
int posti[R][C];
} request_pren;
typedef struct {
long mtype;
request_pren req;
} request_msg_pren;
//**********************//
int my_id_coda,id_coda, ret, STATUS;
long key;
int sala[R][C];
request_msg request_message;
response_msg response_message;
/*variabili per cancella*/
request_msg_canc request_message_canc;
request_msg_pren posti_p;
void visualizza();
void prenota();
void cancella();
int menu();
main(int argc, char *argv[]) {
int scelta,ris;
key = getpid();
my_id_coda = msgget(key, IPC_CREAT|IPC_EXCL|0666);
if( my_id_coda == -1){
my_id_coda = msgget(key, IPC_CREAT|0666);
ret = msgctl(my_id_coda,IPC_RMID,0);
my_id_coda = msgget(key, IPC_CREAT|IPC_EXCL|0666);
if( my_id_coda == -1 ){
printf("cannot install client queue, please check with the problem\n");
exit(-1);
}
}
id_coda = msgget(50, IPC_CREAT|0666);
if( id_coda == -1 ){
printf("cannot open server queue, please check with the problem\n");
exit(-1);
}
/*qui mancava il richiamo al menu*/
do{
int a;
printf("1 visualizza;\n");
printf("2 prenota;\n");
printf("3 cancella;\n");
printf("4 esci;\n");
scanf("%d",&a);
scelta = a;
switch(scelta) {
case 1: visualizza(); break;
case 2: prenota(); break;
case 3: cancella(); break;
}
}while(scelta != 4);
ris=msgctl(my_id_coda,IPC_RMID,0);
if(ris==-1)printf("Errore nella chiamata msgctl");
exit(-1);
}/* end main*/
void visualizza() {
int i,j;
request_message.mtype = 1;
request_message.req.service_code = 1;
request_message.req.response_channel = my_id_coda;
printf("response channel has id %d\n",my_id_coda);
if ( msgsnd(id_coda, &request_message, sizeof(request), FLAG) == -1 ) {
printf("cannot send request to the server\n");
exit(-1);
}
if ( msgrcv(my_id_coda, &response_message, sizeof(response_msg), 1, FLAG) == -1) {
printf("error while receiving the server response, please check with the problem\n");
exit(-1);
}
else {
memcpy((char*)sala,(char*)response_message.posti,128);
printf("\nla sala è:\n");
for(i=0;i<R;i++){
for(j=0;j<C;j++){
printf("%d ",sala[i][j]);
}
printf("\n");
}
}
}
void prenota(){
int i,j;
int numero=0;
int fila=0;
int poltrona=0;
response_msg_canc risposta_codice;
for(i=0;i<R;i++)
for(j=0;j<C;j++)
posti_p.req.posti[i][j]=0;
numero=0;
while(numero>R*C || numero<=0){
printf("Digitare il numero di posti che si vuole prenotare compreso tra 1 e %d\n",R*C);
scanf("%d",&numero);
}
for(i=0;i<numero;i++){
printf("Digitare il %d° posto nel formato 'fila poltrona' con fila compresa tra 1..%d e poltrona tra 1..%d \n",i+1,R,C);
scanf("%d%d",&fila,&poltrona);
/*scanf("%d",&fila);
scanf("%d",&poltrona);*/
if(fila<=0 || fila>R || poltrona<=0 || poltrona>C){
printf("ERRORE\n");
i--;
}
else {posti_p.req.posti[fila-1][poltrona-1]=1;}
}
for(i=0;i<R;i++){
for(j=0;j<C;j++){
printf("%d",posti_p.req.posti[i][j]);
}
printf("\n");
}
posti_p.mtype = 2;
posti_p.req.service_code = 2;
posti_p.req.response_channel = my_id_coda;
if ( msgsnd(id_coda, &posti_p, sizeof(request_pren), FLAG) == -1 ) {
printf("cannot send request to the server\n");
exit(-1);
}
if ( msgrcv(my_id_coda, &risposta_codice, sizeof(response_msg_canc), 2, FLAG) == -1) {
printf("error while receiving the server response, please check with the problem\n");
exit(-1);
}
printf("%s\n",risposta_codice.risp);
}
/* metodo cancella*/
void cancella(){
int i,j;
char preno[5];
response_msg_canc risposta;
request_message_canc.mtype = 3;
request_message_canc.req.service_code = 3;
printf("Inserire codice prenotazione da cancellare:");
scanf("%s",preno);
strcpy(request_message_canc.req.codice,preno);
request_message_canc.req.response_channel = my_id_coda;
printf("response channel has id %d\n",my_id_coda);
if ( msgsnd(id_coda, &request_message_canc, sizeof(request_canc), FLAG) == -1 ) {
printf("cannot send request to the server\n");
exit(-1);
}
if ( msgrcv(my_id_coda, &risposta,sizeof(response_msg_canc), 3, FLAG) == -1) {
printf("error while receiving the server response, please check with the problem\n");
exit(-1);
}
risposta.risp[255]='\0';
printf("%s\n",risposta.risp);
}
Server.c
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/signal.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/shm.h>
#include <math.h>
#include<stdlib.h>
#include<string.h>
#include <sys/sem.h>
#define ERRORE -1
#define FLAG 0
#define SIZE 128
#define R 3
#define C 5
#define CINEMA "prenotazione"
#define STDOUT 1
typedef struct {
int response_channel;
int service_code;
} request;
typedef struct {
int response_channel;
int service_code;
char codice[5];
} request_canc;
typedef struct {
long mtype;
request_canc req;
} request_msg_canc;
typedef struct {
long mtype;
request req;
} request_msg;
typedef struct {
long mtype;
int posti[R][C];
} response_msg;
typedef struct {
char pren[6];
} codice;
typedef struct {
long mtype;
char risp[256];
} response_msg_canc;
/* strutture per prenota*/
typedef struct {
int response_channel;
int service_code;
int posti[R][C];
} request_pren;
typedef struct {
long mtype;
request_pren req;
} request_msg_pren;
//**********************//
codice prenotazioni[R][C];
int id_coda, ret;
long key = 50;
request_msg request_message;
request_msg *new_message;
pthread_t tid;
response_msg response_message;
request_msg_canc request_mes_canc;
request_msg_canc *new_mes_canc;
request_msg_pren request_mes_pren;
request_msg_pren *new_mes_pren;
int ds_shm;
int id_sem;
void ito(int,char*);
int crea_init_sem(key_t,int);
void elimina_sem(int);
int sem_wait(int);
int sem_signal(int);
void visualizza(request_msg*);
void prenota (request_msg_pren*);
void cancella (request_msg_canc*);
main(int argc, char *argv[]) {
codice prenot[3][5];
int sd,size,occ,i,j,status,eli;
long chiave=10,chiave_sem=50;
char buff[5],app[5],*p,*scorri_mem;
sd=open(CINEMA,O_RDONLY);
ds_shm = shmget(chiave,sizeof(codice[3][5]),IPC_CREAT|0666);
if( ds_shm == -1) {printf("Errore nella chiamata shmget\n"); exit(1);}
p = shmat(ds_shm, 0, SHM_W);
if(p==(char*)-1){printf("Errore nella chiamata shmat\n"); exit(1);}
scorri_mem=p;
for(i=0;i<R;i++){
for(j=0;j<C;j++){
size=read(sd,buff,5);
memcpy((char*)app,(char*)buff,size);
strncpy(scorri_mem,app,5);
*(scorri_mem+5)='\0';
printf("%s",scorri_mem);
scorri_mem+=6;
}
}
id_sem=crea_init_sem(chiave_sem,1);
id_coda = msgget(key, IPC_CREAT|IPC_EXCL|0666);
if( id_coda == -1){
id_coda = msgget(key, IPC_CREAT|0666);
ret = msgctl(id_coda,IPC_RMID,0);
id_coda = msgget(key, IPC_CREAT|IPC_EXCL|0666);
if( id_coda == -1 ){
printf("cannot install server queue, please check with the problem\n");
exit(-1);
}
}
//close(sd);
if(fork()==0){
while(1) {
if ( msgrcv(id_coda, &request_message, sizeof(request), 1, FLAG) == -1) {
printf("message receive error, please check with the problem\n");
}
else {
new_message = malloc(sizeof(request_msg));
if(!new_message){
printf("cannot allocate new request message buffer \n");
exit(-1);
}
memcpy((char*)new_message,(char*)&request_message,sizeof(request_msg));
if( pthread_create(&tid, NULL, visualizza, (void *)new_message) != 0){
printf("cannot create new thread \n");
exit(-1);
}
}
}/* end while */
}/* end fork*/
// prenota
if(fork()==0){while(1) {
if ( msgrcv(id_coda, &request_mes_pren, sizeof(request_pren), 2, FLAG) == -1) {
printf("message receive error, please check with the problem\n");
}
else {
new_mes_pren = malloc(sizeof(request_msg_pren));
if(!new_mes_pren){
printf("cannot allocate new request message buffer \n");
exit(-1);
}
memcpy((char*)new_mes_pren,(char*)&request_mes_pren,sizeof(request_pren));
if( pthread_create(&tid, NULL, prenota, (void *)new_mes_pren ) != 0){
printf("cannot create new thread \n");
exit(-1);
}
}
}/* end while */
}/* end fork*/
// cancella
if(fork()==0){ while(1) {
if ( msgrcv(id_coda, &request_mes_canc, sizeof(request_canc), 3, FLAG) == -1) {
printf("message receive error, please check with the problem\n");
}
else {
new_mes_canc = malloc(sizeof(request_msg_canc));
if(!new_mes_canc){
printf("cannot allocate new request message buffer \n");
exit(-1);
}
memcpy((char*)new_mes_canc,(char*)&request_mes_canc,sizeof(request_canc));
if( pthread_create(&tid, NULL, cancella, (void *)new_mes_canc ) != 0){
printf("cannot create new thread \n");
exit(-1);
}
}
}/* end while */
}/* end fork*/
wait(&status);
eli=msgctl(ds_shm,IPC_RMID,NULL);
if(eli == -1) printf("Errore nella chiamata msgctl");
elimina_sem(id_sem);
}
void visualizza(request_msg *request_message){
int status,i,j,occ;
char *p;
printf("asked service of type %d - response channel is %d\n", request_message->req.service_code,request_message->req.response_channel);
response_message.mtype = 1;
p = shmat(ds_shm, 0, SHM_R);
if(p==(char*)-1){printf("Errore nella chiamata shmat\n"); exit(1);}
for(i=0;i<R;i++){
for(j=0;j<C;j++){
strncpy(prenotazioni[i][j].pren,p,6);
p+=6;
}
}
for(i=0;i<R;i++)
for(j=0;j<C;j++){
occ=strncmp(prenotazioni[i][j].pren,"0000",4);
if(occ==0) response_message.posti[i][j]=0;
else response_message.posti[i][j]=1;
}
if ( msgsnd(request_message->req.response_channel, &response_message, sizeof(response_msg), FLAG) == -1 ) {
printf("cannot return response to the client\n");
exit(-1);
}
i=shmdt(p);
free(request_message);
status = 0;
pthread_exit((void *)&status);
}
void prenota (request_msg_pren *request_mes_pren){
response_msg_canc risposta_pren;
int status,occ,i,j,dist,trovato,cod,sd,doppio,conta=0;
char *p,c[6],*scorri_mem;
risposta_pren.mtype = 2;
sem_wait(id_sem);
p = shmat(ds_shm, 0, SHM_R);
if(p==(char*)-1){printf("Errore nella chiamata shmat\n"); exit(1);}
scorri_mem=p;
for(i=0;i<R;i++){
for(j=0;j<C;j++){
strncpy(prenotazioni[i][j].pren,scorri_mem,6);
scorri_mem+=6;
}
}
scorri_mem=p;
for(i=0;i<R;i++)
for(j=0;j<C;j++){
occ=strncmp(prenotazioni[i][j].pren,"0000",4);
if(occ==0) response_message.posti[i][j]=0;
else response_message.posti[i][j]=1;
}
for(i=0;i<R;i++)
for(j=0;j<C;j++){
if(request_mes_pren->req.posti[i][j]==1)
if(request_mes_pren->req.posti[i][j]==response_message.posti[i][j])
trovato=1;
if(request_mes_pren->req.posti[i][j]==0) conta++;
}
i=shmdt(p);
p = shmat(ds_shm, 0, SHM_R);
scorri_mem=p;
if(trovato==1 || conta==(R*C)){ strcpy(risposta_pren.risp,"prenotazione non effettuata");}
else {
do{
cod=random();
ito(cod,c);
doppio=0;
for(i=0;i<R;i++){
for(j=0;j<C;j++){
occ=strncmp(prenotazioni[i][j].pren,c,4);
if(occ==0) {doppio=1;break;}
}
}
}while(doppio==1);
strcpy(risposta_pren.risp,"prenotazione effettuata con codice: ");
strncat(risposta_pren.risp,c,6);
i=shmdt(p);
p = shmat(ds_shm, 0, SHM_W);
scorri_mem=p;
for(i=0;i<R;i++){
for(j=0;j<C;j++){
if(request_mes_pren->req.posti[i][j]==1){
strncpy(scorri_mem,c,6);
if(j<(C-1)) *(scorri_mem+4)=' ';
else (*(scorri_mem+4)='\n');
}
*(scorri_mem+5)='\0';
scorri_mem+=6;
}
}
}
close(STDOUT);
scorri_mem=p;
sd=open(CINEMA,O_RDWR|O_TRUNC);
dup(sd);
for(i=0;i<R;i++){
for(j=0;j<C;j++){
write (sd,scorri_mem,5);
scorri_mem+=6;
}
}
//fflush(STDOUT);
if ( msgsnd(request_mes_pren->req.response_channel, &risposta_pren, sizeof(response_msg_canc), FLAG) == -1 ) {
printf("cannot return response to the client\n");
exit(-1);
}
close(sd);
sem_signal(id_sem);
free(request_mes_pren);
status = 0;
pthread_exit((void *)&status);
}
void cancella (request_msg_canc *request_mes_canc){
response_msg_canc risposta;
int status,occ,i,j,dist,sd,trovato=0;
char *p,*scorri_mem;
risposta.mtype = 3;
p = shmat(ds_shm, 0, SHM_W);
if(p==(char*)-1){printf("Errore nella chiamata shmat\n"); exit(1);}
scorri_mem=p;
for(i=0;i<R;i++)
for(j=0;j<C;j++){
occ=strncmp(scorri_mem,request_mes_canc->req.codice,4);
if(occ==0) {
trovato++;
if(j<C-1){ strcpy(scorri_mem,"0000 \0");}
else { strcpy(scorri_mem,"0000\n");}
}
scorri_mem+=6;
}
i=shmdt(p);
sd=open(CINEMA,O_RDWR|O_TRUNC);
p = shmat(ds_shm, 0, SHM_R);
scorri_mem=p;
for(i=0;i<R;i++){
for(j=0;j<C;j++){
write(sd,scorri_mem,5);
scorri_mem+=6;
}
}
if(trovato>0) strcpy(risposta.risp,"cancellazione effettuata");
else { strcpy(risposta.risp,"codice inesistente");}
if ( msgsnd(request_mes_canc->req.response_channel, &risposta, sizeof(response_msg_canc), FLAG) == -1 ) {
printf("cannot return response to the client\n");
exit(-1);
}
close(sd);
i=shmdt(p);
free(request_mes_canc);
status = 0;
pthread_exit((void *)&status);
}
void ito(int casuale,char c[]){
div_t divisione;
int i,k,j,num=1;
if(casuale > 999999999) k=9;
else k=8;
for(j=0;j<k;j++)
num=num*10;
for(i=0;i<4;i++){
divisione= div(casuale,num);
switch(divisione.quot) {
case 0: c[i]='0'; break;
case 1: c[i]='1'; break;
case 2: c[i]='2'; break;
case 3: c[i]='3'; break;
case 4: c[i]='4'; break;
case 5: c[i]='5'; break;
case 6: c[i]='6'; break;
case 7: c[i]='7'; break;
case 8: c[i]='8'; break;
case 9: c[i]='9'; break;
}
casuale=divisione.rem;
num=num/10;;
}
c[4]=' ';
c[5]='\0';
return ;
}
int crea_init_sem(key_t chiave, int val)
{
int sem;
sem=semget(chiave,1,IPC_CREAT|0666);
if (sem==-1)
{
printf("Impossibile creare il semaforo\n");
exit(1);
}
semctl(sem,0,SETVAL,val);
return(sem);
}
void elimina_sem(int id_sem)
{
if(semctl(id_sem,IPC_RMID,0)==-1)
{
printf("Impossibile eliminare il semaforo\n");
exit(1);
}
}
int sem_wait(int sem)
{
struct sembuf operazione[1]={{0,-1,0}};
return semop(sem,operazione,1);
}
int sem_signal(int sem)
{
struct sembuf operazione[1]={{0,+1,0}};
return semop(sem,operazione,1);
}
And thi is the crash
*** stack smashing detected ***: ./Client
======= Memory map: ========
uca@luca-8:~/Scrivania/tesina/ufficial$ ./Client
1 visualizza;
2 prenota;
3 cancella;
4 esci;
2
Digitare il numero di posti che si vuole prenotare compreso tra 1 e 15
2
Digitare il 1° posto nel formato 'fila poltrona' con fila compresa tra 1..3 e poltrona tra 1..5
3 1
Digitare il 2° posto nel formato 'fila poltrona' con fila compresa tra 1..3 e poltrona tra 1..5
3 2
00000
00000
11000
prenotazione effettuata con codice: 1804
*** stack smashing detected ***: ./Client terminated
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(__fortify_fail+0x45)[0x9408d5]
/lib/i386-linux-gnu/libc.so.6(+0xe7887)[0x940887]
./Client[0x8048c8d]
./Client[0x80487aa]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x872113]
./Client[0x80485c1]
======= Memory map: ========
0019d000-0019e000 r-xp 00000000 00:00 0 [vdso]
00525000-00541000 r-xp 00000000 08:01 2360250 /lib/i386-linux-gnu/libgcc_s.so.1
00541000-00542000 r--p 0001b000 08:01 2360250 /lib/i386-linux-gnu/libgcc_s.so.1
00542000-00543000 rw-p 0001c000 08:01 2360250 /lib/i386-linux-gnu/libgcc_s.so.1
00859000-009cf000 r-xp 00000000 08:01 2360229 /lib/i386-linux-gnu/libc-2.13.so
009cf000-009d1000 r--p 00176000 08:01 2360229 /lib/i386-linux-gnu/libc-2.13.so
009d1000-009d2000 rw-p 00178000 08:01 2360229 /lib/i386-linux-gnu/libc-2.13.so
009d2000-009d5000 rw-p 00000000 00:00 0
00b18000-00b36000 r-xp 00000000 08:01 2360216 /lib/i386-linux-gnu/ld-2.13.so
00b36000-00b37000 r--p 0001d000 08:01 2360216 /lib/i386-linux-gnu/ld-2.13.so
00b37000-00b38000 rw-p 0001e000 08:01 2360216 /lib/i386-linux-gnu/ld-2.13.so
08048000-0804a000 r-xp 00000000 08:01 5636693 /home/luca/Scrivania/tesina/ufficial/Client
0804a000-0804b000 r--p 00001000 08:01 5636693 /home/luca/Scrivania/tesina/ufficial/Client
0804b000-0804c000 rw-p 00002000 08:01 5636693 /home/luca/Scrivania/tesina/ufficial/Client
0809c000-080bd000 rw-p 00000000 00:00 0 [heap]
b78b1000-b78b2000 rw-p 00000000 00:00 0
b78bf000-b78c3000 rw-p 00000000 00:00 0
bf8d0000-bf8f1000 rw-p 00000000 00:00 0 [stack]
Annullato
luca@luca-8:~/Scrivania/tesina/ufficial$
| c | stack | client-server | null | null | 07/03/2012 12:12:09 | too localized | Stack smashing detected in booking Client-Server in C
===
Hi I have this problem with a client server program in C .
This should be a very simple system of booking...please somebody can help me I don't know how to fix (first project in C).
Thanks in advance
Client.c
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/signal.h>
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#define ERRORE -1
#define FLAG 0
#define SIZE 128
#define R 3
#define C 5
typedef struct {
int response_channel;
int service_code;
} request;
typedef struct {
long mtype;
request req;
} request_msg;
typedef struct {
long mtype;
int posti[R][C];
} response_msg;
/*strutture per cancella*/
typedef struct {
int response_channel;
int service_code;
char codice[5];
} request_canc;
typedef struct {
long mtype;
request_canc req;
} request_msg_canc;
typedef struct {
long mtype;
char risp[256];
} response_msg_canc;
//************************************************//
/* strutture per prenota*/
typedef struct {
int response_channel;
int service_code;
int posti[R][C];
} request_pren;
typedef struct {
long mtype;
request_pren req;
} request_msg_pren;
//**********************//
int my_id_coda,id_coda, ret, STATUS;
long key;
int sala[R][C];
request_msg request_message;
response_msg response_message;
/*variabili per cancella*/
request_msg_canc request_message_canc;
request_msg_pren posti_p;
void visualizza();
void prenota();
void cancella();
int menu();
main(int argc, char *argv[]) {
int scelta,ris;
key = getpid();
my_id_coda = msgget(key, IPC_CREAT|IPC_EXCL|0666);
if( my_id_coda == -1){
my_id_coda = msgget(key, IPC_CREAT|0666);
ret = msgctl(my_id_coda,IPC_RMID,0);
my_id_coda = msgget(key, IPC_CREAT|IPC_EXCL|0666);
if( my_id_coda == -1 ){
printf("cannot install client queue, please check with the problem\n");
exit(-1);
}
}
id_coda = msgget(50, IPC_CREAT|0666);
if( id_coda == -1 ){
printf("cannot open server queue, please check with the problem\n");
exit(-1);
}
/*qui mancava il richiamo al menu*/
do{
int a;
printf("1 visualizza;\n");
printf("2 prenota;\n");
printf("3 cancella;\n");
printf("4 esci;\n");
scanf("%d",&a);
scelta = a;
switch(scelta) {
case 1: visualizza(); break;
case 2: prenota(); break;
case 3: cancella(); break;
}
}while(scelta != 4);
ris=msgctl(my_id_coda,IPC_RMID,0);
if(ris==-1)printf("Errore nella chiamata msgctl");
exit(-1);
}/* end main*/
void visualizza() {
int i,j;
request_message.mtype = 1;
request_message.req.service_code = 1;
request_message.req.response_channel = my_id_coda;
printf("response channel has id %d\n",my_id_coda);
if ( msgsnd(id_coda, &request_message, sizeof(request), FLAG) == -1 ) {
printf("cannot send request to the server\n");
exit(-1);
}
if ( msgrcv(my_id_coda, &response_message, sizeof(response_msg), 1, FLAG) == -1) {
printf("error while receiving the server response, please check with the problem\n");
exit(-1);
}
else {
memcpy((char*)sala,(char*)response_message.posti,128);
printf("\nla sala è:\n");
for(i=0;i<R;i++){
for(j=0;j<C;j++){
printf("%d ",sala[i][j]);
}
printf("\n");
}
}
}
void prenota(){
int i,j;
int numero=0;
int fila=0;
int poltrona=0;
response_msg_canc risposta_codice;
for(i=0;i<R;i++)
for(j=0;j<C;j++)
posti_p.req.posti[i][j]=0;
numero=0;
while(numero>R*C || numero<=0){
printf("Digitare il numero di posti che si vuole prenotare compreso tra 1 e %d\n",R*C);
scanf("%d",&numero);
}
for(i=0;i<numero;i++){
printf("Digitare il %d° posto nel formato 'fila poltrona' con fila compresa tra 1..%d e poltrona tra 1..%d \n",i+1,R,C);
scanf("%d%d",&fila,&poltrona);
/*scanf("%d",&fila);
scanf("%d",&poltrona);*/
if(fila<=0 || fila>R || poltrona<=0 || poltrona>C){
printf("ERRORE\n");
i--;
}
else {posti_p.req.posti[fila-1][poltrona-1]=1;}
}
for(i=0;i<R;i++){
for(j=0;j<C;j++){
printf("%d",posti_p.req.posti[i][j]);
}
printf("\n");
}
posti_p.mtype = 2;
posti_p.req.service_code = 2;
posti_p.req.response_channel = my_id_coda;
if ( msgsnd(id_coda, &posti_p, sizeof(request_pren), FLAG) == -1 ) {
printf("cannot send request to the server\n");
exit(-1);
}
if ( msgrcv(my_id_coda, &risposta_codice, sizeof(response_msg_canc), 2, FLAG) == -1) {
printf("error while receiving the server response, please check with the problem\n");
exit(-1);
}
printf("%s\n",risposta_codice.risp);
}
/* metodo cancella*/
void cancella(){
int i,j;
char preno[5];
response_msg_canc risposta;
request_message_canc.mtype = 3;
request_message_canc.req.service_code = 3;
printf("Inserire codice prenotazione da cancellare:");
scanf("%s",preno);
strcpy(request_message_canc.req.codice,preno);
request_message_canc.req.response_channel = my_id_coda;
printf("response channel has id %d\n",my_id_coda);
if ( msgsnd(id_coda, &request_message_canc, sizeof(request_canc), FLAG) == -1 ) {
printf("cannot send request to the server\n");
exit(-1);
}
if ( msgrcv(my_id_coda, &risposta,sizeof(response_msg_canc), 3, FLAG) == -1) {
printf("error while receiving the server response, please check with the problem\n");
exit(-1);
}
risposta.risp[255]='\0';
printf("%s\n",risposta.risp);
}
Server.c
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/signal.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/shm.h>
#include <math.h>
#include<stdlib.h>
#include<string.h>
#include <sys/sem.h>
#define ERRORE -1
#define FLAG 0
#define SIZE 128
#define R 3
#define C 5
#define CINEMA "prenotazione"
#define STDOUT 1
typedef struct {
int response_channel;
int service_code;
} request;
typedef struct {
int response_channel;
int service_code;
char codice[5];
} request_canc;
typedef struct {
long mtype;
request_canc req;
} request_msg_canc;
typedef struct {
long mtype;
request req;
} request_msg;
typedef struct {
long mtype;
int posti[R][C];
} response_msg;
typedef struct {
char pren[6];
} codice;
typedef struct {
long mtype;
char risp[256];
} response_msg_canc;
/* strutture per prenota*/
typedef struct {
int response_channel;
int service_code;
int posti[R][C];
} request_pren;
typedef struct {
long mtype;
request_pren req;
} request_msg_pren;
//**********************//
codice prenotazioni[R][C];
int id_coda, ret;
long key = 50;
request_msg request_message;
request_msg *new_message;
pthread_t tid;
response_msg response_message;
request_msg_canc request_mes_canc;
request_msg_canc *new_mes_canc;
request_msg_pren request_mes_pren;
request_msg_pren *new_mes_pren;
int ds_shm;
int id_sem;
void ito(int,char*);
int crea_init_sem(key_t,int);
void elimina_sem(int);
int sem_wait(int);
int sem_signal(int);
void visualizza(request_msg*);
void prenota (request_msg_pren*);
void cancella (request_msg_canc*);
main(int argc, char *argv[]) {
codice prenot[3][5];
int sd,size,occ,i,j,status,eli;
long chiave=10,chiave_sem=50;
char buff[5],app[5],*p,*scorri_mem;
sd=open(CINEMA,O_RDONLY);
ds_shm = shmget(chiave,sizeof(codice[3][5]),IPC_CREAT|0666);
if( ds_shm == -1) {printf("Errore nella chiamata shmget\n"); exit(1);}
p = shmat(ds_shm, 0, SHM_W);
if(p==(char*)-1){printf("Errore nella chiamata shmat\n"); exit(1);}
scorri_mem=p;
for(i=0;i<R;i++){
for(j=0;j<C;j++){
size=read(sd,buff,5);
memcpy((char*)app,(char*)buff,size);
strncpy(scorri_mem,app,5);
*(scorri_mem+5)='\0';
printf("%s",scorri_mem);
scorri_mem+=6;
}
}
id_sem=crea_init_sem(chiave_sem,1);
id_coda = msgget(key, IPC_CREAT|IPC_EXCL|0666);
if( id_coda == -1){
id_coda = msgget(key, IPC_CREAT|0666);
ret = msgctl(id_coda,IPC_RMID,0);
id_coda = msgget(key, IPC_CREAT|IPC_EXCL|0666);
if( id_coda == -1 ){
printf("cannot install server queue, please check with the problem\n");
exit(-1);
}
}
//close(sd);
if(fork()==0){
while(1) {
if ( msgrcv(id_coda, &request_message, sizeof(request), 1, FLAG) == -1) {
printf("message receive error, please check with the problem\n");
}
else {
new_message = malloc(sizeof(request_msg));
if(!new_message){
printf("cannot allocate new request message buffer \n");
exit(-1);
}
memcpy((char*)new_message,(char*)&request_message,sizeof(request_msg));
if( pthread_create(&tid, NULL, visualizza, (void *)new_message) != 0){
printf("cannot create new thread \n");
exit(-1);
}
}
}/* end while */
}/* end fork*/
// prenota
if(fork()==0){while(1) {
if ( msgrcv(id_coda, &request_mes_pren, sizeof(request_pren), 2, FLAG) == -1) {
printf("message receive error, please check with the problem\n");
}
else {
new_mes_pren = malloc(sizeof(request_msg_pren));
if(!new_mes_pren){
printf("cannot allocate new request message buffer \n");
exit(-1);
}
memcpy((char*)new_mes_pren,(char*)&request_mes_pren,sizeof(request_pren));
if( pthread_create(&tid, NULL, prenota, (void *)new_mes_pren ) != 0){
printf("cannot create new thread \n");
exit(-1);
}
}
}/* end while */
}/* end fork*/
// cancella
if(fork()==0){ while(1) {
if ( msgrcv(id_coda, &request_mes_canc, sizeof(request_canc), 3, FLAG) == -1) {
printf("message receive error, please check with the problem\n");
}
else {
new_mes_canc = malloc(sizeof(request_msg_canc));
if(!new_mes_canc){
printf("cannot allocate new request message buffer \n");
exit(-1);
}
memcpy((char*)new_mes_canc,(char*)&request_mes_canc,sizeof(request_canc));
if( pthread_create(&tid, NULL, cancella, (void *)new_mes_canc ) != 0){
printf("cannot create new thread \n");
exit(-1);
}
}
}/* end while */
}/* end fork*/
wait(&status);
eli=msgctl(ds_shm,IPC_RMID,NULL);
if(eli == -1) printf("Errore nella chiamata msgctl");
elimina_sem(id_sem);
}
void visualizza(request_msg *request_message){
int status,i,j,occ;
char *p;
printf("asked service of type %d - response channel is %d\n", request_message->req.service_code,request_message->req.response_channel);
response_message.mtype = 1;
p = shmat(ds_shm, 0, SHM_R);
if(p==(char*)-1){printf("Errore nella chiamata shmat\n"); exit(1);}
for(i=0;i<R;i++){
for(j=0;j<C;j++){
strncpy(prenotazioni[i][j].pren,p,6);
p+=6;
}
}
for(i=0;i<R;i++)
for(j=0;j<C;j++){
occ=strncmp(prenotazioni[i][j].pren,"0000",4);
if(occ==0) response_message.posti[i][j]=0;
else response_message.posti[i][j]=1;
}
if ( msgsnd(request_message->req.response_channel, &response_message, sizeof(response_msg), FLAG) == -1 ) {
printf("cannot return response to the client\n");
exit(-1);
}
i=shmdt(p);
free(request_message);
status = 0;
pthread_exit((void *)&status);
}
void prenota (request_msg_pren *request_mes_pren){
response_msg_canc risposta_pren;
int status,occ,i,j,dist,trovato,cod,sd,doppio,conta=0;
char *p,c[6],*scorri_mem;
risposta_pren.mtype = 2;
sem_wait(id_sem);
p = shmat(ds_shm, 0, SHM_R);
if(p==(char*)-1){printf("Errore nella chiamata shmat\n"); exit(1);}
scorri_mem=p;
for(i=0;i<R;i++){
for(j=0;j<C;j++){
strncpy(prenotazioni[i][j].pren,scorri_mem,6);
scorri_mem+=6;
}
}
scorri_mem=p;
for(i=0;i<R;i++)
for(j=0;j<C;j++){
occ=strncmp(prenotazioni[i][j].pren,"0000",4);
if(occ==0) response_message.posti[i][j]=0;
else response_message.posti[i][j]=1;
}
for(i=0;i<R;i++)
for(j=0;j<C;j++){
if(request_mes_pren->req.posti[i][j]==1)
if(request_mes_pren->req.posti[i][j]==response_message.posti[i][j])
trovato=1;
if(request_mes_pren->req.posti[i][j]==0) conta++;
}
i=shmdt(p);
p = shmat(ds_shm, 0, SHM_R);
scorri_mem=p;
if(trovato==1 || conta==(R*C)){ strcpy(risposta_pren.risp,"prenotazione non effettuata");}
else {
do{
cod=random();
ito(cod,c);
doppio=0;
for(i=0;i<R;i++){
for(j=0;j<C;j++){
occ=strncmp(prenotazioni[i][j].pren,c,4);
if(occ==0) {doppio=1;break;}
}
}
}while(doppio==1);
strcpy(risposta_pren.risp,"prenotazione effettuata con codice: ");
strncat(risposta_pren.risp,c,6);
i=shmdt(p);
p = shmat(ds_shm, 0, SHM_W);
scorri_mem=p;
for(i=0;i<R;i++){
for(j=0;j<C;j++){
if(request_mes_pren->req.posti[i][j]==1){
strncpy(scorri_mem,c,6);
if(j<(C-1)) *(scorri_mem+4)=' ';
else (*(scorri_mem+4)='\n');
}
*(scorri_mem+5)='\0';
scorri_mem+=6;
}
}
}
close(STDOUT);
scorri_mem=p;
sd=open(CINEMA,O_RDWR|O_TRUNC);
dup(sd);
for(i=0;i<R;i++){
for(j=0;j<C;j++){
write (sd,scorri_mem,5);
scorri_mem+=6;
}
}
//fflush(STDOUT);
if ( msgsnd(request_mes_pren->req.response_channel, &risposta_pren, sizeof(response_msg_canc), FLAG) == -1 ) {
printf("cannot return response to the client\n");
exit(-1);
}
close(sd);
sem_signal(id_sem);
free(request_mes_pren);
status = 0;
pthread_exit((void *)&status);
}
void cancella (request_msg_canc *request_mes_canc){
response_msg_canc risposta;
int status,occ,i,j,dist,sd,trovato=0;
char *p,*scorri_mem;
risposta.mtype = 3;
p = shmat(ds_shm, 0, SHM_W);
if(p==(char*)-1){printf("Errore nella chiamata shmat\n"); exit(1);}
scorri_mem=p;
for(i=0;i<R;i++)
for(j=0;j<C;j++){
occ=strncmp(scorri_mem,request_mes_canc->req.codice,4);
if(occ==0) {
trovato++;
if(j<C-1){ strcpy(scorri_mem,"0000 \0");}
else { strcpy(scorri_mem,"0000\n");}
}
scorri_mem+=6;
}
i=shmdt(p);
sd=open(CINEMA,O_RDWR|O_TRUNC);
p = shmat(ds_shm, 0, SHM_R);
scorri_mem=p;
for(i=0;i<R;i++){
for(j=0;j<C;j++){
write(sd,scorri_mem,5);
scorri_mem+=6;
}
}
if(trovato>0) strcpy(risposta.risp,"cancellazione effettuata");
else { strcpy(risposta.risp,"codice inesistente");}
if ( msgsnd(request_mes_canc->req.response_channel, &risposta, sizeof(response_msg_canc), FLAG) == -1 ) {
printf("cannot return response to the client\n");
exit(-1);
}
close(sd);
i=shmdt(p);
free(request_mes_canc);
status = 0;
pthread_exit((void *)&status);
}
void ito(int casuale,char c[]){
div_t divisione;
int i,k,j,num=1;
if(casuale > 999999999) k=9;
else k=8;
for(j=0;j<k;j++)
num=num*10;
for(i=0;i<4;i++){
divisione= div(casuale,num);
switch(divisione.quot) {
case 0: c[i]='0'; break;
case 1: c[i]='1'; break;
case 2: c[i]='2'; break;
case 3: c[i]='3'; break;
case 4: c[i]='4'; break;
case 5: c[i]='5'; break;
case 6: c[i]='6'; break;
case 7: c[i]='7'; break;
case 8: c[i]='8'; break;
case 9: c[i]='9'; break;
}
casuale=divisione.rem;
num=num/10;;
}
c[4]=' ';
c[5]='\0';
return ;
}
int crea_init_sem(key_t chiave, int val)
{
int sem;
sem=semget(chiave,1,IPC_CREAT|0666);
if (sem==-1)
{
printf("Impossibile creare il semaforo\n");
exit(1);
}
semctl(sem,0,SETVAL,val);
return(sem);
}
void elimina_sem(int id_sem)
{
if(semctl(id_sem,IPC_RMID,0)==-1)
{
printf("Impossibile eliminare il semaforo\n");
exit(1);
}
}
int sem_wait(int sem)
{
struct sembuf operazione[1]={{0,-1,0}};
return semop(sem,operazione,1);
}
int sem_signal(int sem)
{
struct sembuf operazione[1]={{0,+1,0}};
return semop(sem,operazione,1);
}
And thi is the crash
*** stack smashing detected ***: ./Client
======= Memory map: ========
uca@luca-8:~/Scrivania/tesina/ufficial$ ./Client
1 visualizza;
2 prenota;
3 cancella;
4 esci;
2
Digitare il numero di posti che si vuole prenotare compreso tra 1 e 15
2
Digitare il 1° posto nel formato 'fila poltrona' con fila compresa tra 1..3 e poltrona tra 1..5
3 1
Digitare il 2° posto nel formato 'fila poltrona' con fila compresa tra 1..3 e poltrona tra 1..5
3 2
00000
00000
11000
prenotazione effettuata con codice: 1804
*** stack smashing detected ***: ./Client terminated
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(__fortify_fail+0x45)[0x9408d5]
/lib/i386-linux-gnu/libc.so.6(+0xe7887)[0x940887]
./Client[0x8048c8d]
./Client[0x80487aa]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3)[0x872113]
./Client[0x80485c1]
======= Memory map: ========
0019d000-0019e000 r-xp 00000000 00:00 0 [vdso]
00525000-00541000 r-xp 00000000 08:01 2360250 /lib/i386-linux-gnu/libgcc_s.so.1
00541000-00542000 r--p 0001b000 08:01 2360250 /lib/i386-linux-gnu/libgcc_s.so.1
00542000-00543000 rw-p 0001c000 08:01 2360250 /lib/i386-linux-gnu/libgcc_s.so.1
00859000-009cf000 r-xp 00000000 08:01 2360229 /lib/i386-linux-gnu/libc-2.13.so
009cf000-009d1000 r--p 00176000 08:01 2360229 /lib/i386-linux-gnu/libc-2.13.so
009d1000-009d2000 rw-p 00178000 08:01 2360229 /lib/i386-linux-gnu/libc-2.13.so
009d2000-009d5000 rw-p 00000000 00:00 0
00b18000-00b36000 r-xp 00000000 08:01 2360216 /lib/i386-linux-gnu/ld-2.13.so
00b36000-00b37000 r--p 0001d000 08:01 2360216 /lib/i386-linux-gnu/ld-2.13.so
00b37000-00b38000 rw-p 0001e000 08:01 2360216 /lib/i386-linux-gnu/ld-2.13.so
08048000-0804a000 r-xp 00000000 08:01 5636693 /home/luca/Scrivania/tesina/ufficial/Client
0804a000-0804b000 r--p 00001000 08:01 5636693 /home/luca/Scrivania/tesina/ufficial/Client
0804b000-0804c000 rw-p 00002000 08:01 5636693 /home/luca/Scrivania/tesina/ufficial/Client
0809c000-080bd000 rw-p 00000000 00:00 0 [heap]
b78b1000-b78b2000 rw-p 00000000 00:00 0
b78bf000-b78c3000 rw-p 00000000 00:00 0
bf8d0000-bf8f1000 rw-p 00000000 00:00 0 [stack]
Annullato
luca@luca-8:~/Scrivania/tesina/ufficial$
| 3 |
5,602,383 | 04/09/2011 01:50:24 | 1,104,408 | 10/26/2010 08:55:12 | 79 | 1 | Wanna print data in TreeView in C# | i have developed a Project and i wanna to print the data in the Treeview when the User Click on the Print Button
any one have any idea how i can do it ? | c# | null | null | null | null | 04/09/2011 10:11:15 | not a real question | Wanna print data in TreeView in C#
===
i have developed a Project and i wanna to print the data in the Treeview when the User Click on the Print Button
any one have any idea how i can do it ? | 1 |
9,971,549 | 04/02/2012 06:03:06 | 902,597 | 08/19/2011 14:18:19 | 15 | 0 | AppFuse Integration with EXTJS | I want to integrate appfuse with EXt-JS. How can I proceed. Whether it is possible.
Has anyone tried, is it so kindly provide me the procedure how to proceed.
thanks and regards, rajNaveen | java | javascript | extjs | struts2 | appfuse | 04/02/2012 19:39:18 | not a real question | AppFuse Integration with EXTJS
===
I want to integrate appfuse with EXt-JS. How can I proceed. Whether it is possible.
Has anyone tried, is it so kindly provide me the procedure how to proceed.
thanks and regards, rajNaveen | 1 |
8,643,032 | 12/27/2011 09:31:06 | 1,074,762 | 12/01/2011 05:05:14 | 1 | 0 | How can I save the input values of the stringfieldeditor of preference page? | I have created one preference page where there are stringfieldeditor.
Whenever user give some input on any fieldeditor,I want to save those in predference page class.How can I do that? | java | eclipse | null | null | null | null | open | How can I save the input values of the stringfieldeditor of preference page?
===
I have created one preference page where there are stringfieldeditor.
Whenever user give some input on any fieldeditor,I want to save those in predference page class.How can I do that? | 0 |
5,936,775 | 05/09/2011 12:18:56 | 661,965 | 03/16/2011 06:28:08 | 22 | 0 | How to display a combo box with database values | Hai,
i have a combo box and i have to display the combo box values as which are already stored in database | php | javascript | html | null | null | 05/21/2012 16:18:54 | not a real question | How to display a combo box with database values
===
Hai,
i have a combo box and i have to display the combo box values as which are already stored in database | 1 |
10,880,755 | 06/04/2012 11:49:16 | 393,639 | 07/16/2010 08:51:27 | 410 | 27 | Why my external DB is not accessible in Android 4? | @Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory){
File externalFilesDir = Environment.getExternalStorageDirectory();
if(externalFilesDir == null)
return null;
File dbFile = new File(externalFilesDir, SQLiteHelper.DATABASE_NAME);
return SQLiteDatabase.openDatabase(dbFile.getAbsolutePath(), null, SQLiteDatabase.CREATE_IF_NECESSARY);
}
I use the above code to write my db file into the external storage. So it is saved at `/mnt/sdcard/`. When i try it in Android 2.3.5 it works. But with Android 4 it do not work. But still it do not give me any errors. | android | null | null | null | null | null | open | Why my external DB is not accessible in Android 4?
===
@Override
public SQLiteDatabase openOrCreateDatabase(String name, int mode, CursorFactory factory){
File externalFilesDir = Environment.getExternalStorageDirectory();
if(externalFilesDir == null)
return null;
File dbFile = new File(externalFilesDir, SQLiteHelper.DATABASE_NAME);
return SQLiteDatabase.openDatabase(dbFile.getAbsolutePath(), null, SQLiteDatabase.CREATE_IF_NECESSARY);
}
I use the above code to write my db file into the external storage. So it is saved at `/mnt/sdcard/`. When i try it in Android 2.3.5 it works. But with Android 4 it do not work. But still it do not give me any errors. | 0 |
11,548,884 | 07/18/2012 19:28:57 | 1,535,866 | 07/18/2012 19:03:40 | 1 | 0 | Write a packet to a socket, preferably using socket_write() | The script I am attempting to write emulates a Minecraft server interface, but without any functionality. The problem I am having is that I cannot make the correct packets; I know what they should be, as per http://mc.kev009.com/Protocol. I have to keep it in PHP (sorry) and I don't have the IP/hostname of the connecting client. I have a socket
//Declare Variables
$host = "localhost";
$port = 25565;
$name = "MC-Server";
$max_slots = 0; //O will render as '???' in MC client
$used_slots = 0;
$kick_message = "This server has been shutdown.";
$number_of_connections = 10;
//Don't timeout
set_time_limit(0);
//Create hex values
$hex_kick_message = bin2hex($kick_message);
$hex_name = bin2hex($name);
$hex_used_slots = bin2hex($used_slots);
$hex_max_slots = bin2hex($max_slots);
//Create Socket and Bind
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or die("Failed to create socket. \n");
$result = socket_bind($socket, $host, $port) or die("Failed to bind socket. " . socket_strerror(socket_last_error()) . "\n");
//Setup Listener
$result = socket_listen($socket, 0) or die("Failed to create listener. \n");
//Needs to recieve more than 1 packet
$i = 0;
while (i < $number_of_connections){
//Create 'Spawn' socket for connections made
$spawn = socket_accept($socket) or die("Failed to accept incoming connection. \n" );
//Read and Parse Client input
$input = socket_read($spawn, 1024) or die("Failed to read client input. \n");
//Deal with requests
if ($input = '\xFE'){ //Server Ping
socket_write($spawn, '\xFE\xA7\x' . $hex_name . '\xA7' . $hex_used_slots . '\xA7' . $hex_max_slots);
} elseif ($input = '\x02'){ //Handshake
socket_write($spawn, '\x02\xA7\x2D');
} elseif ($input = '\x01'){ //Login Request
socket_write($spawn, '\xFF\xA7\x' . $hex_kick_message);
}
socket_close($spawn);
$i = $i++;
}
//Close the spawn socket
socket_close($socket); | php | sockets | minecraft | null | null | 07/20/2012 01:56:07 | not a real question | Write a packet to a socket, preferably using socket_write()
===
The script I am attempting to write emulates a Minecraft server interface, but without any functionality. The problem I am having is that I cannot make the correct packets; I know what they should be, as per http://mc.kev009.com/Protocol. I have to keep it in PHP (sorry) and I don't have the IP/hostname of the connecting client. I have a socket
//Declare Variables
$host = "localhost";
$port = 25565;
$name = "MC-Server";
$max_slots = 0; //O will render as '???' in MC client
$used_slots = 0;
$kick_message = "This server has been shutdown.";
$number_of_connections = 10;
//Don't timeout
set_time_limit(0);
//Create hex values
$hex_kick_message = bin2hex($kick_message);
$hex_name = bin2hex($name);
$hex_used_slots = bin2hex($used_slots);
$hex_max_slots = bin2hex($max_slots);
//Create Socket and Bind
$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or die("Failed to create socket. \n");
$result = socket_bind($socket, $host, $port) or die("Failed to bind socket. " . socket_strerror(socket_last_error()) . "\n");
//Setup Listener
$result = socket_listen($socket, 0) or die("Failed to create listener. \n");
//Needs to recieve more than 1 packet
$i = 0;
while (i < $number_of_connections){
//Create 'Spawn' socket for connections made
$spawn = socket_accept($socket) or die("Failed to accept incoming connection. \n" );
//Read and Parse Client input
$input = socket_read($spawn, 1024) or die("Failed to read client input. \n");
//Deal with requests
if ($input = '\xFE'){ //Server Ping
socket_write($spawn, '\xFE\xA7\x' . $hex_name . '\xA7' . $hex_used_slots . '\xA7' . $hex_max_slots);
} elseif ($input = '\x02'){ //Handshake
socket_write($spawn, '\x02\xA7\x2D');
} elseif ($input = '\x01'){ //Login Request
socket_write($spawn, '\xFF\xA7\x' . $hex_kick_message);
}
socket_close($spawn);
$i = $i++;
}
//Close the spawn socket
socket_close($socket); | 1 |
3,192,024 | 07/07/2010 04:58:51 | 385,155 | 07/07/2010 04:58:51 | 1 | 0 | convert as rouund values [String(Math.round(65/30))] | String(Math.round(values/30))..am having values 65.i want the answer for that 3 not 2.1...
wat is the solution | python | null | null | null | null | 06/22/2012 11:50:22 | not a real question | convert as rouund values [String(Math.round(65/30))]
===
String(Math.round(values/30))..am having values 65.i want the answer for that 3 not 2.1...
wat is the solution | 1 |
5,631,086 | 04/12/2011 06:12:23 | 428,705 | 08/23/2010 18:23:20 | 1,153 | 86 | Getting X-Mailer attribute in php imap | how I can get X-Mailer attribute in php imap lib ?
I can't find any fetch function for attribute http://php.net/manual/en/function.imap-fetchheader.php | php | imap | null | null | null | null | open | Getting X-Mailer attribute in php imap
===
how I can get X-Mailer attribute in php imap lib ?
I can't find any fetch function for attribute http://php.net/manual/en/function.imap-fetchheader.php | 0 |
6,264,392 | 06/07/2011 11:17:09 | 787,335 | 06/07/2011 11:13:10 | 1 | 0 | using html for an image | I have an image for adding files(is also add button) and I want it to be disabled(or say make it grey) when they are no files.and when they are files to be added it should enable the user to add files. | html | null | null | null | null | 06/07/2011 11:29:17 | not a real question | using html for an image
===
I have an image for adding files(is also add button) and I want it to be disabled(or say make it grey) when they are no files.and when they are files to be added it should enable the user to add files. | 1 |
4,407,117 | 12/10/2010 08:58:04 | 278,288 | 02/21/2010 20:51:22 | 40 | 1 | Filtering a sub set of (potentially) 1.000.000+ items | I have a large dataset with possibly over a million entries. All items have an assigned time stamp and items are added to the set at runtime (usually, but not always, with a newer time stamp).
I need to show a sub set of this data given a certain time range. This time range is usually quite small compared to the total data set, i.e. of the 1.000.000+ items not more than about 1000 are in that given time range. This time range moves at a constant pace, e.g. every second the time range is moved by one second.
Additionally, the user may adjust the time range at any time ("move" through the data set) or set additional filters (e.g. filter by some text).
So far I wasn't worried about performance, trying to get the other things right, and only worked with smaller test sets. I am not quite sure how to tackle this problem efficiently and would be glad for every input. Thanks.
Edit: Used language is C# 4. | c# | .net | algorithm | search | filtering | null | open | Filtering a sub set of (potentially) 1.000.000+ items
===
I have a large dataset with possibly over a million entries. All items have an assigned time stamp and items are added to the set at runtime (usually, but not always, with a newer time stamp).
I need to show a sub set of this data given a certain time range. This time range is usually quite small compared to the total data set, i.e. of the 1.000.000+ items not more than about 1000 are in that given time range. This time range moves at a constant pace, e.g. every second the time range is moved by one second.
Additionally, the user may adjust the time range at any time ("move" through the data set) or set additional filters (e.g. filter by some text).
So far I wasn't worried about performance, trying to get the other things right, and only worked with smaller test sets. I am not quite sure how to tackle this problem efficiently and would be glad for every input. Thanks.
Edit: Used language is C# 4. | 0 |
4,128,982 | 11/08/2010 23:00:43 | 149,080 | 08/01/2009 21:00:20 | 1,395 | 22 | Rails finding the Domain Name from a domain? | I have the following:
domain = email.split("@").last
Which takes an EMAIL like (steve.jobs@apple.com) and returns apple.com
I would like to know how to get just apple just the domain name, without the extension. Ideas? | ruby-on-rails | ruby-on-rails-3 | null | null | null | null | open | Rails finding the Domain Name from a domain?
===
I have the following:
domain = email.split("@").last
Which takes an EMAIL like (steve.jobs@apple.com) and returns apple.com
I would like to know how to get just apple just the domain name, without the extension. Ideas? | 0 |
4,475,985 | 12/18/2010 00:57:28 | 392,176 | 07/15/2010 00:07:52 | 11 | 4 | Telerik MVC Extensions: Grid: During Ajax binding calls why is so much data posting back in the query string? | I am using Ajax binding with the Grid and ran into a problem where ASP.NET MVC was throwing a *HttpRequestValidationException* when I attempted an operation on the grid that invoked the Ajax call (like sorting).
Using Fiddler I was able to determine my browser was attempting to post back my entire model in the query string and there were some characters that would have triggered ASP.NET's request validation.
I was able to work around this by simply adding
[ValidateInput(false)]
to my controller action.
I'm wondering **why was the grid sending back so much data?** And **is this a symptom of a bug in my code or Telerik's?**
Here is what I saw in Fiddler (note the extremely long query string, even though the HTTP verb is "POST").
POST http://127.0.0.1:52601/MyController/DatabindGrid?Items=System.Collections.ObjectModel.Collection%601%5BPMyNamespace.Data.ViewEntities.Alert%5D&DetailsClientUrl=&GetJsonUrl=%2FMonitor%2FGetGridJson&ViewName=&CurrentItem=&PageTitle=My%20Web%20Page&CopyrightText=Copyright%20%26%23x00A9%3B%202004-2010%20My%20Company%20Corporation&BrowserCapabilities=&OemName=&UiVersion=20101123 HTTP/1.1
Referer: http://ipv4.fiddler:52601/MyController/MyAction
Content-Type: application/x-www-form-urlencoded
X-Requested-With: XMLHttpRequest
Accept: text/plain, */*; q=0.01
Accept-Language: en-US
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Host: 127.0.0.1:52601
Content-Length: 56
Connection: Keep-Alive
Pragma: no-cache
Cookie: ASP.NET_SessionId=bvgwuno4bounqio2werepkw4; .ASPXAUTH=612E18BB916F720D13A0F0D1695A86079B94DFE94A3BF5A9A8F19E35A37AE987282B7B684201C112CEC6081181E3D1C52C5517A66D9158E4CF83C1C3F523EE32FF783BD2E3B6E0A42A35E1874E63BA76C7735F9E8ABBA4E58BF61EB29DA03789E07A201A1BA9E7B85F941516ED7EA26E3E8E1E65D0836F39A109201E357EE97478D1A359B3FB4B4AD4C64A02A0CE7BBB39DC8FE1F73B179F284A14CF55D9C67D
page=1&size=10&orderBy=LocationName-asc&groupBy=&filter=
| asp.net-mvc | telerik-grid | telerik-mvc | null | null | null | open | Telerik MVC Extensions: Grid: During Ajax binding calls why is so much data posting back in the query string?
===
I am using Ajax binding with the Grid and ran into a problem where ASP.NET MVC was throwing a *HttpRequestValidationException* when I attempted an operation on the grid that invoked the Ajax call (like sorting).
Using Fiddler I was able to determine my browser was attempting to post back my entire model in the query string and there were some characters that would have triggered ASP.NET's request validation.
I was able to work around this by simply adding
[ValidateInput(false)]
to my controller action.
I'm wondering **why was the grid sending back so much data?** And **is this a symptom of a bug in my code or Telerik's?**
Here is what I saw in Fiddler (note the extremely long query string, even though the HTTP verb is "POST").
POST http://127.0.0.1:52601/MyController/DatabindGrid?Items=System.Collections.ObjectModel.Collection%601%5BPMyNamespace.Data.ViewEntities.Alert%5D&DetailsClientUrl=&GetJsonUrl=%2FMonitor%2FGetGridJson&ViewName=&CurrentItem=&PageTitle=My%20Web%20Page&CopyrightText=Copyright%20%26%23x00A9%3B%202004-2010%20My%20Company%20Corporation&BrowserCapabilities=&OemName=&UiVersion=20101123 HTTP/1.1
Referer: http://ipv4.fiddler:52601/MyController/MyAction
Content-Type: application/x-www-form-urlencoded
X-Requested-With: XMLHttpRequest
Accept: text/plain, */*; q=0.01
Accept-Language: en-US
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)
Host: 127.0.0.1:52601
Content-Length: 56
Connection: Keep-Alive
Pragma: no-cache
Cookie: ASP.NET_SessionId=bvgwuno4bounqio2werepkw4; .ASPXAUTH=612E18BB916F720D13A0F0D1695A86079B94DFE94A3BF5A9A8F19E35A37AE987282B7B684201C112CEC6081181E3D1C52C5517A66D9158E4CF83C1C3F523EE32FF783BD2E3B6E0A42A35E1874E63BA76C7735F9E8ABBA4E58BF61EB29DA03789E07A201A1BA9E7B85F941516ED7EA26E3E8E1E65D0836F39A109201E357EE97478D1A359B3FB4B4AD4C64A02A0CE7BBB39DC8FE1F73B179F284A14CF55D9C67D
page=1&size=10&orderBy=LocationName-asc&groupBy=&filter=
| 0 |
5,127,857 | 02/26/2011 15:46:44 | 635,638 | 02/26/2011 15:46:44 | 1 | 0 | Wget command that returns all webpages on a webserver | Lets say we have a website: www.example.com/
with the following pages:
www.example.com/page1
www.example.com/*unknown*
www.example.com/*unknown*
Is there a Wget command that would produce the following output:
page1
page2
page3
How would this command change if the website structure was:
www.example.com/xxxx/page1
www.example.com/xxxx/page2
www.example.com/xxxx/page3
Essentially I have a server ip address and would like to be able to list all the pages held on the server, to see if there are any I am interested in to download.
For instance I can do "wget -r www.example.com/page1" and I want to know if there are any other directories (page2, page3 - etc) that I might be interested in.
I have researched the --spider command and others, but with no joy.
Appreciate any help given
Ed | wget | directories | null | null | null | 02/26/2011 17:34:47 | off topic | Wget command that returns all webpages on a webserver
===
Lets say we have a website: www.example.com/
with the following pages:
www.example.com/page1
www.example.com/*unknown*
www.example.com/*unknown*
Is there a Wget command that would produce the following output:
page1
page2
page3
How would this command change if the website structure was:
www.example.com/xxxx/page1
www.example.com/xxxx/page2
www.example.com/xxxx/page3
Essentially I have a server ip address and would like to be able to list all the pages held on the server, to see if there are any I am interested in to download.
For instance I can do "wget -r www.example.com/page1" and I want to know if there are any other directories (page2, page3 - etc) that I might be interested in.
I have researched the --spider command and others, but with no joy.
Appreciate any help given
Ed | 2 |
5,036,780 | 02/18/2011 01:29:45 | 344,491 | 05/18/2010 20:55:12 | 25 | 1 | mysql - show profiles doesn't show me a query | Hallo guys. Someone can explain me why show profiles doesn't show me a query?
This is the output of my attempt:
mysql> set profiling = 1;
Query OK, 0 rows affected (0.00 sec)
mysql> use slow;
Database changed
mysql> show profiles;
+----------+------------+-------------------+
| Query_ID | Duration | Query |
+----------+------------+-------------------+
| 1 | 0.00024275 | SELECT DATABASE() |
+----------+------------+-------------------+
1 row in set (0.00 sec)
mysql> select count(*) from people;
+----------+
| count(*) |
+----------+
| 500000 |
+----------+
1 row in set (0.00 sec)
mysql> show profiles;
+----------+------------+-----------------------------+
| Query_ID | Duration | Query |
+----------+------------+-----------------------------+
| 1 | 0.00024275 | SELECT DATABASE() |
| 2 | 0.00030825 | select count(*) from people |
+----------+------------+-----------------------------+
2 rows in set (0.00 sec)
mysql> select
-> concat_ws('-',min(age(dob)),max(age(dob))) as year
-> count(*) as total
-> from people
-> group by if(age(dob)=0,1,ceil(age(dob)/5))
-> ;
+---------+-------+
| years | total |
+---------+-------+
| 0-5 | 29789 |
| 6-10 | 24847 |
| 11-15 | 24670 |
| 16-20 | 24764 |
| 21-25 | 24751 |
| 26-30 | 24753 |
| 31-35 | 24817 |
| 36-40 | 24505 |
| 41-45 | 24540 |
| 46-50 | 24745 |
| 51-55 | 24575 |
| 56-60 | 24441 |
| 61-65 | 24953 |
| 66-70 | 24760 |
| 71-75 | 24586 |
| 76-80 | 24647 |
| 81-85 | 24819 |
| 86-90 | 24879 |
| 91-95 | 24683 |
| 96-100 | 24829 |
| 101-101 | 647 |
+---------+-------+
21 rows in set (31.42 sec)
mysql> show profiles;
+----------+------------+-----------------------------+
| Query_ID | Duration | Query |
+----------+------------+-----------------------------+
| 1 | 0.00024275 | SELECT DATABASE() |
| 2 | 0.00030825 | select count(*) from people |
+----------+------------+-----------------------------+
2 rows in set (0.00 sec)
Thanks in advance. | mysql | null | null | null | null | null | open | mysql - show profiles doesn't show me a query
===
Hallo guys. Someone can explain me why show profiles doesn't show me a query?
This is the output of my attempt:
mysql> set profiling = 1;
Query OK, 0 rows affected (0.00 sec)
mysql> use slow;
Database changed
mysql> show profiles;
+----------+------------+-------------------+
| Query_ID | Duration | Query |
+----------+------------+-------------------+
| 1 | 0.00024275 | SELECT DATABASE() |
+----------+------------+-------------------+
1 row in set (0.00 sec)
mysql> select count(*) from people;
+----------+
| count(*) |
+----------+
| 500000 |
+----------+
1 row in set (0.00 sec)
mysql> show profiles;
+----------+------------+-----------------------------+
| Query_ID | Duration | Query |
+----------+------------+-----------------------------+
| 1 | 0.00024275 | SELECT DATABASE() |
| 2 | 0.00030825 | select count(*) from people |
+----------+------------+-----------------------------+
2 rows in set (0.00 sec)
mysql> select
-> concat_ws('-',min(age(dob)),max(age(dob))) as year
-> count(*) as total
-> from people
-> group by if(age(dob)=0,1,ceil(age(dob)/5))
-> ;
+---------+-------+
| years | total |
+---------+-------+
| 0-5 | 29789 |
| 6-10 | 24847 |
| 11-15 | 24670 |
| 16-20 | 24764 |
| 21-25 | 24751 |
| 26-30 | 24753 |
| 31-35 | 24817 |
| 36-40 | 24505 |
| 41-45 | 24540 |
| 46-50 | 24745 |
| 51-55 | 24575 |
| 56-60 | 24441 |
| 61-65 | 24953 |
| 66-70 | 24760 |
| 71-75 | 24586 |
| 76-80 | 24647 |
| 81-85 | 24819 |
| 86-90 | 24879 |
| 91-95 | 24683 |
| 96-100 | 24829 |
| 101-101 | 647 |
+---------+-------+
21 rows in set (31.42 sec)
mysql> show profiles;
+----------+------------+-----------------------------+
| Query_ID | Duration | Query |
+----------+------------+-----------------------------+
| 1 | 0.00024275 | SELECT DATABASE() |
| 2 | 0.00030825 | select count(*) from people |
+----------+------------+-----------------------------+
2 rows in set (0.00 sec)
Thanks in advance. | 0 |
6,297,559 | 06/09/2011 18:34:03 | 784,543 | 06/05/2011 07:20:06 | 21 | 0 | put result by php in a file and read it by javascript or jquery | i want put result by php in a file (or other thing) and read it by javascript or jquery and print
but php already write in file and i want javascript or jquery recognize new writing.
1. use file is good idea for that?
2. i use buffer in php but my server not support that (its works in xamp but server no)
> for($i=0;i<2000;i++) {
> // this part of code run in 2 minute and output a $result
> print ($result);
> }
i want every $result print in a browser by file or ... but show $result realtime(dont wait for run all code)
example show result in http://duckduckgo.com/?q=jetaudio
| php | javascript | jquery | null | null | 06/09/2011 19:37:01 | not a real question | put result by php in a file and read it by javascript or jquery
===
i want put result by php in a file (or other thing) and read it by javascript or jquery and print
but php already write in file and i want javascript or jquery recognize new writing.
1. use file is good idea for that?
2. i use buffer in php but my server not support that (its works in xamp but server no)
> for($i=0;i<2000;i++) {
> // this part of code run in 2 minute and output a $result
> print ($result);
> }
i want every $result print in a browser by file or ... but show $result realtime(dont wait for run all code)
example show result in http://duckduckgo.com/?q=jetaudio
| 1 |
7,885,177 | 10/25/2011 05:49:42 | 956,853 | 09/21/2011 11:45:27 | 21 | 0 | Restricting the number of items displayed in CheckedListBox in asp.net | I have a checkedlistbox in asp.net web form page as :
<asp:CheckBoxList ID="TagListCheckBox" runat="server" Height="100px" Width = "300px"
style="z-index: 1; left: 63px; top: 146px; position: absolute; TextAlign="Left">
</asp:CheckBoxList>.
and i add items to it dynamically :
protected void TagListButton_Click(object sender, EventArgs e)
{
string[] TagList;
TagList = LhClientClass.client.GetTagList();
foreach (string s in TagList)
{
TagListCheckBox.Items.Add(s);
}
}
But the height of the list box grows as the number of items being added grows.I want to restrict the number of items to be displayed and add a scroll button to it or something.How do I do it? | asp.net | checkboxlist | null | null | null | null | open | Restricting the number of items displayed in CheckedListBox in asp.net
===
I have a checkedlistbox in asp.net web form page as :
<asp:CheckBoxList ID="TagListCheckBox" runat="server" Height="100px" Width = "300px"
style="z-index: 1; left: 63px; top: 146px; position: absolute; TextAlign="Left">
</asp:CheckBoxList>.
and i add items to it dynamically :
protected void TagListButton_Click(object sender, EventArgs e)
{
string[] TagList;
TagList = LhClientClass.client.GetTagList();
foreach (string s in TagList)
{
TagListCheckBox.Items.Add(s);
}
}
But the height of the list box grows as the number of items being added grows.I want to restrict the number of items to be displayed and add a scroll button to it or something.How do I do it? | 0 |
9,757,504 | 03/18/2012 10:14:26 | 252,975 | 01/18/2010 06:58:11 | 104 | 20 | Resharper suggesst but does not perform any refactoring to this code block | In the following method parameters fromDate and toDate's value is never used because it is overwritten in the body before being read.
static void GetDatesFromMonth(string month, ref DateTime fromDate, ref DateTime toDate)
{
DateTime userDateTime = TimeHelper.getUserGMTNow();
DateTime calculatedDate = Convert.ToDateTime(month + " 01," + userDateTime.Year);
toDate = calculatedDate.AddMonths(1).AddSeconds(-1);
fromDate = toDate.AddMonths(-12).AddSeconds(1);
}
I am using this code at many places in my class file.
When I run Resharper on my code it shows this message and unlike all its other suggessions it is not able to correct this code block
can anybody help me to rewrite this method with good coding practice.
| c# | asp.net | resharper | null | null | null | open | Resharper suggesst but does not perform any refactoring to this code block
===
In the following method parameters fromDate and toDate's value is never used because it is overwritten in the body before being read.
static void GetDatesFromMonth(string month, ref DateTime fromDate, ref DateTime toDate)
{
DateTime userDateTime = TimeHelper.getUserGMTNow();
DateTime calculatedDate = Convert.ToDateTime(month + " 01," + userDateTime.Year);
toDate = calculatedDate.AddMonths(1).AddSeconds(-1);
fromDate = toDate.AddMonths(-12).AddSeconds(1);
}
I am using this code at many places in my class file.
When I run Resharper on my code it shows this message and unlike all its other suggessions it is not able to correct this code block
can anybody help me to rewrite this method with good coding practice.
| 0 |
5,864,441 | 05/03/2011 02:20:57 | 672,726 | 03/23/2011 09:33:38 | 6 | 3 | cannot upload file using uploadify | i have problem with uploadify.
on client it's working very nice
but on the hosting (server), the file cannot be uploaded.
the another (button,progress,script for upload) is working,
only file that i want to upload cannot be uploaded.
otherwise i have some process to insert to database the path of file, i put the insert sql query on script for uploading process, the query is working but file cannot be uploaded
my script (upload_file.php):
<?php
$file_id = $_POST['file_id'];
if (!empty($_FILES))
{
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
$destinationFile = "files/". $_FILES['Filedata']['name'];
move_uploaded_file($tempFile,$targetFile);
//additional - query to insert the path
include("database_connection.php");
$query = "insert into file (file_id,path) values ('$file_id','$destinationFile')";
$result = mysql_query($query);
mysql_close();
} ?>
and the javascript:
$('#file').uploadify
({
'uploader' : '/myweb/shockwaves/uploadify.swf',
'script' : '/myweb/process/upload_file.php',
'cancelImg' : '/myweb/images/uploadify/cancel.png',
'folder' : '/myweb/files',
'auto' : true,
'buttonText' : 'Upload',
'scriptData' : {'file_id':'001'}
});
thanks :) | php | jquery | uploadify | null | null | null | open | cannot upload file using uploadify
===
i have problem with uploadify.
on client it's working very nice
but on the hosting (server), the file cannot be uploaded.
the another (button,progress,script for upload) is working,
only file that i want to upload cannot be uploaded.
otherwise i have some process to insert to database the path of file, i put the insert sql query on script for uploading process, the query is working but file cannot be uploaded
my script (upload_file.php):
<?php
$file_id = $_POST['file_id'];
if (!empty($_FILES))
{
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
$destinationFile = "files/". $_FILES['Filedata']['name'];
move_uploaded_file($tempFile,$targetFile);
//additional - query to insert the path
include("database_connection.php");
$query = "insert into file (file_id,path) values ('$file_id','$destinationFile')";
$result = mysql_query($query);
mysql_close();
} ?>
and the javascript:
$('#file').uploadify
({
'uploader' : '/myweb/shockwaves/uploadify.swf',
'script' : '/myweb/process/upload_file.php',
'cancelImg' : '/myweb/images/uploadify/cancel.png',
'folder' : '/myweb/files',
'auto' : true,
'buttonText' : 'Upload',
'scriptData' : {'file_id':'001'}
});
thanks :) | 0 |
4,037,957 | 10/27/2010 21:42:47 | 65,886 | 02/13/2009 04:16:03 | 378 | 2 | [Delphi] What code would let me find the compiled executable's directory? | ...Even when a user opens an application by double-clicking an associated file in a directory that's different from the executable. I've always used ExtractFilePath(Application.EXEName), but this function doesn't work as hoped in this circumstance. | delphi | null | null | null | null | 10/28/2010 15:21:52 | not a real question | [Delphi] What code would let me find the compiled executable's directory?
===
...Even when a user opens an application by double-clicking an associated file in a directory that's different from the executable. I've always used ExtractFilePath(Application.EXEName), but this function doesn't work as hoped in this circumstance. | 1 |
7,891,564 | 10/25/2011 15:17:35 | 974,276 | 10/01/2011 08:11:26 | 45 | 5 | Structuremap, AutoFac, or Ninject, which one is great for a large scale web app? | I have some experience in working by *Structuremap*. And now I'm creating a big and large scale web app (really a social networking site) using *ASP.NET MVC 3*, *Entity Framework 4.1 code-first*, *SqlServer 2008*, via *C#.NET 4*. Which one of *Structuremap*, *AutoFac*, and *Ninject* would you suggest me to use in this case? Performance and easy-of-use is important. Thanks to any help, idea and suggestion. | asp.net-mvc-3 | ninject | structuremap | autofac | large-scale-website | null | open | Structuremap, AutoFac, or Ninject, which one is great for a large scale web app?
===
I have some experience in working by *Structuremap*. And now I'm creating a big and large scale web app (really a social networking site) using *ASP.NET MVC 3*, *Entity Framework 4.1 code-first*, *SqlServer 2008*, via *C#.NET 4*. Which one of *Structuremap*, *AutoFac*, and *Ninject* would you suggest me to use in this case? Performance and easy-of-use is important. Thanks to any help, idea and suggestion. | 0 |
9,773,920 | 03/19/2012 16:25:43 | 753,341 | 05/14/2011 05:48:17 | 2,643 | 82 | Issues with the C Standard Library? | I've read from various sources about there being a lot of bugs, issues and design flaws in the C Standard library. Some to do with string handling functions, some with I/O etc.
Is this true? If so, can anyone list some of the most common known issues? | c | bugs | stdio | standard-library | stdlib | 03/20/2012 05:29:51 | not constructive | Issues with the C Standard Library?
===
I've read from various sources about there being a lot of bugs, issues and design flaws in the C Standard library. Some to do with string handling functions, some with I/O etc.
Is this true? If so, can anyone list some of the most common known issues? | 4 |
8,224,609 | 11/22/2011 09:34:36 | 784,597 | 06/05/2011 09:07:37 | 324 | 2 | How to see the whole file with vi comamnd in Linux | when i did
**grep 'middleware' file.log**
But When i did `vi Filename.log` on the linux server , i could not find my contents
please tell me how to see the whole file with vi file.log | linux | null | null | null | null | 11/22/2011 14:32:25 | off topic | How to see the whole file with vi comamnd in Linux
===
when i did
**grep 'middleware' file.log**
But When i did `vi Filename.log` on the linux server , i could not find my contents
please tell me how to see the whole file with vi file.log | 2 |
8,327,551 | 11/30/2011 14:34:11 | 324,243 | 04/23/2010 13:49:50 | 537 | 12 | Accessing this in jquery ajax success handler | //Save new category information
$('.save_cat').live('click', function() {
cat_id = $(this).attr("id").slice(4);
cat_name = $(this).parent().prev().prev().children('.cat_name_edit').val();
sort_order = $(this).parent().prev().children('.sort_order_edit').val();
$.ajax({ type: 'POST',
url: '../file/category/update_category',
data: { 'cat_id' : cat_id,
'sort_order' : sort_order,
'cat_name' : cat_name},
beforeSend:function(){
//action while loading
},
success:function(data){
alert('hi');
$(this).html("Edit");
},
error:function(){
// failed request; give feedback to user
alert("An unexpected error has occurred. Your category could not be saved.");
},
dataType : 'json'
});
});
In the success handler, I'm attempting to change the html of the clicked element from Save to Edit. If I place this directly below the click handler for .save_cat, it works fine. How can I do this once the request has been successful? | jquery | ajax | null | null | null | null | open | Accessing this in jquery ajax success handler
===
//Save new category information
$('.save_cat').live('click', function() {
cat_id = $(this).attr("id").slice(4);
cat_name = $(this).parent().prev().prev().children('.cat_name_edit').val();
sort_order = $(this).parent().prev().children('.sort_order_edit').val();
$.ajax({ type: 'POST',
url: '../file/category/update_category',
data: { 'cat_id' : cat_id,
'sort_order' : sort_order,
'cat_name' : cat_name},
beforeSend:function(){
//action while loading
},
success:function(data){
alert('hi');
$(this).html("Edit");
},
error:function(){
// failed request; give feedback to user
alert("An unexpected error has occurred. Your category could not be saved.");
},
dataType : 'json'
});
});
In the success handler, I'm attempting to change the html of the clicked element from Save to Edit. If I place this directly below the click handler for .save_cat, it works fine. How can I do this once the request has been successful? | 0 |
6,035,455 | 05/17/2011 18:30:42 | 91,607 | 04/16/2009 12:44:26 | 1,456 | 23 | Customizing Entity Framework Code First | I have a database with a table :
User { UserId, Name, Number, DateCreated, DateEffective, DateEnd, DateReplaced }
I expose the information in the database containing the table through WCF Data Services.
1) the columns : DateCreated, DateEffective, DateEnd, DateReplaced are for keeping historical records and as such should not appear to the clients using my WCF Data Service.
2) also, Whenever a client makes the query :
var q = from u in service.Users select u;
I want it to return only the users who have the DateEnd column set to null.
Is there any way to achieve that functionality ? | c# | .net | wcf | ef-code-first | wcf-data-services | null | open | Customizing Entity Framework Code First
===
I have a database with a table :
User { UserId, Name, Number, DateCreated, DateEffective, DateEnd, DateReplaced }
I expose the information in the database containing the table through WCF Data Services.
1) the columns : DateCreated, DateEffective, DateEnd, DateReplaced are for keeping historical records and as such should not appear to the clients using my WCF Data Service.
2) also, Whenever a client makes the query :
var q = from u in service.Users select u;
I want it to return only the users who have the DateEnd column set to null.
Is there any way to achieve that functionality ? | 0 |
6,528,212 | 06/29/2011 22:54:22 | 821,950 | 06/29/2011 21:11:31 | 6 | 0 | How can I compress string or file using JclCompression unit.? | Hello I installed "jcl" on my delphi,and now How can I use it could anyone write an example code for compressing a string or file? | delphi-7 | null | null | null | null | 06/30/2011 09:22:07 | not a real question | How can I compress string or file using JclCompression unit.?
===
Hello I installed "jcl" on my delphi,and now How can I use it could anyone write an example code for compressing a string or file? | 1 |
6,769,881 | 07/20/2011 23:53:55 | 210,870 | 11/14/2009 02:08:17 | 296 | 3 | Emulate "double" using 2 "float"s | I am writing a program for an embedded hardware that only support 32-bit single-precision floating point arithmetic. The algorithm I am implementing, however, requires a 64-bit double-precision addition and comparison. I am trying to emulate "double" datatype using a tuple of two floats. So a `double d` will be emulated as struct containing the tuple: `(float d.hi, float d.low)`.
The comparison should be straightforward using a lexicographic ordering. The addition however is a bit tricky because I am not sure which base should I use. Should it be FLT_MAX? And how can I detect a carry.
How can this be done? | c++ | c | floating-point | double-precision | null | null | open | Emulate "double" using 2 "float"s
===
I am writing a program for an embedded hardware that only support 32-bit single-precision floating point arithmetic. The algorithm I am implementing, however, requires a 64-bit double-precision addition and comparison. I am trying to emulate "double" datatype using a tuple of two floats. So a `double d` will be emulated as struct containing the tuple: `(float d.hi, float d.low)`.
The comparison should be straightforward using a lexicographic ordering. The addition however is a bit tricky because I am not sure which base should I use. Should it be FLT_MAX? And how can I detect a carry.
How can this be done? | 0 |
7,176,502 | 08/24/2011 13:46:37 | 394,491 | 07/17/2010 05:19:27 | 687 | 24 | Reverse AJAX with Grails | I'm looking to implement some reverse AJAX on a small Grails demo I'm working (potential 'prototype' for larger project).
What I have in mind (feel free to correct me if you think I am approaching this is the wrong way) is to have a JMS message service on the backend that will push messages to clients subscribed to certain topics with some form of reverse AJAX.
From what I can see, there appear to be a few different potential implementations with Grails (i.e. CometD, IcePush, Atmosphere, DWR). I was wondering if anyone has had any success implementing reverse AJAX with Grails and what technologies they used.
In terms of a use-case, I suppose thinking of something like a Facebook user logged in watching as new messages appear is appropriate. | ajax | grails | reverse-ajax | null | null | 08/25/2011 23:18:30 | not constructive | Reverse AJAX with Grails
===
I'm looking to implement some reverse AJAX on a small Grails demo I'm working (potential 'prototype' for larger project).
What I have in mind (feel free to correct me if you think I am approaching this is the wrong way) is to have a JMS message service on the backend that will push messages to clients subscribed to certain topics with some form of reverse AJAX.
From what I can see, there appear to be a few different potential implementations with Grails (i.e. CometD, IcePush, Atmosphere, DWR). I was wondering if anyone has had any success implementing reverse AJAX with Grails and what technologies they used.
In terms of a use-case, I suppose thinking of something like a Facebook user logged in watching as new messages appear is appropriate. | 4 |
10,935,166 | 06/07/2012 15:41:20 | 602,162 | 02/03/2011 20:03:53 | 57 | 0 | Phonegap html input element onclick not firing | I'm working on a phonegap app and have a weird case where the onclick of an html input button isn't firing. The button does appear on the page. I click the button, see the shadow over the button so I know it's being clicked, but the function does not fire. The code is below. I took the same code and put it in jsfiddle where it works as expected. I tried setting it via jquery instead but same result.
console.log('making photo button');
var photoInput = document.createElement('input');
photoInput.type = 'button';
photoInput.value = 'Add Photo';
photoInput.onclick = function () {alert('photo button clicked');};
console.log(photoInput.onclick);
form.appendChild(photoInput);
Both console.logs fire, and the output of the second one is the onclick that was set above. To add to the weirdness, I create another input button below this one, with the same syntax but different onclick, and it works with no issues. The only difference is that this block is inside a switch case in a for loop, building the form dynamically, but the other button is created and appended after. Since the log statements show up, it isn't possible that the code isn't being reached.
Pre-Submission Edit: I just got this to work. After the loop and the other input button are created and appended, and the form is appended to the document, I run the following code.
var photoButton = document.getElementById('photoButton');
photoButton.onclick = function () {alert('photo button after clicked');};
I can work with this, but I'd like to understand why it wasn't working originally if anyone knows. | javascript | phonegap | onclick | null | null | null | open | Phonegap html input element onclick not firing
===
I'm working on a phonegap app and have a weird case where the onclick of an html input button isn't firing. The button does appear on the page. I click the button, see the shadow over the button so I know it's being clicked, but the function does not fire. The code is below. I took the same code and put it in jsfiddle where it works as expected. I tried setting it via jquery instead but same result.
console.log('making photo button');
var photoInput = document.createElement('input');
photoInput.type = 'button';
photoInput.value = 'Add Photo';
photoInput.onclick = function () {alert('photo button clicked');};
console.log(photoInput.onclick);
form.appendChild(photoInput);
Both console.logs fire, and the output of the second one is the onclick that was set above. To add to the weirdness, I create another input button below this one, with the same syntax but different onclick, and it works with no issues. The only difference is that this block is inside a switch case in a for loop, building the form dynamically, but the other button is created and appended after. Since the log statements show up, it isn't possible that the code isn't being reached.
Pre-Submission Edit: I just got this to work. After the loop and the other input button are created and appended, and the form is appended to the document, I run the following code.
var photoButton = document.getElementById('photoButton');
photoButton.onclick = function () {alert('photo button after clicked');};
I can work with this, but I'd like to understand why it wasn't working originally if anyone knows. | 0 |
9,505,586 | 02/29/2012 19:44:51 | 357,314 | 06/03/2010 09:53:37 | 2,356 | 74 | Get xml children without replacing html entities in PHP | I have this code:
<code>
$strXml = '
<root>
<kid><div>ABC></div></kid>
<kid2>DEF</kid2>
</root>';
$objXml = new SimpleXMLElement($strXml);
$arrNodes = $objXml->xpath('/root/*');
foreach($arrNodes as $objNode) {
/* @var $objNode SimpleXMLElement */
echo $objNode->asXML();
}
</code>
The code extracts the first children of the root and displays the content. The problem is the html entities are converted to characters. Is there any way the code output the initial XML content without any conversion ?
| php | xml | null | null | null | null | open | Get xml children without replacing html entities in PHP
===
I have this code:
<code>
$strXml = '
<root>
<kid><div>ABC></div></kid>
<kid2>DEF</kid2>
</root>';
$objXml = new SimpleXMLElement($strXml);
$arrNodes = $objXml->xpath('/root/*');
foreach($arrNodes as $objNode) {
/* @var $objNode SimpleXMLElement */
echo $objNode->asXML();
}
</code>
The code extracts the first children of the root and displays the content. The problem is the html entities are converted to characters. Is there any way the code output the initial XML content without any conversion ?
| 0 |
9,366,347 | 02/20/2012 18:22:06 | 1,065,950 | 11/25/2011 16:12:52 | 1 | 0 | Using Moles to mock System.Net.Sockets | I'm trying to use Moles to mock the Socket class in System.Net.Sockets. I have successfully generated the .moles file and building it did add a System.Net.Moles assembly to my references but It dose not generate the MSocket class. In fact only the MIPEndPointCollection class is generated.
Here is a sample class that uses System.Net.Sockets.Socket:
using System.Text;
using System.Net.Sockets;
namespace MyProject
{
public static class Communicator
{
public static int Send(string messages)
{
byte[] bytes = Encoding.ASCII.GetBytes(messages);
int bytesSent = 0;
using (Socket socket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp))
{
socket.Connect("localhost", 1234);
bytesSent = socket.Send(bytes);
}
return bytesSent;
}
}
}
A dumy test class:
using MyProject;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Net.Moles;
using Microsoft.Moles.Framework;
[assembly: MoledType(typeof(System.Net.Sockets.Socket))]
namespace MyProjectTest
{
[TestClass()]
public class CommunicatorTest
{
private TestContext testContextInstance;
public TestContext TestContext
{
get { return testContextInstance; }
set { testContextInstance = value; }
}
[TestMethod()]
[HostType("Moles")]
public void SendTest()
{
//dose not exist in the System.Net.Moles namespace:
//MSocket.Send = deligate(){ return 0; };
int bytesSent = Communicator.Send("Test Message");
Assert.AreEqual(0, bytesSent);
}
}
}
And my .moles file:
<Moles xmlns="http://schemas.microsoft.com/moles/2010/">
<Assembly Name="System.Net" />
</Moles>
Can someone pleas point out what is wrong with this and what to do to make it work. I know that there are other ways to mock out the Socket class for example with a wrapper class that implements my own interface but I'm only interested in doing this using Moles.
--Thanks Daniel | c# | .net | unit-testing | mocking | moles | null | open | Using Moles to mock System.Net.Sockets
===
I'm trying to use Moles to mock the Socket class in System.Net.Sockets. I have successfully generated the .moles file and building it did add a System.Net.Moles assembly to my references but It dose not generate the MSocket class. In fact only the MIPEndPointCollection class is generated.
Here is a sample class that uses System.Net.Sockets.Socket:
using System.Text;
using System.Net.Sockets;
namespace MyProject
{
public static class Communicator
{
public static int Send(string messages)
{
byte[] bytes = Encoding.ASCII.GetBytes(messages);
int bytesSent = 0;
using (Socket socket = new Socket(AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp))
{
socket.Connect("localhost", 1234);
bytesSent = socket.Send(bytes);
}
return bytesSent;
}
}
}
A dumy test class:
using MyProject;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Net.Moles;
using Microsoft.Moles.Framework;
[assembly: MoledType(typeof(System.Net.Sockets.Socket))]
namespace MyProjectTest
{
[TestClass()]
public class CommunicatorTest
{
private TestContext testContextInstance;
public TestContext TestContext
{
get { return testContextInstance; }
set { testContextInstance = value; }
}
[TestMethod()]
[HostType("Moles")]
public void SendTest()
{
//dose not exist in the System.Net.Moles namespace:
//MSocket.Send = deligate(){ return 0; };
int bytesSent = Communicator.Send("Test Message");
Assert.AreEqual(0, bytesSent);
}
}
}
And my .moles file:
<Moles xmlns="http://schemas.microsoft.com/moles/2010/">
<Assembly Name="System.Net" />
</Moles>
Can someone pleas point out what is wrong with this and what to do to make it work. I know that there are other ways to mock out the Socket class for example with a wrapper class that implements my own interface but I'm only interested in doing this using Moles.
--Thanks Daniel | 0 |
4,355,867 | 12/04/2010 21:14:47 | 505,238 | 11/12/2010 01:23:14 | 8 | 0 | dynamic programming to sepearte a string into a list of words. | this is basically a dublicate of:
http://stackoverflow.com/questions/3466972/how-to-split-a-string-into-words-ex-stringintowords-string-into-words
neverthelees, i have in my use a function like: public int Word(x) {code}, where for a string x,it will return an integer (+ve or -ve), and that integer will be an indication of how good or bad that partitioning is for the specific word. i should return the combination that gives max number.
what i thought of doing for this is to create a table(i,j) , where i and j have length of the word, and fill out the table in tern like:
for i = 1 to n
for j=i to n do
word(subset of x i to j)
and fill out the table, nevertheless, how on earth will i ever be able to retrieve the optimal solution (in a recursive way?)
any help appreciated. | programming-languages | dynamic | null | null | null | null | open | dynamic programming to sepearte a string into a list of words.
===
this is basically a dublicate of:
http://stackoverflow.com/questions/3466972/how-to-split-a-string-into-words-ex-stringintowords-string-into-words
neverthelees, i have in my use a function like: public int Word(x) {code}, where for a string x,it will return an integer (+ve or -ve), and that integer will be an indication of how good or bad that partitioning is for the specific word. i should return the combination that gives max number.
what i thought of doing for this is to create a table(i,j) , where i and j have length of the word, and fill out the table in tern like:
for i = 1 to n
for j=i to n do
word(subset of x i to j)
and fill out the table, nevertheless, how on earth will i ever be able to retrieve the optimal solution (in a recursive way?)
any help appreciated. | 0 |
154,184 | 09/30/2008 17:49:05 | 3,114 | 08/26/2008 18:05:52 | 856 | 62 | Setting WPF dependency property without triggering events | I need to set a dependency property on a control (Slider.Value) in my code without it triggering a ValueChanged event (since I set the value, not the user). What is the best way to handle this situation in WPF? | c# | wpf | events | dependency-properties | null | null | open | Setting WPF dependency property without triggering events
===
I need to set a dependency property on a control (Slider.Value) in my code without it triggering a ValueChanged event (since I set the value, not the user). What is the best way to handle this situation in WPF? | 0 |
1,442,294 | 09/18/2009 02:16:47 | 149,151 | 08/02/2009 01:32:12 | 35 | 3 | asp.net mvc System.Data.Linq.DuplicateKeyException on update | I'm using asp.net mvc with linq to sql repositories and the following code is throwing an mvc System.Data.Linq.DuplicateKeyException exception on this._table.Attach(entity)
My code is something like that:
public ActionResult Edit(int id)
{
return View(_controllerRepository.GetById(id));
}
public ActionResult Edit(Directivo entity)
{
try
{
_repository.Save(entity, this.UserName)
}
catch (Exception ex)
{
return View(ex);
}
}
And in the repository:
public virtual void Save(T entity, string userName)
{
if (0 == entity.Id)
{
entity.UsuarioIntroduccion = userName;
entity.FechaIntroduccion = DateTime.Now;
entity.UsuarioModificacion = null;
entity.FechaModificacion = null;
this._table.InsertOnSubmit(entity);
}
else
{
entity.UsuarioModificacion = userName;
entity.FechaModificacion = DateTime.Now;
this._table.Attach(entity);
this._table.Context.Refresh(RefreshMode.KeepCurrentValues, entity);
}
try
{
this._dataContext.SubmitChanges();
}
catch (SqlException ex)
{
throw new DataContextException(ex);
}
}
Note that the Id isn't 0.
Its really weird because it happens only with this class, i have a couple more that are working well.
Do you have any clues about what could be happening?
Thanks in advance!
| asp.net-mvc | linq-to-sql | null | null | null | null | open | asp.net mvc System.Data.Linq.DuplicateKeyException on update
===
I'm using asp.net mvc with linq to sql repositories and the following code is throwing an mvc System.Data.Linq.DuplicateKeyException exception on this._table.Attach(entity)
My code is something like that:
public ActionResult Edit(int id)
{
return View(_controllerRepository.GetById(id));
}
public ActionResult Edit(Directivo entity)
{
try
{
_repository.Save(entity, this.UserName)
}
catch (Exception ex)
{
return View(ex);
}
}
And in the repository:
public virtual void Save(T entity, string userName)
{
if (0 == entity.Id)
{
entity.UsuarioIntroduccion = userName;
entity.FechaIntroduccion = DateTime.Now;
entity.UsuarioModificacion = null;
entity.FechaModificacion = null;
this._table.InsertOnSubmit(entity);
}
else
{
entity.UsuarioModificacion = userName;
entity.FechaModificacion = DateTime.Now;
this._table.Attach(entity);
this._table.Context.Refresh(RefreshMode.KeepCurrentValues, entity);
}
try
{
this._dataContext.SubmitChanges();
}
catch (SqlException ex)
{
throw new DataContextException(ex);
}
}
Note that the Id isn't 0.
Its really weird because it happens only with this class, i have a couple more that are working well.
Do you have any clues about what could be happening?
Thanks in advance!
| 0 |
11,298,660 | 07/02/2012 17:53:06 | 1,496,718 | 07/02/2012 17:21:43 | 1 | 0 | LUA: Seeking efficient and error-free means of assigning default arguments | Instead of using long lists of arguments in my function definitions, I prefer to pass a few fixed parameters and a table of 'additional params' like this:
function:doit( text, params )
end
This is nice as it allows me to add new named parameters later without breaking old calls.
The problem I am experiencing occurs when I try to force default values for some of the params:
function:doit( text, params )
local font = params.font or native.systemBold
local fontSize = params.fontSize or 24
local emboss = params.emboss or true
-- ...
end
The above code works fine in all cases, except where I have passed in 'false' for emboss:
doit( "Test text", { fontSize = 32, emboss = false } )
The above code will result in emboss being set to true when I really wanted false.
To be clear, what I want is for the first non-NIL value to be assigned to emboss, instead I'm getting a first non-false and non-NIL.
To combat this problem I wrote a small piece of code to find the first non-NIL value in a table and to return that:
function firstNotNil( ... )
for i = 1, #arg do
local theArg = arg[i]
if(theArg ~= nil) then return theArg end
end
return nil
end
Using this function I would re-write the emboss assignment as follows:
local emboss = firstNotNil(params.emboss, true)
Now, this certainly works, but it seems so inefficient and over the top. I am hoping there is a more compact way of doing this.
Please note: I found this ruby construct which looked promising and I am hoping lua has something like it:
[c,b,a].detect { |i| i > 0 } -- Assign first non-zero in order: c,b,a
| lua | null | null | null | null | null | open | LUA: Seeking efficient and error-free means of assigning default arguments
===
Instead of using long lists of arguments in my function definitions, I prefer to pass a few fixed parameters and a table of 'additional params' like this:
function:doit( text, params )
end
This is nice as it allows me to add new named parameters later without breaking old calls.
The problem I am experiencing occurs when I try to force default values for some of the params:
function:doit( text, params )
local font = params.font or native.systemBold
local fontSize = params.fontSize or 24
local emboss = params.emboss or true
-- ...
end
The above code works fine in all cases, except where I have passed in 'false' for emboss:
doit( "Test text", { fontSize = 32, emboss = false } )
The above code will result in emboss being set to true when I really wanted false.
To be clear, what I want is for the first non-NIL value to be assigned to emboss, instead I'm getting a first non-false and non-NIL.
To combat this problem I wrote a small piece of code to find the first non-NIL value in a table and to return that:
function firstNotNil( ... )
for i = 1, #arg do
local theArg = arg[i]
if(theArg ~= nil) then return theArg end
end
return nil
end
Using this function I would re-write the emboss assignment as follows:
local emboss = firstNotNil(params.emboss, true)
Now, this certainly works, but it seems so inefficient and over the top. I am hoping there is a more compact way of doing this.
Please note: I found this ruby construct which looked promising and I am hoping lua has something like it:
[c,b,a].detect { |i| i > 0 } -- Assign first non-zero in order: c,b,a
| 0 |
3,154,721 | 07/01/2010 02:17:30 | 371,699 | 06/20/2010 20:59:42 | 3 | 0 | What programming language would something like this be coded in? | I need to have something coded for back-end functions of one of my websites. The only knowledge I have is of front-end programming, mostly PHP and MySQL. I know nothing about other languages.
I basically need to have a program continuously running on my Linux server that accesses the MySQL table and checks the validity of certain files hosted on remote servers, such as MP3 files. It would run through these files continuously, multithreaded to do a few at a time, and should be done efficiently, so as not to weigh down my server too much (I have one dedicated server). Of course, the MySQL table would then be updated properly. Surely this shouldn't be so hard on the server if coded properly.
What language would be the most suitable for this task? I actually currently have it done in PHP, and it's really stressful on the server, since PHP isn't made for back-end applications.
Any tips/suggestions about this? Also, would be nice to have a ballpark figure of how much something like this would cost? | c# | java | c++ | c | null | 07/02/2010 00:38:27 | not constructive | What programming language would something like this be coded in?
===
I need to have something coded for back-end functions of one of my websites. The only knowledge I have is of front-end programming, mostly PHP and MySQL. I know nothing about other languages.
I basically need to have a program continuously running on my Linux server that accesses the MySQL table and checks the validity of certain files hosted on remote servers, such as MP3 files. It would run through these files continuously, multithreaded to do a few at a time, and should be done efficiently, so as not to weigh down my server too much (I have one dedicated server). Of course, the MySQL table would then be updated properly. Surely this shouldn't be so hard on the server if coded properly.
What language would be the most suitable for this task? I actually currently have it done in PHP, and it's really stressful on the server, since PHP isn't made for back-end applications.
Any tips/suggestions about this? Also, would be nice to have a ballpark figure of how much something like this would cost? | 4 |
4,046,462 | 10/28/2010 19:24:06 | 482,762 | 10/21/2010 09:02:07 | 1 | 0 | how to use keytool commands in command line | Im tring to create a google map in my android app
how can i generate a key using the line command?
i didnt find the line command(im using windows os)
i need all the steps until i get the key in order to send it to MD5
thanks in advanced | keytool | null | null | null | null | 02/20/2012 20:03:04 | not a real question | how to use keytool commands in command line
===
Im tring to create a google map in my android app
how can i generate a key using the line command?
i didnt find the line command(im using windows os)
i need all the steps until i get the key in order to send it to MD5
thanks in advanced | 1 |
5,965,841 | 05/11/2011 14:24:45 | 616,414 | 02/14/2011 15:14:51 | 89 | 3 | Realloc Vs Linked List Scanning | I have to read from a file an unknown number of rows and save them in to a structure (I would like to avoid a prepocessing to count the total number of elements).
After the reading phase I have to make some computations on each of the elements of these rows.
I figured out two ways:
1)use `realloc` each time I read a row. This way the allocation phase is slow but the computation phase is easier thanks to the index access.
2)use a linked list each time I read a row. This way the allocation phase is faster but the computation phase is slower.
What is better from a complexity point of view?
Thanks. | c | linked-list | realloc | null | null | null | open | Realloc Vs Linked List Scanning
===
I have to read from a file an unknown number of rows and save them in to a structure (I would like to avoid a prepocessing to count the total number of elements).
After the reading phase I have to make some computations on each of the elements of these rows.
I figured out two ways:
1)use `realloc` each time I read a row. This way the allocation phase is slow but the computation phase is easier thanks to the index access.
2)use a linked list each time I read a row. This way the allocation phase is faster but the computation phase is slower.
What is better from a complexity point of view?
Thanks. | 0 |
4,857,513 | 01/31/2011 23:54:37 | 597,680 | 01/31/2011 23:54:37 | 1 | 0 | In SQL, how can I perform a "subtraction" operation? | Suppose I have two tables, which both have user ids. I want to perform an operation that would return all user IDS in table 1 that are not in table 2. I know there has to be some easy way to do this - can anyone offer some assistance?
| sql | database | relational-algebra | null | null | null | open | In SQL, how can I perform a "subtraction" operation?
===
Suppose I have two tables, which both have user ids. I want to perform an operation that would return all user IDS in table 1 that are not in table 2. I know there has to be some easy way to do this - can anyone offer some assistance?
| 0 |
177,691 | 10/07/2008 09:00:26 | 24,550 | 10/02/2008 16:04:29 | 10 | 9 | What is your favorite IDE for develop with Websphere Application Server? | Because now I use IBM Rational Application Development (RAD) it very slow in my mind
(my notebook -- RAM 2 GB, CPU Intel Core 2 Duo 2.00GHz and Windows XP sp2).
Otherwise, I have many problem
such as many time my workspace was crash, sometime error while generate client test and etc.
So, I wish to know what IDE that you favorite use for develop with Websphere Application Server.
| websphere | null | null | null | null | 09/01/2011 13:31:26 | not constructive | What is your favorite IDE for develop with Websphere Application Server?
===
Because now I use IBM Rational Application Development (RAD) it very slow in my mind
(my notebook -- RAM 2 GB, CPU Intel Core 2 Duo 2.00GHz and Windows XP sp2).
Otherwise, I have many problem
such as many time my workspace was crash, sometime error while generate client test and etc.
So, I wish to know what IDE that you favorite use for develop with Websphere Application Server.
| 4 |
1,842,632 | 12/03/2009 20:19:44 | 224,228 | 12/03/2009 20:15:26 | 1 | 0 | Difference between monolithic and microkernel | what is the difference between monolithic and microkernel. | kernel | operating-system | system | null | null | 07/08/2012 01:35:52 | off topic | Difference between monolithic and microkernel
===
what is the difference between monolithic and microkernel. | 2 |
10,864,610 | 06/02/2012 17:50:29 | 478,573 | 10/17/2010 14:54:01 | 1,963 | 30 | How to download the Android dungeons in-app billing example? | I am reading the Android page about in-app billing and they have a sample program discussed here:
http://developer.android.com/guide/market/billing/billing_integrate.html#billing-download
but I don't see how to download it. They have a number of links to download which all go to the top of the download section.
Any idea how to actually download that sample app?
Thanks! | android | in-app-billing | null | null | null | 06/04/2012 14:48:42 | off topic | How to download the Android dungeons in-app billing example?
===
I am reading the Android page about in-app billing and they have a sample program discussed here:
http://developer.android.com/guide/market/billing/billing_integrate.html#billing-download
but I don't see how to download it. They have a number of links to download which all go to the top of the download section.
Any idea how to actually download that sample app?
Thanks! | 2 |
42,102 | 09/03/2008 16:44:59 | 4,249 | 09/02/2008 14:13:06 | 168 | 17 | Using different classloaders for different JUnit tests? | I have a Singleton/Factory object that I'd like to write a JUnit test for. The Factory method decides which implementing class to instantiate based upon a classname in a properties file on the classpath. If no properties file is found, or the properties file does not contain the classname key, then the class will instantiate a default implementing class.
Since the factory keeps a static instance of the Singleton to use once it has been instantiated, to be able to test the "failover" logic in the Factory method I would need to run each test method in a different classloader.
Is there any way with JUnit (or with another unit testing package) to do this?
edit: here is some of the Factory code that is in use:
private static MyClass myClassImpl = instantiateMyClass();
private static MyClass instantiateMyClass() {
MyClass newMyClass = null;
String className = null;
try {
Properties props = getProperties();
className = props.getProperty(PROPERTY_CLASSNAME_KEY);
if (className == null) {
log.warn("instantiateMyClass: Property [" + PROPERTY_CLASSNAME_KEY
+ "] not found in properties, using default MyClass class [" + DEFAULT_CLASSNAME + "]");
className = DEFAULT_CLASSNAME;
}
Class MyClassClass = Class.forName(className);
Object MyClassObj = MyClassClass.newInstance();
if (MyClassObj instanceof MyClass) {
newMyClass = (MyClass) MyClassObj;
}
}
catch (...) {
...
}
return newMyClass;
}
private static Properties getProperties() throws IOException {
Properties props = new Properties();
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(PROPERTIES_FILENAME);
if (stream != null) {
props.load(stream);
}
else {
log.error("getProperties: could not load properties file [" + PROPERTIES_FILENAME + "] from classpath, file not found");
}
return props;
} | java | junit | unit-testing | null | null | null | open | Using different classloaders for different JUnit tests?
===
I have a Singleton/Factory object that I'd like to write a JUnit test for. The Factory method decides which implementing class to instantiate based upon a classname in a properties file on the classpath. If no properties file is found, or the properties file does not contain the classname key, then the class will instantiate a default implementing class.
Since the factory keeps a static instance of the Singleton to use once it has been instantiated, to be able to test the "failover" logic in the Factory method I would need to run each test method in a different classloader.
Is there any way with JUnit (or with another unit testing package) to do this?
edit: here is some of the Factory code that is in use:
private static MyClass myClassImpl = instantiateMyClass();
private static MyClass instantiateMyClass() {
MyClass newMyClass = null;
String className = null;
try {
Properties props = getProperties();
className = props.getProperty(PROPERTY_CLASSNAME_KEY);
if (className == null) {
log.warn("instantiateMyClass: Property [" + PROPERTY_CLASSNAME_KEY
+ "] not found in properties, using default MyClass class [" + DEFAULT_CLASSNAME + "]");
className = DEFAULT_CLASSNAME;
}
Class MyClassClass = Class.forName(className);
Object MyClassObj = MyClassClass.newInstance();
if (MyClassObj instanceof MyClass) {
newMyClass = (MyClass) MyClassObj;
}
}
catch (...) {
...
}
return newMyClass;
}
private static Properties getProperties() throws IOException {
Properties props = new Properties();
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(PROPERTIES_FILENAME);
if (stream != null) {
props.load(stream);
}
else {
log.error("getProperties: could not load properties file [" + PROPERTIES_FILENAME + "] from classpath, file not found");
}
return props;
} | 0 |
10,624,799 | 05/16/2012 18:51:36 | 1,399,386 | 05/16/2012 18:39:52 | 1 | 0 | Programming test during interview | I'm an office manager/recruiter for a software company. We currently use an algorithm test for candidates (we have various tests for various levels). It's a timed test in the sense that they have all the time they want but the faster they do it, the better they will do. Accuracy and timing count. From my side, I feel like candidates are not doing as well as they could because they are too worried about getting it done quickly, worried about getting interrupted since they are taking at home during their off hours, etc. From the engineers side, they feel like if they can't complete this test well, the candidate shouldn't be hired.
So, what are people's thoughts on these tests? Are other companies making Software Engineers at various levels do the same thing? Any and all advice is welcome. Thanks!! | interview-questions | null | null | null | null | 05/18/2012 17:14:31 | off topic | Programming test during interview
===
I'm an office manager/recruiter for a software company. We currently use an algorithm test for candidates (we have various tests for various levels). It's a timed test in the sense that they have all the time they want but the faster they do it, the better they will do. Accuracy and timing count. From my side, I feel like candidates are not doing as well as they could because they are too worried about getting it done quickly, worried about getting interrupted since they are taking at home during their off hours, etc. From the engineers side, they feel like if they can't complete this test well, the candidate shouldn't be hired.
So, what are people's thoughts on these tests? Are other companies making Software Engineers at various levels do the same thing? Any and all advice is welcome. Thanks!! | 2 |
447,002 | 01/15/2009 14:45:21 | 2,077 | 08/20/2008 07:26:21 | 1,277 | 21 | In Flex, how do I know when the properties of a dynamic object change? | I have a dynamic class that serves as a storage container for configuration settings. The settings are variables of that class and it has methods to read from and write to a configuration file, database etc. Now I want to trigger writing to the persistant storage whenever a class variable is changed. As the variables are added dynamically at runtime, I can't use get/set methods, also, if I could, that would lead to a lot of boilerplate code.
How can I have an event triggered for changing properties of my class? | flex | dynamic-class | events | null | null | null | open | In Flex, how do I know when the properties of a dynamic object change?
===
I have a dynamic class that serves as a storage container for configuration settings. The settings are variables of that class and it has methods to read from and write to a configuration file, database etc. Now I want to trigger writing to the persistant storage whenever a class variable is changed. As the variables are added dynamically at runtime, I can't use get/set methods, also, if I could, that would lead to a lot of boilerplate code.
How can I have an event triggered for changing properties of my class? | 0 |
2,166,883 | 01/30/2010 04:38:46 | 245,175 | 01/07/2010 00:28:26 | 11 | 2 | How to add data into RichTextBox from two datasourses in WPF | I need to put data from two different datasourses in the same textbox. The text that comes from the first one have to be bolded and the secound normal.
It's there a possibility to do this in WPF? | richtextbox | wpf | data-binding | null | null | null | open | How to add data into RichTextBox from two datasourses in WPF
===
I need to put data from two different datasourses in the same textbox. The text that comes from the first one have to be bolded and the secound normal.
It's there a possibility to do this in WPF? | 0 |
1,848 | 08/05/2008 03:04:43 | 36 | 08/01/2008 12:43:55 | 21 | 2 | Locating Text within image | I am currently working on a project and my goal is to locate text in an image. OCR'ing the text is not my intention as of yet. I want to basically obtain the bounds of text within an image. I am using the AForge.Net imaging component for manipulation. Any assistance in some sense or another?
Thanks. | c# | image | processing | null | null | null | open | Locating Text within image
===
I am currently working on a project and my goal is to locate text in an image. OCR'ing the text is not my intention as of yet. I want to basically obtain the bounds of text within an image. I am using the AForge.Net imaging component for manipulation. Any assistance in some sense or another?
Thanks. | 0 |
10,461,354 | 05/05/2012 11:22:33 | 270,960 | 02/11/2010 09:59:24 | 41 | 3 | MSDTC encountered an error (HR=0x80000171) while attempting to establish a secure connection with system "ServerName" | I have a website application which is using Microsoft Data Transactions and it is based on .NET Framework 4.0 and SQL Server 2008 R2 Express Edition for the database, being deployed at Windows 2008 Server R2 which is a virtual server. The database and IIS are both at the same server.<br/><br/>
The problem is that the error is occurring in the server event logs as:-
MSDTC encountered an error (HR=0x80000171) while attempting to establish a secure connection with system ‘ZEPHYR’. Zephyr is my Server’s name.<br/><br/>
I have done almost all the things included in the two forum questions already:-
http://social.technet.microsoft.com/Forums/en-US/winservergen/thread/eb8835d9-5f5b-4df2-8c68-4a61d5e44d6b/ <br/>
http://social.msdn.microsoft.com/Forums/en-US/sqlgetstarted/thread/13586ca7-f645-4ed7-96e8-ba03f66ef38b
<br/><br/>
All things are working fine, but when executing the following command using the SUBINACL tool:-
<br/>
C:\Program Files (x86)\Windows Resource Kits\Tools>subinacl /service msdtc /grant="Network Service"=QSETIL
msdtc - OpenService Error : 5 Access is denied.
Elapsed Time: 00 00:00:00
Done: 1, Modified 0, Failed 1, Syntax errors 0
Last Done : msdtc
Last Failed: msdtc - OpenService Error : 5 Access is denied.
subinacl /service msdtc /grant="Network Service"=QSETIL
<br/><br/>
But then I used the following ICACLS command to give access to this by using ICACLS command:-
icacls c:\windows\system32\msdtc\msdtc.log /grant admin:(d,wdac)
<br/><br/>
NOTE: ‘admin’ is my user for the Server.
But again it is not resolving the issue.
The access rights for the msdtc.log file by the command :-
{“icacls c:\windows\system32\msdtc\msdtc.log”} are as follows:-
C:\>icacls c:\windows\system32\msdtc\msdtc.log
c:\windows\system32\msdtc\msdtc.log NT AUTHORITY\NETWORK SERVICE:(F)
ZEPHYR\Administrator:(D,WDAC)
ZEPHYR\admin:(D,WDAC)
BUILTIN\Administrators:(F)
ZEPHYR\admin:(I)(F)
NT AUTHORITY\SYSTEM:(I)(F)
BUILTIN\Administrators:(I)(F)
NT SERVICE\KtmRm:(I)(F)
NT SERVICE\MSDTC:(I)(F)
Successfully processed 1 files; Failed processing 0 files
<br/><br/>
As far as I have seen that there are very few forums where question about such an error is posted. <br/><br/>
I would like to ask that how would I resolve this issue, since this error has caused a bottleneck and the Transactions are not working in those .aspx pages wherever implemented. Is there any work-around for this issue?
| .net-4.0 | transactions | sql-server-2008-r2 | windows-server-2008-r2 | msdtc | null | open | MSDTC encountered an error (HR=0x80000171) while attempting to establish a secure connection with system "ServerName"
===
I have a website application which is using Microsoft Data Transactions and it is based on .NET Framework 4.0 and SQL Server 2008 R2 Express Edition for the database, being deployed at Windows 2008 Server R2 which is a virtual server. The database and IIS are both at the same server.<br/><br/>
The problem is that the error is occurring in the server event logs as:-
MSDTC encountered an error (HR=0x80000171) while attempting to establish a secure connection with system ‘ZEPHYR’. Zephyr is my Server’s name.<br/><br/>
I have done almost all the things included in the two forum questions already:-
http://social.technet.microsoft.com/Forums/en-US/winservergen/thread/eb8835d9-5f5b-4df2-8c68-4a61d5e44d6b/ <br/>
http://social.msdn.microsoft.com/Forums/en-US/sqlgetstarted/thread/13586ca7-f645-4ed7-96e8-ba03f66ef38b
<br/><br/>
All things are working fine, but when executing the following command using the SUBINACL tool:-
<br/>
C:\Program Files (x86)\Windows Resource Kits\Tools>subinacl /service msdtc /grant="Network Service"=QSETIL
msdtc - OpenService Error : 5 Access is denied.
Elapsed Time: 00 00:00:00
Done: 1, Modified 0, Failed 1, Syntax errors 0
Last Done : msdtc
Last Failed: msdtc - OpenService Error : 5 Access is denied.
subinacl /service msdtc /grant="Network Service"=QSETIL
<br/><br/>
But then I used the following ICACLS command to give access to this by using ICACLS command:-
icacls c:\windows\system32\msdtc\msdtc.log /grant admin:(d,wdac)
<br/><br/>
NOTE: ‘admin’ is my user for the Server.
But again it is not resolving the issue.
The access rights for the msdtc.log file by the command :-
{“icacls c:\windows\system32\msdtc\msdtc.log”} are as follows:-
C:\>icacls c:\windows\system32\msdtc\msdtc.log
c:\windows\system32\msdtc\msdtc.log NT AUTHORITY\NETWORK SERVICE:(F)
ZEPHYR\Administrator:(D,WDAC)
ZEPHYR\admin:(D,WDAC)
BUILTIN\Administrators:(F)
ZEPHYR\admin:(I)(F)
NT AUTHORITY\SYSTEM:(I)(F)
BUILTIN\Administrators:(I)(F)
NT SERVICE\KtmRm:(I)(F)
NT SERVICE\MSDTC:(I)(F)
Successfully processed 1 files; Failed processing 0 files
<br/><br/>
As far as I have seen that there are very few forums where question about such an error is posted. <br/><br/>
I would like to ask that how would I resolve this issue, since this error has caused a bottleneck and the Transactions are not working in those .aspx pages wherever implemented. Is there any work-around for this issue?
| 0 |
6,981,404 | 08/08/2011 11:25:39 | 198,133 | 10/28/2009 14:07:37 | 40 | 2 | Converting multiple select to appear as a regular select | I'm currently slicing up a new site design and I want to make a multiple select look and feel the same way that a regular select does, but have the user control+click to choose multiple options.
Does anyone have any advice on how to achieve this goal? I am using the uniform js plugin with jQuery for the rest of my input styles.
Many thanks! | jquery | css | select | input | uniform | null | open | Converting multiple select to appear as a regular select
===
I'm currently slicing up a new site design and I want to make a multiple select look and feel the same way that a regular select does, but have the user control+click to choose multiple options.
Does anyone have any advice on how to achieve this goal? I am using the uniform js plugin with jQuery for the rest of my input styles.
Many thanks! | 0 |
1,625,104 | 10/26/2009 14:21:35 | 39,321 | 11/20/2008 13:51:35 | 4,322 | 123 | Installing TortoiseSVN and TortoiseGit together | I have TortoiseSVN installed and it works great. Would like to have an equally great interface to things hosted on Git.
1. Is TortoiseGit as good as TortoiseSVN?
- Can they both be installed without much trouble? Will menus be duplicated? Will stuff be weird? Any experiences with this?
*I'm running Windows 7 64-bit, if that makes any difference.* | tortoisesvn | tortoisegit | null | null | null | null | open | Installing TortoiseSVN and TortoiseGit together
===
I have TortoiseSVN installed and it works great. Would like to have an equally great interface to things hosted on Git.
1. Is TortoiseGit as good as TortoiseSVN?
- Can they both be installed without much trouble? Will menus be duplicated? Will stuff be weird? Any experiences with this?
*I'm running Windows 7 64-bit, if that makes any difference.* | 0 |
48,877 | 09/07/2008 23:09:31 | 4,883 | 09/06/2008 10:24:59 | 239 | 0 | Choosing between AJAX, Flex and Silverlight | AJAX, Flex and Silverlight are a few ways to make more interactive web applications. What kinds of factors would you consider when deciding which to use for a new web app? Does any one of them offer better cross-platform compatibility, performance, developer tools or community support? | untagged | null | null | null | null | 07/23/2012 05:53:16 | not constructive | Choosing between AJAX, Flex and Silverlight
===
AJAX, Flex and Silverlight are a few ways to make more interactive web applications. What kinds of factors would you consider when deciding which to use for a new web app? Does any one of them offer better cross-platform compatibility, performance, developer tools or community support? | 4 |
8,706,277 | 01/02/2012 23:12:03 | 1,125,628 | 01/02/2012 02:58:50 | 1 | 0 | Magento - Online Store - Made multiple stores, I want all of the stores to use only ONE CART + REMEMBER THE USERNAME | first of all i'd like to thank everyone who has been trying to help me previously.
I have a store, i have devided it to many deifferent stores, such as
STORE.COM -> CARS | ELECTRICS | TOYS
|
store.com | | |
cars.store.com
electrics.store.com
toys.store.com
Now, if i am currently in store.com, ive got a cart with 1 item, and i'm logged in.
If i go to cars, my cart is empty, and im not logged in, so i log in, say i buy a car a chevy'2004, i now have 1 item in my cart. But then i go to electrics, my cart is empty again.
HOW DO I MAKE THIS CART COMMON TO ALL STORES?
HOW DO I KEEP THE COOKIES AND THE USER IS LOGGED/OFF/IN THROWOUT THE ENTIRE WEB? | magento | csv | store | online | cart | 01/04/2012 14:15:32 | not a real question | Magento - Online Store - Made multiple stores, I want all of the stores to use only ONE CART + REMEMBER THE USERNAME
===
first of all i'd like to thank everyone who has been trying to help me previously.
I have a store, i have devided it to many deifferent stores, such as
STORE.COM -> CARS | ELECTRICS | TOYS
|
store.com | | |
cars.store.com
electrics.store.com
toys.store.com
Now, if i am currently in store.com, ive got a cart with 1 item, and i'm logged in.
If i go to cars, my cart is empty, and im not logged in, so i log in, say i buy a car a chevy'2004, i now have 1 item in my cart. But then i go to electrics, my cart is empty again.
HOW DO I MAKE THIS CART COMMON TO ALL STORES?
HOW DO I KEEP THE COOKIES AND THE USER IS LOGGED/OFF/IN THROWOUT THE ENTIRE WEB? | 1 |
2,525,112 | 03/26/2010 16:56:49 | 212,445 | 11/16/2009 22:40:40 | 6 | 1 | Two different VSDB Projects for DBCreation and Population? | I've just stated developing with vsdb, and while it seems to be functional, it seems like it introduces unnecessary restrictions.
Effectively what I'd *LIKE* to do is use it to manage database creation, as well as upgrades etc. In creating, nothing special, just a if db not exists create db, and add a couple logins.
I'd like to push out the changes to tables/views/sprocs/funcs etc... but it seems like it wants me to make this two projects... which is fine... but seems like unnecessary complexity.
I guess my question is to be able to point this .dbschema at a server and have it create database if needed as well as populate the database with schema and data.
Is this really going to require of me 2 projects for each database I want to automate the deployment of?
| vsdb | sql | null | null | null | null | open | Two different VSDB Projects for DBCreation and Population?
===
I've just stated developing with vsdb, and while it seems to be functional, it seems like it introduces unnecessary restrictions.
Effectively what I'd *LIKE* to do is use it to manage database creation, as well as upgrades etc. In creating, nothing special, just a if db not exists create db, and add a couple logins.
I'd like to push out the changes to tables/views/sprocs/funcs etc... but it seems like it wants me to make this two projects... which is fine... but seems like unnecessary complexity.
I guess my question is to be able to point this .dbschema at a server and have it create database if needed as well as populate the database with schema and data.
Is this really going to require of me 2 projects for each database I want to automate the deployment of?
| 0 |
11,616,810 | 07/23/2012 16:44:13 | 1,105,013 | 12/18/2011 23:06:27 | 3 | 0 | buf = string.getbytes() inconsistent results | when I call the getBytes() method on a string I get inconsistent results, first time the statement is executed it is only returning the first 3 characters of the string, If I call upon that statement again it returns the full String, but It also randomly returns only the first 3 characters every so often. A snippet of the code from my server class is as follows;
String reply = ("Current list of users includes: " + users);
buf = reply.getBytes();
packet = new DatagramPacket(buf, buf.length, address, port);
socket.send(packet);
On the client receiving end I then have the following;
socket.receive(packet);
String response = new String(packet.getData());
System.out.println("ChatClient: Response from Server: " + response);
The first time that this is called all that is printed is "Cur", Then the second time it is called the full string is printed along with the values stored in 'users'.
Is there anyway to ensure that this operates correctly the first time round and in a consistent manner?
Thanks
Joe
| udp | client-server | console-application | packet | bytestring | null | open | buf = string.getbytes() inconsistent results
===
when I call the getBytes() method on a string I get inconsistent results, first time the statement is executed it is only returning the first 3 characters of the string, If I call upon that statement again it returns the full String, but It also randomly returns only the first 3 characters every so often. A snippet of the code from my server class is as follows;
String reply = ("Current list of users includes: " + users);
buf = reply.getBytes();
packet = new DatagramPacket(buf, buf.length, address, port);
socket.send(packet);
On the client receiving end I then have the following;
socket.receive(packet);
String response = new String(packet.getData());
System.out.println("ChatClient: Response from Server: " + response);
The first time that this is called all that is printed is "Cur", Then the second time it is called the full string is printed along with the values stored in 'users'.
Is there anyway to ensure that this operates correctly the first time round and in a consistent manner?
Thanks
Joe
| 0 |
11,524,676 | 07/17/2012 14:26:41 | 1,006,884 | 10/21/2011 10:17:20 | 298 | 1 | Make textarea and div look exactly the same | Here is the code: http://jsfiddle.net/eric777/XHtY9/
I need to make textarea and div lokk exactly the same in all browsers. | html | css | div | cross-browser | textarea | 07/23/2012 09:04:35 | too localized | Make textarea and div look exactly the same
===
Here is the code: http://jsfiddle.net/eric777/XHtY9/
I need to make textarea and div lokk exactly the same in all browsers. | 3 |
11,526,291 | 07/17/2012 15:52:39 | 1,484,269 | 06/27/2012 00:54:29 | 75 | 1 | error in getting the dropdown in edittext in android application | I am making an android application in which i have an edittext.Below that i have a button save.I want that when user clicks on edittext it shows all the values in drop down from local database.that have been used .
how to perform this action
has anyone done it before
THanks
Tushar | android | null | null | null | null | 07/19/2012 04:30:57 | not a real question | error in getting the dropdown in edittext in android application
===
I am making an android application in which i have an edittext.Below that i have a button save.I want that when user clicks on edittext it shows all the values in drop down from local database.that have been used .
how to perform this action
has anyone done it before
THanks
Tushar | 1 |
7,836,526 | 10/20/2011 13:18:57 | 1,005,221 | 10/20/2011 12:44:35 | 1 | 0 | i would like people to comment onSilverlight Social Networking Site i want to delvelop | I need to develop a social networking site using silverlight and an associated web application.
What web application should it be?
The networking site i plan to have basic functionalities like profiles, messaging, securtiy, friends and blogging.
programming language would be javascript /html as i plan. I dont know how to programme using C# so this is my option i guess. advice is welcomed though on how i should go about doing this.
I would like to know the beginning point for my task.
Thank you in advance..
| javascript | silverlight | null | null | null | 10/20/2011 13:45:42 | not constructive | i would like people to comment onSilverlight Social Networking Site i want to delvelop
===
I need to develop a social networking site using silverlight and an associated web application.
What web application should it be?
The networking site i plan to have basic functionalities like profiles, messaging, securtiy, friends and blogging.
programming language would be javascript /html as i plan. I dont know how to programme using C# so this is my option i guess. advice is welcomed though on how i should go about doing this.
I would like to know the beginning point for my task.
Thank you in advance..
| 4 |
5,023,529 | 02/04/2011 14:10:59 | 500,559 | 11/08/2010 10:19:37 | 113 | 0 | Doing two SELECT query, with the second query dependant of the first, and the result of the second being concatenated in one. | So I have those two tables:
+----------+ +---------------+
|tGathering| |tGatheredPeople|
+----------+ +---------------+
|cId | |cGatheringID |
|cPlace | |cPeople |
|... | +---------------+
+----------+
I want in one select query to retrieve data about Gatherings in one Place (say "Berlin, Germany"), and amongst the values, would be a comma-separated string of all the people present at one gathering.
Is it possible to do it in one query? And if yes, how does one call this kind of query (as you may have noticed, I had difficulties defining what I was searching for)? | mysql | sql | null | null | null | null | open | Doing two SELECT query, with the second query dependant of the first, and the result of the second being concatenated in one.
===
So I have those two tables:
+----------+ +---------------+
|tGathering| |tGatheredPeople|
+----------+ +---------------+
|cId | |cGatheringID |
|cPlace | |cPeople |
|... | +---------------+
+----------+
I want in one select query to retrieve data about Gatherings in one Place (say "Berlin, Germany"), and amongst the values, would be a comma-separated string of all the people present at one gathering.
Is it possible to do it in one query? And if yes, how does one call this kind of query (as you may have noticed, I had difficulties defining what I was searching for)? | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.