Saturday, February 5, 2011

JavaScript-friendly alternative to the f(x) = y JScript idiom that's used when setting CDO.Message options

I have an ASP page written in JScript that sends e-mails using CDO.Message. For specifying an SMTP server (and other options) I'm doing something like this:

    "") =

Now, here comes the catch. I have this code in a stand-alone include file that I include in an HTML page as JavaScript so that I can run unit tests against it in a browser (using JsUnit etc.). I have JavaScript mock objects (Server, Request, etc.) that create a mock ASP environment for the included JScript code. The only problem I have left is with the CDO.Message option setting. Since the f(x) = y syntax that's used in the above code excerpt is not valid JavaScript (invalid left-hand operand), I can't run this piece of code (as it is) within a browser. I'm currently simply bypassing it in my unit test with a conditional that detects whether the environment is truly ASP.

I don't think that there's a JavaScript workaround to this. I'm looking for an alternative syntax (that may use the ActiveX interfaces differently) to setting CDO.Message options that would also be syntactically valid JavaScript.

  • I figured out the answer when looking at the C++ code example at

    The solution is to make the assignment explicitly to the Value property:

        "").Value =

    This way, the code above is valid JavaScript than can be tested with a mock Configuration object.

    From Ates Goral

How do I include filtered rowcounts from two other tables in a query of a third?

I have a MySql database with three tables I need to combine in a query: schedule, enrolled and waitlist. They are implementing a basic class enrollment system.

Schedule contains the scheduled classes. When a user enrolls in a class, their user account id and the id of the scheduled class are stored in enrolled. If a class is at capacity, they are stored in waitlist instead. All three tables share a scheduleId column which identifies each class.

When I query the schedule table, I need to also return enrolled and waitlist columns that represent the number of users enrolled and waiting for that particular scheduleId.

A preliminary query I came up with to accomplish this was:

