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 |
---|---|---|---|---|---|
817,695 | 817,696 | python bitwise operation | <p>hi i am new in python just started learning with python i got a task in which i need to store "1" byte of integer into different bits just like RGB the value are store in that can any one would write a small program for me and explain that ,please i need a help </p>
<p>Thankyou</p>
| python | [7] |
3,403,522 | 3,403,523 | Pointer to int array, passing and using it from another method | <p>I haven't cemented my learning of C++ arrays and have forgotten how to do this properly. I've done it with char array before but its not working as well for int array. </p>
<p>I declare a new blank int array:</p>
<pre><code>int myIntArray[10];
</code></pre>
<p>So this should be an array of nulls for the moment correct?</p>
<p>Then I assign a pointer to this array:</p>
<pre><code>int *pMyArray = myIntArray
</code></pre>
<p>Hopefully thats correct to there.</p>
<p>Then I pass this to another method elsewhere:</p>
<pre><code>anotherMethod(pMyArray)
</code></pre>
<p>where I want to assign this pointer to a local variable (this is where I'm really not sure):</p>
<pre><code>anotherMethod(int *pMyArray){
int myLocalArray[];
myLocalArray[0] = *pMyArray;
}
</code></pre>
<p>I'm not getting any compilation errors but I'm not sure this is right on a few fronts. Any and all help and advice appreciated with this.</p>
<p>Edit:</p>
<p>I should have said what I am trying to do.</p>
<p>Very simple really, I'd just like to modify a local array from another method. </p>
<p>So I have:</p>
<p>Method 1 would contain: </p>
<p>int myArray1[10] = {0};</p>
<p>Method 2 would be passed the pointer to myArray:</p>
<p>Then some code to modify the variables in the array myArray. </p>
| c++ | [6] |
3,991,930 | 3,991,931 | What MUST go inside onDestroy()? (if anything at all) | <p>Right so here I am obsessing over memory leaks, and quite frankly not understanding what could really lead to one (and yes I've read the usual links such as <a href="http://kohlerm.blogspot.co.uk/2009/02/memory-leaks-are-easy-to-find.html" rel="nofollow">http://kohlerm.blogspot.co.uk/2009/02/memory-leaks-are-easy-to-find.html</a>).</p>
<p>I've tried to create some on purpose, for example by leaving a PhoneStateListener subclass inside my activity and opened and closed it a bazillion time, can't see anything in DDMS heap or MAT out of the ordinary. Yet on SO I read over and over again that not only it needs to be deregistered onDestroy, but also onPause (http://stackoverflow.com/questions/4607344/phonestatelistener-isnt-finished)</p>
<p>Question: is there such a list?
Bonus question: is it true that a PhoneStateListener will create leaks unless it's deregistered onPause/onDestroy etc.</p>
<p><strong>UPDATE:</strong> I stand corrected. When re-spawning my app over and over again, even in singleinstance mode, the PhoneStateListener(s) it has registered are still alive after onDestroy was called, and start adding up. I'm currently working on an elegant way to kill them, and will post my results here.</p>
<p><strong>UPDATE2:</strong> The correct way to deregister the listener is:
instanceOfTelephonyManager.listen(phoneStateListener, PhoneStateListener.LISTEN_NONE);
... according to the API</p>
<p><strong>UPDATE3:</strong> As promised linking this to a better phrased question: <a href="http://stackoverflow.com/a/4607435/821423">http://stackoverflow.com/a/4607435/821423</a></p>
| android | [4] |
5,008,318 | 5,008,319 | How can I call a javascript function and pass into it a row's object? | <p>I have the following jQuery:</p>
<pre><code>$('#dataTable').on('click', 'tbody tr', clickHandler);
</code></pre>
<p>Here's the first few lines of my gridClickHander</p>
<pre><code>function gridClickHandler(event) {
$(oTable.fnSettings().aoData).each(function () {
$(this.nTr).removeClass('row_selected');
});
$(this).addClass('row_selected');
var rk = $(this).attr('data-rk');
var pk = $(this).attr('data-pk');
</code></pre>
<p>This code now works very well. </p>
<p>Next I would like to do the same thing as the click event on a row but by using javascript/jQuery code calling the gridClickHandler. For example on a row with an id="row_25". Is there a way I can do this? Sorry but again I am confused abut how to deal with the $(this).</p>
<p>Here's my code:</p>
<pre><code> if (obj.entity == "City") {
var html = obj.$form.find("#select-topic").html();
var indx = obj.$form.find("#select-topic").index()
$("#input_TempRowKey_" + obj.rownum).html(html);
$("#input_TempRowKey_" + obj.rownum).eq(indx).attr('selected', 'selected');
var title = obj.$form.find("#Title").val();
$("#input_Title_" + obj.rownum).val(title);
$("tr#row_" + obj.rownum).attr("data-rk", json.rowKey);
// here I need to do the same as though a user just clicked on rownum
}
</code></pre>
| jquery | [5] |
789,742 | 789,743 | can the ui design for old iphone be used on iphone4? | <p>I'm developing my software, all the ui is drawn based on 480x320 size screen, can my software run on iphone4 without any modification?</p>
| iphone | [8] |
1,691,924 | 1,691,925 | problem with encoding.utf8.getbytes in c# | <p>I am working on C#, trying below code</p>
<pre><code>byte[] buffer = new byte[str.Length];
buffer = Encoding.UTF8.GetBytes(str);
</code></pre>
<p>In str I've got lengthy data but I've got problem in getting complete encoded bytes.
Please tell me what's going wrong and how can I overcome this problem?</p>
| c# | [0] |
357,325 | 357,326 | Unsupported action error on click of email link | <p>I have given email link to TextView in xml, but as I am clicking on the TextView its showing unsupported action error, How can I put the active link on email in textview?</p>
<p>Here is my code of string.xml file:</p>
<pre><code> <resources>
<string name="emailLink"><a href="mailto:[email protected]">[email protected]</a></string>
<resources>
</code></pre>
<p>And mylayout.xml</p>
<pre><code> <TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textSize="15dp"
android:textColor="@color/text_color"
android:layout_marginTop="10dp"
android:id="@+id/text_email"
android:autoLink="email"
android:text="@string/emailLink"/>
</code></pre>
<p>I am running my app in android 2.2 and later versions.</p>
<p>Please help me...
Thanks</p>
| android | [4] |
3,595,749 | 3,595,750 | use variable with "new" when creating object | <p>I am designing a virtual aquarium. I have a class: Fish which I inherit to create classes of different species. The user can select the species in a combo box and click a button to put the fish in the tank. I use the following code to create the fish:</p>
<pre><code> switch(s){
case "Keegan" :
stock.add(new Keegan(this, x,y));
break;
case "GoldenBarb" :
stock.add(new GoldenBarb(this, x,y));
</code></pre>
<p>"stock" is a LinkedList and "s" is the String selected in the Jcombobox. As it stands I will have to create a long switch when I add a bunch of different species. I would like the code to look like:</p>
<pre><code>stock.add(new s(this,x,y));
</code></pre>
<p>and dispense with the switch such that all I have to do is create the class and add its name to the combo box and have it work. Is there a way to do so? Any help is appreciated.</p>
| java | [1] |
1,166,204 | 1,166,205 | How to break an functional-style iteration? | <p>I'm experimenting with functional-style Javascript and have encountered an interesting situation. I have a foreach function that takes a collection and function object:</p>
<pre><code>var Utils = {};
// Applies a functor to each item in a collection.
Utils.foreach = function(collection, functor)
{
for (var i = 0; i < collection.length; i++)
{
functor(collection[i]);
}
};
</code></pre>
<p>This is cool. However now I want to implement another function: </p>
<pre><code>// Checks if a collection contains an item.
Utils.has = function(collection, item)
{
Utils.foreach(collection, function(obj) {
if (item === obj) {
return true; // How to force a return from the foreach function?
}
});
return false;
};
</code></pre>
<p>As you can see I can't implement the "has" function because my return statement doesn't break the iteration.</p>
<p>Can someone recommend a solution for this problem?</p>
| javascript | [3] |
4,023,611 | 4,023,612 | run-time error and program crash | <p>How can I specify a separate function which will be called automatically at Run-Time error to prevent program crash?</p>
| c++ | [6] |
5,498,850 | 5,498,851 | What is the maximum storage limit for db that is specific to a single app? | <p>I need to know important limits in sqlite in the android. so my question is this:</p>
<p>What is the maximum storage limit for db that is specific to a single app?</p>
| android | [4] |
1,942,478 | 1,942,479 | Setting UINavigationbar properties in viewDidLoad does nothing | <p>I've tried setting the style of the UINavigationbar to be a translucent style in the viewDidLoad method of my controller. But nothing is changed. Why?</p>
<p>I set the property using the standard code like</p>
<pre><code>self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
</code></pre>
| iphone | [8] |
4,126,182 | 4,126,183 | Return None if Dictionary key is not available | <p>I need a way to get a dictionary value if its key exists, or simply return None, if it does not.</p>
<p>However, Python returns a key_error if you search for a key that does not exist. I know that I can check for the key, but I am looking for something more explicit. Is there a way to just return None if the key does not exist ?</p>
| python | [7] |
4,094,198 | 4,094,199 | Struggling with pagination implementation | <p>I've partially developed my pagination implementation, but I have an issue.</p>
<p>I want the pagination to look like this:</p>
<pre><code>Page 3 | Page 4 | Page 5
</code></pre>
<p>The middle link in the pagination is the currently selected page. If the page is 0 the currently selected page is the first link. If the page is not 0 the currently selected page is the second link. If the page is the last page the currently selected page is the 3rd link.</p>
<p>So far my implementation highlights the current page, but does not make the current page the center link. Also, when it gets to the last page, it adds 2 additional pages to the pagination that don't exist.</p>
<pre><code><?php for($i=0; $i <= $pages && $i < 3; $i++) : ?>
<li <?php echo ($page == $i + $page) ? 'class="current-page"' : '' ?>><a href="category.php?category=<?php echo $category->category ?>&page=<?php echo $page + $i ?>"><?php echo $page + $i ?></a></li>
<?php endfor; ?>
</code></pre>
<p>Any advice?</p>
| php | [2] |
4,380,438 | 4,380,439 | can different types of objects be put in one array? | <p>Here is the thing, I have several <code>std::map</code>s, like this:</p>
<pre><code>std::map<int, std::set> map_1;
std::map<int, std::string> map_2;
std::map<int, long> map_3;
...
</code></pre>
<p>And there are also several numbers, each of which relates to one map listed above, like</p>
<pre><code>1 -> map_2
2 -> map_1
3 -> map_3
...
</code></pre>
<p>What I'm trying to do is that, put all the maps into one array, then access each number's map
will be like accessing the element of that array, like this:</p>
<pre><code>arr = [map_2, map_1, map_3];
// let x be a number
map_x = arr[x];
do_something(map_x)
</code></pre>
<p>This way, I can relieve myself of writing <code>switch...case</code>, right?</p>
<p>But can I put them together and how?</p>
| c++ | [6] |
1,828,967 | 1,828,968 | Different page titles with one header file? | <p>How do you do multiple page titles with on header file? Theres one thing though. For the index page, i've got</p>
<pre><code>error_reporting(0);
if ($_GET["error"]=="404") {
include("forum/styles/art_air/web_template/overall_header.php");
include("include/404");
include("include/index");
include("forum/styles/art_air/web_template/overall_footer.php");
} else {
include("forum/styles/art_air/web_template/overall_header.php");
include("include/index");
include("forum/styles/art_air/web_template/overall_footer.php");
}
</code></pre>
<p>So i would have the header before anything else. So how would i manage to make so that</p>
<p><code>index?error=404</code> and index have different titles? Thanks in advance.</p>
| php | [2] |
1,534,677 | 1,534,678 | How to draw path on google map as I am moving? | <p>I am trying to draw path in google map. I am able to draw a path between start point and end point but I want to draw path as I am moving. Please help me to draw path as I am moving on google map.</p>
<p>Thanks
Monali</p>
| android | [4] |
4,581,068 | 4,581,069 | Java: Retrieve this for methods above in the stack | <p>How would you get a reference to an executing class several stack frames above the current one? For example, if you have:</p>
<pre><code>Class a {
foo() {
new b().bar();
}
}
Class b {
bar() {
...
}
}
</code></pre>
<p>
Is there a way to get the value that would be retrieved by using 'this' in foo() while the thread is executing bar()?</p>
| java | [1] |
3,332,322 | 3,332,323 | How can you get your code to wait for html() and append() functions to complete? | <p>I'm setting the html of the body element in an iframe to a string str, then I want to access that content on the next line (here just using an alert call to display the content) but the html and append functions haven't completed by the time the alert statement is called.</p>
<pre><code>$(function(){
....
$("#notes-tab span.add_draft").bind("click", function(e){
var str = '';
$(this).parent().siblings(".tab-content").children(".para").each(function(ind) {
str += $(this).find('div:first').html();
});
var curr = $("#content_rte").contents().find("body").html();
if (curr == ' ' || curr == '<br>') {
$("#content_rte").contents().find("body").html(str);
}
else {
$("#content_rte").contents().find("body").append(str);
}
alert($("#content_rte").contents().find("body").html());
});
});
</code></pre>
<p>And of course neither the html nor the append functions take callbacks. </p>
<p>Could someone tell me how one normally accomplishes waiting for the DOM to be changed before proceeding? </p>
| jquery | [5] |
2,853,420 | 2,853,421 | How to change password field to diplay asterisks instead of dots | <p>I am working on the task that requires the password field (i.e.the Edit Text) to hide user input using asterisks(*) rather than dots(.). Currently it shows as dots.
Kindly tell me the way to do it if its possible using android's native methods. Or please post the code to do it if anyone has already done that.</p>
<p>Thanks in advance..</p>
| android | [4] |
3,043,892 | 3,043,893 | Can the call log be closed programatically-android | <p>My app makes multiple calls programatically but to do that it needs to override / hide/ close the call log that is displayed at the end of one call. Is this possible? Can it be made to work using PhoneStateListener() type of functionalities ?</p>
| android | [4] |
1,350,552 | 1,350,553 | Python: Automating Emails | <p>Here is what I want to achieve :</p>
<p>1) An email should be sent to using <strong>"email address & details"</strong> mentioned in a Google docs/excel file.
2) The email should also pick up some content from a web page .i.e <strong>Title, URL</strong> etc. & include in the email sent. </p>
<p>Do let me know, how or where do I begin?</p>
| python | [7] |
1,200,718 | 1,200,719 | Initializing inflate state | <p>Initializing inflate state am getting continously this in logcat any one help to figure from where am getting this and how to prevent this?</p>
| android | [4] |
5,808,094 | 5,808,095 | How to change the Y axis on a Graidle chart | <p>I am using <a href="http://graidle.sourceforge.net/" rel="nofollow">Graidle</a> to drawn a line chart and have found that no matter what the series the Y axis always starts at zero, which makes little sense. I have looked at the documentation but cannot see any way to set what the axis should be.</p>
<p>Do anyone know how to achieve this with Graidle?</p>
| php | [2] |
1,009,548 | 1,009,549 | ImageView Drag/Select | <p>I'm using this code:</p>
<pre><code>public class Card extends ImageView
{
public Card (Context context) {
super (context);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
int eventaction = event.getAction();
int X = (int)event.getX();
int Y = (int)event.getY();
switch (eventaction ) {
case MotionEvent.ACTION_DOWN:
setAlpha(128);
break;
case MotionEvent.ACTION_MOVE:
setPosition(X, Y);
break;
case MotionEvent.ACTION_UP:
setAlpha(255);
break;
}
return true;
}
@Override
public void onDraw(Canvas canvas)
{
super.onDraw(canvas);
}
@Override
public void setImageResource(int resource) {
setImageBitmap(BitmapFactory.decodeResource(getResources(), resource));
layoutParams = new RelativeLayout.LayoutParams(image.getWidth(), image.getHeight());
setLayoutParams(layoutParams);
}
Bitmap image;
@Override
public void setImageBitmap(Bitmap bitmap)
{
image = bitmap;
super.setImageBitmap(image);
}
public RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(0, 0);
public void setPosition(int x, int y)
{
layoutParams.leftMargin = x;
layoutParams.topMargin = y;
setLayoutParams(layoutParams);
invalidate();
}
}
</code></pre>
<p>After some work i get image dragged, but now it make a strange flickering effect
Anyone can tell me why?</p>
| android | [4] |
1,731,080 | 1,731,081 | In JQuery is there way for slideDown() method to scroll the page down too? | <p>The slideDown applied to a div does the slideDown but doesn't scroll the page down and the div slided down div remains hidden from view. Is there a way to scroll the page down as well so the user can view the div?</p>
| jquery | [5] |
603,533 | 603,534 | Is it possible to customize UIImagePickerController? | <p>When using UIImagePickerController to browse a folder, I hope to customize UIImagePickerController as below</p>
<p>in thumbnails mode, place a customized subview (includes a Label and a button) under each thumbnail.</p>
<p>Is it possible?</p>
<p>If not, is there any other third party's free or comercial framework can do this?</p>
<p>Thanks</p>
<p>interdev</p>
| iphone | [8] |
4,487,904 | 4,487,905 | DRYout a class-based chainable API | <p>I have written a chainable API (in a similar style to jQuery) as follows:</p>
<pre><code>class ChainableAPI:
def show(self):
self.visibility = 1
return self
def goBlue(self):
self.color = 'Blue'
return self
def die(self):
self.life = 0
return self
chainableAPI = ChainableAPI()
(chainableAPI
.goBlue()
.show()
.die()
.goBlue())
</code></pre>
<p>Notice how each method of <code>ChainableAPI</code> ends with <code>return self</code>. Is there a way to have all methods to <code>return self</code> automatically? That way I do not have to specify <code>return self</code> manually for each method.</p>
| python | [7] |
4,216,972 | 4,216,973 | adding img in js | <p>I'm using javascript to create an image element like so:</p>
<pre><code>var img = document.createElement('img');
</code></pre>
<p>What would I do to give this img a width of 100%?</p>
| javascript | [3] |
188,933 | 188,934 | How to reload the listView on click of a button in android? | <p>I have created a view in which i have 1 list view and 2 buttons. The first button is for deleting the selected list view and the 2nd button is for deleting the deleted the entire data from the table. I want that if I delete the entire data from the table the list view should get refreshed an it should get reloaded. Please help me out in achieving this.Thanks in advance.</p>
| android | [4] |
1,132,319 | 1,132,320 | Unique, short filenames for pictures | <p>What would be the best way to rename my user uploaded images to fairly short, yet unique names?</p>
<pre><code>uniqid() ?
</code></pre>
| php | [2] |
4,854,486 | 4,854,487 | Deleting records selected by Checkbox | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/5752105/delete-values-selected-using-checkbox">Delete values selected using checkbox</a> </p>
</blockquote>
<p>I want to delete records that has been selected using Checkbox</p>
<p>Checkbox code</p>
<pre><code><input name="checkbox[]" type="checkbox" value="<?=$row[s_id]?>" id="checkbox[]">
</code></pre>
<p>ON delete button</p>
<pre><code>if($_POST['delete'])
{
$cnt=array();
//$cnt=array_count_values($_POST[checkbox]);
$cnt=count($_POST['checkbox']);
for($i=0; $i < $cnt; $i++)
{
$del_id=$checkbox[$i];
//$sql = "DELETE FROM t_s_list WHERE `s_id`='".mysql_real_escape_string($del_id)."'";
$sql = "DELETE * FROM t_s_list WHERE `s_id`= '$del_id'";
$result = mysql_query($sql);
mysql_error();
$NEW="Selected records Deleted";
}
$NEW="Selected records not Deleted";
}
</code></pre>
| php | [2] |
3,452,576 | 3,452,577 | Help with layouting game scores in android | <p>I am still trying to understand now android layouts work. I am developing an application for displaying soccers results for a brazilian championship. I will have a list view for displaying the last game scores, like the image in the url below (extracted from an iphone aplication).</p>
<p><a href="http://grem.io/images/score.jpg" rel="nofollow">http://grem.io/images/score.jpg</a></p>
<p>I cant see how i can do this. I also need to say that i am a trully beginner on this.</p>
<p>Thanks
T</p>
| android | [4] |
4,512,817 | 4,512,818 | Iterating over pattern | <p>Suppose you're dealing with data organized in the following format:</p>
<pre><code>[123]="some string" [234]=999999999 [345]="some other string"
</code></pre>
<p>In Java, what would be the easiest way to split each by KV combination, where K is the tag (enclosed in <code>[ ]</code>).</p>
<p>Is there a Utils (Apache or other?) method you know off that lets you define a structure as shown above to help with iterating over it, instead of having to manually count and read data past and between <code>[ ]</code>?</p>
<p>What do we know?</p>
<ul>
<li>Each element will have a tag</li>
<li>Each tag will be surrounded by <code>[ ]</code></li>
<li>Tag and value assigned to the tag will be separated by <code>=</code></li>
<li>Value will be there. No empty values allowed.</li>
<li>Value may or may not be surrounded by quotes</li>
</ul>
| java | [1] |
3,688,854 | 3,688,855 | How to set focus on button if clicked and buttons are made in xml | <p>I have created 3 buttons and i want to change focus of that button which is clicked by user
using coding is there any way ?</p>
<p>i have seen these links</p>
<p><strong><a href="http://stackoverflow.com/questions/9750097/how-can-a-button-get-the-focus">link1</a></strong></p>
<p><strong><a href="http://stackoverflow.com/questions/4680065/android-set-clicked-focus-on-button">link2</a></strong></p>
<p>but what i want to know that when i made instances of these 3 buttons i only want focus which is clicked at that time and i want to change focuscolor on click defined by me using coding?
Can anybody tell me?</p>
| android | [4] |
189,098 | 189,099 | JavaScript Regex question | <p>All,</p>
<p>I have following function to check for invalid symbols entered in a text box and return true or false. How can I modify this function to also check for occurrences like http:// and https:// and ftp:// return false if encountered ?</p>
<pre><code>function checkURL(textboxval) {
return ! (/[<>()#'"]|""/.test(textboxval));
}
</code></pre>
<p>Thanks</p>
| javascript | [3] |
4,093,636 | 4,093,637 | How does php execute a function assigned to variable? | <p>Ok, I didn't really know how to even phrase the question, but let me explain.</p>
<p>Suppose I have a variable:</p>
<pre><code>$file = dirname(__FILE__);
</code></pre>
<p>What happens if I assign <code>$file</code> to another variable?</p>
<pre><code>$anotherVariable = $file;
</code></pre>
<p>Does the <code>dirname</code> function get executed each time I assign?</p>
<p>Thanks for any help.</p>
| php | [2] |
5,903,347 | 5,903,348 | Generating an ascending list of numbers of arbitrary length in python | <p>I've been looking at how to do this for a bit and there has to be a fast way, is there a function i can call that returns a list of ascending numbers? ie. function(10) would return [0,1,2,3,4,5,6,7,8,9]? Its probably something I'm overlooking.</p>
| python | [7] |
2,732,067 | 2,732,068 | My Sales Order in C# not working properly | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4378196/qty-control-in-c">Qty Control in C#</a> </p>
</blockquote>
<p>I hope the mods don't mind reposting this again. The code below does not work the way it should. When the end user clicks the btQty button the quantity goes to -2. When it should be going by down by one (as sales are made). Here is the code and thanks in advance..</p>
<pre><code> cs.Open();
int ret;
string Query = "SELECT QTY from tblStock WHERE ID=1";
SqlCommand cmd = new SqlCommand(Query, cs);
string str = Convert.ToString(cmd.ExecuteScalar());
if (str != "")
{
ret = Convert.ToInt32(cmd);
}
else
{
ret = -1;
}
if (ret == 0)
{
lbqty.Text = "Not enough stocks.";
dgUpdate();
}
else
{
cmd.CommandText = "UPDATE tblContacts SET QTY = QTY-1 WHERE ID=1";
cmd.ExecuteNonQuery();
if (ret == 1)
{
lbqty.Text = "Re-order. Remaining stocks: 1";
dgUpdate();
}
else
{
txtQty.Text = "Remaining stocks: " + (ret - 1).ToString();
lbqty.Text = "Remaining stocks: " + (ret - 1).ToString();
dgUpdate();
}
}
cs.Close();
</code></pre>
| c# | [0] |
5,932,549 | 5,932,550 | Adding classes to Zend_gateway.php | <pre><code><?php
error_reporting(E_ALL | E_STRICT); //error reporting, not needed
require_once "Zend/Amf/Server.php"; //the zendAMF server
require_once "process.php"; //our test class
$server = new Zend_Amf_Server(); //declare the server
$server->setClass("process"); //load our test-class to the server
?>
</code></pre>
<p>If i try to add another class, its not accepting... i am using the same procedure as above.</p>
| php | [2] |
3,190,418 | 3,190,419 | C# Support for Simultaneous and Editable Languages | <p>I'm currently developing an application that needs the hability to simultaneously show messages in 2 different languages.
(Eg:. User salutation would result in the following message to appear at the display:
"Welcome to my app"
"Bienvenue sur mon application")</p>
<p>Disregarding character encoding issues, what are your suggestions regarding implementation of this feature?</p>
<p>I am thinking about putting all the messages in a database and select the 2 different versions of the message for the available languages.</p>
<p>One more caveat. Messages can be changed by user.</p>
| c# | [0] |
5,679,595 | 5,679,596 | Is HttpContext.Current Ever Null in a Web Application? | <p>Is HttpContext.Current ever null in a web Application (assuming threads are not being used)? More specifically, would it ever be null in <code>void Application_OnError(object sender, EventArgs e)</code>?</p>
| asp.net | [9] |
5,705,221 | 5,705,222 | Prime divisors of a number in C++ | <p>This is my first question on Stackoverflow, so please excuse me if I'm doing something wrong. :) Can you help me with this code? Thank you! :)</p>
<pre><code>#include <iostream>
using namespace std;
</code></pre>
<p>1)</p>
<pre><code>int divisor(int a) // function that checks the divisors of a number *)
{
int i=1; // counter
while(i<=a) // while the counter is less than the number given
{
int i;
if(primes(i)) // here i get the error "primes was not declared in this scope
{
if(a%i==0) // if the remainder of the operation is 0, the number is a divisor
{
cout<<"The divisors of the number are: "<<i<<endl; // prints the divisors
++i; // counter is incremented
}
}
else // else it is not, and the counter i is incremented
{
++i;
}
}
}
</code></pre>
<p>2)</p>
<pre><code>int primes(int number) // checks if a number is prime
{
int i;
for(i=2;i<number;i++) // for loop until the counter i is less than a number
{
if(number%i==0) // if the remainder of the operation is 0, the number is not prime
{
break;
}
else //else the number is prime
cout<<number;
break;
}
}
}
</code></pre>
<p>3)</p>
<pre><code>int main()
{
int n,i;
cout<<"Give the number: ";
cin>>n;
for(i=2;i<n;i++)
{
divisor(n);
}
}
</code></pre>
| c++ | [6] |
5,436,415 | 5,436,416 | prompt in spinner with drop down feature | <p>i have a spinner and i want the spinner to prompt as select class. as we have android:hint property for edit text in android. i dont want the spinner with the dialog box. i want the spinner prompting or hinting before the seletion is made in drop down. is it possible??
please help!!!!
thank you</p>
<p><img src="http://i.stack.imgur.com/kIOo1.png" alt="enter image description here"></p>
<p>i have tried the below code but dint work</p>
<pre><code>classname[0] = "SELECT CLASS";
for (int i = 1; i < classdetails.size() + 1; i++) {
classname[i] = classdetails.get(i - 1).getClass_name() + " "
+ classdetails.get(i - 1).getSection_name().toString();
}
ArrayAdapter<CharSequence> adapterClasses = new ArrayAdapter<CharSequence>(
getApplicationContext(), R.layout.spinner_item_class,
R.id.spinnerclasstxt, classname);
spnrClass.setAdapter(adapterClasses);
spnrClass.setSelection(0);
spnrClass
.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1,
int pos, long arg3) {
int selectedindex = pos;
if (selectedindex == 0) {
spnrSubject.setVisibility(View.INVISIBLE);
} else {
spnrSubject.setVisibility(View.VISIBLE);
selectedClass = classdetails.get(selectedindex - 1);
subjectpopulate(selectedClass);
}
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
}
});
</code></pre>
| android | [4] |
800,397 | 800,398 | Two Ajax timer cannot tick simultaneously? | <p>I have two ajax time for my aspx web page but while the one is ticking , the other stops running. How can i make it both timer run together like the windows form?</p>
| asp.net | [9] |
3,541,834 | 3,541,835 | how to identify the dynamically created UIImageView by tag | <pre><code> if([imageview superview])
{
[imageview removeFromSuperview];
[myView addSubview:imageview];
}
else if([imageview superview])
{
[imageview removeFromSuperview];
[myView addSubview:imageview];
}
else if([imageview superview])
{
[imageview removeFromSuperview];
[myView addSubview:imageview];}
</code></pre>
<p>Here i dynamically create multiple imageviews and set tag values and add it as a subview to the UIView...I need to identify which imageview is in superview position and remove it and add another by tapping it...pls urgent help pls</p>
| iphone | [8] |
1,566,131 | 1,566,132 | parse JSON response for javascript | <p>How to parse the following JSON Array using javascript??</p>
| javascript | [3] |
2,974,559 | 2,974,560 | Release NSObject and stop all method calling | <p>So my menu calls a game with this piece of code:</p>
<pre><code>game = [[Game alloc] init];
[self presentModalViewController:memoryTest animated:FALSE];
</code></pre>
<p>A UIViewController then appears with a countdown. The player can go back to the menu DURING the countdown. However when I try this, the countdown keeps running and eventually the game starts, even thought the UIViewController has been dismissed (therefore the UIView has disappeared) in the backToMenu method.</p>
<pre><code>[self.parentViewController dismissModalViewControllerAnimated:FALSE];
</code></pre>
<p>I've tried to release the game object in the viewDidAppear method of the menu, but no luck. I thought of having a "quit" BOOL value, so the countdown can check wether or not the player has quit the game, but there must be a better way to release an object AND stop all method calls inside it.</p>
<p>Thanks for helping me out.</p>
<p>CountDown method:</p>
<pre><code>- (void)countDown {
SoundEffect *sound = [[SoundEffect alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"tick" ofType: @"wav"]];
[sound playAndRelease];
if(self.countDownStep > 0) {
feedback.image = [UIImage imageNamed:[NSString stringWithFormat:@"countdown%d.png",self.countDownStep]];
feedback.hidden = FALSE;
[self performSelector:@selector(countDown) withObject:nil afterDelay:0.8];
}
else {
[self displayMessage:self.startMessage];
[self.game performSelector:@selector(start) withObject:nil afterDelay:0.8];
[self performSelector:@selector(hide) withObject:nil afterDelay:0.8];
}
self.countDownStep--;
}
</code></pre>
| iphone | [8] |
3,104,010 | 3,104,011 | How to detect when device has resumed from sleep mode | <p>Is there a way to detect when the android system has resumed from sleep mode, but has not turned on the screen? My service does not need to acquire any wake locks, but does need to know when the device has been woken up by another process.</p>
| android | [4] |
1,969,141 | 1,969,142 | Function not repeating On Click? | <p>I'm trying to make a small Android game. My on click function however is not getting repeated... It adds one point the first time and then stops working. It looks correct to me.</p>
<pre><code>addButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
playerScoreField = (TextView)findViewById(R.id.playerScore);
int playerScore = 0;
if(playerScore != target){
playerScore++;
playerScoreField.setText("You are at: " + playerScore);
} else {
addButton.setClickable(false);
addButton.setEnabled(false);
countDown.onFinish();
}
}
});
</code></pre>
| android | [4] |
1,583,975 | 1,583,976 | hashtable values reordered | <p>I have a hashtable, which contains strings for example, when I use put method as below </p>
<pre><code> hashtable.put("1","A");
hashtable.put("1","B");
hashtable.put("1","C");
hashtable.put("1","D");
hashtable.put("1","E");
</code></pre>
<p>Then when I try to print it back it doesn't print in same order, Any one knows why would something like this happen?</p>
<pre><code> Collection c = ht.values();
Iterator itr = c.iterator();
while(itr.hasNext())
System.out.println(itr.next());
</code></pre>
<p>Thanks
Max</p>
| java | [1] |
2,960,737 | 2,960,738 | c# windows form program starts slow at first time | <p>I made a little windows form using .net2.0, but when first start exe file, the windows form shows up in about 10 seconds late, why is there always delay??</p>
<p>does anyone know that? </p>
| c# | [0] |
1,642,659 | 1,642,660 | concatenating tuple | <p>suppose i have a list </p>
<pre><code>a=[1,2,3,4,5]
</code></pre>
<p>now i want to convert this int a tuple<br>
i thought coding something like this will do </p>
<pre><code>state=()
for i in a:
state=state+i
</code></pre>
<p>and it gave error(well its quite obvious) i am trying to concatinate int with tuple</p>
<p>but tuples doesn't have any functions like insert or append like lists..<br>
so how through looping i can add elements.. same thing with dictionary i feel as if i have a missing link</p>
| python | [7] |
3,657,591 | 3,657,592 | javascript click event queue | <p>I made a simple gallery where when you click on a image thumb nail, it will show the larger image with fade in fade out effect with jquery.</p>
<pre><code>$('#thumnail').click(function(){
$('#piccontainer').fadeOut(function(){
$('#piccontainer').html('<div> <img src="' + imgsource + '" /> </div>');
});
$('#piccontainer').fadeIn();
});
</code></pre>
<p>but if i click on a 5 different thumbnails quickly, the large image will fade in fade out for all 5 images. How can I disable so that lets say i clicked on 5 thumbnails <strong>very quickly</strong>, it should only fadein the last 5th one. <strong>basicaly how can i stop the queue of the click events?</strong></p>
<p>thanks for the help.</p>
| javascript | [3] |
1,902,060 | 1,902,061 | How to add files recursively to a listbox by selecting a dir in C# | <p>I'm trying to add a list of files to a listbox which follows all sub-directories </p>
<p>Currently I am using the following code however it only searches one directory and does not recurse into subdirectories. </p>
<pre><code> FolderBrowserDialog odd = new FolderBrowserDialog();
private void button2_Click(object sender, EventArgs e)
{
if (odd.ShowDialog() == DialogResult.OK)
{
string folderName = odd.SelectedPath;
foreach (string f in Directory.GetFiles(folderName))
checkedListBox1.Items.Add(f);
}
}
</code></pre>
<p>Now I modified to this, but says string f doesn't exist in the current code</p>
<pre><code>foreach (string f in Directory.GetFiles(folderName, "*.*", SearchOption.AllDirectories));
checkedListBox1.Items.Add(f);
</code></pre>
| c# | [0] |
2,693,752 | 2,693,753 | how to remove dynamically inflated views? | <p>In a simple card game that i want to develop, I have three buttons: button1,button2 and button3. button1 creates two imageviews in a tablerow and displays the image. When button2 and/or button3 is clicked, it dynamically adds imageview on the tablerow through layout inflater. When game is over, I want user to click button1 and start things all over again. I am able to do that but the problem is, the imageviews that were previously displayed by clicking button2 and button3 also displays. I want them to be removed when button1 is clicked. How can I remove them on click of button1?
Please help me!</p>
| android | [4] |
1,599,943 | 1,599,944 | Android SSLPeerUnVerfiedException | <p>am working https webservice and the certificate is self signed, so import this into my project and create bks file for overriding the error , but still i get SSLPeerUnverfiedException . I had also check with following so question <a href="http://stackoverflow.com/questions/2308774/httpget-with-https-sslpeerunverifiedexception">HttpGet with HTTPS : SSLPeerUnverifiedException</a> ,this also not help me</p>
| android | [4] |
4,563,145 | 4,563,146 | I need to flip a div on hover | <p>I am using <a href="http://lab.smashup.it/flip" rel="nofollow">flip</a> plugin of jquery. I would like to flip a card(div), after it finished to flip, immediately to revertFlip it. That's what I tried</p>
<pre><code> $("#flipbox").bind("hover",function(){
$(this).flip({
direction:'tb',
onEnd: function() {
$(this).revertFlip();
console.log('when the animation has already ended');
}
})
}
</code></pre>
| jquery | [5] |
3,444,116 | 3,444,117 | Cannot change EditText in onCreateView | <p>I want to reset my textinput everytime my fragment gets invoked.</p>
<p>This is the end of my onCreateView-method:</p>
<pre><code> txtValue.setText("");
Log.d("debug", "Hello");
txtValue.addTextChangedListener(tx);
tx.onTextChanged(txtValue.getText(), 0, 0, 0);
InputMethodManager mgr = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.toggleSoftInput(0, 0);
</code></pre>
<p>I get Hello everytime but the text never changes.</p>
| android | [4] |
1,680,157 | 1,680,158 | Help with getParent() downcast | <p>I'm learning android/java and have this example code I can't get to work:</p>
<pre><code>OnRatingBarChangeListener l = new OnRatingBarChangeListener() {
public void onRatingChanged(RatingBar ratingBar, float rating,
boolean fromTouch) {
Integer myPos=(Integer)ratingBar.getTag();
RowModel model=getModel(myPos);
model.rating = rating;
LinearLayout p=(LinearLayout)ratingBar.getParent();
TextView l=(TextView)p.findViewById(R.id.label);
l.setText(model.toString());
}
};
</code></pre>
<p>Everything works except the LinearLayout / getParent() downcast. At runtime it creates a ClassCastException. If I comment out that block of code then everthing works fine. What am I missing?</p>
| android | [4] |
4,917,328 | 4,917,329 | Using PHP Tags in eval() | <p>I have a textarea where you can write PHP & HTML (or technically
anything else). You can preview your Code in the browser by submitting
the form and what I wanna do is <code>eval()</code> the code (and thereby display)
it. Now eval doesn't seem to accept PHP-Tags (<code><?php ?></code>) in the
given string. I've read many posts that suggest calling eval like </p>
<pre><code>eval(' ?>'.$_POST['markup']);
</code></pre>
<p>But that my have worked once, but it doesn't work anymore. I get a
Syntax error for the lines where there's a PHP opening / closing tag. </p>
<p>Is there still a way to <code>eval()</code> strings that contain PHP opening and closing tags? </p>
| php | [2] |
1,843,911 | 1,843,912 | Android:How to custom the specific Seekbar like this? | <p>pic: </p>
<p><img src="http://i.stack.imgur.com/uPZfG.jpg" alt="enter image description here"></p>
<p>How should I do to custom the specific seekbar like the pic?</p>
<p>I think the point is:</p>
<ol>
<li><p>When finger is moving on the seekbar, how to present a suspended view showing the progress.</p></li>
<li><p>There are some views which layer is same level to parent view of seekbar, these views are near the seekbar, would these views overlap the suspended view?</p></li>
</ol>
| android | [4] |
5,110,372 | 5,110,373 | Why do I get 3 values inserted into my C# combo box instead of just 1? | <p>When reading the registry for file names I get 3 entries loading into my combo box for every 1 registry entry. If I have 1 file listed in the registry I would see :</p>
<p>Combo box values:</p>
<p>c:\file1.txt</p>
<p><-----Blank here</p>
<p>c:\file1.txt</p>
<p>I have found the problem lies in this code, it hits 'if (previousFiles != null)' 3 times. How should I correct this?</p>
<pre><code>for (int i = 0; i <= 5; i++)
{
Object previousFiles = OurKey.GetValue("Files" + i);
if (previousFiles != null)
{
comboBox1.Items.Add(previousFiles.ToString());
}
}
</code></pre>
<p>Many thanks
Monday morning blues!</p>
| c# | [0] |
1,589,790 | 1,589,791 | How can you make a review copy of an Android app? | <p>I've been asked for some review copies of an Android app I've written, which is great, but I'm not willing to give out the full app to just anyone. I want to make a time-limited version (which works for about two weeks, then gives up the ghost).</p>
<p>What is the easiest way to do this? I haven't tested this myself, but I think that in theory if one built the app using a keystore which expires in two weeks might work. Is that correct, or do I have to put a line of code in the app which shuts it down if you attempt to boot it after a set date?</p>
| android | [4] |
1,863,379 | 1,863,380 | A pointer greater than zero in c++, what does mean? | <p>I encountered a problem in c++. I read some codes,but there was a very wired usage of pointer. The code is following:</p>
<pre><code> double* marginalProbability =
new double [10 * sizeof(marginalProbability[0])];
memset( marginalProbability, 0, 10 * sizeof(double) );
//................
//.................
if(marginalProbability>0)
printf("larger");
else
printf("smaller");
</code></pre>
<p>The question I'm asking is what does it mean that <code>if(marginalProbability>0)</code>. It is a pointer greater than zero. I think that in a normal compiler, there are no addresses which will be equal to zero. Or are there any other meanings of that? Otherwise, this line seems meaningless. Thanks.</p>
| c++ | [6] |
1,446,554 | 1,446,555 | Not able to run a batch file from a java program | <p>I want to run a batch file from a Java program.</p>
<p>This works:</p>
<pre><code>runtime.getruntime().exec("cmd /c C:\\test.bat"); //Working
</code></pre>
<p>It is working very well, but if I give spaces in the path of the batch file, it is not working:</p>
<pre><code>runtime.getruntime().exec("cmd /c C:\\Program Files\\test.bat"); //Not Working
</code></pre>
<p>Can any one help me on this.</p>
| java | [1] |
4,991,893 | 4,991,894 | If constructor is a method, that doesnt return anything why is there no return type as void? C# | <p>In C#, if consturctors are basucally methods that dont return anything, why dont they have a return type as void? since void is a return type that denotes the same that nothing is returned.</p>
| c# | [0] |
2,185,281 | 2,185,282 | Difference between declaration of function with extern and without it | <p>There is such code:</p>
<pre><code>#include <iostream>
extern void fun();
int main(){
fun();
return 0;
}
void fun(){ std::cout << "Hello" << std::endl; }
</code></pre>
<p>Is there some difference between declarations:</p>
<pre><code>extern void fun();
void fun();
</code></pre>
<p>? Code above behaves the same with extern and without extern keyword.</p>
| c++ | [6] |
1,074,732 | 1,074,733 | Jquery: calculate value on blur event | <p>I am trying to do some live calculation on my form, please have a look at form...</p>
<pre><code><input type="text" value="0" name="product1" class="num"/>
<input type="text" value="0" name="product2" class="num" />
<input type="text" value="0" name="product3" class="num"/>
<input type="text" value="0" name="cost" class="cost"/>
</code></pre>
<p>And jquery code...</p>
<pre><code>$(function() {
var cost = 0;
$('.num').blur(function(){
cost+= parseFloat($(this).val());
});
$('.cost').val(cost);
});
</code></pre>
<p>But its not working, please help thanks.</p>
| jquery | [5] |
5,453,743 | 5,453,744 | How can i get this kind of window? | <p>In eclipse you can detach tabs and they will displayed in a special kind of window.</p>
<p>Win7 with aero displays it as follows</p>
<p><img src="http://www.oliholz.de/data/1.jpg"/><br></p>
<p>How can i produce this frame? i have tried many styles of JFrame,JWindow,JDialog, ...</p>
| java | [1] |
4,306,433 | 4,306,434 | How to check if given timestamp is 10 minutes old? | <p>I have a variable <code>$t1</code> which has a timestamp in the form <code>2013/04/08T09:00:00Z</code>.</p>
<p>How can I compare this with the current time to check if it is 10 minutes old?</p>
| php | [2] |
1,553,318 | 1,553,319 | query about pdf file | <p>hi
How can i append 2nd page of a pdf file to the first page.
in my case the page is getting overwritten..plz reply soon</p>
| java | [1] |
1,432,581 | 1,432,582 | Uncommon shape buttons in ASP.NET | <p><strong>My example image</strong> : <a href="http://imageshack.us/photo/my-images/824/myimager.jpg/" rel="nofollow">http://imageshack.us/photo/my-images/824/myimager.jpg/</a></p>
<p>Hi all,
i am trying to create a web page which include a part like this image.In image every color area is a button and i will create them dynamicly.
So first problem:
How can i create a button like these and give them a click event.(These buttons not square so how i can make every area clickable)
Second problem:
How can i write something in buttons like in image.</p>
<p>Is there a method which can help me in ASP.NET?
thanks. </p>
| asp.net | [9] |
3,260,051 | 3,260,052 | Define jQuery "eq" | <p>I am having a difficult time wrapping my head around the <a href="http://docs.jquery.com/Core/eq" rel="nofollow">jQuery eq</a>. Can someone explain its use to me? What and how does it index?</p>
<p>thanks.</p>
| jquery | [5] |
26,042 | 26,043 | Get the next character after a certain characters position | <p>I am currently trying to read in a log file that consists of [content]. The message in between the brackets might not necessarily be the same length. </p>
<p>I know that the content will start from character position 28 but I then need a way of doing a substring to only get the content upto the next ]. I.e. if I do a substring it will show content. </p>
<p>I have tried <code>line.Substring(28, line.IndexOf(']'));</code> but this doesn't seem to get the next ] after position 28, instead gets the first ] at the beginning of the line. </p>
<p>Thanks for any help you can provide. </p>
| c# | [0] |
137,684 | 137,685 | Open resource XML as String or InputString to give it to Xml.parse(...) | <p>I'm working in a little app that needs to parse an XML file. The "parsing part" it's working great, everything goes fine... </p>
<p>But I'm having a little problem, I don't know how to open the resource that is under (res/xml/file.xml) to the Xml.parse(STRING, root.getContentHandler()); or Xml.parse (INPUTSTREAM...)...</p>
<p>The question is that I don't know how to get an InpuntStream or String from a xml file that is in the res folder... any idea?? I've googled it but all the examples in the web are from a web xml that is downloaded using http, but none of them show how to parse a file from the resources!!</p>
<p>Thanks in advance!!</p>
| android | [4] |
5,667,749 | 5,667,750 | how to convert pdf to image in android ? using pdfbox getting error to import java.awt and javax | <p>how to convert pdf to image in android ? using pdfbox getting error to <code>import java.awt</code> and <code>javax</code></p>
<pre><code>imageType = BufferedImage.TYPE_INT_ARGB; //need to specifies java.awt
String[] formats = ImageIO.getReaderFormatNames(); //need to specifies javax
</code></pre>
| android | [4] |
142,080 | 142,081 | tracking user logins per day | <p>hey guys i'm running a script on my site:
as a user logs into my website i write this days date into a text file so i can know at witch days the user was active on my website.
the thing is, if a user lets say didn't log out from the site for 2 days or more how can i check if he was on the site on those days? can some one give me a good suggestion?</p>
<p>here is the code i'm running as part of my login, just before i register the session: (by the way ill be glad to hear if there's a better way to do it?) </p>
<pre><code> $log_file_name = "logfile.txt";
$log_file_path = "log_files/$id/$log_file_name";
if(file_exists($log_file_path)){
$not = "";
$todaydate = date('d,m,Y');
$today = "$todaydate;";
$strlength = strlen($today);
$file_contents = file_get_contents($log_file_path);
$file_contents_arry = explode(";",$file_contents);
if(!in_array($todaydate,$file_contents_arry)){
$append = fopen($log_file_path, 'a');
$write = fwrite($append,$today); //writes our string to our file.
$close = fclose($append); //closes our file
}
else if(in_array($todaytodaydate,$file_contents_arry)){}
}
else{
mkdir("log_files/$id", 0700);
$todaydate = date('d,m,Y');
$today = "$todaydate;";
$strlength = strlen($today);
$create = fopen($log_file_path, "w");
$write = fwrite($create, $today, $strlength); //writes our string to our file.
$close = fclose($create); //closes our file
}
</code></pre>
| php | [2] |
386,602 | 386,603 | convert time to minute and second | <p>can anyway help me to generate a function in jquery that convert time() to seconds</p>
<p>example: 1336333809 = 9 minutes and 23 seconds?</p>
<p>like this function i found but whew it's seconds to hour</p>
<pre><code>function secondsToTime(secs)
{
var hours = Math.floor(secs / (60 * 60));
var divisor_for_minutes = secs % (60 * 60);
var minutes = Math.floor(divisor_for_minutes / 60);
var divisor_for_seconds = divisor_for_minutes % 60;
var seconds = Math.ceil(divisor_for_seconds);
var obj = {
"h": hours,
"m": minutes,
"s": seconds
};
return obj;
}
</code></pre>
<p>if anyway has a solution please share :D </p>
| javascript | [3] |
4,078,892 | 4,078,893 | Save web pages in mht with java | <p>I need a java class to download web pages in mht.
I will integrate this in my software.
I am looking for something like this (see links), but this two in particular give me some problems:</p>
<p><a href="http://www.uplook.cn/blog/6/62956/" rel="nofollow">http://www.uplook.cn/blog/6/62956/</a></p>
<p><a href="http://www.example-code.com/java/mht_saveWebPage.asp" rel="nofollow">http://www.example-code.com/java/mht_saveWebPage.asp</a></p>
| java | [1] |
1,461,881 | 1,461,882 | Fading all images with Jquery | <p>I am trying to fade out all my images within a table with Jquery.</p>
<p>The following seems not to work.Maybe a syntax error?</p>
<pre><code>$(function() {
$('#myTable img').each(function(index) {
$(this).fadeOut('slow', function() {
// Animation complete.
});
});
});
</code></pre>
| jquery | [5] |
4,935,422 | 4,935,423 | How do I redirect to different pages from a drop down list in php? | <p>When users come to my home page I want them to select which page they want to go to. So, for instance sports, trivia, etc. from a drop down list. How would I get it to redirect to the specific page that is selected using php? This should be simple but I haven't found the solution by searching google.</p>
| php | [2] |
800,752 | 800,753 | Starting a new activity inside a thread | <p>I have a question about threads. I'm not sure what is happening here. My understanding is that the progress dialog won't end until the long activity has finished, but that is not what is happening. I want the long activity to start, finish, dismiss the spinner, and then start the new activity with the intent.</p>
<pre><code> final ProgressDialog spinnerDialog = ProgressDialog.show(
MainScreen.this, "",
"Waiting for accurate (> 10 meters) GPS coordinates...Please wait. ", true);
new Thread(new Runnable() {
public void run() {
//Do something that takes a while
spinnerDialog.dismiss();
return;
}
}).start();
Intent tvi = new Intent();
tvi.setClass(getInstance(), TabbedView.class);
startActivity(tvi);
</code></pre>
| android | [4] |
4,136,732 | 4,136,733 | Android and XML Layout | <p>Is it possible to use Java code to write to the main.xml file?
I want to make some changes to the layout but have it based from values received from Java?</p>
| android | [4] |
3,376,508 | 3,376,509 | Save text file on client machine using javascript | <p>I want to create text file on client machine and then want to write in that file.
And while saving that file i want to ask user where he want to save file i.e. want to ask by save dialog box....</p>
<p>Thank in advance....</p>
| javascript | [3] |
3,036,429 | 3,036,430 | How to infer a type in a base class dependant on the inheriting class at runtime without if statements? | <p>I have this little OO problem..</p>
<pre><code>abstract class MyAbstractBaseClass
{
MyHelperClassBase myHelperBaseClass;
protected method foo()
{
//QUESTION....... : when I am here I want to do this...
myHelperBaseClass = new MyHelperSubClass();
//OR...
myHelperBaseClass = new MyOtherHelperSubClass();
//HOWEVER ITS COMPLETELY CONDITIONAL ON THE BASE CLASS
//HOW DO I MAKE SURE THE CORRECT TYPE IS INSTANTIATED DEPENDANT ON
//THE BASE CLASS WITHOUT USING AN 'if' STATEMENT?
}
}
class MySubClass : MyAbstractClass {}
class MyOtherSubClass : MyAbstractClass {}
/////////////
abstract class MyHelperClassBase {}
class MyHelperSubClass : MyHelperClassBase, IMyHelper {}
class MyOtherHelperSubClass : MyHelperClassBase, IMyHelper {}
</code></pre>
<p>I want to be able to have a the type basically passed up but cant think of a slick way to do this. Should I just stuck an abstract property on the base class?</p>
| c# | [0] |
2,129,275 | 2,129,276 | Is there a way to get $.ajax's default object | <p>Is it possible to get all the defaults that are associcate with the <code>$.ajax</code> function. </p>
<p>So it would return something like this:</p>
<pre><code>{
global:true,
headers:{},
ifModified:false,
type:"GET",
url:"the current page url",
etc....
}</code></pre>
| jquery | [5] |
1,934,240 | 1,934,241 | setContentView over and setting ImageView force close | <p>So basically the screen has a GridView with 9 images on it. When one of those images clicks I have it setContentView to open a layout of just an image view so it displays the chosen image. After they are done with that image they will click back and it gets rid of that contentView and displays the GridView again. The majority of that works except for it using the ImageView in the other contentView. </p>
<pre><code>public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setView();
setContentView(R.layout.wall);
GridView gridview = (GridView) findViewById(R.id.gridview);
gridview.setAdapter(new ImageAdapter(this));
gridview.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int position,
long arg3) {
pos = position;
displayWallpaper();
}
});
}
private void displayWallpaper(){
switch(pos){
case 0:
setContentView(R.layout.wallpaper);
viewing=true;
ImageView image1 = (ImageView)findViewById(R.id.display);
rotate(R.drawable.wallpaper1, image1);
break;
}
}
</code></pre>
<p>So the force close is happening at the ImageView line. And my guess is it isn't finding display, but display is in the wallpaper layout. Any ideas why it may be force closing. If you need more info let me know what and if you have a better way of doing what I am trying to make happen let me know. Thanks.</p>
<p>Also just tested it out. So far the force close still happens if rotate() is commented out and ImageView is there. If I comment both out it works fine (apart from displaying the image).</p>
| android | [4] |
5,182,480 | 5,182,481 | I get syntax error and missing type | <pre><code> #include "MyArrayList.h"
MyArrayList::MyArrayList()
{
size = 0;
}
NODE* MyArrayList::list_create(void *data)
{
NODE *node;
if(!(node=malloc(sizeof(NODE))))
return (NODE*)NULL;
node->data=data;
node->next=NULL;
return node;
}
NODE *MyArrayList::list_add(NODE *node, void *data)
{
NODE *newnode;
newnode=list_create(data);
newnode->next = node->next;
node->next = newnode;
return newnode;
}
</code></pre>
<p>On </p>
<pre><code> NODE* MyArrayList::list_create(void *data)
{
NODE *MyArrayList::list_add(NODE *node, void *data)
{
</code></pre>
<p>myarraylist.cpp(8): error C2143: syntax error : missing ';' before '*'</p>
<p>myarraylist.cpp(8): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int</p>
<p>myarraylist.cpp(8): error C2065: 'data' : undeclared identifier</p>
<p>myarraylist.cpp(8): error C2761: 'MyArrayList::NODE *MyArrayList::list_create(void *)' : member function redeclaration not allowed</p>
<p>myarraylist.cpp(8): fatal error C1903: unable to recover from previous error(s); stopping compilation</p>
<p>Its a linked list</p>
| c++ | [6] |
3,749,142 | 3,749,143 | syntax error in query | <p>I am new to programming and is developing a new desktop database applcation in Access, I am trying to insert data into a table. I had two datetime picker and I read the value from it as</p>
<pre><code>jobcodedatabean.PaperRecievedate1 = dtpjobcodedate.Value.Date;
jobcodedatabean.Shipmenentdate = dtpshipmentdate.Value.Date;
</code></pre>
<p>and I had passed the databean to a function </p>
<pre><code> public void addaction(JobCodeDataBean jobcodedatabean)
{
MessageBox.Show(jobcodedatabean.Shipmenentdate.ToString());
try
{
OleDbConnection oleDbConnection1 = new System.Data.OleDb.OleDbConnection(connString);
oleDbConnection1.Open();
OleDbCommand oleDbCommand1 = new System.Data.OleDb.OleDbCommand("INSERT INTO jobcodemastertable (jobcode ,customercode,totaltrip,shipmentdate,fromPlace, destination,description ,packagetype ,noofpackage ,contactperson ,jobecodedate ) Values ('" + jobcodedatabean.Jobcode + "', '" + jobcodedatabean.Customercode + "' ," + jobcodedatabean.Totaltrip + "," + jobcodedatabean.Shipmenentdate + " ,'" + jobcodedatabean.Fromplace + "','" + jobcodedatabean.Destination + "','" + jobcodedatabean.Description + "','" + jobcodedatabean.Typeofpackage + "','" + jobcodedatabean.Noofpackages + "','" + jobcodedatabean.Contactperson + "'," + jobcodedatabean.PaperRecievedate1 + ") ", oleDbConnection1);
oleDbCommand1.CommandType = CommandType.Text;
oleDbCommand1.ExecuteNonQuery();
oleDbConnection1.Close();
}
catch (Exception)
{
MessageBox.Show(e);
}
</code></pre>
<p>but i am getting the exception at the query</p>
<pre><code>Syntax error (missing operator) in query expression '2/16/2012 12:00:00 AM'.
</code></pre>
<p>In access the date fields are in short date format </p>
<p>Please somebody help to sort out my mistake</p>
| c# | [0] |
975,870 | 975,871 | Sharing parameters between setting view and application view | <p>Simple question : I've got an iPhone app with 2 views with each a separated xib files.
one view holds the settings of the app
one view holds the app using the settings made in previous view.</p>
<p>How should I implement the sharing of setup parameters between the 2 views ?
should I manage those parameters in the app delegate ?</p>
| iphone | [8] |
583,593 | 583,594 | update statement getting an error | <p>Parse error: </p>
<pre><code>syntax error, unexpected T_VARIABLE, expecting ',' or ';' in ds.php on line 6
</code></pre>
<p>This is my code</p>
<pre><code>include_once("db_conn.php");
$del=$_GET['head1'];
$d=$_GET['msg1'];
$dl=$_GET['ctdel']
$dl ="y";
mysql_query("UPDATE thirdpartycategorymaster SET delete = '$dl' WHERE thirdpartycategorymaster.ThirdPartyCategoryID ='$del' ");
mysql_close($conn);
?>
</code></pre>
| php | [2] |
1,892,315 | 1,892,316 | setTimeout / setInterval mobile browser to calculate cpu efficiency | <p>The cpu efficiency of how to use setTimeout / setInterval to calculate mobile browser?</p>
<pre><code>function fn() {
var start = new Date();
setInterval(function () {
var _s = new Date();
console.info(_s - start);
start = _s;
}, 1000/60)
}
fn()
</code></pre>
| javascript | [3] |
5,580,055 | 5,580,056 | How to make admin panel for my files | <p>Let say i've the follow files [index.php / admin.php / access.php]</p>
<p><strong>1) File index.php is with login form</strong></p>
<pre><code><form method="post" name="login" id="login" action="check.php">
Username : <input name="loginid" id="loginid" type="text">
Password : <input name="password" id="password" type="password">
</form>
</code></pre>
<p>it should send entries (user,pass) to file check.php so that check if the username and password is correct or not and i'd like to use this way</p>
<p><strong>2) File check.php</strong> </p>
<p>At file check.php it should do the following function
- Check if the user,pass is correct
- If correct then create cookies or somehow
- If wrong or empty send me back to login.php</p>
<p>Let say here are my db informations</p>
<pre><code>$sql= "select * from settings where admuser='$loginid' and admpass='$password'";
$result = mysql_query($sql) or die("query failed: $sql");
</code></pre>
<p><strong>3) File access.php</strong></p>
<p>This file should compare if i've logged or not so that if not send me back to login.php</p>
<p><strong>4) File admin.php</strong> [ needs access.php to check if i'm logged or not]</p>
<pre><code><?php
include('access.php');
echo "balah blah blah";
?>
</code></pre>
<p>So can anyone please write this example as simple as possible</p>
<p>That example will helps me a lot to study it as study case
cause i've tried before but failed so i really do not know why and here was my last question <a href="http://stackoverflow.com/questions/9025961/login-not-working-after-php-updated">Login not working after php updated</a> but i found i need complate study case code that working.</p>
<p>thank you for helping</p>
| php | [2] |
910,959 | 910,960 | about mb string and normal string in PHP | <p>How do I know the string is mb string? so we use mb_strlen instead of strlen ?</p>
| php | [2] |
5,696,005 | 5,696,006 | Get the google import contacts | <p>How to get programatically the Google import contacts in android phone.please help me.Thanks in advance</p>
| android | [4] |
5,200,920 | 5,200,921 | Wake On Lan using Unicast | <p>I am trying to implement Wake On Lan using unicast. I have the code for broadcast and it is working fine. But I want to make it work using Unicast and I tried a lot but couldn't achieve. </p>
<p>Here is the broadcast code.</p>
<pre><code>import java.io.*;
import java.net.*;
public class WakeOnLan {
public static final int PORT = 9;
public static void main(String[] args) {
String ipStr = "192.168.1.255";
String macStr = "00-1a-6b-51-0a-8c";
try {
byte[] macBytes = getMacBytes(macStr);
byte[] bytes = new byte[6 + 16 * macBytes.length];
for (int i = 0; i < 6; i++) {
bytes[i] = (byte) 0xff;
}
for (int i = 6; i < bytes.length; i += macBytes.length) {
System.arraycopy(macBytes, 0, bytes, i, macBytes.length);
}
InetAddress address = InetAddress.getByName(ipStr);
DatagramPacket packet = new DatagramPacket(bytes, bytes.length, address, PORT);
DatagramSocket socket = new DatagramSocket();
socket.send(packet);
socket.close();
System.out.println("Wake-on-LAN packet sent.");
}
catch (Exception e) {
System.out.println("Failed to send Wake-on-LAN packet: + e");
System.exit(1);
}
}
private static byte[] getMacBytes(String macStr) throws IllegalArgumentException {
byte[] bytes = new byte[6];
String[] hex = macStr.split("(\\:|\\-)");
if (hex.length != 6) {
throw new IllegalArgumentException("Invalid MAC address.");
}
try {
for (int i = 0; i < 6; i++) {
bytes[i] = (byte) Integer.parseInt(hex[i], 16);
}
}
catch (NumberFormatException e) {
throw new IllegalArgumentException("Invalid hex digit in MAC address.");
}
return bytes;
}
}
</code></pre>
<p>If the machine is off, It will not have an Ip address. Then how can unicast work?</p>
| java | [1] |
1,310,335 | 1,310,336 | variable scope of __init__ | <p>I just wonder, why variable defined by <code>__init__</code> is not accessible from class? Should its executed during instantiation, so that its accessible from outside?</p>
<pre><code>>>> class a:
... data = {}
...
>>> a.data
{}
>>> class a:
... def __init__(self):
... self.data = {}
...
>>> a.data
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: class a has no attribute 'data'
</code></pre>
| python | [7] |
1,188,750 | 1,188,751 | Python Server with multiple Sents | <p>How do i make a Server that sents multiple data (1.st file name, 2nd binary file data)?</p>
<p>I only can send 1 data because the client stops the .recv() function only if connection is closed.</p>
<p>Sorry i have no idea, i thougt the recieve function does automaticly know when the end is send.</p>
<pre><code>"""
SOCKET VERBINDUNG AUFBAUEN
"""
serverHost = 'localhost'
serverPort = 2000
server = socket.socket (socket.AF_INET, socket.SOCK_STREAM)
server.bind((serverHost, serverPort))
server.listen(1)
# Liste der Clients
clients = []
sock = []
wlist = []
try:
while True:
lesen, schreiben, oob = select.select([server] + clients, wlist, [])
for sock2 in lesen:
#if sock2 in server:
client, adress = server.accept()
clients.append(client)
wlist.append(client)
print "Client verbunden: %s" % adress[0]
break;
#else:
#sock2.close()
#print 'hier'
#clients.remove(sock)
for sock2 in schreiben:
print 'he'
if sock2 in clients:
print "Uebertragung Dateiname beginnt..."
client.send(fileNameList[0])
clients.remove(client)
wlist.remove(client)
sock2.close()
print "...Uebertragung abgeschlossen!"
#sock2.close()
#clients.remove(client)
</code></pre>
| python | [7] |
3,665,964 | 3,665,965 | Sorting a vector of objects in C++ | <p>say I have a class "Information" and it stores the Name and Age of people in a vector.</p>
<p>so...</p>
<pre><code>class Information {
private:
int age;
string name;
//etc, etc...
};
</code></pre>
<p>How would I sort the vector in either ascending/descending order with respect to age?</p>
<p>I believe you use something like this.</p>
<pre><code>sort(listOfPeople.begin(), listOfPeople.end(), greater<Information>());
</code></pre>
<p>listOfPeople would be the vector.</p>
<p>Any help would be greatly appreciated.</p>
| c++ | [6] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.