Unnamed: 0 int64 65 6.03M | Id int64 66 6.03M | Title stringlengths 10 191 | input stringlengths 23 4.18k | output stringclasses 10 values | Tag_Number stringclasses 10 values |
|---|---|---|---|---|---|
1,025,887 | 1,025,888 | Writing a code using function | <p>I want help in writing a program using function and string where the user inputs the text and output each word in the text and how many times it is repeated beside it.</p>
<p>Example:</p>
<pre><code>cout<< " Enter the text";
cin>> Hello this is a test 1. Hello this is a test 2.;
cout<<
hello 2
this 2
is 2
a 2
test 2
1 1
2 1
</code></pre>
<hr>
<p>Thankx in advance</p>
| c++ | [6] |
3,136,962 | 3,136,963 | Re-doing the completed tasks when taking the background application | <p>I'm having a searching app, which will search the different restaurants nearby.</p>
<p>In ICS based smartphones,</p>
<ol>
<li>I've launched my app and start searching a keyword at a particular location.</li>
<li>Result was shown correctly</li>
<li>Now i pressed the home button(without exiting the app) to move the app to background.</li>
<li>I've launched different application and move some of them to background.</li>
<li>Now i re-launched my app.</li>
<li>It started researching the previous keyword!! (as this is a completed task)</li>
</ol>
<p><strong>I just want to disable the auto search when coming from background in ICS phones</strong>.</p>
<p>Note:
This is not happening in the prev. android versions(eg: droid phones).</p>
<p>Thanks in Advance!!</p>
| android | [4] |
1,463,950 | 1,463,951 | How to send array as argument? | <p>I want to use subprocess to open an application. However the amount of argument is not fixed. What's the best way to approach this?</p>
<pre><code>subprocess.call( "path/to/app", arg[0], arg[1], arg... )
</code></pre>
<p>minimum arg[] is 1 but it can get as large and 10 or 20. What's the best way to send them to aubprocess's argument in this case?</p>
| python | [7] |
2,691,835 | 2,691,836 | java variable declaration | <p>what the below code line does in java.</p>
<pre><code>private static final String PERMISSIONS_KEY = BaseActionStepsHandler.class.getName() + ".USER.ROLES";
</code></pre>
<p>Note:</p>
<p><code>BaseActionStepsHandler</code> is java class,and it is extended in another java class
<code>InvConfirmActionStepsHandler</code> .
The above code is declared in <code>BaseActionStepsHandler.java</code> and it is
called in <code>InvConfirmActionStepsHandler</code> class like below</p>
<pre><code>private static final String PERMISSIONS_KEY = BaseActionStepsHandler.class.getName() + ".USER.ROLES";
</code></pre>
<p>what does it mean.?? </p>
| java | [1] |
5,205,025 | 5,205,026 | Shared preferences gets wiped out, when do you use it then? | <p>I always try to avoid using shared preferences for storage in my app for the followinng reasons:</p>
<ul>
<li>It gets wiped out on device reboot</li>
<li>It gets wiped out when cache data is cleared</li>
<li>It gets wiped out on force exit (through task manager)</li>
</ul>
<p>Which makes me to always resort to internal storage (I/O). However, I see that many people in SO use shared preferences or recommend shared preferences for each other. Am I missing the point here? In particular, when do you use Shared PReferences?</p>
<p>Thanks you</p>
| android | [4] |
3,635,538 | 3,635,539 | jQuery row changing and IDs | <p>I've looked all over for this but haven't had much luck. </p>
<p>So given this code:</p>
<pre><code>$("span[id*=Section]").click(function(){
var row = $(this).parents("tr.MoveableRow:first");
if ($(this).is(".up_button")) {
row.insertBefore(row.prev());
section = this.id;
$("input[name='" + section + "']").val(row.closest("tr").prevAll("tr").length + 1);
} else {
row.insertAfter(row.next());
section = this.id;
$("input[name='" + section + "']").val(row.closest("tr").prevAll("tr").length + 1);
}
});
</code></pre>
<p>Currently, when clicking on the up/down button, the TR moves up or down as expected. The "input[name=" part takes the passed in value of the span ID and assigns the new value to a hidden fields within that TR.</p>
<p>What this ends up doing though is giving me duplicate IDs. So for example, I move row 2 up to row 1. The old row 2's hidden input value becomes 1, but the original 1's hidden input is also 1.</p>
<p>So what I need to be able to do is make the old 1, the new 2.</p>
| jquery | [5] |
3,930,181 | 3,930,182 | How to capture finger movement direction in android phone? | <p>I want to capture the finger movement direction on Android touch phone. If a user slides his finger in up/down/left/right direction, I want to capture this direction. How can I find this? Thanks.</p>
| android | [4] |
3,431,343 | 3,431,344 | Javascript Detect 'Shift' Key Down Within Another Function | <p>I am calling a Javascript function in my html page from a Flash movie (using ExternalInterface) and I want to know if the user has the Shift key down when the function is called.</p>
<p>It seems straight forward if, for example, I call the function from a mouse click because I can pass the event and check 'if (event.shiftKey)'. I don't have an event to check!</p>
<p>Many thanks</p>
<p>Chris</p>
| javascript | [3] |
3,860,289 | 3,860,290 | Is this code is working in Windows 7 environment using pywinauto | <p>I have tried with opening the media player in Win7 using python</p>
<pre><code>from pywinauto.application import *
app=Application.Start("C:\Program Files\Windows Media Player\wmplayer.exe")
app.window_(title="Windows Media player")
app.WindowsMediaplayer.MenuSelect("Help->About Windows Media Player")
</code></pre>
<p>Only player is launching but I want Help window</p>
| python | [7] |
87,696 | 87,697 | Call ASP.NET 2.0 Server side code from Javascript | <p>I'm struggling with this for the past 3 days. I need to call asp.net serverside code from Javascript when the user closes the browser. I'm using the following code to accomplish this. In my asp.net form I have various validation controls. Even if there are some validation errors, When I close the form the server side code works perfectly in my development box(windows 7). But the same code doesnt work in my production environment(windows server).</p>
<p>Does it have something to do with the Validation summary or Validation controls. The button control has Causes validation set to false. So even if there is a validation error still my form will post back. Am I correct? I suspect the form is not getting post back to the server when there is a validation error. But i'm disabling all the validation controls in the javascript before calling the button click event. Can someone throw some light on this issue. </p>
<p>There are few blogs which suggests to use JQUERY, AJAX (Pagemethods and script manager). </p>
<pre><code> function ConfirmClose(e) {
var evtobj = window.event ? event : e;
if (evtobj == e) {
//firefox
if (!evtobj.clientY) {
evtobj.returnValue = message;
}
}
else {
//IE
if (evtobj.clientY < 0) {
DisablePageValidators();
document.getElementById('<%# buttonBrowserCloseClick.ClientID %>').click();
}
}
}
function DisablePageValidators() {
if ((typeof (Page_Validators) != "undefined") && (Page_Validators != null)) {
var i;
for (i = 0; i < Page_Validators.length; i++) {
ValidatorEnable(Page_Validators[i], false);
}
}
}
//HTML
<div style="display:none" >
<asp:Button ID="buttonBrowserCloseClick" runat="server"
onclick="buttonBrowserCloseClick_Click" Text="Button"
Width="141px" CausesValidation="False" />
//Server Code
protected void buttonBrowserCloseClick_Click(object sender, EventArgs e)
{
//Some C# code goes here
}
</code></pre>
| asp.net | [9] |
3,562,858 | 3,562,859 | C++ code using stack | <p>I am writing a program that is a simple expression checker. All the program is to do is to check if a given input by the user is well-formed or not. I have three files I am woring with. I will post portions of each below. My question is in the main.cpp under case one if I have it coded right. I'm new to stacks and am not sure if I coded it correctly on what I want to happen. Just in case the code is to get an expression followed by a : and if the input is <code>'('</code> then push on to stack and if answer is <code>)'</code> then get top and compare to see if they are pairs. Then output if the expression is well-formed or not. Thanks.</p>
<p>Here is the code:</p>
<p>main.cpp</p>
<pre><code>switch (choice){
case 1:
cout << "Current Setting: () " << endl;
cout << "Enter your expression followed by a ; : " << endl;
do {
cin >> answer;
if (answer = '(')
stack.push( '(' );
else
if (answer = ')' )
(stack.top() == '(')
while (answer != ';');
</code></pre>
<p>Stack.h</p>
<pre><code>elemType top(void) const;
// precondition: this stack is not empty
// returns top element in this stack
// transformers
void push(const elemType& item);
// precondition: this stack is not full
// adds item to this stack
void pop(void);
// removes top element from this stack if exist
// remains empty otherwise
</code></pre>
| c++ | [6] |
5,212,996 | 5,212,997 | how do I specify the timezone on a DateFormat string? | <p>I'm trying to specify the timezone on a string that I am passing to <code>DateFormat.parse</code>. We're currently using .net framework 2.0. Current code is</p>
<pre><code>DateTimeFormatInfo DATE_FORMAT = CultureInfo.CurrentCulture.DateTimeFormat;
DateTime first = DateTime.Parse("Wed, 31 Oct 2007 8:00:00 -5", DATE_FORMAT);
</code></pre>
<p>But then when I do <code>first.ToString("r")</code>, the result is </p>
<pre><code>Wed, 31 Oct 2007 09:00:00 GMT
</code></pre>
<p>What am I doing wrong? I also tried using <code>DateTime.SpecifyKind</code> method to set my DateTime object's Kind to Local, but it seems like you would need to specify the kind as local before you parse the string, if the timezone is part of the string.</p>
<p>My local timezone is EDT, that's what I'm ultimately trying to get this date to.</p>
<p>Edit - our solution:</p>
<p>input : </p>
<pre><code>DateTime first = DateTime.SpecifyKind(DateTime.Parse("OCT 31, 2007 8:00 AM", DATE_FORMAT), DateTimeKind.Local);
</code></pre>
<p>output : </p>
<pre><code>first.ToLocalTime().ToString("our format")
</code></pre>
<p>Still haven't found a way to get time zone abbreviation, like 'EDT'.</p>
| c# | [0] |
2,766,420 | 2,766,421 | Disable warning/error beep when changing focus | <p>Whenever I change the focus from one textbox to another it plays an irritating warning/error beep.</p>
<p>Example:</p>
<pre><code>public void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)Keys.Return)
textBox2.Focus();
}
</code></pre>
<p>whenever I press <strong>Enter</strong> it changes the focus to textBox2 and gives the warning beep.</p>
<p>Any help to disable this would be appreciated.
Thank you.</p>
| c# | [0] |
3,337,224 | 3,337,225 | Function does not return correct resource | <p>Guys, hi. I have this fuctions:</p>
<pre>
function query_dp($sql){
$link = mysql_connect('localhost', $bd_id, $bd_pass);
mysql_select_db("$bd");
if (!$link) {
die('Could not connect: ' . mysql_error());
}
return mysql_query($sql) or die(mysql_error());
mysql_close($link);
}
?>
</pre>
<p>In the main program, when i try to do:</p>
<pre>
echo mysql_num_rows(query_db($sql));
</pre>
<p>I get as return</p>
<pre>
1
</pre>
<p>When I do not encapsulate that code in a function and use it directly to the main program, i get the number of rows fetched.</p>
<p>The function is not returning a Resource but a... integer? WTF?</p>
<p>Any help would be greatly appreciated!</p>
<p>Thanks!!</p>
| php | [2] |
4,334,974 | 4,334,975 | The field JsonHttpParser.jsonFactory is not visible | <p>Im developing an application that simply shows the nearby places to my location and i have implemented the map layout and got my location. i have used this blog <a href="http://ddewaele.blogspot.com/2011/05/introducing-google-places-api.html" rel="nofollow">http://ddewaele.blogspot.com/2011/05/introducing-google-places-api.html</a></p>
<p>in order to retrieve the places nearby but there is one problem i cant solve in this method </p>
<p>private static final HttpTransport transport = AndroidHttp
.newCompatibleTransport();
public static HttpRequestFactory createRequestFactory(final HttpTransport transport) {</p>
<pre><code> return transport.createRequestFactory(new HttpRequestInitializer() {
public void initialize(HttpRequest request) {
GoogleHeaders headers = new GoogleHeaders();
headers.setApplicationName("Google-Places-DemoApp");
request.setHeaders(headers);
JsonHttpParser parser = new JsonHttpParser();
parser.jsonFactory = new JacksonFactory();
request.addParser(parser);
}
});
}
</code></pre>
<p>which simply does open an http connection to execute the search url </p>
<p>the problem is that at parser.jsonFactory = new JacksonFactory(); eclipse tell me that The field JsonHttpParser.jsonFactory is not visible. how can i solve this issue knowing that i have imported all necessary external jars.</p>
<p>Thank you </p>
| android | [4] |
57,061 | 57,062 | jQuery list navigation | <p>I require some help creating a navigation bar in jQuery, If you check out the JS fiddle you should understand what effect I am trying to get. I've got it doing what I want apart from when you press on a dublink (I don't want it to slide up when a sublink is clicked)</p>
<p>Cheers for any help</p>
| jquery | [5] |
1,376,205 | 1,376,206 | How to return string from activity started for result | <p>I have started Activity for result, but how to return string like parameter from that activity ?</p>
| android | [4] |
12,878 | 12,879 | Pass value from page to a Jquery POpUp? | <p>I have a Jquery POpup which calls a page internally .Page has a bound repeater on that.I need to acess the Page's repeater from the popup.How to acheive this?</p>
<p>Thanks</p>
| jquery | [5] |
3,512,820 | 3,512,821 | NTLM: How to determine if a machine account is a member of security group | <p>Is there an easy way in .NET code to determine if particular machine account (e.g. MYSERVER001$) is a member of an NT security group? I would also like to do the same check for an NT user or an NT group (check whether they belong to a particular group)</p>
| c# | [0] |
4,684,648 | 4,684,649 | Python: Importing Module | <p>Lets say i have a python model fibo.py defined as below:</p>
<pre><code>#Fibonacci numbers module
print "This is a statement"
def fib(n):
a,b = 0,1
while b < n:
print b
a, b = b, a+b
def fib2(n):
a,b = 0,1
result= []
while(b < n):
result.append(b)
a, b = b, a+b
return result
</code></pre>
<p>In my interpreter session, I do the following:</p>
<pre><code>>> import fibo
This is a statement
>>> fibo.fib(10)
1
1
2
3
5
8
>>> fibo.fib2(10)
[1, 1, 2, 3, 5, 8]
>>> fibo.__name__
'fibo'
>>>
</code></pre>
<p>So far so good..restart the interpreter:</p>
<pre><code>>>> from fibo import fib,fib2
This is a statement
>>> fibo.__name__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'fibo' is not defined
>>>
</code></pre>
<p>I expected the error as I have only imported fib and fib2. But I don't understand why the statement was printed when I only imported fib and fib2.</p>
<p>Secondly if I change the module as:</p>
<pre><code>#Fibonacci numbers module
print "This is a statement"
print __name__
</code></pre>
<p>What should be the expected result?</p>
| python | [7] |
131,224 | 131,225 | How to make a auto click on a webpage onload? | <p>I have a webpage. I want to write a javasript function that will make the html page as a huge excel sheet and put a place holder on a particular row and column. Thus on loading the webpage the place holder will be called by the function and a auto click will be made on that particular row and column. </p>
<p>Does anyone know how to code this function?</p>
<p>I can provide the raw script of the webpage if asked.</p>
<p>Thanks. </p>
| javascript | [3] |
4,056,202 | 4,056,203 | Dialer app formats '+01' and '+07' to '+1' and '+7' on being typed | <p>In Android dialpad, when we type a number starting with '+01' or '+07', the edittext shows '+1'(instead of +01) and '+7'(instead of +7), ie, it automatically formats the number.</p>
<p>Any idea why this is happening?</p>
<p>Is this due to any country code formatting?</p>
| android | [4] |
1,014,035 | 1,014,036 | Python smtplib error .pyc saved after running | <pre><code>import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email import encoders
import os
Traceback (most recent call last):
File "C:\Users\user Account\Desktop\email.py", line 1, in <module>
import smtplib
File "C:\Python27\lib\smtplib.py", line 46, in <module>
import email.utils
File "C:\Users\user Account\Desktop\email.py", line 2, in <module>
from email.MIMEMultipart import MIMEMultipart
ImportError: No module named MIMEMultipart
</code></pre>
<p>Why is this happening? When I import smtplib via the python sell, I have no issues!</p>
<p>A second copy, .pyc, is saved to the directory of the file and it spits of this error.</p>
| python | [7] |
4,160,514 | 4,160,515 | Android getting phone while playing video using videoview | <p>I am using videoview control to play the mp4 video.</p>
<p>while playing the video if i get an phone call the video playing from the beginning.</p>
<p>how do i seek the position of the video to exist position before getting the call.</p>
<p>Thanks in advance.</p>
| android | [4] |
4,100,275 | 4,100,276 | How can I bring an activity to the front from a background service | <p>First of all, I am aware my issue is against the philosophy of Android, but I have no choice, this application will run on a embedded car gps and I need to bring an activity to prevent from car accident, for example, when it's happen around the user. I have to put other activity on the back and bring my alert pop up without user manipulation like notification on the front.</p>
<p>Is there a way to bring manually an activity to the front, by resuming it like when you click on the android task switcher?</p>
| android | [4] |
2,740,862 | 2,740,863 | Any website with multi-level PHP tests? | <p>I'm not sure if this can be asked here, as it's not directly related to a piece of code.</p>
<p>I'm starting to learn PHP and I'm wondering if there's any websites that have multi-level tests (e.g. beginner/intermediate/advanced) or multi-subject tests (e.g. operators/variables etc).</p>
<p>I just had a go at the w3schools one and hit 95% which isn't too bad, baring in mind it's extremely simplistic, but I'd like a place to test my knowledge in a systematic way, that way when I answer a question incorrectly, I can refer back to sources and focus on those particular weak points.</p>
| php | [2] |
4,130,478 | 4,130,479 | Java library for graphical diff | <p>Is there any Java library that can diff text (in particular XML) files and provide the result as an image (e.g. like Pretty Diff)?</p>
| java | [1] |
3,555,288 | 3,555,289 | How can I invoke a javascript trhough a thread? | <p>I have a thread that runs querying a DB and returning some values. If this values satisfyes a condition, I want to raise a message box (javascript alert) for the client side.</p>
<p>In my system, users can post some tasks in DB, and the thread is going to constantly query the database to check if user has things to do. If user has, the system must alert him through a message box. The text is very simple, and statik, like "Hey, dude, go work, lazy!" (I'm joking, the message shall be like "You have new task(s). Please check.") Just it! </p>
<p>I've done javascripts invokings with <code>ClientScript.RegisterStartupScript</code>, and <code>Attributes.Add</code> for buttons. But now I want to call the javascript functions (wich will alert the user that he has things to do) from the midle of a sub (that is executed in a thread), without a submit, load or click event. How can I do it?</p>
<p>Thanks!</p>
| asp.net | [9] |
2,384,691 | 2,384,692 | Interrupting or stopping a sleeping thread | <p>How to stop or interrupt a sleeping thread in java.? I have a thread that syncs data and sleeps for 10 minutes in run() method, if i want to stop the sync by stopping the thread when it is sleeping.? How can this be achieved?</p>
| java | [1] |
2,855,467 | 2,855,468 | How to run IISWeb.vbs command in an asp.net application | <p>Can somebody please help me in executing the IISWeb.vbs commands from the c# code which I am trying to use for starting and stopping the websites on remote IIS servers (IIS 6.0).</p>
<p>I have tried other options like using DirectorServises with SyytemManagement or with WMI but in all cases code works fine for the local IIS server but displays error for the remote servers. I get 'Access denied' error for remote servers</p>
<p>I have got the all the servers in the same domian and network area and trying with a user account with administrative priviledge but nothing works for remote machine so giving it a try using IISWeb.vbs.</p>
<p>Please note that from my dev machine I am able to stop and start the websites on remote machines using this IISWeb.vbs commands without any problem when I run it from command prompt. So definitely there is no permission issues.
Code I am using:</p>
<pre><code> Process p = new Process();
p.StartInfo.FileName = "cscript.exe";
p.StartInfo.Arguments = "iisweb.vbs /stop w3svc/87257621 test /s servername /u userid /p password";
p.StartInfo.UseShellExecute = false;
p.Start();
p.WaitForExit();
int i= p.ExitCode;
</code></pre>
<p>Surprisingly I am not getting any error and i get return code '0' but nothing but website is not getting stopped.</p>
<p>Please help me out.</p>
| asp.net | [9] |
4,340,489 | 4,340,490 | how to get the images from device in android java application | <p>In my application I want to upload the image.</p>
<p>For that I have to get images from gallery in android device.</p>
<p>How do I write code that accomplishes this?</p>
| android | [4] |
1,473,025 | 1,473,026 | Replace part of form element attribute in jQuery | <p>I want to replace a part of the name attribute with a new value. This value is dependent on the original value. The name attribute has a value of: timeslots[timeslot_1][start]</p>
<ol>
<li><p>How do I increment the value 'timeslot_1' to 'timeslot_2' and replace the original value with this one?</p></li>
<li><p>The cloneElm consists of two types of elements (input and select) - I want to be able to capture both elements in my loop.</p></li>
</ol>
<p>The code I have so far:</p>
<pre><code>$(cloneElm).children('span').children('input').each(function(id) {
var newName = $(this).attr('name').replace('timeslot_1', 'timeslot_2');
$(this).attr('name', newName);
});
</code></pre>
<p>Thanks</p>
| jquery | [5] |
1,674,528 | 1,674,529 | Javascript function definition | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/6474425/do-var-fn-function-and-var-fn-function-foo-ever-differ">Do var fn = function() {…} and var fn = function foo() {…} ever differ?</a> </p>
</blockquote>
<p>From here</p>
<p><a href="http://stackoverflow.com/questions/1013385/what-is-the-difference-between-a-function-expression-vs-declaration-in-javascrip">What is the difference between a function expression vs declaration in Javascript?</a></p>
<p>I understand that there is a difference between declaring functions and declaring them as variables.</p>
<p>But It's not clear if there is any difference between:</p>
<pre><code>var func_name = function(param, param1){...};
</code></pre>
<p>and:</p>
<pre><code>var func_name = function func_name(param, param1){...};
</code></pre>
<p>Are they exactly identical? </p>
| javascript | [3] |
3,170,458 | 3,170,459 | SQL Parameter in SQL LIKE clause to use as an intellisense in SearchBox | <p>Can anyone help me to find a good solution for my problem, the <strong>requirements</strong> are this:</p>
<ul>
<li>It occurs in the Search TextBox of my form.</li>
<li>I have to use SQL Parameter (@paramater) in SQL LIKE Clause</li>
<li>Must be seen in the DataGridView.</li>
</ul>
| c# | [0] |
1,885,703 | 1,885,704 | javascript - get node reference to script tag that calls a function | <p>How might one go about obtaining a reference to the DOM script tag that called a function?</p>
<p>For example:</p>
<pre><code><script type="text/javascript">
var globalfunc = function(){
//obtain a reference to the script block that globalfunc() was called from
}
</script>
<script type="text/javascript">
globalfunc();
</script>
</code></pre>
<p>I know that I could assign an id or class to the script element and pass that through to my function to do a DOM lookup, but I think it would be more flexible and elegant to do it without such a thing. The main reason is that I may have to do some work on our site to get 3rd party ads wrangled into shape, and we don't have control over the scripts they use to load their ads.</p>
| javascript | [3] |
1,181,036 | 1,181,037 | What does beforefieldinit flag do? | <p>What does beforefieldinit flag do?
When I look into the IL of my class I see this flag but I don't know what this flag is actually doing?</p>
| c# | [0] |
554,272 | 554,273 | Can android do "waitForResponse" | <p>I am developing an application to communicate with a device via bluetooth.
Same as the BluetoothChat sample, my application makes a service object, and call service.connect() to get a connectedThread for data transmission.</p>
<p>and I have a command method, which takes an integer as its parameter.</p>
<p>the problem is, sometimes, that device returns invalid data.
So when I want to execute the command with ten different parameter, I need to do something like :</p>
<pre><code>for (i = 0; i < 10; i++) {
myService.write(command(i));
packet = waitForResponse(myService);
if (packet is valid) {
do something;
} else {
i--;
}
}
</code></pre>
<p>My program is using handler to deal messages, e.g. when the connectedThread read some data, it will</p>
<pre><code>mHandler.obtainMessage(ControlActivity.MESSAGE_READ, -1, -1, data)
.sendToTarget();
</code></pre>
<p>And there is a handler in my Activity class to deal with these messages.</p>
<p>How can I do something like "waitForResponse" on Android?
or Is there any other way to meet my requirement?</p>
<p>API Level: 13</p>
| android | [4] |
1,268,629 | 1,268,630 | Url Explode for value | <p>Currently I have a url thats like this,</p>
<p><a href="http://website.com/type/value" rel="nofollow">http://website.com/type/value</a></p>
<p>I am using </p>
<pre><code>$url = $_SERVER['REQUEST_URI'];
$url = trim($url, '/');
$array = explode('/',$url);
</code></pre>
<p>this to get the value currently but my page has Facebook like's on it and when it is clicked it adds all these extra variables. <code>http://website.com/type/value?fb_action_ids=1234567&fb_action_types=</code> and that breaks that value that I am trying to get. Is there another way to get the specific value?</p>
| php | [2] |
4,439,234 | 4,439,235 | apache poi 3.6: Reading an xlsx file | <p>I have a relatively dumb newb question, Im trying to open an xlsx file for reading using the apache POI 3.6.</p>
<p>XSSFWorkbook workBook = new XSSFWorkbook("C:\test.xlsx");</p>
<p>The xlsx file was saved in excel 2007, the error Im seeing is:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlException</p>
<ul>
<li>I dont know what the solution is... any ideas and/or example code?</li>
</ul>
| java | [1] |
3,002,533 | 3,002,534 | How to change the Backgroung Image Dynamically according to my spinner selection in Android ? | <p>we are designing the page and we need to change background image dynamically.</p>
<p>Is there any way to load(or change) android application background image dynamically?</p>
<p>help me from come out this problem?</p>
| android | [4] |
773,261 | 773,262 | how to see scrollview in graphical layout | <p>i am using Helios 3.6.2 for android development.
Whenever i design a layout in the Graphical layout mode and not the .xml layout, there is the following problem that occurs:
When i am using a scrollview and the height of the scrollview exceeds the height of the content view area ( the phone screen visible in the graphical layout mode) , i am not able to see the items that i have at the bottom of the screen.
In Helios 3.6.1 there was an option called expand too fit, whenever i used to click on it, the phone screen used to increase in size to encompass all the elements that i have added.
How do i achieve the same thing in 3.6.2?</p>
<p>thank you in advance.<img src="http://i.stack.imgur.com/lMSSw.jpg" alt="i have added the image and marked where i want to see the full view"></p>
| android | [4] |
1,852,102 | 1,852,103 | How to "cache" persistent settings in asp.net application | <p>i'm developing an asp.net application. In my database i've a "classic" mono-record settings table.
Each time i need a setting, i write some code like this</p>
<pre><code>if ReturnSetting("my_setting") = value then
'do something
else
'do others
end if
</code></pre>
<p>In 'ReturnSetting' i open a connection, get the setting value and return it.
This is not efficient (open connection, datareader etc.) </p>
<p>How can i optimize this ? </p>
<p>Thank you</p>
| asp.net | [9] |
2,829,134 | 2,829,135 | Displaying multiple pages of a single file | <p>I have a file that contains 50 rows. I need to display 10 rows at a time followed by the user's action like he requests for a page.. say page 2. where i display the next 10 rows.. I have called a function in js:</p>
<p>like:</p>
<pre><code>setRow(rowID);
</code></pre>
<p>//id is the no from which rows are to be displayed.. i.e. 10 rows from rowId are to be displayed... it is called from an onclick event...</p>
<p>like this:</p>
<pre><code> <input type = "button" vlaue = "1" onclick = "setRow(1);
</code></pre>
<p>" ></p>
<pre><code>function setRow(val id) {
display 10 rows from id;
}
</code></pre>
<p>I tried using: document.get.....ById('').innerHTML... but that does not work..</p>
<p>How am i able to do that?</p>
| javascript | [3] |
1,300,688 | 1,300,689 | System.Diagnostics.Process Arguments | <p>How can I pass Argument to the System.Dignostics.Process with spaces. I am doing this:</p>
<pre><code>System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.EnableRaisingEvents = false;
proc.StartInfo.FileName = exePath + @"\bin\test.exe";
string args = String.Format(@"{0}{1}{2}{3}", "-plot " ,path1, " -o ", path2);
proc.StartInfo.Arguments = args;
</code></pre>
<p>when path1 and path2 do not contain spaces ( Let's say path1 = C:\Temp\ and path2 = C:\Temp\Test) then it works fine, but when path1 and path2 contain spaces for example
path1 = C:\Documents and Settings\user\Desktop and path2 = C:\Documents and Settings\user\Desktop\New Folder) then it trucates the path1 and path2 and abort.</p>
<p>Please let me know the correct way for doing this.</p>
<p>Thanks,
Ashish </p>
| c# | [0] |
218,964 | 218,965 | How can I store JPEGs as Byte[] for faster loading? | <p>I need to load ~150 JPEG images into ArrayList for playing an animation.</p>
<p>If I load them like that </p>
<pre><code>ByteArrayOutputStream stream = new ByteArrayOutputStream();
BitmapFactory.decodeResource(getResources(), R.drawable.y1).compress(Bitmap.CompressFormat.JPEG, 80, stream);
byeArr.add( stream.toByteArray() );
</code></pre>
<p>it can take up to ~10 seconds for 150 images, so maybe there is a way to speed it up? Can I somehow store this images in resources or in assets already as byte[] or something?</p>
<p>Thanks</p>
| android | [4] |
378,164 | 378,165 | best way to parseDouble with comma as decimal separator? | <pre><code>String p="1,234";
Double d=Double.valueOf(p);
System.out.println(d);
</code></pre>
<p>return a error.</p>
<p>what the besy way to get <code>1.234</code> ?</p>
<p>better than: <code>p=p.replaceAll(",",".");</code></p>
<p>thanks a lot :)</p>
| java | [1] |
840,815 | 840,816 | creating a button inside onclick listener? | <p>I want to dynamically create a set of buttons when my program runs.I want these buttons to be created when i create a generate button.Is it possible to call <code>Button but=new Button(this);</code> inside OnClickListener of another Button?</p>
| android | [4] |
1,904,135 | 1,904,136 | android AutoCompleteTextView: how to enforce to redo autocomplete? | <p>I have an AutoCompleteTextView, and I listen to the onTextChanged event, in handler of this event I get the autocomplete list from my http server and then use setAdapter() to attach the auto complete array to the AutoCompleteTextView.</p>
<p>The problem is, when the onTextChanged event is invoked, the AutoCompleteTextView has completed the auto complete process, which means, even I have attached the adapter to the autocomplete view, the view will not aware it and will not show the drop down list.</p>
<p>One option is using textView.showDropDown(); to enforce to show the dropdown list, but the side effect is when I select a item from the drop down list, it will trigger onTextChanged event, which in turn will invoke showDropDown() in onTextChanged, and in result, after I select the item from the list, the drop down list will still show one more time, which is not a good user experience.</p>
<p>Is there a way to tell the AutoCompleteTextView that the adapter has been changed in onTextChanged?</p>
| android | [4] |
275,720 | 275,721 | Problems transfering data between an application and a server using TCP sockets [Android] | <p>My development team and I, are working on an application that uses a sql database, we try to transfer a database from our application to a server using tcp sockets, we made some research about sockets, the server program is written on java language using netbeans, and the application is written on eclipse.</p>
<p>We made several conectivity tests between the application and server programs, using the android emulator, we tried to made it local (running both programs on the same computer) and the server conects with the application, but it doesn´t receive all packages, it receives aproximately 2Kb (we want to transfer a 25Kb file), the same happens when we run the server on other computer in the same network, we made some tests using wireshark to capture all the packagesincoming from the application to the server and viceversa, we´ve noticed that the server receives all the data, but first it receives a 2Kb packet, after that server application receives an end ack, and then, the application receives the missing packages, and then discards them.</p>
<p>We also made some conectivity tests using a coby kyros tablet instead of the emulator, and we have no problem, the application running on the tablet, sends all the data, and the server receives it.</p>
<p>We want know if there are an error on the emulator, and how to solve it.</p>
<p>Please help us or send us yout feedback</p>
| android | [4] |
4,111,205 | 4,111,206 | How to serialize class and his objects | <p>I have an Class structure like this:</p>
<pre><code>class A {
Dictionary<UInt64, B> listB;
method1(){}
methodN(){}
}
class B {
Dictionary<UInt32, C> listC;
Dictionary<UInt32, E> listE;
List<F> listF;
method1(){}
methodN(){}
}
class C {
Dictionary<UInt32, D> listD;
method1(){}
methodN(){}
}
class D {
method1(){}
methodN(){}
}
class E {
method1(){}
methodN(){}
}
class F {
method1(){}
methodN(){}
}
</code></pre>
<p>Class A is the main Class, and B is a sub class of A. All other classes are sub class of B.</p>
<p>I want to serialize class A with all sub Classes.</p>
<p>How can I serialize these Objects? </p>
<p>Thank You!</p>
| c# | [0] |
2,265,635 | 2,265,636 | Android: Multiple Image Density support - scale height width and dpi? | <p>I have an android app that I'm trying to add support for different densities, screen sizes, etc. I've developed the app on the simulator with the HVGA support and used all icons from our iphone app which turns out nice since the resolution was at 320x480. Everything looks good now but I'm a bit confused after reading the official android documentation. For layouts I'm going through and ensuring everything is in dp units but when it comes to the images I'm lost. I know that mdpi is 160 but what do I tell my designer for what the hdpi image needs to be? Do we need to increase the height and width and the dpi? Or is it simply enough to leave the dpi as is and increase the height width? For example, if I have an image that's 100 x 100 with 160 dpi, in order to render it identical on an hdpi screen it should now be 150 x 150 with 240 dpi? Assuming if I leave the dpi at 160 it will just be a little blurred? Sorry about silly question but I just want to make sure I'm doing everything right and I'm really a C developer with no graphics experience at all.... No excuse at all but could use some help. I saw some examples where the splash screen for mdpi was 320x480 at 160 dpi but then the hdpi splash screen was at 480 x 800 at 240. Obviously 480 x 1.5 does not equal 800. Furthermore, after looking at the icons in the android sdk, they only scale up the width and height, not the dpi. Probably because they're icons and don't need to be? Lost in photoshop land....</p>
| android | [4] |
51,599 | 51,600 | How to send an email from yahoo email by using php curl | <p>You know facebook has an API. so, my site's users can login with their facebook accounts on my website.</p>
<p>Does yahoo have an API like facebook? Did anyone see a yahoo API? Ive been looking for a yahoo API for 5 hours, i cannot find it. I wanted to ask this question here , because there are so many php coders here, and someone maybe tried it before.</p>
<p>Id like my site's users to login to their yahoo account and send mail from their account. I wanna use php curl function, or anything elses..</p>
<p>I found this code block:</p>
<blockquote>
<p><a href="http://codeglobe.blogspot.com/2009/07/login-and-get-contacts-yahoo-mail-with.html" rel="nofollow">http://codeglobe.blogspot.com/2009/07/login-and-get-contacts-yahoo-mail-with.html</a></p>
</blockquote>
<p>However i was not able to connect my yahoo account and send an email..</p>
<p>Well, please inform me if you have some informations on this issue..
regards</p>
| php | [2] |
4,479,436 | 4,479,437 | making background thread to check if network available and notify when ever it is available | <p>I made a service and a Activity, I need the processing in the following Manner </p>
<p>Like the service starts automatically at application boots up, and check periodically if there is network available or not, and whenever it is available then notify to the user.</p>
<p>How i can do this, i want some alarm manager or blinking screen until the network is available</p>
<p>Thank You</p>
| android | [4] |
2,140,601 | 2,140,602 | PHP: How to find position of (user-defined) occurrence of a string using stripos | <p>There is strpos() to find First occurrence, and strrpos() to find last occurrence.</p>
<p><a href="http://www.tizag.com/phpT/php-string-strpos.php" rel="nofollow">This</a> tutorial explained that it's possible to get any occurrence using a loop, but that might be not fast when the haystack is big. And my code is looking ugly now.</p>
<p>Is there a way to find 2nd, 3rd, 4th, etc occurrence without looping over the haystack? I mean, finding the required occurrence directly without looping? Possible?</p>
| php | [2] |
3,703,978 | 3,703,979 | How do I automacially assign a variable in constructor while creating objects | <p>Let's say we just have a simple object Person with int ID which identifies it. How can I give new ID value (+1) for each new instance of Person but in constructor of that class Person? (I use no DB for this)</p>
| java | [1] |
4,620,197 | 4,620,198 | About redefining a name of Java method with a typo for simplicity sake | <p>I type fast and usually make a lot of typos that I have to fix constantly while printing. For instance, if I work with method <em>getCompany()</em>, I often write it as <em>getComapny()</em> that irritates me greatly. Is it considered to be a good practice to wrap <em>getCompany()</em> method into <em>getComapny()</em> not to bother about this typo anymore? Like having </p>
<pre><code>public Company getCompany(){
Company company = new Company();
//do some really important stuff in here
return company;
}
</code></pre>
<p>and to wrap it with </p>
<pre><code>public Company getComapny(){
return getCompany();
}
</code></pre>
<p>I think my fellow colleagues who will support the code after me wil be thankful, they have the same problems as far as I aware.</p>
<p>BTW, how to conceal <em>getComapny()</em> from JavaDoc to display <em>getCompany()</em> only?</p>
| java | [1] |
523,125 | 523,126 | parse a C++ code using python | <p>For example, say I have to parse:</p>
<pre><code>void (*do_something)(int a, int b);
</code></pre>
<p>Please let me know how do I find the position of the second occurrence of "(" (open bracket). </p>
<p>Here is what I tried out so far:</p>
<pre><code>text = "void (*do_something)(int a, int b);"
for m in re.finditer('(', text):
print m.start()
</code></pre>
<p>Ultimately, what I intend to do is extract "(int a, int b)" from the piece of code above.</p>
| python | [7] |
2,627,631 | 2,627,632 | How can I get a row that is two rows further down? | <p>I have a reference to a row; how can I locate the row that is two-rows further down from this one, using jQuery?</p>
| jquery | [5] |
2,076,532 | 2,076,533 | Does an Android database get completely removed and recreated then updating an app? | <p>I have an app that uses a database. At startup I check to see if my tables are missing and if so I create them. Works great.
I've noticed that if I "adb uninstall" then the next time I run my app the tables are created again (this is what I need), but what about when updating through the marketplace?
I'm in the process of releasing an update, and I've made major changes to the tables. I'd like it if the tables were completely wiped and re-created, in fact my app needs this to happen. If someone updates and has the old tables then there will be a force close.
Does anyone know the specifics of this scenario?</p>
<p>My tables are only for lookup, I store no user data so I dont really care about losing data on the updates.
Of course I know an option is to use some type of "version" table and check to see if I need to manually drop and create, but I was wondering if that was even needed.
Thanks.</p>
| android | [4] |
98,793 | 98,794 | if row equals 2 thru 10 - VERY EASY PHP | <p>Sorry that I can't find the answer through google - But I know this has got to be really easy.</p>
<p>I have a code like this</p>
<pre><code>if ($row == 1)
</code></pre>
<p>I also want something that states if $row equals 2 through 10 then do this... What is the correct php for this? Thank you. </p>
| php | [2] |
5,230,571 | 5,230,572 | Enabling Dual Display In IT Blaze Board | <p>I had made the following changes as said below,1) Instead of mGraphicsPlane, take array of GraphicsPlane,mGraphicsPlane[2] //for 2 displays fb0 and fb1.2) Change the DISPLAY_COUNT value in surfaceflinger.cpp to 2 #define DISPLAY_COUNT 2. 3) Firstly Initialize main display DisplayHardware by passing dpy as 0, then secondary DisplayHardware by passing dpy as 1.
After making the following changes i had booted up the Blaze board the Errors are as below,
1)ERROR omaplfb (CreateDCSwapChain 668): Swap chain already exists for display 2 2)D/BootAnimation( 1548): SurfaceFlinger died, exiting...3)I/ServiceManager( 1464): service 'SurfaceFlinger' died<br>
please can any one help, yours help is more appreciable.</p>
| android | [4] |
5,240,838 | 5,240,839 | UITabBarController crashing issue | <p>i have used UITabBarController Application. i have add 10 navigation controller inside tabbar.only five item show on the tabbar. bt when we click no 5 itemtabbar second time then application crashed. Error(Interrupted).</p>
<p>Thanks in advance.</p>
| iphone | [8] |
302,030 | 302,031 | Imageview.setMaxHeight is working wrong | <p>Hy!</p>
<p>I download a picture from the internet and want to display it. The height should be 1/6 of the max screen height (for multi phone support)</p>
<p><strong>Code:</strong></p>
<pre><code>final ImageView iv = (ImageView) findViewById(R.id.ImageView01);
iv.setMaxHeight(getWindowManager().getDefaultDisplay().getHeight()/6);
</code></pre>
<p>Please help!</p>
| android | [4] |
3,667,871 | 3,667,872 | How can I start Learn Android? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2869338/where-to-start-to-learn-android">Where to start to learn Android?</a> </p>
</blockquote>
<p><strong>from Zerooo ... I don't have background about Android and what is need to learn it ???</strong> </p>
| android | [4] |
2,492,353 | 2,492,354 | Can static variables be initialized in static methods? | <p>Can static variables be initialized in a method? Is the following code valid? Thank you!</p>
<pre><code>internal static class Common
{
internal static int TimeOut;
internal static string Name;
internal static void Initialize()
{
TimeOut = Config.Read("timeout");
Name = Config.Read("Name");
}
}
</code></pre>
| c# | [0] |
3,735,128 | 3,735,129 | PHP benchmarking: date() VS. date_parse() VS. date_parse_from_format() | <p>Can someone please benchmark and tell me which one is the <strong>fastest</strong> in PHP:</p>
<pre><code>$d = date($output_format, strtotime($date_string));
$d = date_parse($date_string);
$d = date_parse_from_format($input_format, $date_string);
</code></pre>
<p>Thank you!! Geo.</p>
| php | [2] |
730,646 | 730,647 | Interpret strings as packed binary data in C++ | <p>I have question about interpreting strings as packed binary data in C++. In python, I can use struct module. Is there a module or a way in C++ to interpret strings as packed binary data without embedding Python?</p>
| c++ | [6] |
506,880 | 506,881 | How can I toy with this .py file? | <p>I'm learning Python just so I can tinker with the <a href="http://aima.cs.berkeley.edu/code.html" rel="nofollow">files from AIMA</a> easily. I know Java and C++, but I find the AIMA code on the repositories to be too obfuscated. The Python code looks simpler and more elegant...yet, I don't know Python. </p>
<p>I wanna import the functions in <a href="http://aima-python.googlecode.com/svn/trunk/search.py" rel="nofollow">search.py</a>. </p>
<p>I tried creating a search2.py file like this:</p>
<pre><code>import search
class Problem2(Problem):
pass
</code></pre>
<p>on the folder where search.py is and got:</p>
<pre><code>~/aima/aima-python$ python search2.py
Traceback (most recent call last):
File "search2.py", line 3, in <module>
class Problem2(Problem):
NameError: name 'Problem' is not defined
</code></pre>
<p>Why is this?</p>
| python | [7] |
2,836,621 | 2,836,622 | As user types populate different textbox | <p>I have this code to populate two textboxes:</p>
<pre><code>$(document).ready(function(){
$('.tb1').keyup(function(){
var content = $('.tb1').val();
$('.tb2').val(content);
});
});
</code></pre>
<p>However, the only other thing I'd like to do is if the user enters a <code>space</code> I'd like to populate that with a <code>-</code>. </p>
<p>How can I accomplish this?</p>
| jquery | [5] |
2,908,600 | 2,908,601 | Get Fragment during onStart in FragmentActivity | <pre><code>// Code for JStockFragmentActivity
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
...
tabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.portfolio)),
PortfolioManagementFragment.class, null);
}
@Override
protected void onStart() {
super.onStart();
portfolioManagementFragment = ((PortfolioManagementFragment)Utils.getFragment(this, 1));
if (portfolioManagementFragment != null) {
Log.i("CHEOK", "get portfolioManagementFragment sucess");
} else {
Log.i("CHEOK", "get portfolioManagementFragment fail");
}
@Override
public boolean onOptionsItemSelected(MenuItem menuItem) {
final int menuItemId = menuItem.getItemId();
if (menuItemId == R.id.menu_open_from_cloud) {
// Utils.getFragment works fine right here.
}
}
</code></pre>
<hr>
<pre><code>// Code for Utils
/**
* Returns index th fragment.
* @return the index th fragment
*/
public static Fragment getFragment(FragmentActivity fragmentActivity, int index) {
return fragmentActivity.getSupportFragmentManager().findFragmentByTag("android:switcher:" + R.id.viewPager + ":" + index);
}
</code></pre>
<hr>
<p>I always fail to execute <code>Utils.getFragment</code>, within <code>FragmentActivity</code> <code>onStart</code>. It always returns null.</p>
<p>However, if I execute <code>Utils.getFragment</code> within a menu event handler method, it works just fine.</p>
<p>Is there anything I can get <code>Fragment</code> during <code>onStart</code>?</p>
| android | [4] |
2,457,051 | 2,457,052 | cant access array in object | <pre><code>var_dump($img->files);
object(stdClass)#17 (6) {
["960"]= string(46) "/imgs/14c99db10ee9cc28bfa7db16e961fd65-960.jpg"
["60"]= string(45) "/imgs/14c99db10ee9cc28bfa7db16e961fd65-60.jpg"
["100"]= string(46) "/imgs/14c99db10ee9cc28bfa7db16e961fd65-100.jpg"
["200"]= string(46) "/imgs/14c99db10ee9cc28bfa7db16e961fd65-200.jpg"
["300"]= string(46) "/imgs/14c99db10ee9cc28bfa7db16e961fd65-300.jpg"
["500"]= string(46) "/imgs/14c99db10ee9cc28bfa7db16e961fd65-500.jpg"
}
</code></pre>
<p>how can use one index</p>
<pre><code>var_dump($img->files["60"]);
</code></pre>
<p>Fails</p>
<p>Fatal error: Cannot use object of type stdClass as array</p>
| php | [2] |
1,617,513 | 1,617,514 | Get the average from multiple items | <p>Let's suppose I have a list like this</p>
<pre><code>[name1, number1], [name2, number2], [name3, number 3]
</code></pre>
<p>For example</p>
<pre><code>[John, 86], [Joe, 94], [bob, 45], [andy, 34]
</code></pre>
<p>I'm trying to print out everyone above number 80 and get the average. So in this case I want to output</p>
<pre><code>John Joe 90
</code></pre>
<p>What is the most simple structure I can use to do this?</p>
| javascript | [3] |
2,964,956 | 2,964,957 | Automatic printing in C# with ProcessStartInfo cutting off bottom and top | <p>I am using <code>ProcessStartInfo</code> to print my pdf file in my C# project in background. But the file that I printed is cutting off my top and bottom of the pdf file when printed. But when I print the same file by right clicking the pdf file it prints correctly.</p>
<p>Here is my code:</p>
<pre><code> System.Diagnostics.Process process = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = filename; // use default app to execute verb
//assert: can only go to local default printer
startInfo.Verb = "Print"; //prints to default printer
//try to keep Window hidden - work in background
startInfo.UseShellExecute = true;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.CreateNoWindow = true;
// set process to startInfo and execute start
process.StartInfo = startInfo;
process.Start();
process.WaitForExit(10000);
process.CloseMainWindow();
process.Close();
</code></pre>
<p>Please help me.</p>
| c# | [0] |
5,618,840 | 5,618,841 | Scrolling Text View | <p>I have a <code>TextView</code> inside of a <code>ViewGroup</code>. The text displayed in the <code>TextView</code> extends past the width of the <code>ViewGroup</code> and is clipped as expected.</p>
<p>What I'm trying to do, is scroll the <code>TextView</code> to the left to display the text, and stop when the end of the text is visible.</p>
<p>However, if I use a <code>TranslationAnimation</code>, the <code>TextView</code> is "translated" to the appropriate position, but the <code>TextView</code> remains clipped where it was in its original position, and I can't find a way around this, other than to follow a similar pattern as used for the marquee in <code>TextView</code>.</p>
<p>I also don't see a way to specify in the marquee object, to stop just when the text is just visible, so I think I may need to create my own marquee functionality.</p>
<p>Do I have any other options?</p>
<p>Thanks.</p>
| android | [4] |
1,074,235 | 1,074,236 | asp.net: Location of username and password in WebForm and MVC | <p>If someone gives me WebForm/MVC website code using ASP.NET Membership (and he does not know the username/password), or I download it from the Internet without username/password information, how do I retrive username/password such that I can load it into VS2010, set up breakpoints, enter correct username/password, and run it to learn the code?</p>
| asp.net | [9] |
178,617 | 178,618 | The difference between "Object *obj" and "Object &obj" | <p>graph.h</p>
<pre><code>struct Edge {
int from;
int to;
unsigned int id;
Edge(): from(0), to(0), id(0) {};
};
struct Vertex {
int label;
vector<Edge> edge;
};
class Graph: public vector<Vertex> {
int gid;
unsigned int edge_size;
};
class Trans {
public:
int tid;
vector<Graph> graph;
};
</code></pre>
<p><code>vector<Trans> database;</code> <code>database</code> is a global variable, then i call <code>run_algo(database);</code> in main function.</p>
<pre><code>void run_algo(vector<Trans> &db) {
EdgeList edges;
for(unsigned int tid = 0; tid < db.size(); tid++) {
Trans &t = db[tid];
...
Graph g = t.graph[gid];
</code></pre>
<p>I want to ask <code>db</code> is a alias to <code>database</code>, <code>db[tid]</code> is a Transaction vector, but what if the difference between using <code>Trans &t = db[tid];</code> and <code>Trans t = db[tid];</code>, since the author who write the sample using <code>Trans &t = db[tid];</code>, but i think it should use <code>Trans t = db[tid];</code></p>
<p>Thanks:)</p>
| c++ | [6] |
3,962,289 | 3,962,290 | Why am I getting an error in my main.xml? | <p>See image here : <a href="http://i.stack.imgur.com/dS4wt.jpg" rel="nofollow">http://i.stack.imgur.com/dS4wt.jpg</a></p>
<p>I get error in <code>setContentView(R.layout.main);</code> Where is my problem?</p>
| android | [4] |
4,902,388 | 4,902,389 | Help with Pixastic Resize using jQuery | <p>Im trying to use Pixastic with jQuery, looking for advice or any examples of it being used with jQuery?</p>
<p>Any help appreciated.</p>
| jquery | [5] |
2,369,524 | 2,369,525 | Cannot convert Nan to Java.lang.long | <pre><code>TimeoutInterval = TimeoutInterval * 60 * 1000; //Converting to milisecond
TimeOutObj = setTimeout(function(){
},TimeoutInterval);
</code></pre>
<p>What is wrong here, why i am getting this error <code>Cannot convert Nan to Java.lang.long</code>.</p>
| javascript | [3] |
470,180 | 470,181 | how to redirect the output as well as get the output on shell screen at same time | <p>This is windows-application-form code; I want the batch file which is going to be executed to show the output on shell screen which I got by <code>RedirectStandardOutput = false;</code>, but I also want output to be redirected to a log file at the same time. For this, I use <code>RedirectStandardOutput = true;</code>.</p>
<p>Of course, only one can be used at one time!</p>
<pre><code>System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "c:\test\build.bat";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true; // if I use false all the commented lines below are not applicable for comments
p.Start();
string output = null;
//try
//{
output = p.StandardOutput.ReadToEnd();
//}
//catch (Exception ex)
//{
// MessageBox.Show(ex.ToString());
//}
System.IO.File.WriteAllText("c:\test\log.txt", output);
</code></pre>
| c# | [0] |
5,458,250 | 5,458,251 | Why isn't parseInt a method? | <p>Why is parseInt a function instead of a method?</p>
<p>Function:</p>
<pre><code>var i = parseInt(X);
</code></pre>
<p>Method:</p>
<pre><code>var i = X.parseInt();
</code></pre>
| javascript | [3] |
1,496,087 | 1,496,088 | PHP storing several users in a variable | <p>I would like to display admin button on the menu only if the <code>$_SESSION['user']</code> is equal to say a variable with <code>$admins</code> (which I would like to store several values as in several users).</p>
<p>I know I can do this through <em>SQL</em>, but I would like to know if this is possible through <em>PHP</em> and if so how.</p>
<p>edit: to be more specific I know I can do it by looking up the database for a user matching the admin group, but I do not have this setup.</p>
<p>Even if SQL is the easiest option I really hope there is a way with <em>PHP</em>, I was reading about <code>PHP_AUTH_USER</code> quite a bit, but I'd like to store several users in a variable, if that is possible?</p>
| php | [2] |
5,674,996 | 5,674,997 | how to convert nsstring to uicolor? | <p>I have one string(NSString) in string there is one value like string=@"black" now i want to use textcolore using string.I have written below code.
txtView.textColor=[UIColor string];</p>
<p>But it not working can suggest me?</p>
| iphone | [8] |
1,880,246 | 1,880,247 | How to call the function in this file? | <p>I pasted the code given in this link to a file called md5.js.</p>
<p><a href="http://www.webtoolkit.info/javascript-md5.html" rel="nofollow">http://www.webtoolkit.info/javascript-md5.html</a></p>
<p>I am not able to call the function in my below code. Please assist me.</p>
<p><pre><code></p>
function inc(filename)
{
var body = document.getElementsByTagName('body').item(0);
script = document.createElement('script');
script.src = filename;
script.type = 'text/javascript';
body.appendChild(script)
}
function CheckCaptcha()
{
var CaptchaWord="";
CaptchaWord = document.getElementById('studentusername').value;
inc("md5.js");
//Add MD5 function here.
}
<p></pre></code></p>
| javascript | [3] |
4,040,546 | 4,040,547 | Create an image from an url using PHP GD | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3175392/how-to-save-webpage-as-a-image-file-using-php">How to save webpage as a image file using PHP?</a> </p>
</blockquote>
<p>I would like to create an image on the server using a url string that is given.
I want a screen shot of a website to be created.
Is it possible with PHP GD , if so how ?
Thanks</p>
| php | [2] |
4,803,745 | 4,803,746 | How to set DocFlavor for printservice in Java for WIndows | <p>I have written code to run the printer programatically in Java.I have to set the value of docflavor to print the .txt file.When I set it for INPUT_STREAM.TEXT_PLAIN_UTF_8 and run my program on Linux , it prints the text file.but when i run the same code for windows.It can't print the text file.It only prints the jpeg format file.I am using HP Deskjet F735 printer for this. Following is my code .</p>
<pre><code> DocFlavor docflavor = DocFlavor.INPUT_STREAM.TEXT_PLAIN_UTF_8;
PrintRequestAttributeSet attr_set = new HashPrintRequestAttributeSet();
attr_set.add(new Copies(2));
PrintService[] service = PrintServiceLookup.lookupPrintServices(docflavor, attr_set);
if (service.length==0) {
JOptionPane.showMessageDialog(null, "No Printer Selected");
}
else if (service.length > 0) {
System.out.println("Selected printer is " + service[0].getName());
DocPrintJob pj = service[0].createPrintJob();
{
PrintService ps = pj.getPrintService();
FileInputStream fis = null;
try {
File file = new File("/home/ignu/Desktop/newfile");
fis = new FileInputStream(file);
Doc doc = new SimpleDoc(fis, docflavor, null);
pj.print(doc, attr_set);
</code></pre>
| java | [1] |
954,334 | 954,335 | Implementing a PHP Webcrawler | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2313107/how-do-i-make-a-simple-crawler-in-php">How do I make a simple crawler in PHP?</a> </p>
</blockquote>
<p>I have a project on webcrawler, was wondering if this is feasible with PHP, if yes how? Pls tips and materials will be helpful, possible implementaion too. Thanks.</p>
| php | [2] |
187,730 | 187,731 | php objects, how to access a simplexmlelement | <p>I have the following object:</p>
<pre><code>object(SimpleXMLElement)#337 (1) { [0]=> string(4) "1001" }
</code></pre>
<p>But I can't seem to access it using [0] or even not using foreach($value as $obj=>$objvalue)</p>
<p>What am I doing wrong?</p>
| php | [2] |
1,883,184 | 1,883,185 | Retrieving annotated method from attribute constructor | <p>If I annotate a method of a class with an attribute, I can then retrieve custom attributes for that class and see if it has that attribute or not. For example, I'm building a message-oriented program so I have classes like</p>
<pre><code>public class ErrorHandler
{
[HandleMessage(ErrorHandling.ERROR)]
private static void OnError(string message, object context, params object[] args)
{
Exception e;
args.Extract(out e);
Console.WriteLine(e.Message + Environment.NewLine + e.StackTrace);
}
}
</code></pre>
<p>At runtime I can do this:</p>
<pre><code>public static void RegisterStaticHandlers(Type type)
{
foreach (var mInfo in type.GetMethods(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static))
{
var mAttr = mInfo.GetCustomAttribute<HandleMessageAttribute>();
if (mAttr != null)
RegisterInstanceHandler(mAttr.Message, mInfo.CreateDelegate<MessageHandler>());
}
}
</code></pre>
<p>(I have some extension methods to simplify the code, they're not relevant now.)</p>
<p>My question is: can I get rid of this <code>RegisterStaticHandlers</code> method altogether and register the handler in the attribute constructor?</p>
<pre><code>public class HandleMessageAttribute : Attribute
{
public string Message { get; private set; }
public HandleMessageAttribute(string message)
{
Message = message;
Messages.RegisterInstanceHandler(message, ... method reference here ...);
}
}
</code></pre>
<p>Is there a way to retrieve the method that is annotated by an attribute in the attribute constructor, instead of the opposite (and regular) way of having the method and getting its attributes?</p>
<p>[Edited]
I just realized that I can at least do this in the static constructor:</p>
<pre><code>static ErrorHandler()
{
Messages.RegisterStaticHandlers(typeof(ErrorHandler));
}
</code></pre>
<p>This at least keeps the registration of a class inside that class, which is great as far as I'm concerned :)</p>
| c# | [0] |
255,347 | 255,348 | memory usage problem | <p>I am working on optimizing the memory usage of my codes and I found a problem that I do not understand. Please let me know what you think.</p>
<p>Code:</p>
<pre><code>typedef map <pair<string, int>, vector<pair<int, float> > > TDM;
void parsefile (TDM & my_map, string in_file); // parse input file and put it in the data map
float CheckMemUsage (void); // check memory usage by extracting /proc/self/stat info
int main (int argc, char *argv[]) {
TDM my_map;
string infile = "xxx";
printf ("INFO: Memory usage before parse file: %.2fM.\n", CheckMemUsage ());
parsefile (my_map, in_file);
printf ("INFO: Memory usage after parse file: %.2fM.\n", CheckMemUsage ());
for (TDM::iterator it=my_map.begin(); it!=my_map.end(); ++it) {
vector<pair<int, float> > ().swap (it->second);
}
TDM ().swap (my_map);
printf ("INFO: Memory usage after delete map: %.2fM.\n", CheckMemUsage ());
}
</code></pre>
<p>The report of this program:</p>
<pre><code>INFO: Memory usage before parse file: 13.46M.
INFO: Memory usage after parse file: 203.53M.
INFO: Memory usage after delete map: 132.59M.
</code></pre>
<p>In the function "parsefile", I only use string, vector, pair, map stuffs, without new any memory. So after this program, I assume that only my_map is in memory. After deleting my map, the memory usage should return to before parsing file status (13.46M). But it still reports a 132.59M. What is this 132M for? Is there sth wrong in my program?</p>
<p>Thanks a lot for your time. </p>
| c++ | [6] |
986,001 | 986,002 | How to do network i/o from a ContentProvider? | <p>I have a ContentProvider that serves up content of documents that are stored on a server. The content is provided to either another Android app via an ACTION_VIEW intent or to a WebView via a content://... URI. The ContentProvider keeps a cache of documents in the app's cache directory.</p>
<p>Here's the problem. When the consumer asks for a document that's not in the cache, I need to get it over the network. When I try this, I get an exception that network access isn't allowed on the application thread. I'm currently working around this problem by pre-loading the document data in an AsyncTask before passing control to the external app or browser. This works most of the time, but isn't completely reliable in edge cases like when the app gets swapped out and then reloaded.</p>
<p>Any suggestions?</p>
| android | [4] |
5,588,342 | 5,588,343 | How to include a third option for a drill down table view? | <p>I'll try this again. I need help in getting a third option working using a drill down table view. As it sits right now, the application shows all three in the table when the application runs, but when clicked on the second or third, it will only show the view for the third. I read some tutorials on .plist but I wanted to know if it was possible to do it using a condition set for all three. Here's the code that I have:</p>
<pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == 0)
[details setContent:arrAutoLock];
/*(indexPath.row == 1)
[details setContent:arrPasscodeLock];*/
else
[details setContent:arrRestrictions];
[[self navigationController] pushViewController:details animated:YES];
</code></pre>
| iphone | [8] |
5,598,451 | 5,598,452 | Creating a shortcut of an android application on Home screen | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/6337431/android-create-shortcuts-on-the-home-screen">Android create shortcuts on the home screen</a> </p>
</blockquote>
<p>I want to create a shortcut of my android application on home screen as soon as my application is installed in an android device. How do I do this..?</p>
| android | [4] |
1,843,245 | 1,843,246 | linearlayout/textviews scrollable? | <p>Any easy to make a simple linearlayout with a buncha textviews scrollable? Right now, the last textview gets cut off...</p>
<p>(I don't really wanna use a listview)</p>
| android | [4] |
1,383,030 | 1,383,031 | Android: I can no longer build android projects after I updated eclipse | <p>I have a apple computer and just got done updating my eclipse.<br>
Now all the projects have a yellow dot next to them with a excalmation mark</p>
<p>when I tried to build i get the following error
[2012-12-22 21:15:04 - tapzoo] Unknown error: Unable to build: the file dx.jar was not loaded from the SDK folder!</p>
| android | [4] |
1,661,637 | 1,661,638 | Looking for File Copy function in C# | <p>I'm writing a tool that performs copying from USB devices to the local HD - I wonder if there is a function in C# to copy a file from one path to another?</p>
| c# | [0] |
2,076,097 | 2,076,098 | Simulator is Not Loading in Eclipse | <p>I have installed Android SDK, Linux Helios 3.6.2, and ADT plugin in my fedora 13 linux machine. When I am trying to run an application, the simulator is not loading. Anybody know what is the issue, is this any permission issue?</p>
<p>Help is highly appriciated.</p>
<p>Thanks,</p>
| android | [4] |
3,514,896 | 3,514,897 | How do I return the index of multiple elements existing in a list in Python? | <pre><code>L=[0,8,5,6,4,5,6,14,8]
</code></pre>
<p>I want to be able to return the index of [4,5,6] (returning 4 in this example).</p>
| python | [7] |
5,254,360 | 5,254,361 | os.unlink multiple file in python | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/991279/deleting-files-by-type-in-python-on-windows">Deleting files by type in Python on Windows</a> </p>
</blockquote>
<p>How can I delete all files with the extension ".txt" in a directory? I normally just do</p>
<pre><code>import os
filepath = 'C:\directory\thefile.txt'
os.unlink(filepath)
</code></pre>
<p>Is there a command like os.unlink('C:\directory\'*.txt) that would delete all .txt files? How can I do that?
Thanks!</p>
| python | [7] |
4,124,325 | 4,124,326 | Buying Android Device for Development | <p>So I am thinking of getting Sprint Nexus S from ebay to do android development. I am wondering whether getting a locked phone will hinder me from doing any kind of development work on the phone (pushing to app market, connecting to internet(i don't care about 3/4G as long as I can use wifi I am good)). What are some things that I should be worried about when getting a locked phone for development? Will the locked phone even run without SIM?</p>
<p>Or is it really necessary for me to get an unlocked phone for development? I currently use iPhone ATT and I am not planning to switch to Sprint.</p>
| android | [4] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.