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,671,609
3,671,610
validation in text boxes using datepicker
<p>I have three textboxes, box1-filled by user1 box2-filled by user2 box3-filled by user3</p> <p>I have also a default value for these three boxes. 1.Now when box1 is selected user1 cannot input dates before the default date and it should not be allowed to select dates more than in box2(if not blank,otherwise default date is considered). 2.user2 can enter dates in the range of box1 and box2. if these boxes are empty,default will be considered. 3.user3 can enter date after the dates in box2.</p> <p>pls can you suggest some solution,as i am new to this technology. thnx in advance</p>
jquery
[5]
985,351
985,352
Very strange char array behaviour
<p>.</p> <pre><code> unsigned int fname_length = 0; //fname length equals 30 file.read((char*)&amp;fname_length,sizeof(unsigned int)); //fname contains random data as you would expect char *fname = new char[fname_length]; //fname contains all the data 30 bytes long as you would expect, plus 18 bytes of random data on the end (intellisense display) file.read((char*)fname,fname_length); //m_material_file (std:string) contains all 48 characters m_material_file = fname; // count = 48 int count = m_material_file.length(); </code></pre> <p>now when trying this way, intellisense still shows the 18 bytes of data after setting the char array to all ' ' and I get exactly the same results. even without the file read</p> <pre><code>char name[30]; for(int i = 0; i &lt; 30; ++i) { name[i] = ' '; } file.read((char*)fname,30); m_material_file = name; int count = m_material_file.length(); </code></pre> <p>any idea whats going wrong here, its probably something completely obvious but im stumped!</p> <p>thanks</p>
c++
[6]
4,056,246
4,056,247
Include all PHP files from a directory except one 'index.php'
<p>I have the following PHP code that scans a directory and sub folders and lists all the PHP files in iframes. I want to include all the PHP files from the directory except one, any instance of 'index.php'.</p> <p>I've tried adding:</p> <pre><code> if ($file != "." &amp;&amp; $file != ".." &amp;&amp; $file != 'index.php') </code></pre> <p>But it doesn't work. Here's the full code:</p> <pre><code>&lt;?php $iterator = new RecursiveDirectoryIterator('work/'); foreach( new RecursiveIteratorIterator($iterator) as $filename =&gt; $cur) { $file_info = pathinfo($filename); if($file_info['extension'] === 'php') { if ($file != "." &amp;&amp; $file != ".." &amp;&amp; $file != 'index.php') echo "&lt;iframe width=420 height=150 frameborder=1 src='$filename'&gt;&lt;/iframe&gt;"; } } ?&gt; </code></pre> <p>Thanks!</p>
php
[2]
2,324,402
2,324,403
when does document.ready actually fire?
<p>Let's consider the following case:</p> <p>There is a 2.5MB image in an image tag and I'm on a slow connection which takes considerable time to download that image. If I'm putting the document.ready() in the head tag, then will it wait for the image to be downloaded or it will fire when all the html is downloaded?</p> <p>In case it fires when all the html is downloaded,then how do I avoid it?</p> <p>How do I make the .ready() function to fire after the 2.5MB data transfer?</p>
jquery
[5]
2,310,065
2,310,066
What's wrong in this simple android Program, I get 'Force Close'
<p>What is wrong in this program, My eclipse IDE doesn't show any errors....when I execute this simple program the emulator shows force close....Anybody please clarify</p> <pre><code>import android.app.Activity; import android.view.View.OnClickListener; import android.view.View; import android.os.Bundle; import android.widget.*; public class HelloWorld extends Activity implements OnClickListener { /** Called when the activity is first created. */ View Et1,Bt1,TxtDisp; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.name_getter); Bt1=(Button)findViewById(R.id.Btn1); Et1=(EditText)findViewById(R.id.UserInput); TxtDisp=(TextView)findViewById(R.id.TextDisp); Bt1.setOnClickListener(this); } @Override public void onClick(View v) { // TODO Auto-generated method stub String userInput=((EditText) Et1).getText().toString(); ((TextView)TxtDisp).setText(userInput); } } </code></pre>
android
[4]
2,135,741
2,135,742
CsvHelper not writing anything to memory stream
<p>I have the following method:</p> <pre><code>public byte[] WriteCsvWithHeaderToMemory&lt;T&gt;(IEnumerable&lt;T&gt; records) where T : class { using (var memoryStream = new MemoryStream()) using (var streamWriter = new StreamWriter(memoryStream)) using (var csvWriter = new CsvWriter(streamWriter)) { csvWriter.WriteRecords&lt;T&gt;(records); return memoryStream.ToArray(); } } </code></pre> <p>Which is being called with a list of objects - eventually from a database, but since something is not working I'm just populating a static collection. The objects being passed are as follows:</p> <pre><code>using CsvHelper.Configuration; namespace Application.Models.ViewModels { public class Model { [CsvField(Name = "Field 1", Ignore = false)] public string Field1 { get; set; } [CsvField(Name = "Statistic 1", Ignore = false)] public int Stat1{ get; set; } [CsvField(Name = "Statistic 2", Ignore = false)] public int Stat2{ get; set; } [CsvField(Name = "Statistic 3", Ignore = false)] public int Stat3{ get; set; } [CsvField(Name = "Statistic 4", Ignore = false)] public int Stat4{ get; set; } } } </code></pre> <p>What I'm trying to do is write a collection to a csv for download in an MVC application. Every time I try to write to the method though, the MemoryStream is coming back with zero length and nothing being passed to it. I've used this before, but for some reason it's just not working - I'm somewhat confused. Can anyone point out to me what I've done wrong here?</p> <p>Cheers</p>
c#
[0]
517,818
517,819
Will it return my method name if called
<pre><code>private IPerson savePerson; public IContact getsaveContact() { System.out.println("Hello"); //info("Coming Here"); return savePerson; } public void setsaveContact(IPerson contact) { this.savePerson= savePerson; } package import Contact; public interface IPerson { public void savePerson(Contact contact); } </code></pre> <p>I have an interface IPerson with methodname savePerson. I need to access that method name. What i do is above, when i call my getsaveContact method will it return savePerson method name of my Interface</p> <p>I dont want to implement the interface at all, but i need to call the method name inside through some way... i heard we can do it via getter and setter methods. </p>
java
[1]
454,416
454,417
Problem to Type casting
<p>I am using Bonita Api <a href="http://www.bonitasoft.org/docs/javadoc/bpm_engine/5.2/" rel="nofollow">Java docs(Bonita Api)</a> to get the instanceUUID of process and get the instanceUUID of type ProcessInstanceUUID.using getValue(), i am convert the object value in string and send another java class where i want to typecast String into ProcessInstanceUUID class object type.</p> <p>it is possible,if possible please give me some idea to solve this problem.</p> <pre><code>ProcessInstanceUUID instanceUUID = this.getProcessInstanceUUID(); instanceUUIDValue = instanceUUID.getValue(); </code></pre> <p>Thanks</p>
java
[1]
4,158,301
4,158,302
colors that apple supports for rounded buttons
<p>can anyone suggest the background colors that apple support for rounded buttons..Is there any guidelines for this?</p>
iphone
[8]
5,746,784
5,746,785
Google Map Traffic Overlay on Android Device
<p>I am currently doing an android project that shows live traffic congestion report. I am a newbie in Android Dev. I successfully deplayed Google map on my emulator. I also did some overlay control. I would like to do something like Google did, highlight the road with red (congested), orange (moving slowly) and green (moving swiftly) on the road to show traffic. Any references or any idea on how to add those in Google map? Any help would be appreciated =)</p>
android
[4]
4,610,504
4,610,505
Why wouldn't Android applications compile from source?
<p>I am trying to compile the default projects that come with Android; however, it doesn't seem to be working at all. Most of the classes and libs seem to be missing.</p>
android
[4]
1,917,775
1,917,776
Change value in php
<pre><code>// $tags can be a string with comma separated values, such as: // $tags = 'first, second, third'; </code></pre> <p>How can i add a tag to this php code through a form. I want to enter a value in the form and then it will be added to the <code>$tags</code> then it has to redirect me to another page?</p>
php
[2]
179,623
179,624
Java-check if control key is being pressed
<p>I have a Java function in which I want to test if the control key is being held down. How can I do that?</p> <p>Edit: I am using swing for gui.</p>
java
[1]
4,965,498
4,965,499
PHP if statement null
<p>I have this <code>if</code> statement in my controller:</p> <pre><code>if($parent == $page-&gt;parent) </code></pre> <p>Where <code>$parent == null</code> sometimes, when <code>$parent</code> is for example <code>16</code> it executes my if statement but only when its null it doesn't execute it what am I doing wrong?</p> <p>Here's my controller:</p> <pre><code>public function updateMenu($id) { $page = Page::find($id); $parent = Input::get('parent'); $new_order = Input::get('index'); if($parent == $page-&gt;parent) { if($page-&gt;order_id &gt; $new_order) { DB::table('pages') -&gt;where('parent',$parent) -&gt;where('order_id', '&lt;', $page-&gt;order_id) -&gt;increment('order_id'); } else { DB::table('pages') -&gt;where('parent',$parent) -&gt;where('order_id', '&gt;=', $page-&gt;order_id) -&gt;decrement('order_id'); } } else { DB::table('pages') -&gt;where('parent',$page-&gt;parent) -&gt;where('order_id', '&gt;', $page-&gt;order_id) -&gt;decrement('order_id'); } $page-&gt;order_id = Input::get('index'); $page-&gt;parent = Input::get('parent'); $page-&gt;save(); return $id; } </code></pre> <p>I'm making a sortable list, can anyone see a problem?</p>
php
[2]
4,260,304
4,260,305
How do I display the contents of a Linked List in Java?
<p>I created a linked list class and added a bunch of values in it. But I don't know how to display those values. </p> <p>I tried doing the following:</p> <pre><code>System.out.println(list); </code></pre> <p>But it printed out some weird values like ADTList@(followed by some jibberish).</p> <p>Thanks.</p>
java
[1]
4,708,597
4,708,598
jquery table row selector based on user input
<p>How do I select rows depending on what's in an input box? Here's what I have so far:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script src="http://www.google.com/jsapi"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; google.load("jquery", "1"); &lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $('#btnFilter').keyup(function() { var myInput = $(this).val(); $('tbody tr').hide(); // I need to .show() all table rows that have a table cell with a value that begins with the input field. $('tr').something goes here.show(); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form&gt; &lt;input id="btnFilter" name="btnFilter"&gt; &lt;/form&gt; &lt;table&gt; &lt;thead&gt; &lt;tr&gt; &lt;th&gt;Heading 1&lt;/th&gt; &lt;th&gt;Heading 2&lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;A&lt;/td&gt; &lt;td&gt;X&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;ABC&lt;/td&gt; &lt;td&gt;D&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
jquery
[5]
4,668,970
4,668,971
Find line which contains given word and return substring
<p>I have file with lines which look like <strong>word_1:word_2</strong> (for example file looks like </p> <pre><code>username:test password:test_pass dir:root </code></pre> <p>)</p> <p>. How to find from file word_2 when I have word_1 ? Is there in PHP contains and substring like in Java ?</p>
php
[2]
5,181,542
5,181,543
aspnet Membership Database to store extra employee attributes
<p>I'm using aspnet memberhips database for authorization and authentication for my azure web application.</p> <p>This aspnet application contains the employees details. All good until we got new requirment. The new requirement is to in include lots of extra attributes related to employees such as awardcode, costcentre, division, location etc...</p> <p>The requirement is also to admin these details via Admin portal. </p> <p>Is there any way we can fit the above requirement with in aspnet database? Should I add extra tables and fields or there's a better way of acheving this.</p> <p>Thank you.</p>
asp.net
[9]
788,773
788,774
how to change function name of a anchor tag with a span using jquery
<p>I have the following code:</p> <pre><code>&lt;span class="action_bar" id="dupquickaddchildassetbutton'+'_'+nodeid+'_'+'-1'+'" style="background-color: rgb(226, 225, 225); font-size: 10pt; font-weight: 700; visibility: hidden;"&gt; &lt;a href="javascript:void(0)" onclick="editchildassetquickmode('+nodeid+',1,-1);"&gt; &lt;img src="/images/chain-symbol-add.jpg" title="Quick connect child node" border="0" width="16"&gt; &lt;/a&gt; &lt;/span&gt; </code></pre> <p>now I want to change the parameter in this function -1 to actual group id. so, how do I select that anchor tag and change that value in parameter?</p>
jquery
[5]
5,277,995
5,277,996
if spinner changed
<p>i want execute populateFields if the spinner changed but i don't know how i can do it. i need anything like a onclicklistener or else</p> <p>java:</p> <hr> <pre><code> private String abfrage; on create: Spinner spinner = (Spinner) findViewById(R.id.spinnerStd); ArrayAdapter&lt;CharSequence&gt; adapter = ArrayAdapter.createFromResource( this, R.array.spinnerZeitauswahl, android.R.layout.simple_spinner_item); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); abfrage = spinner.getSelectedItem().toString(); populateFields(); populateFields: int j = 10; for(int i = 0; i &lt; 5; i ++) { if(abfrage.equals(arr[i]))//works mFehlzeitText.setText(String.valueOf(j)); j+=10; } </code></pre>
android
[4]
4,727,701
4,727,702
conversation with computer
<p>I have done an aplication in java and I have used java applet.but it doesn't run with the all 'if conditions' here is the aplication.</p> <pre><code>import java.awt.*; import java.awt.event.*; import javax.swing.*; public class BashkebisedimGjeografik extends JApplet implements ActionListener { JLabel question = new JLabel("Cili eshte kryeqyteti i :"); JTextField country = new JTextField ("",15); JButton button1 = new JButton ("Kthe pergjigje!"); JLabel result = new JLabel(""); public void init() { Container contentArea = getContentPane(); FlowLayout layout = new FlowLayout(FlowLayout.LEFT); contentArea.setLayout(layout); contentArea.add(question); contentArea.add(country); contentArea.add(button1); button1.addActionListener(this); contentArea.add(result); country.requestFocus(); setContentPane(contentArea); } public void actionPerformed(ActionEvent e) { Font bigFont = new Font("Arial",Font.ITALIC,24); if (country.getText().equalsIgnoreCase("Albania")) result.setText("Tirana"); if (country.getText().equalsIgnoreCase("Turkey")) { rezultati.setText("Ankara"); } else result.setText("Try again"); } } </code></pre>
java
[1]
2,577,552
2,577,553
Why is the copy constructor of the string used?
<p>I have the following code:</p> <pre><code>class TestClass { public: TestClass(){}; std::string GetTestString() { return (mTestString); } void SetTestString(const std::string&amp; rTestString) { mTestString = rTestString; } private: std::string mTestString; }; TestClass* pGlobalVar; void SomeFunction(TestClass MyClass) { pGlobalVar-&gt;SetTestString("cba"); std::cout &lt;&lt; "Changed string: " &lt;&lt; pGlobalVar-&gt;GetTestString() &lt;&lt; std::endl; std::cout &lt;&lt; "Copied string: " &lt;&lt; MyClass.GetTestString() &lt;&lt; std::endl; } int main() { pGlobalVar = new TestClass(); pGlobalVar-&gt;SetTestString("abc"); std::cout &lt;&lt; "Original string: " &lt;&lt; pGlobalVar-&gt;GetTestString() &lt;&lt; std::endl; SomeFunction(*pGlobalVar); delete (pGlobalVar); } </code></pre> <p>This outputs the following:</p> <pre>Original string: abc Changed string: cba Copied string: abc </pre> <p>As I did not define a copy constructor for my class, I would expect that a flat copy would be made, including the pointer in the <code>std::string</code>. Apparently though the <code>std::string</code> copy constructor is used, since a change to the original string did not change the copy. </p> <p>Can anyone explain to me why it did not make flat copy?</p> <p>I'm using Linux with GCC 4.4.6.</p>
c++
[6]
2,414,214
2,414,215
Defining the Log source in Enterprise library logging block
<p>How can i convert the below piece of code to Enterprise Library Logging block</p> <pre><code>EventLog log = new EventLog(); log.Source = "CTA Repository"; log.WriteEntry("Test Event", EventLogEntryType.Error); </code></pre> <p>basicaly i am not aware how to give the source "CTA Repository" in Logger.write(....)</p>
c#
[0]
3,953,383
3,953,384
What is assignment via curly braces called? and can it be controlled?
<p>What is this called?</p> <pre><code>Vec3 foo = {1,2,3}; </code></pre> <p>Can it be controlled via an operator or some such? As in can I specify how this should act?</p> <p>For instance if I had some complicated class could I use this to assign variables? (Just an exercise in curiosity).</p>
c++
[6]
304,719
304,720
Notice: Undefined index: message
<p>Notice: Undefined index: message in C:\xampp\htdocs\mywebsite\Untitled9.php on line 27</p> <pre><code> &lt;?php session_start(); if ($_GET['message'] == "success" &amp;&amp; $_SESSION['revisit'] == "0") { $_SESSION['revisit'] = "1"; ?&gt; &lt;script type="text/javascript"&gt;window.alert('Message successfully posted.');&lt;/script&gt; &lt;?php } ?&gt; </code></pre> <p>Line 27 is....</p> <pre><code>if ($_GET['message'] == "success" &amp;&amp; $_SESSION['revisit'] == "0") { </code></pre> <p>How do i fix this?</p>
php
[2]
1,367,319
1,367,320
pass two dimensional array to a method C++
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/4810664/how-do-i-use-arrays-in-c">How do I use arrays in C++?</a> </p> </blockquote> <p>I am not sure if how to do this in C++:</p> <pre><code>main() { float array[5][4]; transpose(array); } void transpose(float** array); </code></pre> <p>=> I got some some compilation error: <code>vector&lt;KeypointMatch, std::allocator&lt;KeypointMatch&gt; &gt;</code></p> <p>How can I pass the variable of two dimensional array to a method in C++?</p> <p>Thanks in advance.</p>
c++
[6]
3,115,987
3,115,988
Using Regular Expression in Php in case of checking phone number
<p>I have a variable which has to allow only numbers , dashes and parenthesis, there is no particular length for phone number , And the validation must be done in php , no javascript allowed, </p> <p><strong>EDIT</strong> Just wanted to allow spaces too to the regular expressions....</p> <p>Thanks </p>
php
[2]
4,135,246
4,135,247
Javascript: BitAnd function in javascript
<p>I was wondering if we have BitAnd operation in javascript?Do we have one?Just like in oracle.I tried to find in google ,I couldn`t find.Please suggest if better function we have for that.</p>
javascript
[3]
5,993,323
5,993,324
if option in select has class then add class
<p>is there a way to do: <strong>if options have class 1 and 2 then add class A</strong> in jQuery?</p> <p>So this : </p> <pre><code>&lt;select class="rubrique" name="ctl00"&gt; &lt;option class="" value="" selected="selected"&gt;&lt;/option&gt; &lt;option class="1" value="1"&gt;1&lt;/option&gt; &lt;option class="2" value="2"&gt;2&lt;/option&gt; &lt;/select&gt; </code></pre> <p>would give me that:</p> <pre><code> &lt;select class="rubrique" name="ctl00"&gt; &lt;option class="" value="" selected="selected"&gt;&lt;/option&gt; &lt;option class="1 A" value="1"&gt;1&lt;/option&gt; &lt;option class="2 A" value="2"&gt;2&lt;/option&gt; &lt;/select&gt; </code></pre>
jquery
[5]
3,808,491
3,808,492
Invite suggestions and guidelines for Load balancing of asp .net application
<p>I have an ASP .NET 2.0 web application which is a online survey system. At times it has huge number of users and the application go slow.</p> <p>I wanted to do load balancing for the web application which runs in a single server now.</p> <p>Will anyone suggest me...</p> <ol> <li>In what all scenarios i should consider load balancing to my application?</li> <li>what type of applications need load balancing?</li> <li>what is the pros and cons of load balancing?</li> <li>what is the guidelines for devoloping applications which targets load balancing,</li> <li>At max how many number of concurrent users can access web application without load balancing without affecting performance much?</li> </ol> <p>In my case application is already devoloped. What all the areas i should make changes to prepare it for load balancing?</p> <p>Thanks in advance.</p>
asp.net
[9]
1,023,093
1,023,094
How to turn newlines in a file to lines extending to end of line?
<p>I am copying <a href="http://stackoverflow.com/questions/7633485/insert-string-at-the-beginning-of-each-line/7633962#7633962">this answer</a> like this</p> <pre><code>for line in fileinput.input(['my_file'], inplace=True): sys.stdout.write('_____ {l}'.format(l=line)) </code></pre> <p>to add four underlines to beginning of line. This turns <code>my_file</code> into a checklist. But the above code prints the underlines on the blank lines too. I want to change the blank lines to full length lines. How do I do that? So if the original lines are like this</p> <pre><code>abc def ghi </code></pre> <p>the checklist will look like</p> <pre><code>___ abc _________________________________________________ ___ def _________________________________________________ ___ ghi _________________________________________________ </code></pre> <hr> <p>Thanks!</p>
python
[7]
4,694,626
4,694,627
What is wrong with this line?
<p>I'm getting a </p> <pre><code>Breaking on JScript runtime error - Unknown runtime error </code></pre> <p>on this line:</p> <pre><code>c.innerHTML= '&lt;a name="a1" class="b" href="' + d[2].value + '"&gt;' + d[1].value + '&lt;/a&gt;'; </code></pre>
javascript
[3]
1,550,038
1,550,039
how can i get $(document).height() NEW value when new data has been added?
<p>Lets suppose that <strong>$(document).height()</strong> is 1000. Then i insert a new div at the bottom of the page with height=100. The <strong>$(document).height()</strong> should be 1100 but it keeps throwing 1000 to me.</p> <p>How can i get the new $(document).height() dynamically?</p> <p>Thank!</p>
jquery
[5]
1,910,439
1,910,440
Windows Service acts two different way based on the machine
<p>I wrote a windows service ,that will my class library every 15 mins interval to execute the class.</p> <p>It works fine when i deployed the windows service in my machine,the timer works well and every 15 mins it calls my class library but when i deployed in my server,it works fine only on onstart after that its not raise the timer or every 15 mins suppose to call my class lib are not happening,some one please guide me what suppose to look here to identify the problem</p> <p>here is my code</p> <pre><code> public partial class Service1 : ServiceBase { private Timer _timer; private DateTime _lastRun = DateTime.Now; public Service1() { InitializeComponent(); } protected override void OnStart(string[] args) { log4net.Config.XmlConfigurator.Configure(); _timer = new Timer(10 * 60 * 1000); // every 10 minutes _timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed); Shell Distribute= new Shell(); Distribute.Distribute(); _timer.start();//this line was missed in my original code } protected override void OnStop() { this.ExitCode = 0; base.OnStop(); } private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { //if (_lastRun.Date &lt; DateTime.Now.Date) //{ try { _timer.Stop(); Shell Distribute= new Shell(); Distribute.Distribute(); } catch(exception ex) {} finally { _timer.Start(); } //} } } } </code></pre> <p>I strongly believe log on issues but am not sure for two reasons,if i start or restart this service in my test server using the same account works well but only timer is not working. The code is exactly same so i don't worry much about my code bcoz it work timer based in my local machine using the same account. Thanks in Advance.</p>
c#
[0]
1,560,894
1,560,895
error in running recursion
<p>if running function returns server misconfiguration error</p> <pre><code> function build_path($cid) { $result = array(); $DB = new MySQLTable; $DB-&gt;TblName = 'shop_categories'; $where['cat_id']['='] = $DB-&gt;CleanQuest($cid); $res = $DB-&gt;Select('cat_id,cat_name,cat_parent', $where); if($res !== 'false') { $pid = mysql_fetch_array($res); if($pid['cat_parent'] !== 0) { Echo $pid['cat_parent']; build_path($pid['cat_parent']); } else { Echo $pid['cat_id']; return true; } } return false; } </code></pre> <p>I can't find an error here. Please help.</p> <p>Sorry for disturbing you all. The trouble was in comparison 'if($pid['cat_parent'] !== 0)': $pid['cat_parent'] was a string with int(0)</p> <p>Can i build this function to store full path without using GLOBALS and SESSION vars?</p>
php
[2]
38,822
38,823
How can I create button which clears an EditText?
<p>How can I create a button which resets/deletes all text in an <code>EditText</code>.</p> <p>This is some code I've written:</p> <pre><code>private View.OnClickListener onRes =new View.OnClickListener(){ public void onClick(View v) { // TODO Auto-generated method stub // Here i wanna put some code to clear the EditText } }; </code></pre> <p>I don't have any idea how to do that.</p>
android
[4]
2,419,318
2,419,319
Configuring Asp.NET Application in subfolder - Without IIS config
<p>I have a free hosting account, and two ASP.NET project.<br/> <br/> I want to upload both apps in my hosting, like:<br/> <code>www.hosting.com/myaccount/project1/</code><br/> <code>www.hosting.com/myaccount/project2/</code><br/> <br/> But the problem is when I run project1 or project2<br/> Asp.net considers <code>application main path ("~")</code> as root <code>www.hosting.com/myaccount/</code><br/> Si I cant load dll, App_themes, and Other.<br/> What can I do to stop that strange behvior!<br/> <br/> I cant configure IIS because I am using free hosting. I applied this <a href="http://stackoverflow.com/questions/1516041/run-an-asp-net-website-in-a-subfolder/2739203#2739203">answer</a> and no thing happened. <br/><br/> Thank you for hepling.</p>
asp.net
[9]
427,807
427,808
Load js from external site on fly
<p>I want to load JS code from external site when user click on button. For example:</p> <pre><code> &lt;button onclick="LoadJSFromURL('facebook.com/blablabla')" /&gt; </code></pre> <p>and when user press button we attach new script to the document:</p> <pre><code>&lt;script&gt; Share.WorkUrl="http://MySite.com"; Share.UserId=5 &lt;/script&gt; &lt;script src="http://Facebookcom/blabalbal" &gt;&lt;/script&gt; </code></pre> <p>and then we must execute this script. Is it real?</p>
javascript
[3]
1,286,734
1,286,735
Display Applications that can handle a particular filetype
<p>So, I have the file path of a file in an application &amp; I want to give the user the ability to select from all applications on the phone that can handle/open that file type and then open the file in that applicaton. How do I do this? - performs a similar function to a file manager.</p>
android
[4]
2,113,401
2,113,402
How to get first 2 lines or 200 characters from <p> using jQuery
<p>I have a paragraph with about 10 lines . I want to display the read more button after 2 lines.</p> <p>How can I get the first two lines of some characters using jQuery?</p> <p>Is there any function like </p> <p><code>$('p').get(2lines);</code></p>
jquery
[5]
2,011,845
2,011,846
how can i extern a variable for a namespace in c#?
<p>i want to declare a global linked list for a namespace in c#. i tried to extern the linked list but do not know the correct syntax. can any one tell me how to extern variables?</p>
c#
[0]
4,962,628
4,962,629
get the data from the webservice IOException
<p>`the next code should pars data from the baseurl(web service) to textView <strong>Problem:</strong> *<em>it gives IOException .. I'm sure from the webservice but the program still gives error any one help to get the data from the webservice??</em>*</p> <pre><code>public class NewParsActivity extends Activity { /** Called when the activity is first created. */ static final String baseUrl="http://www.androidpeople.com/wp-content/uploads/2010/06/example.xml"; TextView tv; EditText ed,ed2; Button b; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); tv=(TextView)findViewById(R.id.text); ed=(EditText)findViewById(R.id.edt); b=(Button) findViewById(R.id.button1); ed2=(EditText) findViewById(R.id.editText1); try{ SAXParserFactory spf=SAXParserFactory.newInstance(); SAXParser sp=spf.newSAXParser(); XMLReader xr=sp.getXMLReader(); URL link=new URL(baseUrl); handlXml doingWork=new handlXml(); xr.setContentHandler(doingWork); xr.parse(new InputSource(link.openStream())); String information=doingWork.getInformation(); tv.setText(information); }catch(Exception e){ tv.setText("Error"); } // public class handlXml extends DefaultHandler { One item=new One(); public String getInformation(){ return item.DataToString(); } @Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { // TODO Auto-generated method stub if(localName.equals("website")){ String uniN=attributes.getValue("category"); item.setName(uniN); } } } // &lt;i&gt; public class One { String UName; public void setName(String n){ UName=n; } public String DataToString() { return "In"+UName; } } &lt;i&gt; </code></pre>
android
[4]
2,846,749
2,846,750
I have a problem with the following Java code
<pre><code>public class b { public static void main(String[] args) { byte b = 1; long l = 127; // b = b + l; // 1 if I try this then it does not compile b += l; // 2 if I try this then it does compile System.out.println(b); } } </code></pre> <p>I am using this code but I have problem: I don't understand why <code>b=b+l;</code> is not compiling but if I write <code>b+=l;</code> then it compiles and runs.</p> <p>Please explain why this happens.</p>
java
[1]
2,276,841
2,276,842
What does "return this" do within a javascript function?
<p>i wonder, what does "return this" do within a javascript function, what's its purpose? supposing we have the following code:</p> <pre><code>Function.prototype.method = function (name, func) { this.prototype[name] = func; return this; }; </code></pre> <p>What does "return this" do inside of a function?</p> <p>I know what code above does, and what is the use of "this" keyword. I just don't know what "return this" does inside of a function.</p>
javascript
[3]
3,320,702
3,320,703
Javascript running code once
<p>I only want my JavaScript to run once, <strong>but</strong> I cannot control how many times the javascript file is executed. Basically I'm writing a tiny JS snippet into a CMS, and the CMS is actually calling it 5-10 times. So solutions like this: </p> <pre><code>function never_called_again(args) { // do some stuff never_called_again = function (new_args) { // do nothing } } never_called_again(); </code></pre> <p>Don't seem to work because as soon as my snippet is run again from the top the function is re-declared, and 'do some stuff' is re-evaluated. Perhaps I'm just not doing it properly, I'm not great with JS. I'm considering using something like try-catch on a global variable, something like </p> <pre><code>if (code_happened == undefined) { \\ run code code_happened = true; } </code></pre> <p>EDIT: There is a consistent state e.g. if I set a variable I can see when my snippet is run again. But having to declare it before I access it, I don't know how to say 'does this variable exist yet'</p>
javascript
[3]
3,308,105
3,308,106
Referencing Attributes
<p>Supposing I have this code </p> <pre><code>public class Class1 { List&lt;Class2&gt; myClass2List = new List&lt;Class2&gt;; public Class1() { } } public class Class1List : List { } public class Class2 { public Class2() { }; //Class2 objects will sit in a list that is an attribute of a Class1 object // class1 objects will be in a list that is an attribute of a Class3 object // is it possible for this method to access the list in the Class3 object // without passing the list as a parameter. public void myClass2Method(){ } } public class Class3 { Class1List myList = new Class1List(); public Class3(){ } static void Main() { Class3 myClass3Var = new Class3(); // do something to fill myList; // added some code to maybe make it a bit less muddy foreach (Class1 c1 in this.Class1List){ foreach (class2 c2 in c1.myClass2List{ // here is where I want to reference the Class1List attribute of the /// Class3 object - do I need to pass the list as a paramter? c2.MyClass2Method(); } } } } </code></pre> <p>Now supposing I have an instance of Class2 in myList in the instance of Class3. Is it possible for the Class2 method myClass2Method() to access myList wouthout passing the list as a parameter?</p>
c#
[0]
5,052,705
5,052,706
Why does [5,6,8,7][1,2] = 8 in Javascript
<p>I can't wrap my mind around this quirk.</p> <pre><code>[1,2,3,4,5,6][1,2,3]; // 4 [1,2,3,4,5,6][1,2]; // 3 </code></pre> <p>I know <code>[1,2,3] + [1,2] = 1,2,31,2</code>, but I can't find what type or operation is being performed.</p>
javascript
[3]
5,998,854
5,998,855
stop choose image if last image case selected
<p>I pressed the button "background1" "background 4.jpg" viewed... push the button again (background1) returning to background 1.jpg I want to stop, background 4.jpg. (not return background 4.jpg to background 1.jpg)</p> <pre><code>- (IBAction)background1 { x++; if (x&gt;3) x=0; [self updateImage]; } -(IBAction)background2 { x--; if (x&lt;0) x=3; [self updateImage]; } - (void)updateImage { switch(x) { case 0: [bg setImage:[UIImage imageNamed:@"background 1.png"]]; break; case 1: [bg setImage:[UIImage imageNamed:@"background 2.jpg"]]; break; case 2: [bg setImage:[UIImage imageNamed:@"background 3.jpg"]]; break; case 3: [bg setImage:[UIImage imageNamed:@"background 4.jpg"]]; break; } } </code></pre>
iphone
[8]
2,314,618
2,314,619
How do we find a biggest white rectangle in a n x n bitmap ?
<p>Any idea on how to solve such problems (in C++)- like which is the best Algorithm to use.</p>
c++
[6]
481,790
481,791
iPhone SDK UI element preview
<p>Looking for some catalog/gallery(not UICatalog, just images), where I can see preview of each UI element in iPhone SDK, along with corresponding class name(eg datetime picker, calendar, the black switch bar on bottom). This will give me rough idea on which UI elements I can use in my app and go read about corresponding class.</p>
iphone
[8]
405,057
405,058
How fast c++ file is fulfilled?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/673523/how-to-measure-execution-time-of-command-in-windows-command-line">How to measure execution time of command in windows command line?</a> </p> </blockquote> <p>is there a program which counts how fast .exe file is fulfilled? For example, if I must write c++ that takes one number from input file, multiply it with 2 and outputs in output file. And if I start c++ program, I can't tell how fast it is completed, cause for me it seems like 0.1 sec - blinking window. So is there any chance telling exactly time of it?</p>
c++
[6]
1,811,148
1,811,149
self.title vs self.navigationItem.title
<p>What is the purpose of the <code>title</code> property of UIViewController, can't the title already be set with <code>navigationItem.title</code> ?</p> <p>Both seem to work, I'm just wondering why there's this seemingly duplicated functionality.</p>
iphone
[8]
1,354,755
1,354,756
Is there a way to redirect a browser to a file on the local network?
<p>I'm wondering if it's possible to redirect to a URL like:</p> <pre><code>\\central\public\blah\test.html </code></pre> <p>in PHP? We want to put a link on the website for employees to quickly access tools that have to be kept on the local network for security reasons. Basically the link would only work if you were in the office.</p> <p>I've tried using:</p> <pre><code>header("location: \\central\public\blah\test.html"); </code></pre> <p>but it just formats the URL to http://</p>
php
[2]
4,704,715
4,704,716
Launch Android application from browser
<p>I have a little problem.</p> <p>I have an Android Activity, and I want to run it from one link on the browser.</p> <p>This is what how I have declared my Activity on the Manifest file:</p> <pre><code>&lt;activity android:name=".Wul4" android:windowSoftInputMode="adjustPan" android:configChanges="keyboardHidden|orientation" android:launchMode="singleInstance" android:label="@string/app_name"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.VIEW" /&gt; &lt;category android:name="android.intent.category.BROWSABLE" /&gt; &lt;data android:scheme="wul4" android:host="com.wul4.wul4"/&gt; &lt;category android:name="android.intent.category.DEFAULT"/&gt; &lt;/intent-filter&gt; &lt;/activity&gt; </code></pre> <p>On the webApp, the link to launch the application is the following one:</p> <pre><code>wul4://com.wul4.wul4?codOperacion="+respuestaActual.idOperacion </code></pre> <p>The point is that It is working from the following browsers: "Opera" and "Google Chrome", but it is not working for the rest..........(for instance, it is not working on the default browser of the phone).</p> <p>Anyone knows why??? </p> <p>Thanks a lot!</p>
android
[4]
3,824,085
3,824,086
I cant browse php pages in my local server
<p>I cant browse php pages in my local server.Before it was working fine. But now i cant browse php pages, i can browse html pages and asp pages , no problems with that.</p> <p>But when i try to browse a php page its not loading.</p> <p>What will be the problem??</p> <p>I am using windows 2000 advanced server and my web server is Tomcat</p> <p>please someone help me</p> <p>Guys i'm not getting anything in my browser, its just continue to loading</p> <p>Nothing showing in that page</p> <p>i'm not getting any 404 error or anything like that. its just continue to be loading</p> <p>for example consider my file is located under insider a folder named as myproject</p> <p>i can reach upto this</p> <p><a href="http://localhost/projects/myproject" rel="nofollow">http://localhost/projects/myproject</a></p> <p>but after that i cant browse php pages inside that...</p> <p><a href="http://localhost/projects/myproject/index.php" rel="nofollow">http://localhost/projects/myproject/index.php</a></p> <p>this will continue to be loading, and nothing shows in that page</p>
php
[2]
4,976,071
4,976,072
How to upload image into sqlite db in android and view it?
<p>I am a beginner in android development. And I want to make a photo sharing application so that once the application is installed on the android device the user can upload his/her image. I have seen a lot of examples but nothing works for me. Please help I am newbie.</p>
android
[4]
2,606,791
2,606,792
Booting Android into web browser
<p>Does anybody know how to boot Android into web browser directly? Kind of like autostart browser but the ultimate solution is to not have any desktop just browser. Thanks!</p>
android
[4]
3,033,606
3,033,607
How to make variable size string for sprintf
<p>I want to make variable size string "msg" like this.</p> <pre><code>char *msg; sprintf(msg,"Msg",variable) </code></pre> <p>i dont want to use string . What would be the best solution </p>
c++
[6]
1,052,684
1,052,685
Reparent a view in Android - move from one layout to another
<p>I'm coming from iOS where I can simply reparent a view under another view. I'm trying to figure out the equiv in Android. I want to move an imageview up a couple of spots in the view hierarchy when clicked. Something like:</p> <pre><code>public boolean onTouchEvent(MotionEvent event) { int action = event.getAction(); //Tile touchBegan if(action == MotionEvent.ACTION_DOWN) { RelativeLayout rl = (RelativeLayout)(getParent().getParent()); rl.addView(this); } } </code></pre> <p>This is a simplified example of course.. but just trying to figure out how to re-parent a view under another layout. I found this example searching around which seems incredibly complicated.. </p> <p><a href="http://blahti.wordpress.com/2011/02/10/moving-views-part-3/" rel="nofollow">http://blahti.wordpress.com/2011/02/10/moving-views-part-3/</a></p>
android
[4]
5,700,249
5,700,250
inserting unique date into txt document
<p>I'm trying this script to insert only a unique date into a text file, but it isn't working properly:</p> <pre><code>$log_file_name = "logfile.txt"; $log_file_path = "log_files/$id/$log_file_name"; if(file_exists($log_file_path)){ $not = "not"; $todaydate = date('d,m,Y'); $today = "$todaydate;"; $strlength = strlen($today); $file_contents = file_get_contents($log_file_path); $file_contents_arry = explode(";",$file_contents); if(!in_array($todaytodaydate,$file_contents_arry)){ $append = fopen($log_file_path, 'a'); $write = fwrite($append,$today); //writes our string to our file. $close = fclose($append); //closes our file } else { $append = fopen($log_file_path, 'a'); $write = fwrite($append,$not); //writes our string to our file. $close = fclose($append); //closes our file } } else{ mkdir("log_files/$id", 0700); $todaydate = date('d,m,Y'); $today = "$todaydate;"; $strlength = strlen($today); $create = fopen($log_file_path, "w"); $write = fwrite($create, $today, $strlength); //writes our string to our file. $close = fclose($create); //closes our file } </code></pre> <p>The problem is with the if else statement where it should be written if it's already in the array.</p>
php
[2]
689,387
689,388
Network is not working on Android emulator
<p>Emulator was working fine. It's connected through proxy server. But suddenly now it's not working. It is saying tcp_error. I thought that it is dns problem. but same error. I am using "emulator.exe -avd MY_AVD -http-proxy http://<em>.</em>.*.*:8080 -dns-server <em>.</em>.*.*". I am being stucked, not getting any solution. Any help will be appreciate.</p>
android
[4]
2,537,957
2,537,958
change the background color
<p>hi this code expalins to the dynamcically add and deletind the rows, if i select the row ,it sholud be change this background color can please help me thanks</p> <p> Dynamic Creation </p> <pre><code>$(document).ready(function() { $("&lt;table class='table1' border='1'&gt;&lt;/table&gt;").appendTo(".div1"); $(".add").click(function() { addRows(); }); $(".delete").click(function() { deleteRows(); }); function addRows() { $tab = $(".table1"); $("&lt;tr class='raja'&gt;&lt;td&gt;rajasekhar&lt;/td&gt;&lt;td&gt;hostanalytics&lt;/td&gt;&lt;/tr&gt;").appendTo($tab); $(".raja").click(function() { $tab.removeClass("selected"); $(this).addClass("selected"); }); } function deleteRows() { $(".selected").remove(); } }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="div1"&gt; &lt;/div&gt; &lt;input type="button" class="add" value="InsertRow" /&gt; &lt;input type="button" class="delete" value="DeleteRow" /&gt; &lt;/body&gt; </code></pre> <p></p>
jquery
[5]
3,934,125
3,934,126
Is there a way to override the lock pattern screen?
<p>I want to provide my own version of password mechanism. Is this possible?</p>
android
[4]
428,011
428,012
Removing text after string
<p>Here is my link</p> <pre><code>&lt;img src='http://www.mysite.org/images/post_images/2400.jpg' /&gt;&lt;div&gt;© Ham Sammich&lt;/div&gt;&lt;/div&gt; </code></pre> <p>I want to remove the text after the <code>/&gt;</code> thus making the link..</p> <pre><code>&lt;img src='http://www.mysite.org/images/post_images/2400.jpg' /&gt; </code></pre> <p>I've tried using the strstr function on the end, but my vps does not have the option of going to 5.3 thus making that not a go.</p> <p>Here is my code, which does not work because of 5.3 not being on there..</p> <pre><code>$imgTwo = strstr($img, "&gt;", 1); $img = $imgTwo . "&gt;"; </code></pre> <p>Whats a good substitute for getting this done the way I want?</p>
php
[2]
4,855,577
4,855,578
Disable listview overscroll on Samsung Galaxy Tab 2.3.3 android
<p>I need to totally disable overscroll in my listviews so I can implement my own overscroll functionality.</p> <p>Seems to be simple enough when looking at the core listview classes, just by setting the <code>overscroll</code> mode to OVERSCROLL_NEVER. This fine work on my Samsung Galaxy s2. But doesn't work For <code>Galaxy Tab 2.3.3.</code></p> <p>Has anyone had much experience with samsung ListView customizations that can help me?</p>
android
[4]
2,042,936
2,042,937
php print Issue
<p>I'm trying to get the lines of code below to help me write "<code>&lt;?php include('like.php'); ?&gt;</code>" on a page only when the visitor isn't using a a mobile device but it doesn't seem to be working. I can't tell what I'm doing wrong.</p> <pre><code>&lt;?php if (screen &gt; 699) print('like.php'); ?&gt; </code></pre>
php
[2]
36,050
36,051
selector using variable
<p>Usually when I want to check if any child element inside a parent element was clicked I use something like this:</p> <pre><code>$(document).click(function (e) { alert($(e.target).is("#somediv *")); } </code></pre> <p>But now I have the <code>somediv</code> in a variable. I have tried:</p> <pre><code>var somediv = $(this); $(document).click(function (e) { alert($(e.target).is($(somediv, "*"))); } </code></pre> <p>But it doesn't work. How can I do that? Is it the best way to detect if a element or any child element was clicked?</p>
jquery
[5]
827,572
827,573
upload data from excel to sharepoint list using jquery
<p>I want to upload data from a excel to a sharepoint list. The structure of the excel and the list are same.</p> <p>The user will enter the data in the excel and then give the path of the file in the input box present in the page. Now instead of uploading the whole excel file into a document library the code will read the file and update the list with the data present in the excel file. I am using JQuery in my page.</p>
jquery
[5]
4,106,113
4,106,114
webview.loadData() doesn't fire js alert()s
<p>I've got a webview that loads a local html file with some javascript. The problem I'm having is that I'm not getting any alert()s. I've tried several workarounds like using the WebChromeClient, and attaching a JavascriptInterface with addJavascriptInterface() but I still don't get any alert()s.</p> <p>Is this something that is disabled by design?</p> <p>Here's some code...</p> <pre><code> public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.web); WebView wv=(WebView)findViewById(R.id.web1); wv.getSettings().setJavaScriptEnabled(true); wv.setWebChromeClient(new WebChromeClient() { @Override public boolean onJsAlert(WebView view, String url, String message, JsResult result) { //Required functionality here super.onJsAlert(view, url, message, result); Toast.makeText(DirectionsActivity.this, message, Toast.LENGTH_SHORT).show(); return true; } }); String s = readAssetFile("test.htm");//&lt;--contains js wv.loadUrl(s,"text/html",null); } </code></pre>
android
[4]
6,025,554
6,025,555
$_get and session. Can't get it to work
<p>Can anyone tell me why this doesn't work?</p> <pre><code>&lt;?php $lang = $_get["lang"]; if (($lang == "fr")) { session_destroy(); session_start(); $_SESSION['lang'] == "fr"; } if (($lang == "en")) { session_destroy(); session_start(); $_SESSION['lang'] == "en"; } if (isset($_SESSION['lang'])) { $lang = $_SESSION['lang']; } else { $lang = "fr"; } ?&gt; </code></pre> <p>I just can't seem to get it to work and I tried a lot of different things. Just need a direction to the mistake.</p> <p>It's running on PHP5 on an Apache server if that's any help.</p> <p>Even without the session I can't even get the $_get to work. With normally is never the case.</p>
php
[2]
2,563,089
2,563,090
How to display a .doc or .docs file's content into a html page using php?
<p>I need to display a .doc or .docx file using php.</p>
php
[2]
2,597,239
2,597,240
Is there an data type that acts both as a list and a dictionary?
<p>Normally when I need to have a list of ints/strings/etc. I create a list like:</p> <pre><code>var list = new List&lt;string&gt; </code></pre> <p>And then I create a hashtable that contains all the strings, and I don't insert into the list unless it isn't in the hashtable i.e. to enforce unique items in the list.</p> <p>Is there a datatype that can satisfy both of these requirements for me?</p>
c#
[0]
2,058,719
2,058,720
Is there a PHP function that does the opposite of real_path?
<p>In an upload script, I have</p> <pre><code>$destination = $_SERVER['DOCUMENT_ROOT'] . '/uploads/'. $_SESSION['username'] . '/entries/' . '/' . $year . '/'; </code></pre> <p>and i upload the image path to the database, and thus the string stores is the real_path(ie. S:\sites\www\mysite\uploads\username\entries\2011\file.png)</p> <p>is there a function that converts that real path into "http://sitename/uploads..."</p> <p>althought not hard to implement, i was wondering if there is a built-in one. i looked in the docs but couldn't find anything.</p>
php
[2]
1,943,119
1,943,120
how can i add a new property to an object
<p>i have a custom imageView and i want to add a new prooerty "symbol" to it,so that i can identify every object of my custom imageView.So how can i add a new property to it?Should i go for tag?but i have many objects,so i have to set many tags.</p> <p>Please help......</p>
iphone
[8]
2,724,397
2,724,398
Copy all files and folders from some root
<p>In python, is there an easy method for copying all files and folders from some root to some destination root? Creating all non-existent directories along the way, of course..</p> <p><em>edit</em> how does this change if the root destination directory already exists?</p>
python
[7]
2,048,700
2,048,701
different themes in portrait and landscape for a ListView
<p>I have a ListView which should have the "Theme" theme in portrait and the "Theme.Light" theme in landscape mode. How do I do that? The theme seems to be tied to the activity, and for the ListView I can only change the style, but I dont find a style which works.</p> <p>Or, is there a way to change the activity's theme based on orientation? By code or prefereable by xml?</p> <p>To be more precise and explain the reason: I try to start experimenting with the fragment compatibility library. The starting activity shows in portrait mode a list which looks best with black background. When I touch a list item, a second Activity starts and shows a ListView which better looks on white, so this second Activity has the Theme.Light. Works so far.</p> <p>When I switch to landscape, I try to show both ListViews aside. The second one on the right <em>has</em> to have a white background. The first one on the left could stay on white also (so the whole activity could change the theme), but I'd like to see one on black and one on white, if possible. (I put both ListViews in Fragments, this is done and works. Only the colors are wrong.)</p> <p>Any ideas?</p> <p>Greetings, Joerg</p>
android
[4]
5,179,917
5,179,918
Date converter in python
<pre><code>def main(): print "Welcome To the Date Converter" print "Please Enjoy Your Stay" print date_string = raw_input("Please enter a date in MM/DD/YYYY format: ") date_list = date_string.split('/') import datetime d = datetime.date d.strftime('%B %d, %Y') main() </code></pre> <p>That's what I have so far I keep getting a 0 for an output in help would be appreciated I am trying to have someone input a numerical date and the program convert it to a date like November 15, 2010 </p>
python
[7]
1,567,555
1,567,556
Variable undefined
<p>role="manager" and its says that "manager" is undefined.please help.</p> <pre><code> function onSubmitClick(role) { ..... &lt;input type="b utton" class="button" name="btn_Submit" id = "btn_Submit" value="Submit" onMouseOver="showToolTipMessage(T0097);showStatusBarMessage(T0097)" onMouseOut="hideStatusBarMessage()" onFocus="showStatusBarMessage(T0097)" onBlur="hideStatusBarMessage()" onClick="return onSubmitClick(&lt;%=cstr(Role)%&gt;)"&gt; </code></pre>
javascript
[3]
2,420,280
2,420,281
Can I use WifiP2pmanager class ( API 14) in older API ( ex API 9)?
<p>I'm trying to program an app to discover wifi devices which are connecting to an Access Point. I found that WifiP2pmanager class can be used to scan wifi devices but it's just for API14. Is there anyway to use this class in older API ? (sorry for my poor English >.&lt;)</p>
android
[4]
615,383
615,384
Is this html array or php array?
<p>Please help me out, i came across this script in my project. Is this html array or php array ?</p> <pre><code>&lt;input type="hidden" name="newsletter['.$var["id"].'][someid]" value="'.$var['id'].'" /&gt; </code></pre>
php
[2]
4,313,412
4,313,413
What does script manager control actually do?
<p>I have a small doubt which I could not google the answer, So thought I could find the answer here. Why should we add </p> <pre><code> &lt;asp:ScriptManager ID="ScriptManager1" runat="server"&gt; &lt;/asp:ScriptManager&gt; </code></pre> <p>control in order to use </p> <pre><code> &lt;asp:UpdatePanel runat="server"&gt; in out aspx page. </code></pre> <p>hope some one can give the answer.</p> <p>Thanks in Advance.</p>
asp.net
[9]
1,854,337
1,854,338
update textarea content on click on an input button
<p>i want update textarea content onclock on a input button</p> <p>for example:</p> <pre><code>&lt;input type="button" value="Reply" onclick="update('Ahmed')"&gt; &lt;textarea id="comment_content"&gt;&lt;/textarea&gt; //i want set textarea content to @/Ahmed/ onclick on the above button //example for the javascript function function update(var){ getElementByID('comment_content') = '@/'.var.'/' //set the textarea to @/Ahmed/ } </code></pre> <p>I have another question.. i want onclick on the button, i want send the user to the end of the page ( to the new_comment div )</p> <p>i want javascript code, not jquery</p>
javascript
[3]
2,296,830
2,296,831
In IE7 Jquery Selector not working
<p>I have a simple html like -</p> <pre><code>&lt;div id="mainDiv"&gt; &lt;form method="post"&gt; &lt;input type="hidden" id="txtId" value="123"&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>I am using following selector for accessing hidden field -</p> <pre><code>var txtVal = $('#mainDiv #txtID').val(); alert(txtVal); </code></pre> <p>which is working fine in FF and cheome but in IE7, alert is saying "undefined".</p>
jquery
[5]
3,850,284
3,850,285
How to display year only in date picker in android
<p>Can anybody tell how to display year only in date picker in android</p> <p>Thanks</p>
android
[4]
782,738
782,739
How to empty the logcat buffer in Android
<p>How can I empty the logcat buffer in Android?</p> <p>I use adb logcat from command line and pipe the output to a file, since the DDMS has a very limited buffer. At the moment, when I restart my app (after fixing bugs etc) the logcat buffer has data from the previous launch as well. Even uninstalling the app does not clear the buffer. The only way I've found so far to clear the buffer, is reboot. This is effective, but would like to know if there's an easier way.</p>
android
[4]
2,859,084
2,859,085
Need to use WLAN in android
<p>I developed an app for android tablet, Now i need to perform certain actions on the app through my android phone using WLAN... How to do it? </p>
android
[4]
2,814,082
2,814,083
Selecting tab as default jquery
<p>Thanks to JAAulde for update. Sitll having some issues.</p> <pre><code>$( function() { var tabs = $( 'ul.sideMenu a' ), selected, hashes = [], tabContainers; tabs.each( function() { var locationhash, linkhash, selectthis; locationhash = ( window.location.hash !== '' ) ? window.location.hash : '#index'; linkhash = this.hash; if( this.pathname === window.location.pathname ) { hashes.push( linkhash ); selectthis = ( linkhash === locationhash ); $( this ).toggleClass( 'selected', selectthis ); $( linkhash ).toggle( selectthis ); } } ); tabContainers = $( hashes.join( ', ' ) ); tabs.bind( 'click', function( e ) { // hide all tabs tabContainers .hide() .filter( this.hash ) .show(); // set up the selected class tabs.removeClass( 'selected bluecolor' ); $( this ).addClass( 'selected bluecolor' ); e.preventDefault() } ); } ); </code></pre> <p>Menu -- URL </li> URL </li> <p>Content -- </p> <pre><code>&lt;div id="URL"&gt;content&lt;/div&gt; &lt;div id="Content2"&gt;content2&lt;/div&gt; </code></pre> <p>So I still can't get it to select the first tab on page load. Instead its loading a blank page. </p> <p>I am also having bugs in IE "Message: 'this.style' is null or not an object Line: 30 Char: 9" In IE the whole page loads and when I click links it only acts like an anchor. This is driving me crazy. Any help greatly appreciated. If I get it working I'll update here.</p>
jquery
[5]
5,183,186
5,183,187
How do I have similar multiple panels of GUI to appear on my Windows Form Application
<p>I have a c# windows form application that has a similar GUI functionality as MSN. It works in the way such that only a notification window appears if there is notification which in this case I have put several buttons and other stuffs in a single panel. (is this the right way to do so?)</p> <p>How do I code it such that I can use a arrayList to add similar panels to the list and use a for loop to call it out. Example would be calling 2 or 3 similar panels through the use of arraylist(?) and for them to appear below one another. (Maybe like how MSN notifications window comes up one above another.)</p> <p>the code for the panel is</p> <pre><code> this.panel1.Controls.Add(this.button1); this.panel1.Controls.Add(this.lblImage); this.panel1.Controls.Add(this.lblName); this.panel1.Controls.Add(this.lblLinkName); this.panel1.Controls.Add(this.lblLinkLocation); this.panel1.Controls.Add(this.lblLocation); this.panel1.Location = new System.Drawing.Point(13, 134); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(506, 100); this.panel1.TabIndex = 17; </code></pre> <p>do I have to code the for loop in the designer file or the coding file? as after I have tried to add for loop in the designer code file, the designer view sort of unable to display my UI.</p>
c#
[0]
3,708,640
3,708,641
Can I test for daylight saving time (DST) using PHP date()?
<p>I'm looking at PHP <code>date()</code> documentation and thought that <code>'I'</code> would tell me whether the date supplied was in DST. So I expected the following:</p> <pre><code>$d = strtotime('2012-07-01 12:30:00, Europe/London'); // this is in DST $bool = date('I',$d); // 1 </code></pre> <p>but got this:</p> <pre><code>$bool = date('I',$d); // 0 </code></pre> <p>Obviously I'm reading the documentation wrong. I know I can do this using <code>dateTimeZone()</code> transitions, but is this not a feature of <code>date()</code> as well?</p>
php
[2]
922,904
922,905
cpp issue with wide char and windows functions
<pre><code>static void GetFilesFromDir(std::string dir, std::vector&lt;std::string&gt;&amp; items) { WIN32_FIND_DATA findData; HANDLE hFind=FindFirstFile((dir+"\\*").c_str(), &amp;findData); //1 error do { if(hFind != INVALID_HANDLE_VALUE) { std::string sFileName = findData.cFileName; //2 error LPCSTR lp(sFileName.c_str()); if(sFileName == "." || sFileName == "..") {} //do nothing else if (findData.dwFileAttributes &amp; FILE_ATTRIBUTE_DIRECTORY) GetFilesFromDir(dir+"\\"+sFileName, items); else items.push_back(dir+"\\"+sFileName); } } while (FindNextFile(hFind, &amp;findData)); } </code></pre> <p>So here's my simple function that I just coppied from another project to the new one. And it throws errors for no reason I can think of, especially because it works in other projects... </p> <pre><code>1&gt;c:\users\prog\documents\visual studio 2010\projects\vampire stealth\vampire stealth\smallfunctions.h(22): error C2664: 'FindFirstFileW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR' 1&gt; Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast 1&gt;c:\users\prog\documents\visual studio 2010\projects\vampire stealth\vampire stealth\smallfunctions.h(27): error C2440: 'initializing' : cannot convert from 'WCHAR [260]' to 'std::basic_string&lt;_Elem,_Traits,_Ax&gt;' 1&gt; with 1&gt; [ 1&gt; _Elem=char, 1&gt; _Traits=std::char_traits&lt;char&gt;, 1&gt; _Ax=std::allocator&lt;char&gt; 1&gt; ] 1&gt; No constructor could take the source type, or constructor overload resolution was ambiguous </code></pre> <p>Anyone has any ideas on what's wrong? I'm totally clueless about it.</p>
c++
[6]
536,227
536,228
Jquery Doesnt work on Chrome/IE
<p>I am using Jquery to display if someone type anything in Textbox on image, you can check the working demo at</p> <p><a href="http://jsfiddle.net/nileshbhd5/RFPvr/1/" rel="nofollow">http://jsfiddle.net/nileshbhd5/RFPvr/1/</a></p> <p>It works great in Firefox, but doesnt work in Chrome/IE.</p> <p>Here is the Fiddle <a href="http://jsfiddle.net/nileshbhd5/RFPvr/1/" rel="nofollow">http://jsfiddle.net/nileshbhd5/RFPvr/1/</a></p>
jquery
[5]
542,346
542,347
how to display titleForHeaderInSection
<p>I got array which has one,two,three,four,five. values.. in my array....says countListArray.</p> <p>I need to display this countlistarray has titleForHeaderInSection....</p> <p>for each section i need to display 6 cell...</p>
iphone
[8]
4,792,368
4,792,369
regular expression for date in any format in javascript?
<p>regular expression for date in any format in javascript</p> <p>The format includes: dd/mm/yyyy or mm/dd/yyyy or yyyy/dd/mm or dd-yy-mmmm or ddmmyyyy like so on.....</p> <p>can any one help please??</p>
javascript
[3]
1,420,485
1,420,486
Add event to list
<p>I want to add event to list such that on adding items actions are taken based on the item e.g. genrating new data structures, change in screen output or raising exception.</p> <p>How do I accomplish this?</p>
python
[7]
1,687,905
1,687,906
getPositionForSection and getSectionForPosition and getSections methods for ArrayAdapter
<p>Explain me the usage of <code>getPositionForSection(int)</code> and <code>getSectionForPosition(int)</code> and <code>getSections()</code> methods of <code>ArrayAdapter</code>?</p> <p>I got a good explanation of <a href="http://stackoverflow.com/questions/5300962/getviewtypecount-and-getitemviewtype-methods-of-arrayadapter">getViewTypeCount and getItemViewType methods of ArrayAdapter</a>.</p> <p>Thanks.</p>
android
[4]
3,169,516
3,169,517
Passing Parameters via URI in Android
<p>Is it possible (or recommended) to pass parameters to content providers via URIs in Android, similar to how web addresses use them? That is to say, can I use name/value pairs in content:// URIs?</p> <p>For example, I have a search provider that can search based on names. I pass it a URI like this:</p> <p>content://com.example.app/name/john</p> <p>That would return anyone with "john" in their names, including John, Johnathon, Johnson, etc.</p> <p>I want to have the option (but not requirement) to search by exact names and not find partial matches. I was thinking of doing something like this:</p> <p>content://com.example.app/name/john?exact=true</p> <p>That would tell the search provider to only return names that exactly match "John." But I haven't seen any other examples of parameters used like this within Android. Is there a better way? What am I missing here?</p> <p>Thanks!</p>
android
[4]
5,202,099
5,202,100
Appending To TextBox From Another Class and Thread C#
<p>I have a form that sets up and displays the text box. In the form load method, I am starting a new thread from a completely separate class name <code>Processing</code>:</p> <pre><code> private void Form1_Load(object sender, EventArgs e) { Processing p = new Processing(); Thread processingThread = new Thread(p.run); processingThread.Start(); } </code></pre> <p>Here is the processing class. What I would like to do is create a method in <code>Utilities</code> class that will allow me to update the text box from whatever class I would need to:</p> <pre><code>public class Processing { public void run() { Utilities u = new Utilities(); for (int i = 0; i &lt; 10; i++) { u.updateTextBox("i"); } } } </code></pre> <p>Then finally the <code>Utilites</code> class:</p> <pre><code>class Utilities { public void updateTextBox(String text) { //Load up the form that is running to update the text box //Example: //Form1.textbox.appendTo("text"): } } </code></pre> <p>I have read about the <code>Invoke</code> methods, <code>SynchronizationContext</code>, Background threads and everything else, but almost all examples are using methods in the same class as the <code>Form</code> thread, and not from separate classes.</p>
c#
[0]
4,930,589
4,930,590
C++ member initialization list question
<pre><code>class TreeNode { // An object of type TreeNode represents one node // in a binary tree of strings. public: // Constructor. Make a node containing str. TreeNode(string str) : item(str), left(NULL), right(NULL) {} string item; // The data in this node. TreeNode *left; // Pointer to left subtree. TreeNode *right; // Pointer to right subtree. }; </code></pre> <p>In 6th line, can I delete this part ? </p> <pre><code> : item(str), left(NULL), right(NULL) </code></pre> <p>Thank you.</p>
c++
[6]
1,636,621
1,636,622
Get PageName.aspx from Page object
<p>I want to get the pagename.aspx from the current page object. I <strong>don't</strong> want to do it through HttpContext.Current.<strong>Request</strong> because if I'm already on the page and doing something why not just grab it from page...I don't need to worry about any context here.</p> <p>I guess page already has the name and I need to just append .aspx but is there a way to get the extension with it automatically?</p>
asp.net
[9]
4,993,102
4,993,103
How can I give the same linux user ID for more than one applications?
<p>I would like to give same linux user ID for more than one applications. How can I give the same linux user ID for more than one applications.</p> <p>thanks, Venu.</p>
android
[4]