Given an IList<Foo> with a data set that looks like this:
ID CHILD PARENT TYPE
1 102 101 UPSELL
1 103 101 UPSELL
2 102 101 BONUS
2 104 103 BONUS
3 102 101 BONUS
4 102 101 PRODUCT
4 104 102 PRODUCT
How can I use LINQ to find the intersection of Parent and Child values withing each ID?
Desired output is
ID CHILD PARENT TYPE
4 102 101 PRODUCT
module FooHelper
def foo
haml_tag(:div) do
haml_content("bar")
end
end
end
When I test this I get:
NoMethodError: undefined method `haml_tag'
This code is perfectly valid and works in a development/production environment.
It's something to do with having the haml helpers properly loaded in the test environment.
Thanks!
In Zend Framework how can I set the title properties of option elements within a select?
Desired output:
<option value="foo" title="bar">option</option>
I am unable to get this event to fire:
$("#about").click(function()
{ //I have put alert("foo") here, won't fire
$("#about_stuff").toggle();
});
snip
<li ><a href="#a" id="about">About</a>
I've tested the toggle line in Firebug and it successfully works - I am at my wits end, I've checked it against multiple examples and it persistently refuses to work.
I'm looking to write a custom route that would allow the following
http://localhost/blog/tags/foo
Currently this is what actually works
http://localhost/tags/Index/nhibernate
I've tried the following with no success - any help would be appreciated
routes.MapRoute(
"Tags",
"{controller}/{id}",
new { Controller = "Tags", action = "Index", id = UrlParameter.Optional }
);
routes.MapRoute(
"Tags",
"blog/{controller}/{id}",
new { Controller = "Tags", action = "Index", id = "" }
);
I have a POCO (Plain Old CLR Object)
public Foo
{
public virtual int Id { get; set; }
public virtual Dictionary<string, string> Stuff { get; set; }
public virtual string More { get; set; }
}
Using the model first approach (i.e. I don't have a data model yet), how would I handle persisting Stuff (Dictionary)?
The unmanaged function(pure c++):
void fooC(float& result);
I define the wrapper as (managed wrapper, c++\cli):
void foo(float% result) //managed interface
{
fooC(???);//how to call unmanaged function?
}
how to pass reference parameter in the wrapper?
Hello
I have a loop created with each, check this example:
$('.foo').each(function(i){
//do stuff
});
Is there any possibility to run a functions when this loop has ended? Couldn't find it on docs or Google.
I can make it work without this kind of solution, but it's always good to search for and use the simpliest methods.
Martti Laine
I know the process id of an application in Mac OS X. How can I switch to it (using applescript, or python, or whatever)?
By "switch", I mean, put in focus.
The usual solution is to use the applescript code tell application "Foo" activate, but here the name is not useful because I have many instances of the same application running. I am however able to get the process id of the application.
How can I switch to this application programmatically?
I want to modify an internal webpage to strip away some of the onclick behavior of certain links.
The internal webpage has a bunch of links like:
<a href="/slm/detail/ar/3116370" onclick="rallyPorthole.showDetail('/ar/view.sp','3116370','pj/b');return false;">foo de fa fa</a>
How can I do an extension to Chrome so it does the following:
for link in all_links:
if link's href attribute matches '/slm/detail/ar/...':
remove the onclick attribute
I have some nested datastructures, each something like:
[ ('foo', [ {'a':1, 'b':2},
{'a':3.3, 'b':7} ]),
('bar', [ {'a':4, 'd':'efg', 'e':False} ]) ]
I need to compare these structures, to see if there are any differences. Short of writing a function to explicitly walk the structure, is there an existing library or method of doing this kind of recursive comparison?
Right now I cant find a way to generate a callback between lines 1 and 2 here:
f = Foo.new
f.some_call
f.save!
Is there any way to simulate what would be effectively an after_new callback? Right now I'm using after_initialize but there are potential performance problems with using that since it fires for a lot of different events.
How can I loop through all members in a JavaScript object including values that are objects.
For example, how could I loop through this (accessing the "your_name" and "your_message" for each)?
var validation_messages = {
"key_1": {
"your_name": "jimmy",
"your_msg": "hello world"
},
"key_2": {
"your_name": "billy",
"your_msg": "foo equals bar"
}
}
I am attempting to convert Java code to Jython and am using the apache Log and LogFactory imports. I am attempting to emulate Foo.class in Jython The chunk of code is as follows:
in Java
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class MyClass {
private static final Log log = LogFactory.getLog(MyClass.class);
public MyClass(Document dom)
{ //code
}
How can I emulate this same behavior of MyClass.class in Jython/Python?
I want to pass data to id
<script language="javascript" src="/foo.aspx?id=1"></script>
I have this code in a aspx page.
The data should be passed on load, before this code is being executed.
how can i do that?
If I write a C# class called Foo and that is compiled into an assembly named FooLib.dll. Then, I write a Windows Service in C# that references FooLib.dll. When I deploy my Windows Service using InstallUtil.exe:
a) do I have to explicitly tell it to reference my FooLib.dll?
b) where does FooLib.dll get deployed if I mean to deploy it as a private assembly and not in the GAC?
I want to open files using the class loader. However I always get a FileNotFoundException. How do I create a new File using the URL? I don't want to open it as a stream just as a file.
URL url = VersionUpdater.class.getResource("xslt/screen/foo");
File f = ...
I have series of files like this:
foo1.txt.gz
foo2.txt.gz
bar1.txt.gz
..etc..
and a tabular format files that describe the file
foo1 - Explain foo1
foo2 - Explain foo2
bar1 - Explain bar1
..etc..
What I want to do is to have a website with a simple search bar and allow people to type
foo1 or just foo and finally return the gzipped file(s) and the explanation of the file(s).
What's the best way to implement this.
Sorry I am totally new in this area.
Is there a way to describe the feature of a programming language that allows you to do something like the following:
$foo = return_an_array()[0];
I love this feature in python, and I hate that it's missing in PHP. Is there a name for this?
I have a Python app that contains an object structure that the user can manipulate. What I want to do is allow the user to create a file declaring how the object structure should be created.
For example, I would like the user to be able to create the following file:
foo.bar.baz = true
x.y.z = 12
and for my app to then create that object tree automatically. What's the best way to do something like this?
Just upgraded Rails to 2.3.5 to get the lovely looking rails_xss plugin but I've noticed one big issue with it. Any content_for blocks are escaped when yielded.
I've tried hacking it around by doing the either of following but they do not work:
<% @content_for_foo.html_safe! -%>
<%= yield raw :foo %>
I have some third-party Javascript that has statements like this:
FOO = function() {
...functions() ...
return { hash }
}();
It is working as designed but I'm confused by it. Can anybody define what this structure is doing? Is it just a weird way to create a class?
Is it possible to loop through a data() object?
Suppose this is my code:
$('#mydiv').data('bar','lorem');
$('#mydiv').data('foo','ipsum');
$('#mydiv').data('cam','dolores');
How do I loop through this? Can each() be used for this?