instruction
stringlengths
0
30k
|.net|build-process|nant|
Yes you are correct in thinking that C is a non-functional language. C is a procedural language.
@Konrad > OOP may be flawed and it certainly is no silver bullet but it makes large-scale applications much simpler because it's a great way to reduce dependencies That is the dogma. I am not seeing what makes OOP significantly better in this regard than procedural programming of old. Whenever I make a procedure call I am isolating myself from the specifics of the implementation.
Is msbuild worth looking at?
|nant|msbuild|buildprocess|build-automation|
I currently use nant, ccnet, svn, mbunit. I use msbuild to do my sln build just because it was simpler to shell out. Are there any merits to switching my whole build script to MSBuild? I need to be able to run tests, watir style tests, xcopy deploy. Is this easier?
I currently use nant, ccnet, svn, mbunit. I use msbuild to do my sln build just because it was simpler to shell out. Are there any merits to switching my whole build script to MSBuild? I need to be able to run tests, watir style tests, xcopy deploy. Is this easier? **Update: Any compelling features that would cause me to shift from nant to msbuild?**
So, you expect <font face="Arial">Hi Mom</font> and <span style="font-family:Arial;">Hi Mom</span> to be considered the same? The output depends very much on the User Agent. Like [Ionut Anghelcovici suggests][1], make an image. Do one for every browser you care about. [1]: http://stackoverflow.com/questions/31722#31727
This looks like a network issue, unless there's an odd bug in .Net CF that doesn't allow you to traverse subnets in certain situations (I can find no evidence of such a thing from googling). Can you get any support from the network/IT team? Also, have you tried it from a different subnet? I.e. not the same as the XP machine (192.168.5.x) and not the same as the one that's not worked so far (192.168.10.). @Shaun Austin - that wouldn't explain why they can get at a regular web page on the XP machine from the different subnet.
For .NET, you could use something like [TypeMock][1], which uses the profiling API and allows you to hook into calls to nearly anything. [1]: http://www.typemock.com/
Simplest way to make a Google Map mashup?
|google-maps|web2.0|
Given a list of locations such as <td>El Cerrito, CA</td> <td>Corvallis, OR</td> <td>Morganton, NC</td> <td>New York, NY</td> <td>San Diego, CA</td> What's the easiest way to generate a Google Map with pushpins for each location?
Given a list of locations such as <td>El Cerrito, CA</td> <td>Corvallis, OR</td> <td>Morganton, NC</td> <td>New York, NY</td> <td>San Diego, CA</td> What's the easiest way to generate a Google Map with pushpins for each location?
I've recently started using [Mercurial][1] for some of my work. It's a distributed system like Git but seems easier to use and seems far better supported on Windows, the latter of which was crucial for me. With distributed source code control every user has a complete local copy of the repository. If you're the only person working on a project, as you say you often are, this can simplify things a lot since you just create your own repository and do all your commits etc. locally. If you want to bring on other developers later you can just push the full contents of your repository - current versions and all history - to another system, either on a shared server or directly on to another users' workstation. If you're working only with a local repository remember you'll need a also backup solution as there isn't a copy of all your code on a shared server. I think that Mercurial has lots of other advantages over Subversion, but it does have a big downside which has already been mentioned as a plus point of Subversion: there a **lots** of third party tools and integrations for Subversion. As Mercurial hasn't been around nearly as ong the choice is much less. On Windows it seems that you either have to use the command line (my choice) or the [TortoiseHg][2] Windows Explorer integration. [1]: http://www.selenic.com/mercurial/wiki/ [2]: http://tortoisehg.sourceforge.net/ "Tortoise Hg"
Are there any tools out there to compare the structure of 2 web pages?
|html|dom|diff|asp.net|
I receive HTML pages from our creative team, and then use those to build aspx pages. One challenge I frequently face is getting the HTML I spit out to match theirs exactly. I almost always end up screwing up the nesting of &lt;div&gt;s between my page and the master pages. Does anyone know of a tool that will help in this situation -- something that will compare 2 pages and output the structural differences? I can't use a standard diff tool, because IDs change from what I receive from creative, text replaces <i>lorem ipsum</i>, etc..
I agree with Jason Cohen though we can be a bit clearer on the reason for needing to delete your pointers with the loop. For every "new" or dynamic memory allocation there needs to be a "delete" a memory de-allocation. Some times the "delete" can be hidden, as with smartpointers but it is still there. int main() { int *pI = new int; int *pArr = new int[10]; so far in the code we have allocated two chunks of dynamic memory. The first is just a general int the second is an array of ints. delete pI; delete [] pArr; these delete statements clear the memory that was allocated by the "new"s int ppArr = new int *[10]; for( int indx = 0; indx < 10; ++indx ) { ppArr[indx] = new int; } This bit of code is doing both of the previous allocations. First we are creating space for our int in a dynamic array. We then need to loop through and allocate an int for each spot in the array. for( int indx = 0; indx < 10; ++indx ) { delete ppArr[indx]; } delete [] ppArr; Note the order that I allocated this memory and then that I de-allocated it in the reverse order. This is because if we were to do the delete [] ppArr; first we would loose the array that tells us what our other pointers are. That chunk or memory would be given back to the system and so can no longer be reliably read. int a=0; int b=1; int c=2; ppArr = new int *[3]; ppArr[0] = &a; ppArr[1] = &b; ppArr[2] = &c; This I think should be mentioned as well. Just because you are working with pointers does not mean that the memory those pointers point to was dynamically allocated. That is to say just because you have a pointer doesn't mean it necessarily needs to be delete. The array I created here is dynamically allocated but the pointers point to local instances of ints When we delete this we only need to delete the array. delete [] ppArr; return 0; } In the end dynamically allocated memory can be tricky and anyway you can wrap it up safely like in a smart pointer or by using stl containers rather then your own can make your life much more pleasant.
When you create types for 'Use and throw' purposes. This seems to have come due to LINQ. Seems to be a way to create structures with fields on the fly for a LINQ query. Returning a struct/type with specified fields only. If not for this, you'd have to declare a .Net type for each unique combination of fields you wish to retrieve.
I would like to add that you should make sure to point out where they can find language and API references. In java, the API and language specification is at your fingertips online at java.sun.com... with C or C++, it's not quite as simple and easy to find reference documentation. Whenever I am doing something in C or C++, that is my biggest problem... trying to find what I need. I usually turn to [cplusplus.com][1], which usually has what I need, otherwise I google for it. If you have a set of references you use (online or in the form of books), list them and tell them what you use each reference for. [1]: http://www.cplusplus.com/
It would be an new shell (but I think it is worth it), but from PowerShell it would be [int](get-content counter.txt) + 1 | out-file counter.txt
I downloaded the sample VS2008 project, and am a bit stumped here too. I was able to get past the exceptions however, although probably not in a way that will work will great for you. But here's what I found: This [mailing list post](http://www.antlr.org:8080/pipermail/antlr-interest/2008-February/026657.html) had a discussion of what looks to be the same issue you are experiencing. From there, I added a couple dummy classes in the main program.cs file: class MyNoViableAltException : Exception { public MyNoViableAltException() { } public MyNoViableAltException(string grammarDecisionDescription, int decisionNumber, int stateNumber, Antlr.Runtime.IIntStream input) { } } class MyEarlyExitException : Exception { public MyEarlyExitException() { } public MyEarlyExitException(int decisionNumber, Antlr.Runtime.IIntStream input) { } } and then added the using lines into TimeDefParser.cs and TimeDefLexer.cs: using NoViableAltException = MyNoViableAltException; using EarlyExitException = NoViableAltException; With that the exceptions would bubble into the fake exception classes and could be handled there, but there was still an exception being thrown in the mTokens method in TimeDefLexer.cs. Wrapping that in a try catch in that class caught the exception: try { alt4 = dfa4.Predict(input); } catch { } I really don't get why wrapping it in the internal method rather than where it is being called from handle the error if threading isn't in play, but anyways hopefully that will point someone smarter than me here in the right direction.
Hibernate saveOrUpdate with another object in the session
|java|orm|hibernate|
Is there any way to save an object using Hibernate if there is already an object using that identifier loaded into the session? - Doing session.contains(obj) seems to only return true if the session contains that exact object, not another object with the same ID. - Using merge(obj) throws an exception if the object is new
|orm|hibernate|
Use SQL Server Management Objects (SMO) which understands GO separators. See my blog post here: [http://weblogs.asp.net/jgalloway/archive/2006/11/07/Handling-_2200_GO_2200_-Separators-in-SQL-Scripts-_2D00_-the-easy-way.aspx][1] Sample code: public static void Main() { string scriptDirectory = "c:\\temp\\sqltest\\"; string sqlConnectionString = "Integrated Security=SSPI;" + "Persist Security Info=True;Initial Catalog=Northwind;Data Source=(local)"; DirectoryInfo di = new DirectoryInfo(scriptDirectory); FileInfo[] rgFiles = di.GetFiles("*.sql"); foreach (FileInfo fi in rgFiles) { FileInfo fileInfo = new FileInfo(fi.FullName); string script = fileInfo.OpenText().ReadToEnd(); SqlConnection connection = new SqlConnection(sqlConnectionString); Server server = new Server(new ServerConnection(connection)); server.ConnectionContext.ExecuteNonQuery(script); } } If that won't work for you, see Phil Haack's library which handles that: [http://haacked.com/archive/2007/11/04/a-library-for-executing-sql-scripts-with-go-separators-and.aspx][2] [1]: http://weblogs.asp.net/jgalloway/archive/2006/11/07/Handling-_2200_GO_2200_-Separators-in-SQL-Scripts-_2D00_-the-easy-way.aspx [2]: http://haacked.com/archive/2007/11/04/a-library-for-executing-sql-scripts-with-go-separators-and.aspx
How to find keys of a hash?
|javascript|hash|object|key|
I know in javascript Objects double as hashes but i have been unable to find a built in function to get the keys var h = {a:'b',c:'d'}; I want something like var k = h.keys() ; // k = ['a','c']; It is simple to write a function myself to iterate over the items and add the keys to an array that I return, but is there a standard cleaner way to do that ? I keep feeling it must be a simple built in function that I missed but I can't find it!
|javascript|hash|object|key|
Read Access File into a DataSet
|.net|ms-access|dataset|
Is there an easy way to read an entire Access file (.mdb) into a DataSet in .NET (specifically C# or VB)? Or at least to get a list of tables from an access file so that I can loop through it and add them one at a time into a DataSet?
|.net|ms-access|dataset|
How do I implement license management for on-site installation of webapps (preferably cross-platform)?
|licensing|web-application|
I have a web application running on a Gentoo-based LAMP stack. My customers buy the software as a service and I host everything. They can export their data if they want. However, there is some demand for on-site deployment inside the clients' own networks. For some of these scenarios, there would be a requirement for some particular OS, typically something like Windows Server 2003, but possibly other Linux distros as well. Currently, because I host the system, there is no built-in license management in the app. I bill based on user accounts and data capacity (it's a processing and analysis app for metering data) and I just set up whatever the client pays for and the client can't setup those things himself. Even without on-site installation, that should be changed for better scalability anyway. I am looking for a license managment framework and/or typical approaches that you have implemented yourselves or have seen to work well elsewhere. My requirements are: - "safe enough" rather than "military grade" - very much non-obtrusive - prevent the owner of a license from running the system in multiple plants when he has only licensed one - make the number of user accounts and the data capacity both reasonably tamper-proof and easy to up- / downgrade From a user's point of view, I am quite satisfied with the license management in FogBugz, it seems Joel Spolsky is satisfied with it from a vendor's point of view, and it is cross-platform, so it would make a great reference of what I'm aiming at.
|web-applications|licensing|
I have a web application running on a Gentoo-based LAMP stack. My customers buy the software as a service and I host everything. They can export their data if they want. However, there is some demand for on-site deployment inside the clients' own networks. For some of these scenarios, there would be a requirement for some particular OS, typically something like Windows Server 2003, but possibly other Linux distros as well. I might just decide to circumvent all portability issues by shipping pre-configured appliances that just carry the same system as I run on my servers. However, that would mean I have to provide full technical support and also some customers would be much happier if they knew their admins could maintain the systems themselves. Porting the application will be alright, but I have to think carefully about license management. Currently, because I host the system, there is no built-in license management in the app. I bill based on user accounts and data capacity (it's a processing and analysis app for metering data) and I just set up whatever the client pays for and the client can't setup those things himself. Even without on-site installation, that should be changed for better scalability anyway. Are there good (cross-platform) licensing frameworks? If I roll my own, what are good methods of ensuring that there is only one instance of the system? I'm not looking for military-grade stuff but rather something that's "safe enough". I don't want to impair usability and I don't want to get on people's nerves more than absolutely necessary. For instance, the app should not stop working when they replace the ethernet adapter, but I neither want a customer to buy a license for one plant and simply copy the harddrive to set up identical systems in his other plants. Are there good methods to implement something like a "fuzzy" machine identification, that would allow parts to be changed but can detect if it's a completely new setup?
It looks like you've got fewer items in q than you were expecting when you started iterating. Your script may be trying to access q[q.length], i.e. the element after the last element. Could it be that your successful request has been popped from the queue, and you have a race condition? Are you trying to abort a request that has already completed its life cycle? Alternatively, have you made a silly mistake as people sometimes do, and got your loop termination condition wrong? Just a few thoughts, I hope they help.
Anyone have a diff algorithm for rendered HTML?
|diff|javascript|html|
I'm interested in seeing a good diff algorithm, possibly in Javascript, for rendering a side-by-side diff of two HTML pages. The idea would be that the diff would show the differences of the *rendered* HTML.
|javascript|html|diff|
I'm interested in seeing a good diff algorithm, possibly in Javascript, for rendering a side-by-side diff of two HTML pages. The idea would be that the diff would show the differences of the *rendered* HTML. To clarify, I want to be able to see the side-by-side diffs *as* rendered output. So if I delete a paragraph, the side by side view would know to space things correctly.
Differences in Generics
|generics|java|c#|c++|
I mostly use Java and generics are relatively new. I keep reading that Java made the wrong decision or that .NET has better implementations etc. etc. So, what are the main differences between C++, C#, Java in generics? Pros/cons of each?
|c#|java|c++|generics|templates|
I occasionally get unexpected 404 errors with GETs objects that are part of a preceeding LIST but new to the bucket, and other misc. errors (eg: 403 on my access id and secret key), but nothing catastrophic. My code runs server side, so I've put in some robust error handling and logging. I think this is a wise thing to do *anytime* you have one server on the net communicating with another server. :P
@Soeren, You can most definitely embed IE with the Javascript Markdown editor inside a Windows Forms application.
Have a look at the [Guided tour of WPF][1] by Josh Smith. I also really like Adam's Nathan book WPF Presentation Unleashed. [1]: http://joshsmithonwpf.wordpress.com/a-guided-tour-of-wpf/
The problem with TypeMock is that it excuses bad design. Now, I know that it is often *someone else's* bad design that it's hiding, but permitting it into your development process can lead very easily to permitting your own bad designs. I think if you're going to use a mocking framework, you should use a traditional one (like Moq) and create an isolation layer around the unmockable thing, and mock the isolation layer instead.
If you set the Modifiers property of your components to strict protected makes them accessible without the Components collection.
If out output XML compliant HTML. Or at least translate your HTML product into XML compliancy, you at least could then XSL your output to remove the content and id tags. Apply the same transformation to their html, and then compare.
`<cword>` is the word under the cursor (:help `<cword>`)
`<cword>` is the word under the cursor (:help `<cword>`). Sorry, I should have been more complete in this answer. You can nmap a command to it, or this series of keystrokes for the lazy will work: b #go to beginning of current word yw #yank to register Then, when you are typing in your pattern you can hit `<control-r>0<enter>` which will paste in your command the contents of the 0-th register. You can also make a command for this like: :nmap <leader>w :s/\(<c-r>=expand("<cword>")<cr>\)/ Which will map hitting '\' and 'w' at the same time to replace your command line with :s/\(<currentword>\)/
From LINQ in action (page 76 section 2.6.3): > ... anonymous types [are] a great tool for quick and simple temporary results. We don't need to declare classes to hold temporary results thanks to temporary types. basically they're useful to hold information in the local scope temporarily. Anything more requires the use of reflection and can become quite a problem. The example they give in the above-quoted book is in writing to console the id, name, and amount of memory taken up by each running process. They create an anonymous type, add it to a list (all one statement) and then use ObjectDumper to output it. Therefore the code no longer needs a separately declared class to hold the id, name and memory used but its all declared implicitly bringing the line count down to 4: var pl = new List<Object>(); foreach(var p in Process.GetProcesses()) pl.Add(new {p.Id, p.ProcessName, Memory=p.WorkingSet64}); ObjectDumper.Write(pl);
Implications of Instantiating Objects with Dynamic Variables in PHP
|php|oop|php4|php5|performance|
What are the performance, security, or "other" implications of using the following form to declare a new class instance in PHP <?php $class_name = 'SomeClassName'; $object = new $class_name; ?> This is a contrived example, but I've seen this form used in Factories (OOP) to avoid having a big if/switch statement. Problems that come immediately to mind are 1. You loose the ability to pass arguments into a constructor 2. Smells like eval(), with all the security concerns it brings to the table (but not necessarily the performance concerns) What other implications are there, or what search engine terms other than "Rank PHP Hackery" can someone use to research this?
|php|performance|oop|php4|php5|
What are the performance, security, or "other" implications of using the following form to declare a new class instance in PHP <?php $class_name = 'SomeClassName'; $object = new $class_name; ?> This is a contrived example, but I've seen this form used in Factories (OOP) to avoid having a big if/switch statement. Problems that come immediately to mind are 1. <s>You loose the ability to pass arguments into a constructor</s> (LIES. Thanks Jeremy) 2. Smells like eval(), with all the security concerns it brings to the table (but not necessarily the performance concerns?) What other implications are there, or what search engine terms other than "Rank PHP Hackery" can someone use to research this?
As pointed out by Thomas, you need to Set an object instead of Let. Here's a general function from my library that works for value and object types: Public Function Exists(ByVal key As Variant, ByRef col As Collection) As Boolean 'Returns True if item with key exists in collection On Error Resume Next Const ERR_OBJECT_TYPE As Long = 438 Dim item As Variant 'Try reach item by key item = col.item(key) 'If no error occurred, key exists If Err.Number = 0 Then Exists = True 'In cases where error 438 is thrown, it is likely that 'the item does exist, but is an object that cannot be Let ElseIf Err.Number = ERR_OBJECT_TYPE Then 'Try reach object by key Set item = col.item(key) 'If an object was found, the key exists If Not item Is Nothing Then Exists = True End If End If Err.Clear End Function As also advised by Thomas, you can change the Collection type to Object to generalize this. The .Item(key) syntax is shared by most collection classes, so that might actually be useful. **EDIT** Seems like I was beaten to the punch somewhat by Thomas himself. However for easier reuse I personally prefer a single function with no private dependencies.
Do you need to trust the data? If so, be aware that it's trivial to tamper with client-processed data in nasty and malicious ways. If that's the case, you'll want to process info on the server. Also, be aware that it can be a lot harder to code javascript apps so they are stable, reliable, and bug free. Can you lock down your users so they only use one particular browser?
Silverlight enabled browser tracking
|silverlight|tracking|google-analytics|
I'm trying to get some stats on how many of the visitors to our website have Silverlight enabled browsers. We currently use Google Analytics for the rest of our stats so ideally we'd like to just add 'Silverlight enabled' tracking in with the rest of our Google Analytics stats. But if it has to get written out to a DB etc then so be it. Nikhil has [some javascript](http://www.nikhilk.net/Silverlight-Analytics.aspx) to add Google Analytics tracking of how many users **install** Silverlight, but not how many **already have it installed**, which is what I'm after. Anyone know how to do this? Thanks in advance for any help/ideas.
|silverlight|tracking|google-analytics|browser|
I'm trying to get some stats on how many of the visitors to our website have Silverlight enabled browsers. We currently use Google Analytics for the rest of our stats so ideally we'd like to just add 'Silverlight enabled' tracking in with the rest of our Google Analytics stats. But if it has to get written out to a DB etc then so be it. Nikhil has [some javascript](http://www.nikhilk.net/Silverlight-Analytics.aspx) to add Google Analytics tracking of how many users **install** Silverlight, but not how many **already have it installed**, which is what I'm after. Anyone know how to do this? Thanks in advance for any help/ideas. Update - Cd-MaN has pointed out that I may have mis-read the intent of Nikhil's code. I reckon he's right ;)
C++ : What's the easiest library to open video file
|c++|video|windows|
I would like to open a small video file and map every frames in memory (to apply some custom filter). I don't want to handle the video codec, I would rather let the library handle that for me. I've tried to use Direct Show with the SampleGrabber filter ([using this sample][1]), but I only managed to grab some frames (not every frames!). I'm quite new in video software programming, maybe I'm not using the best library, or I'm doing it wrong. I've pasted a part of my code (mainly a modified copy/paste from [the msdn example][1]), unfortunately it doesn't grabb the 25 first frames as expected... [...] hr = pGrabber->SetOneShot(TRUE); hr = pGrabber->SetBufferSamples(TRUE); pControl->Run(); // Run the graph. pEvent->WaitForCompletion(INFINITE, &evCode); // Wait till it's done. // Find the required buffer size. long cbBuffer = 0; hr = pGrabber->GetCurrentBuffer(&cbBuffer, NULL); for( int i = 0 ; i < 25 ; ++i ) { pControl->Run(); // Run the graph. pEvent->WaitForCompletion(INFINITE, &evCode); // Wait till it's done. char *pBuffer = new char[cbBuffer]; hr = pGrabber->GetCurrentBuffer(&cbBuffer, (long*)pBuffer); AM_MEDIA_TYPE mt; hr = pGrabber->GetConnectedMediaType(&mt); VIDEOINFOHEADER *pVih; pVih = (VIDEOINFOHEADER*)mt.pbFormat; [...] } [...] Is there somebody, with video software experience, who can advise me about code or other simpler library? Thanks [1]: http://msdn.microsoft.com/en-us/library/ms787867(VS.85).aspx
I would like to open a small video file and map every frames in memory (to apply some custom filter). I don't want to handle the video codec, I would rather let the library handle that for me. I've tried to use Direct Show with the SampleGrabber filter ([using this sample][1]), but I only managed to grab some frames (not every frames!). I'm quite new in video software programming, maybe I'm not using the best library, or I'm doing it wrong. I've pasted a part of my code (mainly a modified copy/paste from [the msdn example][1]), unfortunately it doesn't grabb the 25 first frames as expected... [...] hr = pGrabber->SetOneShot(TRUE); hr = pGrabber->SetBufferSamples(TRUE); pControl->Run(); // Run the graph. pEvent->WaitForCompletion(INFINITE, &evCode); // Wait till it's done. // Find the required buffer size. long cbBuffer = 0; hr = pGrabber->GetCurrentBuffer(&cbBuffer, NULL); for( int i = 0 ; i < 25 ; ++i ) { pControl->Run(); // Run the graph. pEvent->WaitForCompletion(INFINITE, &evCode); // Wait till it's done. char *pBuffer = new char[cbBuffer]; hr = pGrabber->GetCurrentBuffer(&cbBuffer, (long*)pBuffer); AM_MEDIA_TYPE mt; hr = pGrabber->GetConnectedMediaType(&mt); VIDEOINFOHEADER *pVih; pVih = (VIDEOINFOHEADER*)mt.pbFormat; [...] } [...] Is there somebody, with video software experience, who can advise me about code or other simpler library? Thanks Edit: The http link seems to be broken? The msdn example is at http://msdn.microsoft.com/en-us/library/ms787867(VS.85).aspx [1]: http://msdn.microsoft.com/en-us/library/ms787867(VS.85).aspx
|nant|msbuild|build-automation|buildprocess|
Should I switch from nant to msbuild?
|buildprocess|msbuild|nant|build-automation|
I currently use nant, ccnet (cruise control), svn, mbunit. I use msbuild to do my sln build just because it was simpler to shell out. Are there any merits to switching my whole build script to MSBuild? I need to be able to run tests, watir style tests, xcopy deploy. Is this easier? **Update: Any compelling features that would cause me to shift from nant to msbuild?**
|build-process|msbuild|nant|build-automation|
"Even if there is no actual [information architecture], it doesn’t mean we don’t experience or perceive it as such. Zen Buddhists say there is no actual “self” but they still name their kids."-Andrew Hinton
Its a programming paradigm.. Designed to make it easier for us mere mortals to break down a problem into smaller, workable pieces.. If you dont find it useful.. Don't use it, don't pay for training and be happy. I on the other hand do find it useful, so I will :)
Code Injection With C#
|codeinjection|c#|
I just saw [This Question][1] and it made me wonder: Can you use windows hooks or other methods to do code injection with c#? I've seen lots of things about code injection but all of them are done in C/C++. I don't know either of those languages and have a really hard time translating. Does anyone have any ideas on how to do this? [1]: http://stackoverflow.com/questions/24230/injecting-a-managed-net-assembly-dll-into-another-process
|c#|code-injection|
REALLY Simple Website--How Basic Can You Go?
|personal-website|newbies|
Although I've done programming, I'm not a programmer. I've recently agreed to coordinate getting a Website up for a club. The resources are--me, who has done Web content maintenance (putting content into HTML and ColdFusion templates via a gatekeeper to the site itself; doing simple HTML and XML coding); a serious Web developer who does database programming, ColdFusion, etc., and talks way over the heads of the rest of us; two designers who use Dreamweaver; the guy who created the original (and now badly broken) site in Front Page and wants to use Expression Web; and assorted other club members who are even less technically inclined. What we need up first is some text and graphics (a gorgeous design has been created in Dreamweaver), some links (including to existing PDF newsletters for download), and maybe hooking up an existing Blogspot blog. Later (or earlier if it's not hard), we may add mouseover menus to the links, a gallery, a calendar, a few Mapquest hotlinks, and so on. My question--First, is there any real problem with sticking with HTML and jpegs for the initial site? Second, for the "later" part of the site development, what's the simplest we can go with? Third, are there costs in doing this the simple way that will make us regret it down the road? Also, is there a good site/resource where I can learn more about this from a newbie perspective? Thanks all!
I believe you have to set the option in your connect string to force textual import rather than auto-detecting it. Provider=Microsoft.ACE.OLEDB.12.0; Data Source=c:\path\to\myfile.xlsx; Extended Properties=\"Excel 12.0 Xml;IMEX=1\"; Your milage may vary depending on the version you have installed. The IMEX=1 extended property tells Excel to treat intermixed data as text.
FindFirstChangeNotification is fine, but for slightly more ultimate power you should be using ReadDirectoryChangesW. (In fact, it's even recommended in the documentation!) It doesn't require a function pointer, it does require you to manually decode a raw buffer, it uses Unicode file names, but it is generally better and more flexible. On the other hand, if you want to do what FileMon does, you should probably do what FileMon does and use [IFS to create and install a file system filter][1]. MSN [1]: http://msdn.microsoft.com/en-us/library/ms790748.aspx
We've had pretty good luck by writing our own malloc and free functions. In production, they just call the standard malloc and free, but in debug, they can do whatever you want. We also have a simple base class that does nothing but override the new and delete operators to use these functions, then any class you write can simply inherit from that class. If you have a ton of code, it may be a big job to replace calls to malloc and free to the new malloc and free (don't forget realloc!), but in the long run it's very helpful. In Steve Maguire's book [Writing Solid Code][1] (highly recommended), there are examples of debug stuff that you can do in these routines, like: - Keep track of allocations to find leaks - Allocate more memory than necessary and put markers at the beginning and end of memory -- during the free routine, you can ensure these markers are still there - memset the memory with a marker on allocation (to find usage of uninitialized memory) and on free (to find usage of free'd memory) Another good idea is to *never* use things like strcpy, strcat, or sprintf -- always use strncpy, strncat, and snprintf. We've written our own versions of these as well, to make sure we don't write off the end of a buffer, and these have caught lots of problems too. [1]: http://www.microsoft.com/mspress/books/1024.aspx
Encrypting the session value will have zero effect. The session cookie is already an arbitrary value, encrypting it will just generate another arbitrary value that can be sniffed. The only real solution is HTTPS. If you don't want to do SSL on your whole site (maybe you have performance concerns), you might be able to get away with only SSL protecting the sensitive areas. To do that, first make sure your login page is HTTPS. When a user logs in, set a secure cookie (meaning the browser will only transmit it over an SSL link) in addition to the regular session cookie. Then, when a user visits one of your "sensitive" areas, redirect them to HTTPS, and check for the presence of that secure cookie. A real user will have it, a session hijacker will not.
Stored Procedures are great because they can be changed without a recompile. I would try to use them as often as possible. I only use ad-hoc for queries that are dynamically generated based on user input.
A quick and dirty solution is to use <a href="http://perldoc.perl.org/functions/glob.html">glob</a> @files = glob ('/path/to/dir/*');
|php|performance|oop|php5|php4|
What are the performance, security, or "other" implications of using the following form to declare a new class instance in PHP <?php $class_name = 'SomeClassName'; $object = new $class_name; ?> This is a contrived example, but I've seen this form used in Factories (OOP) to avoid having a big if/switch statement. Problems that come immediately to mind are 1. <s>You lose the ability to pass arguments into a constructor</s> (LIES. Thanks Jeremy) 2. Smells like eval(), with all the security concerns it brings to the table (but not necessarily the performance concerns?) What other implications are there, or what search engine terms other than "Rank PHP Hackery" can someone use to research this?
Look at the alternate constructor for DatagramSocket: DatagramSocket(int port, InetAddress laddr) Creates a datagram socket, bound to the specified local address. I'm guessing you're only specifying the port.
Winforms c# - Set focus to first child control of tab page.