p****1 发帖数: 275 | 1 有兴趣做不? 我琢磨着, 出题的人是在寻找最优解 :)
Given the table [tSWIFT_History_Trades] , the C# structure TradeNAK and the
C# method UpdateTradeACKNAKDB as defined below:
CREATE TABLE [tSWIFT_History_Trades](
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[BatchId] [varchar](25) NOT NULL,
[TradeId] [varchar](25) NOT NULL,
[Account] [varchar](25) NULL,
[TranType] [varchar](50) NULL,
[TradeDate] [int] NULL,
[SettleDate] [int] NULL,
[Exch] [varchar... 阅读全帖 |
|
p****1 发帖数: 275 | 2 Question:
Given the table [tSWIFT_History_Trades] , the C# structure TradeNAK and the
C# method UpdateTradeACKNAKDB as defined below:
CREATE TABLE [tSWIFT_History_Trades](
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[BatchId] [varchar](25) NOT NULL,
[TradeId] [varchar](25) NOT NULL,
[Account] [varchar](25) NULL,
[TranType] [varchar](50) NULL,
[TradeDate] [int] NULL,
[SettleDate] [int] NULL,
[Exch] [varchar](50) NULL,
[D... 阅读全帖 |
|
j***i 发帖数: 1278 | 3 I copy the following code from the book and complied in gcc
struct ci_char_traits : public char_traits
// here it have errors
//
//
// error: expected template-name before ‘<’ token
// error: expected `{' before ‘<’ token
// error: expected unqualified-id before ‘<’ token
{
static bool eq( char c1, char c2 )
{ return toupper(c1) == toupper(c2); }
static bool lt( char c1, char c2 )
{ return toupper(c1) < toupper(c2); }
static int compare( const char* s1,
|
|
p****1 发帖数: 275 | 4 【 以下文字转载自 JobHunting 讨论区 】
发信人: peace1 (peace1), 信区: JobHunting
标 题: C#, recruiter发过来的面试题
发信站: BBS 未名空间站 (Thu Sep 8 22:17:38 2016, 美东)
有兴趣做不? 我琢磨着, 出题的人是在寻找最优解 :)
Given the table [tSWIFT_History_Trades] , the C# structure TradeNAK and the
C# method UpdateTradeACKNAKDB as defined below:
CREATE TABLE [tSWIFT_History_Trades](
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[BatchId] [varchar](25) NOT NULL,
[TradeId] [varchar](25) NOT NULL,
[Account] [varchar](25) ... 阅读全帖 |
|
p****1 发帖数: 275 | 5 【 以下文字转载自 JobHunting 讨论区 】
发信人: peace1 (peace1), 信区: JobHunting
标 题: C#, recruiter发过来的面试题
发信站: BBS 未名空间站 (Thu Sep 8 22:17:38 2016, 美东)
有兴趣做不? 我琢磨着, 出题的人是在寻找最优解 :)
Given the table [tSWIFT_History_Trades] , the C# structure TradeNAK and the
C# method UpdateTradeACKNAKDB as defined below:
CREATE TABLE [tSWIFT_History_Trades](
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[BatchId] [varchar](25) NOT NULL,
[TradeId] [varchar](25) NOT NULL,
[Account] [varchar](25) ... 阅读全帖 |
|
w******1 发帖数: 520 | 6 电面一轮,先扯淡,再问了一个技术问题,题目是那个excel的index转换,index ->
数字,coding完,问测试。
google answerhttp://www.cnblogs.com/bestcomy/archive/2009/02/04/1383521.html
转换Excel列名,例如A列序号为0,Z列序号为25,ZB列则为27
发现字母列名实际为26进制,于是写了如下Helper Class来解决我的问题
public static int ToIndex(string columnName)
9 {
10 if (!Regex.IsMatch(columnName.ToUpper(), @"[A-Z]+"))
11 throw new Exception("invalid parameter");
12 int index = 0;
13 char[] chars = columnName.ToUpper( |
|
S**I 发帖数: 15689 | 7 try the following:
char *s1 = "firststring";
char *s2 = "secondstring";
char *t1 = ToUpper(s1);
char *t2 = ToUpper(s2);
printf("%s\n", t1);
printf("%s\n", t2); |
|
S*******C 发帖数: 822 | 8 给我toUpper函数,让实现toLower函数。基本上就是事先通过toupper得到所有小转大
的pair,然后存哈希。 |
|
d******o 发帖数: 2489 | 9 or
public string Read(string KeyName)
{
// Opening the registry key
RegistryKey rk = baseRegistryKey ;
// Open a subKey as read-only
RegistryKey sk1 = rk.OpenSubKey(subKey);
// If the RegistrySubKey doesn't exist -> (null)
if ( sk1 == null )
{
return null;
}
else
{
try
{
// If the RegistryKey exists I get its value
// or null is returned.
return (string)sk1.GetValue(KeyName.ToUpper());
}
/... 阅读全帖 |
|
y****e 发帖数: 23939 | 10 直接用STL的equal呢?
inline bool eq_nocase(char c1, char c2) {
return toupper(c1) == toupper(c2);
}
const int N = strlen(str1);
equal(str1, str1+N, str2, eq_nocase); |
|
x***y 发帖数: 633 | 11 #include
toupper() or tolower() |
|
a******r 发帖数: 9 | 12 就是想转换helloWorlD这个字符串全部为大写,并打印。可是以下程序,打印出来的字
符串次数不对。新手上路,不知道怎么改比较好,求指点,多谢
#include
#include
#include
#include
using namespace std;
int main()
{
string str("helloWorlD");
vector svec;
for (string::size_type i=0; i
{
svec.push_back(str);
}
for (vector :: size_type ix=0; ix
{
for (string::size_type index=0; index
{
... 阅读全帖 |
|
s*w 发帖数: 729 | 13 没看懂你怎么弄了个双重循环,单循环不就够了?
for (int i=0;i
str[i] = toupper(str[i]); |
|
a********r 发帖数: 218 | 14 哪位大侠能帮我看看下面的code 哪些地方错了?多谢了!为方便,我写了行号
TCHAR* ToUpper(TCHAR *input) { // 1
static TCHAR buffer[1000]; // 2
TCHAR *p = input; // 3
TCHAR *q = buffer; // 4
// 5
while (*p != '\0') { // 6
*q = *p + 'A' - 'a'; // 7
p++; // 8
q++; // 9
} // 10
return buffer; ... 阅读全帖 |
|
f*******t 发帖数: 7549 | 15 使用静态buffer虽然不安全,但不能说就是错的,主要看运行的结果如何使用。像前面
那个程序如果先printf string1再处理并printf string2,就不会有问题。
如果返回的字符串不是立即使用,有两种办法:动态分配空间,和直接修改原字符串。
动态分配空间最大的坏处在于,使用完之后需要手动释放,一旦忘记就会造成内存泄露
。所以建议在调用ToUpper()前分配好空间,将指针传入函数由它修改。
另外用分配在栈上的空间作为buffer,返回一个指针,很可能等不到使用这段内存就被
释放了,程序出现内存错误。
还有就是楼主的代码没有检查数组越界的问题,如果传入的字符串长度超过了1000就会
出问题。 |
|
f*******t 发帖数: 7549 | 16 最后提个意见,如果不打算在原字符串上作修改,函数参数前最好加个const,变成:
TCHAR* ToUpper(const TCHAR *input);
这是个编程的好习惯。 |
|
w****f 发帖数: 684 | 17 Looking glassdoor's microsoft questions, do not figure out the answers
for below questions.
Did some one know the answers?
Queue with circular array
What are skip lists?
using a mac function toLower(char c) to write a toUpper(char c) function
, without using any ascii code
What is a singleton? |
|
w****f 发帖数: 684 | 18 Yes, but I am catching up...
I figured out skip list and singleton.
* Queue with circular array?
*using a mac function toLower(char c) to write a toUpper(char c)
function, without using any ascii code? |
|
x*******6 发帖数: 262 | 19 char toUpper(char c){
int i = 'a'-'A';
if(Character.isLetter(c)){
if(c-toLower(c)==0)
return (char)(c+i);
else
return c;
}else
throw new IllegalArgumentException();
}
circular array做queue是指queue的rear可以在front之前,两者和maxSize,size有公
式,自己去推导下。
|
|
l*****a 发帖数: 14598 | 20 3/4很清楚了吧?
3
use
char toLower(char c)
to implement
char toUpper(char c)
4 估计先写了个sudoku solver然后被要求优化 |
|
w********2 发帖数: 111 | 21
3的话,如果不能用大小写的已知条件,不太清楚如何能够写出toUpper。求解 |
|
b******n 发帖数: 851 | 22 我估计就是
1) 用toUpper(string s), so that u get a hashMap
whose key is the Uppercase letter, and the value is the lower case letter (
kinda like an inverted index...)
2) and use the hashmap to implement toLower |
|
l*********u 发帖数: 19053 | 23 本懒蛋记ascii table方法 :)
A=65,a=97
so, toLower(x)=toUpper(x)+(97-65) ? :) |
|
p****1 发帖数: 275 | 24 My answer:
Problems with the above codes:
1. We do not have to have the sql string everywhere, it can be simplified to
be put in just 1 place.
2. This code is not using parameters properly thus allowing for SQL
injection attacks.
My below solution would solve the above 2 problems. In my industry
experience, I did not have experience to put SQL parameters into dba.
ExecuteSQL, so, I convert to SqlCommand.
public int UpdateTradeACKNAKDB(List _lANT, string
strFileNameReceived, string strD... 阅读全帖 |
|
c*********c 发帖数: 113 | 25 VS2010, 做的一个windows application
需要实现的一个功能是,把一个已经拿到的dataTable, 以PDF的形式保存到本地,用
的iTextSharp
一开始说我column的number不对,然后各种在网上找,然后改的面目全非以后又出现了
如题所示的错误。。。改疯了,求高手指点。。。
以下为代码:
public string ExportToPDF(DataTable dt, ReportEnums reportType, DateTime
fromDate, DateTime toDate)
{
//这句没关系
string pdfName = utls.GetFileNameandPath(reportType);
Document document = new Document();
MemoryStream inputPDF = new MemoryStream();
M... 阅读全帖 |
|
c*********c 发帖数: 113 | 26 VS2010, 做的一个windows application
需要实现的一个功能是,把一个已经拿到的dataTable, 以PDF的形式保存到本地,用
的iTextSharp
一开始说我column的number不对,然后各种在网上找,然后改的面目全非以后又出现了
如题所示的错误。。。改疯了,求高手指点。。。
以下为代码:
public string ExportToPDF(DataTable dt, ReportEnums reportType, DateTime
fromDate, DateTime toDate)
{
//这句没关系
string pdfName = utls.GetFileNameandPath(reportType);
Document document = new Document();
MemoryStream inputPDF = new MemoryStream();
M... 阅读全帖 |
|
w*********r 发帖数: 18 | 27 int strcmpi (const char* csz1, const char* csz2)
{
int retval=0;
char *p1=NULL, *p2=NULL;
if((csz1 !=NULL) && (csz2 !=NULL))
{ int len1=0, len2=0;
len1=strlen(csz1);
len2=strlen(csz2);
if (len1>0) {
p1= new char [len1+1];
memset(p1,0,len1+1);
strcpy(p1, csz1);
for (int i=0;i
p1[i]=toupper (p1[i]);
}
}
|
|
d***k 发帖数: 763 | 28 问一个简单问题,在MSDN上看到这样的程序
inline char toupper( char a ) {
return ((a >= 'a' && a <= 'z') ? a-('a'-'A') : a );
}
为什么不用
a+('A'-'a') : a
有什么讲究?还是都可以? |
|
p*****e 发帖数: 53 | 29 实在看不出哪里不对,只能来这里求助高手帮忙看看了
非常感谢!!!
1.
int IsSecretPassword(char *ptrstring)
{
char temp[1024];
if(ptrstring)
{
strcpy(temp, ptrstring);
for (int i =0; i
{
temp[i] = toupper(temp[i]);
}
if (strcmp(temp, "TEST")==0)
return 1;
else
return 0;
}
return 0;
}
2.
int* MakeArray(int nsize)
{
int *ptr = 0;
if(nsize <=0)
return NULL;
ptr = (int*)malloc(sizeof(int... 阅读全帖 |
|
c***r 发帖数: 4631 | 30 俺系业余爱好的,上来玩玩。
1,
int IsSecretPassword(char *ptrstring)
{
if( null == ptrstring ) return 0;
int n = strlen(ptrstring);
if( n > 0)
{
char * temp = malloc(n+1);
int r;
strcpy(temp, ptrstring);
for (int i =0; i
{
temp[i] = toupper(temp[i]);
}
if (strcmp(temp, "TEST")==0)
{
r=1;
}
else
{
r = 0;
}
free(temp);
return r;
}
return 0;
}
2,
int* MakeArray(u... 阅读全帖 |
|
d**********1 发帖数: 569 | 31 BasisComponentDict =
(from a in BasisComponentValues
where CheckMonth(a.StartMonth, a.Month, a.EndMonth)
group a by a.Key into g
select new { Key = g.Key, Sum = g.Sum(o => o.Value) })
.ToDictionary(gdc => gdc.Key.ToUpper(), gdc => gdc.Sum);
这个是工作里面做字典的一个例子,挺好用的。 |
|
l*******e 发帖数: 309 | 32 import Data.Char
import Control.Applicative
main = interact $ same_case <*> (unwords . map reverse' . words)
where reverse' word = if isPunctuation (last word)
then reverse (init word) ++ [last word]
else reverse word
same_case = zipWith (\x y -> if isUpper x then toUpper y else
toLower y) |
|
b***e 发帖数: 1419 | 33 import Data.Char
explode s = snd $ foldr (x -> (w, l) -> if x == ' ' then ("", w:l) else (x:w
, l)) ("", []) (" " ++ s)
rw s = map t $ zip s (foldr (x -> xs -> x ++ (' ': xs)) "" (map reverse (
explode s)))
where t (a, b) = if isUpper a then toUpper b else toLower b
res = rw "My name is Albert McDonald" |
|
t***n 发帖数: 546 | 34 autoload=yes crashes the asterisk, lot's of modules cannot be found.
did some research, seems function DB_EXIST is not available.
Here is some result from asterisk debug console:
tomato-asus-rt-n16*CLI> module show
Module Description Use
Count
res_adsi ADSI Resource 0
res_jabber.so AJI - Asterisk Jabber Interface 0
format_pcm.so Raw/Sun uLaw/ALaw 8KHz (... 阅读全帖 |
|