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
Say I have a text area, user enters information exactly like styled below:
Ice cream
Chocolate
then submits this information, I want to retrieve the information EXACTLY like so:
Ice cream, Chocolate
Is this the best way to do it:
$arr = explode("\n", $var);
$arr = implode(",", $arr);
When doing it like this, it puts the information out like so:
Ice cream , Chocolate
Note the space after cream, will a simple trim() fix this?
configparser raises an exception if one parses a simple .properties (key/value) file wich lacks section headers; other than rolling out code myself, is there some module that allows me to do this?
Is there a good way to remove HTML from a Java string? A simple regex like
replaceAll("\\<.*?>","")
will work, but things like
&
wont be converted correctly and non-HTML between the two angle brackets will be removed (ie the .*? in the regex will disappear).
Hi,
Does anyone know good and simple to use in production code R-tree (actually, any implementations - R*, R+ or PR-tree would be great)?
It doesn't matter if it is a template or library implementation, but some implementations that google found look very disappointing...
Thanks in advance.
I'm trying to implement a simple notebook in Qt. Microsoft OneNote allows text or an image from a website to be inserted by Drag&Drop with an attached link to the source that looks like this for the stackoverflow logo on the 'ask' page: Inserted from
<http://stackoverflow.com/questions/ask. With the QT dropsite example, I examined all the information thats transported by the QMimeData object, but didn't find something really helpful.
Do you know a way to do this in pure Qt or at least with not so much platform-dependant code?
When I try to inspect DataSet by standard DataSet visualizer I see this error "could not load this custom viewer".
I wrote simple dataset visualizer, but error throws anyway too.
On other computers with the same configuration visualizer show without any errors.
OS: Windows 7 x86 (Release)
VS: Visual Studio 2010 RC
has somebody any ideas?
I reinstall VS with no effect.
I am trying to set the default value for a new column I just added. In properties I am trying to set 'Default Value or Binding' to a simple XML along the lines of: <root><title>Welcome</title><body>Thank you for your time.</body></root>
However, when I click away, I get "sql error validating the default for column," I set this value in other numerical columns and it worked fine. What gives?
Hi, I am a C++ / Java programmer and the main paradigm I happen to use in everyday programming is OOP. In some thread I read a comment that Type classes are more intuitive in nature than OOP. Can someone explain the concept of type classes in simple words so that an OOP guy like me can understand it?
I'm trying to create a very simple relationship between two objects. Can anybody explain me why I can't find the Company object via findBy method?
class Company {
String name
String desc
City city
static constraints = {
city(unique: true)
}
}
class City {
String name
static constraints = {
}
}
class BootStrap {
def init = { servletContext ->
new City(name: 'Tokyo').save()
new City(name: 'New York').save()
new Company(name: 'company', city: City.findByName('New York')).save()
def c = Company.findByName('company') // Why c=null????!
}
def destroy = {
}
}
Hi:
I'm sure this question is fairly simple to answer... is there any way to make variables and helpers available application-wide on the iPhone, without using the Application delegate?
Thanks!
Seems simple but users have no internet access.
The application will be hosted internally on as Intranet site. The application will be able to make webservice calls to the internet.
I tested and tried Mapquest.
However all the other providers seems to assume the users are able to access the internet so their API's are javascript based with src tags pointing to internet URL's
Any ideas?
Hi,
My question is simple: is there a way to animate the maximize of ExtJS windows? Currently my windows just maximize without any animation and it looks "boring".
How can I view the change history of an individual file, complete with what has changed ?
I have got as far as : git log -- filename
which shows me the commit history of the file, but how do I get at the content of each of the changes ?
Thanks - I'm trying to make the transition from MS SourceSafe and that used to be a simple right click / show history.
In Eclipse (and Flash/Flex Builder) you get the option with Ctrl+Shift+F to do a file search and look for a regular expression. Would be a real handy thing to know.
I want to find the word negate if it appears in a Flex/java comment like the following:
// It was negated because
or
/*
The negate option was....
*/
or
/**
* We have to negate the value
*/
Any ideas? Will test them out at http://www.regexplanet.com/simple/index.html
Hi, this is probably the really newbie question (well, I'm pretty sure it is), but I have a float that's being returned and I need a quick and efficient way of turning it into an int.
Pretty simple, but I have an exception. If the remainder of the float is anything other than .0 then I want to increment the int.
Some quick examples:
Float = 98.0, Int = 98
Float = 98.1, Int = 99
Float = 6.6, Int = 7
etc.
Thanks for any help!
How can I change a title from tab child?
I tried a simple setTitle(...) but it won't work.
(from the parent tab activity, it does, however...)
thanks,
Ori
Here is a scenario in my mind and I have googled, Binged it a lot but got the answer like
"Abstract class has not implemented method so, we cant create the object"
"The word 'Abstract' instruct the clr that not to create object of the class"
But in a simple class where we have all virtual method, able to create an object???
Also, we can define different access modified to Abstract class constructor like private, protected or public.
My search terminated to this question ;
Why we can't create object of an Abstract class?
Say I have a simple object such as
class Something
{
public int SomeInt { get; set; }
}
I have read that using immutable objects are faster and a better means of using business objects? If this is so, should i strive to make all my objects as such:
class ImmutableSomething
{
public int SomeInt { get { return m_someInt; } }
private int m_someInt = 0;
public void ChangeSomeInt(int newValue)
{
m_someInt = newvalue;
}
}
What do you reckon?
Hello
i have gui the i created in the designer , simple one .
QMainWIndow that contains stackedWidget , the application starts with
stackedWidget index 0 that contains qwebkit widget and after some user flow ,it changes to stackedWidget
index 1 that contains QTree widget , to center the first widget i use in the QMainWindow constractor this line of code
this-setCentralWidget(ui.webView); but when the application switching to index number 1 im getting exception that is
coming from the switching command .
why ?
Hi,
I have a template document with a simple macro to insert a file into a document. When i try to load this template file using Application.Addins.Add i am getting an error saying 'Word cannot open this document template'.
wordApplication.AddIns.Add( %template file path%, ref trueObj );
This works fine on some machines.
Also is there any way to make sure that we load the template file as a global Template always.
Hello,
are there free, recommendable Tools for data modeling?
ERM/ORM Diagrams
Creating database models (SQL SERVER
2005)
Simple to use like Visio(no license
here)
Code generation is only a nice to
have (VB.Net)
I know its been asked many times already but no one could come up with solution so far.
The idea is to have one form separated into few steps and validate each step on next click of the button. I know jquery validation plugin is offering quite complicated way of doing it with accordion but can anyone come up with a simple solution something like
var stepOne = {
rules: {
fieldname1: "required",
fieldname2: "required",
}
}
$("form").validate(stepOne); //onclick
hope someone could suggest the best way of doing it.
Thanks.
Is it real and how can I think about it.
To make so the user will select only the month and year, not date, because he need a period on full month, not some date.
here is simple control ...
<asp:TextBox ID="TextBox3" runat="server" />
<asp:CalendarExtender ID="TextBox3_CalendarExtender" runat="server"
Enabled="True" TargetControlID="TextBox3" />