select, s.classDate, s.instructor, COUNT( as enrolled
from schedule as s
left outer join enrolled as e
on = e.scheduleId
group by

which works ok for one or the other, but obviously I can't get the values for both the enrolled and waitlist tables this way. Can anybody suggest a good way of doing this?

  • Two quick ways:

    1- Use COUNT(DISTINCT, COUNT(DISTINCT to get the number of unique instances in each table, then join on both. This is possibly hideously inefficient.

    2- Use subqueries in the FROM clause (only works in MySQL 5.0 and later):

    SELECT, s.classDate, s.instructor, tmpE.c AS enrolled, tmpW.c AS waiting
      schedule AS s,
      ( SELECT scheduleID, COUNT(*) AS c FROM enrolled GROUP BY scheduleID ) AS tmpE,
      ( SELECT scheduleID, COUNT(*) AS c FROM waiting GROUP BY scheduleID ) AS tmpW
    WHERE = e.scheduleID
        AND = w.scheduleID

    I may have missed a left join in there, though.

    From kyle
  • Use nested SELECT queries. Assuming a bit about your schema, how about something like this (might not work on some flavors of SQL):

    select, s.classDate, s.instructor, 
           (select COUNT( from enrolled e where e.scheduleId = as enrolled,
           (select COUNT( from waitlist w where w.scheduleId = as waiting
    from schedule as s
    group by
    From lc
  • I would do it with another left join and two inline count(distincts)

    select, s.classDate, s.instructor ,
    count(distinct as enrolled,
    count(distinct as waiting
    from schedule as s
    left outer join enrolled as e
    on = e.scheduleID
    left outer join waitlist as w
    on = w.scheduleID
    group by

    When I ran this approach versus the subqueries it executed about twice as fast, but I am looking at a pretty small result set.

    From cmsjr

Discover Microsoft SQL Servers on an Internal Network

What is the proper way using .NET to discover the Microsoft SQL Servers on your internal network? I think the SQL Management interface back in the SQL Server 7 days gave you a list of servers in a dropdown. How could I do the same thing with .NET 3.5.

Testrunner/framework for both .Net and Javascript?

My team develops software using multiple languages. We have a server app in .Net and much of our client code is written in JavaScript. (The client code is actually for xulrunner applications, which don't have good testing tools right now, but I hope that is overcome someday.)

I like the idea, though, of having one testing tool that can run tests for all of our code. Throwing out the xulrunner problem right now, and just considering .net and Javascript - are there any options for testing and automation to cover both of these areas? Most of the popular testing tools I have seen seem to be .Net-focused.

Or should I drop my desire to have one testing tool to rule them all, and simply choose the best of breed for each?

  • I'm using a single testing framework in a somewhat similar scenario - using NUnit to test both .Net and unmanaged C++ code. I just write the tests for the later in managed C++. This was nicer than using CppUnit IMO.

    But in your case, there isn't a similar bridge between the .Net and JavaScript worlds that you could use. So you are likely better off using dedicated test frameworks for each platform.

    From oefe

Hibernate session handling in spring web services

I am using spring-ws with Jaxb2Marshaller, PayloadRootAnnotationMethodEndpointMapping and GenericMarshallingMethodEndpointAdapter to configure my web services via the @Endpoint and @PayloadRoot annotations.

When I try to use the DAO's of my project I am able to load objects from the database but as soon as I try to access properties inside my service that should be lazily loaded I get a org.hibernate.LazyInitializationException - could not initialize proxy - no Session.

In my spring-mvc web application the OpenSessionInViewInterceptor handles the sessions. How do I configure my web service project to automatically create a Hibernate session for every web service call?

  • Wrap a org.springframework.aop.framework.ProxyFactoryBean around the object in the spring context that needs the hibernate session to be present.

    This article shows how to do it.

    If you experience problems because of lazy-loaded collections when using sessions this way there are at least 2 possible fixes:

    • Add a Hibernate.initialize() call to the collection in code that is executed with the Hibernate session available -
    • Use a non-lazy collection by adding lazy="false" to the mapping - watch out when using this option, you can easily force hibernate to load your whole database with a couple of badly placed lazy="false" options.
    Thomas Einwaller : I found out that the DAO works but lazy loading fails ... the tip in the link does not help me
    Simon Groenewolt : Added 2 possible fixes for this to my answer.
  • In the meanwhile I found a solution. This forum entry gave me the hint:

    Basically I added the @Transactional annotations to my web service implementation class. The tricky part was to tell spring to use the original class (not the proxy created by tx:annotation-driven) which I achieved by using the following configuration:

    <bean class="" >
        <property name="order" value="1" />
    <tx:annotation-driven mode="proxy" order="200" proxy-target-class="true" />

    The order of the configuration statements seems important too.

How to change the Keyboard layout on Solaris.


I am running a machine with SunOS and NO graphical enviroment. Does someone know how to change the keyboard layout from the console??


  • have a look at the loadkeys command

    pabloh84 : Thx, it accept the command but it doesn't actually do anything...
  • If it's running a recent Solaris 10 update release or patch set, or a release newer than Solaris 10 (such as Solaris Express or OpenSolaris), try kbd -s -- on older Solaris x86 releases, try kdmconfig.

    From alanc
  • Change the LAYOUT value in /etc/default/kbd (use "kbd -s" to get a list of allowed values). Then run "kbd -i" and finally reboot.

    From matli

.Net PostgreSQL Connection String

I am using PostgreSQL in a project I am working on, and one of the queries is timing out. I need to increase the timeout on the database connection, but since I am using my DAO through a complex wrapper to Active Record and NHibernate, I am not able to adjust the timeout of the command object - so I am hoping you can change the timeout through the connection string.

Any ideas?

  • Try this one:

    Provider=PostgreSQL OLE DB Provider;Data Source=myServerAddress;location=myDataBase;User ID=myUsername;password=myPassword;timeout=1000;

    Just replace the obvious parts (myUsername, myServerAddress, etc...) with your stuff.

    Also, for your reference, this site will give you connection string templates for pretty much any database on earth for pretty much any way you need to use it:

  • Have you tried to optimize the query? Optimizing is the best choice over increasing timeouts.

    Dana the Sane : I second this, explain analyse is your friend. Look for slow sequential scans and a poor join order, etc.
    From RedWolves
  • Npgsql-native connection string:

  • Found it: CommandTimeout=20;Timeout=15;

    From Ash

How to reference a DLL in the web.config?

Hi guys,

I have a DLL in the BIN folder, and I need it to be referenced in the web.config, or I get that annoying error:

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0234: The type or namespace name 'ServiceModel' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

This DLL is not in the GAC, and for that I can not use the

<assemblies><add ...

So my guess is that I need to use the configSections like

  <section name="Microsoft.System.Web" 
                 Version=, Culture=neutral,
                 PublicKeyToken=10633fbfa3fade6e "/>

What should be the correct code?

  • Funny I found that if the dll and all its dependencies are in the bin directory, it can be used even if not in the .SLN file or web.config.

    balexandre : Nop ... it only works because it will get the DLL's from the GAC. :) - if you do not have it there, then you wil get the error if not referencing it in the web.config
    Joshua : I guarantee you the DLLs are not in the gac.
    From Joshua
  • Unless the assembly you are using is strongly named, placing it in the bin directory is all you should need to do.

    The configSection you mention is not for adding references to assemblies. This is to define configuration sections in the web.config. So you could add a config section called exampleSection by adding a section tag to configsSections. This would allow you do create a configuration section named "exampleSection" later in the web.config.

    The reason that there is an assembly reference in the configSections section definition is that each config section is specific to an assembly for which it is providing configuration data. The configSection might be specific to the website assembly itself (in which case that is the assembly you would specify) or it might be some other assembly used by the site. Creating a configSection gives you the ability to group settings that are related in one section, instead of inter mingling them all application wide in the appsettings.

    If you gave more information about what you were having trouble with, maybe we could help. What is the assembly and how is it being used?

    balexandre : the dll name is in the question: Microsoft.System.Web, and seeing the tags you get that this is part of WCF REST
    From Jim Petkus

is it possible to migrate a single file from one svn repository to another while preserving history?

I started a small application in my personal svn repository. It's gained enough interest that it is worth moving development to a shared group repository. Can the app (only a single file) including it's history be migrated to the group repository?

how can my java code read OS environment variables?


this may be a very simple problem, but I couldn't find an answer googleing and I'm in a rush - so I'd appreciate fast code examples.

I have an environment variable on the OS i would like to read using java code. I've tried System.getProperty, but that only seems to work for the -D variables supplied directly for the JVM.

how can my java code read OS variables?

  • Try System.getenv(String name)

    Amir Arad : yes, silly me. thanks!
    Tom Hawtin - tackline : Although if you are still using 1.4 (which has end of lifed, but there's still paid support available), it will throw an Error.

SQL exception when trying make an prepared statement

I'm trying to pass the following String to a PreparedStatement:

private static final String QUICK_SEARCH = "select * from c where NAME like '% ? %'";

However, I get an SQL exception that the bind variable is missing.

Any suggestions?

  • You can't put binding variables inside a string like that.

    You need to use:

    SELECT * FROM c WHERE name LIKE CONCAT('%', ?, '%')

    or similar, depending on what functions are supported by your version of SQL.

    From Alnitak
  • Can't u make use of parameters inside of using string concatenation ?

  • cool,

    i just set the % signs when setting preparedstatement;

    pstmt.setString(1, "%" + name + "%");
    From combi001

Bazaar bound branch commit-and-update

I use bzr for websites. I have all my current ones set up so the master branch is kept on the server by having them bound. This means when I commit locally, the changes are automatically pushed out. All good so far.

But I still have to call an update on the remote server. While I can see this being great for some people, I'm finding it increasingly annoying.

Is there a way to commit, push and do a remote update all at the same time?

  • Automatic updates to the production website is bad, even with a VCS to go back up IMO. Anyway, did you looked at this?

    From Keltia
  • Perhaps a script? e.g.

    bzr commit $*
    bzr pull
    bzr push

    Put it in your PATH and give it an obvious name like "bzrsync". It's simple, but should save you a few keystrokes...

    From seanhodges
  • there are 2 plugins for bzr that could help you:



    The latter does not require to keep the branch with full history on the server at all.

    From bialix
  • bzr commit on a bound branch uploads your changes but does not update the working tree of the master branch.

    After your commit, bzr push should cause the working tree to update remotely.

    From xeon

C#: How do you control the current item index that displays in a ComboBox?

I have set a list of items in a combobox, but when I debug the application, I have to select an item from the drop down to display an item by default. Is there a property? that you can set so that the combobox itemindex will always begin at 0 meaning the first item in the list at startup of the application?

  • this.comboBox1.SelectedIndex = 0;
    From BFree
  • You are gonna want to use the SelectedIndex attribute.

    The SelectedItem property can only be read. Using the SelectedText and SelectedValue Properties will change the Text and Value not which one is selected

    From jmein

Are there any good guidelines, references, design patterns or just good advice for building HTML/JavaScript Air Apps.

I'm currently building a prototype AIR application for work. It allows our clients to download and work with their data and then synchronise with the server at some later time. Pretty standard stuff.

I'm an experienced web developer and so I have been fairly successful at getting this app into a reasonable state for demonstration, but in the near future I'll have to get it production ready. In preparation for this I'll need to do a bit of research on best practices for this kind of thing.

Any advice you can give would be most appreciated. I would like to hear about

I've organised my app into a roughly MVC pattern with a rudimentary signal/slot system for inter object communication. this works quite well but I think it may begin to creak if the project were very much larger.
I have an object that communicates with the database server, another that handles the local, SQLite data. An object that handles the various views, both static and dynamic html. A controller that marshals the other objects and handles the flow and a small config object that loads, stores and handles configuration data.
Does this sound reasonable? What have other people done? Are there any good demos/tutorials or good references?

I haven't really spend much time on security because we're at prototype stage but I'm all ears! I'm using CSV to move the data around at the moment but in the end it'll be AMF over HTTPS.

Distribution and updates
I'm developing in Linux. Is this going to be a problem when the app is packaged up? Is AIR on Linux as capable as on Windows or Mac? Will I be able to make a proper installer/badge? Will I be able to get the update framework working?
In general though, because I'm not this far down the line, is making the .air file as simple as it seems? Works like a charm on my machine.

I think that's enough for now unless anyone spots something I've left out.

Thanks :)

  • I have used AIR quite successfully for this sort of thing, and intend to converge with you at the MVC abstraction level. From one of my SO questions, my attention was directed to this. Maybe you could look it over and let me know what you think. At a high level it seems to coincide with your description of your design.

    I'm using AMF - tried starting with JSON but AMF is more direct and for my purposes functionally equivalent.

    My app is used by a couple dozen people across random platforms, Windows and Mac and Linux. Installation is painless. I post one installation package, and the Adobe installer figures out what runtime stuff is needed for the platform being served, and makes sure things are set up correctly with no attention on my part. It completely abstracts out platform dependencies, and there was no learning curve.

    From le dorfier

Is there a 'standard' read/write lock implementation for ruby?

Does anyone know of an existing ruby implementation of a read/write lock -

Preferably this would be in a popular library or some other implementation that's been used by enough people that it's fairly bulletproof at this point.

  • There isn't a standard one to my knowledge, but they aren't terribly hard to write. Failing that, this guy has already written one. It looks right and he's provided tests.

    From Pesto

jQuery + MVC User Controls

What I'm trying to do is pass parameters to a user control view which will update a div tag and render the new data based on a hidden user control there. I know how to update a div tag using the Ajax.Form() Helper Method but passing parameters and updating the partial control is beyond me. I've never used jQuery and looked up some tutorials on how to implement it within mvc but I've hit too many dead ends and need some help figuring out a solution. What I currently have is this and need to extend it to update the user control view.


<form id="formParams">
    <input name="textSearch1" type="text" />
    <input name="textSearch2" type="text" />
    <input name="btnTest" type="submit" onclick="$get('recordsForm').onsubmit()" value="Click Me" />
<% using (Ajax.Form(
            new AjaxOptions
                UpdateTargetId = "records",
                OnSuccess = @"function(sender, args){}",
                HttpMethod = "GET"
            new { @id = "recordsForm" }))
    <div id="records">
        <img src="<%= Url.Content("~/Content/Images/load.gif") %>" alt="loading..." />

ACSX file

<%= ViewData["searchText1"].ToString()%> is the search you entered.

Controller CS File

public ActionResult Records(string searchText1, string searchText2)

            ViewData["searchText2"] = searchText2 + " Stop sucking at jQuery Ayo";
            ViewData["searchText1"] = searchText1;

            return View("Records");

  • I figured it out.. wow all i had to do was incorporate the elements into the ajax form instead of having it in a separate form outside of it.

    From Ayo

Converting an integer Into a List?

Hi, i am currently trying to convert an integer into a list.


1234 => List composed of 1, 2, 3, 4

I have this:

(string->list (number->string 1234))

Unfortunately it adds #'s and \'s to it. I am guessing this is a string representation of a number. How can i remove these symbols. Since i need to reorder the integers, and print out a list.

This is the output of the command above:

(#\1 #\2 #\3 #\4)

  • Here's a function I wrote that breaks the number down by dividing by 10 each time:

    (define (num->list num)
      (if (< num 10)
          (list num)
          (append (num->list (floor (/ num 10)))
                  (list (- num (* 10 (floor (/ num 10))))))))

    Obviously this will only work with positive integers, but if you need negatives it can be easily modified.

  • I'm not familiar with scheme, but a slightly more code intensive, language-independent approach would be to use a math loop to get each digit out.

    if 1234 is x: digit_1 = x%10 digit_2 = x%100 - digit_1 digit_3 = x%1000 - digit_2 - digit_1 etc.

    You would need to add a check at each station, such that if x < 1000, stop after digit 3. Depending on the language, you can add a loop to this in various ways.

    From bigwoody
  • When you covert the string to a list, you are building a list of chars, thats why you get the #. #\ is the character delimiter.; so when you are done your list manipulation, you can reconvert it back to a string fairly easily.

  • As Jonathan said, #\ means that it is a character. So you have to convert the character to number. Here is a simple way to do it.

    (map (lambda (c) (- (char->integer c) 48))
             (string->list (number->string 1234)))

Can I run no-parsed header scripts under Apache 2.2.9 without the nph- preface?

I have a basic Apache 2.2.9 setup under fedora core 8. I would like to set my own HTTP headers to come out (HTTP Forbidden / 403).

If I name the file, it works. If I name the file, it fails and I get a server error, type 500.

According to all web references I've found, the nph-filename convention was no longer necessary effective in Apache 1.3 forward.

Is there a header / apache configuration directive I need to make this work?

  • Are you sure that you need a no-parsed-header script for this? Have you tried printing a "Status" CGI header?

    print "Status: 403\n\n";

Maximum time for HTML metatag refresh


<meta http-equiv="refresh" content="n">

Is there a maximum value for n? Is there a number large enough to where the browser, or whatever is counting down, will fail to refresh after n seconds?

  • No, there is not. At least not within reasonable terms...I'm sure there's a limit to an HTML attribute, but the amount of numbers you could fit into that limit would cause the refresh to take so long you'd probably fall asleep. :P

    From Salty
  • WebKit uses double to store the delay.

    From Gumbo
  • What about -1? It should be accepted as infinite, and the page will never refresh.

    From ExploreIt

Possible to set max rows in MySQL table?

Hello! I have a question about tables in MySQL.

I'm currently making a website where I have files for people to download. Now I want to make a table in MySQL that will store the latest downloads, like if someone downloads then it will add a row in the table with the filename and date, so that I can show on the front page "Most recently downloaded files" or something like that.

And since I only need to display like 5-10 items I don't have to store more in the table. So what I want to know is if it's possible to set a max limit to how many rows there can be in a table. Like if it's set to 10 and there is 10 entries in the table, the next time it tries to add one it will automatically delete the oldest one, so there's always only 10 rows in the table.

  • Look at triggers to delete automatically the old rows.

    From Aif
  • This can be solved by using a trigger (MySQL 5 required) or setting up a cron job or something similar, that periodically checks the number of rows in the tables.

    From wvanbergen
  • I don't think you can set MySQL do it automatically (although my MySQL isn't exactly guru level, so I could be wrong there) so I think what you probably need to do is either create an INSERT trigger to DELETE the oldest row before you do the INSERT, or write your app so it always runs a DELETE prior to an INSERT.

    From gkrogers

All the reasons I can't access an instance of SQL 2005

I've installed an instance of SQL 2005 Express on <computername>/SQLEXPRESS. There is only once instance installed. I've allowed remote connections, turned on SQL authentication, enabled TCP/IP, Named Pipes and VIA but I still can't access the database from another computer. I keep getting:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)

What else can I look for? I'm sure my code is correct as it was used to connect to this same system prior to it being wiped. I'm pretty confident the connection string is correct as well:

Server=<computername>\SQLEXPRESS;User Id=<username>;Password=<password>;

There's also no firewalls standing between the two systems. They're on the same network segment and Windows Firewall has been shut off completely.

  • Is the SQL Server Browser running on the machine? For named instances, like \SQLExpress, the SQL Browser allows client machines to identify which port to connect to.

    By default, only the default instance runs on TCP 1433. If the client can't connect on the default port, it queries the SQL Browser at UDP 1434 to locate the correct port to use for a given named instance.

    Spencer Ruport : Ugh. Thank you. I didn't see a setting for that anywhere in SQL Management Studio or the Configuration Manager so I looked in services and it was disabled. Whatever happened to intuitive software??
    Jason Lepack : Better question, when did intuitive software begin?
    Spencer Ruport : Yeah I guess the days of messing with Autoexec.bat and config.sys weren't much better... and we didn't have Google back then either.

Visual Studio 2008 viewing dialog after breakpoint hit

I am building a C++ MFC application that creates modal dialog boxes, one at a time, while hiding the parent dialog. I wish to view the newly created modal dialogs when a breakpoint is hit when debugging in Visual Studio. However, anytime a breakpoint is hit, the contents of the dialog box are no longer rendered. The box simply goes white, or retains whatever image is imposed on top of it. The dialog displays normally when the program is resumed, but I need to be able to view the dialog box when the breakpoint is hit, while the program is "paused" by the Visual Studio debugger.

  • You can't do this: to repaint the content of the dialog requires that the program be running. If it's stopped at a breakpoint, it's not running.

    This is probably because you've got Visual Studio and your program sharing screen space, so that Visual Studio appears over your program. When you bring your program to the front, it needs to repaint (but can't because it's at a breakpoint).

    The first thing that comes to mind is to get another monitor, and to make sure that Visual Studio and your program are running on separate monitors -- that way, your program won't need to repaint itself, and you should see what was previously on the dialog.

    Alternatively, get two computers and remote debug from one to the other -- again, your program won't need to repaint itself, so you should still see what was there before.

  • There is one more thing you can do, temporarily put dialog.Invalidate(); dialog.SendMessage(WM_PAINT); after your breakpoint, make sure Visual Studio and the dialog are not overlapping, then step over the paint message. If the dialog is blanked it should fill.

    There are a lot of gotchas with setting up Remote Debug, but once you get the hang of it, it's invaluable. It will definitely take care of your current situation, and once you have an environment ready you'll solve future bugs faster. Lots of times I've hit a problem and said, "if I only had a good remote debug environment I'd do A, but instead I'll try inferior solution B first..."

    From Aidan Ryan

B2B web service using windows credentials?

Is this wise, what potential issues could you run into?

  • You need to be a bit more specific. This question is fairly unwieldy and a lot of assumptions would need to be made to give you a straight answer.

    Are you talking about managing authentication/authorization with LDAP or AD?

    Or are you talking about using the kerberos key generated when you login to authenticate with a web app, and that webapp uses that key to pass along to a web service?

    From Nathan

The diff between openssl-2 and openssl-3

New to this.

How can you tell what the openssl version is and what's the diff?

  • Find the current OpenSSL version on the OpenSSL webpage (0.9.8k as of 25-Mar-2009 and 1.0.0, third beta as of 15-Jul-2009). OpenSSL is a implementation of the TLS cryptographic protocol suite (amongst other things).

Sending form without mail client

Hi,everubody! can you help me with my trouble? I'm trying to create form for filling resume. User should not use mail client to submit form. How can I realize this idea on javascript or PHP?

  • If the form as a file upload... You can just upload the cv to the webserver and then use your application to send an Email using your account.

    From Sergio
  • First: You need a server based script. Without any server interaction, no mail can be sent.

    PHP has a mail() function and it works very well, if your server administrator enabled it. Very simple example:

    // The message
    $message = "Line 1\nLine 2\nLine 3";
    // In case any of our lines are larger than 70 characters, we should use wordwrap()
    $message = wordwrap($message, 70);
    // Send
    mail('', 'My Subject', $message);

    If mail() is disabled, you need to connect a SMTP server with correct credentials and then you can send mails via this connection. This function is implemented in the emailer module of phpBB2 e.g.

    Good luck!

    From furtelwart
  • Thanks, guys! You showed me right road to get out of my problem!

Getting the .NET framework setting for <compilation debug="true">

In my web.config I have the standard element;

<compilation debug="true" defaultLanguage="c#">

I know I could use [Conditional("DEBUG")] on methods, or use some pre-compiler if statement like #if DEBUG, but what I am looking for is the built-in .NET framework setting that lets me know if the setting for debug in the compilation section.

I've seen it done before but can't find it or remember it.

Duplicate - Programmatically access the <compilation /> section of a web.config?

  • HttpContext.Current.IsDebuggingEnabled (posted by Jason Diamond) was what I was looking for.

    Thanks for your help Marc!

    Marc Gravell : You might want to close the question, then. And maybe chuck Jason a +1 ;-p
    Dead account : How do I close a question? (Sorry - bit of a noob)

When debugging on WinCE, how can I set Visual Studio to always load symbol files it knows about?

I'm debugging a WinCE, C++ program in Visual Studio across an ActiveSync connection. Every time I start the process it fails to load symbol information. However, if I right click on the module and hit 'Load Symbols' it correctly locates the symbol information without any further prompting from me.

Is there a way that I can set Visual Studio to either:

  • (a) automatically load this symbol information, or
  • (b) automatically break the process into the debugger once it's loaded (similar to what windbg does)?

I'm guessing there's a setting somewhere, but I've yet to find it.

Update: I forgot to mention in the original question that I'm not debugging with the instance of Visual Studio that created the exe.

  • Visual Studio should be automatically loading symbols. But this can be disabled. Go to Tools -> Options -> Debugger -> Symbols. There should be a check box saying something like "Only Load Symbols from these locations when specifically asked to". If that box is checked then uncheck it.

    tsellon : I forgot to mention that I'd checked through those settings. That one is unchecked.
    From JaredPar

Force CascadingDropDown to refresh without page reload

How do I force a CascadingDropDown to refresh it's data without a page refresh? I have a button on the page which adds a variable to the Session which is then used to set the selected value of all the drop downs. However I can't seem to force the refresh of a DropDownList without a full refresh of the page.

  • Let's see - the button on your page probably has an event associated with it to respond to it being clicked, right?

    Can't you just reload and re-assign the data to the dropdown in the button "OnClick" event??

    public void OnButtonClick(.....)
      CascadingDropDown.DataSource = .......;

    Or am I missing something?

    Cheers, Marc

    From marc_s