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 |
---|---|---|---|---|---|
5,585,608 | 5,585,609 |
how to get local time and put it in a string
|
<p>I have a method <code>s</code> that has as parameter a date time.</p>
<p>How to write it in c++ ?</p>
<p>In <code>c#</code> it is:</p>
<pre><code>string s(System.DateTime sd);
</code></pre>
<p>EDIT!
HOW TO CALL THE S METHOD?! also i would like to have in a string the hour, in another string the second..and so on</p>
<p>Another question is: how to convert the time in a string value that has: day, month, hours, min and seconds ?</p>
|
c++
|
[6]
|
3,600,274 | 3,600,275 |
php script to generate checksum from md5
|
<p>In order to calculate the checksum i need following things. these parameters are concatenated in a constant (no spaces) string made up of the values of the following parameters in the exact order listed below:
o Secret Key
o Merchant id
o Currency
o Total amount
o Item list (item_name_1, Item_amount_1, item_quantity_1 to item_name_N,
Item_amount_N, item_quantity_N)
o Timestamp</p>
<p>e.g
In that case the string befor hash will be:
pLAZdfhdfdNh57583USD69.99Tier2 item69.9912010-06-14.14:34:33</p>
<p>And using the MD5 hash function the result is:
ghvsaf764t3w784tbjkegbjhdbgf</p>
<p>i want to know how can i create a php script that will call md5 hash function with the inputs given above and based on that it will generate the hash function value that will be the checksum value for my coding..</p>
|
php
|
[2]
|
1,265,740 | 1,265,741 |
How to crawl markup with PHP, check if images exists and replace non-existing paths?
|
<p>I have some markup which I need to crawl for images, and check if the images exists in the paths they have specified. If an image does not exists in location A, the path should be replaced with location B.</p>
<p>I'm wondering what would be the most efficient way of achieving this?</p>
|
php
|
[2]
|
367,230 | 367,231 |
android how to optimize application code through Progaurd
|
<p>I am working with android sdk ver-8.(But in manifest i gave android:minSdkVersion="6")</p>
<p>I am developing an app. For publishing I want to optimize it. Through ProGuard how can I optimize the code?
Please give me steps of using ProGuard.</p>
<p>Thank you </p>
|
android
|
[4]
|
2,124,467 | 2,124,468 |
Reference on interface as a parameter
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/114180/pointer-vs-reference">Pointer vs. Reference</a> </p>
</blockquote>
<p>I am wondering if there any benefits in using references instead of pointers on some interface. Being more specific let's consider small example:</p>
<pre><code>struct MyInterface {
virtual ~MyInterface() {}
virtual void f() = 0;
};
class MyClass : public MyInterface
{
virtual void f()
{
std::cout << "F()" << std::endl;
}
};
void myFunction(MyInterface& obj);
int main(int argc, char *argv[])
{
MyInterface* pObj = new MyClass;
myFunction(*pObj);
delete pObj;
getchar();
return 0;
}
void myFunction(MyInterface& obj)
{
obj.f();
}
</code></pre>
<p>In <em>myFunction</em> instance of <em>MyClass</em> can be passed as a pointer, what is written in many books. My question is what can be considered as a good practice (pointer or reference) and what is more efficient?</p>
<p>Sorry if this question somehow was asked previously. </p>
|
c++
|
[6]
|
1,140,072 | 1,140,073 |
Data Directory in File Explorer of DDMS View
|
<p>Hi all using Samsung Galaxy GT-1900 ,In eclipse I am trying to access data folder in DDMS file explorer view of my application,its data folder visible but unable to open,facing same problem as posted here <a href="http://stackoverflow.com/questions/3259380/cant-access-data-folder-in-the-file-explorer-of-ddms-using-a-nexus-one.As">Can't access data folder in the File Explorer of DDMS using a Nexus One!</a> I click plus on data folder if disappear for 2-6.I try to explore data folder with normal and also with debug mode.still unable to access this folder.when I run my application on emulator its working fine in emulator I can visit data folder in DDMS file explorer view.Any suited answer how I can access this folder to export/explore my database and txt files.Below I am attaching my DDMS view ..
<img src="http://i.stack.imgur.com/NLMJY.png" alt="Android DDMS File Explorer View in eclipse"></p>
|
android
|
[4]
|
1,607,248 | 1,607,249 |
How to put PHP class definition in include file
|
<p>I'm new to PHP, having trouble when I move a class definition out of my "main" page and into an include file.</p>
<p>Suppose I have main.php, with the below contents. It works fine:</p>
<pre><code><?php
class SimpleClass
{
public $var = 'a def value';
public function displayVar() {
echo $this->var;
}
}
?>
<html>
<h1>blah blah blah</h1>
</html>
</code></pre>
<p>But now suppose that I try removing the class definition and putting it in a <strong>separate</strong> file, so that the main.htm now looks like:</p>
<pre><code><?php
include("classdef.php");
?>
<html>
<h1>blah blah blah</h1>
</html>
</code></pre>
<p>and classdef.php is:</p>
<pre><code><?php
class SimpleClass
{
public $var = 'a def value';
public function displayVar() {
echo $this->var;
}
?>
</code></pre>
<p>Then when I view my main.php, it displays as</p>
<pre><code>var; } } ?>
blah blah blah
</code></pre>
<p>As if the <code>></code> character in the <code>$this->var</code> is interpreted as closing the PHP. I've had trouble searching for this, in that I don't know what the <code>-></code> operator is called.</p>
<p>This is PHP 5.3.3 on Apache 2.2 on Windows.</p>
|
php
|
[2]
|
2,507,101 | 2,507,102 |
Effectively caching data uploads in Android
|
<p>I have implemented a queue service in Android that will change states based on queue and wifi/data connectivity events.</p>
<p>I queue transactions to be posted to a remote url. If the device has a data or wifi connection, it will iterate the queue and post data to the url until the queue is empty, or there is a disconnect event.</p>
<p>I can login to my app, enable airplane mode, generate data, turn airplane mode off, and the transaction are posted. No slow down, even with thousands of transactions. (I was trying to pish it a bit)</p>
<p>Enter: low reception!
My app slows down enormously when the 3G reception is low. (Yes, all uploading happens off the ui thread.) It seems that the cause of this slow down has to do with the post to the server taking a very long time to happen and sometimes just failing.</p>
<p>My question is, how can I solve this? Check for signal quality? Poll a known address? How do other apps, such as Gmail solve this? This must be a common scenario!</p>
|
android
|
[4]
|
5,131,708 | 5,131,709 |
how to check Object Reference?
|
<p>I have like this entity,</p>
<pre><code>public class Receiving{
[Key]
public int ID {get; set;}
public string shipperID {get; set;}
[Foregign("shipperID")]
public virtual Shipper shipper {get; set;}
}
</code></pre>
<p>the Shipper relationship could be <strong>1:0 or 1:1</strong></p>
<p>and I got an error when the shipper is 0.</p>
<pre><code>var result = from p in productRepository
join o in receivingRepository
on p.fk equals o.ID
select new {
test = o.shipper.name // if the shipper is nothing related then it occur an error.
}
</code></pre>
<p>The error message say,
<strong>"Object reference not set to an instance of an object."</strong></p>
<p>How can I check that in select {}?</p>
<p>I tried,</p>
<pre><code>select new {
test = o.shipper.name ?? ""
}
</code></pre>
<p>but it is not working.</p>
|
c#
|
[0]
|
2,428,449 | 2,428,450 |
Service bind to an Activity
|
<p>This is my code:</p>
<pre><code>public class MainActivity extends Activity {
private ComponentName mService;
private Servicio serviceBinder;
private ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className, IBinder service) {
serviceBinder = ((Servicio.MyBinder)service).getService();
}
public void onServiceDisconnected(ComponentName className) {
serviceBinder = null;
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent bindIntent = new Intent(this, Servicio.class);
bindService(bindIntent, mConnection, Context.BIND_AUTO_CREATE);
}
@Override
protected void onStart() {
serviceBinder.somethingThatTakesTooMuch();
super.onStart();
}
public class Servicio extends Service {
private final IBinder binder = new MyBinder();
@Override
public IBinder onBind(Intent intent) {
return binder;
}
public int somethingThatTakesTooMuch() {
return 1;
}
public class MyBinder extends Binder {
Servicio getService() {
return Servicio.this;
}
}
</code></pre>
<p>When I run it,
It get a NullPointerException in this line:</p>
<pre><code>serviceBinder.somethingThatTakesTooMuch();
</code></pre>
|
android
|
[4]
|
3,593,866 | 3,593,867 |
Working with interfaces
|
<p>I have functions of the following form in the code I'm refactoring:</p>
<pre><code>A f()
{
if(existing)
return A();
else
return A(handle);
}
</code></pre>
<p>The Safe Bool Idiom is later used to test if A is associated with a handle or not, i.e. if we should call the class methods for this object which require internally a valid handle for execution. A's methods are const.</p>
<p>I'd like to return an interface, IA, here instead. Must I therefore return a pointer? If so I will go with boost shared pointers. I can test if the pointer is pointing to something or not.</p>
<p>Is there any way for me to work with references here instead? Would you recommend such an approach or do you think that boost::shared_ptrs is the way to go?</p>
<p><strong>UPDATE</strong></p>
<p>A is derived from IA.</p>
<p>My compiler is gcc version 4.4.3.</p>
<p>My biggest problem with this code is that A is used to interact with an external C API. Therefore I wish to mock it away using the IA interface as base for my Mock of A and its implementation, A. Then outside of the method f() above, which I see as a factory, I will only work with IA pointers. Dependency Injection in other words.</p>
<p>So A is basically a handle and an interface to a set of C API functions which require a handle. I can have several objects of type A where the interface is the same but the handle is different. </p>
|
c++
|
[6]
|
4,631,740 | 4,631,741 |
php header information error
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1793482/php-error-cannot-modify-header-information-headers-already-sent">PHP error: Cannot modify header information – headers already sent</a> </p>
</blockquote>
<p>previously my website was running fine but when i switched to new server then wherever the information is being submitted by form (php not using ajax) now when the page refrshes its giving me errror </p>
<pre><code>Warning: Cannot modify header information - headers already sent by (output started at /home/public_html/includes/connection.php:480) in /home/public_html/steps.php on line 124
</code></pre>
<p>and many other pages where the information being submitted by form its giving me error . can anyone help me out with whats goin wrong ?</p>
|
php
|
[2]
|
3,555,209 | 3,555,210 |
insert checkbox values into database within a separate column of the query separated by commas
|
<p>I need help for this problem that I've been trying to solve for a while (I'm new in PHP). I have a form with several checkboxes whose values are pulled from a specific table of the database. I managed to display them in the form, but cannot insert their values into the table connected to that specific page since there is ony one column.I want to enter all the selected values of the checkbox into that single column separated by commas.</p>
<p>Here's the code:</p>
<pre><code>url <BR><?php $query = "SELECT url FROM webmeasurements";
$result = mysql_query($query);
while($row = mysql_fetch_row($result))
{ $url = $row[0];
echo "<input type=\"checkbox\" name=\"url\" value=\"$row[0]\" />$row[0]<br />";
$checkbox_values = implode(';', $_POST['url']); }
?>
<input type="submit" name="Submit" value="Submit">
</form>
<?php
if(isset($_POST['url']))
{ echo $url;
foreach ($_POST['url'] as $statename)
{
$url=implode(',',$statename)
}
}
$q="insert into table (url) values ($url)";
?>
</code></pre>
|
php
|
[2]
|
1,063,645 | 1,063,646 |
How can i insert data in an sqlite table from a text file in android
|
<p>In my application i am creating many tables in the sqlite database but in that one table contains more than 1 lakh rows i am getting data from server using http connection getting this kind of many records causing much more time for me so to avoid this problem i want to connect my tablet through PC and i want to place txt file(which is having insert statements) in the tablet.</p>
<p>Now how can i access that txt file in my application and also how can i insert data in my table using that txt file and also tell me in which location i have to copy this txt file to access it from my application.anyone answer my question.</p>
<p>My DB file size also 273 MB , so i think it's not possible to place it in the assets folder</p>
|
android
|
[4]
|
5,198,067 | 5,198,068 |
Can a selector resource use a color defined in a style?
|
<p>I'm trying to use a color defined in a stlyle in a selector but it is causing a Resources$NotFoundException.</p>
<p>First I added a new attribute to attr.xml:</p>
<pre><code><resources>
<attr name="unread_background" format="color" />
</resources>
</code></pre>
<p>Then I defined that attr value in styles.xml:</p>
<pre><code><style name="ThemeNoTitleBar" parent="android:Theme.NoTitleBar">
<item name="unread_background">#000000</item>
</style>
</code></pre>
<p>Then I tried to use that attr in my selector definition:</p>
<pre><code><selector xmlns:android="http://schemas.android.com/apk/res/android">
<!-- other states snipped -->
<item android:state_selected="false"
android:drawable="?unread_background" />
</selector>
</code></pre>
<p>Lastly, the activity uses the ThemeNoTitleBar style theme in the manifest.</p>
<p>I've also tried creating a color in colors.xml and having it use the new attr but that also fails.</p>
<p>I'm obviously missing something but am not sure what to do to fix it. My intent is to create multiple themes and have the selector use the color in the currently selected theme.</p>
|
android
|
[4]
|
4,470,053 | 4,470,054 |
How to remove x items from collection using LINQ?
|
<p>Is there a way to remove all items except first one from any type of collection (Control.Items, List ....) using LINQ only ?</p>
|
c#
|
[0]
|
1,317,196 | 1,317,197 |
How to distinguish Country code from contact number
|
<p>I am able get the contact number from native contacts. I want to know the country code if the user already added in the number. Different country has different country code example for India it is +91. Some country codes are two digit some are three and so on.. So how to distinguish the country code from the contact number. </p>
<p>Thanks</p>
|
android
|
[4]
|
2,518,069 | 2,518,070 |
Error warning doubts
|
<pre><code>- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{ NSMutableString *message=[[NSMutableString alloc]init];
// Notifies users about errors associated with the interface
switch (result)
{
case MFMailComposeResultCancelled:
message = @"Result: canceled";
break;
case MFMailComposeResultSaved:
message = @"Result: saved";
break;
case MFMailComposeResultSent:
message = @"Result: sent";
break;
case MFMailComposeResultFailed:
message = @"Result: failed";
break;
default:
message = @"Result: not sent";
break;
}
</code></pre>
<p>I am using the above code for mailcomposer. When compiled it gives the warning <code>incompatable pointer types assigning to NSMutableString from NSString</code>. I believe this happens when we use NSString instead of NSMutableString. How can I solve this?.
Thanks in advance.</p>
|
iphone
|
[8]
|
5,992,168 | 5,992,169 |
access object name within the object with this
|
<p>in i want to alert the 'image' which is the object name, how can i access with <code>this</code> ?</p>
<pre><code>Objectswitch={
'image':
{
addCount:function(){
alert('count');
},
addCountandCreate:function(){
this.addCount();
alert(this);
}
}
}
</code></pre>
|
javascript
|
[3]
|
3,884,807 | 3,884,808 |
best way to get a callback when a radiobutton is clicked in javascript
|
<p>I have got an html like this:</p>
<pre><code><input type="radio" name="v" value="1"> 1<br>
<input type="radio" name="v" value="2"> 2<br>
<input type="radio" name="v" value="3" checked> 3<br>
</code></pre>
<p>I want to know how to monitor all of those radio buttons.
I could have many more than 3. </p>
<p>One thing I though is to have an 'onclick' function for all of them.</p>
<p>is that the right way ?
or is there a neater way to register a common javascript function when the radio button set has changed.</p>
<p>Thanks,</p>
|
javascript
|
[3]
|
2,386,503 | 2,386,504 |
Any difference in " 'value' == typeof X " VS " typeof X == 'value' "
|
<p>Is there any difference (compiler/interpreter/juju wise, etc) between the two versions of checking the result of the typeof operator?</p>
<p>I am asking because I see the first version a lot of times, as if it followed a concept, while version two is way more readable and better describes my intention: primarily I am interested in the type of a variable and not a string being equal with something. </p>
<p>UPDATE:
while it's not part of the original question it worth noting that x == y is never a good practice when you are about to check equality. One should always use the === operator for that.</p>
|
javascript
|
[3]
|
306,976 | 306,977 |
Rename Multiple Files in a Directory Replacing Certain Characters on PHP
|
<p>I have a directory with lots of files in them.
I just want to delete single quotes and replace the ampersand (&) with "and" in the FILENAME to all the files.
Is it possible in php ?</p>
|
php
|
[2]
|
5,939,755 | 5,939,756 |
Status of chained assignment in Python
|
<p>At several occasions I stumbled upon C-style assignment in Python such as <code>a = b = 0</code>. By diligent Googling I found out that this is called chained assignment: [<a href="http://en.wikipedia.org/wiki/Assignment_%28computer_science%29#Chained_assignment" rel="nofollow">1</a>],[<a href="http://stackoverflow.com/questions/11498441/what-is-this-kind-of-assignment-in-python-called-a-b-true">2</a>],[<a href="http://stackoverflow.com/questions/7601823/how-do-chained-assignments-work">3</a>]. However, it appears that this feature is not mentioned in the <a href="http://docs.python.org/3/reference/simple_stmts.html#assignment-statements" rel="nofollow">official documentation</a>.</p>
<p>Does this mean that chained assignment is still in experimental phase, or simply that the official documentation is slightly behind the development?</p>
|
python
|
[7]
|
3,152,521 | 3,152,522 |
TableRow OnClickListener's getId returns -1 - What gives?
|
<p>I'm creating tablerows programmatically, and I'm trying to implement an OnClickListener:</p>
<pre><code> final TableRow tr = new TableRow(this);
tr.setId(tourney.getColumnIndex("_id"));
tr.setClickable(true);
tr.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
v.setBackgroundColor(Color.GRAY);
System.out.println("Row clicked: " + v.getId());
}
});
</code></pre>
<p>But everytime I click on the row, I get a value of -1. Why am I not getting the id that I set?</p>
|
android
|
[4]
|
5,170,653 | 5,170,654 |
How to disable child form controls?
|
<p>I have a login which have admin and user rights.</p>
<p>If admin- i can access all the forms and controls.
--OK</p>
<p>If user- i can only access limited forms and controls.
I have Mdi parent and other forms.</p>
<p>--NOT OK</p>
<p>I can only disable toolstrip menu on MDI parent but i need to disable controls on the other childforms also.</p>
<p>like butttons/textboxes etch..</p>
|
c#
|
[0]
|
3,353,227 | 3,353,228 |
Why does std::getline(cin, Number) give a "No matching function for call" error?
|
<p>I wrote a program so the user inputs a number and the program outputs its binary representation.</p>
<p>I get this error:</p>
<blockquote>
<p>No matching function for call to `getline(std::istream&, unsigned int&)'</p>
</blockquote>
<p>How can I solve this?</p>
<p>Also, it outputs:</p>
<pre><code>0
0
0
0
</code></pre>
<p>...when it should output the right value for the input.</p>
<pre><code>#include <iostream>
using namespace std;
int main ()
{
int Number;
cin >> Number;
bool Binary[sizeof(int) * CHAR_BIT];
for(unsigned int i = 0; i < sizeof(int) * CHAR_BIT; i++)
Binary[(sizeof(int) * CHAR_BIT - 1) - i] = Number & (1 << i);
for(unsigned int i = 0; i < sizeof(int); i++)
std::cout << Binary[i] << std::endl;
system ("pause");
return 0;
}
</code></pre>
|
c++
|
[6]
|
3,212,767 | 3,212,768 |
How I can Merge two datatable into one datatable in c#
|
<p>I have tow datatables and i want to merge them and want the output like this;</p>
<p>Table1 values:</p>
<pre><code>FirstName LastName
AAA BBB
AAA BBB
</code></pre>
<p>Table2 values:
*</p>
<pre><code>FullName
CCC
CCC
</code></pre>
<p>*</p>
<p>now i want that FullName's value and FirstName's value merge into One column of Firstname
and out should be like that after merging....</p>
<pre><code>FirstName LastName
AAA BBB
AAA BBB
CCC
CCC
</code></pre>
<p>Both out tables have the column of FirstName and LastName from dtable1 and FullName from dtable2 </p>
<p>i have this code in my c# application</p>
<pre><code> DataSet firstGrid = new DataSet();
DataSet secondGrid = new DataSet();
DataTable table1 = dataGridView3.DataSource as DataTable;
DataTable table2 = dataGridView2.DataSource as DataTable;
DataColumn[] colunm = new DataColumn[table1.Columns.Count];
DataTable table3 = new DataTable();
// table3.;
table3 = table1.Copy();
table3.Merge(table2);
dataGridView1.DataSource = table3;
</code></pre>
|
c#
|
[0]
|
461,047 | 461,048 |
How to refresh activity after changing language (Locale) inside application
|
<p>My application users can change the language from the app's settings. Is it possible to change the language inside the application without having effect to general language settings ?
<a href="http://stackoverflow.com/questions/2264874/android-changing-locale-within-the-app-itself">This question of stackoverflow</a> is very useful to me and i have tried it. After changing language newly created activities display with changed new language, but current activity and previously created activities which are in pause state are not updated.How to update activities ?
I have also spent a lot of time trying to make the preference change to be applied immediately but didn't succeed. When application is restarted, all activities created again, so now language changed correctly.</p>
<pre><code> android:configChanges="locale"
</code></pre>
<p>also added in manifest for all activities. and also support all screen.
Currently I have not done any thing in activity's onResume() method.
Is there any way to refresh or update activity (without finish and starting again) ? Am I missing something to do in onResume() method? </p>
|
android
|
[4]
|
653,103 | 653,104 |
Js Variable Reference Quickie
|
<p>Hoping someone can clear this up for me.</p>
<p>Let's say I have 2 globals:
var myarray=[1,3,5,7,9],hold;</p>
<p>and then I do this:</p>
<pre><code>function setup()
{
alert (myarray[0]);//shows 1
hold=myarray;
alert (hold);//appears to show 'hold' containing all the values of myarray. first number shown is 1
myarray[0]=2;
alert (hold);//shows the values of myarray with the updated first entry. first numbe shown is 2
}
</code></pre>
<p>Am I to take it that 'hold' is simply keeping a reference to myarray, rather than actually taking all the values of?</p>
|
javascript
|
[3]
|
5,173,111 | 5,173,112 |
Make a link unclickable once it has been clicked - jquery
|
<p>I am trying to make a link unclickable once it is clicked, then clickable once another link is clicked. Basically just a toggle but I need to make the active link unclickable to prevent the toggle. Here is my code:</p>
<pre><code>$(document).ready(function(){
$("#Espanol").hide();
$("#espLink").addClass("nonSelected");
// Make english link unclickable
$("#espLink").click(function(){
$("#engLink").addClass("nonSelected");
$("#espLink").removeClass("nonSelected");
$("#English").toggle();
$("#Espanol").toggle();
// need to make espanol link unclickable
// and english link clickable
});
$("#engLink").click(function(){
$("#espLink").addClass("nonSelected");
$("#engLink").removeClass("nonSelected");
$("#English").toggle();
$("#Espanol").toggle();
// need to make english link unclickable
// and espanol link clickable
});
});
</code></pre>
<p>And html:</p>
<pre><code><a id="engLink">English</a> | <a id="espLink">Español</a>
</code></pre>
<p>Anybody know how to do this?</p>
|
jquery
|
[5]
|
4,706,136 | 4,706,137 |
Value selected option dropdownbox
|
<p>I've got a dynamic dropdownbox:</p>
<pre><code>function chgAantal(i,artNr,lengte){
var aantal=document.getElementById("aantal_"+i).value;
if(isNaN(aantal)){
alert('Voer een geldig aantal in...');
document.all["error_"+i].src="/images/fout.gif";
ok=0;
}
else{
location.href="addcart.asp?act=change&aantal="+aantal+"&artNr="+artNr+"&lengte="+lengte+"&bdr=<%=bdr%>";
}
}
<select onchange='chgAantal(\""+i+"\",\""+artNr+"\",\""+lengte+"\")' name='aantal_"+i+"' value='"+aantal+"'/>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
<option value='5'>5</option>
<option value='6'>6</option>
<option value='7'>7</option>
<option value='8'>8</option>
<option value='9'>9</option>
</select>
</code></pre>
<p>When I change the value in (for example) 7, the value changes in the script. But I can't see the selected value, the value displaying is always 1.
How can I display the selected value?</p>
<p>I hope you understand me!</p>
<p>Regards,</p>
<p>Fraak</p>
|
javascript
|
[3]
|
3,481,137 | 3,481,138 |
how can I count number of occurance of a word in a string while ignoring cases
|
<p>I am trying to count the number of occurance of a given word while ignoring cases.
I have tried</p>
<pre><code><?php
$string = 'Hello World! EARTh in earth and EARth';//string to look into.
if(stristr($string, 'eartH')) {
echo 'Found';// this just show eartH was found.
}
$timesfound = substr_count($string, stristr($string, 'eartH'));// this count how many times.
echo $timesfound; // this outputs 1 instead of 3.
</code></pre>
|
php
|
[2]
|
882,485 | 882,486 |
Importing a C++ dll in C#
|
<p>I have created a C++ dll ( let say , MyC++Dll.dll) and I have a header file ( MyC++Dll.h ).
MyC++Dll.h contains the types definition . </p>
<p>I want to import this dll in C# application I am creating . </p>
<p>I am able to import the dll using </p>
<p>[DllImport("MyC++Dll.dll")]
static extern func();</p>
<p>But I am not able to import/include the header file (MyC++Dll.h) in the C# application which contains the types definition . </p>
<p>Please suggest a way to build this C# application successfully . </p>
|
c#
|
[0]
|
3,493,770 | 3,493,771 |
I need the Code to LoginView by Which the User can see If He is Logged in or Logged Out?
|
<p>I would like to Implement a asp.net website,in which i need to implement the LoginView Control to Specify a user if he is Logged in or Logged Out..</p>
|
asp.net
|
[9]
|
1,150,876 | 1,150,877 |
Customizing Textselection dialog of webview
|
<p>I want to customize Textselection dialog of webview.(When we press longclick at that time appear)
Do you have any idea?</p>
|
android
|
[4]
|
5,066,358 | 5,066,359 |
Log in to a website by an android app
|
<p>I am making an android app for <a href="http://yearbook08.com/" rel="nofollow">http://yearbook08.com/</a> I know how to parse through a web page but I have no idea how to enter information in particular field or move onto another page.</p>
<p>If you open this link there are two text fields I want to enter data from my app and want to log in, if somebody has code for this it would be much helpful </p>
|
android
|
[4]
|
1,324,546 | 1,324,547 |
svg file display
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3889882/svg-support-on-android">Svg support on Android</a> </p>
</blockquote>
<p>i want a sample program for displaying svg file in android? or i want to know wha are the classes used for it?</p>
|
android
|
[4]
|
4,149,196 | 4,149,197 |
Disabling onclick() after 1 click
|
<p>I am having a little trouble with a JS event. I have an link that calls the onclick event which opens up a photo in a popup modal window - facebox.</p>
<p>When the user single clicks on the link the image file name attached to that link is passed to the modal window, however if the user double clicks the image file opens twice in the modal window.</p>
<p>I have tried a simple ondblclick="" and ondblclick="return false" to stop this but it seems the browser still interprets it as 2 single onclick() events.</p>
<p>Can anyone suggest a fix or a solution whereby the link is temporarily disabled after the 1st click?</p>
<p>Here is the code below that is calling the event:</p>
<pre><code><a href="javascript:void(0);" onmouseover="setVisibility(\'deletephotodiv'.$do.'\', \'block\');" onmouseout="setVisibility(\'deletephotodiv'.$do.'\', \'none\');" ondblclick="parent.jQuery.facebox({ ajax: \'profile/previewphoto.inc.php?photo=',$_SESSION['images'][$do]['name'],'&album=',$_SESSION['images'][$do]['albumname'],'\' }); ">
</code></pre>
<p>Thanks in advance</p>
<p>Wayne</p>
|
javascript
|
[3]
|
4,276,381 | 4,276,382 |
Python: How to define a function that gets a list of strings OR a string
|
<p>Let's say I want to add a list of strings or just one to a DB:</p>
<pre><code>names = ['Alice', 'Bob', 'Zoe']
</code></pre>
<p>and I want that <code>add_to_db</code> will accept both cases</p>
<pre><code>add_to_db(names)
add_to_db('John')
</code></pre>
<p>Is this the correct way to go:</p>
<pre><code>def add_to_db(name_or_names):
if (...):
... # add a single name
else:
for name in name_or_names:
... # add a single name
commit_to_db()
</code></pre>
<p>What should I put in the first <code>...</code>, as condition to whether it's a list of strings or just a string (don't forget that string is also iterable)?</p>
|
python
|
[7]
|
5,146,433 | 5,146,434 |
Android: How to use fragments to completely change a view
|
<p>My app has a custom segmented control(got it from internet - its really a radio group) and under it a listview. When a user clicks on a row in the list view, a fragment is attached to the activity that displays a different listview. This new listview seems to replace the old one. The problem is that the segmented control is still there, whereas I would like the whole view to be the new list view. Knowing that fragments are embedded in the view group, I thought progammatically removing the segmented control would work, but it didn't, the control just becomes empty space. </p>
<p>It's important that the app works the way I described. I could explain in detail why this is so, if needed.</p>
<p>Any tips? Much appreciated.</p>
|
android
|
[4]
|
2,016,184 | 2,016,185 |
event in each doesn't work
|
<p>This code doesn't work</p>
<pre><code>jQuery.each(["Alloggio","Macchina","Aereo","Treno"], function(){
t = this;
$("#ChkPrenotazione" + t + "Default").change(function(){
$(".Chk" + t).val($(this).val());
});
});
</code></pre>
<p>I want that t inner on change event is equal to "Alloggio" or "Macchina" or "Aereo" or "Treno"</p>
<p>How can i fix it?</p>
<p>thanks</p>
|
jquery
|
[5]
|
851,656 | 851,657 |
multi Image: scroll as well as resize
|
<p>I have 5 images. I want to display each image on a page (paging).
And per page can resize the image on that page (other pages still not changes).
How can i do it?</p>
<p>THank you.</p>
|
iphone
|
[8]
|
4,285,461 | 4,285,462 |
jQuery - How to loop the function?
|
<p>I want to make a basic fadein fadeout slideshow.I only make it auto run once.
How to make it have a loop??</p>
<p>html</p>
<pre><code><img src="image1.jpg" class="img1">
<img src="image2.jpg" class="img2">
</code></pre>
<p>js</p>
<pre><code>$(document).ready(function () {
function playslider(){
$('.img1').fadeIn(800).delay(800).fadeOut(800);
$('.img2').delay(1600).fadeIn(800).delay(800).fadeOut(800);
}
playslider();
});
</code></pre>
|
jquery
|
[5]
|
4,827,719 | 4,827,720 |
unmount sdcard programatically in android?
|
<p>1) I am working to implement Mount/Unmount sdcard support in my android application,Am able to get sdcard state by Environment.getExternalStorageState().I know we can call Settings Intent and Mount/Unmount, but my requirement has to do programatically with out calling Settings Intent.
2) Is it possible to Enable/Disable the Settings application in android.</p>
<p>I am not able to get answers for these questions, suggestions or samples are requested. thanks in advance.</p>
|
android
|
[4]
|
2,568,100 | 2,568,101 |
Fetch data from server and refresh UI when data is fetched?
|
<p>I want to fetch data from server and refresh UI when data is fetched in Android.</p>
<p>What should I use? an AsyncTask or a Service or something else?</p>
|
android
|
[4]
|
363,027 | 363,028 |
Android AlarmManager
|
<p>I have an Alarm Manager which send Intent to BroadcastReceiver. This Broadcast is not in Manifest. I register it onResume and unregister onPause in my Activity. What I need is to Save 2 boolean Preferences when app is not active and time of alarm is come. How to do that ?</p>
|
android
|
[4]
|
2,442,221 | 2,442,222 |
Javascript Call And Apply used together
|
<p>I know the <strong>call</strong> and <strong>apply</strong> in javascript but how does exactly the difference between javascript Call and Apply..?? and another thing i found some code use this together like this:</p>
<pre><code> function doSomething() {
return Function.prototype.call.apply(Array.prototype.slice, arguments);
}
</code></pre>
<p>are is the same as..</p>
<pre><code>Array.prototype.slice.apply(arguments)
</code></pre>
<p>Why we want to use call and apply together?</p>
|
javascript
|
[3]
|
493,249 | 493,250 |
Reading first letter of a word and choosing its number of alphabet
|
<p>I want to use a scanner to import a word. Then use a string to only use 1 letter and after this lookup which letter is which number and then println it. </p>
<p>How can I achieve this?</p>
|
java
|
[1]
|
174,452 | 174,453 |
Working very slow
|
<p>My application connects to web server, downloads data (approximately 43000 Bytes) and do mathematics function (such as log, +, -, * etc...) on each byte. </p>
<p>To prepare apk file, it is just like publishing to android market. Turned off debug mode and deactivated all loggers.</p>
<p>Then put it to the web server and downloaded (installed) on my HTC device. After installation, I've tested the application.
The time from beginning read bytes to end of task is approximately 4 minutes. It is very slow.</p>
<p>I've researched this part. It seems that is working slow on mathematics functions. </p>
<p>Is there any way to increase working speed ? </p>
<p>My code is same as iphone version of my application. It is very fast. All parts complete in 4 - 10 seconds. </p>
<p>What is wrong here ?</p>
<p>Or do I need to any configuration (related debug mode) ?</p>
<p>Please advice.</p>
<p>Thanks.</p>
|
android
|
[4]
|
2,860,698 | 2,860,699 |
Android - Any way to test Gestures on the Emulator?
|
<p>Was wondering if there's any way to test Gestures (eg: Fling) on the Emulator.</p>
<p>I saw a project on google code that lets people simulate the accelerometer, but none of Gestures.</p>
|
android
|
[4]
|
1,734,147 | 1,734,148 |
Popup when user trying to uninstall my application
|
<p>is that possible to prompt a popup to show message when user trying to uninstall my android application? i wanted to show some message my user when they uninstall. any idea?</p>
|
android
|
[4]
|
4,621,575 | 4,621,576 |
C++ Borland Builder forms - calling a function
|
<p>New to C++ so sorry if this is a basic question! I am used to Java (oh yess! so easy).</p>
<p>My function below addMessages is called from another file, it will then actually run <code>__fastcall TfrmRunning::Add()</code>. As i could not get this working from the other file. the add is part of the <code>TdrmRunning</code> object)</p>
<p>How do I get the add messages to call the Add function?</p>
<hr>
<p>This is from <strong>Running.cpp</strong></p>
<pre><code>void __fastcall TfrmRunning::Add()
{
lbMessages->Items->Add("Application Started at ");
}
//This is called from another file as i could not get the above function working
void addMessages(){
TfrmRunning::Add(); // this does not work
}
</code></pre>
<hr>
<p>My Header file (<strong>Running.H</strong>)</p>
<pre><code>class TfrmRunning : public TForm
{
__published: // IDE-managed Components
TImage *imgLogo;
TLabel *lblCopyRight;
TLabel *lblTitle;
TButton *btnExit;
TButton *btnViewType;
TListBox *lbMessages;
void __fastcall btnExitClick(TObject *Sender);
void __fastcall FormCreate(TObject *Sender);
void __fastcall Add();
private: // User declarations
public: // User declarations
__fastcall TfrmRunning(TComponent* Owner);
};
void addMessages();
</code></pre>
|
c++
|
[6]
|
1,241,545 | 1,241,546 |
How can I loop through this array in javascript?
|
<p>I'm trying to loop through this array but it does not return any length. Is it possible?</p>
<p>Thanks!</p>
<pre><code><!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">click</button>
<script>
function myFunction()
{
var fruits = [];
fruits["B"] = "Banana";
fruits["A"] = "Apple";
fruits["O"] = "Orange";
delete fruits["A"];
alert(fruits["A"]); // Alerts "undefined"
alert(fruits["B"]); // Alerts "Banana"
alert(fruits.length); // Alerts "0"
}
</script>
</body>
</html>
</code></pre>
|
javascript
|
[3]
|
5,462,287 | 5,462,288 |
Back button on Android Phones
|
<p>A couple questions about the back button (as seen on the emulator)...</p>
<p>1) Do all Android phones have the back button as a hard, tactile button?</p>
<p>2) If so, is it still recommended to put a back button in your software?</p>
<p>3) Is it possible to change the animation between activities when this back button is pressed? I would like it to be consistent with the animations in my app.</p>
|
android
|
[4]
|
1,466,215 | 1,466,216 |
Two-Way Ajax Binding
|
<p>Alright, here goes... I'm learning JavaScript, so I thought it would be a cool coding exercise to have two-way ajax binding between elements. Except I'm stuck. What do I mean by two-way ajax binding (I made up the term, I hope it's an accurate description of what I'm going for)? Well, say I had a simple box, created in the markup with a div, styled 200px by 200px, red. It wouldn't take any effort at all to make two textareas where, by typing in 500 in the first, and 100 in the second, the size of my div/box would go from 200px in height to 500px in height, and the width of my box would go to 100px in width. But what if I wanted to make it the other way around, simultaneously? Is that possible? Could, on the same page, you be able to type something in a textarea and make the div resize automatically, but at the same time, you be able to select the corner of the div and resize it, updating the textarea in real time via Ajax? How would that be implemented? Once I learn Vanilla JavaScript, I'm planning on learning jQuery, so another thing I was wondering is: is that sort of thing implementable in jQuery?</p>
<p>Thanks! Sorry if that seemed incomprehensible :/</p>
<p>I'm sorry, I'm new to JavaScript, I tried this as an exercise, but now I'm stuck. Apologies...</p>
|
javascript
|
[3]
|
3,308,759 | 3,308,760 |
where can I find php ready made projects
|
<p>I am a new php programmer. To continue my practice I need some ready made php projects. Please tell me about this where can I find these ready made php projects.</p>
|
php
|
[2]
|
2,815,428 | 2,815,429 |
Get Email Response of the user
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2485257/how-to-make-a-php-script-that-read-an-email-from-the-server">how to make a php script that read an email from the server?</a> </p>
</blockquote>
<p>So I want an app to send the user an email, and the user has to respond. How do I capture what the user sent back to the email?</p>
|
php
|
[2]
|
1,365,052 | 1,365,053 |
Can I use <%= ... %> to set a control property in ASP.NET?
|
<pre><code><asp:TextBox ID="tbName" CssClass="formField" MaxLength="<%=Constants.MaxCharacterLengthOfGameName %>" runat="server"></asp:TextBox>
</code></pre>
<p>The code above does not work. I can set the MaxLength property of the textbox in the code behind but i rather not. Is there away I can set the MaxLength property in the front-end code as above?</p>
|
asp.net
|
[9]
|
2,915,577 | 2,915,578 |
Dictionaries or Dual Arrays
|
<p>For the fun of it I am writing a Character class to help me learn what I need to know for video game development. I am also using this to help learn Java. </p>
<p>I want to store a characters stats as a Dictionary(key value pairs), but I'm unclear on how this is done in Java. The other option I am thinking of is to use two arrays(one for stat names, the other for stat values).</p>
<p>What is the best way to store key value pairs in Java?</p>
|
java
|
[1]
|
323,311 | 323,312 |
Reload a table view on close of add subview
|
<p>I have three objects in the applicaion. There is a UItableviewcontroller(with nib file) that shows a list of the items. One UIviewcontroller to add item (with nib file) and a model class that contains item object.</p>
<p>I show the list of item firstly (on application start). I have a navigation button on navigation bar to pop up add view (add as subview) on the same screen (on table view). In add view I have a add button. when I click on add button it adds the record and disappear from the table view but doesn't reload the that.</p>
<p>I have used following code in add item button click action</p>
<pre><code>listitem *home= [[listitem alloc] initWithNibName:@"listitem" bundle:nil];
[self.navigationController pushViewController:home animated:YES];
[home viewWillAppear:YES];
[home release];
[self.view removeFromSuperview];
</code></pre>
<p>In viewwillappear function I am reloading the data from database and also reloading the table view data using reloadData.</p>
<p>Am I doing correct. What is the mistake I am doing.</p>
|
iphone
|
[8]
|
664,784 | 664,785 |
Jquery page turn with html or asp
|
<p>I was asked by a client to create a bookflip (Page Turn) effect that did not require Flash. The imBookFlip plugin can load a book in an iframe or directly on the page. The book's pages can be set to turn when manually clicked only, begin auto flip (turn automatically) as soon as the html page loads, or begin auto flip when first page (front cover is clicked). </p>
|
jquery
|
[5]
|
4,748,614 | 4,748,615 |
Selection of a specific inline style
|
<p>how can I select only the divs with style "right:200px" in jquery?</p>
<p>Example:</p>
<pre><code><div class="test" style="position:absolute; right:200px; top:10px;"><p>Hello</p></div>
<div class="test" style="position:absolute; right:300px; top:20px;"><p>Hello</p></div>
<div class="test" style="position:absolute; right:400px; top:70px;"><p>Hello</p></div>
<div class="test" style="position:absolute; right:200px; top:40px;"><p>Hello</p></div>
<div class="test" style="position:absolute; right:400px; top:100px;"><p>Hello</p></div>
<div class="test" style="position:absolute; right:200px; top:140px;"><p>Hello</p></div>
var div200 = $('.test').css('right');
</code></pre>
<p>I don't know how to select only the divs with "right:200px".
I'm new to jquery. I tried hard but without any success:</p>
<p>Achim</p>
|
jquery
|
[5]
|
4,545,551 | 4,545,552 |
What is the use of eval function inside Javascript?
|
<pre><code><html>
<body>
<script type="text/javascript">
document.write("<br />" + eval("2+2"));
</script>
</body>
</html>
</code></pre>
<p>This gives me output as 4.</p>
<p>If i remove the eval function and run the same thing know it gives me the same output that is 4</p>
<pre><code><html>
<body>
<script type="text/javascript">
document.write("<br />" + (2+2);
</script>
</body>
</html>
</code></pre>
|
javascript
|
[3]
|
4,208,606 | 4,208,607 |
How to split spaces in strings (cross-browser safe)
|
<p>What is the best cross-browser practice to split spaces in a string with Javascript?
I tried <code>theString.split(" ")</code> but i am having issues with IE and Chrome/Safari.</p>
<p><strong>Update</strong></p>
<p>Here's the js code. IE/Chrome throw error at line: 61</p>
<p><a href="http://pastie.org/1151951" rel="nofollow">http://pastie.org/1151951</a></p>
|
javascript
|
[3]
|
3,082,511 | 3,082,512 |
making video from screenshots taken at regular intervals in android
|
<p>i just need to know how to convert a series of images taken during regular intervals can be converted into a video MP4 file. And I also need to playback that video. Can anyone have got an exact solution for this? I am fed up with this..the whole day....</p>
|
android
|
[4]
|
2,389,053 | 2,389,054 |
How do I do a non-standard sort on an Array in C#?
|
<p>Array.Sort(test);</p>
<p>Comes out to be</p>
<pre><code>_A
_B
_C
A
B
C
</code></pre>
<p>I reverse it</p>
<pre><code>C
B
A
_C
.. You know
</code></pre>
<p>I want it to be</p>
<pre><code>_C
_B
_A
C
B
A
</code></pre>
<p>So how could I do that?</p>
|
c#
|
[0]
|
3,474,872 | 3,474,873 |
Overflow in C# expressions Ok?
|
<p>In what way(s) would be an overflow in an expression be desirable in the following cases: </p>
<ol>
<li>Calculating a hash value</li>
<li>Calculating a check sum</li>
</ol>
<p>?</p>
|
c#
|
[0]
|
1,843,123 | 1,843,124 |
python script send emails, how to catch and show error sending email?
|
<p>I have a pretty simple python script that sends emails, something like this:</p>
<pre><code>import smtplib
from email.MIMEText import MIMEText
msg = MIMEText("test email")
msg['Subject'] = // ... yada yada
for iIndex in range(0,200):
s = smtplib.SMTP('smptserver')
// send the email
s.quit()
</code></pre>
<p>My problem is, typically 1 of the 200 emails will never arrive. I don't see any error messages on the console, so I'm assuming that the email was send to the SMTP server, and the SMTP server is dropping the ball.</p>
<p>But before I bug the SMTP guys, I want to make sure I'm not missing an error somewhere.</p>
<p>Is there somewhere other than the console where python will output the error message?</p>
<p>Thanks,
Rob</p>
|
python
|
[7]
|
2,522,132 | 2,522,133 |
JavaScript object data and Arrays
|
<p>I have a JavaScript object as follows.</p>
<pre><code>var sampleData = {
"studentsList": {
"Student1": {
"marks": "123",
"grade": "B"
},
"Student2": {
"marks": "144",
"grade": "A"
}
}
};
</code></pre>
<p>Now the user enters the name of a student, say <code>Student1</code> and I need to get the details of that object. </p>
<p><strong>I have two questions.</strong></p>
<p><strong>[1]</strong> How do I get the details of the entered student using JavaScript? </p>
<p>When I use <code>sampleData.studendsList.valueOf("Student1")</code> returns me the complete object. I just need the details of "Student1".</p>
<p><strong>[2]</strong> Is this the correct way to do it? Or we should create an array of Students and that contains an property called "name" with value say <code>Student1</code> ? If I go with this approach then I need to iterate through the entire array list to get the details of a student. </p>
<p>Which appraoch is better?</p>
|
javascript
|
[3]
|
1,737,039 | 1,737,040 |
howto create a new Date() in Javascript from a non-standard date format
|
<p>i have a date in this format : dd.mm.yyyy</p>
<p>when i instantiate a javascript date with it, it gives me a NaN</p>
<p>in c# i can specify a dateformat, to say: here you have my string, it's in this format, please make a Datetime of it.</p>
<p>is this possible in javascript too, and if not, is there an easy way?</p>
<p>i would prefer not to use a substring for day, substring for month etc. because my method must also be capable of german, italian, english etc dates.</p>
|
javascript
|
[3]
|
2,154,720 | 2,154,721 |
BindingSource remove current
|
<p>I use BindingSource for deleting records in my forms:</p>
<pre><code>try
{
BindingSource1.RemoveCurrent();
BindingSource1.EndEdit();
Table1TableAdapter.Update(dataSet01.Table1);
}
catch (Exception ex)
{
MessageBox.show(ex.Message);
}
</code></pre>
<p>if record related to another,at first user see this record remove,but after that an error will arise. How can I prevent removing related record at first; so no error will be shown.</p>
|
c#
|
[0]
|
3,803,355 | 3,803,356 |
adding lists with containers
|
<p>How can I accomplish this in Python?
<a href="http://stackoverflow.com/questions/7875995/combining-lists-of-word-frequency-data">Combining Lists of Word Frequency Data</a></p>
<p>Let's say I have two lists A and B and both contain the words& frequencies of a file in descending frequency order, how can I do what's done in the question in Python?</p>
<pre><code>from FrequentWords import *
from WordFrequencies import * # makes the list with words&frequencies
L = WordFrequencies('file.txt')
words1 = L[0]
freqs1 = L[1]
L1 = computeWordFrequencies('file1.txt')
words2 = L1[0]
freqs2 = L1[1]
words = zip(*sorted(zip(L,L1)))
both1 = sorted(freqs1+freqs2,reverse=True)
common_words = set(words1) & set(words2)
frequency_common_words = both1
</code></pre>
|
python
|
[7]
|
1,322,794 | 1,322,795 |
how to compare two files and extract the difference?
|
<p>I created a video recorder which stores recording to a file. I would like to implement a method which would read the file each second, compare the current file with the old value (1 second older) and write the difference to a separate file.</p>
<p>I would be very thankful if anyone could explain how to do that or write a simple example. I guess there has to be a thread which compares the new value with the old one by calling a custom method compareFiles(File currentFile, File oldFile) on a given period of time. The old file could also be saved as a temporary file and the current file at the original path could be compared with temporary file.</p>
<p>Any suggestion about the improvement of the described logic is more than welcome!</p>
|
java
|
[1]
|
428,523 | 428,524 |
c# dynamically pass string method at run time for string manipulation
|
<p>How do I dynamically pass string methods to be applied to strings at run time.
ex.</p>
<pre><code>Private String Formatting(String Data, String Format)
</code></pre>
<p>When we pass <code>String S1 = "S1111tring Manipulation"</code> and <code>format = Remove(1,4)</code> - behind the scenes it becomes <code>S1.Remove(1,4)</code> resulting in "String Manipulation"</p>
<p>or if we pass <code>String S1 = "S1111tring Manipulation"</code> and <code>format = ToLower()</code> behind the scene it becomes <code>S1.ToLower()</code> resulting in <code>"s1111tring manipulation"</code></p>
<p>I should be able to pass any valid method like <code>PadLeft(25,'0')</code>, <code>PadRight</code>, <code>Replace</code> etc...</p>
<p>I would appreciate a complete example</p>
<p>This is what I have tried and it does not work</p>
<pre><code>using System.Reflection;
string MainString = "S1111tring Manipulation";
string strFormat = "Remove(1, 4)";
string result = DoFormat(MainString, strFormat);
private string DoFormat(string data, string format)
{
MethodInfo mi = typeof(string).GetMethod(format, new Type[0]);
if (null == mi)
throw new Exception(String.Format("Could not find method with name '{0}'", format));
return mi.Invoke(data, null).ToString();
}
</code></pre>
<p>throws an error (Could not find method with name 'Remove(1, 4)') - so I am not sure how to proceed</p>
|
c#
|
[0]
|
4,594,233 | 4,594,234 |
ajax, jquery, and filtering drop downs
|
<p>So i have these two jquery functions which pass my XHR service a key to filter the results of my list (not shown). I'm new to jquery(and web dev in general). These two functions are %90 the same (except for the id tags). How could I re-write this to be more DRY-like?</p>
<pre><code> $('#id_group').change(function() {
var option = $(this).val();
$.get('jobs/update/', {group:option}, function(data) {
$('#jobs').html(data).hide().fadeIn(1000);
});
});
$('#id_location').change(function() {
var option = $(this).val();
$.get('jobs/update/', {location:option}, function(data) {
$('#jobs').html(data).hide().fadeIn(1000);
});
});
</code></pre>
|
jquery
|
[5]
|
2,303,904 | 2,303,905 |
problem with an app on my phone
|
<p>i have wrote an app getting rss feed from the website of my university.in the eclipse emulator the app runs with no problem and i can reed the rss.but as i transferred it to my mobile(samsung gti 9000) the screen freeze when i push the button for the rss news...also,if i go for the menu button of the phone and change dom to sax the phone pops out a message to force down...any idea?may my phone has a problem?please keep on mind that my phone works on greek language and the emulator on english,i dont know if this matter..</p>
|
android
|
[4]
|
1,715,894 | 1,715,895 |
How to remove hyperlink when user clicks it
|
<p>I am trying to remove the hyperlink after I click it. (pagination)</p>
<p>I want the hyperlink to be removed but still show the text.</p>
<pre><code><a href='#'>1</a>
<a href='#'>2</a>
<a href='#'>3</a> //remove the hyperlink but keep number 3.
<a href='#'>4</a>
<a href='#'>5</a>
</code></pre>
<p>Thanks for the helps.</p>
|
jquery
|
[5]
|
1,961,652 | 1,961,653 |
Calling a new Form from a separate thread and avoid frozing the form
|
<p>I am currently creating a chat system. The receiving end of the client side is managed by a separate thread so that when it receives a message from another client, a new Form is loaded bearing the message of the sender. The problem is, the newly loaded form is frozen and is not responding [due to the blocked methods I use (?)]. How can I solve that problem? I am new to C# so please put in the code snippet.</p>
|
c#
|
[0]
|
4,363,897 | 4,363,898 |
hash_hmac key definition
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/5579559/how-to-implement-hash-hmac-properly">How to implement hash_hmac properly?</a> </p>
</blockquote>
<p>I'm using the hash_hmac function to generate a keyed hash. In this function's argument I should specify a key. I'm wondering what should I use there. Like how should I come up with something and what is your advice for me. I'm afraid if I placed something general I'll be exposed to security breaches on the website I'm developing. Any advice?</p>
<p>the user has "countryOfOrigin" attribute stored for him/her, is it a good idea to use it as a key or maybe instead of the that I can use the username provided on the sign up process..</p>
|
php
|
[2]
|
4,490,095 | 4,490,096 |
Checking for array or Json values in JavaScript
|
<p>I am trying to check, if certain words exist, but as far as I have tried, it seems not to be working. </p>
<p></p>
<pre><code> Chars = {
ae: 'hello',
oe: 'world',
};
if(ae in Chars){
document.write('yes');
}else{
document.write('no');
}
</code></pre>
<p>I am just trying to know, if <code>ae</code> exists</p>
|
javascript
|
[3]
|
1,478,222 | 1,478,223 |
What free or cheap tools I can use for website creation business?
|
<p>I need to do a website for a friend who will pay me on delivery. I took a few courses in ASP.NET and think I can do it in ASP, but I am not sure ASP is free, since its a Microsoft product. Is there a way to use some kind of free version of ASP.NET to develop and sell a website or should I buy it? If it's not free, what are the free or cheap alternatives to it? </p>
|
asp.net
|
[9]
|
1,677,882 | 1,677,883 |
How to delete files matching pattern within a directory in PHP?
|
<p>I have created a PHP script to generate CSV files. I want to keep only the latest file which the script creates. How can I delete all older <code>*.csv</code> files in a directory using PHP?</p>
|
php
|
[2]
|
5,021,811 | 5,021,812 |
stop the title showing up on hover with jquery?
|
<p>I basically am storing some data in the title attribute of some divs that I probably shouldn't be. Anyways I have done it now and when I hover over these elements this information pops up in the browsers handy default tooltip.</p>
<p>e.g</p>
<pre><code><div title="blah blah blah">something</div>
</code></pre>
<p>Is there a method to stop this tooltip title functionality from working as it normally does?</p>
|
jquery
|
[5]
|
460,769 | 460,770 |
c# - How to run a specific DOS Command
|
<p>I tried various methods possible to run this specific DOS command thru C#. I do not want to use a batch file. Whatever i try, it keeps taking only first word from Printer name and not the entire name, in this case, it says Printer POS is not connected instead of saying Printer POS Lexmark is not connected. What could the error be? Thanks guys!</p>
<p>The DOS command is : rundll32 printui, PrintUIEntry /o /n "POS Lexmark"</p>
<p>My code is as follows: </p>
<pre><code>string command = string.Format("/c rundll32 printui, PrintUIEntry /o /n" + " POS Lexmark");
ProcessStartInfo cmdsi = new ProcessStartInfo("cmd.exe");
cmdsi.Arguments = command;
cmdsi.CreateNoWindow = false;
Process cmd = Process.Start(cmdsi);
</code></pre>
|
c#
|
[0]
|
654,826 | 654,827 |
Determine HTML page that called a function in an external js file
|
<p>Is it possible to determine this at runtime?</p>
<p>contents of external.js:</p>
<pre><code>function x() {
//can i get the path/name of the html file that included this js file?
//which is test.html
}
</code></pre>
<p>contents of test.html</p>
<p>script src="external.js"</p>
|
javascript
|
[3]
|
4,310,112 | 4,310,113 |
Client Coding error for chatting application
|
<p>I'm getting a error in my code</p>
<blockquote>
<p>Cross-thread operation not valid:
Control '' accessed from a thread
other than the thread it was created
on.</p>
</blockquote>
<p>I don't know why it is happening. Can someone explain this to me?</p>
|
c#
|
[0]
|
2,522,791 | 2,522,792 |
Javascript to create fence calclutor
|
<p>do you know if it is possible to build calculator to calculate fence, gates, etc. in JavaScript to get result similar to <a href="http://diy-vinyl-fence.com/content/16-fence-calculator" rel="nofollow">http://diy-vinyl-fence.com/content/16-fence-calculator</a> ?</p>
<p>if you have any point, libraries, framework to use i would appreciate</p>
<p>gerard</p>
|
javascript
|
[3]
|
148,055 | 148,056 |
Load Balancing for Listeners
|
<p>How should we load balance listeners to a 3rd party service?</p>
<p>e.g. We need to read gtalk messages via XMPP Listener and build an application using the interactions of the user with a chatbot. In such a case, how would we ensure that we can have XMPP listeners on multiple servers and we load balance the messages between the listeners?</p>
<p>Thanks in advance.</p>
|
java
|
[1]
|
2,748,993 | 2,748,994 |
Converting specific time format with strptime
|
<p>I'm trying to convert </p>
<pre><code>[16/Jan/2010:18:11:06 +0100] (common log format)
</code></pre>
<p>to a timestamp. How can I use <code>strptime</code> to convert this?</p>
<p>time zone can be different from +0100</p>
|
python
|
[7]
|
4,737,948 | 4,737,949 |
Child User Control Button Click not working?
|
<p>I have an issue with user controls. I have three user controls: <code>Usercontrol1</code>, <code>Usercontrol2</code>, and <code>Usercontrol3</code>. <code>Usercontrol3</code> has a "Submit" button. The controls are nested as follows:</p>
<pre>
default.aspx
UserControl1
UserControl2
UserControl3
Submit Button
</pre>
<p>When I run my application, the submit button shows on the page, but when I click on this button, the click event is not raised. Why is this?</p>
|
asp.net
|
[9]
|
3,522,258 | 3,522,259 |
iphone:How to send & receive msgs using XMPPframework in iPhone?
|
<p>I want to send & receive msg using xmppframework in iphone so I am include all files like XMPPframwork , Kissxml and Asyncsocket but I can't send & receive msg so I want this functionality in my iphone apps so please send me code of that or any link which i develop this functioanlity so please help me as soon as possible.....</p>
<p>Thanks</p>
|
iphone
|
[8]
|
5,154,534 | 5,154,535 |
what is the role of /system/app on Android?
|
<p>I am looking to clear space on /system on my Android device. It turns out that /system/app is using almost 35% of the space on /system. I find that if I delete an apk from /system/app, nothing seems to happen to the application. It does not get uninstalled, and it still runs fine. Therefore, what is the role of /system/app ? Is it some sort of cache? Can I clear everything in it?</p>
|
android
|
[4]
|
3,852,891 | 3,852,892 |
C++ object without subclasses?
|
<p>I was wondering if there is a way to declare an object in c++ to prevent it from being subclassed. Is there an equivalent to declaring a final object in Java?</p>
|
c++
|
[6]
|
5,092,641 | 5,092,642 |
PHP class and method
|
<p>Im using class.twitter.php (<a href="http://emmense.com/php-twitter/documentation/v11-methods-available/" rel="nofollow">http://emmense.com/php-twitter/documentation/v11-methods-available/</a>)</p>
<p>Im using this code:</p>
<pre><code>$summize = new summize;
$search = $summize->search('#test');
echo "<pre>";
print_r($search);
echo "</pre>";
</code></pre>
<p>And the output is:</p>
<pre><code>stdClass Object
(
[results] => Array
(
[0] => stdClass Object
(
[profile_image_url] => http://a1.twimg.com/profile_images/327884498/Tobias_Zielke_ums_logo_normal.jpg
[created_at] => Sun, 03 Jan 2010 10:47:14 +0000
[from_user] => tobiaszielke
[to_user_id] =>
[text] => Ich hoffe unser See ist nicht zugefroren #Trocki #Waterproof #Test
[id] => 7329402210
[from_user_id] => 27862585
[geo] =>
[iso_language_code] => de
[source] => <a href="http://ubertwitter.com" rel="nofollow">UberTwitter</a>
)
....
</code></pre>
<p>How can I take the [from_user], [text], and write it to a file?</p>
|
php
|
[2]
|
4,786,775 | 4,786,776 |
Add animated Gif image in Iphone UIImageView
|
<p>i need to load animated Gif image from URL in UIImageview.</p>
<p>If i use the normal code, the image didnt loaded.</p>
<p>If any other way is there to load animated Gif images.</p>
<p>Please help me.</p>
<p>Thanks.</p>
|
iphone
|
[8]
|
2,317,356 | 2,317,357 |
Scrolling a div of images
|
<p>I'm looking for a simple way to scroll a list of images horizontally across a div, and have the pattern repeat (an infinite loop of images moving slowly from left to right). </p>
<p>Currently using <a href="http://logicbox.net/jquery/simplyscroll/" rel="nofollow">http://logicbox.net/jquery/simplyscroll/</a> for this task, but it has a lot of features I don't need (such as user controls and vertical scrolling). My hope is that there's a simple way to code this in jQuery in a few dozen lines.</p>
<p>I'm confident I can build something to scroll the images horizontally, but getting them to loop is beyond me. </p>
<p>Any help, information, or even a new script (that has been updated recently) would be awesome. Thanks!</p>
|
jquery
|
[5]
|
1,628,958 | 1,628,959 |
jquery insert div element which will include all old body content
|
<p>hi i want to insert div element in the root of my page hierarchy, so it must be opened after body tag and closed before body close tag, how can i do it in jquery?</p>
|
jquery
|
[5]
|
1,819,464 | 1,819,465 |
remove the view before next action
|
<p>I am developing one application.In that i want to remove the subview from the main view before next action.I written the code like below.</p>
<pre><code> [subview removeFromSuperview];
[self start];
</code></pre>
<p>But now view is removing after completion of start action.So please tell me how to remove the sub view first from the main view.</p>
|
iphone
|
[8]
|
2,608,340 | 2,608,341 |
How to call static function from another static function
|
<pre><code>public static void func1(string a,string c)
{
func2(a,c)--- error
}
public static void func2(string a,string c)
{
}
</code></pre>
<p>if im wrong please correct it.
I need function to be called this way... function to be static.please help</p>
|
c#
|
[0]
|
1,233,884 | 1,233,885 |
Java String to Date Conversion throws Unparseable date
|
<p>I'm trying to convert following text to Date but not able to get it to parse correctly.</p>
<pre><code>String strDate = "Tue Mar 13 12:00:00 EST 2012";
try{
SimpleDateFormat sd = new SimpleDateFormat("dd/MM/yyyy");
//also tried SimpleDateFormat sd = new SimpleDateFormat("dd/MM/yyyy HH:mm");
//as well as sd.setTimeZone(TimeZone.getDefault());
Date date = sd.parse(strDate);
}catch(Exception e)
{
e.printStack();
//fails with java.text.ParseException: Unparseable date: "Tue Mar 13 12:00:00 EST 2012"
}
</code></pre>
<p>what am i doing wrong? </p>
|
java
|
[1]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.