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 |
|---|---|---|---|---|---|
3,611,687 | 3,611,688 | what's the difference of the three installtion packet of Kayako? | <p>what's the difference of the three installation packet of Kayko?</p>
<pre><code> fusion_stable_ioncubeclosed_4_01_179.tar.gz
fusion_stable_zendclosed_4_01_179.tar.gz
geoiplite_stable_bin_4_01_179.tar.gz
</code></pre>
<p>thank you.</p>
| php | [2] |
4,209,513 | 4,209,514 | Replace string of last two matchings | <p>How can I replace the last two matched string</p>
<p><code>string s= "{\"test\":\"value\"}";</code></p>
<p>From this string "s" I need to remove the double quotes of the value.</p>
<p>But I need generic, like the value may be any string in feature.</p>
<p>I need this to be done in <code>C#</code>.</p>
| c# | [0] |
1,574,368 | 1,574,369 | What is the difference between setting properties to the global object and the window object? | <pre><code>this.f = function() {};
window.d = function() {};
d();
f();
</code></pre>
<p>Any difference?</p>
| javascript | [3] |
65,452 | 65,453 | How to find an uncle of a tag with Jquery | <p>When I click on an anchor in an li tag, I would like to identify the index of the h3 tag that precedes it. For example, if I were to click on overview, I would like to get the index of Introduction. How would I accomplish this with Jquery?</p>
<pre><code><h3><a href="Introduction" rel="address:/Introduction">Introduction</a></h3>
<div class="navigation primary_navigation">
<ul>
<li><a href="purpose" rel="address:/purpose">Purpose</a></li>
<li><a href="overview" rel="address:/overview">Overview</a></li>
</ul>
</div>
<h3><a href="Incorporate_Learning" rel="address:/Incorporate_Learning">Incorporate Learning</a></h3>
<div class="navigation primary_navigation">
<ul>
<li><a href="appraise" rel="address:/appraise">Appraise</a></li>
<li><a href="select" rel="address:/select">Select</a></li>
<li><a href="define" rel="address:/define">Define</a></li>
<li><a href="execute" rel="address:/execute">Execute</a></li>
<li><a href="resources" rel="address:/resources">Resources</a></li>
</ul>
</div>
</code></pre>
| jquery | [5] |
2,793,468 | 2,793,469 | Visual C#, process grows until I get memory errors relating to a UserControl using a loop to draw graphics | <p>Using Visual C# 2008 Exp Edition, I've noticed that with my project loaded the process is consuming ~70,000K of memory. After a few hours this builds up to about ~500,000K.</p>
<p>At this point a <code>UserControl</code> containing a <code>PictureBox</code> (within a <code>Panel</code>) shows a memory error in Visual C# Express. The picture box contains a bitmap and grid of rectangles, drawn with <code>System.Drawing.Graphics</code>.</p>
<p>Here's the code:</p>
<p>This segement occurs just once when the <code>UserControl</code> is initialised.</p>
<pre><code>Bitmap myBitmap = new Bitmap(a, b);
Graphics g = null;
g = Graphics.FromImage(myBitmap);
g.FillRectangle(Brushes.SteelBlue, 0, 0, c, d);
//Paint Rows & Columns
for (int x = 0; x <= e - 1; x++)
{
for (int y = 0; y <= f - 1; y++)
{
g.DrawRectangle(Pens.LightBlue, g, h, i);
}
}
//Release Resources
g.Dispose();
//Add bitmap with grid to BG
ScorePictureBox.Image = myBitmap;
</code></pre>
<p>This piece of code is quite frequent:</p>
<pre><code>for (int EventIndex = 0; EventIndex <= MidiNoteDownArray.Length - 1; EventIndex++)
{
//Paint notes to grid
e.Graphics.FillRectangle(Brushes.LightBlue, j, k, l, m);
e.Graphics.DrawRectangle(Pens.Purple, o, p, q, r);
}
e.Dispose();
</code></pre>
<p>Am I not releasing resources properly? How can I do this correctly?rrect</p>
| c# | [0] |
4,454,520 | 4,454,521 | Remove spam url in text | <p>Input:</p>
<blockquote>
<p>dsfdsf www. cnn .com dksfj kdsfjkdjfdf
www.google.com dkfjkdjfk w w w . ya
hoo .co mdfdd</p>
</blockquote>
<p>Output:</p>
<blockquote>
<p>dsfdsf dksfj kdsfjkdjfdf dkfjkdjfk mdfdd</p>
</blockquote>
<p>How do I write a function that does this in C#?</p>
| c# | [0] |
2,631,280 | 2,631,281 | EditText view's text after maximum length | <p>I have an EditText for an email field. My mobile screen is really small and my email is longer than the field.</p>
<p>I want that the text advance, I mean, I want to stop reading the beginning of my email and continue reading what I'm reading.</p>
| android | [4] |
2,479,118 | 2,479,119 | Incompatible types (boolean/string) | <p>I'm trying to check if my input is a consonant. However it tells me at the line below that they are incompatible types (boolean vs String)</p>
<pre><code>if (medeklinkerGeraden = medeklinkers [r]) {
</code></pre>
<p>^</p>
<pre><code>public String medeklinkerRaden () {
String medeklinkerGeraden = "";
boolean bevatMedeklinker = false;
System.out.println("U mag een medeklinker gokken!");
medeklinkerGeraden = Input.readString();
String [] medeklinkers = {"b", "c", "d", "f", "g", "h", "j", "k", "l", "m", "n", "p", "q", "r", "s", "t", "v", "w", "x", "z"};
do {
for (int r = 0; r < medeklinkers.length; r++)
if (medeklinkerGeraden = medeklinkers [r]) {
bevatMedeklinker = true;
}
}
while (! bevatMedeklinker);
return medeklinkerGeraden;
}
</code></pre>
| java | [1] |
5,597,556 | 5,597,557 | Different Game States in Java | <p>I'm trying to make a game in Java - just a simple one for now. What is the best way to create different game states? Should I have a seperate class for each state, each with a paint() method? Also, how should I switch between the states?</p>
| java | [1] |
3,711,566 | 3,711,567 | "error: Expected a type, got 'classname'" in C++ | <p>Using the following code:</p>
<pre><code>template <typename T>
class node {
[. . .]
};
class b_graph {
friend istream& operator>> (istream& in, b_graph& ingraph);
friend ostream& operator<< (ostream& out, b_graph& outgraph);
public:
[...]
private:
vector<node> vertices; //This line
</code></pre>
<p>I'm getting:</p>
<pre><code> error: type/value mismatch at argument 1 in template parameter list for ‘template<class _Tp, class _Alloc> class std::vector’
error: expected a type, got 'node'
error: template argument 2 is invalid
</code></pre>
<p>On the indicated line. Node is clearly defined before b_graph which uses it - what have I done here?</p>
| c++ | [6] |
5,113,082 | 5,113,083 | mousedown not working | <p>With the below code, when i click and hold the <code>bid-up</code> button, it only goes through the code once and i have to click again for it to work. What it should do is it repeat the code until mouseup or mouseleave. What did i do wrong?</p>
<pre><code>$('.bid-up').live('mousedown',function() {
var button = $(this);
timeoutId = setTimeout(function(){
var number = button.parent('div').siblings('#bid-child-container-2').find('#bid-price').val();
var newnumber = number.split('.');
var on = button.attr('data-on');
button.siblings('#bid-down').attr('data-on','1');
if(newnumber[1]<9) {
var first = newnumber[0];
var second = parseInt(newnumber[1])+1;
}
if(newnumber[1]==9) {
var first = parseInt(newnumber[0])+1;
var second = 0;
}
var finalnumber = first+'.'+second;
button.parent('div').siblings('#bid-child-container-2').find('#bid-price').val(finalnumber);
}, 20);
}).bind('mouseup mouseleave', function() {
clearTimeout(timeoutId);
});
</code></pre>
| jquery | [5] |
5,079,400 | 5,079,401 | java miliseconds find closest to current time | <p>I have following code </p>
<pre><code>for(int i=0; i<a.length; i++){
diff[i] = a.getTime() - b.getTime();
}
a.getTime() = time in array.
b.getTime() = current time on computer.
</code></pre>
<p>What would be the best way to find which one of a.getTime is nearest to current time?</p>
<p>Output diff:</p>
<pre><code>-143214521
32942394
-132931
-21340
</code></pre>
<p>Thank you!</p>
| java | [1] |
1,734,194 | 1,734,195 | ixwebhosting php mail() issues with subject | <p>I encounter a very strange problem with ixwebhosting.</p>
<p>I am able to send email using the php mail() function with $subject = "test";</p>
<p>But if $subject = "testing of information send"; then i won't be able to receive any email</p>
<p>But actually "Mail sent!" was displayed in the php page.</p>
<pre><code>if (!mail($email, $subject, $body, $from)) { echo "Error Sending Email!"; }
else
{ echo "Mail sent!"; }
</code></pre>
| php | [2] |
5,117,696 | 5,117,697 | parsing error with android app | <p>I know this has been asked before, but nothing is working.</p>
<p>I have signed my app. </p>
<p>I sent the signed apk as an email attachment.</p>
<p>I click on the email attachment to install it and I get a parsing error.</p>
<p>What am I doing wrong?</p>
<p>Thanks
DeanO</p>
<p>screen shot link <a href="http://picasaweb.google.com/lh/photo/EAdwMYNAPXSoY9BU8VJRhw?feat=directlink" rel="nofollow">http://picasaweb.google.com/lh/photo/EAdwMYNAPXSoY9BU8VJRhw?feat=directlink</a></p>
| android | [4] |
1,853,905 | 1,853,906 | PHP function problem | <p>I have a php function script that is supposed to uncheck a checkbox or checkboxes if a user unchecks it when the preview button is clicked but I can only get the last
checkbox that was unchecked to stay unchecked but not the other checkeboxes how can I fix this so that all the checkboxes that where unchecked stay unchecked?</p>
<p>Here is part of my PHP function that is giving me the problem.</p>
<pre><code>if(isset($_POST['preview'])){
foreach($query_cat_id as $qci) {
if(!in_array($qci, $cat_id)){
$unchecked = $purifier->purify(strip_tags($qci));
}
}
}
for ($x = 0; $x < count($query_cat_id); $x++){
if(($query_cat_id[$x] == $cat['id']) && ($cat['id'] != $delete_id) && ($cat['id'] != $unchecked)){
echo 'checked="checked"';
}
}
</code></pre>
| php | [2] |
3,292,071 | 3,292,072 | Track file request referrer | <p>I've got a file on server, for example "file.txt". It may be requested from different domains. </p>
<p>Is there any way to track from wich domain this file was requested and save this data somewhere?</p>
<p>Thank you.</p>
| php | [2] |
382,586 | 382,587 | PHP finding the expired time in seconds | <p>Let say we have start date and end date</p>
<pre><code> if (isset($_POST['start_date']))
$_POST['start_date'] = gmdate('Y-m-d H:i:s', strtotime($_POST['start_date']));
if (isset($_POST['end_date']))
$_POST['end_date'] = gmdate('Y-m-d H:i:s', strtotime($_POST['end_date']));
</code></pre>
<p>would <code>$_POST['end_date'] - $_POST['start_date']</code> give you the expired time in seconds?</p>
| php | [2] |
3,381,858 | 3,381,859 | Export data to Excel with PHP | <p>I want to ask something. I have little problem with PHP.</p>
<p>I want to export my database to excel without phpmyadmin but with PHP.</p>
<p>Anyone can help me?</p>
| php | [2] |
3,785,503 | 3,785,504 | How to infer subtype in supertype | <p>Say you have a super-class. In that super class you want to pass runtime object of itself (<code>this</code>) as a parameter to an overloaded method. Trick is, this overloaded method is overloaded by sub-class type. When you try to do it, you'll get a </p>
<blockquote>
<p>method ... is not applicable(actual argument
... cannot be converted to ... by method invocation
conversion)</p>
</blockquote>
<p>Instead you would need to implement the method separately in each subtype (just to get the correct runtime class), which is a lot of duplicate effort when the contents of the method are identical. </p>
<p>e.g:</p>
<pre><code>public class InferTypeTest {
public static void main(String[] args) {
SubClass1 s1 = new SubClass1();
s1.sayHi();
}
public static void sayHi(SubClass1 clz) {
System.out.println("clz 1");
}
private abstract static class SuperClass{
public void sayHi() {
InferTypeTest.sayHi(this);
}
}
private static class SubClass1 extends SuperClass{
}
}
</code></pre>
| java | [1] |
4,417,840 | 4,417,841 | passing a function as a parameter? | <p>Here is my event and as you can see I want to send a function with it as a parameter.</p>
<pre><code>onclick="deleteItems('image', 'size', function(){GetImageSize();})"
</code></pre>
<p>The delete function is in a js file. In my js file I want to call my GetImageSize() function.</p>
<pre><code>var deleteItems = function(module, controller, callback) {
callback(); // ??????????
}
</code></pre>
<p>I want to do this so I can rebuild my table when my ajax call has finished.</p>
<p>Hope you guys can help me</p>
<p>Regards Örvar</p>
| javascript | [3] |
1,827,683 | 1,827,684 | Feeding all textbox on the basis of the value of first textbox jquery | <p>Hello I have many textbox with class "price",
All i want to do is feed all other textbox with the same value as the first textbox. here is my code but its not working.</p>
<pre><code>$firstprice=$("."+$sectionwrapper).find(".price").first().val();
$("."+$sectionwrapper).find(".price:eq(0)").nextAll(".price").val($firstprice);
</code></pre>
<p>where am i going wrong? any help will be appreciated.</p>
<p><strong>Edit</strong></p>
<p>Here is my HTML Code</p>
<pre><code><div class="section-1">
<div id="bookin-ad-wrapper">
<div class="booking-wrapper booking-wrapper-5">
<ul>
<li><label class="w50">Pris kr</label><input type="text" value="" class="price numeric required" name="txtSection[1][5][price]" style=""></li>
</ul>
</div>
<div class="booking-wrapper booking-wrapper-6">
<ul>
<li><label class="w50">Pris kr</label><input type="text" value="" class="price numeric required" name="txtSection[1][6][price]"></li>
</ul>
</div>
<div class="booking-wrapper booking-wrapper-0">
<ul>
<li><label class="w50">Pris kr</label><input type="text" value="" class="price numeric required" name="txtSection[1][0][price]"></li>
</ul>
</div>
</div>
</div>
</code></pre>
<p><strong>$sectionwrapper denotes class "section-1"</strong></p>
<p>Thanks</p>
| jquery | [5] |
3,688,131 | 3,688,132 | keybd_event | <p>I need the key code for <code>ctrl+alt+del</code> in c#,
for example </p>
<pre><code>const int KEYEVENTF_KEYUP = 0x2;
const int KEYEVENTF_KEYDOWN = 0x0;
keybd_event(0x11, 0, KEYEVENTF_KEYDOWN, 0);
keybd_event(0x41, 0, KEYEVENTF_KEYDOWN, 0);
keybd_event(0x11, 0, KEYEVENTF_KEYUP, 0);
keybd_event(0x41, 0, KEYEVENTF_KEYUP, 0);
</code></pre>
<p>this is the code for <code>ctrl+a</code>.</p>
| c# | [0] |
2,953,749 | 2,953,750 | how to split strings and bind them as header for gridview | <p>I have a string list:</p>
<pre><code>List<string> rows = new List<string>();
</code></pre>
<p>Now, rows has data like this:</p>
<pre><code>countryname~population
india~12,211
china~23,22,223
usa~45,454
japan~34,343,232
</code></pre>
<p>I need to bind this data in gridview like countryname, and population as header for gridview</p>
<pre><code>countryname population
india 12,211
china 2322223
usa 45454
japan 34343232
</code></pre>
<p>any help would be
great thank you</p>
| c# | [0] |
5,934,258 | 5,934,259 | Shake Gesture isn't working in iPhone 4, Don't know why...? | <p>I have developed an iPhone app which uses Shake Gesture to rotate the wheel of picker view. I am using IOS 3.2 as base sdk. I have a iPhone 3GS which is updated with IOS 4.0, when I execute my App in this 3GS phone it is working properly with Shake Gesture. but when I run it in iPhone 4 the Shake Gesture doesn't respond. I am not getting the reason of it, if anybody is having the Solotion please help me out... Below i am providing a code part which i hv used to handle Shake Gesture....</p>
<pre><code>#define kRowMultiplier 20
#define kAccelerationThreshold 2.2
#define kUpdateInterval (1.0f/10.0f)
(void) accelerometer:(UIAccelerometer*)accelerometer didAccelerate: UIAcceleration*)acceleration{
if (fabsf(acceleration.x) > kAccelerationThreshold || fabsf(acceleration.y) > kAccelerationThreshold || fabsf(acceleration.z) > kAccelerationThreshold) {
[progressView startAnimating];
if (! isSpinning)
{
if(!btnRegion.selected && !btnFlavor.selected && !btnPrice.selected)
{
// Need to have it stop blurring a fraction of a second before it stops spinning so that the final appearance is not blurred.
[self stopBlurring];
wheelingTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(shufflePickerView) userInfo:nil repeats:YES];
}
else
{
[self shufflePickerView];
[self performSelector:@selector(stopBlurring) withObject:nil afterDelay:2.7];
}
}
isSpinning = YES;
}
}
</code></pre>
<p>is sumthing wrong in code... Can I test it by Simulator on IOS 4.0 or i need to hv a iPhone 4 only...?</p>
| iphone | [8] |
2,227,879 | 2,227,880 | local variables in a function | <p>I know that variables are properties of other objects. For example:</p>
<pre><code>var myVar = 'something';
</code></pre>
<p>is a property of the <em>window</em> object (if it is in the global scope of course).</p>
<p>if I want to find the variable's object, I just use the <em>this</em> variable. But:</p>
<pre><code>function f() {
var myVar2 = 'something';
}
</code></pre>
<p>Which object does <em>myVar2</em> belongs to? (<em>myVar</em> belongs to <em>window</em> object, but what about <em>myVar2</em>?)</p>
<p>I would like to know that, thanks.</p>
| javascript | [3] |
1,457,229 | 1,457,230 | Console application not doing anything | <p>basically I would like to write an application to perform this in command prompt:</p>
<p><code>sslist -H -R -h s234.ds.net /mobile > listofsnapshot.txt</code></p>
<p>then this is my code when i create a c# console application:</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Search
{
class Program
{
static void Main(string[] args)
{
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName = "sslist.exe";
p.StartInfo.Arguments = "-H -R -h s234.ds.net /mobile";
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
p.Start();
string procOutput = p.StandardOutput.ReadToEnd();
string procError = p.StandardError.ReadToEnd();
TextWriter outputlog = new StreamWriter("C:\\Work\\listofsnapshot.txt");
outputlog.Write(procOutput);
outputlog.Close();
}
}
}
</code></pre>
<p>why when i execute my console script, it just hangs there and not do anything?</p>
| c# | [0] |
665,150 | 665,151 | dealing with a quiz script, need to calculate results via php, having problems with searching $_POST's | <p>On this system a user can create a quiz of any number of questions, that info saves to a database. I'm using the below to output the quiz to the users. This outputs fine and you can only choose one of each answer. Each question has 3 inputs with the same post name, q1 has ans1 ans1 ans1, q2 has ans2ans2 ans2 etc... thats where the ".$x." comes in.</p>
<pre><code> $x = 1;
while($row = mysql_fetch_row($quiz)) {
echo "Question ".$x.": ";
echo "<a><b> $row['question'] </b></a>";
echo "<input type='radio' name='ans".$x." /> ".$row['ans1']."<br />";
echo "<input type='radio' name='ans".$x." /> ".$row['ans2']."<br />";
echo "<input type='radio' name='ans".$x." /> ".$row['ans3']."<br />";
$x = $x + 1;
}
</code></pre>
<p>The problem is in the next php page. I'm trying to loop through all posts and where the post matches the correct ans then result = result + 1. I need a loop that does something like this:</p>
<pre><code>$x = 1;
while($row = mysql_fetch_row($quiz)) {
if ($_POST[ans[$x]]=='$row['correct']' { $result = $result + 1;
}
$x = $x + 1;
}
</code></pre>
<p>is there a way i can use a variable in that $_POST value to say ans1 ans2 for each loop?</p>
| php | [2] |
543,646 | 543,647 | How can I check the Image is Touched using OnTouch() | <p>I am trying to get the x,y co-ordinates on Touch of Image and on that I want to perform some action. So, can anyone tell me how to get the x,y co-ordinates of Image when it is touched. Thanks In Advance.</p>
<p><strong>My Code -</strong> </p>
<pre><code>public class MovableObject extends ImageView implements OnTouchListener{
Bitmap myBmp;
Paint myPaint = new Paint();
int MoveX = 0;
public MovableObject(Context context,int moveObject,Bitmap myBmp) {
super(context);
super.setClickable(true);
this.myBmp = myBmp;
myPaint.setColor(Color.WHITE);
this.MoveX = moveObject;
setOnTouchListener(this);
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawBitmap(myBmp, MoveX, 100, myPaint);
}
@Override
public boolean onTouch(View v, MotionEvent event) {
switch (event.getAction() & MotionEvent.ACTION_MASK) {
case MotionEvent.ACTION_DOWN:
System.out.println("down...."+event.getX()+" "+event.getY());
case MotionEvent.ACTION_MOVE:
}
return true;
}
}
</code></pre>
<p><strong>By this I am getting the x,y co-ordinates where I click but I want to get the x,y when I click on my Image.</strong></p>
| android | [4] |
3,626,146 | 3,626,147 | How to move the uiview part of the screen from right to left using CATransition | <p>I am developing one application.In that i want to move the uiview from right to left using below code.</p>
<pre><code>-(void)centerAnimation1:(id)sender
{
theview=qstnview;
CATransition *animation = [CATransition animation];
animation.delegate = self;
[animation setDuration:0.4];
[animation setType:kCATransitionMoveIn];
if(rhtolft)
{
[animation setSubtype:kCATransitionFromLeft];
}
else
{
[animation setSubtype:kCATransitionFromRight];
}
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
//[animation setanima]
[[theWindow layer] addAnimation:animation forKey:@"SwitchToView1"];
[[theview layer] addAnimation:animation forKey:@"SwitchToView1"];
[qstnview removeFromSuperview];
}
- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag{
if(animate)
{
CATransition *animation = [CATransition animation];
animation.delegate = self;
[animation setDuration:0.4];
[animation setType:kCATransitionMoveIn];
if(rhtolft)
{
[animation setSubtype:kCATransitionFromLeft];
rhtolft=NO;
}
else
{
[animation setSubtype:kCATransitionFromRight];
}
//[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];
//[animation setanima]
[[theview layer] addAnimation:animation forKey:@"SwitchToView1"];
[self.view addSubview:qstnview];
}
}
</code></pre>
<p>But this one is moving the view from right side last edge to left side.But i need to move within the frame size only.I dont need to start from right side edge.So please tell me how to do that one.</p>
| iphone | [8] |
831,407 | 831,408 | .remove does not work out - jQuery | <p>I am trying to remove an id, and .live is necessary, the code is below</p>
<pre><code>$('.TS').live('click',function() {
("#"+$(this).attr('id')).remove();
});
</code></pre>
<p>The error got from chrome</p>
<p>Uncaught TypeError: Object #first has no method 'remove'</p>
<p>I tried removeId, but the above error message.</p>
<p>Appreciate all help</p>
<p>Thanks
Jean</p>
| jquery | [5] |
2,607,165 | 2,607,166 | Parameter passed by const reference returned by const reference | <p>I was reading C++ Faq Second Edition , faq number 32.08 . </p>
<p>FAQ says that parameter passed by const reference and returned by const reference can cause dangling reference.</p>
<p>But it is ok if parameter is passed by reference and returned by reference.</p>
<p>I got it that it is unsafe in case of const reference but how is it safe in case when parameter is non const reference.</p>
<p>Last line of FAQ says
"Note that if a function accepts a parameter by non-const reference (for example, f(string& s)), returning a copy of this reference parameter is safe because a temporary cannot be passed by non-const reference."</p>
<p>Need some insight on this!!</p>
| c++ | [6] |
1,870,079 | 1,870,080 | c# from windows service to desktop application | <p>can someone tell me and also give me a short example of how could i make a bridge from a windows service to a c# console application (form application) project? i would need a short example. What should i write in the start, continue and stop methods that windows service has?</p>
<p>EDIT</p>
<p>I have a c# project. i just want to run it from a windows service using a brige..or somthing. i know communication between sessions is not possible</p>
| c# | [0] |
203,848 | 203,849 | Execute function when enter is pressed if textbox has focus | <p>Is it possible to execute a function by pressing the enter key on the keyboard only if a certain textbox has focus. i.e. if any other textbox has focus or no textbox has focus, the enter key should do nothing.</p>
| jquery | [5] |
4,871,200 | 4,871,201 | Why does my function call not print out what it's supposed to? | <pre><code>class A:
def __init__(self, blocking, b = None):
self.blocking = blocking
def printerthing(self):
print "hi this is a test"
a = A(True)
a.printerthing
print("5")
</code></pre>
| python | [7] |
5,647,682 | 5,647,683 | Detect type of object in ArrayList | <p>I'm attempting to make a class that will convert ArrayLists of objects into ArrayLists of other objects. i.e.</p>
<pre><code>ArrayList<Foo> convert(ArrayList<Bar> input){
//conversion logic
}
ArrayList<Bar> convert(ArrayList<Foo> input){
//conversion logic
}
</code></pre>
<p>Unfortunately Java doesn't want to have two functions with the same name and what it believes to be the same inputs and outputs.</p>
<p>I'm attempting to go a different route. Instead of multiple functions with the same name, I want to make one function that accepts an ArrayList, determines which type of object is inside, does the proper conversion, and returns an ArrayList:</p>
<pre><code>ArrayList convert(ArrayList input){
//conversion logic for Foo
//conversion logic for Bar
}
</code></pre>
<p>Is something like this possible?</p>
| java | [1] |
1,831,124 | 1,831,125 | draggable element color changed back when refreshing | <p>The draggable elememnt color will be changed to #DF2525 when stop dragging. But the color is changed back to original one when page is refresh. I want color won't be changed back when refreshing.
Is there anyone know solution? Thanks in advance. </p>
<p>$(function() {</p>
<pre><code> $( "#draggable" ).draggable({
stop: function(){
var position = $(this).position();
$(this).css({"color":"#ff00ff","background":"#DF2525"});
}
});
});
<div class="demo">
<div id="draggable" class="ui-widget-content">
<p>Drag</p>
</div>
</div>
</code></pre>
| jquery | [5] |
4,876,020 | 4,876,021 | Script used to delay load until scrolled | <p>I am using lazy load and I am successful in using it to make images load when the user scrolls and its not hard it is done just by adding a class named as 'lazy' to the img tag and you are done.
But now I have something that I want to lazyload it is a part of area which is in footer, I want it to load only when the user scrolls, I applied the lazy class to the span of it but it didn't work.
Can someone tell me how can it be done?
here is a test page <a href="http://bloghutsbeta.blogspot.com" rel="nofollow">http://bloghutsbeta.blogspot.com</a> where you can see the footer, the area that I want to load lazily is the one that reads as "Share and be a rainbow in someone else cloud"
What could be done?</p>
| javascript | [3] |
4,019,860 | 4,019,861 | How to get subdirectories | <p>I have a string directory that equals a given directory. I want to cycle through that folder and all sub folders of directory. How would I be able to do that?</p>
| c# | [0] |
4,961,518 | 4,961,519 | NetworkOnMainMainThreadException error for Authorization class in Twitter App | <p>Hi am developing Twitter App in android am getting some error like unable to resume AuthorizationActivity and android.os.NetworkOnMainMainThreadException. And also HttpClient exception. I have put both secret key and consumer key in oauth.properties but still couldn't solve. Can anyone help in this plz..</p>
<pre><code>import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebView;
import android.webkit.WebViewClient;
public class AuthorizationActivity extends Activity
{
private OTweetApplication app;
private WebView webView;
private WebViewClient webViewClient = new WebViewClient()
{
@Override
public void onLoadResource(WebView view, String url)
{
//the URL we are looking for looks like this:
//http://otweet.com/authenticated?oauth_token=1234567890qwertyuiop
Uri uri = Uri.parse(url);
if(uri.getHost().equals("otweet.com"))
{
String token = uri.getQueryParameter("oauth_token");
if( null != token)
{
webView.setVisibility(View.INVISIBLE);
app.authorized();
finish();
}else
{
//tell user to try again
}
}else
{
super.onLoadResource(view, url);
}
}
};
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
app = (OTweetApplication)getApplication();
setContentView(R.layout.authorization_view);
setUpViews();
}
@Override
protected void onResume()
{
super.onResume();
String authURL = app.beginAuthorization();
webView.loadUrl(authURL);
}
private void setUpViews()
{
webView = (WebView)findViewById(R.id.web_view);
webView.setWebViewClient(webViewClient);
}
}
</code></pre>
| android | [4] |
1,526,923 | 1,526,924 | Launching windows C# application after installing it | <p>I have C# windows cs project. The application enables opening word documents and pictures as well and storing them in MS Access database. I made a setup and it installs well on computers where Visual Studio 2008 is installed, but when I install it on a computer with no VS installed, it installs and after that it doesn't starts to run.
I can not run it.</p>
<p>Some other C# projects I made can be installed and run without problems on the same computers on which this application doesn't start.</p>
<p>Can anybody help me please what could be my problem?
Thank you in advance</p>
| c# | [0] |
4,916,934 | 4,916,935 | dynamic class method call chaining by array values | <p>For example I have class <strong>MyClass</strong>:</p>
<pre><code>Class MyClass {
public function method_1() {
return $this;
}
public function method_2() {
return $this;
}
public function method_n() {
return $this;
}
}
</code></pre>
<p>And I have array of functions and their arguments:</p>
<pre><code>$array = array(
'method_1' => array(
'0' => 'first_argument',
'1' => 'second_argument',
'2' => 'nth_argument',
),
'method_2' => array(
'0' => 'first_argument',
'1' => 'second_argument',
'2' => 'nth_argument',
),
);
</code></pre>
<p>How to call <code>MyClass</code> methods from the array in chain?</p>
<pre><code>$result = $my_class->$array['method_1']($array['method_1'][0], $array['method_1'][0])
->$array['method_1']($array['method_2'][0], $array['method_2'][0])
->$array['method_n']($array['method_n'][0], $array['method_n'][0]);
</code></pre>
<p>For example:</p>
<pre><code>foreach($array as $function => $args) {
// build chain here and execute after foreach
}
</code></pre>
<p>So, main question is how to call unlimited and unknown number of class functions with arguments in chain? Thanks!</p>
| php | [2] |
55,835 | 55,836 | putting some class methods in different .cc file | <p>I have a bit of code of the following format contained in a single .h and .cc file:</p>
<p>myClass.h:</p>
<pre><code>#ifndef MYCLASS_H
#define MYCLASS_H
class myClass
{
public:
myClass(); // constructor
~myClass(); // destructor
void classMethod1 ();
void classMethod2 ();
int memberVarable1;
int memberVariable2;
};
#endif
</code></pre>
<p>and myClass.cc:</p>
<pre><code>#include "myClass.h"
myClass::myClass(){
// stuff
}
myClass::~myClass(){
// stuff
}
void myClass::classMethod1 (){
// stuff
}
void myClass::classMethod2 (){
// stuff
}
</code></pre>
<p>All of this is working fine. However my project is getting quite large and I'm about to add a set of new functionality. Instead of clogging up myClass.h and myClass.cc I want to put some new methods in another .cc file. I don't seem to be able to get this to work though.</p>
<p>myClass.h:</p>
<pre><code>#ifndef MYCLASS_H
#define MYCLASS_H
#include "secondFile.h"
class myClass
{
public:
myClass(); // constructor
~myClass(); // destructor
void classMethod1 ();
void classMethod2 ();
int memberVarable1;
int memberVariable2;
};
#endif
</code></pre>
<p>and myClass.cc:</p>
<pre><code>#include "myClass.h"
#include "secondFile.h"
myClass::myClass(){
// stuff
}
myClass::~myClass(){
// stuff
}
void myClass::classMethod1 (){
// stuff
}
void myClass::classMethod2 (){
// stuff
}
</code></pre>
<p>secondFile.h:</p>
<pre><code>#ifndef SECONDFILE_H
#define SECONDFILE_H
void someNewMethod();
#endif
</code></pre>
<p>secondFile.cc</p>
<pre><code>#include "secondFile.h"
void someNewMethod(){
// can't see classMethod1()
}
</code></pre>
| c++ | [6] |
866,443 | 866,444 | Creating python script for HPQC: Setting filter properties | <p>I have created a python script to connect to HPQC and get the bugs. I am trying to limit the amount of bugs I get by setting the Filter from the BugFactory. This is proving difficult to do, the documentation says that I need to set the properties like so</p>
<pre><code>bugFactory = td.BugFactory
bugFilter = bugFactory.Filter
bugFilter.Filter("BG_STATUS") = "Open Or New Or In Progress Or Pending Retest"
</code></pre>
<p>when I do this I get this error from python:</p>
<pre><code>bugFilter.Filter("BG_STATUS") = "Open Or New Or In Progress Or Pending Retest"
SyntaxError: can't assign to function call
</code></pre>
<p>how can I set these properties?</p>
| python | [7] |
1,121,696 | 1,121,697 | Converting special characters to generic equivalents (PHP) | <p>Is there an efficient way to convert special entities (such as &mdash) to its logical generic equivalent (such as -)? The manual states that I can convert the actual character to its html entity, but this is going in the opposite direction. It's important to be able to switch out the entity for something generic. Another example.. &rdquo would become a simple " in this so far fictitious function. </p>
<p>Helpz? </p>
| php | [2] |
1,960,272 | 1,960,273 | C# - How do I cancel a region property? | <p>I have</p>
<pre><code>label1.Region = MyRegion;
</code></pre>
<p>Now I want to cancel it. How do I do that?
Thanks.</p>
| c# | [0] |
797,906 | 797,907 | How to pass array data to jQuery dialog and display? | <p>Hello I am trying to pass array data into the jquery dialog box and display. I haven't had much luck with this and Im guessing my whole approach to this is wrong. Any guidance to the right way is much appreciated.</p>
<pre><code><html>
<div id="confirm"></div>
</html>
<script>
var array_data = ["London", "NewYork", "Miami" , "LosAngeles"];
$('#confirm').html(array_data).dialog({
autoOpen: false,
modal: true,
title: 'Confirmation message',
buttons: {
Submit: function () { //Do Something here };
Cancel: function () { $(this).dialog("close"); }
},
width: 850, height: 300
}).dialog('open');
</script>
</code></pre>
<p>I'm unable to figure out how I would pass the array object to the modal and then print out the array values one by one.</p>
| jquery | [5] |
2,323,245 | 2,323,246 | fixed size C-style arrays in class declarations | <p>I've come across a bit of code which essentially looks like this:</p>
<pre><code>#include<iostream>
// in a header file
class xxx{
public:
xxx() { xxx_[0]=0; xxx_[1]=0; xxx_[2]=0;}
double x0() const {return xxx_[0];}
private:
double xxx_[3]; // ???
};
// in the main.cpp
int main(){
xxx x;
std::cout<<x.x0()<<"\n";
}
</code></pre>
<p>The question is --- is declaring as a class member an array of fixed size is really allowed by the standard?</p>
| c++ | [6] |
288,964 | 288,965 | PHP header('Location: '); problem on certain servers on our company network | <p>I have tried:</p>
<pre><code>header('Location: http://www.google.com/');
die();
</code></pre>
<p>It works on Godaddy and fails on both Ipage and Startlogic on my network at work using FireFox,IE and Chrome. They work at the Public Library on all three servers using Firefox. The person doing our IT thinks it might be a cisco conflict, but has been unable to resolve it.</p>
<p>Is this a common enough problem I should avoid PHP 302 redirects</p>
<p>Any ideas on how to resolve this. </p>
<p>** I added to a comment below and should have had it up here<br>
"Is there a better term than hangs. Anyway it hangs whenever I execute a script without output."<br>
Godaddy works fine the other two will keep going and going until they time out</p>
| php | [2] |
4,460,082 | 4,460,083 | How to binding image to repeater control from sql server image field in asp.net? | <p>i am storing the images into database directly. Now i want to bind the repeater control to the database's image field. I want to load all the images from the database.</p>
| asp.net | [9] |
5,651,752 | 5,651,753 | Javascript - Get position of the element of the array | <p>For instance, a variable named arrayElements of array type contains [1,2,3,4].</p>
<p>How do i get the position of which that has the value "3" in the array variable besides using loop?</p>
<p>thanks.</p>
| javascript | [3] |
5,714,799 | 5,714,800 | How can I calculate log base 2 in c++? | <p>Here is my code.</p>
<pre><code>#include <iostream>
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include <cmath>
#include <functional>
using namespace std;
void main()
{
cout<<log2(3.0)<<endl;
}
</code></pre>
<p>But above code gives error. Error code is : error C3861: 'log2': identifier not found.
How can i calculate log2 using c++?</p>
| c++ | [6] |
5,380,479 | 5,380,480 | How to do Android's DigitalClock show the date? | <p>When the mobile screen locks, its shown a time and date widget.
I'm trying to how it using DigitalClock, but I can show only time.
Any idea how to show date either (with this or other built-in widget)?</p>
<p>--update</p>
<p>I found some pages talking about alternatives to Android Calendar, but I don't find Android Calendar widget nowhere..</p>
| android | [4] |
3,082,215 | 3,082,216 | Wrong values when reading integers from file | <p>I asked a similar question some weeks ago, but I got stuck, and didn't really know if I didn't make any other mistakes. </p>
<p>I can relatively clearly tell what I am fighting with now.</p>
<p>I am trying re-write a VB6 function in C++.
The difficult line is this one:</p>
<pre><code>vector<int>vIntegerValues;
vIntegerValues.resize(iCountIntegers);
fseek(iReadFile, uFromBytePos * sizeof(int), SEEK_CUR);
size_t readElements = fread(&vIntegerValues[0], sizeof(int), iCountIntegers, iReadFile);
</code></pre>
<p>My VB6 version is this:</p>
<pre><code>Dim vIntegerValues() As Integer
ReDim vIntegerValues(0 To iCountIntegers)
Get #iReadFile, uFromBytePos, vIntegerValues()
</code></pre>
<p>However the C++ function fills up the integer vector with data that is not as expected.</p>
<p>For example in VB6 the first values are:
0,0,2,2,0,-2,0,-2,0,2,0,0,-2,</p>
<p>And in C++ the first values are
131074, -131072, -131072, 131072, 0, 65534</p>
<p>Can somebody help when he sees where I go wrong?
Thank you very much.</p>
<p>ps: I don't know in advance what the size of the vector vIntegerValues will be, so please do not suggest anything with a fixed vector. This is where I would get stuck.</p>
| c++ | [6] |
6,028,623 | 6,028,624 | Checking redirect in PHP before actioning | <p>Is there a way to check if the server responds with an error code before sending a user there?</p>
<p>Currently, I am redirecting based on user editable input from the backend (client request, so they can print their own domain, but send people elsewhere), but I want to check if the URL will actually respond, and if not send them to our home page with a little message.</p>
| php | [2] |
3,874,199 | 3,874,200 | should every element with runat=server have an id attribute? | <p>I have inherited an asp.net website to maintain</p>
<p>when looking at the aspx page, almost every element with runat=server don't have id attribute defined.</p>
<p>should I go through every element and add one? </p>
| asp.net | [9] |
4,751,480 | 4,751,481 | foreach in C# recalculation | <p>If I write a foreach statment in C#:</p>
<pre><code>foreach(String a in veryComplicatedFunction())
{
}
</code></pre>
<p>Will it calculate veryComplicatedFunction every iteration or only once, and store it somewhere?</p>
<p>Please answer this question if you really KNOW the answer.</p>
| c# | [0] |
1,188,865 | 1,188,866 | When using Robotium in android for unit testing how to take run time data from server? | <p>I an using Robotium-solo for android unit testing and I want to take data from web-server how can I do this run time and make some test cases for this, like I have data or not. Please help me to solve this out I really stuck in this..
Thanks.</p>
| android | [4] |
2,563,049 | 2,563,050 | flicking for MainForm | <p>I have login form and a mainForm.</p>
<p>After loading MainForm, it will be hidden and load the LoginForm. If the user enters correct authentication then the loginForm will be disposed and the MainForm is shown. But the mainForm got flicks for the first time loading for several seconds.</p>
<p>I am implementing in C#.</p>
<p>How can I avoid this flicks? </p>
<p>Thanks in advance</p>
| c# | [0] |
4,276,911 | 4,276,912 | Gtk loop or Cron for timer | <p>Well, I have created a python script, which checks the number of uncompleted tasks of tasque and displays it using pynotify periodically. My question is how do I implement this timer. I can think of two things. A Cron job to execute a python script periodically or using a python script which uses a gtk loop to call the specified function for checking periodically.</p>
| python | [7] |
323,806 | 323,807 | back page and next page again with values still intact in edittext | <p>Im wondering is there any method where i can use to have the same values display on the edittext after the application goes to previous page and back to the orignal page?</p>
<p>e.g in Page 1, the user pressed next page button and it goes to page 2, users key in some values in edittext. From page 2, i implemented onBackPressed(), therefore when the user goes back to page 1 the values on edittext is on where they are suppose to be. </p>
<p>here comes my question, when the user goes back to page 2 the values that will previously enter in the edittext are gone.</p>
<p>This the method i implemented on page 1 that enables users to goes to page 2</p>
<pre><code>public void nextPage(View view) {
variables vb = new variables();
Intent intent_next = new Intent(this,
Display_form_personal_details2.class);
startActivity(intent_next);
</code></pre>
<p>This the method i implemented on page 2 that enables users to goes to page page 1</p>
<pre><code>public void previousPage (View view){
Intent intent_previous = new Intent (this, Display_form_personal_details.class);
onBackPressed();
}
</code></pre>
| android | [4] |
885,871 | 885,872 | How to assign property under functions? | <p>I am trying to assign the property under a function. I have</p>
<pre><code>test.prototype.getName = function(){
var myself=this;
//ajax callback function
call.callback = function(obj){
//I want to assign returned ajax obj to test property.
myself.testName=obj;
}
}
test.prototype.build = function(){
this.getName();
console.log(this.testName)//undefined...
}
test.build();
</code></pre>
<p>How do I get the this.testName shown in my build function? Thanks a lot!</p>
| javascript | [3] |
467,677 | 467,678 | Javascript loop giving me problems | <p>I want to extract only groups from this string</p>
<p>I want to have something like in alert "group1,group2"
but it returns empty.</p>
<pre><code>var phone_nos = "group1,group2,564774890900";
var recipients = phone_nos.split(",");
for( var i=0; i<recipients.length; i++ )
group =recipients[i].substring(0,5)
{ if (group=="group")
{groups.push(recipients)}
}
alert(groups.join(","))
</code></pre>
| javascript | [3] |
4,138,457 | 4,138,458 | How to use timer in C#? | <p>I want my function to be executed every 2 seconds to check if there is any new user so that I could make a new log for them. This is in console application so i used Thread. But my console shut down after it run the function once. I am expecting the timer to run as long as I am running the console and my createLog function will be executed every 2 seconds. I am relatively new to C# so maybe my concept of timer is completely wrong. Please help...</p>
<pre><code>namespace ConsoleApplication1
{
class Program
{
public static Hashtable clientsList = new Hashtable();
static void Main(string[] args)
{
Timer t = new Timer(createLog, null, 0, 2000);
IPAddress ip = IPAddress.Parse("127.0.0.1");
TcpListener serverSocket = new TcpListener(ip, 9888);
TcpClient clientSocket = default(TcpClient);
int counter = 0;
serverSocket.Start();
.... //this main is monitoring the network....
console.read();
}
private static void createLog(object state)
{
//this function checks the database and if there is new user it will create a new text file for he/she.
}
}
</code></pre>
| c# | [0] |
2,986,923 | 2,986,924 | How to implement expandable view (window shade) in Android? | <p>Does anybody know how to implement an expandable view which behaves like the status bar?
I've seen it in many apps, so I assume it's not too difficult :)</p>
| android | [4] |
3,350,679 | 3,350,680 | Write to internal storage - File is empty | <p>I'm trying to write text files to internal storage in many ways. I don't know why the result text files are empty.</p>
<pre><code>package com.testandroid;
public class TestAndroidActivity extends Activity {
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
writeToInternalStorage(this);
}
private void writeToInternalStorage(final Context context) {
try {
// Way1
final PrintWriter writer = new PrintWriter(new File("/data/data/com.testandroid/test.txt"));
writer.println("Something");
// Way2
final PrintWriter writer2 = new PrintWriter(new FileOutputStream("/data/data/com.testandroid/test2.txt"));
writer2.write("Something more");
// Way3
final FileOutputStream fos = openFileOutput("test3.txt", Context.MODE_PRIVATE);
final PrintWriter writer3 = new PrintWriter(fos);
writer3.write("Something of something");
try {
fos.close();
} catch (final IOException e) {
e.printStackTrace();
}
// Way4
try {
final BufferedWriter writer4 = new BufferedWriter(new FileWriter(new File("/data/data/com.testandroid/test4.txt")));
writer4.write("Something please");
} catch (final IOException e) {
e.printStackTrace();
}
} catch (final FileNotFoundException e1) {
e1.printStackTrace();
}
}
}
</code></pre>
| android | [4] |
3,028,185 | 3,028,186 | set cursor on empty tag | <p>I'm writing text editor, with some special formatting features, using iframe in design mode. I got a problem when setting cursor position in empty element, e.g.:</p>
<pre><code><p></p>
</code></pre>
<p>i want to set cursor, so when user continued typing text appeared between <code><p></code> tags.
Here is my code:</p>
<pre><code><iframe id="editor"></iframe>
$(document).ready(function() {
var iframe = $('#editor').contents().get(0);
var iwin = $('#editor')[0].contentWindow;
iwin.document.designMode = "on";
$('body', iframe).html('<p>ppp1</p><p></p><p>ppp3</p>');
$('#editor').focus();
var start = $('p', iframe)[1];
var rng = $('#editor')[0].contentDocument.createRange();
rng.setStart(start, 0);
rng.setEnd(start, 0);
var sel = iframe.getSelection();
sel.removeAllRanges();
sel.addRange(rng);
});
</code></pre>
<p><strong>JsFiddle</strong>: <a href="http://jsfiddle.net/xbit/MGaTf/3/" rel="nofollow">http://jsfiddle.net/xbit/MGaTf/3/</a></p>
| javascript | [3] |
804,978 | 804,979 | iphone multiple image loding | <pre><code>NSString *urlVal = @"http://at.azinova.info/green4care/iphone/viewImage.php?id=";
NSString *urlVal1 = [urlVal stringByAppendingString:selectedCountryw];
NSURL *url1 = [NSURL URLWithString:urlVal1];
NSString *resultString = [NSString stringWithContentsOfURL:url1 encoding:NSUTF8StringEncoding error:nil];
NSMutableArray *arycountries2 = [resultString componentsSeparatedByString:@"#***#"];
arraycountries = [[NSMutableArray alloc]initWithArray:arycountries2];
</code></pre>
<p>i want to display the image url(resultstring) to a tableview.i refer three20 and lazytable.but it didnot work for me.tableview code given below</p>
<pre><code>- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [arraycountries count];
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.imageView.image = [UIImage imageNamed:[arraycountries objectAtIndex:indexPath.row]];
return cell;
}
</code></pre>
<p>plese help me </p>
| iphone | [8] |
4,648,905 | 4,648,906 | How to give an alert in the mobile browser? | <p>When we try to open an attachment file from the mail, the desktop browser asks to save / open the file. As like that I need to do in the android mobile browser. How it's possible to ask a question in the mobile browser at the time of open an attachment file (*.ics)? Can anyone help me to develop an application for this ???</p>
| android | [4] |
4,417,978 | 4,417,979 | how to compare Stringbuffer object and String object | <p>how to compare sb and s</p>
<pre><code>StringBuffer sb= new StringBuffer("Hello");
String s= "Hello";
</code></pre>
<p><code>s.equals(sb.toString())</code> is giving result as <strong>false</strong>.</p>
| java | [1] |
3,695,055 | 3,695,056 | Python, asyncore, asynchat, error on Python 2.7.3 Mac ONLY Bad file descriptor | <p>I got a crash error when I try to force to disconnect user from my custom Python server.
I'm using asyncore and asynchat class.</p>
<p>But when I want to force the disconnection like this</p>
<pre><code>asynchat.async_chat.close (self)
</code></pre>
<p>I got this error :</p>
<pre><code>asyncore.loop()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/asyncore.py", line 216, in loop
poll_fun(timeout, map)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/asyncore.py", line 145, in poll
r, w, e = select.select(r, w, e, timeout)
select.error: (9, 'Bad file descriptor')
</code></pre>
<p>But only on Python Mac. No problem on Windows...</p>
<p>There is an execption in the code source of the asyncore.py class. But the server is crashing.</p>
<pre><code> try:
r, w, e = select.select(r, w, e, timeout)
except select.error, err:
if err.args[0] != EINTR:
raise
else:
return
</code></pre>
<p>So strange...</p>
| python | [7] |
4,348,894 | 4,348,895 | Populating a drop down box with a variable containing comma seperated values | <p>How can I, populate a select box based on a variable that will contain data by comma separated values?</p>
<p>Example:</p>
<pre><code>var x = Jenny,John,Stephanie,Marc,Ryan,Jessica
</code></pre>
<p>Expected result:</p>
<pre><code>[DROP DOWN BOX]
Jenny
John
Stephanie
Marc
Ryan
Jessica
</code></pre>
| javascript | [3] |
1,311,311 | 1,311,312 | javascript "polymorphic callable objects" | <p>I saw <a href="http://ajaxian.com/archives/javascript-tips-for-rookies-and-gurus">this article on polymorphic callable objects</a> and was trying to get it to work, however it seems that they are not really polymorphic, or at least they do not respect the prototype chain.</p>
<p>This code prints <code>undefined</code>, not <code>"hello there"</code>.</p>
<p>Does this method not work with prototypes, or am I doing something wrong? </p>
<pre><code>var callableType = function (constructor) {
return function () {
var callableInstance = function () {
return callableInstance.callOverload.apply(callableInstance, arguments);
};
constructor.apply(callableInstance, arguments);
return callableInstance;
};
};
var X = callableType(function() {
this.callOverload = function(){console.log('called!')};
});
X.prototype.hello = "hello there";
var x_i = new X();
console.log(x_i.hello);
</code></pre>
| javascript | [3] |
5,029,762 | 5,029,763 | spliting java string based on bunch of non alpha characters | <p>I have a string some thing like <code>my+*%name===is+jhon!#and&*^I$stay===in^&$#@US</code>. I want output as </p>
<pre><code>s[0]="my"
s[1]="+*%"
s[2]="name"
s[3]="==="
s[4]="is"
s[5]="+"
s[6]="jhon"
s[7]="!#"
s[8]="and"
s[9]="&*^"
s[10]="I"
s[11]="$"
s[12]="stay"
s[13]="==="
</code></pre>
<p>etc.</p>
<p>Please note that it is not following any pattern and the bunch of nonalphanumeric chars vary as the string will be dynamic data string</p>
| java | [1] |
3,029,464 | 3,029,465 | Android - Is it possible to use ui api in the other class and thread expect Activity? | <p>I have some questions about android ui api.</p>
<p>Give a example, that I want to implement.</p>
<p>Main_UI_Thread.java :</p>
<pre><code>public class Main_UI_Thread extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
/*** do something about layout ***/
...
DisplayClass dc = new DisplayClass();
Thread th = new Thread(dc);
th.start();
}
}
</code></pre>
<p>DisplayClass.java :</p>
<pre><code>public class DisplayClass extends Thread{
@Override
public void run() {
if( something happen ) {
to display Dialog or Toast show
and handle the ui listener
}
}
}
</code></pre>
<p>I know the message passing can be do that;</p>
<p>But I want the ui program is be implemented in DisplayClass.java</p>
<p>Is it possible??</p>
<p>My English is not well.^^" </p>
<p>Thanks everybody to give me some suggestions. :P</p>
| android | [4] |
5,506,281 | 5,506,282 | change background color on list item selection android | <p>hello frnds i want to change background color (white on selection) of list on selection of list in listview and if i select any other position then first selected row comes to its previous state and currently selected rows background become white.so how to do this</p>
<pre><code> public void onListItemClick(ListView parent, View v, int position, long id) {
super.onListItemClick(parent, v, position, id);
//do some stuff here
Toast.makeText(getApplicationContext(), "You have selected"+(position+1)+"th item", Toast.LENGTH_SHORT).show();
}
</code></pre>
| android | [4] |
399,901 | 399,902 | How do I add a mouseover event on a row in jquery? | <p>I have a dynamically populating table and would like to add a mouseover feature</p>
<pre><code>(mouseover="style.backgroundColor='#E1EBF4'")
</code></pre>
<p>to my table row while the data row is being added. </p>
<pre><code>function addRecentData(data) {
$('#newTable tr:last').after('<tr><td class="name"></td><td class="id"></td></tr>');
var $tr = $('#newTable tr:last');
$tr.find('.name').html(data.Name);
$tr.find('.id').html(data.Id);
}
</code></pre>
| jquery | [5] |
2,111,717 | 2,111,718 | Array() and Array.prototype usage | <p>First of all i would like to ask for excuse if answer is obvious, and/or easy to find.
I didn't find any complete answers.</p>
<p>The question is very simple:</p>
<pre><code>var array1 = Array().slice.call(arguments,1);
var array2 = Array.prototype.slice.call(arguments,1);
</code></pre>
<p>They do the same thing.
Can you do in such a way for Object, Date, String, etc prototypes </p>
| javascript | [3] |
708,798 | 708,799 | TabIndex for two control contained with a table cell ASP.Net | <p>I have a weird issue that I am being asked to fix but alas I have thus far drawn a blank. As the title suggests I am trying to get the tab order for two text boxes to follow one after the other.</p>
<p>The idea is (and this is inherited code rather than that of my own design) that a routine is call that builds atable cell inserting two text boxes and one link. This is then returned and foreach line in the table a new copy of this cell is generated. </p>
<p>I have tried setting the TabIndex for the text boxes and find that when I tab I only get as far as the first box (txtPound) and never the second (txtPence).</p>
<p>I can't decide if the issue is due to trying to do this in a TableCell or whether its something else completely.</p>
<p>Hopefully that's clear but should you require any further info then I will try to supply it.</p>
<p>I have included a striped down version of the code below, essentially this gets added to a table row in a the aspx pace.</p>
<p>Any help would be greatly appreciated.</p>
<pre><code> private TableCell EstimateInputs(Brief item)
{
TableCell td = new TableCell();
TextBox txtPounds = new TextBox();
string[] agencyCosts;
txtPounds.TabIndex = 1;
td.Controls.Add(txtPounds);
//td.Controls.Add(new LiteralControl("<span>.</span>"));
TextBox txtPence = new TextBox();
txtPence.MaxLength = 2;
txtPence.TabIndex = 2;
td.Controls.Add(txtPence);
td.Controls.Add(new LiteralControl("</p></fieldset>"));
}
</code></pre>
| asp.net | [9] |
3,213,424 | 3,213,425 | Display values in PHP that are Std Class | <p>All,
I have the following code to get some posts from Tumblr:</p>
<pre><code>$baseHostname = "name.tumblr.com";
$tumblrConsumerKey = "asfd"; # use your own consumer key here
$humblr = new Humblr($baseHostname, $tumblrConsumerKey);
$post = $humblr->getPosts(array('limit' => 1));
print_r($post);
</code></pre>
<p>This works fine and gives me a result of something like this:</p>
<pre><code>Array (
[0] => stdClass Object (
[blog_name] => name
[id] => 43993
[post_url] => http://name.tumblr.com/post/43993/
[slug] => slug
[type] => video
[date] => 2013-02-25 18:00:25 GMT
[timestamp] => 1361815225
[state] => published
[format] => html )
</code></pre>
<p>I try and display some values like this:</p>
<pre><code>echo "The blog name is: ".$post->blog_name;
echo $post->id;
</code></pre>
<p>However, it is blank. How can I display these values?</p>
<p>Thanks</p>
| php | [2] |
3,123,741 | 3,123,742 | can i use isFinishing() from a service? | <p>I want to know if my app closing legitimately or from a crash. When my app starts it sets an alarm which when triggered starts a service. I cant work out how to code the isFinishing() from the service . I tried :-</p>
<pre><code>if (!((Activity) getBaseContext()).isFinishing())
</code></pre>
<p>this compiled ok but when run gave the following error:-</p>
<pre><code>java.lang.ClassCastException: android.app.ContextImpl
</code></pre>
<p>Is there a way to call from a service?
Ron</p>
| android | [4] |
4,861,756 | 4,861,757 | How to check domain | <p>I use JavaScript to insert the specific into the page. The problem is that it is necessery to load this iframe for the specific domain. I mean like in GoogleMaps, where you have to insert special key to be able load maps for your domain.</p>
<p>In few words I want to check where my script is linked from.</p>
| javascript | [3] |
5,290,507 | 5,290,508 | Problems with changing constructor's prototype | <p>I'm currently going through Stoyan Stefanov's book "Object-oriented JavaScript" and I've stumbled on an interesting problem. Here's the code:</p>
<pre><code>var shape = {
type: 'shape',
getType: function() {
return this.type;
}
};
function Triangle(a, b, c) {
this.a = a;
this.b = b;
this.c = c;
this.type = 'triangle';
}
Triangle.prototype = shape; // changing the prototype object
Triangle.prototype.getPerimeter = function() {
return this.a + this.b + this.c;
}
var t = new Triangle(1, 2, 3);
t.constructor; // logs Object() instead of Triangle(a, b, c)
</code></pre>
<p>As you can see, here is a simple example of the constructor inhereting some properties from the prototype object. But the constructor property of object t points to the Object() object instead of Triangle(a, b, c), as it should have. If I comment the line with the prototype change, though, everything works fine. What's my problem?
(Reread the whole prototype chapter in Object-oriented Javascript and JavaScript Patterns, couldn't find an answer).
P.S. Sorry for my bad English, trying to practice it. :)</p>
| javascript | [3] |
4,159,976 | 4,159,977 | Derived class can't see parent class properly | <p>I'm seeing two problems in a setup like this:</p>
<pre><code>namespace ns1
{
class ParentClass
{
protected:
void callback();
};
}
namespace ns1
{
namespace ns2
{
class ChildClass : public ParentClass
{
public:
void method()
{
registerCallback(&ParentClass::callback);
}
};
}
}
</code></pre>
<ol>
<li>ChildClass::method() gives a compile error: "<em>'ns1::ParentClass::callback' : cannot access protected member declared in class 'ns1::ParentClass'</em>"</li>
<li><code>ParentClass *pObj = new ChildClass()</code> gives an error, that it can't do the conversion without a cast. C++ can down-cast happily, no?</li>
</ol>
| c++ | [6] |
862,615 | 862,616 | Canon camera is not detected in gphoto2? | <p>I have used gphoto2 for integrating digital camera integration through android device. I have build the application in linux and able to run it also but when I connected the digital camera of canon i.e canon EOS 5D Mark II it doesn't detect it. When I click on detect camera button it shows 0 camera detected. I am unable to find the problem please help.?
I got gphoto from this site i.e <a href="http://gitorious.org/agphoto2/agphoto2/trees/master" rel="nofollow">http://gitorious.org/agphoto2/agphoto2/trees/master</a></p>
<p>Thanks</p>
| android | [4] |
4,675,236 | 4,675,237 | animation in android | <p>I had an activity (say homeActivity) and when I start a new activity(say nextActivity) from my homeactivity i would like to give it an animation effect like appearing it from the bottom. Is it possible in android?</p>
| android | [4] |
2,514,397 | 2,514,398 | how to send attachment by email | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1214646/send-email-with-attachments-in-php">Send email with attachments in PHP?</a> </p>
</blockquote>
<p>I've many Joomla/Drupal sites running but I want to send a file attachment by email using php code on linux/unix command line, how can I do it?</p>
<p>When I use mail function in my shared hosting account, it's not send any mails.</p>
| php | [2] |
137,052 | 137,053 | How to get the currenlly logged in username in C#? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4040290/get-the-logged-on-user-name-in-c-sharp">Get the logged on user name in C#</a> </p>
</blockquote>
<p>C# application may be executed either directly (double clicking on exe) or can be executed as administrator (Run as Administrator).</p>
<p>I need to run my application as administrator (Run as administrator) even in simple user account.</p>
<p>I want to get the currently logged in username using C#(But i get the username of admin). </p>
<p>i tried many options like : Environment.Username, WindowsIdentity class etc. It gives me the username of admin(because i have run the exe as admin) not the currently logged in Username.</p>
<p>This is a winForm application developed on .net 3.5. Application Executable is executed with administrator login by a vb script. vb script is executed as soos as the user logs in.</p>
<p>There are many similar queries in this fourm, but all the answers provide the username of the administrator not the currently loggeed in user's username. Hence i have posted this question. </p>
<p>please answer my query. Thanking you in advance. </p>
| c# | [0] |
5,839,486 | 5,839,487 | exception in static initializer | <p>I have a GUI application. In my main class I have a method (called <code>createAndShow()</code>) to initialize all my GUI classes. Inside each GUI class, I have <code>static initializer</code> to read properties files(resource bundles or configuration files). If a file or entry is missing or value is wrong, I catch the exception and then throws a <code>MissingResourceException</code> to upper level on purpose. In my <code>createAndShow()</code> method of the main class, I put a try-catch to catch <code>Exception</code>. But somehow JVM refuse to get there. Whenever a file is missing, that <code>MissingResourceException</code> is thrown and then the application just hang. I expected the <code>createAndShow()</code> method will catch that exception and exit gracefully. Is there anything special for exceptions throws from the static initializer?</p>
<p>I am using XP and java 1.6.</p>
| java | [1] |
5,258,904 | 5,258,905 | unable to create image using simplecursoradapter | <p>im easily able to use for textviews but textview with imageview like contacts name,number and image display sort of listing i m suffering with i have searched many blogs but without success please help.... </p>
<pre><code>public class Listmain extends ListActivity
{
@Override public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
try
{
Data_baseActivity db=new Data_baseActivity(this);
db.open();
InputStream is;
Cursor cursor =db.getAllContacts1();
int len=cursor.getCount();
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.rowlayout, cursor, new String[] { "image", "name"}, new int[] { R.id.icon, R.id.label});
adapter.setViewBinder(new ProductViewBinder());
setListAdapter(adapter);
db.close();
}
catch(Exception e)
{
Toast.makeText(this, e.toString()+" error", Toast.LENGTH_LONG).show();
}
}
}
public class ProductViewBinder implements ViewBinder
{
public boolean setViewValue(View view, Cursor cursor, int columnIndex)
{
try
{
if (view instanceof ImageView)
{
byte[] result = cursor.getBlob(3);//my image is stored as blob in db at 3
Bitmap bmp = BitmapFactory.decodeByteArray(result, 0, result.length);
ImageView im=(ImageView)findViewById(R.id.icon);
im.setImageBitmap(bmp);
return true;
}
}
catch(Exception e)
{
Toast.makeText(Listmain.this, e.toString()+" err", Toast.LENGTH_LONG).show();
}
return false;
}
}
</code></pre>
| android | [4] |
2,888,679 | 2,888,680 | Get variable name reffering the object in C# | <p>Is it possible to get the variable name using which the object was called in C#? Or is it possible to get all the variable which are reffering a particular object?</p>
<p>EDIT:
Just to clarify further even though this has been answered.</p>
<p>Consider the code sample given by Fredrik Mörk</p>
<pre><code>User someUser = new User();
User anotherVariable = someUser;
</code></pre>
<p>i.Is it possible to find someUser using the object reffered by anotherVariable.<br>
ii. Is it possible to find get the name of the variable using which the object was called. That is something like <code>someUser.getName()</code> should give "someUser" as output.</p>
<p>Thanks...</p>
| c# | [0] |
4,080,012 | 4,080,013 | Why cant we override Equals() in a value type without boxing? | <p>I know I can avoid boxing by adding my own Equals implementation.</p>
<pre><code>public struct TwoDoubles
{
public double m_Re;
public double m_Im;
public TwoDoubles(double one, double two)
{
m_Re = one;
m_Im = two;
}
public override bool Equals(object ob)
{
return Equals((TwoDoubles)ob);
}
public bool Equals(TwoDoubles ob)
{
TwoDoubles c = ob;
return m_Re == c.m_Re && m_Im == c.m_Im;
}
}
</code></pre>
<p>I can't call this an override as much as an overload. By the magic of the runtime it does correctly call the correct <code>Equals()</code> implementation based on the type of the caller.</p>
<p>Why can't I override and change the parameter type to <code>TwoDoubles</code> and let boxing occur by the power of the runtime on an as needed basis? Is it because C# doesn't support parameter contravariance (if that's the reason then why is it not supported...seems a small step from <code>object o = new TwoDoubles()</code>)? </p>
<p><strong>UPDATE</strong><br />
Clarification: <code>object</code> is a part of the inheritance hierarchy of a struct. Why can we not specify a more derived type as a parameter to override an implementation from a less derived type? This would allow us to write:</p>
<pre><code> public override bool Equals(TwoDoubles ob)
{
TwoDoubles c = ob;
return m_Re == c.m_Re && m_Im == c.m_Im;
}
</code></pre>
<p>Which should be called when the variable is a TwoDouble even if said variable has been boxed into an object type.</p>
| c# | [0] |
2,393,650 | 2,393,651 | Cross platform /dev/null in Python | <p>I'm using the following code to hide stderr on Linux/OSX for a Python library I do not control that writes to stderr by default:</p>
<pre><code>f = open("/dev/null","w")
zookeeper.set_log_stream(f)
</code></pre>
<p>Is there an easy cross platform alternative to /dev/null? Ideally it would not consume memory since this is a long running process.</p>
| python | [7] |
5,378,517 | 5,378,518 | Cookie with a path specified is not set via javascript | <p>I have a local host called "myproject". When i try to set a cookie for resource "myproject/someresource" like this:</p>
<pre><code>document.cookie = "mycookie=somevalue; path=/someresource";
</code></pre>
<p>IE does not set this cookie. But it does if i do not use path parameter:</p>
<pre><code>document.cookie = "mycookie=somevalue";
</code></pre>
<p>What am i doing wrong?</p>
| javascript | [3] |
370,324 | 370,325 | C# WP8 Error: Cannot implicitly convert type 'Microsoft.Xna.Framework.Media.Song' to 'Microsoft.Xna.Framework.Media.MediaQueue | <p>I'm trying to find the currently playing song on windows phone. </p>
<p>To do this, I did</p>
<pre><code>MediaQueue s = s.ActiveSong;
</code></pre>
<p>For some reason, I get the above error when doing this. Probably a simple mistake, but I can't figure it out.</p>
| c# | [0] |
2,076,958 | 2,076,959 | How to set an object variable dynamically via a method in Java | <p>I am attempting to run a method that takes in an string and creates the object using the string as the object's variable:</p>
<pre><code>public void createObj(String objName){
Obj objName = new Obj();
}
</code></pre>
<p>Is this even possible? If so, how may I accomplish it?</p>
| java | [1] |
4,178,346 | 4,178,347 | How to search exact string using python file handling | <p>I have a file that contains</p>
<pre><code>"1111 1111 1111 // google
1111 1111 1111 // google talk browser
1111 1111 1111 // google talks
1111 1111 1111 // google talk"
</code></pre>
<p>I want to print only "// google talk" related line (only 4th line)</p>
<p>tried like this this not working...</p>
<pre><code>with open('file.txt', 'r') as handle:
for index, line in enumerate(handle, 1):
if line.strip() == 'talk':
print 'Match found on line', index
</code></pre>
| python | [7] |
2,201,477 | 2,201,478 | Cambria Math font not displayed properly in Windows forms | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/13339759/text-using-cambria-math-font-in-windows-forms-gets-shifted-vertically">Text using Cambria Math font in Windows forms gets shifted vertically</a> </p>
</blockquote>
<p>I am trying to render the text with hex code "11DE" using "Cambria Math" font in Windows forms at position (0,0), but it is not drawn correctly. </p>
<p>Anyone please provide me a solution on this.</p>
<pre><code> string st = ((char)4574).ToString();
Font f = new System.Drawing.Font("Cambria Math", 12f);
Graphics gr = this.CreateGraphics();
gr.DrawString(st, f, Brushes.Black, new PointF(0, 0));
</code></pre>
| c# | [0] |
4,510,574 | 4,510,575 | Strange Behavior when Splitting a String | <p>I am trying to split a string using a delimiter and I'm getting some odd results when I grab values from different cells in the String array. Example:</p>
<pre><code>dataString = (String) hashMap.get("LCSSAMPLEREQUEST_sampleRequestString");
System.out.println(dataString);
String dataStringSplit[] = dataString.split("quantity|&^&|");
String tempString = dataStringSplit[0];
</code></pre>
<p>Here is the line in dataString before the first delimiter:</p>
<pre><code>"sortingNumber|&^&|1|-()-|ID|&^&|1|-()-|DROPPED|&^&|false|-()-|"
</code></pre>
<p>Now when I do a <code>System.out</code> of <code>'tempString'</code>, I get a string with no value.</p>
<p>If I do <code>tempString = dataStringSplit[1]</code>, then I get a value of <code>'sor'</code>. </p>
<p>What am I doing wrong here?</p>
| java | [1] |
2,121,132 | 2,121,133 | Same code doesn't work in different environments | <p>I am using the following jQuery code in my <a href="http://mitpachat.com/c/73/%D7%AA%D7%95%D7%A1%D7%A4%D7%95%D7%AA-%D7%9C%D7%9E%D7%98%D7%A4%D7%97%D7%AA" rel="nofollow">production</a> and <a href="http://mitpachattest19.com.yew.arvixe.com/c/53/%D7%9E%D7%98%D7%A4%D7%97%D7%95%D7%AA" rel="nofollow">test</a> env </p>
<pre><code>$(document).ready(function() {
$(this).find('div.description:contains("חדש")').each(function() {
$(this).closest(".item-box").find(".picture a").addClass("SaleProduct");;
$('div.description:contains("מבצע")').each(function() {
$(this).closest(".item-box").find(".picture a").addClass("NewProduct");
});
});
});
</code></pre>
<p>but some how the same code dosen't work is the prod env. i am certain that the jQuery is being called
but i cant figure whay it doesn't work . </p>
| jquery | [5] |
2,240,356 | 2,240,357 | jquery add css to scrolltop function | <p>How do I add this ....</p>
<p>$("#otherdiv").css("background-color","yellow");</p>
<p>To trigger with this ....</p>
<pre><code>$(function(){
var stickerTop = parseInt($('#header-container').offset().top);
$(window).scroll(function() {
$("#header-container").css((parseInt($(window).scrollTop()) + parseInt($("#header- container").css('margin-top')) > stickerTop) ? {
position: 'fixed',
top: '0px'
} : {
position: 'relative'
});
});
});//]]>
</code></pre>
<p>Many thanks !</p>
| jquery | [5] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.