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 |
|---|---|---|---|---|---|
4,947,115 | 4,947,116 | The constructor property - Relate Pre-existing Objects? | <p>I'm currently trying to test whether it's possible to make one object inherit from another object AFTER both objects have been created using literals. I tried to aim the constructors and prototypes at one another but it seems like no matter what, the only way Im going to pull this off is by building a new object using one of the pre-existing ones.. Let me know if I'm wrong. Here was my quick attempt to solve the problem.</p>
<pre><code>Object.relate = function(parent, child){
function F(){};
F.prototype = parent;
child.constructor = F;
}
alpha = {a:1};
beta = {b:2};
Object.relate(alpha, beta);
</code></pre>
| javascript | [3] |
2,883,578 | 2,883,579 | Android - listen to changes in a folder | <p>I have a Bluetooth application, which will list out all of the files in the bluetooth folder on my phone. So far I have only done it this way: </p>
<pre><code>public class GetCaseInformation {
int numberOfFiles;
String pathToFolder;
File folder;
public GetCaseInformation(String pathToFolder) {
this.pathToFolder = pathToFolder;
folder = new File(pathToFolder);
}
public int getCasesFromFolder() {
return folder.list().length;
}
}
</code></pre>
<p>A very simple way to check how many files I have in my folder. The method <code>getCasesFromFolder()</code> is called in my <code>onCreate</code> method, so this will just be updated every time the user goes to the home screen. Is it possible to listen for changes in a spesific folder? So I dynamicaly can update the count of files in this folder? </p>
| android | [4] |
5,295,556 | 5,295,557 | _ElementInterface instance has no attribute 'tostring' | <p>The code below generates this error. I can't figure out why. If ElementTree has parse, why doesn't it have tostring? <a href="http://docs.python.org/library/xml.etree.elementtree.html#xml.etree.ElementTree.ElementTree" rel="nofollow">http://docs.python.org/library/xml.etree.elementtree.html#xml.etree.ElementTree.ElementTree</a></p>
<pre><code>from xml.etree.ElementTree import ElementTree
...
tree = ElementTree()
node = ElementTree()
node = tree.parse(open("my_xml.xml"))
text = node.tostring()
</code></pre>
| python | [7] |
5,620,528 | 5,620,529 | How to add another object to this object | <p>I am new to JSON and Here is my First JSON Object </p>
<pre><code>var First = {
"a" : [{}]
};
</code></pre>
<p>I want to add the below object to "a" in "First"</p>
<pre><code>var a = {"1":"One","2":"Two"};
</code></pre>
<p>I have tried below code </p>
<pre><code>First.a[First.a.length-1] = a;
</code></pre>
<p>It is not working.I assume that there are some syntax mistakes in this. Please help me on this.</p>
| javascript | [3] |
2,819,827 | 2,819,828 | Python: how do I replace all of the same elements in an int array? | <p>I have 1,2,3,6,7,8,1,1,1,6,7,5</p>
<p>What is the syntax for replacing all 1's with ... say.. 0?</p>
<p>for strings its .replace("1", "0")</p>
| python | [7] |
763,859 | 763,860 | How to use AIDL stub in webservice android...give some sample sites? | <p>How to use AIDL stub in web service android.give some sample sites?</p>
| android | [4] |
4,645,413 | 4,645,414 | 404 Object Not Found for Javascript files | <p>I have a .Net 1.1 webapp.</p>
<p>I have a usercontrol (.ascx) that has links to 3 JS files in
script tags.</p>
<p>When I run the app and load a page with the usercontrol
all is fine and Firebug shows the js files listed.</p>
<p>But when I load another page that loads the usercontrol in a .aspx
in a new browser window Firebug reports 404 object not found
for the 3 JS files.</p>
<p>What could cause this??</p>
<p>Malcolm</p>
| asp.net | [9] |
3,369,194 | 3,369,195 | NSDictionary and NSMutableArray | <p>I have a tableView with <code>n</code> rows.
In each row have data such as <code>foodID</code>, <code>foodPrice</code>, ...</p>
<p>When I select one of rows in table, it should load a new window displayed info: <code>foodID</code> <code>foodPrice</code> of slected table
I think a <code>NSDictionary</code> can solove but don't know how to code it.</p>
| iphone | [8] |
5,536,164 | 5,536,165 | How can I compare a string and a bool array? | <p>I have two arrays as below:</p>
<pre><code>_user string[3] containing "true" "true" and "true"
_test bool[3] containing true true false
</code></pre>
<p>The number of elements in the arrays will vary from one run to another. My question is how can I compare the values in these two arrays and return true if the elements match one for one. </p>
<p>Hope someone can help as my C# is not very good at all. </p>
<p>Janet</p>
| c# | [0] |
1,609,717 | 1,609,718 | Forcing code flow to go to except block | <p>I have:</p>
<pre><code>try:
...
except Exception, e:
print "Problem. %s" % str(e)
</code></pre>
<p>However, somewhere in try, i will need it to behave as if it encountered an Exception. Is it un-pythonic to do:</p>
<pre><code>try:
...
raise Exception, 'Type 1 error'
...
except Exception, e:
print "Problem. Type 2 error %s" % str(e)
</code></pre>
| python | [7] |
5,435,759 | 5,435,760 | How to retrieve textview text from main.xml | <p>I have following main.xml of layout </p>
<pre><code><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textview01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello" />
</code></pre>
<p></p>
<p>and I am trying to retrieve the text i.e. @string/hello by using the following code</p>
<pre><code> public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv= (TextView) findViewById(R.id.textview01);
String input= tv.getText().toString();
Log.d("Info",input);
</code></pre>
<p>but I am not able to see the output. Application is crashing with NULL Exception error at the String input = tv.getText(</p>
| android | [4] |
4,293,100 | 4,293,101 | Specific Java generic array creation | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/5662394/java-1-6-creating-an-array-of-listt">Java 1.6: Creating an array of List<T></a> </p>
</blockquote>
<p>How can I initialize this array in Java.</p>
<pre><code>Vector<Integer>[] c;
</code></pre>
<p>I already try:</p>
<pre><code>Vector<Vector<Integer>[]> a = new Vector<Vector<Integer>[]>();
Vector<Integer>[] c = (Vector<Integer>[])a.toArray();
</code></pre>
<p>with the following error:</p>
<blockquote>
<p>Exception in thread "main" java.lang.ClassCastException:
[Ljava.lang.Object; cannot be cast to [Ljava.util.Vector; at
app.Program.main(Program.java:38) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601) at
com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)</p>
</blockquote>
<p>EDIT:</p>
<p>My problems is that I am client from a class that receives an generic array "T[] args" argument, and in my case T is a generic type such Vector, Thanks</p>
<p>I am new in Java.</p>
| java | [1] |
840,821 | 840,822 | converting datetime | <p>i want to convert Datetime. I don't know how to do this? It gives errors. nvarchar doesn't convert to datetime.</p>
<p>startDate format : "11.03.2012"</p>
<p>My table :
STARTDATE datetime
ENDDATE datetime </p>
<pre><code>public static int Insert(string startDate, string endDate)
{
Conn c = new Conn();
SqlParameter[] prms = new SqlParameter[]{
new SqlParameter("@STARTDATE", DateTime.ParseExact(startDate,"DD MM YYYY",null)),
new SqlParameter("@ENDDATE", DateTime.ParseExact(endDate,"DD MM YYYY",null)),
};
return Convert.ToInt32(c.getObjectSP("sp_Insert", prms));
}
</code></pre>
| c# | [0] |
352,599 | 352,600 | Sorting issue in jqgrid | <p>the below code code is not sorting but pagination is working.Any solution?</p>
<pre>
$("#vendor_list").jqGrid({
url: '/ra/vendor',
datatype: 'json',
ignoreCase: true,
colNames:['Vendor ID','Vendor Code', 'Vendor Name', 'Country', 'Approved', 'Location'],
colModel:[
{name:'Vendor ID',index:'vendor_id', hidden:true},
{name:'Vendor Code',index:'vendor_code', sorttype: 'text'},
{name:'Vendor Name',index:'vendor_name', sorttype: 'text'},
{name:'Country',index:'country', sorttype: 'text'},
{name:'Preferred',index:'preferred', align:'center'},
{name:'Location',index:'location_flag', align:'center'},
],
rowNum:5,
rowList:[5,10,20,30],
sortable: true,
loadonce: true,
mtype: "POST",
pager: $('#vendor_list_pager'),
sortname: 'id',
sortorder: 'asc',
multiselect: true,
viewrecords: true,
gridview: true,
//onPaging: function(which_button) {
// $('#vendor_list').setGridParam({datatype: 'json'});
//},
caption:"Vendor Selection List",
});
</pre>
| javascript | [3] |
5,579,421 | 5,579,422 | move_uploaded_file not working after preview page | <p>I'm submitting a form to a preview page(form) and then a final submit. I'm having trouble getting move_uploaded_file to work. How do i solve this? when i check the directory there is no file there.</p>
<p>preview page </p>
<pre><code> $tmpname = $_FILES['titleimage']['tmp_name'];
$imagefile = $_FILES['titleimage']['name'];
$filename = basename($imagefile);
$imagename = dirname(__FILE__).'/avatar/'.$filename;
echo "<form enctype='multipart/form-data' id='submitpreview' action='/upload' method='POST'>
<input type='hidden' name='image' value='$tmpname' readonly />
<input type='hidden' name='imagedir' value='$imagename' readonly />";
//other code
echo "<div id='preview-submit-button'><a>Submit</a></div>
</form>";
</code></pre>
<p>upload page</p>
<pre><code>$image = $_POST['image'];
$directory = $_POST['imagedir'];
move_uploaded_file($image,$directory);
</code></pre>
| php | [2] |
4,228,983 | 4,228,984 | Android on screen click | <p>I have one image..which consists of two buttons in it. I don't want to use default button control rather i want to perform action on the buttons of image.</p>
<p>is there any way to perform onclick on the buttons of image..</p>
| android | [4] |
4,731,871 | 4,731,872 | Validity of checking exact value of preset double | <p>I sometimes do the following in my code when I am being lazy:</p>
<pre><code>double d = 0;
...
if( condition1 ) d = 1.0;
...
if (d == 0) { //not sure if this is valid
}
</code></pre>
<p>can I always count on the fact that if I set a <code>double</code> to be <code>0</code> I can later check in the code for it with <code>d == 0</code> reliably? </p>
<p>I understand that if I do computations on <code>d</code> in the above code, I can never expect <code>d</code> to be exactly <code>0</code> but if I set it, I would think I can. All my testing so far on various systems seem to indicate that this is legitimate.</p>
| c++ | [6] |
223,766 | 223,767 | An unknown Java syntax | <p>Let's see the following code snippet in Java.</p>
<pre><code>package common;
final public class Main
{
private static void show(Object... args) //<--Here it is...
{
for(int i=0;i<args.length;i++)
{
System.out.println(args[i]);
}
}
public static void main(String[] args)
{
show(1, 2, 3, 4, 5, 6, 7, 8, 9);
}
}
</code></pre>
<hr>
<p>The above code in Java works well and displays numbers starting from 1 to 9 through the only loop on the console. The only question here is the meaning of <code>(Object... args)</code> in the above code.</p>
| java | [1] |
4,592,668 | 4,592,669 | Android EditText | <p>in my custom listview that Contain an image and EditText ,and in EditText i can comment the photo ,i can give text comment max length of 50 ,when i lost the focus in EditText i want to rearrange the text in EditText in following format</p>
<p>EG: suppose comment contain 40 char and user can at a time directly view only 20 char,then if i lost the focus text should be rearranged that at the end there should be 3 dot</p>
<p>Original Comment i wirte:eg-> eeeeeeeeeeeeeeeeeeeeeeeeeee
after i lost focus it should shown as-> eeeeeeeee...</p>
<p>it's importent that the nothing happens to original text because these text i want to send to server, and i directly take these values,and if am replace the text by new this type of text this will create problem, also when i gain focus i need to see full text also. </p>
<p>NB: i set android:singleline=true</p>
| android | [4] |
4,287,998 | 4,287,999 | Function to return distinct values in a 2D array | <p>I have the following 2D array</p>
<pre><code>var items = [['al','bv','sd'],
['al','cc','ab'],
['cv','vv','sw'],
['al','bv','sd']
];
</code></pre>
<p>I need a function which will return me a similar array but with distinct values. For example, in the above array, <code>['al','bv','sd']</code> happens twice.</p>
<p>I would like the function to return me:</p>
<pre><code>var items = [['al','bv','sd'],
['al','cc','ab'],
['cv','vv','sw']
];
</code></pre>
| javascript | [3] |
4,852,088 | 4,852,089 | problem with parameters of the query | <p>I'm having troubles passing parameters to a query throws this exception</p>
<p><strong>The parameterized query '(@IdIndicador int)INSERT INTO [AtentoMIG].[dbo].[Indicador]([Nom' expects the parameter '@IdIndicador', which was not supplied.</strong></p>
<p><strong>this is my code</strong></p>
<pre><code>_sqlCommand = new SqlCommand
("INSERT INTO [AtentoMIG].[dbo].[Indicator]"
+ "([Name]"
+ ",[Descripction])"
+ "VALUES"
+ "('" + data[0] + "'"
+ ",'" + data[13] + "') SET @IdIndicador = SCOPE_IDENTITY()", _sqlConexion);
SqlParameter idIndicador = new SqlParameter("@IdIndicador", SqlDbType.Int);
_sqlCommand.Parameters.Add(idIndicador);
_sqlCommand.Connection.Open();
_sqlCommand.ExecuteNonQuery();
int id = (int)idIndicador.Value;
_sqlConexion.Close();
return true;
</code></pre>
<p>Why am i doing wrong?? for me the code looks good</p>
| c# | [0] |
1,619,908 | 1,619,909 | How can i get the defalut session for a context in android? | <p>I want to set the session of a context to it's default session.So for acheiving this I first want to get the default session for the context. How can I do this?Thanks in advance..</p>
| android | [4] |
5,807,758 | 5,807,759 | Error to read /dev/ttyUSB0! | <p>The problem:</p>
<ul>
<li><p>jni side open serial port and set parameters ok, tested out and work fine.</p></li>
<li><p>java side only read device the following way:</p>
<pre><code>in = new BufferedInputStream(new FileInputStream("/dev/ttyUSB0"));
</code></pre></li>
</ul>
<p>The port number is correct I have tested out it!</p>
<p>The above code it own thread, of course not blocking UI worker thread!</p>
<pre><code>byte[] bytes= new byte[1024];
ByteArrayOutputStream byteStream= new ByteArrayOutputStream();
int len;
len=in.read(bytes);// This is line which doesn't work!
byteStream.write(bytes, 0, len);
if(len!=-1) {
// And here I will be parsed data.
}
</code></pre>
<p>So I want open serial port and set parameters in jni side, and it's working nice, also close to port works well. But now I want to read to the open ttyUSB0 port in own thread, but it crash in line </p>
<pre><code>len = in.read(bytes);
</code></pre>
<p>Android manifest file includes</p>
<pre><code>uses-permission android:name="android.permission.ACCESS_SUPERUSER"
</code></pre>
<p>before application application part.</p>
<p>Thanks for helps!</p>
| android | [4] |
3,582,607 | 3,582,608 | how can i track or trace hotlinker ip address? | <p>is there any way to find out ip address of a hotlinker?</p>
| php | [2] |
1,866,031 | 1,866,032 | truncate links with jQuery | <p>My first post here, but I learned a lot already by lurking =) This time, I can't find a solution for problem, although it looks like something that's easy to achieve.</p>
<p>I have a list of links to blogpost, generated with Feed2JS. Unfortunately, the RSS feed that is the source for this adds anchors to the links that I don't want. I can't change the feed, because it's generated automatically in RapidWeaver.</p>
<p>Is it possible to remove everything from the hash in the url's with jQuery? for example: change </p>
<p><a href="http://www.example.com/blog/files/398e042ea42b7ee9d1678b3c53132fc3-31.php#unique-entry-id-31" rel="nofollow">http://www.example.com/blog/files/398e042ea42b7ee9d1678b3c53132fc3-31.php#unique-entry-id-31</a></p>
<p>to</p>
<p><a href="http://www.example.com/blog/files/398e042ea42b7ee9d1678b3c53132fc3-31.php" rel="nofollow">http://www.example.com/blog/files/398e042ea42b7ee9d1678b3c53132fc3-31.php</a></p>
<p>I'm pretty new to jQuery, and still have a lot to learn, so please keep your answer simple.</p>
<p>Jeroen</p>
| jquery | [5] |
3,057,491 | 3,057,492 | Will inlining Javascript reduce the chance of delays? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/138884/when-should-i-use-inline-vs-external-javascript">When should I use Inline vs. External Javascript?</a> </p>
</blockquote>
<p>Often Javascript needs to be run as soon as possible. For example, suppose I have some radio buttons in a form and when the form fails to submit, the Javascript selects the last button that I selected. If one button is selected by default and the user sees this and then the Javascript changes buttons, it will look weird. Therefore, the script should run as soon as possible and it seems that inlining Javascript might help with this. Is this likely to make a significant difference in terms of reducing how often users see this kind of weird behaviour?</p>
| javascript | [3] |
1,196,007 | 1,196,008 | List<T> to IEnumerable<T> problem in interface | <pre><code>namespace WpfApplication3
{
public class Hex
{
public String terr;
}
public class HexC : Hex
{
int Cfield;
}
public interface IHexGrid
{
IEnumerable<Hex> hexs { get; }
}
public class hexGrid : IHexGrid //error CS0738: 'WpfApplication3.hexGrid' does not
{
public List<Hex> hexs { get; set; }
}
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
List<HexC> hexList1 = new List<HexC>();
genmethod(hexList1); //but this compiles fine
}
void genmethod(IEnumerable<Hex> hexList)
{
string str1;
foreach (Hex hex in hexList)
str1 = hex.terr;
}
}
}
</code></pre>
<p>The full error message is: 'WpfApplication3.hexGrid' does not implement interface member 'WpfApplication3.IHexGrid.hexs'. 'WpfApplication3.hexGrid.hexs' cannot implement 'WpfApplication3.IHexGrid.hexs' because it does not have the matching return type of 'System.Collections.Generic.IEnumerable'.</p>
<p>Why doesn't List implicitly cast to IEnumerable above? Thanks in advance!</p>
| c# | [0] |
2,410,583 | 2,410,584 | Java String import | <p>i have one doubt that when we use ArrayList or HashMap in java we have to import the import java.util.ArrayList;import java.util.HashMap; but when we use String it do not require the import Statement.. can any one clarify my Doubt..
Thanks in Advance..
Mahaveer</p>
| java | [1] |
2,815,796 | 2,815,797 | adding a border in Java | <p>I am trying to create an image that adds a border to an existing image on Java by copying the pixels from their old locations to new coordinates. My solution is working, but I was wondering if there is a more efficient/shorter way to do this.</p>
<pre><code> /** Create a new image by adding a border to a specified image.
*
* @param p
* @param borderWidth number of pixels in the border
* @param borderColor color of the border.
* @return
*/
public static NewPic border(NewPic p, int borderWidth, Pixel borderColor) {
int w = p.getWidth() + (2 * borderWidth); // new width
int h = p.getHeight() + (2 * borderWidth); // new height
Pixel[][] src = p.getBitmap();
Pixel[][] tgt = new Pixel[w][h];
for (int x = 0; x < w; x++) {
for (int y = 0; y < h; y++) {
if (x < borderWidth || x >= (w - borderWidth) ||
y < borderWidth || y >= (h - borderWidth))
tgt[x][y] = borderColor;
else
tgt[x][y] = src[x - borderWidth][y - borderWidth];
}
}
return new NewPic(tgt);
}
</code></pre>
| java | [1] |
5,870,486 | 5,870,487 | Create a .txt list of IPs in a subnet | <p>I'd like to make a very simple text (.txt) file. This python program needs to make a list of multiple ranges of IPs in a subnet, each taking up one line.</p>
<p>Example:</p>
<pre><code>10.10.27.1
10.10.27.5
10.10.27.6
10.10.27.26
10.10.27.27
10.10.27.28
10.10.27.29
10.10.27.51
10.10.27.52
10.10.27.53
10.10.27.54
</code></pre>
<p>The subnet mask will essentially always be a /24, so providing mask input is not necessary. The program can even default to only supporting a standard class C. </p>
<p>Also, I'd like to support common ranges for devices that we use. A prompt for say, "Printers?" will include .26 - .30. "Servers?" will include .5 - .7. "DHCP?" prompt always will include .51 - .100 of the subnet. "Abnormal?" will include .100 - .254.</p>
<pre><code>Subnet? 10.10.27.1
Servers? Y
Printers? Y
DHCP? Y
Abnormal? N
</code></pre>
<p>Output being:</p>
<pre><code>10.10.27.1
10.10.27.5
10.10.27.6
10.10.27.7
10.10.27.26
10.10.27.27
10.10.27.28
10.10.27.29
10.10.27.30
10.10.27.51 (all the way to .100)
</code></pre>
<p>What is the best way to code this?</p>
| python | [7] |
4,452,005 | 4,452,006 | jQuery update label's text with HTML string | <p>I have a simple HTML <code>label</code> input. By using the ajax request, I get back the HTML string which I want to put as that label's text. To do so, I try the following code:</p>
<pre><code>$('#my-label').text($("<label class='someClass'>4.00 ABC</label> (13.26 DEF)"));
</code></pre>
<p>but nothing happens. How to cope with that ?</p>
| jquery | [5] |
2,202,620 | 2,202,621 | How do I change the user's signature in MFMailComposeViewController? | <p>I am using a MFMailComposeViewController for my application, and everything works fine, but every message has <code>Sent From My iPhone</code> at the end of it. How can I remove this signature line or change it to read <code>Sent From My iPad</code>?</p>
| iphone | [8] |
3,314,131 | 3,314,132 | Cron Expression for a time range | <p>I am unable to create cron expression to fire every 5 minutes starting at 3:45am and
ending at 7:20am every day.</p>
<p>Can anybody help on this?</p>
| java | [1] |
4,809,348 | 4,809,349 | How to increase my upload limit in php | <p>I read so many articles out there in the internet and found that to change the php.ini file to upgrade the upload limit. But I do all the suffs and cant upload more than 10mb of files or so. </p>
<p>I am trying to add a feature to upload video file through the front end for users. But failed for some reason</p>
<p>Is there any other way to do it. Or is it because it is a video file or some thing like that</p>
| php | [2] |
4,265,339 | 4,265,340 | Return constant and non constant by value | <p>There is such code:</p>
<pre><code> const int fun(){ return 2; } // can be assigned to int and const int
int fun2(){ return 2; } // can be assigned to int and const int
</code></pre>
<p>Is there any difference in using these functions? They both return by value so it is always copied at the end of function call.</p>
| c++ | [6] |
4,201,824 | 4,201,825 | what's the difference between try and class in java? | <p>i want to know what's the difference between public or private class and try, and when do i have to use one of them and not the other? </p>
<pre><code>try {
date1 = sdf.parse(duration);
date2 = sdf.parse(Time2);
long diff = date1.getTime() - date2.getTime();
if(diff > 0){
long jour = diff/(60*24*60*1000);
int jor = (int)jour;
String jr = Integer.toString(jor);
long heur = (diff%(60*24*60*1000))/(60*60*1000);
int her = (int)heur;
String hr = Integer.toString(her);
long minu = ((diff%(60*24*60*1000))%(60*60*1000))/(60*1000);
int mi = (int)minu;
String mn = Integer.toString(mi);
TAG_FINAL_TIME = jr + "j" + " " + hr + "h" + " "+ mn + "min";
}
else{
int i1 = 0;
String I = Integer.toString(i1);
TAG_FINAL_TIME = I; }
fintime = TAG_FINAL_TIME;
} catch (ParseException e) {
e.printStackTrace();
}
</code></pre>
| java | [1] |
1,002,033 | 1,002,034 | Calling Explorer from ASPX WebForm Link Button | <p>I have a link button on my aspx webform page. When the user clicks on the link, I want to open the Windows explorer on the client PC and open a folder and view the directory. It will take a folderpath as in \Machinename\C$\WINNT\ThisFolder and pass it to the Explorer. The code works when I developed with Visual Studio on my client machine. When I deployed it on the server and called the webform from my client PC, it does not do anything. the webpage only flickers once when I click on the link button. Does the asp.net application need permission or am I missing another step? Any help is great appreciated.</p>
<pre><code>ProcessStartInfo processStartInfo = new ProcessStartInfo();
processStartInfo.FileName = "explorer";
processStartInfo.UseShellExecute = true;
processStartInfo.WindowStyle = ProcessWindowStyle.Normal;
processStartInfo.Arguments = string.Format("/select,\"{0}\"", folderpath);
Process.Start(processStartInfo);
</code></pre>
| asp.net | [9] |
3,005,957 | 3,005,958 | Block users coming from a particular URL after clicking banner ad | <p>I want to block users coming from a particular URL. our adbanner is shown in many websites. People who click our banner on a website are directed to our registration page. I don't want the page to be shown for people who click our ad on a particular website say <a href="http://abc.com" rel="nofollow">http://abc.com</a>. How can I implement this restriction ?
Thanks in advance </p>
| php | [2] |
4,783,406 | 4,783,407 | Find an object with a data member with a unique value in Java? | <p>I'm doing a Java task that is like a simple bank system with Customer objects and SavingsAccount. I store all Customer objects in an arraylist and I was also planning to do the same with the SavingsAccount objects, but that is perhaps not necessary. Each SavingsAccount has a data member called accountNumber that is unique. </p>
<p>The SavingsAccount also include data members lika accountBalance. So my question is how do I reach a SavingsAccount that has the accountNumber equal to "1002" (For some reason I have them as Strings) and then be able to set or get values from data member, like accountBalance with setAccountBalance? Help is preciated! Thanks!</p>
<p>I create the account object</p>
<pre><code>SavingsAccount account = new SavingsAccount(inAccount);
</code></pre>
<p>The class SavingsAccount:</p>
<pre><code>class SavingsAccount {
// data members
private String accountType;
private String accountNumber;
private double accountInterestRate;
private int accountBalance;
// constructor
public SavingsAccount(String inNumber){
accountType = "Saving";
accountNumber = inNumber;
accountInterestRate = 0.5;
accountBalance = 0;
}
// get account number
public String getAccountNumber() {
return accountNumber;
}
// get account balance
public int getAccountBalance() {
return accountBalance;
}
// get interest rate
public double getAccountInterestRate(){
return accountInterestRate;
}
// set new value to balance
public void setAccountBalance(int inMoney){
accountBalance = accountBalance + inMoney;
}
}
</code></pre>
<p>EDIT:</p>
<p>Since I'm learning Java, I prefer a solution that is not to complicated to use right now. I know how to use arraylist, but I haven't reach to the hashmap yet, and was hoping for a simplier, but perhaps not the best, solution for now? Isn't there a way to reach objects without "collecting" them in arraylist or hashmap?</p>
| java | [1] |
4,258,281 | 4,258,282 | How to detect when the screen is on? | <p>As mentioned in a previous question, I am having difficulty intercepting all android.intent.action.SCREEN_ON events without a long-lived service (discouraged).</p>
<p>I may be able to work around the need if I can simply work out when the screen is on at any given time, in the service.</p>
<p>Can anyone suggesting a method call that would return this information? 1.5 upwards.</p>
| android | [4] |
4,150,523 | 4,150,524 | What's the best workflow to keep cpp files and header files in sync? | <p>I'm trying to learn C++ for Qt development, and I'm a little scared of header files. What I'd like to know is, what's the best workflow for keeping *.cpp and *.h files synched? For example, is the norm to write the class file and then copy the relevant info over to the header? </p>
<p>Sorry if this doesn't make any sense...I'm just looking for an efficient workflow for this.</p>
<p>Thanks!</p>
<ul>
<li>Justin</li>
</ul>
| c++ | [6] |
3,990,804 | 3,990,805 | Android - periodically wake up from standby mode? | <p>I have an app that needs to send a periodic heart beat to a server, but when the phone goes into standby mode the background heartbeat thread dies. Is there anyway to wake the phone from standby, send the heartbeat and then go back to sleep programmatically? I want to avoid using PARTIAL_WAKE_LOCK if possible.</p>
<p>Thanks</p>
| android | [4] |
4,931,609 | 4,931,610 | How to use javascript change function to toggle a paragraph? | <p>I want to toggle an input via a checkbox. Here's the code:</p>
<h2>css:</h2>
<pre><code>.moveaway{ position:absolute;top:-999rem;}
</code></pre>
<h2>html</h2>
<pre><code><p>
<label><?php _e('Setup Template')?></label>
<input class="check-toggle" name="toggle" type="checkbox" value="1" <?php echo $template ? 'checked="checked' : '';?> />
</p>
<p id="template-input" class="<?php echo $template ? '' : 'moveaway'?>">
<lable for="template-name">Template Name</lable>
<input id="template-name" type="text" name="template-name" value="<?php echo $tamplate; ?>" />
</p>
</code></pre>
<h2>javascript:</h2>
<pre><code>$("input.check-toggle").change(function() {
if ($(this).is(':checked')) {
$("p#template-input").attr('class','');
}else{
$("p#template-input").attr('class','moveaway');
$("input#template-name").val(0);
}
});
</code></pre>
<p>The above code works when the template-name input field is empty. When the template-name field value is set, the wrapper <code>p#template-input</code> gets merged in to the p which contains the check-toggle input.</p>
<p>I don't understand how the change function made this. I would like to learn how to get the result that the p#template-input can be toggled by the checkbox.</p>
| javascript | [3] |
232,693 | 232,694 | an expression for an infinite generator? | <p>Is there a straight forward generator expression that can yield infinite elements?</p>
<p>This is a purely theoretical question. No need for a "practical" answer here :)</p>
<hr>
<p>For example, it is easy to make a finite generator:</p>
<pre><code>my_gen = (0 for i in xrange(42))
</code></pre>
<p>However, to make an infinite one I need to "pollute" my namespace with a bogus function:</p>
<pre><code>def _my_gen():
while True:
yield 0
my_gen = _my_gen()
</code></pre>
<p>Doing things in a separate file and <code>import</code>-ing latter doesn't count.</p>
<hr>
<p>I also know that <code>itertools.repeat</code> does exactly this. Im curious if there is a one liner solution without that.</p>
| python | [7] |
5,377,528 | 5,377,529 | insert terms and condition page in iphone application code that is loaded when application is installed | <p>i have developed an iphone application where i have generated a terms and condition page and i wand that page to load only at that time of installation and not everytime application is run on iphone. Is there any any way to do this... i am done with this.... should i insert it into the application bundle and show it into settings...</p>
<p>Thanx in advance... </p>
| iphone | [8] |
3,552,245 | 3,552,246 | how to access the following js file function in my javascript code | <p><a href="http://www.pinlady.net/PluginDetect/PDFReader/" rel="nofollow">http://www.pinlady.net/PluginDetect/PDFReader/</a>
following are the two javascript file in the which is in above url
PluginDetect_PDFReader.js, PDFReader.js </p>
<p>i don't know how to get the result.
one js file call another one.</p>
<p>through this js file in want to know whether the pdf reader is installed in the browser or not..</p>
| javascript | [3] |
3,258,158 | 3,258,159 | Android People.Number and People.Number_key return null | <p>I am trying to get the contacts from the phone but all I can get is the name, the phone numbers return null.</p>
<pre><code> Cursor cursor = getContentResolver().query(People.CONTENT_URI, null, null, null,People.NAME + " ASC");
startManagingCursor(cursor);
cursor.moveToFirst();
if(cursor.getCount() > 0){
while(cursor.moveToNext()){
int idCol = cursor.getColumnIndex(People._ID);
int nameCol = cursor.getColumnIndex(People.NAME);
int numCol = cursor.getColumnIndex(People.NUMBER_KEY);
String name = cursor.getString(nameCol);
String number = cursor.getString(numCol);
//mDbHelper.addContact(managedCursor.getString(1),managedCursor.getString(2));
Log.v("contact.add",name+" - "+number);
}
</code></pre>
<p>Any ideas?</p>
<p>After about 3 hours, I have figured it out:</p>
<pre><code> ContentResolver cr = getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI,
null, null, null, null);
if (cur.getCount() > 0) {
cur.move(-1);
while (cur.moveToNext()) {
String id = cur.getString(
cur.getColumnIndex(ContactsContract.Contacts._ID));
String name = cur.getString(
cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
if (Integer.parseInt(cur.getString(cur.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0) {
if (Integer.parseInt(cur.getString(
cur.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0) {
Cursor pCur = cr.query(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID +" = ?",
new String[]{id}, null);
while (pCur.moveToNext()) {
Log.v("Phone",""+pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER))+" - "+name);
i++;
}
pCur.close();
}
}
}
}
</code></pre>
| android | [4] |
2,407,289 | 2,407,290 | how to find the index of the currect opyion in a selected list | <p>I have a select box and I want to try and get the index of the current selected option.
I can get the value of this with.</p>
<p>(#mySelectBox).val();</p>
<p>what I'm after is if say val was set by default to the last option which would be option3 I want to get the index of that option.</p>
<pre><code> <div class="selectItems">
<select id="mySelectBox">
<option value="0">option1</option>
<option value="1">option2</option>
<option value="2">option3</option>
</select>
</div>
</code></pre>
| jquery | [5] |
3,869,898 | 3,869,899 | Can I copy video directly to the iPhone without iTunes? | <p>If you connect your iPhone to your PC it shows up as a drive and you can browse your images in the DCIM\100Apple folder.</p>
<p>Is there any way to copy video to the phone without using iTunes?</p>
| iphone | [8] |
1,428,007 | 1,428,008 | jQuery - Pausing and resuming a looping animation too quickly causes the queue to go haywire | <p>I have the following code that animates forever, pauses at the end of the current animation on mouse enter, and resumes on mouse leave. It works how I want it to except for one issue.</p>
<p>If I hover in and out of the element too quickly (e.g. by cutting across the corner) it causes some kind of queue build up and everything goes haywire. However when I actually check the queue there's nothing strange in it and the animations are obviously not even running in the queued order.</p>
<p>Using the following code waggle your mouse in and out of the grey area. When you eventually allow the animations to resume they will go haywire (also available at <a href="http://jsfiddle.net/54YTx/" rel="nofollow">http://jsfiddle.net/54YTx/</a>).</p>
<pre><code>$('body').html('<div style="background: lightgrey;">Testing</div>');
function do_animations() {
// Always 0 or 1
console.log($('div').queue('fx').length);
$('div')
.delay(1000)
// Hardcoded numbers mean that resuming from the bottom position takes longer but it doesn't matter in this simple example
.animate({'padding-top': '100px'}, 1000)
.animate({'padding-top': '0px'}, 1000)
// Queue instead of callback so that clearQueue() can stop the loop reliably
.queue(function() {
do_animations();
$('div').dequeue();
});
};
do_animations();
$('div').hover(function() {
// Don't use stop(). We want the current animation to finish
$('div').clearQueue();
}, function() {
do_animations();
});
</code></pre>
| jquery | [5] |
3,688,450 | 3,688,451 | how to check if a space is followed by a certain character? | <p>I am really confused on this regex things. I have tried to understand it, went no where.</p>
<p>Basically, i am trying to replace all spaces followed by every character but a space to be replaced with "PM".</p>
<p>" sd"
" sd"</p>
<p>however</p>
<p>" sd"
" sd"</p>
| java | [1] |
2,857,778 | 2,857,779 | Picking colors through Interface Builder | <p>We have a color defined in a constants.h file like so</p>
<pre><code>#define CUSTOM_ORANGE [UIColor colorWithRed:173/255. green:22/255. blue:35/255. alpha:1.0]
</code></pre>
<p>When I create a UIView in IB and want to change the color to this color, I open up the RGB sliders and set it to those same values of 173, 22, 35 and the color is not the same. Why is that and how can I get my custom color in IB? Thanks.</p>
| iphone | [8] |
2,035,086 | 2,035,087 | navigate to C:Drive via php error | <p>I'm trying to navigate to C drive via PHP on my local drive, this one line of code works fine:</p>
<pre><code><a href='<?php echo'file:///C:\Users\Emily\Documents\'?>' TARGET="_blank" >Clcik Me</a>
</code></pre>
<p>This works fine from my local drive but as soon as this is on my sever it throws an error. I've been trying to strip and replace slashes but to no luck, hope sone one can help me.</p>
| php | [2] |
5,779,672 | 5,779,673 | How to get grandparent directory with PHP | <p>I have a following directory structure.</p>
<pre><code>-webshop
-controllers
-webshop.php
</code></pre>
<p>In webshop.php I want to get webshop which is the grandparent of this file.</p>
<p>If I use the following I think I get 'controllers'.</p>
<pre><code>echo basename(dirname(__FILE__)); // this will get controllers
</code></pre>
<p>How can I get the grandparent directory?</p>
<p>Thanks in advance.</p>
| php | [2] |
5,938,088 | 5,938,089 | New line for input in python | <p>I am very new to Python programming (15 minutes) I wanted to make a simple program that would take an input and then print it back out. This is how my code looks.</p>
<pre><code>Number = raw_input("Enter a number")
print Number
</code></pre>
<p>How can I make it so a new line follows. I read about using \n but when i tried:</p>
<pre><code>Number = raw_input("Enter a number")\n
print Number
</code></pre>
<p>it didn't work. Thanks in advance!</p>
| python | [7] |
2,965,204 | 2,965,205 | what does object.start() mean? | <p>Sorry i am new to C#. I have a program, where there is a class CatchFS. The main function in the class , has the code </p>
<p>CatchFS fs = new CatchFS(args);</p>
<p>fs.Start();</p>
<p>Can someone tell me what it means. I hv heard of thread.start() but object.start() is new to me . Am i even thinking right ?</p>
<p>Thanks a lot, Yes it is derived from a class called FileSysetm.cs. The start does this : public void Start ()
{
Console.WriteLine("start");
Create ();
if (MultiThreaded) {
mfh_fuse_loop_mt (fusep);
}
else {
mfh_fuse_loop (fusep);
}
}</p>
<p>Now im trying to do a fusemount. The program starts and it hangs. there is some call that was not returned and i couldnt figure out which one. I tried using debug option of monodevelop, but no use, it runs only in my main function and I get thread started and thats it !!
I think the file FileSystem.cs is from library Mono.fuse.dll. Thanks for all your time. I hv been looking at this question for 2 whole days, and I dont seem to figureout much as to why the code wont proceed.Im expecting my azure cloud storage to be mounted in this fusemount point. My aim is after running this code I should be able to do an ls on the mountpoint to get list of contents of the cloud storage. I am also suspecting the mountpoint. Thanks a lot for providing me all your inputs. </p>
| c# | [0] |
4,905,326 | 4,905,327 | PHP Function to shorten string to exactly 3 characters | <p>The fact that I don't know how to do this is a good example of how elementary my PHP skills are.</p>
<p>How can I shorten a string <code>$fr_month</code> to 3 characters as a function"<code>short_fr_month()</code>"?</p>
| php | [2] |
5,546,089 | 5,546,090 | Getting function to Know the Insertion of file in a folder | <p>In C# how to know that a file has been inserted into the Folder. I need this in C#.</p>
| c# | [0] |
2,014,527 | 2,014,528 | Android Assetmanager string parsing | <p>I am attempting to parse an xml file referenced by a string using assetmanager, I have had a lot of help thanks to SO and this is what I have so far. </p>
<pre><code>Document doc = db.parse(assetManager.open(Resources.getSystem().getString(R.string.FileName)));
</code></pre>
<p>String filename is my questions.xml file, I'm doing this so ultimately I can enforce localization on my app for multiple xml files. However my app is not able to read R.string.FileName, and errors out the application. Can anyone help me out here? </p>
| android | [4] |
1,901,992 | 1,901,993 | starting text to speech engine from a service? | <p>i have a service from where i am trying to start a TextToSpeech engine ,but it seems that it's not working , so is it possible to start tts from a service?</p>
<p>here's what i've tried:</p>
<pre><code>package com.example.TextSpeaker;
import java.util.Locale;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.speech.tts.TextToSpeech;
import android.speech.tts.TextToSpeech.OnInitListener;
import android.util.Log;
import android.widget.Toast;
public class SpeakerService extends Service implements OnInitListener{
public static TextToSpeech mtts;
@Override
public IBinder onBind(Intent arg0) {
// TODO Auto-generated method stub
return null;
}
@Override
public void onCreate(){
Log.d("SpeakerService","Service created successfully!");
mtts = new TextToSpeech(this,this);
mtts.setLanguage(Locale.ENGLISH);
}
@Override
public void onStart(Intent intent,int startid)
{
Log.d("SpeakerService","Service started successfully!");
Log.d("SpeakerService","Service started successfully!");
Log.d("SpeakerService","tspker.mtts = " + TextSpeaker.mtts.toString());
mtts = new TextToSpeech(this,this);
mtts.setLanguage(Locale.ENGLISH);
mtts.speak(Receiver.str, TextToSpeech.QUEUE_FLUSH,null);
}
@Override
public void onDestroy(){
if(mtts!=null)
{
mtts.stop();
Toast.makeText(getApplicationContext(),"The service has been destroyed!", T oast.LENGTH_SHORT).show();
}
}
@Override
public void onInit(int arg0) {
// TODO Auto-generated method stub
}
}
</code></pre>
| android | [4] |
184,565 | 184,566 | Can I pass parameter from different page? | <p>In PHP it is easy to pass parameter using <code>$_GET[]</code> and <code>$_POST[]</code>. Is there something like that in JavaScript? I hope I can pass parameters from addresses or forms.</p>
| javascript | [3] |
2,321,215 | 2,321,216 | python comparing two matrices | <p>In the below shown matrices i want to match the first element in both the matrices. If the first element is equal then i need match the second element from both the matrices and so on..
if the elements are same then print "same" else print "not same"....</p>
<p>My question is how this in the optimal way also for m*n where m=n always</p>
<pre><code> for i in a1:
for j in a2:
if i!=j:
break
else:
//compare the next corresponding columns and print "same" or "not same"
a1=[1,44,55],[2,33,66],[3,77,91]
a2=[1,44,55],[2,45,66],[3,77,91]
OR
a1=[1,44,55]
[2,33,66]
[3,77,91]
a2=[1,44,55]
[2,45,66]
[3,77,91]
</code></pre>
| python | [7] |
853,669 | 853,670 | How to run my android reminder application running even thought i exit from it | <p>How to run my reminder application in background even if exit from the application.
My reminder application works fine when it is continue,but if i exit from the application it will not show my desired output.So,is there any way to run may application in background OR any service using that i make my application as service OR anything else.</p>
<p>Plz help me</p>
<p>Thanks in Advance...</p>
| android | [4] |
2,973,731 | 2,973,732 | Cutting / splitting strings with Java | <p>I have a string as follows:</p>
<pre><code>2012/02/01,13:27:20,872226816,-1174749184,2136678400,2138578944,-17809408,2147352576
</code></pre>
<p>I want to extract the number: 872226816, so in this case I assume after the second comma start reading the data and then the following comma end the reading of data.</p>
<p>Example output:</p>
<pre><code>872226816
</code></pre>
| java | [1] |
1,474,275 | 1,474,276 | Mastermind game | <p>I'm a beginner in java programming. Now I'm doing a game called mastermind.</p>
<p>It has many conditions and I'm using numbers instead of colours.</p>
<p>I have no idea of how to solve this problem: I'm using if else statement to do my game but if the solution is 4444 and user input is 4444, the output answer is wrong.</p>
<p>In this game the first input is computer generated, but i have to test the program, so i set the number by myself, and the second input is the player input.</p>
<p>Here is the code i've done:</p>
<pre><code>import javax.swing.JOptionPane;
public class asd {
public static void main (String args[]){
int i,j;
int b=0 ,w=0;
String input[] = new String[4];
input[0] = JOptionPane.showInputDialog("input a digit");
input[1] = JOptionPane.showInputDialog("input a digit");
input[2] = JOptionPane.showInputDialog("input a digit");
input[3] = JOptionPane.showInputDialog("input a digit");
String Uinput[] = new String[4];
Uinput[0] = JOptionPane.showInputDialog("input a digit");
Uinput[1] = JOptionPane.showInputDialog("input a digit");
Uinput[2] = JOptionPane.showInputDialog("input a digit");
Uinput[3] = JOptionPane.showInputDialog("input a digit");
for(i=0;i<4;i++){
for(j=0;j<4;j++){
if(i<4){
if(input[i].equals(Uinput[j])){
if(i==j){
b++;
i++;
j=0;
}else{
w++;
}
}
}
}
}
System.out.println("black = "+b+"\nwhite = "+w);
}
}
</code></pre>
| java | [1] |
236,034 | 236,035 | Simple HTML construction in ASP.NET? | <p>A simple question, I think:</p>
<p>I want to put a tag into an ASP.NET app I've been asked to maintain, so I'm coming at this from a newbie point of view just tinkering around the edges without knowing a lot.</p>
<p>I wrote an old ASP application back in 1998, so I am just running on memory...</p>
<p>How do I write some output to the webpage?</p>
<p>I know I can use an </p>
<pre><code><asp:label id="blah">
</code></pre>
<p>but then I need to define a Label blah; in my code behind and then assign it.</p>
<p>I believe that I can put in-place:</p>
<pre><code><% Response.Write("sometext"); %>
</code></pre>
<p>and that will write sometext in the location within the page. (Am I correct?)</p>
<p>Lastly, I remember there was a syntax to the effect of</p>
<pre><code><%= "some string" %>
</code></pre>
<p>but I can't find the documentation on it, to say either it is deprecated, unadvised, or the rationale for such a decision.</p>
<p>I have tried googling for "ASP.NET grammar" but I can't even find a good description that "<%=" even exists, though it is mentioned in a few blogs.</p>
<p>For something simple, like inject the global version number, or the current date, then I can't see anything particularly wrong with in-place composition - it would save me defining 15 labels and having to initialise them all - though perhaps the asp:label approach could reference one global instance of a label?</p>
<p>Just asking for opinions on good practices :)</p>
| asp.net | [9] |
3,243,235 | 3,243,236 | How to position the TextView from code? | <p>Is it possible to place the <code>TextView</code> in some position which I calculate within my code.<br>
I have the x and y position with me (which i get after the calculation) and I just want to place the <code>TextView</code> in that position. </p>
<p>How can i implement it?<br>
Please Help.</p>
<p>Thanks,<br>
Sen </p>
| android | [4] |
4,986,328 | 4,986,329 | CSS in Master and regular pages | <p>I have some pages that use the master page and apply a theme. Some of my pages are not using master pages, instead they have individual css files linked</p>
<pre><code><link href="../Style/pck.css" rel="stylesheet" type="text/css" />
</code></pre>
<p>Although the css works for regular pages for most cases, the body css is taken from the theme. I do not want that. I want that the body css should be taken from pck.css.</p>
<p>What to do?</p>
| asp.net | [9] |
1,238,342 | 1,238,343 | HTTPS In Android | <p>I have implemented HTTP Post to post data to the backend. How do I implement HTTPS in Android (I have already configured the backend for https)? </p>
<p>I googled and found some solutions:
<a href="http://stackoverflow.com/questions/2253061/secure-http-post-in-android">Secure HTTP Post in Android</a> </p>
<p>and tried them but I do not receive any data in the backend. </p>
<p>Is it the correct way to implement? Is there any other method?</p>
<p>Below is my code snippet:</p>
<pre><code> File file = new File(filepath);
HttpClient client = new DefaultHttpClient();
//String url = "http://test.....;
String url = "https://test......";
HttpPost post = new HttpPost(url);
FileEntity bin = new FileEntity(file, url);
post.setEntity(bin);
HttpResponse response = client.execute(post);
HttpEntity resEntity = response.getEntity();
</code></pre>
<p>Basically I am using fileentity to do a HTTPPost. Now I want to do this over https. After implementing https over at the backend I just modified http to https in the url and tested again. And it is not working.</p>
<p>Any idea how do i resolve this?</p>
<p>Thanks In Advance,
Perumal</p>
| android | [4] |
1,463,476 | 1,463,477 | how to convert utf-8 to ASCII in c++? | <p>i am getting response from server in utf-8 but not able to read that.
how to convert utf-8 to ASCII in c++?</p>
| c++ | [6] |
2,448,901 | 2,448,902 | Resuming of activity if alive | <p>I have 2 activities<br>
1. <strong>activity1</strong><br>
2. <strong>activity2</strong></p>
<p><strong>activity1</strong> is running. On an event from <strong>activity1</strong>, I wanted to switch to <strong>activtiy2</strong> </p>
<p>The conditions are </p>
<p>1.create new activity and run if <strong>activity2</strong> is not alive.<br>
2.Resume <strong>activity2</strong> if it is alive</p>
<p>In both cases it should not close <strong>activity1</strong></p>
<p>How to achieve this requirement.</p>
| android | [4] |
3,592,463 | 3,592,464 | How to release resources? | <p>I'm a beginner in android.Now am developing a game in android where i need to release all the resources on a button click as the game comes to an end..How to do that? </p>
| android | [4] |
133,959 | 133,960 | Implementing Serialization in a Class that contains an ArrayList | <p>I'm trying to serlialize a class I created, it's not working and for some reason I can't see the entire exception when I try to log it (in android), but that's not important...</p>
<p>I have a suspicion what it might be...</p>
<p>I haven't done java programming in many years... but now I seem to remember perhaps serialization is not completely automatic?</p>
<p>could someone please tell me what I have to do? point me in the right direction?</p>
<p>I have a class AccountList, I implemented serializable... it contains an arraylist of class Account ... I implemented serializable on AccountList and Account.. I mean just declared "implements Serializable"</p>
<p>but now I think I vaguely remember that if there is something like arraylist inside this AccountList class, then I must actually write some serialization code by overriding some methods in AccountList ?</p>
<p>what should I do?</p>
| java | [1] |
1,580,491 | 1,580,492 | How can I initialize a default value in C#? | <p>I want to have a default value for a boolean <code>crossover</code> of <code>false</code><br>
How can I initialize it?</p>
<pre><code>public class DecisionBar
{
public DateTime bartime
{ get; set; }
public string frequency
{ get; set; }
public bool HH7
{get;set;}
public bool crossover
{get;set;}
public double mfe
{get;set;}
public double mae
{get;set;}
public double entryPointLong
{get;set;}
public double entryPointShort
{get;set;}
}
</code></pre>
| c# | [0] |
2,121,910 | 2,121,911 | Specific php document for a page | <p>I'm Doing a site with some content that can be updated by Wordpress, but, It would be a lot times if I could write a php document for one page and other php document for another page, Like front-page.php. Is it somehow possible?</p>
<p>Thanks a lot in advance.</p>
| php | [2] |
2,372,322 | 2,372,323 | C#: Initialising member variables to be exposed via properties | <p>I have just written a small piece of code and it struck me that I am not sure what method of initialisation is best practice when it comes to initialising my member variables which will be exposed and used via properties. Which is the best way to initialise my member variables out of the two examples below and more importantly <strong>why</strong>?</p>
<p><strong>Example 1:</strong></p>
<pre><code> private string m_connectionString = ConfigurationManager.ConnectionStrings["ApplicationDefault"].ConnectionString;
private string m_providerName = ConfigurationManager.ConnectionStrings["ApplicationDefault"].ProviderName;
public string ConnectionString
{
get { return m_connectionString; }
set { m_connectionString = value; }
}
public string ProviderName
{
get { return m_providerName; }
set { m_providerName = value; }
}
public EntityClusterRefreshServiceDatabaseWorker()
{
}
</code></pre>
<p><strong>Example 2:</strong></p>
<pre><code> private string m_connectionString;
private string m_providerName;
public string ConnectionString
{
get { return m_connectionString; }
set { m_connectionString = value; }
}
public string ProviderName
{
get { return m_providerName; }
set { m_providerName = value; }
}
public EntityClusterRefreshServiceDatabaseWorker()
{
ConnectionString = ConfigurationManager.ConnectionStrings["ApplicationDefault"].ConnectionString;
ProviderName = ConfigurationManager.ConnectionStrings["ApplicationDefault"].ProviderName;
}
</code></pre>
<p>NOTE: Assume that I am not using these variables in a static context. </p>
| c# | [0] |
1,863,527 | 1,863,528 | Reading from files and comparing their data | <p>I'm trying to create a program that will read from a file (which I've already created). </p>
<p>The program then has to compare the aforementioned file with another file (which again, I have). </p>
<p>Could someone assist me with this? I've already created the part in which the first file has to be read. Also, I'm using a console application, if that helps. </p>
| c# | [0] |
663,874 | 663,875 | Ouput stuff while php script is running | <p>So I just created a script to resize a whole bunch of images. <strong>Is there anyway to have there be output as its running through the loop?</strong> </p>
<p>Basically I have like 400 photos in photo db table. Its gathering a list of all these photos, then looping through each one and resizing it 3 times. (large,medium,small version). </p>
<p>Right now on each loop I am echoing that images results, but I dont see the results untill EVERYTHING is done. So like 10 minutes later, I will get output. I added this set_time_limit(0); to make sure it doesnt time out.</p>
<p>*<em>EDIT *</em> It looks like every so often the script actually updates to the browser, maybe every 30 seconds?</p>
| php | [2] |
3,660,354 | 3,660,355 | How to get ISO 3166-1 compatible country code? | <p>I am working on displaying list of timezones by country name.</p>
<p>As answered here:
<a href="http://stackoverflow.com/questions/2826419/country-to-timezones-in-php-zend-framework">Country to timezones in PHP/Zend Framework</a></p>
<p>I am thinkig to call <code>DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, 'US')</code> to list all timezones by country.</p>
<p>Is there any easy way to get list of ISO 3166-1 compatible country codes and their corresponding names in PHP(PHP 5.3)?</p>
| php | [2] |
5,641,088 | 5,641,089 | jquery help getting my id | <p>i have 2 simple links on my page. how do i use jQuery to get the id's or values of those links?</p>
<p>thanks,
rodchar</p>
| jquery | [5] |
1,222,372 | 1,222,373 | How do I see every method called when I run my application in the iPhone Simulator? | <p>I would really like to see <strong>every</strong> method, delegate, notification, etc. which is called / sent while I run my app in the iPhone Simulator. I thought the right place for this would be in the debugger, but I can't find the right setting. </p>
<p>My target is to see all that is happening in the background while I, for example, add a row to a UITableView or push the 'back'-button from my UINavigationController.</p>
<p>This would be a big help to figure out what delegate to use when something in the app is happening or when the user is pushing a button, changing a view, etc.</p>
<p>Is it possible to get this information?</p>
| iphone | [8] |
3,086,248 | 3,086,249 | Why Object#hashCode() returns int instead of long | <p>why not:</p>
<pre><code>public native long hashCode();
</code></pre>
<p>instead of: </p>
<pre><code>public native int hashCode();
</code></pre>
<p>for higher chance of achieving unique hash codes?</p>
| java | [1] |
106,353 | 106,354 | Querystring data gets truncated | <p>When I check "view source > frame info" on the window produced by the jQuery code below, it cuts off the querystring at the &type=image. I'm url encoding the ampersands properly, right?</p>
<pre><code>Address: ...wp-admin/media-upload.php?post_id=28&type=image&
function wpe_customImages($initcontext)
{
global $post;
?>
<script type="text/javascript">
jQuery(document).ready(function() {
var fileInput = '';
jQuery('#wpe-uploadAttachments').click(function() {
fileInput = jQuery(this).prev('input');
formfield = jQuery('#upload_image').attr('name');
post_id = jQuery('#post_ID').val();
tb_show('', 'media-upload.php?post_id='+post_id+'&amp;type=image&amp;TB_iframe=true&amp;wpe_idCustomAttachment=true');
return false;
});
</code></pre>
| jquery | [5] |
2,524,647 | 2,524,648 | Scaling Android Canvas 2D graphics for different devices | <p>I asked a similar question to this awhile back and got zero responses, so I'm going to try rephrasing it . . . </p>
<p>What is "best practice" for ensuring that the 2D drawing primitives in the Canvas class scale properly for different devices (phones with different screen resolutions)? Are they supposed to scale automatically? Is there a way to scale the whole canvas? Am I supposed to detect the size and do my own scaling as I draw each line, circle and point individually? Am I supposed to do it by manipulating the View? Or what?</p>
<p>The goal is to make sure the graphics fill up the screen to take full advantage of the available resolution, but don't overflow it.</p>
<p>Thanks in advance! </p>
| android | [4] |
4,387,444 | 4,387,445 | How to Encyrpt Session Values in Android | <p>I'm developing an Android app which based on a web-server. Users, who installed the app, should register on web, so they can login. When someone try to login I verify their information with <code>API</code>.</p>
<p>So I'm curious about persisting and <strong>encryption processes</strong>. Should I encrypt the values or just put them all to <code>SharedPreferences</code>? If encryption is needed what's the efficient way?</p>
<p>And last but not least, Is SharedPreferences enough in terms of security?</p>
<p>Thanks.</p>
| android | [4] |
5,408,766 | 5,408,767 | VisualBasic Convert.FromBase64String equivalent on PHP | <p>I would like to know the VisualBasic Convert.FromBase64String equivalent on PHP.</p>
<p>Thanks.</p>
| php | [2] |
5,113,075 | 5,113,076 | move content from one hidden div to another displayed div | <p>how do i move content from one hidden div to another displayed div using jquery?</p>
<p>say i have div1 with display style is none and another div "div2" with display style block.</p>
<p>how do I move the content from div1 to div2 and clear div1?</p>
| jquery | [5] |
2,735,588 | 2,735,589 | python - Letter Count Dict | <p>Write a Python function called <code>LetterCount()</code> which takes a string as an argument and returns a dictionary of letter counts. </p>
<p>The line:</p>
<pre><code>print LetterCount("Abracadabra, Monsignor")
</code></pre>
<p>Should produce the output:</p>
<pre><code>{'a': 5, 'c': 1, 'b': 2, 'd': 1, 'g': 1, 'i': 1, 'm': 1, 'o': 2, 'n': 2, 's': 1, 'r': 3}
</code></pre>
<p>I tried:</p>
<pre><code>import collections
c = collections.Counter('Abracadabra, Monsignor')
print c
print list(c.elements())
</code></pre>
<p>the answer I am getting looks like this</p>
<pre><code>{'a': 4, 'r': 3, 'b': 2, 'o': 2, 'n': 2, 'A': 1, 'c: 1, 'd': 1, 'g': 1, ' ':1, 'i':1, 'M':1 ',':1's': 1, }
['A', 'a','a','a','a','c','b','b','d','g', and so on
</code></pre>
<p>okay now with this code
import collections
c = collections.Counter('Abracadabra, Monsignor'.lower())</p>
<p>print c
am getting this
{'a': 5, 'r': 3, 'b': 2, 'o': 2, 'n': 2, 'c: 1, 'd': 1, 'g': 1, ' ':1, 'i':1, ',':1's': 1, }</p>
<p>but answer should be this
{'a': 5, 'c': 1, 'b': 2, 'd': 1, 'g': 1, 'i': 1, 'm': 1, 'o': 2, 'n': 2, 's': 1, 'r': 3}</p>
| python | [7] |
4,753,146 | 4,753,147 | Setting LinkButton Title in ASP.Net Wizard Sidebar Template | <p>Playing around with customizing the appearance of the Wizard control in ASP.Net, and I've found out how to disable the sidebar buttons using the SideBarTemplate and catching the OnItemDataBound event. All pretty easy. What I want to do now is to modify the text of the rendered LinkButton to prefix the step name with something like ">>" for the current step.</p>
<p>So, in my ItemDataBound event handler for the SideBarList, I have the following code:</p>
<pre><code> Dim stepCurrent As WizardStep = e.Item.DataItem
Dim linkCurrent As LinkButton = e.Item.FindControl("SideBarButton")
If Not stepCurrent Is Nothing Then
Trace.Write("SideBar", "Current Step = " & stepCurrent.Wizard.ActiveStep.Name)
Trace.Write("Sidebar", "Link Button = " & linkCurrent.Text)
linkCurrent.Enabled = False
If stepCurrent.Wizard.ActiveStepIndex = e.Item.ItemIndex Then
linkCurrent.Style.Add(HtmlTextWriterStyle.Color, "#000000")
linkCurrent.Style.Add(HtmlTextWriterStyle.FontWeight, "bold")
linkCurrent.Text.Insert(0, ">> ")
End If
End If
</code></pre>
<p>However, what I find is the trace output is showing an empty string for the lunkbutton text, but the style changes work.</p>
<p>Am I trying to set the text in the wrong place?</p>
<p>Thanks</p>
| asp.net | [9] |
1,410,567 | 1,410,568 | Audio Recording and Playback – Internal storage | <p>I’m working on an app that needs to record and playback several audio files. I’d like to organize them into subdirectories under the “../files” folder as follows. ( I’ve successfully done this onto external storage. but need to allow devices with no External storage.)</p>
<pre><code>../files/TopicA
Note1.3gp
Note2.3gp
Note3.3gp
../files/TopicB
Note1.3gp
Note2.3gp
Note3.3gp
</code></pre>
<p>I can successufully record the files, but cannot play them back. This seems to be due to the requirent of MediaPlayer needing the Files to be WORLD_READABLE. How can make the .3gp files WORLD_READABLE? (I'm using MediaRecorder to create the files)</p>
<p>I tried using openFileOutput() to copy the files and make the new file WORLD_READABLE but that does not seem to work with subdirectories. I want to keep my target base as 2.1 so i can't use the function setReadable() to change the mode.</p>
<p>Any Suggestions?</p>
| android | [4] |
5,655,366 | 5,655,367 | Combine overlapping urls in C# | <p>I've got two Urls. A server and a relative url that I would like to combine. The problem is that part of the url's may well overlap. I've done this using some horrible string manipulation but would like to put this out there and see if there is a nice and clean way of doing it.</p>
<pre><code>string siteUrl = "http://seed-dev6/sites/irs";
string formUrl = "/sites/irs/Forms/testform.xsn";
</code></pre>
| c# | [0] |
5,549,825 | 5,549,826 | Does int.Parse uses boxing/unboxing or type casting in C#? | <p>What happens when i say </p>
<pre><code> int a = int.Parse("100");
</code></pre>
<p>is there any boxing/unboxung or type casting happening inside the Prse method?</p>
| c# | [0] |
2,906,726 | 2,906,727 | How to Program another page on buttons in eclipse? | <p>I have programmed a few buttons on my main.xml and in my java.
But what I want to know is that lets say I tap the button it brings me to another page of buttons.
How do I program those buttons?
I tried creating another java but that will not work.</p>
| android | [4] |
5,006,783 | 5,006,784 | iPhone: UITableView delegate is alive after viewController was released | <p>My ViewController1 pushes ViewController2</p>
<pre><code>ViewController2 *controller =
[[ViewController2 alloc] init];
[self.navigationController pushViewController:controller
animated:NO];
[controller release];
</code></pre>
<p>ViewController2 has UITableView ... in xib file I connected delegate with File's Owner. Also ViewController2 has Done button </p>
<pre><code>- (IBAction)doneButtonPressed {
[self.navigationController popViewControllerAnimated:NO];
}
</code></pre>
<p>The problem is that if to click table rows and done button at the same time, sometimes didSelectRowAtIndexPath: method calls after that ViewController2 was popped, and I have SIGABRT error and this thing in logger :</p>
<pre><code>[__NSCFSet tableView:didSelectRowAtIndexPath:]: unrecognized selector sent to instance 0x62579d0'
</code></pre>
<p>So how tableView:didSelectRowAtIndexPath can be called after I popped viewController2 ? It should be dead...</p>
| iphone | [8] |
94,418 | 94,419 | jquery - Observing an iFrame Body's scroll high and expanding to prevent a scroll bar? | <p>i have an iframe which can grow inside of the top window.</p>
<p>I would like to prevent the iframe from having a scroll bar by growing the height of the iframe to as it grows, thus preventing a vertical scrollbar. Possible?</p>
| jquery | [5] |
4,652,556 | 4,652,557 | what are the other equivalent librarys of C++ qt | <p>What are the other equivalent libraries of C++ Qt ?
If anybody has used please share your experience with this community.
If anybody knows altrenative please let us know yourr experience with these libraries</p>
| c++ | [6] |
1,513,037 | 1,513,038 | Main layout doesn't catch onTouchListener | <p>I have implemented for my layout onTouchListener like</p>
<pre><code>layout.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
gdt.onTouchEvent(event);
return true;
}
});
</code></pre>
<p>where I call SimpleOnGestureListener onFling. Problem is that I have inside layout other widgets and I cannot catch with this when you swipe over that widgets. I am trying to implement swipe changing but this main layout doesn't catch when I swipe over big nested widget inside(multiselect list). What to do ?</p>
| android | [4] |
55,043 | 55,044 | Initializing on declaration vs initializing in constructors | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3918578/should-i-initialize-variable-within-constructor-or-outside-constructor">Should I initialize variable within constructor or outside constructor</a> </p>
</blockquote>
<p>I was wondering, which is a better practice and why. Should I initialize class fields upon declaration, or should I do it in the constructor? Given that it's a simple one-line initialization.</p>
<pre><code>class Dude
{
String name = "El duderino";
Dude() {
// irrelevant code
}
}
</code></pre>
<p>vs.</p>
<pre><code>class Dude
{
String name;
Dude() {
name = "El duderino";
// irrelevant code
}
}
</code></pre>
<p><strong>Edit:</strong> I am aware of the situations where one of the styles would be preferred over the other like in the case of executing initializer code that might throw an exception. What I'm talking about here are cases when both styles are absolutely equivalent. Both ways would accomplish the same task. Which should I use then?</p>
| java | [1] |
1,515,306 | 1,515,307 | remove attribute from all tags by class name | <p>I have a form with labels styled as class="input"</p>
<p>The labels are positioned inside the form fields, and they are designed to disappear when you type in the field. That is working fine. The problem is when I reset the form after it is submitted. </p>
<pre><code>jQuery("#requestform").get(0).reset();
</code></pre>
<p>This statement will clear the fields, but I also need to remove the "visibility: hidden" attribute from the labels so the labels will reappear.</p>
<p>I tried this, but it didn't work:</p>
<pre><code>jQuery('.formlabel').removeAttr("visibility");
</code></pre>
<p>here's some sample html from my page:</p>
<pre><code><label class="input">
<span class="formlabel" style="color: rgb(153, 153, 153); visibility: hidden;">Email</span>
<input type="text" id="email" name="email" title="email">
</label>
</code></pre>
<p>what's wrong with my jQuery? what's the correct way to remove all 'visiblity' attributes from all my class="formlabel" tags?</p>
<p>Cheers!</p>
| jquery | [5] |
1,699,683 | 1,699,684 | how to solve issue when keyboard is getting displayed, keyboard hides the tab bar | <p>when keyboard is getting displayed, keyboard hides the tab bar. How to change the position for keyboard? I want to do similar to skype app calling screen.</p>
<p>I want to display simple keyboard on my tab bar from bottom i have found lots of links and explanation on adding toolbar & tab bar on top of keyboard please help to solve this ASAP i need it urgently to solve this issue </p>
| iphone | [8] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.