Unnamed: 0
int64 65
6.03M
| Id
int64 66
6.03M
| Title
stringlengths 10
191
| input
stringlengths 23
4.18k
| output
stringclasses 10
values | Tag_Number
stringclasses 10
values |
---|---|---|---|---|---|
1,162,533 | 1,162,534 | Reading numbers from inputs with JavaScript always returns NaN | <p>I want to create a calculator which simply sums 2 fields up. But whatever I try it does not work. It also returns "NaN", also if I use parseInt().</p>
<p>Here's the code:</p>
<pre><code> <script type="text/javascript" language="Javascript">
function doSum()
{
var a = document.getElementsByName("a").value;
var b = document.getElementsByName("b").value;
var sum = a + b;
document.getElementById("sum").value = sum;
}
</script>
<form action="" method="POST">
<br/>a:<br/>
<input type="text" name="a" onblur='doSum()' value="0" size="5" />
<br/>b:<br/>
<input type="text" name="b" onblur='doSum()' value="0" size="5" />
<br/>Ergebnis<br/>
<input type="text" id='sum' value='' size="50" disabled/>
</form>
</code></pre>
<p>Sorry for that noob question, but what I'am doing wrong?
Thanks for any help!</p>
| javascript | [3] |
5,029,569 | 5,029,570 | Asynchronous call in javascript | <p>I am executing a function and i want to pause execution for some time.</p>
<pre><code>function a(){
}
//here some code --- I am using result of a function here...
</code></pre>
<p>Can anyone help me... how to use asynchronous call??</p>
| javascript | [3] |
3,040,789 | 3,040,790 | missing antialias while fade | <p>I use Jquery fadeIn effect, but it does not work well in Chrome (neither in IE).
At the end of the animation it lost(gain?) its anti-alias property. See the pictures below.</p>
<p>The large text border will be arched, the small one will be sharp.</p>
<p><img src="http://i.stack.imgur.com/OrXv8.png" alt="anti-alias"></p>
| jquery | [5] |
561,819 | 561,820 | alias keyword (like typedef) in C#? | <p>I have 2 libs that have different case on different platforms :(. It seems like everything else is the same (method names, param order, etc). How can i create an alias so my current spelling for platform a will work when i compile for platform b (I would really hate to make a wrapper for case difference)</p>
| c# | [0] |
2,650,124 | 2,650,125 | Detecting if disc is in DVD drive | <p>Is there an easy way to detect if a disc is inserted in the DVD drive? I don't care what kind of disc (CD, DVD or Blu-Ray)?</p>
| c# | [0] |
5,293,313 | 5,293,314 | vertically center text in tabs | <p>How do I center the text vertically in tabs within a TabHost? The text sits at the bottom right now. I seemed to have tried everything but nothing works.</p>
<p>I've tried using things like android:layout_gravity="center" and android:gravity="center" but they do nothing.</p>
<p>Thanks</p>
| android | [4] |
2,308,784 | 2,308,785 | Html control and Server control can be used in single aspx page | <p>I need help on this following aspx code</p>
<p>aspx Code:</p>
<pre><code><asp:Label ID ="lblName" runat ="server" Text ="Name"></asp:Label>
<asp:TextBox ID ="txtName" runat ="server"></asp:TextBox>
</code></pre>
<p>Consider this is my aspx page content. I am going to populate the values for the TextBox only after the postback from server. But the label is also posting to the server (<code>runat="server"</code>) even though it's not necessary. Should I write my code like this to save time from server with less load.</p>
<p>Corrected Code:</p>
<pre><code><label id ="lblNames">Name</label>
<asp:TextBox ID ="txtName" runat ="server"></asp:TextBox>
</code></pre>
<p>Only my server control will send to the server for postback and not my HTML control which has a static value.</p>
<p>Please suggest whether this is the correct way of coding.</p>
| asp.net | [9] |
3,267,513 | 3,267,514 | jquery click on a child ignore parent click | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/7696098/prevent-click-event-from-affecting-parent-jquery">Prevent click event from affecting parent jquery</a> </p>
</blockquote>
<p>I have a DOM structure similar to this:</p>
<pre><code><div class="parent">
<div class="child">
</div>
</div>
</code></pre>
<p>I have the following jQuery:</p>
<pre><code>$('.parent').click(function(){
$(this).hide();
});
</code></pre>
<p>When <code>.child</code> is clicked I don't want the parent to hide but obviously because <code>.child</code> is a child of <code>.parent</code> this naturally happens. I've tried adding this:</p>
<pre><code>$('.child').click(function(e){
e.stopPropagation();
});
</code></pre>
<p>But it still doesn't work. I've also tried replacing <code>e.stopPropagation</code> with <code>return false;</code> </p>
<p>any suggestions?</p>
<p><a href="http://jsfiddle.net/mPUTe/" rel="nofollow">JSFiddle</a></p>
| jquery | [5] |
1,505,514 | 1,505,515 | Convert from rtf 2 pdf using php | <p>i will like to ask if there is any script or any help on how to convert rtf to pdf using a php script, Thanks</p>
| php | [2] |
905,963 | 905,964 | How to make medical summaries files from java application | <p>I have made a program in Java which is used to collect medical data (personal, diagnosis,treatments) from people with cancer. In this program you fill the forms and all these data are then stored to a database. </p>
<p>Now, what I want to make: if the user selects to see a patient's data, I want to give him the possibility to print the patient's record. I know how to print a file using java. But I don't know how to make such a file, how to form it. I mean it's not just printing "Hello world". It may need tables, colors, etc. How should I do this? Is there a way to make a prototype (ex. doc) file and then through the program fill just the data, or I have to fully form this file through my program? </p>
<p>Hope I was clearly understood!</p>
| java | [1] |
1,798,123 | 1,798,124 | iPhone - Volume/Mute Buttons | <p>What class is referenced in the volume/mute button popup? Sorry for the awful question but I can't seem to find it anywhere.</p>
| iphone | [8] |
1,489,239 | 1,489,240 | jQuery character count | <p>I am working on a character count <a href="http://stackoverflow.com/questions/5371089/jquery-count-characters-in-textarea">based on this post</a>.<br/>
I would like to call the function on window load but seem to be having issues, otherwise everything works.<br/>
Can anyone lend a hand on getting the count on load please.<br/>
<a href="http://jsfiddle.net/nalagg/PrtXH/" rel="nofollow">heres my fiddle</a></p>
<pre><code>function countChar(val){
var len = val.value.length;
if (len >= 500) {
val.value = val.value.substring(0, 500);
$('#stat span').text(0);
}else {
$('#stat span').text(500 - len);
}
}
$(function(){
var inputT = $('#descTextArea').val();
//countChar(inputT);//this is breaking the code
$('#descTextArea').keyup(function(){
countChar(this);
});
});
</code></pre>
| jquery | [5] |
483,771 | 483,772 | Property constructor vs Scope declaration | <p>I am creating a duplex contract in WCF and am following tutorials for how to build out properly. In declaring my client service Callback interface instance I initially declared the instance property as <code>private readonly</code> like so:</p>
<pre><code>private readonly IEventServiceCallback Callback = OperationContext.Current.GetCallbackChannel<IEventServiceCallback>();
</code></pre>
<p>But at looking at the MSDN example, the interface reference is defined via getter syntax like so:</p>
<pre><code>IEventServiceCallback Callback
{
get
{
return OperationContext.Current.GetCallbackChannel<IEventServiceCallback>();
}
}
</code></pre>
<p>I'm just curious if there is really a reason to do one way vs. the other or if it's just personal preference? Any feedback would be appreciated.</p>
| c# | [0] |
4,190,467 | 4,190,468 | How can I get certain columns from datatable to datagridview? | <p>I have a datatable that I want to extract certain information from (only certain rows and only certain columns). I'm trying to use the code below, but I'm getting an index out of range error when I run it, and I'm not sure if what I'm doing is the best way to get only certain data from a datatable to a datagridview. Any ideas?</p>
<pre><code> currentRow = 0;
int dataGridRow = 0;
foreach (DataRow row in resultsDT.Rows)
{
string value = resultsDT.Rows[currentRow]["HighLow"].ToString();
if (value.Equals("High") | value.Equals("Low"))
{
dataGridView2.Rows[dataGridRow].Cells["colHighLow"].Value = resultsDT.Rows[currentRow]["HighLow"];
dataGridView2.Rows[dataGridRow].Cells["colDifference"].Value = resultsDT.Rows[currentRow]["Difference"];
dataGridView2.Rows[dataGridRow].Cells["colMbrSep"].Value = resultsDT.Rows[currentRow]["MBRSEP"];
dataGridView2.Rows[dataGridRow].Cells["colLocation"].Value = resultsDT.Rows[currentRow]["LOCATION"];
dataGridView2.Rows[dataGridRow].Cells["colDistrict"].Value = resultsDT.Rows[currentRow]["DIST"];
dataGridView2.Rows[dataGridRow].Cells["colAddress"].Value = resultsDT.Rows[currentRow]["ADDR1"];
dataGridView2.Rows[dataGridRow].Cells["colMeter"].Value = resultsDT.Rows[currentRow]["METER"];
dataGridView2.Rows[dataGridRow].Cells["colKWh"].Value = resultsDT.Rows[currentRow]["KWH"];
dataGridRow++;
}
currentRow++;
}
</code></pre>
| c# | [0] |
475,350 | 475,351 | can I use activiy one time(register activity) and switch the main launcher to different activity? | <p>can I use activiy one time(register activity) and switch the main launcher after using to different activity?</p>
<p>another question if I may,
If I create parameter x in one of the activities in my application, can I use this parameter in other activities?...If yes, how I can do that?</p>
<p>thanks :)</p>
| android | [4] |
3,249,044 | 3,249,045 | Radio button group retrieve value | <p>I have group radio buttons with same name cost and different id's cost_1, cost_2. and their values are also different. I wish to collect value of selected radio button. and show it in particular text box that is 'total' including values of other radio button group. How can I get value of selected radio button from name using jQuery? Because if I select it using ID and loop it will count value of each radio button. </p>
| jquery | [5] |
5,261,180 | 5,261,181 | Style appearances don't work | <p>I'm working on a sort of progress screen but I'm having trouble with the appearances.</p>
<p>Here is my code: </p>
<pre><code> LinearLayout progressLayout = new LinearLayout(this);
progressLayout.setOrientation(LinearLayout.VERTICAL);
progressLayout.setGravity(Gravity.CENTER);
LayoutParams layoutParams = new LayoutParams(
android.view.ViewGroup.LayoutParams.FILL_PARENT,
android.view.ViewGroup.LayoutParams.FILL_PARENT);
progressLayout.setLayoutParams(layoutParams);
LayoutParams titelParams = new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT);
titelParams.setMargins(0, 0, 0, pixelsToDIP(15));
TextView t = new TextView(this);
t.setText("Zorgdossier wordt geladen");
t.setTextAppearance(this, android.R.attr.textAppearanceLarge);
t.setLayoutParams(titelParams);
ProgressBar circle = new ProgressBar(this);
circle.setScrollBarStyle(android.R.attr.progressBarStyleLarge);
circle.setLayoutParams(new LayoutParams(android.view.ViewGroup.LayoutParams.WRAP_CONTENT, android.view.ViewGroup.LayoutParams.WRAP_CONTENT));
progressLayout.addView(t);
progressLayout.addView(circle);
this.setContentView(progressLayout);
}
private int pixelsToDIP(int pixel) {
float pixels = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
pixel, this.getResources().getDisplayMetrics());
return (int) pixels;
}
</code></pre>
<p>I set the style of the progress and textview to large but they display really small.<br>
Any ideas? </p>
| android | [4] |
3,476,543 | 3,476,544 | (java) How do i ask if something is not happening | <p>In my loop i want</p>
<p>do</p>
<p>something
while( (something is happening) || (something is not happening))</p>
<p>How do I ask if something is not happening</p>
<p>Thanks!</p>
| java | [1] |
5,516,474 | 5,516,475 | How to select current month from dropdownlist using C# with the help of back end code? | <p>Suppose i have a dropdownlist in which whole months are there in that dropdown.I want that on page load dropdownlist select current month automatically(means with the help of back end code using C#). so how to do this ? please tell me.</p>
| asp.net | [9] |
2,646,690 | 2,646,691 | jQuery toggling between two objects on one item click | <p>This should be a simple one but since im a bit tied on time i figured id ask... Anyways I was just wondering how could I make two things toggle for eg. I want a div to show then hide (slide effect) and at the same time the link that does this effect to change text... I have this code currently...</p>
<pre><code>/* Show/Hide */
$("#statusDisplayH").live("click", function(){
$("#statusH").slideToggle("medium");
if($("#statusH").is(":visible"))
{
$("#statusDisplayH").text("HIDE");
}
else
{
$("#statusDisplayH").text("SHOW");
}
});
</code></pre>
<p>where statusH is the div to show/hide and statusDisplayH is a link "a href..." and of course the link is not inside the div... Thanks in advance for the help!</p>
| jquery | [5] |
2,407,619 | 2,407,620 | How to get max 10 random items from list? | <p>I have a list that can have a variable amount of items (but no more than ~30 so no performance issue here), I want to get maximum 10 random items and I wrote a piece of code for that which works fine if there are 10+ items in the list. The issue with the code below is that it obviously doesn't randomize the result if there are less than 10 items in the list and if there are less than 10 items I want to display them all but in random order.</p>
<pre><code>var keyPersons = people.ToList();
Random rnd = new Random();
while (keyPersons.Count() > 10)
{
int j = rnd.Next(0, keyPersons.Count());
keyPersons.RemoveAt(j);
}
rptKeyPersons.DataSource = keyPersons;
</code></pre>
<p>How can I randomize the result if there are let's say only five items in the person list?</p>
<p>Thanks in advance.</p>
| c# | [0] |
2,611,072 | 2,611,073 | I need some assistance writing an Android app | <p>I'm a junior-level computer science minor and currently work for one of the dining halls on campus. We're into innovative ideas, and recently came up with the idea for a smartphone app that displays our dining hall's menu.</p>
<p>I've had about three courses worth of Java practice, and have completed most of the tutorials available on Sun's website. However, I am still going to need help constructing this app, while learning a bit along the way because I hope to make more apps in the future.</p>
<p>I am looking for someone to help walk me through writing this app almost step-by-step, so please don't just pop in the comments and link me to a tutorial site that'll help my skills. </p>
<p>Just some background information on the app:</p>
<p>I'd like it to hold one month's worth of menus at a time. We have marketing interns working for the dining halls who will be able to plug in and update the app every month (is there some sort of routine we can configure for them to make it easier?). </p>
<p>I have downloaded the Android SDK for Eclipse, and am ready to start coding. So, is anyone out there willing to help?</p>
| android | [4] |
3,336,077 | 3,336,078 | design a usercontrol for different scenario | <p>Now I am working on a registration system, there are basically three different scenario to get users' personal information (name, address e.g.)
1. prepopulate data from table1
2. prepopulate data from table2
3. empty for new user</p>
<p>I am trying to make a personal information usercontrol for these three situation, in this case I guess I need a switch to determine which table to go. My question is does it worth to do this? Because I am not sure if the client will add more scenario in the future. thanks</p>
| c# | [0] |
2,585,196 | 2,585,197 | why equals() method when we have == operator? | <p>When i see the implementation of equals() method it does nothing but same as what == does. So my question is what was the need to have this as separate method when we have == operator which does the same work? </p>
| java | [1] |
3,780,711 | 3,780,712 | What number is e+000 | <p>i have a data file full of numbers i'm loading into a vector of floats. However, the numbers in the data file are like -4.60517025e+000 but are being read in like -4.60517</p>
<p>What number should -4.60517025e+000 be</p>
| c++ | [6] |
5,275,702 | 5,275,703 | allow only alphabets and underscore using javascript | <p>I am allowing a string to contain only alphabets and underscore,but is i enter fist character as alphabet or underscore and later if i put any invalid character then this validation is being done.I have done validation as follows:</p>
<pre><code>function permission_validate()
{var permission=document.permissionForm.permission.value;var allowedStr=/[A-Za-z_]/;
if(!allowedStr.test(permission)){document.getElementById("permission_Er").innerHTML="* Required field can contain Only A-Z/az/_";
document.permissionForm.permission.focus();return false;}else{return true;}
</code></pre>
| javascript | [3] |
271,968 | 271,969 | Python fixed width strings with the Template object | <p>Is there a way make fixed width substitutions with the python String.Template objects substitution language</p>
<p>For example if I wanted s to be 'A string 0003' how would I modify this code:</p>
<pre><code>from string import Template
stmpl=Template("A string ${tcount}")
s=stmpl.substitute(tcount=3)
print(s)
</code></pre>
<p>Related question, not using template strings:
<a href="http://stackoverflow.com/questions/5138062/setting-fixed-length-with-python">Setting fixed length with python</a></p>
| python | [7] |
255,485 | 255,486 | Android 3.0 SQLiteStatement: bindings gone after execute() | <p>I have tested this with android 3.0 & 3.1 and after calling execute() or executeUpdateDelete() on SQLiteStatement object all bindings that i made with bind...() methods disappear:</p>
<pre><code>stmt = sqliteDB.compileStatement(sqlText);
stmt.bindLong(1, ...);
stmt.bindLong(2, ...);
stmt.execute();
</code></pre>
<p>After call to execute() bindings created with bindLong() disappear so i have to rebind if i want to execute the same statement again.</p>
<p>This doesn't happen with previous releases of android (level 10 and below).</p>
<p>Is this a bug?</p>
| android | [4] |
493,593 | 493,594 | Installing app on Devices(iPhone/iPod) | <p>I have developed an application for iPhone and iPod touch. Now i want to install that app on the device. I have created a provisioning profile for the particular device.
My query is that, now to install the app on a device I have to add the provisioning profile of that device to xcode and after selecting the developer in build option in project info pane i build the project and send the build and provisioning profile to the user.
Is there any to install the app without doing the above task of building the project with the provisioning profile.
Means i have a build of an app and a newly downloaded provisioning profile. I will send the user both build and profile in a zip file. will the user be able to install the app on his/her device? </p>
| iphone | [8] |
2,333,888 | 2,333,889 | Generate random word ( from two known words ) | <p>SO I can do this with numbers:</p>
<pre><code><?=number_format(mt_rand(0,1));?>
</code></pre>
<p>What I want to do is echo instead of 0 or 1</p>
<p>the words <strong>firstclass</strong> or <strong>secondclass</strong></p>
<p>Because I cannot use numbers as class identifiers ( css ) So essetinally, this is just for displaying random stuff within a list and prepending the class identifier with either firstclass or secondclass.</p>
<pre><code>.firstclass {display:none;}
</code></pre>
<p>I am not ace with php, so I guess I need to set up an array, and somehow attribute:</p>
<p>0 = firstclass
1 = secondclass </p>
<p>within the array, so that i can get my little test script working.</p>
<p>Any suggestions please.</p>
| php | [2] |
2,818,406 | 2,818,407 | How server side events are called in .NET | <p>I am a beginner to .NET, I have some doubts in my mind. Can anybody help me to sort out?</p>
<ol>
<li><p>When a user requests for a file(*.ASPX), The request first goes to IIS server and with the help of Handlers and modules it finds the type of file that need to be processed and sent back to the client. But while displaying on the cilent machine the content of the .ASPX file will be displayed as HTML controls. How are the events generated at the client side and sent back to the server?</p></li>
<li><p>I know runat=server tells the control will be processed at serverside.
But every time why we need to write "runat=server". Is there any ASP.NET control which runs at client side?</p></li>
</ol>
| asp.net | [9] |
1,902,896 | 1,902,897 | Pointer-to-member selection | <p>I have seen the following binary operator listed on a book <a href="http://www.apibook.com" rel="nofollow">pp 191</a>,</p>
<pre><code>Point-to-member selection x->*y
</code></pre>
<p>I understand <code>x->y</code> but not <code>x->*y</code>. Is this a typo or something else?</p>
| c++ | [6] |
5,826,255 | 5,826,256 | How access text that is not comes under any tags, using jquery? | <p>Means if name not comes under any tag,like</p>
<pre><code><div>name
<br>
santhosh
<br>
</div>
</code></pre>
<p>i need only "santhosh"....not entire text like"name santhosh".....if any one knows kindly tell me...</p>
| jquery | [5] |
1,790,817 | 1,790,818 | jquery plugin pattern using jquery.data | <p>I have seen this piece of code in jquery plugin patterns and the notes section mention that we could attach the plugin to the DOM element using the jQuery.data function. What I don't understand is how do I make use of this piece of code. Can somebody provide examples of how to use this functionality and explain its significance?</p>
<pre><code> $.fn[pluginName] = function (options) {
return $Extend(this).each(function () {
if (!$.data(this, 'plugin_' + pluginName)) {
$.data(this, 'plugin_' + pluginName,
new Plugin( this, options ));
}
});
};
</code></pre>
| jquery | [5] |
3,022,377 | 3,022,378 | Nesting Functions-Python | <p>I am having a hard time nesting 2 functions into larger functions, and so that the functions will open and read a file and print the outcome. There is no error, however the result shows up as <code>None</code>. Please let me know how I can improve the code. Thank you in advance!</p>
<pre><code>import glob
#Read a result file and return a list
def read_results(filename):
text_file=open(filename,"r")
lines=text_file.readlines()
return lines
text_file.close()
#Give a list of results files in your directory
def get_filename():
filelist=glob.glob("./Data/*.*")
return filelist
#Call above functions to get file names and read each file
def read_lines(filename):
def get_filename()
def read_results():
print lines
#main
function=read_results("./Data/GSM21203-GSM21215.csv")
print"\nHere's the lines of the text file:", function
#In order to use the strip method, it must be a str. Currently I am not using a string. Figure out how to do it
print"\n"
list_of_filenames=get_filename()
print"Here are the list of filenames:",list_of_filenames
read_each_file=read_lines("*.*")
print "Here are the contents of each file",read_each_file
</code></pre>
| python | [7] |
177,003 | 177,004 | C++: how do I convert hex char to unsigned char? | <p>I have a method that takes unsigned chars, but I want to pass it 0x01.</p>
<p>I know I can represent hex chars in strings by going "\x01"...
but that is still a signed char.</p>
<p>EDIT:
some code: </p>
<pre><code>kennys_hash((unsigned char const *)"\x00"); // the method call
</code></pre>
<p>the error:</p>
<pre><code>src/main.cpp:88: error: invalid conversion from ‘const unsigned char*’ to ‘unsigned char’
src/main.cpp:88: error: initializing argument 1 of ‘unsigned char kennys_hash(unsigned char)’
</code></pre>
<p>the method header: </p>
<pre><code>unsigned char kennys_hash(unsigned char out)
</code></pre>
<p>ALso, when the cast is just to unsigned char, I get this error: </p>
<pre><code>src/main.cpp:88: error: cast from ‘const char*’ to ‘unsigned char’ loses precision
</code></pre>
| c++ | [6] |
891,631 | 891,632 | how to make an api for my website | <p>Im creating a review website, and one of the features is that you can get an API that shows your 5 star (*) rating from the site on another site. </p>
<p>I was wondering what is the best way to go about this? </p>
<p>I thought of just using an iframe but that didn't seem like the best solution. </p>
<p>I was hoping to do it through javascript someway like facebook and twitter, any ideas?</p>
| php | [2] |
83,464 | 83,465 | C# How to use OrderBy with a property on a nested class? | <p>I have a IEnumerable collection of a class which I want to sort.
One of the properties I want to sort is in a nested class.
What is the syntax to make this work?
The code below shows what I am trying to do, although it does not work.</p>
<pre><code> AbsenceViewModel avm = new AbsenceViewModel();
if (sort.Column != null)
{
if (sort.Column == "OtherLeaveName")
avm.ListNames = avm.ListNames .OrderBy("NestedClass.Name", sort.Direction);
else
avm.ListNames = avm.ListNames (sort.Column, sort.Direction);
}
</code></pre>
<p>So putting in "NestedClass.Name" doesn't work. What do I need to do instead?</p>
| c# | [0] |
335,246 | 335,247 | How do I add a string of numbers in python | <p>For instance if I have the string entered 345. I want them to be added 3 + 4 + 5. I've seen this here before just can't seem to find it again. Thanks!</p>
| python | [7] |
5,844,125 | 5,844,126 | $_SESSION doesn't work properly | <p>Does anybody know why the following code doesn't work properly?</p>
<pre><code>function LinksPage()
{
$ClickedWord = $_GET['clickedword'];
foreach($_SESSION['Links'] as $key=>$value)
{
if ($key == $ClickedWord)
echo $key." ".$value.' <br />';
}
}
</code></pre>
<p>When I check <code>$ClickedWord</code>, <code>$_SESSION['Links']</code>, I see that there is a key in <code>$_SESSION['Links']</code> that matches <code>$ClickedWord</code> but when I run the program if doesn't generate output.</p>
| php | [2] |
3,074,222 | 3,074,223 | Onclick select then off | <p>I am using basic code to highlight the text within a text field when the user clicks in it:</p>
<pre><code><input type="text" id="search_for" name="searchTerm" onclick="this.select()">
</code></pre>
<p>Which is great, but you only have the choice to delete, meaning you can't actually click in the middle of the selected text to add something in the middle of words/characters already in there.</p>
<p>Scenarios... if a user does a search for "red car", they should be able to click in the box, its hightlighted, so hit delete and search for "blue car". Or, they might want to click in the input and change their search to "big red car".</p>
<p>Is it possible to click then unset the highlight by clicking again? Or what other method could I use?</p>
<p>Or should I select the field on page load, then click to un-select? Is that even possible?</p>
<p>I've searched extensively for this but no luck as yet.</p>
| javascript | [3] |
2,144,444 | 2,144,445 | related to Android audio driver | <p>While I was diving into the Android kernel. I had a question about audio device driver.</p>
<p>People say that...
- Android uses ALSA audio driver.
- HAL layer is C/C++ library
- ALSA driver runs in user space, not in kernel space</p>
<p>Then, questions:
1. What is the Audio Drivers(I guess it's ALSA driver) in the picture below?
ALSA driver should exist in the library portion, isn't it?
(http://developer.android.com/guide/basics/what-is-android.html)</p>
<p>2.
There should be nothing about audio driver in Android Kernel, if it conforms to the ALSA driver?</p>
<ol>
<li>
I have a wm8994.c codec source file which drives codec h/w actually.
who's going to call the functions in wm8994.c? I think ALSA HAL will. Am I wrong?</li>
</ol>
<p>I'm very confused... </p>
<p>Thank you
ilgimae</p>
| android | [4] |
1,724,612 | 1,724,613 | Associative array - change position | <p>For ex have this array:</p>
<pre><code>[food] => Array (
[fruits] => apple
[vegetables] => garlic
[nuts] => cashew
[meat] => beaf
)
</code></pre>
<p>I need to change the position of a specific key-value combination.</p>
<p>Let's say I need to move [fruits] => apple to 3rd position</p>
<pre><code>[food] => Array (
[vegetables] => garlic
[nuts] => cashew
[fruits] => apple
[meat] => beaf
)
</code></pre>
<p>I am not talking about sorting by key or value.
I need to change position of key-value to a very strict new position.</p>
<p>Something like:</p>
<pre><code>change_pos($my_arr, $key_to_move, $new_index);
</code></pre>
<p>=></p>
<pre><code>change_pos($my_arr, "fruits", 3);
</code></pre>
<p>Is that possible?</p>
| php | [2] |
1,445,966 | 1,445,967 | JQuery Smooth Lightbox zoomin | <p>I need a jquery lightbox with smooth zooming animation
it should zoom form the center of window. I searched many time I am beginner please help me for this</p>
| jquery | [5] |
3,472,839 | 3,472,840 | problem in improving two galleries | <p><strong>Here is my code:</strong> </p>
<pre><code> gallery = (Gallery) findViewById(R.id.gallery1);
gallery = (Gallery)findViewById(R.id.gallery2);
imgView = (ImageView)findViewById(R.id.ImageView01);
imgView.setImageResource(Imgid[0]);
final ArrayList<searchResults> searchResults = GetsearchResults();
tv = (TextView)findViewById(R.id.name);
tv1 = (TextView)findViewById(R.id.citystate);
gallery.setAdapter(new Adapter(this, searchResults));
gallery1.setAdapter(new AddImgAdp(this));
</code></pre>
| android | [4] |
5,141,606 | 5,141,607 | Setting the height of a sliding div | <p>How do I set the height to a vertically sliding div? I have used jQuery and here is the code for it:</p>
<p>When I say set the height, I mean so the div only slides say 1000px where it will stop sliding? The issue I have is that in smaller smaller screen sizes, the sliding div always wants to be shown, so on some pages it pushes the footer down, so the user can never see the footer!?</p>
<p><a href="http://dev.assessmentday.co.uk/psychometric-test.htm" rel="nofollow">http://dev.assessmentday.co.uk/psychometric-test.htm</a></p>
<p>Thanks.</p>
<p>210895</p>
| jquery | [5] |
4,014,988 | 4,014,989 | bypassing UIImagePicker in iphone sdk | <p>From my understanding on iphone sdk, the app runs in a sandbox & the only way to get access to photo library is thru the UIImagePicker. Wondering if there is any way to bypass UIImagePicker & still get all the images from the user's photo library. </p>
<p>I am looking for something like java's File API. (If we want list all files in a dir, as we can use dir.list() .. do we have anything similar to this in iphone sdk)</p>
| iphone | [8] |
626,934 | 626,935 | Custom Fields Not Showing | <p>I have this custom field for a post:</p>
<pre><code>key: price
value: 2000
</code></pre>
<p>I've added this to my loop:</p>
<pre><code><div class="buyitnow"><?php $price = get_post_meta($post->ID, 'price', true);
if ( $price ) { ?>
Price: $<?php echo number_format($price ,",",",",","); ?>
<?php } else {} ?></div>
</code></pre>
<p>But all I'm getting is:</p>
<pre><code>Price: $
</code></pre>
| php | [2] |
5,433,488 | 5,433,489 | how to download decrypted file without writing to disk first | <p>I have a script that can take an mp3 file on disk for a given <code>$path</code> variable (ie: <code>/var/recordings/file.mp3</code>) and send it to the browser to be player by a media player. Here is the code:</p>
<pre><code>//Send the media asset to the browser
header('Content-type: audio/mpeg');
header('Content-length: ' . filesize($path));
header('Content-Disposition: filename="recording.mp3"');
header('X-Pad: avoid browser bug');
header('Cache-Control: no-cache');
header("Content-Transfer-Encoding: binary");
header("Content-Type: audio/mpeg, audio/x-mpeg, audio/x-mpeg-3, audio/mpeg3");
print file_get_contents($path);
</code></pre>
<p>I now store the mp3 files in question in encrypted form, so I now read the file in question into a string and decrypt it using an encryption class. I'd like to now send this decrypted file directly to the browser without outputting it into a file, and then having PHP read the contents of that file. Is it possible? I would assume I could just do <code>print $decrypted_string</code> but how would I specify the file size?</p>
| php | [2] |
2,453,319 | 2,453,320 | Operator & and * at function prototype in class | <p>I'm having a problem with a class like this:</p>
<pre><code>class Sprite {
...
bool checkCollision(Sprite &spr);
...
};
</code></pre>
<p>So, if I have that class, I can do this:</p>
<pre><code>ball.checkCollision(bar1);
</code></pre>
<p>But if I change the class to this:</p>
<pre><code>class Sprite {
...
bool checkCollision(Sprite* spr);
...
};
</code></pre>
<p>I have to do this:</p>
<pre><code>ball.checkCollision(&bar1);
</code></pre>
<p>So, what's the difference?? It's better a way instead other?</p>
<p>Thank you.</p>
| c++ | [6] |
1,262,246 | 1,262,247 | assignment in PHP | <p>I am learning php and read this example in this <a href="http://www.php.net/manual/en/language.types.boolean.php" rel="nofollow">http://www.php.net/manual/en/language.types.boolean.php</a> tutorial,
I want to understand what occur when assigning the return value of method to a variable, why it may change?? please see my questions in the code.</p>
<pre><code><?php
public function myMethod()
{
return 'test';
}
public function myOtherMethod()
{
return null;
}
if($val = $this->myMethod())
{
// $val might be 1 instead of the expected 'test'
** why it may returns 1??**
}
if( ($val = $this->myMethod()) )
{
// now $val should be 'test'
}
// or to check for false
if( !($val = $this->myMethod()) ) **what happens here????**
{
// this will not run since $val = 'test' and equates to true
}
// this is an easy way to assign default value only if a value is not returned:
if( !($val = $this->myOtherMethod()) ) **what happens here????**
{
$val = 'default'
}
?>
</code></pre>
| php | [2] |
4,678,661 | 4,678,662 | Service Receiving Touch Events from all Activities on Phone? | <p>I've seen applications that if you touch a certain part of the screen (i.e. very top left) they will launch an application. This can be done from the home screen, or any application on my screen. The best I can figure how they can do this is by having a service that receives all touch events, and then tests whether or not they are in the specified area? How would you do this? Can anyone point me in the right direction?</p>
| android | [4] |
4,939,576 | 4,939,577 | Android ActionBar and content position | <p>I'm using the support package ActionBar. Just using standard "setContentView". It seems like the action bar is simply floating above the content, rather than displacing it. I'm sure there's a really dumb thing I'm doing, but its driving me nuts. I would expect my content to show below the action bar.</p>
<p>Also, using viewpager with tabs on another screen. Same issue, but worse. Content takes up whole screen, and actionbar and tabs are on top.</p>
| android | [4] |
5,303,247 | 5,303,248 | CSS not pulling in for jQuery UI dialog | <p>I want to add a jQuery dialog modal to a form page. When the dialog box is triggered I see the the text content but with no CSS. I'm pulling in the jquery in the functions.php for the page:</p>
<pre><code>wp_enqueue_script('jquery-ui-dialog');
</code></pre>
<p>The jquery css (jquery-ui-dialog.css) is under my wp-includes/css directory.
I tried adding</p>
<pre><code>wp_enqueue_style('jquery-ui-dialog');
</code></pre>
<p>but it not work. Does anybody know the proper way to enable jQuery Dialog.</p>
| jquery | [5] |
2,082,007 | 2,082,008 | website folder layout | <p>I'm not going to ask <em>what is the best way to ...?</em> since they might be several ways to do it, I just want to know from your experience how to manage folders and files when starting to build a website ? (note: I'm not english native that is why I request here, I can't find right places to be answered).</p>
<p>I've been coding for years but always on my own and I never share about how people structure their website before.</p>
<p>As an information, I'm making a structure file at the root of my website, <em>struct.php</em> that contains the common layouts shared by the many pages in my website.</p>
<p>If the user types <em>http://mywebsite.com/folder/</em> it requests the index file of the requested folder which just contains the 'struct' file importation, for the other variable parts like the metadatas of webpages, I'm creating a folder named <em>meta</em> which contains a file for any type of data (.title, .description, .keywords) and of course the struct file is fetching the content of these informative file and display them in their appropriate place in the document.</p>
<p>I feel comfortable with that structure cause it's been a long time using it. But I'd really appreciate it if you were giving some advices or some useful links and/or tell me how you manage your own website.</p>
| php | [2] |
3,955,341 | 3,955,342 | What is the best way for a programmer to learn most efficient and common way to write code? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/82639/how-to-become-a-better-programmer">How to become a better programmer?</a> </p>
</blockquote>
<p>As a programmer when you want to learn a programming language, you usually focus on syntax, language features, etc. </p>
<p>but knowing languages syntax in not important; the most important thing is the way of coding. simply the Programming Logic. obviously it is experimental and can't be formulated but some projects are similar in many aspects such as the class hierarchy, application layers, etc.</p>
<p>For example the Application layers a database application would have.</p>
<p>Or as another example to mention a more specific problem, which is the most common way to implement a multi-page application configuration wizard? designing individual forms, using inheritance, using control containers, etc. (I know it depends on the Application but there might be some similarities)</p>
<p>...anyway, what would you suggest to learn these things? books (I read many programming-how-to books but they're not enough to learn these things), open-source projects (in this case I'd prefer C#) or any other way you might think that is good.</p>
| c# | [0] |
5,277,241 | 5,277,242 | How to search a record from database by date range in c# | <p>I have one column called date in database and my database datecolumn contain like this 2013-02-22,but in front end iam using 2 ajaxdate pickers and searching for a record
i am writing the query like this,i want to know whether it is correct or not.</p>
<pre><code>SELECT * from table where Date between '" + txtfromdate.Text +"' and '"+txttodate +"'";
</code></pre>
| c# | [0] |
3,797,712 | 3,797,713 | How to remove warnings java | <p>I found this and it seems to be working, I'm trying to iterate trough HashMap :</p>
<p><a href="http://stackoverflow.com/questions/1066589/java-iterate-through-hashmap">Java: iterate through HashMap</a></p>
<p>But this portion of code shows warnings and I don't have a clue how to make it not show them :</p>
<pre><code>Iterator it = map.entrySet().iterator();
Map.Entry pairs = (Map.Entry) it.next();
</code></pre>
<p>Is there a way to "fix" this without using suppressWarnings annotation ?</p>
| java | [1] |
5,191,105 | 5,191,106 | how secure is sending values through urls in PHP | <p>I want to know how secure is about sending values through URLs. It will be a big mess I think. The good suggestion would be sending values by post method in php through pages. But if I get a better example of how usually the script would be in post format it would be great.. Or otherwise suggest your valuable comments to this to do how</p>
| php | [2] |
2,906,263 | 2,906,264 | How to make custom title bar for my android application? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3157522/android-custom-title-bar">Android: Custom Title Bar</a> </p>
</blockquote>
<p>I want to make custom title bar for my application for cahnging the color of my applicatin name.How can i do this?</p>
| android | [4] |
966,726 | 966,727 | Python debugging tips | <p>What are your best tips for debugging Python?</p>
<p>Please don't just list a particular debugger without saying what it can actually do.</p>
<h3>Related</h3>
<ul>
<li><a href="http://stackoverflow.com/questions/299704">What are good ways to make my Python code run first time?</a> - This discusses minimizing errors</li>
</ul>
| python | [7] |
851,517 | 851,518 | When do you have to use @property and @synthesize in the iPhone SDK? | <p>When do you have to use <code>@property</code> and <code>@synthesize</code> in the iPhone SDK? And why use <code>@property</code> and <code>@synthesize</code>?
I was studying property, but I can't get a correct idea. What would some examples for illustrating this be?</p>
| iphone | [8] |
3,125,087 | 3,125,088 | post the result values in an array | <p>I have used the following code to display the previous and after years of current year.</p>
<pre><code><?php
$year = date(Y);
$endyear = $year + 10;
$startyear = $year - 10;
for ($i = $startyear; $i <= $endyear; $i++)
{
echo $i;
}
?>
</code></pre>
<p>I want to put the resulting values of <code>$i</code> in an array. How can I do that?</p>
| php | [2] |
1,188,695 | 1,188,696 | SQL Ready Made Table of language | <p>Sir,
Plz can u help me to arrange all indian language ready made Table in MS SQL.
I have to add that table in my Dropdown list.</p>
| asp.net | [9] |
4,760,626 | 4,760,627 | jQuery image transition plugin | <p>I'm looking for some simple crossbrowser plugin/function that could change one image to other with some smooth effect (fadeIn, fadeOut or opacity is not an option), code:</p>
<pre><code><script type="text/javascript" >
imgtimer = setInterval(function() {
// this is something what I'm looking for:
var from = $('.visible');
var to = $('.visible').next('img');
changeimg(from,to,effect);
// some function that could be able to hide one image
// and show other with some effect.
}, 5000);
</script>
<div id="images">
<img src="img_01.jpg" class="visible" />
<img src="img_02.jpg" />
<img src="img_03.jpg" />
</div>
</code></pre>
<p>Any ideas? I just can find any plugin that would look nice. I don't need any complex sliders.</p>
| jquery | [5] |
6,003,335 | 6,003,336 | python getting instance variables best practice | <p>I was wondering how should one access the instance variables in a python class. Should i make a method for every instance variable or should i access them directly?</p>
<p>Here's an example:</p>
<pre><code>class Example(object):
def __init__(self):
self.x = 5
def getX(self):
return self.x
def addYtoX(self, y):
return self.x + y # OR: return self.getX() + y
</code></pre>
<p>Thank you!</p>
| python | [7] |
4,492,675 | 4,492,676 | how to do Facebook like expanding and shrinking animation to view controller | <p>how can we add a shrinking and expanding view instead of normal push and pop for transom between news.i have seen Adems youtube video tutorial for adding shrinking and expanding transition ,but there is no code available for download.how can i implement this to subviews?.is that possible.</p>
| iphone | [8] |
280,142 | 280,143 | JQuery: Multiple checkbox to disable multiple textbox | <p>I have multiple checkbox in my form; each to disable a specific textbox.</p>
<p>Currently I have this in my form.</p>
<pre><code>$("#check1").click(function() {
$("#text1").attr('disabled',! this.checked)
});
$("#check2").click(function() {
$("#text2").attr('disabled',! this.checked)
});
...
...
...
</code></pre>
<p>Any tips on how I can shorten this up? I think having 1 line of code for each checkbox and textbox seems to be too much, repetitive and redundant. Thank you in advance.</p>
| jquery | [5] |
3,344,157 | 3,344,158 | When will Android have a public Calendar API? | <p>Is someone from Google able to advise when the Android SDK is likely to include a public API for reading/writing event data to the user's calendar?</p>
<p>Searching the forums I see that this is a much desired feature by many developers but I haven't seen any indication as to when (or even if) this need will be addressed.</p>
<p>Thanks in advance ...</p>
| android | [4] |
775,972 | 775,973 | How to send Russian and Arabic character on windowsmessages? | <p>I have 2 applications in c# that are talking via windows messages
App1: sends a message to App2</p>
<pre><code>string msg=UserName+","+UserAge;
byte[] sarr =System.Text.Encoding.Default.GetBytes(msg);//
int len = sarr.Length;
COPYDATASTRUCT cds;
cds.dwData = (IntPtr)100;
cds.lpData = msg;
cds.cbData = len + 1;
result = SendMessage(hWnd, WM_COPYDATA, wParam, ref cds);
</code></pre>
<p>App2:receives the message from App1</p>
<pre><code>COPYDATASTRUCT sentPara = new COPYDATASTRUCT();
Type mytype = sentPara.GetType();
sentPara = (COPYDATASTRUCT)message.GetLParam(mytype);
string[] parameters = sentPara.lpData.Split(',');
</code></pre>
<p><strong>Problem:</strong>
The username is in Russian and when i receive it in App2 i got question marks"???????", i think it's something in the encoding of byte array but i don't how to solve it</p>
| c# | [0] |
4,439,382 | 4,439,383 | Is it possible to capture the url of a dragged browser tab? | <p>More and more web browsers these days are supporting the tear-off and dragging of browser tabs. </p>
<p>Is it possible (using javascript?) to "catch" one of those browser tabs when it is released over an element on a web page and extract from that capture the URL of the page in that dropped tab?</p>
<p>I'm looking for a convenient way to add a URL to a page. If I could enable a user to tear off a tab and drag it onto my page and thereby extract the URL that would be very slick.</p>
| javascript | [3] |
4,929,287 | 4,929,288 | Changing current version of Java within Windows | <p>I'm working in a Windows XP environment and have recently installed java 1.6 because it was required by an application. </p>
<p>However I don't want this to be the default version of java to be used. How do I set it so that the command java -version will return 1.5.x</p>
| java | [1] |
6,008,780 | 6,008,781 | Automated python compiling(?) | <p>Im trying to setup a script that converts all my .py scripts in the folder into windows .exe binaries and then reuploads them back to google code with svn commit.</p>
<p>I can make it work with a single .py file, but how can i have it do all in the directory and then delete the source .py's until the next time the script is run. This is just a snippet, the main thing i need help with is making the os.system command containing the pyinstaller.py command run on each file in the directory. Please and thank you ^_^</p>
<p>The hope is to assign a clustered group of servers to compile my code every hour, so any changes made will be compiled into binaries and tested for stability.</p>
<pre><code>#!/usr/bin/env python
import os
import sys
#filename = ".py"
def updatecode():
os.system("sudo svn update")
os.system('sudo cp /code/Python/*.py pyinstaller/'
def compile2exe(file):
print "[!] Compiling input file to windows binary..."
os.system('sudo python pyinstaller.py --onefile -o ../binaries/ %s'%file)
#for filename in os.listdir('/code/Python/'):
# compile2exe(filename)
</code></pre>
| python | [7] |
2,110,350 | 2,110,351 | Html select tag issue | <p>There are two field in my form. </p>
<p>1) Html select field item ( From mysql database)<br>
2) Name box. </p>
<p>If a user select a item from html select tag and forgot to write his/her name then with php it's say..</p>
<pre><code>* Your username required
</code></pre>
<p>BUT then it's doesn't show the select item which user <strong>selected</strong>.. it's show again <strong>Select...</strong> That's why another error message appear.. </p>
<pre><code>* Please select your item.
</code></pre>
<p>How do i show this selected item with php?</p>
<p><strong>Html form:</strong></p>
<pre><code><tr>
<td>Class</td>
<td>
<select class="td" name="class">
<option selected="selected" value="">Select..</option>
<?php
include_once("../../toplevel/content/manage/dbcon/dbcon.php");
$sql = mysql_query("SELECT * FROM class");
while($re = mysql_fetch_array($sql))
{
$re_class = mysql_real_escape_string(trim($re['c_name']));
echo "<option value='$re_class'> $re_class </option>";
}
?>
</select>
</td>
</tr>
<tr>
<td>Name</td>
<td><input type="text" value="<?php if(isset($_POST['uname'])) echo
$_POST['uname']; ?>" name="uname" class="td" /></td>
</tr>
<tr>
</code></pre>
<p>I can do this for Name filed But how do i do this for the select field ?<br>
Thanks a lot.<br>
Shibbir</p>
| php | [2] |
5,720,617 | 5,720,618 | How to sort like values in Python | <p>I was wondering how to sort like values in a list, and then break like values into a sub-list. </p>
<p>For example: I would want a function that probably does something like </p>
<pre><code>def sort_by_like_values(list):
#python magic
>>>list=[2,2,3,4,4,10]
>>>[[2,2],[3],[4,4],[10]]
OR
>>>[2,2],[3],[4,4],[10]
</code></pre>
<p>I read up on the sorted api and it works well for sorting things within their own list, but doesn't break lists up into sub-lists. What module would help me out here?</p>
| python | [7] |
3,412,002 | 3,412,003 | Virtual methods and subclasses in c++ | <p>So i'm trying to better understand virtual methods.
I have a base class <strong>Sensor</strong> and several subclasses <strong>SensorTemp</strong> *<em>SensorPh</em>* <strong>SensorOrp</strong></p>
<pre><code>class Sensor
{
public:
virtual void updateValue();
}
</code></pre>
<p>the subclasses then override updateValue with their own method definitions (this happens in each of the subclasses)</p>
<p>.h file</p>
<pre><code>#include "Sensor.h"
class SensorTemp : public Sensor
{
private:
public:
};
</code></pre>
<p>.Cpp file</p>
<pre><code>#include "Sensor.h"
#include "SensorTemp.h"
void Sensor::updateValue(){
int reading = analogRead(pinId);
float voltage = reading * 5.0;
voltage /= 1024.0;
currentVal = voltage * 100 ;
Serial.print("temp: "); Serial.println(currentVal);
}
</code></pre>
<p>My issue is this works for the first subclass declaration, although the following will have a compiler error: updateValue() .... first defined here ld.exe : : Disabling relaxation: it will not work with multiple definitions</p>
<p>So I'm stuck on what type of approach I should take if I want to define the method differently from each subclass?</p>
<p>Any insight would be highly appreciated!</p>
| c++ | [6] |
1,015,990 | 1,015,991 | Show error message with buttons? | <p>How can I make it so that after doing something (like opening a file), if it fails, it:</p>
<ol>
<li>Freezes the application</li>
<li>Shows a Windows dialog with the default error message, along with any custom message specified.</li>
<li>Gives options to 'Retry' or 'Abort'</li>
</ol>
<p>Whats the best way to do something like this?</p>
| c++ | [6] |
3,584,138 | 3,584,139 | Get Tried Paths for PHP's include | <p>Is it in any way possible to tell PHP that I want to have a list of tried paths whenever <code>include</code> fails? The file is there, yet PHP is telling me the <code>include</code> failed.</p>
| php | [2] |
693,498 | 693,499 | jQuery: Adding element after nth element | <p>I need help in adding an element at a particular location in the page body.</p>
<p>Here is my page code.</p>
<pre><code><div id="div1>
<label id="label1"></label>
<input type="text1"></input>
<!-- Insert button here -->
<span id="span1"></span>
</div>
</code></pre>
<p>I want to add a button at the location where I have put a comment above using jQuery. If the page syntax is fixed, is there a way I can add an element as a third child of the parent div? I do not want to put placeholders and do a string replace.</p>
<p>Thanks.</p>
| jquery | [5] |
1,747,707 | 1,747,708 | better way to check if in array and then in array | <p>I am adding the following code to check whether a checkbox should be checked or not:</p>
<pre><code>is_array($current_color_id_array) ? in_array('1', $current_color_id_array) : ''
</code></pre>
<p>I'm just wondering if there is nicer/more concise way to do it perhaps?</p>
<p>Edit: Sorry I was not clear enough, and actually my code was wrong..</p>
<p>This is supposed to check if $current_color_id_array is an array because apparently if I don't check it will give me the error Warning: in_array() expects parameter 2 to be array</p>
<p>and it should also check if the value is in the array to mark the checkbox as checked. </p>
<p>this is all part of a checkbox function: </p>
<pre><code>function tep_draw_checkbox_field($name, $value = '', $checked = false, $compare = '') {
return tep_draw_selection_field($name, 'checkbox', $value, $checked, $compare);
}
</code></pre>
<p>it is the third parameter. So if I can reask this I would say is there a better way of writing: </p>
<pre><code>tep_draw_checkbox_field('color_id[]', '1', (is_array($current_color_id_array) && in_array('1', $current_color_id_array)))
</code></pre>
<p>and just in case, this is how the array is made:</p>
<pre><code>$color_id_query = tep_db_query("select color_id from " . TABLE_PRODUCTS_TO_COLORS . " where products_id = '" . (int)$product['products_id'] . "'");
while ($color_id_row = mysql_fetch_array ($color_id_query)) {
$current_color_id_array[] = $color_id_row['color_id'];
}
</code></pre>
| php | [2] |
2,895,024 | 2,895,025 | Android converted jar file into eclipse error | <p>i got an error when converted jar file into eclipse.</p>
<p>The error is "Error generating final archive: duplicate entry: classes.dex"</p>
<p>Anyone please help me?</p>
| android | [4] |
1,724,690 | 1,724,691 | Comparing two lists of names | <p>I am trying to create a short Windows Presentation Foundation in C# to compare two lists in different format and output the users that are common to them. <strong>Right now I am taking each list from the user through a textbox.</strong> Now I am a little confused on how I can compare the two different textboxes and output the common names. If the data was in an array of some sort I could of done <code>var name = string.Split('(')[0].Trim()</code> but since I decided to use textboxes I am unsure of how to proceed with this. </p>
<p>First List: </p>
<pre><code>Jacqueline Beaurivage (loh Da road);
Bon Van Daht (fary goal lim)
Bon Jobi (ting wei)
Ting Wan (dehtee road);
</code></pre>
<p>Second List:</p>
<pre><code>Jacqueline Beaurivage
Bon Van Daht
</code></pre>
<p>Expected output:</p>
<pre><code>Jacqueline Beaurivage
Bon Van Daht
</code></pre>
| c# | [0] |
3,146,672 | 3,146,673 | Change ExpandableList view programmaticly | <p>I have an ExpandaleList, and BaseExpandableListAdapter which I implements.</p>
<p>Now sometimes I need to show other xml content, So i am trying to do:</p>
<p>ExpandableList.this.setContentView(R.layout.errorscreen);</p>
<p>but then I get this exception:
ERROR/AndroidRuntime(23948): java.lang.RuntimeException, Your content must have a ExpandableListView whose id attribute is 'android.R.id.list'.</p>
<p>Now, I have been told to do this in order to fix it:</p>
<pre><code>add ExpandableListView to your xml layout and set it's id to list. Like so:
<ExpandableListView android:id="@id/android:list" android:layout_width="fill_parent"android:layout_height="fill_parent"/>
</code></pre>
<p>But I have no idea how to do it programmaticly, anyone could show me any example?</p>
<p>thanks,</p>
<p>ray.</p>
| android | [4] |
5,930,995 | 5,930,996 | Can we share session between ASP.NET 2.0 and ASP.NET 4.0 applications? | <p>Can we share session data between ASP.NET 2.0 and ASP.NET 4.0 applications? Is it possible if the types of the objects in the session are compatible?</p>
<p>I need to load an ASP.NET 4 application in Iframe on ASP.NET 2 application. The session data will be in a ASPNET Session Server or SQL server, or in AppFabric if it could be used in ASP.NET 2.0.</p>
| asp.net | [9] |
2,076,066 | 2,076,067 | How to gather code into one variable | <p>I need to be able to get all of this information (as text) into the variable $all so that I can use it later in my script. But when I echo $all later on it doesn't work. And don't anyone say anything about the use of font tags, I'm as depressed about it as you are.</p>
<pre><code> $all = <<< STOPTHISCRAZYTHING
echo "<br><br><textarea rows=\"30\" cols = \"100\">";
echo "<div align=\"center\"><font size=\"7\">I Have</font></div>";
foreach($same as $match)
{
echo "<img src=\"" . $match . "\">";
}
echo "<div align=\"center\"><font size=\"7\">I Need</font></div>";
foreach($different as $diff)
{
if(!in_array($diff, $reject))
{
echo "<img src=\"" . $diff . "\">";
}
}
echo "<div align=\"center\"><font size=\"7\">I Am Unable To Obtain</font></div>";
foreach($retired_different as $unabletoget)
{
echo "<img src=\"" . $unabletoget . "\">";
}
echo "</textarea>";
STOPTHISCRAZYTHING;
</code></pre>
| php | [2] |
5,103,467 | 5,103,468 | Silent Installation of "j2re-1_4_2_06-windows-i586-p.exe" on Vista Ultimate | <p><code>2re-1_4_2_06-windows-i586-p.exe</code> is not being silently install on Vista ultimate. I am using following command:</p>
<pre><code>j2re-1_4_2_06-windows-i586-p.exe /S /v"/qn ADDLOCAL=ALL IEXPLORER=0 MOZILLA=0"
</code></pre>
<p>That command work fine on XP and NT. Kindly tell me, how to make silent j2re on Vista Ultimate.</p>
| java | [1] |
3,423,121 | 3,423,122 | Would this work? Sending radio input data | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/9618504/get-radio-button-value-with-javascript">Get Radio Button Value with Javascript</a> </p>
</blockquote>
<p>I'm trying to post my input data. Most of it is in text boxes but one field is a radio button. I'm not sure the syntax is correct.</p>
<pre><code>var myProps = [];
var type = document.getElementByName().value;
function addProp(id) {
if type = "text" {
var value = encodeURIComponent(document.getElementById(id).value);
}
if type = "radio" {
var value = encodeURIComponent(valueRadioButtonList(id).value);
}
myProps.push(id + "=" + value);
}
addProp('child_name');
addProp('age');
addProp('hometown');
addProp('boy_girl');
addProp('first_name');
addProp('last_name');
addProp('email');
addProp('address1');
addProp('address2');
addProp('city');
addProp('state');
addProp('zip');
addProp('country');
xmlhttp.send(myProps.join("&"));
</code></pre>
| javascript | [3] |
6,000,474 | 6,000,475 | java interface problem | <pre><code>interface Block{
void printblock();
}
interface Block2{
void printblock();
}
class Impl2 implements Block,Block2{
@Override
public void printblock() {
// TODO Auto-generated method stub
System.out.println("Impl2");
}
}
public class Import
{
public static void main(String[] args) {
new Impl2().printblock();
}
}
</code></pre>
<p>Now please say me which printblock method is implementing by the class Import.Its implementing Block interface or Block2 interface?</p>
| java | [1] |
919,561 | 919,562 | Dijkstra's Algorithm team project not running because I named it Dijkstra(Project name)? | <p>Was working on a team project in C#, I called it Dijkstra's Algorithm, and when I was done writing my code down I went to debug using Visual Studio 2010 and I would keep getting an error like this:</p>
<p>!<a href="https://lh5.googleusercontent.com/-M8DCWHZMhig/UXYtd_9z3OI/AAAAAAAAAJQ/njtUVLTHxq4/w497-h373/Error.png" rel="nofollow">https://lh5.googleusercontent.com/-M8DCWHZMhig/UXYtd_9z3OI/AAAAAAAAAJQ/njtUVLTHxq4/w497-h373/Error.png</a></p>
<p>This kept happening more and more when I re-did the project under a similar name. Only when I took out the name Dijkstra would it properly run and debug.</p>
<p>Why is that?</p>
| c# | [0] |
505,602 | 505,603 | Change JavaScript NaN Message to Something Else | <p>I've got an <code>input[type="text"]</code> that throws up a NaN error until another box is filled. I know why the message is appearing, that's not a problem, it's correct. I'm just wondering if I can change 'NaN' to something more descriptive for the user.</p>
| javascript | [3] |
4,444,906 | 4,444,907 | android input problem | <p>I have an android problem which generates a pie chart. There are two files in my project, mainActivity and drawChart. In mainActivity I put all the variables and the algorithm in. In drawChart I put the onDraw function.
For now I want to generate some input areas. The problems are,
How should I generate the input? use XML or JAVA?
How should I pass the data we type in to the program?</p>
<p>Because I am a obsolutely beginner, so please teach me a little bit specifically.
Thank you very much.</p>
| android | [4] |
1,191,115 | 1,191,116 | Can I refer to a variable using a string? | <p>Say I have the following JS:</p>
<blockquote>
<pre><code>var foo_index = 123;
var bar_index = 456;
</code></pre>
</blockquote>
<p>And the following HTML:</p>
<blockquote>
<pre><code><div id="foo"></div>
<div id="bar"></div>
</code></pre>
</blockquote>
<p>Then I'd like to say this:</p>
<blockquote>
<pre><code>thisIndex = this.id + '_index'
</code></pre>
</blockquote>
<p>And I'd like <code>thisIndex</code> to be a number. How do I turn the string, which is exactly the variable name, into a variable?</p>
| javascript | [3] |
3,528,738 | 3,528,739 | unexpected result when extending abstract class | <p>I'm trying to print an error on purpose 'There is an error' but getting 'Success' message instead?</p>
<p>Any idea why?</p>
<p>Thanks</p>
<pre><code>abstract class Restful
{
public $error = array();
public function __construct()
{
//Doing something here
//....
//....
$this->validate_params();
}
public function validate_params()
{
$this->error[] = 'test error';
}
}
class RestfulRequest extends Restful
{
public function __construct()
{
if (count($this->error) > 0)
{
exit('There is an error');
}
echo 'Success';
}
}
new RestfulRequest();
</code></pre>
| php | [2] |
5,628,431 | 5,628,432 | using third party smtp | <p>I run a website that allows users to send email newsletters using their SMTP, not the host's SMTP. In that case the user can connect directly with his/smtp to send email. I am aware that some hosting companies do not allow this. Does anyone know the way around this? I need to move my website from the present host.</p>
| php | [2] |
5,098,880 | 5,098,881 | Stripping text from a string using a marker and php | <p>How can i strip out the code after the "-" (including the -) in this title using php?</p>
<pre><code>Buying a Home - Conveyancing Solicitors Dorset, Devon & Cornwall - LCS Legal Services
</code></pre>
| php | [2] |
1,563,410 | 1,563,411 | Modify Dictionary Value is possible.What is the right approach? | <p>I have dictionary that is populated and I have no control of.</p>
<p>I need to modify the value how can I do that?</p>
<p>I have put a noddy example together to explain the problem</p>
<pre><code>class Program
{
static void Main(string[] args)
{
Dictionary<Customer, int> CustomerOrderDictionary = new Dictionary<Customer, int>();
CustomerOrderDictionary.Add(new Customer { Id = 1, FullName = "Jo Bloogs" },3);
CustomerOrderDictionary.Add(new Customer { Id = 2, FullName = "Rob Smith" },5);
//now I decide to increase the quantity but cannot do the below as value has no setter
foreach (var pair in CustomerOrderDictionary)
{
if(pair.Key.Id==1)
{
pair.Value = 4;///ERROR HERE
}
}
}
}
public class Customer
{
public int Id { get; set; }
public string FullName { get; set; }
}
</code></pre>
<p>Any suggestions?
Thanks a lot</p>
| c# | [0] |
1,135,581 | 1,135,582 | sorting data in autocompletetextview | <p>The normal way how AutoCompleteTextView shows suggestions, is that it shows only strings that begin with the text the user entered, but the sort order of the results is undefined. Can I somehow sort them by myself? So that when user enters e.g. "g", I show him results beginning with "g" that are most relevant for him.</p>
| android | [4] |
465,463 | 465,464 | How to Disable data connection programmatically in android? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/11555366/enable-disable-data-connection-in-android-programmatically">Enable/disable data connection in android programmatically</a> </p>
</blockquote>
<p>Need a solution for disabling of mobile data connection programmatically in android to stop the internet connectivity .</p>
| android | [4] |
5,093,898 | 5,093,899 | Ratios with Datatable | <p>I have an application that I am making an have run into a place where I got stuck. My problem is this: how can I create a ratio with a datatable.</p>
<p>Ex:
My Table:
<hr></p>
<p>|gh | gh | tf | tf|
<hr></p>
<p>|tf | tf | tf | tf|
<hr></p>
<p>|gh | gh | tf | tf|
<hr></p>
<p>My output:</p>
<p>4 gh:8 tf</p>
<p>Anything could be in the table, so I was hoping to use Linq to determine the ratio .. but didnt know how to find out all the diffrent results in the table.</p>
| c# | [0] |
5,775,463 | 5,775,464 | pre-compile asp.net website | <p>we have a asp.net 2.0 website created in visual studio using asp.net website model. So, every time I need to deploy the website to the production server, I go to visual studio and right click on the website and select "publish website". I will check the first 2 options. "Allow this precompiled site to be updatable" and "use fixed naming assemblies". In the Target location, I specify the folder name in my local machine. Once it is published successfully, I copy the contents from the local folder to the website folder in iis. Does this mean that I am precompiling the website. After copying the website, I don't see instant response to the pages. Initially it takes some time to load as if it is compiling at that time. After that, If I go to the same page again, it is fast. So, I don't think I am doing precompile but I am not sure. </p>
<p>Please let me know.</p>
| asp.net | [9] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.