qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
358,350
<p>I have a list, and each item is linked, is there a way I can alternate the background colors for each item?</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;a href="link"&gt;Link 1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="link"&gt;Link 2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="link"&gt;Link 3&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="link"&gt;Link 4&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="link"&gt;Link 5&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre>
[ { "answer_id": 358357, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": -1, "selected": false, "text": "li, li + li + li, li + li + li + li + li {\n background-color: black;\n}\n\nli + li, li + li + li + li {\n background-col...
2008/12/11
[ "https://Stackoverflow.com/questions/358350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26130/" ]
358,387
<p>Basically what the title says...</p> <p>I need to have an image that when clicked, I call script.php for instance and in that PHP script file, I get the image coordinates where the mouse was clicked.</p> <p>Is this possible?</p> <p><strong>EDIT:</strong><br /> After a couple of answers I realized I didn't describe my problem correctly... The thing is, I don't have total control over the HTML. The control I have for the image and the image link is the control BBCode provides me.</p> <p>Basically want I want to do is to have a forum signature with links to various sections on my website. You could argue I could use multiple images but most forums limit how much you can type for the signature, which is not enough for multiple images.</p> <p>So, I will only be able to do something like this:<br /></p> <pre><code>[url=http://www.mydomain.com/script.php] [img]http://www.mydomain.com/signature.jpg[/img] [/url] </code></pre> <p>Which translates to something like this:<br /></p> <pre><code>&lt;a href="http://www.mydomain.com/script.php"&gt; &lt;img src="http://www.mydomain.com/signature.jpg" /&gt; &lt;/a&gt; </code></pre>
[ { "answer_id": 358401, "author": "jmucchiello", "author_id": 44065, "author_profile": "https://Stackoverflow.com/users/44065", "pm_score": 2, "selected": false, "text": "name=\"foo\"" }, { "answer_id": 358512, "author": "recursive", "author_id": 44743, "author_profile...
2008/12/11
[ "https://Stackoverflow.com/questions/358387", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40480/" ]
358,389
<p>I just finished watching the Google clean code video on YouTube (see <a href="http://googletesting.blogspot.com/" rel="nofollow noreferrer">link</a>, first article) about removing <code>if</code> statements from your code and using polymorphism instead. </p> <p>After watching the video I had a look at some code that I was writing before watching the video and noticed some places where I could use this method, mainly places where the same kind of logic was implemented many times. So a example:</p> <p>I have some code like this.</p> <pre><code>public int Number { get { string returnValue; if (this.internalTableNumber == null) returnValue = this.RunTableInfoCommand(internalTableName, TableInfoEnum.TAB_INFO_NUM); else returnValue = this.RunTableInfoCommand(internalTableNumber.Value, TableInfoEnum.TAB_INFO_NUM); return Convert.ToInt32(returnValue); } } </code></pre> <p>What RunTableInfoCommand does isn't really important,but the main thing is that I have many properties with exactly the same <code>if</code> statments the only thing that changes is the TableInfoEnum.</p> <p>I was wondering if someone could help me refactor this so that it still does the same thing but without any <code>if</code> statements?</p>
[ { "answer_id": 358403, "author": "Andrew Kennan", "author_id": 22506, "author_profile": "https://Stackoverflow.com/users/22506", "pm_score": 0, "selected": false, "text": "public class Thing\n{\n public IValueFetcher ValueFetcher { get; set; }\n\n public int Number \n { \n get \n ...
2008/12/11
[ "https://Stackoverflow.com/questions/358389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6335/" ]
358,397
<p><strong>Is it possible for some Javascript to detect whether Skype is installed or not?</strong></p> <p>The reason I ask is that I'd like to change a link's href based on that: if Skype isn't installed, show a popup explaining what Skype is and how to install it, if it is installed, change the link to <code>skype:my.contact.name?call</code> so the click will start a call. Real estate issues means that I'd prefer to only have one link shown.</p>
[ { "answer_id": 358421, "author": "some", "author_id": 36866, "author_profile": "https://Stackoverflow.com/users/36866", "pm_score": 3, "selected": false, "text": "function isSkypeInstalled(str) {\n try {\n /*@cc_on\n //The Microsoft way, thanks to the conditional comment...
2008/12/11
[ "https://Stackoverflow.com/questions/358397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9021/" ]
358,398
<p>I have a class called myClass which defines post() and get() methods. </p> <p>From <em>index.html</em>, I have a form with an action that calls myClass.post() which grabs some data from the data base, sets a couple variables and sends the user to <em>new.html</em>. </p> <p>now, <em>new.html</em> has a form which calls myClass.get(). </p> <p><strong>I want the get() method to know the value of the variables I got in post().</strong> That is is main point here.</p> <p>I figure the submit from new.html creates a separate instance of myClass created by the submit from index.html. </p> <p>Is there a way to access the "post instance" somehow? </p> <p>Is there a workaround for this? If I have to, is there an established way to send the value from post to "new.html" and send it back with the get-submit? </p> <p>more generally, I guess I don't understand the life of my instances when web-programming. In a normal interactive environment, I know when the instance is created and destroyed, but I don't get that when I'm only using the class through calls to its methods. Are those classes even instantiated unless their methods are called? </p>
[ { "answer_id": 358613, "author": "muhuk", "author_id": 42188, "author_profile": "https://Stackoverflow.com/users/42188", "pm_score": 1, "selected": false, "text": "def save_foo(request):\n if request.method == 'POST':\n save(request.POST)\n return HttpRedirect(reverse(\n...
2008/12/11
[ "https://Stackoverflow.com/questions/358398", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1179/" ]
358,410
<p>Can anybody let me know the query to find all the tables that has a date columns on it.</p> <p>Thanks</p>
[ { "answer_id": 358424, "author": "RobS", "author_id": 18471, "author_profile": "https://Stackoverflow.com/users/18471", "pm_score": 4, "selected": false, "text": " select distinct c.TABLE_NAME \n from INFORMATION_SCHEMA.COLUMNS as c\n where c.DATA_TYPE = 'datetime'\n" }, ...
2008/12/11
[ "https://Stackoverflow.com/questions/358410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
358,430
<p>I want to implement a simple 2 part FormWizard. Form 1 will by dynamically generated something like this:</p> <pre><code>class BuyAppleForm(forms.Form): creditcard = forms.ChoiceField(widget = forms.RadioSelect) type = forms.ChoiceField(widget = forms.RadioSelect) def __init__(self,*args, **kwargs): user = kwargs['user'] del kwargs['user'] super(BuyAppleForm, self).__init__(*args, **kwargs) credit_cards = get_credit_cards(user) self.fields['creditcard'].choices = [(card.id,str(card)) for card in credit_cards] apple_types= get_types_packages() self.fields['type'].choices = [(type.id,str(type)) for type in apple_types] </code></pre> <p>This will dynamically create a form with lists of available choices.</p> <p>My second form, I actually want no input. I just want to display a confirmation screen containing the credit card info, apple info, and money amounts (total, tax, shipping). Once user clicks OK, I want the apple purchase to commence.</p> <p>I was able to implement the single form way by passing in the request.user object in the kwargs. However, with the FormWizard, I cannot figure this out.</p> <p>Am I approaching the problem wrong and is the FormWizard not the proper way to do this? If it is, how can the Form <code>__init__</code> method access the user object from the HTTP request? </p>
[ { "answer_id": 358556, "author": "Krystian Cybulski", "author_id": 45226, "author_profile": "https://Stackoverflow.com/users/45226", "pm_score": 1, "selected": true, "text": "buy_apples" }, { "answer_id": 4858044, "author": "Zak Patterson", "author_id": 597745, "autho...
2008/12/11
[ "https://Stackoverflow.com/questions/358430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45226/" ]
358,443
<p>I'm trying to get some WPF concepts down, so I've put together a simple example of what I'm trying to do. I would like to set a custom property of a user control, and have it be used by an element within the control.</p> <p>I've been researching and experimenting, but I'm not fully understanding everything here. Any help would be appreciated.</p> <p>The user control for this example is a simple square with a circle inside of it:</p> <pre><code>&lt;UserControl x:Class="CircleInSquare" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="100" Height="100" &gt; &lt;Grid Background="#000000"&gt; &lt;Ellipse Name="Circle" Margin="10" Fill="?????????" &gt; &lt;/Ellipse&gt; &lt;/Grid&gt; &lt;/UserControl&gt; </code></pre> <p>The VB Code Behind it:</p> <pre><code>Partial Public Class CircleInSquare Private _CircleColor As Color Public Property CircleColor() As Color Get Return _CircleColor End Get Set(ByVal value As Color) _CircleColor = value End Set End Property End Class </code></pre> <p>When I use this user control, how can I apply a CircleColor to the control, and have it be shown as the Ellipse's fill color? Even better... can I give it a default color that shows up in the VS2008 Designer?</p> <p>So... if I place one of these into my window XAML like this:</p> <pre><code>&lt;app:CircleInSquare CircleColor="Blue" /&gt; </code></pre> <p>I would like the circle to display as Blue (or any other color I choose for that instance)</p>
[ { "answer_id": 358458, "author": "bendewey", "author_id": 37881, "author_profile": "https://Stackoverflow.com/users/37881", "pm_score": 0, "selected": false, "text": "<Ellipse app:CircleInSquare.CircleColor=\"Blue\" />\n" }, { "answer_id": 358535, "author": "Jobi Joy", "a...
2008/12/11
[ "https://Stackoverflow.com/questions/358443", "https://Stackoverflow.com", "https://Stackoverflow.com/users/641985/" ]
358,449
<p>When using ASP.NET protected configuration, how can I encrypt the config with just the public key?</p> <p>I can export a public key file. I would like to then use this public key to encrypt the configuration files on another server for later deployment. However, I can't figure out how to get aspnet_regiis to use the exported public key.</p> <p>Basically, I tried importing just the public key into a container, and then encrypt it. However, when I do that, instead of using the existing key to encrypt, it creates an entirely new key pair, overwriting the existing public key. In the script below, if you rename each of the copied files back to connections.config, and try to decrypt them, the first one (connectionstring_server.encrypted) will fail, while the second (connectionstring_build.encrypted) will succeed), proving that a new keypair was created.</p> <p>Here is a batch file that demonstrates the approach I have tried (edit: this is just an example to test the aspnet_regiis capabilities. My actual usage of it would, obviously, be slightly different) :</p> <pre><code>REM delete container in case it already exists \WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -pz "MyKeys" REM create container \WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -pc "MyKeys" REM export key \WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -px "MyKeys" "publicKey.xml" REM encrypt file \WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -pef "connectionStrings" . -prov "MyProvider" REM copy encrypted file for later comparison copy connections.config connectionstring_server.encrypted pause REM decrypt file \WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -pdf "connectionStrings" . REM delete continer \WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -pz "MyKeys" REM import public key \WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -pi "MyKeys" publicKey.xml REM encrypt file with just public key - THIS DOES NOT WORK CORRECTLY, it creates a new keypair \WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -pef "connectionStrings" . -prov "MyProvider" REM copy back encrypted file copy connections.config connectionstring_build.encrypted pause REM decrypt file \WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -pdf "connectionStrings" . </code></pre> <p>And here is a sample web.config</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;configuration&gt; &lt;configProtectedData&gt; &lt;providers&gt; &lt;add name="MyProvider" keyContainerName="MyKeys" type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" useMachineContainer="true" /&gt; &lt;/providers&gt; &lt;/configProtectedData&gt; &lt;connectionStrings configSource="connections.config" /&gt; &lt;/configuration&gt; </code></pre> <p>And the corresponding connections.config:</p> <pre><code>&lt;connectionStrings&gt; &lt;add name="SomConnectionName" connectionString="Data Source=somedatasource; Initial Catalog=somedatabase; Integrated Security=SSPI; Persist Security Info=False;" providerName="System.Data.SqlClient" /&gt; &lt;/connectionStrings&gt; </code></pre> <p><strong>Edit:</strong> Answer suggested below that I could export the private key as well. That would indeed allow the encryption to work, but I shouldn't need the private key to encrypt. What I want to do is leave the private key just on the server that will use the config file, and store the public key in a more accessible place. Is the inability to do this simply a limitation of aspnet_regiis?</p>
[ { "answer_id": 358458, "author": "bendewey", "author_id": 37881, "author_profile": "https://Stackoverflow.com/users/37881", "pm_score": 0, "selected": false, "text": "<Ellipse app:CircleInSquare.CircleColor=\"Blue\" />\n" }, { "answer_id": 358535, "author": "Jobi Joy", "a...
2008/12/11
[ "https://Stackoverflow.com/questions/358449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24954/" ]
358,457
<p>I think I shall reframe my question from </p> <p>Where should you use BlockingQueue Implementations instead of Simple Queue Implementations ?</p> <p>to </p> <p><strong>What are the advantages/disadvantages of BlockingQueue over Queue implementations taking into consideration aspects like speed,concurrency or other properties which vary e.g. time to access last element.</strong></p> <p>I have used both kind of Queues. I know that Blocking Queue is normally used in concurrent application. I was writing simple ByteBuffer pool where I needed some placeholder for ByteBuffer objects. I needed fastest , thread safe queue implementation. Even there are List implementations like ArrayList which has constant access time for elements.</p> <p>Can anyone discuss about pros and cons of BlockingQueue vs Queue vs List implementations?</p> <p>Currently I have used ArrayList to hold these ByteBuffer objects.</p> <p><strong>Which data structure shall I use to hold these objects?</strong></p>
[ { "answer_id": 358464, "author": "Eugene Yokota", "author_id": 3827, "author_profile": "https://Stackoverflow.com/users/3827", "pm_score": 2, "selected": false, "text": "BlockingQueue" }, { "answer_id": 358558, "author": "erickson", "author_id": 3474, "author_profile"...
2008/12/11
[ "https://Stackoverflow.com/questions/358457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45232/" ]
358,471
<p>I am writing a program that requires the use of XMODEM to transfer data from a sensor device. I'd like to avoid having to write my own XMODEM code, so I was wondering if anyone knew if there was a python XMODEM module available anywhere?</p>
[ { "answer_id": 705300, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": false, "text": "def xmodem_send(serial, file):\nt, anim = 0, '|/-\\\\'\nserial.setTimeout(1)\nwhile 1:\n if serial.read(1) != NAK:\n ...
2008/12/11
[ "https://Stackoverflow.com/questions/358471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
358,495
<p>I have designing the TabMenu Like following</p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { $('#container-1').tabs(); $('#container-2').tabs(); } &lt;/script&gt; ..... &lt;div id="container-1"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#fragment-1"&gt;&lt;span id="start"&gt;First&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div id="container-2"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="#fragment-1"&gt;&lt;span id="end"&gt;Last&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; ..... </code></pre> <p>Is it possible to get the ClickedTab data, instead of the index? Like if ClickTab is first then <code>#fragment1</code>. Else if ClickTab is last, <code>#fragment2</code>.</p> <p>How can I do this?</p>
[ { "answer_id": 358508, "author": "ChadT", "author_id": 23300, "author_profile": "https://Stackoverflow.com/users/23300", "pm_score": 1, "selected": false, "text": "<li><a href=\"#fragment-1\"><span id=\"end\">Last</span></a></li>\n" }, { "answer_id": 359486, "author": "Manik"...
2008/12/11
[ "https://Stackoverflow.com/questions/358495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44984/" ]
358,500
<p>I want to select a blob col from one table, base64 encode it and insert it into another tables. Is there any way to do this without round tripping the data out of the DB and through my app?</p>
[ { "answer_id": 7088614, "author": "lepe", "author_id": 196507, "author_profile": "https://Stackoverflow.com/users/196507", "pm_score": 3, "selected": false, "text": "sys_eval(CONCAT(\"echo '\",myField,\"' | base64\"));\n" }, { "answer_id": 12138609, "author": "WOLFF", "au...
2008/12/11
[ "https://Stackoverflow.com/questions/358500", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1343/" ]
358,501
<p>I'm trying to add a custom font as a resource in my application. I have a "CustomFont" directory in the application and all the fonts inside of it are set to "Resource"</p> <pre><code>&lt;Window.Resources&gt; &lt;Style x:Key="Gotham-XLight"&gt; &lt;Setter Property="TextElement.FontFamily" Value="/CustomFonts;Component/#Gotham-XLight" /&gt; &lt;/Style&gt; &lt;/Window.Resources&gt; </code></pre> <p>And then on my TextBlock I have this: (inside a grid)</p> <pre><code>&lt;TextBlock x:Name="TimeTextBlock" Style="{DynamicResource Gotham-XLight}" TextAlignment="Center" FontSize="25" FontWeight="Bold" Foreground="White" Text="TextBlockTimer" Margin="105,242.974,0,226.975" HorizontalAlignment="Left" Width="221.919" /&gt; </code></pre> <p>But I'm not seeing my font as people say. Am I doing something wrong?</p>
[ { "answer_id": 358511, "author": "joshperry", "author_id": 30587, "author_profile": "https://Stackoverflow.com/users/30587", "pm_score": 3, "selected": false, "text": "<Window.Resources>\n <Style x:Key=\"Gotham-XLight\">\n <Setter Property=\"TextElement.FontFamily\" Value=\"Cus...
2008/12/11
[ "https://Stackoverflow.com/questions/358501", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22451/" ]
358,533
<p>I am curious to learn <a href="http://www.boost.org/" rel="noreferrer">Boost</a>. But I wanted to ask:</p> <ul> <li>How important is it to make the effort to learn Boost?</li> <li>What prerequisites should one have before jumping on Boost?</li> </ul> <p>Why I am curious to know about Boost is that many people are talking about Boost on IRC's channels and here in StackOverflow.</p>
[ { "answer_id": 358691, "author": "Anteru", "author_id": 39912, "author_profile": "https://Stackoverflow.com/users/39912", "pm_score": 2, "selected": false, "text": "shared_ptr" } ]
2008/12/11
[ "https://Stackoverflow.com/questions/358533", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38038/" ]
358,538
<p>I'm trying to develop an application that will use getImageData in javascript in Firefox 3, but I am getting a "<code>NS_ERROR_DOM_SECURITY_ERR</code>" on the getImageData call. The javascript and the image are both currently being served from by hard drive, which is apparently a security violation? When this is live they will both be served from the same domain, so it won't be a problem, but how can I develop in the meantime?</p>
[ { "answer_id": 366493, "author": "Justin Love", "author_id": 30203, "author_profile": "https://Stackoverflow.com/users/30203", "pm_score": 3, "selected": false, "text": " var data;\n try {\n try {\n data = context.getImageData(sx, sy, sw, sh).data;\n } catch (e) {\n net...
2008/12/11
[ "https://Stackoverflow.com/questions/358538", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2652/" ]
358,542
<p>How to find fifth highest salary in a single query in SQL Server</p>
[ { "answer_id": 358547, "author": "Jayden", "author_id": 44873, "author_profile": "https://Stackoverflow.com/users/44873", "pm_score": 5, "selected": false, "text": "select\n *\nfrom\n(\n Select\n SalesOrderID, CustomerID, Row_Number() Over (Order By SalesOrderID) as RunningCount\n ...
2008/12/11
[ "https://Stackoverflow.com/questions/358542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45241/" ]
358,546
<p>Sorry, I thought this was an inheritance question: it was an ArrayList question all along!</p> <p>Ok, my problem is more specific than I thought. So I have two families of classes. Cards, and Zones. Zones are boxes for holding card. </p> <p>The first two subClasses of Zone, ZoneList and ZoneMap are meant to be two different ways of storing Cards. Further subclasses, such as Hand, and PokerHand, have their own specific ways of dealing with the cards they store. </p> <p>Where it gets complicated is that Card also has subClasses, such as PokerCard, and that the subclasses of ZoneList and ZoneMap are meant to organize those. </p> <p>So in ZoneList I have <code>protected ArrayList&lt;Card&gt; cardBox;</code> and in PokerHand I expected to be able to declare <code>cardBox = new ArrayList&lt;PokerCard&gt;();</code> since PokerCard is a Card. The error I am getting is that I apparently can't cast between Card and GangCard when it comes to ArrayLists... So I was trying to fix this by just redeclaring cardBox as <code>private ArrayList&lt;PokerCard&gt; cardBox;</code> inside PokerHand, but that resulted in the hiding that was bugging up my program.</p> <p>SO really, the question is about casting between ArrayLists? Java tells me I can't, so any ideas on how I can?</p> <p>z.</p>
[ { "answer_id": 358579, "author": "Scanningcrew", "author_id": 45219, "author_profile": "https://Stackoverflow.com/users/45219", "pm_score": 1, "selected": false, "text": "Zonelist" }, { "answer_id": 358610, "author": "Marc Novakowski", "author_id": 27020, "author_prof...
2008/12/11
[ "https://Stackoverflow.com/questions/358546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29182/" ]
358,601
<p>There are 2 radiobutton and a hyperlink. if select 'radiobutton1' the hyperlink is enabled. if select 'radiobutton2' the hyperlink is disabled. i can use jquery to disable the hyperlink, but can't enable it. How to enable the hyperlink with jquery?</p>
[ { "answer_id": 358665, "author": "seanb", "author_id": 3354, "author_profile": "https://Stackoverflow.com/users/3354", "pm_score": 2, "selected": false, "text": "$(\"#hyperlink1\").click(function(){ \n // return true or false based on your radio buttons \n ret...
2008/12/11
[ "https://Stackoverflow.com/questions/358601", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
358,603
<p>I have a problem I have got stuck on. </p> <p>I want to export my Access table to an Excel file. Currently, I do that using <code>DoCmd.TransferSpreadsheet</code>, but I want some kind of formatting to be done on the exported data. Can I format that data I am sending to Excel or do I have to write a macro in Excel that will format that data after it has been exported from Access?</p>
[ { "answer_id": 358935, "author": "Berzerk", "author_id": 37599, "author_profile": "https://Stackoverflow.com/users/37599", "pm_score": 2, "selected": false, "text": "Sub Makro1()\n''\nConst sDB = \"c:\\db1.mdb\"\nConst sSQL = \"SELECT * FROM Table1\"\n\n With ActiveSheet.QueryTables.A...
2008/12/11
[ "https://Stackoverflow.com/questions/358603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
358,609
<p>I am developing a Tool in vb.net and need find out Activex Controls from MS Access DB forms. I am able to conut number of controls in form, but unable to get the Activex Controls only from the form. Can any one have any idea how to achieve this, please suggest. </p>
[ { "answer_id": 359240, "author": "Gary Kindel", "author_id": 44597, "author_profile": "https://Stackoverflow.com/users/44597", "pm_score": 0, "selected": false, "text": "Dim oAccess As Access.Application\n\n' Start a new instance of Access for Automation:\noAccess = New Access.Applicatio...
2008/12/11
[ "https://Stackoverflow.com/questions/358609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45255/" ]
358,617
<p>How can I create a file dsn for connecting to an AS400 system using the iSeries ODBC driver?</p> <p>The iSeries ODBC driver allows many settings to be configured. Where can I find a list of all properties that can be set in the file DSN?</p>
[ { "answer_id": 358628, "author": "Gustavo Rubio", "author_id": 14533, "author_profile": "https://Stackoverflow.com/users/14533", "pm_score": 2, "selected": false, "text": "[ODBC]\nDRIVER=iSeries Access ODBC Driver\nSystem=server;\nUid=user;\nPwd=password;\nInitial Catalog=library;\n" }...
2008/12/11
[ "https://Stackoverflow.com/questions/358617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
358,645
<p>In IIS7 for Vista, you can select your machine and it gives you several options in which you can use to configure your system. Where is this file stored at? It seems like there's a big master.config file which stores all my settings like the "Connection Strings" which are inherited by the webpages. </p> <p>Supposedly it's some file named machine.config but nothing I change in the IIS manager for my machine changes there. </p>
[ { "answer_id": 358653, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 4, "selected": true, "text": "C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\CONFIG" }, { "answer_id": 358664, "author": "VonC", "a...
2008/12/11
[ "https://Stackoverflow.com/questions/358645", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10352/" ]
358,654
<p>I need to specify path to dlls referenced by assembly in .config file. Problem is that path can be found in env. variable. Is it possible to use some sort of %DLLPATH% macro in .config file?</p>
[ { "answer_id": 358678, "author": "Prensen", "author_id": 43633, "author_profile": "https://Stackoverflow.com/users/43633", "pm_score": 5, "selected": false, "text": "<configuration>\n <appSettings>\n <add key=\"mypath\" value=\"%DLLPATH%\\foo\\bar\"/>\n </appSettings>\n</configurati...
2008/12/11
[ "https://Stackoverflow.com/questions/358654", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35425/" ]
358,663
<p>this question can create a misunderstanding: I know I have to use CSS to validate successfully my document as XHTML 1.0 Transitional. The fact is that I have to embed in my webpage a picture composed by zeros and ones created with <a href="http://www.text-image.com/index.html" rel="noreferrer" title="text image">text image</a>, and the problem is that the code uses deprecated tag font and looks like this</p> <pre><code>&lt;!-- IMAGE BEGINS HERE --&gt; &lt;pre&gt; &lt;font size="-3"&gt; &lt;font color="#000000"&gt;0001100000101101100011&lt;/font&gt; &lt;font color="#010000"&gt;00&lt;/font&gt; &lt;font color="#020101"&gt;0&lt;/font&gt; &lt;font color="#040101"&gt;0&lt;/font&gt; &lt;font color="#461919"&gt;1&lt;/font&gt; &lt;font color="#b54f4f"&gt;1&lt;/font&gt; ...etc.etc... &lt;/font&gt; &lt;/pre&gt; &lt;!-- IMAGE ENDS HERE --&gt; </code></pre> <p>(In this code example I inserted a newline after each couple of tags to make it more readable, but the original code is all in one line because of the <code>&lt;pre&gt;</code> tag). The font's color changes at least thousands times so I never considered to create a field in the CSS for each combination.Hope someone knows at least where to find a solution, I searched everywhere :) Thanks</p>
[ { "answer_id": 358667, "author": "Ryan Doherty", "author_id": 956, "author_profile": "https://Stackoverflow.com/users/956", "pm_score": 6, "selected": true, "text": "<font color=\"#000000\">0001100000101101100011</font>" }, { "answer_id": 358703, "author": "BraveSirFoobar", ...
2008/12/11
[ "https://Stackoverflow.com/questions/358663", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41977/" ]
358,681
<p>I'm trying to generate my models from a schema.xml file on OSX 10.5 with the latest versions of PHP &amp; Propel 1.3 &amp; Phing. All the model classes actually get created, then it just dies, right at the last step. I have already tried </p> <blockquote> <p>chmod -R 777 ./application/config</p> </blockquote> <p>but that didn't help. I have also tried both </p> <blockquote> <p>propel-gen ./ reverse</p> </blockquote> <p>and </p> <blockquote> <p>propel-gen ./ creole</p> </blockquote> <p>Both produced the same error. This error: </p> <pre><code>propel &gt; convert-conf: [echo] Output file: models-conf.php [echo] XMLFile: /application/config/runtime-conf.xml Execution of target "convert-conf" failed for the following reason: pear/data/propel_generator/build-propel.xml:514:20: No valid xmlConfFile specified. [phingcall] /pear/data/propel_generator/build-propel.xml:514:20: No valid xmlConfFile specified. Execution of target "main" failed for the following reason: pear/data/propel_generator/build-propel.xml:94:18: Execution of the target buildfile failed. Aborting. [phing] pear/data/propel_generator/build-propel.xml:94:18: Execution of the target buildfile failed. Aborting. BUILD FINISHED </code></pre> <p>Here is my build.properties file:</p> <pre><code>propel.project = models propel.database = mysql propel.database.encoding = utf8 propel.database.url = mysql:host=localhost;dbname={$myDBName} propel.database.user = {$myDBuser} propel.database.password = {$myDBpass} propel.output.dir = /application propel.php.dir = ${propel.output.dir}/ propel.sql.dir = ${propel.output.dir}/models/sql propel.schema.dir = ${propel.output.dir}/config propel.conf.dir = ${propel.output.dir}/config propel.phpconf.dir = ${propel.output.dir}/config propel.addGenericAccessors = true </code></pre> <p>Any ideas?</p>
[ { "answer_id": 360603, "author": "lo_fye", "author_id": 3407, "author_profile": "https://Stackoverflow.com/users/3407", "pm_score": 2, "selected": true, "text": "<datasource id=\"models\"> <!-- this ID must match <database name=\"\"> in schema.xml -->\n" }, { "answer_id": 3248287...
2008/12/11
[ "https://Stackoverflow.com/questions/358681", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3407/" ]
358,687
<p>I currently have a database that is 20GB in size. I've run a few scripts which show on each tables size (and other incredibly useful information such as index stuff) and the biggest table is 1.1 million records which takes up 150MB of data. We have less than 50 tables most of which take up less than 1MB of data.</p> <p>After looking at the size of each table I don't understand why the database shouldn't be 1GB in size after a shrink. The amount of available free space that SqlServer (2005) reports is 0%. The log mode is set to simple. At this point my main concern is I feel like I have 19GB of unaccounted for used space. Is there something else I should look at?</p> <p>Normally I wouldn't care and would make this a passive research project except this particular situation calls for us to do a backup and restore on a weekly basis to put a copy on a satellite (which has no internet, so it must be done manually). I'd much rather copy 1GB (or even if it were down to 5GB!) than 20GB of data each week.</p> <p>sp_spaceused reports the following:</p> <pre><code>Navigator-Production 19184.56 MB 3.02 MB </code></pre> <p>And the second part of it:</p> <pre><code>19640872 KB 19512112 KB 108184 KB 20576 KB </code></pre> <p>while I've found a few other scripts (such as the one from two of the server database size questions here, they all report the same information either found above or below). The script I am using is from SqlTeam. Here is the header info:</p> <pre><code>* BigTables.sql * Bill Graziano (SQLTeam.com) * graz@&lt;email removed&gt; * v1.11 </code></pre> <p>The top few tables show this (table, rows, reserved space, data, index, unused, etc):</p> <pre><code>Activity 1143639 131 MB 89 MB 41768 KB 1648 KB 46% 1% EventAttendance 883261 90 MB 58 MB 32264 KB 328 KB 54% 0% Person 113437 31 MB 15 MB 15752 KB 912 KB 103% 3% HouseholdMember 113443 12 MB 6 MB 5224 KB 432 KB 82% 4% PostalAddress 48870 8 MB 6 MB 2200 KB 280 KB 36% 3% </code></pre> <p>The rest of the tables are either the same in size or smaller. No more than 50 tables.</p> <p>Update 1: - All tables use unique identifiers. Usually an int incremented by 1 per row.</p> <ul> <li><p>I've also re-indexed everything.</p></li> <li><p>I ran the dbcc shrink command as well as updating the usage before and after. And over and over. An interesting thing I found is that when I restarted the server and confirmed <em>no one</em> was using it (and no maintenance procs are running, this is a very new application -- under a week old) and when I went to run the shrink, every now and then it would say something about data changed. Googling yielded too few useful answers with the obvious not applying (it was 1am and I disconnected everyone, so it seems impossible that was really the case). The data was migrated via C# code which basically looked at another server and brought things over. The quantity of deletes, at this point in time, are probably under 50k in rows. Even if those rows were the biggest rows, that wouldn't be more than 100M I would imagine.</p></li> <li><p>When I go to shrink via the GUI it reports 0% available to shrink, indicating that I've already gotten it as small as it thinks it can go.</p></li> </ul> <p>Update 2:</p> <ul> <li><p>sp_spaceused 'Activity' yields this (which seems right on the money):</p> <p>Activity 1143639 134488 KB 91072 KB 41768 KB 1648 KB</p></li> <li><p>Fill factor was 90.</p></li> <li><p>All primary keys are ints.</p></li> <li><p>Here is the command I used to 'updateusage':</p> <p>DBCC UPDATEUSAGE(0);</p></li> </ul> <p>Update 3:</p> <ul> <li>Per Edosoft's request: Image 111975 2407773 19262184 It appears as though the image table believes it's the 19GB portion. I don't understand what this means though. Is it <em>really</em> 19GB or is it misrepresented?</li> </ul> <p>Update 4:</p> <ul> <li>Talking to a co-worker and I found out that it's because of the pages, as someone else here has also state the potential for that. The only index on the image table is a clustered PK. Is this something I can fix or do I just have to deal with it? The regular script shows the Image table to be 6MB in size.</li> </ul> <p>Update 5:</p> <ul> <li>I think I'm just going to have to deal with it after further research. The images have been resized to be roughly 2-5KB each and on a normal file system doesn't consume much space but on SqlServer it seems to consume considerably more. The real answer, in the long run, will likely be separating that table in to another partition or something similar.</li> </ul>
[ { "answer_id": 358707, "author": "Bernhard Hofmann", "author_id": 39722, "author_profile": "https://Stackoverflow.com/users/39722", "pm_score": 1, "selected": false, "text": "DECLARE @DbName NVARCHAR(128)\nSET @DbName = DB_NAME(DB_ID())\nDBCC UPDATEUSAGE(@DbName)\n" }, { "answer_...
2008/12/11
[ "https://Stackoverflow.com/questions/358687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18217/" ]
358,700
<p>I have 3 projects in my VS solution. One of them is a Web app, the second one is a Windows Service and the last one a Setup project for my Web app. </p> <p>What I want is by the end of the installation of the web app in my setup project, within my custom action to try and install my windows service given that I have the location of the assembly by then.</p>
[ { "answer_id": 358704, "author": "lakshmanaraj", "author_id": 44541, "author_profile": "https://Stackoverflow.com/users/44541", "pm_score": 5, "selected": false, "text": "System.Configuration.Install" }, { "answer_id": 637728, "author": "Konstantinos", "author_id": 17443,...
2008/12/11
[ "https://Stackoverflow.com/questions/358700", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17443/" ]
358,714
<p>I know that in C#, if you write <code>~MyClass()</code>, this basically translates to <code>override System.Object.Finalize()</code>. So, whether you write the <em>destructor</em> or not, every type in CLR will have a <code>Finalize()</code> method in it (of <code>System.Object</code> at least).</p> <p>1] So, does it mean that, every object, by default, <strong>has</strong> a finalizer ?</p> <p>2] What is the basis for the CLR to decide that an object should be put through finalization queue ? </p> <p>I'm asking this, because, I had a class, say <code>ManagedResourceHolder</code> that implemented <code>IDisposable</code>, but did not call <code>GC.SuppressFinalize(this)</code> in its <code>IDisposable.Dispose()</code> method. The class did not hold any unmanaged resources, and there was no need for the <code>~ManagedResourceHolder()</code> method, which in turn meant no need for the <code>GC.SuppressFinalize(this)</code> call as there was no <em>finalizer</em>.</p> <p>3] In context of the above scenario, is it <strong>always</strong> necessary to provide a finalizer when you implement IDisposable ? (even on a class that holds no unmanaged resources)</p> <p>The FxCop rule <a href="http://msdn.microsoft.com/en-us/library/ms182269.aspx" rel="noreferrer">CA1816</a> was giving me a violation on this and the response I got <a href="http://social.msdn.microsoft.com/Forums/en-US/vstscode/thread/4e8a3155-6f12-4888-9ca1-f6762761e038" rel="noreferrer">here</a> when I asked in the CA forum on MSDN confused me.</p> <p>Thanks.</p>
[ { "answer_id": 358715, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 0, "selected": false, "text": "Finalize()" }, { "answer_id": 358716, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https:...
2008/12/11
[ "https://Stackoverflow.com/questions/358714", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42913/" ]
358,718
<p>I have a fairly expensive array calculation (SpectralResponse) which I like to keep to a minimum. I figured the best way is to store them and bring it back up when same array is needed again in the future. The decision is made using BasicParameters.</p> <p>So right now, I use a LinkedList of object for the arrays of SpectralResponse, and another LinkedList for the BasicParameter. And the BasicParameters has a isParamsEqualTo(BasicParameters) method to compare the parameter set.</p> <pre><code>LinkedList&lt;SpectralResponse&gt; responses LinkedList&lt;BasicParameters&gt; fitParams LinkedList&lt;Integer&gt; responseNumbers </code></pre> <p>So to look up, I just go through the list of BasicParameters, check for match, if matched, return the SpectralResponse. If no match, then calculate the SpectralResponse. </p> <p>Here's is the for loop I used to lookup. </p> <pre><code>size: LinkedList size, limited to a reasonable value responseNumber: just another variable to distinguish the SpectralResponse. for ( i = size-1; i &gt; 0 ; i--) { if (responseNumbers.get(i) == responseNum) { tempFit = fitParams.get(i); if (tempFit.isParamsEqualTo(fit)) { return responses.get(i); } } } </code></pre> <p>But somehow, doing it this way no only take out lots of memory, it's actually slower than just calculating SpectralResponse straight. Much slower.</p> <p>So it is my implementation that's wrong, or I was mistaken that precalculating and lookup is faster?</p>
[ { "answer_id": 376220, "author": "Nicholas White", "author_id": 42543, "author_profile": "https://Stackoverflow.com/users/42543", "pm_score": 0, "selected": false, "text": "if (responseNumbers.get(i) == responseNum)" } ]
2008/12/11
[ "https://Stackoverflow.com/questions/358718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9774/" ]
358,721
<p>I have a scenario when I start 3..10 threads with ThreadPool. Each thread does its job and returns to the ThreadPool. What are possible options to be notified in main thread when all background threads have finished?</p> <p>Currently I'm using a homegrown method with incrementing a variable for each of created threads and decrementing it when a background thread is about to finish. This works just fine, but I was curious if there are better options.</p>
[ { "answer_id": 358733, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 5, "selected": true, "text": "Interlocked.Decrement" }, { "answer_id": 358879, "author": "DonkeyMaster", "author_id": 5178, "aut...
2008/12/11
[ "https://Stackoverflow.com/questions/358721", "https://Stackoverflow.com", "https://Stackoverflow.com/users/430254/" ]
358,730
<p>I have a jsp page with two radio tags. </p> <p>The page contains a struts2 form. When I submit the form one of two radio must be automatically checked.</p> <p>Is it possible to do that?</p>
[ { "answer_id": 358749, "author": "annakata", "author_id": 13018, "author_profile": "https://Stackoverflow.com/users/13018", "pm_score": 3, "selected": true, "text": "checked=\"checked\"" }, { "answer_id": 358750, "author": "VonC", "author_id": 6309, "author_profile": ...
2008/12/11
[ "https://Stackoverflow.com/questions/358730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39339/" ]
358,760
<p>I am implementing a database design that has a vehicle table, vehicle engine and vehicle gear table with SQL 2005.</p> <p>Each table has an ID that is a SQL identity number, and each engine and gear has a relation with the vehicle ID. So before I create a vehicle I must create an engine and gear.</p> <p>How could I know the vehicle identity number when creating the engine and gear? The vehicle row hasn't yet been created because of the foreign key constraint with the engine and gear tables?</p> <p>Should I implement an automatic trigger that on a creation of a vehicle creates an empty row for the engine and gear linked to the vehicle? But again how could I know the vehicle ID?</p>
[ { "answer_id": 358863, "author": "Carl", "author_id": 2136, "author_profile": "https://Stackoverflow.com/users/2136", "pm_score": 0, "selected": false, "text": "CREATE VIEW VehicleComplete AS SELECT * FROM Vehicle INNER JOIN VehicleEngine USING(VehicleID)\n\nUPDATE VehicleComplete SET Re...
2008/12/11
[ "https://Stackoverflow.com/questions/358760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38963/" ]
358,764
<p>I need to exclude files with the following pattern:</p> <p>ProjectFoo.Data[0-9]{14}.lgp</p> <p>How can I use RegEx for (Visual)SVN ignore list?</p>
[ { "answer_id": 358928, "author": "Bert Huijben", "author_id": 2094, "author_profile": "https://Stackoverflow.com/users/2094", "pm_score": 4, "selected": true, "text": "ProjectFoo.Data[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].lgp\n" } ]
2008/12/11
[ "https://Stackoverflow.com/questions/358764", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2104/" ]
358,772
<p>With Symfony's Action Security if a user has not been identified he will be forwarded to the default login action as defined in the applications settings.yml file. How would I forward the user to the originally requested action after the user is successfully authenticated?</p>
[ { "answer_id": 364228, "author": "deresh", "author_id": 11851, "author_profile": "https://Stackoverflow.com/users/11851", "pm_score": 4, "selected": true, "text": "if(!$this->getUser()->hasParameter('referer'))\n{\n $this->getUser()->setParameter('referer',$this->getRequest()->getRefere...
2008/12/11
[ "https://Stackoverflow.com/questions/358772", "https://Stackoverflow.com", "https://Stackoverflow.com/users/200521/" ]
358,780
<p>I have a method, which will accept a parameter of a JQuery Object and will calculate totals for a section. So if you give it a JQuery Object of a div containing the section it will calculate a total for it</p> <p>so you can do this:</p> <p>var $totalcompletion = CalculateSectionCompletion(jQuery("#Section1"));</p> <p>Now I have multiple divs with the class of section container. I want to be able to call the above method on any div with that class.</p> <p>I'm doing this:</p> <p>jQuery("div.SectionContainer").each( function(i, valueOfElement){<br> CalculateSectionCompletion(valueOfElement);<br> });</p> <p>The problem is the valueOfElement is actually the DOM object and not the JQuery Object, so I can't pass this in to my method.</p> <p>Is there anyway I can loop through all JQuery Objects selected by a query, without writing some dirty code to extract the Id from the DOM object, and call JQuery(valueOfElement.id) and pass it in?</p>
[ { "answer_id": 358806, "author": "Strelok", "author_id": 2788, "author_profile": "https://Stackoverflow.com/users/2788", "pm_score": 3, "selected": true, "text": "jQuery(\"div.SectionContainer\").each( function(i, valueOfElement){\n CalculateSectionCompletion($(valueOfElement));\n});\n"...
2008/12/11
[ "https://Stackoverflow.com/questions/358780", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45279/" ]
358,783
<p>I have a script which uses pexpect to start a CLI program. It works a bit like a shell where you get a prompt where you can enter some commands.</p> <p>The problem I have, I think, is that this program uses a coloured prompt.</p> <p>This is what I do </p> <pre><code>import pprint import pexpect 1 a = pexpect.spawn('program') 2 a.expect("prompt&gt;") 3 print "---------start------------" 4 print(a.before) 5 a.sendline("command") 6 a.expect("prompt&gt;") 7 print "---------before------------" 8 pprint.pprint(a.before) 9 print "---------after------------" 10 pprint.pprint(a.after) </code></pre> <p>This is the output:</p> <pre><code>&gt; python borken.py ---------start------------ A lot of text here from the enjoying programs start-up, lorem ipsum ... ---------before------------ ' \x1b[0m\x1b[8D\x1b[K\x1b[1m\x1b[34m' ---------after------------ 'prompt&gt;' </code></pre> <p>For some reason the first prompt colour coding borkens up things and a.before at line 8 is garbled, normal print does not work, even if I see that the command at line 5 actually produced a lot of output.</p> <p>Does someone know what the problem could be, or is it possible to set the terminal type in pexpect to avoid the colours?</p> <p>I am using tcsh shell</p>
[ { "answer_id": 358794, "author": "csl", "author_id": 21028, "author_profile": "https://Stackoverflow.com/users/21028", "pm_score": 2, "selected": false, "text": "shell_cmd = 'ls -l | grep LOG > log_list.txt'\nchild = pexpect.spawn('/bin/bash', ['-c', shell_cmd])\nchild.expect(pexpect.EOF...
2008/12/11
[ "https://Stackoverflow.com/questions/358783", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12126/" ]
358,786
<p>What are the patterns and dos and don'ts when one is writing tests for <a href="http://javolution.org/" rel="nofollow noreferrer">Javolution</a> tests? In particular I was wondering:</p> <ul> <li>TestCase.execute() does not allow throwing of exceptions. How to deal with them? Rethrow as RuntimeException or store in a variable and assert in TestCase.validate() or something?</li> <li>Are there any graphical runners that show you the tests that fail, i.e. in Eclipse? Perhaps someone wrote a JUnit-Wrapper such that I could use the Eclipse JUnit Runner?</li> </ul>
[ { "answer_id": 385911, "author": "Hans-Peter Störr", "author_id": 21499, "author_profile": "https://Stackoverflow.com/users/21499", "pm_score": 0, "selected": false, "text": "protected final javolution.testing.TestCase test;\n\npublic JavolutionJUnit4Adapter(javolution.testing.TestCase t...
2008/12/11
[ "https://Stackoverflow.com/questions/358786", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21499/" ]
358,788
<p>I've problem with sending HTML mails with <a href="http://phpmailer.worxware.com/index.php?pg=phpmailer" rel="nofollow noreferrer">PHPMailer</a>. I make a <a href="http://en.wikipedia.org/wiki/Smarty" rel="nofollow noreferrer">Smarty</a> template and I got all the HTML code from it. But when I send mail, I got the mail without included CSS (it's only background-color, font or something like that). In PHPMailer I set that the mail is HTML.</p> <p>Is there any way to send HTML mail with included CSS?</p>
[ { "answer_id": 2209829, "author": "useless", "author_id": 267351, "author_profile": "https://Stackoverflow.com/users/267351", "pm_score": 3, "selected": false, "text": " $body = <<< YOUR_HTML_WITH_CSS_STYLE_TAGS\n<html>\n<head>\n <style>\n body * {width:1px;}\n #adiv ...
2008/12/11
[ "https://Stackoverflow.com/questions/358788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/461736/" ]
358,789
<p>We are having a problem where IE6 (the only browser we have noticed this happening on) seems to be caching an empty version of our main stylesheet. The only way to resolve the problem is to request the stylesheet directly by typing the its url directly into the browser, and then when you refresh the page, it will appear with the styles. About a week or so later, it will happen again.</p> <p>This isn't happening to all users, but we can't figure out why it is happening.</p> <p>We are running IIS on Server 2003, and this problem started happening a couple of months ago (never had any problems before that).</p> <p>I appreciate any help you can offer.</p> <p>Paul</p> <p>*I have looked closer and now it is doing the same for certain Javascripts as well.</p> <ul> <li>12-12-2008</li> </ul> <p>Thanks for the help Grant, IE is fairly locked down, but have checked what can be changed and it is fine, and no extra plug-ins are installed.</p> <p>If you Ctrl-F5 or kill the temp files it doesn't seem to do anything. It's not until you request the file directly that it actually it actually fixes the problem which does indicate that there is a problem with IE caching a broken or empty version. Unfortunately, I must now wait until it happens again and I'm going to check the log files on the server.</p> <p>Again thanks for the help.</p>
[ { "answer_id": 360240, "author": "Grant Wagner", "author_id": 9254, "author_profile": "https://Stackoverflow.com/users/9254", "pm_score": 1, "selected": false, "text": "Content-type" } ]
2008/12/11
[ "https://Stackoverflow.com/questions/358789", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
358,791
<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" &gt; &lt;head runat="server"&gt; &lt;title&gt;Untitled Page&lt;/title&gt; &lt;link href="Stylesheet.css" rel="stylesheet" type="text/css" /&gt; &lt;/head&gt; &lt;body&gt; &lt;table style="height: 100%; width: 100%;"&gt; &lt;tr&gt; &lt;td colspan="2" style="height: 100px;"&gt;Header&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="width: 180px;"&gt;Links&lt;/td&gt; &lt;td&gt;Content&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan="2" style="height: 25px;"&gt;Footer&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Stylesheet.css looks as follows:</p> <pre><code>* { margin: 0; padding: 0; } html, body { height: 100%; width: 100%; } </code></pre> <p>Row 1 and 3 above have fixed heights. Row 3 is not filling the remaining space. If i omit the doctype, it works as expected. I need to use this doctype.</p>
[ { "answer_id": 358811, "author": "adam", "author_id": 33604, "author_profile": "https://Stackoverflow.com/users/33604", "pm_score": 1, "selected": false, "text": "<div>" }, { "answer_id": 453478, "author": "Kornel", "author_id": 27009, "author_profile": "https://Stack...
2008/12/11
[ "https://Stackoverflow.com/questions/358791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
358,792
<p>I'm writing a DLL which talks to Excel via its IDispatch interface. From VBA I pass in a Variant containing <code>Application.Caller</code> from which I draw the IDispatch pointer via <code>.pDispVal</code>. </p> <p>What I'd like to know is how to query the interface via that IDispatch pointer. I want to set up a connection point container, and from there find a connection point to Excel. The ultimate goal is to tie things to Excel's Calculate event and be able to manipulate the Excel data.</p>
[ { "answer_id": 358811, "author": "adam", "author_id": 33604, "author_profile": "https://Stackoverflow.com/users/33604", "pm_score": 1, "selected": false, "text": "<div>" }, { "answer_id": 453478, "author": "Kornel", "author_id": 27009, "author_profile": "https://Stack...
2008/12/11
[ "https://Stackoverflow.com/questions/358792", "https://Stackoverflow.com", "https://Stackoverflow.com/users/426/" ]
358,793
<p>I am looking for a specific desgin pattern.</p> <p>For example i have an article class, clsArticle. This class contains member variables like Id, title, author, article, and so on. Imagine i want to show all the articles in a list. So somewhere i have to create a method getAllArticles(). Since clsArticle is not responsible for getting all the articles, i have to put this method in another class, clsArticleFact (Where Fact stands for Factory).</p> <p>Does someone know how this pattern is called? Is this way of working a design pattern?</p>
[ { "answer_id": 358817, "author": "OscarRyz", "author_id": 20654, "author_profile": "https://Stackoverflow.com/users/20654", "pm_score": 3, "selected": true, "text": "ArticleFactory.getAll(): Article[]\n" }, { "answer_id": 358858, "author": "Claymore", "author_id": 7510, ...
2008/12/11
[ "https://Stackoverflow.com/questions/358793", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40676/" ]
358,797
<p>I am working on an application where i need to transfer mails from a mailbox to anoter one.I can not send these mails using smtp because this willchange the header information .I am using C# and out look api to process mails . is thre any way i can transfer mails to other mail box without changing mail header.</p> <hr> <p>By Transfer I mean, I need to take a mail from one mail box and move this to another mailbox without changing any header information. If I use smtp , header information will be changed. I have heared that using MAPI mail can be moved from one mail box to another mail box. any pointers.</p>
[ { "answer_id": 360354, "author": "Oliver Giesen", "author_id": 9784, "author_profile": "https://Stackoverflow.com/users/9784", "pm_score": 0, "selected": false, "text": "MailItem.Move" }, { "answer_id": 374136, "author": "Kapil", "author_id": 45280, "author_profile": ...
2008/12/11
[ "https://Stackoverflow.com/questions/358797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45280/" ]
358,802
<p>In our project I have several <a href="http://www.junit.org/" rel="noreferrer">JUnit</a> tests that e.g. take every file from a directory and run a test on it. If I implement a <code>testEveryFileInDirectory</code> method in the <code>TestCase</code> this shows up as only one test that may fail or succeed. But I am interested in the results on each individual file. How can I write a <code>TestCase</code> / <code>TestSuite</code> such that each file shows up as a separate test e.g. in the graphical TestRunner of Eclipse? (Coding an explicit test method for each file is not an option.)</p> <p>Compare also the question <a href="https://stackoverflow.com/questions/385925/parameterizedtest-with-a-name-in-eclipse-testrunner">ParameterizedTest with a name in Eclipse Testrunner</a>.</p>
[ { "answer_id": 358884, "author": "Michael Borgwardt", "author_id": 16883, "author_profile": "https://Stackoverflow.com/users/16883", "pm_score": 2, "selected": false, "text": "TestSuite" }, { "answer_id": 358926, "author": "bruno conde", "author_id": 31136, "author_pr...
2008/12/11
[ "https://Stackoverflow.com/questions/358802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21499/" ]
358,821
<p>I've just started to use linq to sql and have run into a problem with inserting a record with an auto incrementing field.</p> <p>I have created a new instance of a company object defined by linq. it has initialised an auto incrementing field 'companyID' to 0. InsertOnSubmit() fails with the following invalidOperationException.</p> <blockquote> <p>Incorrect autosync specification for member 'companyID'</p> </blockquote> <p>the column attribute IsDbGenerated is true for the companyID property. I am using sql server 2000.</p> <p>Edit: Auto-sync is set to OnIsert. The dataype is BigInt in TSQL, long in c#.</p> <p>Does anyone know why this error is occuring and how it can be resolved?</p> <p>thanks</p>
[ { "answer_id": 4000204, "author": "ingamx", "author_id": 484589, "author_profile": "https://Stackoverflow.com/users/484589", "pm_score": 2, "selected": false, "text": "\"OnInsert\"" } ]
2008/12/11
[ "https://Stackoverflow.com/questions/358821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18966/" ]
358,826
<p>I've been trying to fix this for two hours straight and I can't figure it out.</p> <pre><code>onclick = "location='exceltest.asp?vanjaar=&lt;%=vanjaar%&gt;&amp;vanmaand=&lt;%=vanmaand%&gt;&amp;vandag=&lt;%=vandag%&gt;&amp;totjaar=&lt;%=totjaar%&gt;&amp;totmaand=&lt;%=totmaand%&gt;&amp;totdag=&lt;%=totdag%&gt;'" </code></pre> <p>That line of code is in an &lt; input type="button" /> attribute. The button links to a page where an Excel download should be triggered. The values in the URL are from- and to-date-parts. (year, month, day)</p> <p>this:</p> <pre><code>onclick = "location='exceltest.asp?fromdate=&lt;%=fromdate%&gt;&amp;todate=&lt;%=todate%&gt;'" /&gt; </code></pre> <p>does not work, because somehow IE7 reads the date (eg. 2008/1/1) wrong. Something to do with the slashes I think. </p> <p>But when I try to click the button in IE and thus download the generated file, Internet explorer tries do download the file </p> <blockquote> <p>exceltest.asp?vanjaar=2008vanmaand=1vandag=1totjaar=2008totmaand=2totdag=1</p> </blockquote> <p>instead of the excel file I want.<br> FF offers to download the excelfile, but gives (in that excelfile) an overview of an htmlpage with an errormessage telling me my query is wrong (Item cannot be found in the collection corresponding to the requested name or ordinal.) But that CAN'T be, I'm using that exact same query elsewhere, using the same (but restarted) connection.</p> <p>This is the bit of code I use to instantiate the download of the file:</p> <pre><code>Response.Buffer = TRUE Response.ContentType = "application/vnd.ms-excel" Response.AddHeader "content-disposition", "attachment; filename=overicht.xls" </code></pre> <p>There might actually being to things going on here, but I am most insterested in why IE wants to download the asp page and FF offers the right download.</p>
[ { "answer_id": 358853, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 2, "selected": false, "text": "&" }, { "answer_id": 358861, "author": "Jonathan Lonowski", "author_id": 15031, "author_profile": "https:...
2008/12/11
[ "https://Stackoverflow.com/questions/358826", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42389/" ]
358,834
<p>If I want to create a .NET object in the powershell I write something like the following:</p> <pre><code>[System.Reflection.Assembly]::LoadWithPartialName("System.Xml") | out-null" $doc = new-object -typename System.Xml.XmlDocument" </code></pre> <p>If I want to call a static .Net method I use a command similar to the following line:</p> <pre><code>$path = [System.String]::Format("{0} {1}", "Hello", "World") </code></pre> <p>I don't see the rule behind that. If it works in the first example, why can't I use <code>System.String.Format</code> in the second one?</p>
[ { "answer_id": 358919, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 2, "selected": false, "text": "// type \"Assembly\" in the \"System.Reflection\" namespace\n[System.Reflection.Assembly] \n\n// member method \"LoadWithP...
2008/12/11
[ "https://Stackoverflow.com/questions/358834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
358,835
<p>Assuming the following hypothetical inheritance hierarchy:</p> <pre><code>public interface IA { int ID { get; set; } } public interface IB : IA { string Name { get; set; } } </code></pre> <p>Using reflection and making the following call: </p> <pre><code>typeof(IB).GetProperties(BindingFlags.Public | BindingFlags.Instance) </code></pre> <p>will only yield the properties of interface <code>IB</code>, which is "<code>Name</code>". </p> <p>If we were to do a similar test on the following code,</p> <pre><code>public abstract class A { public int ID { get; set; } } public class B : A { public string Name { get; set; } } </code></pre> <p>the call <code>typeof(B).GetProperties(BindingFlags.Public | BindingFlags.Instance)</code> will return an array of <code>PropertyInfo</code> objects for "<code>ID</code>" and "<code>Name</code>".</p> <p>Is there an easy way to find all the properties in the inheritance hierarchy for interfaces as in the first example?</p>
[ { "answer_id": 358857, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": false, "text": "interface ILow { void Low();}\ninterface IFoo : ILow { void Foo();}\ninterface IBar { void Bar();}\ninterface ITest :...
2008/12/11
[ "https://Stackoverflow.com/questions/358835", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31770/" ]
358,874
<p>I'm currently adding verbose tooltips to our site, and I'd like (without having to resort to a whizz-bang jQuery plugin, I know there are many!) to use carriage returns to format the tooltip.</p> <p>To add the tip I'm using the <code>title</code> attribute. I've looked around the usual sites and using the basic template of:</p> <pre><code>&lt;a title='Tool?Tip?On?New?Line'&gt;link with tip&lt;/a&gt; </code></pre> <p>I've tried replacing the <code>?</code> with:</p> <ul> <li><code>&lt;br /&gt;</code></li> <li><code>&amp;013; / &amp;#13;</code></li> <li><code>\r\n</code></li> <li><code>Environment.NewLine</code> (I'm using C#)</li> </ul> <p>None of the above works. Is it possible?</p>
[ { "answer_id": 358880, "author": "Stefan Mai", "author_id": 13257, "author_profile": "https://Stackoverflow.com/users/13257", "pm_score": 7, "selected": false, "text": "&#10;" }, { "answer_id": 358885, "author": "Greg Dean", "author_id": 1200558, "author_profile": "ht...
2008/12/11
[ "https://Stackoverflow.com/questions/358874", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32027/" ]
358,891
<p>I want another developer to run a Perl script I have written. The script uses many CPAN modules that have to be installed before the script can be run. Is it possible to make the script (or the <code>perl</code> binary) to dump a list of all the missing modules? Perl prints out the missing modules’ names when I attempt to run the script, but this is verbose and does not list all the missing modules at once. I’d like to do something like:</p> <pre><code>$ cpan -i `said-script --list-deps` </code></pre> <p>Or even:</p> <pre><code>$ list-deps said-script &gt; required-modules # on my machine $ cpan -i `cat required-modules` # on his machine </code></pre> <p>Is there a simple way to do it? This is not a show stopper, but I would like to make the other developer’s life easier. (The required modules are sprinkled across several files, so that it’s not easy for me to make the list by hand without missing anything. I know about <a href="http://search.cpan.org/~smueller/PAR-0.983/lib/PAR.pm" rel="noreferrer">PAR</a>, but it seems a bit too complicated for what I want.)</p> <hr/> <p><strong>Update:</strong> Thanks, Manni, that will do. I did not know about <code>%INC</code>, I only knew about <code>@INC</code>. I settled with something like this:</p> <pre><code>print join("\n", map { s|/|::|g; s|\.pm$||; $_ } keys %INC); </code></pre> <p>Which prints out:</p> <pre><code>Moose::Meta::TypeConstraint::Registry Moose::Meta::Role::Application::ToClass Class::C3 List::Util Imager::Color … </code></pre> <p>Looks like this will work.</p>
[ { "answer_id": 358959, "author": "innaM", "author_id": 7498, "author_profile": "https://Stackoverflow.com/users/7498", "pm_score": 5, "selected": true, "text": "%INC" }, { "answer_id": 360423, "author": "brian d foy", "author_id": 2766176, "author_profile": "https://S...
2008/12/11
[ "https://Stackoverflow.com/questions/358891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17279/" ]
358,894
<p>I am wondering if Unittesting and using statements can really go hand in hand as there is no way to mock the disposable object instantiated in the using statement. How would I be able to effectively unittest a method containing the following using statement?</p> <pre> public void MyMethod() { using(MyDisposableClass disp = new MyDisposableClass()) { ... } } </pre> <p>Are using statements simply forbidden when you are unit-testing?</p> <p>Any comments appreciated.</p>
[ { "answer_id": 359013, "author": "Gishu", "author_id": 1695, "author_profile": "https://Stackoverflow.com/users/1695", "pm_score": 2, "selected": false, "text": "interface IResource : IDisposable\n{\n void DoSomething();\n}\n\nclass DisposableResource : IResource\n{\n public vo...
2008/12/11
[ "https://Stackoverflow.com/questions/358894", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32313/" ]
358,912
<p>I have a string. I need to replace all instances of a given array of strings from this original string - how would I do that?</p> <p>Currently I am using...</p> <pre><code>var inputString = "this is my original string."; var replacement = ""; var pattern = string.Join("|", arrayOfStringsToRemove); Regex.Replace(inputString, pattern, replacement); </code></pre> <p>This works fine, but unfortunately it breaks down when someone tries to remove a character that has a special meaning in the regex.</p> <p>How should I do this? Is there a better way?</p>
[ { "answer_id": 358917, "author": "adam", "author_id": 33604, "author_profile": "https://Stackoverflow.com/users/33604", "pm_score": 0, "selected": false, "text": "\\\n" }, { "answer_id": 358923, "author": "muhuk", "author_id": 42188, "author_profile": "https://Stackov...
2008/12/11
[ "https://Stackoverflow.com/questions/358912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39561/" ]
358,927
<p>I have a table called ApprovalTasks... Approvals has a status column</p> <p>I also have a view called ApprovalsView</p> <p>When I try a straight update :</p> <pre><code>update ApprovalTasks set Status = 2 where ApprovalTaskID = 48 </code></pre> <p>I'm getting this error message: </p> <pre><code>Msg 2601, Level 14, State 1, Line 1 Cannot insert duplicate key row in object 'dbo.ApprovalsView' with unique index 'IX_ApprovalTaskID'. The statement has been terminated. </code></pre> <p>Any idea why this is happening?</p> <p>Here is the create table script:</p> <pre><code>USE [CSPMOSSApplication] GO /****** Object: Table [dbo].[ApprovalTasks] Script Date: 12/11/2008 12:41:35 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[ApprovalTasks]( [ApprovalTaskID] [int] IDENTITY(1,1) NOT NULL, [ApproverID] [int] NOT NULL, [DueDate] [datetime] NULL, [Status] [smallint] NOT NULL, [ApprovedRejectedDate] [datetime] NULL, [Reason] [nvarchar](1024) COLLATE Finnish_Swedish_CI_AS NULL, [OrganizationID] [int] NOT NULL, [TicketID] [int] NOT NULL, [Link] [nchar](255) COLLATE Finnish_Swedish_CI_AS NULL, [GlobalApproverID] [int] NULL, CONSTRAINT [PK_Approval_Tasks] PRIMARY KEY CLUSTERED ( [ApprovalTaskID] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] GO USE [CSPMOSSApplication] GO ALTER TABLE [dbo].[ApprovalTasks] WITH NOCHECK ADD CONSTRAINT [FK_Approval_Tasks_ApprovalTaskStatuses] FOREIGN KEY([Status]) REFERENCES [dbo].[ApprovalTaskStatuses] ([ApprovalTaskStatusID]) GO ALTER TABLE [dbo].[ApprovalTasks] CHECK CONSTRAINT [FK_Approval_Tasks_ApprovalTaskStatuses] GO ALTER TABLE [dbo].[ApprovalTasks] WITH NOCHECK ADD CONSTRAINT [FK_Approval_Tasks_Organizations] FOREIGN KEY([OrganizationID]) REFERENCES [dbo].[Organizations] ([OrganizationID]) GO ALTER TABLE [dbo].[ApprovalTasks] CHECK CONSTRAINT [FK_Approval_Tasks_Organizations] GO ALTER TABLE [dbo].[ApprovalTasks] WITH NOCHECK ADD CONSTRAINT [FK_Approval_Tasks_Tickets] FOREIGN KEY([TicketID]) REFERENCES [dbo].[Tickets] ([TicketID]) GO ALTER TABLE [dbo].[ApprovalTasks] CHECK CONSTRAINT [FK_Approval_Tasks_Tickets] GO ALTER TABLE [dbo].[ApprovalTasks] WITH NOCHECK ADD CONSTRAINT [FK_Approval_Tasks_Users] FOREIGN KEY([ApproverID]) REFERENCES [dbo].[Users] ([UserID]) GO ALTER TABLE [dbo].[ApprovalTasks] CHECK CONSTRAINT [FK_Approval_Tasks_Users] </code></pre> <p>PK_Approval_Tasks(Clustered)</p> <pre><code>USE [CSPMOSSApplication] GO /****** Object: Index [PK_Approval_Tasks] Script Date: 12/11/2008 12:45:50 ******/ ALTER TABLE [dbo].[ApprovalTasks] ADD CONSTRAINT [PK_Approval_Tasks] PRIMARY KEY CLUSTERED ( [ApprovalTaskID] ASC )WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] </code></pre> <p>IX_ApprovalTaskID(Clsutered)</p> <pre><code>SE [CSPMOSSApplication] GO SET ARITHABORT ON GO SET CONCAT_NULL_YIELDS_NULL ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_NULLS ON GO SET ANSI_PADDING ON GO SET ANSI_WARNINGS ON GO SET NUMERIC_ROUNDABORT OFF GO /****** Object: Index [IX_ApprovalTaskID] Script Date: 12/11/2008 12:47:27 ******/ CREATE UNIQUE CLUSTERED INDEX [IX_ApprovalTaskID] ON [dbo].[ApprovalsView] ( [ApprovalTaskID] ASC )WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY] </code></pre> <p>Create View Script</p> <pre><code>USE [CSPMOSSApplication] GO -- ============================================= -- Script Template -- ============================================= -- [ApprovalTasks]: add columns Link, GlobalApproverID IF NOT EXISTS(SELECT 1 FROM sysobjects,syscolumns WHERE sysobjects.id = syscolumns.id AND sysobjects.name = 'ApprovalTasks' AND syscolumns.name = 'Link') BEGIN ALTER TABLE ApprovalTasks ADD [Link] [nchar] (255) COLLATE Finnish_Swedish_CI_AS NULL PRINT 'Column ApprovalTasks.Link was added.' END IF NOT EXISTS(SELECT 1 FROM sysobjects,syscolumns WHERE sysobjects.id = syscolumns.id AND sysobjects.name = 'ApprovalTasks' AND syscolumns.name = 'GlobalApproverID') BEGIN ALTER TABLE ApprovalTasks ADD [GlobalApproverID] [int] NULL PRINT 'Column ApprovalTasks.GlobalApproverID was added.' ALTER TABLE [dbo].[ApprovalTasks] WITH NOCHECK ADD CONSTRAINT [FK_Approval_Tasks_GlobalApproverID] FOREIGN KEY([GlobalApproverID]) REFERENCES [dbo].[Users] ([UserID]) ALTER TABLE [dbo].[ApprovalTasks] CHECK CONSTRAINT [FK_Approval_Tasks_GlobalApproverID] END -- [ApprovalsView] IF EXISTS (SELECT * FROM sys.fulltext_indexes fti WHERE fti.object_id = OBJECT_ID(N'[dbo].[ApprovalsView]')) BEGIN DROP FULLTEXT INDEX ON [dbo].[ApprovalsView] PRINT 'FULLTEXT INDEX on [ApprovalsView] was dropped.' END GO IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[ApprovalsView]') AND name = N'IX_ApprovalTaskID') BEGIN DROP INDEX IX_ApprovalTaskID ON [dbo].[ApprovalsView] WITH ( ONLINE = OFF ) PRINT 'INDEX IX_ApprovalTaskID was dropped.' END GO IF EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ApprovalsView]')) DROP VIEW [dbo].[ApprovalsView] SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE VIEW [dbo].[ApprovalsView] WITH SCHEMABINDING AS SELECT at.ApprovalTaskID, at.ApproverID, at.DueDate, at.Status, ats.ApprovalTaskStatusTranslationKey AS StatusText, at.ApprovedRejectedDate, at.Reason, at.OrganizationID, ord.Name AS OrderName, ord.TotalPrice, ord.SubmitDate, ord.OrdererID, usr.FirstName AS OrdererFirstName, usr.LastName AS OrdererLastName, ordi.Items_Name AS ItemName, ordi.Items_Description AS ItemDescription, ordi.OtherInformation AS ItemInformation, oir.RecipientFullName, CONVERT(nvarchar(250), oir.DeliveryAddress) As DeliveryAddress, ti.Description FROM dbo.ApprovalTasks at INNER JOIN dbo.ApprovalTaskStatuses ats ON ats.ApprovalTaskStatusID = at.Status INNER JOIN dbo.Orders_Items_Recipients oir ON oir.TicketID = at.TicketID INNER JOIN dbo.Orders_Items ordi ON ordi.Orders_ItemsID = oir.Orders_ItemsID INNER JOIN dbo.Orders ord ON ordi.OrderID = ord.OrderID INNER JOIN dbo.Users usr ON ord.OrdererID = usr.UserID INNER JOIN dbo.Tickets ti ON ti.TicketID = at.TicketID GO CREATE UNIQUE CLUSTERED INDEX [IX_ApprovalTaskID] ON [dbo].[ApprovalsView] ( [ApprovalTaskID] ASC )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY] GO CREATE FULLTEXT INDEX ON [dbo].[ApprovalsView]( [DeliveryAddress] LANGUAGE [Neutral], [ItemDescription] LANGUAGE [Neutral], [ItemInformation] LANGUAGE [Neutral], [ItemName] LANGUAGE [Neutral], [OrdererFirstName] LANGUAGE [Neutral], [OrdererLastName] LANGUAGE [Neutral], [OrderName] LANGUAGE [Neutral], [Reason] LANGUAGE [Neutral], [RecipientFullName] LANGUAGE [Neutral]) KEY INDEX [IX_ApprovalTaskID] ON [ApprovalSearchCatalog] WITH CHANGE_TRACKING AUTO GO ALTER FULLTEXT CATALOG [ApprovalSearchCatalog] rebuild PRINT 'Catalog [ApprovalSearchCatalog] task to rebuild fulltext index was sent.' -- STORED PROCEDURES IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ReceiveApprovalTasksFromQueue]') AND type in (N'P', N'PC')) DROP PROCEDURE [dbo].[ReceiveApprovalTasksFromQueue] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO EXEC dbo.sp_executesql @statement = N' -- ============================================= -- Author: Petr Klozik -- Create date: 19.11.2008 -- Description: Gets approvals which DueDate is over ReferenceDate (now) -- ============================================= CREATE Procedure [dbo].[ReceiveApprovalTasksFromQueue] @Limit int As BEGIN SET NOCOUNT ON; If Not @Limit Is Null Set RowCount @Limit -- Status: WaitingForApproval = 1 Select Tasks.ApprovalTaskID From ApprovalTasks Tasks Where Status = 1 And DueDate &lt; GetDate() END ' GO GRANT EXECUTE ON [dbo].[ReceiveApprovalTasksFromQueue] TO [OMT_IntegrationRole] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[UpdateApprovalTaskInfo]') AND type in (N'P', N'PC')) DROP PROCEDURE [dbo].[UpdateApprovalTaskInfo] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO EXEC dbo.sp_executesql @statement = N' -- ============================================= -- Author: Klozik Petr -- Create date: 2008-11-25 -- Description: Updates Approval task info to DB -- ============================================= CREATE PROCEDURE [dbo].[UpdateApprovalTaskInfo] @ApprovalTaskID int, @DueDate datetime, @ApprovalRejectDate datetime, @Reason nvarchar(1024), @Status int, @GlobalApproverID int AS BEGIN SET NOCOUNT ON; Update ApprovalTasks Set DueDate = @DueDate, ApprovedRejectedDate = @ApprovalRejectDate, Reason = @Reason, Status = @Status, GlobalApproverID = @GlobalApproverID Where ApprovalTaskID = @ApprovalTaskID END ' GO GRANT EXECUTE ON [dbo].[UpdateApprovalTaskInfo] TO [OMT_IntegrationRole] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GetUserById]') AND type in (N'P', N'PC')) DROP PROCEDURE [dbo].[GetUserById] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO EXEC dbo.sp_executesql @statement = N' -- ============================================= -- Author: Klozik Petr -- Create date: 2008-12-04 -- Description: Gets user row by the specified ID. -- ============================================= CREATE PROCEDURE [dbo].[GetUserById] ( @UserID int ) AS BEGIN SELECT UserID, RTRIM(SID) [SID], RTRIM(OMTGUID) [OMTGUID], RTRIM(UserAccount) [UserAccount], RTRIM(Email) [Email], RTRIM(FirstName) [FirstName], RTRIM(LastName) [LastName], RTRIM(Country) [Country], RTRIM(City) [City], RTRIM(PostalNumber) [PostalNumber], RTRIM(StreetAddress) [StreetAddress], RTRIM(PhoneNumber) PhoneNumber, Modified, Deleted, Uploaded, UploadCode, UploadStatus, RTRIM(Users.ADUserAccount) AS ADUserAccount FROM [dbo].[Users] WHERE UserID = @UserID END ' GO GRANT EXECUTE ON [dbo].[GetUserById] TO [OMT_IntegrationRole] GO IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GetApprovalTaskInfoById]') AND type in (N'P', N'PC')) DROP PROCEDURE [dbo].[GetApprovalTaskInfoById] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO EXEC dbo.sp_executesql @statement = N' -- ============================================= -- Author: Petr Klozik -- Create date: 19.11.2008 -- Description: Gets approvals which DueDate is over ReferenceDate (now) -- ============================================= CREATE Procedure [dbo].[GetApprovalTaskInfoById] @ApprovalTaskID int As BEGIN SET NOCOUNT ON; Declare @OrganizationID int Declare @CurrentApproverID int Declare @NewApproverID int Declare @NewOrganizationID int Select @OrganizationID = OrganizationID, @CurrentApproverID = ApproverID From ApprovalTasks Where ApprovalTaskID = @ApprovalTaskID Set @NewApproverID = ( Select Top 1 o.GlobalApproverID From Organizations o Inner Join OrganizationDescendants od On od.OrganizationID = o.OrganizationID Where od.DescendantID = @OrganizationID And Not(o.GlobalApproverID Is Null) Order By o.OrganizationLevel Desc ) If Not(@NewApproverID Is Null) Begin Set @NewOrganizationID = ( Select OrganizationID from Organizations Where GlobalApproverID = @NewApproverID) End Select Tasks.*, Tickets.Description AS TicketDescription, Tickets.RequestorID, Tickets.OrdererID, @NewApproverID AS OrgGlobalApproverID, @NewOrganizationID AS OrgGlobalApproverOrganizationID From ApprovalTasks Tasks inner join Tickets Tickets on Tasks.TicketID = Tickets.TicketID Where ApprovalTaskID = @ApprovalTaskID END ' GO GRANT EXECUTE ON [dbo].[GetApprovalTaskInfoById] TO [OMT_IntegrationRole] GO </code></pre>
[ { "answer_id": 358962, "author": "Nick Kavadias", "author_id": 40067, "author_profile": "https://Stackoverflow.com/users/40067", "pm_score": 3, "selected": true, "text": "DISABLE TRIGGER ALL ON ApprovalTasks" } ]
2008/12/11
[ "https://Stackoverflow.com/questions/358927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41291/" ]
358,931
<p>I need to copy a text from a textbox into the clipboard with ASP.NET. I want a code that is comparable with Mozilla Firefox and IE.</p>
[ { "answer_id": 358955, "author": "Strelok", "author_id": 2788, "author_profile": "https://Stackoverflow.com/users/2788", "pm_score": 3, "selected": true, "text": "// set the clipboard\nvar x = 'Whatever you want on the clipboard';\nwindow.clipboardData.setData('Text',x);\n\n// get the cl...
2008/12/11
[ "https://Stackoverflow.com/questions/358931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44973/" ]
358,934
<pre><code>include("conn.php"); $result = mysql_query("SELECT * FROM sggame"); while($row = mysql_fetch_assoc($result)); { $id = $row['id']; echo $id; echo 'working?'; } </code></pre> <p>The above code simply doesn't return anything out of the db. The row name is correct and the loop runs, showing that there is something in the database. However the row is just not echoed out at all. This is code i have used a thousand time before and am rather perplexed as to why it has stopped now! Any help, as always, is much appreciated</p>
[ { "answer_id": 358943, "author": "Aron Rotteveel", "author_id": 11568, "author_profile": "https://Stackoverflow.com/users/11568", "pm_score": 3, "selected": true, "text": "while($row = mysql_fetch_assoc($result));\n" } ]
2008/12/11
[ "https://Stackoverflow.com/questions/358934", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31677/" ]
358,949
<p>I am looking in to ways to enable a site to basically have something like:</p> <p><a href="http://mysite.com/" rel="nofollow noreferrer">http://mysite.com/</a><strong>en-US</strong>/index.aspx`</p> <p>Where the "en-US" can vary by culture..</p> <p>This culture in the URL will then basically set the <code>CurrentUICulture</code> for the application..</p> <p>Basically, we currently have a page where the user explicitly clicks it, but some are favouriting past that, and it is causing some issues..</p> <p>I know this sort of thing is easily done in ASP.NET MVC, but how about those of us still working in 2.0? Can you guys in all your wisdom offer any suggestions/pointers/ANYTHING that may get me started? This is new to me :)</p> <p>I'm sure there must be some way to pick up the request and set/bounce as appropriate.. <code>HttpModule</code> maybe?</p> <h3>Update</h3> <p>Just had a thought.. May be best to create VirtDirs in IIS and then pull the appropriate part from the Requested URL and set the culture in <code>InitializeCulture</code>?</p>
[ { "answer_id": 359024, "author": "Eduardo Molteni", "author_id": 2385, "author_profile": "https://Stackoverflow.com/users/2385", "pm_score": 1, "selected": false, "text": "Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)\n ' Code that runs on application startup\n ...
2008/12/11
[ "https://Stackoverflow.com/questions/358949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/832/" ]
358,951
<p>I have a solution that contains a good deal of projects, </p> <p>I would like to remove the source control bindings completely, how can I do this?</p> <p><strong>Update:</strong> What I really want to do is move one solution and its projects from TFS 2005 -> 2008. Thats why I am removing the bindings, is there a better way to do this?</p>
[ { "answer_id": 6137843, "author": "Matt Frear", "author_id": 32598, "author_profile": "https://Stackoverflow.com/users/32598", "pm_score": 7, "selected": false, "text": "\"Go Offline\n\nThe Team Foundation Server http://some-other-guys-tfs-server/ \nis currently unavailable.\n\nThe solut...
2008/12/11
[ "https://Stackoverflow.com/questions/358951", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41291/" ]
358,952
<p>This one is weird,</p> <p><a href="http://www.pickledegg.orchardhostings6.co.uk/bug/wp-test.php" rel="nofollow noreferrer">I have a page that consists of a html table in a div called 'rates-viewer'</a>. If you load this page in IE (6 or 7), you will notice that the contents of the table headers is misaligned over to the left.</p> <p>If you choose a country from the dropdown, it triggers an ajax call to a script. This script returns exactly the same html into the 'rates-viwer' div, to replace the original table.</p> <p><em>The weird thing is that when it does so, the table header content is correctly aligned.</em> </p> <p>Why does loading the same html into the same div, cause my table header content to be corrected like this?</p> <p>I assumed that my html differed slightly, I'm sure its the same.</p> <p>Can anyone plase help with this one please, its causing me to frown a lot :) I basically need the original html to be lined up correctly, but I'm intrigued as to why this is happening.</p> <p>The JS is a bit of jquery, and its in the wp-test.php source. My script that is called is rates-viewer-test.php, and the CSS is in main.css...</p>
[ { "answer_id": 6137843, "author": "Matt Frear", "author_id": 32598, "author_profile": "https://Stackoverflow.com/users/32598", "pm_score": 7, "selected": false, "text": "\"Go Offline\n\nThe Team Foundation Server http://some-other-guys-tfs-server/ \nis currently unavailable.\n\nThe solut...
2008/12/11
[ "https://Stackoverflow.com/questions/358952", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26107/" ]
358,972
<p>I'm creating a xml-file for display in Excel using &#95;di&#95;IXMLDocument. But for some tags I get an unwanted extra (empty) xmlns attribute witch makes the file unreadable for Excel... This is what i do:</p> <pre><code>... _di_IXMLNode worksheet = workbook-&gt;AddChild("Worksheet"); worksheet-&gt;SetAttribute("ss:Name",Now().DateString()); ... </code></pre> <p>and this is what comes out:</p> <pre><code>&lt;Worksheet xmlns="" ss:Name="2008-12-11"&gt; </code></pre> <p>Where does xmlns come from? How do I get rid of it?</p> <p>EDIT: Some more info: If I try to add a xmlns attribute to Worksheet myself, like this:</p> <pre><code>... _di_IXMLNode worksheet = workbook-&gt;AddChild("Worksheet"); worksheet-&gt;SetAttribute("xlmns","Foo"); worksheet-&gt;SetAttribute("ss:Name",Now().DateString()); ... </code></pre> <p>Then the child nodes of "Worksheet" all get the empty xmlns attributes instead!</p> <pre><code>&lt;Worksheet xmlns="Foo" ss:Name="2008-12-11"&gt; &lt;Table xmlns=""&gt; </code></pre>
[ { "answer_id": 359279, "author": "c0m4", "author_id": 2079, "author_profile": "https://Stackoverflow.com/users/2079", "pm_score": 1, "selected": true, "text": "_di_IXMLNode worksheet = workbook->AddChild(\"Worksheet\",\"workbooks-namespace\",false);\nworksheet->SetAttribute(\"ss:Name\",N...
2008/12/11
[ "https://Stackoverflow.com/questions/358972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2079/" ]
358,973
<p>In a simple dialog app, using designer, I've set up the usual shortcut keys for cut, copy, paste and delete in the edit menu.</p> <p>My problem is that I only want to handle delete events when a certain tree control is in focus. Otherwise, in my datagrid control for example, I want delete to work as usual.</p> <p>What's the best way to do this? Currently I'm getting a delete event in the main form class, but the delete key isn't working in the edit controls in the datagrid control.</p> <p><b>Edit</b> - specified that the delete key isn't working in edit sub-controls</p>
[ { "answer_id": 359075, "author": "Wolf5", "author_id": 37643, "author_profile": "https://Stackoverflow.com/users/37643", "pm_score": 3, "selected": true, "text": "keycombination" } ]
2008/12/11
[ "https://Stackoverflow.com/questions/358973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11828/" ]
358,974
<p>Is there a way to add an attribute to an xml node (which I have the xpath of) using nant? Tried xmlpoke but it looks like it can only update existing attributes.</p> <p>thanks.</p>
[ { "answer_id": 3982825, "author": "Christopher Stott", "author_id": 134595, "author_profile": "https://Stackoverflow.com/users/134595", "pm_score": 2, "selected": false, "text": "<script language=\"C#\" prefix=\"test\" >\n <references>\n <include name=\"System.Xml.dll\"...
2008/12/11
[ "https://Stackoverflow.com/questions/358974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19956/" ]
358,999
<p>I need to retrieve the Build Status from TeamCity in the form of XML, RSS format would be ideal.</p> <p>I am familiar with the RSS feed within Teamcity but that is of no use as it is more of a history view. I am looking for something more like the page generated by the Status Widget but in XML form. (FYI, the status widget page is not XHTML - tried that!)</p> <p>I wonder if anyone has across anything that could assist?</p> <p>Kind Regards, David Christiansen</p>
[ { "answer_id": 4600764, "author": "brasskazoo", "author_id": 6340, "author_profile": "https://Stackoverflow.com/users/6340", "pm_score": 3, "selected": true, "text": "Syndication Feed" }, { "answer_id": 26777420, "author": "Alfons", "author_id": 2771739, "author_profi...
2008/12/11
[ "https://Stackoverflow.com/questions/358999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20406/" ]
359,029
<p>I'm having an extremely weird problem with a PHP script of mine.</p> <p>I'm uploading a couple of files and having PHP put them all in one folder. I've have trouble with random files being sent and random ones not being sent. So I debugged it and I got a very weird result from the $_FILES[] array.</p> <p>I tried it with 3 files.</p> <p><code>$_FILES["addFile"]["name"]</code> Holds the names of the 3 files.</p> <p>You'd expect <code>$_FILES["addFile"]["tmp_name"]</code> to hold the 3 temporary names that PHP uses to copy the files, but it doesn't. It holds just one name. The other 2 are empty strings, which generate an error whilst uploading(which I supress from being displayed)</p> <p>This is very odd. I've tried mulitple situations and it just keeps on happening. This must be something in my settings or perhaps even my code.</p> <p>Here's my code:</p> <pre><code>$i = 0; if (!empty($_FILES['addFile'])) { foreach($_FILES['addFile'] as $addFile) { $fileToCopy = $_FILES["addFile"]["tmp_name"][$i]; $fileName = $_FILES["addFile"]["name"][$i]; $i++; if(!empty($fileToCopy)){ $copyTo = $baseDir."/".$fileName; @copy($fileToCopy, $copyTo) or die("cannot copy ".$fileToCopy." to ".$copyTo); } } exit(0); } </code></pre> <p>Since the tmp_name is empty, the if-value will be false so it's gonna skip the die() function.</p> <p>Does anybody know what might be causing this?</p> <p>further info: I'm using Windows XP, running WAMP server. Never had this problem before and I can acces all maps from which I've tried to upload. Security settings of windows can't be the issue I think.</p>
[ { "answer_id": 359056, "author": "Eran Galperin", "author_id": 10585, "author_profile": "https://Stackoverflow.com/users/10585", "pm_score": 1, "selected": false, "text": "if (!empty($_FILES['addFile']) && is_array($_FILES['addFile']['name'])) {\n $length = count($_FILES['addFile']['n...
2008/12/11
[ "https://Stackoverflow.com/questions/359029", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11795/" ]
359,031
<p>Following are the PHP code lines which I am using to open a PDF file:</p> <pre><code>$pdf_generartor = new PDFlib(); $doc = $pdf_generartor -&gt; open_pdi_document("Report.pdf", "") or die ("ERROR: " . $pdf_generartor -&gt; get_errmsg()); </code></pre> <p>Though the file is at required location, every time I receive following error:</p> <pre><code>ERROR: Couldn't open PDF file 'Report.pdf' for reading (file not found) </code></pre> <p>Is anyone familiar with the possible solution?</p>
[ { "answer_id": 359049, "author": "benlumley", "author_id": 39161, "author_profile": "https://Stackoverflow.com/users/39161", "pm_score": 1, "selected": false, "text": "echo realpath('Report.pdf');\n" }, { "answer_id": 385589, "author": "Anil", "author_id": 45284, "aut...
2008/12/11
[ "https://Stackoverflow.com/questions/359031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6561/" ]
359,036
<p>My program run fine from anywhere else on my drive apart from the Program Files directory (windows XP), I am logged on as administrator so I have full permissions to the drive. It runs fine from the root of c: the windows directory basically anywhere else apart from Program Files. I have recreated this problem on 4 different machines 2 XP, 2 Vista. </p> <p>My program is a C# .Net 2.0 program. What on earth could the problem be?</p> <p>I have even copied my entire project to the Program Files directory and I can't debug it from there it just won't run up, no errors at all.</p> <p>Thanks for any help.</p>
[ { "answer_id": 359066, "author": "Toon Krijthe", "author_id": 18061, "author_profile": "https://Stackoverflow.com/users/18061", "pm_score": 2, "selected": false, "text": "LogDebug('before 1');\nStatement1;\nLogDebug('before 2');\nStatement2;\nLogDebug('before 3');\nStatement3;\nLogDebug(...
2008/12/11
[ "https://Stackoverflow.com/questions/359036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
359,041
<p>I need to create a request for a web page delivered to our web sites, but I need to be able to set the host header information too. I have tried this using HttpWebRequest, but the Header information is read only (Or at least the Host part of it is). I need to do this because we want to perform the initial request for a page before the user can. We have 10 web server which are load balanced, so we need to request the file from each of the web servers. </p> <p>I have tried the following:</p> <pre><code>HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://192.168.1.5/filename.htm"); request.Headers.Set("Host", "www.mywebsite.com"); WebResponse response = request.GetResponse(); </code></pre> <p>Obviously this does not work, as I can't update the header, and I don't know if this is indeed the right way to do it.</p>
[ { "answer_id": 359299, "author": "Xetius", "author_id": 274, "author_profile": "https://Stackoverflow.com/users/274", "pm_score": 4, "selected": true, "text": "string getString = \"GET /path/mypage.htm HTTP/1.1\\r\\nHost: www.mysite.mobi\\r\\nConnection: Close\\r\\n\\r\\n\";\nEncoding AS...
2008/12/11
[ "https://Stackoverflow.com/questions/359041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/274/" ]
359,043
<p>I'm writing code to generate character-based pagination. I have articles in my site that I want to split up based on length.</p> <p>The code I have so far is working albeit two issues:</p> <ol> <li>It's splitting pages in the middle of words and HTML tags; I want it to only split after a complete word, tag, or a punctuation mark. </li> <li>In the pagination bar, it's generating the wrong number of pages.</li> </ol> <p>In the pagination bar, it's generating the wrong number of pages.</p> <p>Need help addressing these two issues. Code follows:</p> <pre><code>$text = file_get_contents($View); $ArticleLength = strlen($text); $CharsPerPage = 5000; $NoOfPages = round((double)$ArticleLength / (double)$CharsPerPage); $CurrentPage = $this-&gt;ReturnNeededObject('pagenumber'); $Page = (isset($CurrentPage) &amp;&amp; '' !== $CurrentPage) ? $CurrentPage : '1'; $PageText = substr($text, $CharsPerPage*($Page-1), $CharsPerPage); echo $PageText, '&lt;p&gt;'; for ($i=1; $i&lt;$NoOfPages+1; $i++) { if ($i == $CurrentPage) { echo '&lt;strong&gt;', $i, '&lt;/strong&gt;'; } else { echo '&lt;a href="', $i, '"&gt;', $i, '&lt;/a&gt;'; } echo ' | '; } echo '&lt;/p&gt;'; </code></pre> <p>What am I doing wrong?</p>
[ { "answer_id": 359062, "author": "benlumley", "author_id": 39161, "author_profile": "https://Stackoverflow.com/users/39161", "pm_score": 0, "selected": false, "text": "$NoOfPages = round((double)$ArticleLength / (double)$CharsPerPage);\n" }, { "answer_id": 359067, "author": "...
2008/12/11
[ "https://Stackoverflow.com/questions/359043", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
359,047
<p>How can I detect which request type was used (GET, POST, PUT or DELETE) in PHP?</p>
[ { "answer_id": 359050, "author": "gnud", "author_id": 27204, "author_profile": "https://Stackoverflow.com/users/27204", "pm_score": 12, "selected": true, "text": "$_SERVER['REQUEST_METHOD']\n" }, { "answer_id": 897311, "author": "neu242", "author_id": 13365, "author_p...
2008/12/11
[ "https://Stackoverflow.com/questions/359047", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115/" ]
359,052
<p>I need to send PUT and DELETE along with POST, GET to a REST API how can I do it?</p>
[ { "answer_id": 360112, "author": "skamradt", "author_id": 9217, "author_profile": "https://Stackoverflow.com/users/9217", "pm_score": 2, "selected": false, "text": "function HttpPutBinary(const URL: string; const Data: TStream): Boolean;\nvar\n HTTP: THTTPSend;\nbegin\n HTTP := THTTPSe...
2008/12/11
[ "https://Stackoverflow.com/questions/359052", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115/" ]
359,087
<p>If i do jQuery(expr).change( function), then I can get an event function to fire when the user makes a change to the value.</p> <p>Is it possible to get this to fire if it's changed programatically, ie if I call jQuery(expr).val("moo").</p> <p>or if some Plain old JavaScript changes it's value?</p> <p>Thanks for any help.</p>
[ { "answer_id": 359129, "author": "Sander Versluys", "author_id": 2172, "author_profile": "https://Stackoverflow.com/users/2172", "pm_score": 5, "selected": true, "text": "jQuery('#element').change();\n" }, { "answer_id": 359140, "author": "Adam Bellaire", "author_id": 216...
2008/12/11
[ "https://Stackoverflow.com/questions/359087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45279/" ]
359,099
<p>I'm trying to refactor a large, old project and one thing I've noticed is a range of different Iterator implementations:</p> <pre><code>while($iterator-&gt;moveNext()) { $item = $iterator-&gt;current(); // do something with $item; } for($iterator = getIterator(), $iterator-&gt;HasNext()) { $item = $iterator-&gt;Next(); // do something with $item } while($item = $iterator-&gt;fetch()) { // do something with item } </code></pre> <p>or even the <a href="http://www.php.net/~helly/php/ext/spl/" rel="nofollow noreferrer">StandardPHPLibrary (SPL)</a> iterator which allows</p> <pre><code>foreach($iterator as $item) { // do something with $item } </code></pre> <p>Having so many different Iterators (with different methods for looping over collections) seems like a strong code smell, and I'm inclined to refactor everything to SPL. Is there a compelling advantage to any of these implementations of Iterator, or is it purely a matter of personal taste? </p>
[ { "answer_id": 359117, "author": "Kent Fredric", "author_id": 15614, "author_profile": "https://Stackoverflow.com/users/15614", "pm_score": 1, "selected": false, "text": "for( $object as $i => $v ) \n" } ]
2008/12/11
[ "https://Stackoverflow.com/questions/359099", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20074/" ]
359,109
<p>How can I set up GNU screen to allow the mouse's scrollwheel to scroll around in the scrollback buffer? I tried to Google about this, but most hits were on how to allow applications inside screen to use the scrollwheel.</p>
[ { "answer_id": 1125947, "author": "Pistos", "author_id": 28558, "author_profile": "https://Stackoverflow.com/users/28558", "pm_score": 10, "selected": true, "text": "~/.screenrc" }, { "answer_id": 3474732, "author": "Tommi R.", "author_id": 128698, "author_profile": "...
2008/12/11
[ "https://Stackoverflow.com/questions/359109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13051/" ]
359,120
<p>for testing purposes i need an recursive directory with some files, that comes to maximum path-length.</p> <p>The Script used for the creation consists only of two for-loops, as followed:</p> <pre><code>for /L %%a in (1 1 255) do @( mkdir %%a &amp;&amp; cd %%a &amp;&amp; for /L %%b in (1 1 %random%) do @( echo %%b &gt;&gt; %%a.txt ) ) </code></pre> <p>Now I would like to embed this script as part of another script, since more is to be done, but I can not add any other commands around it or it refuses working. I use this under windows vista, if this is useful to you.</p> <p>Nor it works if i write <code>"@ECHO OFF</code>" in first line, neither with "<code>echo done</code>" on the last line.</p> <p>output on commandline is:</p> <pre><code>X:\Scripte&gt;recursive.cmd OFFfor /L %a in (1 1 255) do @( mkdir %a The system cannot find the path specified. </code></pre> <p>EDIT: Seems to be a problem with layer 8, the problem seems to be in the command shell used, if used the bare cmd.exe, it works, with visual studio 2008 command shell it does not work, like stated above.</p> <p>anyway, thank you.</p>
[ { "answer_id": 359135, "author": "Patrick Cuff", "author_id": 7903, "author_profile": "https://Stackoverflow.com/users/7903", "pm_score": 2, "selected": true, "text": "@echo OFF\n\nfor /L %%a in (1 1 255) do (\n @echo a = %%a\n mkdir %%a\n cd %%a\n for /L %%b in (1 1 %random%...
2008/12/11
[ "https://Stackoverflow.com/questions/359120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44532/" ]
359,122
<p>I am looking at depency injection, I can see the benefits but I am having problems with the syntax it creates. I have this example</p> <pre><code>public class BusinessProducts { IDataContext _dx; BusinessProducts(IDataContext dx) { _dx = dx; } public List&lt;Product&gt; GetProducts() { return dx.GetProducts(); } } </code></pre> <p>The problem is that I don't want to write </p> <pre><code>BusinessProducts bp = new BusinessProducts(dataContextImplementation); </code></pre> <p>I would continue to write </p> <pre><code>BusinessProducts bp = new BusinessProducts(); </code></pre> <p>because I feel the first alternative just feels unatural. I dont want to know what the BusinessProduct "depends" on to get the products, also I feel it makes my code more unreadable. </p> <p>Is there any alternatives to this approach as I would like to keep my original syntax for creating objects but I would like to still be able to fake the dependencies when unit testing or is it this dependecy injection frameworks can do for me?</p> <p>I am coding in c# but alternatives from other languages is welcome</p>
[ { "answer_id": 359146, "author": "krosenvold", "author_id": 23691, "author_profile": "https://Stackoverflow.com/users/23691", "pm_score": 2, "selected": false, "text": "new BusinessProducts(dataContextImplementation)\n" }, { "answer_id": 359189, "author": "Szymon Rozga", ...
2008/12/11
[ "https://Stackoverflow.com/questions/359122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29519/" ]
359,125
<p>This is a fairly basic question, which for some reason, a proper solution escapes me at the moment. I am dealing with a 3rd-party SDK which declares the following structure:</p> <pre><code>struct VstEvents { VstInt32 numEvents; ///&lt; number of Events in array VstIntPtr reserved; ///&lt; zero (Reserved for future use) VstEvent* events[2]; ///&lt; event pointer array, variable size }; </code></pre> <p>Even though this is a "variable sized" array, it's declared statically. So obviously, if I make a VstEvents object, set the numEvents to something, and then go through and start adding them to the array, it's going to cause memory corruption.</p> <p>So how am I supposed to properly deal with a structure like this? Should I allocate my own VstEvent* array and then point events[0] to it?</p>
[ { "answer_id": 359136, "author": "epatel", "author_id": 842, "author_profile": "https://Stackoverflow.com/users/842", "pm_score": 2, "selected": true, "text": "struct VstEvents *evnts;\n\nevnts = (struct VstEvents*)malloc(sizeof(struct VstEvents) + \n num...
2008/12/11
[ "https://Stackoverflow.com/questions/359125", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14302/" ]
359,126
<p>I'm using Crystal Reports 11 (and VB6) to open a report file, load the data from an Access database and either print the report to a printer or export the report to another .rpt file (for later printing without the database)</p> <p>Even for small amounts of data the process is somewhat slow. Profiling showed about 1.5 seconds for three records (one page) For about 500 records on 10 pages, it's 1.7 seconds.</p> <p>Can I do something the speed it up? Can I tweak the data or the report? </p>
[ { "answer_id": 359136, "author": "epatel", "author_id": 842, "author_profile": "https://Stackoverflow.com/users/842", "pm_score": 2, "selected": true, "text": "struct VstEvents *evnts;\n\nevnts = (struct VstEvents*)malloc(sizeof(struct VstEvents) + \n num...
2008/12/11
[ "https://Stackoverflow.com/questions/359126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23368/" ]
359,128
<p>When a ComboBox is clicked this causes it to be selected in the window. Is there a way to perform the equivalent of a javascript blur()</p>
[ { "answer_id": 359158, "author": "arul", "author_id": 15409, "author_profile": "https://Stackoverflow.com/users/15409", "pm_score": 3, "selected": true, "text": "comboBox1.TopLevelControl.Focus();\n" }, { "answer_id": 6341225, "author": "Roey", "author_id": 314905, "a...
2008/12/11
[ "https://Stackoverflow.com/questions/359128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32055/" ]
359,147
<p>Related to this question: <a href="https://stackoverflow.com/questions/353207/url-characters-replacement-in-jsp-with-urlrewrite">URL characters replacement in JSP with UrlRewrite</a></p> <p>I want to have masked URLs in this JSP Java EE web project. For example if I had this:</p> <pre><code>http://mysite.com/products.jsp?id=42&amp;name=Programming_Book </code></pre> <p>I would like to turn that URL into something more User/Google friendly like:</p> <pre><code>http://mysite.com/product-Programming-Book </code></pre> <p>I've been fighting with UrlRewrite, forwarding and RequestDispatcher to accomplish what I want, but I'm kind of lost. I should probably have a filter for all http requests, re format them, and forward the page. </p> <p>Can anyone give some directions? Tips? </p> <p>Thanks a lot. </p> <p><strong>UPDATE:</strong> Servlets did it. Thanks Yuval for your orientation. I had been using UrlRewrite, as you can see at the first sentence of the question I also asked a question about that. But I couldn't manage to get UrlRewrite work the way I wanted. Servlets did the job.</p>
[ { "answer_id": 359306, "author": "Yuval", "author_id": 2819, "author_profile": "https://Stackoverflow.com/users/2819", "pm_score": 1, "selected": true, "text": "http://mysite.com/product-Programming-Book" }, { "answer_id": 367745, "author": "tegbains", "author_id": 19419,...
2008/12/11
[ "https://Stackoverflow.com/questions/359147", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1492/" ]
359,206
<p>I have seen these two approaches for constant declaration which are to be used in the project.</p> <ol> <li><p>Constants in a public module. </p></li> <li><p>Constants in a NonInheritable(Sealed) class </p></li> </ol> <p>Does anybody uses any other approach for the constant declartion ?</p> <p>Is there any difference between these approaches, any pros and cons ?</p> <p>Thanks.</p>
[ { "answer_id": 359215, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 5, "selected": true, "text": "Math.Pi" } ]
2008/12/11
[ "https://Stackoverflow.com/questions/359206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41968/" ]
359,213
<p>On a Unix systems it's very easy to compile the CLASSPATH by using find:</p> <pre><code>LIBDIR=`find lib/ -name \*.jar` for DIR in $LIBDIR: do CLASSPATH="$CLASSPATH:$DIR" done java -classpath $CLASSPATH com.example.MyClass </code></pre> <p>What would be the aquivalent in a Windows batchfile?</p>
[ { "answer_id": 359242, "author": "MrG", "author_id": 33429, "author_profile": "https://Stackoverflow.com/users/33429", "pm_score": 3, "selected": true, "text": "setlocal ENABLEDELAYEDEXPANSION\nFOR /R .\\lib %%G IN (*.jar) DO set CLASSPATH=!CLASSPATH!;%%G\n\njava -classpath %CLASSPATH% c...
2008/12/11
[ "https://Stackoverflow.com/questions/359213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33429/" ]
359,217
<p>I have a WPF ListView which repeats the data vertically. I cannot figure out how to make it repeat horizontally, like the slideshow view in Windows Explorer. My current ListView definition is:</p> <pre><code>&lt;ListView ItemsSource="{StaticResource MyDataList}" ItemTemplate="{StaticResource ListViewTemplate}"&gt; &lt;/ListView&gt; </code></pre> <p>The DataTemplate is (although I believe this should not matter); </p> <pre><code> &lt;Rectangle HorizontalAlignment="Stretch" Margin="0,1,0,0" x:Name="rectReflection" Width="Auto" Grid.Row="1" Height="30"&gt; &lt;Rectangle.Fill&gt; &lt;VisualBrush Stretch="None" AlignmentX="Center" AlignmentY="Top" Visual="{Binding ElementName=imgPhoto}"&gt; &lt;VisualBrush.RelativeTransform&gt; &lt;TransformGroup&gt; &lt;MatrixTransform Matrix="1,0,0,-1,0,0" /&gt; &lt;TranslateTransform Y="1" /&gt; &lt;/TransformGroup&gt; &lt;/VisualBrush.RelativeTransform&gt; &lt;/VisualBrush&gt; &lt;/Rectangle.Fill&gt; &lt;Rectangle.OpacityMask&gt; &lt;RadialGradientBrush GradientOrigin="0.5,1.041"&gt; &lt;RadialGradientBrush.RelativeTransform&gt; &lt;TransformGroup&gt; &lt;ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.202" ScaleY="2.865"/&gt; &lt;SkewTransform AngleX="0" AngleY="0" CenterX="0.5" CenterY="0.5"/&gt; &lt;RotateTransform Angle="0" CenterX="0.5" CenterY="0.5"/&gt; &lt;TranslateTransform X="-0.002" Y="-0.491"/&gt; &lt;/TransformGroup&gt; &lt;/RadialGradientBrush.RelativeTransform&gt; &lt;GradientStop Color="#D9000000" Offset="0"/&gt; &lt;GradientStop Color="#01FFFFFF" Offset="0.8"/&gt; &lt;/RadialGradientBrush&gt; &lt;/Rectangle.OpacityMask&gt; &lt;/Rectangle&gt; &lt;/Grid&gt; &lt;/Border&gt; &lt;/DataTemplate&gt; </code></pre>
[ { "answer_id": 359418, "author": "Boyan", "author_id": 38106, "author_profile": "https://Stackoverflow.com/users/38106", "pm_score": 9, "selected": true, "text": "<ListView.ItemsPanel>\n <ItemsPanelTemplate>\n <StackPanel Orientation=\"Horizontal\"></StackPanel>\n </ItemsPan...
2008/12/11
[ "https://Stackoverflow.com/questions/359217", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26221/" ]
359,229
<p>I am working on an application which draws a simple dot grid. I would like the mouse to snap between the points on the grid, eventually to draw lines on the grid.</p> <p>I have a method which takes in the current mouse location (X,Y) and calculates the nearest grid coordinate.</p> <p>When I create an event and attempt to move the mouse to the new coordinate the whole system becomes jerky. The mouse doesn't snap smoothly between grid points.</p> <p>I have copied a code sample below to illustrate what I am attempting to do. Does anyone have any advice they could offer me as to how I can eliminate the jumpiness within the mouse movement?</p> <hr> <pre><code>using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace GridTest { public partial class Form1 : Form { Graphics g; const int gridsize = 20; public Form1() { InitializeComponent(); g = splitContainer1.Panel2.CreateGraphics(); splitContainer1.Panel2.Invalidate(); } private void splitContainer1_Panel2_Paint(object sender, PaintEventArgs e) { Drawgrid(); } private void Drawgrid() { for (int x = 0; x &lt; splitContainer1.Panel2.ClientSize.Width; x += gridsize) { for (int y = 0; y &lt; splitContainer1.Panel2.ClientSize.Height; y += gridsize) { g.DrawLine(Pens.Black, new Point(x, y), new Point(x + 1, y)); } } } private void splitContainer1_Panel2_MouseMove(object sender, MouseEventArgs e) { Point newPosition = new Point(); newPosition = RoundToNearest(gridsize, e.Location); Cursor.Position = splitContainer1.Panel2.PointToScreen(newPosition); } private Point RoundToNearest(int nearestRoundValue, Point currentPoint) { Point newPoint = new Point(); int lastDigit; lastDigit = currentPoint.X % nearestRoundValue; if (lastDigit &gt;= (nearestRoundValue/2)) { newPoint.X = currentPoint.X - lastDigit + nearestRoundValue; } else { newPoint.X = currentPoint.X - lastDigit; } lastDigit = currentPoint.Y % nearestRoundValue; if (lastDigit &gt;= (nearestRoundValue / 2)) { newPoint.Y = currentPoint.Y - lastDigit + nearestRoundValue; } else { newPoint.Y = currentPoint.Y - lastDigit; } return newPoint; } } } </code></pre>
[ { "answer_id": 359922, "author": "user21826", "author_id": 21826, "author_profile": "https://Stackoverflow.com/users/21826", "pm_score": 2, "selected": true, "text": "\nImports System\nImports System.Drawing\nImports System.Windows.Forms\n\nModule modSnap\n\n Public Const strApplicati...
2008/12/11
[ "https://Stackoverflow.com/questions/359229", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
359,232
<p>I'm using Windows XP Service Pack 3 and have Command Extensions enabled by default in the Windows Registry. Somehow, the following command does not work on this version of Windows but if I run it in Windows Server 2003 or Windows Vista Business, it works just fine. Any clue?</p> <p>The problem is that on Windows XP, it seems like the /f option is not working at all and the do part of the command never gets executed.</p> <p>This is the command:</p> <pre><code>for /f "tokens=1 delims=: " %A in ('tasklist /FI "IMAGENAME eq python.exe" /NH') do ( If "%A" == "python.exe" ( echo "It's running" ) Else ( echo "It's not running" ) ) </code></pre> <p>Thanks in advance.</p>
[ { "answer_id": 359274, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 1, "selected": false, "text": "@echo off\nfor /f \"tokens=1 delims=: \" %%A in ('tasklist /FI \"IMAGENAME eq java.exe\" /NH') do (\n If \"%%A\" == \"java.e...
2008/12/11
[ "https://Stackoverflow.com/questions/359232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
359,237
<p>This is a somewhat bizarre question. My objectives are to understand the language design decision and to identify the possibilities of reflection in C++.</p> <ol> <li><p>Why C++ language committee did not go towards implementing reflection in the language? Is reflection too difficult in a language that does not run on a virtual machine (like java)?</p></li> <li><p>If one were to implement reflection for C++, what will be the challenges?</p></li> </ol> <p>I guess the uses of reflection are well-known: editors can be more easily written, program code will be smaller, mocks can be generated for unit tests and so on. But it would be great if you could comment on uses of reflection too.</p>
[ { "answer_id": 359462, "author": "jalf", "author_id": 33213, "author_profile": "https://Stackoverflow.com/users/33213", "pm_score": 10, "selected": true, "text": "#include" }, { "answer_id": 1411360, "author": "Community", "author_id": -1, "author_profile": "https://S...
2008/12/11
[ "https://Stackoverflow.com/questions/359237", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19501/" ]
359,257
<p>In SQL server 2005 this query</p> <pre><code>select len(cast('the quick brown fox jumped over the lazy dog' as varchar)) </code></pre> <p>returns 30 as length while the supplied string has more characters. This seems to be the default. Why 30, and not 32 or any other power of 2?</p> <p><strong>[EDIT]</strong> I am aware that I should always specifiy the length when casting to varchar but this was a quick let's-check-something query. Questions remains, why 30?</p>
[ { "answer_id": 359289, "author": "curtisk", "author_id": 17651, "author_profile": "https://Stackoverflow.com/users/17651", "pm_score": 7, "selected": true, "text": "SELECT CAST('the quick brown fox jumped over the lazy dog' AS VARCHAR(45))\n" }, { "answer_id": 11529344, "auth...
2008/12/11
[ "https://Stackoverflow.com/questions/359257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6399/" ]
359,284
<p>I have a method which prints out the order of a set of images. I need to submit this to a new php page.</p> <p>I have a form which currently prints out the order to the same page.</p> <pre><code>&lt;form action="mainpage.php" method="post"&gt; &lt;div style="clear:both;padding-bottom:10px"&gt; &lt;input type="Button" style="width:100px" value="Show order" onclick="saveImageOrder()"&gt; &lt;/div&gt; </code></pre> <p><code>Saveimageorder()</code> shows the image and it saves the order in a variable called orderString</p> <pre><code>function saveImageOrder() { var orderString = ""; var objects = document.getElementsByTagName('DIV'); for(var no=0;no&lt;objects.length;no++) { if(objects[no].className=='imageBox' || objects[no].className=='imageBoxHighlighted') { if(orderString.length&gt;0) orderString = orderString + ','; orderString = orderString + objects[no].id; } } document.getElementById('debug').innerHTML = 'This is the new order of the images(IDs) : &lt;br&gt;' + orderString; } </code></pre> <p>How to do this?</p>
[ { "answer_id": 359305, "author": "jumoel", "author_id": 1555170, "author_profile": "https://Stackoverflow.com/users/1555170", "pm_score": 2, "selected": false, "text": "document.formname.submit();\n" }, { "answer_id": 359338, "author": "smoothdeveloper", "author_id": 1704...
2008/12/11
[ "https://Stackoverflow.com/questions/359284", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
359,287
<p>I am writing an <a href="http://www.eclipse.com" rel="nofollow noreferrer">Eclipse</a> plug-in that loads resources from a central database. I would like to use <a href="http://www.hibernate.org" rel="nofollow noreferrer">Hibernate</a> to access that database. </p> <p>So how would I add this as a dependency to my plug-in project? I've tried Google but only get hits on about plug-ins for editing Hibernate configuration files.</p>
[ { "answer_id": 359676, "author": "Mario Ortegón", "author_id": 2309, "author_profile": "https://Stackoverflow.com/users/2309", "pm_score": 1, "selected": false, "text": "Manifest-Version: 1.0\nBundle-ManifestVersion: 2\nBundle-Name: Solarmetric Kodo\nBundle-SymbolicName: com.solarmetric....
2008/12/11
[ "https://Stackoverflow.com/questions/359287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1969/" ]
359,290
<p>How is it possible to get the FxCop custom dictionary to work correctly?</p> <p>I have tried adding words to be recognised to the file 'CustomDictionary.xml', which is kept in the same folder as the FxCop project file. This does not seem to work, as I still get the 'Identifiers should be spelled correctly' FxCop message, even after reloading and re-running FxCop. Using version 1.36.</p>
[ { "answer_id": 446429, "author": "spinodal", "author_id": 11374, "author_profile": "https://Stackoverflow.com/users/11374", "pm_score": 5, "selected": false, "text": "<Dictionary>\n <Words>\n <Recognized>\n <Word>\"productname\"</Word>\n <Word>\"companyna...
2008/12/11
[ "https://Stackoverflow.com/questions/359290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15985/" ]
359,298
<p>I have data from a table in a database (string) that contain text and price. I extract the price from the data but my problem is that sometime I can Convert it to float and sometime not.</p> <p>I have noticed that :</p> <pre><code>Convert.ToSingle(m.Groups[1].Value); </code></pre> <p>It works but not always because sometime the period is the problem (it requires a comma). What can I do? I have try to replace the ".", by "," but sometime on other PC it's a period that it's required!</p>
[ { "answer_id": 359311, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 6, "selected": true, "text": "Convert.ToSingle(m.Groups[1].Value, CultureInfo.InvariantCulture.NumberFormat);\n" }, { "answer_id": 359...
2008/12/11
[ "https://Stackoverflow.com/questions/359298", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14441/" ]
359,303
<p>I have a IBAction such as:</p> <pre><code>- (IBAction)showPicker:(id)sender; </code></pre> <p>How can I get the name of the control from the sender variable?</p> <p>I am typically a c# coder so have tried the following to no avail</p> <pre><code>senderName = ((UIButton *)sender).name; </code></pre> <p>I need something more descriptive than the control id (not the button title either). I have 5 buttons all calling the same method. I need to determine which was clicked in order to perform the methods actions on the appropriate control. I.E I have an address picker method but want to populate 5 text fields with different details with each of 5 buttons. Just trying to keep the code tidy</p> <p>N.B Originally I was planning on using the Interface Builders name field, but I've been advised (below) that this isn't available at runtime.</p>
[ { "answer_id": 359358, "author": "Marc Charbonneau", "author_id": 35136, "author_profile": "https://Stackoverflow.com/users/35136", "pm_score": 2, "selected": false, "text": "name" }, { "answer_id": 359369, "author": "Matthew Schinckel", "author_id": 188, "author_prof...
2008/12/11
[ "https://Stackoverflow.com/questions/359303", "https://Stackoverflow.com", "https://Stackoverflow.com/users/258/" ]
359,315
<p>How to configure JAXB unmarshaller so it will trim leading and trailing whitespaces from strings?</p> <p>For instance let's consider a simple binding between a Java bean and XML using JAXB annotations:</p> <pre><code>@XmlRootElement(name="bean") class Bean { @XmlElement(required=true) String name; @XmlElement(required=true) int number; } </code></pre> <p>I would like to be able to unmarshal XML given bellow so <strong>bean.name</strong> does not include starting and trailing whitespaces - is "<strong>My name</strong>", not "<strong>\n My name\n</strong> ".</p> <pre><code>&lt;bean&gt; &lt;name&gt; My name &lt;/name&gt; &lt;number&gt;1&lt;/number&gt; &lt;/bean&gt; </code></pre>
[ { "answer_id": 359363, "author": "bruno conde", "author_id": 31136, "author_profile": "https://Stackoverflow.com/users/31136", "pm_score": 4, "selected": true, "text": "public class MyNormalizedStringAdapter extends XmlAdapter<String, String> {\n\n @Override\n public String marshal...
2008/12/11
[ "https://Stackoverflow.com/questions/359315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42201/" ]
359,320
<p>I want to create a delegate type in C# inside a method for the purpose of creating Anonymous methods.</p> <p>For example:</p> <pre><code>public void MyMethod(){ delegate int Sum(int a, int b); Sum mySumImplementation=delegate (int a, int b) {return a+b;} Console.WriteLine(mySumImplementation(1,1).ToString()); } </code></pre> <p>Unfortunately, I cannot do it using .NET 2.0 and C# 2.0.</p>
[ { "answer_id": 359339, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 6, "selected": true, "text": "public void MyMethod(){\n Func<int, int, int> mySumImplementation = \n delegate (int a, int b) { return a+b; };...
2008/12/11
[ "https://Stackoverflow.com/questions/359320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32582/" ]
359,321
<p>I have the following SQL query:</p> <pre><code>select expr1, operator, expr2, count(*) as c from log_keyword_fulltext group by expr1, operator, expr2 order by c desc limit 2000; </code></pre> <p>Problem: The <code>count(*)</code> as part of my order by is killing my application, probably because it don't use index. I would like to know if there is any way to make it faster, like for example a <code>select</code> inside of another <code>select</code>, or something like that.</p> <p>My <code>SELECT</code> explained:</p> <pre><code>+----+-------------+----------------------+-------+---------------+-------+---------+------+--------+----------------------------------------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+----------------------+-------+---------------+-------+---------+------+--------+----------------------------------------------+ | 1 | SIMPLE | log_keyword_fulltext | index | NULL | expr1 | 208 | NULL | 110000 | Using index; Using temporary; Using filesort | +----+-------------+----------------------+-------+---------------+-------+---------+------+--------+----------------------------------------------+ </code></pre> <p>UPDATED:</p> <p>I tried to do a subquery like that</p> <pre><code>select * from (select b.expr1,b.operator,b.expr2,count(*) as c from log_keyword_fulltext b group by b.expr1,b.operator,b.expr2) x order by x.c desc limit 2000; </code></pre> <p>its working but not faster, following is the explain:</p> <pre><code>+----+-------------+------------+-------+---------------+-------+---------+------+--------+----------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+------------+-------+---------------+-------+---------+------+--------+----------------+ | 1 | PRIMARY | &lt;derived2&gt; | ALL | NULL | NULL | NULL | NULL | 38398 | Using filesort | | 2 | DERIVED | b | index | NULL | expr1 | 208 | NULL | 110000 | Using index | +----+-------------+------------+-------+---------------+-------+---------+------+--------+----------------+ </code></pre> <p>You can check that now, its not using temporary anymore, but it still with the same performance. any recommendation ?</p>
[ { "answer_id": 359364, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": -1, "selected": false, "text": "create foo as \n select expr1, operator, expr2, count(*) as c\n from log_keyword_fulltext \n group by expr1, ope...
2008/12/11
[ "https://Stackoverflow.com/questions/359321", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18642/" ]
359,328
<p>I have the following javascript code, which loads without error, however the update function does not actually seem functional, as get_Records.php is never loaded. I can not test if get_auction.php is loaded as it is loaded from within get_records.php</p> <p><strong>One of my main concerns</strong> is that I am doing the wrong thing by having update() take the paramters pk and query, as only one of them will ever be used. That seems like a bad hack, and poor logic, but I am not aware of a better way.</p> <p>Here is the code</p> <pre><code>var xmlHttp var layername var url function update(layer, part, pk, query) { alert ("update"); if (part=="1") { alert ("part 1"); url = "get_auction.php?cmd=GetAuctionData&amp;pk="+pk+"&amp;sid="+Math.random() } else if (part=="2") { alert ("part 2"); url = "get_records.php?cmd=GetRecordSet&amp;query="+query+"&amp;sid="+Math.random() } xmlHttp=GetXmlHttpObject() if(xmlHttp==null) { alert("Your browser is not supported?") } xmlHttp.onreadystatechange = function() { if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById(layer).innerHTML=xmlHttp.responseText } else if (xmlHttp.readyState==1 || xmlHttp.readyState=="loading") { document.getElementById(layer).innerHTML="loading" } }; xmlHttp.open("GET",url,true) xmlHttp.send(null) } function GetXmlHttpObject() { var xmlHttp=null; try { xmlHttp = new XMLHttpRequest(); } catch (e) { try { xmlHttp =new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } return xmlHttp; } function makewindows() { child1 = window.open ("about:blank"); child1.document.write(&lt;?php echo htmlspecialchars(json_encode($row2["ARTICLE_DESC"]), ENT_QUOTES); ?&gt;)); child1.document.close(); } </code></pre> <p>I placed alert statements into the update function, andnot one is displayed, indicated the update function is never called?</p> <p>I do not want to, and cannot use a framework, nor do I have access to use firebug, so please do not suggest these things. I am aware of them and use them when I can.</p> <p>I would also like to know if calling php from within makewindows() is preferred to having makewindows simply take a parameter.., is there any advantage or disadvantage to each approach?</p> <p>I seem to get an error when trying to call the function, this is how I am doing it in PHP:</p> <pre><code>echo "&lt;li&gt;&lt;a href='#' onclick=update('Layer3','2','0','hello')'&gt;Link 1&lt;/a&gt;&lt;/li&gt;" . </code></pre> <p>which makes this html, which should be fine?"\n"; </p> <pre><code>&lt;li&gt;&lt;a href='#' onclick='update('Layer3','2','0','hello')'&gt;Link 1&lt;/a&gt;&lt;/li&gt; </code></pre> <p>edit: I have taken tester101'S advice and changed it to this:</p> <pre><code>echo '&lt;li&gt;&lt;a href="#" onclick="update(\'Layer3\',\'2\',\'0\',\'hello\')"&gt;Link 1&lt;/a&gt;&lt;/li&gt;' . "\n"; </code></pre> <p>Which still gives an error. I will probably end up using toms answer, but would like to know why this is not working.</p>
[ { "answer_id": 359368, "author": "Jan Aagaard", "author_id": 37147, "author_profile": "https://Stackoverflow.com/users/37147", "pm_score": 0, "selected": false, "text": "windows.alert(\"GetXmlHttpObject started.\");" }, { "answer_id": 359387, "author": "Tom Haigh", "autho...
2008/12/11
[ "https://Stackoverflow.com/questions/359328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1246613/" ]
359,332
<p>I refactor my code and I am looking for a solution to grep my source files for something like</p> <pre><code>if ( user &amp;&amp; user.name &amp;&amp; user.name.length() &lt; 128 ) ... </code></pre> <p>in order to replace it later with ruby's andand or groovy's ?. operator (safe navigation operator).</p>
[ { "answer_id": 362870, "author": "krusty.ar", "author_id": 43981, "author_profile": "https://Stackoverflow.com/users/43981", "pm_score": 2, "selected": false, "text": "line = \"user && user.name && user.name.length()\"\np line.match(/(?:(\\w*)(?:\\s\\&\\&\\s(\\1\\.(\\w*)))(?:\\s\\&\\&\\s...
2008/12/11
[ "https://Stackoverflow.com/questions/359332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45327/" ]
359,342
<p>For a web application, I would like to create a simple but effective licensing system. In C#, this is a little difficult, since my decryption method could be viewed by anyone with Reflector installed.</p> <p>What are some methods for encrypting files in C# that are fairly tamper-proof?</p>
[ { "answer_id": 359923, "author": "Wolfwyrd", "author_id": 15570, "author_profile": "https://Stackoverflow.com/users/15570", "pm_score": 6, "selected": true, "text": "sn -k c:\\keypair.snk\n" }, { "answer_id": 1316907, "author": "mark", "author_id": 161372, "author_pro...
2008/12/11
[ "https://Stackoverflow.com/questions/359342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31516/" ]
359,347
<p>I would like to execute multiple commands in a row:</p> <p>i.e. (just to illustrate my need):</p> <p><code>cmd</code> (the shell)</p> <p>then</p> <p><code>cd dir</code></p> <p>and</p> <p><code>ls</code></p> <p>and read the result of the <code>ls</code>.</p> <p>Any idea with <code>subprocess</code> module?</p> <p><strong>Update:</strong></p> <p><code>cd dir</code> and <code>ls</code> are just an example. I need to run complex commands (following a particular order, without any pipelining). In fact, I would like one subprocess shell and the ability to launch many commands on it.</p>
[ { "answer_id": 359355, "author": "unwind", "author_id": 28169, "author_profile": "https://Stackoverflow.com/users/28169", "pm_score": 2, "selected": false, "text": "subprocess.Popen()" }, { "answer_id": 359432, "author": "Oli", "author_id": 22035, "author_profile": "h...
2008/12/11
[ "https://Stackoverflow.com/questions/359347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18648/" ]
359,351
<p>I have a multi-user eclipse (3.4) installation with a shared master configuration area. Users need to override <code>user.name</code> with their full name and the usual method (adding -Duser.name=... to eclipse.ini) is not suitable since the override must be per-user. I've tried setting user.name in config.ini (inside each user's <code>configuration</code> directory):</p> <pre><code>user.name=Luca Tettamanti </code></pre> <p>but it does work, eclipse still retains the login name. The strange thing is that:</p> <pre><code>user.foobar=Luca Tettamanti </code></pre> <p>is correctly picked up. Is it possible to somehow override user.name in this configuration?</p>
[ { "answer_id": 359417, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 3, "selected": true, "text": ".cmd" }, { "answer_id": 359443, "author": "jamesh", "author_id": 4737, "author_profile": "https://Stackoverf...
2008/12/11
[ "https://Stackoverflow.com/questions/359351", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42448/" ]
359,354
<p>I'm trying to use the EntLib 3.1 within .net code for a dll which is registered for COM interop. Where do I put the config file? </p> <p>Alternatively, is there a way to specify within the dll code where it should get the entlib config from? Since my dll will be called from COM I don't always know what exe will be calling it.</p> <p>I created a simple app which uses entlib Logging, with two classes: 'CallingApp' and 'MyComThing'. When I call a method of MyComThing from CallingApp it logs using the configuration in CallingApp's config file. When I call the method of MyComThing from a vbs script, ie through COM, I get an error "The configuration section for Logging cannot be found in the configuration source". My COMThing.dll.config file is in the same folder as the registered COMThing.dll, ie in the bin\debug\ folder.</p> <p>thanks!</p>
[ { "answer_id": 360308, "author": "Rory", "author_id": 8479, "author_profile": "https://Stackoverflow.com/users/8479", "pm_score": 3, "selected": true, "text": " string dllConfigFilename = Assembly.GetExecutingAssembly().Location + \".config\";\n FileConfigurationSource exce...
2008/12/11
[ "https://Stackoverflow.com/questions/359354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8479/" ]