input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Null values reading data from Excel using ADO <p>I am reading data from an Excel 2007 spreadsheet using ADO. Setting up the connection is easy:</p>
<pre><code>Dim ado As ADODB.Connection
Set ado = CreateObject("ADODB.Connection")
ado.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=myFilename.xlsx;Ext... | <p>I've found the ADO connection strings here are unbelievably picky. I've gotten reading the spreadsheets to work but with a slightly different connection string:</p>
<blockquote>
<p>Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileName + @";Extended Properties="Excel 12.0;IMEX=1";</p>
</blockquote>
<p>(I do... |
How to find all unselected checkboxes? <p>In jQuery, how does one go about finding all the 'unchecked' checked boxes.</p>
<pre><code>$(':checkbox:checked');
</code></pre>
<p>appears to be me all checked boxes, but what I need is all non-checked boxes.</p>
| <p>You use the <a href="http://docs.jquery.com/Selectors/not#selector"><code>:not</code></a> selector, like so:</p>
<pre><code>$('input:checkbox:not(:checked)');
</code></pre>
<p>Or the <a href="http://docs.jquery.com/Traversing/not#expr"><code>.not</code></a> function, like so:</p>
<pre><code>$('input:checkbox').no... |
IIS VS 2008 / Web.config - wrong date format <p>can anyone help. I have recently moved servers, its IIS7 rather that our previous IIS6 but everything else is the same, i have set the region to the UK and all date formats plus system local .. I mean everything ..</p>
<p>But when a webpage asp.net is running on IIS7 it ... | <p>Make sure you have also ticked the box in Regional and Language Options (Advanced tab) to say "Apply all settings to the default user profile. The account that .Net runs under will remain as US unless you do this. Reboot.</p>
<p>Been there :)</p>
|
archive-like format using XML <p>I'm generating some code using <code>XSLT</code> but the generated sources should be localized in a set of <em>distinct</em> files. Is there a tool/format (based on XML ?) that could be used to store the files in a jar/ar/tar-like format . I'm thinking of something like this:</p>
<pre>... | <p>At the end, I've implemented <strong>Xar</strong> the tool I needed. See <a href="http://code.google.com/p/lindenb/wiki/Xar" rel="nofollow">http://code.google.com/p/lindenb/wiki/Xar</a></p>
|
Can Microsoft Code Contracts be used with an ASP.NET Website? <p>I'm currently using <a href="http://research.microsoft.com/en-us/projects/contracts/">Microsoft Code Contracts</a> in an ASP.NET MVC application without any issues but I can not seem to get it quite running in a basic ASP.NET Web site. I'm not entirely su... | <p>I had the same problem and this is how I solved it:</p>
<p>In the Referenced Class Libraries, right click -> properties -> code contracts.
Make sure "perform contract checking" is checked. I had mine set to "Full"
Contract Reference Assembly: make sure it is set to "Build"</p>
<p>Save your changes.</p>
<p>In the ... |
Rebuild Sitecore Search index and link database in a background process <p>We have a staged environment with 1 CMS and 3 Slave servers</p>
<p>I want to create a page on the slave server, which will be called by the staging module on a successful publish, that will rebuild all indexes and the links database.</p>
<p>I ... | <p>I've come across this issue before with Sitecore and took a slightly different approch. Instead of having a page that the staging module calls I tapped into the publish:end event and added a custom handler to rebuild the Link Database.</p>
<pre class="lang-xml prettyprint-override"><code><event name="publish:en... |
Pulling MX record from DNS server <p>I am writing an application that is requiring me to do a DNS lookup for an MX record. I'm not sure if anyone has had experience doing this kind of work but if you do, any help would be appreciated.</p>
<p>EDIT:
The thing that I'm going for is an application that will send an e-mai... | <p>The simplest method is to simply use commonly available tools.</p>
<p>The basic "dig" command will return the records to you via this query:</p>
<pre><code>dig mx example.com
</code></pre>
<p>If you want just the lines with the mx records...</p>
<pre><code>dig mx example.com | grep -v '^;' | grep example.com
</c... |
How do I install/use the phpize command? <p>I am intending to use SQLite 3 with PHP 5. I found this: <a href="http://packages.debian.org/etch/web/php5-sqlite3" rel="nofollow">http://packages.debian.org/etch/web/php5-sqlite3</a> but I am having problems with installation:</p>
<ol>
<li>unzip & untar the package</li>... | <p>The instructions you've got don't typically make sense for Windows, unless you're running GNU Make. </p>
<p>You ought to have a look at this:
<a href="http://us2.php.net/manual/en/sqlite3.installation.php" rel="nofollow">http://us2.php.net/manual/en/sqlite3.installation.php</a></p>
|
Is there a Scala unit test tool that integrates well with Maven? <p>My company is beginning to write some code using Scala. I've been moved onto this project, and am a big fan of TDD, so I would like to get a unit-testing framework in place. However, the build system we're using for this project is Maven, and that's ... | <p>ScalaTest 1.0 has:</p>
<p>org.scalatest.junit.JUnitRunner</p>
<p>You can use it with JUnit's RunWith annotation. Maven likes that. There's also a Maven plugin now for ScalaTest, written by Jon-Anders Teigen. Right now you'll need to grab it from Jon-Anders github page:</p>
<p><a href="http://github.com/teigen/mav... |
How do I calculate the number of days, minus Sundays, between two dates in C#? <p>I am creating a Library Management System. </p>
<p>I have used the timestamp to calculate the Date Difference and with the help of date difference I am calculating the Fine also.</p>
<p>Now this date difference includes all days in a we... | <p>Essentially, you can calculate the raw number of days; you need to find the number of Sundays to be subtracted from that number. You know that every 7 days is a Sunday, so you can divide your raw number of days by 7, and subtract that number from your raw number of days. Now you need to remove the number of Sunday... |
LinkButton Click Event <p>I have this problem ..
I have one "Login" linkbutton and one "UserList" linkbutton on one masterpage. When the user is logged in, and he clicks "UserList" linkbutton, the UserList Page which has the masterpage mentioned above, opens.(This i have achieved).</p>
<p>but if the user is not logge... | <p>Try this: </p>
<p>In the HTML of the <strong>MasterPage</strong>: </p>
<p>Define an event handler for <strong>LinkButtonLogin</strong>'s onclick event:</p>
<pre><code><asp:linkbutton id="LinkButtonLogin" runat="server"
text="Login" onclick="LinkButtonLogin_Click"></asp:linkbutton>
</code></pre>... |
JQuery Accordion Activation <p>Is there another way to activate an accordion menu besides the</p>
<p>.accordion('activate', indexval); method? In IE7 this changes my header DIV formatting (it smashes it). The accordion is at the base of the page so when it is activated my header disappears. Can anyone offer me some h... | <p>I once had a similar problem, by default accordion will use <code><h3></code> tags for it's header elements. Your page header probably has an <code><h3></code> tag in it that you aren't expecting to be in the accordion.</p>
<p>What you could do, is change the headers in #HwReferences to <code><h5>... |
Is there a way to delete all iPhone application data? <p>Update:</p>
<p>The app is running on the device of an ad-hoc user.</p>
<p>I just want to delete a single application's data.</p>
<p><hr /></p>
<p>Original question:</p>
<p>Is there a way to completely wipe the an iPhone application's directory easily?</p>
<... | <p>Have them delete the app from their phone first. That will delete the application folder. Then they can install a fresh copy with no saved files in the app's directory.</p>
|
Is pure client-side dom manipulation possible using Rails' prototype helper? <p>I have a div that I want to show or hide depending on whether a hyperlink is clicked. This obviously doesn't require any server-side interaction. But is there a way to do this using Rails' prototype helpers? Or should I simply use JQuery or... | <p>You should absolutely be using jQuery. The best reason is because of how little code it is:</p>
<pre><code>$("a.myLink").click(function() { $("#myDiv").toggle() });
</code></pre>
|
Spring: How to programmatically define FactoryBean <p>I want to programmatically setup a FactoryBean on an existing ApplicationContext.
There are a lot of examples on how to define a bean programmatically (e.g.: <a href="http://www.carlobonamico.com/blog/2008/01/22/how-to-dynamicallyprogrammatically-define-spring-beans... | <p>The way you provided with the link given is exactly the way to go. For a <code>BeanFactoryPostProcesser</code> there is no difference between a class implementing <code>FactoryBean</code> or one that doesn't. All you typically do is register a <code>BeanDefinition</code> via <code>BeanDefinitionRegistry</code>.</p>
|
How would I create an asynchronous notification system using RESTful web services? <p>I have a Java application which I make available via RESTful web services. I want to create a mechanism so clients can register for notifications of events. The rub is that there is no guarantee that the client programs will be Java... | <p>I can think of four approaches:</p>
<ol>
<li><p>A Twitter approach: You register the Client and then it calls back periodically with a GET to retrieve any notifications.</p></li>
<li><p>The Client describes how it wants to receive the notification when it makes the registration request. That way you could allow JMS... |
Get the last visited pages of a User of our ASP.NET Site? <p>Is it possible get the last visited pages by user using C# / ASP.NET (without using javascript)</p>
| <p>You can get in some cases the page from which the user came with <a href="http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.referer.aspx" rel="nofollow">Referer</a>.</p>
|
How do you avoid JQuery toggle() on a layout div from causing your layout to move around? <p>I have a JQuery function that toggles one of the divs in my layout. The problem is that the whole layout moves around on the screen when the div appears or disappears. Is there a way to achieve the same show/hide effect without... | <p>You could wrap that div in another div that maintains the proper width/height to keep the layout consistent.</p>
<pre><code><div style="width:300px;height:200px">
<div class="animateMe">
<p>When I close, the outer div will still be there.</p>
</div>
</div>
</code></pre>
... |
How to backup SQL Server Agent jobs? <p>How can I backup and restore SQL Server 2005 Agent job schedules?</p>
| <p>the msdb database is where all the jobs live, it is one of the system databases</p>
|
Will creating a new app pool disrupt anything in IIS 6? <p>I have a website in IIS 6, let's call it "WebSite1." I have a virtual application underneath it, let's call it "VirtualApp1." Both of these are set up to use the same application pool, "AppPool1." I want to create a new application pool, "NewAppPool," and switc... | <p>I've done this many times on a production server, and never experienced any problems or hickups.</p>
<p>So I'd say: no, go ahead! :)</p>
|
How to support "AddType x-mapp-php5 .php" on my development machine <p>My ISP requires me to put the following in my .htaccess files:</p>
<pre><code>AddType x-mapp-php5 .php
</code></pre>
<p>But that breaks my development machine.</p>
<p>I don't really understand what that directive is for, but I'm sick of commentin... | <p>You could try the <a href="http://httpd.apache.org/docs/2.0/mod/core.html#ifmodule"><code><IfModule></code></a> Apache directive to distinguish your development machine from the production machine.</p>
<p>E.g. the following would work if you're running PHP as an Apache module, and your ISP runs it as CGI:</p>... |
Microsoft Dynamics CRM as a software development platform? <p>My organisation is in the final stages of acquiring CRM 4.0 for use as a general purpose software development platform. The company who is selling it to us has convinced upper management that CRM will solve all our productivity problems and make software dev... | <p>I've worked with MS CRM 3.0 and now 4.0 here's my take:</p>
<ol>
<li><p>Whenever possible focus on standard best practices. Don't get overly confused by what CRM is doing or wants you to do. </p></li>
<li><p>Don't be afraid to break what's "supported" by MS. With some caveats on 2 major factors - will your compa... |
Always need to empty browser history <p>I have a C#/.NET website on my local machine that I use to test. </p>
<p>Everytime I run the website in Internet Explorer 7, I have to empty the browser history or it will stay logged on as the previous person.</p>
<p>How do I make it so it lets me log in without having to empt... | <p>Your login information is stored in the session and that sets a cookie in IE7. So you don't have to clear the whole history - just a session cookie for the site.
Alternatively you could implement 'logout' functionality in your app.</p>
|
Before-the-dot-in-a-file-name, what is it called? <p>After-the-dot-in-a-file-name, it is called extension.</p>
| <p>It's called the basename. In fact, there's a unix/linux command for it:</p>
<blockquote>
<p>basename - strip directory and suffix
from filenames</p>
</blockquote>
|
How to bind a classes property to a TextBox? <p>I have a Customer class with a string property comments and I am trying to bind it like this:</p>
<pre><code><asp:TextBox ID="txtComments"
runat="server"
TextMode="MultiLine" Text=<%=customer.Comments %>>
</asp:TextBox>
</cod... | <p>Alternatively you can set the value in the Page_Load event of the code behind file:</p>
<pre><code>txtComments.Text = customer.Comments;
</code></pre>
|
MVC view testing javascript with Visual Studio <p>I have MVC view with javascript. What would be the best way to test my view?</p>
| <p>You can use a JavaScript unit testing framework like <a href="http://jania.pe.kr/aw/moin.cgi/JSSpec" rel="nofollow">JSSpec</a></p>
<p>Additionally, you can use a web app testing tool like <a href="http://seleniumhq.org/" rel="nofollow">Selenium</a></p>
|
When stop testing using TDD? <p>I don't know so much about Test-Driven Development (TDD), but I always hear that i need to start the development with some test cases. Then, I need to make this tests pass with the most simple solution. And then create more tests to make my tests fail again...</p>
<p>But the question is... | <p>Shamelessly copying Kent Beck's answer to <a href="http://stackoverflow.com/questions/153234/how-deep-are-your-unit-tests/153565#153565">this question</a>.</p>
<blockquote>
<p>I get paid for code that works, not
for tests, so my philosophy is to test
as little as possible to reach a given
level of confidenc... |
Changing XML Namespace with Scala <p>I am using scala to load a XML file from file via the <code>scala.xml.XML.loadFile()</code> method. The documents I'm working with have namespaces already defined and I wish to change the namespace to something else using scala. For example, a document has a xmlns of "http://foo.com... | <p>Here it is. Since NamespaceBinding is nested (each ns has a parent, except TopScope), we need to recurse to fix that. Also, each ns has an URI and a prefix, and we need to change both.</p>
<p>The function below will change just one particular URI and prefix, and it will check all namespaces, to see if either prefix... |
Umbraco: List Child Nodes in User Control <p>I have a user control in which I need to return child nodes based on parentID. I am able to get the parentID, but don't know the syntax for returning child nodes. </p>
| <p>Getting child nodes is pretty straightforward.</p>
<p>Not sure how far you are with your code so here's a complete example with the various options:</p>
<pre><code>using umbraco.presentation.nodeFactory;
namespace cogworks.usercontrols
{
public partial class ExampleUserControl : System.Web.UI.UserControl
... |
Is there a function pointer or array of functions in PowerShell? <p>I would like to do something like this. Index into an array of functions and apply the appropriate function for the desired loop index.</p>
<pre><code>for ($i = 0; $i -lt 9; $i++)
{
$Fields[$i] = $Fields[$i] | $($FunctionTable[$i])
}
#F1..F9 are d... | <p>Here's an example of how to do this using the call (&) operator.</p>
<pre><code># define 3 functions
function a { "a" }
function b { "b" }
function c { "c" }
# create array of 3 functioninfo objects
$list = @(
(gi function:a),
(gi function:b),
(gi function:c)
)
0, 1, 2 | foreach {
# call functions at ... |
Parsing a String in Ruby (Regexp?) <p>I've got a string</p>
<pre><code>Purchases 10384839,Purchases 10293900,Purchases 20101024
</code></pre>
<p>Can anyone help me with parsing this? I tried using StringScanner but I'm sort of unfamiliar with regular expressions (not very much practice).</p>
<p>If I could separate i... | <pre><code>string = "Purchases 10384839,Purchases 10293900,Purchases 20101024"
string.scan(/(\w+)\s+(\d+)/).collect { |type, id| { :type => type, :id => id }}
</code></pre>
|
How to launch wifi network shortcut using C# <p>I have created a shortcut in C:\Temp folder for Wifi Network connection (special kind of short cut)</p>
<p>I am trying to launch this using C#</p>
<pre>
System.Diagnostics.Process myProc = new System.Diagnostics.Process();
myProc.StartInfo.FileName = "C:\\Temp\\wifi.ln... | <p>You're missing a colon in your path. I created the shortcut on my desktop, and then ran the following, and it worked as expected...</p>
<pre><code>System.Diagnostics.Process myProc = new System.Diagnostics.Process();
myProc.StartInfo.FileName = @"C:\Users\scott\Desktop\wifi.lnk";
myProc.Start();
</code></pre>
|
Network tools that simulate slow network connection <p>I would like to visually evaluate web pages response time for several Internet connections types (DSL, Cable, T1, dial-up etc.) while my browser and web server are on the same LAN or even on the same machine. Are there any simple network tools or browser plug-ins t... | <p>On Linux, see <a href="http://www.linuxfoundation.org/collaborate/workgroups/networking/netem">netem</a>: the kernel already contains support for traffic shaping, and can simulate high latency, low bandwidth, packet losses, and all sort of other adverse conditions, even on a loopback device (so you don't need a real... |
What types of SVG gradient fills are supported when using the Embed meta tag in ActionScript3 <p>I've been trying to embed some svg files into an AS3 project using the Embed meta tag. For example:</p>
<pre><code>[Embed(source = "assets/image.svg")]
private var Image : Class;
</code></pre>
<p>However when displaying ... | <p>Just a suspect, I never heard of SVG in ActionScript before:</p>
<p>Inkscape doen't create new gradients every time you assign one to an element and modify it. Rather it creates an empty gradient and references to an original. Like this:</p>
<pre><code><linearGradient id="linearGradient4168">
<stop styl... |
DOS Batch command to process 1 file at a time <p>I am trying to execute a certain task where i am required to read files (one at a time) from a folder which can have undefined number of files. I need to be able to MOVE the first file in the folder to a new location and then execute another task with another batch file.... | <p>You can use a for command something like this:</p>
<pre><code>for /R c:\test\src %i IN (*.*) DO (
MOVE %i C:\test\dest
YourBatch.bat C:\test\dest\%~nxi
)
</code></pre>
<p>If you are putting this command in a batch file you will need to double up the % symbols like this:</p>
<pre><code>for /R c:\test\src %%i IN (*... |
How come the gridView Page is not inserting or updating or refreshing. What am I doing wrong? <p>How come the gridView Page is not inserting or updating or refreshing. What am I doing wrong?</p>
<pre><code>protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{
using (SqlConnectio... | <p>Does your DetailsView1 mapped to the DetailsView1_ItemInserting method in the code front? </p>
<pre><code><asp:DetailsView ID="DetailsView1 " runat="server"
DataSourceID="SqlDataSource"
DataKeyNames="HoursId"
OnItemInserted="DetailsView_ItemInserted"
OnItemUpdated="DetailsView_ItemUpdate... |
separate directory for iphone resources <p>iPhone resources by default show up in a "Resources" group that's visible in the main xcode project view. I want to be able to put them into an actual, physically separate directory at some arbitrary location on my machine decided by me. Interestingly enuf, the default "Classe... | <p>Right click on Resources, add existing files, choose your directory<br />
and select "Create Folder References for any added folders".</p>
<p>Voilà .</p>
|
How to set bean property value in jsf page? <p>I have Facelet component and I have backing bean for it. When I include my component to some page I pass bean from page to my component:</p>
<pre><code><ui:include src="./WEB-INF/templates/myTemplate.xhtml">
<ui:param name="pageBean" value="#{... | <p>Usually you assign values to some input controls like:</p>
<pre><code><h:inputText value='#{pageBean.field}'/>
</code></pre>
<p>That implies both getting and setting the value of <code>someField</code> property.
Please provide details on what should determine the value of <code>#{pageBean.field}</code> in y... |
Using NetBeans IDE 6.7 with J3D's Canvas3D Container <p>I keep telling myself that this should be simple, and yet I'm completely lost. Let me start by saying that I'm new to NetBeans IDE, and that I am using it out of necessity. I don't really know much about it yet.</p>
<p>I have successfully designed my main window ... | <p>The Canvas3D is a heavyweight component meaning it uses a native peer component to hook into DirectX or OpenGL so probably this kind of component is not available for drag and drop. Though you could try extending a JPanel.</p>
<p>You can setup the layout manually quite easily using a BoderLayout.</p>
<pre><code>M... |
Cocoon lite / XML and XSLT publishing framework <p>What publishing frameworks (publishing only, NOT full-blown CMS) based on XML, XSLT sitemaps and pipelines exist, are stable, active, and simpler / lighter than Cocoon?</p>
<p>I have glanced at:</p>
<ul>
<li><p>mod_xslt (<a href="http://www.mod-xslt2.com/" rel="nofol... | <p>some people argue that what has been done with cocoon 8 or 10 years ago is now best done with REST. (search for REST or restful with goolge)</p>
<p>in combination with XProc, its very powerful but can be light as well.
I think calabash ist the best option for XProc, but there are others. (One example is maybe exist... |
MDI Child form calling, not generation <p>I have an MDI form with 3 nested children with in it. As of right now all it can do is display a new form. For example: each time I press the menu button, the new child form(Form1) is created. Now, if I press that same menu button a second or subsequent time a <em>new</em> Form... | <p>I think what you want here is a class level variable for the form. Something like -</p>
<pre><code>'Class level (outside of a method)
Dim NewMDIChild As InventoryForm1
Private Sub RadMenuItem1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles RadMenuItem1.Click
if (NewMDIChild Is Nothing) Then
NewMDIC... |
respond with 404 error from asp.net page codebehind <p>I have a scenario in which I'm <a href="http://www.west-wind.com/weblog/posts/76293.aspx">serving a file</a> from codebehind.</p>
<p>which file, depends on request. in some cases there will be no file to serve and I want to return 404 to the browser.</p>
<p>how c... | <p>you can use the <a href="http://msdn.microsoft.com/en-us/library/system.web.httpresponse.statuscode.aspx">Response.StatusCode</a> property to return a 404:</p>
<pre><code>Page.Response.StatusCode = 404
</code></pre>
<p>As for the question of whether it's the "correct thing to do" I'd say it depends how the Page is... |
Finding all Controls on a Page <p>If I start with</p>
<pre><code>Page.Controls
</code></pre>
<p>Then recursively call all the children control.Controls, will the guarantee that I find all the controls that exist on a given page. Are there any time that orphaned controls can exist, or any other controls that will not ... | <p>It will find all the controls that exist when you ask. There's nothing to say that more controls won't be added later, after DataBinding, for instance.</p>
<p>Maybe you want to check in the OnPreRenderComplete method?</p>
|
Django file upload input validation and security <p>I'm creating a <strong>very</strong> simple django upload application but I want to make it as secure as possible. This is app is going to be completely one way, IE. anybody who uploads a file will never have to retrieve it. So far I've done the following:</p>
<ol>... | <p>Disallowing a file extension is -- potentially -- a waste of time. A unix server doesn't use the extension -- it uses ownership and permissions. </p>
<p>When accepting an upload, you will often rename the file to prevent it being misused. Uploaded files should be simply named "upload_xxx" with the "xxx" being a ... |
Finding partial strings in a list of strings - python <p>I am trying to check if a user is a member of an Active Directory group, and I have this:</p>
<pre><code>ldap.set_option(ldap.OPT_REFERRALS, 0)
try:
con = ldap.initialize(LDAP_URL)
con.simple_bind_s(userid+"@"+ad_settings.AD_DNS_NAME, password)
ADUser = co... | <p>If the format example you give is somewhat reliable, something like:</p>
<pre><code>import re
grps = re.compile(r'CN=(\w+)').findall
def anyof(short_group_list, adu):
all_groups_of_user = set(g for gs in adu.get('memberOf',()) for g in grps(gs))
return sorted(all_groups_of_user.intersection(short_group_list))
... |
IT evaluating quality of coding - how do we know what's good? <p>Coming from an IT background, I've been involved with software projects but I'm not a programmer. One of my biggest challenges is that having a lot of experience in IT, people often turn to me to manage projects that include software development. The pr... | <p>Great question. Should get some good responses.</p>
<ol>
<li>Code cleanliness (indented well, file organization, folder structure)</li>
<li>Well commented (not just inline comments, but variables that say what they are, functions that say what they do, etc.)</li>
<li>Small understandable functions/methods (no craz... |
The field must have a documentation header - Style Cop - Code smell? <p>I was just running style cop against some of my code and got a few:</p>
<pre><code>SA1600: The field must have a documentation header.
</code></pre>
<p>Now don't get me wrong I like style cop, it's great when you work on a project with more then ... | <p>This is quite an old post but came across it while searching for a solution to this issue myself, so though I would offer a solution.</p>
<p>If you open your <em>Settings.StyleCop</em> file in the rules editor, select the <em>Documentation Rules</em> node, then in the <em>Detailed settings</em> section on the right... |
Is there a GZIP J2ME library? <p>Is there a gzip compression library that will work on J2ME?</p>
| <p>Try <a href="http://jazzlib.sourceforge.net/" rel="nofollow">Jazzlib</a>, although it's GPL, and seems like it hasn't been updated for a while. Another option is to try and lift the source from <a href="http://gcc.gnu.org/java/index.html" rel="nofollow">libgcj</a> (which is what jazzlib did).</p>
<p><a href="http:/... |
How to hide a custom field type from new column choices <p>I'm trying to figure out a clean way to hide a custom field type from the list of available columns when a user goes to add a new column to a list. I only want this field type to show up when a given feature has been activated (the feature could be site, web, ... | <p>In XML file, please set </p>
<pre><code><Field Name="UserCreatable">FALSE</Field>
</code></pre>
<p>I't work with me</p>
|
Inserting a line to a known block of text <p>I define a 'block' of text as all lines between start of file, newline or end of file:</p>
<pre><code>block1
block2
block3
anotherblock4
anotherblock5
anotherblock6
lastblock7
lastblock8
</code></pre>
<p>Any text can occupy a block - it is unknown what lines are there.
I... | <p>This does what you want and gets rid of the unwanted <code>newline</code> at the beginning:</p>
<pre><code>sed -n "1{x;d};H;\${g;s/\n\n/\nTEST\n\n/2;p}"
</code></pre>
|
PHP (folder) File Listing in Alphabetical Order? <p>I'm not sure how simple this would be, but I'm using a script which displays the files from a specific folder, however I'd like them to be displayed in alphabetical order, would it be hard to do this? Here's the code I'm using:</p>
<pre><code>if ($handle = opendir($m... | <p>Instead of using <code>readdir</code> you could simply use <code>scandir</code> (<a href="http://tw.php.net/manual/en/function.scandir.php">documentation</a>) which sorts alphabetically by default.</p>
<p>The return value of <code>scandir</code> is an array instead of a string, so your code would have to be adjuste... |
How can I efficiently calculate the binomial cumulative distribution function? <p>Let's say that I know the probability of a "success" is P. I run the test N times, and I see S successes. The test is akin to tossing an unevenly weighted coin (perhaps heads is a success, tails is a failure).</p>
<p>I want to know the... | <p><strong>Exact Binomial Distribution</strong></p>
<pre><code>def factorial(n):
if n < 2: return 1
return reduce(lambda x, y: x*y, xrange(2, int(n)+1))
def prob(s, p, n):
x = 1.0 - p
a = n - s
b = s + 1
c = a + b - 1
prob = 0.0
for j in xrange(a, c + 1):
prob += factor... |
extract fileName using Regex <p>If I want to match only <code>fileName</code>, i.e,</p>
<p>in <code>C://Directory/FileName.cs</code>, somehow ignore everything before <code>FileName.cs</code> using Regex.</p>
<p>How can I do it?</p>
<p>I need this for a Compiled UI I am working on ... can't use programming language ... | <p>Something like this might work:</p>
<pre><code>[^/]*$
</code></pre>
<p>It matches all characters to the end of the line that are not "/"..</p>
<p>If you want to match paths that use the "\" path separator you would change the regex to:</p>
<pre><code>[^\]*$
</code></pre>
<p><em>But do make sure to escape the "\... |
Can I disassemble my code in PLTScheme? <p>Can I see the translated machine instruction of a scheme function like (disassemble) in LISP?</p>
| <p>There is a <code>decompile</code> module providing a function by the same name. It can be used to decompile a bytecode file into a kind of a human-readable form. However, this is not a linear assembly-language representation (that is what gets generated dynamically by the JIT), and it's questionable whether it wil... |
Are SSL certificates bound to the servers ip address? <p>We have two different ldap providers in two different physical office locations.</p>
<p>When I connect my laptop to one location and I 'retrieve from port' (in Websphere 6.1) to import the ssl cert of the ldap provider, I can authenticate to the respective ldap ... | <p>SSL certificates are bound to a 'common name', which is usually a fully qualified domain name but can be a wildcard name (eg. *.domain.com) or even an IP address, but it usually isn't.</p>
<p>In your case, you are accessing your LDAP server by a hostname and it sounds like your two LDAP servers have different SSL c... |
Is there any way to show, or throw, a PHP warning? <p>I have a select() method in a database class, that has an optional boolean argument $sum. This argument is used to say if the method should or not use COUNT(*) too.</p>
<p>I would like to show a warning, like those normal PHP errors, if I try to access class->sum i... | <p>If you want to generate a warning, you should write </p>
<pre><code>trigger_error($yourErrorMessage, E_USER_WARNING);
</code></pre>
<p><a href="http://php.net/manual/en/function.trigger-error.php"><code>trigger_error()</code></a> has the <code>$error_type</code> parameter for setting the error level (<code>Notice<... |
MS-SQL 2005 search: conditional where clause with freetext <p>I'm writing a fairly complex stored procedure to search an image library.</p>
<p>I was going to use a view and write dynamic sql to query the view, but I need to use a full text index, and my view needs outer joins (<a href="http://stackoverflow.com/questio... | <p>I know it's a year later and a newer version of SQL but FYI...</p>
<p>I am using SQL Server 2008 and have tried to short circuit using</p>
<pre><code>AND ( @searchText = '' OR freetext(Name, @searchText))
</code></pre>
<p>and I receive the message "Null or empty full-text predicate" when setting @searchText = ''.... |
Object to YAML Serializer in C# <p>Is there a library ( in C#) that serializes an object's property to yaml format and converts it to string so that I can print it as a string?</p>
| <p>Yes I think there are some please look <a href="http://www.yaml.org/" rel="nofollow">here</a>.</p>
|
What does RED text mean in the Firebug net tab? <p>I can't seem to find any help on this but under the Net tab in Firebug, one of my sites is showing red highlighted items. Unfortunately the site is protected right now so I can't post the link.</p>
<p><img src="http://imgur.com/hueWT.gif" alt="Firebug"></p>
<p>Can a... | <p>Ordinarily it indicates a 404 error or some other error, but here you have a 200 status. Use the plus button to expand and look at the response headers. What do they say?</p>
<p><strong>Edit:</strong> I checked the Firebug source. It definitely means their was a response header in the 400 or 500 range. </p>
<p>Why... |
RSS <link> tag not appearing in <head> of Drupal view page display output <p>I have a Drupal 6 site with a view that has a page and a feed display. Both the page and the feed work great. The view just shows content type Story in reverse chronological order- basic blog listing page.</p>
<p>While the RSS look good, the ... | <p>In Drupal 6 this is no longer automatic.</p>
<p>Edit the view and under "Feed Settings" set "Attach to" to the page that you want to autodiscover the feed. </p>
|
C# program quitting/crashing suddenly, how to break it? <p>So my C# program is quitting/disapearing/closing/crashing suddenly even in debug mode.
How can I make it break/pause/stop so as to find out where caused it?</p>
| <p>Set a breakpoint (by clicking the left of the line numbers--it's a red circle) that you know is before the point where it crashes and then step through it (using F8). The last statement that you're on is the one that it's crashing at.</p>
|
SharePoint problem while adding custom menu item in document library <p>I have written a feature(Site scoped) that adds custom menu items to the New Menu and EditControlBlock of a SharePoint 2007 document library. These menu items should show up only when the user has add and edit permissions for that document library.... | <p>you may need to try and elevate their permissions in the code. </p>
<pre><code>SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite(web.Site.ID))
{
// implementation details omitted
}
});
</code></pre>
<p><a href="http://msdn.microsoft.com/en-us/library/microsoft.share... |
Pylons/Routes rewrite POST or GET to fancy URL <p><strong>The behavior I propose:</strong></p>
<p>A user loads up my "search" page, www.site.com/search, types their query into a form, clicks submit, and then ends up at www.site.com/search/the+query instead of www.site.com/search?q=the+query. I've gone through a lot of... | <p>HTML forms are designed to go to a specific URL with a query string (<code>?q=</code>) or an equivalent body in a <code>POST</code> -- either you write clever and subtle Javascript to intercept the form submission and rewrite it in your preferred weird way, or use <code>redirect_to</code> (and the latter will take s... |
DB2 Exception handling <p>The problem that I am facing is primarily on Exception Handling! When an exception occurs I want to put that data in another log table with the error message. However, in DB2 I am not able to figure out a way to retrieve the corresponding error message for the raised SQLSTATE. </p>
<p>PS: I h... | <p>DB2 has an SQLERRM function too. All you need to to is capture all of the tokens from the error and feed them into the function for the equivalent message you'd get from the CLP. </p>
<p><a href="http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/topic/com.ibm.db2.luw.sql.rtn.doc/doc/r0022027.html" rel="nofollow"... |
Does user write permissions to the Temporary ASP.NET Files folder pose any security problems? <p>I am experiencing assembly binding failures due to insufficient permissions to the Temporary ASP.NET Files folder.</p>
<p>The application uses (web.config) Forms authentication with Impersonate = True and IIS Windows Integ... | <p>ASP.NET requires write permission to the Temporary ASP.NET files folder, it shouldn't be a security risk providing you only grant permission to that folder and not any higher as it sits within the c:\windows folder. </p>
<p>This <a href="http://msdn.microsoft.com/en-us/library/aa302435.aspx" rel="nofollow">MSDN art... |
.Net XML Serialization issue <p>My confusion is, I am using .Net C# XMLSerializer to serialize a customize defined type, using the schema/cs file generated by XSD tool from an input original XML file. But the generated serialized XML file namespace is different from original XML input file. Especially from original XML... | <p>Aren't they interchangeable? In one it is using <code>xmlns</code> to set the namespace at the element, and in the other a <code>xmlns:soapenv</code> alias - but the meaning is the same, and IMO the second version is cleaner.</p>
<p>There is the <code>XmlSerializerNamespaces</code> class that can fix this ; full ex... |
XSLT: Use Named template to copy XSD to XSD <p>I have the XSD content in <a href="http://www.pesc.org/library/docs/standards/Sector%20Library/AcademicRecord%5Fv1.4.0.xsd" rel="nofollow">this file</a>.</p>
<p>Using this xsl, I can copy the contents of the desired element:</p>
<pre><code><?xml version="1.0" encoding... | <p>This is a bit of a shot in the dark, but I think you are missing the correct handling of namespaces in your XSL stylesheet.</p>
<p>The "<code>complexType</code>" template you made does not match the "<code>xs:complexType</code>" nodes have. You must declare the <code>xs</code> namespace, like this:</p>
<pre><code>... |
How to update rows in jQuery with PHP and HTML <p>My PHP script generates a table with rows which can optionaly be edited or deleted. There is also a possibilety to create a new Row.</p>
<p>I am having a hard time to figure out how to update the HTML rows which are generated through PHP and inserted via jQuery. After ... | <p>place all your event-handlers outside the ajax function and use the <code>live()</code> method instead. And you need to include what data to send when using ajax. From <a href="http://visualjquery.com/" rel="nofollow">visualjquery</a>:</p>
<pre><code>$(function() {
$.ajax({
type: "POST",
url: "s... |
Why doesn't JUnit provide assertNotEquals methods? <p>Does anybody know why JUnit 4 provides <code>assertEquals(foo,bar)</code> but not <code>assertNotEqual(foo,bar)</code> methods? </p>
<p>It provides <code>assertNotSame</code> (corresponding to <code>assertSame</code>) and <code>assertFalse</code> (corresponding to ... | <p>I'd suggest you use the newer <a href="http://junit.sourceforge.net/doc/ReleaseNotes4.4.html"><code>assertThat()</code></a> style asserts, which can easily describe all kinds of negations and automatically build a description of what you expected and what you got if the assertion fails:</p>
<pre><code>assertThat(ob... |
document.getElementById().innerHTML fails with 'Unknown Error' in IE <p>I'm trying to use document.getElementById().innerHTML in a JavaScript to change information in a webpage. On FireFox this works as described in the W3C documentation, however, the same method returns 'Unknown Error' in IE. The JavaScript looks like... | <p>IE does not let you add.alter table rows that way. You will need to use DOM Methods removeChild, appendChild, and createElement OR insertRow and insertCell</p>
|
Support for encoding query string or POST data in YUI? <p>How do you encode a javascript object/hash (pairs of properties and values) into a URL-encoded query string with YUI (2.7.0 or 3.0.0 Beta) ?</p>
<p>I want to do the equivalent of <a href="http://prototypejs.org/api/object/toquerystring" rel="nofollow">Object.to... | <p>I've made this little helper for my own project.</p>
<pre><code>var toQueryString = function(o) {
if(typeof o !== 'object') {
return false;
}
var _p, _qs = [];
for(_p in o) {
_qs.push(encodeURIComponent(_p) + '=' + encodeURIComponent(o[_p]));
}
return _qs.join('&');
};
/... |
Instantiate class from name? <p>imagine I have a bunch of C++ related classes (all extending the same base class and providing the same constructor) that I declared in a common header file (which I include), and their implementations in some other files (which I compile and link statically as part of the build of my pr... | <p>This is a problem which is commonly solved using the <a href="http://sinnema313.wordpress.com/2009/03/01/the-registry-pattern/">Registry Pattern</a>:</p>
<blockquote>
<p>This is the situation that the
Registry Pattern describes:</p>
<blockquote>
<p>Objects need to contact another
object, knowing on... |
Setting character encoding with request parameter <p>Is it possible to pass a request param containing the encoding to a filter which checks if there is a value and sets it as character encoding? I have read that calling the method to setting the character encoding should be done before reading the request params. Is t... | <p>This problem is solved in <a href="http://stackoverflow.com/questions/2657515/detect-the-uri-encoding-automatically-in-tomcat">http://stackoverflow.com/questions/2657515/detect-the-uri-encoding-automatically-in-tomcat</a>.</p>
|
Access Modules in Flex <p>I have build a module in Flex that I call myModule, this module has a method myMethod. Now I use the ModuleManager to load this module.</p>
<pre><code>mod = ModuleManager.getModule("myModule.swf");
mod.addEventListener(ModuleEvent.READY, modEventHandler);
mod.load();
</code></pre>
<p>now I w... | <p>I'm not entirely sure how the module manager works. But generally I use a module loader to display my modules. However there were only 2 ways I have seen to access a modules functions.</p>
<p>You can access the function directly by:</p>
<pre><code>mod.child.myMethod();
</code></pre>
<p>Or you need to create an... |
Designing a generic data class <p>I want to popuate a listbox with objects of different types. I display the type (humanized) of the object in the listbox.</p>
<p>I created a class ListBoxView that overrides the ToString method and returns a string according to the type. I create a List of ListBoxView and databind thi... | <p>Actually I think I'd just implement <code>ToString()</code> on <code>Car</code>, <code>Human</code> etc and not bother with this class at all. Otherwise you'll have to update this class every time you add a new type.</p>
<p>If you're worried about I18n of the type names, then keep this class, but only so you can p... |
SQL Server 2008 Management Studio doesn't recognize new Schema <p>I have created a new Schema in a database called Contexts. Now when I want to write a query, Management Studio doesn't recognize the tables that belong to the new Schema. It says: 'Invalid object name Contexts.ContextLibraries'...</p>
<p>Transact-SQL:</... | <p>Try to refresh local cache of Management Studio:</p>
<p>Management Studio Menu >> Edit >> IntelliSense >> Refresh Local Cache</p>
<p>or use shortcut:</p>
<p>CTRL + SHIFT + R</p>
<p>I always forget that it's there.</p>
|
How to get the list of SqlInstances of a paricular machine <p>Can anyone tell me how to get remote Sqlserver instances using c# and SMO or any api?</p>
<p>I have a remote server name "RemoteMC", which has 2 instances of sql server: "RemoteMc" and "RemoteMC\sqlexpress"</p>
<p>I try to get the instances in code like th... | <p>The <code>SmoApplication.EnumAvailableSqlServers</code> method is what you're looking for. There are 3 overloads, and one of those takes a <code>string</code> parameter for the server name.</p>
<p>It returns a <code>DataTable</code> whose rows have fields like <code>Version</code>, <code>name</code>, <code>IsLocal<... |
Javascript OLE Word <p>I want to show a MS Word environment in an Iframe without all the toobars. The document that is being showed contains input fields. After these fields are filled in, the document must be printed. I have created the print button and want the (filled in) document printed when this button is clicked... | <p>I think <a href="http://support.microsoft.com/kb/286023/en-us/" rel="nofollow">this link</a> may be the answer to your question.</p>
|
Why doesn't VS 2008 IDE remember my preferences? <p>This is a very petty question that I'm only asking while <a href="http://imgs.xkcd.com/comics/compiling.png" rel="nofollow">compiling</a>... ;)</p>
<p>For some reason my VS 2008 IDE doesn't remember my window preferences when I close & reopen - it resets the win... | <p>The window positions are stored in the following file:</p>
<pre><code>%APPDATA%\Application Data\Microsoft\VisualStudio\9.0\windows.prf
</code></pre>
<p>I'm guessing that you don't have write access to this file, or something.</p>
<p>Anyway if you can somehow delete this file, it will regenerate it when you next ... |
How do I map custom types in Linq to Sql? <p>I have a Customer class that contains a property, MyProperty, which is of a custom type MyCustomType. I want to persist the property value in the database as text. In the designer I've set the Type to 'MyType' and the Server Data Type to 'varchar(10)'. When I build the pr... | <p>A class to a varchar? I'm not aware of any functionality that supports this in LINQ-to-SQL. Your best bet may be a simple property (it can be private if you need):</p>
<pre><code>[Column(Name="ColumnName", DbType="varchar(10) NULL", CanBeNull=true)]
private string MyPropertyString {
get { /* serialize MyPropert... |
In C Left shift (char) 0xFF by 8 and cast it to int <p>On left shift of (char) 0xff by 8 and casting it to int we get -256 or 0xffffff00.
Can somebody explain why this should happen? </p>
<pre><code>#include <stdio.h>
int main (void)
{
char c = 0xff;
printf("%d %x\n", (int)(c<<8),(int)(c<<... | <p><code>char</code> can be signed or unsigned - it's implementation-defined. You see these results because <code>char</code> is signed by default on your compiler.</p>
<p>For the signed char 0xFF corresponds to â1 (that's how two's complement work). When you try to shift it it is first promoted to an <code>int</cod... |
Silverlight Toolkit Charting Control - Show "Column" Colours <p>In the silverlight toolkit chart control, the legend on the X Axis can show an indeterminate amount of points. E.g. 1,2,3,4,5.</p>
<p>Would it be possible to colour the virtual columns that this creates? I.e. in the space where legend mark 2 is shown, th... | <p>It's not really possible due to the fact that there are no virtual columns created.</p>
<p>The chart is a canvas and the scatter point is just a point positioned on it. Your best bet would be to create your own ColumnSeries type and then style it to look like a ScatterSeries with your desired background colour.</p>... |
Movie, Image Editing, Mixing Audio in IPhone <p>I need to develop some sort of application featuring Editing Movie slices, Adding and editing images, Adding sound . recording movie, Adding effects, setting transitions between movie clips and images.</p>
<p>so is there any provision in SDK 3.0? I will use iPhone 3GS<... | <p>Unfortunately, there isn't a lot of support for a program like this on the iPhone yet. With the 3GS and OS 3.0, your program can let the user record a video and trim it, but everything after that is left to you to do from scratch. You get the filename of the recorded video, but there are no OS calls to even do som... |
Ruby to Groovy <p>I have a framework written in Ruby that needs to be converted into Groovy.<br>
It does not use anything outside of core ruby, but a lot of meta programming.</p>
<p>Are all the same basic features supported by Groovy and is the changeover complicated?</p>
| <p>Groovy and Ruby are not terribly different, but the metaprogramming aspect changes a bit.</p>
<p>Although I am not a Groovy expert, I can refer to you some pointers in the documentation (<a href="http://groovy.codehaus.org/Dynamic+Groovy">http://groovy.codehaus.org/Dynamic+Groovy</a>):</p>
<p>Dynamic method callin... |
Remove File with white spaces on its name <p>I have a file named "my file.pdf" and I can't delete this file with this code:</p>
<pre><code>if (remove("/var/tmp/\"my file.pdf\"") != 0)
printf( "Error deleting file\n");
</code></pre>
<p>Any suggestion different than do some regex to replace '{whitespace}' f... | <p>The remove() function does not use regexes. Does your file really contain quote characters as well as spaces? If not, and if the file contains a single space then:</p>
<pre><code>if (remove("/var/tmp/my file.pdf") != 0)
</code></pre>
<p>should work.</p>
|
What are the drawbacks of accessing DOM elements directly by ID? <p>Today I stumbled upon the possibility to access a DOM element in Javascript simply by its id e.g. like this:</p>
<pre><code>elementid.style.backgroundColor = "blue"
</code></pre>
<p>I tested with a very short snippet if this works in IE, Firefox and ... | <p>It is propriety Microsoft gubbins. It doesn't work in lots of browsers — especially in standards mode (and you want standards mode to avoid <a href="http://www.cs.tut.fi/~jkorpela/quirks-mode.html">quirks mode</a> inconsistencies such as IE getting <code>width</code> wrong).</p>
|
Use of extension methods to enhance readability <p>What is the general thinking on the use of extension methods that serve no purpose other than enhancing readability?</p>
<p>Without using extension methods we might have the method</p>
<pre><code>IEnumerable<DependencyObject> GetDescendents(DependencyObject roo... | <p>I think the big advantage of extension methods is discoverability. If someone is unaware that one of their team members created a GetDescendents method in a utility class somewhere, they'll never use it. However, if that method starts to show up in Intellisense or in the Object Browser, there's a decent chance they ... |
How should I store data inside custom exceptions? <p>When dealing with custom exceptions, I usually inherit from Exception and then add some fields/properties to my exception class to store some additional info:</p>
<pre><code>public class MyException : Exception
{
public int ErrorCode{get;set;}
public MyExce... | <p>If you are bothering to create your own exception, you don't need the Data property. Data comes in useful when you want to store a bit of extra information in an existing exception class, but don't want to create your own custom exception class. </p>
|
How on earth is this rails query working? <p>I have just optimised some Ruby code that was in a controller method, replacing it with a direct database query. The replacement appears to work and is much faster. Thing is, I've no idea how Rails managed to figure out the correct query to use! </p>
<p>The purpose of the q... | <p>The *acts_as_taggable_on_steroids* plugin tells your Place model that it has_many Tags through Taggings. With this association specified, ActiveRecord knows that it needs to join taggings in order to get to the tags table. The same thing holds true for HABTM relationships. For example:</p>
<pre><code>class Perso... |
Can python mechanize handle HTTP auth? <p>Mechanize (Python) is failing with 401 for me to open http digest URLs. I googled and tried debugging but no success. </p>
<p>My code looks like this.</p>
<pre><code>import mechanize
project = "test"
baseurl = "http://trac.somewhere.net"
loginurl = "%s/%s/login" % (baseurl, ... | <p>Mechanize claims that the parameters should be uri, username and password as parameters, but you have four parameters. Four parameters are correct for urllib2.add_password, but then the first parameter should be the realm, not the uri.</p>
<p><a href="http://wwwsearch.sourceforge.net/mechanize/" rel="nofollow">http... |
Web Service use in Android <p>How can we use Web services in Android Applications? </p>
| <p>See my question here: <a href="http://stackoverflow.com/questions/992880/unresolved-host-exception-android">http://stackoverflow.com/questions/992880/unresolved-host-exception-android</a></p>
|
RegEx for ICQ UIN <p>What <code>RegularExpressionValidator.ValidationExpression</code> should I use to allow only ICQ UIN like input?</p>
<pre><code>xxx-xxx-xxx and xxx-xxx-xx and xx-xxx-xxx and xxxxxxxxx so on..
</code></pre>
<p>i.e. with dash as separator and without.</p>
| <p>You can use the following simple expression.</p>
<pre><code>^([0-9]-?){7,8}[0-9]$
</code></pre>
<p>The drawback is, that it allows things like <code>1-2-3-4-5-6-7-8</code>. If you want to restrict the layout more, you can use complexer expressions.</p>
<pre><code>^(?=([0-9]-?){8,9})([0-9]{2,3}-?)*(?<!-)$
</cod... |
In Perl, how can I convert all newlines to spaces in a string? <p>Are there any functions are available for converting all newlines in a string to spaces?</p>
<p>For example: </p>
<pre><code>$a = "dflsdgjsdg
dsfsd
gf
sgd
g
sdg
sdf
gsd";
</code></pre>
<p>The result is am looking for is:</p>
<pre><code>$a = "dfl... | <p>I would recommend restricting the use of <code>$a</code> and <code>$b</code> to sort routines only. </p>
<p>For your question, <code>tr///</code> is more appropriate than <code>s///</code>:</p>
<pre><code>#!/usr/bin/perl
use strict;
use warnings;
my $x = q{dflsdgjsdg
dsfsd
gf
sgd
g
sdg
sdf
gsd};
$x =~ tr{\n}{ }... |
Linking to full category pages using the category tag in RSS 2.0 <p>Using the category tag in RSS 2.0:</p>
<pre><code><category domain="http://mysite.example.com/tags">
Science and Technology
</category>
</code></pre>
<p>How would I provide an additional URL to the page that shows all of the items in ... | <p>Yes, it should be perfectly safe to extend with a namespace - that is, after all, written explicitly in the spec at <a href="http://cyber.law.harvard.edu/rss/rss.html#extendingRss" rel="nofollow">http://cyber.law.harvard.edu/rss/rss.html#extendingRss</a></p>
|
Using locale date format in Joomla modules <p>How to output a date in the locale date/time format in Joomla?</p>
<p>I'm creating a module which is supposed to print dates. I know I can dirty-hack it like that:</p>
<pre><code> strftime(format_string, strotime($date));
</code></pre>
<p>... but I would like a smooth... | <p>In Joomla! 1.5 there is the JDate class:</p>
<pre><code>function getLocalizedDate($date = 'now', $format_string = '%Y-%M-%D')
{
jimport('joomla.utilities.date');
$jdate = new JDate($date);
return $jdate->toFormat(JText::_($format_string));
}
</code></pre>
<p>Weekday & Month names are localized by t... |
.NET MVC - Form submit causes postback instead of onSubmit javascript execution <p>i'm trying to submit my Ajax form using jQuery. However calling the submit() function causes the entire page to refresh. It should just execute the onSubmit part of the form (which returns <code>false</code> so that the page shouldn't re... | <p>If you use the HTML Ajax.BeginForm you cant just commit the form, because the form is somehow hooked up with ASP.NET MVC Ajax. </p>
<p>There are 3 solutions:</p>
<p><strong>Easiest and best way</strong></p>
<p>Use jquery $.AJAX to commit the form</p>
<p><strong>Easy but strange way</strong></p>
<p>Put a submit ... |
Wrapping Web-Services for COM <p>I have zero experience with COM. I actually never thought, I'll need to do something with COM, thinking it's something that I luckily managed to avoid. Oh, well.</p>
<p>I need to create a wrapper for Web Services, which could be used from COM. I was hoping, that it's a solved problem, ... | <p>You can call a Web Service from just about anywhere, including VB6 and COM.</p>
<p>If you can create an XMLHTTP60 COM object, here's an SO answer that shows you how to use it: <a href="http://stackoverflow.com/questions/122607/what-is-the-best-way-to-consume-a-web-service-from-vb6/122645">What is the best way to co... |
Resources for learning a new language quickly? <p>The title may seem slightly self-contradictory, and I accept that you can't really <em>learn</em> a language quickly. However, an experienced programmer that already has knowledge of a few languagues and different styles (functional, OO, imperative etc.) often wants to ... | <p>You generally have two main things to overcome:</p>
<ul>
<li>Syntax</li>
<li>Reference</li>
</ul>
<p>Syntax you can pick up fairly quickly with a language tutorial and a stack of samplecode.
Reference (library/API calls) you need to find a proper guide to; perhaps the language reference, or perhaps google...</p>
... |
Converting SQL2008 RDL file to SQL2005 <p>How do I convert a RDL file that was created using the SQL2008 designer to work on SQL2005 Reporting services?</p>
| <p>There is no specific downgrade path see this <a href="http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=350119">link</a> for the official MS statement.</p>
<p>If you're feeling adventurous (and lucky) you could try converting your 2008 RDL to match the 2005 but I'm guessing that would be ... |
How to add an assembly in other assembly? <p>I have a dll called Test.dll in which I have a class called ABC which has a method FindTYpe.
Now, I have a project called TestB and I have added the reference of Test.dll in TestB.
Now, if I am trying to find a type XYZ in TestB, from <code>Test.ABC.FindTYpe()</code>, it's t... | <p>You'll need to post your code for FindType(). My guess is that you're doing something like;</p>
<pre><code>System.Reflection.Assembly.GetExecutingAssembly().GetTypes()
</code></pre>
<p>to find a list of types to search through, and the type in TestB.dll isn't in Test.dll, so the item isn't found. </p>
<p>You migh... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.