instruction stringlengths 0 30k ⌀ |
|---|
How can I return a variable from a $.getJSON function |
|jquery|javascript| |
I want to return StudentId to use elsewhere outside of the scope of the $.getJSON()
j.getJSON(url, data, function(result)
{
var studentId = result.Something;
});
//use studentId here
I would imagine this has to do with scoping, but it doesn't seem to work the same way c# does
... |
|javascript|jquery|ajax| |
Can't you just use the same control I'm Stack Overflow uses (that we're all typing into)---WMD, and just store the Markdown in the VARCHAR. Then use the .NET Markdown to HTML converter, as you mentioned, to display the HTML as needed. Jeff talks about this in more detail in a StackOverflow podcast (don't know the episo... |
Both of you were on the right track. What I realized is that SimpleModal appends the dialog to the body, which is outside ASP.Net's `<form>`, which breaks the functionality, since it can't find the elements.
To fix it, I just modified the SimpleModal source to append eveything to `'form'` instead of `'body'`. When... |
How do threads work in python, and what are common python-threading specific pitfalls? |
|python|multithreading| |
I've been trying to wrap my head around how threads work in python, and it's hard to find good information on how they operate. I may just be missing a link or something, but it seems like the official docs aren't very thorough on the subject, and I haven't been able to find a good write-up.
From what I can tell, on... |
Well, I've been browsing around Bugzilla for a bit now and seemingly the best way you can go for clearing the authentication would be to send non-existant credentials.
Read more here: [https://bugzilla.mozilla.org/show_bug.cgi?id=287957][1]
[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=287957 |
Do you need the .NET 1.0 framework to target the .NET 1.0 framework? |
|.net| |
I have a bunch of .NET frameworks installed on my machine. I know that with the Java JDK, I can use the 6.0 version to target 5.0 and earlier. Can I do something similar with the .NET framework - target 1.0 and 2.0 with the 3.0 framework? |
(**Updated**)
You need to compile with the 1.0 compilers. These are only available with the 1.0 release of the runtime/SDK.
The 2.0/3.5 compilers won't emit 1.0-compatible assemblies.
Visual Studio 2008 can generate 2.0 assemblies, but 1.0 was left off.
|
Alternative "architectural" approaches to javaScript client code? |
|javascript|client|ria|architecture|model-view-controller| |
I've been working on a side project for some time now, and the further I get, the more my webpage has turned into a full-featured application. Right now, I'm sticking with <a href="http://jquery.com">jQuery</a>, however, the logic on the page is growing to a point where some organization, or dare I say it, "architectur... |
|javascript|model-view-controller|architecture|client|ria| |
How is your javaScript code organized? Does it follow patterns like MVC, or something else?
I've been working on a side project for some time now, and the further I get, the more my webpage has turned into a full-featured application. Right now, I'm sticking with <a href="http://jquery.com">jQuery</a>, however, the... |
MVC Route Help, 2 routes, 1 with a category url structure and the other for content page |
|mvc|routes| |
2 routes, the URLS look like:
- categories, always ends in a '/'
www.example.com/category/
www.example.com/category/subcategory/
www.example.com/category/subcategory/subsubcategory/
- content page, doesn't end in a '/', can only be at the root level or after 1 subcategory page.
www.example.com/root-le... |
ASP.NET MVC Route Help, 2 routes, 1 with a category url structure and the other for content page |
Really you're only doing four calculations, so ***readability seems way more important*** here than efficiency. My approach to make something like this more readable is to
1. Extract common code to a function
2. Put similar calculations together to make the patterns more obvious
3. Get rid of the intermediate... |
@chakrit
does this really work if refreshing the page?
i thought the viewstate was stored on the page, and had to be sent to the server on a postback, with a refresh that is not happening. |
If you still wish to get the project to compile using VS2008 (or in the future) I can suggest using a binary editor to view the object file in question *mainapp.obj*.
Here is an example from a small project of mine.
The zdbException.obj contains the following excerpt
DEFAULTLIB:"libc
pmtd" /DEFAUL... |
http://www.iconarchive.com has a nice selection |
Possible? Absolutely. Undetected? [Unlikely][1], since UDP employs a checksum that would require multiple-bit errors to appear valid.
[1]: http://gaia.cs.umass.edu/kurose/transport/UDP.html |
Possible? Absolutely. Undetected? [Unlikely][1], since UDP employs a checksum that would require multiple-bit errors to appear valid. If an error is detected, the system will likely drop the packet - such are the risks of using UDP.
[1]: http://gaia.cs.umass.edu/kurose/transport/UDP.html |
I've had the best luck with [Icon Buffet][1] and [StockIcons][2]
[1]: http://www.iconbuffet.com
[2]: http://stockicons.com |
I've used Silk Icons (http://www.famfamfam.com/lab/icons/silk/) on a few projects. It's covered under the creative commons license so you will have to include a link back to the site somewhere in your app. |
Try to make each .c focus on a particular area of functionality. Use the corresponding .h file to declare those functions.
Each .h file should have a 'header' guard around it's content. For example:
#ifndef ACCOUNTS_H
#define ACCOUNTS_H
....
#endif
That way you can include "accounts.h" as ma... |
UPD is really faster than TCP, and the simple reason is because it's non-existent acknowledge packet (ACK) that permits a continuous packet stream, instead of TCP that acknowledges each packet.
For more information I recommend the simple, but very comprehensible [Skullbox explanation][1]
[1]: http://skullbox.... |
I can perhaps give you a taste of our experience when we began looking at unit testing our middle-tier process that included a ton of "business logic" sql operations.
We first created an abstraction layer that allowed us to "slot in" any reasonable database connection (in our case, we simply supported a single ODBC-... |
|asp.net|mvc|routes| |
I need some help with ASP.NET MVC routes. I need to create 2 routes for a cms type application. One route will be for category level URLS, and the other route will be for the actual page content.
- categories, always ends in a '/'
www.example.com/category/
www.example.com/category/subcategory/
www.example... |
> The server must analyze all of this
> info to determine the health of these
> computers
That is probably the biggest clue so far explaning what your application is kinda about. Are you able to provide a more elaborate briefing on what this application is seeking to achieve in this distributed environment? We do ... |
Base64 Encoding Image |
|php|encoding|base64|opensearch| |
Where do the linux TCP/IP hackers live? |
|linux|tcp-ip|kernel| |
Over the past year or so my production platform has been plagued by an odd TCP/IP issue. I've spent zillions of hours working with competent & knowledgeable sysadmins, scouring the net, reading source code, been jerked around by RH's pathetic support, and **crying tears of blood**! To no avail. (Google ['unkn-4'][1]... |
Where do the Linux TCP/IP hackers 'live'? |
|linux|tcp|kernel| |
I don't see it mentioned often enough, but you **can** still implement fairly simple services with WCF, very similar to ASMX services. For example:
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class SimpleService
{
... |
$a = array(
0 => '- select -',
1 => 'Afghanistan',
2 => 'Albania',
3 => 'Algeria',
80 => 'USA'
);
$temp = array();
foreach ($a as $k => $v) {
$v == 'USA'
? array_unshift($temp, array($k, $v))
: array_push($temp, array($k, $v));
}
forea... |
Whilst it may be automatically dropped at the end of a session, it is good practice to drop the table yourself when you're done with it. |
How would you make a comma-separated string from a list? |
|python| |
What would be your preferred way to concatenate strings from a sequence such that between each two consecutive pair a comma is added. That is, how do you map, for instance, `[ 'a', 'b', 'c' ]` to `'a,b,c'`? (The cases `[ s ]` and `[]` should be mapped to `s` and `''`, respectively.)
I usually end up using something ... |
|python| |
What would be your preferred way to concatenate strings from a sequence such that between each two consecutive pair a comma is added. That is, how do you map, for instance, `[ 'a', 'b', 'c' ]` to `'a,b,c'`? (The cases `[ s ]` and `[]` should be mapped to `s` and `''`, respectively.)
I usually end up using something ... |
|python|list| |
Things have definitely quited down for the idea. Which is strange since you'd think its goals are even more relevant now.
[http://www.jini.org/wiki/Category:News][1]
[1]: http://www.jini.org/wiki/Category:News |
In Firebug's CSS tab, you can see what style rules apply to a selected elements in the cascading order. This may or may not help you in your problem.
My guess would be that something about the content of #inner3 is causing it to wrap below the first line, and the #outer is just getting sized to accommodate the small... |
Is there any way to repopulate an Html Select's Options without firing the Change event (using jQuery)? |
|javascript|jquery|dom|html-select| |
I have multiple selects:
<select id="one">
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
</select>
<select id="two">
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
... |
|java|twain|scanner|java-native-interface| |
I'm working on building an app to scan directly from TWAIN scanner to a Java applet. I'm already aware of [Morena][1] and [JTwain][2], but they cost money. I need free. I could re-invent the wheel with JNI, but it seems like someone has probably already done this as a FOSS tool.
Is anyone familiar with a **free** to... |
Getting Java and TWAIN to play together nicely |
|java|java-native-interface|twain|scanner| |
PHP on IIS |
|php|iis|windows|lamp|portability| |
Having been a PHP developer on LAMP servers for quite a while, is there anything that I will need to take into consideration while preparing an application for IIS on windows. |
|php|windows|iis|lamp|portability|wimp| |
If you're willing to use some C++, you can use a "function object":
struct MoveHandler {
chess_game *game;
int depth;
MoveHandler(chess_game *g, int d): game(g), depth(d) {}
void operator () (chess_move*) {
// now you can use the game and the depth
}... |
I'm not familiar with WebObjects, but I see you have java listed in there.
[iText][1] is a java api for building pdfs. If you can access a java api from WebObjects you should be able to build pdfs that way.
[1]: http://www.lowagie.com/iText/ |
After a moment of inspiration, the solution to my question became apparent to me (I was riding my bike). The '$now' part of
strtottime( string $time {,int $now ])
needs to be set as the current date. Not "$time()-now", but "the current date I'm concerned with / I'm looking at my log for.
ie: if I'm lo... |
Symmetric key storage |
|security|symmetric-key|key-storage| |
My company is going to be storing sensitive data for our customers, and will be encrypting data using one of the managed .NET encryption algorithm classes. Most of the work is done, but we haven't figured out how/where to store the key. I've done some light searching and reading, and it seems like a hardware solution m... |
That sounds pretty harsh to me, but if you think about the amount of money that changes hands during acquisitions, it's probably one of those cases where your IDE vendor just gets paid without complaint most of the time, so they keep with the policy.
I can see why it shouldn't be completely free to transfer the lice... |
A good algorithm similar to Levenstein but weighted for Qwerty keyboards? |
|algorithm|string|comparison|text| |
I noticed some posts here on string matching, which reminded me of an old problem I'd like to solve. Does anyone have a good Levenstein-like algorithm that is weighted toward Qwerty keyboards?
I want to compare two strings, and and allow for typos. Levenstein is okay, but I'd prefer to also accept spelling errors ba... |
Getting out of control? I think it's already out of control!
Can you not categorise the cases into 'x' general areas and split down into helper routines? |
Why does a "file exists" method in many languages return true for a directory? |
|file-io|methods|language-design| |
I know that it does in PHP, and I'm pretty sure it does in Java. I haven't used the latest versions of .NET, so I won't speak for them. It seems very awkward, but I was wondering if there was an underlying reason for this. |
In a single sentence, I'd say that WCF is "software that lets you set up and manage communication between systems a lot more efficiently than in the past".
I can see them bringing up BizTalk as a competitor, but of course you could say that WCF works with it and is in fact used as base technology for it in the more ... |
What's the best way to display a video with rounded corners in Silverlight? |
|silverlight| |
The MediaElement doesn't support rounded corners (radiusx, radiusy). Should I use a VideoBrush on a Rectangle with rounded corners? |
Visual Studio 2008 was the first to support targeting older versions of .NET. Unfortunately, it supports only .NET 2 and up.
In other words, you'll need .NET framework SDK 1 or 1.1 to do this. |
Yet another way to do it:
$ ls template_*.txt | sed -e 's/^template\(.*\)$/cp template\1 foo\1/' | ksh -sx
I've always been impressed with the ImageMagick [convert](http://www.imagemagick.org/script/convert.php) program that does what you expect with image formats:
$ convert rose.jpg rose.png
It has... |
We are using the tools by [RedGate][1] which I personally find very useful in any aspect of work with databases. For scripting I would recommend the [SQL Compare][2] (you need a pro version for scripting). The SQL Compare is a must have for deploying schema changes from the deployment DB to the live Server and a real t... |
The most widely used IDE for Common Lisp, particularly in the free software subset of the community, is in fact [SLIME][1], which runs on Emacs. You can use whatever CL compiler you prefer and invoke Lisp source files the way you describe, but if you do that, you won't be taking advantage of many of Lisps dynamic featu... |
XSLT Find and Replace with Unique |
|xslt| |
I am performing a find and replace on the line feed character (` `) and replacing it with the paragraph close and paragraph open tags using the following code:
<xsl:template match="/STORIES/STORY">
<component>
<xsl:if test="boolean(ARTICLEBODY)">
<p>
<xsl:call-template name="re... |
Shouldn't you be able to do something like this?
var strings = (from a in fooList select a.Bar).Distinct();
string[] array = strings.ToArray(); |
How to get an array of distinct property values from in memory lists? |
|linq| |
I have a List of Foo. Foo has a string property named Bar. I'd like to use linq to get a string[] of distinct values for Foo.Bar in List of Foo.
How can I do this? |
|.net|linq| |
For primitives (int, long etc) it is pass by value *the actual value (e.g. 3)*
For Objects you pass by value *the reference to the object*.
So if you have `doSomething(foo)` and `public void doSomething(Foo foo) { .. }` the two Foos have copied *references* that point to the same objects. |
Java passes references by value.
So you can't change the reference that gets passed in.
|
Building on what SQLMenace said, you can use a CROSS JOIN to quickly populate the table or efficiently create it in memory.
[http://www.sitepoint.com/forums/showthread.php?t=562806][1]
[1]: http://www.sitepoint.com/forums/showthread.php?t=562806 |
You'll have to handle the OnSelectedIndexChanged event of your drop down list to rebind your dataset based on the users selection. If you want the filtering to happen in an asynch postback, wrap the dataset (or datagrid I'm assuming) and your drop down in an UpdatePanel. That is one way to do it anyhow. |