Unnamed: 0
int64 65
6.03M
| Id
int64 66
6.03M
| Title
stringlengths 10
191
| input
stringlengths 23
4.18k
| output
stringclasses 10
values | Tag_Number
stringclasses 10
values |
|---|---|---|---|---|---|
5,966,056
| 5,966,057
|
Fade out, replace image and fade in
|
<p>I have some problems with this script and I would appreciate some help to get it to work. First I fade out the old image and then I load the new image that in the same time fades in. The new image isn't replaced when I use the fade in!?</p>
<pre><code>$("#image2").click(function () {
$("#portfolio").fadeOut('slow', function () {
$("#portfolio").attr("src", "Images/Portfolio/portfolio_strv.jpg", function () {
$(this).fadeIn(400);
});
});
});
</code></pre>
|
jquery
|
[5]
|
1,954,630
| 1,954,631
|
Can I write a java application for Login purpose?
|
<p>I need to handle Login functionality to a particular site say <code>www.abc.com</code>. I had already registered to this particular site, hence can I give the username and password hardcoded in my application so that I can have connected to the server directly.</p>
<p>Thanks & Regards</p>
|
java
|
[1]
|
4,921,040
| 4,921,041
|
Removing cdata in simplehtmldom
|
<p>Hello good day I am trying to scrape an xml feed that was given to us, I am using simple htmldom to scrape it but some contents have cdata, how can I remove it?</p>
<pre><code><date>
<weekday>
<![CDATA[ Friday
]]>
</weekday>
</date>
</code></pre>
<p>php</p>
<pre><code><?php
<?php
include('simple_html_dom.php');
include ('phpQuery.php');
if (ini_get('allow_url_fopen'))
$xml = file_get_html('http://www.link.com/url.xml'); }
else{ $ch = curl_init('http://www.link.com/url.xml');
curl_setopt ($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$src = curl_exec($ch);
$xml = str_get_html($src, false); }
?>
<?php
foreach($xml->find('weekday') as $e)
echo $e->innertext . '<br>';
?>
</code></pre>
<p>I believe by default simplehtmldom removes the cdata but for some reason it doesn't work.</p>
<p>Kindly tell me if you need any info that would be helpful to solve this issue </p>
<p>Thank you so much for your help</p>
|
php
|
[2]
|
5,381,137
| 5,381,138
|
How to get alphabets only from given albha-numberic word in java?
|
<p>sorry for this if this is a silly question.but i need to know about this.</p>
<p>If i have a word like alphabets,numeric and special charters. I need to extract alphabets only.No need for numeric and special characters.I need to know is there default function is there in Java to split characters only?</p>
<pre><code>eg.String word="te123@#st";
</code></pre>
<p>I need <strong>test</strong> only.</p>
|
java
|
[1]
|
4,682,289
| 4,682,290
|
Getting NoClassDefFoundError for a class present in the project
|
<pre><code>decodeThread = new DecodeThread(activity, decodeFormats, characterSet,
new ViewfinderResultPointCallback(activity.getViewfinderView()));
</code></pre>
<p>For the above code I am getting below exception:</p>
<pre><code>01-24 01:33:02.078: E/AndroidRuntime(708): java.lang.NoClassDefFoundError: com.main.onlinecart.ViewfinderResultPointCallback
</code></pre>
<p>The class <code>ViewfinderResultPointCallback</code> is present in the same package of the calling class. I am not getting the error for other classes that are being used from the same package. What can be a possible problem here? Anything related to classpath? Where can i crosscheck the class path variable?</p>
<p>I am using eclipse (on mac os x) and running the project from Run configuration.</p>
<p>The class <code>ViewfinderResultPointCallback</code> implements another class <code>ResultPointCallback</code> which is not in the same package but it is present in a jar added in the build path of the project. And i see one exception in the log: </p>
<pre><code>01-24 01:33:01.968: I/dalvikvm(708): Failed resolving com/main/onlinecart/ViewfinderResultPointCallback; interface 472 'Lcom/google/zxing/ResultPointCallback;'
01-24 01:33:01.968: W/dalvikvm(708): Link of class 'Lcom/main/onlinecart/ViewfinderResultPointCallback;' failed
</code></pre>
<p>but there are many other classes from the same jar which are not throwing any error.</p>
|
java
|
[1]
|
5,841,535
| 5,841,536
|
CallerMemberNameAttribute and .Net 4
|
<p>All,</p>
<p>I noticed in .Net 4.5 there is a CallerMemberName attribute, which Blend specifically uses to raise a PropertyChanged event from the calling method. My question is, since this attribute doesn't specifically exist in .Net 4.0, is it possible to somehow duplicate this behavior by creating a custom attribute? Code samples much appreciated.</p>
|
c#
|
[0]
|
1,502,360
| 1,502,361
|
How does the equivalence operator work with arrays in PHP?
|
<p>Code:</p>
<pre><code>$arr = array( 10, 20, 30 );
$arr1 = array(
1=>30,
2=>20,
0=>10
);
var_dump( $arr == $arr1 );
$a = array( 1, 2, 3);
$b = array(
1=>2,
2=>3,
0=>1
);
var_dump($a == $b);
</code></pre>
<p>This outputs:</p>
<pre><code>bool(false)
bool(true)
</code></pre>
|
php
|
[2]
|
3,736,967
| 3,736,968
|
How to set the application as a default one?
|
<p>I download a ics file (Outlook Calendar File) from a mail attachment in my application. Another application also downloads the ics file. I need to set my application as the default application to open the ics files (from my program). <strong>Is there any possibility to know our application is the default application or not from our program?</strong> </p>
<p>If my application is not a default application, is the user select my application at that time i have to get some details from the user.Can anyone help me to solve this???</p>
|
android
|
[4]
|
5,610,384
| 5,610,385
|
Definition of 'enumerator' in C#
|
<p>What is the meaning of enumerator in C#?</p>
|
c#
|
[0]
|
647,181
| 647,182
|
how linq query bind to stimulsoft report
|
<p>I use stimulsoft for get report.first i design a report with stireport1 name.
but i click on button for report show , a empty report display for me.why?my code is:</p>
<pre><code>private void radButton1_Click(object sender, EventArgs e)
{
// stiReport1.RegData("query", query);
// stiReport2.RegBusinessObject("PUBS", "pub_info", query);
//stiReport2.RegData("pub_info", query);
// stiReport2.RegReportDataSources() = query;
// stiReport2.Dictionary.Databases.Add(query);
// stiReport2.Render();
StiReport st = GetReport();
st.Show();
}
private StiReport GetReport()
{
StiReport report = new StiReport();
if (File.Exists("D:\\stiReport1"))
{
report.Load("D:\\stiReport1");
}
PUBSEntities db = new PUBSEntities();
var query = (from p in db.pub_info
select p).ToList();
db.Dispose();
// report.RegBusinessObject("PUBS", "pub_info", query);
report.RegData("mypub",query);
return report;
}
</code></pre>
|
c#
|
[0]
|
1,425,013
| 1,425,014
|
html formatting does not show properly
|
<p>I am using tinymcs editor and by that editor I write some text containing bullet through that editor. In database it is saving properly. But when I fetch the records, all the things are coming properly like paragraph, color etc. except the bullet format.
Which function I have to use so that all the styles used in editor will be shoing in the page. I understand this is happening as I directly access those from database.
Thank in avance.</p>
|
php
|
[2]
|
1,407,882
| 1,407,883
|
C# windows application
|
<p>Hi all i am doing an application in win forms</p>
<p>I am having a small issue i.e i am having my main form as</p>
<p>Tree view, panel and a data grid. I am having some user control forms.</p>
<p>When i select a node from tree view corresponding user control will be get loaded in the panel if main form. This works good.</p>
<p>Now for the child nodes i am having some text files attached when i click on that i will display the data grid along with the data present in the text file. This also works fine.</p>
<p>But now when click on data grid cells i would like to show the data in the user control form .</p>
<p>Can any one tell how to handle the controls from particular user controls that was displayed </p>
|
c#
|
[0]
|
2,421,186
| 2,421,187
|
How could you detect programmatically when your server is over capacity in ASP.NET?
|
<p>One of the <em>interesting</em> things about Twitter is the over capacity, fail whale. My question is, programmatically, how can they detect when their system is over capacity? Is there a special type of exception that gets thrown in this case?</p>
|
asp.net
|
[9]
|
4,034,622
| 4,034,623
|
culture name is not supported
|
<p>I'm receiving "culture name 'uploads' is not supported" when my asp.net app start. Where I have to view/debug to toggle the error? A full-text for "uploads" returns o entries in my project</p>
|
asp.net
|
[9]
|
4,898,356
| 4,898,357
|
Python: print a generator expression?
|
<p>In the Python shell, if I enter a list comprehension such as:</p>
<pre><code>>>> [x for x in string.letters if x in [y for y in "BigMan on campus"]]
</code></pre>
<p>I get a nicely printed result:</p>
<pre><code>['a', 'c', 'g', 'i', 'm', 'n', 'o', 'p', 's', 'u', 'B', 'M']
</code></pre>
<p>Same for a dictionary comprehension:</p>
<pre><code>>>> {x:x*2 for x in range(1,10)}
{1: 2, 2: 4, 3: 6, 4: 8, 5: 10, 6: 12, 7: 14, 8: 16, 9: 18}
</code></pre>
<p>If I enter a generator expression, I get not such a friendly response: </p>
<pre><code>>>> (x for x in string.letters if x in (y for y in "BigMan on campus"))
<generator object <genexpr> at 0x1004a0be0>
</code></pre>
<p>I know I can do this:</p>
<pre><code>>>> for i in _: print i,
a c g i m n o p s u B M
</code></pre>
<p>Other than that (or writing a helper function) can I easily evaluate and print that generator object in the interactive shell? </p>
|
python
|
[7]
|
222,648
| 222,649
|
How does the GMail app implement its selection summary in ActionBar?
|
<p>When an email is selected for deletion in the GMail app, the ActionBar looks like so:</p>
<p><img src="http://i.stack.imgur.com/TcYpX.png" alt="enter image description here"></p>
<p>There is a check mark and selection count displayed, with a subtle entry and exit animation. It appears it's an overlay that's on top of the ActionBar or replaces it.</p>
<p>Since I don't know the name of this widget I have trouble finding info about it. </p>
<ul>
<li>Is it part of the API? Google Calendar has a similar overlay when creating an event, which makes me think it's possibly part of the API.</li>
<li>If it is, what is it called?</li>
<li>How is the ActionBar updated with the row selection count? (No need for code, just a brief explanation would be helpful on how to write content to the the ActionBar overlay shown in the image).</li>
</ul>
|
android
|
[4]
|
4,569,325
| 4,569,326
|
jQuery Swapping Elements
|
<p>Ok let me make an example:</p>
<pre><code><head>
<script type="text/javascript">
$(document).ready(function(){
$("#options_2").hide();
$("#options_3").hide();
});
</script>
</head>
<body>
<div id="options_1">option 1</div>
<div id="options_2">option 2</div>
<div id="options_3">option 3</div>
<a href="" class="selected">choose option 1</a>
<a href="">choose option 2</a>
<a href="">choose option 3</a>
</body>
</code></pre>
<p>As you can see only option 1 is visible by default, and the link you click to show option 1 has the class="selected" by default, showing the user that that option is currently selected. I basically want it so that when they click "choose option 2" the options 1 div hides itself and the options 2 div shows itself, and then gives the second link the selected class and removes the class from the image link.</p>
<p>It basically just tabs using links and divs but due to the format I have to display it in I cannot use any of the tabs plugins I have found online.</p>
|
jquery
|
[5]
|
354,673
| 354,674
|
parse string to time
|
<p>I am looking to extract the time out of this string</p>
<pre><code>Tue, 13 Mar 2012 04:48:34 -0400
</code></pre>
<p>I know that strtotime may work but I am not sure of implemation on how to just get <code>04:48:34</code> out from that string</p>
<p>thanks</p>
|
php
|
[2]
|
4,292,433
| 4,292,434
|
How to call default implementation of heightForRowAtIndexPath?
|
<p>In my <code>heightForRowAtIndexPath</code> method I want to customize height only for certain rows. For the rest I want the framework to take care. How would I do that?</p>
|
iphone
|
[8]
|
2,553,491
| 2,553,492
|
Learning PHP and web-programming for intermediate programmers
|
<p>I would like to know some good resources (book or website) on learning PHP for those who are already familiar with programming. Many of the tutorials I've been finding are for people who never programmed before and take way to long to go through to even learn basic language constructs. The optimal resource would not assume previous web-development background however.</p>
<p>Thanks,
Michal Gorecki</p>
|
php
|
[2]
|
309,038
| 309,039
|
How can I separate the Jquery effects?
|
<p>I have this function:</p>
<pre><code>$("a#quicktabs-tab-menu-1").click(function () {
$("a#top20").fadeOut("SLOW");
$("div.ads").fadeOut("SLOW");
$("div.device").fadeOut("SLOW");
$("#new_music_bg").fadeIn("SLOW");
});
</code></pre>
<p>But when I run it All the effect functioning together.</p>
<p>how can I make the first effect done and then start the second one and etc.</p>
<p>Thank you very much</p>
|
jquery
|
[5]
|
3,287,860
| 3,287,861
|
how to expend and shrink fragments dyanamically
|
<p>I am making an application which is based on fragment , in which I</p>
<p>have made several fragments. Now I want to provide the tablet functionality to </p>
<p>each of my fragment. I mean to say that I can perform expandable and shrinkable </p>
<p>functionality to each of my fragment in the way that when I expand one fragment </p>
<p>my another fragments should shrink automatically and vice versa too.</p>
<p>How can I do this?</p>
|
android
|
[4]
|
395,118
| 395,119
|
How to let the code wait to be executed until the other event handler finished?
|
<p>In the following code, I want to use the <code>geometryService</code> (a utility class provided by third party) to sequentially calculate several shape area. I failed because the second time area calculation mustn't wait until the first calculation is finished. To resolve this issue, I can put the second area calculation into the finish calculation event handler, but the code is a mess. Is there a better way I can make <code>geometryService.AreasAndLengthsAsync(secondShape)</code> wait to execute until<code>geometryService.AreasAndLengthsAsync(firstShape)</code> is finished executing?</p>
<pre><code>Shape firstShape = new Shape();
Shape secondShape = new Shape();
GeometryService geometryService = new GeometryService();
geometryService.AreaAndLengthsCompleted += GeometryService_AreasAndLengthsCompleted;
geometryService.AreasAndLengthsAsync(firstShape);
geometryService.AreasAndLengthsAsync(secondShape);
private void GeometryService_AreasAndLengthsCompleted(object sender, AreasAndLengthsEventArgs args){ }
</code></pre>
|
c#
|
[0]
|
3,694,445
| 3,694,446
|
javascript if/else or ternary operator is faster?
|
<p>Which method is faster or more responsive in javascript, if/else or the ternary operator? Is it preferred to use one or the other and if so, for what reasons?</p>
|
javascript
|
[3]
|
4,895,121
| 4,895,122
|
What's the point of this code pattern?
|
<p>I was trying to create a python wrapper for an tk extension, so I looked at Tkinter.py to learn how to do it. </p>
<p>While looking at that file, I found the following pattern appears a lot of times: an internal method (hinted by the leading "_" in the method name) is defined, then a public method is defined just to be the internal method. </p>
<p>I want to know what's the benefit of doing this.</p>
<p>For example, in the code for class Misc:</p>
<pre><code>def _register(self, func, subst=None, needcleanup=1):
# doc string and implementations is removed since it's not relevant
register = _register
</code></pre>
<p>Thank you.</p>
|
python
|
[7]
|
2,551,692
| 2,551,693
|
Assembler in C++
|
<p>I have the following code.</p>
<pre><code>#include<iostream>
using namespace std;
int main() {
int result=0;
_asm {
mov eax,2
mov eax,result;
}
cout<<result<<endl;
return 0;
}
</code></pre>
<p>I know assembler well but why doesn't the program output 2 to the screen?</p>
|
c++
|
[6]
|
3,075,405
| 3,075,406
|
How to get information about the satellites from android?
|
<p><br>
I am trying to get the satellite information from the android and wrote this following code which is not giving any results, could any one point out why is it so? <br></p>
<pre><code>public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.gps);
final LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
GpsStatus gpsStatus = locationManager.getGpsStatus(null);
if(gpsStatus != null)
{
Iterable<GpsSatellite>satellites = gpsStatus.getSatellites();
Iterator<GpsSatellite>sat = satellites.iterator();
int i=0;
while (sat.hasNext()) {
GpsSatellite satellite = sat.next();
strGpsStats+= (i++) + ": " + satellite.getPrn() + "," + satellite.usedInFix() + "," + satellite.getSnr() + "," + satellite.getAzimuth() + "," + satellite.getElevation()+ "\n\n";
}
}
TextView tv = (TextView)(findViewById(R.id.Gpsinfo));
tv.setText(strGpsStats);
}
</code></pre>
<p>thanks<br>
Nohsib</p>
|
android
|
[4]
|
3,821,481
| 3,821,482
|
Difference between Service and Thread in Android?
|
<p>all I need to know is that when I can do some operation using an independent thread, why do I need Service.
<strong>What is that, a Service can do but a Thread can't?</strong>
I did go to through many of the posts but couldn't find a satisfactory answer.</p>
|
android
|
[4]
|
1,410,827
| 1,410,828
|
which mode of NFC supports p2p payment?
|
<p>I have started working p2p payment using LLCP mode, but most of the phones doesn't support LLCP.
so apart from this LLCP, can anyone please tell me, which mode of NFC will support this p2p payment.</p>
<p>Thanks</p>
|
java
|
[1]
|
2,409,999
| 2,410,000
|
How do I break out of an $.each in jquery?
|
<p><strong>How to I break out of the following jquery each method when a condition is met;</strong></p>
<pre><code>var rainbow = {'first' : 'red', 'second' : 'orange', 'third' : 'yellow'};
$.each(rainbow, function (key, color) {
if (color == 'red') {
//do something and then break out of the each method
alert("i'm read, now break.");
}
});
</code></pre>
|
jquery
|
[5]
|
587,921
| 587,922
|
how to get next day of current date in a MonthDisplayHelper in android?
|
<p>i have a monthdisplayhelper to display the month, i want to select days between two date. i.e.,if i selected 2nd July and 9th July, all the dates(3rd to 8th) in between these dates must be selected or highlighted.</p>
|
android
|
[4]
|
395,220
| 395,221
|
case-insensitive alphabetical sorting of nested lists
|
<p>i'm trying to sort this nested list by inner's list first element:</p>
<pre><code>ak = [ ['a',1],['E',2],['C',13],['A',11],['b',9] ]
ak.sort(cmp=lambda x, y: cmp(x[0], y[0]))
for i in ak: {
print i
}
</code></pre>
<p>by default python considers A > a, hence the output i get is:</p>
<pre><code>['A', 11] ['C', 13] ['E', 2] ['a', 1] ['b', 9]
</code></pre>
<p>i've tried converting all list values to even case during comparison by adding x[0].lower etc. but no use. How do i force python (i'm working on 2.4 version) to do case-insensitive alphabetical sorting?</p>
<p><strong>Edited:</strong></p>
<blockquote>
<p>Jarret and Brian, your
assumptions about parenthesis were
right! I did forget to put them in! And Jarret, your suggestions about not using "cmp" works like a charm! Thanks a lot guys!</p>
</blockquote>
|
python
|
[7]
|
4,415,433
| 4,415,434
|
Tamper voice using audiorecord
|
<p>I am recording my voice using <strong><code>AudioRecord</code></strong> class and I am playing it with a small delay using <strong><code>AudioTrack</code></strong></p>
<p>How can I change what my voice sounds like?</p>
|
android
|
[4]
|
4,346,962
| 4,346,963
|
Symbolic links in php
|
<p>I am trying to create a symbolic link in php, on linux</p>
<p>if i create the link manually with ln -s targetfile linkfile it works just fine</p>
<p>if i try </p>
<pre><code><?php
symlink($targetfilefullpath, $linkfilefullpath) ;
?>
</code></pre>
<p>nothing happens, there is no link</p>
<p>also if i try</p>
<pre><code><? php
shell_exec("ln -s ".$targetfilefullpath." ".$linkfilefullpath);
?>
</code></pre>
<p>also nothing happens, there is no link</p>
<p>all the targetfiles and folders have chmod 777</p>
<p>what could be wrong ?</p>
|
php
|
[2]
|
1,889,697
| 1,889,698
|
C# - Generics- string array processing
|
<p>We have two set of string arrays, e.g.:</p>
<pre><code>string[] a = new string[] {"value1","value2","value3"};
string[] b = new string[] {"value1","value2","value3"};
</code></pre>
<p>I have to develop a generic method which should takes these two string arrays as parameters
and should return the combined one back:</p>
<pre><code>public T[] ArrayItms(T1[] a, T2[] b)
{
return T[];
}
</code></pre>
<p>I got bit confused, doing so in generics.</p>
|
c#
|
[0]
|
5,496,774
| 5,496,775
|
How to disable javascript from firebug?
|
<p>How can I prevent my javascript from Firebug view?So that I can prevent Hacking from Javascript?</p>
|
javascript
|
[3]
|
2,818,673
| 2,818,674
|
How do you enclose unknown HTML in a div with plain Javascript?
|
<p>I have an HTML page that has varying types of content. I would like to make a javascript function that when run encloses anything inside the <code><body></code> tag with a <code><div id="content-container"></code>. Then I want to be able to add a <code><div id="verifying"></div></code> that new <code><div></code>. I think I know how to do this with jQuery, but I need to do it with plain Javascript. </p>
<p>Any idea as to how this would be done?</p>
|
javascript
|
[3]
|
74,782
| 74,783
|
necessity of prototype declaration in every method
|
<p>Is is necessary to have "prototype" appended to every method of class.. or namespace is enough in example below (for full example refer link below). I understand that it is good practice but do inheritance really require the keyword "prototype" declare in every method.. what is the real necessity inheritance</p>
<pre><code>if(animal === undefined) var animal = {};
animal.Mammal.prototype.haveABaby=function(){
var newBaby=new Mammal("Baby "+this.name);
this.offspring.push(newBaby);
return newBaby;
}
animal.Mammal.prototype.toString=function(){
return '[Mammal "'+this.name+'"]';
}
</code></pre>
<p><a href="http://phrogz.net/JS/classes/OOPinJS2.html" rel="nofollow">http://phrogz.net/JS/classes/OOPinJS2.html</a></p>
|
javascript
|
[3]
|
5,330,208
| 5,330,209
|
Pressing "back" key when a killed process was on the stack
|
<p>I'm learning Android development and I'm a bit confused about how Android manages killing process when an activity is on the task's stack.
Let's say I have a task with 4 activities: A-B-C-D.</p>
<p>Let A,B,D be part of process P1 and C be part of process P2.</p>
<p>Let's suppose that while the user is interacting with D Android kills P2 since D needs a lot of memory. What happens when the user press the back key?</p>
<p>1) Since P2 has been killed and C is missing, B will be on the top (i.e. the stack becomes A-B).
2) A new process (let it be P3) is created and activity C is restarted (but of course its state will be the "starting" state)</p>
|
android
|
[4]
|
2,775,066
| 2,775,067
|
read file in php and insert into ec2 amazon server mysql database
|
<p>actually im having list of medicine in a file and i want to insert it on ec2 amazon server database which is mysql.I run this file on localhost.when im trying my code, which is in php it show an error as follows:im not getting.</p>
<p>Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on 'ec2-122-248-220-105.ap-southeast-1.compute.amazonaws.com' (10060) in C:\websites\medicine\filehandling.php on line 17
Can't connect to MySQL
This is a servername:ec2-122-248-220-105.ap-southeast-1.compute.amazonaws.com
here is my code... and let me know where im wrong.</p>
<pre><code><?php
$hostname='http://ec2-122-248-220-105.ap-southeast-1.compute.amazonaws.com';
//$port='3306';
$user='root';//// specify username
$pass='bitnami'; //// specify password
$dbase='fortis'; //// specify database name
set_time_limit(1000);
$connection = mysql_connect("$hostname" , "$user" , "$pass" ,"$port")
or die ("Can't connect to MySQL");
$db = mysql_select_db($dbase , $connection) or die ("Can't select database.");
$file = fopen("med4","r") or exit ("File not found");
$c =0 ;
while (!feof($file)){
++$c;
$val = fgets($file);
mysql_query("insert into patientinfo_medicines (medicine) values ('$val')");
}
fclose($file);
echo $c;
?>
</code></pre>
|
php
|
[2]
|
1,794,708
| 1,794,709
|
Sanitise or validate email php
|
<p>I am using <code>filter_var</code></p>
<p>and a function to check if the email is valid</p>
<pre><code>function checkEmail($email)
{
return filter_var($email, FILTER_VALIDATE_EMAIL);
}
</code></pre>
<p>This is only thing I do. In registration for example i validate email with this function then insert in database (prepared statement used ofc) <strong>But is it essential to use sanitisation in this function as well?</strong> Is there any "VALID" but "DANGEROUS" email that could cause problem...?</p>
|
php
|
[2]
|
2,495,633
| 2,495,634
|
What's wrong with my 9-patch PNG for Button
|
<p>I created a 9-patch PNG but it won't work. In the Android SDK Tool everything looks ok. But when i add it to a Button then i only see a pink background. The text placement (padding from the patch) seems to be ok. What am i doing wrong?</p>
<pre><code> <Button
android:id="@+id/button_settings"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:text="Settings"
android:textColor="#fff"
android:background="@drawable/button_settings_idle"
/>
</code></pre>
<p>The 9-patch in the Android SDK Tool:</p>
<p><img src="http://i.stack.imgur.com/QjaiO.jpg" alt="The 9-patch in the Android SDK Tool"></p>
<p>A normal Button and the Button with the PNG:</p>
<p><img src="http://i.stack.imgur.com/drPdV.png" alt="A normal Button and the Button with the PNG"></p>
<p>The PNG used in my project</p>
<p><img src="http://i.stack.imgur.com/MN1P0.png" alt="The PNG used in my project"></p>
|
android
|
[4]
|
1,512,902
| 1,512,903
|
didSelectRowAtIndexPath does not push new view controller and also no error
|
<p>I have a newb question. I have a table view controller that's working fine at first glance. It prints all the rows from my Nsmutabledictionary. When I click on a row, it fires this function as expected without crashing or giving system errors:</p>
<pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:[NSBundle mainBundle]];
SCInventoryLeaf *childView = [storyboard instantiateViewControllerWithIdentifier:@"inventoryleaf"];
NSArray *keys = [arrInventory allKeys];
id aKey = [keys objectAtIndex:indexPath.row];
id anObject = [arrInventory objectForKey:aKey];
childView.title = aKey;
childView.price = [anObject objectForKey:@"price"];
[self.navigationController pushViewController:childView animated:YES];
}
</code></pre>
<p>But for some reason, my childView is not presenting itself after the onRowClick. I did properly name the identifier in my storyboard. </p>
<p>What could be wrong? Where shoudl i troubleshoot next?</p>
<p>Edit -- I shold also mention that I put some breakpoints in viewDidLoad of SCInventoryLeaf.m, but they never seem to get fired. So I'm guessing the SCInventoryLeaf.m is never used? But I'm pretty sure I eastblished a relationship ebtween my tblviewcontroller and scinventoryleaf....</p>
|
iphone
|
[8]
|
4,544,227
| 4,544,228
|
How to add the private framework in iphone os to our app?
|
<p>HI ,,</p>
<p>Is there any to add the private framework in our app which is not released by apple ?</p>
<p>Can we use all the private framework by any way aur we have any restriction to dump that framework ?
After using that framework apple accept our app or not ?</p>
<p>Thanks </p>
|
iphone
|
[8]
|
4,105,527
| 4,105,528
|
How do I access mails from gmail account using Android API level 4
|
<p>I want to access mails from my gmail account using android level 4.</p>
<p>Thanks in advance.</p>
|
android
|
[4]
|
937,026
| 937,027
|
Doubts regarding class and object
|
<p>I know the functions are loaded only once in the memory. My doubt is... if we create an object of a class how it refer the function? What is the thing behind the object creation and function calling? Is there any pointer in the object to the function? </p>
|
java
|
[1]
|
2,860,014
| 2,860,015
|
AsyncTask ImageView from image web using setImageBitmap
|
<p>I have a problem to display this image in my internet.
I have no idea how to make it work.
I am new to android.</p>
<p>The problem is that part ...</p>
<pre><code>imView = (ImageView) findViewById(R.id.imageView1);
imView.setImageBitmap(bm); //error
</code></pre>
<p>Thank you.</p>
<p>my code</p>
<pre><code>public class CarregaImagem extends AsyncTask<String, Void, String>{
String imageUrl = "http://www.cuboweb.com.br/android/images/logoconsulfarma.png";
private ProgressDialog progress;
private Activity activity;
Bitmap bmImg;
public CarregaImagem(Activity activity){
this.activity = activity;
}
protected void onPreExecute() {
progress = new ProgressDialog(activity);
progress.setTitle("Aguarde...");
progress.setMessage("Carregando...");
progress.show();
}
protected String doInBackground(String... params) {
// TODO Auto-generated method stub
try {
URL aURL = new URL(imageUrl);
final URLConnection conn = aURL.openConnection();
conn.connect();
final BufferedInputStream bis = new BufferedInputStream(conn.getInputStream());
final Bitmap bm = BitmapFactory.decodeStream(bis);
BitmapFactory.decodeStream(new URL(imageUrl).openConnection().getInputStream());
bis.close();
} catch (IOException e) {
imageUrl = "";
} catch(Exception f){
imageUrl = "";
}
return imageUrl;
}
protected void onPostExecute(String imageUrl) {
if(!imageUrl.equals("")){
imView = (ImageView) findViewById(R.id.imageView1);
imView.setImageBitmap(bm); //error
} else{
Toast.makeText(activity, "Não foi possível obter resultados", Toast.LENGTH_LONG).show();
}
progress.dismiss();
}
}
</code></pre>
|
android
|
[4]
|
4,851,671
| 4,851,672
|
c++, get phone number from txt file
|
<p>I'm trying input a phone number in the format: 555-555-5555 into a struct with three int's. I've tried using getline with a delimiter of "-", but I keep getting the error: "cannot convert parameter 1 from 'int' to 'char *'".</p>
<p>I tried creating a temp char* variable to store the number in and then type casting it to int, but that didn't work. </p>
<p>How should I go about doing this?</p>
<p>Thanks</p>
<p>edit:</p>
<p>here's some of the code:</p>
<pre><code>void User::Input(istream& infile) {
char* phone_temp;
...
infile.getline(phone_temp, sizeof(phoneNum.areaCode), "-");
phoneNum.areaCode = (int)phone_temp;
...
}
</code></pre>
|
c++
|
[6]
|
4,122,048
| 4,122,049
|
Adjust volume though AudioManager without UI showing up
|
<p>I'm trying to adjust a volume stream in Android, but the UI keeps showing up every time I set the volume or adjust it.</p>
<p>Anyone know of a way to prevent the UI from showing up? Looking at the source code it should not show up unless I pass the flag FLAG_SHOW_UI which has a constant value of 1. It doesn't show all the time. 1/5 times. But if I pass the UI flag, it will show always.</p>
<p><a href="http://source-android.frandroid.com/frameworks/base/core/java/android/view/VolumePanel.java" rel="nofollow">http://source-android.frandroid.com/frameworks/base/core/java/android/view/VolumePanel.java</a></p>
<pre><code>protected void onVolumeChanged(int streamType, int flags) {
if (LOGD) Log.d(TAG, "onVolumeChanged(streamType: " + streamType + ", flags: " + flags + ")");
if ((flags & AudioManager.FLAG_SHOW_UI) != 0) {
if (mActiveStreamType == -1) {
reorderSliders(streamType);
}
onShowVolumeChanged(streamType, flags);
}
</code></pre>
<p>Kevin</p>
|
android
|
[4]
|
5,462,087
| 5,462,088
|
setting static variable from properties file java
|
<p>I need to use set some global variables which would be used by a few classes.</p>
<p>i'm having trouble assigning static variables from a properties files.</p>
<p>How i want to call the variables is something like this: String url = WebdriverConfiguration.getBaseUrl();</p>
<pre><code>public class WebDriverConfiguration
{
private static Properties testProperties;
private static String instaceUrl;
testProperties = loadProperties();
public static final String DEFAULT_BASEURL = testProperties.getProperty("confluence.base.url","");
private static final int DEFAULT_HTTP_PORT = 8080;
private static final String DEFAULT_CONTEXT_PATH = "/";
public static final String TEST_SPACE_KEY = "SMOKE";
public static final String TEST_PAGE = "XXX";
private static final String BASE_URL = System.getProperty("baseurl", DEFAULT_BASEURL);
public static String getBaseUrl()
{
return BASE_URL;
}
private Properties loadProperties() throws IOException
{
InputStream testPropertiesInput = getClass().getClassLoader().getResourceAsStream("webtester.properties");
Properties testProperties = new Properties();
if (null != testPropertiesInput)
{
try
{
testProperties.load(testPropertiesInput);
}
finally
{
IOUtils.closeQuietly(testPropertiesInput);
}
}
return testProperties;
}
}
</code></pre>
|
java
|
[1]
|
167,334
| 167,335
|
"Address expression must be an lvalue or a function designator" when passing an object's address
|
<p>Here is part of my code:</p>
<pre><code>class A
{
public:
void init(classB& pObject);
classB& _pObject;
}
void classA::init(classB& pObject)
{
_pObject = pObject;
}
class B
{
public:
void init();
}
void classB::init()
{
classA* pClassA = new classA;
pClassA->init(&this);
}
</code></pre>
<p>I got 2 problems after compile:</p>
<ol>
<li><p><code>_pObject = pObject;</code>: No viable overloaded '='</p></li>
<li><p><code>pClassA->init(&this);</code>: Address expression must be an lvalue or a function designator</p></li>
</ol>
<p>I'm getting confused about these problems... How can I fix that?</p>
|
c++
|
[6]
|
5,950,629
| 5,950,630
|
In app purchase does not work when live
|
<p>I have an app in the app store that I have added an in app purchase for, I fully tested it in the sandbox environment and all worked fine. I have had the app update and the in app purchase approved by apple and according to iTunes connect all has gone live. The app updates just fine but then in app purchase simply doesn't work!! No products are returned! Anyone else have this problem? Surely if it worked in the sandbox and apple has approved it, there should be no issues!?</p>
|
iphone
|
[8]
|
708,951
| 708,952
|
jQuery double click, but don't select the content
|
<p>I'm using jquery's dbclick() function in order to toggle highlight of the table raw. The problem I'm facing is that whenever I double click the content of the cell is also selected. Is there an easy way to prevent content selection?</p>
<p>My code:</p>
<pre><code>if ($('.tbl_repeat').length > 0) {
$('.tbl_repeat tr').dblclick(function() {
$(this).toggleClass('tr_active');
});
}
</code></pre>
<p>Perhaps I didn't make myself clear - I don't want to disable selecting all together - only when the double click occurs - apart from this event everything else should be selectable as usual.</p>
|
jquery
|
[5]
|
2,948,552
| 2,948,553
|
One time Android setup screen?
|
<p>I'm trying to create a setup activity for my Android application which my users would see the first time they opened the app, but never again unless they wanted to redo the setup. How do I create this setup activity as the first activity without giving it MAIN/LAUNCHER intent-filters? (I want to use those for my home activity.)</p>
|
android
|
[4]
|
4,004,709
| 4,004,710
|
Jquery change event doesn't fire every time
|
<p>I have some jquery code to fire on input-change:</p>
<pre><code>$("[data-binding] input").bind('change', function () {
debug('changing');
PerformWCFCall($(this));
});
</code></pre>
<p>the <code>debug</code>-function is simply a call to <code>console.log</code></p>
<p>The problem is that it randomly doesn't fire. 90% of the time everything works fine, but then all of a sudden it stops working a couple of times, and starts working again.</p>
<p>the <code>PerformWCFCall</code> doesn't contain any binding-code, but only a async call to a WCF service.</p>
<p>I'm also calling <code>$("[data-binding] input").unbind('change')</code> before the call to <code>.bind</code> just in case. But I'm having a hard time figuring this one out.</p>
<p>Hope someone can help</p>
<p>Let me know if you need any more information!</p>
|
jquery
|
[5]
|
1,703,163
| 1,703,164
|
Will the same singleton instance be available after php script command line call?
|
<p>I have script with defined class (for instance, Singleton.php). This class implements classic singleton pattern as in PHP manual:</p>
<pre><code> class Singleton {
private static $instance;
public static function getInstance()
{
if (!isset(self::$instance)) {
$c = __CLASS__;
self::$instance = new $c;
}
return self::$instance;
}
public function run() {
// bunch of "thread safe" operations
} }
$inst = Singleton::getInstance();
$inst->run();
</code></pre>
<p>Question. If I call this script twice from command line ('<code>php Singleton.php</code>'), will run() method be really "thread safe"? It seems that it will not. I used to imitate single-process run via text file where some flag is stored, but it seems that there might be other cases. Your thoughts?</p>
|
php
|
[2]
|
3,794,745
| 3,794,746
|
Call requires API level 14 (current min is 10):
|
<p>How can I solve this error ? I do not understand the reason behind this error ? </p>
<p>code </p>
<pre><code>devicePolicyManager.setCameraDisabled(demoDeviceAdmin, false);
</code></pre>
<p>error :</p>
<blockquote>
<p>Call requires API level 14 (current min is 10):
android.app.admin.DevicePolicyManager#setCameraDisabled DevicePolicyDemoActivity.java /DevicePolicyDemoActivity/src/com/marakana/android/devicepolicydemo line
62 Android Lint Problem</p>
</blockquote>
|
android
|
[4]
|
3,253,829
| 3,253,830
|
Open a file in the proper encoding automatically
|
<p>I'm dealing with some problems in a few files about the encoding. We receive files from other company and have to read them (the files are in csv format)</p>
<p>Strangely, the files appear to be encoded in UTF-16. I am managing to do that, but I have to open them using the <code>codecs</code> module and specifying the encoding, this way.</p>
<pre><code>ENCODING = 'utf-16'
with codecs.open(test_file, encoding=ENCODING) as csv_file:
# Autodetect dialect
dialect = csv.Sniffer().sniff(descriptor.read(1024))
descriptor.seek(0)
input_file = csv.reader(descriptor, dialect=dialect)
for line in input_file:
do_funny_things()
</code></pre>
<p>But, just like I am able to get the dialect in a more agnostic way, I 'm thinking it will be great to have a way of opening automatically the files with its proper encoding, at least all the text files. There are other programs, like vim that achieve that.</p>
<p>Anyone knows a way of doing that in python 2.6?</p>
<p>PD: I hope that this will be solved in Python 3, as all the strings are Unicode...</p>
|
python
|
[7]
|
1,858,824
| 1,858,825
|
How do I use JSONObject in Android
|
<p>I have the following Android java code:</p>
<pre><code>String json = "{\"Name_1\":1,\"Name_2\":0,\"Name_3\":0}";
JSONObject object = new JSONObject(json);
String[] propertyNames = JSONObject.getNames(object);
values = new String[propertyNames.length];
for (int i = 0; i < propertyNames.length; i++) {
values[i] = String.valueOf(object.get(propertyNames[i]));
}
</code></pre>
<p>but I am getting the following error: The method <code>getNames(JSONObject)</code> is undefined for the type <code>JSONObject</code>.
What can I do to get the <code>propertyNames</code>?</p>
|
android
|
[4]
|
2,200,160
| 2,200,161
|
Getting java.lang.ClassCastException: javax.swing.KeyStroke when creating a JSplitPane
|
<p>I'm getting a random unreproducible Error when initializing a JSplitPane in with JDK 1.5.0_08. Note that this does not occur every time, but about 80% of the time:</p>
<pre><code>Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.KeyStroke
at java.util.TreeMap.compare(TreeMap.java:1093)
at java.util.TreeMap.put(TreeMap.java:465)
at java.util.TreeSet.add(TreeSet.java:210)
at javax.swing.plaf.basic.BasicSplitPaneUI.installDefaults(BasicSplitPaneUI.java:364)
at javax.swing.plaf.basic.BasicSplitPaneUI.installUI(BasicSplitPaneUI.java:300)
at javax.swing.JComponent.setUI(JComponent.java:652)
at javax.swing.JSplitPane.setUI(JSplitPane.java:350)
at javax.swing.JSplitPane.updateUI(JSplitPane.java:378)
at javax.swing.JSplitPane.<init>(JSplitPane.java:332)
at javax.swing.JSplitPane.<init>(JSplitPane.java:287)
...
</code></pre>
<p>Thoughts? I've tried cleaning and rebuilding my project so as to minimize the probability of corrupted class files.</p>
<p><strong>Edit #1</strong> See <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6434148" rel="nofollow">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6434148</a> - seems to be a JDK bug. Any known workarounds? None are listed on the bug entry page.</p>
|
java
|
[1]
|
4,457,797
| 4,457,798
|
why equals() method when we have == operator?
|
<p>When i see the implementation of equals() method it does nothing but same as what == does. So my question is what was the need to have this as separate method when we have == operator which does the same work? </p>
|
java
|
[1]
|
4,349,436
| 4,349,437
|
Dynamically add methods to an object
|
<p>I am, for fun, trying to make it able to give an array some options and then implode the array into a string which can be used with the WideImage class. But I am having troubles. It's like it's actually not possible.</p>
<p>My code is following:</p>
<pre><code>$options = array('resize'=>'50,50');
$actions = implode('->', $options);
$img = WideImage::load($image) . $actions . ';';
</code></pre>
<p>This would make a string like: </p>
<pre><code>WideImage::load('../images/photo.jpg')->resize(50,50);
</code></pre>
<p>What I am searching for from you guys, is to tell me if this is possible at all.</p>
<p><strong>UPDATE</strong></p>
<p>When I am using eval() I am getting an error that the methods given to the wideimage class is undefined property.</p>
<p>Here is my code:</p>
<pre><code>$actions = 'resize(50,50)';
return eval('WideImage::load($image)->$actions->saveToFile('path/to/file')');
</code></pre>
<p>This gives me an error of undefined property, and says that saveToFile() is member of a non-object. But if I hardcode the resize and don't use $actions it's actually working. What am I doing wrong here?</p>
|
php
|
[2]
|
184,896
| 184,897
|
Making a "folder" in Android app - sqlite or other method?
|
<p>So I'm making a task management app in Android and have thus far made an implementation that just displays a list of tasks which are store in an SQLite database.</p>
<p>I want to be able to add categories or folders that the tasks can be sorted in to, and planned to do it using a one to many relationship with SQLite but from what I've read SQLite isn't great with foreign keys?</p>
<p>I would appreciate any input or thoughts regarding the best method for doing such a thing.</p>
|
android
|
[4]
|
3,511,866
| 3,511,867
|
Strings in Objective C for Iphone
|
<p>i am new to iphone application development.
i have a string say abc, i just want to display it as "Hello abc" in the screen</p>
<p>i want to add Hello to abc , before abc.
In objective c, i saw functions appendString , which displays result as "abc Hello"<br>
But i want to display i as "Hello abc"</p>
|
iphone
|
[8]
|
3,114,732
| 3,114,733
|
mozilla's bind function question
|
<p>Had a question about a implementation of bind function that I found on Mozilla's site. For the most part it makes sense to me, but I cant figure out what this check is for... </p>
<pre><code>this instanceof nop ? this : ( obj || {} )
</code></pre>
<p>in the bind function. Obviously its checking if 'this' is the empty function, but why would you need to bind the empty function. I have tried it in firebug, it works, but what is the point? Just trying to increase my javascript knowledge so any help would be appreciated.</p>
<pre><code>if ( !Function.prototype.bind ) {
Function.prototype.bind = function( obj ) {
var slice = [].slice,
args = slice.call(arguments, 1),
self = this,
nop = function () {},
bound = function () {
return self.apply( this instanceof nop ? this : ( obj || {} ),
args.concat( slice.call(arguments) ) );
};
nop.prototype = self.prototype;
bound.prototype = new nop();
return bound;
};
}
</code></pre>
|
javascript
|
[3]
|
4,187,862
| 4,187,863
|
Keyup doesnt respond
|
<p>I don't know what the hell is going on. </p>
<p>Why isn't my simple javascript code working? Been here for hours. I have a bunch of other javascript, was thinking if it's interrupting or something?</p>
<p>Trying to through a tutorial, then I got stuck at the first line:</p>
<pre><code>$('#name').keyup(function() {
alert('alert');
});
</code></pre>
<p>I don't know the problem.. in fiddle it's all working of course
<a href="http://jsfiddle.net/pgWtK/1/" rel="nofollow">http://jsfiddle.net/pgWtK/1/</a></p>
<p>I tried putting it inside the head with document ready but that doesn't help so, any clues?</p>
|
jquery
|
[5]
|
920,496
| 920,497
|
update progress between pages
|
<p>I have a website that uses the ajax UpdateProgress and UpdatePanel controls. I know that I can't use this same method to show a process indicator between pages. But, the user's would like to see that some work is being done while they are going to a new link. What are some ways to do this?</p>
<p>Thanks!</p>
|
asp.net
|
[9]
|
3,961,680
| 3,961,681
|
PHP: Use temporary image file on another page.
|
<p>I let the user upload an image... it creates a temp file but I do not want to move it a permanent address yet because I want to take them to <code>cropphoto.php</code>where they can create a thumbnail from it, if they exit out of the window before this I don't want it to be saved.</p>
<p>How would I pass the temporary image from the following script:</p>
<pre><code><?php
include_once '../dbconnect.php';
$protocol = !empty($_SERVER['HTTPS']) ? 'https://' : 'http://';
$domain = $protocol. $_SERVER['SERVER_NAME'];
function findexts ($filename) {
$filename = strtolower($filename) ;
$exts = split("[/\\.]", $filename) ;
$n = count($exts)-1;
$exts = $exts[$n];
return $exts;
}
$SubcatID = $_POST['SubcatID'];
if (empty($SubcatID)){
$SubcatID = -1;
}
$ext = findexts ($_FILES['photo']['name']) ;
if ($ext == "jpg" || $ext == "jpeg") {
$return = 'cropphoto.php?PhotoID='.urlencode($_FILES['photo']['name']);
header("Location: $return");
} else {
echo "ERROR: The image must be a JPEG";
exit;
}
?>
</code></pre>
<p>The current url paramater im using just passes the image name but I can't find the temp folder it is in.</p>
|
php
|
[2]
|
4,381,918
| 4,381,919
|
retrieving video and images from given link using php
|
<p>hello i'm building website in which i need the functionality of retriving video ( if video), images, descirption from different links, like different video websites or if general website link get thumbnail and descirption.</p>
<p>is there any php class exist ? for this taks Please help me suggest better solution Thanks in advance...</p>
<p>oh yeah example is just like facebook link tab</p>
|
php
|
[2]
|
2,976,587
| 2,976,588
|
Alternate of split and merge in javascript
|
<p>Input: "https://localhost:8181/View/Statement.aspx"; </p>
<p>Output: <a href="https://localhost:8181/View" rel="nofollow">https://localhost:8181/View</a>; </p>
<p>Apart from using the split function and then merging by using the array index, is there any efficient way available in java script for achieving the same?</p>
<p>If so, please demonstrate .</p>
<p>Thanks in advance</p>
|
javascript
|
[3]
|
5,108,416
| 5,108,417
|
How to test for am or pm?
|
<p>I am trying to test for am or pm in a if else statement..</p>
<pre><code>if(am){
//Do something
else{
//Do something else
</code></pre>
<p>Ive tried </p>
<pre><code>int am = cld.get(Calendar.AM_PM);
</code></pre>
<p>but the if else </p>
<p>wont take it as a parameter to test. Maybe because its not boolean.</p>
<p>How would i go about testing this?</p>
|
android
|
[4]
|
2,533,897
| 2,533,898
|
Use textbox for date picker iphone developmnt
|
<p>I am using a UIView to show a form with a text box(text), text box (want to attache this with datepicker) and text box (attach this wit picker to select multiple values)</p>
<p>I want to show date picker on click on text box but when I click on the texbox,it start showing the keyboard at bottom.</p>
<p>Will it be good to use read only textbox for date picker value or should i user table view for my form. Please suggest a link for that</p>
|
iphone
|
[8]
|
5,434,009
| 5,434,010
|
Time Duration problem
|
<p>I am not able to get the correct Time duration.So can anyone please help me in finding the solution</p>
<p>//code</p>
<pre><code> public static String getDateDifference(java.util.Date start, java.util.Date end) {
logger.info("Enter getDateDifference ");
Calendar startCal = Calendar.getInstance();
startCal.setTime(start);
Calendar endCal = Calendar.getInstance();
endCal.setTime(end);
int hourDiff = Math.abs(endCal.get(Calendar.HOUR_OF_DAY) - startCal.get(Calendar.HOUR_OF_DAY));
int minDiff = Math.abs(endCal.get(Calendar.MINUTE) - startCal.get(Calendar.MINUTE));
String diff = Integer.toString(hourDiff) + ":" + Integer.toString(minDiff);
logger.info("Date Difference : " + diff);
logger.info("Exit getDateDifference ");
return diff;
}
</code></pre>
|
java
|
[1]
|
5,368,386
| 5,368,387
|
Conflicts in using both jQuery and prototype
|
<p>Is it possible to use both jQuery and prototype scripts without having any collisions or overwritten variables? I don't know if since I last used prototype a few months back this has been fixed.</p>
|
jquery
|
[5]
|
4,108,878
| 4,108,879
|
in-app billing for android application
|
<p>I want to use Google play store API for my android game application and I am very confused from where I can get this API and implement them.Can anyone please tell me in detail,it will be great help to me as I am new to android gaming.So please help.</p>
|
android
|
[4]
|
4,593,151
| 4,593,152
|
use jQuery to replace one tag with another, keeping all attributes & data
|
<p>I realise this is similar to <a href="http://stackoverflow.com/questions/7093417/using-jquery-to-replace-one-tag-with-another">Using jQuery to replace one tag with another</a>, however I'm looking to replace a tag with another tag inside html, but KEEP the attributes and any defined custom data (set via $.data) for the object. Any idea how to achieve this?</p>
|
jquery
|
[5]
|
2,995,158
| 2,995,159
|
Drag and drop/ dropping elements issue
|
<p>Hello i am developing a shopping cart and i would like to send values to each of my fields in the basket. I have the example here: <a href="http://jsfiddle.net/ckSPG/1/" rel="nofollow">http://jsfiddle.net/ckSPG/1/</a></p>
<p>I would like the data to be organized:-? </p>
<pre><code>$(function() {
$(".draggable").draggable({
revert: true
});
$("#droppable").droppable({
over: function() {
$(this).css('backgroundColor', '#cedae3');
},
out: function() {
$(this).css('backgroundColor', '#CDAF95');
},
drop: function(e, ui) {
var p = $("#name").text();;
var name = $(ui.draggable).text();
//var price = $(ui.draggable).text();
addlist(name);
}
});
});
function addlist(name)
{
$("#droppable").append(name);
}
</code></pre>
|
jquery
|
[5]
|
5,962,664
| 5,962,665
|
ASP.NET Repeater inside UpdatePanel, need to create PostBackTrigger
|
<p>I have an UpdatePanel which has a Repeater inside it, and inside of the Repeater is a Button that I want to be a PostBackTrigger for the UpdatePanel (not an AsyncPostBackTrigger).</p>
<p>I have tried to create a trigger in the code behind in the Repeater's ItemDataBound event (using code below) but nothing I tried worked.</p>
<pre><code>PostBackTrigger trigger = new PostBackTrigger();
//failed
//trigger.ControlID = "btnCourseAttachmentUpdateSubmit";
//failed
//trigger.ControlID = ((Button)e.Item.FindControl("btnCourseAttachmentUpdateSubmit")).ID;
//failed
//trigger.ControlID = ((Button)e.Item.FindControl("btnCourseAttachmentUpdateSubmit")).ClientID;
//failed
//trigger.ControlID = ((Button)e.Item.FindControl("btnCourseAttachmentUpdateSubmit")).UniqueID;
panAttachments.Triggers.Add(trigger);
</code></pre>
<p>I know there is a technique to resolve this by using a hidden button but before I did that I wondered if there was a way of doing this similar to what I was trying in the code above?</p>
|
asp.net
|
[9]
|
3,300,744
| 3,300,745
|
How do I split and embolden this string with JavaScript?
|
<p>I have this string and I used string.bold() method to make bold the string. While debugging this JavaScript I found that this string is appended with bold tag, with the HTML tag <code><B>6,00,234</B></code>. Now I need to show this bold result in one area and I need to show the same result without this bold option in another area. </p>
<p>Using JavaScript how can I achieve this?</p>
<p><strong>string result = 6,00,234</strong></p>
|
javascript
|
[3]
|
1,060,787
| 1,060,788
|
jquery turn querystring into object
|
<pre><code>var obj = {
'key': 'value',
'cheese':'bacon',
'&':'>'
};
var params = $.param(obj)
console.log(params); // key=value&cheese=bacon&%26=%3E
</code></pre>
<p>how do I turn <code>params</code> back into an object? (exactly what it was before)</p>
|
jquery
|
[5]
|
999,547
| 999,548
|
Why do I have to pass the letter 'e' into this jQuery function?
|
<p>I know that E is short for 'event,' but it's still not clear to me why I need to use it? I tried passing other letters through the function and it didn't seem to work. Are there other situations where I need to pass a specific letter into a function? </p>
<pre><code>$("#myThing").click(function (e) {
var hit = $(e.target);
hit.css('color','blue');
});
</code></pre>
<p>This does the same thing:</p>
<pre><code>$("#myThing").click(function () {
$(this).css('color','blue');
});
</code></pre>
<p>When should I use $(this) versus 'e'?</p>
<p>Thank you!</p>
|
jquery
|
[5]
|
3,946,816
| 3,946,817
|
What does this code do?
|
<pre><code>#ifndef INFINITY
#ifdef _MSC_VER
union MSVC_EVIL_FLOAT_HACK
{
unsigned __int8 Bytes[4];
float Value;
};
static union MSVC_EVIL_FLOAT_HACK INFINITY_HACK = {{0x00, 0x00, 0x80, 0x7F}};
#define INFINITY (INFINITY_HACK.Value)
#endif
</code></pre>
<p>I'm currently getting started with the Chipmunk physics engine and found this in a header file</p>
<p>INFINITY is used to set infinite momentum for objects, however I don't understand what this code above does!</p>
|
c++
|
[6]
|
57,476
| 57,477
|
request query convert from vb to c#
|
<p>this code is made by vb,page name:main.aspx</p>
<p>when i type the url like that main.aspx?sStyle=0
it type word Yes in the page</p>
<p>and if i type the url like that main.aspx?sStyle=0
it type word No in the page</p>
<pre><code><%@ Page Language=VB Debug=true %>
<%
Dim sStyle
If Request.QueryString("sStyle") = "0" Or Len(Request.QueryString("sStyle")) = 0 Then
Me = 0
ElseIf Request.QueryString("sStyle") = "1" Then
Me = 1
End If
%>
<%If sStyle = "0" Then%>
Yes
<%End If%>
<%If sStyle = "1" Then%>
No
<%End If%>
</code></pre>
<p>=========================================================</p>
<p>my question is how do i make the exact same page using c#</p>
<p>Regards</p>
|
c#
|
[0]
|
930,792
| 930,793
|
Android: run application in dev/prod environment?
|
<p>I want to make development easier by implementing a configuration parameter that determines whether the app should be run in 'DEV' mode or 'PROD' mode.</p>
<p>I want this parameter to be accessible from any file (based on this parameter different chunks of code will be executed).</p>
<p>What's the most practical way to store this parameter (which isn't accessible or changeable by the user)? </p>
<p><em>How can I access it from within the application?</em></p>
|
android
|
[4]
|
4,297,147
| 4,297,148
|
ASP.NET and the new Chart Control
|
<p>I'm looking through the asp:chart documentation and I don't see where you set a "ChartType" on a ChartArea. How do you make a simple 2D PieChart? I don't see where you set the type at all.</p>
<p><strong>Note:</strong>
Adapt Gordon's answer to ASP.NET. Close enough to get me on the correct path. Thanks.</p>
|
asp.net
|
[9]
|
19,858
| 19,859
|
Find and replace strings within tags with Jquery
|
<p>I am looking to create a tool that when it runs, it goes through a particular div on a page and finds all strings within set tags and then replaces these strings by going through an array and exchanging the letters in the string with its corresponding digit in another array.
Currently the below code does the required function but it seems to keep looping over the same tags and adding every updated string to previous tags.</p>
<p>Here is the code:</p>
<pre><code> var arr = ['a','h1','h2','h3','h4','h5','h6','b','i','p','span','u'];
var arr_alphabet = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'];
var arr_update = ['0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26'];
for(var i=0;i<arr.length;i++)
{
$('.myDiv ' + arr[i]).each(function(index)
{
var str = $(this).text();
var arr_text = str.split('');
for(var j=0;j<arr_text.length;j++)
{
var change = $.inArray(arr_text[j],arr_alphabet);
if(change >-1)
{
arr_text[j] = arr_update[change];
}
}
var result = arr_text.toString();
var result_final = result.replace(/\,/g,'');
$('.myDiv ' + arr[i]).append(' ' + arr[i] + ' ' + arr_text[i] + ' [tag]');
});
</code></pre>
<p>Is there a way to update each tag and move onto the next one without continually updating the previous tags.</p>
<p>Thanks.</p>
|
jquery
|
[5]
|
1,366,643
| 1,366,644
|
JUnit Testing Exceptions
|
<p>I'm really new to java. </p>
<p>I'm running some JUnit tests on a constructor. The constructor is such that if it is given a null or an empty string for one of its parameters, it's supposed to throw an exception. </p>
<p>When I test this constructor in JUnit with a null or an empty string parameter, I get a red bar, even though I'm almost 100% sure that the constructor method does indeed throw an exception when such parameters are passed in to it. </p>
<p>Shouldn't there be a green bar in JUnit if the method throws an exception the way it is supposed to? Or is it that when you are supposed to get a red bar when the exception throwing works the way it is supposed to?</p>
<p>Thanks!</p>
|
java
|
[1]
|
2,616,348
| 2,616,349
|
Generate Unique Random Number based on UserID
|
<p>i got a code to generate random number.</p>
<pre><code>public string Get8Digits()
{
var bytes = new byte[4];
var rng = RandomNumberGenerator.Create();
rng.GetBytes(bytes);
uint random = BitConverter.ToUInt32(bytes, 0) % 100000000;
return String.Format("{0:D8}", random);
}
</code></pre>
<p>but i am looking for a routine where i will pass user id and routine will generate unique random number based on userid. in my case user id may look like</p>
<pre><code>a) 1,2,3,100,5000
b) C0001,C0002,C0003,C0010
d) AL62YU,B1N36W,ZU21PQ etc
</code></pre>
|
c#
|
[0]
|
4,558,064
| 4,558,065
|
Weird Characters from CSV Import
|
<p>I'm importing text from a .csv file. When importing the file there are some weird characters in it like "Õ". The character is supposed to be in apostrophe. For instance "it's". Any idea how I can convert that to a standard apostrophe? </p>
<p>I'm pretty sure that they problem is from the source .csv, but I need to be need to be able convert these characters. </p>
|
php
|
[2]
|
2,654,174
| 2,654,175
|
How do I make my code run in a loop and ask the user "Try again Yes or no?"
|
<pre><code>import java.io.*;
public class Magic{
static final int maxsize = 50;
public static void main (String [] args) throws IOException{
int i, j, k, l, n, key;
boolean n_ok;
String line;
int [] [] square = new int [maxsize] [maxsize];
BufferedReader KeybIn = new BufferedReader(new InputStreamReader(System.in));
try{
System.out.print("Size of square? ");
line = KeybIn.readLine();
n = Integer.parseInt(line);
n_ok = (1<=n) & (n<=maxsize+1) & (n%2==1);
if ( n_ok ){
for (i=0;i<n;i++)
for (j=0;j<n;j++) square[i][j] = 0;
square[0][(int)(n-1)/2] = 1;
key = 2;
i = 0;
j = (int)(n-1)/2;
while ( key <= n*n ){
k = i - 1;
if ( k < 0 ) k = k + n;
l = j - 1;
if ( l < 0 ) l = l + n;
if ( square[k][l] != 0 ) i = (i+1) % n;
else { i = k; j = l; }
square[i][j] = key;
key = key + 1;
}
System.out.println("Magic square of size " + n);
for (i=0;i<n;i++)
{
for (j=0;j<n;j++)
System.out.print("\t"+square[i][j]);
System.out.println();
}
}
}catch (NumberFormatException e){
System.out.println("Error in number, try again.");
}
}
}
</code></pre>
<p>So how do I put the "Try again yes or no"? just that.. then if I enter y .. it will ask the user the size of the square again .. if letter n it will exit .. this is for magic square</p>
|
java
|
[1]
|
5,384,816
| 5,384,817
|
how to assign and concat using multiple delimiters in an array?
|
<p>i apologize if the question is wrong. i am a still a newbie and a learner however i would appreciate if someone correct me if i am somewhere wrong.</p>
<p>here in the Class method i am using for Inserting the data into the database</p>
<pre><code>public funtion insert($table,$col,$value)
{
if(is_array($col) && is_array($value))
{
$query = "INSERT INTO ".$table."(" . implode(",",$col) . ") VALUES(" . implode(",",$value) . ")";
}
else
{
$query = "INSERT INTO " . $table . "(" . $col . ") VALUES(". $value . ")";
}
}
</code></pre>
<p>now here i am determining if the $col and $value is an array if yes then process it.</p>
<p>however i have a problem here since the VALUES in the Insert statement needs to be represnted in the single or double quote format it will not process the query and hence print the error</p>
<p>for example the below code would print the error</p>
<pre><code>$query = "INSERT INTO users(username,email) VALUES(test,test@test.com)";
</code></pre>
<p>and the correct format will be</p>
<pre><code>$query = "INSERT INTO users(username,email) VALUES('test','test@test.com')";
</code></pre>
<p>now in the col value i would like to add the single quotes to every value in the array for example the $value array which is like this.</p>
<p>$value = array('test','test@test.com');</p>
<p>should give back the value</p>
<p>'test','test@test.com'</p>
<p>instead oof </p>
<p>test,test@test.com</p>
<p>how do i achieve it?</p>
<p>thank you?</p>
|
php
|
[2]
|
1,541,979
| 1,541,980
|
jQuery - show/hide won't change an element's state
|
<p>I have searched this site and googled a lot - the problem has happened to many, but none of the solutions worked for me.</p>
<p>I have problem with jQuery show/hide. It stubbornly refuses to hide a specific element on a page. jQuery works, the events fire, everything looks ok, typing <code>.hide()</code> returns the element along with correct inline <code>display</code> attribute, but the element stays intact.</p>
<p>Originally I set up my css to control the initial state of elements' state (to avoid visibility/display conundrum), but eventually I moved all into my js, so that jQuery is in charge of everything.</p>
|
jquery
|
[5]
|
4,881,133
| 4,881,134
|
Share menu android
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2407108/share-feature-of-menu-in-android-application">share feature of menu in android application</a> </p>
</blockquote>
<p>Hello I want to do this share menu in my app but I don´t know how. There is a manual or a code to help me. Thank you.</p>
<p><img src="http://i.stack.imgur.com/ZhKhG.jpg" alt="enter image description here"></p>
|
android
|
[4]
|
4,715,391
| 4,715,392
|
Web application showing miss alignment in IE 8
|
<p>I am developing an web application using asp.net and it almost completed.My application working properly in IE 7 but its not working properly in IE 8.It shoes an miss alignment of controls...</p>
|
asp.net
|
[9]
|
5,868,737
| 5,868,738
|
How to assign array values at run time
|
<p>Consider I have an Array,</p>
<pre><code>int[] i = {1,2,3,4,5};
</code></pre>
<p>Here I have assigned values for it. But in my problem I get these values only at runtime.
How can I assign them to an array.</p>
<p>For example:</p>
<p>I get the max size of array from user and the values to them now how do I assign them to the array int [].</p>
<p>Or can I use anyother data types like ArrayList etc which I can cast to Int[] at the end?</p>
|
c#
|
[0]
|
5,951,955
| 5,951,956
|
iPhone trying to use a block animation to simulate a card flip, but nothing happens no animation
|
<p>I'm trying to do a card flip animation...but nothing happens.</p>
<p>this is what I do
1. create a container view, to hold the two views to animate from.
2. Create the first view.
3. add it to the container.
4. create the second view
3. start the animation block, beginAnimations
4. call setAnimationTransition put in the view container
5. add the second view to the view container
6. commit the animation,</p>
<p>my code</p>
<pre><code>// create container view
CGRect viewRect = CGRectMake(10, 10, 100, 100);
UIView* myView = [[UIView alloc] initWithFrame:viewRect];
// create 2 viues to flip between for animation
UIImage *i= [ UIImage imageNamed : @"card1.jpg"];
UIImageView *topCard=[ [UIImageView alloc] initWithImage: i ];
topCard.frame= CGRectMake(0,0,100,100);
[myView addSubview:topCard];
[self.view addSubview:myView];
i= [ UIImage imageNamed : @"card2.jpg"];
UIImageView *butCard=[ [UIImageView alloc] initWithImage: i ];
butCard.frame= CGRectMake(0,0,100,100);
// set up the animation
[UIView beginAnimations:@"Flip Top Card" context:nil];
[UIView setAnimationDuration:1];
[UIView setAnimationRepeatCount:0];
[UIView setAnimationRepeatAutoreverses:NO];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut ];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:myView cache:YES];
[myView addSubview:butCard];
// start the animation
[UIView commitAnimations];
</code></pre>
<p>-Ted</p>
|
iphone
|
[8]
|
5,160,605
| 5,160,606
|
jquery how to unload or hide javascript?
|
<p>i have a jquery script. see fiddle <a href="http://jsfiddle.net/patrioticcow/vLzCU/5/" rel="nofollow">here</a>, that loads some scripts depending on what option i select.</p>
<p>there are a few problems. </p>
<ol>
<li><p>I cant make the js unload/hide when the other option is selected (what if i have more options?)</p></li>
<li><p>and the script doesnt load inside <code>#feed-1307038796890991</code> but next to it.. wired</p></li>
</ol>
<p>any help much appreciated.
Thanks</p>
|
jquery
|
[5]
|
3,922,625
| 3,922,626
|
C++ Template specialisation issue
|
<p>I have code that boils down to this:</p>
<pre><code>//Just a templated array class .. implementation doesn't matter
template<int N>
struct Array {};
//A simple Traits like class
template<typename T>
struct MyTraits {}
//Specialization of the traits class
template<int N>
struct Foo< Array<N> >
{
static void monkey() {};
}
int main()
{
Foo< Array<3> >::monkey();
}
</code></pre>
<p>Unfortunately the compiler doesn't like it...</p>
<pre><code>test.cpp: In function ‘int main()’:
test.cpp|17| error: ‘monkey’ is not a member of ‘Foo<Array<3> >’
</code></pre>
<p>What am I doing wrong, and how do I fix it?
Thanks</p>
|
c++
|
[6]
|
2,752,917
| 2,752,918
|
center a div depending screen width
|
<p>i think i'm doing something wrong.
i mean, I'm trying to make a function to center one divs depending screen width.</p>
<h1>cabecera is the div i'm trying to center using left position</h1>
<p>my code start through this thinking:</p>
<p>mw ---> minimal width of the div</p>
<p>mg0 --> left margin + right margin ( the same value for both )</p>
<pre><code>$(window).width = mg0 + mw = m + m + mw
</code></pre>
<p>this is my code.</p>
<pre><code>function calc_margen() {
var mw = 1000;
var mpw = $(window).width();
var mg0 = mpw - mw;
var m = mg0 / 2;
$('#cabecera').left( m );
$('#pie').left ( m );
};
</code></pre>
|
jquery
|
[5]
|
2,332,458
| 2,332,459
|
Can you use a custom filter with PHP filter_var() and filter_input()
|
<p><a href="http://us.php.net/manual/en/book.filter.php" rel="nofollow">PHP Filters</a> are pretty cool, but what do you do if the filters don't quite match what you want? Can you create a custom filter?</p>
|
php
|
[2]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.