I have a date/time string like this: 180510_112440 in this format ddmmyy_hhmmss
I need a snippet for having a string formatted like this way: 2010-05-18 11:24:40
Thanks for help.
in a PHP web page i need to run this following command to create a new domain:
virtualmin create-domain --domain DOMAIN --pass PASS --plan 'Standard Package' --limits-from-plan --features-from-plan
This is usually executed in a shell but i don't know how to do it from a web page and also i need to take the domain string and pass string from a web form. Can anyone help with the PHP code as my skills are basic and i have already tried a few things that just don't work.
Thanks.
I want to catch an exception when user enter no value in a Textbox and try to process further by press a button, I know I can use "If else" statement to make it. but in terms of "Try and Catch" block, I dont know how. Here is the code sample.
Dim NameString As String
Try
NameString = OperatorNameTextBox.Text
Catch ex As ArgumentException
MessageBox.Show("Enter a String Value")
End Try
Hi,
How do I gat the the full .exe path
ManagementClass mangnmt = new ManagementClass("Win32_StartupCommand");
ManagementObjectCollection mcol = mangnmt.GetInstances();
foreach (ManagementObject strt in mcol)
{
string[] lv = new String[4];
lv[0] = strt["Caption"].ToString();
lv[1] = strt["Location"].ToString();
lv[2] = strt["Command"].ToString();
lv[3] = strt["Description"].ToString();
listView1.Items.Add(new ListViewItem(lv, 0));
}
var obj = {},ar = [],nothing=null,empty=undefined,word ='string',headorTail = true;
console.log(typeof obj) //object
console.log(typeof ar)//object
console.log(typeof nothing)//object
console.log(typeof empty)//undefined
console.log(typeof word)//string
console.log(typeof headorTail)//boolean
But how can i get the type of obj,ar,nothing as "object, array,null" - what is the best way to achieve this?
Is there a good resource to get run times for standard API functions? It's somewhat confusing when trying to optimize your program. I know Java isn't made to be particularly speedy but I can't seem to find much info on this at all.
Example Problem:
If I am looking for a certain token in a file is it faster to scan each line using string.contains(...) or to bring in say 100 or so lines putting them to a local string them performing contains on that chunk.
how to find file's path according to filename? i need to find file's path according to file name sample code:
string path= System.IO.Directory.GetDirectories(@"c:\", "kategori",System.IO.SearchOption.AllDirectories).First();
But i need :
string path= System.IO.Directory.GetDirectories(@"anyFolder", "kategori",System.IO.SearchOption.AllDirectories).First();
Basically i have binary data, i dont mind if it's unreadable but im writing it to a file which is parsed and so it's importance newline characters are taken out.
I thought i had done the right thing when i converted to string....
byte[] b = (byte[])SubKey.GetValue(v[i]);
s = System.Text.ASCIIEncoding.ASCII.GetString(b);
and then removed the newlines
String t = s.replace("\n","")
but its not working ?
What I want to do is replace the "[replace]" in input string with the corresponding vaule in the replace array. The total number of values will change but there will always be the same number in the replace array as in input string. I have tried doing this with preg_replace and preg_replace_callback but I can't get the pattern right for [replace], I also tried using vsprintf but the % in <table width="100%"> was messing it up. All help is greatly appreciated!
Replace Array:
$array = array('value 1','value 2','value 3');
Input String
$string = '
<table width="100%">
<tr>
<td>Name:</td>
<td>[replace]</td>
</tr>
<tr>
<td>Date:</td>
<td>[replace]</td>
</tr>
<tr>
<td>Info:</td>
<td>[replace]</td>
</tr>
</table>
';
Desired Result
<table width="100%">
<tr>
<td>Name:</td>
<td>value 1</td>
</tr>
<tr>
<td>Date:</td>
<td>value 2</td>
</tr>
<tr>
<td>Info:</td>
<td>value 3</td>
</tr>
</table>
I have value in 1 string for particular key.
but NSUserDefault class method doesn't work properly and it doesn't set object of a string forkey .
in short setobject forkey method is not working of NSUserDefault class.
why is it so?
Is it possible to have a static collection as a member of a hibernate entity?
Say I have an object Question:
public class Question {
private String category;
...
}
Would it be possible to populate a static Set<String> that is a distinct set of all categories in the Database? I know I could just query this, but I was wondering if there was a more elegant solution, as it seems like something that other people may have come across.
Hello there,
I am try to find out how to enforce uniqueness in fields other than the unique id.
Example:
@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class User implements IsSerializable {
@PrimaryKey
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
private Long id;
@Persistent
private String name;
@Persistent
private String email; // <= I want this to be unique as well
}
In the example above, how can I enforce uniqueness of the email value across the database?
Daniel
This was a bug I found in a server application using Valgrind.
struct Foo
{
Foo(const std::string& a)
: a_(a_)
{
}
const std::string& a_;
};
with gcc -Wall you don't get a warning.
Why is this legal code?
Hello All-
I'm having trouble with a URL string in my Web Application. It's using a UNC path similar to \\houtestmachine\common\File1.pdf My problem is when it encounters files that have a # character. I tried doing a string newstring = originalstring.Replace("#", "%23"); but the # is still there in URL (target of a hyperlink) at runtime in the browser. How can I fix this?
Hi,
when I do the following
def somefunction
@texts = A.find_all_by_someid(someid)
respond_to do |format|
format.xml { render :xml => @texts }
end
end
it gets the string from the db correctly, except if the string has leading whitespaces, it seems they are trimmed.
Note: the whitespaces are there in the db correctly
What can I do to conserve those whitespaces?
Thanks
What does this do exactly?
var counts = new Dictionary<string, int>();
for (int i = 0; i < 10; i++)
counts[string.Format("STA Thread Queue Worker Thread No. {0}", i + 1)] = 0;
Thanks
Hi,
I want to extract the status from the string untill I found a timespan. My input is something like "Something in start but not with this keyword of sure. STATUS: My Status Is Here Which can be anything but timespan 23:59:01 and so on. I want to extract the string after STATUS: untill 23:59:01 is found. How can i achieve this through regex. this 23:59:01 is a timespan and it is always in this format hh:mm:ss
Hi,
I can store string of few length in char data type.
But when it exceeds its capacity what can be the alternative way to store string.
I am using char data type.
void setString(char* inPoints)
{
if (strcmp(mPoints, inPoints)!= ZERO) {
if (mPoints) {
free(mPoints);
}
mPoints = (char*)malloc((strlen(inPoints) + 1) * sizeof(char));
strcpy(mPoints, inPoints);
}
}
I am setting an object like this
n.name = n.name.join(String.fromCharCode(255));
n.description = n.description.join(String.fromCharCode(255));
I want to be able to alert(n); but it tells me [Object]
is there a way to alert complete object?
thanks
I'm looking for a way to define and send a JSON object array. I've figured out how to define a single JSON object, turn it into a string and send it, but what about an array of this type? Probably something simple I'm overlooking...
var myColumnSetting = { "ColumnName": name,
"ColumnIndex": index
}
convert it to a string
var myJSONText = JSON.stringify(myColumnSetting, false);
J2EE has ServletRequest.getParameterValues().
On non-EE platforms, URL.getQuery() simply returns a string.
What's the normal way to properly parse the query string in a URL when not on J2EE?
I have a Dictionary<string,int> and I simply want to decrement the value in my dictionary by one.
I have this but not sure if its best practice.
foreach (KeyValuePair<string, int> i in EPCs)
{
EPCs[i.Key] = i.Value - 1;
}
I see so many solution , but none of them was matching my problem .
As i am new to iOS development .
I have a String
abc/_api/web/GetFolderByServerRelativeUrl('Documents/Root Folder/Level 1/Level 2/Level 1-1/Level 1/')/folders.
I want to remove Remove Substring after last "/"
for example my new string should look like this.
abc/_api/web/GetFolderByServerRelativeUrl('Documents/Root Folder/Level 1/Level 2/Level 1-1/Level 1/)
Can someone suggest me the best way to achieve this , thanks ,
I'm trying to have method void run( string method ) which would run method in that class. For example:
class Foo {
public:
void run( string method ) {
// this method calls method *method* from this class
}
void bar() {
printf( "Function bar\n" );
}
void foo2() {
printf( "Function foo2\n" );
}
}
Foo foo;
int main( void ) {
foo.run( "bar" );
foo.run( "foo2" );
}
this would print:
Function bar
Function foo2
Thanks! :)
I have a string of letters and I want to search it for a specific letter.
NSString *word = @"word";
How would I find out if the string contained a letter "w"?
Thanks