Create a task with an < T & gt;

I somehow feel I am missing something basic. Here's my problem. I am trying to create a System.Threading.Tasks.Task instance to execute an action that accepts a parameter of a certain type. I thought I could do something like void DoWork(MyClass obj)

Unix: pre-dispatch a file without a fictitious file?

I do not want: $ cat file > dummy; $ cat header dummy > file I want similar to the command below but to the beginning, not to the end: $ cat header >> file You can't append to the beginning of a file without rewriting the file. The first way y

Is Ul # Content not identical to #Content ul?

I'm debugging my css code as my ul are not coming out with indents and bullets as expected. I've got a lot of UL's in my css but I've written them in various ways. I've tried to make them uniform, i.e. ul after the div name, but they behave different

Add dynamically to the array in PHP?

I am trying to take input from a form, add it to an array, and print_r that array to the screen. My problem is that the input from the form only replaces the first (and only) element in the array. <form action="" method="POST"> &

Detect whether a form has been submitted with PHP

I'm looking for a clean way to handle forms with PHP that does validation and caching of data, but doesn't require mixing PHP with the form HTML. Basically, I want to be able to write a form in pure HTML and intercept that form on it's way to it's de

Built-in sum function in python

def sum_elements(l): sum = 0 string = "" k = 0 for i in l: if type(i) is int: sum = sum + l[k] k += 1 elif type(i)is str: string = string + str(l[k]) k += 1 print "sum of integers in list" + str(sum) print "sum of strings in list&

How to prove a bug in this code via unit test

we have a habit in our company that when a bug is reported we do following steps: Write a unit test that fails clearly showing the bug exists Fix the bug Re-run the test to prove the bug has been fixed Commit the fix and the test to avoid regressions

Okta how to pass groups in assertion SAML

Trying to integrate our organisation's web app with Okta's SSO. Everything works smoothly except that I can't find a way to pass the native Okta groups which the user is part of in the assertion SAML (there's no such option in the 'Edit SAML Integrat

Changing the password when adding a new user

CakePHP 2.4 While adding a new user I must hash passwords before storing it in the Database. To do so I did: //UsersController public $helpers = array('Html', 'Form'); public $components = array( 'Session', 'Auth' => array( 'loginRedirect' => array(

Make Global Image for all classes in xcode

So I have created a jpeg file using the Facebook graph url with a user id in ViewControllerA. This image is saved as profilePicture. My question is how do I make this image (UIImage) global? In other words, I just want to make this image available to

Entity Framework Does Not Save Modified Children

Frustrating, this. Here's a pair of related objects, as generated by database-first Entity Framework: public partial class DevelopmentType { public DevelopmentType() { this.DefaultCharges = new HashSet<DefaultCharge>(); } public System.Guid RowId {

How to keep the VBScript command window open during runtime

When I execute a VBScript, the command window that it creates closes quickly before the user gets a chance to read the output. How can I get the window to stay open without modifying windows registry? This is the code: Set objShell = WScript.CreateOb

Return value to finally block to Scala

Possible Duplicate: "return" and "try-catch-finally" block evaluation in scala There are two Scala functions: a): def foo(): Int = try { 1 } finally { 2 } b): def bar(): Int = try { return 1 } finally { return 2} I cannot figure out wh

Find a string between two known strings

I have a String with this content: href="" /> [...] [...] I just want to get the central part of the string. How is it possible to get the part between @"href="" and @"" />" Note: Even i

How to get the first word of the sentence in Swift

I am trying to get first word from String sentence as variable. How to do that? I have Local notification and I need to use it's message first word as variable, is it possible? For LocalNotifications I use LocalNotificationHelper library for easier h

Why do some floating elements decide to release both?

First off, this example will only work in a browser that supports :nth-child, like Chrome or FireFox. I have an unordered list where the odd numbered list items are floated left and clear left, and the even numbered list items float right and clear r

CodeIgniter and normal website

I have a web hosting which hold a website I run. I'm learning CodeIgniter so I would like to upload it a file in that web hosting and run some test and learn, CodeIgniter just for test, and keep using the website normally for users. Is there any rela

How to print on the same line in python without using,

Currently, I have the following code in a script: print "Loading... " html = urllib2.urlopen(url).read() print "Done" That works great, it displays loading, pauses while the download completes, and then displays done. The only problem

How to avoid N + 1 in queries generated by EF

I used to generate all the helper tables like UsergroupUsers for many-to-many relations or relational Ids in POCO myself but now I want EF to take care of them. Now I don't think it's such a good idea after all. Problem When I try to get all Usergrou

Users disconnecting from my MVC3 application hosted on WinHost

I'm running ASP and MVC3 on and I am constantly getting logged out using Windows Forms authentication. I will go from one to two pages and it will work but when I go to our create character page it is logging you out. Sometimes it will do

Correction of odd and even selector

i have this css rule, .messagesContent:nth-child(even){ float: right; background: white; } .messagesContent:nth-child(odd){ float: left; background: #ccc; } i use jquery to add an element before all elements , with this var c = $("#content_2").f

Magento: remove the footer from the package

I need to figure out how to remove a footer from the wrapper and add it on the end of page. I would like to use a footer that has 100% of width of the browser resolution, which is impossible while it's wrapped. I guess I need to change page.xml in my