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 |
|---|---|---|---|---|---|
2,633,329
| 2,633,330
|
Get Mounted Drives in c#
|
<p><code>DriveInfo.GetDrives()</code> will enumerate all volumes mounted with a drive letter, but is there any way (without p/invoking Win32) to enumerate raw volumes, or to see volumes that may be mounted in a folder and not a drive letter?</p>
|
c#
|
[0]
|
2,605,143
| 2,605,144
|
AsyncTask - Accessing variable from doInBackground in different class
|
<p>Basically I am wanting to get access to a variable that has been assigned in doInBackground in a different class but I am not sure how to do this here. Below is my relevant class structure. This is for an android application. Thanks.</p>
<pre><code>public class CreateNewPlayers extends AsyncTask<String, String, String> {
public String doInBackground(String... args) {
String playerid = playerid1.getText().toString();
</code></pre>
|
android
|
[4]
|
2,228,574
| 2,228,575
|
correct syntax for javascript "src" declaration
|
<p>trying to add a math.random() method to my embedded js declaration to prevent the linked javascript file from being cached.</p>
<p>The problem is that I keep getting syntax errors. I think I'm close but my debugging efforts are proving futile. The code is as follows:</p>
<pre><code><script type="text/javascript">
document.write("<script src='links7.js?'+Math.random()+></script>");
</script>
</code></pre>
<p>any suggestions?</p>
|
javascript
|
[3]
|
1,055,372
| 1,055,373
|
Print value of array without using loop
|
<p>How to print values of array without using for/foreach loop using C# ?</p>
<pre><code>int[] iValue = {12,25,65,14,25,89};
</code></pre>
<p>Thanks.</p>
|
c#
|
[0]
|
761,938
| 761,939
|
Help with php custom popup
|
<p>Hi i have create a custom popup using javascript to use in PHP file. thw popup will appear when user click <em>My Special Website</em> i need to change the title header. Can help me how to do it??</p>
<pre><code>//function:
function myPopup() {
window.open( "<?=$CFG->wwwroot.'/example.php';?>" ,"myWindow", " height = 300, width = 600, statusbar=0, scrollbars=0,resizable=0, location=0,status=0, directories=0, menubar =0, toolbar =0 , left = 262,top = 234" ) }
// call:
<a href="#" onclick="myPopup() " >My Special WebSite </a> <span class="style1">*</span>
</code></pre>
<p>See my sample page: </p>
|
javascript
|
[3]
|
4,409,384
| 4,409,385
|
How to Save Recorded Audio file in application's raw folder
|
<p>I am creating an application in which I have to record the voice and save it and later play the same. I want to save the recorded audio in the raw folder of the application. How should I give the the directory path of raw folder to save my Audio file.</p>
|
android
|
[4]
|
2,976,586
| 2,976,587
|
validation for Time HH:MM am or pm Format using regular expression
|
<p>I am working on web application using asp.net with vb code.</p>
<p>I have a textbox for time field for which i am using regular expression validator.</p>
<p>the format i want is HH:MM am. the regular expression i am using is "(0[1-9]|[1][0-2])[:]" + "(0[0-9]|[1-5][0-9])[ ][A|a|P|p][M|m]"</p>
<p>i am entering the time example: 08:30 AM or 08:30 PM but the regular expression is showing error message.</p>
<p>Can anyone help me with correct regular expression.</p>
<p>thankyou all in advance</p>
<p>shubha</p>
|
asp.net
|
[9]
|
2,238,390
| 2,238,391
|
Cannot Import Counter is encountered in python 2.7.3 on CSH
|
<p>I am using UNIX's cShell in my Windows 7 OS.<br>
When I am executing a prog. it shows an error every time :<code>can not import name Counter</code>.<br>
though I have mentioned in the script <code>from collections import Counter</code>.<br>
I am using <code>Python 2.7.3</code>, then why this problem is persisting.</p>
|
python
|
[7]
|
2,895,716
| 2,895,717
|
Reload or maintain DOM state using Jquery after browser back button pressed
|
<p>I need a browser page to maintain it's post ajax changed state after the user navigates away and hits the back button to return to it. Unfortunately items previously faded out with jQuery are visible or dynamically added items (via ajax) disappear once the user hits the back button to return to a page. </p>
<p>I've tried about 20 different no-cache meta and header solutions and none seem to work in Chrome 13.0.782 for mac. I've also tried the onunload solution outlined here: <a href="http://stackoverflow.com/questions/158319/cross-browser-onload-event-and-the-back-button">Cross-browser onload event and the Back button</a> to no avail.</p>
<p>Ideally I'd like the page state to remain the same (with all jQuery changes to the DOM) without having to reload it, but I would be happy with the ability to reload the page when a user navigates back to it.</p>
<p>I realize there are multiple questions about reloading after the back button is pressed, but none of the solutions work in my situation.</p>
|
jquery
|
[5]
|
4,802,758
| 4,802,759
|
getting a specific word using .match and regular expression not working
|
<p>I am having a little trouble with regular expression.</p>
<p>I want to match a regular expression in a sentence.</p>
<p>Example :</p>
<pre><code>John has two candy ::123::
</code></pre>
<p>and i am using this code to look for it:</p>
<pre><code>var getid = x$('div').html().match(/::([^:]+)::/g);
</code></pre>
<p>To get the 123 our of the sentence.</p>
<p>So what's my problem here?
I kept on getting an undefined value for getid var.</p>
|
jquery
|
[5]
|
5,049,370
| 5,049,371
|
What control to use for display a row from Database
|
<p>I have something like this </p>
<pre><code>select sum(value) from database.table
</code></pre>
<p>And this will display only one number for example : 6546.00
What is the best control that i should use to display the selected data to my .aspx page
I don't want use DatagridView .
I think : <code>label , textbox(onlyRead) , ListVIew</code> or something else ? </p>
|
asp.net
|
[9]
|
3,296,988
| 3,296,989
|
stop automatical convert to htmlentities?
|
<p>I have a div id="ultimativegodemperorofalldivs"
It contains some Text like "such a cool & sexy div"</p>
<p>when I extract the InnerHTML with JS it converts the <code>&</code> to <code>&amp;</code>
I really don't want this. I don't need it for URL's so it really should be a very simple <code>&</code>.
How to archive this?</p>
<p>Thx in Advance,
iceteea</p>
|
javascript
|
[3]
|
2,393,871
| 2,393,872
|
Android: keep screen on from widget
|
<p>I have a home screen widget and I want to add "keep screen on" functionality. So how do I set the flag "FLAG_KEEP_SCREEN_ON" from within an AppWidgetProvider.onReceive method?</p>
<p>From within an activity you would do a </p>
<pre><code>this.getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
</code></pre>
<p>but I only have a Context object at hand...</p>
|
android
|
[4]
|
4,818,186
| 4,818,187
|
Checkbox not unchecking
|
<p>I have this code and it works fine, but the problem is the checkbox does not get removed when you click it again, it only gets removed when the span.removePortfolio is clicked. Thanks!</p>
<pre><code><input type="checkbox" name="portfolio"/>
<div>
Has Portfolio <span class="removePortfolio">X</span>
</div>
$("input[name=portfolio]").change(function() {
loadResults();
checkPortStatus();
});
$('span.removePortfolio').live("click", function() {
$("input[name=portfolio]").removeAttr("checked");
$('#portfolioRemove').hide();
});
var portChecked = false;
function checkPortStatus() {
if((portChecked) == true) {
$("input[name=portfolio]").removeAttr("checked");
}
}
function loadResults() {
if($("input[name=portfolio]").attr("checked", "checked")) {
portChecked = true;
}
}
</code></pre>
<p>I simply need the checkbox to be checked when the user clicks it, unchecked when they click it again, and unchecked if it was checked and the user clicks the span.removePortfolio.</p>
|
jquery
|
[5]
|
228,184
| 228,185
|
Trying to identify the newest and second newest file in a directory
|
<p>I am trying to identify the newest and second newest files in a directory. This is the code I intended to use:</p>
<pre><code>CONFIGS = "/Users/root/dev/config-files/"
allConfigs = sorted(os.listdir(CONFIGS), key=os.path.getctime)
t1 = "%s/%s" % (CONFIGS, allConfigs[-1])
t2 = "%s/%s" % (CONFIGS, allConfigs[-2])
</code></pre>
<p>I am encountering this error, which I can't figure out why:</p>
<pre><code>MBA:dev root$ python
Python 2.7.3 (default, Apr 19 2012, 00:55:09)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> CONFIGS = "/Users/root/dev/config-files/"
>>> allConfigs = sorted(os.listdir(CONFIGS), key=os.path.getctime)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/genericpath.py", line 64, in getctime
return os.stat(filename).st_ctime
OSError: [Errno 2] No such file or directory: 'newest.txt'
>>>
</code></pre>
<p>Anyone have any thoughts?</p>
|
python
|
[7]
|
3,820,900
| 3,820,901
|
Showing calendar Control
|
<p>I am creating a web application in which i have to select a date. I am using Calendar control. But it occupies too much space and other labels and text boxes are not shown in proper alignment. Is there anything I Can do in which when i click on an image, the calendar control opens, but on the textbox, so that it does not occupy any space.</p>
<p>Regards,
Jigar</p>
|
c#
|
[0]
|
1,195,409
| 1,195,410
|
How to convert string to bitmap in android
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2471935/how-to-load-an-imageview-by-url-in-android">How to load an ImageView by URL in Android?</a> </p>
</blockquote>
<p>How to convert string to bitmap in android.I am getting url value in string .I want to set bimap in imageview can anybody tell how to do?</p>
<p>Thanks</p>
|
android
|
[4]
|
4,566,323
| 4,566,324
|
hit enter to click button VC#
|
<p>I'm working on a WinForm App in C#, and there is only one button on app's screen, app's need is when user hit to enter, button should work as clicked to it. How can this be possible?</p>
|
c#
|
[0]
|
3,789,026
| 3,789,027
|
TextView and Button in each row and onListItemClick()
|
<p>I have a ListView with some elements on it. Each row has a TextView and a Button. It looks like this:</p>
<p><strong>| Some text in a row (Button) |</strong></p>
<p>Now, when I click on this text nothing happens. Simply no one function is called. But when I click on the button I can handle the event. I use onListItemClick()</p>
<p>So what should I use instead of this TextView to be able to handle an event (when I click on the text)?</p>
<p>Before this I had only one TextView in each row and when I was clicking on a row everything worked fine (onListItemClick() was called).</p>
<p>Thank you in advance!</p>
|
android
|
[4]
|
4,206,737
| 4,206,738
|
rmdir in PHP not working on an empty directory
|
<p>I'm trying to remove a directory with PHP. </p>
<p>I unlink/remove all files/subdirs from the inside out and finally call rmdir on the now empty top directory. Everything goes according to plan until the last call to rmdir. PHP warns that the directory is NOT emtpy and refuses to remove it. But when I look at the directory in the explorer it is empty, after all.</p>
<p>I also tried a well known recursive function with the same result. </p>
<p>The operating system is Windows 7 with Xampp and there are no access restrictions for any of the elements in question. </p>
<p>Any ideas?</p>
|
php
|
[2]
|
2,238,340
| 2,238,341
|
using default icons in UITabbar
|
<p>i am using tab bar control in my app and want to use the default search icon in one of my tab. I am making the tab bar programmically but i am not able to find a property where i can specify UITabBarSystemItemSearch item which i find in apple documentation. Following is my code for tab bar</p>
<pre><code>CouponsViewController *coupons = [[CouponsViewController alloc] init];
UINavigationController *couponsNavigationController = [[UINavigationController alloc] initWithRootViewController:coupons];
couponsNavigationController.tabBarItem.title = @"Coupons";
couponsNavigationController.navigationBar.tintColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.1];
[coupons release];
SettingsViewController *settings = [[SettingsViewController alloc] init];
UINavigationController *settingsNavigationController = [[UINavigationController alloc] initWithRootViewController:settings];
settingsNavigationController.tabBarItem.title = @"Settings";
settingsNavigationController.navigationBar.tintColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.1];
[settings release];
ProfileViewController *profile = [[ProfileViewController alloc] init];
UINavigationController *profileNavigationController = [[UINavigationController alloc] initWithRootViewController:profile];
profileNavigationController.tabBarItem.title = @"Profile";
profileNavigationController.tabBarItem.image = [UIImage imageNamed:@"profileImg.png"];
profileNavigationController.navigationBar.tintColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.1];
[profile release];
[tabBarController setViewControllers:[NSArray arrayWithObjects:loyaltyNavigationController,searchNavigationController,couponsNavigationController,settingsNavigationController,profileNavigationController,nil] animated:NO];
tabBarController.delegate=self;
tabBarController.selectedIndex=0;
[window addSubview:tabBarController.view];
</code></pre>
|
iphone
|
[8]
|
999,009
| 999,010
|
RandomAccessFile read/write start-finish position problem
|
<p>I've searched this a lot but still can't find... So I hope you can help me to understand :)</p>
<p>The question is...</p>
<p>I have big file A.dat and I want </p>
<ul>
<li>A) Read it with RandomAccessFile (to
avoid OutOfMemory error) </li>
<li>B) Read it by pieces of 4Mb (buffer)</li>
<li>C) Write each this 4Mb piece to file
B.dat</li>
<li>D) So to make file B.dat as a copy of
file A.dat</li>
</ul>
<p>But I have a problem... If I have a file which length cannot be devided by 4Mb the data get lost and file become corrupted :( </p>
<p>For example...
I have media file. Its length is 15.8Mb so I can get only 15.8Mb/4Mb=3 whole pieces. Then I can write only those 3 bytes pieces and the rest get lost :(
Or the problem is if file is smaller than buffer size (4Mb)... </p>
<p>I think it shouldn't be a hard task but I couldn't see any standart tutorial which shows how to solve such kind of things... </p>
<p>I dearly hope you can help me with this question.</p>
<p>Andrew</p>
|
java
|
[1]
|
1,218,340
| 1,218,341
|
Parameter is not valid when getting image from stream
|
<p>I have this code:</p>
<pre><code> MemoryStream ms = new MemoryStream(newbytes, 0,
newbytes.Length);
ms.Position = 0;
ms.Write(newbytes, 0, newbytes.Length);
Image img = Image.FromStream(ms);
img.Save(@"C:\Users\gsira\Pictures\Blue hills5.jpg");
</code></pre>
<p>I get this error at the Image.FromStream(ms) call:</p>
<p>System.ArgumentException: Parameter is not valid.
at System.Drawing.Image.FromStream(Stream stream, Boolean useEmbeddedColorManagement, Boolean validateIma</p>
<p>How can I resolve this? A couple of links which solve this problem (one on an MSDN thread) are broken so I am lost.</p>
|
c#
|
[0]
|
2,300,099
| 2,300,100
|
Getting JavaScript object key list
|
<p>I have a JavaScript object like</p>
<pre><code>var obj = {
key1: 'value1',
key2: 'value2',
key3: 'value3',
key4: 'value4'
}
</code></pre>
<p>How can I get the length and list of keys in this object?</p>
|
javascript
|
[3]
|
786,049
| 786,050
|
How to check my internet access on Android?
|
<p>What I really want is, when the user has no connection, I want to show some dialog that he or she has no connection. </p>
<p>I tried to put this on my MainActivity but still didn't work.</p>
<pre><code>public boolean isOnline() {
ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
return cm.getActiveNetworkInfo().isConnectedOrConnecting();
}
</code></pre>
<p>I also used this one but it didn't also work:</p>
<pre><code>public class ConnectionChangeReceiver extends BroadcastReceiver
{
@Override
public void onReceive( Context context, Intent intent )
{
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService( Context.CONNECTIVITY_SERVICE );
NetworkInfo activeNetInfo = connectivityManager.getActiveNetworkInfo();
NetworkInfo mobNetInfo = connectivityManager.getNetworkInfo( ConnectivityManager.TYPE_MOBILE );
if ( activeNetInfo != null )
{
Toast.makeText( context, "Active Network Type : " + activeNetInfo.getTypeName(), Toast.LENGTH_SHORT ).show();
}
if( mobNetInfo != null )
{
Toast.makeText( context, "Mobile Network Type : " + mobNetInfo.getTypeName(), Toast.LENGTH_SHORT ).show();
}
}
}
</code></pre>
<p>I added this on my manifest:</p>
<pre><code><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</code></pre>
<p>Can someone tell me what I'm doing wrong, I would really appreciate it a lot. Thanks in advance!</p>
|
android
|
[4]
|
1,347,419
| 1,347,420
|
Variable with name `None`
|
<p>I need to have a variable with name <code>None</code>:</p>
<pre><code>class QAbstractPrintDialog(QDialog):
None = int() # QAbstractPrintDialog.PrintDialogOption enum
PrintToFile = int() # QAbstractPrintDialog.PrintDialogOption enum
PrintSelection = int() # QAbstractPrintDialog.PrintDialogOption enum
...
</code></pre>
<p>But:</p>
<blockquote>
<p>syntax error: cannot assign to None</p>
</blockquote>
<p>I need the name to be <code>None</code>. I thought this will work:</p>
<pre><code>QAbstractPrintDialog.None = int() # QAbstractPrintDialog.PrintDialogOption enum
</code></pre>
<p>But it didn't. Is there a workaround to not have a syntax error?
Solutions like setattr don't work for me - this code will be parsed to extract classes, functions, arguments, etc.</p>
<p>Python 2.6, 2.7</p>
<p><strong>EDIT:</strong></p>
<p>I am helping a guy to write pseudo-Python modules which contain description of Qt classes. <code>QAbstractPrintDialog</code> is one of the classes and it has <code>enum QAbstractPrintDialog::PrintDialogOption</code> (http://doc.trolltech.com/latest/qabstractprintdialog.html). One of the enums is None. I can easily reference a <code>None</code> attribute via <code>QAbstractPrintDialog.None</code> but i can not set it. <code>int()</code> means the type of the attribute.</p>
<p>See here: <a href="http://scummos.blogspot.com/2011/06/kdevelop-python-language-support-plugin.html" rel="nofollow">http://scummos.blogspot.com/2011/06/kdevelop-python-language-support-plugin.html</a></p>
|
python
|
[7]
|
305,155
| 305,156
|
Random string from 4 to 12 characters using just one character
|
<p>I need to generate something like this using PHP:</p>
<pre><code>******
*********
****
***********
******
********
*******
*********
*******
**********
********
******
********
</code></pre>
<p>using PHP.</p>
<p>So, if i.e. I have this code so far:</p>
<pre><code><?php
$character = "*"; //character that will be used in generated strings
$min = "4"; //minimum characters for a generated string
$max = "12"; //maximum characters for a generated string
?>
</code></pre>
<p>What is the efficient way to write the next part of the code for rand() and echo of the string?</p>
|
php
|
[2]
|
30,708
| 30,709
|
Multiple $_POST items
|
<p>I am trying to post multiple email address when a form is submitted but it is only posting one. Here is the code.</p>
<pre><code>$email_to = $_POST['emailto'];
$message = stripslashes($message);
$respond = $_REQUEST['first_name'] ;
mail("$email_to,","Website",$message,"From: $respond","Employment Application");
</code></pre>
<p>Thanks is advance</p>
|
php
|
[2]
|
2,678,062
| 2,678,063
|
Read XML file from a web server
|
<p>I need to know how I can read a xml file which is placed at web.war. This also needs to be server independent. </p>
<p>Appreciate your help.</p>
<p>Thank you.</p>
|
java
|
[1]
|
1,095,069
| 1,095,070
|
(com process.android.www) has stopped unexpectedly
|
<p>I have tried restarting, changing to manual network, and tried many solutions.. But nothing is working out.. </p>
<blockquote>
<p>dialer\res\values\styles.xml:146: error: Error retrieving parent for
item: No resource found that matches the given name
'@android:style/Theme.NoTitleBar.OverlayActionModes'</p>
</blockquote>
<p>Can anybody assist me with the situation and with the best possible solution?</p>
<p>Thank you</p>
|
android
|
[4]
|
4,632,235
| 4,632,236
|
Parse error: syntax error, unexpected T_FUNCTION on line 1? Why this type of function gives error in the server?
|
<p>My function is:</p>
<pre><code>$cb = function() use ( $a, $b ){
..........
return $string;
}
</code></pre>
<p>Output: </p>
<blockquote>
<p>Parse error: syntax error, unexpected T_FUNCTION on line no ..</p>
</blockquote>
<p>Why does this type of function give an error in the server?</p>
|
php
|
[2]
|
464,999
| 465,000
|
How do closures work in PHP (If at all)?
|
<pre><code>function outer_function() {
$nid = 3;
function exists($var) {
print $nid;
return $var->nid == $nid;
}
$a_filtered_array = array_filter($an_array, "exists");
}
</code></pre>
<p>I'm trying to filter this array using a variable that's defined in the outer function, but the variable is not defined. This would work in JS. What am I doing wrong here? How would I accomplish this in PHP?</p>
|
php
|
[2]
|
4,786,713
| 4,786,714
|
ASPX page loaded loaded in android browser, numbers in labels open phone dialer
|
<p>I have a simple aspx site that is styled for use on the android platform. i have some label that are numbers such as "100>200" or "825". The problem is that when ever one of these labels is touched the phone automatically opens the touched number in the dialer. These are not phone numbers and i do not want the dialer to be opened. is there a way to avoid this problem..</p>
<p>thanks</p>
|
android
|
[4]
|
3,094,800
| 3,094,801
|
Resize Imageview and fitXY
|
<p>I am resizing an ImageView and auto fitting the image to it, I need this for zoom in and out for image, this is the way i wish to implement this because the image is already 2048x2048 and I cant re-size it. Bu the code only works once for some reason, second click does not do anything. If you have other ideas or suggestions I would love to hear them. Thank you.</p>
<pre><code>ImageView map = (ImageView) findViewById(R.id.imageViewMap);
Bitmap mapIm = BitmapFactory.decodeResource(getResources(),R.drawable.myMap);
map.setImageBitmap(mapIm); //first view
zoomIn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
map.getLayoutParams().height = counter*5000 ;
map.getLayoutParams().width = counter*5000;
BitmapDrawable bmd = new BitmapDrawable(mapIm);
map.setImageDrawable(bmd);
bmd = null;
counter++;
}
});
</code></pre>
|
android
|
[4]
|
1,170,941
| 1,170,942
|
Creating link with javascript
|
<p>I am trying to create a link in JS that moves the person the page from where he has come from. Here is the code.</p>
<pre><code><script language="javascript">
function Jump()
{
document.href=document.referrer;
}
</script>
</code></pre>
<p>Here is the html,</p>
<pre><code><a href="#" onclick="Jump();">Skip and Continue</a>
</code></pre>
<p>Now when the user clicks on the link, nothing happens. Please guide me where I am doing wrong. Thanks</p>
|
javascript
|
[3]
|
5,336,114
| 5,336,115
|
Javascript <script> tag error
|
<p>I faced a strange issue today at my work place. In a JSP, i had multiple script tags like below, one of which has a empty space in src of the script tag. This JSP is loaded successfully firefox, after i input the values and click submit, the JSP is submitted twice, once with post request and other with get request. The issue is why the form is submitted twice? If anybody had faced this issue. Please respond.</p>
<p>We some how resolved this issue by placing a dummy js file in the script tag, but want to understand the real problem behind it.</p>
<pre><code><script src="file.js" type="text/javascript"/>
<script src="file1.js" type="text/javascript"/>
<script src="file2.js" type="text/javascript"/>
<script src="file3.js" type="text/javascript"/>
<script src=" " type="text/javascript"/>
<script src="file4.js" type="text/javascript"/>
</code></pre>
|
javascript
|
[3]
|
1,712,079
| 1,712,080
|
Define map with add
|
<p>Hello I want to define map or set that I can add to it values doing loop</p>
<pre><code>for example
for
Map<String,String> listParentChild = new HashMap<String, String>() ;
listParentChild.put("Container", "Entity");
</code></pre>
<p>but I want the in every loop size the to add the specific names
I have tried with the above code and it seems that Its overwrite... </p>
<p>Thanks</p>
|
java
|
[1]
|
4,704,843
| 4,704,844
|
How to access an array from within an object?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/7027615/accessing-class-properties-with-spaces">Accessing Class Properties with Spaces</a> </p>
</blockquote>
<p>i have and object file and i cant get devices list, How to get <strong>devices</strong>?? how to call 2 wards like "Canon Camera" ?</p>
<pre><code> [Camera] => stdClass Object
(
[Canon Camera] => stdClass Object
(
[DEVICES] => Array
(
[0] => Canon EOS 30
[1] => Canon EOS 5D Mark II
[2] => Canon EOS 7D
[3] => Canon EOS A2
[4] => Canon EOS Digital Rebel (300D)
[5] => Canon EOS Rebel XS
[6] => Canon PowerShot 1200
[7] => Canon PowerShot A200
[8] => Canon PowerShot A520
[9] => Canon PowerShot A550
)
)
</code></pre>
|
php
|
[2]
|
3,721,331
| 3,721,332
|
Fetch remote url from POST request
|
<p>I'm looking for a way to fetch remote URL from where POST request was made to my form.
So i.e. I have a form on www.someserver.com/someform.html that does POST to www.myserver.com/some.php. So I need to fetch from POST request "www.someserver.com" on www.myserver.com/some.php page. Is there a way to do that?</p>
|
php
|
[2]
|
4,196,093
| 4,196,094
|
How do I safely cast between any numeric types with clipping if required?
|
<p>I'd like a function of the following form</p>
<pre><code>template <typename T, typename U>
U clipAndCast(T x)
{
...
return y;
},
</code></pre>
<p>where y is x cast to type U, but with x clipped if required so that this cast is well-defined.</p>
<p>Is there a library or boost function do to this? I can't find one, so if not what's the best way to write such a function?</p>
|
c++
|
[6]
|
2,950,596
| 2,950,597
|
URL searching in iPhone program
|
<p>I am a new iPhone programmer.</p>
<p>I am making a web based application. I'm taking the user input of a URL to a text box. When the button is pressed they will go to the web address.</p>
<p>Now when user type the URL such as <a href="http://www.google.com" rel="nofollow">http://www.google.com</a>, then it works fine
The problem is that when user only types google.com or www.google.com it doesn't work.</p>
<p>I don't understand how to fix this.</p>
<p>If I add 'http://' problematically, I still have a problem because if the user writes the whole web address it will fail.</p>
<p>Here is my code for button click:</p>
<p>-(IBAction)go
{
NSMutableString *str;</p>
<pre><code> str = [NSMutableString stringWithFormat:@"http://www.%@",name.text];
[webview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
</code></pre>
<p>}</p>
<p>Here name is a textfield and webView is an object of webView. Other than the web address behavior, it works fine.</p>
<p>Please help....</p>
|
iphone
|
[8]
|
4,607,860
| 4,607,861
|
How to get referer url without the id?
|
<p>I use this code to get referer url:</p>
<pre><code><?php echo $_SERVER['HTTP_REFERER']; ?>
</code></pre>
<p>And the output is:</p>
<blockquote>
<p><a href="http://example.com/application/view/viewleave.php?idleave=1" rel="nofollow">http://example.com/application/view/viewleave.php?idleave=1</a></p>
</blockquote>
<p>How should i do to get this?</p>
<blockquote>
<p><a href="http://example.com/application/view/viewleave.php" rel="nofollow">http://example.com/application/view/viewleave.php</a></p>
</blockquote>
|
php
|
[2]
|
5,529,498
| 5,529,499
|
javascript data getting undefined
|
<p>Variable <code>CIMtrek_Attachement_1</code> getting undefined it is not checking the if condition it moving to this line <code>var selecteditems = CIMtrek_Attachement_1.split("\\");</code></p>
<pre><code>var CIMtrek_Attachement_1= $("#CIMtrek_RegWhseCo_Attachement_1").val();
alert("CIMtrek_Attachement_1=666666==>> "+CIMtrek_Attachement_1);
if (CIMtrek_Attachement_1 !== null && CIMtrek_Attachement_1 !== "" && CIMtrek_Attachement_1 === undefined)
{
var selecteditems = CIMtrek_Attachement_1.split("\\");
var filename = selecteditems[(selecteditems.length-1)];
alert("selecteditems=666==>> "+selecteditems);
alert("filename=66666==>> "+filename);
nodeField = createNodeField(xmlDoc, new Array("FieldName"), "Record")
nodeField.attributes[0].value = NewFormFields[i]
nodeField.appendChild(xmlDoc.createTextNode(filename));
rootElement.appendChild(nodeField);
}
</code></pre>
|
javascript
|
[3]
|
4,860,545
| 4,860,546
|
where are my UIBarButtonItem & UIToolbar on UIPopoverController
|
<p>I have an iphone app, on the top of screen there is an UIToolbar, there are 2 UIBarButtonItem on the UIToolbar.</p>
<p>One is 'Cancel' another is 'Confirm'.
But if I migrate the project to ipad and present the view/ViewController using UIPopoverController, these two UIBarButtonItem & UIToolbar disappear.</p>
<p>I know if I touch anywhere outside the UIPopoverController, it will disappear, but I prefer to keep the UIBarButtonItems to ask for confirmation of some option.</p>
<p>Is it possible?</p>
<p>Welcome any comment</p>
<p>Thanks </p>
|
iphone
|
[8]
|
1,329,545
| 1,329,546
|
Why does `type(myField)` return `<type 'instance'>` and not `<type 'Field'>`?
|
<p>I am confronted to a python problem. I want to use <code>type()</code> to find out what type of variable I am using. The code looks similar to this one: </p>
<pre><code>class Foo():
array=[ myField(23),myField(42),myField("foo"), myField("bar")]
def returnArr(self):
for i in self.array:
print type(i)
if __name__ == "__main__":
a=Foo()
a.returnArr()
</code></pre>
<p>Edit: myField() is a class I defined.</p>
<p>When I ask for the type() I get: <code><type 'instance'></code> Now according to <a href="http://docs.python.org/reference/datamodel.html" rel="nofollow">1</a> this is due to the fact that I use a class element and ask for <code>type()</code> on that. Now what I need is: <code><type 'int'></code> for the example: <code>myField(42)</code> and <code><type 'str'></code> for <code>myField(foo)</code>. How could I acheive that?</p>
<p>EDIT:</p>
<pre><code>def __init__(self, name, default, fmt="H"):
self.name = name
if fmt[0] in "@=<>!":
self.fmt = fmt
else:
self.fmt = "!"+fmt
self.default = self.any2i(None,default)
self.sz = struct.calcsize(self.fmt)
self.owners = []
</code></pre>
<p>The code is taken from scapy and I try to adapt it.</p>
|
python
|
[7]
|
5,624,960
| 5,624,961
|
jquery multiple click issue
|
<p>I have the following jquery code:</p>
<pre><code>$(document).ready(function()
{
$("#build_table, a.coursename, .Start Date, .Book Title, .Book Author, .Book Isbn").click(function()
{
var whichButton = $(this).attr("class");
console.log("Whichbotton = " + whichButton);
var prog = $("#program option:selected").text();
var sch = $("#school option:selected").text();
var trm = $("#term option:selected").text();
var ext = $("#extension option:selected").text();
if(prog == "" || sch == "" || trm == "")
{
alert("Please enter a selection for each field");
}
else
{
$.get("build_table.php", {program: prog, school: sch, term: trm, extension: ext, button: whichButton},
function(table)
{ console.log("Entered table function");
$("#input_table").replaceWith("<div id='input_table'>" + table + "</div>");
});
}
});
});
</code></pre>
<p>At the way beginning, I have a click function which I want to work for multiple butttons. This code will call a php file to build a table, and the resulting table headers have different class names (such as coursename). But it doesn't actually work for coursename, Start date, etc, only for build_table which was the button that built the table in the first place. Am I missing something? I know that the names are correct, I even tried to take the space out of one of them (a.coursename) and that still didn't work...</p>
|
jquery
|
[5]
|
3,626,418
| 3,626,419
|
construct an array of integers to achieve specific sequence
|
<blockquote>
<p>construct the shortest possible sequence of integers ending with A,
using the following rules:</p>
<p>the first element of the sequence is 1, each of the successive
elements is the sum of any two preceding elements (adding a single
element to itself is also permissible), each element is larger than
all the preceding elements; that is, the sequence is increasing.</p>
<p>For example, for A = 42, a possible solutions is [1, 2, 3, 6, 12, 24,
30, 42]. Another possible solution is [1, 2, 4, 5, 8, 16, 21, 42].</p>
</blockquote>
<p>I have written the following but it fails on input of 456, by returning[1,2,4,8,16,32,64,128,200,256,456] , there are no numbers in the sequence that can be added together to get 200.</p>
<p>how can I fix the below code? what am I doing wrong?</p>
<pre><code> public static int[] hit(int n)
{
List<int> nums = new List<int>();
int x = 1;
while (x < n)
{
nums.Add(x);
x = x * 2;
if (x > n)
{
nums.Add(n - (x / 2));
nums.Add(n);
}
}
nums.Sort();
int[] arr = nums.ToArray();
return arr;
}
</code></pre>
|
c#
|
[0]
|
1,242,385
| 1,242,386
|
pythonic way to compare compound classes?
|
<p>I have a class that acts as an item in a tree:</p>
<pre><code>class CItem( list ):
pass
</code></pre>
<p>I have two trees, each with CItem as root, each tree item has some dict members (like item._test = 1). Now i need to compare this trees. I can suggest to overload a comparison operator for CItem:</p>
<pre><code>class CItem( list ):
def __eq__( self, other ):
# first compare items as lists
if not list.__eq__( self, other ): return False
# now compare dict members
if self.__dict__ != other.__dict__: return False
# seems equal
return True
</code></pre>
<p>Now i can compare two trees using '==' or '!='. Is this a 'pythonic' way or such comparsion can be done easire?</p>
|
python
|
[7]
|
2,437,616
| 2,437,617
|
Does Adobe have an Android SDK or API for their PDF reader?
|
<p>I want to be able to display local PDF files in a View within our app. (running on a tablet under Android 4.03) Currently we install AdobeReader.apk along with our app and launch it with an Intent. (our devices are shipped with our software preinstalled) But that means it runs separately and we have no programmatic control over it (for example, an image that's too big to fit on the screen will force the user to pan around - I'd rather have it shrunk to fit a specified size.)</p>
<p>So does Adobe offer an SDK for Android? If not, are there robust alternatives? I've looked at a few third-party ones but they seemed unfinished and not-ready-for-prime-time or they have open licensing issues that would conflict with our commercial/industrial application.</p>
<p>(I know this question has been asked before but maybe something new has emerged since last time it was asked) </p>
|
android
|
[4]
|
3,833,812
| 3,833,813
|
Joining multiple event handlers in Javascript
|
<p>How to join multiple event handlers in Javascript as in the following scenario :</p>
<pre><code>onClick="doSomething();" onKeyUp="doSomething();" onLoad="doSomething();"
</code></pre>
|
javascript
|
[3]
|
5,492,326
| 5,492,327
|
How to format output of methods inside of a class in an efficient way?
|
<p>I want to write a class with much stuff inside. Right now I want to have <strong>certain options for the output to show data in a disired format</strong>. Im my example a function inside a class should format the output (a former dictionary) as a list. But i really can't figure out how to do it...</p>
<p>here my try:</p>
<pre><code>class TestClass(object):
def __init__(self):
pass
def return_values_as_list(self,otherfunction):
data_as_list=[ i for i in otherfunction.values()]
return data_as_list
def get_data1_from_db(self):
self.data= {'1_testkey':'1_testvalue',"1_testkey2":"1_testvalue2"}
def get_data2_from_db(self):
self.data= {'2_testkey':'2_testvalue',"2_testkey2":"2_testvalue2"}
return self.data
</code></pre>
<p>What i want to have at the end is something like </p>
<blockquote>
<p>['1_testvalue','1_testvalue2']</p>
</blockquote>
<p>when instantiation looks like the following:</p>
<pre><code>testcase = TestClass()
testcase.get_data1_from_db.return_values_as_list()
</code></pre>
<p>Any help with that? I thought also of hooks...but i dont really know how to do that...</p>
|
python
|
[7]
|
3,375,964
| 3,375,965
|
How to apply a fadeIn effect when adding rows to a table using jQuery
|
<p>I am currently adding rows to a table using the .insertAfter() funciton within my document.</p>
<pre><code>$(document).ready(function () {
CheckRowLength();
$("#add").click(function () {
$('#querytable tr:last').clone(true).insertAfter('#querytable tr:last');
$('#querytable tr:last #name').val('');
CheckRowLength();
return false;
});
$("#del").click(function () {
$(this).parent().parent().remove();
CheckRowLength();
});
function CheckRowLength() {
var RowCount = $('#querytable tr').length;
if (RowCount > 2) {
$('#querytable tr:last #del').show();
}
else {
$('#del').hide();
}
}
});
</code></pre>
<p>html markup</p>
<pre><code><table id="querytable">
<tr>
<td id="col1">
Field Name
</td>
</tr>
<tr>
<td>
<input type="text" name="name" id="name" />
</td>
<td>
<a id="add">Add</a>
<a id="del">Delete</a>
</td>
</tr>
</table>
</code></pre>
<p>The effect I would like to obtain is when the row is added have it fade in. I tried to use the fadeIn() function but I am not implementing it correctly as nothing is happening. </p>
<pre><code>$('#querytable tr:last').clone(true).insertAfter('#querytable tr:last').fadeIn('slow');
</code></pre>
<p>Can someone please point me in the right direction for this effect. Or is this even possible when used in conjunction with insertAfter?</p>
<p>Thanks in advance</p>
|
jquery
|
[5]
|
5,663,478
| 5,663,479
|
Automatically set parent reference on child items
|
<p>I have a class that contains an <code>IList<T></code> property called <code>Children</code>. Each child should reference its parent. My solution has been to set the <code>ChildClass.Parent</code> property in the <code>ParentClass.Children</code> getter. Is there a better way, or is this the best solution?</p>
<pre><code>class ParentClass
{
private IList<ChildClass> _children;
public virtual IList<ChildClass> Children
{
get
{
// make sure each child refers to its parent (this)
foreach (ChildClass c in _children)
{
c.Parent = c.Parent ?? this;
}
return _children;
}
set
{
_children = value;
}
}
}
</code></pre>
|
c#
|
[0]
|
948,775
| 948,776
|
Partial to full expand/collapse w/ jQuery
|
<p>I'd like to write a function to allow to expand and collapse a div. It is not quite as straight forward though. If the div is more than 50px high I need to add an icon ("expand") to allow expanding it to a full height. And when it is fully expanded I need to change the style of the icon to ("collapse") and collapse it back to 50px. The icon needs to be position to the right bottom corner of the div.</p>
<p>I can have multiple such divs on a page.</p>
<p>Now, I can get a height of the div but how do I do it for each one on the page and onload?</p>
<pre><code>var divHeight = $('.myDiv').height();
if (divHeight > 50) {
$('.icon_collase').appendTo('.myDiv');
}
<style>
.collasedDiv {
max-height:50px;
}
</style>
$(".icon_collase").click(function() {
$('.icon_collase').toggleClass('icon_collase icon_expand');
$('.myDiv').addClass('collasedDiv');
}
<div class="myDiv">
// content here
</div>
<div class="myDiv">
// another content here
</div>
</code></pre>
|
jquery
|
[5]
|
1,076,207
| 1,076,208
|
Java connecting to Http which method to use?
|
<p>I have been looking around at different ways to connect to URLs and there seem to be a few.</p>
<p>My requirements are to do POST and GET queries on a URL and retrieve the result.</p>
<p>I have seen</p>
<pre><code>URL class
DefaultHttpClient class
HttpClient - apache commons
</code></pre>
<p>which method is best?</p>
|
java
|
[1]
|
2,723,009
| 2,723,010
|
How to embed a php graph in a web-page
|
<p>I am using this script which is one of the examples provided by the graph itself. When I put this on a web-page by itself, it's drawing the graph. But when I embed the code in an already existing web-page (with some content), it doesn't draw a graph.</p>
<p>I did the experiment using img src and its working fine.
But I just wanted to submit some parameter along with that graph in same web page.
How do I do that one without using "img src"?</p>
<p>Thanks in advance</p>
|
php
|
[2]
|
1,566,158
| 1,566,159
|
Call javascript function with an href
|
<p>i'm developing a website, but i'm not an expert when it comes to javascript. I'm using a script that i found on the internet for searching the page for a text string. To call this function i use the following code:</p>
<pre><code> <div class="pesquisa" id="pesquisa"><form name="f1" action=""
onSubmit="if(this.t1.value!=null && this.t1.value!='')
findString(this.t1.value);return false">
<input name="t1" type="text" /></form>
</div>
</code></pre>
<p>this is working well, when i enter text and click enter he finds it on the page.
Now i have a "button" next to it that is represented by:</p>
<pre><code><a href='javaScript:document.f1.findString(this.t1.value)'>
<div class="enviar" id="enviar">Pesquisar</div></a></div>
</code></pre>
<p>I want this "button" to call the same function with the value inserted in the form. But it is not working this way.
Any ideas on how this can be made ?</p>
<p>Thanks in advance, Cláudio</p>
|
javascript
|
[3]
|
1,318,870
| 1,318,871
|
Javascript - sort objects in an array alphabetically on one property of the array
|
<p>Let's say you have a javascript class like this...</p>
<pre><code>var DepartmentFactory = function(data) {
this.id = data.Id;
this.name = data.DepartmentName;
this.active = data.Active;
}
</code></pre>
<p>Let's say you then create a number of instances of that class and store them in an array...</p>
<pre><code>var objArray = [];
objArray.push(DepartmentFactory({Id: 1, DepartmentName: 'Marketing', Active: true}));
objArray.push(DepartmentFactory({Id: 2, DepartmentName: 'Sales', Active: true}));
objArray.push(DepartmentFactory({Id: 3, DepartmentName: 'Development', Active: true}));
objArray.push(DepartmentFactory({Id: 4, DepartmentName: 'Accounting', Active: true}));
</code></pre>
<p>So I now would have an array of objects created by DepartmentFactory. How would I go about using the array.sort() method to sort this array of objects by the DepartmentName property of each object?</p>
<p>The array.sort() method works just fine when sorting an array of strings...</p>
<pre><code>var myarray=["Bob", "Bully", "Amy"];
myarray.sort(); //Array now becomes ["Amy", "Bob", "Bully"]
</code></pre>
<p>But how do I make it work with a list of objects?</p>
<p>Thanks.</p>
|
javascript
|
[3]
|
2,254,907
| 2,254,908
|
Sort Bitset in c++
|
<p>I am very new to c++ I am trying to reverse a binary how to do this ? is there any good algorthm to do this ?</p>
|
c++
|
[6]
|
5,056,589
| 5,056,590
|
divs display none ie6 and jquery toggle
|
<p>I am currently using display none for the divs which I would like to use jquery toggle on. As usual something in ie6 is not the same compared to other browsers. First of all display none is adding white space and secondly its doing something weird. Imagine there is a word called elephant in div 1 and there is nothing in div 2 it is displaying the last few letters of elephant in div 2 for instance phant! When I removed display none every thing went fine is there any way around this so every thing is consistent in all browsers and I can keep using toggle. May I add it is working with a few other divs 99% consistently just a slight layout jerk in ie6. What might the problem be?</p>
|
jquery
|
[5]
|
5,299,768
| 5,299,769
|
Web app on home screen (iphone style)?
|
<p>just wondering when I had an iphone I was able to create a web app then place some code in it so that when the user pressed "add to homescreen" an icon would be placed on the home screen and when the user clicked it the web app would run full screen (no web navigation bar) so it just looked like a normal app (although it would only run with the web on) Is there anyway I can do this with android or do I have to code a whole app to do it? Sorry if this is a bit unclear. Thanks, Adam.</p>
<p>What I used for the iphone:</p>
<pre><code><meta name="viewport" content="user-scalable=no, width=device-width" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-startup-image" href="images/myCustomStartupGraphic.png" />
</code></pre>
|
android
|
[4]
|
3,698,520
| 3,698,521
|
How to simulate target="_blank" in JavaScript
|
<p>When a user clicks on a link, I need to update a field in a database and then open the requested link in a new window. The update is no problem, but I don't know how to open a new window without requiring them to click on another hyperlink.</p>
<pre><code><body onLoad="document.getElementById('redirect').click">
<a href="http://www.mydomain.com?ReportID=1" id="redirect" target="_blank">Report</a>
</body>
</code></pre>
|
javascript
|
[3]
|
1,593,159
| 1,593,160
|
Is there any AJAX-like asynchronous callback method in Android?
|
<p>I was wondering if there is any way to create asynchronous callback functions in an android client similar to AJAX, binding an event handler to a 'response received' event. I am looking for something like this:</p>
<ol>
<li>Client sends data through POST or GET to the server and the app is not locked, waiting for response.</li>
<li>Server process the data and sends a response.</li>
<li>The app receives the response and at this time an event is raised and its event handler is executed.</li>
</ol>
|
android
|
[4]
|
5,553,311
| 5,553,312
|
Keeping the format of file in c#
|
<p>In my project, I need to read from a file. But I don't want the format of file to be changed.
When I use the common way of reading file in c#, for example the Header of the file comes to the left hand side or the bold words shown as an ordinary words. Can anyone help me and tell me how can I read the file in c# without changing the Format of the file.</p>
<p>Thanks in advance</p>
|
c#
|
[0]
|
1,833,058
| 1,833,059
|
How to detect iphone4s
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/448162/determine-device-iphone-ipod-touch-with-iphone-sdk">Determine device (iPhone, iPod Touch) with iPhone SDK</a> </p>
</blockquote>
<p>I am using UIDevice (Hardware) by Erica Sadun to detect the device info. <br/>
Since iphone4s is a new device, does anyone have a way to detect if it's a iphone4s device.<br/>
Thanks in advance!</p>
|
iphone
|
[8]
|
3,167,465
| 3,167,466
|
UIButton is crashing the application
|
<p>Added UIButton to app</p>
<pre><code>UIButton *playButton = [UIButton buttonWithType:UIButtonTypeCustom];
[playButton addTarget:self action:@selector(play:) forControlEvents:UIControlEventTouchUpInside];
UIImage *image = [UIImage imageNamed:@"play.png"];
[playButton setImage:image forState:UIControlStateNormal];
</code></pre>
<p>when i run the application it is crashing and message is UIButtonview unrecognized selector</p>
<p>Did exception breakpoint </p>
<p>Found that it is crashing at</p>
<pre><code>[toolbar setItems:toolbarItems];
</code></pre>
<p>I think i m not adding UIButton properly to toolbar</p>
<pre><code>//Add buttons to the array
NSArray *toolbarItems = [NSArray arrayWithObjects: settingsButton, flexItem, rewind, flexItem, playButton, flexItem, pause, flexItem, modalBarButtonItem, nil];
[toolbar setItems:toolbarItems];
</code></pre>
<p>Anyideas to fix this one.</p>
<p>Thanks for help.</p>
|
iphone
|
[8]
|
5,988,185
| 5,988,186
|
Submit Universal apps to the apple app store?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/308290/procedure-to-submit-iphone-application-to-app-store">Procedure to submit iPhone application to App Store?</a> </p>
</blockquote>
<p>How to submit Universal apps to the apple app store</p>
|
iphone
|
[8]
|
2,981,546
| 2,981,547
|
A website with many good and small javascript libraries?
|
<p>I used to find a website with many good and small javascript libraries, but now I can't remember it now.</p>
<p>Can someone tell me such a site?</p>
|
javascript
|
[3]
|
5,241,748
| 5,241,749
|
How to implement session handling in Java to be servlet container independent?
|
<p>AFAIK: <a href="http://www.freeopenbook.com/mysqlcookbook/mysqlckbk-CHP-19-SECT-4.html" rel="nofollow">Session handling is done by the servlet Container</a> (e.g. Tomcat, Glassfish...), i would prefer a solution which is servlet container independent, like php does it, implement some handler or filter and let the application deal with it. I have not found any sort of Information regarding self build session handling in Java.</p>
|
java
|
[1]
|
1,034,502
| 1,034,503
|
How to change status "Developer Action Needed" in In-App Purchase Feature
|
<p>My app was rejected earlier and I uploaded it again after resolving issues. I have implemented the In App Purchase feature in the app, but now its status is "Developer Action Needed" and I can see "Rejected" before the language I had selected to display the name of the app. I can't attach the screen shot as my reputation is just 9. So please let me know how to change this status to "Waiting For Review". What I should do?</p>
|
iphone
|
[8]
|
688,877
| 688,878
|
How can i get from a directory string only the file name in the end?
|
<p>I have a <code>List<string></code> that contain 5 files for example in index[0] I see:</p>
<pre><code>D:\New folder (45)\converted.avi_Automatic\Lightning 2 Length 4 [276 - 280]\000276.bmp
</code></pre>
<p>The line is : </p>
<pre><code>label22.Text = files[_indx].ToString();
</code></pre>
<p>I want instead see in label22 : D:\New folder (45)\converted.avi_Automatic\Lightning 2 Length 4 [276 - 280]\000276.bmp to see only: 000276.bmp</p>
<p>Before files were _files wich is a <code>List<FileInfo></code> so I could make <code>_files[_indx].FullName</code> or <code>.Name</code></p>
<p>But now the list is <code>List<string></code> </p>
|
c#
|
[0]
|
5,283,328
| 5,283,329
|
How do I check the input data type of a variable in C++?
|
<p>I'm currently started learning C++, but i've one doubt about how to check the data type of input variable in c++.</p>
<pre><code>#include<iostream>
using namespace std;
int main()
{
double a,b;
cout<<"Enter two double values";
cin>>a>>b;
if() //if condition false then
cout<<"data entered is not of double type";
//i'm having trouble for identifying whether data
//is double or not how to check please help me
}
</code></pre>
|
c++
|
[6]
|
1,939,241
| 1,939,242
|
converting files to utf-8 but character destroyed
|
<pre><code>foreach (var f in new DirectoryInfo(@"...").GetFiles("*.cs", SearchOption.AllDirectories)) {
string s = File.ReadAllText(f.FullName);
File.WriteAllText (f.FullName, s, Encoding.UTF8);
}
</code></pre>
<p>but when converting characters get destroyed. How can i prevent that čćžšđ will not be destroyed?</p>
<p>Manually i fisrt copy text then convert file to utf-8 and paste text back and characters are ok. But here i have more than 200 files and this is too much.</p>
|
c#
|
[0]
|
2,238,646
| 2,238,647
|
Compare same date using java
|
<p>The date is selected by the user using a drop down for year, month and day. I have to compare the user entered date with today's date. Basically see if they are the same date. For example
the user entered 02/16/2012. And if today is 02/16/2012 then I have to display a message. How do I do it?
I tried using milliseconds but that gives out wrong results.</p>
|
java
|
[1]
|
4,138,313
| 4,138,314
|
Rename Files in a Directory
|
<p>I have 400 files in a directory (with <code>.png</code> extensions). They start with the name <code>005.png</code> and go up to <code>395.png</code>.</p>
<p>I want to rename them using <code>os.rename</code>:</p>
<pre><code>os.rename(006.png,005.png)
</code></pre>
<p>In other words, I want to shift all the numbers down one, renaming the file <code>005.png</code> to <code>004.png</code> and renaming <code>395.png</code> to <code>394.png</code>, and so on.</p>
<p>I don't want to do this manually, because it would take too long:</p>
<pre><code>os.rename(005.png,004.png)
os.rename(006.png,005.png)
...
</code></pre>
<p>How can I do this simply? I am using the s60 2nd edition FP3.</p>
<p>Thanks in advance!</p>
|
python
|
[7]
|
634,988
| 634,989
|
Creating a function in php that checks that get value is in the order dd/mm/yyy
|
<p>I'm currently building a room booking system and was wondering how to check if the user has entered a date (get value) in the correct UK format of dd/mm/yyyy.</p>
<pre><code>$uk_date = $_GET["date"];
</code></pre>
<p>For example to avoid a situation where the user types in 12/2012 or 2012 or uses the incorrect separators.</p>
<p>Thanks in advance!</p>
|
php
|
[2]
|
50,283
| 50,284
|
JDOM duplicate element name handling
|
<p>Say for eg I have an XML like this</p>
<pre><code> <Containers>
<Container ContainerGrossWeight="0.69" ContainerGrossWeightUOM="lbs" ContainerScm="16757598166153847" TrackingNo="420913119102999949374063023016">
</Container>
<Container ContainerGrossWeight="4.84" ContainerGrossWeightUOM="lbs" ContainerScm="16757598166153848"
TrackingNo="420913119102999949374063023016">
</Container>
</Containers>
</code></pre>
<p>So "Containers" is the parent and it has two children.. and another .. But the attribute values in both are different.</p>
<p>I use JDOM to read and manipulate the values. If I write the below code I get the attributes of first . My question is how do I access the attributes and values of second ?</p>
<pre><code>Element Containers = rootNode.getChild("Containers")
Element Container = Containers.getChild("Container")
String ContainerSCM = Container.getAttributeValue("ContainerSCM")
</code></pre>
<p>The above code gives me "16757598166153847" as output
how do I get "16757598166153848" as output which is the getAttributeValue of second Element Containers attribute?</p>
|
java
|
[1]
|
2,079,939
| 2,079,940
|
Calculating future date with strtotime doesn't work properly
|
<p>If I run "next saturday" into strtotime function it shows 4/3/2010 as the date. Why does it not show 4/10?</p>
|
php
|
[2]
|
461,809
| 461,810
|
Why do we actually use getters and setters?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/565095/are-getters-and-setters-evil">Are Getters and Setters evil?</a><br>
<a href="http://stackoverflow.com/questions/1568091/why-use-getters-and-setters">Why use getters and setters?</a> </p>
</blockquote>
<p>I've been asking myself this for awhile but why do we actually use Getters and Setter methods? They take up extra space in our code, can someone explain. I've posted some code below for a better understanding.</p>
<pre><code>public class Test2
{
public int _ChangeThis = 0;
}
</code></pre>
<p>--- Other way ---</p>
<pre><code>public class Test1
{
public int _ChangeThis = 0;
public setChangeThis(int ChangeThis)
{
_ChangeThis = ChangeThis;
}
</code></pre>
<p>}</p>
<p>--- Main code ---</p>
<pre><code>Test2 testclass = new Test2();
//What is the difference and why do we use the setter? I cannot understand the advantage.
testclass.setChangeThis(1);
testclass._ChangeThis = 1;
</code></pre>
|
java
|
[1]
|
3,907,858
| 3,907,859
|
Click event for dynamically added li element?
|
<p>I am having totally 20 links.First 10 links directly visible to user and remaining 10 links shown when user hover the down arrow image(used for hover). When user click any one hover link, the link till the currently clicked are moved to left side(another down arrow used for add the right side links to left side dynamically by creating li). This one working fine.But this is not working as vice versa. (i.e)When i click left side link it should navigate to right side.Click event not working for li element that i created dynamically. Please Can any one help for me??????</p>
<p>My sample Code: </p>
<pre><code>//To append the line from right hover to looplink div
$('#loop_link').append('<li id="pagelinkli_'+val3+'">'+$('#pagelinkli_'+val3).html()+'</li>');
//To hide the link in right hover div once it selected and appended in loop link div
$('#pagelink_a #pagelinkli_'+val3).css('display','none');
//This line to move the link from loop link to left hover div
$('#pagelink_a_left ul').prepend(('<li id="pagelinkli_'+val6+'">'+$('#pagelinkli_'+val6).html()+'</li>'));
//This line to hide the link in looplink div
$('#loop_link #pagelinkli_'+val6).css('display','none');
</code></pre>
<p><strong>This code is like navigating link from right hover to tab and from tab to left hover and vice versa.....</strong></p>
|
jquery
|
[5]
|
3,032,985
| 3,032,986
|
php: how to know what file has contains a php function that is called
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2222142/how-to-find-out-where-a-function-is-defined">How to find out where a function is defined?</a> </p>
</blockquote>
<p>in a client's website I have a php code:</p>
<pre><code>return userHasActivePurchase($iId);
</code></pre>
<p>The website is full of icludes, requires.
I have made a full text search on "userHasActivePurchase" to find out what php file does contain this function without success.</p>
<p>My question is : <strong>I have a function name and I would like to know what php files contains that function.</strong></p>
<p>I tried with:</p>
<pre><code>print_r(userHasActivePurchase);
</code></pre>
<p>without success.</p>
<p>Please help !</p>
|
php
|
[2]
|
2,355,908
| 2,355,909
|
How to handle form action using php?
|
<p>In my home page, i had one submit button(form action $_SERVER[PHP_SELF]). By clicking submit button,(by some action), its shows me the "Accept" and "Reject" button. My "Accept" button(data should save in my database) is not at all working for me .(i pointed this also to form action $_SERVER[PHP_SELF]).But if i click on the "Accept" button, its brings to me to the home page only.</p>
<p>This is not working for me</p>
<pre><code> if(isset($_POST['confirm']) && ($_POST['confirm'])=="Confirm")
{
$name=$_POST['txt1'];
echo $name;
}
</code></pre>
<p>Please help me out.thanks in advance urgent.</p>
|
php
|
[2]
|
3,508,043
| 3,508,044
|
Field has incomplete type const char * []
|
<p>I am trying tot pass argv from the main function of my program to the constructor of my class. I want to then set a field in my class to those values. I have <code>const char * _argv[];</code> in my header file. My constructor is:</p>
<p><code>Sweeper(int argc, const char * argv[]){_argc = argc; _argv = argv;}</code></p>
<p>What do I need to do?</p>
|
c++
|
[6]
|
5,332,387
| 5,332,388
|
How do I instantiate an object when it's constructor expects enumerations?
|
<p>I have a class that uses enumerable data types. In it's constructor, it uses two of these. When I try to instantiate an object of this class from another file, I get an error.<br>
Here is part of the code from the class:</p>
<pre><code>public class Card {
public static enum colorType {BLACK, RED};
public static enum suitType {CLUB, DIAMOND, HEART, SPADE };
public static enum rankType {ACE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT,
NINE, TEN, JACK, QUEEN, KING };
private boolean faceup = false;
private rankType rank;
private suitType suit;
//*************************************************************
//Card- constructor. initializes a card and makes it face down
//*************************************************************
public void Card(rankType r, suitType s){
this.rank = r;
this.suit = s;
this.faceup = false;
}
</code></pre>
<p>When I try to do this:</p>
<pre><code>Card C1 = new Card(ACE,SPADE);
</code></pre>
<p>from another file, I get an error. using rankType.ACE and suitType.SPADE as arguments also gives the same error. I can do Card C1 = new Card(); with no errors, but that would create a card with nothing in it. The exact error I'm getting is:</p>
<pre><code>internal error; cannot instantiate Card.<init> at Card to ()
</code></pre>
<p>Obviously there is some trick to using enumerables in this situation. What am I doing wrong?<br>
Fixed. Solutions to my problems are in posts from uthomas, Tieson T., and the accepted answer.</p>
|
java
|
[1]
|
2,421,553
| 2,421,554
|
How to determine the current iPhone OS version at runtime and compare version strings?
|
<p>How can you determine and compare (>, <, etc.) the current OS version of the iPhone that the app is running on? There is a certain bug in 3.0 but not in 3.1+ so I'd like to be able to skip out a bit of code if the current OS version is not >= 3.1. </p>
<p>This needs to be at runtime not compile time!</p>
|
iphone
|
[8]
|
5,273,957
| 5,273,958
|
Delphi's like decision cube for c#
|
<p>I'm looking for a pivot table like component for winforms and c#, like the good-old decision cubes that came with Delphi decades ago. Any pointers?</p>
<p>I need one able to be used independently of the underlying database, so capable of getting data programatically and not restricted to sqlserver olap or similar</p>
|
c#
|
[0]
|
90,797
| 90,798
|
open google search page
|
<p>I have a text box , and user enters text on here , I want to know how can I handle this textbox so when users enters a text , It opens google search page and search that text , I do not want to using apis , just opens google website in browser and searches for text .</p>
<p>thanks</p>
|
android
|
[4]
|
733,189
| 733,190
|
asp:SqlDataSource vs ADO.NET coding with C#
|
<p>I really do not have time to learn new language, in my case asp.net, but would like to start developing website in asp.net. I do not want to use asp:SqlDataSource control. is it ok if i write in codebehind aspx: all database connections and other CRUD operations in ado.net and c#. I already know xhtml, javascript - jquery, css, xml, json, some knowledge in sever-side coding (before php). want to start coding, instead of learning messy asp.net controls. Please advise, or I have to sit and learn all bloody ways of using those asp.net controls? </p>
|
asp.net
|
[9]
|
98,871
| 98,872
|
Re-doing the completed tasks when taking the background application
|
<p>I'm having a searching app, which will search the different restaurants nearby.</p>
<p>In ICS based smartphones,</p>
<ol>
<li>I've launched my app and start searching a keyword at a particular location.</li>
<li>Result was shown correctly</li>
<li>Now i pressed the home button(without exiting the app) to move the app to background.</li>
<li>I've launched different application and move some of them to background.</li>
<li>Now i re-launched my app.</li>
<li>It started researching the previous keyword!! (as this is a completed task)</li>
</ol>
<p><strong>I just want to disable the auto search when coming from background in ICS phones</strong>.</p>
<p>Note:
This is not happening in the prev. android versions(eg: droid phones).</p>
<p>Thanks in Advance!!</p>
|
android
|
[4]
|
2,549,666
| 2,549,667
|
xml/rss file creater
|
<pre><code><channel>
<title>Company</title>
<link>http://www.ndroid360.com/companypms/index.php/main_con</link>
<description>Companypms - By Keyur Modi </description>
<language>en-us</language>
<image>
<title>Company</title>
<url>http://www.ndroid360.com/companypms/public/admin/dashboard/images/keyur.jpg</url>
<link>http://www.ndroid360.com/companypms/index.php/main_con</link>
<width>90</width>
<height>36</height>
</image>
<item>
<title>Project Add</title>
<link>http://www.ndroid360.com/companypms/index.php/main_con</link>
<description>
OK, modi sarkar
</description>
</item>
<item>
<title>A Post Title</title>
<guid isPermaLink="true">http://www.mydomain.com/file-location/</guid>
<link>http://www.ndroid360.com/companypms/index.php/main_con</link>
<pubDate>Wed, 30 Apr 2009 23:00:00 +1100</pubDate>
<description><![CDATA[ <p>This is a brief summary of the post, so tempting that noone will be able to resist clicking through.</p> ]]></description>
</item>
</channel>
</code></pre>
<p>I want to put an image after second <code><item></item></code>-tag. What can I do?</p>
|
php
|
[2]
|
4,561,302
| 4,561,303
|
Is there any way to prevent access to text files other than encryption?
|
<p>Basically I am implementing a dictionary and I dont want any user to access my dictionary .txt file. I need to access the file from my program. The txt files are too large that encryption method takes a lot of time to decrypt them. What other methods are there ?</p>
|
c++
|
[6]
|
2,766,711
| 2,766,712
|
how to do mailchimp API Integration in Java or PHP
|
<p>These functions will allow you to create, update, and even reuse campaigns for what we hope is the ultimate flexibility in campaign management. Once you have them ready, we also have several functions to allow you to send your campaigns to emails according to their status</p>
|
java
|
[1]
|
3,297,762
| 3,297,763
|
Web login system
|
<p>So here is my problem: I am designing a website for my project. So a user has got a role, stored as user_role in my database. User roles can be classified as 'police', 'ambulance', 'SMF' or 'fire'. So if the user logs in as 'police', he will be redirected to a specific page and if a user logs in as smf, he will be redirected to another webpage and so on. I am not able to get the proper syntax for logging in through user roles. </p>
<p>Is it possible for me to some suggestions on the php scripts that i can use??</p>
<p>Thank you in advance</p>
|
php
|
[2]
|
3,482,275
| 3,482,276
|
iPhone code forUIImageViewControllerPickerSourceTypeCamera
|
<pre><code>- (IBAction)pickAndDecode:(id) sender {
UIImagePickerControllerSourceType sourceType;
int i = [sender tag];
switch (i) {
case 0: sourceType = UIImagePickerControllerSourceTypeCamera; break;
case 1: sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; break;
case 2: sourceType = UIImagePickerControllerSourceTypePhotoLibrary; break;
default: sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
}
[self pickAndDecodeFromSource:sourceType];
}
- (void) updateToolbar {
self.cameraBarItem.enabled = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera];
self.savedPhotosBarItem.enabled = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum];
self.libraryBarItem.enabled = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary];
self.archiveBarItem.enabled = true;
self.actionBarItem.enabled = (self.result != nil) && ([self.result actions] != nil) && ([self.result actions].count > 0);
}
- (void)pickAndDecodeFromSource:(UIImagePickerControllerSourceType) sourceType {
[self reset];
// Create the Image Picker
if ([UIImagePickerController isSourceTypeAvailable:sourceType]) {
UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.sourceType = sourceType;
picker.delegate = self;
picker.allowsImageEditing = YES; // [[NSUserDefaults standardUserDefaults] boolForKey:@"allowEditing"];
// Picker is displayed asynchronously.
[self presentModalViewController:picker animated:YES];
} else {
NSLog(@"Attempted to pick an image with illegal source type '%d'", sourceType);
}
}
</code></pre>
<p>Where I Put this line in my above codes;
[picker setShowsCameraControls:FALSE];</p>
<p>please help me so that i can change the real view of iPhone camera according to my view which i have designed</p>
|
iphone
|
[8]
|
4,508,358
| 4,508,359
|
counting characters in php
|
<p>I want to count how many characters a certain string has in PHP, but I cant get it to work.</p>
<p>I did a var_dump and this is what I got:</p>
<pre><code>string(23) "Children&#8217;s Center"
</code></pre>
<p>It seems like <code>'</code> gets translated to <code>&#8217;s</code> </p>
<p>This makes it impossible to get the actual character count. I tried using <code>html_entity_decode</code> but it did not help.</p>
<p>Anyone?</p>
<p>EDIT:
My function looks like this now:</p>
<pre><code>function make_shorter($string, $maxlength)
{
$string = stripslashes($string);
$string = html_entity_decode($string);
if ( mb_strlen(utf8_decode($string)) > $maxlength)
return substr($string,0,$maxlength).'...';
else
return $string;
}
</code></pre>
<p>I can't change how the data gets in to the system. I can only modify it's output.</p>
<p>(It's a wordpress site)</p>
|
php
|
[2]
|
448,206
| 448,207
|
PHP rCopy Set File chMod?
|
<p>I am using the following code to copy a folder and it's contents from location A to B.</p>
<p>It's works file but I have a problem with the file ownerships...it's setting the copy to Nobody</p>
<p>I've tried activating suPHP but my website broke so can't do that one.</p>
<p>Are there any work arounds?</p>
<p>Here is the code I'm using:</p>
<pre><code>rcopy("$source_folder", "$target_folder");
chmod($target_folder, 0755);
chmod($target_folder.'/images', 0777);
}
</code></pre>
|
php
|
[2]
|
1,287,817
| 1,287,818
|
Stop Infinite event handling for ui tabs
|
<p>I want to show an alert message if user click on second tan without submitting the form on the first tab, the problem I face of infinite alert messages that's show when user click on tab,
here is the code I write</p>
<pre><code> $(function() {
$('#tabs').tabs({
selected:<?php echo $param ?>,
select: function(e, ui) {
var thistab = ui;
runMethod();
}
});
});
function runMethod(){
if( $.trim($("#generalImportNo").text()) == "")
{
alert("You should fill all main information first.")
$('#tabs').tabs({selected:1 });
}
}
</code></pre>
<p>I try to use <code>stopPropagation</code> but it doesn't work, how can I prevent infinite event occuring ?!</p>
|
jquery
|
[5]
|
4,778,671
| 4,778,672
|
Bind JSONArray to adapter
|
<p>How would you go about to bind a <code>JSONArray</code> to an adapter, the adapter will be used to bind data to a spinner.</p>
<p>Of course I could iterate over the strings in the <code>JSONArray</code> and add 'em to a String array, but that seems cumbersome.</p>
|
android
|
[4]
|
2,975,384
| 2,975,385
|
Use of #include <iostream.h>
|
<p>I am working on an older project that still has the deprecated "#include iostream.h" inclusions. I understand that iostream.h is deprecated and should not be used, but some of the systems that this code has to run/compile on are old solaris machines running CC and do not have iostream available. My question is: how can I make my more modern g++ compiler accept the iostream.h inclusions. </p>
<p>EDIT: The compilier cannot find the iostream.h file so I am assuming that none of the .h versions of the library are available to g++. </p>
|
c++
|
[6]
|
5,280,386
| 5,280,387
|
Multiple periodic timers
|
<p>Is there any standard python module for creating multiple periodic timers.
I want to design a system which supports creating multiple periodic timers of different periodicity running in just one thread. The system should be able to cancel a specific timer at any point of time.</p>
<p>Thanks in advance for any input!</p>
|
python
|
[7]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.