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 |
|---|---|---|---|---|---|
943,569 | 943,570 | variable increment doesn't work | <p>When I launch my web page, increment doesn't work correctly!</p>
<p>It should go like this: <code>$i = from 1 to x (0,1,2,3,4,5,6 etc..)</code>.<br>
But instead it jumps over every step giving result of <code>(1,3,5,7 etc..)</code>.</p>
<p>Why is this code doing this?</p>
<pre><code><ul class="about">
<?php
$result = mysql_query("SELECT * FROM info WHERE id = 1");
while ($row = mysql_fetch_assoc($result))
{
$bioText = $row['bio'];
}
$endBioTxt = explode("\n", $bioText);
for ($i=0; $i < count($endBioTxt);)
{
if (checkNum($i) == true)
{
echo "<li class='left'><div>".$endBioTxt[$i]."</div></li>";
echo $i;
}
else
{
echo "<li class='right'><div>".$endBioTxt[$i]."</div></li>";
echo $i;
}
$i++;
}
// Function to check if number is prime
function checkNum($num){
return ($num % 2) ? TRUE : FALSE;
}
?>
</ul>
</code></pre>
<p>Output:</p>
<blockquote>
<p>Sometext!(right side)<br>
0<br>
1<br>
Sometext2!(right side)<br>
2<br>
3<br>
...</p>
</blockquote>
| php | [2] |
733,803 | 733,804 | shopping cart: delete doesn't work as supposed to | <p>I'm having some problem with the "delete" of my shopping cart script (is a case of a switch)</p>
<pre><code>case 'delete':
if ($cart) {
$items = explode(',',$cart);
$newcart = '';
foreach ($items as $item) {
if ($_GET['id'] != $item) {
if ($newcart != '') {
$newcart .= ','.$item;
} else {
$newcart = $item;
}
}
}
$cart = $newcart;
$_SESSION['cart'] = $cart;
}
break;
</code></pre>
<p>Example: $_SESSION['cart'] = 1,2,1;
The problem is that when a client bought twice the same item, it deletes both. How can i fix it?</p>
| php | [2] |
1,669,824 | 1,669,825 | Will a handler invoke handleMessage after onSaveInstance and before onResume and onRestart? | <p>I have a handleMessage method which calls FragmentTransaction's commit method. This commit method can only be called before the Activity's onSaveInstance method is called. I usually leave it up to the Handler to decide when to call handleMessage, assuming it will do it when the activity is ready. From Handler class documentation, "The given Runnable or Message will then be scheduled in the Handler's message queue and processed when appropriate." I would really like to know if there is any documentation stating that handleMessage is only called before onSaveInstanceMethod(), or if it can be called any time before onDestroy(). I'm just not sure what "when appropriate" means.</p>
| android | [4] |
4,153,276 | 4,153,277 | ideas for android applications | <p>i am an android application developer. I have developed 10 applications so far. I want to develop a funny and weird android application. Could anyone suggest any ideas..?</p>
| android | [4] |
3,167,116 | 3,167,117 | Can setDisplayShowTitleEnabled be set in xml to theme an ActionBar? | <p>I am trying to theme an <code>ActionBar</code> in xml rather than code. So far I have this:</p>
<pre><code><style name="TestTheme" parent="android:Theme.Holo.Light">
<item name="android:actionBarStyle">@style/TestActionBar</item>
</style>
<style name="TestActionBar" parent="android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">@drawable/actionbar_background</item>
</style>
</code></pre>
<p>This is giving me my custom background and I want to be able to turn off the title here as well. In code, I would set <code>setDisplayShowTitleEnabled</code> to false. How do I do it in xml?</p>
| android | [4] |
4,390,647 | 4,390,648 | what will happen when an array is initialized more than once in c++? | <p>What happens to the memory location when I initialize a variable in c++ more than once? For example:</p>
<pre><code>LPWSTR sampleString = new whcar_t[10];
//some operations here
sampleString = new wchar_t[2];
//some operations here
sampleString = new wchar_t[25];
//some operations here
</code></pre>
<p>If I delete the memory by using <code>delete [] sampleString;</code> will all the associated memory locations be cleared?</p>
| c++ | [6] |
5,918,413 | 5,918,414 | ProgressDialog doesn't appear | <p>I have the following in my Activity that I use to download a users films in their LoveFilm queue, but the ProgressDialog never appears.</p>
<pre><code>public class MyListActivity extends Activity {
SharedPreferences prefs;
ProgressDialog m_progressDialog;
Thread listThread;
User user;
private Runnable threadProc_initializeQueue = new Runnable() {
public void run() {
user.fetchQueues();
Queue defaultQueue = user.getDefaultQueue();
defaultQueue.fetchTitles();
m_progressDialog.dismiss();
}
};
/* (non-Javadoc)
* @see android.app.Activity#onCreate(android.os.Bundle)
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
prefs = getSharedPreferences(getString(R.string.app_name), MODE_PRIVATE);
// Authenticate the user if needs be.
if(!prefs.getBoolean("isAuthenticated", false)) {
Intent i = new Intent(this, OAuthActivity.class);
startActivity(i);
finish();
} else {
// Get the users default list.
LoveDroid app = (LoveDroid) getApplication();
user = new User(app);
m_progressDialog = ProgressDialog.show(MyListActivity.this, "Please Wait", "Loading", true);
listThread = new Thread(null, threadProc_initializeQueue);
listThread.run();
}
}
</code></pre>
<p>I've seen others with this problem, and they all basically get around to recommending a line that looks like mine</p>
<pre><code>m_progressDialog = ProgressDialog.show(MyListActivity.this, "Please Wait", "Loading", true);
</code></pre>
<p>The rest of the code works, the users films are downloaded via the thread, but the dialog never shows up, it takes a few seconds too, it's not like the dialog is being dismissed before it's had time to appear.</p>
| android | [4] |
1,617,414 | 1,617,415 | exporting sql query result to excel | <p>In my asp.net application i wanted to export the SQL query result to Excel and that excel should be avaliable to the user as a download.
Please help</p>
| asp.net | [9] |
5,600,687 | 5,600,688 | How to create Google blogger type Sub Domain URL for blog | <p>I have to create a BLOG section in my website. If my site is www.abc.com, then I have to create different blogs like google blogger service.</p>
<p><a href="http://author1.abc.com" rel="nofollow">http://author1.abc.com</a></p>
<p><a href="http://author2.abc.com" rel="nofollow">http://author2.abc.com</a></p>
<p>I have the ability to create unlimited sub domains but I am not able to understand how above blog URL will work. These will be virtual sub domains or will I have to create actual sub domains.
Is it possible via Url rewriting? If yes, how?</p>
<p>If I use Url rewriting, browser will redirect the above URL to page for which I have craeted the URL rewriting rule. I dont want to change the URL in browser.</p>
<p>Any one has any suggestion?</p>
| asp.net | [9] |
3,771,854 | 3,771,855 | How to access the Array of dictionary values in iphone | <p>I have Array of dictionary contents but i am not able to get the dictionary values.
Below is the dictionary format and in dictionary "resdata" and timestamp is dictionary key values. So i need to know how to get the timestamp values.</p>
<pre><code> <__NSArrayM 0x89426d0>(
{
resData = (
{
timestamp = "2012-04-09 13:54:08 +0000";
}
);
seqCounter = 101;
}
here is the source code
for (int i = 0; i < [self.gluClkDetailArray count]; i++)
{
NSMutableDictionary *mDict = [self.gluClkDetailArray objectAtIndex:i];
NSDate *mDate = [[mDict objectForKey:@"resData"] objectForKey:@"timestamp"];
NSLog(@"NSDATE-----%@", mDate);
}
In above code the dictionary value is 0.
Thanks in advance
</code></pre>
| iphone | [8] |
4,862,702 | 4,862,703 | setTimeout alternative | <p>I want to run a function after delay a second , setTimeout works on browser, but on ipad, it sometimes just completely skip this function, perhaps it can't run several setTimeout at the same time becuase I have many other timeout functions, what is the proper alternative for setTimeout?</p>
<pre><code>that.movepictimer = setTimeout(function(){
for(i=1;i<that.pic.length;i++){
if(that.$pic[i]!=null && that.$pic[i]!=undefined){
css_translate(f,that.$pic[i],that.picleft,0,i);
}
}
},1000)
</code></pre>
| javascript | [3] |
4,950,999 | 4,951,000 | Is there a way to get the name of the top level PHP file from inside an included one? | <p>Let's say I'm writing a global logData method that wants to write to a log file that has the same name as the php that's running it, but with a .log extension.</p>
<p>I'm including this logging in a parent php with the intention of having it always write to log files that are whatever the *parent file name is (not the tools.php lib in which it's sitting).</p>
<p>So, I have
/some/arbitrary/directory/parent.php</p>
<p>which calls</p>
<p>include ("/path/to/my/php/libs/tools.php");</p>
<p>but when I run my logging method that's in tools.php it logs to a file called </p>
<p>/path/to/my/php/libs/tools.php.log</p>
<p>rather than
/some/arbitrary/directory/parent.php.log (which is what I'd like).</p>
<p>I'm using <code>__FILE__</code> which is behaving this way (probably as its intended to). Is there a command for getting the parent's file name so that I can get this to work as I intend? Or will I have to pass <strong>FILE</strong> as a param into my method from the parent php to get it to write to the correct output file?</p>
<p>TIA</p>
| php | [2] |
4,032,927 | 4,032,928 | Split screen and scrolling with one side frozen | <p>I have searched the posts here for a specific answer to this question, and although there are many responses to split screen problems, I have found none that relate to what I want to do. I am not a developer, but I have one who is working for me. He is having difficulty finding a solution to this problem.</p>
<p>I am working on an Android app that requires a vertical split screen. The left side of the screen scrolls up and down only, and basically has product names. The right side of the screen contains columns of data for the products. This data is much too wide to display on one screen. I need the data and columns in the right screen to scroll in all directions, while the product names only scroll in the vertical. Now, both the names, and the data need to remain locked together so that when one is scrolled vertically the other follows.</p>
<p>I sure hope someone can point me in the right direction, or tell me it’s not possible, because my programmer seems to be going nuts. Thanks!</p>
| android | [4] |
4,787,960 | 4,787,961 | TextUtil.concat not preserves hyperlinks | <p>For example code below works right</p>
<pre><code>CharSequence text = TextUtils.concat( "before ", Html.fromHtml( "<b>This works</b>"), " after " );
myTextView.setText(text, TextView.BufferType.SPANNABLE );
</code></pre>
<p>If i put an hyperlink in the html code, i.e</p>
<pre><code>CharSequence text = TextUtils.concat( "before ", Html.fromHtml( "<a href=\"www.google.it\">Google</a>"), " after " );
myTextView.setText(text, TextView.BufferType.SPANNABLE );
Linkify.addLinks( myTextView, Linkify.ALL );
</code></pre>
<p>"Google" is displayed but hyperlink is not undelined correctly and is not clickable. Any advice?</p>
| android | [4] |
2,805,798 | 2,805,799 | php stop execution in runtime | <p>I have a script to scrape a page. When the script runs, it takes 3 hours to complete.
I want to build a button en when pressing it, the script must stop running.</p>
<p>Someone an idea?</p>
| php | [2] |
4,777,139 | 4,777,140 | Master Page reloads every Time | <p>I uses a Master Page in website,In master Page I create a menu by accordian pane and repeater,this master page is base for all the other page,
,when user click on the items of Menu its sub items are open and when the userclicks on the subitem then the page navigate according to the url
My problem is that,when the tarhet page loads master page is again loading and the menu binds again ,I doesn't want to reload menu at that time..........
I think I should use the concept Of Nesting Master Page,but I am not sure it solves my Problem...</p>
<p>How can I do this</p>
| asp.net | [9] |
1,675,947 | 1,675,948 | Alarm Manager events not fired (registering for notifications per day) | <p>I am writing an application which needs a homewidget showing the current date. For that I have used the alarm manager registering as follows:-</p>
<pre><code>Intent intent = new Intent(HomeScreenWidgetProvider.ACTION_UPDATE_DATE);
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, appWidgetId);
intent.setData(getUriData(appWidgetId));
PendingIntent datePendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
AlarmManager alarms = (AlarmManager) getApplicationContext().getSystemService(Context.ALARM_SERVICE);
alarms.cancel(datePendingIntent);
**alarms.setRepeating(AlarmManager.RTC, getTimeForMidnight(), AlarmManager.INTERVAL_DAY, datePendingIntent);**
</code></pre>
<p>As you see, the above code registers for notifications first for the next 12.00AM with an interval of a day from there on. I update the date in my widget when I get a notification from alarm manager.</p>
<p>There is one big problem though. I don't get the alarm manager events when the date changes (at 12.00AM). And so the date does not change in my home screen widget.</p>
<p>The above code works fine in the emulator but not on the device. I am using Samsung Galaxy S 19000 for (real time) testing.</p>
<p>Is there a problem with use of alarm manager? Or is there an alternate way of receiving date change notifications?</p>
| android | [4] |
3,159,024 | 3,159,025 | jquery animate onStart callback | <p>Does jquery animate method have a onStart callback. I know about the complete callback but don't see anywhere to use other callbacks like onStart or initialize .</p>
<p>I want onStart callback because when I am calling animate(), it may not start immediately but queued due to previous animation not finished.</p>
| jquery | [5] |
905,701 | 905,702 | Creating ListView with Two text in one line | <p>I am creating an application to find near by places from user's current location. I want to create a ListView which will list all the place's name with distance from current location. I am able to to show the place name but how to show the distance in the same list view.</p>
| android | [4] |
1,341,670 | 1,341,671 | how to start google latitude services in background | <p>i have a app in which i wish to <strong>start google latitude</strong> services in <strong>background</strong>
i do <strong>not</strong> intend to start the <strong>foreground application</strong> along with it.</p>
<p>also tell me the permissions required in manifest</p>
<pre><code> Intent intent = new Intent();
intent.setClassName("com.google.android.apps.maps","com.google.android.maps.LatitudeActivity");
startActivity(intent);
</code></pre>
<p>this code is giving me permissions error.</p>
| android | [4] |
332,171 | 332,172 | PHP won't echo out the $_POST | <p>got a small problem, this code</p>
<pre><code><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<?php
...
echo '<input name="textfield" type="text" id="textfield" value="Roger" />';
echo 'Hello, '.$_POST['textfield'].'<br>';
...
?></p>
</form>
</code></pre>
<p>should echo out "Hello, Roger", as roger is the default value, yet it gives out only "Hello, " and nothing else. Any suggestions?</p>
<p>edit: yes, there's a form.</p>
<p>Thanks!</p>
| php | [2] |
4,307,005 | 4,307,006 | Best way to represent a tooltip on a table | <p>I have a table with lot of information that needs to display on each cell. I currently have images to represent the presence of information and on hover of these images, I would like to display additional info. I was impressed with the meetup.com and facebook style tool tips divs which display more information on hover and the div would expand based on the amount of information. Which is the best way to represent this kind of info? I would like to use jQuery/Javascript/HTML/CSS to achieve this effect.</p>
<p>Note 1: I have looked at few jquery plugins but they all seem to use the title attribute of a tag to represent the information. But I have large amount of information I need to show on the tooltip and also need to style the information so using title attribute is not very helpful.</p>
<p>Note 2: The tooltip also needs to adjust its position if the left/right or bottom/top of the table is detected. </p>
<p>see the image to get a look at the table that is likely to contain the above format.</p>
<p><img src="http://i.stack.imgur.com/UnPz0.png" alt="http://imgur.com/f8EQf"></p>
| jquery | [5] |
5,061,524 | 5,061,525 | How to remove divider for one row in custom list view in android | <p>can anybody tell How to remove divider for one row in android.I want to remove third row divider in android.In Custom List view there is line below for each row.I want to remove third row line </p>
<p>Thanks</p>
| android | [4] |
2,190,532 | 2,190,533 | contact saving result is not showing in javscript | <p>I wrote a phone number saver in JavaScript. Everything is working, but when I search a name or a number in the search box no result is being shown:</p>
<pre><code>function contact() {
var nam1=prompt("Please enter the name");
var num1=prompt("please enter the phone number");
}
contact();
function search() {
var searc= prompt("Please enter the name of your contact or phone number");
}
search();
//search box
if ( searc == nam1 ) {
alert("The phone Number is , " + num1);
}
if ( searc == num1 ) {
alert("The Contact Name is , " + nam1);
}
</code></pre>
| javascript | [3] |
1,938,506 | 1,938,507 | Pointers in stl::map | <p>I have query regarding std::map.</p>
<p>if I have a std::map like:</p>
<pre><code>std::map <T1, T2*> my_map;
T1 t;
T2* tt = new T2;
my_map[t]=tt;
</code></pre>
<p>who is responsible to clean this container, Will destructor of T2 will take care of it (T2* tt). Also if I want to retain this container throughout the program, where should I clean it.</p>
<p>Thanks</p>
| c++ | [6] |
2,659,109 | 2,659,110 | Querying the MediaStore is coming up with results that don't appear to match | <p>I'm new to Android development and I've been working on a custom music player for my own use. After quite a bit of searching, I finally tracked down some code I could use to search the MediaStore for music files. This is the code I'm using.</p>
<pre><code>Uri uri = MediaStore.Audio.Media.EXTERNAL_CONTENT_URI;
StringBuilder where = new StringBuilder();
where.append(MediaStore.Audio.Media.TITLE + " != ''");
// Add in the filtering constraints
String [] keywords = null;
if (query != null) {
String [] searchWords = query.split(" ");
keywords = new String[searchWords.length];
Collator col = Collator.getInstance();
col.setStrength(Collator.IDENTICAL);
for (int i = 0; i < searchWords.length; i++) {
keywords[i] = '%' + MediaStore.Audio.keyFor(searchWords[i]) + '%';
}
for (int i = 0; i < searchWords.length; i++) {
where.append(" AND ");
where.append(MediaStore.Audio.Media.ARTIST_KEY + "||");
where.append(MediaStore.Audio.Media.TITLE_KEY + " LIKE ?");
}
}
String selection = where.toString();
String[] projection = {
BaseColumns._ID,
MediaStore.Audio.Media.MIME_TYPE,
MediaStore.Audio.Artists.ARTIST,
MediaStore.Audio.Albums.ALBUM,
MediaStore.Audio.Media.TITLE
};
Cursor cursor = this.managedQuery(
uri,
projection,
selection,
keywords,
MediaStore.Audio.Media.TITLE);
</code></pre>
<p>If I search for "Laredo", I expect it to come back with just "The Streets of Laredo" by Johnny Cash. It's included in the results, but there's a couple dozen other songs being returned that don't seem to match my query at all.</p>
<p>The built-in music player seems to be doing the same thing, although it's returning even more unrelated matches. Is this the expected behavior? If it is, I can add some additional code to filter my list down to exact matches. If it's not, what am I doing wrong?</p>
| android | [4] |
5,244,676 | 5,244,677 | Reading lines from a file in PHP | <p>I'm having problems reading lines from a text file in PHP.</p>
<p>I have this code:</p>
<pre><code>$a_path = "./data/answers.txt";
$answers = fopen($a_path);
$line_num = 1;
while ($line = fgets($answers))
{
for ($i = 0; $i < count($common_q_line_nums); $i++)
{
if ($line_num == (int)$common_q_line_nums[$i])
{
echo $line;
}
}
$line_num++;
}
</code></pre>
<p>I am using Macintosh, however I updated the php.ini file with <code>auto_detect_line_endings = On</code></p>
<p>The <code>$common_q_line_nums</code> sorted array contains numbers in the range of the lines in the text file.</p>
<p>Any idea why I'm getting nothing back? The file is opening ok, and the <code>$common_q_line_nums</code> is good.</p>
<p>Appreciated, Alex</p>
| php | [2] |
2,645,223 | 2,645,224 | PHP Associative Array Duplicate Key? | <p>I have an associative array, however when I add values to it using the below function it seems to overwrite the same keys. Is there a way to have multiple of the same keys with different values? Or is there another form of array that has the same format?</p>
<p>I want to have
42=>56
42=>86
42=>97
51=>64
51=>52
etc etc</p>
<pre><code> function array_push_associative(&$arr) {
$args = func_get_args();
foreach ($args as $arg) {
if (is_array($arg)) {
foreach ($arg as $key => $value) {
$arr[$key] = $value;
$ret++;
}
}else{
$arr[$arg] = "";
}
}
return $ret;
}
</code></pre>
| php | [2] |
205,785 | 205,786 | how to pass javascript variables from one javaScript file to another javascript file? | <p>I have two javascript files in one folder.I want to pass a variable one javascript file to another.what procedure should I use?</p>
| javascript | [3] |
4,049,703 | 4,049,704 | php get cookie set by another server | <p>I know I am asking how to get the cross-domain cookies and that is traditionally not possible but we have a situation where we had two servers <code>site1.domain.com</code> and <code>site2.domain.com</code> and we had a cookie based SSO which was working fine until the company decided to move <code>site2.domain.com</code> to a completely different domain. Now the problem is, when someone logs in to <code>site1.domain.com</code>, we set a cookie for the <code>.domain.com.</code></p>
<p>I want to check if there's a cookie from <code>domain2.com</code>, which is the new domain of the second server.</p>
<p>I tried curl to call a page called getCookie.php, which just gets the cookie and sends the response back but curl initiates a completely new session and doesn't pretend to be a user who is browsing the site2.domain2.com</p>
<p>Is there any way, I can read that cookie value from site2? Any help is appreciated.</p>
| php | [2] |
1,844,800 | 1,844,801 | Comment Starting with /*! | <p>My editor (geany) changes the comment colour when the comments starts with <code>/*!</code>
Whats the difference between <code>/* ... */</code> and <code>/*! ... */</code></p>
| javascript | [3] |
2,842,767 | 2,842,768 | EditText: SoftKeyboard in Custom AlertDialog | <p>I've implemented a popup dialog with a EditText element inside. I can't get Softkeyboard shown on the screen and due to it unable to fill the EditText element. The problem is pretty well known, but still I can't get it working. I've tried different options for solving this issue - see onCreate method. Thanks.</p>
<pre><code>public class MyPopup extends AbstractPlainPopup {
protected Context _context;
public CreatePlaylistPopup(Context context) {
super(context);
_context = context;
}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LayoutInflater inflater = getLayoutInflater();
View container = inflater.inflate(R.layout.popup_new_playlist, null);
final EditText titleInput = (EditText) container.findViewById(R.id.my_text_view);
titleInput.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
InputMethodManager mgr = (InputMethodManager) _context.getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.showSoftInput(titleInput, InputMethodManager.SHOW_IMPLICIT);
//getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
//MyPopup.this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
}
}
});
container.findViewById(R.id.cancelButton).setOnClickListener(
new onCancelClick());
container.findViewById(R.id.createButton).setOnClickListener(
new onCreateClick());
setContentView(container);
}
abstract public class AbstractPlainPopup extends AlertDialog implements Observable {
public final static int CANCEL = 0;
public final static int OK = 1;
protected int _state;
protected ArrayList<Observer> observers = new ArrayList<Observer>();
public AbstractPlainPopup(Context context){
super(context);
}
public AbstractPlainPopup(Context context, boolean cancelable, OnCancelListener cancelListener) {
super(context, cancelable, cancelListener);
}
</code></pre>
| android | [4] |
3,764,597 | 3,764,598 | not able to get contentsize.height value in viewwillappear for uitableview | <p>i have created uitable(tblPartySizeSummary) view programmatically.i am calling contentsize.height in viewwillappear.i am getting 0 for content size.height.i am trying to fix scroll if content size is less or equal to table view height
i have called all delegates and datasource method properly.
my code is as below :</p>
<pre><code>tblPartySizeSummary=[[UITableView alloc] initWithFrame:CGRectMake(0,155, 320,212) style:UITableViewStylePlain];
tblPartySizeSummary.tag=2;
tblPartySizeSummary.backgroundColor=[UIColor clearColor];
tblPartySizeSummary.rowHeight=40;
CGFloat f;
f=[self tableViewHeight];
//tblPartySizeSummary.scrollEnabled=YES;
tblPartySizeSummary.delegate=self;
tblPartySizeSummary.dataSource=self;
tblPartySizeSummary.separatorColor=[UIColor lightGrayColor];
[self.view addSubview:tblPartySizeSummary];
NSLog(@"Content size height is %@",[tblPartySizeSummary contentSize].height);
if(tblPartySizeSummary.contentSize.height < tblPartySizeSummary.frame.size.height)
{
tblPartySizeSummary.scrollEnabled=NO;
}
else
{
tblPartySizeSummary.scrollEnabled=YES;
}
</code></pre>
<p>where should i call tblPartySizeSummary.contentSize.height?
any suggestion ?
thanks?</p>
| iphone | [8] |
384,292 | 384,293 | how to implement selective property-visibility in c#? | <p>Can we make a property of a class visible to public , but can only be modified by some specific classes?</p>
<p>for example, </p>
<pre><code>// this is the property holder
public class Child
{
public bool IsBeaten { get; set;}
}
// this is the modifier which can set the property of Child instance
public class Father
{
public void BeatChild(Child c)
{
c.IsBeaten = true; // should be no exception
}
}
// this is the observer which can get the property but cannot set.
public class Cat
{
// I want this method always return false.
public bool TryBeatChild(Child c)
{
try
{
c.IsBeaten = true;
return true;
}
catch (Exception)
{
return false;
}
}
// shoud be ok
public void WatchChild(Child c)
{
if( c.IsBeaten )
{
this.Laugh();
}
}
private void Laugh(){}
}
</code></pre>
<p><strong>Child</strong> is a data class,<br>
<strong>Parent</strong> is a class that can modify data,<br>
<strong>Cat</strong> is a class that can only read data.</p>
<p>Is there any way to implement such access control using Property in C#?</p>
| c# | [0] |
395,713 | 395,714 | android exit application completely and go to main applications screen | <p>i know that this question is asked many times, but really i can't understand the answer, i want to set button, when user click it i want to exit the application (also the carbage collector should remove the objects), and after exiting i want to go to the screen where the user found the application icon on mobile.</p>
<p>for exit i don't know what to do </p>
<p>for going to the screen where to find the application icon i tried like this</p>
<pre><code>Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
</code></pre>
<p>but doesn't work</p>
| android | [4] |
532,609 | 532,610 | javascript source path problem | <p>i have a problem to access some file from different source.
for example i have html folder and xml folder in same directory.
then from html file i wanna access xml file in xml folder.
in html i have script to call file
xmlDoc=loadXMLDoc("../xml/note.xml");</p>
<p>why this path doesnt work as well?</p>
<p>this is my code of loadXmlDoc()</p>
<pre><code>function loadXMLDoc(dname)
{
var xmlDoc;
if (window.XMLHttpRequest)
{
xmlDoc=new window.XMLHttpRequest();
xmlDoc.open("GET",dname,false);
xmlDoc.send("");
return xmlDoc.responseXML;
} // IE 5 and IE 6
else if (ActiveXObject("Microsoft.XMLDOM"))
{
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async=false;
xmlDoc.load(dname);
return xmlDoc;
}
alert("Error loading document");
return null;
}
</code></pre>
| javascript | [3] |
5,727,443 | 5,727,444 | How does a C++ object access its member functions? | <p>How does a C++ object know where it's member function definitions are present? I am quite confused as the Object itself does not contain the function pointers.
<code>sizeof</code> on the Object proves this.
So how is the object to function mapping done by the Runtime environment? where is a class's member function-pointer table maintained? </p>
| c++ | [6] |
2,399,629 | 2,399,630 | Why does it cause a run-time error, character to int without initializing? | <p>First of all, I apologize about poor english.</p>
<p>At next simple program,</p>
<pre><code>void fx(int *a){
for(int i=*a; i<='Z'; i++)
printf("%c", i);
}
int main(){
int a;
scanf("%c", &a);
fx(&a);
return 0;
}
</code></pre>
<p>I entered a capital letter at run-time, it caused FATAL error and was solved by killing proccess.</p>
<p>It does not cause any problem at next codes.</p>
<pre><code>//except fx()
int main(){
int a;
scanf("%c", &a);
return 0;
}
</code></pre>
<p>or</p>
<pre><code>//initialize int a
void fx(int *a){
for(int i=*a; i<='Z'; i++)
printf("%c", i);
}
int main(){
**int a = 0;**
scanf("%c", &a);
fx(&a);
return 0;
}
</code></pre>
<p>I know it should be 'char' to input character. but I cannot understand about above situation.</p>
<p>What happened?</p>
<p>PS. I worked with VS2010, c++</p>
| c++ | [6] |
556,716 | 556,717 | In a loop, should I reuse a single class instance, or create new ones? | <p>for example</p>
<pre><code> Aclass myAclass = new Aclass();
for(int i=0;i<n;i++)
{
myAclass.load(i);
myAclass.do();
myAclass.clear() // clear the state of myAclass, rdy for next iteration.
}
</code></pre>
<p>or what if I embed the `myAclass.load() into the class constructor, and do sth like:</p>
<pre><code> for(int i=0;i<n;i++)
{
Aclass myAclass = new Aclass(i);
myAclass.do();
}
</code></pre>
<p>So which way is better practice?
btw, the title seems not fitting the content, help me with a more appropriate title.</p>
<p>Note: Constructor of Aclass is trivial, Load() is not, Clear() is trivial
(of course the constructor in the 2nd example is not trivial as it triggers Load().)</p>
| c# | [0] |
508,559 | 508,560 | how to get the result from a sub activity | <p>When user presses a button from a webview, I open a scrollview activity with some buttons and edittext fields.</p>
<p>Once the user enters the fields and presses the 'create' button, from scrollview activity, I want the results from the called activity to be accessible.</p>
<p>How can I do thi?</p>
| android | [4] |
1,787,308 | 1,787,309 | Scenario - How to improve user experience using preload of pages and delayed save of web pages in ASP.NET | <p>I have a ASP.NET website and say it has 2 pages. I am displaying these 2 pages as 2 tabs. Both pages have some input fields like check boxes, radio buttons, dropdowns.</p>
<p>When I move from tab-1 to tab-2, I have to perform the following operations.</p>
<ol>
<li><p>I need to save the data entered on tab-1. This is currently handled in tab-1's PageLoad when user clicks tab-2 on the screen. I have made a DataSave() method, which is called in the PageLoad for IsPagePostBack equals true.</p></li>
<li><p>Once the DataSave is completed, I exit from tab-1 page and call the PageLoad of tab-2.</p></li>
<li><p>In tab-2, I created a DataLoad() method, which brings all the data for controls on tab-2.</p></li>
<li><p>Now when I enter all the data on tab-2 and click tab-1, the same steps 1 to step 3 are completed for tab-2 and tab-1.</p></li>
</ol>
<p>This process takes a lot of time. The user is shown saving of first tab and then loading of second tab everytime.</p>
<p>Is there a way, that I can load the controls of second tab (or as many secondary tabs I have) in the background when the user is working on tab-1. And when the user clicks the second tab, he is displayed the second tab instantly while the tab-1 data is saved in the background.</p>
<p>I hope I was able to explain my problem.</p>
| asp.net | [9] |
4,517,392 | 4,517,393 | How to refer to the application context from a broadcast receiver | <p>I'm using the usual technique of extending Application in order to store global constants. </p>
<p>So within my activities, I can simply do (in oncreate()):</p>
<pre><code>W = (WcmApplication) getApplicationContext();
</code></pre>
<p>However, this doesn't work for broadcast receivers:</p>
<pre><code>The method getApplicationContext() is undefined for the type MyReceiver
</code></pre>
<p>So, thinking I was being clever, I tried to do:</p>
<pre><code> W = (WcmApplication) context;
</code></pre>
<p>... but that throws an error at runtime saying my broadcast receiver is not allowed to access that context</p>
<p>Not giving up, I try this:</p>
<pre><code>W = (WcmApplication) Context.getApplicationContext();
</code></pre>
<p>... no dice</p>
<p>So I ended up having to do:</p>
<pre><code>W = (WcmApplication)context.getApplicationContext() ;
</code></pre>
<p>... and that works nicely, however I have no idea why. </p>
<p>Can someone explain why one works and not the others?</p>
<p>Thank you!</p>
| android | [4] |
5,603,633 | 5,603,634 | have a variable in the value of a class property? | <p>in my class i have some properties. i want some values of these to have another property. but i noticed it wasnt possible.</p>
<p>code:</p>
<pre><code>$property = "my name is: $this->name";
</code></pre>
<p>generated an error.</p>
<p>i set the $this->name with the constructor.</p>
<p>could you somehow accomplish this? i would like the "my name is: " to be defined in the property and not in the constructor if its possible.</p>
<p>thanks.</p>
| php | [2] |
2,995,970 | 2,995,971 | Make a general input screen | <p>I have a large table with all kinds of strings and numbers, and a number of them have to be editable. The table is loaded from an object with getters and setters of course. </p>
<p>I want to create a general input screen with an edit text and an ok button; and use that to edit the fields. However, i can't get this to work, this is a snippet of my code:</p>
<pre><code>public class InputViewController extends Activity {
private String inputType;
EditText mEdit;
private String inputString;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.inputscreen);
Bundle extras=getIntent().getExtras();
{
//get the type of input from the screen that sent us here, contained in a putextra
inputType = extras.getString("inputType");
TextView textViewInput = (TextView) findViewById(R.id.textViewInput);
textViewInput.setText(inputType);
mEdit = (EditText)findViewById(R.id.editText1);
}
//save input and return to previous screen
final Button button = (Button) findViewById(R.id.button3);
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//save input based on inputType
if(inputType.equals("Oplossing")){
inputString = mEdit.getText().toString();
ActivityViewController.activityObject.setSolution(inputString);
System.out.println(ActivityViewController.activityObject.getSolution());
}
//return to previous screen
finish();
}
});
</code></pre>
| android | [4] |
4,053,549 | 4,053,550 | File type is returning null in chrome browser | <p>I have used file uploader(used PHP) in my application.</p>
<p>In FireFox, and Internet Explorer8 working when I try below statement.</p>
<pre><code>print $_FILES['upladed']['type'];
</code></pre>
<p>But in chrome I am getting null value(not printing anything).</p>
<p>If I use <code>var_dump($_FILES['upladed']['type']);</code> then I am getting result as</p>
<pre><code>string '' (length=0)
</code></pre>
<p>Please suggest some pointers.</p>
<p>Thanks</p>
<p>-Pravin</p>
| php | [2] |
1,302,172 | 1,302,173 | Problem accessing childNodes[] | <p>Javascript/HTML noob here...please be gentle.</p>
<p>I'm learning my way around the DOM and Javascript and am using the following page to explore accessing nodes via Javascript:</p>
<p><a href="http://franklyanything.com/test2.html" rel="nofollow">http://franklyanything.com/test2.html</a></p>
<p>As you can see in the snippet of Javascript I put in the Head, I'm trying to access the 2nd child of the <code><html></code> element, which should be the Body element. </p>
<p>However each time I run the page nothing happens and Firebug reports the variable as <code>undefined</code>. I have no problems if I change the index from [1] to [0]. This correctly identifies the <code><html></code> tag.</p>
<p>I'm stumped. Ideas?</p>
<p>Thanks in advance!</p>
| javascript | [3] |
1,678,846 | 1,678,847 | Filtering a line out of a string c# | <p>I want to read a .txt file in c# and filter a line out of the string and only show that line. If the match is on the first line, i get a good output using streamreader.ReadLine. But if it's on the second line, i need to get it filtered. (i tought by creating a ReadLine loop?)
Thanks in advance</p>
<pre><code> private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
{
StreamReader sr = new StreamReader(textBox1.Text);
string BoxLM1 = sr.ReadLine();
if (comboBox3.Text == "Anderlecht")
{
if (BoxLM1.Contains("Anderlecht"))
{
label5.Text = BoxLM1;
}
else
{
string BoxLM2 = sr.ReadToEnd();
MessageBox.Show(BoxLM2);
}
</code></pre>
| c# | [0] |
3,671,762 | 3,671,763 | Replace "while" with "for" in given python script | <p>I have written following script in python which works fine:</p>
<pre><code>from sys import argv
script, filename = argv
def brokerage(cost):
vol = 100
tamt = cost*vol
br = (((cost*0.1)/100)*vol)*2
rc = (0.0074*tamt)/100
stt = (0.025*tamt)/100
std = (0.004*tamt)/100
stb = (11*br)/100
tbr = br+rc+stt+std+stb
return(tbr)
cost1 = 10
cost2 = 510
while cost1 < 501 and cost2 < 1001:
value1 = brokerage(cost1)
value2 = brokerage(cost2)
# Can't write 'float' to file so, changed it into string. Don't know why.
x1 = str(value1)
x2 = str(value2)
line = " |%d\t\t%s\t|\t|%d\t\t%s\t|" % (cost1, x1, cost2, x2)
# use 'a' in 'open' function to append it, will not overwrite existing value
# as with 'w'.
save = open(filename, 'a')
save.write(line)
save.write("\n |---------------------|\t|-----------------------|\n")
save.close
cost1+=10
cost2+=10
</code></pre>
<p>Now instead of "while" I want to use "for" with minimal code structure change.</p>
| python | [7] |
4,572,119 | 4,572,120 | PHP: print success or error message on submit? | <p>hey guys,
i wonder how i can solve that:
i have a lot of forms on my website. whenever i submit a button i would like to print a message on the following page. when a form is submitted the page simply refreshes. what's the easiest way to do that or how is it normally done?</p>
<p>thanks for the help</p>
| php | [2] |
603,569 | 603,570 | Whats the point of having a conversion constructor | <p>After reading about the conversion constructor I came up with the conclusion that it is simply a class constructor that has one parameter. This <a href="https://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=/com.ibm.xlcpp8l.doc/language/ref/cplr384.htm" rel="nofollow">page</a> explains it a lot however I am still confused with it use. Why is it used ?. So far all I understand is that instead of declaring an instance as such</p>
<pre><code>someclass a(12);
</code></pre>
<p>we could do it like</p>
<pre><code>someclass a = 12;
</code></pre>
| c++ | [6] |
5,727,684 | 5,727,685 | How to play a wmv file in my asp.net webpage? | <p>Is there a way to play a wmv file in my asp.net webpage? Thanks!
Will an end use need install some control when he access the webpage?</p>
| asp.net | [9] |
3,418,418 | 3,418,419 | How to find out that Facebook App is selected when using Intent to share in Android | <p>How to find out that Facebook App is selected when using Intent to share text message in Android? Is there any way to do that? Thanks.</p>
| android | [4] |
5,087,243 | 5,087,244 | How do i persist this change of layout in database using JQuery Portlet? | <p>I just saw this cool feature of JQuery which is JQuery Portlet</p>
<p><a href="http://jqueryui.com/demos/sortable/portlets.html" rel="nofollow">http://jqueryui.com/demos/sortable/portlets.html</a></p>
<p>I was just wondering how do i persist this to my database? so that it's available even for future sessions to all users of my website?</p>
| jquery | [5] |
4,628,267 | 4,628,268 | Learning Java, how to type text on canvas? | <p>I'm reading a book by Eric Roberts - Art and science of java and it got an excersise that I can't figure out - </p>
<p>You have to make calendar, with GRect's, 7 by 6, that goes ok, the code part is easy, but also you have to type the numbers of the date on those rectangles, and it's kinda hard for me, there is nothing about it in the book.</p>
<p>I tried using GLabel thing, but here arises the problem that I need to work on those numbers, and it says "can't convert from int to string and vice versa".
GLabel (string, posX, posY) - it is not accepting int as a parameter, only string, I even tried typecasting, still not working.</p>
<p>For example I want to make a loop</p>
<p>int currentDate = 1;</p>
<p>while (currentDate < 31) {</p>
<p>add(new Glabel(currentDate, 100, 100);</p>
<p>currentDate++;</p>
<p>This code is saying that no man, can't convert int to string.
If i try changing currentDate to string, it works, but I got a problem with calculation, as I can't manipulate with number in string, it doesn't even allow to typecast it into int.</p>
<p>How can I fix it? Maybe there is another class or method to type the text over those rectangles?</p>
<p>I know about println but it doen't have any x or y coordinates, so I can't work with it. And I think it's only for console programs.</p>
| java | [1] |
5,812,001 | 5,812,002 | import class defined in same module file? | <p>I have a module file called <code>mymodule.py</code>, which contains the following code:</p>
<pre><code>class foo:
def __init__(self):
self.foo = 1
class bar:
import foo
def __init__(self):
self.bar = foo().foo
</code></pre>
<p>The <code>__init__.py</code> file in the same directory has </p>
<pre><code>from mymodule import foo
</code></pre>
<p>From a script in the same directory, I have the following code:</p>
<pre><code>from mymodule import bar
</code></pre>
<p>When I try to run <code>bar()</code>, I get the error that <code>No module named foo</code>. How can I create an instance of <code>foo</code> in <code>bar</code> when they are defined within the same module file?</p>
| python | [7] |
3,285,515 | 3,285,516 | C++: sorting struct based on one of each property | <p>I am a Java and C# programmer. Recently, I am working on C++ project. I am having a problem of how to write the sample code following in C++. The sample code following is to sort a property of a struct:</p>
<pre><code>public struct Person
{
public string name;
public int age;
}
</code></pre>
<p>Add some Persons to a list and sort by the age:</p>
<pre><code>static void main()
{
List<Person> persons = new List<Person>();
Person person = new Person();
person.age = 10;
person.name = "Jane";
persons.Add(person);
person = new Person();
person.age = 13;
person.name = "Jack";
persons.Add(person);
person = new Person();
person.age = 12;
person.name = "Anna";
persons.Add(person);
// sort age
persons.Sort(delegate(Person p1, Person p2)
{ return p1.age.CompareTo(p2.age); });
persons.ForEach(delegate(Person p)
{ Console.WriteLine(String.Format("{0} {1}", p.age, p.name)); });
</code></pre>
<p>}</p>
<p>Thanks in advance and I am very appreciated for your help to learn more about C++.</p>
<p>Could you please help me to write an equivalent sample code in C++?</p>
<p>Thanks in advance</p>
| c++ | [6] |
3,561,192 | 3,561,193 | Does this snippet cause an infinite loop? | <p>I'm not sure. I created this code that crashes only on device < 2.3.x. Is this code causes a loop? </p>
<pre><code>SharedPreferences prefs3 = PreferenceManager.getDefaultSharedPreferences(this);
listener = new SharedPreferences.OnSharedPreferenceChangeListener() {
public void onSharedPreferenceChanged(SharedPreferences prefs, String listpref) {
preferenze();
} };
private void preferenze() {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getBaseContext());
CheckboxPreference = prefs.getBoolean("checkboxPref", true);
ListPreference = prefs.getString("listpref", "");
numeronotifiche = prefs.getString("notify", "");
Sound = prefs.getString("sound", "");
barranotifiche = prefs.getBoolean("keep", false);
</code></pre>
| android | [4] |
695,004 | 695,005 | CallBack won't work, please help | <p>Somehow my callback doesn't work...</p>
<p>from a sending activity:</p>
<pre><code>Intent intent=new Intent();
intent.setAction("Constructor.rob.call");
sendBroadcast(intent);
</code></pre>
<p>receiving activity:</p>
<pre><code>public class popup extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.popupcanvas);
IntentFilter filter = new IntentFilter("Constructor.rob.com.call");
this.registerReceiver(new Receiver(), filter);
}
private class Receiver extends BroadcastReceiver {
@Override
public void onReceive(Context arg0, Intent arg1) {
finish();
}
}
}
</code></pre>
<p>and from the manifest:</p>
<pre><code>...
<intent-filter>
<action android:name="Constructor.rob.com.call" />
</intent-filter>
</application>
</manifest>
</code></pre>
<p>Any ideas what might be wrong? Thanks!</p>
| android | [4] |
5,711,988 | 5,711,989 | fancybox slider script not working in i7 and i8 | <p><a href="http://174.120.232.253/~priya/Parthvi/wordpress/NobelConcert/" rel="nofollow">http://174.120.232.253/~priya/Parthvi/wordpress/NobelConcert/</a></p>
<p>in this link we use Fancybox slider and it is not working in i7 and i8 and refrence link for this slider.
<a href="http://webdesignandsuch.com/fancymoves-jquery-product-slider-2/" rel="nofollow">http://webdesignandsuch.com/fancymoves-jquery-product-slider-2/</a></p>
| jquery | [5] |
5,654,001 | 5,654,002 | Header response "403 Forbidden" with cURL, file_get_contents() and fopen() | <p>I'm hoping you'll be able to help me.
The site is currently online and I can access it fine, I can't seem to understand why this isn't working.</p>
<p><code>file_get_contents()</code> and <code>fopen()</code> return an error saying the following:</p>
<pre class="lang-none prettyprint-override"><code>PHP Warning: file_get_contents(http://www.hackforums.net): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in /host/Users/Phizo/Desktop/stalker.php on line 29
</code></pre>
<p>Now I just started taking up cURL since I wanted to try get around this 403, also no luck.</p>
<pre class="lang-php prettyprint-override"><code>$handle = curl_init();
$file = fopen('source.txt', 'w');
curl_setopt($handle, CURLOPT_URL, 'http://www.hackforums.net/');
curl_setopt($handle, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($handle, CURLOPT_HEADER, true);
curl_setopt($handle, CURLOPT_AUTOREFERER, true);
curl_setopt($handle, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:13.0) Gecko/20100101 Firefox/13.0.1');
curl_setopt($handle, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($handle, CURLOPT_FILE, $file);
curl_exec($handle);
print_r(curl_getinfo($handle));
curl_close($handle);
fclose($file);
</code></pre>
<p>Outputs the following error:</p>
<pre class="lang-none prettyprint-override"><code>Fatal error: Maximum execution time of 30 seconds exceeded in D:\Hosting\6514439\html\zeonsglobal\admin\press_uploads\stalker.php on line 29
</code></pre>
| php | [2] |
5,851,761 | 5,851,762 | Append HTML and Text into a LI | <p>How can I append a blurb of text into my first <code>LI</code>s'</p>
<pre><code> <ul id="topnav">
<li class="mainNavFirst"><a href="/solutions">Solution</a>
<li class="mainNavLast"><a href="/contact">Contact Us</a></li>
</ul>
</code></pre>
<p>I want to append text inside </p>
<pre><code><li class="mainNavFirst"><a href="/solutions">Solution <span>Blurb Goes Here</span></a>
</code></pre>
| jquery | [5] |
2,204,047 | 2,204,048 | Trigger event on return in C++ | <p>I want to execute some function right before the return of another function. The issue is that there are multiple returns and I don't want to copy-paste my call before each of them. Is there a more elegant way of doing this? </p>
<pre><code>void f()
{
//do something
if ( blabla )
return;
//do something else
return;
//bla bla
}
</code></pre>
<p>I want to call g() before the function returns.</p>
| c++ | [6] |
693,348 | 693,349 | Can I run Wine on an Android slate? | <p>I would like to run a small Windows program on an Android slate. It runs just fine under Wine in Ubuntu, but I am unsure how to install & run Wine on the Android slate. </p>
<p>Sorry if it's not strictly a programming question. If you want it to be so, I could rephrase it as "will I have to write my Delphi code again Java in order to run it on an Android slate?" </p>
| android | [4] |
2,910,292 | 2,910,293 | Grab the content of a div,which is inside another div | <p>I am doing an application where I want to grab the content of div,which is inside a div.In my application I want to grab the content of <code><li></li>,</code>which is inside <code><ul class="snippet-list"></ul></code>.The ul class is inside <code><div data-analyticsid="related"></div></code>.Is there any regular expression like preg_match to grab the data.</p>
<p>Thanks in advance...</p>
| php | [2] |
4,791,930 | 4,791,931 | How can i Access a control into a class? | <p>I Have a Gridview in page.aspx. this gridview i want to pass as a parameter to the constructor of a class1.cs.Can anybody tel me, How can this be done? </p>
| asp.net | [9] |
3,567,307 | 3,567,308 | exception in thread 'main' java.lang.NoClassDefFoundError: | <p>The following program is throwing error:</p>
<pre><code>public class HelloWorld {
public static void main(String args[]) {
System.out.println("Hello World!");
}
}
CLASSPATH C:\Program Files\Java\jdk1.6.0_18\bin\
Path C:\Program Files\Java\jdk1.6.0_18\bin\
JAVAHOME C:\Program Files\Java\jdk1.6.0_18\bin
</code></pre>
<p>Can you please tell me the root cause?</p>
| java | [1] |
2,970,269 | 2,970,270 | Android: where to find xhdpi menu icons? | <p>I use menu icons provided in the android sdk, like the the info icon below. All the platforms prior to version 14 provided these in ldpi, mdpi, and hdpi. Platforms 14 and 15 provide xhdpi icons, but they no longer include the menu icons (because they have been replaced with actionbar friendly icons). </p>
<p>So, is there somewhere that the old menu icons are published in xhdpi sizes?</p>
<p><img src="http://i.stack.imgur.com/xWMGu.png" alt="enter image description here"></p>
<p>Edit: </p>
<p>The below link is helpful. The provided clipart includes some of the icons I need, which can then be exported to xhdpi. But I still am missing a couple the "ic_menu_compose.png" icon.</p>
<p><a href="http://android-ui-utils.googlecode.com/hg/asset-studio/dist/icons-menu.html#source.space.trim=1&source.space.pad=0&name=example" rel="nofollow">http://android-ui-utils.googlecode.com/hg/asset-studio/dist/icons-menu.html#source.space.trim=1&source.space.pad=0&name=example</a></p>
| android | [4] |
480,938 | 480,939 | c++ programming with linux | <p>i am receiving a buffer with float values like -157.571 91.223 -165.118 -59.975 0.953 0 0.474 0 0 0.953 0 0.474 0.474 0 5.361 0 0 0.474 0 5.361...but they are in characters...now i want to retrieve one by one value and put it in a variable...can any one help me please...i have used memcpy but no use..if i am copying 8 bytes its taking as -157.571 with 8 values including '-' and '.' .... is there any solution for this ..</p>
| c++ | [6] |
3,781,025 | 3,781,026 | Ignoring first item of string Array | <p>How to ignore the first <code>item</code> of <code>string[]</code> in case of <code>if (item=="")</code> my code like</p>
<pre><code>string[] temp3 = clearstring.Split(new string[]{@",","\r\n","\n","]", "\"", "}"}, StringSplitOptions.None);
temp.Close();
StreamWriter sW = new StreamWriter(Npath);
foreach (string item in temp3)
{
if (item == "")
{
}
</code></pre>
| c# | [0] |
1,111,640 | 1,111,641 | Removing default menu in Video Player | <p>I am using a video player in my app in which i dont want the default options like play, stop and progress seek bar when i click the video since i am going to stream a live video on that.Can anyone help me how to remove that.Thanks</p>
| android | [4] |
93,666 | 93,667 | Change in behaviour & generation of nullreference exception | <p>I made this program 2hr ago and it ran quit well when i confronted this to presaved .xls file. But when i closed that and started new instance,it started generating null refrence exception why??plz explain.</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading;
using Microsoft.Office.Interop;
using Excel = Microsoft.Office.Interop.Excel;
namespace svchost
{
class MainClass
{
Excel.Application oExcelApp;
static void Main(string[] args)
{
MainClass mc = new MainClass();
while (true)
{
if (mc.chec())
{
Console.WriteLine("RUNNING");
Thread.Sleep(4000);
}
else
{
Console.WriteLine("NOT RUNNING");
Thread.Sleep(8000);
}
}
}
public bool chec()
{
try
{
oExcelApp = (Excel.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Excel.Application");
Excel.Workbook xlwkbook = (Excel.Workbook)oExcelApp.ActiveWorkbook;
//****PROBLEM FROM HERE*********
Console.WriteLine(xlwkbook.Name + "\n");
ke kw = new ke(ref oExcelApp,ref xlwkbook);
Console.WriteLine(xlwkbook.Author);
xlwkbook = null;
}
catch (Exception ec)
{
oExcelApp = null;
System.GC.Collect();
Console.WriteLine(ec);
return false;
}
oExcelApp = null;
System.GC.Collect();
return true;
}
}
class ke
{
public ke(ref Excel.Application a1, ref Excel.Workbook b1)
{
Excel.Worksheet ws = (Excel.Worksheet)a1.ActiveSheet;
Console.WriteLine(a1.ActiveWorkbook.Name + "\n" + ws.Name);
Excel.Range rn;
rn = ws.Cells.Find("657/07", Type.Missing, Excel.XlFindLookIn.xlValues, Excel.XlLookAt.xlPart,
Excel.XlSearchOrder.xlByRows, Excel.XlSearchDirection.xlNext, false, Type.Missing, Type.Missing);
Console.WriteLine(rn.Text);
}
}
}
</code></pre>
| c# | [0] |
2,720,723 | 2,720,724 | Def doesn't work | <p>Not sure why this code doesn't work.</p>
<pre><code>class convert_html(sublime_plugin.TextCommand):
def convert_syntax(self, html, preprocessor)
return "this is just a " + preprocessor + " test"
def convert_to_jade(self, html):
return self.convert_syntax(html, "jade")
def run(self, edit):
with open(self.view.file_name(), "r") as f:
html = f.read()
html = html.convert_to_jade(html)
print(html)
</code></pre>
<p>It says <code>AttributeError: 'str' object has no attribute 'convert_html'</code></p>
<p>How do I make it work?</p>
| python | [7] |
3,365,311 | 3,365,312 | use php dom parser inside another class - ERROR: Call to a member function on a non-object | <p>I'm using PHP simple dom parser <a href="http://simplehtmldom.sourceforge.net/manual.htm" rel="nofollow">http://simplehtmldom.sourceforge.net/manual.htm</a>.
I'm able to successfully use it and remove an html tag with specific id by doing </p>
<pre><code>$html = str_get_html('<div><div class="two">two</div></div>');
function test($str, $class){
$e = $str->find($class,0);
$e->outertext = '';
echo $str->outertext;
}
test($html, '#two');
</code></pre>
<p>My problem is when i try to use the function inside another php class. It doesn't work. Here's what i did</p>
<pre><code>$html = new simple_html_dom(); //initialized the object
class Someclass {
public function test($wrap, $class){
global $html;
$html->load($wrap);
$e = $html->find($class,0);
$e->outertext = '';
echo $html->outertext;
}
}
</code></pre>
<p>I'm getting an error <strong>Fatal error: Call to a member function load() on a non-object</strong>
What am i doing wrong. I'm i calling this correctly.</p>
| php | [2] |
1,141,673 | 1,141,674 | How to go to the "root" directory of a website? | <p>There is a PHP website into a Linux computer webserver. In a particular PHP file , which is located in a deep subdirectory of this site , I want to go to the first directory of the site. How to write the PHP code to achieve that ?</p>
| php | [2] |
4,494,979 | 4,494,980 | Android Animate an Image View vertically | <p>Hi i have an image view position and the bottom of the page i'm wanting to animate so it moves down does anyone know how to do this? currently when i run it nothing happens</p>
<p>here is what i have tried so far</p>
<p>heres my animation</p>
<pre><code><set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator">
<translate android:fromYDelta="0" android:toXDelta="30" android:duration="1000"
android:fillAfter="true"/>
</set>
</code></pre>
<p>heres my java</p>
<pre><code>public class IntialSetup extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_initialsetup);
animations();
}
public void animations(){
final ImageView image = (ImageView)findViewById(R.id.su_shirts);
Animation AnimationMovepos = AnimationUtils.loadAnimation(this, R.anim.shirt_anim);
image.startAnimation(AnimationMovepos);
}
}
</code></pre>
| android | [4] |
1,455,779 | 1,455,780 | scope issue inside jquery plugin | <p>How would I get to call the method showAlert() I have tried storing a reference to the plugin with this and $(this) inside the self variable but none seem to work. I'm calling the showAlert from inside the button click event.</p>
<pre><code> (function($){
//Add your default settings values here
var settings = {
//Replace with your own settings
testValue:"FOO"
}
var selectedArr=[];
var self=this;
var methods = {
init : function(options){
return this.each(function(){
//if options exists, let's merge them with our default settings
if(options){
$.extend(settings,options);
}
var $this=$(this);
var button = $this.find('.schedule .time a');
button.click(function(evt){
evt.preventDefault();
selectedArr.push( $(this).addClass('selected') );
$(this).parent().find('input').attr('checked','checked');
self.showAlert();
})
});
}
}
showAlert: function(){
alert("Please select an alternitive");
}
//Setting namespace. Under no circumstance should a single plugin ever claim more than one namespace in the jQuery.fn object.
//See http://docs.jquery.com/Plugins/Authoring for an explaination of the method used here
$.fn.chooseAppointment = function(method){
if(methods[method]){
return methods[method].apply(this,Array.prototype.slice.call(arguments,1));
}else if(typeof method === 'object' || !method){
return methods.init.apply(this,arguments);
}else{
$.error('Method ' + method + ' does not exist on jQuery.chooseAppointment');
}
};
})(jQuery);
</code></pre>
| jquery | [5] |
864,022 | 864,023 | invert filename order script | <p>I have a set of files which the names follow this pattern: xxx - 001, xxx - 002 ..... xxx - 700</p>
<p>What I would like to do it`s a python script which I can invert the order of the name of the files, doing the xxx - 700 to be the xxx - 0001!</p>
| python | [7] |
2,309,938 | 2,309,939 | How does Android application framework communicate with Libraries? | <p>From Android architecture, application framework (Content Providers,Resource manager. etc) are written in Java. But the libraries(Surface Manager, 3D libraries etc) are in C.</p>
<p>How do these layers communicate between to give the final output? </p>
| android | [4] |
4,055,953 | 4,055,954 | Android Save Canvas into Bitmap | <p>I have been struggling on converting a Canvas to a Bitmap. <br />
Here is my code on the onDraw function. I have tried many variations and I still didn't get an answer. <br /></p>
<pre><code> @Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
Bitmap bitmap = Bitmap.createBitmap(canvas.getWidth(),canvas.getHeight(),Bitmap.Config.ARGB_8888);
canvas.setBitmap(bitmap);
for(List<Point> pointA : pointWhole)
{
Point prev = null;
for (Point point : pointA) {
if(prev != null)
{
canvas.drawLine(prev.x, prev.y, point.x, point.y, paint);
}
prev = point;
}
}
}
</code></pre>
<p>It doesn't seem to save the whole bitmap.</p>
| android | [4] |
2,493,195 | 2,493,196 | Splitting an string into a string array.? | <p>I am facing a problem while executing a sql query in C#.The sql query throws an error when the string contains more than 1000 enteries in the IN CLAUSE .The string has more than 1000 substrings each seperated by ','.</p>
<p>I want to split the string into string array each containing 999 strings seperated by ','.</p>
<p>or</p>
<p>How can i find the nth occurence of ',' in a string.</p>
| c# | [0] |
2,216,127 | 2,216,128 | Best method views by date | <p>I got a little confused about this problem. I am trying to make a views system for my website.</p>
<p>I got a 770 rows of articles in my mySQL database and I'm trying to do a views system to know which article got the most views and when. (Today, 3 Days Ago, This week, This month)</p>
<p>I tried to do something like this in mySQL database:</p>
<p>Table: views</p>
<pre><code>ID articleID date
</code></pre>
<p>But then I don't know how to sum it up? and If I will add column 'views' it wont help me because I have to change the dates all time.</p>
<p>amm can someone advice me please?</p>
<p>thanks alot!</p>
| php | [2] |
3,192,838 | 3,192,839 | jQuery Code working in FF, doesnt in Chrome | <p>I have the following jQuery Code that works fine in FF and IE. It doesnt work in Chrome and I cant figure out why. :(</p>
<p>Im trying to change the background-image of an element with this.</p>
<p>Any help is appreciated!</p>
<pre><code> $(".category-nav").find("a").each(function(index){
if($(this).css("background-color") === "transparent" && !$(this).parent().hasClass("level1"))
{
$(this).css("background-image", "url(/images/gallery/images/arrow-cat-list-grey.png)");
}
});
</code></pre>
| jquery | [5] |
2,898,845 | 2,898,846 | How to create marquee in Android using only java code without xml | <p>I need to create Marquee in Android using only java code without using xml? Please provide me with resources to program in Android using only Java code without using xml.</p>
| android | [4] |
4,399,313 | 4,399,314 | jQuery select the same OPTION on three SELECT drop downs with one action | <p>I have 3 SELECT drop down</p>
<p>SELECT 1</p>
<pre><code><select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
</code></pre>
<p>SELECT 2</p>
<pre><code><select type="hidden">
<option value="Sadan">Volvo</option>
<option value="Sadan">Saab</option>
<option value="Sport">Mercedes</option>
<option value="Sport">Audi</option>
</select>
</code></pre>
<p>SELECT 3</p>
<pre><code><select>
<option value="1000">Sport</option>
<option value="2000">Sadan</option>
</select>
</code></pre>
<p>SELECT 2 is hidden in the background (This is due to the JSP/Struts limitation).</p>
<p>What I need is a way if the user selects SELECT 1 option that SELECT 2 corresponding option would be selected and then SELECT 3 corresponding option would be selected.</p>
<p>EXAMPLE:</p>
<p>User selects SELECT 1 option <strong><code><option value="mercedes">Mercedes</option></code></strong></p>
<p>EXPECTED RESULTS:</p>
<p>SELECT 2 auto selected option <strong><code><option value="Sport">Mercedes</option></code></strong></p>
<p>AND</p>
<p>SELECT 3 auto selected option <strong><code><option value="1000">Sport</option></code></strong></p>
| jquery | [5] |
4,908,654 | 4,908,655 | Is it true that Javascript, before ECMA-262 or ECMA 5.1, doesn't have pseudo-classical inheritance or prototypal inheritance support? | <p>The reason is that, although we can use pseudo classical inheritance in Javascript, we actually have to implement our own <code>extend</code> or <code>inherit</code>.</p>
<p>What about the prototypal inheritance -- I think it does have the feature that if <code>foo.bar</code> is used, if <code>bar</code> is not a property of <code>foo</code>, the interpreter or the compiled code (such as if using Google V8) will go up the prototype chain, but there is no built in method to make object <code>b</code>'s hidden prototype property point to <code>a</code> as a prototypal chain. We have to add it by defining a <code>clone()</code> function or <code>Object.create()</code>. What's more, I think I see in the pure prototypal inheritance code that there is no constructor whatsoever. So it looks like in prototypal code, there is no constructor (constructor functions). But if we use prototypal inheritance, we actually have to implement <code>clone()</code> using a constructor -- which is more like the pseudo classical inheritance side.</p>
<p>So it does seem that the original Javascript is actually neither Pseudo-classical nor Prototypal inheritance? I read that it needed to be out on the market within 10 days, or else something worse would have come out to the market, according to <a href="http://en.wikipedia.org/wiki/Brendan_Eich" rel="nofollow">this Wikipedia article</a>. But I also wonder somewhat, why the 1 year or 2 years after Javascript came out in 1995, at least the Netscape version of Javascript didn't add an <code>extend</code> and <code>Object.create()</code> method already?</p>
<p>This question aims to understand and clarify some concepts in the pseudo-classical and prototypal part of Javascript. And is it true -- the original Javascript does not by itself have pseudo-classical or prototypal inheritance support?</p>
| javascript | [3] |
1,100,371 | 1,100,372 | Is there a list of popular jars to avoid for Android dev? | <p>I'm experimenting with porting an open source tool to Android. I quickly discovered that there are some dependencies that are no-go for Android, particularly xml-apis.jar and xercesImpl.jar. That's OK, because with a modern Java I shouldn't really need those anyway because the built-in XML parser is good enough. But there's surely more. For example, I expect that cglib and aspectj won't work because they deal with bytecode instead of dex.</p>
<p>Is there a curated list of popular open-source jars to avoid when coding for Android?</p>
| android | [4] |
5,408,076 | 5,408,077 | Manually getting the output instead of output redirection in cmd line | <p>I have a C++ program which has the prototype of the main function as follows:</p>
<p><code>int main(int argc, char * argv[])</code></p>
<p>The code hasn't been written by me, but this is a single C file available <a href="http://tartarus.org/~martin/PorterStemmer/c.txt" rel="nofollow">here</a>.
When I compile this code, and through the command line run it as:</p>
<p><code>someexe in.txt > out.txt</code><br/>
This gives me an output out.txt which is generated in the same directory by operating on some input from in.txt.</p>
<p><code>someexe in.txt out.txt</code><br/>
This gives me an output on the command line itself. (without using <code>></code> operator)</p>
<p>However, instead of passing the command line argument and without using the output redirection <code>></code> operator, I have been trying to call the main function from another function and passing the parameters myself. If I pass an array of <code>char*</code> {fileDirName, in.txt}, I am not sure how to go about generating an out.txt (since I think <code>></code> output redirection is an operating system level function available in command line).</p>
<p>Any suggestions would be greatly appreciated</p>
<p>The program in the link is readily available as copy paste and can be tried (main function is written at the last in the above program)</p>
| c++ | [6] |
4,080,014 | 4,080,015 | How to remove %0A from the url | <pre><code><code>
<form action="" method="get">
<table cellspacing="0">
<tbody>
<tr>
<th>Check</th>
<th>Country</th>
<th>Check</th>
</tr>
<?
while($row = mysql_fetch_array($result))
{ ?>
<tr>
<td>
<input type='checkbox' onclick="check()" name='allowed' value='1' <?
$reflex=mysql_query("select distinct * from geocity where isAllowed='1' AND
country='" . $row['Code'] . "'"); $count = mysql_num_rows($reflex); if ($count ==
1{echo 'checked';}else{echo '';} ?>>
</td>
<td><? echo $row['CountryName']; ?></td>
<td>
<input type='checkbox' id="check1" name='countryname' value="<?echo $row['Code'];?>"
<? $reflex = mysql_query("select distinct * from geocity where isAllowed='1' AND
country='" . $row['Code'] . "'"); $count = mysql_num_rows($reflex); if ($count == 1)
{echo 'checked';}else{echo '';} ?>>
</td>
</tr>
<?
};
?>
</tbody>
</table>
<input type="submit" class='button' value="Save">
</form>
</code>
</code></pre>
<p>Here is my code but when i submit the for the problem occurs is that in the url "%0A" this occurs so how can I remove this %0A from the url.
the url looks something like this:
<code>example.com/test.php?allowed=1&countryname=AF%0A</code></p>
| php | [2] |
3,012,246 | 3,012,247 | How do I make a picture seem like a radiobutton? | <p>I am attempting to use my own buttons to make an overlay at the bottom of the screen. When a button is pressed it should light up (kind of how a radio button turns green when selected) and it should take you to a new activity while keeping the overlay intact. </p>
<p>There are five buttons that should be put on a black bar and when selected it should turn blue. </p>
<p>If someone could send me in the right direction I would be very grateful. Thank you</p>
| android | [4] |
1,669,842 | 1,669,843 | Need logic for summing numbers using Checkboxes in Android | <p>can any one suggest me the logic to sum the numbers using the checkboxes in Android. For instance if checkbox1 have number 100 assigned to it, checkbox2 is assigned with number 200, checkbox 3 is assigned with 300 and checkbox4 is assigned with number 400.</p>
<p>If I select checkbox1 and checkbox3 I should get a Toast message showing the sum or if I choose the checkboxes 1,2,3 then I should get the sum of all the checkboxes that were checked. </p>
| android | [4] |
5,147,227 | 5,147,228 | How to remove decimal sign from number but preserve all digits? | <p>How to convert this <code>20,00</code> into <code>2000</code> in javascript ?
Basically how to remove decimal sign but keep all digits?</p>
| javascript | [3] |
5,123,803 | 5,123,804 | how to start voice record for specific period of time | <p>as new to android and had a requirement to start voice recording for specific period of time and the time will get by the button click by the user choice i had design the UI with several button with some second of time.so while clicking the button the time will set and recording will start.Is anything is there in android.Little help will be much appreciate.</p>
| android | [4] |
4,098,547 | 4,098,548 | Android caching method | <p>In my application there is a set amount of images that need cached. It is about 12 - 15 images I will need cached tops. What I have done is store the image in a file in a directory on the device like this.</p>
<pre><code> FileOutputStream o = new FileOutputStream(getFilesDir().getAbsolutePath()
+ "/background.txt");
Bitmap b = getBitmapFromURL("http://10.84.4.2:8083/images/General/background.png");
b.compress(Bitmap.CompressFormat.PNG, 90, o);
</code></pre>
<p>Then just reload the image when I need it like this</p>
<pre><code>BitmapDrawable bg = new BitmapDrawable(BitmapFactory.decodeFile(c
.getFilesDir().getAbsolutePath() + "/background.txt"));
</code></pre>
<p>I download the images all at once using Asynch Task like this</p>
<pre><code>public class DownloadImagesTask extends AsyncTask<String, String, Bitmap>
{
Bitmap bmp;
String name;
@Override
protected Bitmap doInBackground(String... urls)
{
name = urls[1];
return download_Image(urls[0]);
}
@Override
protected void onPostExecute(Bitmap result)
{
try
{
FileOutputStream o = new FileOutputStream(getFilesDir()
.getAbsolutePath() + name);
result.compress(Bitmap.CompressFormat.PNG, 90, o);
} catch (Exception e)
{
e.printStackTrace();
}
}
private Bitmap download_Image(String url)
{
return bmp = getBitmapFromURL(url);
}
}
</code></pre>
<p>My question is, is this a bad way of doing this? I tried finding good tutorials about caching online, but found it difficult to find a full tutorial that actually explained it properly. The method I am using seems quite simple, but not sure if it is recommended.</p>
<p>Would be grateful if anyone could tell me what are the pros and cons of doing it my way, and should I consider changing to another method.</p>
<p>Thanks</p>
| android | [4] |
3,529,346 | 3,529,347 | Margins of a LinearLayout, programmatically with dp | <p>Is it possible to set the Margins of a LinearLayout, programmatically but not with pixels, but dp?</p>
| android | [4] |
3,677,188 | 3,677,189 | Make header permanently visible | <p>In my custom list activity, I have added header in my list activity, it works fine when the list is populated, when it is empty the header also gone, so is there any option to place a permanent header in the list activity.</p>
<p>My XML code is,</p>
<pre><code><LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:background="@drawable/background">
<ListView
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:layout_marginTop="10dip"
android:layout_marginBottom="10dip"
android:drawSelectorOnTop="false"
android:cacheColorHint="@color/black"/>
<TextView
android:id="@android:id/empty"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:textSize="24dip"
android:text="@string/empty"/>
</code></pre>
<p></p>
<p>ad_header.xml</p>
<pre><code><LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:myapp="http://schemas.android.com/apk/res/com.example.Password"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical">
<ImageView
android:id="@+id/add"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:layout_gravity="center"
android:layout_weight="1"
android:paddingTop="5dip"
android:paddingBottom="5dip"
android:src="@drawable/add_new_item"
android:background="@color/white"/>
</code></pre>
<p></p>
<p>Thanks. </p>
| android | [4] |
480,951 | 480,952 | Take two string arguments and return a string with only the characters that are in both of the argument strings in python | <pre><code>def same_letters():
word1 = ''
word2 = ''
word1 = str(input("Please enter first word:"))
word2 = str(input("Please enter second word:"))
if word1 != word2:
for letter in word1:
for character in word2:
word1 = word1.replace(character, "")
print(word1)
</code></pre>
<p>This is what I have so far; I want to be able to display the answer like so:</p>
<p>Please enter first word: space</p>
<p>Please enter second word: spot</p>
<p>sp</p>
<p>Instead when I run this program I get the opposite instead of getting the letters that are in both string arguments I get "ace" and if I switch it around I get "ot" I cannot for the life of me figure out how to display the same characters.</p>
<p>thanks for any help</p>
| python | [7] |
4,560,476 | 4,560,477 | add a new item to vector and shift it remaining part to right | <p>I am trying to put a new item to vector, and shift remaining items. How can I do that ?</p>
<p>Ex </p>
<pre><code>vector -------------------------------------------------------
| 1 | 2 | 3 | 4 | 5 | 9 | 10 | 15 | 21 | 34 | 56 | 99 |
-------------------------------------------------------
^
new item = 14, it should be added to ^
After insertion,
vector ------------------------------------------------------------
| 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 21 | 34 | 56 | 99 |
------------------------------------------------------------
^ ^
^-shifted to right by one-^
</code></pre>
| c++ | [6] |
2,966,292 | 2,966,293 | use get_declared_class() to only ouput that classes I declared not the ones PHP does automatically | <p>A little curious, but I want to make an array out of the classes that I have declared using something like this</p>
<pre><code>foreach(get_declared_classes() as $class)
$c[] = $class;
print_r($c);
</code></pre>
<p>the only problem with that is that I get something like on top of my loaded classes:</p>
<pre><code>stdClass
Exception
ErrorException
Closure
DateTime
DateTimeZone
DateInterval
DatePeriod
LibXMLError
LogicException
BadFunctionCallException
BadMethodCallException
DomainException
InvalidArgumentException
LengthException
OutOfRangeException
RuntimeException
OutOfBoundsException
OverflowException
RangeException
UnderflowException
UnexpectedValueException
RecursiveIteratorIterator
IteratorIterator
{...}
SQLiteResult
SQLiteUnbuffered
SQLiteException
SQLite3
SQLite3Stmt
SQLite3Result
XMLReader
XMLWriter
XSLTProcessor
ZipArchive
</code></pre>
<p>is there a function that only loads user specific classes rather than system loaded classes? or perhaps a condition statement that limits the <code>foreach</code> to list those classes?</p>
| php | [2] |
1,365,574 | 1,365,575 | Slow creating Select List with Ajax in ie 8 | <p>I'm creating a select List from a getJson call.</p>
<p>in firefox / chrome the select list is generated very quickly but in ie (tested in ie8) it takes some seconds to create the options.</p>
<p>There is approx 2000 options being added to the select list</p>
<p>My code is below</p>
<pre><code>function getPractitioners(practID, selectID) {
selectID = '#' + selectID;
$.getJSON("/practitioner/getPractitioners", { practID: practID }, function (fooList) {
$(selectID).empty();
$.each(fooList, function (i, foo) {
if (foo.profID == practID) {
$(selectID).append(('<option value=\'' + foo.profID + '\' selected=\'selected\'>' + foo.display + '</option>'));
}
else
{
$(selectID).append(('<option value=\'' + foo.profID + '\' >' + foo.display + '</option>'));
}
});
$(selectID).trigger("liszt:updated");
});
}
</code></pre>
<p>Can anybody suggest anything to improve this?</p>
<p>Previously I was adding the options like </p>
<pre><code>$(selectID).append(("<option></option>").attr("value", foo.profID).attr("selected", "selected").text(foo.display));
</code></pre>
<p>but changing this did not improve the performance.</p>
<p>Thank you in advance.</p>
| jquery | [5] |
3,495,926 | 3,495,927 | how can I drag a file to an exe I create (drag and drop over the Icon) and have it as an argument when the exe start running? | <p>how can I drag a file to an exe I create (drag and drop over the Icon) and have it as an argument when the exe start running ?</p>
| c# | [0] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.