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 |
---|---|---|---|---|---|
72,017 | 72,018 | How to pass data from DOMDocument to regexp? | <p>Using the following code I get "img" tags from some html and check them if they are covered with "a" tags. Later if current "img" tag is not part of the "a" ( hyperlink ) I want to do cover this img tag into "a" tag adding hyperlinks start ending tag plus setting to target. For this I want the whole "img" tags html to work with. </p>
<p>Question is how can I transfer "img" tags html into regexp. I need some php variable in regexp to work with the place is marked with ??? signs.</p>
<pre><code>$doc = new DOMDocument();
$doc->loadHTML($article_header);
$imgs = $doc->getElementsByTagName('img');
foreach ($imgs as $img) {
if ($img->parentNode->tagName != "a") {
preg_match_all("|<img(.*)\/>|U", ??? , $matches, PREG_PATTERN_ORDER);
}
}
</code></pre>
| php | [2] |
4,682,552 | 4,682,553 | User cannot install to device with android 4.0.4 even though app supports APIs 3 - 16 | <p>I have a user with Motorola XT910 with android 4.0.4 reported he is unable to download my application from the Google Play Store. The error states the device is not compatible with the current version; however, my application supports APIs 3 - 16 which should include android 4.0.4.</p>
<p>I currently have API 16 and SDK Tools r20, and from the android revision history (http://developer.android.com/tools/revisions/platforms.html) I can see API 15 revision 3 is needed for Android 4.0.4. I haven't been able to download revision 3 as it doesn't show up in the SDK Manager, but shouldn't API 16 cover that? or am I making a wrong assumption?</p>
<p>Do I need to download revision 3 of the API 15 or does having API 16 covers it?
If it's needed, what can I do so that this particular revision shows up in the SDK Manager? Or is it possible to download elsewhere without using the SDK manager.</p>
| android | [4] |
99,408 | 99,409 | Getting offset from index in binary file | <p>Well, the question says it all. I'm looking for the value in a binary file, and it's location is in the index of the binary file. I'm using the following code, and its not getting me the right bytes back out of the binary file. I'm getting the correct value from the first read, at 0xC, but I'm not converting the offset right. I tried converting it to a string first and getting the right string value, but the moment I try to get it to long its searching the wrong area. Also note that the data I need is actually ox60 BEFORE the index location given to me in the binary.</p>
<pre><code> long offset = 0;
//Open read stream
Stream fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
BinaryReader brFile = new BinaryReader(fileStream);
//Read index to find start position
fileStream.Seek(0xC, SeekOrigin.Begin);
byte[] b = brFile.ReadBytes(4);
//Convert to long value
for (int x = 0; x < byErr.Length; x++)
offset = System.Convert.ToInt64(b[x].ToString()); //I'm assuming this is the problem
//Cleanup
fileStream.Flush();
b = null;
//Read needed value
fileStream.Position = offset;
fileStream.Seek(-0x60, SeekOrigin.Current); //The value I need is 0x60 BEFORE the index location
b = brFile.ReadBytes(4);
//Cleanup
fileStream.Flush();
fileStream.Close();
brFile.Close();
</code></pre>
| c# | [0] |
1,254,471 | 1,254,472 | Check string for words starting with the character @ | <p>Hi there and thank you for taking the time to look into this.</p>
<p>I'm working on a comment system and instead of using nested comments, I just want to add the @user method for replies.</p>
<p>So let's say for example I enter this comment:</p>
<pre><code>@moonwalker: Thanks again for your reply.
</code></pre>
<p>I'm looking for a function to check if a word is starting with the character @ and after that changing the word into a link. The problem I'm facing is that people will use things like:</p>
<pre><code>@moonwalker: rest of the message
@moonwalker, rest of the message
@moonwalker rest of the message
</code></pre>
<p>or even use en email address in their comments.</p>
<p>Is there a simple way to achieve this? Preg_match perhaps?</p>
<p>Thanks in advance for your help.</p>
| php | [2] |
1,274,424 | 1,274,425 | Dynamically adding a button in touch area when touching screen (Android) | <p>I want to dynamically add a button to my LinearLayout when touching the screen. My willing is that this button will be added just behind the place I touched the screen. So, for example, if I touched the screen at (x,y) point then a button will be added around this point. Is it possible? if so - how? </p>
<p>Thanks!</p>
| android | [4] |
3,072,739 | 3,072,740 | HtmlEncode in C# | <p>Is there any way to html encode some text without using System.Web.HttpUtility.HtmlEncode method? I want to deploy my desktop application using .NET 3.5 Client Profile and the problem is that System.Web.dll it's not part of the .NET 3.5 Client Profile so I have to find an workaround.</p>
| c# | [0] |
1,160,447 | 1,160,448 | how to get content from a Div that has a span which also has some content? | <p>How to get content from a Div that has a span which also has some content?</p>
<pre><code><div id="test">
this is a DIV
<span>
This is a span
</span>
</div>
alert(document.getElementById('test').innerText);
</code></pre>
<p>The code alerts me with This is a DIV This is a span.Im looking to get the content only from the DIV.</p>
| javascript | [3] |
3,428,793 | 3,428,794 | Bookmarklet not working as it should (i think) | <p>Can someone tell me what I am doing wrong here...</p>
<p>This returns "Button Not Found"</p>
<pre><code>javascript:var nam="http://apps.facebook.com/onthefarm/giftaccept.php?senderId=547766125&amp;gift=haitibackpack_item_single&amp;timestamp=1285776944&amp;ref=gift_accept_tab&amp;key=6870697de39960508737349c7a3f1363%24%24ggM3T%2CPU2YKM2l0mNrM%28U%28b%21eHAoclFCBgwg49%21S34GWkEXxTekFN_Fkx5%2AUZPcNMEOj&amp;signature=a86a9e11aab0051e3fde676a9abe4283&amp;srcapp=FarmVille"; nam="actions["+nam.replace(/\&amp;/g, "&")+"]"; var els=document.getElementsByName(nam); if(els.length == 0) alert("Button not found"); else els[0].click();
</code></pre>
<p>This prompts me to enter a URL...I enter the EXACT same URL as in the above example and it works fine, clicks the button which brings me to the desired page. </p>
<pre><code>javascript:var nam=prompt('enter URL Please'); nam="actions["+nam.replace(/\&amp;/g, "&")+"]"; var els=document.getElementsByName(nam); if(els.length == 0) alert("Button not found"); else els[0].click();
</code></pre>
<p>Thanks</p>
<p>Before you ask...I've tried in Chrome, IE and Firefox. It does not appear to be an issue with the length of the JS. I get the same results as above regardless of which (valid) URL I use. I am getting desperate here.</p>
| javascript | [3] |
4,841,180 | 4,841,181 | How to show progress image after the page load? | <p>I want to perform some operation after the page load, This operation takes some time. I want to show a progress image while the operation is being performed. But the problem is if i call the function in page_load event, my page hangs till the operation is not over. Is there any way i can achieve this?</p>
| asp.net | [9] |
1,987,901 | 1,987,902 | LINQ concatenating elements in two string arrays | <p>I have two string arrays</p>
<pre><code>Array1 = {"Paul","John","Mary"}
Array2 = {"12","13","15"}
</code></pre>
<p>I would like to know whether it is possible to join these arrays so that the resultant arrays have something like </p>
<pre><code>{"Paul12","John13","Mary15"}
</code></pre>
| c# | [0] |
5,460,406 | 5,460,407 | jQuery NOT selector | <p>I have the following:</p>
<pre><code>$('input[name=myCheck]').change(function() {
$('input:checkbox').removeAttr('checked');
});
</code></pre>
<p>How do I say: removeAttr('checked') for everybody except this?</p>
| jquery | [5] |
5,510,295 | 5,510,296 | When invoking .NET CLR from within C++, an error is returned | <p>I am calling a .NET assembly from C++. </p>
<p>This works perfectly for any test .NET 4.0 projects that I call. </p>
<p>However, when calling a large project with 20 sub-assemblies, it fails with the error below:</p>
<pre><code>Failed to execute assembly: 0x80004003. GetLastError=126. dwReturn=1.
</code></pre>
<p>Here is the C++ code that generates the error:</p>
<pre><code>DWORD dwReturn;
hr = pCLR->ExecuteInDefaultAppDomain(szApplication, szEntryType, szEntryMethod, szParameter, &dwReturn);
if (FAILED(hr))
{
// Fails if I try the production assembly, with 20 subassemblies.
printf(" Failed to execute assembly: 0x%X. GetLastError=%d. dwReturn=%d.\n", hr, GetLastError(), dwReturn);
}
else
{
// Works 100% if I plug in a small toy assembly in .NET 4.0.
wprintf(L" Assembly returned: %d\n", dwReturn);
}
</code></pre>
<h2>Environment</h2>
<ul>
<li>Visual Studio 2010 SP1.</li>
<li>C++ for the code above.</li>
<li>.NET 4.0 for the target assembly.</li>
</ul>
| c++ | [6] |
5,884,416 | 5,884,417 | How should i deal with a Large database (17mb)? | <p>I have a big database file in my project that is locate in my Assets folder, now i can not devise it to small pieces,
it is another option to use a large database file in the app ??</p>
<p>Thanks for helping!!</p>
| android | [4] |
3,847,687 | 3,847,688 | How to set a deep array in PHP | <p>Assume I have the following function</p>
<pre><code>function setArray(&$array, $key, $value)
{
$array[$key] = $value;
}
</code></pre>
<p>In the above function, key is only at the first level, what if I want to set the key at the 2nd or 3rd levels, how to rewrite the function?</p>
<p>e.g.</p>
<pre><code> $array['foo']['bar'] = 'test';
</code></pre>
<p>I want to use the same function to set the array value</p>
| php | [2] |
3,791,128 | 3,791,129 | Quitting application in Android | <p>I want to quit application in Android. Just put a "quit" button, which kills my app.</p>
<p>I know I shouldn't do this. I know that this is not the philosophy of the OS.</p>
<p>If you know how it can be done, pls share. </p>
<p>In the app, I have many opened activities, so "finish()" will not do the job.</p>
<p>Thank you for your information in advance.
Danail</p>
| android | [4] |
4,944,116 | 4,944,117 | How to play media files automatically one after another? | <p>If I have a list of songs in an array list and I want to play the songs automatically one by one sequentially. How can I do that ? </p>
<p>Currently my player plays a song and plays the next one only after I press next button. I want to remove this requirement of pressing the next button. </p>
| android | [4] |
2,729,419 | 2,729,420 | Last loop in for()? | <p>I have been struggling with this for a while:</p>
<pre><code>for( var key in obj ){
blah.blah()
if(choice){
doThis();
}
}
</code></pre>
<p>How can I call <code>doThis()</code> only at the last item? Since I don't have a counter, <code>i</code>, I can't determine which is the last item.</p>
| javascript | [3] |
963,054 | 963,055 | vista can not allow me to insert or select record msaccess from database when i login from user not admin | <p>i have little problem in using my application application having msaccess database if i install it on xp i can easily insert or select record from database but if i install it on vista. i can't access my msaccess database. if i login as admin it works fine but if i login as user i cant insert or select any record from my msaccess database from application please tell me what should i do.</p>
| c# | [0] |
5,483,603 | 5,483,604 | How to get Hyperlink from whole string | <ol>
<li><p>I create an application in which i get the response from web service .</p></li>
<li><p>The response is
"I might be in danger. I have triggered my panic alarm which is connected to you. Call me now. If i'm not answering, contact the police. My position is:http://maps.google.com/maps?q=21.183783,72.823548" </p>
<p>3.I store the string in text view.and i want to open HTTP URL in browser,on the click of text.but how can i get HTTP URL in whole string plese give me idea.</p></li>
</ol>
| android | [4] |
901,868 | 901,869 | How to convert an array to a different format? | <p>Hi
i want to convert this array where id as key and name value pair </p>
<pre><code>Array(
[4882] => treatment
[4876] => Advance
[4854] => Applied Clinical
)
</code></pre>
<p>to </p>
<pre><code>Array(
[0] => Array([id] => 4882, [name] => treatment)
[1] => Array([id] => 4876, [name] => Advance)
[2] => Array([id] => 4854, [name] => Applied Clinical)
)
</code></pre>
| php | [2] |
5,061,559 | 5,061,560 | Disable the touch events for all the views | <p>What's the best way to disable the touch events for all the views?</p>
<p>Thanks a lot,</p>
<p>Gratzi</p>
| android | [4] |
1,288,490 | 1,288,491 | Android2.2 emulator Warning: No DNS server found | <p>How can I resolve this in android emulator?</p>
<p>Starting emulator for AVD 'Android2.2_api8'
Failed to create Context 0x3005
emulator: WARNING: Could not initialize OpenglES emulation, using software renderer.
Warning: No DNS servers found</p>
| android | [4] |
2,797,464 | 2,797,465 | how can i change text of TextView in ListView when we click the Button? | <p><strong>I have a ListView with a Button and a TextView and i want to change text of TextView when i click in Button. I handle the click and when i click the Button <code>android:onClick="myClickHandler"</code> i change the text value of TextView but the problem is when i scroll the ListView i found the same text in other cells in ListView. how can i resolve this problem? <br/> tanx a lot.</strong><br>
this is the method to handle click <br> </p>
<pre><code>public void myClickHandler(View v)
{
//get the row the clicked button is in
LinearLayout vwParentRow = (LinearLayout)v.getParent();
TextView child = (TextView)vwParentRow.getChildAt(1);
child.setText("bma bla");
}
</code></pre>
| android | [4] |
3,249,255 | 3,249,256 | Carry forward the querystring with sitemap link issue | <p>i am working with sitemap and i was looking for solution to attach query string with sitemap url. i search google and found that it can be done through sitemap SiteMapResolve event. so i worked with it. but my objection was not fulfil fully. here is my code</p>
<pre><code> protected void Page_Load(object sender, EventArgs e)
{
SiteMap.SiteMapResolve += new SiteMapResolveEventHandler(this.ExpandForumPaths);
}
private SiteMapNode ExpandForumPaths(Object sender, SiteMapResolveEventArgs e)
{
string QryString = new Uri(HttpContext.Current.Request.Url.AbsoluteUri).Query;
SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true);
SiteMapNode tempNode = currentNode;
tempNode.Url = tempNode.Url + QryString;
return currentNode;
}
</code></pre>
<p>through the above code help me to attach querystring with sitemap current link but attached query string with previous link is getting disappear. </p>
<h2>as a example</h2>
<p>if i request like
<a href="http://localhost:7745/index.aspx?id=1" rel="nofollow">http://localhost:7745/index.aspx?id=1</a> then
querystring is attached with home link because whenever i hover on the home link then i saw that query was there with the home link. but when i request like
<a href="http://localhost:7745/DE/index.aspx?cat=101" rel="nofollow">http://localhost:7745/DE/index.aspx?cat=101</a> then
cat query string is attached with current sitemap link but when i hover again on home or root link then i saw no query string was there with root link.</p>
<p>so please tell me i need to do to make the query string persistent with all the link generated by sitemap. please discuss in detail. thanks</p>
| asp.net | [9] |
40,152 | 40,153 | php----url redirection | <p>now, i have an input textfield in a form, which used to filled in the url's name. eg:(google).
i want to get when i put the mouse key hover on the google. the url display on the tool bar is my site's internal address. eg:(http://example.com/... ) then click the google. it will go to the google site.</p>
<p>the input textfield is used to fill in some url's name.</p>
| php | [2] |
741,336 | 741,337 | what is wrong with my if statement in php? | <p>what is wrong with my if statement? i have tried all i can?</p>
<pre><code>if($admin == "Yes") {
echo "<a href='Home.php'> Admin </a>|<a href='Home.php'> Home </a>|<a href='profile.php?id=".$userid."'> Profile </a>|<a href='games.php'> Games </a>|<a href='Dev.php'> Dev </a></br>";
} else {
echo "<a href='Home.php'> Home </a>|<a href='profile.php?id='".$userid." > Profile </a>|<a href='games.php'> Games </a>|<a href='Dev.php'> Dev </a></br>";
}
</code></pre>
| php | [2] |
6,002,894 | 6,002,895 | Subscribe delegates to all methods of a class | <p>I have just familiarized myself a little bit with C# delegates. One can subscribe multiple delegate instances to a delegate by the "+=" operator. But is it also possible to have a controller class that has delegates for all the methods in second class, and have the methods being added automatically, i.e. without having to add (or even know) each method individually to the corrsponding delegate ?</p>
<p>In simplified code (omitting access modifiers etc.):</p>
<pre><code>class Car
{
void Start();
void Drive();
}
// I would like to have the following class generated automatically
// without needing to repeat all the methods of Car, i.e.
// without declaring a delegate instance for each of them
class CarController
{
delegate void DoSomething();
DoSomething StartAll;
DoSomething DriveAll;
void Subscribe(Car anotherCar)
{
StartAll += anotherCar.Start;
DriveAll += anotherCar.Drive;
}
}
</code></pre>
<p>EDIT:
Rawling's solution is the one that I like best. It's simple and clear. As a little tweak I have tried how the thing would work with dynamically typed objects, and it works indeed: complete decoupling between Controller and controlled objects. Of course such usage of "dynamic" is not of everyone's taste...</p>
<pre><code>public class CallAller2 : HashSet<dynamic>
{
public void CallAll(Action<dynamic> action)
{
foreach (dynamic t in this)
{
try {action(t);} catch (RuntimeBinderException) {};
}
}
}
class Bike
{
void Drive();
}
CallAller2 ca = new CallAller2();
ca.Add(new Car());
ca.Add(new Bike());
ca.CallAll(c => c.Start()); // is ignored by Bike which does not implement it
ca.CallAll(c => c.Drive());
</code></pre>
| c# | [0] |
4,368,202 | 4,368,203 | Javascript beginner: how to replace a href text if it matches a specified string? | <p>When someone posts a link to another page on my website, I'd like to shorten the a href text from something like: <code>http://mywebsite.com/posts/8</code> to <code>/posts/8</code> or <code>http://mywebsite.com/tags/8</code> to <code>/tags/8</code>. Since I'm learning javascript I don't want to depend on a library like prototype or jquery. Is it recommended to use javascript's <code>replace</code> method?</p>
<p>I found w3schools' page <a href="http://www.w3schools.com/jsref/jsref_replace.asp" rel="nofollow">here</a> but my code was replacing all instances of the string, not just the href text.</p>
<p>Here's what I have so far:</p>
<pre><code><script type="text/javascript" charset="utf-8">
var str="http://www.mywebsite.com";
document.write(str.replace("http://www.", ""));
</script>
</code></pre>
| javascript | [3] |
5,830,676 | 5,830,677 | std::string vs. char* | <p>does std::string store data differently than a char* on either stack or heap or is it just derived from char* into a class?</p>
| c++ | [6] |
1,344,304 | 1,344,305 | Pagination Standards | <p>Does anyone know of a defined standard for Pagination? We have a consultant company that buildt a website for us and part of the site has a list of items that uses pagination. They have a pretty standard pagination layout consisting of two buttons on either side of a list of numbers (links). </p>
<pre><code>[<<] [<] 1 2 3 4 5 [>] [>>]
</code></pre>
<p>The buttons [<] and [>] move you through the pages, either back on or forward one. THe numbers are all direct links to the pages.</p>
<p>The problem I have is with the buttons with the double 'arrows'. I think these should take you to the First or Last page. Everyone here agrees with that and expect it to work that way. However, the company that has designed the site has those buttons jumping 10 pages forward or backwards. I"ve never seen this done like this, and so the expected behavior isn't what myself and other users are expecting. This site just went live last night and we've already had 3 users report this functionality as a bug.</p>
<p>Is there a set of standards I can use for this to show the consultants? They don't want to change this functionality.</p>
<p>Thanks in advance.</p>
| asp.net | [9] |
409,159 | 409,160 | Android Basic Authentication 2.2+ | <p>HI,</p>
<p>I am struggeling with Basic HTTP Authentication like I have seen many others..</p>
<pre><code>public String getJSONObject()
{
try
{
String strURL = "deleted_manually_here";
StringBuilder result = new StringBuilder();
String base64EncodedCredentials = Base64.encodeToString(
(username+":"+password).getBytes(), Base64.DEFAULT);
HttpPost post = new HttpPost(strURL);
post.addHeader("Authorization", "Basic " + base64EncodedCredentials);
ResponseHandler<String> responseHandler=new BasicResponseHandler();
String responseBody=client.execute(post, responseHandler);
JSONObject response=new JSONObject(responseBody);
Log.d(TAG,"SUCCESS!");
return "B";
}
catch (Throwable t) {
Log.e(TAG, "EXCEPTION in updateStatus()", t);
return "N";
}
}
</code></pre>
<p>Where username & password is a private final String.</p>
<p>But in my adb logcat I get:</p>
<p>E/GetHttpQuotes( 392): EXCEPTION in updateStatus() << my log text"
E/GetHttpQuotes( 392): java.net.SocketException: Permission denied << so something is wrong..</p>
<p>I tried so many code I found but nothing worked...</p>
| android | [4] |
2,508,969 | 2,508,970 | can i hide our address bar url in asp.net | <p>help me,
i want to hide my address bar url in my asp.net website.</p>
| asp.net | [9] |
1,046,714 | 1,046,715 | Difference Between StreamWriter/Reader and StringWriter/Readerll | <p>Im very confused with the exact difference between them and different usage approach of these two TextWriter/Reader derived types StringWriter/Reader and StreamReader/Reader.
I know that using them we can deal easily with character based data in stream avoiding byte fuss as working direclty using Filestream...</p>
| c# | [0] |
3,142,219 | 3,142,220 | Best practices for creating an exception log file in PHP on a public website | <p>I am currently running on a homegrown PHP framework that outputs a nicely formatted HTML document with lots of great information when an exception is encountered and it is running in debug mode. </p>
<p>When it is running in production on the public site, debug mode is off and it simply returns a proper message to the user. Everything works just as it should. Except for the fact that it doesn't log errors in the production environment. I'd like for it to take the HTML documents that it creates in my development environment and, instead of displaying to the user (obviously), store them somewhere. </p>
<p>The issue I'm running into is that PHP cannot create a file above the root nor can it create a file within the root in a folder that is anything but wide-open. Due to the very explicit nature of my error reporting, I need to store this information in a secure environment and in a public folder in the public root doesn't seem like the best place. </p>
<p>I realize the other options are to put this info in a database but if the error is a database connection issue, that's no good. And it can be emailed but again, if there is a connection issue to the SMTP server, that's no good. Plus, I don't want to spam myself if something goes really haywire. </p>
<p>So, what is the best practice here? I'm certain I'm just missing something obvious. Thank you.</p>
<p>BTW, I'm running PHP v5.2 on Apache, hosted on a shared server.</p>
| php | [2] |
3,357,289 | 3,357,290 | is there a way NicEditor be on a subfolder and not outside the demo page folder? | <p>Hello I just want to know if I can put it on a subfolder instead ? When I tried to put it on subfolder or within the same folder of my page, it displays normal textare. But whenever I put it outside the folder it works fine. </p>
<p>Just asking for convenience. </p>
<p>Or if there is already an answer please tell me.</p>
<p>Thank you</p>
| php | [2] |
3,205,260 | 3,205,261 | Convert number to Italian and Italian to number in python | <p>I need Python code to convert numbers to and from Italian. </p>
<p>Looking at previous questions I learned that pynum2word does one way (num -> words) in several languages but alas, not in Italian.</p>
<p>If no such code exist in Python, I wouldn't mind translating such code from Perl/Ruby/Java.</p>
<p>Thanks.</p>
| python | [7] |
533,475 | 533,476 | How to replace number data within a string to a different number? | <p>There is a string variable containing number data , say <code>$x = "OP/99/DIR";</code> . The position of the number data may change at any circumstance by user desire by modifying it inside the application , and the slash bar may be changed by any other character ; but the number data is mandatory. How to replace the number data to a different number ? example <code>OP/99/DIR</code> is changed to <code>OP/100/DIR</code>.</p>
| php | [2] |
2,951,892 | 2,951,893 | ClassFormatError: Unknown constant tag in class XY | <p>I have a piece of code in which I try to load a class during runtime. The code is not all selfwritten so I have some problems understanding the error which always appers after compiling.</p>
<p>Here the code:</p>
<pre><code>private Class findClass(String s)
throws ClassNotFoundException
{
URL url = getResource("AP.class");
if(url == null)
{
throw new ClassNotFoundException(s);
}
inputstream = null;
Class classToRead;
try
{
inputstream = url.openStream();
byte abyte0[] = readClass(inputstream);
classToRead= defineClass(s, abyte0, 0, abyte0.length);
}
catch(IOException ioexception)
{
throw new ClassNotFoundException(s);
}
if(inputstream != null)
{
try
{
inputstream.close();
}
catch(Exception exception1) { }
}
return classToRead;
}
</code></pre>
<p>The error appears at the defineClass method.</p>
<p>Error stacktrace:</p>
<pre><code>Exception in thread "main" java.lang.ClassFormatError: Unknown constant tag 63 in class file AP
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at c.findClass(c.java:100)
at c.loadClass(c.java:56)
at java.lang.ClassLoader.loadClass(Unknown Source)
at c.a(c.java:20)
at mainOpenClass.main(lol.java:13)
</code></pre>
<p>My questions now are:
Is maybe anything wrong with the code?
Is it possible that the AP.class is damaged?
What does the error really mean?</p>
<p>I hope anybody can help me with my problem because searching the internet didn't really help in that case.</p>
| java | [1] |
4,893,455 | 4,893,456 | check if an input with specific type is selected | <p>I'm using the folowing code to check if an input field is selected but I don't no where the problems is, because it is not working!</p>
<pre><code> <html>
<head>
<title>Test </title>
<head>
<body>
<form >
<input type="text" id="select" value="select"/>
</form>
<script type="text/javascript" >
var d, len,i, j, el;
d=document.forms;
len=d.length;
for(i=0; i<len; i++){
el=d[i].elements;
for(j=0;j<el.length; j++)
if(el[j].type == "text" && el[j].focus())
{
alert("you selected an input field with type text");
}
}
</script>
</body>
</html>
</code></pre>
<p>Any help would be much appreciated! Thanks!</p>
| javascript | [3] |
1,800,533 | 1,800,534 | Automatically INotifyPropertyChanged | <p>Is there any way to automatically get notified of property changes in a class without having to write OnPropertyChanged in every setter? (I have hundreds of properties that I want to know if they have changed).</p>
<p><hr /></p>
<p>Anton suggests <a href="http://www.nablasoft.com/alkampfer/index.php/2008/08/04/implement-inotifypropertychanged-with-castledynamicproxy/">dynamic proxies</a>. I've actually used the "Castle" library for something similar in the past, and while it does reduce the amount of code I've had to write, it added around 30 seconds to my program startup time (ymmv) - because it's a runtime solution.</p>
<p>I'm wondering if there is a compile time solution, maybe using compile-time attributes...</p>
<p><hr /></p>
<p>Slashene and TcKs give suggestions which generates repetitive code - unfortunately, not all my properties are a simple case of m_Value = value - lots of them have custom code in the setters, so cookie-cutter code from snippets and xml aren't really feasible for my project either.</p>
| c# | [0] |
1,840,058 | 1,840,059 | Breakpoint problem in MS Visual C# 2008 Express Edition | <p>Whenever I place a breakpoint somewhere in my C# code file and then debug the program, the application stops responding. Everything's fine without the breakpoint. What gives?</p>
<p>I am talking about VS. </p>
| c# | [0] |
173,847 | 173,848 | Using variables in an array | <p>I have borrowed beautiful <em><a href="http://www.php.net/manual/en/function.time.php#105257" rel="nofollow">Cokidoo DateTime</a></em> class, that converts regular DateTime to "ago format".</p>
<p>I'm developing multilingual web-site and wanted to replace <code>year ago</code>, <code>years ago</code>, <code>month ago</code> with variables.</p>
<h3>Code example:</h3>
<pre><code>protected $strings = array(
'y' => array('1 year ago', '%d years ago'),
'm' => array('1 month ago', '%d months ago'),
'd' => array('1 day ago', '%d days ago'),
'h' => array('1 hour ago', '%d hours ago'),
'i' => array('1 minute ago', '%d minutes ago'),
's' => array('now', '%d secons ago'),
);
</code></pre>
<p><br>
Is this possible to do this without using replace methods?</p>
<p>Obviously this didn't work:</p>
<p><code>'m' => array('1' . $month_ago, '%d' . $months_ago),</code></p>
<p>Any help please?</p>
| php | [2] |
771,817 | 771,818 | image rotator + zoomin jquery plugins | <p>Guys can you suggest me a jquery plugins that has both the image rotator and zoomin feature. I want a plugin that that both this feature..</p>
<p>Thanks in advance</p>
| jquery | [5] |
257,282 | 257,283 | Add remove class? | <p>Okay I have two classes for two links and two divs with different information. What I am trying to do is have it so when you click on one link it adds a 2 to both of the classes and makes the second div visable. When you click on the other link it takes off a 2 and makes the first div visable.</p>
<p>Here is what I currently got</p>
<pre><code>$("#posts").click(function () {
$("#sideboxtopleft").toggleClass("2");
$("#arrow").toggleClass("2");
});
</code></pre>
<p>Pretty much posts is the link, when when you click on it. It would make sideboxtopleft and arrow, sideboxtopleft2 and arrow2 and when you clicked on comments it would take off the 2 of both of those. Then there are two divs, one is set to hidden and I want to make it visable and set the other to hidden. Pretty much creating a tab system with changing tab classes.</p>
| jquery | [5] |
2,768,242 | 2,768,243 | With C# Why would you use an accessor instead of just setting the varialbe equal to the property? | <p>For example</p>
<pre><code>Public int Width
{
get { return Something.Width; }
}
</code></pre>
<p>instead of </p>
<pre><code>Public int Width;
//later in the code
Width = Something.Width;
</code></pre>
<p>or</p>
<pre><code>Public int Width = Something.Width;
</code></pre>
| c# | [0] |
4,323,782 | 4,323,783 | Print File without print dialog box | <p>I need your help to print my locally saved file without using print dialog box , i tried out many cases but failed to do so. one case is like;</p>
<pre><code>var pr = new PrintDocument();
pr.PrintController = new System.Drawing.Printing.StandardPrintController();
pr.PrinterSettings = new PrinterSettings();
pr.PrinterSettings.PrintFileName = "E:\\File.docx";
pr.PrinterSettings.PrinterName = fileName.ToString();
pr.Print();
pr.Dispose();
</code></pre>
| c# | [0] |
812,356 | 812,357 | BestWay to save small data incase of shutting down | <p>Every mintute I want to save some data incase of shutting down. the data is very small (words).</p>
<p><strong>Notes:</strong></p>
<ol>
<li><strong>The file I save on, is writen concurrently, and Alot.
Each thread will write something and then wont stop change it. Every new thread will add more text and change it's text too.</strong></li>
<li>most of what I write to it will be small words like addresses.</li>
<li>I need a good way of pulling out that information from the file in the best way. DB will be good but some programers say its for very big information only.</li>
<li>I dont care if the file's size.</li>
<li>I dont care about how much files I will have.</li>
</ol>
<p>Thanks.</p>
| c# | [0] |
2,506,455 | 2,506,456 | How to scroll to a particular record in gridview which is in div | <p>I have a TextBox and a Button, and
I have a quite long GridView (I don't want to page it), so I put it in a Div with vertical scroll bar enabled.</p>
<p>I just want to enter search string in text box and if I click on button it should find the row where string matched and set its back color, and should scroll to that row.</p>
<p>This should be done in Javascript.
I'm able to do every thing, but no luck in scrolling to the found row.</p>
<p>The javascript function is like below </p>
<pre><code>function NextClinic() {
var gvClinics = document.getElementById("<%= gvClinics.ClientID %>");
var FindText = document.getElementById("<%= txtClinicKeywords.ClientID %>").value;
var oRows = gvClinics.rows;
var rawDataRows = new Array();
var cell;
var hdnCounterNext = document.getElementById("<%= hdnCounterNext.ClientID %>").value;
for (var i = hdnCounterNext; i < oRows.length; i++) {
var cell = gvClinics.rows[i].cells[3];
if (cell.innerHTML.indexOf(FindText) !== -1) {
alert("found at " + i);
document.getElementById("<%= hdnCounterNext.ClientID %>").value = i+1
return false;
}
}
}
</code></pre>
<p>A best suggestion is highly appreciated..</p>
<p>Thanks
Sri.</p>
| javascript | [3] |
1,156,326 | 1,156,327 | How to get whether jquery response is a file or not? | <pre><code>$(document).ajaxComplete(function(event, request, settings) {
alert(request.responseText);
});
</code></pre>
<p>Here in this code, it is alerting both js,css file and the plain response. Is there anyway to get only the plain responses.</p>
| jquery | [5] |
4,641,429 | 4,641,430 | Searching through a string trying to find ' in PHP | <p>I am using tinyMCE and, rather annoyingly, it replaces all of my apostrophes with their HTML numeric equivalent. Now most of the time this isn't a problem but for some reason I am having a problem storing the apostrophe replacement. So i have to search through the string and replace them all. Any help would be much appreciated</p>
| php | [2] |
4,801,755 | 4,801,756 | Run python from python without Popen or os.system | <p>I have a wrapper python script which repeatedly calls another python script via <code>os.system</code>. This works well enough, but there is quite a performance hit invoking the sub-shell and importing the modules again and again. How might I transform this to something more elegant and performant?</p>
<pre><code>counter = 0
for thing in list_of_stuff:
os.system("python inner_script.py %s result_%s" % (thing, counter)
counter += 1
</code></pre>
<p>I would prefer to do this all in the wrapper, but can modify <em>inner-script.py</em> if that's the only or best way. </p>
<p>If it's relevant, the environment is Python 2.7 on Windows. </p>
<p><strong>edit:</strong> I don't just import inner_script because it doesn't understand the command line parameters:</p>
<pre><code>import inner_script
counter = 0
for thing in ['TR2','TR5']:
inner_script('%s result_%s' % (thing, counter))
counter += 1
</code></pre>
<p>result:</p>
<pre><code>C:\> python xx-wrapper.py
inner_script [input features] [output workspace]
</code></pre>
<p>which is the usage message returned by inner_script.py:</p>
<pre><code>if len(sys.argv) < 3:
print usage
exit()
in_features = sys.argv[1]
out_folder = sys.argv[2]
main(in_features, out_folder)
</code></pre>
| python | [7] |
5,212,468 | 5,212,469 | How does the php snippet work? | <pre><code> $this->_config = parse_ini_file($configIniFile);
</code></pre>
<p>And this is the content of <code>$configIniFile</code>:</p>
<pre><code>; <?php exit; ?> DO NOT REMOVE THIS LINE
[database]
host = localhost
username = root
password =
dbname = openslopeone
port = 3306
adapter = PDO_MYSQL ; PDO_MYSQL or MYSQLI
</code></pre>
| php | [2] |
3,069,476 | 3,069,477 | Is it possible to set a background png on a view and anchor it to the top and not scale in Android? | <p>I have an image, say 16px from our designer. I want to Set it as the background image on a view, but the view is larger than the image. So I want to anchor the image at the top of the view, and then have the view fill in the bottom with a solid color.</p>
<p>Is this possible in the current version of android, 1.5_r3?</p>
<p>Here is what I have so far, but the image is scaling to take up the entire view, and I am not sure how to set the image as background and specify a solid color at the same time. I suspect I need to wrap the view in a containing view which has the color specified, is that the best way to do it?</p>
<pre><code><RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="3dip"
style="@style/listItemStyle">...
</code></pre>
<p>Where listItemStyle is defined as:</p>
<pre><code> <style
name="listItemStyle"
parent="@android:style/Widget.ListView">
<item name="android:background">@drawable/list_background</item>
</style>
</code></pre>
| android | [4] |
4,404,102 | 4,404,103 | Why would a language let programmer to handle divison by zero | <p>This happens in Javascript, for example, that division by zero is not handled by the language itself.
Is there's a valid reason for this?</p>
<p>I see this as a very basic exception that a language should be able to handle (they even handle 0/0 as NaN NaN).</p>
<blockquote>
<p>or take the square root of a negative number or use arithmetic
operators with non-numeric operands that cannot be converted to
numbers.</p>
</blockquote>
| javascript | [3] |
1,842,389 | 1,842,390 | ASP.NET Resource Reference Best Practices | <p>I'm relatively new to ASP.NET and was wondering if anyone could shed some light on when I should use relative references (e.g. ../images/banner_tinga.jpg) versus the tilde (e.g. ~/images/banner_tinga.jpg). Depending on the situation you can accomplish the same goal using either. What are the pros and cons of each mechanism? One argument for the relative reference seems to be Visual Studio's design time dislike for resources referenced by the tilde. Whenever I reference a css file that why it indicates it can not be found.</p>
<p>Regards,
javacavaj</p>
| asp.net | [9] |
198,268 | 198,269 | Reading data from a various terminals using PHP | <p>I would like to know if there's by any chance a way to communicate with a POS device, a cash register and a magnetic card reader with PHP. By communications I mean reading the output of that device.</p>
<p>Thank you.</p>
| php | [2] |
4,894,041 | 4,894,042 | Converting an array of 0 and 1 to integer | <p>I have an array of integers which store only 1 or 0. Is there a direct function in python which would do it?
Suppose the array is [0,1,0,1] then it should return 5.</p>
| python | [7] |
1,436,982 | 1,436,983 | Android: How to solve slow response after clicking TabWidget | <p>I have four Tab at the top of my apps<br>
The content of the fourth tab is that it will get data from sql server and then display in listview<br>
since the amount of data retrieved is quite big, it takes 2-3 sec<br>
The problem is that:<br>
After I click the fourth tab, it has no response, then after 2-3sec, it displays the content<br>
As I know it is loading the data from database, I will not continue to click<br>
However, when users click it and no response, he may click and click and click<br>
How to show something to user so that they know it is loading data??</p>
| android | [4] |
2,040,270 | 2,040,271 | Class Not Recognised as Return/Parameter Type | <p>I'm calling a simple method that receives an instance of one of my classes and returns another class instance. For some reason it doesn't recognise them in the method declaration but is fine with them within the method and before the method is called. Can't figure out a reason for this. Here is my code;</p>
<pre><code>public ReceiptResponse DownloadReceipt(ReceiptRequest request)
{
ReceiptResponse call = null;
...
}
</code></pre>
<p><code>ReceiptResponse</code> and <code>ReceiptRequest</code> both throw errors in the <code>public</code> line, but the creation of <code>call</code> is fine for some reason. Here is one the classes (both are nearly identical);</p>
<pre><code>public class ReceiptRequest
{
public String ClientID;
public String PolNum;
public String RecNum;
}
</code></pre>
<p><strong>MY ERROR</strong></p>
<blockquote>
<p>Error 16 The type or namespace name 'ReceiptRequest' could not be
found (are you missing a using directive or an assembly reference?)</p>
</blockquote>
<p><strong>UPDATE</strong></p>
<p>I definitely have the required using statement because if I hover over <code>ReceiptResponse</code> on the creation of <code>call</code> line then it displays the using statment in the tooltip.</p>
<p>Why is this?</p>
| c# | [0] |
1,492,292 | 1,492,293 | php path issue to transmit session info | <p>I have a pretty simple question but I am really new to php. I have just downloaded an interesting chat plugin called comechat. Precisely, there is a cometchat direvtoru that contains php files. The latter only need the $_SESSION['user'] to process. But it didn t and I think I have a path problem for my code to transmit the user's session info.</p>
<p>On the side of my code, I have the following architecture : essentially three directories</p>
<ul>
<li>classes (containing all my php files except index.php, the account.php generate the user session)</li>
<li>templates (containing all my html files)</li>
<li>public containing - index.php
- css directory
- js directory
- cometchat directory</li>
</ul>
<p>index.php process the php files of 'classes' and then the latter files process the html files using the smarty engine.</p>
<p>I tried to call the config files of the cometchat directory by proceeding to a require_once path/config.php in the index.php but it didn t work. So I have perhaps a silly question but : if I call this config file in index.php, and knowing that index.php instanciate an account class of account.php file (where the user's session is created), does the require_once path/config.php will retrieve the session info. More generally, could anypne help to deal with this problem? </p>
<p>Best,
Mehdi</p>
| php | [2] |
1,138,524 | 1,138,525 | Chrome error: Uncaught SyntaxError: <unknown message reserved_word> | <p>Okay heres my problem:</p>
<p>Im trying to extend the dom but for one of my prototype functions, it throws an error.
The error is for the function hasClass. I used the reserved word Element earlier in that script so i dont understand why he is throwing the error only there?</p>
<pre><code>Element.prototype.hasClass = function (class) {
return this.className.match(new RegExp('(\\s|^)'+class+'(\\s|$)'));
}
Element.prototype.addClass = function (class) {
this.className = this.className + " " + class;
}
Element.prototype.removeClass = function (class) {
if (this.hasClass(class)) {
var reg = new RegExp('(\\s|^)'+class+'(\\s|$)');
this.className = this.className.replace(reg,' ');
}
}
</code></pre>
| javascript | [3] |
2,736,928 | 2,736,929 | how to study C++ | <p>i wangt to study C++,but i don't know how to begin.</p>
| c++ | [6] |
5,732,509 | 5,732,510 | iPhone SDK - Changing Xib files (partial curl) | <p>I am creating an iPhone app for iOS 4 using the newest SDK.</p>
<p>On one of my pages I would like the user to click a thumbnail of a photo and then a partial curl transition style take affect to show a full sized version of the image. </p>
<p>On the page with the full sized image I have a toolbar with a "Back" button and a "Select" button. </p>
<p>When I click the Back button the partial curls rolls back down to my first Xib. </p>
<p>BUT when I click the Select button, the app crashes. </p>
<p>Can anyone help me or explain why it is doing this? Thanks!</p>
<p>.m file:</p>
<pre><code>-(IBAction)switchViews4 {
ImagePicker *image = [[ImagePicker alloc] initWithNibName:nil bundle:nil];
image.modalTransitionStyle = UIModalTransitionStylePartialCurl;
[self presentModalViewController:image animated:YES];
[image release];
</code></pre>
<p>}</p>
| iphone | [8] |
2,115,284 | 2,115,285 | Lowercase and Uppercase with jQuery | <p>How can I lowercase a string with jquery, I tried this (chkIsHasKids is a checkbox):</p>
<pre><code>var jIsHasKids = $('#chkIsHasKids').attr('checked').toLowerCase();
</code></pre>
<p>not work</p>
<p>any idea ?</p>
| jquery | [5] |
2,410,213 | 2,410,214 | Android Image name change | <p>I am storing the captured image from camera into the DCIM/Camera folder.. I wanna to change the name of the image stored.. Here is my code...</p>
<p>ContentValues values = new ContentValues();</p>
<pre><code> Uri uri = getContentResolver().insert(Media.EXTERNAL_CONTENT_URI,values);
Log.v("uri", uri+"");
startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE).putExtra(MediaStore.EXTRA_OUTPUT,uri), 0);
</code></pre>
| android | [4] |
5,456,547 | 5,456,548 | Define a lambda expression that raises an Exception | <p>How can I write a lambda expression that's equivalent to:</p>
<pre><code>def x():
raise Exception()
</code></pre>
<p>The following is not allowed:</p>
<pre><code>y = lambda : raise Exception()
</code></pre>
| python | [7] |
3,251,284 | 3,251,285 | Accessing regedit without admin rights | <p>I was wondering if i could run a program without administrator rights?
I am trying to run the program regedit from System32.
I have also tried copying it onto a USB and running it from there, and both have not worked.
Can someone help me run regedit using C# script?</p>
| c# | [0] |
1,134,748 | 1,134,749 | Do i need to delete objects that i set in class member when i replace them? | <p>I have the following:</p>
<pre><code>class Manager{
public:
void update(list<Employe> employees){
employees_ = employees;
}
private:
list<Employe> employees_;
};
</code></pre>
<p>do i need to delete old employees in the end of update method?</p>
| c++ | [6] |
3,737,498 | 3,737,499 | static variable allocation time in .net | <p>When static variable is allocated i.e. when you declare class or at the time of object creation?</p>
| c# | [0] |
365,095 | 365,096 | hide some form information without changing from GET to POST | <p>I have an array of ids and an array of corresponding values on a form. The user chooses the value on the screen but I am using GET on my form to get the ids. The problem is I need to convert the key back into the value on the second php page, except that the GET function did not send the value along with the id. I do not want to send the value over the url and I do not wish to change the URL as it is now (or, by extension, change from GET to POST to hide the value). </p>
<p>Basically, what is the best way to make this conversion on the second php page having only sent the key over the url and not having the array as a variable on the second page? I read something about super globals but I was not sure if that was the right way to go. </p>
<p>Any help would be appreciated. Thanks.</p>
| php | [2] |
3,610,351 | 3,610,352 | Activity isn't picking up new intent | <p>For various reasons, my app creates entries in the notification bar. When the user clicks on the notification, I want to display a custom activity that presents the entry in a certain format.</p>
<pre><code>Intent intent = new Intent(applicationContext, TextMessageViewerActivity.class);
intent.putExtra("text_message", someText);
PendingIntent contentIntent = PendingIntent.getActivity(applicationContext, 0, intent, 0);
// now create a notification and post it. no fancy flags
</code></pre>
<p>It all boils down to sending a string via an Intent extra, and displaying that in my Activity. What happens is that the first Intent that gets delivered to my Activity gets "stuck" somehow, and all further Intents delivered to it display the only the first Intent's extra.</p>
<pre><code>public class TextMessageViewerActivity extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.text_viewer);
}
@Override
public void onResume()
{
super.onResume();
Intent startingIntent = getIntent();
String message = startingIntent.getStringExtra("text_message");
String displayMessage = message != null ? message : "No message found";
((TextView)findViewById(R.id.text_viewer_text_id)).setText(displayMessage);
}
}
</code></pre>
<p>What am I not understanding about the Android Activity lifecycle?</p>
| android | [4] |
4,652,838 | 4,652,839 | how to show my current location with marker on google map in android | <p>please help. i have tried a code which should give my current location with marker on google map. but it is not working. i have give my location via DDMS and TELNET but still in dark. what should i do?? the code is:</p>
<pre><code>package com.chupamobile.android.googlemaps;
import android.location.Location;
public class GoogleMapsActivity extends MapActivity{
private MapView myMap;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
myMap = (MapView) findViewById(R.id.mymap);
initMap();
initMyLocation();
}
/**
* Initialise the map and adds the zoomcontrols to the LinearLayout.
*/
private void initMap() {
//myMap = (MapView) findViewById(R.id.mymap);
View zoomView = myMap.getZoomControls();
//MapController mc = myMap.getController();
//mc.setZoom(16);
LinearLayout myzoom = (LinearLayout) findViewById(R.id.myzoom);
myzoom.addView(zoomView);
myMap.displayZoomControls(true);
}
/**
* Initialises the MyLocationOverlay and adds it to the overlays of the map
*/
private void initMyLocation() {
MyLocationOverlay myLocOverlay = new MyLocationOverlay(this, myMap);
myLocOverlay.enableMyLocation();
myLocOverlay.enableCompass();
myMap.getOverlays().add(myLocOverlay);
Toast.makeText(getApplicationContext(), "I am In"+myLocOverlay, Toast.LENGTH_LONG).show();
}
/*public void onLocationChanged(Location location){
if(location!=null){
GeoPoint point = new GeoPoint((int)(location.getLatitude()*1E6),(int)(location.getLongitude()*1E6));
MapController mc = myMap.getController();
mc.animateTo(point);
mc.setZoom(16);
}
}
*/
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
</code></pre>
| android | [4] |
2,193,364 | 2,193,365 | how to execute html tag in javascript | <p>my database calls certain functions by inserting commands inside angle brackets. i.e.<#SUBMIT title="Request Report"> will create a button that submits form (criteria) data to the engine for reporting. </p>
<p>Before that button gets clicked I want to check some date criteria so I have inserted an image link into my document which calls my javascript code. If all conditions are met I want it to run/click the above button. Here is my code, it all works until the <#submit> part. Any suggestions would be gratefully welcome.</p>
<pre><code>function checkdate() {
var currentTime = new Date();
var startdate = document.forms[0].datescopestart.value;
var startdate2 = startdate.split("/");
var startdate3 = new Date(startdate2[2], startdate2[1] - 1, startdate2[0]);
var totaldays = ((currentTime - startdate3) / 86400000);
if (totaldays > 100) {
alert("You can only choose a start date within the last 100 days")
} else if (startdate == "") {
alert("You cannot leave the start date blank")
} else {
("<#SUBMIT>")
}
}
</code></pre>
<p><em><strong>EDIT</em></strong>
The source code behind the rendered <#Submit> button is:</p>
<pre><code><input type=button value="Request Report" class=button onclick="showhide('reportbutton');selectAll(document.forms[0].customfieldexp);selectAll(document.forms[0].user);document.forms[0].submit()">
</code></pre>
<p>I'm not sure how to incorporate that into the javascript.</p>
| javascript | [3] |
3,290,503 | 3,290,504 | Splitting a string in javascript | <p>In javascript, how can I get three different substrings for the date, month, and year from the following string: "12/15/2009" ? </p>
| javascript | [3] |
1,940,704 | 1,940,705 | C# UseVisualStyleBackColor | <p>Is there a way in which I can change the button color and preserve the Windows VisualStyle? I want to create a button that looks like checkBox2 (color and style)<br/> <br/>
<img src="http://i.stack.imgur.com/nNzKF.png" alt="alt text"></p>
<pre><code>this.button2.BackColor = System.Drawing.SystemColors.GradientActiveCaption;
this.button2.UseVisualStyleBackColor = false; //if true, BackColor gets ignored
</code></pre>
| c# | [0] |
4,460,373 | 4,460,374 | jQuery - applying .animate() to a row added using .after() | <p>So I currently use the following:</p>
<pre><code>$.ajax({
type: "GET",
url: "file.php",
success: function(html) {
$("#tableRow").after(html);
}
});
</code></pre>
<p>which neatly adds a new row (or rows) to an existing table.
file.php returns:</p>
<pre><code><tr><td>stuff</td></tr>
</code></pre>
<p>I can add a single row at a time.
I'm trying to animate just the newly added row like:</p>
<pre><code>$("#tableRow").after(html).animate({ backgroundColor: "#bce4b4" }, "fast")
</code></pre>
<p>but that highlights the row I'm adding the new row after. I can't get it to apply to just that new row. How can I do that?</p>
<p><strong>UPDATE</strong>:</p>
<p>Based on the answers given I put this together:
<a href="http://jsfiddle.net/jreljac/5ctpc/3/" rel="nofollow">http://jsfiddle.net/jreljac/5ctpc/3/</a> where I do the following:</p>
<pre><code>$("<tr><td>2 1</td><td>2 2</td></tr>").insertAfter("#tableRow").animate({
backgroundColor: "#bce4b4"
}, "slow");
</code></pre>
<p>(I replaced what file.php will give with text") and that does not seem to work. It creates the row but does not animate. Am I missing something simple?</p>
| jquery | [5] |
218,560 | 218,561 | Syntax error on 'onBackPressed()' | <p>I am displaying a dialog box. When the back key pressed, I am writing a code and using back key default functionality, but every time I get following error, here is my code: </p>
<pre><code>public void myfunc {
new AlertDialog.Builder(TaxiPlexer.this).setIcon(android.R.drawable.ic_dialog_alert).setTitle("Enable GPS").setMessage(
"Please Enable GPS in device settings to use Taxi application").setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//do something
} // onClick
}).show();
@Override //error: Syntax error on token(s), misplaced construct(s)
public void onBackPressed() { //error: Syntax error on token "void", @ expected
GPSdialog = false;
super.onBackPressed();
} }
</code></pre>
| android | [4] |
1,774,864 | 1,774,865 | Javascript Resize Image not working | <p>I have JS which resize the <code>width</code> and <code>height</code> of Image which is working fine if I used Alert before assigning the actual image src to the image object and if I omit the alertbox, it is not working. Please suggest me how to fix it. </p>
<p>` </p>
<pre><code><html>
<head>
<script type="text/javascript" language="javascript">
function resize_image_height_weight(id, hgt, wdth)
{
//alert(id);
Obj=document.getElementById(id);
myImage = new Image();
myImage.src = Obj.src;
var heights = myImage.height;
var widths = myImage.width;
// alert("Height=>" + heights + " Width=> " + widths);
if(heights > hgt || widths > wdth)
{
if(heights > widths)
{
var temp = heights/hgt;
var new_width = widths / temp;
new_width = parseInt(new_width);
heights = hgt;
widths = new_width;
}
else
{
var temp = widths/wdth;
var new_height = heights / temp;
new_height = parseInt(new_height);
heights = new_height;
widths = wdth;
}
}
Obj.height = heights;
Obj.width = widths;
}
</script>
</head>
<body>
<div>
<center>
<img src="http://www.google.co.in/intl/en_com/images/srpr/logo1w.png" id="i" alt="Google logo" height="150" width="150">
<script type="text/javascript">
document.images[document.images.length-1].onload = resize_image_height_weight("i",150,150);
</script>
</center>
</div>
</body>
</html>`
</code></pre>
| javascript | [3] |
219,904 | 219,905 | Is there any wordpress plugin to upload images and captions to multiple pages once | <p>Hi I have a couple of pages that need the same images and captions, is there a wordpress plugin that would allow this on 1 upload?</p>
| php | [2] |
4,079,849 | 4,079,850 | Communicate with android RIL | <p>I'm looking to get access to get low level network information on an android device that isn't available through the api. Is there a way to talk to the RIL to get more information?</p>
| android | [4] |
3,915,716 | 3,915,717 | main function stack size | <p>Max function stack size is limited and can be quickly exhausted if we use big stack variables or get careless with recursive functions.</p>
<p>But main's stack isn't really a stack. main is always called exactly once and never recursively. By all means main's stack is static storage allocated at the very beginning and it lives until the very end. Does it mean I can allocate big arrays in main's stack?</p>
<pre><code>int main()
{
double a[5000000];
}
</code></pre>
| c++ | [6] |
3,609,281 | 3,609,282 | Change Window State to Fullscreen | <p>How can I change the web browser window state to Fullscreen in javascript(Like when user press F11)? I know how can I specify Window State of new Window that has been opened by Window.Open Method but I want to change the sate of current Window.</p>
| javascript | [3] |
4,644,191 | 4,644,192 | getElementID dont work on chrome | <p>I have a code like this: </p>
<pre><code>parent.document.getElementById("test").value ="1";
</code></pre>
<p>but it doesnt work on chrome. The error is:</p>
<blockquote>
<p>"Uncaught TypeError: Cannot call
method 'getElementById' of undefined"</p>
</blockquote>
<p>any help is apreciated thanks in advance! :)</p>
| javascript | [3] |
4,295,403 | 4,295,404 | how to display complete Bitmap in android using Canvas? | <p>friends,</p>
<p>i am using following onDraw method to display bitmap on screen.</p>
<pre><code> @Override
public void onDraw(Canvas canvas) {
Bitmap _scratch = BitmapFactory.decodeResource(getResources(), R.drawable.icon2);
//ImageView img= new ImageView(Tutorial2D.this);
//img.setImageBitmap(_scratch);
canvas.drawColor(Color.BLACK);
canvas.drawBitmap(_scratch, 0, 0, null);
}
</code></pre>
<p>image is displayed on the screen but some part because android screen is small
how can i display complete image in whole android screen?</p>
<p>can i set ScaleType of image to fitxy in canvas ? </p>
<p>or</p>
<p>can i add android layout image to this canvas so that i could set fitxy property or image there as i have commented the code?</p>
<p>any help would be appreciated.</p>
| android | [4] |
554,632 | 554,633 | built-in Java classes/methods to convert between binary, decimal, and octal? | <p>i know of several general formulas for converting between binary, decimal, and octal, but i was wondering if java has any built-in methods or classes that convert between the three. for instance, in the Integer class, there are static methods such as toBinaryString, toOctalString, etc which allow for decimal conversion, but i haven't found any to convert the other way. anyone know of anything?</p>
<p>in particular, i am looking for methods to convert from octal and binary to decimal and between octal and binary</p>
<p>thanks! x</p>
| java | [1] |
4,507,593 | 4,507,594 | Google admob errod on return ad | <p>I keep getting this error in my debug when ads are about to be displayed.</p>
<pre><code>07-16 14:35:29.630: INFO/Ads(12137): onFailedToReceiveAd(Ad request successful, but no ad returned due to lack of ad inventory.)
</code></pre>
<p>What does this mean and how do i fix it?</p>
| android | [4] |
2,266,582 | 2,266,583 | Retrieve data from dynamically generated form | <p>I'm trying to use a dynamically created form to edit content on a page. I retrieve information from a DB table (in this case image captions) and display them in text areas ready to be edited and saved back into the DB.</p>
<p>This seems to do the job of organizing and displaying the form:</p>
<pre><code>echo"<form action='edit.php' method='post'>";
for ($limit;$limit<=$all_values;$limit++)
{
echo "<textarea cols='15' rows='3' name='caption' value='$caption_arr[$limit]'>
$caption_arr[$limit]</textarea><br>
}
echo "<br><input type='submit' value='Edit' name='pictureEedit'></form>";
</code></pre>
<p>But something goes wrong from here. When I enter this in edit.php:</p>
<pre><code> $caption=$_POST['caption'];
echo $caption;
</code></pre>
<p>And I only get the caption from the last field. When I added check boxes to the form it all worked fine provided I only checked 1 but if I checked 2 or more it would only give me the value for the last one.</p>
<p>I also tried this:</p>
<pre><code> $caption[$x]=$_POST['caption'];
foreach ($caption as $key => $value) {echo $key.$value.'<br>';}
</code></pre>
<p>but got the same result.</p>
| php | [2] |
629,203 | 629,204 | Start Function if input length > 3 characters | <p><strong>Part 1:</strong> I want the .highlight() fonction to be active only when the input length is larger than 3. After 3 characters, I want every keystroke to look in the body for this value and apply the .highlight() function (which works fine when using a static value). I am using it as a find in page function.</p>
<p>So here's what I have tried, but without success:</p>
<pre><code><script type="text/javascript">
$(document).ready(function() {
if($("#search_doc_input").length > 3) {
$('#search_doc_input').keydown(function() {
$(body).highlight($(this).val());
});
}
});
</script>
</code></pre>
<p><strong>Part 2:</strong> Also, what would be the best way, once the highlight function is active for a certain value, to scroll to the first instance of the new <code><span class="highlight"></code> added (which is what the .highlight() function does)?</p>
| jquery | [5] |
408,042 | 408,043 | Are there any alternatives to COM+ transaction based data-access layer? | <p>We are using our data-access layer with COM+. It's suboptimal. But the reasons to keep it are that it's transaction-secure. Are there any other alternatives to transcation-secure data-access handling? </p>
| asp.net | [9] |
4,831,367 | 4,831,368 | Find an element by class name, from a known parent element | <p>I want to find an element by class name. I know it will appear in a particular parent div, so rather than search the entire dom, I'd like to search only the particular div. I am trying this, but does not seem to be the correct syntax:</p>
<pre><code>var element = $("#parentDiv").(".myClassNameOfInterest");
</code></pre>
<p>what's the right way to do that?</p>
<p>Thanks</p>
| jquery | [5] |
798,710 | 798,711 | How to print the strings in an array? | <p>At the moment I have an array of </p>
<pre><code>public Module[]moduleArray = new Module[4];
</code></pre>
<p>and to output it i'm using </p>
<pre><code>public void displayModules()
{
for (int i = 0; i < moduleArray.length; i++)
{
System.out.println(moduleArray[i]);
}
}
</code></pre>
<p>However it's outputting </p>
<blockquote>
<p>Module@1f5e4ae5<br>
Module@67871079<br>
null<br>
null </p>
</blockquote>
| java | [1] |
5,737,906 | 5,737,907 | How can I verify that a user enters an integer or alphabetic character in Java? | <p>I am accepting an input from user as an integer using <code>Scanner.nextInt()</code>. How do I verify that he enters an integer, and not an alphabetic character?</p>
| java | [1] |
4,530,107 | 4,530,108 | Jquery first table, last row selection | <p>I'm having issues with the <code>tr:last</code> selector.</p>
<p>I have a basic table:</p>
<pre><code><table id="myTable">
<tr>
<td>1</td>
<td></td>
</tr>
</table>
</code></pre>
<p>When the user clicks on a link, It adds an addtional row to my table using:</p>
<pre><code>$("a#more").live("click", function(){
$table = $('#myTable');
var a = $table.find('tr:last').clone(true);
$table.find('tr:last').after(a);
});
</code></pre>
<p>Which works like a charm. However, the issue starts when I decided to add an additional table in the last <code>td</code> of my table:</p>
<pre><code><table id="myTable">
<tr>
<td> 1 </td>
<td>
<table id="myTable2">
<tr><td> Additional Information </td></tr>
</table>
</td>
</tr>
</table>
</code></pre>
<p>WHen I use <code>clone</code> this time, it picks the last row of my second table and copies a new row to my second table. My goal is to duplicate ONLY the entire last row of my first table and creating a new <code>tr</code> with all of the contents in it (including a copy of the second table).</p>
<p>I'm not sure how to go about this.</p>
| jquery | [5] |
4,514,917 | 4,514,918 | how can I use biginteger in java | <p>i have this code and i want to change it to BigInteger</p>
<pre><code>import java.util.*;
public class Euclid {
long TIME;
long start = System.currentTimeMillis();
private static final String EXCEPTION_MSG =
"Invalid value (%d); only positive integers are allowed. ";
public static int getGcd( int a, int b)
{//long start = System.currentTimeMillis();
if (a < 0)
{
throw new IllegalArgumentException(String.format(EXCEPTION_MSG, a));
}
else
if (b < 0)
{
throw new IllegalArgumentException(String.format(EXCEPTION_MSG, b));
}
while (b != 0)
{
if (a > b)
{
a = a - b;
}
else
{
b = b - a;
}
}
return a;
//long timeTaken = System.currentTimeMillis() - start;
}
}
</code></pre>
| java | [1] |
647,245 | 647,246 | Multiple 'endings' to a function - return an object, return a string, raise an exception? | <p>This one's a structure design problem, I guess. Back for some advice.</p>
<p>To start: I'm writing a module. Hence the effort of making it as usable to potential developers as possible.</p>
<p>Inside an object (let's call it <code>Swoosh</code>) I have a method which, when called, may result in either success (a new object is returned -- for insight: it's an <code>httplib.HTTPResponse</code>) or failure (surprising, isn't it?).</p>
<p>I'm having trouble deciding how to handle failures. There are two main cases here:</p>
<ol>
<li>user supplied data that was incorrect</li>
<li>data was okay, but user interaction will be needed () - I need to pass back to the user a string that he or she will need to use in some way.</li>
</ol>
<p>In (1) I decided to <code>raise ValueError()</code> with an appropriate description.
In (2), as I need to actually pass a <code>str</code> back to the user.. I'm not sure about whether it would be best to just <code>return</code> a string and leave it to the user to check what the function returned (<code>httplib.HTTPResponse</code> or <code>str</code>) or <code>raise</code> a custom exception? Is passing data through raising exceptions a good idea? I don't think I've seen this done anywhere, but on the other hand - I haven't seen much.</p>
<p>What would you, as a developer, expect from an object/function like this?</p>
<p>Or perhaps you find the whole design ridiculous - let me know, I'll happily learn.</p>
| python | [7] |
3,743,161 | 3,743,162 | Determine whether an number is one greater or one less than another in a circular set | <p>I am kicking myself for having to ask this ...I can solve this with a couple of simple 'if' statements, but I am sure there is a simpler way!</p>
<p>I have a paging control which allows the user to move one page left or one page right. Each page has an index. The pages cycle, therefore if you have three pages and you keep moving right the user sees:</p>
<pre><code>0 => 1 => 2 => 0 => 1 ...
</code></pre>
<p>I have the current page index and the previous page index. How can I determine if the user has paged right or left?</p>
<p>Thanks!</p>
| c# | [0] |
452,230 | 452,231 | python logging.info does not print, logging.warn and logging.error does | <pre><code>import logging
if __name__ == "__main__:
logging.info('info')
logging.warn('warning')
logging.error('error')
</code></pre>
<p>Result: </p>
<pre><code>warning
error
</code></pre>
<p>Why does <code>logging.info</code> doesn't report? </p>
<p>Thank you</p>
| python | [7] |
321,830 | 321,831 | c# beginner: compiling from command line | <p>i am following this tutorial:</p>
<p><a href="http://www.csharp-station.com/Tutorials/Lesson01.aspx">http://www.csharp-station.com/Tutorials/Lesson01.aspx</a></p>
<p>i pasted this into a text file, named it Welcome.cs:</p>
<pre><code>// Namespace Declaration
using System;
// Program start class
class WelcomeCSS
{
// Main begins program execution.
static void Main()
{
// Write to console
Console.WriteLine("Welcome to the C# Station Tutorial!");
}
}
</code></pre>
<p>then i went into command prompt, and pointed to the directory where the file is. i typed <code>csc.exe Welcome.cs</code></p>
<pre><code>i got csc.exe is not recognized as internal or external command
</code></pre>
<p>i am using VS2008</p>
<p>after i added csc.exe to the windows dir, i am getting this error:</p>
<pre><code>fatal error cs2018: unable to find messages file 'cscompui.dll'
</code></pre>
<p>thanks for your help!</p>
| c# | [0] |
88,415 | 88,416 | Passing variables between modules | <p>I'm wonder why this simple code doesn't work.</p>
<p>In main.py I have</p>
<pre><code>def foo():
HTTPHelper.setHost("foo")
host = HTTPHelper.host()
</code></pre>
<p>and in HTTPHelper.py:</p>
<pre><code>_host = None
def setHost(host):
_host = host
def host():
return _host
</code></pre>
<p>But when I step through foo() host becomes NoneType, even though I set it on the line before. Very confused...</p>
| python | [7] |
4,799,803 | 4,799,804 | jQuery validation: .each with form | <p>If I have a form of about 40 questions, how do I apply the same rules to questions 1-20, and 21-40?</p>
<p>For example:</p>
<pre><code>$("#form_survey").validate({
rules: {
a_ +i: {max:12, maxlength:2},
},
messages: {
a_ +i:{
max: "That's too much!"
}
}
</code></pre>
<p>Where the "+i" is the ideal increment of +1...</p>
<p>Should be easy, I'm just stuck on syntax...</p>
| jquery | [5] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.