Unnamed: 0 int64 65 6.03M | Id int64 66 6.03M | Title stringlengths 10 191 | input stringlengths 23 4.18k | output stringclasses 10 values | Tag_Number stringclasses 10 values |
|---|---|---|---|---|---|
4,764,405 | 4,764,406 | Add URL into Javascript | <p>How to add this :</p>
<p>type: "POST",
url: "login.php", in JS code below (exactly in comment "do your ajax call and processing here...":</p>
<pre><code>$(document).ready(function()
{
$("#submit_butt").click( function()
{
var conf =
{
frequency: 5000,
spread: 5,
duration: 600
};
/* do your AJAX call and processing here...
....
....
*/
// this is the call we make when the AJAX callback function indicates a login failure
$("#login").vibrate(conf);
// let's also display a notification
if($("#errormsg").text() == "")
{
$("#loginform").append();
// clear the fields to discourage brute forcing :)
$("#password").val("");
document.forms['login_form'].elements['username'].focus();
}
else
{
}
});
});
</code></pre>
| javascript | [3] |
1,618,697 | 1,618,698 | How do I extract the Maps API Key from the keygen files? | <p>I generated a Maps API key by selecting Export Android Application from Eclipse. I created a new keystore and assigned a password to it. After completion of the process I found two files in the newly created keystore...</p>
<p>HelloGoogleMaps.apk
roys_android_key</p>
<p>My question is how do I extract My certificate's MD5 fingerprint: from one or both of these files in order to Generate The API key (button bottom of form)...</p>
<p><a href="http://code.google.com/android/maps-api-signup.html" rel="nofollow">http://code.google.com/android/maps-api-signup.html</a>.</p>
<p>I am a real newbie so please excuse me if I missed something obvious.</p>
| android | [4] |
5,177,588 | 5,177,589 | When will I get an arraystoreexception and a classcastexception with respect to generics? | <p>My understanding is that you get an <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/ArrayStoreException.html" rel="nofollow">ArrayStoreException</a> when you try to insert an object of incompatible type. </p>
<pre><code>Object[] array = new String[1];
array[0] = 1;
</code></pre>
<p>Can someone explain, with an example, when will I get an <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/ArrayStoreException.html" rel="nofollow">ArrayStoreException</a> and when will I get a <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/ClassCastException.html" rel="nofollow">ClassCastException</a> ? </p>
| java | [1] |
1,548,988 | 1,548,989 | Is it worth it to switch from home-grown remote command interface to using JMX | <p>Without knowing too much about JMX, I've always assumed that it would be the best approach for building in remote management to our standalone Java server application. Our server application has some minimal remote control capability, using text commands sent via TCP/IP socket to it.</p>
<p>Using the home grown approach, it is fairly to add a new command. (Just create new command text, and the code to handle that in the message receiver). On the other hand, we have hardly implemented any commands, even though there are many things we would like to be able to execute remotely.</p>
<p>I am trying to weigh the value of moving to incorporating JMX (learning it, and building the interfaces), versus just sticking with the home-grown approach. Does anyone have any experience or advice regarding changing an existing application to use JMX?</p>
| java | [1] |
866,964 | 866,965 | TypeError: cannot concatenate 'str' and 'builtin_function_or_method' objects | <p>What is wrong with this code?</p>
<pre><code>def welcome(name):
print "congrats! You created your first Python bank account"+ name
print "Hello welcome to the Python bank Account"
print"To begin please enter your name"
name=raw_input
welcome(name)
</code></pre>
| python | [7] |
1,108,623 | 1,108,624 | Is there any Sound filtering library in android | <p>I want to capture an audio and convert it into byte array.<br>
But when I record the audio, noise gets added to it. </p>
<p>Is there any filtering library in android so that I can remove noise in it.</p>
<p>Regards,<br>
Sneha</p>
| android | [4] |
5,475,376 | 5,475,377 | How to read eventObject in .click() handler? | <p>I have the following object:</p>
<pre><code>function Controller() {
$(".button").click(this.handleClick);
}
Controller.prototype.handleClick = function(event) {
console.log("Clicked: "+event.target.id);
};
...
return Controller;
});
</code></pre>
<p>Is the way I'm reading the eventobject in handleClick() incorrect?</p>
<p>It seems to work every now and then, while giving empty results most of the time - no errors in console though.</p>
<p>EDIT: I changed the "target" to "currentTarget" and now it works!</p>
| jquery | [5] |
4,082,172 | 4,082,173 | uint is 32 bits no matter the system is 32 or 64 bits? | <p>in C#, uint is a UInt32 type so it will be always 32 bits long no matter the OS is 32 or 64 bits. Am I right?</p>
| c# | [0] |
142,252 | 142,253 | IEnumerable<IMyInterface> Implicitly From Class[] But Not From Struct[]. Why? | <p>Given:</p>
<pre><code>public interface IMyInterface{
}
public class MyClass:IMyInterface{
public MyClass(){}
}
public struct MyStruct:IMyInterface{
private int _myField;
public MyStruct(int myField){_myField = myField;}
}
</code></pre>
<p>Why can I write:</p>
<pre><code>IEnumerable<IMyInterface> myClassImps = new[] {
new MyClass(),
new MyClass(),
new MyClass()
};
</code></pre>
<p>But not:</p>
<pre><code>IEnumerable<IMyInterface> myStructImps = new[]{
new MyStruct(0),
new MyStruct(1),
new MyStruct(2)
};
</code></pre>
<p>Which gives me the following warning:</p>
<p><strong>Error 29 Cannot implicitly convert type 'MyApp.MyNS.MyStruct[]' to 'System.Collections.Generic.IEnumerable<MyApp.MyNS.IMyInterface>'</strong></p>
<p>And must instead be written:</p>
<pre><code>IEnumerable<IMyInterface> myStructImps = new IMyInterface[]{
new MyStruct(0),
new MyStruct(1),
new MyStruct(2)
};
</code></pre>
| c# | [0] |
1,339,115 | 1,339,116 | Android timer set delay | <p>I have a service class in my Android app which uses a timer. The timer is set to run at a delay of 1min (60000ms). I want the user to be able to dynamically change this delay. Normally, in java I could just use timer.setDelay(); but Android does not have this function. </p>
<p>Service class so far:</p>
<pre><code>public class LocalService extends Service
{
Timer timer = new Timer();
int newDelay;
public IBinder onBind(Intent arg0)
{
return null;
}
public void onCreate()
{
super.onCreate();
startService();
}
private void startService()
{
timer.scheduleAtFixedRate(new TimerTask()
{
public void run()
{
mainTask();
}
}, 0, 60000);
}
private void mainTask()
{
//do something
}
private void shutdownService()
{
if (timer != null) timer.cancel();
}
public void onDestroy()
{
super.onDestroy();
shutdownService();
}
private void readNewDelay()
{
InputStream in = openFileInput("updateDelay");
if(in != null)
{
InputStreamReader input = new InputStreamReader(in);
BufferedReader buffreader = new BufferedReader(input);
newDelay = Integer.parseInt(buffreader.readLine()) * 60000; //value in file is saved in minutes
}
in.close();
}
}
</code></pre>
<p>The delay I want is saved to a text file by an activity. I then want the service to read this file and update its timer delay accordingly. </p>
| android | [4] |
2,729,163 | 2,729,164 | Issue with pointer to character array C++ | <p>I have what I thought should be a very simple snippet of code to write, though I'm unable to compile for a reason which I do not understand.</p>
<p>The following simplified code will not compile:
</p>
<pre><code>char buffer[9] = "12345678";
char* pBuffer = &buffer;
</code></pre>
<p>Compiler (g++) throws the following error:</p>
<p><code>error: cannot convert 'char (*)[9]' to 'char*' in initialization</code></p>
<p>C++ isn't exactly my "native" language, but everywhere I've looked tells me this should work. Any ideas or advice is greatly appreciated.</p>
| c++ | [6] |
5,384,431 | 5,384,432 | Sementation fault 11 in simple SWITCH | <pre><code>int main(){
MyBase *mb;
int choice;
cout << "Select: ";
cin >> choice;
switch (choice) {
case 1:
mb = new Test1();
break;
case 2:
mb = new Test2();
break;
case 3:
mb = new Test3();
break;
case 4:
mb = new Test4();
break;
case 5:
mb = new Test5();
break;
case 6:{
LinkTest t;
t.start();
break;
}
default:
return 0;
}
if(mb != 0){
mb->start();
delete mb;
}
return 0;
}
</code></pre>
<p>If choice is 6, why am I getting a segmentation fault when checking if mb is NULL?</p>
<p>I am new to c++ and just doing some exercises.
How can I fix this without affecting the class LinkTest?
Thanks.</p>
| c++ | [6] |
5,407,020 | 5,407,021 | Memory leak using raphael.js with hover | <p>There is a serious memory leak happening using the Raphael library pie chart WITH the hover attribute. If I remove the code that includes the hover attribute it works great and when I add it back in the memory footprint steadily grows and hovering over the piechart increases the memory footprint even more so. Unlike most other examples I'm using window.setInterval to constantly update the page (if this helps any).
I'm at a loss as to how to correct this issue and reaching out for some help.</p>
<p>Below is the basics of what I'm doing...using pretty much the dynamic pieChart on the Raphael website and adding an interval timer to it. I cant however figure out how to utilize the hover effect without the memory issue???:</p>
<pre><code> window.onload = setInterval(drawThePie, 10000);
function drawThePie() {
var mainCont = parent.frames["main"].document;
mainCont.getElementById("holder").innerHTML = "Getting data..";
//..Setting values for pieChart and legend into arrays here
//..Looping through color array and setting values for colorlist below
var r = Raphael("holder");
var aCircle = r.aCircle(85,85,78).attr({fill: "black"});
pie = r.piechart(85,85,75,data, {"legend": legend, "legendpos": "east", colors: colorlist });
if(dataNotZero > 0) { mainCont.getElementById("holder").innerHTML = "";}
pie.hover(function () {
this.sector.stop();
this.sector.scale(1.1, 1.1, this.cx, this.cy);
if (this.label) {
this.label[0].stop();
this.label[0].attr({ r: 7.5 });
this.label[1].attr({ "font-weight": 800 });
}
}, function () {
this.sector.animate({ transform: 's1 1 ' + this.cx + ' ' + this.cy }, 500, "bounce");
if (this.label) {
this.label[0].animate({ r: 5 }, 500, "bounce");
this.label[1].attr({ "font-weight": 400 });
}
});
};
</code></pre>
| javascript | [3] |
4,432,970 | 4,432,971 | Change in appearance - Widget | <p>How do I choose the appearance of the widget? I mean to give users a choice of looks. Enter into the options and chooses the example of the ListView (To know how to do it) but how to do that when you look (I think that ImageButton) actually reads the selected layout.</p>
| android | [4] |
5,791,747 | 5,791,748 | exiting a running command in python | <p>I'm new to python. I'm writing a script that calls a command line tool and displays the output from the command on the screen. The issue is that after the command runs it doesn't exit on it's own, it requires manual typing of ctrl-c to stop and continue on with the rest of the python script. Does anyone know how I could get it to stop on it's own and continue on with the rest of the script?</p>
<pre><code>cmd ='./ppshelper -sms "15062929382" warning'
os.system(cmd)
print "SMS sent"
</code></pre>
<p>"SMS sent" is not printed until the user presses ctrl-c</p>
<p>Thanks</p>
| python | [7] |
4,796,454 | 4,796,455 | Contextual Action Bar menu forces items into oveflow menu when there is room | <p>I have a contextual action bar with three menu items, so only three icons. There is definitely room on the cab, but only one icon shows and the other two are forced into the oveflow menu. If I use android:showAsAction="always" in all three menu items then they all show and there is room. However, I would rather use android:showAsAction="ifRoom" with the result that all three icons show. Have tried deleting android:title on each item, but that still resulted in the oveflow menu, so I know it's not trying to put the title in.</p>
<p>
</p>
<pre><code><item android:id="@+id/delete_quiz"
android:title="DeleteQuiz"
android:icon="@drawable/ic_menu_close_clear_cancel"
android:showAsAction="ifRoom"
/>
<item android:id="@+id/load_quiz"
android:title="LoadQuiz"
android:icon="@drawable/ic_menu_close_clear_cancel"
android:showAsAction="ifRoom"
/>
<item android:id="@+id/start_quiz"
android:title="StartQuiz"
android:icon="@drawable/ic_menu_close_clear_cancel"
android:showAsAction="ifRoom"
/>
</code></pre>
<p></p>
<p>The icon I'm using is ic_menu_close_clear_cancel for each menu item.</p>
<p>Has anyone had a similar experience? What did you do? Thank you in advance.</p>
| android | [4] |
598,681 | 598,682 | Could i convert a jar file to exe? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4330936/java-jar-to-exe">(Java) jar to exe</a> </p>
</blockquote>
<p>What if i want to run a .jar program on a pc that doesnt have the JDK...?</p>
<p>would it possible?</p>
| java | [1] |
2,042,533 | 2,042,534 | Need iPhone card flip effect , can't figure out how to do it | <p>I'm writing a card game and need a animation to flip them over from one side to the other along the y axses. What would be the easiest way to do this? Is there any good tutors?
This is what I did:</p>
<p>Found some sample code for using UITransitionView. But it comes up as undeclared on my sdk, and I found out this was undocumented.
Looked into OpenGL, seems to complicated.</p>
<p>Any help would be GREAT!
Ted</p>
| iphone | [8] |
5,138,856 | 5,138,857 | What is the best file format for configuration file? | <p>I need a good config file format. I plan on putting to table schema. Like symfony, ruby on rails, etc. What is the best file format for configuration file ? Yaml or XML or JSON encoded file ? Which is the best for this purpose ?</p>
| php | [2] |
2,933,478 | 2,933,479 | Best way to determine if a file is empty (php)? | <p>I'm including a custom.css file in my template to allow site owners to add their own css rules. However, when I ship the file, its empty and there's no sense loading it if they've not added any rules to it.</p>
<p>What's the best way to determine if its empty?</p>
<pre><code>if ( 0 == filesize( $file_path ) )
{
// file is empty
}
// OR:
if ( '' == file_get_contents( $file_path ) )
{
// file is empty
}
</code></pre>
| php | [2] |
1,609,807 | 1,609,808 | Find subsequences of strings within strings | <p>I want to make a function which checks a string for occurrences of other strings within them.
However, the substrings which are being checked may be interrupted within the main string by other letters.</p>
<p>For instance:</p>
<pre><code>a = 'abcde'
b = 'ace'
c = 'acb'
</code></pre>
<p>The function in question should return as b being in a, but not c.</p>
<p>I've tried set(a).intersection(set(b)) already, and my problem with that is that it returns c as being in a.</p>
| python | [7] |
5,561,256 | 5,561,257 | c++ euclidean distance | <p>This code compiles and runs but does not output the correct distances.</p>
<pre><code>for (int z = 0; z < spaces_x; z++)
{
double dist=( ( (spaces[z][0]-x)^2) + ( (spaces[z][1]-y)^2) );
dist = abs(dist);
dist = sqrt(dist);
cout << "for x " << spaces[z][0] <<
" for y " << spaces[z][1] <<
" dist is "<< dist << endl;
if (dist < min_dist)
{
min_dist = dist;
index = z;
}
}
</code></pre>
<p>Does anyone have an idea what the problem could be?</p>
| c++ | [6] |
3,410,444 | 3,410,445 | Show result of long task after a ProgressDialog | <p><br>
I have an application which runs a long task and returns a value. While the task is running, a <code>ProgressDialog</code> shows the progress. After the task is done I want to show the result in a <code>TextView</code>. I run the task in a FutureTask.<br>
My problem is that if I try to get the result, the <code>.get()</code> method of FutureTask blocks the UI Thread and I don't see the <code>ProgressDialog</code> (the <code>TextView</code> displays the result propertly). </p>
<p>My code for the task (pool is ExecutorService): </p>
<pre><code>final FutureTask<String> future = new FutureTask<String>(new Callable<String>() {
@Override
public String call() {
return myLongTask();
}
});
pool.execute(future);
</code></pre>
<p>And afterwards I call <code>updateProgressBar()</code> in a <code>Runnable</code> which updates the <code>ProgressDialog</code> with a <code>Handler</code>: </p>
<pre><code>Runnable pb = new Runnable() {
public void run() {
myUpdateProgressBar();
}
};
pool.execute(pb);
</code></pre>
<p>Now I'm getting the result, which blocks the UI Thread preventing the <code>ProgressDialog</code> to show up: </p>
<pre><code>String result = future.get()
</code></pre>
<p>If I try to put the result inside the updateProgressBar() method (by passing the future as a parameter) after the ProgressDialog dismisses, an Exception is thrown: </p>
<blockquote>
<p>Only the original thread that created a view hierarchy can touch its views.</p>
</blockquote>
<p>Any ideas how to solve this problem? (I've heard about AsyncTasks but I can't figure out how to use them propertly.)</p>
| android | [4] |
1,479,912 | 1,479,913 | edit Xml File using C# | <p>this is my xml file...</p>
<p>
</p>
<p>
-->
</p>
<p></p>
<pre><code><!--Daily Genarated File Path-->
<add key="DailyFilName" value="C:\DailySummary.xls"/>
<!--Weekly Genarated File Path-->
<add key="WeeklyFilName" value="C:\WeeklySummary.xls"/>
<!--Log File Path-->
<add key="LogFilName" value="c:\\TranmittalsLog.txt"/>
</code></pre>
<p></p>
<p></p>
<p>i need to edit my DailyFilName by c#. Using Key i need to change the value.</p>
| c# | [0] |
4,435,216 | 4,435,217 | how to get values from drop down list in php | <p>I have several drop down lists in a table, I am trying to retrive the value of the drop down list if its not 0.</p>
<p>I have a table of items each item has the drop down list. Below is how I create the drop down list, I give it the tableid as a name because this is a unique identifier for the particular product.</p>
<pre><code>echo "<td><select name=". $row['goosedown_id'] .">
<option value=''> 0 </option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
<option>8</option>
</select>
</td>";
</code></pre>
<p>Then once the form is submitted I am trying to just print any values i can... cause im not sure how to proceed... I do this like so.</p>
<pre><code>$goosedown_id = check_input($_POST['goosedown_id']);
//..
goose down = $goosedown_id
</code></pre>
<p>I am hoping to be able to print out the associated values or calculate the price based off other items in the table i.e. price etc. but I am hoping someone can help me with trying to access the items that are no 0 first.</p>
| php | [2] |
5,111,692 | 5,111,693 | C# how to dynamically cast an object? | <p>I am building a helper object that has a property called Mailer. In reality Mailer can be either a System.Net.Mail.MailMessage or a Mono.System.Net.Mail.MailMessage. So I would preferably only want 1 declaration of mailer. </p>
<p>For example I don't want:</p>
<pre><code>private Mono.Mailing.MailMessage MonoMessage = new Mono.Mailing.MailMessage();
private System.Net.Mail.MailMessage MailMessage = new System.Net.Mail.MailMessage();
</code></pre>
<p>I would prefer </p>
<pre><code>object mailer;
</code></pre>
<p>Then in constructor</p>
<pre><code>switch (software)
{
case EnunInternalMailingSoftware.dotnet:
this.mailer = new System.Net.Mail.MailMessage();
break;
case EnunInternalMailingSoftware.mono:
this.mailer = new Mono.Mailing.MailMessage();
break;
}
</code></pre>
<p>The problem is that mailer has no properties at design time. So I can't compile my code. </p>
<p>How can this be fixed, am I taking the right approach. Thanks in advance</p>
| c# | [0] |
5,703,247 | 5,703,248 | OOP. Calling methods from within methods | <p>How do I call class methods from functions within the class? My code is:</p>
<pre><code>var myExtension = {
init: function() {
// Call onPageLoad
},
onPageLoad: function() {
// Do something
},
}
</code></pre>
<p>I've tried ...</p>
<pre><code>onPageLoad();
</code></pre>
<p>... from within the init method but it's saying it's not defined.</p>
<p>I'm not having much luck with google because I don't understand the syntax used. All the JS OOP examples I find online are in a different format. I'm using the format Mozilla use for extension development.</p>
| javascript | [3] |
717,770 | 717,771 | any building tool can automatically understand file dependencies in C++ project? | <p>I have a project with 50+ <code>.h</code> files and 50+ <code>.cpp</code> files. I'm using <code>make</code> to build a project, which looks something like this (it's just a piece of an entire file):</p>
<pre><code>HEADERS := $(shell find $(INCLUDE) -name "*.h")
%.obj: %.cpp $(HEADERS)
$(CPP) $(CPPFLAGS) -fPIC -o $@ -g -c $<
</code></pre>
<p>When I'm making changes to one <code>.h</code> file, the whole project has to be re-compiled. It's annoying and time-consuming. But I don't want to hard-code file dependencies inside <code>Makefile</code>, since it's even more time-consuming. I would like to have some <code>make</code>-like tool, which will find dependencies right inside my <code>.cpp</code>/<code>.h</code> files, automatically. Any suggestions? Thanks in advance!</p>
| c++ | [6] |
3,303,680 | 3,303,681 | What is the difference between $('#___') and $('.___') in JQuery | <p>I often see these 2 selectors, what is the difference? Thanks</p>
| jquery | [5] |
1,218,433 | 1,218,434 | Compiler optimization of references | <p>I often use references to simplify the appearance of code:</p>
<pre><code>vec3f& vertex = _vertices[index];
// Calculate the vertex position
vertex[0] = startx + col * colWidth;
vertex[1] = starty + row * rowWidth;
vertex[2] = 0.0f;
</code></pre>
<p>Will compilers recognize and optimize this so it is essentially the following?</p>
<pre><code>_vertices[index][0] = startx + col * colWidth;
_vertices[index][1] = starty + row * rowWidth;
_vertices[index][2] = 0.0f;
</code></pre>
| c++ | [6] |
1,253,027 | 1,253,028 | preventDefault() is not working | <p>My Goal is to remove the action of checkbox checking by clicking on its label
Below is my code.. </p>
<pre><code> $('TABLE TBODY TR TD').each(function()
{
$(this).find('input').each(function()
{
$('label for='+$(this)+'').preventDefault();
});
});
</code></pre>
<p>Below is the associated HTML..</p>
<pre><code> <table>
<tr><input type="checkbox" id="a1"><div><label for="a1">ClickMe</lable></div></tr>
</table>
</code></pre>
<p>Please someone help me.</p>
| jquery | [5] |
754,521 | 754,522 | Dynamically creating image tag to show when silverlight is not installed | <p>I'm using Silverlight.CreateObject to create a silverlight object dynamically. when silverilght is not installed it shows its own patent image from microsoft. I want to replace this image with mine...how can I do this??</p>
| javascript | [3] |
1,356,836 | 1,356,837 | How to split the string in C#? | <p>Note: </p>
<pre><code>string s="Error=0<BR>Message_Id=120830406<BR>"
</code></pre>
<p>What's the most elegant way to split a string in C#? </p>
| c# | [0] |
1,704,751 | 1,704,752 | Is there any value in creating an Integer object from an int? | <p>I was walking through some code and came across these lines:</p>
<pre><code>public final static int CM_VALUE = 0x200;
public final static Integer CM = new Integer(CM_VALUE);
</code></pre>
<p>Do anyone know why the author held the value in hex before passing it back to <code>Integer</code>? Does doing it this way add any benefits to the code?</p>
| java | [1] |
670,349 | 670,350 | How do I find and replace HTML entities with jQuery? | <p>I've constructed a calendar template for a Drupal site using an HTML table, and I've got jQuery to add a class 'no-text' to each empty cell: </p>
<pre><code>$('table.calendar td:empty').addClass('no-text');
</code></pre>
<p>This works well, but my problem is that the CMS WYSIWYG editor automatically adds the HTML entity <code>&nbsp;</code> to empty cells. I've therefore attempted to find and replace the entities with a 'real' space beforehand, but jQuery fails to find them:</p>
<pre><code>$('table.calendar td').each(function() {
var $this = $(this);
var t = $this.text();
$this.text(t.replace('[entity here]',''));
});
</code></pre>
<p>This snippet works fine when replacing a normal string, but the <code>&nbsp;</code> seems to be something different!</p>
<p>So my question is this: how can jQuery be used to search and replace HTML entities?</p>
| jquery | [5] |
3,597,984 | 3,597,985 | Calling class attribute without creating an instance to that class | <p>I would like to initialize a class, then call an attribute which was set during the initialization, but without creating another instance. As a test example:</p>
<pre><code>class t1:
def __init__(self, skipInit=False):
if not skipInit:
print 'Initialized'
self.var = 123456
else:
print 'Not Initialized'
def returnVar(self):
return self.var
class t2:
def getVar(self):
print t1.returnVar(t1)
</code></pre>
<p>I want to initialize t1 with <code>t1()</code>, and later on, access to <em>var</em> from t2, with <code>t2.getVar(t2)</code> or some other way from within t2. Obviously the above code is not working, and I have a hard time understanding why. </p>
<p>In actuality the classes are in a wxPython program. There is a Frame->Notebook->Panel->MenuBar hierarchy, all in separate files. I set a number of variables during the Panel initialization, and try to access these from one of the menu items on the GUI. At that point panel will already be initialized and shown, which why I added the skipInit switch. Any ideas on how to do this?</p>
| python | [7] |
3,842,359 | 3,842,360 | Find the differences - 14x14 Images | <p>I have 23 images, they all are 14 pixels x 14 pixels.</p>
<p>In each one there's a letter on a white background (255 255 255 RGB).</p>
<p>I want to compare them and find unique blank pixels to identify that letter.</p>
<p>For example after that comparing procedure I would like to say that a image 14x14 that has the pixel number (3 width, 2 height) white is an "A" for sure.</p>
<p>Is it possible?</p>
<p>I have the main loop to check every pixel but I'm stuck now:</p>
<pre><code>function getpixelat($img,$x,$y) {
$rgb = imagecolorat($img,$x,$y);
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
return $r.$g.$b;
}
for( $y=$inity; $y<$h; $y++) {
for( $x=$initx; $x<$w; $x++) {
$pixel = getpixelat($img,$x,$y);
}
}
</code></pre>
| php | [2] |
1,303,752 | 1,303,753 | Java: Could not reserve enough space for object heap | <p>I am trying to allocate 2 gigs of ram to a java application started from a bat file using this line of code:</p>
<pre><code> @echo off
"%ProgramFiles(x86)%\Java\jre6\bin\java.exe" -Xmx2G -Xms1G -jar craftbukkit-1.2.5-R4.0.jar
pause
</code></pre>
<p>When I attempt to run it like this, however, it spits out an error saying:</p>
<pre><code> Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create teh Java virtual machine
Press any key to continue . . .
</code></pre>
<p>I currently have 8 gig of ram in my computer and I know I am using a max of 3 gigs at all times(I let the computer sit for the most part just running this server file). I have 2x4gig sticks of ram so I know its not separated out, and I know that I have enough free ram to allocate so why would it not let me? I am able to allocate 1536M(1.5 gigs) and under, but if I jump to 2G's it gives me this error. Any help is appreciated</p>
| java | [1] |
5,815,259 | 5,815,260 | Generate a random string with a specific bit size in java | <p>How do i do that? Can't seems to find a way. Securerandom doesn't seems to allow me to specify bit size anywhere</p>
| java | [1] |
5,913,434 | 5,913,435 | Adding space to each array output | <p>I'm trying to add a space after each output but its only appearing on the last output</p>
<pre><code>if ($en['mm_wmeet']) {
$tmp = explode(",", $en['mm_wmeet']);
for ($i = 0; $i < count($tmp); $i++) {
$en['mm_wmeet'] = $tmp[$i]. "&nbsp;";
}
}
</code></pre>
| php | [2] |
735,086 | 735,087 | Post Json Object on server using HttpPost | <p>I have to send json array to the server from android application. i'm able to send data through httpget but i want to send it through httppost i saw the examples but my data are not posting.</p>
<p>i get the response code 200 even i'm passing the wrong parameter in url what's the reason behind this. </p>
<p>here is my code:</p>
<pre><code>DefaultHttpClient UserIDclient = MySSLSocketFactory.getNewHttpClient();
HttpPost httppost = new HttpPost("my url");
List<BasicNameValuePair> nvps = new ArrayList<BasicNameValuePair>();
nvps.add(new BasicNameValuePair("api","apiname"));
nvps.add(new BasicNameValuePair("user_id","179"));
nvps.add(new BasicNameValuePair("child_id","94"));
nvps.add(new BasicNameValuePair("json",json array));
UrlEncodedFormEntity p_entity = new UrlEncodedFormEntity(nvps,HTTP.UTF_8);
httppost.setEntity(p_entity);
HttpResponse response = UserIDclient.execute(httppost);
</code></pre>
| android | [4] |
908,875 | 908,876 | Ignore serialize some object fields at runtime (Dynamic Ignore) | <p>I have a webmethod which return an object ASResponse :</p>
<pre><code> [WebMethod]
public ASResponse test()
{
return new ASResponse ();
}
</code></pre>
<p>Question :</p>
<p>Is it possible to customize the SOAP response by force the compiler do not serialize some ASResponse class fields ( if some condition are true) and allow them if some condition are false.</p>
<p>Samples :</p>
<pre><code><soap:Body>
</code></pre>
<p><code><WrongCaseResponse xmlns="http://tempuri.org"></code></p>
<pre><code><WrongCaseResult>
<Length>5</Length>
<ID>125487</ID>
<Error>183</Error>
</WrongCaseResult>
</WrongCaseResponse>
</soap:Body>
</code></pre>
<p>==========================================================================</p>
<pre><code> <soap:Body>
<SuccessCaseResponse xmlns="http://tempuri.org">
<SuccessCaseResult>
<Length>5</Length>
<ID>125487</ID>
<CallHome>5000</CallHome>
</SuccessCaseResult>
</SuccessCaseResponse >
</soap:Body>
</code></pre>
| c# | [0] |
3,704,715 | 3,704,716 | Don't understand serialize() | <p>I'm looking at this function: serialize() for PHP and I don't really understand what is it's function. Can someone provide a simple example with output? </p>
| php | [2] |
907,974 | 907,975 | Blip Slideshow plug in Mootools/jQuery conflict | <p>This particular site uses the Blip Slideshow plug in (because it's fed by a Picasa web rss feed) and also a jQuery powered slider. The plug in inserts the Mootools script links ahead of the jQuery ones in the header which breaks the slider. I can push the Mootools links to the footer but then Blip doesn't work.
The script that calls the slider is already using jQuery no conflict - I think correctly:</p>
<pre><code>jQuery(document).ready(function() {
jQuery('.fp-slides').cycle({
fx: 'fadeZoom',
timeout: 8000,
delay: 0,
speed: 500,
next: '.fp-next',
prev: '.fp-prev',
pager: '.fp-pager',
continuous: 0,
sync: 1,
pause: 1,
pauseOnPagerHover: 1,
cleartype: true,
cleartypeNoBg: true
});
});
</code></pre>
<p>I've read many forum answers about how to use no conflict but don't know where else it may need to be applied to resolve this.
The scripts in use are:
Mootools v1.3.1
jQuery v1.7.1
jquery.cycle.all
I can post links or any other code that might need to be seen if someone can help sort this out.</p>
| jquery | [5] |
4,400,133 | 4,400,134 | Run app on iTouch w/o iTunes | <p>I have written a small app using Ojective-C w/ XCode. It's only for personal fun and I don't want to pay Apple $99 to just let it run on my iTouch. Is there any alternative for me to run it on iTouch instead of iPhone simulator? Please give me some suggestion.</p>
| iphone | [8] |
2,045,714 | 2,045,715 | solve a bad Url to clean Url in php? | <p>when I spide a website ,I got a lot of bad url like these.
<code>http://example.com/../../.././././1.htm</code>
<code>http://example.com/test/../test/.././././1.htm</code>
<code>http://example.com/.//1.htm</code>
<code>http://example.com/../test/..//1.htm</code></p>
<p>all of these should be <code>http://example.com/1.htm</code>.
how to use PHP codes to do this ,thanks.</p>
<p>PS: I use <a href="http://snoopy.sourceforge.net/" rel="nofollow">http://snoopy.sourceforge.net/</a>
I get a lot of repeated link in my database , the '<code>http://example.com/../test/..//1.htm</code>' should be '<code>http://example.com/1.htm</code>' . </p>
| php | [2] |
2,856,237 | 2,856,238 | Python Cartesian Product | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/533905/get-the-cartesian-product-of-a-series-of-lists-in-python">Get the cartesian product of a series of lists in Python</a> </p>
</blockquote>
<p>I'm trying to figure out some logic that I just can't wrap my head around. Say I have the following data structure:</p>
<pre><code>letters = (
('b','c'),
('a','e','ee'),
('d','f'),
('e','y'),
)
</code></pre>
<p>How would I iterate through this to get every possible string combination:</p>
<pre><code>bade
cade
bede
cede
beede
ceede
bafe
cafe
befe
cefe
beefe
ceefe
bady
cady
bedy
cedy
beedy
ceedy
bafy
cafy
befy
cefy
beefy
ceefy
</code></pre>
| python | [7] |
2,877,844 | 2,877,845 | Copy Speed of Process | <p>think I have a process that perform Copy function with system.io.File.Copy , how can I get copy speed of my process ?</p>
| c# | [0] |
1,110,824 | 1,110,825 | php date manipulation | <p>I am designing a software for leave management in php.I actually need a simple function in php which takes a given date as parameter(i.e any date) and no of days to be added to it as the parameter and returns the resultant date.</p>
<p>The function should accept date in 'YYYY-MM-DD' format and also return resulting date in same mentioned format.</p>
<p>I need help.Any help will be highly appreciated in this regard.</p>
| php | [2] |
3,274,424 | 3,274,425 | Why would I use Angular? | <p>From the basic Angular tutorial, it seems like all it does is fetch some JSON from an API and display it. Also, there's its double binding magic.</p>
<p>But why would I use it instead of a backend solution (like Rails) that builds the view in the backend and serves it to the user, with everything in place already? What are the use cases?</p>
| javascript | [3] |
307,959 | 307,960 | javascript date increment | <p>I want to set a text box with a date (in dd/mm/yyyy format) 14 days ahead to current date in javascript . can any one help me regarding this ? </p>
| javascript | [3] |
3,208,969 | 3,208,970 | how to convert "2012-04-30" date into "04-Apr-2012" format | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/6065507/formatting-dates-using-a-format-class-or-otherwise-if">Formatting Dates using a Format class (or otherwise if )</a> </p>
</blockquote>
<p>I am using "My Sql" Db, In my DB table,i am storing Date in "2012-04-30" format but now i have to show it in my jsp page in this "04-Apr-2012" format.</p>
<p>How can i do it with Java Code?</p>
| java | [1] |
5,147,574 | 5,147,575 | Reading UTF-8 file and writing plain ANSI? | <p>I have an UTF-8 file (it's a csv).<br>
I need to read line by line this file do some replace and then write line by line into another file.</p>
<pre><code> BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(
new FileOutputStream(fileFix), "ASCII")
);
bw.write(""); //clean current file
BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(file),"UTF-8")
);
String line;
while ((line = br.readLine()) != null) {
line = line.replace(";", ",");
bw.append(line + "\n");
}
</code></pre>
<p>Simple as that.<br>
The problem is that the output file (fileFix) is UTF-8 and i think it has the BOM character.</p>
<p>How can I write the file as plain ANSI without the BOM?</p>
<p>The error I am getting while reading my file with a software (weka)</p>
<p><img src="http://i.stack.imgur.com/YygWl.png" alt="enter image description here"></p>
<p>The first line of this file:</p>
<p><img src="http://i.stack.imgur.com/bErW8.png" alt="enter image description here"></p>
<p>Consider that notepad++ tells me the charset is UTF-8. If i try to convert this file in plain ASCII (with windows notepad), that chars disappers</p>
<h2>Solution</h2>
<p>When you are on the first line run:</p>
<pre><code>line = line.substring(1);
</code></pre>
<p>To remove any BOM char.</p>
| java | [1] |
3,379,956 | 3,379,957 | PHP SID not showing | <p>I cannot get my SID working ...</p>
<pre><code><?php
session_start();
// Or maybe pass along the session id, if needed
echo '<br /><a href="page2.php?' . SID . '">page 2</a>';?>
</code></pre>
<p>does not show up SID number but session_id is working not sure if I am missing something.
THnks</p>
| php | [2] |
4,040,484 | 4,040,485 | Reading if-statement one by one | <p>Bassicly i want the user to input "4" and then display the next question but when the user }
q=1;</p>
| android | [4] |
3,370,531 | 3,370,532 | Passing primitive types to a Bundle | <p>When i use Intent.putExtra to a Bundle to pass a int value, is that primitive bumped up to an Object first. I though only Parceable or Serializable objects could be passed to a Bundle. How about primitives. Is this bumped up to an Integer ?</p>
<p>Kind Regards.</p>
| android | [4] |
2,179,462 | 2,179,463 | What is the best way to create a HashMap of String to Vector of Strings in C++? | <p>Criteria, don't want creating copies of objects all over the place.
Should be fast, memory efficient and should not create leaks.
Should be threadsafe.</p>
<p>Ideally I would want to store pointers to vectors in the HashMap, but I am worried about memory leaks that way.</p>
<p>Is this the best way?</p>
<pre><code>std::map<std::string, std::auto_ptr<std::vector<std::string> > > adjacencyMap;
</code></pre>
| c++ | [6] |
3,390,635 | 3,390,636 | Split Paragraphs Java: i want first 50 words in one variable from string | <p>I have</p>
<pre><code>String explanation = "The image-search feature will start rolling out in the next few days, said Johanna Wright, a Google search director. "Every picture has a story, and we want to help you discover that story she said.";
</code></pre>
<p>there are total number of words are 300</p>
<p>In Java, how do I get the first 50 words from the string?</p>
| java | [1] |
907,114 | 907,115 | C++ operator overloading cheatsheet | <p>Does anyone have a summary of boilerplate declarations for C++ operator overloading? A one page pdf would be nice. It would help us forgetful people having to stop and think about where to put our <code>const</code> and <code>&</code> and <code>friend</code> etc.</p>
| c++ | [6] |
4,697,020 | 4,697,021 | tokenise a string and building a multimap | <p>I have string like below:</p>
<pre><code>"1-1-2-1,1-1-3-1,1-2-3-4,2-3-4-5,2-3-5-8"
</code></pre>
<p>i want tokenise the string and store it in a multimap,so that the map looks like below:</p>
<pre><code>key value
1-1 2-1
1-1 3-1
1-2 3-4
2-3 4-5
</code></pre>
<p>well, i can split the string using the below function into a vector</p>
<pre><code>std::vector<std::string> &split(const std::string &s, char delim, std::vector<std::string> &elems)
{
std::stringstream ss(s+' ');
std::string item;
while(std::getline(ss, item, delim))
{
elems.push_back(item);
}
return elems;
}
</code></pre>
<p>But i am out of any clue for creating a map as above.
could anybody please help?</p>
| c++ | [6] |
5,907,391 | 5,907,392 | How do I get this variable to be global? | <p>The problem here is that I do not know where to define the variable <code>wage</code>, before its use in the if-else block to make it a field variable, so it can be recognized and used by Eclipse.</p>
<p>The code just below will give me the error at the last line of code: <code>wage</code> cannot be resolved to a variable. But when I place it in another line of code just under the Scanner console line (4 lines down from the top), it comes up with errors at all lines of code with the variable <code>wage</code> beneath it and says "duplicate local variable" So I do not know where to place it to make it a field variable. Any ideas anyone?</p>
<pre><code>import java.util.Scanner;
public class Java3 {
public static void main(String[] args) {
Scanner console = new Scanner(System.in);
System.out.println("*** Basic Wage Calculator ***");
System.out.printf("%n");
System.out.println("Enter start time in 24:00 format");
String startTime = console.nextLine();
String[] tokens = startTime.split(":");
double starttimeHours = Double.parseDouble(tokens[0]);
double startMinutes = Double.parseDouble(tokens[1]);
if (starttimeHours >= 6 && starttimeHours <= 8
|| starttimeHours >= 9 && starttimeHours <= 19) {
double wage = 1.6;
} else if (starttimeHours >= 9 && starttimeHours >= 10 && startMinutes >= 01) {
double wage = 43;
} else {
double wage = 987;
}
System.out.println(wage);
}
}
</code></pre>
| java | [1] |
483,031 | 483,032 | adding UISearchBar in Navigation based application | <p>I have added UISearch object on view in Navigation based application.</p>
<p>But when i run the application, only table view is visible, why UI Search object is not visible.</p>
<p>Thanks in advance,
iSight</p>
| iphone | [8] |
5,870,471 | 5,870,472 | Why won't this function work in an Object-Oriented style of javascript? | <p>I am trying to access the function as a method of the person object why won't it access the method and do what the function is supposed to do?
</p>
<pre><code>function Person(name, age, location) {
this.name= name;
this.age = age;
this.location = location;
this.test = function() {
alert("TEST");
};
}
var Matt = new Person("Matthew", "21", "South Africa");
Matt.test;
</code></pre>
<p></p>
| javascript | [3] |
4,559,978 | 4,559,979 | How to get the content using jquery | <pre><code><table class="subTable">
<tr><td>09:00</td><td>-</td><td>18:00</td></tr>
<tr><td colspan="3"><!-- 呜呜呜旺旺旺旺王旺旺旺旺wwwwww -->呜呜呜旺...</td></tr>
<tr class="nomoreEvents" style="display:none;"><td colspan="3"><span class="hideId">456</span>&nbsp;</td></tr>
</table>
</code></pre>
<p>how to get the content inside the comments ( <!-- --> ), ie: i want to get 呜呜呜旺旺旺旺王旺旺旺旺wwwwww</p>
| jquery | [5] |
31,338 | 31,339 | Accessing standard call ringtones in iphone sdk | <p>Is it possible to access (ie. list) and then play standard ringtones through the iPhone SDK? I've had a good search through the SDK but can't find anything obvious.</p>
<p>Note I'm not talking about changing ringtones - just being able to have the user select a standard ringtone and then play it from an application via the audio service.</p>
| iphone | [8] |
680,177 | 680,178 | Store Objects in ApplicationContext | <p>When my application goes to background , my (static and singleton) objects are cleared.
So I tried to store these objects in <strong>Applicaton Context</strong> . I am using the following code.</p>
<p>Accounts.create(getApplicationContext()) will be called once to store the accounts instance.</p>
<p>Is that possible(reliable) to store objects in Application Context ? I am not sure the following way is correct or not . please guide ..</p>
<pre><code> public class Init extends Application {
private Hashtable<Object, Object> globalStore = new Hashtable<Object, Object>();
public void putToGlobalStore(Object key, Object value) {
globalStore.put(key, value);
}
public Object takeFromGlobalStore(Object key) {
return this.globalStore.get(key);
}
public void removeFromGlobalStore(Object key) {
this.globalStore.remove(key);
}
public boolean containsInGlobalStore(Object key) {
return this.globalStore.containsKey(key);
}
}
public class Accounts {
protected Accounts(String name, Context context) {
Init init = (Init) applicationContext;
init.putToGlobalStore(name, this);
}
private static Init applicationContext;
public static void create(Context context) {
if (context instanceof Application)
applicationContext = (Init) context;
else
applicationContext = (Init) context.getApplicationContext();
if (applicationContext.containsInGlobalStore(GLOBAL_NAME))
Logger.log("Warning " + GLOBAL_NAME
+ " is already created. This will remove all old datas");
new Accounts(GLOBAL_NAME, applicationContext);
}
private static final String GLOBAL_NAME = "accounts";
public static Accounts getInstance() {
try {
return (Accounts) applicationContext
.takeFromGlobalStore(GLOBAL_NAME);
} catch (Exception e) {
Logger.log("GLOBAL_NAME Lost");
return null;
}
}
</code></pre>
<p>Please help.</p>
| android | [4] |
802,254 | 802,255 | How much text can fit into a string.xml file? | <p>Android: I am programming an app that is beginning to use a massive amount of text. I'm putting all of my text in a string file and calling it from there and then placing portions of it into a textview.</p>
<p>Is there a limit to that or is there a better way to store text (in a file or database?) and then retrieve it to go into a textview and if so...any examples?</p>
| android | [4] |
1,270,807 | 1,270,808 | Generating combinations in c++ | <p>I have been searching a source code for generating combination using c++. I found some advanced codes for this but that is good for only specific number predefined data. Can anyone give me some hints, or perhaps, some idea to generate combination. As an example, suppose the set S = { 1, 2, 3, ...., n} and we pick r= 2 out of it. The input would be n r.In this case, the program will generate arrays of length two, like 5 2 outputs 1 2, 1 3, etc.. I had difficulty in constructing the algorithm. It took me a month thinking about this. Thanks..</p>
| c++ | [6] |
3,290,277 | 3,290,278 | How to upload image into sqlite db in android and view it? | <p>I am a beginner in android development. And I want to make a photo sharing application so that once the application is installed on the android device the user can upload his/her image.
I have seen a lot of examples but nothing works for me. Please help I am newbie.</p>
| android | [4] |
4,005,137 | 4,005,138 | Progress Dialog in Android | <p>can i keep progress dialog anywhere in activity??
if possible then how can i do it???</p>
| android | [4] |
1,349,368 | 1,349,369 | Show custom dialog when spinner is being clicked | <p>Currently, I have the spinner in <code>dialog</code> mode.</p>
<pre><code> <Spinner
android:spinnerMode="dialog"
android:id="@+id/genderSpinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:entries="@array/gender_array"
android:prompt="@string/gender_prompt" />
</code></pre>
<p>It will show something like this</p>
<p><img src="http://i.stack.imgur.com/Ujwt1.png" alt="enter image description here"></p>
<p>However, sometimes, I will like to have control on what type of dialog to be shown. For instance, I will like to show a dialog with date picker, when spinner is being clicked.</p>
<p>Note, Google Calendar does have such controls.</p>
<p><img src="http://i.stack.imgur.com/9gxpd.png" alt="enter image description here"></p>
<p>May I know how can I achieve so?</p>
| android | [4] |
3,233,035 | 3,233,036 | jQuery .click() super simple but don't know what is going on | <p>So I don't quite understand why my function is not working. </p>
<p>So I have a div that gets a class added to it using .addClass and then resizes to the width and height of the window.
When I try to make "close" the div to return the original size it the click function does not work. I have included my code below. Any help is appreciated. I know this is probably a super simple solution. For some reason it doesn't seem to be finding the element to remove the class of 'flip' and resize.</p>
<p>jQuery</p>
<pre><code> var windowHeight = $(window).height();
var windowWidth = $(window).width();
$('.click').on("click", function () {
$(this).addClass('flip').height(windowHeight).width(windowWidth);
});
// for the window resize
$('#CloseThis').on("click", function () {
//alert($(this).parent().attr('class'));
$('body .click').removeClass('flip').height(200).width(200);
});
</code></pre>
<p>HTML</p>
<pre><code><div class="click panel">
<div class="front">
<h2>Click or tap this circle!</h2>
</div>
<div class="back">
<h2>Tap Again!</h2>
<div id="CloseThis">Close this</div>
</div>
</div>
</code></pre>
| jquery | [5] |
2,172,447 | 2,172,448 | Access the base class method with derived class objects | <p>If I am using shadowing and if I want to access base class method with derived class objects, how can I access it?</p>
| c# | [0] |
3,916,212 | 3,916,213 | Detect HTML tags in a string | <p>I need to detect whether a string contains HTML tags. </p>
<pre><code>if(!preg_match('(?<=<)\w+(?=[^<]*?>)', $string)){
return $string;
}
</code></pre>
<p>The above regex gives me an error:</p>
<pre><code>preg_match() [function.preg-match]: Unknown modifier '\'
</code></pre>
<p>I'm not well up on regex so not sure what the problem was. I tried escaping the \ and it didn't do anything. </p>
<p>Is there a better solution than regex? If not, what would be the correct regex to work with the preg_match?</p>
| php | [2] |
5,199,924 | 5,199,925 | User.Identity.Name is blank ASP.NET | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/7839567/why-does-httpcontext-current-user-identity-name-return-blank">Why does HttpContext.Current.User.Identity.Name return blank</a> </p>
</blockquote>
<p>This website has been setup for a very long time and last week all of a sudden it started giving errors. After much debugging I found that the problem was User.Identity.Name. Its returning blank value</p>
<p>We are using Windows Authorization </p>
<p>here is the web.config code</p>
<pre><code><authentication mode="Windows"/>
<identity impersonate="true" />
<authorization>
<allow users="*"/>
</authorization>
</code></pre>
<p>I also tried reverting all my code but the variable is still returning blank</p>
<p>How can I debug this issue?</p>
| asp.net | [9] |
3,489,381 | 3,489,382 | Passing parameters to SAP Crystal report in ASP.NET application | <p>I have a SAP Crystal report, which was converted from VB6 project to VC 2011. This report uses TTX-file and has a couple of parameters. It not uses database connection. </p>
<p>I'm looking for answer for 2 questions:</p>
<ol>
<li>What should be alternate to ttx-file in VC 2010 Web application?</li>
<li>How to pass parameters to Crystal Report?
Current asp-page uses method <code>SetParameterValue()</code>, which is not supported in SAP Crystal Reports. </li>
<li><p>How to set datasource for the report? I use following code to set data set to SAP Crystal Report:</p>
<pre><code>reportDoc.SetDataSource(ds);
</code></pre></li>
</ol>
| asp.net | [9] |
5,563,398 | 5,563,399 | Separate two numbers which are joined by a dash | <p>Could anyone please tell me how I can separate the following numbers.</p>
<pre><code>12255252-675765675
</code></pre>
<p>So they can be called separately:</p>
<pre><code>$number1 = 12255252;
$number2 = 675765675;
</code></pre>
| php | [2] |
2,272,156 | 2,272,157 | How to return multiple values in java? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/457629/how-to-return-multiple-objects-from-a-java-method">How to return multiple objects from a Java method?</a> </p>
</blockquote>
<p>Will it possible to return two or multiple values from a method to main in java? if so, how it is possible and if not how can we do? </p>
| java | [1] |
2,094,433 | 2,094,434 | Get the letters (ABCDE) between two letters (AE) using C# | <p>I need to get the letters as an array on passing two letters using C#</p>
<p>For ex.: When i pass <code>"AE"</code>, i need to get the {A,B,C,D,E} as an array. and passing <code>"FJ"</code> should return {F,G,H,I,J}.</p>
| c# | [0] |
976,628 | 976,629 | Best practices to handle JSON data for API SDK | <p>The company I work for has an API and I am porting that API over to PHP. Right now, the API returns to me a large JSON object and I'm trying to figure out how I should handle the data. I could have a whole bunch of "get" methods, like:</p>
<pre><code>$t = new APIThing();
$t->getJSONObjects();
for ($i=0; ...) {
$t->getHeadline($i);
}
</code></pre>
<p>Or, I could return the JSON object and let people play with the data themselves, so that would be something like this</p>
<pre><code>$t = new APIThing();
$t->getJSONObjects();
foreach ($t as $u) {
echo $u->headline;
}
</code></pre>
<p>So what do you think? Just expose the JSON object or wrap the whole thing up into functions?</p>
| php | [2] |
3,360,592 | 3,360,593 | Append text at after the url with the help of jquery | <p>I'm using this code to grab a url from a clicked link:</p>
<pre><code>var newurl = $(this).attr('href');
</code></pre>
<p>I want to add a string to that url.</p>
<p>For example, my current url is:</p>
<p>mydomain/test.jsp</p>
<p>I want to make it:</p>
<p><a href="http://testdomain.com/mydomain/test.jsp" rel="nofollow">http://testdomain.com/mydomain/test.jsp</a></p>
<p>What should I do to achive this ?</p>
<p>I'd be grateful for your advice!</p>
<p>here is the try fildde
<a href="http://jsfiddle.net/GLw6W/5/" rel="nofollow">http://jsfiddle.net/GLw6W/5/</a></p>
| jquery | [5] |
4,092,712 | 4,092,713 | UIGestureRecognizer equivalent for hitTest: withEvent: | <p>I have two views: view A (huge scroll view (map) with scrolling, zooming, etc.) and its subview B (with same size as A, subclass of uiview, only for drawing of routes). Before that I used hitTest: withEvent: function to forward all user events to A. But now, I have to recognize tap event on view B. I added UITapGestureRecognizer to B, but it didn't work, because all events were "hitten" to A. I comment this function, but now nor scrolling, nor zooming don't work, only tapping..Any ideas? Thank you very much!</p>
| iphone | [8] |
5,201,629 | 5,201,630 | php how to make URL link on view | <p>i did one chat application ,</p>
<p>in the my chat pings area am displaying my pings, if i enter url that is displaying as TEXT but instead i want to display as URL ,</p>
<p>How to display url are Link the view, </p>
<p>Advise...</p>
<p>Example ,</p>
<pre><code>x says:hi Good Morning,
y says:Hi GM,
x says:Chk this www.happylife.in ,(instead text i want to show www.happylife.in URL or LINK)
y says:yes sure
</code></pre>
| php | [2] |
3,283,862 | 3,283,863 | How can i put navigationbar after a splash screen? | <p>I an new in iphone application i want to put Nevigation controller after a splash screen so how can i put?Is there any way to put nevigationbar in my application without Splash Screen. </p>
| iphone | [8] |
675,496 | 675,497 | Correct way to setup a function call from event? | <p>Is this the way to setup my event to call a function?</p>
<p>I have this in a document.ready</p>
<pre><code>$(document).on('change', "[data-viewlink]",
function ()
{
UpdateViewLink($(this).attr("id"));
}
);
</code></pre>
<p>The <code>UpdateViewLink()</code> function is surrounded by a <code>function()</code>. It is a single call and am wondering if <code>function(){}</code> is required. Is this the correct way to set this up?</p>
<p>I also call <code>UpdateViewLink()</code> from normal functions.</p>
| jquery | [5] |
965,883 | 965,884 | How can I set the value of a textbox through PHP? | <p>So I have this empty textboxes in a registrationg page. The user enters some data, hits continue and then there's a confirmation page. If the data is incorrect, the user hits go back to go correct whatever was wrong. However, when he goes back, all the textboxes are empty. So the first thing that comes to my mind is to store the user data in a Session (I have a User class that holds all this data so I store the class in the session). When the user goes back I am able to retrieve the data.</p>
<p>I do something like this:</p>
<pre><code>if($_SESSION['UserInfo'])
{
$user = $_SESSION['UserInfo'];
$firstName = $user->FirstName;
$lastName = $user->LastName;
}
</code></pre>
<p>How would I put these variables in a textbox?</p>
| php | [2] |
1,221,493 | 1,221,494 | c# identifier expected? | <p>I am trying to create a program to copy all the files from one directory to another. But I am running in a basic issue. It says indentifier expected when I try to compile on line 52.</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
static void Main()
{
}
public bool RecursiveCopy()
{
string origDir = @"D:\Documents and Settings\Dub\My Documents\HoN Updates\test";
string destDir = @"C:\Games\HoN";
bool status = false;
//get all the info about the original directory
DirectoryInfo dirInfo = new DirectoryInfo(origDir);
//retrieve all the _fileNames in the original directory
FileInfo[] files = dirInfo.GetFiles(origDir);
//always use a try...catch to deal
//with any exceptions that may occur
try
{
//loop through all the file names and copy them
foreach (string file in Directory.GetFiles(origDir))
{
FileInfo origFile = new FileInfo(file);
FileInfo destFile = new FileInfo(file.Replace(origDir, destDir));
//copy the file, use the OverWrite overload to overwrite
//destination file if it exists
System.IO.File.Copy(origFile.FullName, destFile.FullName, true);
//TODO: If you dont want to remove the original
//_fileNames comment this line out
File.Delete(origFile.FullName);
status = true;
}
Console.WriteLine("All files in " + origDir + " copied successfully!");
}
catch (Exception ex)
{
status = false;
//handle any errors that may have occurred
Console.WriteLine(ex.Message);
}
return status;
}
public string origDir = @"D:\Documents and Settings\Dub\My Documents\HoN Updates\test"; // ERROR HERE
public string destDir = @"C:\Games\HoN"; // ERROR HERE
static void RecursiveCopy(origDir, destDir)
{
Console.WriteLine("done");
Console.ReadLine();
}
}
}
</code></pre>
| c# | [0] |
1,663,880 | 1,663,881 | javascript class problem | <p>Examine this code</p>
<pre><code> var _class=function()
{
this.Test=100;
this.Callback=function(msg)
{
alert(msg+"\r\n"+this.Test);
}
}
function run(call)
{
call("Hello world");
}
var obj=new _class();
run(obj.Callback);
</code></pre>
<p>I got the result :</p>
<pre><code> [Alert]
Hello world
undefined
</code></pre>
<p>but when i call
obj.Callback("Hello world")</p>
<p>i got expected</p>
<pre><code> [Alert]
Hello world
100
</code></pre>
<p>why ?</p>
<p>thank for help</p>
| javascript | [3] |
3,325,063 | 3,325,064 | email authentications | <p>hey can any one suggest me is there any API or example for authenticating email addresses in iphone app</p>
| iphone | [8] |
2,393,974 | 2,393,975 | return statement in a function as class | <p>I am confused about the return statement in a function that serves as a class. See the example code below:</p>
<pre><code><html>
<body>
<script type="text/javascript">
function test() {
this.abc = 'def';
return 3;
}
var mytest = new test();
document.write(mytest + ', ' + (typeof mytest) + ', ' + mytest.abc);
</script>
</body>
</html>
</code></pre>
<p>The code out put: [object Object], object, def.</p>
<p>Here is my question. I wrote 'return 3' in the test() function. Is this statement ignored when 'new test()' is called?</p>
<p>Thanks.</p>
| javascript | [3] |
4,470,825 | 4,470,826 | How can I disable the next button in liquid jquery carousel? | <p>Im using jQuery Liquid Carousel plugin and i dont know how to disable previous and next button .Can you please help me?? </p>
| jquery | [5] |
109,078 | 109,079 | What's the difference between double exclamation operator and Boolean() in JavaScript? | <p>I know that <code>!!variable</code> will convert variable into a boolean value and the function <code>Boolean()</code>, according to the ecma262 spec, will also perform a type conversion by calling <code>ToBoolean(value)</code>.</p>
<p>My question is: what's the difference? Is <code>!!</code> better in performance than Boolean() ?</p>
| javascript | [3] |
1,225,455 | 1,225,456 | Send and Receive messages between registered users | <p>I have a website I am implementing and I want to add a functionality to send and receive messages between registered users. What is the best way to go about implementing it in C# asp.net?</p>
<p>Thanks</p>
| asp.net | [9] |
29,870 | 29,871 | Fatal error: Call to undefined function empty() | <p>Any idea why I'm getting this strange error? "Fatal error: Call to undefined function empty()"</p>
<pre><code>function newpart($name,$country,$bday_day,$bday_month,$bday_year,$gender,$pass1,$pass2,$email,$option1,$secondOption1,$secondOptionLevel1){
$this->name = $name;
$this->country = $country;
$this->bday_day = $bday_day;
$this->bday_month = $bday_month;
$this->bday_year = $bday_year;
$this->gender = $gender;
$this->pass1 = $pass1;
$this->pass2 = $pass2;
$this->email = $email;
$this->option1 = $option1;
$this->secondOption1 = $secondOption1;
$this->secondOptionLevel1 = $secondOptionLevel1;
if( empty($this->name) || empty($this->pass1) ){
$this->errorCount++;
}
}
</code></pre>
| php | [2] |
2,009,249 | 2,009,250 | Reverse loop for date display | <p>I've been trying to figure this out and can't seem to get it.</p>
<p>Here is the code..</p>
<pre><code> $m= date("m");
$de= date("d");
$y= date("Y");
for($i=0; $i<=6; $i++){
echo "<br>";
echo date('m/d',mktime(0,0,0,$m,($de+$i),$y));
echo "<br>";
}
</code></pre>
<p>It displays the following.</p>
<pre><code>04/08
04/07
04/06
04/05
04/04
04/03
04/02
</code></pre>
<p>That is exactly what I want, but I want it to flip around so echos it would look like the following.</p>
<pre><code>04/02
04/03
04/04
04/05
04/06
04/07
04/07
</code></pre>
<p>How would I do this?</p>
| php | [2] |
313,790 | 313,791 | How can I create a user defined data structure in pyton | <p>In python, how can I create a data structure like</p>
<pre><code>class Person {
String firstName;
String lastName;
}
</code></pre>
<p>and then I create a structure of 'Person' object.</p>
<p>Thank you.</p>
| python | [7] |
4,501,222 | 4,501,223 | PHP: How to get an array's value by its numeric offset if it's an associative array? | <p>I have an associative array which when var dumped looks like this:</p>
<pre><code>Array
(
[tumblr] => Array
(
[type] => tumblr
[url] => http://tumblr.com/
)
[twitter] => Array
(
[type] => twitter
[url] => https://twitter.com/
)
)
</code></pre>
<p>As you can see the key's are custom "tumblr" and "twitter" and not numeric 0 and 1.</p>
<p>Some times I need to get the values by the custom keys and sometimes I need to get values by numeric keys.</p>
<p>Is there anyy way I can get <code>$myarray[0]</code> to output:</p>
<pre><code>(
[type] => tumblr
[url] => http://tumblr.com/
)
</code></pre>
| php | [2] |
1,375,292 | 1,375,293 | comparison if statment should be called twice but it is only called once when comparing an Integer | <p>I have a function that takes a Integer array and a boolean array. If the value in the Integer array is the highest value and the boolean array is true, the value in the trackerArray is set to true. This is a simplified version of my code that produces the error...</p>
<pre><code>package com.thisis.a.test;
public class ThisIsATest {
public static void main(String[] args){
Integer[] integerArray = new Integer[]{75,200,75,200,75};
boolean[] booleanArray = new boolean[]{false,true,false,true,false};
boolean[] trackerArray = new boolean[]{false,false,false,false,false};
Integer iHighestSum = 0;
for(int c = 0; c < booleanArray.length; c++){
if(booleanArray[c] == true)
if(integerArray[c] > iHighestSum)
iHighestSum = integerArray[c];
}
for(int c = 0; c < booleanArray.length; c++){
if(booleanArray[c] == true)
if(integerArray[c] == iHighestSum)
trackerArray[c] = true; // this if statement should be called twice
}
// trackerArray should be {false,true,false,true,false}
// instead it is {false,true,false,false,false}
}
}
</code></pre>
<p>The trackerArray should be {false,true,false,true,false}, instead it is {false,true,false,false,false}. The if statment should be triggered twice but instead it is only triggered once. Why is this?</p>
| java | [1] |
3,641,290 | 3,641,291 | Join Declaration and Assignment or not to join...That is the question | <p>There are 2 school of thoughts on debugging. One says declare your variable first, then assign...for easier debugging.</p>
<pre><code>int myInt;
myInt = GetSomething();
</code></pre>
<p>or there is a school of thought that says that's just not clean, just do this:</p>
<pre><code>int myInt = GetSomething();
</code></pre>
<p>I don't understand how the first helps. Because if I put a debug point over myInt in either case, it's going to give me a value that I can check anyway. </p>
<p>So can someone tell me in detail when debugging, how the first approach is worth putting 2 lines in? I know some people swear by it.</p>
<p>Obviously there are times you must do the first, because you may need to do more than just a one-time set such as set an object's properties. But outside that, a one-time call to set a variable is what I'm specifically talking about here.</p>
| c# | [0] |
4,521,133 | 4,521,134 | I am able to get current location using gps connection only after half an hour in Android? | <p>I am working in location based project. I am able to get current location in some android mobiles quicker. But I am able to get current location in some android mobiles, only after some half an hour. I only need to use GPS connection. So, I disabled "Use wireless networks" and enabled "Use GPS satellites". I need to finish it soon. Please give some solution to fix it. Thanks in Advance.</p>
<p>The Coding Which I am using is as follows:</p>
<pre><code>LocationManager locationManager;
String context = Context.LOCATION_SERVICE;
locationManager = (LocationManager)getSystemService(context);
Criteria crta = new Criteria();
crta.setAccuracy(Criteria.ACCURACY_FINE);
crta.setAltitudeRequired(false);
crta.setBearingRequired(false);
crta.setCostAllowed(true);
crta.setPowerRequirement(Criteria.POWER_LOW);
//String provider = locationManager.getBestProvider(crta, true);
String provider = LocationManager.GPS_PROVIDER;
Location location = locationManager.getLastKnownLocation(provider);
updateWithNewLocation(location);
locationManager.requestLocationUpdates(provider, 1000, 1, locationListener);
</code></pre>
<p>I dont know why, In some mobile I am able to get the current location quicker.
But later in some other mobiles. Please give me some solution as soon as possible. Please help me my code is working by the way.</p>
| android | [4] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.