instruction stringlengths 0 30k ⌀ |
|---|
I may have misunderstood your question but....
The 'grey bar telling you what type of control it is' only shows up if you are looking at the page in 'design view' in your IDE (are you using Visual Studio?).
Once you run the page this label is not visible.
It is very common for pages that have dynamic/server-side content to 'not look right' when you are looking at them in 'design view'.
Little things like the label/grey bar you are talking about are just there to help you work on the page when it is not populated with the dynamic content.
As a result of this, I find that 99.9% of the time I use 'source view' in my IDE because as your page content becomes more dynamic, the 'design view' becomes more useless. |
One repository for your projects is probably sufficient. I like the typical approach that indexes the layout by project (see [this section][1] from the [O'Reilly Subversion book][2]):
/first-project/trunk
/first-project/branches
/first-project/tags
/another-project/trunk
/another-project/branches
/another-project/tags
/common-stuff/trunk
/common-stuff/branches
/common-stuff/tags
Keep in mind that you can always reorganize the repository later.
Also, for in-house stuff, I prefer FSFS for the data-store, as opposed to Berkeley DB. FSFS is more resilient and the speed of checkouts is not much concern for small teams/projects. You can [compare][3] and decide for yourself.
Other standard parts of the recipe include [Trac][4] and a minimal Linux server to host the repository on the LAN.
[1]: http://svnbook.red-bean.com/en/1.1/ch04s07.html#svn-ch-4-sect-7.1
[2]: http://svnbook.red-bean.com/
[3]: http://svnbook.red-bean.com/en/1.1/ch05.html#svn-ch-5-sect-1.3
[4]: http://trac.edgewall.org/ |
__doPostBack not rendering on postback |
|postback|aspnet| |
I'm having a strange problem.
I have to use GetPostBackEventRefence to force a Postback, but it works the first time, after the first postback, the .NET function is not rendered... any ideas?
This is what I'm missing after the postback:
<script language="javascript" type="text/javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
theform = document.Main;
}
else {
theform = document.forms["Main"];
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script> |
|asp.net|postback| |
|asp.net|javascript|postback| |
We use a custom modified version of [suckerfish][1] at work. DB performance isn't an issue for us because we cache the control.
The control renders out nested `UL`/`LI`s either for all nodes in the `web.sitemap` or for a certain set of pages pulled from the DB. We then use [jQuery][2] to do all the cool javascript stuff. Because it uses such basic HTML, it's pretty easy to have multi-line or wrapped long items once you style it with CSS.
[1]: http://www.google.com/search?q=suckerfish
[2]: http://jquery.com/ |
Some things that come to mind:
- asp.net has nice "automatic" user management (authentication) system. I think it only goes with SQL Server, but there might be a way to make it work on other DBs. The tutorials assume SQL Server usually (or the built in file based DB for development)
- Not related to asp.net, but useful for any project is SQLCLR, which I find a great addition to sql server. Lets you delegate logic you write in the business level (supporting dll or classes) to sql server in the from of a SP, but the SP is written in vb.net/c#
- [Notification services][1]
[1]: http://msdn.microsoft.com/en-us/library/ms170722(SQL.90).aspx |
I extract DNRTV's audio and listen to it as a podcast (or have it run as a video on my Archos media player and just listen to it).
I don't have time to watch it for an hour. Usually I can follow the discussion without watching the video. |
The only way to test for randomness is to write a program that attempts to build a predictive model for the data being tested, and then use that model to try to predict future data, and then showing that the uncertainty, or entropy, of its predictions tend towards maximum (i.e. the uniform distribution) over time. Of course, you'll always be uncertain whether or not your model has captured all of the necessary context; given a model, it'll always be possible to build a second model that generates non-random data that looks random to the first. But as long as you accept that the orbit of Pluto has an insignificant influence on the results of the shuffling algorithm, then you should be able to satisfy yourself that its results are acceptably random.
Sorry. |
The only way to test for randomness is to write a program that attempts to build a predictive model for the data being tested, and then use that model to try to predict future data, and then showing that the uncertainty, or entropy, of its predictions tend towards maximum (i.e. the uniform distribution) over time. Of course, you'll always be uncertain whether or not your model has captured all of the necessary context; given a model, it'll always be possible to build a second model that generates non-random data that looks random to the first. But as long as you accept that the orbit of Pluto has an insignificant influence on the results of the shuffling algorithm, then you should be able to satisfy yourself that its results are acceptably random.
Of course, if you do this, you might as well use your model *generatively*, to actually create the data you want. And if you do that, then you're back at square one. |
I have a project that I work on in both VS 2005 and VS 2008. The trick is just to have to different solution files, and to make sure they stay in sync. Remember that **projects** keep track of their **files**, so the main thing **solutions** do is keep track of which **projects** they contain; pretty easy to keep in sync.
So just create a new blank solution in VS 2005, and then add each of your projects to it, one by one. Be sure to name the solutions appropriately. (I call mine ProjectName.sln and ProjectNameVs2008.sln.)
Which is a long way of saying you should try workaround #2. |
In your event handlers, instead of `return false`, use `event.preventDefault()` or `event.stopPropagation()`. The `event` methods are the standard/compatible way, but lots of old tutorials still recommend `return`. |
It was a network issue, we configurated a proxy server and that was the problem, I need to learn more about network. |
At the risk of offending some, I suspect that the word managed was used so they could use the word unmanaged instead of compiled. While managed may mean more, the reality is it seems to be the used to distinguish mostly between what is pretty much just in time compiling (as the replacement for what was one once interpreted or pcode) and native compiled code.
Or put another way, which would you prefer to use:
a) Unmanaged code that may do uncontrollable things to the system.
b) Native compiled code that is fast, solid and is close to the OS.
Of course, they are actually the same thing. |
How do I get the external IP of a socket in Python? |
I've used [CppUnit][1] with VS2005 and Eclipse. The wiki is very thorough (especially if you are familiar with JUnit).
[1]: http://cppunit.sourceforge.net/cppunit-wiki |
You could try setting up your own python installation using [Virtual Python][1]. Check out how to setup Django using it [here][2]. That was written a long time ago, but it shows how I got MySQLdb setup without having root access or anything like it. Once you've got the basics going, you can install any python library you want.
[1]: http://peak.telecommunity.com/DevCenter/EasyInstall#creating-a-virtual-python
[2]: http://forums.site5.com/showthread.php?t=10236 |
Try this:
<%= Html.CheckBox("myCheckbox", "Click here", "True", false, new {_id ="test" })%>
For any keyword you can use an underscore before the name of the attribute. |
Try this:
<%= Html.CheckBox("myCheckbox", "Click here", "True", false, new {_id ="test" })%>
For any keyword you can use an underscore before the name of the attribute. Instead of class you use _class. Since class is a keyword in C#, and also the name of the attribute in HTML. Now, "id" isn't a keyword in C#, but perhaps it is in another .NET language that they want to support. From what I can tell, it's not a keyword in VB.NET, F#, or Ruby so maybe it is a mistake that they force you to use an underscore with it. |
One thing I've done in the past - if I'm extending a class I'll try and follow their conventions. For example, when working with the Spring Framework, I'll have my MVC Controller classes in a package called com.mydomain.myapp.web.servlet.mvc
If I'm not extending something I just go with what is simplest. com.mydomain.domain for Domain Objects (although if you have a ton of domain objects this package could get a bit unwieldy).
For domain specific constants, I actually put them as public constants in the most related class. For example, if I have a "Member" class and have a maximum member name length constant, I put it in the Member class. Some shops make a separate Constants class but I don't see the value in lumping unrelated numbers and strings into a single class. I've seen some other shops try to solve this problem by creating SEPARATE Constants classes, but that just seems like a waste of time and the result is too confusing. Using this setup, a large project with multiple developers will be duplicating constants all over the place. |
Chris, I'm a little confused about your circumstances. If I understand correctly, you have a both a web app (read/write) a standalone application (read-only?) using Hibernate to access a shared database. The changes you make with the web app aren't visible to the standalone app. Is that right?
If so, have you considered using a different second-level cache implementation? I'm wondering if you might be able to use a clustered cache that is shared by both the web application and the standalone application. I believe that SwarmCache, which is integrated with Hibernate, will allow this, but I haven't tried it myself.
In general, though, you should know that the contents of a given cache will never be aware of activity by another application (that's why I suggest having both apps share a cache). Good luck! |
I think a place where Singleton will make more sense than the static class is when you have to construct a pool of costly resources (like database connections). You would not be interested in creating the pool if noone ever uses them (static class will means that you do the costly work when class is loaded). |
Am I allowed to run a javascript runtime (like v8) on the iPhone? |
|c++|javascript|iphone|law| |
According to [this discussion][1], the iphone agreement says that it doesn't allow "loading of plugins or running interpreted code that has been downloaded".
Technically, I **would** like to download scripts from our server (embedded in a proprietary protocol).
Does this mean I wouldn't be allowed to run a runtime like v8 in an iphone app?
This is probably more of a legal question.
[1]: http://groups.google.com/group/v8-users/browse_thread/thread/3f57f8d1c31806a5 |
|c++|javascript|iphone|legal| |
How to upload a file to a WCF Service? |
|web-services|wcf| |
I've build a WCF Service to accept a file and write it to disk. The front-end consists of a page with SWFUpload which is handling the upload on the client side. Apparently, SWFUpload posts the data with a Content Type of: multipart/form-data.
I would think this ok but on the Service side I get an error. The error is "ProtocolException" expecting text/xml. I've tried different message encodings in the bindings but nothing seems to work.
How can I get this file uploaded using multipart/form-data?
|
It's not clear what conditions you're talking about. If you want to set column to default value, you can use [DbNull.Value][1];
command.AddWithValue("@param", DbNull.Value);
or
command.Parameters.Add("@param", <data type>).Value = DBNull.Value;
[1]: http://msdn.microsoft.com/en-us/library/system.dbnull.value.aspx |
Setting up SVN repositories can be tricky only in the sense of how you organize them. Before we setup SVN, I actually RTFM'd the online [Subversion manual][1] which discusses organizational techniques for repositories and some of the gotchas you should think about in advance, namely what you cannot do after you have created your repositories if you decide to change your mind. I suggest a pass through this manual before setup.
For us, as consultants, we do custom and in-house software development as well as some document management through SVN. It was in our interest to create one repository for each client and one for ourselves. Within each repository, we created folders for each project (software or otherwise). This allowed us to segment security access by repository and by client and even by project within a repository. Going deeper, for each software project we created 'working', 'tags' and 'branches' folders. We generally put releases in 'tags' using 'release_w.x.y.z' as the tag for a standard.
In your case, to keep sprocs, scripts, and other related documents in synch, you can create a project folder, then under that a 'working' folder, then under that 'code' and next to it 'scripts', etc. Then when you tag the working version for release, you end up tagging it all together.
\Repository
\ProjectX
\Working
\Code
\Scripts
\Notes
\Tags
\Branches
As for non-code, I would suggest a straight folder layout by project or document type (manuals, policies, etc.). Generally with documents and depending on how your company operates, just having the version history/logs is enough.
We run SVN on Windows along with [WebSVN][2] which is a great open source repository viewer. We use it to give clients web access to their code and it's all driven by the underlying Subversion security. Internally, we use [TortoiseSVN][3] to manage the repositories, commit, update, import, etc.
Another thing is that training should be considered an integral part of your deployment. Users new to version control may have a hard time understanding what is going on. We found that giving them functional instructions (do this when creating a project, do this when updating, etc.) was very helpful while they learned the concepts. We created a 'sandbox' repository where users can play all they want with documents and folders to practice, you may find this useful as well to experiment on what policies to establish.
Good luck!
[1]: http://svnbook.red-bean.com/
[2]: http://websvn.tigris.org/
[3]: http://tortoisesvn.tigris.org/ |
|python|sockets| |
When I call `socket.getsockname()` on a socket object, it returns a tuple of my machine's internal IP and the port. However, I would like to retrieve my external IP. What's the cheapest, most efficient manner of doing this? |
This isn't possible without cooperation from an external server, because there could be any number of NATs between you and the other computer. If it's a custom protocol, you could ask the other system to report what address it's connected to. |
Vista does some nifty transparent redirection to provide backwards compatibility with non-vista applications. Try installing to the All Users location as a non-admin, and Vista should transparently put your shortcuts somewhere unique to that user.
|
The only way I can think of that's guaranteed to give it to you is to hit a service like http://whatismyip.com/ to get it. |
Excel like server side control for ASP.NET |
|asp.net|excel|servercontrols| |
We have a requirement to increase the functionality of a grid we are using to edit on our webapp, and our manager keeps citing Excel as the perfect example for a data grid :/ He still doesn't really get that a Spreadsheet like control doesn't exist out of the box, but I thought I'd do a bit of searching nonetheless.
I've found a couple of products on Google, but was wondering if anyone else has any feedback around any such controls (obviously the cheaper or *ahem* freer the better)
|
We have a requirement to increase the functionality of a grid we are using to edit on our webapp, and our manager keeps citing Excel as the perfect example for a data grid :/ He still doesn't really get that a Spreadsheet like control doesn't exist out of the box, but I thought I'd do a bit of searching nonetheless.
I've found a couple of products on Google, but was wondering if anyone else has any feedback around any such controls (obviously the cheaper or *ahem* freer the better)
**EDIT** We do currently have the Telerik controls, but what the 'current' requirement is, is a control that can copy and paste (e.g) 3 cells from one row and paste them on another, the row by row editing of Telerik doesn't really cut it. We are currently in competition with an 'Excel' based solution, which is always a nightmare in winning users around, who always prefer flexibility to structure
|
Tools for manipulating PowerPoint files |
|c#|.net|powerpoint| |
Do you know managed tools for manipulating PowerPoint files?
The tool should be 100% managed code and offer the option to
handle .ppt and .pptx files. |
- Managed DirectX (Microsoft.DirectX namespace) for faster 3D graphics. It's a solid .NET wrapper over DirectX API, which comes with a bit of performance hit for creating .NET objects and marshalling. Unless you are writing a full featured modern 3D engine, it will work fine.
- Window Presentation Foundation (WPF) (Windows.Media namespace) - best choice for 2D graphics. Also has limited 3D abilities. Aimed to replace Windows Forms with vector, hardware accelerated resolution-independent framework. Very convenient, supports several flavours of custom controls, resources, data binding, events and commands... also has a few WTFs. Speed is usually faster than GDI and slower than DirectX, and depends greatly on how you do things (seen something to work 60 times faster after rewriting in a sensible way). We had a success implementing 3 1280x1024 screens full of real-time indicators, graphs and plots on a single (and not the best) PC.
|
@[Abdu]
The main thing I've found that MySQL has over MSSQL is timezone support - the ability to nicely change between timezones, respecting daylight savings is fantastic.
Compare this:
mysql> SELECT CONVERT_TZ('2008-04-01 12:00:00', 'UTC', 'America/Los_Angeles');
+-----------------------------------------------------------------+
| CONVERT_TZ('2008-04-01 12:00:00', 'UTC', 'America/Los_Angeles') |
+-----------------------------------------------------------------+
| 2008-04-01 05:00:00 |
+-----------------------------------------------------------------+
to the contortions involved at [this answer][1].
As for the 'easier to use' comment, I would say that the point is that they are different, and if you know one, there will be an overhead in learning the other.
[1]: http://stackoverflow.com/questions/24797/effectively-converting-dates-between-utc-and-local-ie-pst-time-in-sql-2005#25073 |
@[abdu](#51244)
The main thing I've found that MySQL has over MSSQL is timezone support - the ability to nicely change between timezones, respecting daylight savings is fantastic.
Compare this:
mysql> SELECT CONVERT_TZ('2008-04-01 12:00:00', 'UTC', 'America/Los_Angeles');
+-----------------------------------------------------------------+
| CONVERT_TZ('2008-04-01 12:00:00', 'UTC', 'America/Los_Angeles') |
+-----------------------------------------------------------------+
| 2008-04-01 05:00:00 |
+-----------------------------------------------------------------+
to the contortions involved at [this answer][1].
As for the 'easier to use' comment, I would say that the point is that they are different, and if you know one, there will be an overhead in learning the other.
[1]: http://stackoverflow.com/questions/24797/effectively-converting-dates-between-utc-and-local-ie-pst-time-in-sql-2005#25073 |
I believe you are going to have to tranfer the file as a byte array to WCF. You will need to handle the post from SWFUpload and convert to a byte array before sending to your service. |
How do I get the full url of the page I am on in C# |
|c#|user-controls| |
I need to be able to get at the full URL of the page I am on from a user control. Is it just a matter of concatenating a bunch of Request variables together? If so which ones? Or is there a more simpiler way? |
|c#|asp.net|user-controls| |
@jdiaz,
@JasonS is right, to upload file you need to transfer it as a byte stream. You need to use [WCF streaming][1]. For example on how to upload file via WCF see [an article][2] from http://kjellsj.blogspot.com
[1]: http://msdn2.microsoft.com/en-us/library/ms733742.aspx
[2]: http://kjellsj.blogspot.com/2007/02/wcf-streaming-upload-files-over-http.html |
Find long running query on Informix? |
|database|informix| |
How can you find out what are the long running queries are on Informix database server? I have a query that is using up the CPU and want to find out what the query is. |
*I would let him use whatever his WYSIWYG Editor spits out
I just threw-up a little...
*ahh hello? You don't think the graphic designer is writing the CSS by hand
do you?
Funnily enough I have worked with a few designers and the best among them ***do*** hand-tweak their css. The guy I am thinking of actually does all of his design work as an XHTML file with a couple of CSS files and creates graphical elements on the fly as he needs them. He uses Dreamweaver but only really as a navigation tool. (I learned a lot from that guy)
Once you've made an investment to learn purely CSS-based design and have had a little experience (found out where IE sucks [to be fair it's getting better]) it ends up being faster I've found. I worked on Content Management Systems and the application rarely had to change for the designers to come up with a radically different look. |
> *I would let him use whatever his WYSIWYG Editor spits out
> I just threw-up a little...
> *ahh hello? You don't think the graphic designer is writing the CSS by hand do you?
Funnily enough I have worked with a few designers and the best among them ***do*** hand-tweak their css. The guy I am thinking of actually does all of his design work as an XHTML file with a couple of CSS files and creates graphical elements on the fly as he needs them. He uses Dreamweaver but only really as a navigation tool. (I learned a lot from that guy)
Once you've made an investment to learn purely CSS-based design and have had a little experience (found out where IE sucks [to be fair it's getting better]) it ends up being faster I've found. I worked on Content Management Systems and the application rarely had to change for the designers to come up with a radically different look. |
As others have mentioned, Lists and tuples are both containers which can be used to store python objects. Lists are extensible and their contents can change by assignment, on the other hand tuples are immutable.
Also, lists cannot be used as keys in a dictionary whereas tuples can. |
I use Hungarian Naming for UI elements like buttons, textboxes and lables. The main benefit is grouping in the Visual Studio Intellisense Popup. If I want to access my lables, I simply start typing lbl.... and Visual Studio will suggest all my lables, nicley grouped together.
However, after doing more and more Silverlight and WPF stuff, leveraging data binding, I don't even name all my controls anymore, since I don't have to reference them from code-behind (since there really isn't any codebehind anymore ;) |
The best way to implement sparse matrices is to not to implement them - atleast not on your own. I would suggest to BLAS (which I think is a part of LAPACK) which can handle really huge matrices. |
Windows PowerShell is the obvious choice when it comes to "better windows command line shell other than cmd". Its clipboard handling isn't that much of an improvement - mark with the mouse, Enter to copy, or right mouse click to paste. |
A Primary Key needn't be an autoincrementing field, in many cases this just means you are complicating your table structure.
Instead, a Primary Key should be the minimum collection of attributes (note that most DBMS will allow a composite primary key) that uniquely identifies a tuple.
In technical terms, it should be the field that every other field in the tuple is fully functionally dependent upon. (If it isn't you might need to normalise).
In practice, performance issues may mean that you merge tables, and use an incrementing field, but I seem to recall something about premature optimisation being evil... |
[Devexpress][1] has a powerful grid control for both web and windows. It is not free and I guess nothing really matches Excel. But once the users started using it, they wanted every app use it. Check these [videos][2] especially the data grouping one.
[1]: http://www.devexpress.com/Products/NET/Controls/ASP/Grid/
[2]: http://www.devexpress.com/Products/NET/Controls/ASP/Grid/quickstart.xml |
[Devexpress][1] has a powerful grid control for both web and windows. It is not free and I guess nothing really matches Excel. But once the users started using it, they wanted every app with it. Check these [videos][2] especially the data grouping one.
[1]: http://www.devexpress.com/Products/NET/Controls/ASP/Grid/
[2]: http://www.devexpress.com/Products/NET/Controls/ASP/Grid/quickstart.xml |
Update: with Silverlight fast approaching, maybe you can use a real excel control.
[Devexpress][1] has a powerful grid control for both web and windows. It is not free and I guess nothing really matches Excel. But once the users started using it, they wanted every app with it. Check these [videos][2] especially the data grouping one.
[1]: http://www.devexpress.com/Products/NET/Controls/ASP/Grid/
[2]: http://www.devexpress.com/Products/NET/Controls/ASP/Grid/quickstart.xml |
Java: Is there a way to take a screenshot using java and save it to some sort of image? |
|java|image|screenshot| |
Simple as the title states: Can you use only Java commands to take a screenshot and save it? Or, do I need to use an OS specific program to take the screenshot and then grab it off the clipboard? |
Use backticks to substitute the result of a command.
ls > `pwd`.txt |
Use backticks to substitute the result of a command:
ls > `pwd`.txt
Note that the unprocessed substitution of `pwd` is an absolute path, so the above command creates a file with the same name in the same directory as the working directory, but with a `.txt` extension. |
Use backticks to substitute the result of a command:
ls > `pwd`.txt
Note that the unprocessed substitution of `pwd` is an absolute path, so the above command creates a file with the same name in the same directory as the working directory, but with a `.txt` extension. Thomas Kammeyer reminded me that the `basename` command strips the leading directory, so this would create a text file in the current directory with the name of that directory:
ls > `basename $PWD`.txt |
Use backticks to substitute the result of a command:
ls > `pwd`.txt
As pointed out by Landon, `$(cmd)` is equivalent:
ls > $(pwd).txt
Note that the unprocessed substitution of `pwd` is an absolute path, so the above command creates a file with the same name in the same directory as the working directory, but with a `.txt` extension. Thomas Kammeyer reminded me that the `basename` command strips the leading directory, so this would create a text file in the current directory with the name of that directory:
ls > `basename $(pwd)`.txt |
Wow, lots of complexity here, if all you want to do is just catch the most obvious syntax errors, I would do something like this:
\S+@\S+
It usually catches the most obvious errors that the user makes and assures that the form is mostly right, which is what javascript validation is all about. |
I don't fully understand the question but you seem to be asking what to do with additional exception data, if that is not your question feel free to ignore this.
I think an important question to ask is what exactly is the exception message for? It is not for knowing where the exception came from, the stack trace is for that; it is not to encapsulate an exception in a more general one, that should be done with the InnerException field; in the case where your exception is only raised from a particular place in your code it isn't even for describing what kind of error you had - thats what the type of the exception is for.
Generally I use the message field to provide simple, human-readable tips that a programmer that is not me, seeing this error for the first time can use to gain an understanding of the underlying system. I consider the message field to be appropriate for a short (one sentence) explanation, a hint as to how this error is frequently raised, or a reference to further reading.
So, as far as I understand your question, I think that the best way to store this 'additional information' that is received from another system is as an InnerException. I don't know Elmah, but if it's worth its salt it will check for InnerExceptions and store them. |
Elmah is a http module that records unhandled exceptions.
I guess it's just a limitation of Elmah, since it doesn't store custom fields. I guess I'll have to ask those guys. I have the extra field in there for the response data, but Elmah does not store it. |
Play button in browser |
|flash|browser|mp3|streaming| |
I want to put songs on a web page and have a little play button, like you can see on Last.fm or Pandora. There can be multiple songs listed on the site, and if you start playing a different song with one already playing, it will pause the first track and begin playing the one you just clicked on. I think they use Flash for this, and I could probably implement it in a few hours, but is there already code I could use for this? Maybe just a flash swf file that you stick hidden on a web page with a basic Javascript API that I can use to stream mp3 files? |
I want to put songs on a web page and have a little play button, like you can see on Last.fm or Pandora. There can be multiple songs listed on the site, and if you start playing a different song with one already playing, it will pause the first track and begin playing the one you just clicked on. I think they use Flash for this, and I could probably implement it in a few hours, but is there already code I could use for this? Maybe just a flash swf file that you stick hidden on a web page with a basic Javascript API that I can use to stream mp3 files?
Also, what about WMA or AAC files? Is there a universal solution that will play these 3 file types? |
@jagmal I think you've got some wires crossed somewhere - all the examples you list are clearly not static methods.
**Static methods should deal entirely with abstract properties and concepts of a class - they should in no way relate to instance specific attributes (and most compilers will yell if they do).**
For the car example, speed, kms driven are clearly attribute related. Gear shifting and speed calculation, when considered at the car level, are attribute dependent - but consider a carModel class that inherits from car: at this point theyy could become static methods, as the required attributes (such as wheel diameter) could be defined as constants at that level.
|
The mechanize Browser object has a title() method. So the code from [this post](http://stackoverflow.com/questions/51233/how-can-i-retrieve-the-page-title-of-a-webpage-using-python#51242) can be rewritten as:
<pre><code>from mechanize import Browser
br = Browser()
br.open("http://www.google.com/")
print br.title()
</code></pre> |
What table/view do you query against to select all the table names in a schema in Oracle? |
|sql|oracle-database|query| |
What object do you query against to select all the table names in a schema in Oracle? |
I use this code and it works great:
System.Xml.XmlDocument xd = new System.Xml.XmlDocument;
xd.Load("http://www.webservice.com/webservice?fXML=1");
string xPath = "/xml/somekey";
// this node's inner text contains "somevalue"
return xd.SelectSingleNode(xPath).InnerText; |
I use this code and it works great:
System.Xml.XmlDocument xd = new System.Xml.XmlDocument;
xd.Load("http://www.webservice.com/webservice?fXML=1");
string xPath = "/xml/somekey";
// this node's inner text contains "somevalue"
return xd.SelectSingleNode(xPath).InnerText;
----------
EDIT: I just realized you're talking about a webservice and not just plain XML. In your Visual Studio Solution, try right clicking on References in Solution Explorer and choose "Add a Web Reference". A dialog will appear asking for a URL, you can just paste it in: "http://www.webservice.com/webservice.asmx". VS will autogenerate all the helpers you need. Then you can just call:
com.webservice.www.WebService ws = new com.webservice.www.WebService();
// this assumes your web method takes in the fXML as an integer attribute
return ws.SomeWebMethod(1); |
You may use,
select tabname from tabs
to get the name of tables present in schema. |
you're looking for:
<pre>
select table_name from user_tables;
</pre> |
You could move whatever is in your app_code to an external class library if your QA dept can promote that entire library. I think you are stuck with sticky sessions if you can't find a convenient or tolerable way to switch to a pre-compiled site. |
What you want to use is probably [MTOM][1], if you want it to be standard. Using this, you can have MIME multiparts messages.
You then have to read the file as a stream and stuff it into one of the parameters of the request.
[1]: http://www.w3.org/TR/soap12-mtom/ |
Most of the podcasts I listened to are already discussed above.
DotNetRocks
HanselMinutes
RunAsRadio
Mondays (for when you are bored with development stuffs)
Herding Code
Arcast (used to)
AudibleAjax
OpenWeb
There are some bits from OOPSLA that were interesting as well (not a long running podcasts, but it's nice to hear). |
Performance gain in compiling java to native code? |
|java|performance| |
Is there any performance to be gained these days from compiling java to native code, or do modern hotspot compilers end up doing this over time anyway?
|
Yes, if you make it a dynamic link and make the interface c-style. lib.exe will generate import libraries which are compatible with the gcc toolchain.
That will resolve your linking problems. However that is just the start of the problem.
Your larger problems will be things like exceptions, and memory allocation.
- You must ensure that no exception cross from VC++ to gcc code, there are no guarantees of compatibility.
- Every object from the VC++ library will need to live on the heap because:
- Do not mix gcc new/delete with anything from VC++, bad things will happen. However, if you make an interface like create_some_obj()/delete_some_obj() you do not end up using gcc new to construct VC++ objects. Maybe make a small handler object that handles construction and destruction. This way you preserve RAII, but still use the c-interface for the true interface.
- Calling convention must be corret. In VC++ there is cdecl and stdcall. If gcc tried to call an imported function with the wrong calling type, bad things will happen.
The bottom line is keep a simple interface that is ANSI C compliant, and you should be fine. The fact that crazy C++ goes on behind is okay, as long as it is contained.
Oh and make sure all the code is re-entrant, or you risk opening a whole nother can-o-worms. |
Yes, if you make it a dynamic link and make the interface c-style. lib.exe will generate import libraries which are compatible with the gcc toolchain.
That will resolve your linking problems. However that is just the start of the problem.
Your larger problems will be things like exceptions, and memory allocation.
- You must ensure that no exception cross from VC++ to gcc code, there are no guarantees of compatibility.
- Every object from the VC++ library will need to live on the heap because:
- Do not mix gcc new/delete with anything from VC++, bad things will happen. This goes for object construction on the stack too. However, if you make an interface like create_some_obj()/delete_some_obj() you do not end up using gcc new to construct VC++ objects. Maybe make a small handler object that handles construction and destruction. This way you preserve RAII, but still use the c-interface for the true interface.
- Calling convention must be correct. In VC++ there is cdecl and stdcall. If gcc tried to call an imported function with the wrong calling type, bad things will happen.
The bottom line is keep a simple interface that is ANSI C compliant, and you should be fine. The fact that crazy C++ goes on behind is okay, as long as it is contained.
Oh and make sure all the code is re-entrant, or you risk opening a whole nother can-o-worms. |
Yes that NoScript snippet is right. |
I'll vote up darkhelmet since [gSoap][1] would also be my recommendation. We're mostly a Java shop but with some C++ bits and gSoap has been our preferred SOAP integration way. It is indeed more work than your typical Java stacks but it seems solid.
[1]: http://www.cs.fsu.edu/~engelen/soap.html |