Hey, I'm just wondering how to convert a numerical date into text format in PHP
Example change
06.04.2010 to say April 6th 2010
Is there any function already made?
Suppose I want to use the ASCII special character FS(0x1C) in a .Net string, and then be able to format a byte array from that same string with the special character properly represented as a single byte, how would I do that? I can't seem to get my head around it.
Thanks for any help you can give.
How to create a new data type which to can check/validate its schema when is created a new variable (of that type)?
By example, to validate if a string has 20 characters, I tried:
{{{
// Format: 2006-01-12T06:06:06Z
func date(str string) {
if len(str) != 20 {
fmt.Println("error")
}
}
var Date = date()
type Account struct {
domain string
username string
created Date
}
}}}
but it faills because Date is not a type.
i have date in dd/mm/yyyy format. how can i store it in databse, if i fant to do some operations on them after?
for example i must find out the rows, where date > something
what type i must set to date field?
thanks
{"paging": {"pageNum":2,"action":"Next","type":"","availableCacheName":"getAllFunds","selectedCacheName":"","showFrom":101,"showTo":200,"totalRec":289,"pageSize":100},
"Data":[{"sourceCodeId":0,"radio_fund":"individua
l","availableFunds":[],"fundId":288,"searchName":[],"fundName":"Asian Equity Fund A Class Income","srcFundGrpId":"PGI","firstElement":0,"las
tElement":0,"totalElements":0,"pageList":[],"standardExtract":true}]
I have json file with above format with two fileds,one paging and one is Data array.
I able to retrieve values of paging,but i am not able to retrieve the values of data array with .each function of jquery.
Any suggestions or inputs really appreciated.
Sorry for the long question, but I think this is an interesting situation and I couldn't find any explanations for it:
I was involved in optimization of an application that performed a large number of sequential SELECT and INSERT statements on a single dedicated SQL Server database.
The process needs to INSERT a large number of records into a table, but for each of them there should be some value mappings, which performed using SELECT statements on another table in the same database. For a specific execution, it took 90 minutes to run.
I used a profiler (JProfiler - the application is Java-based) to determine how much time does each part of the application take. It yields that 60% of the time was spent on INSERT method calls, and almost 20% on SELECT calls (the rest distributed in other parts).
After some trials, I came to this situation: I commented out the INSERT query that took 60% of the time. I was expecting for the total run time to be around 35 minutes, as I have removed 60% of the 90 minutes. But the whole process took the same 90 minutes (doing only SELECTs and nothing else), but each SELECT took longer this time!
Everything was running sync, there were no async calls. And there was only one single thread of execution. SELECT and INSERT queries are very simple, and don't have anything special, and they are on different tables, but on the same DB.
I tested with both the DB on the application machine, and on a remote network machine.
I can't think of any explanation for this, as the Profiler (Application profiler, not SQL Profiler) reported the changes in the method call times, and by removing INSERT statements SELECT statements took longer to run.
Can anyone give me some kind of explanation of what could have happened?
(there can't be cache / query optimization stuff, because the queries were run in sync, and in a single thread, and it was far from affecting the cache this much)
I should note that the bottleneck of the speed was in SQL server, using most of the CPU time.
I am currently exporting Drupal data to an external source (XML) programmatically. However, I want the data to run through the site's default Input Format (the filter that runs before user content is displayed on the website) before being written to file.
How do I programmatically apply a Drupal input filter? Is there a specific function call or hook for this purpose? If so, links/advice would be most appreciated.
Do you know any easy way to find a logging call that throws "not enough argumenst for format string".
On my workstation I've modified logging/__init__.py to print the msg so I can easily find the line in the source.
But do you have any idea what to do on the testing environment where you can't change python standard library nor run pdb easily?
Hi-- I have a UK date in the format "06/Apr/2010 13:24" that I need to insert into a mysql db date field.
The PHP strtotime function can't handle this string-- has anyone got any ideas other than writing a custom function?
Thanks!
I want to have some way of backing up the user defaults to a property list or XML, or some other appropriate file format that can be transfered over the net. How could I get a backup of these so that I can send them to a webserver and retrieve them back to the device and read them in to the user defaults database?
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
here is my code
function check($dt) {
$date = date("Y-m-d");
$start = new DateTime($date);
$end = new DateTime($dt);
$diff = $start->diff( $end );
return $diff->format( '%d days' );
}
print check('2009-12-14');
that prints 29 days
where am i wrong ?
I remember seeing a while ago that there is some method in maybe the Reflection namespace that would recursively run ToString() on all of an object's properties and format it nicely for display.
Yes, I know everything I could want will be accessible through the debugger, but I'm wondering if anyone knows that command?
i have to convert a video to images i need some help to under stand this phenomenon and guid to code a program for it.
also
which format of video will be more useful for me ?
thanx in advance!
Hi
I'm a beginner programmer, pretty new 2 it
Basically is there any alternatives to the print statement for output in Python, and how can I format my output text to be color-coded?
Thanks
searching for a function, which converts rhs to the type of lhs.
e.g.
var x=false // x is boolean now;
x=assign (x, "true"); //should convert "true" to boolean and return that
x=assign (x, 1); // dto, convert 1 to true
x=0 // x is number
x=assign (x, "123"); // should convert "123" to 123;
so such a function can be written, thats not the question. But: Is there somewhere a somehow complete implementation of such a thing? I started with something like that:
function assign (v, x) {
if (typeof v==typeof x) {
return x;
}
switch (typeof v) {
case 'boolean' : {
return x=='true'?true:false;
}
case 'number' : {
return parseFloat(x);
}
}
return "xxx";
}
var v=true;
var x='true';
var r1=assign (v, x);
console.log (typeof r1+ " "+r1);
v=10;
x="123";
var r1=assign (v, x);
console.log (typeof r1+ " "+r1);
which of course is not complete, but maybe shows what I'm goig for.
Quick and simple question.
There are examples online about achieving in-memory gzip compression with zlib (C++) WITHOUT external libraries (like boost or such)?
I just need to compress and decompress a block of data without much options. (it must be gzip as its the same format used by another mine C# program (the data is to be shared))
Tried to search to no avail...
Thanks!
I have a field varchar(14) = 20090226115644
I need convert it to - 2009-02-26 11:56:44 (datetime format)
My idea. use cast and convert.. but I always have errors.
Conversion failed when converting
datetime from character string.
I made this, but don`t like it..
SELECT
SUBSTRING(move,1,4) + '-' + SUBSTRING(move,5,2) + '-' + SUBSTRING(move,7,2) + ' ' + SUBSTRING(move,9,2) + ':' + SUBSTRING(move,11,2) + ':'+SUBSTRING(move,13,2) as new --
FROM [Test].[dbo].[container_events]
where move IS not null
Result :2009-02-26 11:56:44
How to register a new MIME type in android? I am very much new to android. I need to download a *.ics file from the browser (Email attachment).but the browser response is unsupported file format.Can anyone help me ???
Hi All,
Please somebody help me.
I want to compress a folder (which contains images & text files as well as few sub folders) in zip,rar,tar format & then give it for download to user.
Is there any class/api/library/code to do so.
I am working on Joomla CMS.
Regards,
Shahu.
Assume that I have a text file separated by colons. I understand how to display the entire text file or any specific column using awk. However, what I want to do is to get the awk output and then display it by adding my own text using a shell script? For example, assume that my text file is:
England:London:GMT
USA:Washington:EST
France:Paris:GMT
What I want to do is to display this input into the below format:
COUNTRY: England
CAPITOL: London
TIMEZONE: GMT
COUNTRY: USA
CAPITOL: Washington
TIMEZONE: EST
COUNTRY: France
CAPITOL: Paris
TIMEZONE: GMT
I have to get the sum of a list of doubles. If the sum is 100, I have to decrement from the highest number until it's = 100. If the sum is < 100, I have to increment the lowest number until it's = 100. I can do this by looping though the list, assigning the values to placeholder variables and testing which is higher or lower but I'm wondering if any gurus out there could suggest a super cool & efficient way to do this? The code below basically outlines what I'm trying to achieve:
var splitValues = new List<double?>();
splitValues.Add(Math.Round(assetSplit.EquityTypeSplit() ?? 0));
splitValues.Add(Math.Round(assetSplit.PropertyTypeSplit() ?? 0));
splitValues.Add(Math.Round(assetSplit.FixedInterestTypeSplit() ?? 0));
splitValues.Add(Math.Round(assetSplit.CashTypeSplit() ?? 0));
var listSum = splitValues.Sum(split => split.Value);
if (listSum != 100)
{
if (listSum > 100)
{
// how to get highest value and decrement by 1 until listSum == 100
// then reassign back into the splitValues list?
var highest = // ??
}
else
{
// how to get lowest where value is > 0, and increment by 1 until listSum == 100
// then reassign back into the splitValues list?
var lowest = // ??
}
}
update: the list has to remain in the same order as the items are added.