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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11,258,262 | 06/29/2012 08:10:41 | 1,039,175 | 11/10/2011 06:54:05 | 84 | 2 | JNI is platform depended? | I write simple "Hello World" program with Java and JNI for Linux, and if i right for using JNI you must compile shared libs for every platform (e.g. *.so for Linux, *.dll for Windows and so on) place it somewhere near your *.jar file and write a script to execute it properly (e.g. java -jar -Djava.library.path=. your_app.jar). This makes me kinda sad because i choose Java because of platform interdependency. Of course building a exact same lib with Windows and Mac is not a big deal, but at first time i think about a JNI like a silver bullet which will combine platform independence of Java and speed of C in a single .jar file.
Maybe i assume something wrong and there is some way to do it?
| java | c | jni | null | null | 06/30/2012 23:30:23 | not a real question | JNI is platform depended?
===
I write simple "Hello World" program with Java and JNI for Linux, and if i right for using JNI you must compile shared libs for every platform (e.g. *.so for Linux, *.dll for Windows and so on) place it somewhere near your *.jar file and write a script to execute it properly (e.g. java -jar -Djava.library.path=. your_app.jar). This makes me kinda sad because i choose Java because of platform interdependency. Of course building a exact same lib with Windows and Mac is not a big deal, but at first time i think about a JNI like a silver bullet which will combine platform independence of Java and speed of C in a single .jar file.
Maybe i assume something wrong and there is some way to do it?
| 1 |
1,517,646 | 10/04/2009 23:03:20 | 6,448 | 09/15/2008 10:12:05 | 639 | 32 | Apply a ColorMatrix making use of GPU | I have a C# application that recolors an image using ColorMatrix. I understand that ColorMatrix doesn't make use of the GPU. What would be the best avenue to explore if I wanted to use the GPU to recolor the image? Pointers to where look in any suggested libraries would be appreciated, examples even more so! | c# | gpu | colormatrix | null | null | null | open | Apply a ColorMatrix making use of GPU
===
I have a C# application that recolors an image using ColorMatrix. I understand that ColorMatrix doesn't make use of the GPU. What would be the best avenue to explore if I wanted to use the GPU to recolor the image? Pointers to where look in any suggested libraries would be appreciated, examples even more so! | 0 |
9,350,140 | 02/19/2012 14:41:18 | 1,091,558 | 12/10/2011 18:58:49 | 83 | 1 | Can anyone fix my foreach loop? | I have code like this
<?php
$array = array('http://www.google.com', 'http://www.facebook.com', 'http://www.twitter.com');
foreach ( $array as $website );
{
echo "<pre>";
echo "Hi $website\n";
echo "Hello $website\n";
echo "Welcome $website\n";
echo "</pre>";
}
?>
My output looks like this
Hi http://www.twitter.com
Hello http://www.twitter.com
Welcome http://www.twitter.com
I mean my code printing only the last array value. But i want output like this.
Hi http://www.google.com
Hello http://www.google.com
Welcome http://www.google.com
Hi http://www.facebook.com
Hello http://www.facebook.com
Welcome http://www.facebook.com
Hi http://www.twitter.com
Hello http://www.twitter.com
Welcome http://www.twitter.com
Can anyone tell me why its only printing last value?
Thanks
| php | arrays | foreach | null | null | 02/19/2012 15:00:36 | too localized | Can anyone fix my foreach loop?
===
I have code like this
<?php
$array = array('http://www.google.com', 'http://www.facebook.com', 'http://www.twitter.com');
foreach ( $array as $website );
{
echo "<pre>";
echo "Hi $website\n";
echo "Hello $website\n";
echo "Welcome $website\n";
echo "</pre>";
}
?>
My output looks like this
Hi http://www.twitter.com
Hello http://www.twitter.com
Welcome http://www.twitter.com
I mean my code printing only the last array value. But i want output like this.
Hi http://www.google.com
Hello http://www.google.com
Welcome http://www.google.com
Hi http://www.facebook.com
Hello http://www.facebook.com
Welcome http://www.facebook.com
Hi http://www.twitter.com
Hello http://www.twitter.com
Welcome http://www.twitter.com
Can anyone tell me why its only printing last value?
Thanks
| 3 |
11,558,269 | 07/19/2012 09:55:26 | 1,181,904 | 02/01/2012 04:34:42 | 145 | 2 | Dynamically colouring jTable row | In the answer to my previous question, http://stackoverflow.com/questions/11135695/coloring-jtable-row, but now I'm unsure as to new question goes here, setting color to row is working. But I want to give it from a for loop, means I want to set color for i'th row. I'm giving the which I have used,
for(int i=0;i<serialNumber;i++){
if((jTable1.getValueAt(i,1).toString()).equals(BidNumber)){
Enumeration<TableColumn> en = jTable1.getColumnModel().getColumns();
while (en.hasMoreElements()) {
TableColumn tc = en.nextElement();
tc.setCellRenderer(new MyTableCellRenderer());
}
}
It will invoke the method cellrenderer,
public class MyTableCellRenderer extends DefaultTableCellRenderer implements TableCellRenderer {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
setBackground(null);
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
boolean interestingRow = row ==1;
if (interestingRow) {
setBackground(Color.YELLOW);
}
return this;
}
}
here I am trying to put color for the row when first column value is equal to the BidNumber, but in cellrenderer(here),it's set as row==1,then every time when the condition is true the 1 st row will be colored..How can I set it for i'th row? | swing | jtable | tablecellrenderer | null | null | null | open | Dynamically colouring jTable row
===
In the answer to my previous question, http://stackoverflow.com/questions/11135695/coloring-jtable-row, but now I'm unsure as to new question goes here, setting color to row is working. But I want to give it from a for loop, means I want to set color for i'th row. I'm giving the which I have used,
for(int i=0;i<serialNumber;i++){
if((jTable1.getValueAt(i,1).toString()).equals(BidNumber)){
Enumeration<TableColumn> en = jTable1.getColumnModel().getColumns();
while (en.hasMoreElements()) {
TableColumn tc = en.nextElement();
tc.setCellRenderer(new MyTableCellRenderer());
}
}
It will invoke the method cellrenderer,
public class MyTableCellRenderer extends DefaultTableCellRenderer implements TableCellRenderer {
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
setBackground(null);
super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
boolean interestingRow = row ==1;
if (interestingRow) {
setBackground(Color.YELLOW);
}
return this;
}
}
here I am trying to put color for the row when first column value is equal to the BidNumber, but in cellrenderer(here),it's set as row==1,then every time when the condition is true the 1 st row will be colored..How can I set it for i'th row? | 0 |
11,437,304 | 07/11/2012 16:37:17 | 985,214 | 10/08/2011 09:28:43 | 25 | 0 | Display HashSet in a JList and real-time item update | I'd like to display the content of a [HashSet][1] in a [JList][2]. I achieved this by the following statement:
JList list = new JList(hashset.toArray());
Now, I'd like `list` to reflect the changes in `hashset`. I could do this by calling `setListData()` when the elements in `hashset` are changed, as below:
list.setListData(hashset.toArray());
This does not seem to be a proper way to do it. As I understood from the [tutorial][3], I need to extend/implement a [ListModel][4]. Please provide an appropriate example of overloading ListModel, if it is applicable to my intentions. Otherwise, kindly suggest a better approach to this.
Thanks in advance.
[1]: http://docs.oracle.com/javase/7/docs/api/java/util/HashSet.html
[2]: http://docs.oracle.com/javase/7/docs/api/javax/swing/JList.html
[3]: http://docs.oracle.com/javase/tutorial/uiswing/components/list.html
[4]: http://docs.oracle.com/javase/7/docs/api/javax/swing/ListModel.html | java | jlist | hashset | null | null | null | open | Display HashSet in a JList and real-time item update
===
I'd like to display the content of a [HashSet][1] in a [JList][2]. I achieved this by the following statement:
JList list = new JList(hashset.toArray());
Now, I'd like `list` to reflect the changes in `hashset`. I could do this by calling `setListData()` when the elements in `hashset` are changed, as below:
list.setListData(hashset.toArray());
This does not seem to be a proper way to do it. As I understood from the [tutorial][3], I need to extend/implement a [ListModel][4]. Please provide an appropriate example of overloading ListModel, if it is applicable to my intentions. Otherwise, kindly suggest a better approach to this.
Thanks in advance.
[1]: http://docs.oracle.com/javase/7/docs/api/java/util/HashSet.html
[2]: http://docs.oracle.com/javase/7/docs/api/javax/swing/JList.html
[3]: http://docs.oracle.com/javase/tutorial/uiswing/components/list.html
[4]: http://docs.oracle.com/javase/7/docs/api/javax/swing/ListModel.html | 0 |
4,976,475 | 02/12/2011 05:12:06 | 571,600 | 01/11/2011 17:18:17 | 3 | 0 | Python: Delete CSV headers row and rewite new headers row | Still teaching myself python so please don't hate me if my code is terrible...
My code:
ifile = csv.reader(open("TE.csv",'rb'))
shutil.copy("TE.csv","temp")
tempfile = csv.reader(open("temp","rb"))
ofile = csv.writer(open("TE-RESULTS.csv","ab"))
for row in ifile:
#do some web scraping stuff here
VC_s = str(cells[1].find(text=True))
VC_i = str(cells[2].find(text=True))
VT_s = str(cells[4].find(text=True))
entry = [VC_s, VC_i, VT_s]
rowAdd = tempfile.next()
ofile.writerow(rowAdd + entry)
Problem: I start with a CSV that I will have to add 3 columns to the end. Using my code above, I get the following output:
HEADER1 HEADER2 HEADER3 result1 result2 result3
autocheck C:\check 1.jpg result1 result2 result3
services C:\svcs 2.jpg result1 result2 result3
My ***DESIRED*** output:
HEADER1 HEADER2 HEADER3 HEADER4 HEADER5 HEADER6
autocheck C:\check 1.jpg result1 result2 result3
services C:\svcs 2.jpg result1 result2 result3
What is the best way to fix my code that will give me the desired output? My initial thought would be to delete the HEADERS row and replace it with a new HEADERS row in the TE-RESULTS.csv file. | python | csv | header | null | null | null | open | Python: Delete CSV headers row and rewite new headers row
===
Still teaching myself python so please don't hate me if my code is terrible...
My code:
ifile = csv.reader(open("TE.csv",'rb'))
shutil.copy("TE.csv","temp")
tempfile = csv.reader(open("temp","rb"))
ofile = csv.writer(open("TE-RESULTS.csv","ab"))
for row in ifile:
#do some web scraping stuff here
VC_s = str(cells[1].find(text=True))
VC_i = str(cells[2].find(text=True))
VT_s = str(cells[4].find(text=True))
entry = [VC_s, VC_i, VT_s]
rowAdd = tempfile.next()
ofile.writerow(rowAdd + entry)
Problem: I start with a CSV that I will have to add 3 columns to the end. Using my code above, I get the following output:
HEADER1 HEADER2 HEADER3 result1 result2 result3
autocheck C:\check 1.jpg result1 result2 result3
services C:\svcs 2.jpg result1 result2 result3
My ***DESIRED*** output:
HEADER1 HEADER2 HEADER3 HEADER4 HEADER5 HEADER6
autocheck C:\check 1.jpg result1 result2 result3
services C:\svcs 2.jpg result1 result2 result3
What is the best way to fix my code that will give me the desired output? My initial thought would be to delete the HEADERS row and replace it with a new HEADERS row in the TE-RESULTS.csv file. | 0 |
9,484,116 | 02/28/2012 14:50:08 | 1,229,414 | 02/23/2012 21:22:24 | 1 | 0 | How to be a "big league" C coder | Although not my major, I've got pretty much the equivalent of a Bacherlors degree in CompSci. I took a "Unix Systems Programming" based on the Stevens book and also an Operating Systems class where the toughest assignment was to write a "buddy system" simulator with all the funky pointer fun. Through all this I picked up some passable C skills and the rudiments of make and gdb, all housed under the Emacs roof. Good. But then I met a guy at a job who was a world-class Debian contributor. The first time I saw him he was hacking his own private version of Mutt because he wasn't satisfied with it for some archaic reason. Okay, I realize there's a deep, wide chasm between school project C and real-world big project C. How do you bridge that gap? For example, I download the source for some app, do the configure, make, install . . . and the screen is filled for hours with craziness! I look at some of the source code . . . and get lost fairly quickly, especially trying to figure out the overview of what's going on. It's C. I understand it (sort of), but the overview is not coming through. So my question is this: How do you get "big league" C hacking skills? I remember in the Stevens class, we hacked our own version of tar based on an algorithm in the book -- and some cheat-sheet help from BSD source. But really, how do you get to the point where you can truly contribute to a serious app endeavor? And what about these languages? I just downloaded the source for PolyML and poked around. Wow! How could I ever learn C at that level? | c | system | null | null | null | 02/28/2012 14:52:59 | not a real question | How to be a "big league" C coder
===
Although not my major, I've got pretty much the equivalent of a Bacherlors degree in CompSci. I took a "Unix Systems Programming" based on the Stevens book and also an Operating Systems class where the toughest assignment was to write a "buddy system" simulator with all the funky pointer fun. Through all this I picked up some passable C skills and the rudiments of make and gdb, all housed under the Emacs roof. Good. But then I met a guy at a job who was a world-class Debian contributor. The first time I saw him he was hacking his own private version of Mutt because he wasn't satisfied with it for some archaic reason. Okay, I realize there's a deep, wide chasm between school project C and real-world big project C. How do you bridge that gap? For example, I download the source for some app, do the configure, make, install . . . and the screen is filled for hours with craziness! I look at some of the source code . . . and get lost fairly quickly, especially trying to figure out the overview of what's going on. It's C. I understand it (sort of), but the overview is not coming through. So my question is this: How do you get "big league" C hacking skills? I remember in the Stevens class, we hacked our own version of tar based on an algorithm in the book -- and some cheat-sheet help from BSD source. But really, how do you get to the point where you can truly contribute to a serious app endeavor? And what about these languages? I just downloaded the source for PolyML and poked around. Wow! How could I ever learn C at that level? | 1 |
5,953,290 | 05/10/2011 16:31:44 | 143,960 | 03/31/2009 19:11:58 | 72 | 2 | White space in IE8 and no javascript ajax postback | The site that I am updating is having an issue with IE that has me stumped. Everything works fine in Firefox (of course). One issue has an extra blank page on all the website's pages. The second issue is certain pages show up blank. On those pages, there are list sets. Those list sets have a css class called listSet. Each list set is populated via this javascript:
jQuery(document).ready(function($) {
fillApprovalList("DutaApprovalLists");
});
var fillApprovalList = function(ajaxFunction) {
if (getParameterByName("mode").toLowerCase() == "approve") {
var $listsToFill = $(".approvalList").find(".listSet")
$listsToFill.each(function() {
var $currObj = $(this);
var statusAndId = $currObj.attr("id");
var $table = $currObj.find(".resultList");
fillApprovalListAjax(ajaxFunction,statusAndId,0);
});
}
}
var fillApprovalListAjax = function(ajaxFunction, statusAndId, page){
var $currObj = $("[id='"+statusAndId+"']");
var $table = $currObj.find(".resultList");
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "/database/services/ApprovalList.asmx/"+ajaxFunction,
data: "{statusAndId:'" + statusAndId + "',page:"+page+"}",
dataType: "json",
success: function(data) {
$table.find("tr").remove()
$table.parent().find("#loading").hide()
$table.append(data.d.ResultSet);
var $pagingDiv = $table.parent().find(".paging");
$pagingDiv.find("a").remove()
$pagingDiv.append(data.d.Links);
$pagingDiv.find("a").click(pageApprovalList);
var $countDiv= $table.parent().find("#count");
$countDiv.empty();
$countDiv.append(data.d.DisplayingText);
}
});
}
Now, I can't for the life of me figure out why this isnt working. I step through the code, javascript and server side, and everything gets returned OK. To remove the extra page, I included this:
<!--[if IE 8]>
<style type="text/css">
#small_boxes {
overflow: hidden;
padding-bottom: -150px;
}
</style>
<![endif]-->
But only if I don't have this line:
<meta http-equiv="X-UA-Compatible" content="IE=xxx" />
If I were to modify that line to be, lets say IE=EmulateIE8, then that list page renders fine, but then I have the white space on every page. I have tried pretty much all IE= options and none fix both. And all my javascript includes are as such:
<script type="text/javascript" language="javascript" src="/scripts/jquery-1.5.1.js"></script>
Having the < / script> tag. Its kind of like a chicken and the egg deal I have going on. | javascript | asp.net | internet-explorer-8 | null | null | null | open | White space in IE8 and no javascript ajax postback
===
The site that I am updating is having an issue with IE that has me stumped. Everything works fine in Firefox (of course). One issue has an extra blank page on all the website's pages. The second issue is certain pages show up blank. On those pages, there are list sets. Those list sets have a css class called listSet. Each list set is populated via this javascript:
jQuery(document).ready(function($) {
fillApprovalList("DutaApprovalLists");
});
var fillApprovalList = function(ajaxFunction) {
if (getParameterByName("mode").toLowerCase() == "approve") {
var $listsToFill = $(".approvalList").find(".listSet")
$listsToFill.each(function() {
var $currObj = $(this);
var statusAndId = $currObj.attr("id");
var $table = $currObj.find(".resultList");
fillApprovalListAjax(ajaxFunction,statusAndId,0);
});
}
}
var fillApprovalListAjax = function(ajaxFunction, statusAndId, page){
var $currObj = $("[id='"+statusAndId+"']");
var $table = $currObj.find(".resultList");
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "/database/services/ApprovalList.asmx/"+ajaxFunction,
data: "{statusAndId:'" + statusAndId + "',page:"+page+"}",
dataType: "json",
success: function(data) {
$table.find("tr").remove()
$table.parent().find("#loading").hide()
$table.append(data.d.ResultSet);
var $pagingDiv = $table.parent().find(".paging");
$pagingDiv.find("a").remove()
$pagingDiv.append(data.d.Links);
$pagingDiv.find("a").click(pageApprovalList);
var $countDiv= $table.parent().find("#count");
$countDiv.empty();
$countDiv.append(data.d.DisplayingText);
}
});
}
Now, I can't for the life of me figure out why this isnt working. I step through the code, javascript and server side, and everything gets returned OK. To remove the extra page, I included this:
<!--[if IE 8]>
<style type="text/css">
#small_boxes {
overflow: hidden;
padding-bottom: -150px;
}
</style>
<![endif]-->
But only if I don't have this line:
<meta http-equiv="X-UA-Compatible" content="IE=xxx" />
If I were to modify that line to be, lets say IE=EmulateIE8, then that list page renders fine, but then I have the white space on every page. I have tried pretty much all IE= options and none fix both. And all my javascript includes are as such:
<script type="text/javascript" language="javascript" src="/scripts/jquery-1.5.1.js"></script>
Having the < / script> tag. Its kind of like a chicken and the egg deal I have going on. | 0 |
11,451,127 | 07/12/2012 11:46:09 | 1,520,653 | 07/12/2012 11:36:07 | 1 | 0 | Can you explain why Java uses so many pointless intermediate objects? | Ladies, gentlemen.
I was reading [Google's documentation for Closure Templates.][1]
There's not that much code in there, but it represents what I'm having trouble understanding (in Java, in particular). I'll go line by line:
// Bundle the Soy files for your project into a SoyFileSet.
SoyFileSet sfs = new SoyFileSet.Builder().add(new File("simple.soy")).build();
I get this. An object to gather multiple template files. Fine. But why the `.Builder()`? Why not just `new SoyFileSet().add(...).build()`?
// Compile the template into a SoyTofu object.
// SoyTofu's newRenderer method returns an object that can render any template in file set.
SoyTofu tofu = sfs.compileToJavaObj();
Fine. But why do I want this? After I have the files gathered, I was expecting just something like `sfs.render(Map<> data)`. Why do I need to compile this to a Java object?
And finally...
// Call the template with no data.
System.out.println(tofu.newRenderer("examples.simple.helloWorld").render());
Great, why do I have to create an intermediate object just so I can call a method od it? Why couldn't the `sfs` object have a `.render()` method? Why do I need a `Renderer` object?
Java is frustrating, why aren't things done in a straightforward way?
[1]: https://developers.google.com/closure/templates/docs/helloworld_java | java | null | null | null | null | 07/12/2012 13:09:30 | not constructive | Can you explain why Java uses so many pointless intermediate objects?
===
Ladies, gentlemen.
I was reading [Google's documentation for Closure Templates.][1]
There's not that much code in there, but it represents what I'm having trouble understanding (in Java, in particular). I'll go line by line:
// Bundle the Soy files for your project into a SoyFileSet.
SoyFileSet sfs = new SoyFileSet.Builder().add(new File("simple.soy")).build();
I get this. An object to gather multiple template files. Fine. But why the `.Builder()`? Why not just `new SoyFileSet().add(...).build()`?
// Compile the template into a SoyTofu object.
// SoyTofu's newRenderer method returns an object that can render any template in file set.
SoyTofu tofu = sfs.compileToJavaObj();
Fine. But why do I want this? After I have the files gathered, I was expecting just something like `sfs.render(Map<> data)`. Why do I need to compile this to a Java object?
And finally...
// Call the template with no data.
System.out.println(tofu.newRenderer("examples.simple.helloWorld").render());
Great, why do I have to create an intermediate object just so I can call a method od it? Why couldn't the `sfs` object have a `.render()` method? Why do I need a `Renderer` object?
Java is frustrating, why aren't things done in a straightforward way?
[1]: https://developers.google.com/closure/templates/docs/helloworld_java | 4 |
9,258,140 | 02/13/2012 09:27:39 | 618,517 | 02/15/2011 20:21:43 | 902 | 33 | Java applet on a site to take a screenshot? | I want to do the following:
1. Create a java applet without display and put it on my site.
2. When the user enters, he allows the applet to run and for him nothing changes (he does not see any screen from that applet).
3. When he clicks on a button, I want an onclick event to send the applet a message so it will take a screenshot of the clients screen.
4. Then, send the screenshot as encoded byte data back to javascript and I using AJAX will send it back to the server.
5. At the end on the server I will build an image from that data and save a .png or any other format on the server (using PHP).
I need guidance in all of those stages.
Thanks a lot in advance. | java | php | javascript | null | null | 02/13/2012 11:24:28 | not a real question | Java applet on a site to take a screenshot?
===
I want to do the following:
1. Create a java applet without display and put it on my site.
2. When the user enters, he allows the applet to run and for him nothing changes (he does not see any screen from that applet).
3. When he clicks on a button, I want an onclick event to send the applet a message so it will take a screenshot of the clients screen.
4. Then, send the screenshot as encoded byte data back to javascript and I using AJAX will send it back to the server.
5. At the end on the server I will build an image from that data and save a .png or any other format on the server (using PHP).
I need guidance in all of those stages.
Thanks a lot in advance. | 1 |
2,835,801 | 05/14/2010 16:24:03 | 341,426 | 05/14/2010 16:24:03 | 1 | 0 | Why hasn't functional programming taken over yet? | I've read some texts about declarative/functional programming (languages), tried out Haskell as well as written one myself. From what I've seen, functional programming has several advantages over the classical imperative style:
- Stateless programs; No side effects
- Concurrency; Plays extremely nice with the rising multi-core technology
- Programs are usually shorter and in some cases easier to read
- Productivity goes up (example: Erlang)
- Imperative programming is a very old paradigm (as far as I know) and possibly not suitable for the 21th century
Why are companies using or programs written in functional languages still so "rare"?
Why, when looking at the advantages of functional programming, are we still using imperative programming languages?
Maybe it was too early for it in 1990, but today? | functional-programming | null | null | null | null | 05/20/2010 15:29:09 | not constructive | Why hasn't functional programming taken over yet?
===
I've read some texts about declarative/functional programming (languages), tried out Haskell as well as written one myself. From what I've seen, functional programming has several advantages over the classical imperative style:
- Stateless programs; No side effects
- Concurrency; Plays extremely nice with the rising multi-core technology
- Programs are usually shorter and in some cases easier to read
- Productivity goes up (example: Erlang)
- Imperative programming is a very old paradigm (as far as I know) and possibly not suitable for the 21th century
Why are companies using or programs written in functional languages still so "rare"?
Why, when looking at the advantages of functional programming, are we still using imperative programming languages?
Maybe it was too early for it in 1990, but today? | 4 |
9,360,942 | 02/20/2012 12:14:57 | 889,900 | 08/11/2011 12:26:32 | 12 | 0 | How do I set the Django auth.login session length/age? | I have a Django app deployed on Google App Engine that prematurely logs its users out (not a single browser close is involved). In settings.py, I have this code:
SESSION_COOKIE_AGE = 365 * 24 * 60 * 60
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
I also tried using this code right after calling auth.login():
request.session.set_expiry(30*24*60*60)
Is there any way that I can let the length of the auth.login session be much longer, say, a year? | django | django-authentication | null | null | null | null | open | How do I set the Django auth.login session length/age?
===
I have a Django app deployed on Google App Engine that prematurely logs its users out (not a single browser close is involved). In settings.py, I have this code:
SESSION_COOKIE_AGE = 365 * 24 * 60 * 60
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
I also tried using this code right after calling auth.login():
request.session.set_expiry(30*24*60*60)
Is there any way that I can let the length of the auth.login session be much longer, say, a year? | 0 |
6,778,200 | 07/21/2011 15:01:12 | 453,712 | 05/14/2010 15:54:20 | 222 | 8 | php including file | I have to include in a php script some files that are located on a 2nd level subdirectory.
The problem is that in my xampp it fails to include these files.
In netbeans if i click on the path it open files.
require_once("../../config/bootstrap.php");
require_once("../../config/config.php");
What may be the problem?
Thanks. | php | include | directory | require | null | 07/22/2011 21:49:38 | too localized | php including file
===
I have to include in a php script some files that are located on a 2nd level subdirectory.
The problem is that in my xampp it fails to include these files.
In netbeans if i click on the path it open files.
require_once("../../config/bootstrap.php");
require_once("../../config/config.php");
What may be the problem?
Thanks. | 3 |
4,651,394 | 01/10/2011 20:51:51 | 570,404 | 01/10/2011 20:51:51 | 1 | 0 | link list file I/O | how to create double link list and writing or reading list from/to File.. if you can, write simple code to understandable easily. thanks.. | file | list | hyperlink | null | null | 01/10/2011 21:10:31 | not a real question | link list file I/O
===
how to create double link list and writing or reading list from/to File.. if you can, write simple code to understandable easily. thanks.. | 1 |
7,133,010 | 08/20/2011 16:15:10 | 269,902 | 02/09/2010 23:14:54 | 71 | 1 | Intergrating disq.us profiles with user profiles on my site | Helllo!
I'm looking to integrate disq.us comments on my site.
I have users registered on my site and their avatars. And I would like, that clicking each disq.us comment on the site would lead to my user profile page for registered user.
However, looking on disqus integration in other sites I can see, that each avatar of the commenter is taken from disqus, but not from the site. And clicking on this avatar opens disqus commenter profile, not from the site.
Is there any way to alter this behaviour or is it unchangeable if working with disqus?
Could not find anything in their docs.
----------
I also heard that there is low API disqus to load comments while generating the page (not with js), but instead of using it, I guess I'll better write my own comments module.
| disqus | null | null | null | null | null | open | Intergrating disq.us profiles with user profiles on my site
===
Helllo!
I'm looking to integrate disq.us comments on my site.
I have users registered on my site and their avatars. And I would like, that clicking each disq.us comment on the site would lead to my user profile page for registered user.
However, looking on disqus integration in other sites I can see, that each avatar of the commenter is taken from disqus, but not from the site. And clicking on this avatar opens disqus commenter profile, not from the site.
Is there any way to alter this behaviour or is it unchangeable if working with disqus?
Could not find anything in their docs.
----------
I also heard that there is low API disqus to load comments while generating the page (not with js), but instead of using it, I guess I'll better write my own comments module.
| 0 |
7,172,493 | 08/24/2011 08:23:35 | 905,925 | 08/22/2011 13:12:57 | 3 | 0 | Creating product pages using PHP | I have a product gallery page, with numerous products.
I wish to create a page for each product with product specific comment box(maybe facebook). I can write a new page for each product and hyperlink them. But this will need a new page for every product added.
I think I can use php to dynamically create a page for every product out in a layout previously defined.
Can anybody help with a basic example?? | php | null | null | null | null | 08/24/2011 08:32:56 | not a real question | Creating product pages using PHP
===
I have a product gallery page, with numerous products.
I wish to create a page for each product with product specific comment box(maybe facebook). I can write a new page for each product and hyperlink them. But this will need a new page for every product added.
I think I can use php to dynamically create a page for every product out in a layout previously defined.
Can anybody help with a basic example?? | 1 |
10,435,736 | 05/03/2012 16:42:35 | 770,023 | 05/25/2011 17:15:53 | 678 | 30 | Invalid read of size 1 in strstr() using valgrind | I'm inspecting some piece of code with valgrind and I get this error:
==7001== Invalid read of size 1
==7001== at 0x402E21B: strstr (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==7001== by 0x8049742: replace_in_file (functions.c:191)
==7001== by 0x8049C55: parse_dir (functions.c:295)
==7001== by 0x8049059: main (main.c:214)
==7001== Address 0x42018c3 is 0 bytes after a block of size 3 alloc'd
==7001== at 0x402B018: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==7001== by 0x80496EC: replace_in_file (functions.c:183)
==7001== by 0x8049C55: parse_dir (functions.c:295)
==7001== by 0x8049059: main (main.c:214)
The code snippet looks as follows:
long int replace_in_file(char **sets, FILE *file, char *path, const char *mode){
long int n = 0, size = 0, len, remaining_len;
char *buffer,
*found,
*before,
*after;
size = file_size(file);
if(-1 != size){
buffer = malloc(size * sizeof(char));
rewind(file);
fread(buffer, 1, size, file);
int i=0;
do{
do{
found = strstr(buffer, sets[i]); // LINE 191
if(NULL != found && '\0' != sets[i][0]){
//rest of code...
I cannot realise why I get that error, because everything works as expected and in the debugger every variable seems fine.
What is wrong, how can I fix it? | c | valgrind | strstr | null | null | null | open | Invalid read of size 1 in strstr() using valgrind
===
I'm inspecting some piece of code with valgrind and I get this error:
==7001== Invalid read of size 1
==7001== at 0x402E21B: strstr (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==7001== by 0x8049742: replace_in_file (functions.c:191)
==7001== by 0x8049C55: parse_dir (functions.c:295)
==7001== by 0x8049059: main (main.c:214)
==7001== Address 0x42018c3 is 0 bytes after a block of size 3 alloc'd
==7001== at 0x402B018: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==7001== by 0x80496EC: replace_in_file (functions.c:183)
==7001== by 0x8049C55: parse_dir (functions.c:295)
==7001== by 0x8049059: main (main.c:214)
The code snippet looks as follows:
long int replace_in_file(char **sets, FILE *file, char *path, const char *mode){
long int n = 0, size = 0, len, remaining_len;
char *buffer,
*found,
*before,
*after;
size = file_size(file);
if(-1 != size){
buffer = malloc(size * sizeof(char));
rewind(file);
fread(buffer, 1, size, file);
int i=0;
do{
do{
found = strstr(buffer, sets[i]); // LINE 191
if(NULL != found && '\0' != sets[i][0]){
//rest of code...
I cannot realise why I get that error, because everything works as expected and in the debugger every variable seems fine.
What is wrong, how can I fix it? | 0 |
9,259,323 | 02/13/2012 10:59:23 | 948,909 | 09/16/2011 13:28:23 | 47 | 0 | Unknown "half" error | I have problem in my PHP code. I'm trying to make internet shop and Im now in product listing step. My code is so long, so I will show only substantial part.
$result = mysql_query("SELECT name, category, describtion, value FROM products") or die(mysql_error());
if(mysql_num_rows($result) % 2 == 0)
{
while($left = mysql_fetch_array($result, MYSQL_NUM) && $right = mysql_fetch_array($result, MYSQL_NUM))
{
echo '
<div class="sub_items">
<div class="sub_left">
<div class="sub_items_header">
<h1>'.$left[0].'</h1>
<h2>'.$left[1].'</h2>
</div>
<div class="sub_items_image">
<img src="images/'.$left[0].'.png" width="167" height="164" alt="'.$left[0].'" />
</div>
<div class="sub_items_text">
'.$left[2].'
</div>
<div class="sub_items_cartinfo">
<div class="price">
<h2>'.$left[3].'$</h2>
</div>
<div class="addtocart">
<a href="chart.php?name='.$left[0].'"><span>Add to Cart</span></a>
</div>
<div class="clearthis"> </div>
</div>
<div class="clearthis"> </div>
</div>
<div class="sub_right">
<div class="sub_items_header">
<h1>'.$right[0].'</h1>
<h2>'.$right[1].'</h2>
</div>
<div class="sub_items_image">
<img src="images/'.$right[0].'.png" width="175" height="170" alt="'.$right[0].'" />
</div>
<div class="sub_items_text">
'.$right[2].'
</div>
<div class="sub_items_cartinfo">
<div class="price">
<h2>'.$right[3].'$</h2>
</div>
<div class="addtocart">
<a href="chart.php?name='.$right[0].'"><span>Add to Cart</span></a>
</div>
<div class="clearthis"> </div>
</div>
<div class="clearthis"> </div>
</div>
<!-- End of Right Sub Item -->
<div class="clearthis"> </div>
</div>
<div class="h_divider"> </div>
';
}
In the while cycle I'm echoing data. Data is separated to left and right div. I'm not getting any error message, but I have bad output. Look.
![...][1]
[1]: http://i.stack.imgur.com/B2ao1.png
The left side not loads, but right yes. Why? Anybody please help me. | php | mysql | html | database | echo | 02/14/2012 02:33:50 | off topic | Unknown "half" error
===
I have problem in my PHP code. I'm trying to make internet shop and Im now in product listing step. My code is so long, so I will show only substantial part.
$result = mysql_query("SELECT name, category, describtion, value FROM products") or die(mysql_error());
if(mysql_num_rows($result) % 2 == 0)
{
while($left = mysql_fetch_array($result, MYSQL_NUM) && $right = mysql_fetch_array($result, MYSQL_NUM))
{
echo '
<div class="sub_items">
<div class="sub_left">
<div class="sub_items_header">
<h1>'.$left[0].'</h1>
<h2>'.$left[1].'</h2>
</div>
<div class="sub_items_image">
<img src="images/'.$left[0].'.png" width="167" height="164" alt="'.$left[0].'" />
</div>
<div class="sub_items_text">
'.$left[2].'
</div>
<div class="sub_items_cartinfo">
<div class="price">
<h2>'.$left[3].'$</h2>
</div>
<div class="addtocart">
<a href="chart.php?name='.$left[0].'"><span>Add to Cart</span></a>
</div>
<div class="clearthis"> </div>
</div>
<div class="clearthis"> </div>
</div>
<div class="sub_right">
<div class="sub_items_header">
<h1>'.$right[0].'</h1>
<h2>'.$right[1].'</h2>
</div>
<div class="sub_items_image">
<img src="images/'.$right[0].'.png" width="175" height="170" alt="'.$right[0].'" />
</div>
<div class="sub_items_text">
'.$right[2].'
</div>
<div class="sub_items_cartinfo">
<div class="price">
<h2>'.$right[3].'$</h2>
</div>
<div class="addtocart">
<a href="chart.php?name='.$right[0].'"><span>Add to Cart</span></a>
</div>
<div class="clearthis"> </div>
</div>
<div class="clearthis"> </div>
</div>
<!-- End of Right Sub Item -->
<div class="clearthis"> </div>
</div>
<div class="h_divider"> </div>
';
}
In the while cycle I'm echoing data. Data is separated to left and right div. I'm not getting any error message, but I have bad output. Look.
![...][1]
[1]: http://i.stack.imgur.com/B2ao1.png
The left side not loads, but right yes. Why? Anybody please help me. | 2 |
6,868,064 | 07/29/2011 02:34:45 | 493,552 | 11/01/2010 12:18:48 | 30 | 2 | How to install 2 ubuntu versions inside windows | I have installed Ubuntu 8.04 inside XP. Is it possible to install ubuntu 11.04 in different hard disk partition but again inside widnows?
Thanks,
Chandra | ubuntu-11.04 | null | null | null | null | 07/29/2011 04:47:21 | off topic | How to install 2 ubuntu versions inside windows
===
I have installed Ubuntu 8.04 inside XP. Is it possible to install ubuntu 11.04 in different hard disk partition but again inside widnows?
Thanks,
Chandra | 2 |
10,908,628 | 06/06/2012 05:30:54 | 1,336,396 | 04/16/2012 13:21:51 | 6 | 0 | Get acadlinetype selected index value | I have added Acadlinetype ocx file.
I don't know how to get acadlinetype selected index value in vba.
Thank in advance. | vba | null | null | null | null | 06/06/2012 15:33:23 | not a real question | Get acadlinetype selected index value
===
I have added Acadlinetype ocx file.
I don't know how to get acadlinetype selected index value in vba.
Thank in advance. | 1 |
2,786,119 | 05/07/2010 04:01:38 | 92,679 | 04/19/2009 05:23:14 | 335 | 7 | How do I use .find for the last five days in ruby on rails? | Have a model called contact_email.date_sent
I want to be able to run a report which displays all those where the date_sent range is between date.today and date.today 5 days ago.
I assume I use something like
@send_emails = Contact_Email.find(:conditions=> ???)
But not clear what exactly is the best way. Thanks! | ruby-on-rails | find | date | null | null | null | open | How do I use .find for the last five days in ruby on rails?
===
Have a model called contact_email.date_sent
I want to be able to run a report which displays all those where the date_sent range is between date.today and date.today 5 days ago.
I assume I use something like
@send_emails = Contact_Email.find(:conditions=> ???)
But not clear what exactly is the best way. Thanks! | 0 |
8,303,107 | 11/28/2011 22:12:10 | 409,833 | 08/03/2010 15:31:19 | 13 | 3 | Windows Remote Desktop Services. Disable mouse and keyboard | Is there any way to disable Mouse and Keyboard functions in a Remote Desktop Connection?
I'm using Windows Server 2008 R2. I checked the Group Policies but didn't find anything related.
**I just want to allow Remote Desktop connection without mouse/keyboard functions** (spectator mode)
Thanks | windows | remote | null | null | null | 11/28/2011 23:29:46 | off topic | Windows Remote Desktop Services. Disable mouse and keyboard
===
Is there any way to disable Mouse and Keyboard functions in a Remote Desktop Connection?
I'm using Windows Server 2008 R2. I checked the Group Policies but didn't find anything related.
**I just want to allow Remote Desktop connection without mouse/keyboard functions** (spectator mode)
Thanks | 2 |
6,735,814 | 07/18/2011 16:03:29 | 637,142 | 02/28/2011 04:31:33 | 742 | 34 | How to build a release version of iPad app on xCode | I actually need to get the .app file of a xcode application. I have tried searching for an answer and I found a similar question in [here][1]. I have tried:
![enter image description here][2]
after building the application, when I go to my app folder I cannot find the build folder that everyone talks about. I already have the Ad Hoc Distribution Provisioning Profile in order to send the app. I just need to send an app to a friend and I have already created the Ad Hoc Distribution Provisioning Profile. I believe I am just missing the .app file.
[1]: http://stackoverflow.com/questions/1984727/how-to-get-app-file-of-a-xcode-application
[2]: http://i.stack.imgur.com/Pk4AX.png | build | xcode4 | null | null | null | null | open | How to build a release version of iPad app on xCode
===
I actually need to get the .app file of a xcode application. I have tried searching for an answer and I found a similar question in [here][1]. I have tried:
![enter image description here][2]
after building the application, when I go to my app folder I cannot find the build folder that everyone talks about. I already have the Ad Hoc Distribution Provisioning Profile in order to send the app. I just need to send an app to a friend and I have already created the Ad Hoc Distribution Provisioning Profile. I believe I am just missing the .app file.
[1]: http://stackoverflow.com/questions/1984727/how-to-get-app-file-of-a-xcode-application
[2]: http://i.stack.imgur.com/Pk4AX.png | 0 |
10,947,007 | 06/08/2012 10:18:44 | 811,901 | 06/23/2011 09:08:51 | 56 | 0 | php explode where no spaces etc | I am trying to explode a string that does not already define the parts clearly (i.e. with spaces or commas)
example string : FRPARGBASD
the FR PAR GB ASD all need to be exploded to insert as seperate entities into a database.
How would I go about this please | php | explode | null | null | null | 06/08/2012 11:00:44 | not a real question | php explode where no spaces etc
===
I am trying to explode a string that does not already define the parts clearly (i.e. with spaces or commas)
example string : FRPARGBASD
the FR PAR GB ASD all need to be exploded to insert as seperate entities into a database.
How would I go about this please | 1 |
10,106,825 | 04/11/2012 13:24:27 | 1,244,706 | 03/02/2012 09:08:44 | 13 | 0 | MVC3 search textbox with magnifying glass | May someone kindly share code that will allow me to create a search textbox with the magnifying glass. Im using mvc 3. Thanks | asp.net-mvc-3 | full-text-search | null | null | null | 04/11/2012 20:23:02 | not a real question | MVC3 search textbox with magnifying glass
===
May someone kindly share code that will allow me to create a search textbox with the magnifying glass. Im using mvc 3. Thanks | 1 |
5,494,251 | 03/31/2011 01:02:51 | 427,155 | 08/21/2010 15:14:07 | 326 | 5 | performance gain on Google App Engine MapReduce | How much of a compute intensive gain can one expect on GAE MapReduce? The scenario of interest to me is compute intensive, so for example: multiplying a trillion random floats in a single threaded single core application. Then imagine 1000 MapReduce workers multiplying a billion random numbers each and announcing "finished" when all workers have finished. Assume billing is enabled. | google-app-engine | google | mapreduce | null | null | null | open | performance gain on Google App Engine MapReduce
===
How much of a compute intensive gain can one expect on GAE MapReduce? The scenario of interest to me is compute intensive, so for example: multiplying a trillion random floats in a single threaded single core application. Then imagine 1000 MapReduce workers multiplying a billion random numbers each and announcing "finished" when all workers have finished. Assume billing is enabled. | 0 |
3,572,215 | 08/26/2010 05:13:09 | 159,759 | 08/20/2009 04:42:29 | 580 | 17 | What Action to invoke the Video Camera in Android? | Is it possible to call the built-in Video Recorder in Android through an implicit `Intent`? I did some search but haven't figured out yet.
Many thanks. | android | action | android-intent | video-capture | null | null | open | What Action to invoke the Video Camera in Android?
===
Is it possible to call the built-in Video Recorder in Android through an implicit `Intent`? I did some search but haven't figured out yet.
Many thanks. | 0 |
10,580,661 | 05/14/2012 09:29:07 | 1,393,330 | 05/14/2012 08:54:46 | 1 | 0 | Want to build multimodule pom which builds 2 ear from same project in maven | I have one main PTC Project inside which I have different modules(sub projects)
<modules>
<module>PrismaTestCommon</module>
<module>PrismaTestClientHTMLGeneration</module>
<module>PrismaTestClientWeb</module>
<module>PrismaTestClientEarM</module>
</modules>
So I have one common pom.xml of PTC which contains above dependency of module:
The above thing builds ptc.ear
Now I want to add 2 modules BTCHTMLGeneration on BTCEarM and use PTCCommon and PTCWeb from PTC and build btc.ear. Also when i want to build ptc.ear it takes above 4 module and when i want to build btc.ear , it shoud take common 2 module from PTC and 2 new module from BTC
How can I achieve this...Please help | maven | null | null | null | null | null | open | Want to build multimodule pom which builds 2 ear from same project in maven
===
I have one main PTC Project inside which I have different modules(sub projects)
<modules>
<module>PrismaTestCommon</module>
<module>PrismaTestClientHTMLGeneration</module>
<module>PrismaTestClientWeb</module>
<module>PrismaTestClientEarM</module>
</modules>
So I have one common pom.xml of PTC which contains above dependency of module:
The above thing builds ptc.ear
Now I want to add 2 modules BTCHTMLGeneration on BTCEarM and use PTCCommon and PTCWeb from PTC and build btc.ear. Also when i want to build ptc.ear it takes above 4 module and when i want to build btc.ear , it shoud take common 2 module from PTC and 2 new module from BTC
How can I achieve this...Please help | 0 |
11,660,499 | 07/26/2012 00:03:25 | 1,020,719 | 10/30/2011 13:46:34 | 61 | 2 | Sorting dictionary using a tuple and operator.itemgetter | I am before my last milestone preparing suitable output. Its quite simple, I think, but my approach doesn't work:
Given an dictionary like
mydict={x1 : (val1, dist1, (lat1,lon1)), x2 : (val2, dist2, (lat2,lon2)), ...}
I tried to sort this in a nested way in an array, first using the "values" and if equals, sorting for "dist".
However, I did my homework and tried it using this way:
import operator
s= sorted(mydict.iteritems(), key=operator.itemgetter(1)).
The thing ist that if the sort methode would be appliable to tuples, it would be quite easy, because it's already in the right order.
Unfortunately I get:
> 'list' object is not callable
Do you have an idea?
| python | numpy | null | null | null | null | open | Sorting dictionary using a tuple and operator.itemgetter
===
I am before my last milestone preparing suitable output. Its quite simple, I think, but my approach doesn't work:
Given an dictionary like
mydict={x1 : (val1, dist1, (lat1,lon1)), x2 : (val2, dist2, (lat2,lon2)), ...}
I tried to sort this in a nested way in an array, first using the "values" and if equals, sorting for "dist".
However, I did my homework and tried it using this way:
import operator
s= sorted(mydict.iteritems(), key=operator.itemgetter(1)).
The thing ist that if the sort methode would be appliable to tuples, it would be quite easy, because it's already in the right order.
Unfortunately I get:
> 'list' object is not callable
Do you have an idea?
| 0 |
7,593,858 | 09/29/2011 07:26:58 | 857,997 | 07/22/2011 13:22:58 | 73 | 4 | How to find the latitude and longitude of a place 'X' kms away from a given lat lon | I want to find the latitude and longitude of a place that is some x kms from a given latitude and longitude(in Java).
For eg.
My current lat and long is 16° 33' N and 76° 05' E and I want to find the lat long of a place that is 15 kms away from that place.
Assuming the given lat long is the centre of the circle how do i find the lat long of points at 0, 90,180,270 degrees with the radius being 15kms?
Thanks.
| java | distance | trigonometry | lat-long | null | 09/29/2011 11:26:58 | off topic | How to find the latitude and longitude of a place 'X' kms away from a given lat lon
===
I want to find the latitude and longitude of a place that is some x kms from a given latitude and longitude(in Java).
For eg.
My current lat and long is 16° 33' N and 76° 05' E and I want to find the lat long of a place that is 15 kms away from that place.
Assuming the given lat long is the centre of the circle how do i find the lat long of points at 0, 90,180,270 degrees with the radius being 15kms?
Thanks.
| 2 |
1,169,365 | 07/23/2009 02:58:56 | 137,791 | 07/14/2009 01:55:45 | 1 | 0 | Can you validate an inactive user's password in ASP.NET's membership system? | I am creating an activation form for newly-created users in ASP.NET's membership system. When the user is created I send an email with a link to an activation page. However, before the user is activated, I want to verify their user name and password, so I have them enter their credentials into text boxes.
However, based on what I've read and the behavior I am seeing, it appears that I have to activate the user before I can test the password, either with FormsAuthentication.Authenticate or Membership.ValidateUser. I think this is a potential security weakness - is there any way around it?
Thanks,
Graham | asp.net | membership | authentication | null | null | null | open | Can you validate an inactive user's password in ASP.NET's membership system?
===
I am creating an activation form for newly-created users in ASP.NET's membership system. When the user is created I send an email with a link to an activation page. However, before the user is activated, I want to verify their user name and password, so I have them enter their credentials into text boxes.
However, based on what I've read and the behavior I am seeing, it appears that I have to activate the user before I can test the password, either with FormsAuthentication.Authenticate or Membership.ValidateUser. I think this is a potential security weakness - is there any way around it?
Thanks,
Graham | 0 |
5,475,721 | 03/29/2011 16:21:25 | 407,688 | 07/31/2010 22:13:25 | 56 | 1 | printing large font characters using ASCII values like diode screens. | Hello I do not what type of this program called, but I will do my best to describe it.
I want to write a program preferably in C that prints using ASCII characters to print large characters similar to diodes signs
Eg.
Output:
#
#
#
#
#
#
for characters L | c | null | null | null | null | 03/29/2011 19:19:52 | not a real question | printing large font characters using ASCII values like diode screens.
===
Hello I do not what type of this program called, but I will do my best to describe it.
I want to write a program preferably in C that prints using ASCII characters to print large characters similar to diodes signs
Eg.
Output:
#
#
#
#
#
#
for characters L | 1 |
9,512,633 | 03/01/2012 08:07:47 | 120,574 | 06/10/2009 14:36:39 | 350 | 14 | How to bring new android design to android devices os 2.1+? | What is the best practice for developing application looking like it is recommended by [Android Design][1] on the one hand but it also should work well on android os 2.1+ devices?
[1]: http://developer.android.com/design/index.html | android | design | compatibility | ics | null | 03/03/2012 01:04:22 | not a real question | How to bring new android design to android devices os 2.1+?
===
What is the best practice for developing application looking like it is recommended by [Android Design][1] on the one hand but it also should work well on android os 2.1+ devices?
[1]: http://developer.android.com/design/index.html | 1 |
7,165,275 | 08/23/2011 17:44:29 | 727,781 | 03/16/2011 18:19:21 | 16 | 1 | Which VBA should i learn? | Hy!
Sorry for the dummy question, but now i am really confused.
I have to write a database in Access 2010 and i need to use VBA also (i have never used it). A thought that the times came to learn a little about VBA and VB. I would like to read through a VB tutorial also just to know a little bit about that too. But i found a lot of VB for example 6.0, 2005, 2008, 2010.
My question is: If I want ot learn VBA in Access 2010 which VBA version should i to read (link would good), and which version of VB?
I hope i didn't ask very stupid question | vba | vb | access | null | null | 08/25/2011 01:45:23 | not constructive | Which VBA should i learn?
===
Hy!
Sorry for the dummy question, but now i am really confused.
I have to write a database in Access 2010 and i need to use VBA also (i have never used it). A thought that the times came to learn a little about VBA and VB. I would like to read through a VB tutorial also just to know a little bit about that too. But i found a lot of VB for example 6.0, 2005, 2008, 2010.
My question is: If I want ot learn VBA in Access 2010 which VBA version should i to read (link would good), and which version of VB?
I hope i didn't ask very stupid question | 4 |
5,750,058 | 04/21/2011 21:38:09 | 582,062 | 01/19/2011 20:24:19 | 15 | 0 | Explain keyword this. | Could someone explain more about the Keyword "this"? | java | homework | null | null | null | 04/21/2011 21:40:19 | not a real question | Explain keyword this.
===
Could someone explain more about the Keyword "this"? | 1 |
8,656,342 | 12/28/2011 13:12:29 | 1,048,116 | 11/15/2011 17:32:53 | 93 | 0 | C - adding to an Char Array and Int | Basically, I have an array being passed as a pointer to a function, which capitalizes the first letter, the strlen of that array is also being passed.
What I want to do, after capitalization, is to then append '1' to the end of the array, so that `hello` becomes `Hello1`. But I am unsure how to do such thing in code, or whether its possible.
...
char myString[70]; <-- Array being passed, where the string is never > 64 char's.
...
void capFirst(char *s, int i) {
s[0] = (toupper(s[0]));
}
| c | arrays | null | null | null | null | open | C - adding to an Char Array and Int
===
Basically, I have an array being passed as a pointer to a function, which capitalizes the first letter, the strlen of that array is also being passed.
What I want to do, after capitalization, is to then append '1' to the end of the array, so that `hello` becomes `Hello1`. But I am unsure how to do such thing in code, or whether its possible.
...
char myString[70]; <-- Array being passed, where the string is never > 64 char's.
...
void capFirst(char *s, int i) {
s[0] = (toupper(s[0]));
}
| 0 |
6,410,496 | 06/20/2011 11:32:50 | 804,147 | 06/18/2011 01:35:48 | 54 | 3 | sqlalchemy objects as dict keys? | The use case is that I have a remote (read slow) database from which I grab some data through ORM mapped classes.
I'd like to store non-db temporary data along side the ORM data and I don't want to pollute the mapped class namespace (which other people use) with a bunch of temporary attributes just so I can store some object specific data. What I would really like to do is to use these as keys into a dict.
I've seen [this thread](http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg21227.html) so I know that it can be done, but I don't like the example of:
def __hash__( self ):
return id( self ) if self.id is None else hash( self.id )
Because my use case includes a db set auto_increment primary key which won't exist until after a flush. This is one of the no-noes of hashing.
I could try to fix it if I put a flush in the `__hash__` but that feels like way too big a side effect to be a good idea.
So, the question is: is there a good way to use ORM mapped class instances as keys to a dict, or is there another/better way to associate temporary data with an object without polluting it's namespace? | python | sqlalchemy | null | null | null | null | open | sqlalchemy objects as dict keys?
===
The use case is that I have a remote (read slow) database from which I grab some data through ORM mapped classes.
I'd like to store non-db temporary data along side the ORM data and I don't want to pollute the mapped class namespace (which other people use) with a bunch of temporary attributes just so I can store some object specific data. What I would really like to do is to use these as keys into a dict.
I've seen [this thread](http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg21227.html) so I know that it can be done, but I don't like the example of:
def __hash__( self ):
return id( self ) if self.id is None else hash( self.id )
Because my use case includes a db set auto_increment primary key which won't exist until after a flush. This is one of the no-noes of hashing.
I could try to fix it if I put a flush in the `__hash__` but that feels like way too big a side effect to be a good idea.
So, the question is: is there a good way to use ORM mapped class instances as keys to a dict, or is there another/better way to associate temporary data with an object without polluting it's namespace? | 0 |
9,901,052 | 03/28/2012 04:15:03 | 793,894 | 06/11/2011 11:19:44 | 20 | 0 | How to Use Web Services in Android Application? | I am creating an application in which I want to access a web service and perform a particular task like if I enter the two number into the edit Text and click on the button the addition or subtraction or whatever shows on to the screen. and I do not want to use the local database of Android.
Means my back-end process or say logic's are already created in SQl Sever. But I don't know how to call or access the functionality of web services in Android. Please Help me Out.
Thanks in Advance for Any Help........ | android | null | null | null | null | 03/28/2012 04:57:15 | not a real question | How to Use Web Services in Android Application?
===
I am creating an application in which I want to access a web service and perform a particular task like if I enter the two number into the edit Text and click on the button the addition or subtraction or whatever shows on to the screen. and I do not want to use the local database of Android.
Means my back-end process or say logic's are already created in SQl Sever. But I don't know how to call or access the functionality of web services in Android. Please Help me Out.
Thanks in Advance for Any Help........ | 1 |
11,322,372 | 07/04/2012 04:20:43 | 1,194,697 | 02/07/2012 12:58:59 | 1 | 0 | How to create web application in android? | Hi i am fresher in android
I want to create web application for an existing website ...
similar to apps like facebook and flipkart
can anyone help me .... | java | android | null | null | null | 07/04/2012 09:00:21 | not a real question | How to create web application in android?
===
Hi i am fresher in android
I want to create web application for an existing website ...
similar to apps like facebook and flipkart
can anyone help me .... | 1 |
7,484,100 | 09/20/2011 11:03:37 | 821,746 | 06/29/2011 18:56:31 | 1 | 0 | Can someone guide me how i can implement Intellisense in my own application(kinda editor) | Can someone guide me how i can implement Intellisense in my own application(kinda editor) i want to allow pepole to write c,java programs in that editor by giving them intellisense when writing the code? | c# | null | null | null | null | 09/20/2011 11:23:06 | not a real question | Can someone guide me how i can implement Intellisense in my own application(kinda editor)
===
Can someone guide me how i can implement Intellisense in my own application(kinda editor) i want to allow pepole to write c,java programs in that editor by giving them intellisense when writing the code? | 1 |
693,045 | 03/28/2009 16:25:27 | 12,637 | 09/16/2008 15:03:39 | 169 | 26 | How to sign in to a service using PHP | I want to sign in to a service (site) using PHP (without using its API)
If the service login was with a <form> and the method is 'GET', I would use
Service.com/signin.php?username=xxxx&password=xxxx
Now, the <form> has a POST method how can I do so??
Thanks!! | post | methods | signup | null | null | null | open | How to sign in to a service using PHP
===
I want to sign in to a service (site) using PHP (without using its API)
If the service login was with a <form> and the method is 'GET', I would use
Service.com/signin.php?username=xxxx&password=xxxx
Now, the <form> has a POST method how can I do so??
Thanks!! | 0 |
6,204,482 | 06/01/2011 16:23:15 | 776,456 | 05/30/2011 15:04:50 | 1 | 0 | Selenium doesnt actually click? | selenium.click([xpath to object])
seems to be screwed up for me. It recognises the button i want to click, and thinks it clicks it, but nothing happens on screen. The next line involves clicking another button on the next screen. It fails because it cant locate the button, because the first click hasnt actually happened. | java | selenium | null | null | null | null | open | Selenium doesnt actually click?
===
selenium.click([xpath to object])
seems to be screwed up for me. It recognises the button i want to click, and thinks it clicks it, but nothing happens on screen. The next line involves clicking another button on the next screen. It fails because it cant locate the button, because the first click hasnt actually happened. | 0 |
2,581,490 | 04/05/2010 22:11:15 | 88,739 | 04/08/2009 18:26:34 | 457 | 15 | Should business objects be able to create their own DTOs? | Suppose I have the following class:
class Camera
{
public Camera(
double exposure,
double brightness,
double contrast,
RegionOfInterest regionOfInterest)
{
this.exposure = exposure;
this.brightness = brightness;
this.contrast = contrast;
this.regionOfInterest = regionOfInterest;
}
public void ConfigureAcquisitionFifo(IAcquisitionFifo acquisitionFifo)
{
// do stuff to the acquisition FIFO
}
readonly double exposure;
readonly double brightness;
readonly double contrast;
readonly RegionOfInterest regionOfInterest;
}
... and a DTO to transport the camera info across a service boundary (WCF), say, for viewing in a WinForms/WPF/Web app:
using System.Runtime.Serialization;
[DataContract]
public class CameraData
{
[DataMember]
public double Exposure { get; set; }
[DataMember]
public double Brightness { get; set; }
[DataMember]
public double Contrast { get; set; }
[DataMember]
public RegionOfInterestData RegionOfInterest { get; set; }
}
Now I can add a method to `Camera` to expose its data:
class Camera
{
// blah blah
public CameraData ToData()
{
var regionOfInterestData = regionOfInterest.ToData();
return new CameraData()
{
Exposure = exposure,
Brightness = brightness,
Contrast = contrast,
RegionOfInterest = regionOfInterestData
};
}
}
*or*, I can create a method that requires a special IReporter to be passed in for the Camera to expose its data to. This removes the dependency on the Contracts layer (Camera no longer has to know about CameraData):
class Camera
{
// beep beep I'm a jeep
public void ExposeToReporter(IReporter reporter)
{
reporter.GetCameraInfo(exposure, brightness, contrast, regionOfInterest);
}
}
So which should I do? I prefer the second, but it requires the IReporter to have a CameraData field (which gets changed by `GetCameraInfo()`), which feels weird. Also, if there is any even better solution, please share with me! I'm still an object-oriented newb. | c# | oop | dto | null | null | null | open | Should business objects be able to create their own DTOs?
===
Suppose I have the following class:
class Camera
{
public Camera(
double exposure,
double brightness,
double contrast,
RegionOfInterest regionOfInterest)
{
this.exposure = exposure;
this.brightness = brightness;
this.contrast = contrast;
this.regionOfInterest = regionOfInterest;
}
public void ConfigureAcquisitionFifo(IAcquisitionFifo acquisitionFifo)
{
// do stuff to the acquisition FIFO
}
readonly double exposure;
readonly double brightness;
readonly double contrast;
readonly RegionOfInterest regionOfInterest;
}
... and a DTO to transport the camera info across a service boundary (WCF), say, for viewing in a WinForms/WPF/Web app:
using System.Runtime.Serialization;
[DataContract]
public class CameraData
{
[DataMember]
public double Exposure { get; set; }
[DataMember]
public double Brightness { get; set; }
[DataMember]
public double Contrast { get; set; }
[DataMember]
public RegionOfInterestData RegionOfInterest { get; set; }
}
Now I can add a method to `Camera` to expose its data:
class Camera
{
// blah blah
public CameraData ToData()
{
var regionOfInterestData = regionOfInterest.ToData();
return new CameraData()
{
Exposure = exposure,
Brightness = brightness,
Contrast = contrast,
RegionOfInterest = regionOfInterestData
};
}
}
*or*, I can create a method that requires a special IReporter to be passed in for the Camera to expose its data to. This removes the dependency on the Contracts layer (Camera no longer has to know about CameraData):
class Camera
{
// beep beep I'm a jeep
public void ExposeToReporter(IReporter reporter)
{
reporter.GetCameraInfo(exposure, brightness, contrast, regionOfInterest);
}
}
So which should I do? I prefer the second, but it requires the IReporter to have a CameraData field (which gets changed by `GetCameraInfo()`), which feels weird. Also, if there is any even better solution, please share with me! I'm still an object-oriented newb. | 0 |
1,018,897 | 06/19/2009 16:35:26 | 82,657 | 03/25/2009 15:49:31 | 156 | 6 | Select multiple entities in Criteria Query | In NHibernate HQL you can select multiple entities for a given query like this example.
var query = session.CreateQuery("select c,k from Cat as c join c.Kittens as k");
Obviously the real world situation has more complexity but that is the basics. Is there a way to do this in a Criteria query?
| nhibernate | c# | null | null | null | null | open | Select multiple entities in Criteria Query
===
In NHibernate HQL you can select multiple entities for a given query like this example.
var query = session.CreateQuery("select c,k from Cat as c join c.Kittens as k");
Obviously the real world situation has more complexity but that is the basics. Is there a way to do this in a Criteria query?
| 0 |
3,063,033 | 06/17/2010 15:21:49 | 369,411 | 06/17/2010 14:27:00 | 13 | 0 | Frontend Session Counter : How long customer stayed on my website ? | I want to show my customer - **For how long they are available on my site**.
I need **live session counter** on **front end** until they leave my site.
This can be done by tracking customers **IP address**, But Newbie in Javascripts.
Your help will be appriciated.
Thanx
| javascript | null | null | null | null | null | open | Frontend Session Counter : How long customer stayed on my website ?
===
I want to show my customer - **For how long they are available on my site**.
I need **live session counter** on **front end** until they leave my site.
This can be done by tracking customers **IP address**, But Newbie in Javascripts.
Your help will be appriciated.
Thanx
| 0 |
4,603,133 | 01/05/2011 10:40:17 | 346,963 | 05/01/2009 10:09:02 | 129 | 21 | Who calls ctor in Virtual inheritance? | #include<iostream>
class base{
public:
base(){std::cout<<"In base";}
};
class dv1:virtual private base {
public:
dv1(){std::cout<<"In DV1";}
};
class dv2:virtual private base {
public:
dv2(){std::cout<<"In DV2";}
};
class drv : public dv1, public dv2 {
public:
drv() {std::cout<<"Why is this working";}
};
int main() {
drv obj;
return 0;
} | c++ | virtual | multiple-inheritance | null | null | null | open | Who calls ctor in Virtual inheritance?
===
#include<iostream>
class base{
public:
base(){std::cout<<"In base";}
};
class dv1:virtual private base {
public:
dv1(){std::cout<<"In DV1";}
};
class dv2:virtual private base {
public:
dv2(){std::cout<<"In DV2";}
};
class drv : public dv1, public dv2 {
public:
drv() {std::cout<<"Why is this working";}
};
int main() {
drv obj;
return 0;
} | 0 |
2,559,273 | 04/01/2010 09:10:20 | 243,999 | 01/05/2010 14:49:52 | 423 | 41 | Android - Adjust screen when keyboard pops up? | I want to be able to adjust my UI screen on Android when the soft keyboard pops up.
So at the minute I have something similiar to the first picture below where I have and EditText at the bottom of the screen and when a user taps the EditText I want the same as what happens in the second picture.
That is that the EditText gets moved up and appears to "sit" on top of the soft keyboard, when the soft keyboard dissapears it should then return to its prior state.
Can anyone let me know the best way to approach and implement this?
![alt text][1]
---
![alt text][2]
[1]: http://img40.imageshack.us/img40/2300/keyboarddown.png
[2]: http://img46.imageshack.us/img46/9339/keyboardup.png | android | userinterface | keyboard | edittext | screen | null | open | Android - Adjust screen when keyboard pops up?
===
I want to be able to adjust my UI screen on Android when the soft keyboard pops up.
So at the minute I have something similiar to the first picture below where I have and EditText at the bottom of the screen and when a user taps the EditText I want the same as what happens in the second picture.
That is that the EditText gets moved up and appears to "sit" on top of the soft keyboard, when the soft keyboard dissapears it should then return to its prior state.
Can anyone let me know the best way to approach and implement this?
![alt text][1]
---
![alt text][2]
[1]: http://img40.imageshack.us/img40/2300/keyboarddown.png
[2]: http://img46.imageshack.us/img46/9339/keyboardup.png | 0 |
9,434,768 | 02/24/2012 16:55:17 | 124,257 | 06/17/2009 11:13:53 | 4,375 | 128 | Prevent Internet Explorer 8 from caching form data | I'm currently facing the problem that IE8 decides to cache a (hidden) form field into which I write a randomly generated hash, which is also stored in the session. If the hash sent in the form equals the hash stored in session, the form request is valid.
But because IE caches those values, the value sent in the form differs from what is stored in the session. How can I prevent this from happening? I tried `autocomplete="off"` in both the field and the `<form>` element..
The hidden input field looks like this:
<input type="hidden" name="hash" value="hash inserted here" autocomplete="off" />
And the form tag like this:
<form action="action uri" method="post" autocomplete="off"> | php | forms | internet-explorer | null | null | null | open | Prevent Internet Explorer 8 from caching form data
===
I'm currently facing the problem that IE8 decides to cache a (hidden) form field into which I write a randomly generated hash, which is also stored in the session. If the hash sent in the form equals the hash stored in session, the form request is valid.
But because IE caches those values, the value sent in the form differs from what is stored in the session. How can I prevent this from happening? I tried `autocomplete="off"` in both the field and the `<form>` element..
The hidden input field looks like this:
<input type="hidden" name="hash" value="hash inserted here" autocomplete="off" />
And the form tag like this:
<form action="action uri" method="post" autocomplete="off"> | 0 |
10,685,276 | 05/21/2012 12:28:28 | 967,484 | 09/27/2011 16:09:09 | 2,125 | 31 | iPhone iOS saving data obtained from UIImageJPEGRepresentation() fails second time: ImageIO: CGImageRead_mapData 'open' failed | I'm running into a weird issue with my UIImage manipulation.
I'm doing a dropbox sync, and have to store my images as local files. To do so, I save them using the UIImagePNGRepresentation(image) or UIImageJPEGRepresentation(image, 0.66)
Here's my typical workflow:
User selects an image or takes a photo
Image gets assigned to an imageView
The image view's UIImage gets saved to a file using the method below
Next time the user re-opens the app, I read the image back from the file using
[UIImage imageWithContentsOfFile:fullImagePath]
This works once.
The second time I run through the routine, I get the error message listed below when trying to save the image to disk once again.
//saving the image
NSData* data = isPNG?UIImagePNGRepresentation(image):UIImageJPEGRepresentation(image, 0.66);
BOOL success = [data writeToFile:filepath atomically:YES];
if(!success)
{
DLog(@"failed to write to file: %@",filepath );
}
//loading the image
[UIImage imageWithContentsOfFile:fullImagePath]
//I'm getting this error when I try to re-save an image that has been previously converted to JPEG or PNG
2012-05-21 08:16:06.680 file already exists: NO
ImageIO: CGImageRead_mapData 'open' failed '/var/mobile/Applications/C1312BF8-C648-4397-82F3-D93E4FAAD35F/Documents/imageData/LogoImage.jpg'
error = 2 (No such file or directory)
May 21 08:16:06 <Error>: ImageIO: JPEG Not a JPEG file: starts with 0xff 0xd9
May 21 08:16:06 <Error>: ImageIO: JPEG Application transferred too few scanlines
It appears to me that this error is happening due to me trying to re-save the image as JPEG once again. If I ask the view to render itself in context (effectively creating a new image), the error does not happen.
**Does anyone know what I'm doing wrong? Am I missing some kind of metadata by trying to convert a UIImage to data, reloading it, and trying to convert it once again after displaying it to the user?**
Thank you!
| iphone | objective-c | ios | uiimage | imageio | null | open | iPhone iOS saving data obtained from UIImageJPEGRepresentation() fails second time: ImageIO: CGImageRead_mapData 'open' failed
===
I'm running into a weird issue with my UIImage manipulation.
I'm doing a dropbox sync, and have to store my images as local files. To do so, I save them using the UIImagePNGRepresentation(image) or UIImageJPEGRepresentation(image, 0.66)
Here's my typical workflow:
User selects an image or takes a photo
Image gets assigned to an imageView
The image view's UIImage gets saved to a file using the method below
Next time the user re-opens the app, I read the image back from the file using
[UIImage imageWithContentsOfFile:fullImagePath]
This works once.
The second time I run through the routine, I get the error message listed below when trying to save the image to disk once again.
//saving the image
NSData* data = isPNG?UIImagePNGRepresentation(image):UIImageJPEGRepresentation(image, 0.66);
BOOL success = [data writeToFile:filepath atomically:YES];
if(!success)
{
DLog(@"failed to write to file: %@",filepath );
}
//loading the image
[UIImage imageWithContentsOfFile:fullImagePath]
//I'm getting this error when I try to re-save an image that has been previously converted to JPEG or PNG
2012-05-21 08:16:06.680 file already exists: NO
ImageIO: CGImageRead_mapData 'open' failed '/var/mobile/Applications/C1312BF8-C648-4397-82F3-D93E4FAAD35F/Documents/imageData/LogoImage.jpg'
error = 2 (No such file or directory)
May 21 08:16:06 <Error>: ImageIO: JPEG Not a JPEG file: starts with 0xff 0xd9
May 21 08:16:06 <Error>: ImageIO: JPEG Application transferred too few scanlines
It appears to me that this error is happening due to me trying to re-save the image as JPEG once again. If I ask the view to render itself in context (effectively creating a new image), the error does not happen.
**Does anyone know what I'm doing wrong? Am I missing some kind of metadata by trying to convert a UIImage to data, reloading it, and trying to convert it once again after displaying it to the user?**
Thank you!
| 0 |
4,547,182 | 12/28/2010 15:38:40 | 556,122 | 12/28/2010 15:38:40 | 1 | 0 | How to build a yipit.com clone? | Specifically how to build a crawler which can read data from around 20 daily deal websites, and display on the clone site. | php | python | django | perl | null | 12/28/2010 16:17:54 | not a real question | How to build a yipit.com clone?
===
Specifically how to build a crawler which can read data from around 20 daily deal websites, and display on the clone site. | 1 |
4,565,826 | 12/30/2010 20:00:42 | 462,087 | 09/29/2010 18:08:49 | 32 | 0 | How to create a simple Proxy to access web servers in C | I’m trying to create an small Web Proxy in C. First, I’m trying to get a webpage, sending a GET frame to the server.
I don’t know what I have missed, but I am not receiving any response. I would really appreciate if you can help me to find what is missing in this code.
int main (int argc, char** argv) {
int cache_size, //size of the cache in KiB
port,
port_google = 80,
dir,
mySocket,
socket_google;
char google[] = "www.google.es", ip[16];
struct sockaddr_in socketAddr;
char buffer[10000000];
if (GetParameters(argc,argv,&cache_size,&port) != 0)
return -1;
GetIP (google, ip);
printf("ip2 = %s\n",ip);
dir = inet_addr (ip);
printf("ip3 = %i\n",dir);
/* Creation of a socket with Google */
socket_google = conectClient (port_google, dir, &socketAddr);
if (socket_google < 0) return -1;
else printf("Socket created\n");
sprintf(buffer,"GET /index.html HTTP/1.1\r\n\r\n");
if (write(socket_google, (void*)buffer, LONGITUD_MSJ+1) < 0 )
return 1;
else printf("GET frame sent\n");
strcpy(buffer,"\n");
read(socket_google, buffer, sizeof(buffer));
// strcpy(message,buffer);
printf("%s\n", buffer);
return 0;
}
And this is the code I use to create the socket. I think this part is OK, but I copy it just in case.
int conectClient (int puerto, int direccion, struct sockaddr_in *socketAddr) {
int mySocket;
char error[1000];
if ( (mySocket = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
printf("Error when creating the socket\n");
return -2;
}
socketAddr->sin_family = AF_INET;
socketAddr->sin_addr.s_addr = direccion;
socketAddr->sin_port = htons(puerto);
if (connect (mySocket, (struct sockaddr *)socketAddr,sizeof (*socketAddr)) == -1) {
snprintf(error, sizeof(error), "Error in %s:%d\n", __FILE__, __LINE__);
perror(error);
printf("%s\n",error);
printf ("-- Error when stablishing a connection\n");
return -1;
}
return mySocket;
}
Thanks!
| c | homework | sockets | proxy | webproxy | null | open | How to create a simple Proxy to access web servers in C
===
I’m trying to create an small Web Proxy in C. First, I’m trying to get a webpage, sending a GET frame to the server.
I don’t know what I have missed, but I am not receiving any response. I would really appreciate if you can help me to find what is missing in this code.
int main (int argc, char** argv) {
int cache_size, //size of the cache in KiB
port,
port_google = 80,
dir,
mySocket,
socket_google;
char google[] = "www.google.es", ip[16];
struct sockaddr_in socketAddr;
char buffer[10000000];
if (GetParameters(argc,argv,&cache_size,&port) != 0)
return -1;
GetIP (google, ip);
printf("ip2 = %s\n",ip);
dir = inet_addr (ip);
printf("ip3 = %i\n",dir);
/* Creation of a socket with Google */
socket_google = conectClient (port_google, dir, &socketAddr);
if (socket_google < 0) return -1;
else printf("Socket created\n");
sprintf(buffer,"GET /index.html HTTP/1.1\r\n\r\n");
if (write(socket_google, (void*)buffer, LONGITUD_MSJ+1) < 0 )
return 1;
else printf("GET frame sent\n");
strcpy(buffer,"\n");
read(socket_google, buffer, sizeof(buffer));
// strcpy(message,buffer);
printf("%s\n", buffer);
return 0;
}
And this is the code I use to create the socket. I think this part is OK, but I copy it just in case.
int conectClient (int puerto, int direccion, struct sockaddr_in *socketAddr) {
int mySocket;
char error[1000];
if ( (mySocket = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
printf("Error when creating the socket\n");
return -2;
}
socketAddr->sin_family = AF_INET;
socketAddr->sin_addr.s_addr = direccion;
socketAddr->sin_port = htons(puerto);
if (connect (mySocket, (struct sockaddr *)socketAddr,sizeof (*socketAddr)) == -1) {
snprintf(error, sizeof(error), "Error in %s:%d\n", __FILE__, __LINE__);
perror(error);
printf("%s\n",error);
printf ("-- Error when stablishing a connection\n");
return -1;
}
return mySocket;
}
Thanks!
| 0 |
3,545,592 | 08/23/2010 07:46:13 | 274,207 | 02/16/2010 09:09:28 | 262 | 14 | Convert windows phone 7 proj to win mobile 6.5? | Did someone try to convert a windows phone 7 project written in c# to an application that's working on a windows mobile 6.5 .
The question is: Are there some special libraries (for "painting the screen") that won't work with the win mobile CF ?
The only thing I know, that the application written in c# for win phone 7 is compiled in some strange (I don't remember now) file extensions, not in *.cab | c# | windows-mobile | windows-phone-7 | compatibility | null | null | open | Convert windows phone 7 proj to win mobile 6.5?
===
Did someone try to convert a windows phone 7 project written in c# to an application that's working on a windows mobile 6.5 .
The question is: Are there some special libraries (for "painting the screen") that won't work with the win mobile CF ?
The only thing I know, that the application written in c# for win phone 7 is compiled in some strange (I don't remember now) file extensions, not in *.cab | 0 |
2,682,275 | 04/21/2010 10:59:24 | 189,699 | 10/14/2009 09:23:40 | 3 | 0 | Why scala 2.8 REPL does not auto-complete some method (i.e. forall, exists)? | I started the scala REPL an write the following code:
scala> val a = Array(1,2,3,4)
a: Array[Int] = Array(1, 2, 3, 4)
scala> a.`<TAB>`
asInstanceOf getClass isInstanceOf toString
scala> a.exists(_ == 1)
res1: Boolean = true
`Why I don't have "exists" listed when I press <TAB>?` | scala-2.8 | repl | autocomplete | null | null | null | open | Why scala 2.8 REPL does not auto-complete some method (i.e. forall, exists)?
===
I started the scala REPL an write the following code:
scala> val a = Array(1,2,3,4)
a: Array[Int] = Array(1, 2, 3, 4)
scala> a.`<TAB>`
asInstanceOf getClass isInstanceOf toString
scala> a.exists(_ == 1)
res1: Boolean = true
`Why I don't have "exists" listed when I press <TAB>?` | 0 |
1,554,496 | 10/12/2009 13:12:55 | 146,780 | 07/29/2009 01:23:43 | 136 | 3 | Intellisense help VC++ 9 | I'm new to c++. I'm using visual studio professional. I'm using Allegro library to make a game. When I access an Allegro type or an std; type, intelisense shows me the members. for instance if I do buffer-> it brings up a rectangle listbox of all the class members. But when they are my types it does not work.
I made a struct called PLAYER
struct PLAYER{
int age;
int health;
bool isdead;
};
so then I expected that if I did:
PLAYER *player;
player.
that I would see the members.
I tried :: , . , and -> but none work.
Where am I going wrong?
If I do player.health = 100;
it compiles but intellisense doesnt pick up on it.
Thanks
| visual-c++ | null | null | null | null | null | open | Intellisense help VC++ 9
===
I'm new to c++. I'm using visual studio professional. I'm using Allegro library to make a game. When I access an Allegro type or an std; type, intelisense shows me the members. for instance if I do buffer-> it brings up a rectangle listbox of all the class members. But when they are my types it does not work.
I made a struct called PLAYER
struct PLAYER{
int age;
int health;
bool isdead;
};
so then I expected that if I did:
PLAYER *player;
player.
that I would see the members.
I tried :: , . , and -> but none work.
Where am I going wrong?
If I do player.health = 100;
it compiles but intellisense doesnt pick up on it.
Thanks
| 0 |
11,539,166 | 07/18/2012 10:19:58 | 1,248,108 | 03/04/2012 13:10:33 | 1 | 0 | NatTypeDetection can't be used on ios | apllication on ios will not run when use NatTypeDetection (RakNet) ,but it is ok
on simulator and mac | ios | nat | null | null | null | 07/19/2012 21:30:49 | not a real question | NatTypeDetection can't be used on ios
===
apllication on ios will not run when use NatTypeDetection (RakNet) ,but it is ok
on simulator and mac | 1 |
9,130,481 | 02/03/2012 14:46:54 | 191,379 | 10/16/2009 18:46:18 | 75 | 3 | ExtJS display RowExpander on condition only | I currently have a rather big Grid and am successfully using the RowExpander plugin to display complementary informations on certain rows. My problem is that it's not all rows that contain the aforementioned complementary informations and I do not wish the RowExpander to be active nor to show it's "+" icon if a particular data store's entry is empty. I tried using the conventional "renderer" property on the RowExpander object, but it did not work.
So basically, how can you have the RowExpander's icon and double click shown and activated only if a certain data store's field != ""?
Thanks in advance! =) | javascript | extjs | grid | extjs3 | null | null | open | ExtJS display RowExpander on condition only
===
I currently have a rather big Grid and am successfully using the RowExpander plugin to display complementary informations on certain rows. My problem is that it's not all rows that contain the aforementioned complementary informations and I do not wish the RowExpander to be active nor to show it's "+" icon if a particular data store's entry is empty. I tried using the conventional "renderer" property on the RowExpander object, but it did not work.
So basically, how can you have the RowExpander's icon and double click shown and activated only if a certain data store's field != ""?
Thanks in advance! =) | 0 |
4,473,912 | 12/17/2010 19:03:56 | 485,880 | 10/24/2010 22:05:02 | 1 | 0 | A question regarding C# and SQL | i am doing an updation of record and i was successfull doing so but, i dind`t wanted to that way actually.. i have done that, i have added a textbox onto the form and on the click, i`m getting the id in the id`s textbox. But, i want dont want to have an ID textbox on my form instead and want to get the ID of the Customer.. i am struggling doing so.. help required..
here is my Code :
private void btnUpdate_Click(object sender, EventArgs e)
{
SqlConnection cn = new SqlConnection(@"Data Source=COMPAQ-PC-PC\SQLEXPRESS;Initial Catalog=Gym;Integrated Security=True");
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
int result = new SqlCommand("Update Customer set Customer_Name = '" + tbName.Text + "',Cell_Number = '" + tbContactNumber.Text + "',Customer_Address = '" + tbAddress.Text + "' where CustomerID = " + tbID.Text, cn).ExecuteNonQuery();
if (cn.State == ConnectionState.Open)
{
cn.Close();
}
cn.Dispose();
BindGridView();
}
private void BindGridView()
{
SqlConnection cn = new SqlConnection(@"Data Source=COMPAQ-PC-PC\SQLEXPRESS;Initial Catalog=Gym;Integrated Security=True");
SqlCommand cmd = new SqlCommand("Select * from Customer", cn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
dgView_CustomerInfo.DataSource = dt.DefaultView;
}
private void dgView_CustomerInfo_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
tbID.Text = dgView_CustomerInfo.Rows[e.RowIndex].Cells["CustomerID"].Value.ToString();
tbName.Text = dgView_CustomerInfo.Rows[e.RowIndex].Cells["Customer_Name"].Value.ToString();
tbContactNumber.Text = dgView_CustomerInfo.Rows[e.RowIndex].Cells["Cell_Number"].Value.ToString();
tbAddress.Text = dgView_CustomerInfo.Rows[e.RowIndex].Cells["Customer_Address"].Value.ToString();
} | c# | sql | null | null | null | 12/18/2010 06:56:05 | not a real question | A question regarding C# and SQL
===
i am doing an updation of record and i was successfull doing so but, i dind`t wanted to that way actually.. i have done that, i have added a textbox onto the form and on the click, i`m getting the id in the id`s textbox. But, i want dont want to have an ID textbox on my form instead and want to get the ID of the Customer.. i am struggling doing so.. help required..
here is my Code :
private void btnUpdate_Click(object sender, EventArgs e)
{
SqlConnection cn = new SqlConnection(@"Data Source=COMPAQ-PC-PC\SQLEXPRESS;Initial Catalog=Gym;Integrated Security=True");
if (cn.State == ConnectionState.Closed)
{
cn.Open();
}
int result = new SqlCommand("Update Customer set Customer_Name = '" + tbName.Text + "',Cell_Number = '" + tbContactNumber.Text + "',Customer_Address = '" + tbAddress.Text + "' where CustomerID = " + tbID.Text, cn).ExecuteNonQuery();
if (cn.State == ConnectionState.Open)
{
cn.Close();
}
cn.Dispose();
BindGridView();
}
private void BindGridView()
{
SqlConnection cn = new SqlConnection(@"Data Source=COMPAQ-PC-PC\SQLEXPRESS;Initial Catalog=Gym;Integrated Security=True");
SqlCommand cmd = new SqlCommand("Select * from Customer", cn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
dgView_CustomerInfo.DataSource = dt.DefaultView;
}
private void dgView_CustomerInfo_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
tbID.Text = dgView_CustomerInfo.Rows[e.RowIndex].Cells["CustomerID"].Value.ToString();
tbName.Text = dgView_CustomerInfo.Rows[e.RowIndex].Cells["Customer_Name"].Value.ToString();
tbContactNumber.Text = dgView_CustomerInfo.Rows[e.RowIndex].Cells["Cell_Number"].Value.ToString();
tbAddress.Text = dgView_CustomerInfo.Rows[e.RowIndex].Cells["Customer_Address"].Value.ToString();
} | 1 |
10,714,389 | 05/23/2012 06:09:36 | 268,667 | 02/08/2010 13:27:26 | 3,306 | 147 | How to change the default namespace for Embedded Resources with MSBuild? | I am attempting to embed an unmanaged dll in my console project. The default namespace of the project is `Company.Project1Exe`. The Assembly Name (output exe ) is named `project1.exe`
The dlls are added to the project using the `Add as Link` option and are located in a `Libs\x86` subfolder
Company.Project1Exe
|
|--Program.cs
|--Libs
|--x86
|-My1st.dll
|-My2nd.dll
They have been added to the project using the `Add as Link` option, thus are not physically locate in the `Libs` subfolder.
I have set the Build Action of both these dlls to 'Embedded Resource'.
By default, MSBuild will embed these dlls using the `DefaultNamspace.ExtendedNamespace.FileName` where the `ExtendedNamespace` represents the directory structure of the project.
This results in resource being embedded as `Company.Project1.Libs.x86.My1st.dll` and `Company.Project1.Libs.x86.My2nd.dll` respectively.
I want these resources to embedded using the Assembly Name so that they are embedded as `Project1.Libs.x86.My1st.dll` and `Project1.Libs.x86.My2nd.dll` respectively.
How can I do this?
| visual-studio-2010 | msbuild | embedded-resource | null | null | null | open | How to change the default namespace for Embedded Resources with MSBuild?
===
I am attempting to embed an unmanaged dll in my console project. The default namespace of the project is `Company.Project1Exe`. The Assembly Name (output exe ) is named `project1.exe`
The dlls are added to the project using the `Add as Link` option and are located in a `Libs\x86` subfolder
Company.Project1Exe
|
|--Program.cs
|--Libs
|--x86
|-My1st.dll
|-My2nd.dll
They have been added to the project using the `Add as Link` option, thus are not physically locate in the `Libs` subfolder.
I have set the Build Action of both these dlls to 'Embedded Resource'.
By default, MSBuild will embed these dlls using the `DefaultNamspace.ExtendedNamespace.FileName` where the `ExtendedNamespace` represents the directory structure of the project.
This results in resource being embedded as `Company.Project1.Libs.x86.My1st.dll` and `Company.Project1.Libs.x86.My2nd.dll` respectively.
I want these resources to embedded using the Assembly Name so that they are embedded as `Project1.Libs.x86.My1st.dll` and `Project1.Libs.x86.My2nd.dll` respectively.
How can I do this?
| 0 |
10,275,279 | 04/23/2012 05:33:54 | 1,347,877 | 04/21/2012 05:14:11 | 1 | 0 | What is DBase? How to use DBase in Win98 Operating system? | **What is DBase?** How to use DBase in **Windows 98**? How to install**DBase**? Please I have Urgent requirement? Suggest me how to use? | database | dbms | dbase | null | null | 04/23/2012 09:30:18 | not a real question | What is DBase? How to use DBase in Win98 Operating system?
===
**What is DBase?** How to use DBase in **Windows 98**? How to install**DBase**? Please I have Urgent requirement? Suggest me how to use? | 1 |
3,107,439 | 06/24/2010 05:29:40 | 325,418 | 05/09/2009 15:50:29 | 4,436 | 116 | In Ruby, how do you print out the URL params and Server environment variables? | In Ruby (running on a web server as a .cgi), how do you print out the URL params and Server environment variables? | ruby | null | null | null | null | null | open | In Ruby, how do you print out the URL params and Server environment variables?
===
In Ruby (running on a web server as a .cgi), how do you print out the URL params and Server environment variables? | 0 |
4,080,971 | 11/02/2010 18:34:04 | 281,709 | 02/26/2010 00:20:57 | 8 | 0 | Best API for iOS Music Notation and Playback | I'm constructing an application that allows you to compose and play back your compositions for iOS. I looked into CoreMIDI (new to 4.2), but I'm not looking to interface with any keyboards or other MIDI hardware and think there may be a simpler way. Does anyone else have any suggestions on the best API to use for this type of task? | iphone | audio | ios | null | null | null | open | Best API for iOS Music Notation and Playback
===
I'm constructing an application that allows you to compose and play back your compositions for iOS. I looked into CoreMIDI (new to 4.2), but I'm not looking to interface with any keyboards or other MIDI hardware and think there may be a simpler way. Does anyone else have any suggestions on the best API to use for this type of task? | 0 |
5,500,264 | 03/31/2011 13:02:47 | 640,015 | 03/01/2011 19:50:06 | 97 | 0 | Celcius to Farenheit | I can convert from ferenheit to celcius, but not the other way around. I have attached the code below. Hopefully it's enough to see what is going on.
public void actionPerformed(ActionEvent arg0) {
double temps = 0, temp1 = 0;
String instrings;
instrings = temp.getText();
if(instrings.equals(""))
{
instrings = "0";
temp.setText("0");
}
temps = Double.parseDouble(instrings);
instrings = temp.getText();
if(instrings.equals(""))
{
instrings = "0";
temp.setText("0");
}
temp1 = Double.parseDouble(instrings);
if(arg0.getActionCommand().equals("C")){
temps = (( temps * 9)/5+32);
DecimalFormat formatters = new DecimalFormat("#,###,###.###");
results.setText(""+formatters.format(temps));
}
else if(arg0.getActionCommand().equals("F"));
{
temp1 = (((temps - 32)/9)*5);
DecimalFormat formatters = new DecimalFormat("#,###,###.###");
results.setText(""+formatters.format(temp1));
} | java | eclipse | null | null | null | null | open | Celcius to Farenheit
===
I can convert from ferenheit to celcius, but not the other way around. I have attached the code below. Hopefully it's enough to see what is going on.
public void actionPerformed(ActionEvent arg0) {
double temps = 0, temp1 = 0;
String instrings;
instrings = temp.getText();
if(instrings.equals(""))
{
instrings = "0";
temp.setText("0");
}
temps = Double.parseDouble(instrings);
instrings = temp.getText();
if(instrings.equals(""))
{
instrings = "0";
temp.setText("0");
}
temp1 = Double.parseDouble(instrings);
if(arg0.getActionCommand().equals("C")){
temps = (( temps * 9)/5+32);
DecimalFormat formatters = new DecimalFormat("#,###,###.###");
results.setText(""+formatters.format(temps));
}
else if(arg0.getActionCommand().equals("F"));
{
temp1 = (((temps - 32)/9)*5);
DecimalFormat formatters = new DecimalFormat("#,###,###.###");
results.setText(""+formatters.format(temp1));
} | 0 |
2,775,512 | 05/05/2010 17:45:55 | 247,519 | 01/10/2010 15:57:37 | 1 | 0 | Client / Server security from mobile to website | Hey. Am new to the world of web programming and learning a bunch of fairly simple new pieces of tech, trying to piece them all together.
So, we have a simple client (currently iPhone, to move to J2ME soon) that's pulling down lists of data via PHP, which is talking to a MySQL db. I have a rudimentary user/login system so that data is only served to someone who matches a known user etc, either on the website or on the client.
All the php scripts on the website that query the DB check to make sure an active session is in place, otherwise dumping the user back to the login screen.
I've read a little about SSL and want to know if that is sufficient to protect the website AND the data passing between the server and the client? | mysql | php | security | ssl | iphone | null | open | Client / Server security from mobile to website
===
Hey. Am new to the world of web programming and learning a bunch of fairly simple new pieces of tech, trying to piece them all together.
So, we have a simple client (currently iPhone, to move to J2ME soon) that's pulling down lists of data via PHP, which is talking to a MySQL db. I have a rudimentary user/login system so that data is only served to someone who matches a known user etc, either on the website or on the client.
All the php scripts on the website that query the DB check to make sure an active session is in place, otherwise dumping the user back to the login screen.
I've read a little about SSL and want to know if that is sufficient to protect the website AND the data passing between the server and the client? | 0 |
8,083,181 | 11/10/2011 16:49:04 | 624,071 | 02/19/2011 04:30:35 | 108 | 2 | WPF inline-edit datagrid: currency editing | I have a WPF datagrid with an editable column that happens to be a decimal datatype, with a currency mask. Unfortunately, when I attempt to edit this mask, the output result is very bizarre: i.e. if I select the column and type '400' the currency mask fills in $004.00, this is quite undesirable. How can I remedy this? I would like for the mask to NOT show up while editing (or at least change the edit so it isn't right-to-left)
Any ideas?
Thanks. | c# | wpf | null | null | null | null | open | WPF inline-edit datagrid: currency editing
===
I have a WPF datagrid with an editable column that happens to be a decimal datatype, with a currency mask. Unfortunately, when I attempt to edit this mask, the output result is very bizarre: i.e. if I select the column and type '400' the currency mask fills in $004.00, this is quite undesirable. How can I remedy this? I would like for the mask to NOT show up while editing (or at least change the edit so it isn't right-to-left)
Any ideas?
Thanks. | 0 |
152,441 | 09/30/2008 09:57:21 | 3,839 | 08/31/2008 10:11:12 | 1,286 | 66 | Unit testing for PL/SQL | Anyone have any experience or tools for unit testing PL/SQL. The best looking tool I've seen for this seems to be Quests Code Tester, but i'm not sure how well that would integration with continuous integration tools or command line testing? | oracle | plsql | null | null | null | 07/26/2012 12:16:10 | not constructive | Unit testing for PL/SQL
===
Anyone have any experience or tools for unit testing PL/SQL. The best looking tool I've seen for this seems to be Quests Code Tester, but i'm not sure how well that would integration with continuous integration tools or command line testing? | 4 |
6,920,670 | 08/03/2011 01:21:07 | 283,863 | 03/01/2010 19:39:37 | 186 | 34 | How to download file using JavaScript | How to download a file using JavaScript *only*?
Please don't give me answer like
`"Change the `***`MIME`***` in the sever"`
or
`window.open(`***`URL`***`,"_blank")`
Because I know there are another solutions. Thanks. | javascript | null | null | null | null | 08/06/2011 03:23:43 | not constructive | How to download file using JavaScript
===
How to download a file using JavaScript *only*?
Please don't give me answer like
`"Change the `***`MIME`***` in the sever"`
or
`window.open(`***`URL`***`,"_blank")`
Because I know there are another solutions. Thanks. | 4 |
492,430 | 01/29/2009 16:43:07 | 12,469 | 09/16/2008 14:29:15 | 1,192 | 41 | SAN disk layout | So we've decided on an EMC NX4 for our storage setup.
Database workload
Write: ~220 IOPS
Read: ~6 IOPS
Web workload
Write: ~10 IOPS
Read: ~55 IOPS
I had planned to go for 5 x 15k SAS disks in RAID 10 + hot spare for our databases, and then a 7 x 7,2k SATA RAID 6 + hot spare for our web data. However, EMC conveniently forgot to mention that the first 5 disks had to be setup in a RAID 5 for the system volumes. We haven't signed the agreement yet, but I obviously need to come up with a new disk layout for this to work out.
They suggest we put the 15k SAS disks in a RAID 5 + hot spare, but won't this rather quickly give me write performance issues? Besides the RAID 5, we'd then be left with a 6 disk RAID 6 leaving us 4/3TB usable data depending on hot spare/not.
Alternatively we should stick with the RAID 10 for our DB's and put our 1TB 7,2k SATA disks in RAID5 - Though I'm not fond of the rebuild time and insecurity of running these in RAID5. The raid level suits web data much better however.
So we basically have three choices as I see it:
6 x 15k SAS RAID5 for System Volumes + DB data+log
6 x 7,2k SATA RAID6 for file data
OR
6 x 7,2k SATA RAID5 for System Volumes + file data
5 x 15k SAS RAID10 for DB data+log
OR
5 x 15k SAS RAID5 for System Volumes + DB Data
2 x 15k SAS RAID1 for DB Log
1 x 15k SAS hot spare
3 x 7,2k SATA RAID5 for file data
1 x 7,2k SATA hot spare
Option 1 may have write performance issues. Option 2 can become dangerous during rebuilds. Option 3 is good for DB performance but leaves us only 2TB usable file storage, meaning we'll soon have to expand with an extra shelf - and at that point convert our file data to a RAID6.
| san | raid | performance | null | null | 01/29/2009 17:15:17 | off topic | SAN disk layout
===
So we've decided on an EMC NX4 for our storage setup.
Database workload
Write: ~220 IOPS
Read: ~6 IOPS
Web workload
Write: ~10 IOPS
Read: ~55 IOPS
I had planned to go for 5 x 15k SAS disks in RAID 10 + hot spare for our databases, and then a 7 x 7,2k SATA RAID 6 + hot spare for our web data. However, EMC conveniently forgot to mention that the first 5 disks had to be setup in a RAID 5 for the system volumes. We haven't signed the agreement yet, but I obviously need to come up with a new disk layout for this to work out.
They suggest we put the 15k SAS disks in a RAID 5 + hot spare, but won't this rather quickly give me write performance issues? Besides the RAID 5, we'd then be left with a 6 disk RAID 6 leaving us 4/3TB usable data depending on hot spare/not.
Alternatively we should stick with the RAID 10 for our DB's and put our 1TB 7,2k SATA disks in RAID5 - Though I'm not fond of the rebuild time and insecurity of running these in RAID5. The raid level suits web data much better however.
So we basically have three choices as I see it:
6 x 15k SAS RAID5 for System Volumes + DB data+log
6 x 7,2k SATA RAID6 for file data
OR
6 x 7,2k SATA RAID5 for System Volumes + file data
5 x 15k SAS RAID10 for DB data+log
OR
5 x 15k SAS RAID5 for System Volumes + DB Data
2 x 15k SAS RAID1 for DB Log
1 x 15k SAS hot spare
3 x 7,2k SATA RAID5 for file data
1 x 7,2k SATA hot spare
Option 1 may have write performance issues. Option 2 can become dangerous during rebuilds. Option 3 is good for DB performance but leaves us only 2TB usable file storage, meaning we'll soon have to expand with an extra shelf - and at that point convert our file data to a RAID6.
| 2 |
9,904,055 | 03/28/2012 08:50:00 | 1,297,226 | 03/28/2012 05:30:13 | 1 | 0 | I want to authenticate the login details, that is User name and Password supplied in the UI the Database Class is: |
This below function I call from my activity class like `Cursor c = DBHelper.test(UNAME, UPASS);`
Cursor c = mDb.rawQuery("SELECT _id FROM Login WHERE Customer_Name=? AND Password=?", new String[] {username, password});
if(c.moveToFirst()) {
// at least one row was returned, this should signal success
} else {
// authentication failed
}
This is my on click function:
public void onClick(View arg0){
Cursor c = DBHelper.test(UNAME, UPASS);
startManagingCursor(c);
String[] from = new String[] {DbAdapter.CNAMEPRIME,DbAdapter.CPASSPRIME};
if(DbAdapter.CNAMEPRIME == UNAME && DbAdapter.CPASSPRIME == UPASS){
//Starting a new Intent
Intent nextScreen = new Intent(getApplicationContext(), LenDenTab.class);
//Sending data to another Activity
startActivity(nextScreen);
}
else{
Context context = getApplicationContext();
String text = "Invalid Login";
int duration = Toast.LENGTH_LONG;
Toast toastNodification = Toast.makeText(context, text, duration);
toastNodification.show();
}
}
});
} | android | sql | null | null | null | 03/29/2012 12:12:36 | too localized | I want to authenticate the login details, that is User name and Password supplied in the UI the Database Class is:
===
This below function I call from my activity class like `Cursor c = DBHelper.test(UNAME, UPASS);`
Cursor c = mDb.rawQuery("SELECT _id FROM Login WHERE Customer_Name=? AND Password=?", new String[] {username, password});
if(c.moveToFirst()) {
// at least one row was returned, this should signal success
} else {
// authentication failed
}
This is my on click function:
public void onClick(View arg0){
Cursor c = DBHelper.test(UNAME, UPASS);
startManagingCursor(c);
String[] from = new String[] {DbAdapter.CNAMEPRIME,DbAdapter.CPASSPRIME};
if(DbAdapter.CNAMEPRIME == UNAME && DbAdapter.CPASSPRIME == UPASS){
//Starting a new Intent
Intent nextScreen = new Intent(getApplicationContext(), LenDenTab.class);
//Sending data to another Activity
startActivity(nextScreen);
}
else{
Context context = getApplicationContext();
String text = "Invalid Login";
int duration = Toast.LENGTH_LONG;
Toast toastNodification = Toast.makeText(context, text, duration);
toastNodification.show();
}
}
});
} | 3 |
10,085,022 | 04/10/2012 07:47:52 | 313,245 | 04/09/2010 23:35:47 | 1,207 | 13 | Does NoSQL databases use or need indexes? | I am a newbie in NoSQL databases and this may sound a bit stupid but I was wondering if NoSQL databases use or need indexes?
If yes, how to make or manage them? any links?
Thanks | database | indexing | index | nosql | null | null | open | Does NoSQL databases use or need indexes?
===
I am a newbie in NoSQL databases and this may sound a bit stupid but I was wondering if NoSQL databases use or need indexes?
If yes, how to make or manage them? any links?
Thanks | 0 |
2,109,146 | 01/21/2010 12:34:07 | 54,988 | 01/14/2009 13:04:39 | 375 | 4 | Is it possible for WHEN to check the if the variable belongs to an array? | How can I do something like this ? or do i need to use IF all the time?
ar = [["a","b"],["c"],["d","e"]]
x = "b"
case x
when ar[0].include?(x)
puts "do something"
when ar[1].include?(x)
puts "do else"
when ar[2].include?(x)
puts "do a 3rd thing"
end
I'm using ruby 1.8.7 | ruby | case | switch-statement | null | null | null | open | Is it possible for WHEN to check the if the variable belongs to an array?
===
How can I do something like this ? or do i need to use IF all the time?
ar = [["a","b"],["c"],["d","e"]]
x = "b"
case x
when ar[0].include?(x)
puts "do something"
when ar[1].include?(x)
puts "do else"
when ar[2].include?(x)
puts "do a 3rd thing"
end
I'm using ruby 1.8.7 | 0 |
3,591,863 | 08/28/2010 18:09:55 | 180,663 | 09/28/2009 19:11:43 | 473 | 1 | Gem that allows for data access using sharded mysql databases while maintaining the usage of Activerecord | *This is a relatively complex problem that I am thinking of, so please suggest edits or comment on parts where you are not clear about. I will update and iterate based on your comments*
I am thinking of a developing a rails gem that simplifies the usage of sharded tables, even when most of your data is stored in relational databases. I believe this is similar to the concept being used in Quora or Friendfeed when they hit a wall scaling w traditional mysql, with most of the potential solutions requiring massive migration (nosql), or just being really painful (sticking w relational completely)
- http://bret.appspot.com/entry/how-friendfeed-uses-mysql
- http://www.quora.com/When-Adam-DAngelo-says-partition-your-data-at-the-application-level-what-exactly-does-he-mean?q=application+layer+quora+adam+
Essentially, how can we continue using MySQL for a lot of things it is really good at, yet allowing parts of the system to scale? This will allow someone got started using mysql/activerecord, but hit a roadblock scaling to easily scale the parts of the database that makes sense.
For us, we are using Ruby on Rails on a sharded database, and storing JSON blobs in them. Since we cannot do joins, we are creating tables for relationships between entities.
For example, we have 10 different type of entities. Each entity can be linked to each other using a big (sharded) relationship tables.
The tables are extremely simple. The indexes is (Id1, Id2..., type), and data is stored in the JSON blob.
- Id, type, {json data}
- Id1, Id2, type {json data}
- Id1, Id2, Id3, type {json data}
We have put a lot of work into creating higher level interfaces for storing a range of data sets for relational data
For any given type, you can define a type of storage - (value, unweighted list, weighted lists, weighted lists with guids)
We have higher level interfaces for each of them - querying, sorting, timestamp comparison, intersections etc.
That way, if someone realizes that they need to scale a specific part of the database, they can keep most of their infrastructure, and move only the tables they need into this sharded database
What are your thoughts? As mentioned above, I would love to know what you folks think | mysql | ruby-on-rails | scalability | null | null | null | open | Gem that allows for data access using sharded mysql databases while maintaining the usage of Activerecord
===
*This is a relatively complex problem that I am thinking of, so please suggest edits or comment on parts where you are not clear about. I will update and iterate based on your comments*
I am thinking of a developing a rails gem that simplifies the usage of sharded tables, even when most of your data is stored in relational databases. I believe this is similar to the concept being used in Quora or Friendfeed when they hit a wall scaling w traditional mysql, with most of the potential solutions requiring massive migration (nosql), or just being really painful (sticking w relational completely)
- http://bret.appspot.com/entry/how-friendfeed-uses-mysql
- http://www.quora.com/When-Adam-DAngelo-says-partition-your-data-at-the-application-level-what-exactly-does-he-mean?q=application+layer+quora+adam+
Essentially, how can we continue using MySQL for a lot of things it is really good at, yet allowing parts of the system to scale? This will allow someone got started using mysql/activerecord, but hit a roadblock scaling to easily scale the parts of the database that makes sense.
For us, we are using Ruby on Rails on a sharded database, and storing JSON blobs in them. Since we cannot do joins, we are creating tables for relationships between entities.
For example, we have 10 different type of entities. Each entity can be linked to each other using a big (sharded) relationship tables.
The tables are extremely simple. The indexes is (Id1, Id2..., type), and data is stored in the JSON blob.
- Id, type, {json data}
- Id1, Id2, type {json data}
- Id1, Id2, Id3, type {json data}
We have put a lot of work into creating higher level interfaces for storing a range of data sets for relational data
For any given type, you can define a type of storage - (value, unweighted list, weighted lists, weighted lists with guids)
We have higher level interfaces for each of them - querying, sorting, timestamp comparison, intersections etc.
That way, if someone realizes that they need to scale a specific part of the database, they can keep most of their infrastructure, and move only the tables they need into this sharded database
What are your thoughts? As mentioned above, I would love to know what you folks think | 0 |
8,163,137 | 11/17/2011 06:43:44 | 302,593 | 02/10/2010 10:11:26 | 34 | 0 | How to get the list from sharepoint 2010? | How to get the list count in sharepoint 2010
Regards,
Raji. | sharepoint2010 | null | null | null | null | 03/21/2012 02:51:08 | not a real question | How to get the list from sharepoint 2010?
===
How to get the list count in sharepoint 2010
Regards,
Raji. | 1 |
6,538,883 | 06/30/2011 17:44:36 | 364,914 | 10/03/2009 05:04:00 | 531 | 10 | Java: how to locate an element via xpath string on org.w3c.dom.document | How do you quickly locate element/elements via xpath string on a given org.w3c.dom.document? there seems to be no `FindElementsByXpath()` method.
ex) /html/body/p/div[3]/a
I found that recursively iterating through all the child node levels to be quite slow when there are lot of elements of same name. Any suggestions?
I cannot use any parser or library, must work with w3c dom document only. | java | dom | xpath | null | null | null | open | Java: how to locate an element via xpath string on org.w3c.dom.document
===
How do you quickly locate element/elements via xpath string on a given org.w3c.dom.document? there seems to be no `FindElementsByXpath()` method.
ex) /html/body/p/div[3]/a
I found that recursively iterating through all the child node levels to be quite slow when there are lot of elements of same name. Any suggestions?
I cannot use any parser or library, must work with w3c dom document only. | 0 |
3,268,018 | 07/16/2010 18:59:43 | 394,222 | 07/16/2010 18:50:04 | 1 | 0 | "Web Services" Node is absent in GlassFish Server Open Source Edition 3.0.1 | I need to deploy a Web Service, but I can't see the "Web Services" Node. Is there a way to enable it in glassfish? | web-services | glassfish-3 | null | null | null | null | open | "Web Services" Node is absent in GlassFish Server Open Source Edition 3.0.1
===
I need to deploy a Web Service, but I can't see the "Web Services" Node. Is there a way to enable it in glassfish? | 0 |
9,489,114 | 02/28/2012 20:21:58 | 1,235,898 | 02/27/2012 15:21:14 | 9 | 0 | Access denied - mysql_connect() | I have got the following message in my browser:
An error occurred in script'/home/greentes/public_html/includes/mysql.inc.php' on line 10:
mysqli_connect() [function.mysqli-connect]: (42000/1044): Access denied for user 'greentes_uson'@'localhost' to database 'greentes_pdfshop'
Line 10, of mysql.inc.php:
$dbc = mysqli_connect(DB_HOST,DB_USER, DB_PASSWORD, DB_NAME);
....................
What could be causing this error please? Is this sufficient information to answer this question? Thank you | php | mysql | null | null | null | 02/28/2012 21:00:44 | too localized | Access denied - mysql_connect()
===
I have got the following message in my browser:
An error occurred in script'/home/greentes/public_html/includes/mysql.inc.php' on line 10:
mysqli_connect() [function.mysqli-connect]: (42000/1044): Access denied for user 'greentes_uson'@'localhost' to database 'greentes_pdfshop'
Line 10, of mysql.inc.php:
$dbc = mysqli_connect(DB_HOST,DB_USER, DB_PASSWORD, DB_NAME);
....................
What could be causing this error please? Is this sufficient information to answer this question? Thank you | 3 |
8,915,684 | 01/18/2012 18:54:18 | 926,637 | 09/03/2011 13:24:53 | 16 | 0 | Conerting text to unicode in javascript | Well i have the following
<script language="Javascript" type="text/javascript">
<!--
function showUnicode()
{
var text = prompt('Enter the wanted text','Unicode')
var unicode
var ntext
var temp
var i = 0
//got the text now transform it in unicode
for(i;i < text.length;i++)
{
unicode += text.charCodeAt(i)
}
//now do an alert
alert('Here is the unicode:\n' + unicode + '\nof:\n' + text)
}
-->
</script>
and the alert shows: Here is the unicode NaN of text
why does it show only NaN and not the rest of the Unicode? | javascript | unicode | null | null | null | null | open | Conerting text to unicode in javascript
===
Well i have the following
<script language="Javascript" type="text/javascript">
<!--
function showUnicode()
{
var text = prompt('Enter the wanted text','Unicode')
var unicode
var ntext
var temp
var i = 0
//got the text now transform it in unicode
for(i;i < text.length;i++)
{
unicode += text.charCodeAt(i)
}
//now do an alert
alert('Here is the unicode:\n' + unicode + '\nof:\n' + text)
}
-->
</script>
and the alert shows: Here is the unicode NaN of text
why does it show only NaN and not the rest of the Unicode? | 0 |
7,664,350 | 10/05/2011 16:09:33 | 499,417 | 11/06/2010 19:26:35 | 1,550 | 46 | iOS 5 - No more UDID - How to keep some critical datas to identifiy the user even if app is deleted | I've just read on a blog that the UDID will not survive iOS 5. I use it as an identifier combined to an app ID I generate myself. Without that UDID, I will just have the App Identifier but as it is stored in the userDefaukts for the moment, it is deleted if the app is uninstalled.
How may I do to keep it safe even if the app is deleted from the iPhone ? I have to achieve this to ensure that I have at least one stable identifier, even if it's not the sole one I use to identify the user. | iphone | ios | nsuserdefaults | uniqueidentifier | udid | null | open | iOS 5 - No more UDID - How to keep some critical datas to identifiy the user even if app is deleted
===
I've just read on a blog that the UDID will not survive iOS 5. I use it as an identifier combined to an app ID I generate myself. Without that UDID, I will just have the App Identifier but as it is stored in the userDefaukts for the moment, it is deleted if the app is uninstalled.
How may I do to keep it safe even if the app is deleted from the iPhone ? I have to achieve this to ensure that I have at least one stable identifier, even if it's not the sole one I use to identify the user. | 0 |
11,614,437 | 07/23/2012 14:21:55 | 1,252,575 | 03/06/2012 15:28:13 | 84 | 13 | Delete file used by another process and get its info | I'm writing a program that searches for some files and deletes them. I desire to implement two things (probably using PInvoke):
- find all the processes that use "found file", kill it and delete file,
- get info about that process (its name should be fine - for log).
Do you know any useful PInvoke methods?
Thx in advance. | c# | process | pinvoke | null | null | 07/24/2012 15:14:15 | not a real question | Delete file used by another process and get its info
===
I'm writing a program that searches for some files and deletes them. I desire to implement two things (probably using PInvoke):
- find all the processes that use "found file", kill it and delete file,
- get info about that process (its name should be fine - for log).
Do you know any useful PInvoke methods?
Thx in advance. | 1 |
8,521,623 | 12/15/2011 14:27:58 | 935,705 | 09/08/2011 20:50:51 | 6 | 0 | Facebook post impressions missing since December 6 for Facebook pages | This is the latest date I'm able to get post impressions. I've also noticed that post are now displaying how many people were reached, am how many people are talking about the post. What happened to impressions, and where can I get this new information? | facebook | facebook-insights | impressions | null | null | 12/15/2011 17:44:59 | off topic | Facebook post impressions missing since December 6 for Facebook pages
===
This is the latest date I'm able to get post impressions. I've also noticed that post are now displaying how many people were reached, am how many people are talking about the post. What happened to impressions, and where can I get this new information? | 2 |
9,139,109 | 02/04/2012 07:11:56 | 756,120 | 05/16/2011 18:02:12 | 6 | 0 | Adding new Tomcat user | i want to add a new user to apache tomcat ver6 web server .
i added the following line to tomcat-users.xml:
<user username="abhishek" password="abhi" roles="tomcat"/>
i also modify the /etc/init.d/tomcat6 file as follows:
TOMCAT6_USER=abhishek
TOMCAT6_GROUP=admin
i am using ubuntu 10.04 and from System->Administration->users and groups , i confirmed that 'abhishek' belongs to group admin. I start the web server, but the localhost:8080 is not responding , neither it throws any error. Reverting the changes in /etc/init.d/tomcat6 to default results in fine working. Where am i wrong in adding a new user to tomcat server ? | tomcat | user | new-operator | null | null | 02/05/2012 01:26:33 | off topic | Adding new Tomcat user
===
i want to add a new user to apache tomcat ver6 web server .
i added the following line to tomcat-users.xml:
<user username="abhishek" password="abhi" roles="tomcat"/>
i also modify the /etc/init.d/tomcat6 file as follows:
TOMCAT6_USER=abhishek
TOMCAT6_GROUP=admin
i am using ubuntu 10.04 and from System->Administration->users and groups , i confirmed that 'abhishek' belongs to group admin. I start the web server, but the localhost:8080 is not responding , neither it throws any error. Reverting the changes in /etc/init.d/tomcat6 to default results in fine working. Where am i wrong in adding a new user to tomcat server ? | 2 |
1,349,740 | 08/28/2009 22:43:39 | 162,266 | 08/24/2009 20:00:51 | 19 | 0 | Arguments in @selector | Is there any way that I can pass arguments in selector?
example:
I have this method
- (void)myMethod:(NSString*)value1 setValue2:(NSString*)value2{
}
and I need to call this function through a selector passing two arguments.
[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(/*my method*/) userInfo:nil repeats:YES];
How can I do this? | iphone | cocoa-touch | cocoa | null | null | null | open | Arguments in @selector
===
Is there any way that I can pass arguments in selector?
example:
I have this method
- (void)myMethod:(NSString*)value1 setValue2:(NSString*)value2{
}
and I need to call this function through a selector passing two arguments.
[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(/*my method*/) userInfo:nil repeats:YES];
How can I do this? | 0 |
8,584,932 | 12/21/2011 04:01:05 | 975,305 | 10/02/2011 10:26:27 | 360 | 0 | Image Data Structure | An image(square image) can be stored as a tree: A node is white if the image is white, is black if the image is black, and is mixed if it contains both. White and black nodes are leaves, whereas a mixed node will have exactly 4 children, representing the 4 quadrants in the image. Given 2 images (trees), find the image representing their intersection. (Intersection: B^B -> B, B^W -> W, W^W->W)
This is a Google Interview Question | algorithm | data-structures | tree | interview-questions | null | 12/22/2011 08:16:08 | not constructive | Image Data Structure
===
An image(square image) can be stored as a tree: A node is white if the image is white, is black if the image is black, and is mixed if it contains both. White and black nodes are leaves, whereas a mixed node will have exactly 4 children, representing the 4 quadrants in the image. Given 2 images (trees), find the image representing their intersection. (Intersection: B^B -> B, B^W -> W, W^W->W)
This is a Google Interview Question | 4 |
5,161,473 | 03/01/2011 23:02:14 | 340,554 | 05/13/2010 17:54:39 | 105 | 5 | Question about smart pointers in C++ | Is auto_ptr good to work with only for local variables?
If I need to work with classes too, do i need copied pointer ?
Thanks in advanced. | c++ | null | null | null | null | null | open | Question about smart pointers in C++
===
Is auto_ptr good to work with only for local variables?
If I need to work with classes too, do i need copied pointer ?
Thanks in advanced. | 0 |
10,905,154 | 06/05/2012 21:20:34 | 1,415,938 | 05/24/2012 19:39:37 | 9 | 0 | WCF and SQL SERVER | We need to build a WCF Service whichs interacts (calling Stored Procedures) with the Sql Server 2008. In future we might add more functionalities - meaning the WCF Service or library must be manageable.
Could anyone suggest any patterns to follow/implement? | c# | sql-server | wcf | null | null | 06/06/2012 03:21:59 | not constructive | WCF and SQL SERVER
===
We need to build a WCF Service whichs interacts (calling Stored Procedures) with the Sql Server 2008. In future we might add more functionalities - meaning the WCF Service or library must be manageable.
Could anyone suggest any patterns to follow/implement? | 4 |
11,147,046 | 06/21/2012 21:29:33 | 793,468 | 06/10/2011 22:29:53 | 459 | 3 | Display data on form and update form asynchronously | What is the best way to approaching this? I have a text box where Teachers enter Student ID and I want to display student information based on the id entered. Once the student info is displayed, I have a drop down list which populates with a list which lists all the classes that student is enrolled in. Once a course is selected from that drop down list I want to display students progress on the form in a particular section on the form. How can I approach this? Here is What I have so far:
Controller:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Student.Models;
namespace Student.Controllers
{
public class StudentFormController : Controller
{
//
// GET: /StudentForm/
public ActionResult Index()
{
return View("StudentForm");
}
public ActionResult DisplayStudentDetails(string StudentId)
{
StudentDataContext db = new StudentDataContext();
var StudentName = (from p in db.vwStudent.Where(a => a.StudentID == StudentId)
group p by p.StudentName into g
select g.Key).FirstOrDefault();
var StudentClassList = (from p in db.vwStudent.Where(a => a.StudentID == StudentId)
group p by p.ClassID into g
select g.Key).ToList();
ViewData["StudentName"] = StudentName;
ViewData["StudentClassList "] = StudentClassList ;
return View("StudentForm");
}
public ActionResult DisplayClassDetails(string StudentId, string ClassId)
{
StudentDataContext db = new StudentDataContext();
ViewData.Model = (from p in db.vwStudentProgress.Where(a => a.StudentID == StudentId && a.ClassID == ClassId);
return View("LPForm");
}
}
}
View(Form):
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<asp:Content ID="Content3" ContentPlaceHolderID="TitleContent" runat="server">
Student Form
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" runat="server">
<form id="form2" method="get" action="/StudentForm/DisplayStudentDetails/" runat="server">
<div style="text-align: left; height: 202px;">
<asp:ScriptManager ID="ScriptManager2" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
Student Id:<input type="text" name="id" value="<%=HttpContext.Current.Request.QueryString["StudentId"]%>" /><br />
Student Name:<input type="text" name="StudentName" value="<%=ViewData["ShortName"]%>" /><br />
Classes Enrolled in:
<select name="Classes">
<%if (ViewData["Classes"] != null)
{%>
<% foreach (int? Classes in (List<int?>)ViewData["Classes"])
{%>
<option><%=Classes%></option>
<%}%>
<%}%>
</ContentTemplate>
</asp:UpdatePanel>
<input type="submit" value="Display Student Details"/>
</div>
</form>
</asp:Content>
| c# | html | asp.net-mvc | jquery-ajax | asp.net-ajax | null | open | Display data on form and update form asynchronously
===
What is the best way to approaching this? I have a text box where Teachers enter Student ID and I want to display student information based on the id entered. Once the student info is displayed, I have a drop down list which populates with a list which lists all the classes that student is enrolled in. Once a course is selected from that drop down list I want to display students progress on the form in a particular section on the form. How can I approach this? Here is What I have so far:
Controller:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Student.Models;
namespace Student.Controllers
{
public class StudentFormController : Controller
{
//
// GET: /StudentForm/
public ActionResult Index()
{
return View("StudentForm");
}
public ActionResult DisplayStudentDetails(string StudentId)
{
StudentDataContext db = new StudentDataContext();
var StudentName = (from p in db.vwStudent.Where(a => a.StudentID == StudentId)
group p by p.StudentName into g
select g.Key).FirstOrDefault();
var StudentClassList = (from p in db.vwStudent.Where(a => a.StudentID == StudentId)
group p by p.ClassID into g
select g.Key).ToList();
ViewData["StudentName"] = StudentName;
ViewData["StudentClassList "] = StudentClassList ;
return View("StudentForm");
}
public ActionResult DisplayClassDetails(string StudentId, string ClassId)
{
StudentDataContext db = new StudentDataContext();
ViewData.Model = (from p in db.vwStudentProgress.Where(a => a.StudentID == StudentId && a.ClassID == ClassId);
return View("LPForm");
}
}
}
View(Form):
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>
<asp:Content ID="Content3" ContentPlaceHolderID="TitleContent" runat="server">
Student Form
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="MainContent" runat="server">
<form id="form2" method="get" action="/StudentForm/DisplayStudentDetails/" runat="server">
<div style="text-align: left; height: 202px;">
<asp:ScriptManager ID="ScriptManager2" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
Student Id:<input type="text" name="id" value="<%=HttpContext.Current.Request.QueryString["StudentId"]%>" /><br />
Student Name:<input type="text" name="StudentName" value="<%=ViewData["ShortName"]%>" /><br />
Classes Enrolled in:
<select name="Classes">
<%if (ViewData["Classes"] != null)
{%>
<% foreach (int? Classes in (List<int?>)ViewData["Classes"])
{%>
<option><%=Classes%></option>
<%}%>
<%}%>
</ContentTemplate>
</asp:UpdatePanel>
<input type="submit" value="Display Student Details"/>
</div>
</form>
</asp:Content>
| 0 |
11,207,760 | 06/26/2012 12:54:47 | 1,298,386 | 03/28/2012 14:01:22 | 13 | 0 | How to create Zip file in c# | I want to create a zip file in c#, which will have various types files of almost 8 GB data. I am using following code
using (var zipStream = new ZipOutputStream(System.IO.File.Create(outPath)))
{
zipStream.SetLevel(9); // 0-9, 9 being the highest level of compression
var buffer = new byte[1024*1024];
foreach (var file in filenames)
{
var entry = new ZipEntry(Path.GetFileName(file)) { DateTime = DateTime.Now };
zipStream.PutNextEntry(entry);
var bufferSize = BufferedSize;
using (var fs = new BufferedStream(System.IO.File.OpenRead(file), bufferSize))
{
int sourceBytes;
do
{
sourceBytes = fs.Read(buffer, 0, buffer.Length);
zipStream.Write(buffer, 0, sourceBytes);
} while (sourceBytes > 0);
}
}
zipStream.Finish();
zipStream.Close();
}
This code is working for small files till 1 GB data, but giving exception when data reaches till 7-8 GB. Can Anyone plz help me? | c# | zip | null | null | null | 06/27/2012 13:09:49 | not a real question | How to create Zip file in c#
===
I want to create a zip file in c#, which will have various types files of almost 8 GB data. I am using following code
using (var zipStream = new ZipOutputStream(System.IO.File.Create(outPath)))
{
zipStream.SetLevel(9); // 0-9, 9 being the highest level of compression
var buffer = new byte[1024*1024];
foreach (var file in filenames)
{
var entry = new ZipEntry(Path.GetFileName(file)) { DateTime = DateTime.Now };
zipStream.PutNextEntry(entry);
var bufferSize = BufferedSize;
using (var fs = new BufferedStream(System.IO.File.OpenRead(file), bufferSize))
{
int sourceBytes;
do
{
sourceBytes = fs.Read(buffer, 0, buffer.Length);
zipStream.Write(buffer, 0, sourceBytes);
} while (sourceBytes > 0);
}
}
zipStream.Finish();
zipStream.Close();
}
This code is working for small files till 1 GB data, but giving exception when data reaches till 7-8 GB. Can Anyone plz help me? | 1 |
8,251,666 | 11/24/2011 02:45:40 | 1,063,107 | 11/24/2011 02:42:56 | 1 | 0 | Whats the easy way to make simple text based iphone app | I am not into iphone app thing so i don't know how difficult it is to mkae it.
But basically i want simple app which wil conatin a 50 page document with nice background.
And next and previous button for next page view.
HOw hard it will be to make that kind of stuff. | iphone | ios | null | null | null | 11/24/2011 02:57:01 | not constructive | Whats the easy way to make simple text based iphone app
===
I am not into iphone app thing so i don't know how difficult it is to mkae it.
But basically i want simple app which wil conatin a 50 page document with nice background.
And next and previous button for next page view.
HOw hard it will be to make that kind of stuff. | 4 |
8,904,360 | 01/18/2012 02:19:23 | 1,117,873 | 12/27/2011 15:40:07 | 6 | 0 | Why is this not floating left? | I'm trying to get the second text box there with the song lyrics to be on the right of the newspaper image. (My users will appreciate those lyrics). and have them cenetered. They are both floated left but its not working. Any ideas?
http://talons-guild.com/sopa/strike.htm | html | css | null | null | null | 01/18/2012 19:43:19 | not a real question | Why is this not floating left?
===
I'm trying to get the second text box there with the song lyrics to be on the right of the newspaper image. (My users will appreciate those lyrics). and have them cenetered. They are both floated left but its not working. Any ideas?
http://talons-guild.com/sopa/strike.htm | 1 |
9,676,451 | 03/12/2012 23:51:22 | 1,202,728 | 02/10/2012 18:49:01 | 17 | 0 | PHP code does not display what it is supposed to | Okay, so I am working on an uploading website for images...and right now i am working on the registration for the website. it is written almost entirely in **PHP**. The problem that I am having is that in the else statement of the secondary if statement (the one starting with `if (empty($register_email)`)... there is an issue that i can't seem to find a solution to.
Here's what it does:
- Checks to see if email is valid (if it's not it adds the error text to the `$errors` array
- Checks to see if it is longer than what I want the length to be.
- Checks to see if the email already exists in the database through a seperate function in another PHP script file.
If any of these errors exist then it is supposed to display them through the `foreach` statement at the bottom of the script. However, my problem is...it does not display the errors. In fact...it leaves the screen blank except for the header above it.
<?php
if (isset($_POST['register_email'], $_POST['register_name'], $_POST['register_password'])) {
$register_email = $_POST['register_email'];
$register_name = $_POST['register_name'];
$register_password = $_POST['register_password'];
$errors = array();
if (empty($register_email) || empty($register_name) || empty($register_password)) { // **||** means "or"
$errors[] = 'All fields are required';
} else {
if (filter_var($register_email, FILTER_VALIDATE_EMAIL) == false) {
$errors[] = 'Email address not valid';
}
if (strlen($register_email) > 255 || strlen($register_name) > 35 || strlen($register_password) > 35) {
$errors[] = 'One or more fields contains too many characters';
}
if (user_exits($register_email)) {
$errors[] = 'That email has already been registered';
}
}
if (!empty($errors)) { //If errors do exist
foreach($errors as $error) {
echo $error, '<br />';
}
} else {
//register our user
}
}
?>
Now one thing that I have tested to make sure that it is not an issue with the function (in regards to the `if (empty($register_email)...)` is that I have done this
if (filter_var($register_email, FILTER_VALIDATE_EMAIL) == false) {
$errors[] = 'Email address not valid';
echo 'Email address is not valid';
} else {
echo 'Email address is valid';
And it did properly work, it echoed out the correct result. However when I try to do it through the foreach statement (which i have to do to display mulitple errors), it doesn't work.
P.S. I have gone to 3 different websites for syntax check and everything checked out okay.
} | php | validation | email | foreach | user-registration | 03/14/2012 12:16:36 | not a real question | PHP code does not display what it is supposed to
===
Okay, so I am working on an uploading website for images...and right now i am working on the registration for the website. it is written almost entirely in **PHP**. The problem that I am having is that in the else statement of the secondary if statement (the one starting with `if (empty($register_email)`)... there is an issue that i can't seem to find a solution to.
Here's what it does:
- Checks to see if email is valid (if it's not it adds the error text to the `$errors` array
- Checks to see if it is longer than what I want the length to be.
- Checks to see if the email already exists in the database through a seperate function in another PHP script file.
If any of these errors exist then it is supposed to display them through the `foreach` statement at the bottom of the script. However, my problem is...it does not display the errors. In fact...it leaves the screen blank except for the header above it.
<?php
if (isset($_POST['register_email'], $_POST['register_name'], $_POST['register_password'])) {
$register_email = $_POST['register_email'];
$register_name = $_POST['register_name'];
$register_password = $_POST['register_password'];
$errors = array();
if (empty($register_email) || empty($register_name) || empty($register_password)) { // **||** means "or"
$errors[] = 'All fields are required';
} else {
if (filter_var($register_email, FILTER_VALIDATE_EMAIL) == false) {
$errors[] = 'Email address not valid';
}
if (strlen($register_email) > 255 || strlen($register_name) > 35 || strlen($register_password) > 35) {
$errors[] = 'One or more fields contains too many characters';
}
if (user_exits($register_email)) {
$errors[] = 'That email has already been registered';
}
}
if (!empty($errors)) { //If errors do exist
foreach($errors as $error) {
echo $error, '<br />';
}
} else {
//register our user
}
}
?>
Now one thing that I have tested to make sure that it is not an issue with the function (in regards to the `if (empty($register_email)...)` is that I have done this
if (filter_var($register_email, FILTER_VALIDATE_EMAIL) == false) {
$errors[] = 'Email address not valid';
echo 'Email address is not valid';
} else {
echo 'Email address is valid';
And it did properly work, it echoed out the correct result. However when I try to do it through the foreach statement (which i have to do to display mulitple errors), it doesn't work.
P.S. I have gone to 3 different websites for syntax check and everything checked out okay.
} | 1 |
7,823,276 | 10/19/2011 14:54:23 | 35,264 | 11/06/2008 21:29:27 | 2,275 | 162 | With JasperReports how do you populate a text field with the single row and column result from a sub dataset? | Typically with reports you have a single query that returns a lot of data that mostly gets printed in the detail area. The report-writing tools I've seen are geared towards this type of report.
I'm finding myself writing some summary reports where there isn't just one query with one where clause that returns a lot of data. On these reports there are many queries with different where clauses that each returns just one number. The report is just one page and each number goes in a specific spot.
What I'm doing to accomplish this is to write a query that is huge. First, I select one row then I have a left join with its own SQL for each additional number I need to retrieve, which becomes it's own column in the results. I would like to get away from having this huge query. Also, I just ran into a situation where mysql was basically complaining that the query was too large; it was something about too deeply-nested subqueries, but removing one of the joins fixed it.
It would help a lot if I could make each query a separate sub dataset and populate a textfield with the resulting number.
Could a scriptlet maybe be used to perform the query and populate the resulting number in a variable?
Do other report-writing programs/libraries make this easier?
| java | reporting | jasper-reports | ireport | null | null | open | With JasperReports how do you populate a text field with the single row and column result from a sub dataset?
===
Typically with reports you have a single query that returns a lot of data that mostly gets printed in the detail area. The report-writing tools I've seen are geared towards this type of report.
I'm finding myself writing some summary reports where there isn't just one query with one where clause that returns a lot of data. On these reports there are many queries with different where clauses that each returns just one number. The report is just one page and each number goes in a specific spot.
What I'm doing to accomplish this is to write a query that is huge. First, I select one row then I have a left join with its own SQL for each additional number I need to retrieve, which becomes it's own column in the results. I would like to get away from having this huge query. Also, I just ran into a situation where mysql was basically complaining that the query was too large; it was something about too deeply-nested subqueries, but removing one of the joins fixed it.
It would help a lot if I could make each query a separate sub dataset and populate a textfield with the resulting number.
Could a scriptlet maybe be used to perform the query and populate the resulting number in a variable?
Do other report-writing programs/libraries make this easier?
| 0 |
6,974,881 | 08/07/2011 18:39:26 | 880,919 | 08/05/2011 15:54:38 | 8 | 0 | getting a class that clicked | I have two classes `.find_input`, I want to get a class(`.find_input`) that has been clicked with jQuery, and appendTo a html code.
div class="column find_input">
<div class="ai_service">
</div>
</div>
<div class='find_input'>
<div class="adding">
</div>
</div>
like this that getting class after `.find_input`, that clicked.
var org_cl = '.' + $(this).closest('div.find_input').find('div').attr('class');
how it is?<p>
with respect
| javascript | jquery | jquery-selectors | jquery-events | null | 07/08/2012 01:03:51 | not a real question | getting a class that clicked
===
I have two classes `.find_input`, I want to get a class(`.find_input`) that has been clicked with jQuery, and appendTo a html code.
div class="column find_input">
<div class="ai_service">
</div>
</div>
<div class='find_input'>
<div class="adding">
</div>
</div>
like this that getting class after `.find_input`, that clicked.
var org_cl = '.' + $(this).closest('div.find_input').find('div').attr('class');
how it is?<p>
with respect
| 1 |
6,847,679 | 07/27/2011 16:10:31 | 826,659 | 07/03/2011 06:54:13 | 134 | 18 | How much data we can get from client's ip in asp.net ? | I want to know which type of data and how much data we can obtained from client's IP. For example his location, city etc or any other information. | asp.net | ip-address | null | null | null | 07/28/2011 20:00:51 | off topic | How much data we can get from client's ip in asp.net ?
===
I want to know which type of data and how much data we can obtained from client's IP. For example his location, city etc or any other information. | 2 |
4,121,790 | 11/08/2010 06:45:43 | 196,116 | 10/25/2009 08:10:07 | 48 | 3 | Stack performance in programming languages | Just for fun, I tried to compare the stack performance of a couple of programming languages calculating the Fibonacci series using the naive recursive algorithm. The code is mainly the same in all languages, i'll post a java version:
public class Fib {
public static int fib(int n) {
if (n < 2) return 1;
return fib(n-1) + fib(n-2);
}
public static void main(String[] args) {
System.out.println(fib(Integer.valueOf(args[0])));
}
}
Ok so the point is that using this algorithm with input 40 I got these timings:
C: 2.796s
Ocaml: 12.737s
Python: 106.407s
Java: 1.336s
C#(mono): 2.956s
They are taken in a Ubuntu 10.04 box using the versions of each language available in the official repositories, on a dual core intel machine.
I know that functional languages like ocaml have the slowdown that comes from treating functions as first order citizens and have no problem to explain CPython's running time because of the fact that it's the only interpreted language in this test, but I was impressed by the java running time which is half of the c for the same algorithm! Would you attribute this to the JIT compilation?
How would you explain these results? | java | python | c | performance | ocaml | null | open | Stack performance in programming languages
===
Just for fun, I tried to compare the stack performance of a couple of programming languages calculating the Fibonacci series using the naive recursive algorithm. The code is mainly the same in all languages, i'll post a java version:
public class Fib {
public static int fib(int n) {
if (n < 2) return 1;
return fib(n-1) + fib(n-2);
}
public static void main(String[] args) {
System.out.println(fib(Integer.valueOf(args[0])));
}
}
Ok so the point is that using this algorithm with input 40 I got these timings:
C: 2.796s
Ocaml: 12.737s
Python: 106.407s
Java: 1.336s
C#(mono): 2.956s
They are taken in a Ubuntu 10.04 box using the versions of each language available in the official repositories, on a dual core intel machine.
I know that functional languages like ocaml have the slowdown that comes from treating functions as first order citizens and have no problem to explain CPython's running time because of the fact that it's the only interpreted language in this test, but I was impressed by the java running time which is half of the c for the same algorithm! Would you attribute this to the JIT compilation?
How would you explain these results? | 0 |
10,076,856 | 04/09/2012 17:06:38 | 1,293,535 | 03/26/2012 16:29:34 | 8 | 0 | 4-way traffic light w/ walk signals in VHDL | So, I have been trying to program a 4-way traffic signal in VHDL for the past couple of weeks, and the walk signals keep giving me trouble. We are not being required to stagger the walk signals from the traffic signals or use different timings for the walk signals. You simply need a way for a user to request a walk signal, and then when the parallel traffic signal turns green, the walk signal turns on - and after a timer runs out, the walk signal turns off, the traffic light changes to yellow, then to red.
I've gotten the 4-way signal to compile without the walk signals, but as soon as I put in the walk signals, Quartus runs into a compilation error where it thinks the walk/traffic signal controller (wcntlr) entity in the system controller (LightWalk) either shouldn't be a Bit Vector, or should have more ports than it does. I've shown this problem to the professor, and he's clueless as to what is happening.
Here is the code
1.CounterMod5 (a timer, Mod2^2)
--CounterMod5
library ieee;
use ieee.std_logic_1164.all;
entity CntrMod5 is
port(clk, reset: in bit;
--q: out integer range 0 to 4);
q: out bit);
end CntrMod5;
architecture a of CntrMod5 is
begin
process (clk, reset)
variable count: integer range 0 to 4;
begin
if (reset = '0') then
count := 0;
else
if (clk'event and clk='1') then
count :=count+1;
end if;
end if;
if (count = 4) then
q <='1';
else q <= '0';
end if;
--q <=count;
end process;
end a;
2. CounterMod225 (another timer, Mod2^25)
--CounterMod225
library ieee;
use ieee.std_logic_1164.all;
entity CntrMod225 is
port(clk, reset: in bit;
--q: out integer range 0 to 33554431);
q: out bit );
end CntrMod225;
architecture a of CntrMod225 is
begin
process (clk, reset)
variable count: integer range 0 to 33554431;
begin
if (reset = '0') then
count := 0;
else
if (clk'event and clk='1') then
count := count + 1;
end if;
end if;
if (count = 3554431) then
q <='1';
else q <= '0';
end if;
--q <=count;
end process;
end a;
3. Walk/Light Controller (controls all the lights)
--WalkController
library ieee;
use ieee.std_logic_1164.all;
Entity wcntlr is
port (timer, clk, nswk, ewwk, reset: in bit;
--timer: in bit;
--clk: in bit;
--reset: in bit;
--nswk: in bit;
--ewwk: in bit;
lights: out bit_vector (7 downto 0));
end wcntlr;
architecture a of wcntlr is
type sequence is (s0, s1, s2, s3, s4, s5);
signal state: sequence;
begin
process (clk, reset, timer)
begin
if (reset='0') then
state <= s0;
else
if (clk'event and clk='0') then
case state is
when s0=> if (timer='0') then state <=s1; --when ewg, if the timer=0, then go to ewy. If not 1, stay ewg
else state <=s0; end if;
when s1=> if (nswk='1') then state <=s4; --when ewy, if nswk=1, then go to nsg and nswl. If not, just nsg
else state <=s2; end if;
when s2=> if (timer='0') then state <=s3; --when nsg, if timer=0, then go to nsy. If not 0, stay nsg
else state <=s2; end if;
when s3=> if (ewwk ='1') then state <=s5; --when nsy, if ewwk=1, then go to ewg and ewwl. If not, just ewg
else state <=s0; end if;
when s4=> if (timer='0') then state <=s3; --when nsg and nswl, if timer=0, then go to nsy. If not, stay nsg and nswl
else state <=s4; end if;
when s5=> if (timer='0') then state <=s1; --when ewg and ewwl, if timer=0, then go to ewy. if not, stay ewg and ewwl
else state <=s5; end if;
end case;
end if;
end if;
end process;
with state select
lights <="01111101" when s0, --ewg,nsr
"01111011" when s1, --ewy,nsr
"11010111" when s2, --nsg,ewr
"10110111" when s3, --nsy,ewr
"11000111" when s4, --nsq,nswl,ewr
"01111100" when s5; --ewg,ewwl,nsr
end a;
4. The Traffic Controller (that ties everything together)
--traffic_controller_walk.vhd
library ieee;
use ieee.std_logic_1164.all;
entity LightWalk is
port (timer, clk, reset, nswk, ewwk: in bit;
lights: out bit_vector (5 downto 0));
end LightWalk;
architecture a of LightWalk is
component CntrMod225
port (clk, reset: in bit;
--q: out integer range 0 to 33554431);
q: out bit);
end component;
component CntrMod5
port (clk, reset: in bit;
--q: out integer range 0 to 4);
q: out bit);
end component;
component wcntlr
port (timer, clk, nswk, ewwk, reset: in bit;
lights: out bit_vector (7 downto 0));
end component;
signal connect: bit_vector (1 downto 0);
begin
comp1: CntrMod225 port map (clk, reset, connect(1));
comp2: CntrMod5 port map (connect(1), reset, connect(0));
comp3: wcntlr port map (connect(0), connect(1), nswk, ewwk, reset, lights);
end a;
I just can't seem to figure it out. I'm headed to the lab now, and will talk with the professor some more, as well as post exactly what errors I'm getting. | vhdl | bit | null | null | null | 04/11/2012 20:25:55 | too localized | 4-way traffic light w/ walk signals in VHDL
===
So, I have been trying to program a 4-way traffic signal in VHDL for the past couple of weeks, and the walk signals keep giving me trouble. We are not being required to stagger the walk signals from the traffic signals or use different timings for the walk signals. You simply need a way for a user to request a walk signal, and then when the parallel traffic signal turns green, the walk signal turns on - and after a timer runs out, the walk signal turns off, the traffic light changes to yellow, then to red.
I've gotten the 4-way signal to compile without the walk signals, but as soon as I put in the walk signals, Quartus runs into a compilation error where it thinks the walk/traffic signal controller (wcntlr) entity in the system controller (LightWalk) either shouldn't be a Bit Vector, or should have more ports than it does. I've shown this problem to the professor, and he's clueless as to what is happening.
Here is the code
1.CounterMod5 (a timer, Mod2^2)
--CounterMod5
library ieee;
use ieee.std_logic_1164.all;
entity CntrMod5 is
port(clk, reset: in bit;
--q: out integer range 0 to 4);
q: out bit);
end CntrMod5;
architecture a of CntrMod5 is
begin
process (clk, reset)
variable count: integer range 0 to 4;
begin
if (reset = '0') then
count := 0;
else
if (clk'event and clk='1') then
count :=count+1;
end if;
end if;
if (count = 4) then
q <='1';
else q <= '0';
end if;
--q <=count;
end process;
end a;
2. CounterMod225 (another timer, Mod2^25)
--CounterMod225
library ieee;
use ieee.std_logic_1164.all;
entity CntrMod225 is
port(clk, reset: in bit;
--q: out integer range 0 to 33554431);
q: out bit );
end CntrMod225;
architecture a of CntrMod225 is
begin
process (clk, reset)
variable count: integer range 0 to 33554431;
begin
if (reset = '0') then
count := 0;
else
if (clk'event and clk='1') then
count := count + 1;
end if;
end if;
if (count = 3554431) then
q <='1';
else q <= '0';
end if;
--q <=count;
end process;
end a;
3. Walk/Light Controller (controls all the lights)
--WalkController
library ieee;
use ieee.std_logic_1164.all;
Entity wcntlr is
port (timer, clk, nswk, ewwk, reset: in bit;
--timer: in bit;
--clk: in bit;
--reset: in bit;
--nswk: in bit;
--ewwk: in bit;
lights: out bit_vector (7 downto 0));
end wcntlr;
architecture a of wcntlr is
type sequence is (s0, s1, s2, s3, s4, s5);
signal state: sequence;
begin
process (clk, reset, timer)
begin
if (reset='0') then
state <= s0;
else
if (clk'event and clk='0') then
case state is
when s0=> if (timer='0') then state <=s1; --when ewg, if the timer=0, then go to ewy. If not 1, stay ewg
else state <=s0; end if;
when s1=> if (nswk='1') then state <=s4; --when ewy, if nswk=1, then go to nsg and nswl. If not, just nsg
else state <=s2; end if;
when s2=> if (timer='0') then state <=s3; --when nsg, if timer=0, then go to nsy. If not 0, stay nsg
else state <=s2; end if;
when s3=> if (ewwk ='1') then state <=s5; --when nsy, if ewwk=1, then go to ewg and ewwl. If not, just ewg
else state <=s0; end if;
when s4=> if (timer='0') then state <=s3; --when nsg and nswl, if timer=0, then go to nsy. If not, stay nsg and nswl
else state <=s4; end if;
when s5=> if (timer='0') then state <=s1; --when ewg and ewwl, if timer=0, then go to ewy. if not, stay ewg and ewwl
else state <=s5; end if;
end case;
end if;
end if;
end process;
with state select
lights <="01111101" when s0, --ewg,nsr
"01111011" when s1, --ewy,nsr
"11010111" when s2, --nsg,ewr
"10110111" when s3, --nsy,ewr
"11000111" when s4, --nsq,nswl,ewr
"01111100" when s5; --ewg,ewwl,nsr
end a;
4. The Traffic Controller (that ties everything together)
--traffic_controller_walk.vhd
library ieee;
use ieee.std_logic_1164.all;
entity LightWalk is
port (timer, clk, reset, nswk, ewwk: in bit;
lights: out bit_vector (5 downto 0));
end LightWalk;
architecture a of LightWalk is
component CntrMod225
port (clk, reset: in bit;
--q: out integer range 0 to 33554431);
q: out bit);
end component;
component CntrMod5
port (clk, reset: in bit;
--q: out integer range 0 to 4);
q: out bit);
end component;
component wcntlr
port (timer, clk, nswk, ewwk, reset: in bit;
lights: out bit_vector (7 downto 0));
end component;
signal connect: bit_vector (1 downto 0);
begin
comp1: CntrMod225 port map (clk, reset, connect(1));
comp2: CntrMod5 port map (connect(1), reset, connect(0));
comp3: wcntlr port map (connect(0), connect(1), nswk, ewwk, reset, lights);
end a;
I just can't seem to figure it out. I'm headed to the lab now, and will talk with the professor some more, as well as post exactly what errors I'm getting. | 3 |
2,740,856 | 04/29/2010 21:20:56 | 185,921 | 10/07/2009 20:13:54 | 368 | 9 | Converting an input text value to a decimal number | I'm trying to work with decimal data in my `PHP` and `MySql` practice and I'm not sure about how can I do for an acceptable level af accuracy.
I've wrote a simple `function` which recives my `input text value` and converts it to a `decimal number` ready to be stored in the database.
<?php
function unit ($value, $decimal_point = 2) {
return number_format (str_replace (",", ".", strip_tags (trim ($value))), $decimal_point);
}
?>
I've resolved something like `AbdlBsF5%?nl` with some jQuery code for replace and some regex to keep only numbers, dots and commas.
In some country, people uses the comma `,` to send decimal numbers, so a number like `72.08` is wrote like `72,08`. I'd like avoid to forcing people to change their usual chars and I've decided to use a jQuery to keep this too.
Now every web developer knows the last validation must be handled by the dynamic page for security reasons.
So my answer is should I use something like `unit ();` function to store data or shoul I also check if users inserts invalid chars like letters or something else? If I try this and send letters, the query works without save the invalid data, I think this isn't bad, but I could easily be wrong because I'm a rookie.
What kind of method should I use if I want a number like `99999.99` for my query? | php | mysql | null | null | null | null | open | Converting an input text value to a decimal number
===
I'm trying to work with decimal data in my `PHP` and `MySql` practice and I'm not sure about how can I do for an acceptable level af accuracy.
I've wrote a simple `function` which recives my `input text value` and converts it to a `decimal number` ready to be stored in the database.
<?php
function unit ($value, $decimal_point = 2) {
return number_format (str_replace (",", ".", strip_tags (trim ($value))), $decimal_point);
}
?>
I've resolved something like `AbdlBsF5%?nl` with some jQuery code for replace and some regex to keep only numbers, dots and commas.
In some country, people uses the comma `,` to send decimal numbers, so a number like `72.08` is wrote like `72,08`. I'd like avoid to forcing people to change their usual chars and I've decided to use a jQuery to keep this too.
Now every web developer knows the last validation must be handled by the dynamic page for security reasons.
So my answer is should I use something like `unit ();` function to store data or shoul I also check if users inserts invalid chars like letters or something else? If I try this and send letters, the query works without save the invalid data, I think this isn't bad, but I could easily be wrong because I'm a rookie.
What kind of method should I use if I want a number like `99999.99` for my query? | 0 |
9,818,465 | 03/22/2012 08:07:28 | 508,127 | 11/15/2010 10:28:18 | 1,667 | 3 | Sql server transaction and select statement | i often saw many people use select statement with in transaction. i often use insert/update/delete only in transaction. i just do not understand that what is the utility of putting select statement inside transaction.
i got one answer that....Select inside the transaction can see changes made by other previous Insert/Update/delete statements in that transaction, A Select statement outside the transaction cannot.
above statement is it true or not ?
is this is the only reason that people put select statement inside transaction. please discuss all the reason in detail if possible. thanks | sql-server | null | null | null | null | null | open | Sql server transaction and select statement
===
i often saw many people use select statement with in transaction. i often use insert/update/delete only in transaction. i just do not understand that what is the utility of putting select statement inside transaction.
i got one answer that....Select inside the transaction can see changes made by other previous Insert/Update/delete statements in that transaction, A Select statement outside the transaction cannot.
above statement is it true or not ?
is this is the only reason that people put select statement inside transaction. please discuss all the reason in detail if possible. thanks | 0 |
9,925,913 | 03/29/2012 13:03:22 | 229,144 | 12/10/2009 21:01:34 | 799 | 25 | JQuery themeroller hover is not being applied | I'm using jQuery's Themeroller to create a style for my web application. I am trying to apply the style to my own custom button. However, the ui-state-hover class is not being applied.
I am adding the same classes in my code as I can see on the Themerollers page for that button-component. Here is my code as copied from firebug:
<button aria-disabled="false" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="button">
<span class="ui-button-text">Visa/Dölj filter</span>
</button>
I have included jquery-ui-1.8.18.custom.css and jquery-1.7.1.min.js files.
Is there anything more than above I need to think about when using themerollers?
This is very frustrating since I thought this was going to work out of the box. If this doesn't work, I cannot use it since making it work takes more time than creating the style myself... | jquery | html | css | themeroller | null | null | open | JQuery themeroller hover is not being applied
===
I'm using jQuery's Themeroller to create a style for my web application. I am trying to apply the style to my own custom button. However, the ui-state-hover class is not being applied.
I am adding the same classes in my code as I can see on the Themerollers page for that button-component. Here is my code as copied from firebug:
<button aria-disabled="false" role="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" id="button">
<span class="ui-button-text">Visa/Dölj filter</span>
</button>
I have included jquery-ui-1.8.18.custom.css and jquery-1.7.1.min.js files.
Is there anything more than above I need to think about when using themerollers?
This is very frustrating since I thought this was going to work out of the box. If this doesn't work, I cannot use it since making it work takes more time than creating the style myself... | 0 |
8,442,164 | 12/09/2011 07:05:41 | 819,151 | 06/28/2011 12:32:36 | 772 | 71 | How to get Date format like this in android? | How to get Date format like this?
Saturday,Dec 11,2011 | android | dateformat | null | null | null | null | open | How to get Date format like this in android?
===
How to get Date format like this?
Saturday,Dec 11,2011 | 0 |
10,175,411 | 04/16/2012 13:50:09 | 714,831 | 04/19/2011 08:44:49 | 90 | 11 | Gstreamer : Development and Code Committing | I am trying to **develop for the Gstreamer**(Committing to gstreamer Code base and Developing Application Using Gstreamer Plugins) and I have following questions :
(1) How can I contribute.I wanted to start with the code reviews initially and later on minor patch commits.I have gained fair knowledge on Gstreamer theoretical part and Plugin Development guide.
(2) Are the **gstreamer** projects hosted on [http://sourceforge.net/][1] .Can I fork the projects from there, Like we do with the git hub.Is there any manual for gettinn started.
(3) Final question :
Is there any coding IDE for Gstreamer which has the intelisense ,auto code complete and documentation support(GStreamer 0.10 Library Reference Manual or GStreamer 0.10 Core Reference Manual).Is there any IDE having this inbuilt support or the way by which we can add the support for this.
Rgds,
softy
[1]: http://sourceforge.net/ | ide | commit | gstreamer | sourceforge | null | 04/19/2012 14:50:40 | not a real question | Gstreamer : Development and Code Committing
===
I am trying to **develop for the Gstreamer**(Committing to gstreamer Code base and Developing Application Using Gstreamer Plugins) and I have following questions :
(1) How can I contribute.I wanted to start with the code reviews initially and later on minor patch commits.I have gained fair knowledge on Gstreamer theoretical part and Plugin Development guide.
(2) Are the **gstreamer** projects hosted on [http://sourceforge.net/][1] .Can I fork the projects from there, Like we do with the git hub.Is there any manual for gettinn started.
(3) Final question :
Is there any coding IDE for Gstreamer which has the intelisense ,auto code complete and documentation support(GStreamer 0.10 Library Reference Manual or GStreamer 0.10 Core Reference Manual).Is there any IDE having this inbuilt support or the way by which we can add the support for this.
Rgds,
softy
[1]: http://sourceforge.net/ | 1 |
6,797,110 | 07/22/2011 23:20:58 | 697,529 | 04/07/2011 20:16:36 | 294 | 11 | What happens if I post to a site a million times repeatedly? | I was just trying to post something to a website via my localhost to retrieve some data, and suddenly, this idea came to my mind: What happens if I create a post, put it into a for loop that runs over 1 million times, and send requests to a specific url for a million time? I just did not want to try to avoid any harm, but I wonder. And if this could cause some harm, how can I avoid such an attack? | c# | loops | post | attack | defensive-programming | 07/22/2011 23:59:44 | not a real question | What happens if I post to a site a million times repeatedly?
===
I was just trying to post something to a website via my localhost to retrieve some data, and suddenly, this idea came to my mind: What happens if I create a post, put it into a for loop that runs over 1 million times, and send requests to a specific url for a million time? I just did not want to try to avoid any harm, but I wonder. And if this could cause some harm, how can I avoid such an attack? | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.