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
2,328,449
2,328,450
TextBox AutoComplete from MDB
<p>I have a .Net 4 Windows Forms app that uses a Microsoft Access Database with one table which has three columns CityCode, Name and Country.</p> <p>What I want to do is have an autocomplete which shows the “Name” and “Country” but when selected the “CityCode” Value is shown in the textbox. In addition if the user types A City Code eg LAX as they type L it would list all the cities whose code or Name starts with L.</p> <p>Can this be done?</p> <p>Currently I have the following for access the database (but it seems to be a bit slow!)</p> <pre><code>textBoxCity.AutoCompleteCustomSource = CityList(); public static AutoCompleteStringCollection CityList() { string connectionStringLD = string.Empty; connectionStringLD = @"Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\CityList.mdb"; string SQL = "SELECT CityCode from CityTable"; OdbcConnection conn = new OdbcConnection(connectionStringLD); OdbcCommand cmd = new OdbcCommand(SQL); cmd.Connection = conn; conn.Open(); OdbcDataReader reader = cmd.ExecuteReader(); AutoCompleteStringCollection theCityList = new AutoCompleteStringCollection(); while (reader.Read()) { theCityList.Add(reader.GetValue(0).ToString()); } return theCityList; } </code></pre>
c#
[0]
3,513,208
3,513,209
Adding properties dynamically in javascript
<p>In Javascript you add properties to an object dynamically for example:</p> <pre><code>var car = {colour: "blue"}; car.reg = "XYXABC00D"; </code></pre> <p>Is there a special buzzword for this?</p> <p>Thanks.</p>
javascript
[3]
5,324,470
5,324,471
How versionnig an android application works?
<p>I'm a beginner in Android and I would like to know (and understand) in detail how upgrading an application works. Thanks.</p>
android
[4]
3,500,497
3,500,498
C# what is the size of unmanaged object?
<p>Read definition of <code>Marshal.SizeOf().</code> It says this: <code>The size returned is the size of the unmanaged object. The unmanaged and managed sizes of an object can differ.</code> Is that means Marshal.SizeOf will return you the definition size but not the actual memeory allocated size because there are may have some padding for alignment?</p> <p>For example:</p> <pre><code>struct MyStruct { char c; } </code></pre> <p>The size will be 1 byte for unmanaged object (unmanaged size) if I use <code>Marshal.SizeOf()</code> but may be 2 or 4 bytes for managed object (managed size) if I use <code>sizeof(</code>). Am I right?</p>
c#
[0]
5,465,216
5,465,217
Allocating byte array to get 4 billion bits
<p>I was reading this book entitled, Cracking the Coding Interview by Laakman. There is this part where she (the author p.g. 202) did:</p> <pre><code>byte[] bitfield = new byte [0xFFFFFFF/8];//there are 7 F's </code></pre> <p>She was allocating 4 billion bits. However, isn't 0xFFFFFFF = 2^28-1? Thus, she has only allocated a byte array of 2^28-1/8 bytes, which is not remotely close to 4 billion bits. It is only 2^28-1 bits. My question is- is she wrong or am I doing something wrong? How do we allocate 4 billion bits? I have tried:</p> <pre><code>byte[] bitfield = new byte[0xfffffff *2]; </code></pre> <p>Although the above causes the jvm to run out of heap space.</p> <p>While we are at it, what is the best was to express hex values? e.g. 0xffffffff or 0xFFFFFFFF?</p>
java
[1]
2,392,449
2,392,450
How to insert UILabel in UIText?
<p>Can we insert UILabel in UItext in I phone App? is it possible? if yes how?</p> <p>Thanks in advance!</p>
iphone
[8]
2,427,715
2,427,716
How to move image within a div tag
<p>I have a image inside a div which is 100*100 , i want to move the image inside the div like various company's does. for example www.zazzle.com does that.</p> <p>I tried the below code ,but it is pushing all other divs down ,the divs are getting expanded. any idea how to do this.</p> <pre><code> $item.animate({height: '+=5', width: '+=5'}, 'fast', function() { $item.animate({height: '-=10', width: '-=10'}, 'fast', function() { $item.animate({height: '+=5', width: '+=5'}, 'fast', function() { //animation finished }); }); }); </code></pre>
jquery
[5]
1,705,120
1,705,121
There is any way to get ClientIDMode and ClientID property on ASP.NET 3.5?
<p>I would like to have the brand new <code>ClientIDMode</code> and the <code>ClientID</code> property on ASP.NET 3.5 controls, there is any way I can achieve that?</p> <p>I was thinking in replacing the default control compiler, this is possible or there is many changes to make this behavior available?</p>
asp.net
[9]
2,155,241
2,155,242
what is this nameless function?
<p>What does this line from the following code sample mean? </p> <pre><code>synchronized (_surfaceHolder) { _panel.onDraw(c); } </code></pre> <p>I can guess what it does, but what is it called and how does it works? Is it a nameless synchronized function?</p> <pre><code>class TutorialThread extends Thread { private SurfaceHolder _surfaceHolder; private Panel _panel; private boolean _run = false; public TutorialThread(SurfaceHolder surfaceHolder, Panel panel) { _surfaceHolder = surfaceHolder; _panel = panel; } public void setRunning(boolean run) { _run = run; } @Override public void run() { Canvas c; while (_run) { c = null; try { c = _surfaceHolder.lockCanvas(null); synchronized (_surfaceHolder) { _panel.onDraw(c); } } finally { // do this in a finally so that if an exception is thrown // during the above, we don't leave the Surface in an // inconsistent state if (c != null) { _surfaceHolder.unlockCanvasAndPost(c); } } } } </code></pre>
android
[4]
3,693,347
3,693,348
Dynamic casting
<p>why does the two last lines doesn't work and give me "The type or namespace name 'myType' could not be found" :</p> <pre><code>Type myType = this.GetType(); bool test = obj is myType; var p = (myType)obj; </code></pre> <p>thx</p>
c#
[0]
4,981,842
4,981,843
how to capture image automatically in Android
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/9682928/capture-image-with-front-camera-without-opening-the-camera-application-in-androi">Capture image with front camera without opening the camera application in android</a> </p> </blockquote> <p>my problem is I can do capturing only by using Intent to launch the camera and click the button to capture image. Is it possible to do it automatically by not clicking a button or what codes can I add to do this? thanks in advance.</p>
android
[4]
3,463,608
3,463,609
Javascript VAR syntax
<p>What does this mean in var definition:</p> <pre><code>var array = array || []; </code></pre> <p>... and next two parts of javascript are equal each other?</p> <pre><code>var array = array || []; array.push([1],[2]); array.push([3]); </code></pre> <p>=</p> <pre><code>var array = array.push([1],[2],[3]) || []; </code></pre> <p>?</p>
javascript
[3]
1,948,662
1,948,663
How to set view outlet using tab bar controller in iPhone SDK
<p>I created a simple tab bar application in Xcode. </p> <p>The default tab bar has 2 tab bar items. I add a third tab bar item and set its view controller attribute to a view i had created and subsequently saved called ThirdView.xib. </p> <p>When I try to run, the first two default tabs work fine. The third one I added throws this error:</p> <pre><code> *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] loaded the "ThirdView" nib but the view outlet was not set.' </code></pre> <p>I apologize as I'm a huge iPhone-SDK n00b, but no manner of clicking and dragging and control-click dragging is allowing me to set the view outlet on the third view I had created. </p>
iphone
[8]
444,043
444,044
Why do images for textures on the iPhone need to have power-of-two dimensions?
<p>I'm trying to solve this flickering problem on the iphone (open gl es game). I have a few images that don't have pow-of-2 dimensions. I'm going to replace them with images with appropriate dimensions... but why do the dimensions need to be powers of two?</p>
iphone
[8]
1,167,951
1,167,952
Record sound in android
<pre><code>Intent intent=new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION); startActivityForResult(intent, VoiceHandler.VOICE_FLAG); </code></pre> <p>This code execute fine with my ICS device but not with my android 2.3 device this code throws </p> <pre><code>android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.provider.MediaStore.RECORD_SOUND } </code></pre>
android
[4]
5,202,926
5,202,927
dismissModalView doesn't respond to touches
<p>in MyAppDelegate, when a button is pressed it presents a modal view:</p> <pre><code>- (void) showInfoPanel:(id)sender { </code></pre> <p>infoViewController = [[InfoViewController alloc] init]; UINavigationController *infoNavController = [[UINavigationController alloc] init]; infoNavController.navigationBarHidden = YES; [window addSubview:infoNavController.view]; [infoNavController presentModalViewController:infoViewController animated:YES];</p> <p>}</p> <p>in InfoViewController i have to dismiss the modal view:</p> <pre><code>- (void) exitInfoPanel:(id)sender { [self.parentViewController dismissModalViewControllerAnimated:YES]; </code></pre> <p>}</p> <p>although it works, the MyAppDelegate window doesn't respond to touches anymore. </p> <p>instead in the InfoViewController if:</p> <pre><code>[self.view removeFromSuperview]; </code></pre> <p>It respond to touches but I lose the animation of dismissing the modal view.</p> <p>What I am doing wrong, why it doesn't respond to touches when the modalview is dismissed? ?</p> <p>thanks </p>
iphone
[8]
2,764,716
2,764,717
How can I prevent PrintWriter from printing a blank line at the beginning of each file?
<p>I'm trying to write a couple of methods to save a binary tree to a file. They work correctly, except for a slight problem. The problem is that a blank line is inserted at the beginning of each file that's created. Why is PrintWriter doing this, and how can I prevent it from happening?</p> <p>Here's my code:</p> <pre><code>import java.io.*; void callSaveGame(String fileName) throws IOException { PrintWriter out = new PrintWriter(new FileWriter("X:\\path\\to\\save\\directory\\" + fileName)); // associate PrintWriter with file saveGame(root, out); out.close(); } void saveGame(Node current, PrintWriter out) { if (current != null) { out.println(current.getData()); // print node to file saveGame(current.getLChild(), out); // call for left child(ren) saveGame(current.getRChild(), out); // call for right child(ren) } } </code></pre>
java
[1]
3,058,533
3,058,534
jquery: on click, add text from title-tag to an input box
<p>I have a contactbook, and a form close to it... For the form, one of the requirements is to fill in the receiver for the message. So when the user clicks on a contact from the contactbook, automaticly the username from the titel-tag should appear in the receiver inpunt in the form.</p> <p>All help with this is appreciated!!</p>
jquery
[5]
814,554
814,555
How to store $ in a PHP variable?
<p>I want to store a $ character in a PHP variable.</p> <pre><code>$var = "pas$wd"; </code></pre> <p>I get the following error</p> <pre><code>Notice: Undefined variable: wd in C:\xxxxx on line x </code></pre> <p>Help.</p>
php
[2]
2,262,931
2,262,932
remove uncommon values in php array
<p>Hello all,</p> <pre><code>Array ( [0] =&gt; Array ( [id] =&gt; 242) [1] =&gt; Array ( [id] =&gt; 24) [2] =&gt; Array ( [id] =&gt; 234) [3] =&gt; Array ( [id] =&gt; 244) ) Array ( [0] =&gt; 24 [1] =&gt; 242 [2] =&gt; 244 ) </code></pre> <p>When I used <code>print_r()</code>, I got above two arrays. Now, I need to filter two arrays and get uncommon values so my output will be 234</p>
php
[2]
2,130,935
2,130,936
polymorphic downcasting for derived classes with additional members
<p>Consider a class <code>Base</code> with virtual functions and a class <code>Derived</code> from Base implementing the virtual functions, but with few additional private members. Can we safely downcast the <code>Base*</code> pointer to <code>Derived*</code> pointer?</p> <pre><code>Base* base = new Derived(); Derived* derived = dynamic_cast&lt;Derived*&gt;(base); // Is this valid? </code></pre> <p>What if derived class contains an additional private member int _derivedNum apart from implementation of virtual functions in the base class? Can I still use derived->_derivedNum to access the private member of the derived class after downcasting the base class pointer?</p>
c++
[6]