Shhow me a very simple one line example in C# to check if a given bit is set in given byte
function signature should be like
bool IsBitSet(Byte b,byte nPos)
{
return .....;
}
The Speed vs
I want to show the contents of a file given by a path at a specific state of a git repo. I unsuccessfully tried this:
git show f825334150cd4bc8f46656b2daa8fa1e92f7796d:Katana/source/Git/GitLocalBranch.h
fatal: ambiguous argument
'f825334150cd4bc8f46656b2daa8fa1e92f7796d:Katana/source/Git/GitLocalBranch.h': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions
The commit in question didn't modify the file specified. How can I show the contents of a file at a given state (specified by a commit hash) regardless of the involvement of the file in the commit?
Hi my question
Need to get the 10 word before and 10 words after for the given text . i mean need to start the 10 words before the keyword and end with 10 word after the key word.
Given text : "Twenty-three"
The main trick : content having some html tags etc .. tags need to keep that tag with this content only . need to display the words from 10before - 10after
content is bellow :
removed
Thank you
Assuming a complete binary tree, each node can be adressed with the position it appears in a given tree traversal algorithm.
For example, the node indices of a simple complete tree with height 3 would look like this:
breadth first (aka level-order):
0
/ \
1 2
/ \ / \
3 4 5 6
post-order dept first:
6
/ \
2 5
/ \ / \
0 1 3 4
The height of the tree and an index in the post-order traversal is given.
How can i calculate the breadth first index from this information?
The Python datetime.isocalendar() method returns a tuple (ISO_year, ISO_week_number, ISO_weekday) for the given datetime object. Is there a corresponding inverse function? If not, is there an easy way to compute a date given a year, week number and day of the week?
I've heard that given a programmer with enough time and skill in any particular language and enough lines of code, then any program could be created with any given language. I know its certainly not going to be cost-efficient, for instance, to rewrite Adobe Photoshop in BASIC, but could a good enough and patient enough programmer potentially create any program in any language?
I want to read all files inside a given folder(path to folder) using FindFirstFile method provide in windows API. Currently I'm only succeeded in reading files inside the given folder. I could not read files inside sub folders. Can anyone help me to do this??
I have a huge repository of files that are ordered by numbered folders. In each folder is a file which starts with a unique number then an unknown string of characters. Given the unique number how can i open or copy this file?
for example:
I have been given the number '7656875' and nothing more.
I need to interact with a file called '\server\7656800\7656875 foobar 2x4'.
how can i achieve this using PHP?
Is there any way, given a function passed as a parameter, to alter its input parameter string before evaluating it?
Here's pseudo-code for what I'm hoping to achieve:
test.func <- function(a, b) {
# here I want to alter the b expression before evaluating it:
b(..., val1=a)
}
Given the function call passed to b, I want to add in a as another parameter without needing to always specify ... in the b call. So the output from this test.func call should be:
test.func(a="a", b=paste(1, 2))
"1" "2" "a"
How can I check for a boolean to change state over a given period of time, and if a change is made over that time period perform a method?
Can any help please be given in Java.
Thanks.
For one of my opensource project, i need to compute decimal equivalent of given unicode character.
For example if tamil character "?" given, output should be 2949 .
I am using c++ in Qt environment. I googled and couldnot find a solution for this. Pls help if you know a solution for this.
I need to do something only if all the li's in a given ul are hidden.. this doesn't seem to do the trick. is there a way?
if ($('#some_ul li:hidden')) {
// do something only if all 'li's in a given ul are hidden
}
In NHibernate there is a merge function that does the following:
if there is a persistent instance with the same identifier currently associated with the session, copy the state of the given object onto the persistent instance
if there is no persistent instance currently associated with the session, try to load it from the database, or create a new persistent instance
the persistent instance is returned
Is this possible in EF? I mean this part : copy the state of the given object onto the persistent instance. And if i used ApplyCurrentValues it seemes to be as update behavior or not?
Given..
1 - The start-point GPS coordinates,
2 - The end-point GPS coordinates,
3 - The speed at which the object is travelling,
4 - Knowing that the trip trajectory will be a straight line...
How can I calculate what my GPS coordinated will be in n minutes' time? That is to say, how can I calculate my position at a given time after the trip has started before the trip has ended?
I want to read a bunch of text files, by loading them as resources using the context classloader.
URL url = Thread.currentThread()
.getContextClassloader()
.getResource("folder/foo.txt");
Is there some way to get a list of resources whose names match a given pattern? For eg:
URL[] matchingUrls = someLibrary.getMatchingResources("folder/*.txt");
Libraries like Spring can scan the classpath to find classes with a given annotation, so I am wondering if there something similar to load a bunch of resources.
Given a List<int> myValues which I know to be ordered, what is the quickest way to determine if X is in the given list?
Do I really have to write my own binary search?
Given an HFONT, how do I tell if it's a symbol font? A pdf library I'm using needs to treat symbol fonts differently, so I need a way to programatically tell if any given font is a symbol font or not.
Hi can we hide variables in a structure from outside of the given file using static keyword???
similarly can we hide a global variable from outside of the given file using static keyword?
if so please let me know how.
Thanks in advance...
Is it possible to do mass updates on a given entity in Core Data?
Given an Person entity for example, can I do something like this:
Person.update(@"set displayOrder = displayOrder + 1 where displayOrder > 5")
Or is my only option to fetch all the entities needed and then loop through and update them individually???
Thanks
if we supposed that "A.B." is a value for an xml element called given-names
the following code converts this value to "A.tempspacetempspaceB." instead of "A. B."
foreach (XElement initial in doc.XPathSelectElements("//given-names"))
{
string v = initial.Value.Replace(".", ". ").TrimEnd(' ');
initial.SetValue(v);
}
So why tempspace comes here instead of literal space??
thank you for any help.
So given a static type in your code you can do
var defaultMyTypeVal = default(MyType);
How would you do the same thing given a variable of Type so you can use it during runtime?
In other words how do I implement the following method without a bunch of if statements or using Generics (because I will not know the type I'm passing into the method at compile time)?
public object GetDefaultValueForType(Type type) {
....
}
I have an Employee table, it's a self-referencing table, with managerId refers to primary key empID. I want to find 2 level records by a given empId. For example: if given empId=5,
if empId=5 has children records, display them, as well as the children in children records.
You may also provide a recursive suggestion without level limitation. The database is SQL Server 2005.
Hi all,
I came cross a question in my interview.
Question:
Array of integers will be given as the input and you should find out the middle element when sorted , but without sorting.
For Example.
Input: 1,3,5,4,2
Output: 3
When you sort the given input array, it will be 1,2,3,4,5 where middle element is 3.
You should find this in one pass without sorting.
Any solutions for this?
suppose we have simple polygon(without holes) with vertices
(v0,v1,....vn)
my aim is to determine if for given point p(x,y) any line segment connecting this point and any vertices of polygon is inside polygon or even for given two point
p(x0,y0) `p(x1,y1)`
line segment connecting these two point is inside polygon?
i have searched many sites about this ,but i am still confused,generally i think we have to compare coordinates of vertices and by determing coordinates of which point is less or greater to another point's coordinates,we could determine location of any line segment,but i am not sure how correct is this,please help me
write a scheme function that remove the first top level occurrence of a given item
from a list of items.
eg given list (a b c) item b, result list (a c)
plz help me