Unnamed: 0 int64 65 6.03M | Id int64 66 6.03M | Title stringlengths 10 191 | input stringlengths 23 4.18k | output stringclasses 10 values | Tag_Number stringclasses 10 values |
|---|---|---|---|---|---|
3,128,076 | 3,128,077 | Python: How to check if an imported module/package/class is from standard library | <p>Is there a possibility to verify if an import comes from the standard library or not?</p>
<p>For example:</p>
<pre><code>from math import sin #from the standard library.
from my_module import MyClass #not from the standard library.
</code></pre>
| python | [7] |
873,638 | 873,639 | Why does my Form return raw php code? | <p>When I submit my form; the resultant page seems to output just raw php code rather than actually executing. the funny thing is, if I just run my code and hard code the $_get array values it works a charm I'm running this on a virtual server (Xampp) if that helps.</p>
<pre><code> *The related get code *
$search = $_GET['searcharg'];
</code></pre>
<p>The form:</p>
<pre><code><form action="search.php" method="get">
Search:<input type="text" name="searcharg" /><br />
<input type="submit" value="Submit" />
</form>
</code></pre>
<p>Any help would be appreciated. </p>
| php | [2] |
3,676,026 | 3,676,027 | Removing events in jquery | <p>I have some code in jquery which looks like this:</p>
<pre><code>$("#filterZaal").attr("disabled", "disabled");
$("#filterGenre").attr("disabled", "disabled");
$("#filterZaal").live("change", interceptZaalFilter);
$("#filterDag").live("change", interceptDagFilter);
$("#filterGenre").live("change", interceptGenreFilter);
</code></pre>
<p>Now, i have added a button, and when i push this button i would like that all of the above code does not count anymore, so when i push the button, these events would no longer be called but when i push it again it should become enabled again. </p>
<p>How can i do this in jquery?</p>
| jquery | [5] |
1,021,421 | 1,021,422 | php csv problem | <p>I have this function </p>
<pre><code>function csv_to_array($filename='', $delimiter=',')
{
if(!file_exists($filename) || !is_readable($filename))
{
echo "Not a valid file name";
return FALSE;
}
$header = NULL;
$data = array();
$fname = file($filename);
$a1 = array('username','fullname','email','dept');
if (($handle = fopen($filename, 'r')) !== FALSE)
{
while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
{
if(!$header)
{
$header = $row;
// print_r(array_diff_key($header,$array)) ;
}
else {
$data[] = array_combine($header, $row);
}
}
fclose($handle);
}
return $data;
}
</code></pre>
<p>It return associative array.
My csv file contains the header
username fullname email dept
but i require the header not to be mentione din the csv file how do i go about it </p>
| php | [2] |
583,581 | 583,582 | How to set the ICON image to each expnadle list group in android | <p>I'm using a Expandable list adapter to put view which has 3 groups and each group has 4 sub children , currently each group has the same icon image .
I need to put 3 different images to the three groups .. How to put this in android ..
Pls help . </p>
| android | [4] |
376,326 | 376,327 | Access video, image share feature in android | <p>is it possible to call a share features of android from our application ?If possible how to access or call this feature?</p>
| android | [4] |
2,196,744 | 2,196,745 | Any advantage of always using suffix 'f' for floats in C++? | <p>Any advantage of always using suffix 'f' for floats in C++?</p>
<p>From one hand my code gets mess, I mean I have lots of math formulas
and imagine instead of writing simply 1, to write 1.0f. It would clutter
the code.</p>
<p>But I wonder if there is an optimization or other aspect on this?</p>
<p>Thanks</p>
| c++ | [6] |
2,484,853 | 2,484,854 | Jquery using find() with dynamic string | <p>My question is how do I use the jquery find(), to find the correct listitems based on my checked checkboxes? I have tried building the string dynamicly but it does not work...?!</p>
<p>Is there an easier way?</p>
<p>I several listitems and a couple of checkboxes marked up like this.</p>
<pre><code> <li class="item" data-id="2" data-type="Bokföringsprogram" operativsystem='Windows' >
<li class="item" data-id="2" data-type="Bokföringsprogram" operativsystem='Windows' operativsystem='MAC OS' >
<li class="item" data-id="67" data-type="Faktureringsprogram" operativsystem='Windows' operativsystem='MAC OS' >
<li><input type="checkbox" name="boxvalidator" value="Windows" />Windows<br /></li>
<li><input type="checkbox" name="boxvalidator" value="MAC OS" />MAC OS<br /></li>
<li><input type="checkbox" name="boxvalidator" value="Ubuntu" />Ubuntu<br /></li>
<li><input type="checkbox" name="boxvalidator" value="Linux" />Linux<br /></li>
</code></pre>
<p>Jquery code</p>
<pre><code>$('input:checkbox[name="boxvalidator"]:checked').each(function()
{
$boxchecked = $boxchecked + ",li[operativsystem=~" + $(this).attr('value') + "],";
});
var $filteredPortfolio = $portfolioClone.find($boxchecked);
</code></pre>
<p>String looks like this:
undefined,li[operativsystem=~Windows],,li[operativsystem=~MAC OS],</p>
<p>must be an easier way of doing this?</p>
<p>Cheers & thanks for reading all the way down here!</p>
| jquery | [5] |
2,055,562 | 2,055,563 | Creating an array of Sets in Java | <p>I'm new to Java so I'm probably doing something wrong here,
I want to create an array of Sets and I get an error (from Eclipse).
I have a class:</p>
<pre><code>public class Recipient
{
String name;
String phoneNumber;
public Recipient(String nameToSet, String phoneNumberToSet)
{
name = nameToSet;
phoneNumber = phoneNumberToSet;
}
void setName(String nameToSet)
{
name = nameToSet;
}
void setPhoneNumber(String phoneNumberToSet)
{
phoneNumber = phoneNumberToSet;
}
String getName()
{
return name;
}
String getPhoneNumber()
{
return phoneNumber;
}
}
</code></pre>
<p>and I'm trying to create an array:</p>
<pre><code>Set<Recipient>[] groupMembers = new TreeSet<Recipient>[100];
</code></pre>
<p>The error I get is "Cannot create a generic array of TreeSet"</p>
<p>What is wrong ?</p>
| java | [1] |
6,016,624 | 6,016,625 | how to manipulate strings in jQuery (especially, finding sub-string in a string) | <p>let's say, for instance, I have this</p>
<pre><code><h2>I don't love Programming</h2>
</code></pre>
<p>I'd like to remove <strong>'don't'</strong> from the text inside the h2 tag.</p>
<p>So far, I've done this</p>
<pre><code>var content = $(h2).text();
</code></pre>
<p>That's allow me to get the text <strong>'I don't love Programming'</strong>. But I need a way to locate <strong>don't</strong> and replace it by something else or simply remove it.</p>
<p>Thanks for helping </p>
| jquery | [5] |
2,425,355 | 2,425,356 | progress bar not showing | <p>hi guys check out the code below... i am using progress bar in my application but it is not showing when i use dialog.dismiss() but shows if i dont use this method but the problem then is that it does not go away....
any help guys...?</p>
<pre><code> AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("Are you sure you want to delete?")
.setCancelable(false)
.setPositiveButton("Yes",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
`ProgressDialog` dialog1 = ProgressDialog.show(context, "", "Deleting...",true);
// Log.v("", "You Clicked " + s);
dba.delete("messages", "private = 0 and _id=?",
new String[] { s });
dba.close();
populate();
}
})
.setNegativeButton("No",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int id) {
dialog.cancel();
}
});
AlertDialog alert = builder.create();
alert.show();
dialog1.dismiss();
</code></pre>
| android | [4] |
3,983,777 | 3,983,778 | How to deploy java app for Windows pc | <p>I have studied Java Web Start and found it complex and clumsy for my purposes. In addition, my app needs to access the PC resources, which causes more hoops to be jumped through with Java Web Start. To add to the difficulties I need to access a 32-bit native library (libvlc) so I need to insure that my app runs under 32-bit Java. Is there an easy way to deploy my app without resorting to Java Web Start? Needless to say, I want everything to be contained in a single .exe file.</p>
| java | [1] |
916,809 | 916,810 | How to run PPT file in Android | <p>How can I run PowerPoint (.ppt) file in Android programmatically.</p>
| android | [4] |
1,850,957 | 1,850,958 | Convert IQueryable<> type object to List<T> type? | <p>I have IQueryable<> object.</p>
<p>I want to Convert it into List<> with selected columns like <code>new { ID = s.ID, Name = s.Name }</code>.</p>
<p>Edited</p>
<p>Marc you are absolutely right!</p>
<p>but I have only access to FindByAll() Method (because of my architecture).</p>
<p>And it gives me whole object in IQueryable<>.</p>
<p>And I have strict requirement( for creating json object for select tag) to have only list<> type with two fields.</p>
| c# | [0] |
4,812,712 | 4,812,713 | How do you run a shell script inside of an Android app? | <p>I am trying to write an android app for root users that runs a series of shell commands, or a shell script if that is preferable, and displays the output... can anyone point me in the right direction?</p>
| android | [4] |
2,438,651 | 2,438,652 | multiple names in a jquery var | <p>i want to apply my script on multiple pages so the var should read 3 names not just one;
this is how it looks now:</p>
<pre><code>var first;
$(document).ready(function() {
first = $('[name=body]').val();
});
</code></pre>
<p>need to do an or " || " or an and " && " some how so the name could be 'body','body2' and 'body3', depends on what page is it.
please help</p>
<p>Thanks all,</p>
| jquery | [5] |
2,128,965 | 2,128,966 | Javascript Code Performance analysis tool | <p>I am stuck with one task now. Requesting your help on this.</p>
<p><strong>Description :</strong>
There is a functionality written in purely javascript - but with lack of performance.
Its taking more than 3.5 seconds to complete the workflow.</p>
<p>Of cource, Its includes a lot of DB calls & functionalities and loops.</p>
<p>This set of codes written by long years ago, so i am not aware of any functionality much on that.</p>
<p><strong>Question :</strong>
Are there any (free) tools available to trace how many times functions getting called and how much time its taking? (Like DotTrace for .Net)</p>
<p>Note : using IE 6.0 & Our product is very huge will not support firefox.</p>
<p>Thanks
Karthik</p>
| javascript | [3] |
2,566,707 | 2,566,708 | Server Error in '/' Application :( | <p>i uploaded my website to my web host server.</p>
<p>the website was running good in my local computer but on the server it's showing me this error :</p>
<blockquote>
<h2>Server Error in '/' Application.</h2>
<p>Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.</p>
<p>Parser Error Message: The file '/MasterPage.master' does not exist.</p>
<p>Source Error:</p>
<p>Line 1: <%@ page title="" language="VB" masterpagefile="~/MasterPage.master" autoeventwireup="false" inherits="news, App_Web_giiaopeh" %><br>
Line 2:<br>
Line 3: <%@ Register Assembly="AjaxControlToolkit" > </p>
<p>Namespace="AjaxControlToolkit.HTMLEditor"</p>
<p>Source File: /news/news.aspx Line: 1</p>
<hr>
<p>Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET<br>
Version:2.0.50727.4016</p>
</blockquote>
<p>can you help me please?</p>
<p>the master page already in the server but i can't understand from where did this code came from <code>inherits="news, App_Web_giiaopeh"; %></code></p>
<p>because my original code is:</p>
<pre><code><%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="news.aspx.vb" Inherits="news" %>
</code></pre>
| asp.net | [9] |
4,112,072 | 4,112,073 | Add comma to numbers every three digits using C# | <p>I want to add comma to decimal numbers every 3 digits using c#.<br>
I wrote this code :</p>
<pre><code>double a = 0;
a = 1.5;
Interaction.MsgBox(string.Format("{0:#,###0}", a));
</code></pre>
<p>But it returns 2.<br>
Where am I wrong ?<br>
Please describe how can I fix it ?</p>
<hr>
<p><strong>All answers was useful , unfortunately I don't know to mark which answer as answer,<br>
Thank you for all teachers.</strong></p>
| c# | [0] |
1,380,218 | 1,380,219 | Convert string 10/29/2010 according to users culture | <p>How can I convert the english date 10/29/2010 or any language date to user culture date format</p>
<p>I am using the following code </p>
<pre><code> CultureInfo cultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture;
cultureInfo.DateTimeFormat.
string lng = cultureInfo.TwoLetterISOLanguageName;
DateTime dateTime = DateTime.Parse("10/29/2010", cultureInfo);
</code></pre>
<p>but it throws error when I try to parse it.</p>
<p>Any Idea how can I resolve this issue</p>
<p>Thanx</p>
| asp.net | [9] |
1,633,128 | 1,633,129 | Buttons IBAction doesn't work inside MKAnnotation view, why ??? Any Idea? | <p>I am having MKAnnotationView and i have added UIButton to it, by addSubView method with IBAction assigned to it using addTarget method. But when i tabbed on that button IBAction doesn't called ....!</p>
<p>I am not getting, Why it is not working?</p>
<p>How can i add button to MKannotationView so that its IBAction called ???</p>
<p>Plz. help me.</p>
<p>Thanks</p>
| iphone | [8] |
542,625 | 542,626 | jQuery - sort a table after adding a row to it | <p>I have 2 tables, one table has 2 columns, the other table has 1 column. When you click on a row, that row is removed from the table and a new TR is added to the end of the opposite table. Now I want to sort it alphabetically.</p>
<p>jQuery plugins like tablesorter are total overkill for what I want to do. Is there a simple way I can sort the table?</p>
<p>Edit: <a href="http://jsfiddle.net/nvJve/" rel="nofollow">Fiddle</a></p>
| jquery | [5] |
2,610,644 | 2,610,645 | hightlight custom-drawn cell on touchdown iphone | <p>I am custom drawing cells, how can I hightlight the cells on touchdown</p>
<p>thanks</p>
| iphone | [8] |
2,731,294 | 2,731,295 | Python web application | <p>I want to create a very simple python web app. I don't need Django or any other web framwwork like that. Isn't there a simpler way to create a web app in python?</p>
<p>Thanks</p>
| python | [7] |
3,138,498 | 3,138,499 | Show Div when Grid Item is Clicked - Javascript not Updating Panel | <p>On one aspx page I have a GridView that has a list of Thingys that are loaded from db. This is placed in one div. </p>
<p>In another Div with display=none I have the form to add a new thingy. </p>
<p>I also have a link [add new thingy] that hides the gridview div and shows the content of the form. </p>
<p>I am using JS methods to hide and show the Divs. </p>
<p>Now in the grid the first column is also a link that I want to load the form with the Thingy info without postback. </p>
<p>Currently the problem is that if I use the Grid's OnRowCommand I get a postback. </p>
<p>1) how can I remove that postback and load the form in the second Div</p>
<p>2) a similar issue is on save form, I can switch back to the gridview div using js really quickly but how do I reload the grid with the newly saved Thingies. </p>
<p>I am open to a completely different approach if it solves the issue. I chose this approach over the much easier UpdatePanel because its much faster to switch between the contents without a postback.</p>
<p>Thanks in advance. </p>
| asp.net | [9] |
5,255,433 | 5,255,434 | What a strange syntax? | <p>I've found unknown for me code construction on JQuery site. After some formatting it looks like: </p>
<pre><code>function (a,c) {
c==null && (c=a,a=null);
return arguments.length>0
? this.bind(b,a,c)
: this.trigger(b)
}
</code></pre>
<p>What does the first line of the function mean? Is it any trick or standard JS code construction?</p>
| javascript | [3] |
4,440,524 | 4,440,525 | php Strict Standards: Creating default object from empty value | <p>i am getting this error on every page where i am trying to get any kind of id for instance i am using the following code </p>
<pre><code>$objClass = array();
$objClass[0]->custId = $_GET['id'];
</code></pre>
<p>i am getting error in the second line. though it is working fine but it just keeps on showing everywhere. I read the answer with stdclass but i dint get it so if ur giving this as a solution plz explain hw to use it cz im quite new in the field.
also can somebody tell me how to hide php errors.</p>
| php | [2] |
4,625,542 | 4,625,543 | Warning for header information in my test server but not in local why? | <p>I have my site live in which i echoed few strings for testing, so it displayed me those test strings but along with the warning message </p>
<blockquote>
<p>Warning: Cannot modify header
information - headers already sent by
(output started at
/home/companyfolder/public_html/mycart.php:117)
in
/home/companyfolder/public_html/includes/functions/general.php
on line 50</p>
</blockquote>
<p>But at the same time i do not get this error any where in my local machine so i want to know is there any difference in display of header information related to servers?</p>
| php | [2] |
3,944,702 | 3,944,703 | Static constructor in c++ | <p>This question was asked to me in an interview:</p>
<p>What is a static constructor?</p>
<p>Does it exist in C++? If yes, please explain with an example.</p>
| c++ | [6] |
271,505 | 271,506 | Calculation of Latitude and Longitue from given point and radius | <p>I have latitude, longitude and a radius. Can you please help me in finding the
another latitude and longitude from given points (latitude and longitude) and radius.</p>
<p>Thanks in Advance</p>
| java | [1] |
623,604 | 623,605 | Data-structure to store "last 10" data sets? | <p>I'm currently working with an object Literal to store temporary information to send to clients, it's like a history container for the last 10 sets of data.</p>
<p>So the issue that I', having is figuring out the most efficient way to splice on object as well as push an object in at the start, so basically i have an object, this object has 0 data inside of it.</p>
<p>I then insert values, but what I need to do is when the object reaches 10 keys, I need to pop the last element of the end of object literal, push all keys up and then insert one value at the start.</p>
<p>Take this example object</p>
<pre><code>var initializeData = {
a : {},
b : {},
c : {},
d : {},
e : {},
f : {},
g : {},
h : {},
i : {},
j : {}
}
</code></pre>
<p>When I insert an element I need <strong>j</strong> to be removed, <strong>i</strong> to become the last element, and <strong>a</strong> to become <strong>b</strong>.</p>
<p>So that the new element becomes <strong>a</strong>.</p>
<p>Can anyone help me solve this issue, I am using node.js but native JavaScript is fine obviously.</p>
<hr>
<p>Working with arrays after advice from replies, this is basically what I am thinking your telling me would be the best solution:</p>
<pre><code>function HangoutStack(n)
{
this._array = new Array(n);
this.max = n;
}
HangoutStack.prototype.push = function(hangout)
{
if(this._array.unshift(hangout) > this.max)
{
this._array.pop();
}
}
HangoutStack.prototype.getAllItems = function()
{
return this._array;
}
</code></pre>
| javascript | [3] |
1,808,335 | 1,808,336 | attachments to e-mail? | <p>I've got something like the following...</p>
<pre><code> public boolean sendmail (String host, String to, String from,
String message, String subject, String cc){
try
{
//Created TCP Connection to server
Socket s = new Socket(host, 25);
//Open our streams.
InputStream inStream = s.getInputStream();
OutputStream outStream = s.getOutputStream();
in = new Scanner(inStream);
out = new PrintWriter(outStream, true );
//get my info!
String hostName = InetAddress.getLocalHost().getHostName();
//e-mail time!
receive();
send("HELO" + host);
receive();
send("MAIL FROM: <" + from + "\n");
receive();
send("RCPT TO: <" + to + "\n");
receive();
send("DATA");
receive();
send("DATA");
receive();
//Make sure to close the everything again!!
out.close();
in.close();
s.close();
return true;
}
catch (Exception e)
{
appendtolog("ERROR: " + e);
return false;
}
}
private void send(String s) throws IOException{
appendtolog(s);
out.print(s.replaceAll("\n", "\r\n"));
out.print("\r\n");
out.flush();
}
private void receive(){
String line = in.nextLine();
appendtolog(line);
}
</code></pre>
<p>is it possible to just put an attachment somewhere in there? I realise there is ways of doing this using the API more but I'm wondering there a way I can hammer functionality for attachments into that or is using something like.. </p>
<pre><code>// Set the email attachment file
MimeBodyPart attachmentPart = new MimeBodyPart();
FileDataSource fileDataSource = new FileDataSource(filename) {
@Override
public String getContentType() {
return "application/octet-stream";
}
};
attachmentPart.setDataHandler(new DataHandler(fileDataSource));
attachmentPart.setFileName(filename);
</code></pre>
| java | [1] |
4,315,747 | 4,315,748 | How to get thumbnail from a live camera or a NSURL | <p>I want to know that Can we get thumbnails from a live camera or video? If yes then how? Please suggest me what is best way to show more then 20 or 30 live cameras in a UITableView. I have customized the UITableViewCell and added a UIWebView to that cell with the loadRequest. But this is much slower and also got unvisitable on table scroll. How I can get out of these problems. </p>
<p>Thanks,</p>
| iphone | [8] |
2,193,795 | 2,193,796 | how to get hashmap content of arraylist in java? | <p>I am using the following code to save hashmap content into arraylist. </p>
<pre><code>HashMap jediSaber = new HashMap();
ArrayList<HashMap> valuesList = new ArrayList();
for(int i = 0; i< 4;i++) {
jediSaber.put("white","white_name"+i);
jediSaber.put("blue","blue_name"+i);
valuesList.add(i, jediSaber);
System.out.println("list ontent:"+i+":"+valuesList.get(i).values());
}
`
</code></pre>
<p>output is as follows:</p>
<pre><code> list content:0:[blue_name0, white_name0]
list content:1:[blue_name1, white_name1]
list content:2:[blue_name2, white_name2]
list content:3:[blue_name3, white_name3]
</code></pre>
<p>When i try to display the content of arraylist in outside with the following code,</p>
<pre><code>System.out.println("list content:");
for(int i = 0;i<valuesList.size();i++){
System.out.println("list:"+i+":"+valuesList.get(i).values());
}
</code></pre>
<p>It is showing the following output,</p>
<pre><code> list content:0:[blue_name3, white_name3]
list content:1:[blue_name3, white_name3]
list content:2:[blue_name3, white_name3]
list content:3:[blue_name3, white_name3]
</code></pre>
<p>My problem is i need to display the content of arraylist of hashmap. </p>
<p>I think something i missed in second part. Can anybody help me to solve this minor issue?</p>
<p>Thanks in advance!!..</p>
| java | [1] |
1,913,545 | 1,913,546 | How to create one variable from multiple variables in PHP? | <p>Lets say we have variables: $page and $id. For example, $id=2. I wanna create new variable from existing variables $page and $id: $page2. how to do it? is it possible??</p>
| php | [2] |
3,851,403 | 3,851,404 | Android How to check Version | <p>I did my application in 2.2 environment, when i install my apk in older version i am getting parser error. is there anything possibility to display our own message instead parser error message. As per my opinion it is not. Because i googled about this issue there is nothing hints about this topic. if anyone knows pls share and others can also understand if they want to display this kind of message. Thanks in andvance. </p>
| android | [4] |
3,494,501 | 3,494,502 | retype password verification not working | <p>I used the following code:</p>
<pre><code><script type="text/javascript">
function validate() {
if ((document.changepass.newpassword.value != '') &&
(document.changepass.retypenewpassword.value ==
document.changepass.newpassword.value)){
document.changepass.retypenewpassword.blur();
document.changepass.submit();
}
}
</script>
<form name="changepass" method="POST" action="changepassword.jsp" onsubmit="return validate();">
<table align="center">
<tr>
<td>New Password:</td>
<td><input type="password" name="newpassword" size="20"
style="width: 145px" maxlength="10"></td>
</tr>
<tr>
<td>Retype New Password:</td>
<td><input type="password" name="retypenewpassword" size="20"
style="width: 144px" maxlength="10"></td>
</tr>
<tr>
<td><input type="submit" value="Change Password" name="operation" ></td>
<td><input type="reset"></td>
</tr>
</table>
</form>
</code></pre>
<p>but when I'm giving unmatched entry then also it getting changed.i mean the validate function is not getting called.
plz help</p>
<p>in hope
robin</p>
| javascript | [3] |
583,950 | 583,951 | jQuery live search | <p>I really like the <a href="http://informationarchitects.jp/articles/" rel="nofollow">search function on iA</a> and I was wondering how they did it. I found ejohn.org/blog/jquery-livesearch/ by John Resig but I still don't know how to: </p>
<ol>
<li>add the counter (128/128 - the number encreases and decreases)</li>
<li>highlight the word I'm searching in the text</li>
</ol>
| jquery | [5] |
1,608,888 | 1,608,889 | Do not show on default page | <p>I have a header which is showed on all my pages. In that header I have a banner. </p>
<p>Is there a way to not show that banner on the root page as well as other pages? </p>
<p>Something like this:</p>
<pre><code>If (!Root OR !/test.php) {
BANNER
}
</code></pre>
| php | [2] |
2,638,210 | 2,638,211 | Image inserted in xls sheet but doesn't appears ! | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4040602/insert-image-in-xls-sheet-throgh-php-code">Insert image in xls sheet throgh php code.</a> </p>
</blockquote>
<p>Hello All,
it feels great that after the help topics and Questionnaire on blog post i am able to insert the image in xls sheet using PHP5,and i am sure about this because befor inserting the image the size of xls file is 15 KB but after inserting the image the size is 127 KB. but when i open up the xls sheet it doesn't get appeared. what could be the reasons.I am using OPenOffice Calc to open up the xls sheet.Hope you all will be cooperative as always.</p>
<p>Cheers !!</p>
| php | [2] |
605,888 | 605,889 | PHP: If image too wide or tall downsize and constrain proportions. | <p>I am guessing probably need to use GD image library for this but I need some help being pointed in the right direction.</p>
<p>I display an image on a page and if it is over 800px wide I want to downscale it to 800 px wide but scale the height proportionally and if its over 600px tall I want to do the same.</p>
<p>What's the best way of achieving this?</p>
| php | [2] |
4,377,968 | 4,377,969 | Problem in storing image in MediaStore in Android | <p>I have written a block of code to insert new image to Android device Image gallery through java program, please find the code below,</p>
<pre><code>ContentValues values = new ContentValues();
values.put(Images.Media.TITLE, "title");
values.put(Images.Media.BUCKET_ID, "test");
values.put(Images.Media.DESCRIPTION, "test Image taken");
values.put(Images.Media.MIME_TYPE, "image/jpeg");
Uri uri = getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, values);
OutputStream outstream;
try {
outstream = getContentResolver().openOutputStream(uri);
receivedBitmap.compress(Bitmap.CompressFormat.JPEG, 70, outstream);
outstream.close();
alertDialog.showMessage("Image Stored Successfully", "Media");
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri));
} catch (Exception e) {
</code></pre>
<p>Image is stored perfectly, but the problem is i could not view the image immediately. I need to switch off and turn it on the device to view the image. Can anyone plese help me to solve this problem?</p>
<p>Edit: Hi Aleadam, Thanks for the replay, pls check my code below</p>
<pre><code> m_pScanner = new MediaScannerConnection(this,
new MediaScannerConnectionClient() {
public void onMediaScannerConnected() {
m_pScanner.scanFile(returnUrl, null /*mimeType*/);
}
public void onScanCompleted(String path, Uri uri) {
if (path.equals(returnUrl)) {
ImageViewActivity.this.runOnUiThread(new Runnable() {
public void run() {
}
});
m_pScanner.disconnect();
}
}
});
m_pScanner.connect();
</code></pre>
<p>It not working for me, it not even connected with the MediaScanner. whether i missed out something.</p>
<p>Thanks
Rajapandian</p>
| android | [4] |
320,008 | 320,009 | Can an object be released in viewDidDisappear method? | <p>I am trying to release the objects,which are used to design the User Interface ,mostly UILabel 's.Is it safe to release the label objects in the viewDidDisappear method as i navigate from one screen to another ? </p>
<p>and i am not using ARC.</p>
| iphone | [8] |
5,731,958 | 5,731,959 | JQuery TreeTable - Trapping Expand event | <p>I'm using the treetable plugin in my web app.
<a href="http://plugins.jquery.com/project/treeTable" rel="nofollow">http://plugins.jquery.com/project/treeTable</a></p>
<p>I want to be able to perform an action when a specific expandable node is expanded. </p>
<p>I can determine which element is responsible for expanding the node. Its a span with class expander.
As far as I can tell the plugin doesnt have an event that is fired when the node is expanded or toggled. </p>
<p>I think this is more of a jquery question than a treetable question, but how would I go about doing that. </p>
<p>This is my first question, please let me know if you need more information. </p>
<p>Thanks. </p>
| jquery | [5] |
4,793,249 | 4,793,250 | Why am I getting errors about API version? | <p>I changed the API version in my manifest to:</p>
<pre><code><uses-sdk android:minSdkVersion="14"
android:targetSdkVersion="14" />
</code></pre>
<p>However in my code I'm getting an error:</p>
<pre><code>Call requires API level 14 (current min is 11):
android.hardware.Camera.Parameters#getMaxNumFocusAreas
</code></pre>
<p>What do I need to change?</p>
| android | [4] |
237,819 | 237,820 | taking javascript into an external file and calling a function from it | <p>I have made a working webpage but when i try to take the jscript into an external file it no longer is called. i have put in the code in my header to include the file name but still unable to call it. Here is my jscript please help me out
by the way just a quick edit I got the isMobile function from here <a href="http://www.abeautifulsite.net/blog/2011/11/detecting-mobile-devices-with-javascript/" rel="nofollow">http://www.abeautifulsite.net/blog/2011/11/detecting-mobile-devices-with-javascript/</a></p>
<pre><code><script>
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
function load()
{
var w=((screen.availWidth)/50)*49;
var h=(w/4)*3;
if( isMobile.any() ){
var t=w;
w=h;
h=t;
}
var a=document.getElementById('banner');
a.style.width=w+'px';
a.style.height=(h/4)+'px';
var b=document.getElementById('main');
b.style.width=w+'px';
b.style.height=Math.round((h/7)*4)+'px';
}
</script>
</code></pre>
| javascript | [3] |
4,833,013 | 4,833,014 | how to get response code in android | <p>i am using ksoap to get connected with my web services i got response code "000" as login successful on my logcat now my question is that how to handle that response code so that user can go to next page if possible please provide code..</p>
| android | [4] |
2,017,383 | 2,017,384 | Site.master menu items | <p>In my Site.master, I have a menu.</p>
<pre><code><asp:Menu ID="NavigationMenu" runat="server" ItemWrap="true" Orientation ="Horizontal" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false">
<Items>
<asp:MenuItem NavigateUrl="~/_UILayer1/AdminAcctInfo.aspx" Text="Admin Profile <br/>Info" />
<asp:MenuItem NavigateUrl="~/_UILayer1/BUsersAcctInfo.aspx" Text="Business Users <br/>Profile Info"/>
<asp:MenuItem NavigateUrl="~/_UILayer1/FMMPublication.aspx" Text="Publication"/>
<asp:MenuItem NavigateUrl="~/_UILayer1/ComplaintReportForm.aspx" Text="Complaints"/>
<asp:MenuItem NavigateUrl="~/_UILayer1/FMMAnalytics1.aspx" Text="Analytics"/>
<asp:MenuItem NavigateUrl="~/_UILayer1/PollResults.aspx" Text="Sold Items<br/>PollResults"/>
<asp:MenuItem NavigateUrl="~/_UILayer1/PollResults.aspx" Text="Contact Us<br/>Reports"/>
<asp:MenuItem NavigateUrl="~/_UILayer1/PollResults.aspx" Text="Approve Business<br/> Users<br/> Scheme 0 members" />
<asp:MenuItem NavigateUrl="~/_UILayer1/PollResults.aspx" Text="Check Duplicate<br/> Profiles" />
<asp:MenuItem NavigateUrl="~/_UILayer1/PollResults.aspx" Text="Coupons"/>
</Items>
</asp:Menu>
</code></pre>
<p>There are 10 menuiitems that three of the menu items are falling on the next line.
How do I adjust the width or the font of these menu items and have all these menuitems on one line</p>
<p>Thanks
Sun</p>
| asp.net | [9] |
5,667,910 | 5,667,911 | Retriving phone prefences | <p>is there any way to retrieve phone info such as language so that i can use that to auto adjust the program based on the phone language ? </p>
<p>//Thx in advance</p>
| android | [4] |
43,279 | 43,280 | jQuery: Main nav items selected depending on URL or page name | <p>Ok, I've looked all over for a solution for this but so far I'm unable to find anything related to what I need to accomplish.</p>
<p>What I need is very simple as far as logic goes.</p>
<p>I have a nav bar like this one:</p>
<pre><code><nav>
<ul>
<li><a href="download.shtml">Download</a></li>
<li><a href="documentation.shtml">Documentation</a></li>
<li><a href="contact.shtml">Contact</a></li>
<li><a href="about.shtml">About</a></li>
</ul>
</nav>
</code></pre>
<p>And the URLs of the site are straightforward:</p>
<pre><code>http://domain.net/download.shtml
http://domain.net/documentation.shtml
http://domain.net/contact.shtml
http://domain.net/about.shtml
</code></pre>
<p><strong>Question:</strong></p>
<p>How can I detect which page/URL I'm on and add a class of <code>.active</code> to the corresponding nav item?</p>
<p>The end result would be, for example if I'm in the Download page:</p>
<pre><code><nav>
<ul>
<li><a href="download.shtml" class="active">Download</a></li>
<li><a href="documentation.shtml">Documentation</a></li>
<li><a href="contact.shtml">Contact</a></li>
<li><a href="about.shtml">About</a></li>
</ul>
</nav>
</code></pre>
<p>Thanks in advance for any help on this matter.</p>
| jquery | [5] |
1,314,519 | 1,314,520 | securing and encrypting .mdb file in c# | <p>I want to make my MS Access file (.mdb) unreadable/readable based on a key, using C#. I want to do this without using any third party tools. How can I do this?</p>
| c# | [0] |
529,131 | 529,132 | How to get in JavaScript width and height of image, before it's loaded? | <p>I'm wondering if it's possible to get sizes (width and height) of an image before it's loaded? Unfortunately I can't use something like this code:</p>
<pre><code>$('img').load(function() {
alert(this.width + ' ' + this.height);
});
</code></pre>
<p>I can't wait while image is loading, <strong>I need to know sizes of an image at the beggining</strong>.</p>
<p>Is it possible or should I use for example PHP and getimagesize() function and pass it to HTML?</p>
| javascript | [3] |
3,770,278 | 3,770,279 | clearAnimation() calls onAnimationEnd() | <p>I use an animationListener to animate card moving. At the end of it, I do something else. I noticed that trails of the card moving were left. So what I did was calling clearAnimation. However for some reason onAnimationEnd is called again when I call clearAnimation. WHYYY?</p>
<pre><code>@Override
public void onAnimationEnd(Animation arg0) {
card.getCardImage().setVisibility(View.INVISIBLE);
card.getCardImage().clearAnimation();
</code></pre>
<p>.
.
.
Do other stuff
}</p>
<p>As you can see I call clearAnimation but it cause this method to stop and OnAnimationEnd is called again. The weird thing that I have a very similar code somewhere else and it does not call onanimationEnd again! Any help?</p>
| android | [4] |
2,265,704 | 2,265,705 | Is it possible to reuse a connection when accessing multiple tables in C#? | <p>I am new to C#. I have a program which reads multiple tables in single database. Suppose if i am reading table A so before reading this I have to connect to database in C#. after this I have to fetch some information from table B. Do I have to give the server info, userid and password again to connect to database?</p>
| c# | [0] |
3,931,431 | 3,931,432 | Android: is screen "flickering" harmful? | <p>I'm creating a "sophisticated phone disco" app where I'll implement screen changing colors pretty quickly, also adjusting brightness according. </p>
<p>Could this be harmful to the screen?</p>
| android | [4] |
2,265,976 | 2,265,977 | jQuery insertbefore | <p>I have the following:</p>
<pre><code><table id="StateNames">
<tr>
<td><input name="StateName"></td>
</tr>
<tr><td>Wyoming</td></tr>
<tr><td>Wisconsin</td></tr>
<tr><td>West Virginia</td></tr>
</table>
</code></pre>
<p>I'd like to </p>
<pre><code>$('input').change(function() {
var StateName = $(this).val();
insert <tr><td>StateName</td></tr> before Wyoming
</code></pre>
| jquery | [5] |
167,686 | 167,687 | Possible to post data in a PHP redirect? | <p>Well right now I have a page (page2.php) and at the top it does some validation checking and if something fails it bounces back to page1.php. The problem is that page1.php is loaded by a post meaning it is the end result of a form. This means that all the post data I originally have on page1.php is lost.</p>
<p>So here is my code:</p>
<pre><code>if ($validation_fails)
{
header('Location:page1.php');
}
</code></pre>
| php | [2] |
5,922,164 | 5,922,165 | PHP - Duplicate array values | <p>so i have this array;</p>
<pre><code>Array ( [0] => A [1] => B [2] => C )
</code></pre>
<p>what i want to do is;</p>
<pre><code>Array ( [0] => A [1] => A [2] => A [3] => B [4] => B [5] => B [6] => C [7] => C [8] => C)
</code></pre>
<p>repeat each value, A-A-A-B-B-B-C-C-C</p>
<p>i have tried array_merge and gives me A-B-C-A-B-C</p>
<p>thanks!</p>
| php | [2] |
4,484,900 | 4,484,901 | How to detect more than one line break \n in PHP? | <p>I need to detect more than one <code>\n</code>. Doesn't matter if it's 2 or 1000, as long as it's more than one <code>\n</code>. What would be the regex for this (if regex is necessary that is)?</p>
<p><strong>EDIT</strong></p>
<p>I am using this:</p>
<pre><code>$pregmatch = preg_match('#\\n\\n+#', $locations);
if ($pregmatch > 0) {
echo 'more than one, this many: '.count($pregmatch);
} else
echo 'less than one';
</code></pre>
<p>but <code>count($pregmatch)</code> doesn't return the actual number of more than one <code>\n</code> detected. How can that be achieved?</p>
| php | [2] |
3,974,186 | 3,974,187 | Need help with jQuery validation for a select list | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/3824608/jquery-custom-validation-method-issue">jQuery custom validation method issue</a> </p>
</blockquote>
<p>I have a select list #technology. It's default value is "0" due to back end payment processor. I need a validation rule (using jquery.validate.js) that makes it return false if it's value is "0" but return true for any other value. What I am trying isn't working.</p>
<pre><code><script type="text/javascript">
$(document).ready(function() {
$.validator.addMethod(
"SelectTechnology",
function(value, element) {
//var selectedCountry = $('#Country').val();
if ($("#singleTech").val() === '0'){
return false;
} else return true;
},
"Please Select a Technology"
);
var validator = $("#SinglePmnt").validate({
rules: {
technology: {
SelectTechnology: true
}
},
errorElement: "span",
errorPlacement: function(error, element) {
error.appendTo(element.parent("td"));
}
});
});
</script>
</code></pre>
<p>It doesn't clear the error if you hit submit with the default value selected then change it.
thanks</p>
| jquery | [5] |
3,123,227 | 3,123,228 | issue while iterating the records | <p>I have a table ggg which contain different coulums as shown below</p>
<pre><code>AAAA BBBB CCCC
---- ---- ----
FDFD fghj null
WDWD dwww null
DWDS dree null
DSDS null 4556
DSDS dfgh null
</code></pre>
<p>As shown in the above table I am getting all the rows in an object , object t
and I am using the methods like t.getBBBB() and t.getCCCC() , Now i am iterating over he object t storing it contents in an arraylist with advanced for loop now please advise i have to perform the logic where the value of the column BBBB is null and
value of column CCCC is 4556</p>
<p>I am doing like this</p>
<pre><code>if (t.getBBBB().equals(null) && t.getCCCC().equals(4556)
{}
</code></pre>
<p>but the issue is that as a i am iterating all this in advance for loop so the first rows come before this having the value other so it throws the exception please advise how to proceed </p>
| java | [1] |
60,681 | 60,682 | Does Javascript have a contains function? | <p>I am not sure if it does or does not. Some sites show using a contains in javascript but when I try it does not work.</p>
<p>I have</p>
<pre><code>var userAgent = navigator.userAgent.split(';');
if (userAgent.contains("msie7") == true) {...}
</code></pre>
<p>I am trying to use the useragent to figure out if the user is running IE 8 in compatibility mode. So I want to check the userAgenet for msie7 & for the trident 4.0</p>
<p>So how could I check this array?</p>
| javascript | [3] |
5,364,500 | 5,364,501 | How do you redirect the user to their previous page after logging in with PHP? | <p>I have a log in widget included on every page on my website. Currently when they log in, they are redirected to the home page. However I want it so when they log in, they stay on the page they are currently viewing.</p>
<p>On my forum you have to be logged in to post (obviously). I would like it so they will stay on the forum post they are trying to reply to after logging in, rather than having to find it again. How do I do this?</p>
| php | [2] |
422,226 | 422,227 | php reads mysql id shows 01 02 03 | <p>I wanna php output my mysql 1 as 01, 2 as 02.... and so on,
so I get database ID first then I wrote this code for output</p>
<pre><code>if ($id <10) {
echo '0'.$id;
} else {
echo $id;
}
</code></pre>
<p>and then I want to insert $id to my class then in a loop</p>
<pre><code> while ($sth <100) {
$id = mysql_result($result,$mtt,"ID");
echo "<div class='active_$id'>$info</div>";
$sth++
}
</code></pre>
<p>how should i replace </p>
<pre><code>if ($id <10) {
echo '0'.$id;
} else {
echo $id;
}
</code></pre>
<p>to <code>$id</code>? </p>
| php | [2] |
2,945,805 | 2,945,806 | openOrCreateDatabase error | <pre><code>public class DBActivities {
private final String tableName = "Table_SMS";
private final String CREATE_TABLE_SMS = "CREATE TABLE " + tableName + "(" + "db_date TEXT " + "db_sms_count INTEGER);";
private SQLiteDatabase db;
public DBActivities() {
DoDBInitialization();
}
private void DoDBInitialization() {
db = openOrCreateDatabase(tableName, 0, null);
db.setVersion(1);
db.setLocale(Locale.getDefault());
db.setLockingEnabled(true);
}
</code></pre>
<p>I'm getting the error "The method openOrCreateDatabase(String, int, null) is undefined for the type DBActivities". What can be the problem here? DBActivities class is being used by the main class for all database related activites.</p>
<p>I did some research and I tried using:</p>
<pre><code>db = openOrCreateDatabase(tableName, null, Context.MODE_PRIVATE);
</code></pre>
<p>Still the result is the same.</p>
| android | [4] |
2,248,390 | 2,248,391 | Accessing a range of elements from a vector | <p>There is a list of objects say for example:- Rectangle objects in a list, like
std::list. I need to get a list of 50 objects(at a time) from the list and then grab individual elements from each Rectangle as length and breadth and form a string of sizes(length, breadth) of first 50, and then the next 50 and so forth until the end...</p>
<p>I am trying to figure out a way to code this using boost functionality. </p>
| c++ | [6] |
4,616,603 | 4,616,604 | Survey program, name repeating, need idea | <p>The first line should consist of N number who would determinate the number of names entered, the program output should display the name who is repeated most of the times, I hope that makes sense.</p>
<p>Example:</p>
<p>4</p>
<p>John</p>
<p>Harry</p>
<p>Davis</p>
<p>Harry</p>
<p>The output would be "Harry". Any idea how I would go with this in C++?</p>
<p>My current code:</p>
<pre><code> #include <iostream>
using namespace std;
string niza[100];
int index,brojac=0,maxi=0;
int proverka(string ime, int n)
{
for(int i=0; i<=n-1; i++)
{
if(ime==niza[i])
{
if(brojac==0)
{
index=i;
brojac++;
if(brojac>maxi) maxi=brojac;
}
else
{
brojac=0;
}
}
}
}
int main()
{
int n;
cin >> n;
for(int i=0; i<=n-1; i++)
{
cin >> niza[i];
}
for(int i=0; i<=n-1; i++)
{
proverka(niza[i],n);
}
cout << niza[index];
return 0;
}
</code></pre>
| c++ | [6] |
5,302,365 | 5,302,366 | Securing my website admin area | <p>So I'm building a GUI admin area for my site. I will be the only one to login and it will just show a clean (printable) layout of info from my db.</p>
<p>Here's what I'm doing for security. Let me know if you think this is good and how I can improve.</p>
<ol>
<li>headers on all pages check for <code>admin == true</code> or die/redirect</li>
<li>since i have a dedicated ip at home and i will only login from home. I made all pages including the login form page check for my IP <code>$_SERVER['REMOTE_ADDR'];</code> != header redirect</li>
<li>My login script is in <code>dir</code> set <code>700</code> in folder permissions.</li>
<li>my login and pw contain 10 total combo of letters, numbers and special chars. PW is stored as SHA2 HASH</li>
<li>my login script checks for <code>regex</code> prior to <code>sql</code> and my credentials are stored in a separate admin table</li>
<li>The entire site is on SSL.</li>
</ol>
<p>So is this secure? Can I do more? Is this overkill? Please share your opinions and suggestions (especially regarding my IP check. Can that be circumvented?)</p>
<p>Used to escape bad data - in conjunction with <code>regex</code> on every field</p>
<pre><code>function escape_data ($data) {
if (function_exists(‘mysql_real_escape_string’)) {
global $dbc;
$data = mysql_real_escape_string (trim($data), $dbc);
$data = strip_tags($data);
} else {
$data = mysql_escape_string (trim($data));
$data = strip_tags($data);
}
return $data;
}
</code></pre>
| php | [2] |
4,767,465 | 4,767,466 | What are the rules on #include "xxx.h" Vs #include <xxx.h>? | <p>If I have my own library projects, which style should I use to <code>#include</code> the headers from them in my application? Are there strict rules, and do the two actually have different meanings to the compiler/preprocessor or is it about standards only?</p>
| c++ | [6] |
1,565,132 | 1,565,133 | Why is it returning exit status 11? | <pre><code><?php
require_once 'functions.php';
if(!isset($_SERVER['DOCUMENT_ROOT'])){
$_SERVER['DOCUMENT_ROOT'] = /* ... */;
}
if(isset($_GET['img'])){
$id = urldecode($_GET['img']);
}else{
die('unspecified');
}
$w = 150;
$h = 114;
$row = get_fields($id, array('name', 'ext'));
$image = $_SERVER['DOCUMENT_ROOT'] . '/images/' . $row['name'];
if (!file_exists($image)){
die('invalid');
}
$cache = $_SERVER['DOCUMENT_ROOT'] . '/thumbs/' . $row['name'];
$cli = isset($_GET['context']) && $_GET['context'] == 'cli';
if(!file_exists($cache)){
$thumb = cacheThumb($image);
}elseif(!$cli){
$thumb = new Imagick($cache);
}
if(!$cli){
header ('Content-Type: image/' . strtolower($thumb->getImageFormat()));
echo $thumb->getImageBlob();
}else{
exit(0);
}
function cacheThumb($image){
global $cache, $w, $h, $firephp;
$thumb = new Imagick($image);
$thumb->flattenImages();
$quotient = min($thumb->getImageWidth() / $w,
$thumb->getImageHeight() / $h);
$thumb->cropImage($w * $quotient, $h * $quotient, 0, 0);
$thumb->scaleImage($w, $h);
$thumb->writeImage($cache);
return $thumb;
}
?>
</code></pre>
| php | [2] |
5,263,135 | 5,263,136 | Android Game Startup Screen | <p>In some games, the game startup is to display the company name for a moment and then display the main menu for starting the game.</p>
<p>I would like to do something similar. But I am not sure if my way is a good way...</p>
<p>In my plan, I would display the startup image and then make the program sleeps for 1 seconds and then display the main menu</p>
<p>Shall I use the sleep function to hold the screen for a second? </p>
<p>If I want to use flash image instead of static image? Is it also feasible? What's the usual way to do something like this ?</p>
| android | [4] |
5,265,273 | 5,265,274 | Upload and insert into text area | <p>I have wrote a very simple php upload. But I want to insert image in text area with "click". I want to do this with jquery. </p>
<p><img src="http://i.stack.imgur.com/esJ4v.jpg" alt="alt text">
<img src="http://i.stack.imgur.com/rJvdH.jpg" alt="alt text"></p>
<p>Is there any jquery plugin for do this? (or an application for upload like in stackoverflow)?
Thanks in advance</p>
| jquery | [5] |
1,279,201 | 1,279,202 | Dynamically add an Android canvas? | <p>I want to dynamically add my canvas to my layoiut but this has the error:
Description Location Resource Path Type
The method addView(View) in the type ViewGroup is not applicable for the arguments (Canvas) Java Problem</p>
<pre><code>Canvas canvas = new Canvas();
LinearLayout ll = new LinearLayout(this);
ll.addView(canvas);
</code></pre>
| android | [4] |
1,207,621 | 1,207,622 | Resize byte[] of Image | <p>After reading from file dialog I want to resize a picture. I have the done the following code. Now I want to resize the stream of picture. How do I do it?</p>
<pre><code>Stream stream = (Stream)openFileDialog.File.OpenRead();
byte[] bytes = new byte[stream.Length];
</code></pre>
| c# | [0] |
4,613,473 | 4,613,474 | get a different file name | <p>How do i get a different file name on a webserver by requesting the url.</p>
<p>for example "file" click url link and get "file.bin"</p>
<p>the "file" is located on a webserver by requesting the url, user can download "file.bin" instead of "file"</p>
<p>something like (file + .bin)</p>
| java | [1] |
3,672,334 | 3,672,335 | How ads to android application | <p>I think about create some free applications on android but I would like to add some ads to make some money. How I can find good tutorial how I can add ads to my applications?</p>
| android | [4] |
5,723,973 | 5,723,974 | why HashMap Values are not cast in List? | <p>I'm putting values into the hashmap which is of the form.</p>
<pre><code> Map<Long, Double> highLowValueMap=new HashMap<Long, Double>();
highLowValueMap.put(1l, 10.0);
highLowValueMap.put(2l, 20.0);
</code></pre>
<p>I want to create a list by using values method of map.</p>
<pre><code>List<Double> valuesToMatch=new ArrayList<>();
valuesToMatch=(List<Double>) highLowValueMap.values();
</code></pre>
<p>or </p>
<pre><code> List<Double> valuesToMatch=(List<Double>) highLowValueMap.values();
</code></pre>
<p>it throw exception:</p>
<blockquote>
<p>Exception in thread "main" java.lang.ClassCastException:
java.util.HashMap$Values cannot be cast to java.util.List</p>
</blockquote>
<p>But it allow to create list in definition of list like:</p>
<pre><code>List<Double> valuesToMatch = new ArrayList<Double>( highLowValueMap.values());
</code></pre>
| java | [1] |
2,630,402 | 2,630,403 | How to set style for EditText? | <p>I'm developing some Android application, and I need to change style of EditText. I use 4.0 version, and I need to set border width, border color and background color, and rounded corners. How can I do it? Thank you in advance. </p>
| android | [4] |
2,481,082 | 2,481,083 | jquery toggle display | <p>I'd like to create a list and be able to toggle the display of children items on click. Should be simple but i can't get it to work. Any thoughts?</p>
<pre><code><script>
$(document).ready(function(){
$("dt a").click(function(e){
$(e.target).children("dd").toggle();
});
});
</script>
<style>
dd{display:none;}
</style>
<pre>
<dl>
<dt><a href="/">jQuery</a></dt>
<dd>
<ul>
<li><a href="/src/">Download</a></li>
<li><a href="/docs/">Documentation</a></li>
<li><a href="/blog/">Blog</a></li>
</ul>
</dd>
<dt><a href="/discuss/">Community</a></dt>
<dd>
<ul>
<li><a href="/discuss/">Mailing List</a></li>
<li><a href="/tutorials/">Tutorials</a></li>
<li><a href="/demos/">Demos</a></li>
<li><a href="/plugins/">Plugins</a></li>
</ul>
</dd>
</dl>
</pre>
</code></pre>
| jquery | [5] |
5,448,720 | 5,448,721 | iPhone security architecture | <p>I want to study in detail about security architecture that iphone has implemented. after searching on internet, the only useful material that i found is iphone reference library. Where i am now a days studying the Architecture of OS and then i will seduty the "secure coding guide".</p>
<p>I was wondering, if some of you guys, can lead me to some nice article or something which covers iphone security in general or in detail besides iphone official sites. </p>
<p>thanks,</p>
| iphone | [8] |
706,188 | 706,189 | Unable to get particular output in a file | <pre><code>File outputFile2 = new File("money2.txt");
BufferedWriter outData2 = new BufferedWriter(new FileWriter(outputFile2));
for(int i = 0 ; i < 4 ; i++)
{
System.out.println(ts[i].getMoney());
outData2.write("TESTING");
outData2.write(ts[i].getMoney());
outData2.newLine();
}
outData2.close();
</code></pre>
<p>This is my code. In my console I get</p>
<pre><code>20000
10000
10000
4000
</code></pre>
<p>Which is exactly what I want in my file. But instead, I get this in <code>money2.txt</code>:</p>
<pre><code>TESTING?
TESTING?
TESTING?
TESTING?
</code></pre>
<p><em>(Testing is there for debugging purposes)</em></p>
<p>I can't figure out how to debug this. My file is being written to correctly (since 'TESTING' is getting printed. My array is being read from correctly (since output to the console is correct.</p>
<p>What is going wrong?</p>
| java | [1] |
4,188,610 | 4,188,611 | Reading file into RichTextBox without using LoadFile | <p>I want to read a file into a RichTextBox without using LoadFile (I might want to display the progress). The file contains only ASCII characters.</p>
<p>I was thinking of reading the file in chunks.</p>
<p>I have done the following (which is working):</p>
<pre><code>const int READ_BUFFER_SIZE = 4 * 1024;
BinaryReader reader = new BinaryReader(File.Open("file.txt", FileMode.Open));
byte[] buf = new byte[READ_BUFFER_SIZE];
do {
int ret = reader.Read(buf, 0, READ_BUFFER_SIZE);
if (ret <= 0) {
break;
}
string text = Encoding.ASCII.GetString(buf);
richTextBox.AppendText(text);
} while (true);
</code></pre>
<p>My concern is:</p>
<pre><code>string text = Encoding.ASCII.GetString(buf);
</code></pre>
<p>I have seen that it is not possible to add a <code>byte[]</code> to a RichTextBox.</p>
<p>My questions are:</p>
<ul>
<li><p>Will a new string object be allocated for every chunk which is read?</p></li>
<li><p>Isn't there a better way not to have to create a string object just for appending the text to the RichTextBox?</p></li>
<li><p>Or, is it more efficient to read lines from the file (StreamReader.ReadLine) and just add to the RichTextBox the string returned?</p></li>
</ul>
| c# | [0] |
3,162,498 | 3,162,499 | AutoCompleteTextView NullPointer Exception | <p>I have searched a long time and cannot find a solution to my problem. I am trying to create a Dialog with an AutoCompleteTextView. I followed the tutorial on the Android developer website, and it worked great. I have been successful using layouts on Dialogs before, so I thought this would be just as easy. I created a layout for my Dialog and I made sure that the AutoCompleteTextView has an ID. Here's where the interesting stuff happens...</p>
<pre><code> dialog.setContentView(R.layout.auto_layout);
AutoCompleteTextView auto_tv = (AutoCompleteTextView)findViewById(R.id.role_ac);
</code></pre>
<p>Here is the layout as well.</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="Role" />
<AutoCompleteTextView android:id="@+id/role_ac" android:layout_width="280dip" android:layout_height="wrap_content"/>
<Button android:layout_height="wrap_content"
android:layout_width="fill_parent" android:text="Done"
android:id="@+id/auto_doneButton" />
</LinearLayout>
</code></pre>
<p>For some reason, auto_tv is null even though it does exist in the layout auto_layout. The only way I have been able to get an AutoCompleteTextView in a Dialog is by building the layout programmatically. Why is the AutoCompletTextView null when I try to use it? Did I forget something in my layout or am I not constructing the object correctly? Any help on this would be greatly appreciated. Thanks.</p>
| android | [4] |
5,363,685 | 5,363,686 | Sorting a dictionary which has values as list, and sorting based on the elements inside this list | <p>I have a list</p>
<pre><code>A={'k3': ['b', 3],'k2': ['a', 1],'k1': ['a', 3],'k4': ['c', 2],'k5': ['b', 2]}
</code></pre>
<p>I want to sort the above dictionary first by letters 'a','b' and 'c' in an ascending order</p>
<p>and then based on values 3,2,1 in the descending order. So my output should look something like</p>
<pre><code>A={'k1': ['a', 3],'k2': ['a', 1],'k3': ['b', 3],'k5': ['b', 2],'k4': ['c', 2]}
</code></pre>
<p>How do I do it?</p>
| python | [7] |
3,529,935 | 3,529,936 | Storage of single/group of integer values | <p>am working on a bit unusual requirement wherein there is an integer parameter x, which can take a single value or a group of values. If the parameter takes a group of values, it is enough for me to store only the maximum and minimum. Usual C# thinking made me to to have four variables namely x, minX, maxX and boolean variable (to know whether the variable takes a single or group of values), I have four such parameters, which results in bloating of class variables (total 16 variables).</p>
<p>Is there any construct in C# which helps me in an efficient storage with the above constraint? I couldnt think beyond nullable values.</p>
| c# | [0] |
938,527 | 938,528 | Error converting a numeric month into textural representation | <p>I am using the following code in php to convert the month in numeric to textural representation. </p>
<pre><code>date('M',strtotime(8));
</code></pre>
<p>But for every digit I am getting 'Dec' as my month.</p>
<p>How should i make it work. </p>
<p>Thank you
Zeeshan</p>
| php | [2] |
2,591,448 | 2,591,449 | Initializing and assigning values,from pass by reference | <p>Okay, this is just a minor caveat. I am currently working with the lovely ArcSDK from ESRI. Now to get a value from any of their functions, you basically have to pass the variable, you want to assign the value to.</p>
<p>E.g.:</p>
<pre><code>long output_width;
IRasterProps->get_Width(&output_width);
</code></pre>
<p>Its such a minor thing, but when you have to pick out around 30 different pieces of data from their miscellaneous functions, it really starts to get annoying.</p>
<p>So what i was wondering is it possible to somehow by the magic of STL or C++ change this into:</p>
<pre><code>long output_width = IRasterProps->get_Width(<something magical>);
</code></pre>
<p>All of the functions return void, otherwise the off chance some of them might return a HRESULT, which i can safely ignore. Any ideas?</p>
<p><strong>*EDIT**</strong></p>
<p>Heres the final result i got which works :)!!!!!</p>
<pre><code>A magic(P p, R (__stdcall T::*f)(A *)) {
A a;
((*p).*f)(&a);
return a;
}
</code></pre>
| c++ | [6] |
4,153,198 | 4,153,199 | IndexOutOfBoundsException...know what the error means but need help debugging? | <p>Creating a program to generate random numbers and put them in either an even or odd array, but get the same error message above? If anyone knows how to format better please help!</p>
<pre><code> import static java.lang.Math.*;
import java.util.Random;
public class Unit8
{
public static void main ( String [ ] args )
{
int [ ] randomNum = new int [100] ;
for ( int x = 0; x <= randomNum.length; x++ )
{
randomNum [ x ] = (int) (Math.random ( ) * 25 );
}
int sum = 0;
int [ ] oddArray = new int [ 100 ] ;
for ( int x = 0; x <= randomNum.length; x++ )
{
if (randomNum [ x ] % 2 != 0 )
sum += oddArray [ x ];
}
int sum2 = 0;
int [ ] evenArray = new int [ 100 ] ;
for ( int x = 0; x <= randomNum.length; x++ )
{
if (randomNum [ x ] % 2 == 0 )
sum2 += evenArray [ x ] ;
}
display ( oddArray );
display1 ( evenArray );
}
public static void display ( int [ ] oddArray)
{
System.out.println ( oddArray );
}
public static void display1 ( int [ ] evenArray )
{
System.out.println ( evenArray );
}
}
</code></pre>
| java | [1] |
1,775,219 | 1,775,220 | Prepend zero to byte | <p>I'm reading file and I want to print byte value in 2 digits if it is less than 10 (example if byte=1 it should disply byte=01), I don't want to compare it like this:</p>
<pre><code> if(byte<10){
stringBuffer buf= new stringBuffer();
buf.append("0"+byte);
}
</code></pre>
<p>is there any built in method to do this, just like the format function in vc++?</p>
<p>Thanks
gagana</p>
| java | [1] |
4,638,192 | 4,638,193 | how to add an index(path) to an array | <p>hello
i am wondering how its possible to add an index for a tableview to an array. i am trying to save this index to the array in order to be able to view it later. i just am interested in knowing how to save the index to the array. thanks </p>
| iphone | [8] |
2,449,549 | 2,449,550 | shortest possible hash value | <p>I have gone through this page...</p>
<p><a href="http://www.php.net/manual/en/function.hash.php" rel="nofollow">http://www.php.net/manual/en/function.hash.php</a></p>
<p>MD5 is 32 characters long while sha1 is 40.
For e.g.</p>
<pre><code>$str = 'apple';
sha1 string d0be2dc421be4fcd0172e5afceea3970e2f3d940
md5 string 1f3870be274f6c49b3e31a0c6728957f
</code></pre>
<p>Even if the optional raw_output is set to TRUE, then the md5 digest is instead returned in raw binary format with a length of 16.</p>
<p>I am looking for a function that will create hash that will be equal or less than 8 characters.</p>
<p>Update:
I need smaller strings for 3 reasons:</p>
<p>1) MySQL Archive table type does not seem to allow an index on a column that has more than 8 chars</p>
<p>2) I am planning to use key-value utility like redis that likes smaller keys</p>
<p>3) Security is not an issue here. I am hashing columns like "country + telco + operator"</p>
| php | [2] |
5,691,367 | 5,691,368 | Cannot cast list iterator to an object | <p>I get the error:</p>
<pre><code>error C2682: cannot use 'dynamic_cast' to convert from 'std::_List_iterator<_Mylist>' to 'UserBean *'
</code></pre>
<p>When executing:</p>
<pre><code>list<UserBean> * userBeans = getUserBeans();
for(list<UserBean>::iterator i = userBeans->begin(); i != userBeans->end(); i++)
UserBean * newUser = dynamic_cast<UserBean*>(i);
</code></pre>
<p>Am I doing something wrong, or can you not convert iterator items to objects?</p>
| c++ | [6] |
3,724,878 | 3,724,879 | jQuery: Selecting immediate siblings | <p>Suppose I have this HTML:</p>
<pre><code><div id="Wrapper">
<div class="MyClass">some text</div>
<div class="MyClass">some text</div>
<div class="MyBorder"></div>
<div class="MyClass">some text</div>
<div class="MyClass">some text</div>
<div class="MyClass">some text</div>
<div class="MyBorder"></div>
<div class="MyClass">some text</div>
<div class="MyClass">some text</div>
</div>
</code></pre>
<p>I want to get the text of the MyClass divs next to the one clicked on, in the order they're in.</p>
<p>This is what I have:</p>
<pre><code>$('#Wrapper').find('.MyClass').each(function () {
AddressString = AddressString + "+" + $(this).text();
});
</code></pre>
<p>I know adds ALL the MyClass divs; I'm just wondering if there's a quick way to do it.</p>
<p>Thanks.</p>
| jquery | [5] |
3,580,572 | 3,580,573 | PHP __DIR__ or __FILE__ symlinked | <p>Using <code>__DIR__</code> and <code>__FILE__</code> constants do not work in a symlinked situation. What is the workaround for this?</p>
<p>For example:</p>
<p>I have a file:</p>
<pre><code>/home/me/modules/myfile.php
</code></pre>
<p>It is symlinked to:</p>
<pre><code>/var/www/project/app/myfile.php
</code></pre>
<p>from in <code>/home/me/modules/myfile.php</code> i need to include a file that is located in <code>/var/www/project</code></p>
<p>EDIT</p>
<p>To the suggestions of using realpath() - unfortunately this does not work.</p>
<pre><code>var_dump(__DIR__);
var_dump(realpath(__DIR__));
</code></pre>
<p>both return exactly the same filepath</p>
| php | [2] |
4,967,064 | 4,967,065 | Android Phone App Modification | <p>Is there any way to modificate Phone App? I need to add some caller's info on it but I can't find way to do it/</p>
| android | [4] |
3,998,575 | 3,998,576 | Parsing Character Stream | <p>I am getting a continuous stream of characters which I have moved into a flat file in a single line. Now these characters are coming in below form.</p>
<pre><code>keepalivekeep_aliveenroll,10.213.17.4,0,12,594,4,5,METRO-A,1enroll,10.213.17.4,0,13,594,4,5,METRO-B,1clear,10.213.17.4,0,14,100010934,1323168443
</code></pre>
<p>What i want is to move messages coming between particular tags (<code>keep_alive</code>, <code>clear</code>, <code>enroll</code>, etc.) in different lines. For example output from above should be:</p>
<pre><code>keep_alive
keep_alive enroll,10.213.17.4,0,12,594,4,5,METRO-A,1
enroll,10.213.17.4,0,13,594,4,5,METRO-B,1
clear,10.213.17.4,0,14,100010934,1323168443
</code></pre>
<p>What is the best way to do this in Java? What is noteworthy here is that file is getting continuous data and I need to do this continuously in some kind of loop.</p>
| java | [1] |
2,538,063 | 2,538,064 | how to represent negative number to array of integers? | <p>I must convert string of 1324312321 to array of integers in java</p>
<p>this is fine. I could use integer parseint and string substring method </p>
<p>but how do I repesent -12312312 to my original array of integer.. </p>
<p>the fact that - is a char / string and convert to array of integer would alter the value ( even though I convert - to integer-equivalent , it would change the rest of 12312312)</p>
<p>it must be an array of integers and how should I convert negative numbers and still keeep the same value</p>
<p>somehow reminding me of two complements trick but i dont think i need to go down to binary level in my program.. </p>
<p>any other trick for doing this?</p>
<p>thanks!</p>
| java | [1] |
598,502 | 598,503 | Javascript, getting value using key press is always one character behind the latest? | <p>Is there anyway around this?</p>
<p>If i pressed 'St', by the time i had pressed the t, if i were to output the input textfield.value in the onkeypress/onkeyup/etc function, i would only get 'S'??</p>
<p>How do i get rid of this lag?</p>
| javascript | [3] |
2,156,591 | 2,156,592 | TabActivity and Activity event Handling | <p>I followed the tutorial "Tab Layout" and i created my TabActivity with some tab, in particular i have a tab called "newTab" with a button and i want to add a new tab when i press it.</p>
<p>If i implement the OnClickListener in the newTab Activity i don't know how to call the tabHost.addTab() method because it is a TabActivity method, and if i implement the OnClickListener in the TabActivity i don't know how to assign the button event to it... so how can i do it?</p>
<p>Tnk's All</p>
| android | [4] |
4,581,518 | 4,581,519 | How to add a corner for a button? | <p>How can I create a corner like this for a button?</p>
<p><img src="http://i.stack.imgur.com/PYW5J.png" alt="cornered button"></p>
<p>This button is created programmatically, and I can't use an image because the width/height of the button varies.</p>
| android | [4] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.