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,114,071 | 4,114,072 |
Replacing a number in a string with jquery
|
<p>I have a string which has a number in it that I would like to replace with another number.</p>
<p>ie</p>
<pre><code><a href="" id="my_link">blah blah 32 blah blah</a>
</code></pre>
<p>I know there is only going to be 1 number in this string.</p>
<p>I can get this far:</p>
<pre><code>var my_string = $('a#my_link').text();
</code></pre>
<p>But basically I don't know how to then perform a search on my_string for a numeral and replace that number with something else.</p>
<p>Is that possible with jQuery?</p>
<p>Thanks for any ideas.</p>
|
jquery
|
[5]
|
657,323 | 657,324 |
Android: how to implement scrolling/moving background floating buttons and textviews
|
<p>I'm not even sure where to look to do this. I have an already made relative layout with buttons and textviews.</p>
<p>Is it possible to have top layer that the user can interact ( my relative layout) with transparent background </p>
<p>Then a bottom layer thats a background image thats scrolling. Thats outside of the control of the user. For example a scrolling image of space. Thats continually scrolling. </p>
<p>Thanks in advance</p>
|
android
|
[4]
|
2,041,365 | 2,041,366 |
Auto completed text view to filter the items present in the arraylist in android
|
<p>I have Auto completed text view,i want to filter the items present in the listcli arraylist.i enter the text "te" means it shows text as Apple test,Dmn test,Testing,Test 124 etc.But i want to show only Testing,Test 124 etc only.How can i filter these text?Also after enter the text,i click the next button in keyboard it doesn't go for the next edit text field,How do control this the keyboard? </p>
<pre><code>client.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence s, int start, int before,
int count) {
// TODO Auto-generated method stub
cli = client.getText().toString();
actionvalues = ReadXML.getXmlData("WebService", Base_Url
+ "GetclientList?xml=" + client.getText().toString(),
"ClientList", "Client", "CID", "ClientName");
for (int i = 0; i < actionvalues.size(); i++) {
String client = actionvalues.get(i).get("ClientName")
.toString();
</code></pre>
<p>listcli is array list</p>
<pre><code>listcli.add(client);
}
adapter = new ArrayAdapter<String>(SalesActivity.this,
android.R.layout.simple_dropdown_item_1line,listcli);
client.setAdapter(adapter);
</code></pre>
|
android
|
[4]
|
1,305,849 | 1,305,850 |
Cross-thread operation not valid: Asynchronous delegates error
|
<p>I've been trying to learn delegates.I just created a button,label and checkbox. If I click checkbox, the time format changes. If i click the button , i print the date accordingly. However when trying to use asynchromous delegate i.e., to use another thread, i am stuck with an error</p>
<pre><code> public delegate void AsyncDelegate(bool seconds);
public partial class Form1 : Form
{
AsyncDelegate ad;
TimeZ t = new TimeZ();
public Form1()
{
InitializeComponent();
}
private void btn_async_Click(object sender, EventArgs e)
{
ad = new AsyncDelegate(t.GetTime);
AsyncCallback acb = new AsyncCallback(CB);
if (chk_sec.Checked)
{
ad.BeginInvoke(true, acb, null);
}
else
ad.BeginInvoke(false, acb, null);
}
public void CB(IAsyncResult ar)
{
t.Tim = ar.ToString();
ad.EndInvoke(ar);
lbl_time.Text = t.Tim;
}
</code></pre>
<p>and in another class library i get Timez used above. I add a reference of it in the project </p>
<pre><code> public class TimeZ
{
private string tim;
public string Tim
{
get
{
return tim;
}
set
{
tim = value;
}
}
public string GetTime(bool seconds)
{
if (seconds)
{
return DateTime.Now.ToLongTimeString();
}
else
return DateTime.Now.ToShortTimeString();
}
}
</code></pre>
<p>However i get this error when i run the program:</p>
<pre><code> Cross-thread operation not valid: Control 'lbl_time' accessed from a thread other than
the thread it was created on.
</code></pre>
<p>Can u help me out on how to solve this?</p>
|
c#
|
[0]
|
716,998 | 716,999 |
What is Python's Fabric equivalent in other languages?
|
<p>Can someone tell me what's the equivalent of Python's <a href="http://docs.fabfile.org/0.9/" rel="nofollow">Fabric</a> in Python itself, other languages or third party tools? I am still a bit fuzzy on what it is trying to accomplish and it's usage.</p>
|
python
|
[7]
|
3,486,999 | 3,487,000 |
Open contact list to pick contact, or add a new one
|
<p>In my application I need to pick a contact using the default contact application. I do that using:<br>
<code>
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);<br>
startActivityForResult(intent, PICK_CONTACT);
</code><br></p>
<p>But i'm missing the "Create New" button, which is there on the top. How can I get it?</p>
|
android
|
[4]
|
4,185,156 | 4,185,157 |
Error While Opening .pyc Files
|
<p>Whenever I try to open .pyc or .pyo files, I always get an error that says FAILED TO DECODE.</p>
<pre><code>OS: Lion
Python: 3.0.1
</code></pre>
<p><em>I
'm trying to open them in IDLE, it asks me what the current encoding of the file is, and pre-entered is <code>us-ascii</code></em></p>
|
python
|
[7]
|
3,660,789 | 3,660,790 |
Handling Status Bar notification
|
<p>in my app a background service starts and from that service i want to set Status bar notification, that the service has Started following is the code :</p>
<pre><code> Context context = getApplicationContext();
String ns = Context.NOTIFICATION_SERVICE;
int icon = R.drawable.icon;
CharSequence tickerText = "Hello";
long when = System.currentTimeMillis();
Notification notification = new Notification(icon, tickerText, when);
CharSequence contentTitle = "My notification";
CharSequence contentText = "Hello World!";
Intent notificationIntent = new Intent(MyService.this, MyClass.class);
notificationIntent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK);
PendingIntent contentIntent = PendingIntent.getActivity(this,0,notificationIntent,0);
notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);
NotificationManager mNotificationManager = (NotificationManager) getSystemService(ns);
mNotificationManager.notify(1, notification);
</code></pre>
<p>Notification is displayed in Status bar But whin i click on that MyClass.class is not fired.And in log cat it shows
"Input Manager Service Window already focused ignoring focuson ...."</p>
<p>so plz provide solution.</p>
<p>thanks in advance</p>
|
android
|
[4]
|
3,632,856 | 3,632,857 |
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code
|
<p>How can I call a non static method in main class.I am getting the folowing error in my sample console application</p>
<pre><code>Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - non-static method doSomthing() cannot be referenced from a static context
at sample.Main.main(Main.java:20)
</code></pre>
<p>and the code is,</p>
<pre><code>public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
doSomthing();
System.out.print("From Main");
}
protected void doSomthing()
{
System.out.print("From Main doSomthing");
}
}
</code></pre>
|
java
|
[1]
|
2,501,202 | 2,501,203 |
How can i get the buttons to launch a intent
|
<p>How can I get the buttons to link to a intent so when user clicks on one of these arrays it would load up a new java file?</p>
<pre><code>final CharSequence[] items = {"Red", "Green", "Blue"};
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Pick a color");
builder.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
Toast.makeText(getApplicationContext(), items[item], Toast.LENGTH_SHORT).show();
}
});
AlertDialog alert = builder.create();
</code></pre>
|
android
|
[4]
|
4,269,816 | 4,269,817 |
Line breaks in javascript return
|
<p>I'm trying to add line breaks to the response in this already working javascript:</p>
<pre><code>if (/example text/i.test(text)) return "example response";
</code></pre>
<p>I've tried all of the following and none have worked:</p>
<pre><code>if (/example text/i.test(text)) return "example response 1/nexample response 2";
if (/example text/i.test(text)) return "example response 1" + '/n' + "example response 2";
if (/example text/i.test(text)) return "example response 1<br />example response 2";
</code></pre>
<p>etc etc</p>
<p>Is there any easy way to accomplish this inline without adding vars or more complexity to the rest of my code?</p>
|
javascript
|
[3]
|
3,842,698 | 3,842,699 |
How would i delete data from an external file?
|
<p>The format i have in the external file is </p>
<pre><code>name
tel no
mob no
address
</code></pre>
<p>From the gui i would like to delete a contact which is in the format of above using my delete button.</p>
<p>i have completed the export method and was wondering if deleting would be similar,, here is my code for exporting.</p>
<pre><code> {
FileOutputStream file;
PrintStream out;
try { file = new FileOutputStream("../files/example.buab", true);
out = new PrintStream(file);
out.println(txtname.getText());
out.println(txtnum.getText());
out.println(txtmob.getText());
out.println(txtadd1.getText());
System.err.println ("");
out.close();
}
catch (Exception e)
{
System.err.println ("Error in writing to file");
}
}
</code></pre>
|
java
|
[1]
|
2,569,659 | 2,569,660 |
Regular Expression required for condition
|
<p>I need a regular expression which can match a string with the following requirements:</p>
<ol>
<li>Must be between 6 and 64 characters long </li>
<li>Cannot include the following symbols : @, &, ', <, >, !, ", /, #, $, %, +, ?, (, ), *, [ , ] , \ , { , } </li>
<li>Cannot contain spaces, tabs, or consecutive underscores, i.e. __ </li>
<li>Cannot contain elements that imply an email address or URL, such as ".com", ".net", ".org", ".edu" or any variation (e.g. "_com" or "-com") </li>
<li>Cannot start with underscore '_', dash '-' or period '.' </li>
<li>Cannot contain the words "honey" or "allied" </li>
<li>Cannot contain single letter followed by numbers</li>
</ol>
|
asp.net
|
[9]
|
797,926 | 797,927 |
jquery - how could prevent clicked link when I move links with drag&drop?
|
<p>I allow move (drag&drop) some elements which contains inside link (<code>a</code>), After user drop it, it redirects browser to <code>href</code> of moved element. How could I allow to click that element and drag&drop its also?
I use <a href="http://dragsort.codeplex.com/" rel="nofollow">http://dragsort.codeplex.com/</a> plugin.</p>
|
jquery
|
[5]
|
1,079,251 | 1,079,252 |
php date format YYYY-MM-DD minus or add one week from now?
|
<pre><code>today 22-05-2011 so it should be 29-05-2011? ( plus 1 week )
or
today 22-05-2011 so it should be 15-05-2011? ( minus 1 week )
</code></pre>
<p>thanks for looking in.</p>
<p>Adam Ramadhan</p>
|
php
|
[2]
|
5,720,128 | 5,720,129 |
Web Development ported to iPhone
|
<p>We want to make an iPhone app but we would like to be able to do web development on some sort of framework, and then use something to kind of port this into an iPhone app for us.</p>
<p>Is there anything out there that exists like this?</p>
|
iphone
|
[8]
|
4,259,421 | 4,259,422 |
How to detect internet speed in Javascript?
|
<p>How can I create a Javascript page that will detect the user's internet speed and show it on the page? Something like your internet speed is ??/?? Kb/s.</p>
|
javascript
|
[3]
|
2,653,101 | 2,653,102 |
JavaScript slidedown without jQuery
|
<p>I wish to have a similar effect to jQuery slidedown but <strong>without</strong> using jQuery or any other libary. I know it's "possible" as anything in jQuery can be done in plain JavaScript. Just harder.</p>
<p>I cannot use jQuery as everything has to be written in my own code without any libaries used.</p>
<p>Has anyone done something like this or any effects just using plain JavaScript?</p>
|
javascript
|
[3]
|
1,932,223 | 1,932,224 |
json in select tags
|
<p>i will come straight to the point i have this code in html </p>
<pre><code><select id ="list" name = "items[]"></select>
<select id ="list" name = "items[]"></select>
<select id ="list" name = "items[]"></select>
</code></pre>
<p>in jquery i have </p>
<pre><code><script>
jQuery(function($){
$.getJSON('product_json.php', function(data) {
var select = $('#list');
$.each(data, function(key, val){
$('<option/>').attr('value', val.PRODUCTID)
.html('ID ' + val.PRODUCTID)
.appendTo(select);
});
});
});
</script>
</code></pre>
<p>i am getting json data for first select tag but dont in other 2 select tags, i want the same json data in all 3 select tags using same id. in my example id = "list" thanks</p>
|
jquery
|
[5]
|
1,633,124 | 1,633,125 |
Exception on sessionDestroyed when calling another beans method
|
<p>I am facing problem when i am calling database insert method under </p>
<pre><code>public void sessionDestroyed(HttpSessionEvent se)
</code></pre>
<p>sessionDestroyed threw exception of </p>
<pre><code>Session event listener threw exception java.lang.NullPointerException
</code></pre>
<p>my complete code looks like </p>
<pre><code>public void sessionDestroyed(HttpSessionEvent se)
{
UserInfo currentUser = new UserInfo();
AccessHistory loginHist = new AccessHistory();
HttpSession session = se.getSession();
if (session != null) {
if (session.getAttribute("userInfo") != null) {
currentUser = (UserInfo) session.getAttribute "userInfo");
if (currentUser.getUserId() != null )
{
if(!currentUser.getUserId().isEmpty()){
loginHist.setUserId(currentUser.getUserId());
try {
getAccessHistoryDAO().maintHistory(loginHist, false);
} catch (DAOException e) {
e.printStackTrace();
}
}
}
}
}
</code></pre>
<p>any help will be greatly appricated. thank you.</p>
|
java
|
[1]
|
3,862,375 | 3,862,376 |
jquery animate behaving differently in IE
|
<p>This animation runs fine in Firefox, but in IE it runs the first part of the animation the first time you hover over the div and the second part of the animation the second time you hover. I need it all to run at the same time.</p>
<p>Any ideas?</p>
<pre><code>$(document).ready(function() {
$("#test1").hover(
function() {
$(this).animate({
width: "599px",
left: "0px",
height: "168px",
//backgroundColor: "#d7df23",
opacity: 0.95,
borderWidth: "0px"
}, 100).css("z-index", "10");
$(this).find(".thumb").animate({
width: "150px",
height: "150px",
marginTop: "8px",
marginRight: "0px",
marginBottom: "0px",
marginLeft: "12px",
borderColor: "#FFF"
}, 100).attr('src','images/home/animatedMenu/brochureRequestIMG.jpg');
}, function() {
});
});
</code></pre>
|
jquery
|
[5]
|
2,429,243 | 2,429,244 |
Python: sorting a list using two keys which sort in a different direction
|
<pre><code>>>> from operator import itemgetter
>>> ul = [(10,2),(9,4),(10,3),(10,4),(9,1),(9,3)]
>>> ol = sorted(ul, key=itemgetter(0,1), reverse=True)
>>> ol
[(10, 4), (10, 3), (10, 2), (9, 4), (9, 3), (9, 1)]
</code></pre>
<p>What I want is to sort reverse=False on the second key. In other words, I want the result to be:</p>
<pre><code>[(10, 2), (10, 3), (10, 4), (9, 1), (9, 3), (9, 4)]
</code></pre>
<p>How do I do this?</p>
|
python
|
[7]
|
1,202,676 | 1,202,677 |
what next after 'dive into python'
|
<p>I've been meaning to learn another language than java. So I started to poke around with python. I've gone over 'dive into python' so I have a decent knowledge about python now. </p>
<p>where do you suggest I go from here? I dont want to go through another advanced book again and would like to use the python knowledge towards building 'something'. </p>
<p>I've heard that python is good for web crawling, however, I did not see that in dive into python. Can the community suggest how to use my pythong knowledge towards web crawlers or spiders?</p>
|
python
|
[7]
|
1,069,332 | 1,069,333 |
email users using array from foreach
|
<p>i asked a previous question about his but it has changed since, i would like to create an array from the db query '$to' and use it in the <code>email_to_user()</code> function. This will hopefully email all users from the <code>$entry->dept</code> array.</p>
<p>when $entry->dept = 1 this works and emails the user from department #1
when $entry->dept = 1,30 the email function fails</p>
<pre><code>$divisions = explode(",", $entry->dept);
foreach($divisions as $division) {
$divs=get_record('induction_emails','id',$division);
$useremail = get_record('user', 'email', $divs->email);
$to = get_record('user', 'id', $useremail->id);
}
if (email_to_user($to, $from, $subject, $body)){
redirect('thanks.php');
die;
}
else {
}
?>
</code></pre>
<p>Cheers for any help, much appreciated.</p>
|
php
|
[2]
|
4,479,805 | 4,479,806 |
Number bound to function name
|
<p>There is code:</p>
<pre><code>def somefun():
print "hi"
print somefun
</code></pre>
<p>Result is:</p>
<pre><code><function somefun at 0x0153DDF0>
</code></pre>
<p>What's 0x0153DDF0?</p>
|
python
|
[7]
|
1,482,602 | 1,482,603 |
Javascript beginner: how to replace a href text if it matches a specified string?
|
<p>When someone posts a link to another page on my website, I'd like to shorten the a href text from something like: <code>http://mywebsite.com/posts/8</code> to <code>/posts/8</code> or <code>http://mywebsite.com/tags/8</code> to <code>/tags/8</code>. Since I'm learning javascript I don't want to depend on a library like prototype or jquery. Is it recommended to use javascript's <code>replace</code> method?</p>
<p>I found w3schools' page <a href="http://www.w3schools.com/jsref/jsref_replace.asp" rel="nofollow">here</a> but my code was replacing all instances of the string, not just the href text.</p>
<p>Here's what I have so far:</p>
<pre><code><script type="text/javascript" charset="utf-8">
var str="http://www.mywebsite.com";
document.write(str.replace("http://www.", ""));
</script>
</code></pre>
|
javascript
|
[3]
|
1,501,454 | 1,501,455 |
How are lambda expressions bound to a class?
|
<p>If I set up a class like below in Python, as I expect the lambda expressions created should be bound to the class A. I don't understand why when I put a lambda inside a list like in <code>g</code> it isn't bound.</p>
<pre><code>class A(object):
f = lambda x,y: (x + y)
g = [lambda x,y: (x + y)]
a = A()
#a.f bound
print a.f
<bound method A.<lambda> of <__main__.A object at 0xb743350c>>
#a.g[0] not bound
print a.g[0]
<function <lambda> at 0xb742d294>
</code></pre>
<p>Why is one bound and not the other?</p>
|
python
|
[7]
|
3,325,512 | 3,325,513 |
jquery variable scope problem
|
<p>I have a chat class with two methods: updateChat and sendChat.</p>
<pre><code>//chat.js
var state;
var room;
function Chat (theRoom) {
this.update = updateChat;
this.send = sendChat;
this.room = theRoom;
}
function updateChat(){
alert('ROOM: '+this.room);
$.ajax({
type: "POST",
url: "/chat/process.php",
data: {
'function': 'update',
'state': state,
'room': this.room
},
dataType: "json",
success: function(data){
if(data.text){
for (var i = 0; i < data.text.length; i++) {
$('#chat-area').append($("<p>"+ data.text[i] +"</p>"));
}
}
if(data.state)
state = data.state;
}
});
}
}
//send the message
function sendChat(message, nickname)
{
alert('A'+state); //20
//XXX
updateChat();
alert('B'+state); //20
$.ajax({
type: "POST",
url: "/live-event/chat/process.php",
data: {
'function': 'send',
'message': message,
'nickname': nickname,
'room': this.room
},
dataType: "json",
success: function(data){
alert('C'+state); //wrong!: 2 //it should be 20!
//XXX
updateChat();
alert('D'+state); //21
},
});
}
</code></pre>
<p>The constructor of the chat object:</p>
<pre><code>var chat = new Chat(4); //4 = the number of the chat room
chat.send('test', 'tester');
</code></pre>
<p>My problem are the method calls at the locations marked with XXX.
In the updateChat() method, this.room is undefined if I call the updateChat methods like that.
But I need to pass the room number to get the right state (state is simply the number of lines in the chat room's text file).</p>
<p>I think it's a problem with variable scope or with the methods not being called in the context of the object.</p>
|
javascript
|
[3]
|
4,083,479 | 4,083,480 |
ini_set not working
|
<p>Here is the matter:</p>
<pre>
ini_set('display_errors', '1');
ini_set('safe_mode', '0');
ini_set('allow_url_fopen', '1');
ini_set('allow_url_include', '1');
print_r(ini_get_all());
</pre>
<p>And I get:</p>
<pre>
Array(
[allow_url_fopen] => Array
(
[global_value] => 1
[local_value] => 1
[access] => 4
)
[allow_url_include] => Array
(
[global_value] =>
[local_value] =>
[access] => 4
)
</pre>
<p>Why I cannot set that variable within the php ini_set function? The directive is specified as PHP_INI_ALL then it can be defined within the ini_set() function!
<a href="http://php.net/manual/en/ini.list.php" rel="nofollow">http://php.net/manual/en/ini.list.php</a></p>
|
php
|
[2]
|
4,443,420 | 4,443,421 |
How to setup parsing emails?
|
<p>How do I setup a server so I can get emails and parse them in python?</p>
|
python
|
[7]
|
2,908,092 | 2,908,093 |
java: file read, modify outside, then read again, modification not seen
|
<p>I have set of files which will be served by a servlet based on a parameter. The servlet opens stream to required file, reads, writes to http response and closes the stream. Now this file can be modified manually and saved. Then next time a request comes for this file, servlet opens a stream to this file, writes it to the response, but I see the content is not the modified one, its the old one. </p>
<p>If I restart tomcat, servlet responds with modified content. Can it be made to read the modified content without restart?</p>
<p>Its not tomcat caching, the string read from file reader itself is unchanged.</p>
<p>thanks!</p>
<p>Here's the content of the servlet-</p>
<pre><code>InputStream fhandle=this.getClass().getClassLoader().getResourceAsStream("responses/"+file);
if(fhandle!=null){
Reader fr=new InputStreamReader(fhandle);
PrintWriter out=resp.getWriter();
int a=-1;
FileWriter fos=new FileWriter("copyFile.xml"); //to compare what's read with actual file
while((a=fr.read())>=0){
fos.write(a);
out.write(a);
}
out.flush();
fos.close();
fr.close();
fr=null;
fhandle.close();
fhandle=null;
System.gc();
}
else
System.out.println(file+" not found");
</code></pre>
<p>After hitting the servlet for first time, I will edit the file and save it. Now again I will hit the same servlet for the same file, and I will not get the edited content.</p>
|
java
|
[1]
|
3,566,379 | 3,566,380 |
list view error android
|
<p>this is my code:</p>
<pre><code>@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final ListView listView = (ListView) findViewById(R.id.mylist);
final Button b=(Button)findViewById(R.id.b);
b.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// Perform action on click
while(i<30){
String stringValue = Integer.toString(i);
tt[i] = sendPostDataToInternet(stringValue);
i++;
}
//TextView f=(TextView)findViewById(R.id.cc);
//f.setText(tt[1]+tt[2]+tt[3]);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(v.getContext(),
android.R.layout.simple_list_item_1, android.R.id.text1, tt);
listView.setAdapter(adapter);
}
});
}
</code></pre>
<p>I tried to set the data to text and it worked, but when I set it into a listview it gives</p>
<pre><code>at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
</code></pre>
<p>whats the matter
Thanks.</p>
|
android
|
[4]
|
1,527,419 | 1,527,420 |
Video manipulation using ffmpeg library
|
<p>I need a proper documentation and explanation of the ffmpeg library files that we can use to do programming so as to make a video editor that is capable of adding effects in video and merging 2 different video files.I want to make the editor for android,although i got the android specific ffmpeg files from <a href="http://bambuser.com/opensource" rel="nofollow">http://bambuser.com/opensource</a> but i am unable to utilize them for my purpose.
I tried a simple c program in devC++ using the header files like avcodec.h avformat.h given in ffmpeg but getting linker error for function like av_register_all,av_open_input_file.</p>
|
android
|
[4]
|
5,576,814 | 5,576,815 |
Put a string into an array
|
<p>I have a string that contains this:</p>
<p><code>array(a=1, b=2, c=array(ca=23, cb=45),d=array(da=342, db=array(dba=3154, dbb=8746), dc=765),e=8)</code></p>
<p>Now, I need to create an array from the contents of this string. I tried it this way:</p>
<pre><code>$arrValues = array();
$arrValues = $strVar;
var_dump($arrValues);
</code></pre>
<p>But of course, as was to be expected, this just gives you an array with 1 item of type string, and the whole shebang in it.</p>
<p>Any tips?</p>
|
php
|
[2]
|
3,595,538 | 3,595,539 |
How to use shared array between function calls in objective C
|
<p>I have one array.
I want that array to retain its value between function calls of from single class function.</p>
<p>I have function that is called every time page is loaded. </p>
<p>This function displays all the data stored in array right from application launches.</p>
<p>Thanks in advance.</p>
|
iphone
|
[8]
|
1,582,600 | 1,582,601 |
if AutoFlush slowdown system, bad for HDD or something like that when used intensive?
|
<p>I write a lot of logs every day (millions of strings per day, up to 1 Gb of logs). I'm interested if when I set <code>AutoFlush</code> I significantly slow-down computer or "damaging" HDD (SaS 15000 if this is important)? Will HDD do some expensive extra operations every time new line is wrote (like opening file, modifing closing etc. etc.)</p>
<p>Well likely I just should not use <code>AutoFlush</code> but sometimes I want to use it to troubleshoot other problems.</p>
|
c#
|
[0]
|
2,827,024 | 2,827,025 |
How to redirect in php with customized url
|
<p>I need to write a php page that opens an existing url with customized query strings (essentially redirect).</p>
<pre><code>"http://existingurl?test=pass&newparam=".$_REQUEST['u'];
</code></pre>
<p>How to do that?</p>
|
php
|
[2]
|
1,165,967 | 1,165,968 |
php sessions wont save form data
|
<p>Here's what I have so far. The problem is when I hit submit it takes me to the next page, but the session does not store the first name. If I remove the action, so it's action="" then the session saves the first name. Why does this happen and how do I fix it?</p>
<pre><code>...html stuff...
<?php
session_start();
if(isset($_POST['submit'])){ $_SESSION['firstName'] = $_POST['firstName']; }
?>
<form method="POST" action="nextPage.php">
<input name="firstName" type="text" size="70"/>
...
<input type="submit" name="submit" value="Continue"/>
</form>
</code></pre>
|
php
|
[2]
|
3,089,221 | 3,089,222 |
How to fetch the label text from string using jquery
|
<p>I want to fetch the text of checkbox label in the given code:</p>
<pre><code><label id="age_global_2" class="checked">
<input type="checkbox" value="3016" name="age_global">
2 - 3 Years
</label>
</code></pre>
|
jquery
|
[5]
|
1,799,563 | 1,799,564 |
problem with g++ and "undefined reference to `__gxx_personality_v0'"
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/203548/undefined-symbol-gxx-personality-v0-on-link">Undefined Symbol ___gxx_personality_v0 on link</a> </p>
</blockquote>
<p>I have a problem, I have the Following programm</p>
<pre><code>// fkt.cpp
#include "fkt.h"
int add2(int a, int b)
{
return a+b;
}
</code></pre>
<p>and the header:</p>
<pre><code>// fkt.h
int add2(int a, int b);
</code></pre>
<p>now I compile this with: <code>g++ -c fkt.cpp</code></p>
<p>now I run <code>nm</code> and get:</p>
<pre><code>00000000 T _Z6add2ii
U __gxx_personality_v0
</code></pre>
<p>when I want to use the function anywhere I get:</p>
<pre><code>(.eh_frame+0x12): undefined reference to `__gxx_personality_v0'
</code></pre>
<p>how can I solve this problem? (i'm using ubuntu linux)</p>
|
c++
|
[6]
|
2,809,974 | 2,809,975 |
Running PHP in apache
|
<p>Im a newbie to PHP and trying to run this code in apache webserver but for some reason its not running.</p>
<p>The file is saved under htdocs info.php. WHen I run there is no action at all..Infacts it opens the download window.</p>
<p>ANy help is appreciated</p>
<p>php code:</p>
<pre><code><?php
date_default_timezone_set('America/Los_Angeles');
echo date("F j, Y, g:i:s a");
?>
</code></pre>
|
php
|
[2]
|
5,489,694 | 5,489,695 |
How to solve fatal exception
|
<pre><code> WARN/dalvikvm(4645): threadid=7: thread exiting with uncaught exception (group=0x4001d800)
ERROR/AndroidRuntime(4645): FATAL EXCEPTION: Timer-0
ERROR/AndroidRuntime(4645): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
ERROR/AndroidRuntime(4645): at android.os.Handler.<init>(Handler.java:121)
ERROR/AndroidRuntime(4645): at android.widget.Toast.<init>(Toast.java:68)
ERROR/AndroidRuntime(4645): at android.widget.Toast.makeText(Toast.java:231)
ERROR/AndroidRuntime(4645): at com.example.Task.jokedescription$1.run(jokedescription.java:186)
ERROR/AndroidRuntime(4645): at java.util.Timer$TimerImpl.run(Timer.java:289)
WARN/ActivityManager(59): Force finishing activity com.example.Task/.jokedescription
</code></pre>
|
android
|
[4]
|
2,092,752 | 2,092,753 |
How can I shorten a singleton call?
|
<p>I have a singleton class that basically deals with logs. Every place at which I call it in the code, I have to type:</p>
<pre><code>LogClass::GetInstance()->WriteToLog("text");
</code></pre>
<p>How can I shorten this call so that I can just type <code>WriteToLog("text")</code> and it will call the function on the singleton object?</p>
|
c++
|
[6]
|
2,427,795 | 2,427,796 |
Static Method call from unknown object
|
<p>I want to call a static method from one of my objects. This is no problem if I know the name of the object, but in this case, I don't.<br>
I have an array with several object names and I want to call the method from one of this arrays elements. So, it looks something like this:</p>
<pre><code>function call_method($key) {
$tmp = array('key1' => 'objectname1','key2' => 'objectname2','key3' => 'objectname3');
if(array_key_exists($key, $tmp)) {
$tmp::static_method();
}
}
</code></pre>
<p>But, this solution is not working. Does somebody know how to get this working?</p>
|
php
|
[2]
|
1,641,056 | 1,641,057 |
Data Source in connection string - Setup project
|
<p>I'm creating a setup project for my C# desktop application.
What the data source should be written in the connection string for the access database ?and where I should put my database file in the solution project ?</p>
|
c#
|
[0]
|
31,756 | 31,757 |
javascript deleting the array of elements
|
<p>i am having 10 check boxes.if i click the value of the check box has to push to the array,if i unchecked the check box then the corresponding check box value has to be deleted from the array?
pls...anyone give reply for this</p>
|
javascript
|
[3]
|
267,421 | 267,422 |
Creating simple bookmarklet in javascript
|
<p>I'm trying to pick up the selected text of a document in a bookmarklet. How do I implement this?</p>
<p>I got this from the internet. Why does this not work?</p>
<p>javascript:
Q=document.selection?document.selection.createRange().text:document.getSelection(); alert(Q);</p>
<p>Thanks!</p>
|
javascript
|
[3]
|
1,520,439 | 1,520,440 |
Reading inputs in java
|
<p>Hello everyone I'm trying to improve my Java skills by solving some problems from ACM, now the thing is my sample input looks like this :</p>
<pre><code> 3 100
34 100
75 250
27 2147483647
101 304
101 303
-1 -1
</code></pre>
<p>So at first I'm just trying to read them but its not working here is the java code:</p>
<pre><code>import java.io.BufferedInputStream;
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner stdin = new Scanner(new BufferedInputStream(System.in));
while (stdin.hasNext()) {
System.out.println(stdin.nextInt() + " and the next " + stdin.nextInt());
}
}
}
</code></pre>
<p>I'm trying to send these inputs as an argument, and not by reading them from file, here is how:</p>
<p><img src="http://i41.tinypic.com/j61npu.gif" alt="alt text"></p>
<p>The program just spins(executes) but not printing anything. How can I fix this?</p>
|
java
|
[1]
|
4,795,396 | 4,795,397 |
What is __return__?
|
<p>I am debugging a script in Python 3.1 and discovered this:</p>
<blockquote>
<p>(Pdb) p locals()
{'count': 264, 'self': , 'depth': 1, 'offset': 0, <strong>'__return__': None,</strong> 'blkno': 4, 'size': 264}</p>
</blockquote>
<p>I found <a href="http://www.python.org/dev/peps/pep-0316/" rel="nofollow">deferred PEP</a> that mentions it, and little else.</p>
<p><strong>What is <code>__return__</code>?</strong> When was it added? How is it useful?</p>
|
python
|
[7]
|
929,136 | 929,137 |
Firefox 4 JS fails to send ~6th AJAX request while other browsers work as expected
|
<p>I'm using jquery to post a form back to the server and it works very reliably on all browsers except FF4 on an older Windows XP setup. It reaches the point where the XHR should have been sent, but I never see the request in the server log.</p>
<p>The machine isn't mine, but is one of my Beta Testers. It's been a consistent problem, but I'm not sure how to debug it. He isn't a web developer, just a friend of a friend that happened to be willing to test a game for us. If he restarts FF, it works about 6 more times and then it fails.</p>
<p>It's a facebook app, and there are other XHRs that Facebook is doing, so the 6th request is in my app. My app is NOT a single page app, but uses 2 XHRs within this one page, one right after page load, and one about 4 minutes later. I'm using setTimeout a bit, but otherwise, nothing else other than trapping keystrokes.</p>
<p>This same code works on a old G4 Mac running Safari 3.0 just fine, without ANY issues for hours at a time.</p>
<p>How do you troubleshoot something like this. Not sure I want to try to get into a remote Firebug session....</p>
|
jquery
|
[5]
|
1,321,242 | 1,321,243 |
How can I leave a message in crashlog when I catch an exception?
|
<p>I want to leave a message in crashlog when I catch an exception. Does NSLog() work?</p>
|
iphone
|
[8]
|
6,010,107 | 6,010,108 |
Unexpected Error
|
<p>So I can't figure out why my app wont load... There are no errors.</p>
<p><a href="http://pastebin.com/ssXXhiWw" rel="nofollow">Link to onCreate (Its kinda big)</a></p>
<p>Maybe it has to do with tabhost? new to that, first attempt...</p>
<p>Hopefully someone can help.</p>
<p>Thanks,
Brandon</p>
|
android
|
[4]
|
3,356,120 | 3,356,121 |
Is AppendHeader exactly the same as AddHeader?
|
<p>We use ASP.Net 4.0. In our code we regularly use <code>Response.AddHeader("x", "y")</code>. Is this exactly the same as <code>Response.AppendHeader("x", "y")</code>? I read that AppendHeader only exists for compatibility with classic ASP, which we do not use.</p>
<p>Can we, without any concerns, replace AddHeader with AppendHeader?</p>
|
asp.net
|
[9]
|
4,350,958 | 4,350,959 |
spawnining more threads
|
<p>I have developed a program in which the thread A waits for Thread B to complete it task and when thread B finishes its task it makes notfiy() to thread A to continue onwards..below is the code..</p>
<pre><code> class ThreadA {
public static void main(String [] args) {
ThreadB b = new ThreadB();
b.start();
synchronized(b) {
try {
System.out.println("Waiting for b to complete...");
b.wait();
} catch (InterruptedException e) {}
System.out.println("Total is: " + b.totals);
}
}
}
class ThreadB extends Thread {
public int totals;
public void run() {
synchronized(this) { //instance level lock
for(int i=0;i<100;i++) {
totals += i;
}
notify();
}
}
}
</code></pre>
<p>Now I want lets say 3 more thread are waiting for thread b , so please advise me how to spawn 3 more threads , just like thread A is waiting , please advise.</p>
|
java
|
[1]
|
5,911,895 | 5,911,896 |
jquery context menu plugin - Where is the right click event type?
|
<p>I was studying the code for the plugin below and wondering where and when does it tie the "Right Click" event. All it does is </p>
<p>Plugin reference link : <a href="http://www.javascripttoolbox.com/lib/contextmenu/" rel="nofollow">http://www.javascripttoolbox.com/lib/contextmenu/</a></p>
<p><code>$(this).bind('contextmenu',function(e){cmenu.show(this,e);return false;});</code></p>
<p>and "contextmenu" is a custom jquery event type.</p>
<p>Can someone please explain how all this works</p>
<p>I did check there are click events but those are tied to the menu items and not the element to which the menu is tied.</p>
<p>Thanks</p>
<p>Answer: "contextmenu" is not a custom event type. It is actually another name (mapping etc) for 'right click'</p>
|
jquery
|
[5]
|
2,482,404 | 2,482,405 |
How to bring back library functions which have been deleted?
|
<p>Suppose I do this</p>
<pre><code>import cmath
del cmath
cmath.sqrt(-1)
</code></pre>
<p>I get this</p>
<pre><code>Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'cmath' is not defined
</code></pre>
<p>But when I import <code>cmath</code> again, I am able to use <code>sqrt</code> again</p>
<pre><code>import cmath
cmath.sqrt(-1)
1j
</code></pre>
<p>But when I do the following</p>
<pre><code>import cmath
del cmath.sqrt
cmath.sqrt(-1)
</code></pre>
<p>I get this</p>
<pre><code>Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'sqrt'
</code></pre>
<p>Even when I import <code>cmath</code> again, I get the same error.</p>
<p>Is it possible to get <code>cmath.sqrt</code> back?</p>
<p>Thanks!</p>
|
python
|
[7]
|
1,172,782 | 1,172,783 |
How to show 2 Maps in 1 application at same time using Fragments
|
<p>My problem is I have to run 2 different maps at the same time in same application. Both maps will be visible at same time. I am working on Android 3.2 and using Fragments.</p>
<p>I know "Only one MapActivity is supported per process. Multiple MapActivities running simultaneously are likely to interfere in unexpected and undesired ways." I also checked discussions of running activity in different process with android:process tag. <a href="http://code.google.com/p/android/issues/detail?id=3756#c7" rel="nofollow">http://code.google.com/p/android/issues/detail?id=3756#c7</a></p>
<p>Currently, I am creating an Activity with two fragments and each fragment contains a TabHost. Each TabHost contains a map activity.
</p>
<p>Though I have specified process of each MapActivity but I still get RecyclingMapObject error in Logcat and same map object is reused. Kindly suggest if we can any workaround so that 2 Maps can be displayed at the same time.</p>
<p>Sample source code used from <a href="https://github.com/inazaruk/examples/tree/master/MapFragmentExample" rel="nofollow">https://github.com/inazaruk/examples/tree/master/MapFragmentExample</a>.</p>
<p>Thanks & Regards,
Vibhor</p>
|
android
|
[4]
|
5,337,256 | 5,337,257 |
check compiler with break point
|
<p>When I tried to focus on compiler in code, I made break point on code.</p>
<pre><code>if (!IsPostBack)
{
using (SqlConnection Con = Connection.GetConnection())
{
if (Request.QueryString["Category_Id"] != null &&
DDlProductFamily.SelectedIndex < 0)
{
SqlCommand Com = new SqlCommand("SelectAllCtageories_Front", Con);
Com.CommandType = CommandType.StoredProcedure;
Com.Parameters.Add(Parameter.NewInt(
"@Category_Id", Request.QueryString["Category_Id"]));
SqlDataAdapter DA = new SqlDataAdapter(Com);
DA.Fill(dt);
DataList1.DataSource = dt;
DataList1.DataBind();
}
</code></pre>
<p>But I cannot check condition although I had the value of query string.</p>
|
c#
|
[0]
|
5,984,545 | 5,984,546 |
Getting response from server in javascript
|
<p>How does I get the response from the server in JavaScript? This is my sample code:</p>
<pre><code>function get_Image(values) {
if (window.XMLHttpRequest) {
var http_request = new XMLHttpRequest();
} else if (window.ActiveXObject) {
var http_request = new ActiveXObject("Microsoft.XMLHTTP");
} else {
http_request.open("GET", "http://sample_address_for_server", true);
http_request.send();
}
alert(http_request.status);
if (http_request.readyState == 4) {
if (http_request.status == 200) {
xmlDoc = http_request.responseText;
alert(xmlDoc);
}
}
}
</code></pre>
|
javascript
|
[3]
|
3,387,425 | 3,387,426 |
documnet.getElementById does not fetch the value . what is going wrong?
|
<p>i am sure this is quite a numb question to ask and most probably the most basic one. i am just a starter for JS.</p>
<p>i am trying to access the value of input field by document.getElementById and it is returning null to me i am not sure why here is the code.</p>
<pre><code><html>
<head>
<script type="text/javascript">
var name = document.getElementById("e_name");
alert(name);
</script>
</head>
<body>
<form action="" method="post">
<input type="text" name="name" id="e_name" value="Enter your Name"/>
<input type="submit" name="submit"/>
</form>
</body>
</html>
</code></pre>
<p>the following code prints the value null in alert box. what is wrong?</p>
<p>Update :</p>
<p>When i use the following code.</p>
<pre><code><html>
<head>
</head>
<body>
<form action="" method="post">
<input type="text" name="name" id="name" value="Enter your Name"/>
<input type="submit" name="submit"/>
</form>
<script type="text/javascript">
var name = document.getElementById('name').value;
alert(name);
</script>
</body>
</html>
</code></pre>
<p>it prints Enter your Name but if i change the value it does not print the changed value. i would want to perform the following for validation purpose</p>
<p>a) holds the value of e_name in a javascript variable in the head tag</p>
<p>b) so that i should be able to process it for validation.</p>
<p>how do i do it?</p>
|
javascript
|
[3]
|
872,464 | 872,465 |
How to call a function from a function argument in JavaScript?
|
<p>So I read the tutorial from some web, and they did something like this.</p>
<pre><code>function populateDB(tx) {
tx.executeSql('DROP TABLE IF EXISTS DEMO');
tx.executeSql('CREATE TABLE IF NOT EXISTS DEMO (id unique, data)');
tx.executeSql('INSERT INTO DEMO (id, data) VALUES (1, "First row")');
tx.executeSql('INSERT INTO DEMO (id, data) VALUES (2, "Second row")');
}
function errorCB(err) {
alert("Error processing SQL: "+err.code);
}
function successCB() {
alert("success!");
}
var db = window.openDatabase("Database", "1.0", "Cordova Demo", 200000);
db.transaction(populateDB, errorCB, successCB);
</code></pre>
<p>In the last line, they called the method transaction from object db, and there are 3 functions in the argument field, but isn't the functions populateDB, errorCB both need an argument as well? Where is that argument being called?</p>
|
javascript
|
[3]
|
686,559 | 686,560 |
How to test drag & drop functionality of an image?
|
<p>I want to test the drag & drop functionality of an image. My application is
developed in <code>Java</code>. I have one image box in my application from which I have to drag and
drop image to a fixed panel.</p>
|
java
|
[1]
|
1,012,606 | 1,012,607 |
print value of check box
|
<p>i have 10 check box. I want to capture in array and print value as the user checked checkbox. if he uncheck, value should be unprinted. </p>
|
jquery
|
[5]
|
315,503 | 315,504 |
Should structs always be immutable?
|
<p>I was reading a couple of threads on here about structs and there is/was one about structs and how they should be representing immutable values (eg like a digit - 1) because of their value type behaviour/semantics.</p>
<p>But on the other hand, structs represent things like phone numbers, which can change for the same household.</p>
<p>Is this a hard and fast rule?</p>
|
c#
|
[0]
|
734,536 | 734,537 |
how to store NSDictionary in NSUserdefaults and how can i retrieve from it
|
<p>I am getting some info from web server like this.</p>
<pre><code>970,
Aditya2,
B,
JNTU1,
"Ram@gamil.com"
</code></pre>
<p>I need to store these values and i need to retrieve it from there where i want.</p>
<p>i found NSDictionary is correct for this.</p>
<p>I need to save these values in NSDictionary.</p>
<p>How can i done this.</p>
<p>can any one pls help me.</p>
<p>Thank u in advance.</p>
|
iphone
|
[8]
|
1,475,081 | 1,475,082 |
Why variable is initialized to undefined eventhough block is not executed?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/500431/javascript-variable-scope">JavaScript Variable Scope</a> </p>
</blockquote>
<pre><code>var flag = false;
if(flag === true)
{
var you = "great";
}
</code></pre>
<p>Variable "you" is initialized with undefined, it shows undefined instead of showing reference error when printed. why?</p>
|
javascript
|
[3]
|
4,583,689 | 4,583,690 |
How do I create a script that appends the file create date to filename using python?
|
<p>I would like to create a python script that
appends the file created date to the end of the filename while retaining the oringinal file name ("Report") for a batch of pdf documents.</p>
<pre><code>directory = T:\WISAARD_Web Portal Projects\PortalLogging\WebLogExpert
filenames = Report.pdf
</code></pre>
<p>Thank you for your help.</p>
|
python
|
[7]
|
4,477,661 | 4,477,662 |
List of string type in C#
|
<p>I have a list </p>
<pre><code> List<string> ParamValues = new List<string>();
ParamValues.Add(txtEmployeeId.Text);
ParamValues.Add(txtPassword.Text)
</code></pre>
<p>in a Login.aspx.cs file.</p>
<p>I want to use this list as a parameter of a method. The method is in a DataAccess.cs class file.
How can i do it?</p>
|
c#
|
[0]
|
3,736,314 | 3,736,315 |
How can I group together multiple variables so they act the same?
|
<p>I have an effect that I want to have happen to all 3 different elements when you hover any one of them but I'm having trouble grouping the variables together so they can all act the same</p>
<p>The code I wrote was what I thought would group them together.</p>
<pre><code> var germany=new Array();
germany[0]=germany1_poly;
germany[1]=germany2_poly;
germany[2]=germany3_poly;
google.maps.event.addListener(germany, "mouseover",function() {
germany.setOptions({ fillColor: "#ff0000", strokeColor: "#ff0000" });
});
</code></pre>
|
javascript
|
[3]
|
5,073,189 | 5,073,190 |
How can I control the Windows 7 mixer programmatically?
|
<p>Windows 7 has per-application volume controls that let you mute applications individually. How can I mute and unmute an application from a console app?</p>
|
c#
|
[0]
|
5,870,818 | 5,870,819 |
How to change the brightness after starting and stopping the service in Android?
|
<p>In my application, when i am starting the Broad Cast Reciever, i am putting the phone in Dim Mode. For this i am using the below code:</p>
<pre><code>android.provider.Settings.System.putInt(getContentResolver(),android.provider.Settings.System.SCREEN_BRIGHTNESS, 0);
</code></pre>
<p>Before that, i am storing the previous brightness using Shared Preference and when i am stopping my application, i am changing the brightness to the previous stored brightness.</p>
<pre><code> float brightness = myPrefs.getFloat("previous_bright", 0.0f);
android.provider.Settings.System.putFloat(context.getContentResolver(),android.provider.Settings.System.SCREEN_BRIGHTNESS, brightness);
</code></pre>
<p>Now it is going to the dim mode. But when i am stopping the application, first i have to press the power button of the device and then i have to unlock it. Then only it is changing to its previous brightness. I am checking it in Google Nexus One. How an i change it without locking and unlocking it??</p>
<p>My OS version is 2.2. And it is coming fine in Android Tablet(Olive Pad).</p>
|
android
|
[4]
|
2,223,310 | 2,223,311 |
How to set an image as a background of a graph?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/10054202/how-to-set-a-background-image-in-graph">How to set a background image in graph?</a> </p>
</blockquote>
<p>I am implementing one application related to graphs.</p>
<p>I am using Achartengine.jar is used to implement the graph.</p>
<p>My problem is when i am setting background color to graph it is applied fine.</p>
<p>I want set an image as a background of graph.</p>
<p>But it is not set properly.</p>
<p>When i set an image as background, the image is displayed within x,y-axis.</p>
<p>Not displayed on the margins of X,Y-axis.</p>
<p>my code is as follows</p>
<p><a href="http://stackoverflow.com/questions/10054202/how-to-set-a-background-image-in-graph">How to set a background image in graph?</a></p>
<p>if any one know how to rectify this problem please help me.</p>
<p>Thanks in advance.</p>
|
android
|
[4]
|
3,176,910 | 3,176,911 |
My php code gets commented out by the browser
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/9368841/php-code-gets-turned-into-html-comments">PHP: Code gets turned into HTML <!— Comments? --></a> </p>
</blockquote>
<p>I have some very, very simple php code.</p>
<pre><code><html>
<head>
<title>Something</title>
</head>
<body>
<h2>Something</h2>
<?php
$val = $_POST['a'];
echo 'Value: ' . $val . '<br />;
?>
</body>
</html>
</code></pre>
<p>When I press the submit button in an form I've made, the browser comments out the php code like this:</p>
<pre><code><!--?php
//the stuff i do above
?-->
</code></pre>
<p>Anyone knows what this is?</p>
|
php
|
[2]
|
1,857,372 | 1,857,373 |
Determining the class of a method
|
<p>Let's say I have:</p>
<pre><code>class User():
def method(self):
pass
u=User()
</code></pre>
<p>How do I extract the class from <code>u.method</code> through the <code>access</code> decorator? All I get from <code>u.method</code> is that it is a function... but I'd like to know from which <code>class</code>.</p>
<p>I am interested in a python 2.7 solution.</p>
<p><strong>Update</strong>: I forget to mention I didn't give enough details:</p>
<pre><code>class access():
"""
Decorator for specifying which 'access right' must be enforced
at the object method level
"""
def __init__(self, right):
self.right=right
def __call__(self, method):
### need to grab the method's class name here
</code></pre>
<p>I am actually using a decorator:</p>
<pre><code>class User():
@access("edit"
def method(self):
pass
</code></pre>
|
python
|
[7]
|
8,012 | 8,013 |
apk and performance
|
<p>after i develope my application i try to run my <code>apk</code> every thing works fine
and i go to the <code>setting</code> and take a screenshot of some <code>application</code> to show you</p>
<p>look at the picture
to know what i am taking about
<img src="http://i.stack.imgur.com/TLYAa.png" alt="http://im27.gulfup.com/daf61.png"></p>
<p>I would like help understanding exactly what information this screen gives to me and how to use it.</p>
<p>knowing that i use <code>android</code> </p>
|
android
|
[4]
|
3,444,067 | 3,444,068 |
Preventing second static HTML page from loading
|
<p>I have a link on a page. When the user clicks the link a static HTML page loads. I would like to prevent the user from launching a second instance of the same static HTML document. </p>
<p>I'm thinking some javascript up front in the static HTML page might do. Basically if the script detects that there is already an instance of the static HTML document loaded then a Javascript pop-up would indicate to the user that 'document is already loaded" (something like that). </p>
<p>Anyhow, Java script is not my strong point so wondering if someone can please shed some light on this. </p>
|
javascript
|
[3]
|
1,883,840 | 1,883,841 |
PHP: How to use this code on different page
|
<p>I'd like to use the code below for multiple pages. I tried putting the <code>$listloadpage</code> in an <code>array("page-1", "page-2")</code> but <code>stristr()</code> doesn't work that way.</p>
<pre><code>$currentpage = $_SERVER['REQUEST_URI'];
$listloadpage = "page-1";
if(stristr($currentpage, $listingloadpage) !== false)
{
$database->query('SELECT id, name FROM table_1 ORDER BY name', array());
$results = $database->statement->fetchAll(PDO::FETCH_ASSOC);
}
</code></pre>
<p>I'd rather not have to repeat the code above for "page-2".</p>
<p>URL would look like <code>http://www.domain.com/index.php?action=page-1</code></p>
<p><strong>EDIT:</strong> Thanks to Dagon I got it to work...</p>
<pre><code>$listloadpage = array("page-1", "page-2");
if(in_array($_GET['action'], $listingloadpage) !== false)
{
// Display content
}
</code></pre>
|
php
|
[2]
|
3,269,819 | 3,269,820 |
If $_POST variable is not 3 numbers long
|
<p>I would like to get a person's weight, who is over 18 years old so very likely to be 100 pounds plus, so I want to check if the $_POST variable for the weight entered is 3 digits only. I have a form where the user enters their weight...</p>
<pre><code>if (!is_numeric($weight)) {
echo "You did not enter a numeric weight.";
die;
}
</code></pre>
<p>Using the above to make sure it's numeric... but also want to verify the number is 3 digits.</p>
<p>Thank you</p>
|
php
|
[2]
|
305,193 | 305,194 |
Where does my C++ compiler look to resolve my #includes?
|
<p>this is a really basic question. I've been learning C++ and thus far I have only used the standard library. I have been including things like <code><iostream></code> and with no problems. Now I want to use Apache Xerces, so I've installed it on my machine (a Debian system) and am following a tutorial which says I need to include:</p>
<pre><code>#include <xercesc/sax2/SAX2XMLReader.hpp>
</code></pre>
<p>but g++ says "error: xercesc/sax2/SAX2XMLReader.hpp: No such file or directory". Where is it looking? Do I need to give it more information?</p>
<p>Thanks.</p>
|
c++
|
[6]
|
5,720,544 | 5,720,545 |
Shorten title to a certain length
|
<p>Given a title and a max_length, what would be the best way to shorten the title? The following is what I had in mind:</p>
<pre><code>def shorten_title(title, max_length):
if len(title) > max_length:
split_title = title.split()
length = len(title)
n = 1
while length > max_length:
shortened_title = split_title[:length(split_title)-n]
n+=1
return shortened_title
else:
return title
</code></pre>
|
python
|
[7]
|
1,121,135 | 1,121,136 |
How do I use the google API to pull a site title gvien a url?
|
<p>I need to use</p>
<p><a href="http://code.google.com/apis/customsearch/v1/reference.html#method_search_cse_list" rel="nofollow">http://code.google.com/apis/customsearch/v1/reference.html#method_search_cse_list</a></p>
<p>to pull the site title given a url. I found this info. from a previous post <a href="http://stackoverflow.com/questions/9856544/how-do-i-match-a-site-url-to-the-site-title">here.</a></p>
<p>Problem is I don't know where to begin...on using the API. Can someone provide a link or an example.</p>
<p>What' I'm trying to do is relatively simple...it is just I've never used and API like this before.</p>
<p>I found the property I need.</p>
<pre><code>items[].title
</code></pre>
<p>but what code do I use to populate it?
Thanks</p>
|
javascript
|
[3]
|
3,417,289 | 3,417,290 |
Regex to find out fields which are having non ascii character in python
|
<p>i have data of thousand records which i read line by line . Each line has some fields and their value but field names contain a non ascii character, below is the example of such a record :</p>
<pre><code>| | | X:720 | N°227: Done
</code></pre>
<p>where X and N°(non ascii character) are fieldnames and 720,227 and "Done" are field values which i have to extract.
These fields are optional which may exist or may not .
Now I have to check whether these fields exist in line or not and if it exists then what is its value(for example X field is having value 720 and N° is having value 227 and "Done")
Please let me know how to do this using regex in python ,is there any another way to do this in python?</p>
|
python
|
[7]
|
5,288,515 | 5,288,516 |
Image storage as byte code locally from XML parsing & display if it is stored Otherwise go for parsing.
|
<p>I am having an app in which at the time of launcing the app XML parsing is giving Main category from URL like hp, dell, etc...I am displaying it in the Tableview.</p>
<p>Then on click of particular cell i can get the detail of main category means its subcategory like <a href="http://www.dealsbell.com/findcoupon.php?store=hp" rel="nofollow">http://www.dealsbell.com/findcoupon.php?store=hp</a></p>
<p>Here also i am getting data properly after parsing.</p>
<p>But my concern over here is, in ( <a href="http://www.dealsbell.com/findcoupon.php?store=hp" rel="nofollow">http://www.dealsbell.com/findcoupon.php?store=hp</a> ) this link i am getting images.</p>
<p>Each particular subcategory will have a same image. So i want to do something like that the image if first time loaded from the URL then it will display image from parsing otherwise i would like to store that <strong>image as its byte code</strong> in folder / file / in any way in my device on first parsing.</p>
<p>If once the image is stored to the particular way in my device next time when i will go to see the subcategory it will first check this image is stored locally to my device or not.</p>
<p>If yes then it should go to the particular location to fetch this local image & display it to each cell otherwise will parse & display image.</p>
<p>I hope you are getting, what i want to ask.</p>
<p>Please guide me, how can this be possible & what is the way to get result.</p>
<p>If any example or link you can suggest, then it will be more efficient to me.</p>
<p>Thanks in advance.</p>
|
iphone
|
[8]
|
863,674 | 863,675 |
Error while sending mail (attachment file)
|
<p>in my application i am using to send mail with attachments i write the code like this </p>
<p>Using System.Net.Mail;</p>
<p>MailMessage mail = new MailMessage();</p>
<pre><code> mail.Body = "<html><body><b> Name Of The Job Seeker: " + txtName.Text + "<br><br>" + "The Mail ID:" + txtEmail.Text + "<br><br>" + " The Mobile Number: " + txtmobile.Text + "<br><br>" + "Position For Applied: " + txtPostionAppl.Text + "<br><br>" + "Description " + txtdescript.Text + "<br><br></b></body></html>";
mail.From = new MailAddress ( txtEmail.Text);
mail.To .Add (new MailAddress ( mailid));
mail.Priority = MailPriority.High;
FileUpload1.PostedFile.SaveAs("~/Resume/" + FileUpload1.FileName);
mail.Attachments.Add(filenme);
SmtpMail sm = new SmtpMail();
sm.Send(mail);
</code></pre>
<p>it is giving error at attachment like mail.Attachemts.Add(filena)</p>
<p>like this</p>
<p>'System.Collections.ObjectModel.Collection.Add(System.Net.Mail.Attachment)' has some invalid arguments.</p>
|
asp.net
|
[9]
|
715,672 | 715,673 |
Add some number to a variable and print
|
<p>Can you please help me, I've searched all over and I can't seem to find a simple way of doing this.</p>
<p>This code, for example adds '+1' every time its execuded:</p>
<pre><code>$('#LoadProgressMessage').html('<h6>'+ ++PercentLoaded + '% Loaded</h6>');
</code></pre>
<p>But what if I want to add an extra 2, 3 or 4?</p>
<p>Thank you! :))</p>
|
jquery
|
[5]
|
3,131,193 | 3,131,194 |
Getting the base element from a jQuery object
|
<p>I'm struggling to find the right terminology here, but if you have jQuery object...</p>
<pre><code>$('#MyObject')
</code></pre>
<p>...is it possible to extract the base element? Meaning, the equivalent of this:</p>
<pre><code>document.getElementById('MyObject')
</code></pre>
|
jquery
|
[5]
|
1,964,532 | 1,964,533 |
How do I replace characters in a string in Python?
|
<p>I'm trying to find the best way to do the following:</p>
<p>I have a string lets say:</p>
<pre><code>str = "pkm adp"
</code></pre>
<p>and I have a certain code in a dictionary to replace each charecter such as this one:</p>
<pre><code>code = {'a': 'c', 'd': 'a', 'p': 'r', 'k': 'e', 'm': 'd'}
</code></pre>
<p>(<code>'a'</code> should be replaced by <code>'c'</code>, <code>'d'</code> by <code>'a'</code> ...)</p>
<p>How can I convert the first string using the required characters from the dictionary to get the new string? Here for example I should get <code>"red car"</code> as the new string.</p>
|
python
|
[7]
|
2,486,541 | 2,486,542 |
Run progress bar while switching Activity
|
<p>im stuck in a situation where i am switching from activity 1 to activity 2.
i am using Thread.sleep(5000) to start another activity after 5 seconds
But the progress bar which i want to run for five seconds also sleeps with the first activity
Pleaze help me as to when i click next Button on first activity a progress bar shoud run for five sec
and then activity should be loaded
My Code is:</p>
<pre><code> public class Activity1 extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button next = (Button) findViewById(R.id.B);
final ProgressBar p=(ProgressBar) findViewById(R.id.pr);
next.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
p.setVisibility(4);
Thread t=new Thread();
try{
t.sleep(5000);
}
catch(Exception e){}
Intent myIntent = new Intent(view.getContext(), activity2.class);
startActivityForResult(myIntent, 0);
}
});
}}
</code></pre>
|
android
|
[4]
|
4,203,205 | 4,203,206 |
How to make this recursive function iterative in python?
|
<p>Usually I'm good with this type of thing, but this is bugging me. I had to write this function last week, and writing it recursively made the most sense, although now I'm trying to find a way to make it iterative to incorporate it into another function I'm writing. This is the recursive version of the function,</p>
<pre><code>def XXX (x,y,z):
if z[x][0][0] != z[y][0][0]:
XXX(z[x][0],z[y][0],z)
else:
return z[x][0]
</code></pre>
<p>and this is the data structure</p>
<pre><code>{'A': [('AD', 4.0), None, None], 'C': [('ADBFGC', 14.5), None, None], 'B': [('BF', 0.5), None, None], 'E': [('ADBFGCE', 17.0), None, None], 'D': [('AD', 4.0), None, None], 'G': [('BFG', 6.25), None, None], 'F': [('BF', 0.5), None, None], 'ADBFG': [('ADBFGC', 6.25), ('AD', 4.25), ('BFG', 2.0)], 'BF': [('BFG', 5.75), ('B', 0.5), ('F', 0.5)], 'ADBFGC': [('ADBFGCE', 2.5), ('ADBFG', 6.25), ('C', 14.5)], 'ADBFGCE': [None, ('ADBFGC', 2.5), ('E', 17.0)], 'BFG': [('ADBFG', 2.0), ('BF', 5.75), ('G', 6.25)], 'AD': [('ADBFG', 4.25), ('A', 4.0), ('D', 4.0)]}
</code></pre>
<p>I'm completely blanking on this, any help would be appreciated :) </p>
|
python
|
[7]
|
5,118,848 | 5,118,849 |
connect to a database in c# .net
|
<p>Hey guys i am making a game launcher and i am making it so they have to registered to my website to continue and i don't know how to connect to a database on c# .net.<br /><Br />
<strong>question</strong>: How do i connect to a database that's on my website in c# .net?
or where on the web do i learn that stuff?
and its not a Microsoft server.<br /><br />
I have a idea that you use the sqlconnection but i don't know.</p>
<p>any help will be appreciated </p>
<p>i want to connect to only one table not just all of them and the table is called "users".</p>
<p>table as well </p>
|
c#
|
[0]
|
4,869,862 | 4,869,863 |
When I logged in I have to be directed to a specific form
|
<p>I am new to .net. I have created a page with login.</p>
<p>When I enter the information and when the username and password match, "My home page" text turns into a hyperlink, when I click the hyperlink it directs me to a profile web-form.</p>
<p>I need to modify the code in such a way that when the login details match the page should be directed to the profile web-form without having to click the hyperlink. I need code for this issue.</p>
<p>Thank You</p>
|
asp.net
|
[9]
|
263,468 | 263,469 |
Select a value of a html dropdown of a webpage with the help of C# windows application
|
<p>Select a value of a html dropdown of a webpage with the help of <i><b>C# windows application</b></i> . I am using <b>web browser control<</b> for filling out the text boxes , I got stuck with the dropdown please help </p>
|
c#
|
[0]
|
988,290 | 988,291 |
Python reading file
|
<p>How would I find out how many attempts have been made to login with the root account?</p>
<p>Here is the code I am using so far in python:</p>
<pre><code>myFile = open('file','r')
count_rr = 0
for line in myFile.readlines():
list_of_line = line.split(' ')
if 'root' in list_of_line[?]
print 'root'
count_rr = counter_rt + 1
</code></pre>
<p>Here are two lines of the file I am trying to read:</p>
<pre><code>Jan 10 09:32:46 j4-be03 sshd[3885]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=218.241.173.35 user=root
Jan 10 09:32:48 j4-be03 sshd[3885]: Failed password for root from 218.241.173.35 port 50212 ssh2
</code></pre>
|
python
|
[7]
|
4,022,201 | 4,022,202 |
Api client that fetches global configuration from web.config
|
<p>In my application I want to do something like:</p>
<pre><code>SomeApiClient apiClient = new SomeApiClient();
List<User> apiClient.getUsers();
</code></pre>
<p>In my web.config, I will a few configuration key/value pairs.</p>
<p><strong>How can I write the constructor of SomeApiClient in such a way that it loads the values from the web.config, but not each time, only once when the application starts or first request?</strong></p>
|
c#
|
[0]
|
4,660,269 | 4,660,270 |
How to open results in another page
|
<p>This is probably a simple question but I cannot figure out how to open the results from my database in a javascript popup window. I have an index.php page with a input box and an input button. When the user selects a date and presses the button, I'd like the results to open in a new window. How can I do this?</p>
<p>Thanks</p>
|
javascript
|
[3]
|
4,057,147 | 4,057,148 |
Exposing that your app is installed to the android browser
|
<p>I am trying to find a way to detect in the android browser whether my application has been installed.</p>
<p>Use case:
I have a web page that a user can reach via their android web browser. If the application is installed it would show "Tips & tricks". If it is not installed, it would show promotional material and a link to download the app.</p>
<p>Attempted solution:
My initial thoughts have been to associate my application with a custom mime type using the apps manifest and in the web page iterate javascript's mimeTypes array. I figured if the mime type showed up in the array, I could assume that the application was installed.</p>
<p>Unfortunately, the mimeTypes array doesn't ever change.</p>
<p>Any ideas how I could determine if my application is installed when the user accesses my web page via the android browser?</p>
<p>Thanks for any help / insight you might have.</p>
|
android
|
[4]
|
2,325,410 | 2,325,411 |
Problem regarding webservices image cant displayed in the out put
|
<pre><code>NSURL *url=[NSURL URLWithString:elementurl];
NSLog(@"url %@", url);
NSData *data = [NSData dataWithContentsOfURL:url];
NSLog(@"data = %@, length = %i", data, [data length]);
UIImage *image = [[UIImage alloc] initWithData:data];
[data release];
iam not getting the data can any one suggest another method
</code></pre>
|
iphone
|
[8]
|
4,270,834 | 4,270,835 |
Jquery - Add entry to the rightclick contextmenu
|
<p>you can disable the menu</p>
<pre><code>$(document).bind("contextmenu", function(e) {
return false;
});
</code></pre>
<p>you can show a div</p>
<pre><code>$(document).bind("contextmenu", function(e) {
$('#menu').css({
top: e.pageY+'px',
left: e.pageX+'px'
}).show();
return false;
});
</code></pre>
<p>but is it possible only to add an entry to the rightclick contextmenu?</p>
<p>Thanks in advance! <br />
Peter</p>
|
jquery
|
[5]
|
2,350,080 | 2,350,081 |
c++ time.h, clock_gettime(), semantic error, how to link real-time library in Eclipse?
|
<p>I have some problem using the clock_gettime() function. </p>
<pre><code>#include <iostream>
#include <time.h>
timespec timer_start;
timespec timer_end;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &timer_start);
// sleep for 5 seconds
boost::this_thread::sleep(boost::posix_time::milliseconds(5000));
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &timer_end);
std::cout << (timer_end.tv_sec - timer_start.tv_sec) << ":" << (timer_end.tv_nsec - timer_start.tv_nsec) << std::endl;
</code></pre>
<p>The output I get is this</p>
<p>0:6934599</p>
<p>It seems that the timer only elapsed 693 milliseconds or so. </p>
<p>I compile the program with g++ -lrt on Linux gnu gcc 4.6. I also received a Semantic Error, says
<strong>Symbol 'CLOCK_PROCESS_CPUTIME_ID' could not be resolved</strong> </p>
<p>Thanks.</p>
|
c++
|
[6]
|
3,036,388 | 3,036,389 |
php from string to echo
|
<p>I have a "big" string like <code>something here blah bla <b>tomato</b> something else kasjd ajsd</code></p>
<p>From this I am trying to extract <code>tomato</code>.</p>
<p>What is the function to use to do this based on getting the position in the big string of the strings to the left and right of the target string?</p>
<p>so like I have:</p>
<pre><code>start: "bla <b>"
end: "</b> some"
</code></pre>
<p>and I want what is between them in the big string...</p>
|
php
|
[2]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.