instruction
stringlengths
0
30k
|regex|xhtml|
How would you programmacially abbriviate XHTML to an arbitrary number of words without leaving unclosed or corrupting tags? E.g. this: <p> Proin tristique dapibus neque. Nam eget purus sit amet leo tincidunt accumsan. </p> <p> Proin semper, orci at mattis blandit, augue justo blandit nulla. <span>Quisque ante congue justo</span>, ultrices aliquet, mattis eget, hendrerit, <em>justo</em>. </p> ...abbriviated to 25 words would be: <p> Proin tristique dapibus neque. Nam eget purus sit amet leo tincidunt accumsan. </p> <p> Proin semper, orci at mattis blandit, augue justo blandit nulla. <span>Quisque ante congue...</span> </p> Thanks, Nick
How would you programmacially abbriviate XHTML to an arbitrary number of words without leaving unclosed or corrupted tags? E.g. this: <p> Proin tristique dapibus neque. Nam eget purus sit amet leo tincidunt accumsan. </p> <p> Proin semper, orci at mattis blandit, augue justo blandit nulla. <span>Quisque ante congue justo</span>, ultrices aliquet, mattis eget, hendrerit, <em>justo</em>. </p> ...abbriviated to 25 words would be: <p> Proin tristique dapibus neque. Nam eget purus sit amet leo tincidunt accumsan. </p> <p> Proin semper, orci at mattis blandit, augue justo blandit nulla. <span>Quisque ante congue...</span> </p> Thanks, Nick
Check out "Writing Efficient Ruby Code" from Addison Wesley Professional: [http://safari.oreilly.com/9780321540034][1] I found some very helpful and interesting insights in this short work. And if you sign up for the free 10-day trial you could read it for free. (It's 50 pages and the trial gets you (AFAIR) 100 page views.) [https://ssl.safaribooksonline.com/promo][2] [1]: http://safari.oreilly.com/9780321540034 [2]: https://ssl.safaribooksonline.com/promo
Parsing manually is a lot of fun... at the beginning:) In practice if commands aren't very sophisticated you can treat them the same way as those used in command line interpreters. There's a list of libraries that you can use: [http://java-source.net/open-source/command-line](http://java-source.net/open-source/command-line). I think you can start with [apache commons CLI](http://commons.apache.org/cli) or [args4j](https://args4j.dev.java.net/) (uses annotations). They are well documented and really simple in use. They handle parsing automatically and the only thing you need to do is to read particular fields in an object. If you have more sophisticated commands, then maybe creating a formal grammar would be a better idea. There is a very good library with graphical editor, debugger and interpreter for grammars. It's called [ANTLR](http://www.antlr.org/) (and the editor [ANTLRWorks](http://www.antlr.org/works/index.html)) and it's free:) There are also some example grammars and tutorials.
How do you handle white space in your HTML
|html|
One of my biggest typographical frustrations about HTML is the way that it mangles conjoined whitespace. For example if I have: <span>Following punctuation rules. With two spaces after the period. </span> One of the two spaces following the period will be considered to be insignificant whitespace and be removed. I can of course, force the whitespace to be significant with: <span>Following punctuation rules.&nbsp; With two spaces after the period. </span> but it just irks me to have to do that and I usually don't bother. Does anyone out there automatically insert significant whitespace into external content submissions that are intended for a web page?
Generating a good hash is easier said than done. Remember, you're basically representing n bytes of data with m bits of information. The larger your data set and the smaller m is, the more likely you'll get a collision ... two pieces of data resolving to the same hash. The simplest hash I ever learned was simply XORing all the bytes together. It's easy, faster than most complicated hash algorithms and a halfway decent general-purpose hash algorithm for small data sets. It's the Bubble Sort of hash algorithms really. Since the simple implementation would leave you with 8 bits, that's only 256 hashes ... not so hot. You could XOR chunks instead of individal bytes, but then the algorithm gets much more complicated. So certainly, the cryptographic algorithms are maybe doing some stuff you don't need ... but they're also a huge step up in general-purpose hash quality. The MD5 hash you're using has 128 bits, with billions and billions of possible hashes. The only way you're likely to get something better is to take some representative samples of the data you expect to be going through your application and try various algorithms on it to see how many collisions you get. So until I see some reason to not use a canned hash algorithm (performance, perhaps?), I'm going to have to recommend you stick with what you've got.
You could drop off the constructor and just put them in each individual class. Then what you have is each class has its own __construct, which is probably the same depending on if it is a shipper or vendor. If you want to only have those constructs defined once I don't think you want to go down that route. What I think you want to do is make an abstract class that implements vendor, and one that implements shipper. There you could define the constructors differently. abstract class Vendor implements iVendor { public function __construct() { whatever(); } } abstract class Shipper implements iShipper { public function __construct() { something(); } }
You can use a styled pre block to preserve whitespace. Most WYSIWYG editors also insert &amp;nbsp; for you... Overall, it's good that the browser ignores whitespace. Just view the source on this website for yourself and imagine how crazy the site would look if every space was displayed.
I really like the [Apache Felix tutorials][1]. However, I think in general leveraging OSGi in your application isn't one of those "let's use this framework, because it's hype" decision. It's more of a design question, but then everything that OSGi gives you in terms of design, you can have with vanilla Java as well. As for the runtime, you cannot just add an existing application and make it OSGi enabled. It needs to be design to be dynamic. Spring DM makes it easy to hide that from you, but it's still there and you need to be aware of it. [1]: http://felix.apache.org/site/tutorials-examples-and-presentations.html
In Firebird writers never block readers and there are no dirty-reads. Only read-commited and snapshot isolation levels. It uses a multi-generational engine (like oracle i believe) instead of simple page or record locking.
Favicon must be an [.ico file](http://en.wikipedia.org/wiki/ICO_%28icon_image_file_format%29) to work properly on all browsers. Modern browsers also support PNG and GIF images. I've found that in general the easiest way to create one is to use a freely available web service such as [favicon.cc](http://favicon.cc/). After creating one, just put the favicon.ico file into your web server root directory.
Favicon must be an [.ico file](http://en.wikipedia.org/wiki/ICO_%28icon_image_file_format%29) to work properly on all browsers. Modern browsers also support PNG and GIF images. I've found that in general the easiest way to create one is to use a freely available web service such as [favicon.cc](http://favicon.cc/).
Use an interface that runs each response in a separate interpreter, such as `mod_wsgi` for Python. This lets multi-threading be used without encountering the GIL. EDIT: Apparently, `mod_wsgi` no longer supports multiple interpreters per process because idiots couldn't figure out how to properly implement extension modules. It still supports running requests in separate processes FastCGI-style, though, so that's apparently the current accepted solution.
I use [Subversion][1]. As an easy way to reference the website version (production, testing, development), I use a very simple trick. I add the revision number somewhere on the site (eg in the admin footer). Something like this: <?php print("$Revision: 1 $"); ?> Each time you checkout (development versions) or export (for production), the "1" will be replaced by the revision number in your repository, thus making it easy to setup the customer version on your test server, for example. [1]: http://svnbook.red-bean.com/
I use a proportional font too. They seem good for the same reasons they work in books and magazines: the more variation between characters, the easier it is for the brain to distinguish them; and you can fit more on the screen. Indentation still works fine: 6 leading spaces is still twice as wide as 3 leading spaces. I use a version of Georgia that I hacked to make the lower case "l" look less like the digit "1", and put a slash through the zero.
I'm not totally sure which problem you want so solve, but if you deploy your python/django application via an apache prefork MPM using mod_python apache will start several worker processes for handling different requests. If one request needs so much resources, that you want to use multiple cores have a look at [pyprocessing](http://pyprocessing.berlios.de/). But I don't think that would be wise.
Caching MySQL queries
|php|mysql|caching|
Is there a simple way to cache MySQL queries in PHP or failing that, is there a small class set that someone has written and made available that will do it? I can cache a whole page but that won't work as some data changes but some does not, I want to cache the part that does not.
I'm surprised that someone who has used Subversion in the past would even have a want/need for TFS source control. My experience with TFS (2005) has been pretty horrible. I've read all kinds of whitepapers & guidance as to how to properly structure your source for various development needs. Our simple situation, where we have a trunk with mainline development, and integration branch where we integrate changes & deploy from, and a releases branch to keep track of past releases is very common and straightforward, but we are continually running into problems. My main issues with TFS: - Merging is a PAIN in comparison to subversion. - There are unfixed bugs. I ran into one about renaming/merging that has been known for 2 years and a fix will never be released for 2005. We ended up moving our branch to a "broken" folder and we ignore it now. - Putting read-only locks on your files is friction. Who says I need to edit batch files and build scripts inside of TFS so that it will "check it out" for me? Subversion _knows_ which files changed. There are no readonly locks there. - Speed. TFS is dog-slow over a WAN, and it's really only usable if I VPN into my work computer, which makes my dev experience really slow overall. - Lack of good command-line and explorer integration. IDE integration is really nice for the day-to-day Get-Latest, adding files, and checking in, but when you need to do things across many projects, it's nice to have good tools at your disposal. And before someone jumps down my throat claiming tf.exe works well... it's not really a cmd line tool. For example, checking in code shouldn't pop up a modal dialog. ...the list goes one. I think even with all of the integration, there are free alternatives that are far superior.
> s/[^:]\bBoolean\b(?!")/bool/g This does not match strings where Boolean is at that the beginning of the line becuase [^:] is "match a character that is not :".
It works just fine. I have worked with source code from my "home" folder on many different systems (NFS, Samba, AD) and never had any problems. The only drawback is that you might experience somewhat longer compile times if your network is slow or there is much traffic on the network. Under normal circumstances this is not an issue though, since source code files are usually small and will be cached by the operating system anyway.
In SP1 does the foo.Bar property get properly deserialized? In pre SP1 you wouldn't be able to deserialize the object because the set method of the Bar property is private so the XmlSerializer doesn't have a way to set that value. I'm not sure how SP1 is pulling it off. You could try adding this to your web.config/app.config <system.xml.serialization> <xmlSerializer tempFilesLocation="c:\\foo"/> </system.xml.serialization> That will put the class generated by the XmlSerializer into c:\foo so you can see what it is doing in SP1 vs RTM
Flex ComboBox, default value and dataproviders
|apache-flex|data-binding|
I have a Flex ComboBox that gets populated by a dataprovider all is well... I would now like to add a default " -- select a item --" option at the 0 index, how can I do this and still use a dataprovider? I have not seen any examples of such, but I can't imagine this being hard...
Normally you would do this with a 3x3 Matrix, but the Matrix class only lets you specify 6 values instead of 9. You might be able to do this in Direct X.
Let's combine the culture-safe answer and the extension method answer: public static class DateTimeExtensions { public static DateTime StartOfWeek(this DateTime dt, DayOfWeek startOfWeek) { System.Globalization.CultureInfo ci = System.Threading.Thread.CurrentThread.CurrentCulture; DayOfWeek fdow = ci.DateTimeFormat.FirstDayOfWeek; return DateTime.Today.AddDays(-(DateTime.Today.DayOfWeek- fdow)); } }
If your pages are "updatable," they must be compiled before use. That means, yes, on first request the assemblies are loaded, compiled, and made ready for accessing. Whenever these files are changed (even some virus software can trigger this by changing the modified date of the files!), the appdomain gets recycled. You can configure your web application to not be updatable. Everything gets compiled into DLLs, and you won't see any .ASPX or .CS files in the virtual directory. It makes your code harder to update (need to put some additional text on your webpage? Recompile time!), but it increases the availability of your web app. However, this still won't prevent your web app from being recycled if any of the files are altered. For example, if you edit web.config, your appdomain will recycle even if its compiled.
How can I make flash cs3, actionscript send events to javascript?
|javascript|flash|actionscript|
I'm using Flash to play an .flv movieclip on my site, but I want to have the .swf send trigger an event in my javascript when it start loading, starts playing and ends playing. What is the best way to do that in Flash CS3 using Actionscript 3.0 ?
What browser/ ad-on do you have? it may be your browser or some other software (may be even the web server) is blocking the sessions from http://www.myIsv.com/myWebSite/ with in the frame, thinking its an XSS attack. If the session works at http://www.myIsv.com/myWebSite/ with out the frame you could always us a redirect from http://www.mysmallwebsite.com to the ugly url, instead of using the frame.
What browser/ ad-on do you have? it may be your browser or some other software (may be even the web server) is blocking the sessions from http://www.myIsv.com/myWebSite/ working from with-in the frame, as its located on a different site, thinking its an XSS attack. If the session works at http://www.myIsv.com/myWebSite/ with out the frame you could always us a redirect from http://www.mysmallwebsite.com to the ugly url, instead of using the frame. EDIT: I have just tried your frame code on a site of mine that uses sessions, firefox worked fine, with me logging in and staying loged in, but IE7 logged me straight out again.
How you expose a collection depends entirely on how users are intended to interact with it. **1)** If users will be adding and removing items from an object's collection, then a simple get-only collection property is best (option #1 from the original question): private readonly Collection<T> myCollection_ = new ...; public Collection<T> MyCollection { get { return this.myCollection_; } } This strategy is used for the `Items` collections on the WindowsForms and WPF `ItemsControl` controls, where users add and remove items they want the control to display. These controls publish the actual collection and use callbacks or event listeners to keep track of items. WPF also exposes some settable collections to allow users to display a collection of items they control, such as the `ItemsSource` property on `ItemsControl` (option #3 from the original question). However, this is not a common use case. <br/> **2)** If users will only be reading data maintained by the object, then you can use a readonly collection, as [Quarrelsome](http://stackoverflow.com/questions/35007/how-to-expose-a-collection-property#35065) suggested: private readonly List<T> myPrivateCollection_ = new ...; private readonly ReadOnlyCollection<T> myPrivateCollectionView_ = new ReadOnlyCollection<T>( this.myPrivateCollection_ ); public ReadOnlyCollection<T> MyCollection { get { return this.myPrivateCollectionView_; } } Note that `ReadOnlyCollection<T>` provides a live view of the underlying collection, so you only need to create the view once. If the internal collection does not implement `IList<T>`, or if you want to restrict access to more advanced users, you can instead wrap access to the collection through an enumerator: public IEnumerable<T> MyCollection { get { foreach( T item in this.myPrivateCollection_ ) yield return item; } } This approach is simple to implement and also provides access to all the members without exposing the internal collection. However, it does require that the collection remain unmodfied, as the BCL collection classes will throw an exception if you try to enumerate a collection after it has been modified. If the underlying collection is likely to change, you can either create a light wrapper that will enumerate the collection safely, or return a copy of the collection. <br/> **3)** Finally, if you need to expose arrays rather than higher-level collections, then you should return a copy of the array to prevent users from modifying it (option #2 from the orginal question): private T[] myArray_; public T[] GetMyArray( ) { T[] copy = new T[this.myArray_.Length]; this.myArray_.CopyTo( copy, 0 ); return copy; // Note: if you are using LINQ, calling the 'ToArray( )' // extension method will create a copy for you. } You should not expose the underlying array through a property, as you will not be able to tell when users modify it. To allow modifying the array, you can either add a corresponding `SetMyArray( T[] array )` method, or use a custom indexer: public T this[int index] { get { return this.myArray_[index]; } set { // TODO: validate new value; raise change event; etc. this.myArray_[index] = value; } } (of course, by implementing a custom indexer, you will be duplicating the work of the BCL classes :)
If you really want your white space to be preserved, try the css property: white-space: pre; Or, you could just use a &lt;pre&gt; tag in your markup. By the way, it's a good thing that HTML browsers ignore white space in general, it allows us to have clearly formatted source code, without affecting the output.
The following is an example of a template that would produce the required output in XSLT 1.0: <xsl:template name="getExtension"> <xsl:param name="filename"/> <xsl:choose> <xsl:when test="contains($filename, '.')"> <xsl:call-template name="getExtension"> <xsl:with-param name="filename" select="substring-after($filename, '.')"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:value-of select="$filename"/> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template match="/"> <xsl:call-template name="getExtension"> <xsl:with-param name="filename" select="'http://www.blah.com/path/to/file/media.jpg'"/> </xsl:call-template> </xsl:template>
How do I generate a hashcode from a byte array in c#
|c#|hash|
Say I have an object that stores a byte array and I want to be able to efficiently generate a hashcode for it. I've used the cryptographic hash functions for this in the past because they are easy to implement, but they are doing a lot more work than they should to be cryptographically oneway and I don't care about that (I'm just using the hashcode as a key into a hashtable). Here's what I have today: struct SomeData : IEquatable<SomeData> { private readonly byte[] _Data; public SomeData(byte[] data) { if (null == data || data.Length <= 0) { throw new ArgumentException("data"); } _Data = new byte[data.Length]; Array.Copy(data, _Data, data.Length); } public override bool Equals(object obj) { return obj is SomeData && Equals((SomeData)obj); } public bool Equals(SomeData other) { for (int i = 0; i < _Data.Length; ++i) { if (_Data[i] != other._Data[i]) { return false; } } return true; } public override int GetHashCode() { return BitConverter.ToInt32(new MD5CryptoServiceProvider().ComputeHash(_Data), 0); } } Any thoughts?
Say I have an object that stores a byte array and I want to be able to efficiently generate a hashcode for it. I've used the cryptographic hash functions for this in the past because they are easy to implement, but they are doing a lot more work than they should to be cryptographically oneway and I don't care about that (I'm just using the hashcode as a key into a hashtable). Here's what I have today: struct SomeData : IEquatable<SomeData> { private readonly byte[] data; public SomeData(byte[] data) { if (null == data || data.Length <= 0) { throw new ArgumentException("data"); } this.data = new byte[data.Length]; Array.Copy(data, this.data, data.Length); } public override bool Equals(object obj) { return obj is SomeData && Equals((SomeData)obj); } public bool Equals(SomeData other) { if (other.data.Length != data.Length) { return false; } for (int i = 0; i < data.Length; ++i) { if (data[i] != other.data[i]) { return false; } } return true; } public override int GetHashCode() { return BitConverter.ToInt32(new MD5CryptoServiceProvider().ComputeHash(data), 0); } } Any thoughts?
As far as web development, especially for javascript, I find [Firebug][1] to be invaluable. [Web developer toolbar][2] is also very useful. [1]: http://getfirebug.com/ [2]: https://addons.mozilla.org/en-US/firefox/addon/60
[Web Developer][1] for web development. [Scribefire][2] if you're a blogger-progammer [1]: https://addons.mozilla.org/en-US/firefox/addon/60 [2]: https://addons.mozilla.org/en-US/firefox/addon/1730
I'd also recommend the [Web Developer][1] extension by Chris Pederick. [1]: https://addons.mozilla.org/en-US/firefox/addon/60
PHP best practices?
|php|
What is a good way to remove the code from display pages when developing with PHP. Often the pages I work on need to be editted by an outside person. This person is often confused by lots of blocks of PHP, and also likes to break my code. I've tried moving blocks of code out into functions, so now there are functions spread out all throughout the HTML now. As some pages become more complex it becomes a program again, and processing POSTs are questionable. What can I be doing better in my PHP development?
|php|
I guess it's silly to mention Firebug -- doubt any of us could live without it. Other than that I use the following (only listing dev-related): - Console<sup>2</sup>: next-generation error console - DOM inspector: as the title might indicate, allows you to browse the DOM - Edit Cookies: change cookies on the fly - Execute JS: ad-hoc Javascript execution - IE Tab: render a page in IE - Inspect This: brings the selected object into the DOM inspector - JSView: display linked javascript and CSS - LORI (Life of Request Info): shows how long it takes to render a page - Measure IT: a popup ruler. - URL Params: shows GET and POST variables - Web Developer: a myriad of tools for the web developer
There's a lot that can be said on this topic but a very basic starting point would be to move as much code as possible out into separate files and then use include statements.
I don't believe ST_GeomFromText() is particularly expensive, although in the past I've optimized PostGIS queries by creating a function, declaring a variable and then assigning the result of ST_GeomFromText to the variable. Have you tried checking the execution plan for you query with a variety of different parameters because that should give you a definite idea of which bits of the query are taking the time? I'm guessing most of the exceution time will be in the calls to ST_DWithin() and ST_Distance(), although if the id and category columns aren't indexed then it might be doing some interesting table scanning.
I don't believe ST_GeomFromText() is particularly expensive, although in the past I've optimized PostGIS queries by creating a function, declaring a variable and then assigning the result of ST_GeomFromText to the variable. Have you tried checking the execution plan for you query with a variety of different parameters because that should give you a definite idea of which bits of the query are taking the time? I'm guessing most of the execution time will be in the calls to ST_DWithin() and ST_Distance(), although if the id and category columns aren't indexed then it might be doing some interesting table scanning.
|c++|program-entry-point|return-values|
I'm pretty sure VC++ just inserts a return 0 if you don't include one in main functions. The same thing can happen with functions too, but in those cases at least you'll get a warning.
This is part of the C++ language standard. An implicit return 0 is generated for you if there's no explicit return statement in main.
I wrote a script to do this a little while back. The script (Compare-QueryResults.ps1) is available [here][1] and you will also need my Run-SQLQuery script (available [here][2]) or you can replace that with a script or function of your own. Basically, what the script does is take the results of each of your queries and break the datarows apart so that each field is its own object. It then uses Compare-Object to check for any differences between the data in those rows. It returns a comparison object that shows you all the differences between the data returned. The results are an object, so you can save them to a variable and use Sort-Object or the Format-* cmdlets with them. Good luck. If you have any problems with the scripts, let me know, I'd be happy to walk you through them. I've been using them for application testing, seeing what rows are being modified by different actions in a program. [1]: http://podcast.acoupleofadmins.com/media/Scripts/Compare-QueryResults.ps1 [2]: http://podcast.acoupleofadmins.com/media/scripts/Run-SQLQuery.ps1
Check out the [dbdeploy][1], there are Java and .net tools already available, you could follow their standards for the SQL file layouts and schema version table and write your python version. [1]: http://dbdeploy.com/
> 3.6.1 Main function > > .... > > 2 An implementation shall not > predefine the main function. This > function shall not be overloaded. It > shall have a return type of type int, > but otherwise its type is > implementation-defined. All > implementations shall allow both of > the following definitions of main: > > int main() { /* ... */ } > > and > > int main(int argc, char* argv[]) { /* > ... */ } > > .... and it continues to add ... > > 5 A return statement in main has the > effect of leaving the main function > (destroying any objects with automatic > storage duration) and calling exit > with the return value as the argument. > If control reaches the end of main > without encountering a return > statement, the effect is that of > executing return 0; attempting to find an online copy of the C++ standard so I could quote this passage [I found a blog post that quotes all the right bits better than I could.][1] [1]: http://zamanbakshifirst.blogspot.com/2006/11/c-c-main-should-return-void.html
My company decided to buy the Infragistics NetAdvantage for .NET. We will be using their Gantt control. Thanks for your answers.
What are the naming conventions of an AS3 class?
|actionscript-3|convention|naming|
I'm trying to write a RegEx to determine a proper class or package name of an AS3 class. I know - Must start with a letter (capital or otherwise) - any other digit can be alphanumeric - cannot have spaces Is there anything else?
Sounds like robocopy is what you need. Very powerful replication command. Details : http://en.wikipedia.org/wiki/Robocopy Full command switch guide : http://atlex.nl/tmp/robocopy_switches.txt Batch scripting guide: http://www.tacktech.com/display.cfm?ttid=307
It may not be very elegant, but I apply CSS to a &lt;pre&gt; tag. There's always the "white-space" CSS attribute, but it can be a bit hit and miss.
what about the *ObjectContext.SavingChanges* event? See also <http://www.thedatafarm.com/blog/2008/07/13/OverridingObjectContextSaveChanges.aspx>.
Take a look at the [pre tag](http://www.w3schools.com/TAGS/tag_pre.asp). It might do what you want.
This won't solve your problem, but if you only needed lat/long data for these addresses, the Google Maps API will parse non-formatted addresses pretty well.
Are there any standards at all in the way that the addresses are recorded? For example: 1. Are there always commas or new-lines separating street1 from street2 from city from state from zip? 2. Are address types (road, street, boulevard, etc) always spelled out? always abbreviated? Some of each? 3. Define "error". My general answer is a series of Regular Expressions, though the complexity of this depends on the answer. And if there is no consistency at all, then you may only be able to achieve partial success with a Regex (ie: filtering out zip code and state) and will have to do the rest by hand (or at least go through the rest very carefully to make sure you spot the errors).
You'd better use white-space: pre-wrap than white-space: pre or &amp;nbsp; With your example, the latter solutions can start a new line on "rules.&amp;nbsp;" just because your **n**on-**b**reakable **sp**ace hit the end of the line.
Add the error to a hidden list with that users name. Set the visibility on the list (for users) to only read/write their own values. Then use a custom web part or FlexListViewer to view the contents of that list and display it to the user. Once they acknowledge that error, remove it from the list. If necessary, you can add a different workflow action on that message list, that says pause for 2 days and then email. Whatever, depending on your requirements. Otherwise you can have a custom db table that you use for pretty much the same thing, this way sharepoint does most of the work for you.
Add the error to a hidden list with that users name. Set the visibility on the list (for users) to only read/write their own values. Then use a custom web part or FlexListViewer to view the contents of that list and display it to the user. Once they acknowledge that error, remove it from the list. If necessary, you can add a different workflow action on that message list, that says pause for 2 days and then email. Whatever, depending on your requirements. Otherwise you can have a custom db table that you use for pretty much the same thing, this way sharepoint does most of the work for you. **Update** This can be packaged up as a feature and deployed to each site as needed. The strengths of this approach (adding a list item to a list, querying, alerting a user, and emailing a user) are all built into the sharepoint itself. In this case you can focus on your custom logic only, while letting sharepoint focus on the implementation details.
I would leave the onClick and set it as the trigger for the updatePanel. That's odd that it works in FF and not IE. That is opposite from the behavior we experience.
Seems like the best you could do is to iterate through the list, for every item add it to a list of "seen" items or else remove it from the "seen" if it's already there, and at the end your list of "seen" items will include the singular element. This is O(n) in regards to time and n in regards to space (in the worst case, it will be much better if the list is sorted). The fact that they're integers doesn't really factor in, since there's nothing special you can do with adding them up... is there?
Seems like the best you could do is to iterate through the list, for every item add it to a list of "seen" items or else remove it from the "seen" if it's already there, and at the end your list of "seen" items will include the singular element. This is O(n) in regards to time and n in regards to space (in the worst case, it will be much better if the list is sorted). The fact that they're integers doesn't really factor in, since there's nothing special you can do with adding them up... is there? **Question** I don't understand why the selected answer is "best" by any standard. O(N*lgN) > O(N), and it changes the list (or else creates a copy of it, which is still more expensive in space and time). Am I missing something?
Optimizing Sharepoint Search Crawling
|sharepoint|.net|c#|
With SharePoint Server 2007, there is also a Search Feature and a Crawler. However, the Crawler is somewhat limited in that it only supports Basic Auth when crawling external sites and that there is no way to tell it to ignore noindex,nofollow attributes. Now, there is a site i'd like to index, unfortunately this site uses it's own Authentication System, and it uses noindex,nofollow on the pages. As I control that site, i can remove the Attributes, but it's a PITA to do so. Also, it does not solve the Authentication issue. So I just wonder if it's possible to extend Sharepoint's Crawler somehow?
Optimizing/Customizing Sharepoint Search Crawling
|c#|.net|sharepoint|
Would building an application using a Sql Server Database File (mdf) be a terrible idea?
|asp.net|sql|sql-server|mysql|
I'm working on a side project that would be a simple web application to maintain a list of classes and their upcoming schedules. I would really like to use Linq to SQL for this project, but unfortunately the server environment I'm developing for only has MySql available. I've dabbled briefly with Subsonic but it just doesn't get the job done. The database requirements for this application aren't that great, though, so I'm curious if using an MDF file in App_Data would be a workable solution. Otherwise, it appears I'm going to have to hand-code sql queries which I want to avoid at all costs.
Rewrite or repair?
This is a great overview of how to cache queries in MySQL: - [The MySQL Query Cache][1] [1]: http://www.petefreitag.com/item/390.cfm
I've been using cntlm ([http://cntlm.sourceforge.net/][1]) at work. Configuration is very similar to ntlmaps. - gem install --http-proxy http://localhost:3128 _name_of_gem_ Works great, and also allows me to connect my Ubuntu box to the ISA proxy. Check out [http://cntlm.wiki.sourceforge.net/][2] for more information [1]: http://cntlm.sourceforge.net/ [2]: http://cntlm.wiki.sourceforge.net/
Why not take the approach that GMail uses and show the number of messages in the page title? Sometimes users don't want to be distracted when a new message arrives.
Personally, I just use comma-separed selector, but there some solution for writing css programmatically. Maybe this is a little overkill for you simpler needs, but take a look at [CleverCSS][1] (Python) [1]: http://pypi.python.org/pypi/CleverCSS/
This should do the trick: Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim path As String path="/AbosoluteVitualPath/OutputCached.aspx" HttpResponse.RemoveOutputCacheItem(path) End Sub
Make Browser Window Blink in Task Bar
|javascript|browser|
How do I make a user's browser blink/flash/highlight in the task bar using JavaScript? For example, if I make an AJAX request every 10 seconds to see if the user has any new messages on the server, I want the user to know it right away, even if he is using another application at the time.
How do I make a user's browser blink/flash/highlight in the task bar using JavaScript? For example, if I make an AJAX request every 10 seconds to see if the user has any new messages on the server, I want the user to know it right away, even if he is using another application at the time. *Edit: These users do want to be distracted when a new message arrives.*
The `@page` rule is supposed to allow this, but is only implemented in Opera.
[CSS Variables][1], if it ever becomes implemented in all major browsers, may one day resolve this issue. Until then, you'll either have to copy and paste, or use a preprocessor of whatever sort, like others have suggested (typically using server-sider scripting). [1]: http://disruptive-innovations.com/zoo/cssvariables/
Iterable<T> only has the method Iterator<T> get() or somesuch. So no need to build any query or execute any code until you actually start iterating. It does make the execute in your example redundant. However, the thread will be locked until the first result is available, so you might consider using an Executor to run the code for the query in a separate thread.
Clearing Page Cache in ASP.NET
|asp.net|csharp|outputcache|