In hosts file I have added following line
127.0.0.1 test
When I call Request.Url.Host in Asp.Net application still get "localhost". How do I get "test" ?
Are there any example for a recursive function that call an other one which calls the first one too ?
example
function1()
{
//do something
f2();
//do something
}
function2()
{
//do something
f1();
//do something
}
Right now I am using an extension to linq to provide me with the functionality of Contains. I call the WhereIn like this:
Answers = Answers.WhereIn(x => x.category.catid, catSTRarray);
Is there a built in function within entity framework to use?
Hi!
I'm writing a static page controller.
I get the menuname in the routes.rb and it's call the static controller show method.
match '/:menuname' = 'static#show'
And static_controller.rb:
@static=Staticpage.where("menuname =
?", params[:menuname])
But if I want print @static.title in the view, I get this error:
undefined method `title' for #
Whats wrong?
the SQL query looks good:
SELECT staticpages.* FROM staticpages WHERE (menuname = 'asd')
I call two feeds that both return an NSMutableArray, I then need to make the two arrays into one.
NSMutableArray *array1 = [JSONWrapper downloadFeed];
NSMutableArray *array2 = [JSONWrapper downloadFeed];
// something like: array1 += array2
Thanks
For instance this code:
function stuff() {
this.onlyMethod = function () {
return something;
}
}
// some error is thrown
stuff().nonExistant();
Is there a way to do something like PHP's __call as a fallback from inside the object?
function stuff() {
this.onlyMethod = function () {
return something;
}
this.__call__ = function (name, params) {
alert(name + " can't be called.");
}
}
// would then raise the alert "nonExistant can't be called".
stuff().nonExistant();
Hello I want to utilise Microsoft indexing service , but I dont like to fact they you need to manually index the files and build the catalog. Is there a way to automate this eg, call an api from code, as a scheduled task , or perhaps command line commands that will index a folder and built the catalog. This is for a searching a document repository built using asp.net
Thanks
Why is t.b evaluated on every call? And is there any way how to make it evaluate only once?
type test =
{ a: float }
member x.b =
printfn "oh no"
x.a * 2.
let t = { a = 1. }
t.b
t.b
With respect to OOP best practices, why do some people feel it's poor design if you call something a WhateverManager or WhateverController? Is this widely accepted as a best practice (to avoid this)? And what is the recommended alternative?
I've read that it's important to call setContentView() early in an activity since it builds the view objects that may be manipulated by subsequent code in onCreate().
In terms of lifecycle, does the view get drawn to screen as soon as setContentView() is called, or does it allow the onCreate() function to build/populate the information in the view objects, and wait to actually draw it after onCreate() completes?
Thanks!
I'm trying to define my own operator in Io, and I'm having a hard time. I have an object:
MyObject := Object clone do(
lst := list()
!! := method(n, lst at(n))
)
But when I call it, like this:
x := MyObject clone do(lst appendSeq(list(1, 2, 3)))
x !! 2
But I get an exception that argument 0 to at must not be nil. How can I fix?
I am using ubuntu(apache) for my php application.i need to create a timestamp for authenticated call of a webservice.In php i getting only 10 digit timestamp like 1273229733.But i need to create like 1273229613000 .How can i solve this problem.help me please.
I've been searching examples for the Win32 API C++ function TerminateProcess() but couldn't find any.
I'm not that familiar with the Win32 API in general and so I wanted to ask if someone here who is better in it than me could show me an example for,
Retrieving a process handle by its PID required to terminate it and then call TerminateProcess with it.
If you aren't familiar with C++ a C# equivalent would help too.
With takePicture, the camera captures an image (click), however I it does not call the imagePickerController:didFinishPickingMediaWithInfo: method. So how do we access the image?
I am trying to have a custom URL which looks like this:
example.com/site/yahoo.com
which would hit this script like this=
example.com/details?domain=yahoo.com
can this be done using app.yaml?
the basic idea is to call "details" with the input "yahoo.com"
If I have a textbox in my view:
<div><%= Html.TextBox("Comments", Model.Comments)%></div>
I want to post the contents of this textbox to the controller with an Ajax call. I only need this one value though, so I don't want to post the whole form back.
<%= Ajax.ActionLink("update", "UpdateComments",
new { comments = /* ????? */ },
new AjaxOptions { HttpMethod="POST" })%>
How do I get the textbox value?
Hi, I would like to write the following code in c#.
a) small console application that simulates memory leak.
b) small console application that would invoke the above application and release it right away simulating managing memory leak problem..
In other words the (b) application would continuously call and release application (a) to simulate how the "rebellious" memory leak application is being contained with out addressing the root cause which is application (a).
Some sample code for application (a) and (b) would be very helpful.
Thanks
Please let me know when a call to shmat function can raise a signal 11.
if ((shmId=shmget(shmKey, 0, 0)) <= 0) {
printf( "shmget(0x%x)", shmKey);
return 0;
}
printf( "queueOpen - Key 0x%x gives ID %d", shmKey, shmId);
qh = shmat(shmId, 0, SHM_RND);
I am getting a signal 11 by the code above. Please help
Hello,
A class A possesses an instance c of a class C. Another class B has to modify c through C::setBlah(); method.
Is it bad to create an accessor C getC(); in A and then use A.getC().setBlah() ?
Or should I create a method A::setBlah(); that would call C::setBlah(); ? Isn't it annoying if there are several methods like that ?
So I have a List collection that I fetch via a API call (which I don't have any control over).
The list is ordered.
public class Article
{
articleID,
string Url
}
So I have a Url value, using that I want to figure out the next and previous Url's if any.
What's the most elegant way of doing this?
I've some html code generated in javascript like this
cell.innerHTML = '<a href="#" class="sortheader" id="sortheader_'+i+'" '+
'onclick="ts_resortTable(this, '+i+');return false;">' +
txt+'<span class="sortarrow"></span></a>';
I'd like to call the function ts_resortTable() but independently of the onclick event how can i generate the "this" parameter of the function?
I tried the DOM selector : $('sortheader_'+i) in jQuery and the getElementById('#sortheader_'+i) as well but it's not working
Given the following method: (real method has a few more parameters, but the important ones are below...)
public string DoSomething(string formatter, params string[] values)
{
// Do something eventually involving a call to String.Format(formatter, values);
}
Is there a way to tell if my values array has enough objects in it to cover the formatter, so that I can throw an exception if there aren't (short of doing the string.Format; that isn't an option until the end due to some lambda conversions)?
My firefox downloads the JSON response of an AJAX call as a file.
It's suppose to be handled by the JavaScript i.e. JSON object.
Can anyone explain how to stop this behavior or there is something I am missing.
Thanks.
I hope this isn't oo trivial question, but when I call System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString() I'm getting back a lower case user ID, but other dev's are getting an upper case user ID. How can I force ystem.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString() to return an upper case string?