由买买提看人间百态

topics

全部话题 - 话题: obje
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
o*****e
发帖数: 23
1
【 以下文字转载自 Programming 讨论区,原文如下 】
发信人: oldbare (bearhill), 信区: Programming
标 题: My makefile can not work, why?
发信站: The unknown SPACE (Sun Apr 7 15:15:57 2002) WWW-POST
Here is my make file:
# makefile for phase 1
CC = gcc
CFLAGS = -g
OBJS = TestLexan.o lexan.o
TestLexan.o : TestLexan.c gloabls.h
$(CC) $(CFLAGS) -c TestLexan.c
lexan.o : lexan.c lexan.h gloabls.h
$(CC) $(CFLAGS) -c lexan.c
TestL.exe: $(OBJS)
$(CC) $(CFLAGS) -eTestL $(OBJS)
After running it, there is the message:
bash: ./makefile
l**********r
发帖数: 79
2
这个跟return type 无关, 你这是典型的c思维写java代码。 但是java 有一个神器,
就是包装。
package microbenchmark;
import java.util.InputMismatchException;
import java.util.Scanner;
public class SC {
Objects obje;
public SC(){
obje=new Objects();
}
private class Objects{
float fn=0;
float sn=0;
public Objects(){
fn=0;
sn=0;
}
public void setFN(float value){
fn=value;
}
public void setSN(float value){
sn... 阅读全帖
a******6
发帖数: 78
3
来自主题: Statistics版 - 问关于C中调用R函数
一个简单的程序,不知道哪里出了问题,请各位大虾指点一下:
谢谢
#include
#include
#include
#include
int main()
{
double a[3];
int i;

GetRNGstate();
for(i=0;i<=3;i++)
{
a[i]=rnorm(0.0,1.0);
printf("a[%2d]=%f \n",i,a[i]);
}
PutRNGstate();
}
错误如下:
Linking...
test.obj : error LNK2001: unresolved external symbol _PutRNGstate
test.obj : error LNK2001: unresolved external symbol _Rf_rnorm
test.obj : error LNK2001: unresolved external symbol _GetRNGsta
w*******y
发帖数: 60932
4
Some of you that bought tickets through Ticketmaster not only got ripped off
from their fees and now we are getting ripped off from the proposed "
setttlement"
Matt Cameron, a member of the class like us, objected to this pittance by
filing his own motion. He is looking for other people to join in on his
settlement. Here is the facebook page:
https://www.facebook.com/groups/124588604321066/
to join in the opposition class and the disposition:
http://www.scribd.com/doc/74322776/Ticketmaster-Set... 阅读全帖
D**C
发帖数: 6754
5
来自主题: JobHunting版 - 问一道java题
you already set the source to null.
then the reference is pointing to null also.
so both obj are good for gc.
why won't they?
then what's the point to set an obj to null?
m*******i
发帖数: 370
6
来自主题: JobHunting版 - 一个data structure design的问题,求助
thanks! 应该是这个。不知道怎么implement的
是使用array吗?比如
MyClass* obj_ptr=new MyClass[N];
根据hash key insert to the array, 然后maintain pointer根据insert 的顺序指向
上一个insert的obj和下一个将要insert的obj?
不知道是不是这样?给解释一下吧,多谢!
t**g
发帖数: 1164
7
来自主题: JobHunting版 - 问几个unix/c++工作面试题
1.假如有millions个objs,new的话效率太慢,如何快速分配内存和初始化
2.有没有比memset更高效的办法赋值
3.用array的话,如何对这million个obj调用带参数的ctor
我用A a[100]={A(b)}他说错了
事后我猜use vector instead (which allow customized ctor calling), and then
transfer it to array?
4.linux下如何查找程序某个process详细信息
我回答ps和top,他说不对
谢谢!
a*****v
发帖数: 6
8
来自主题: JobHunting版 - 问个C++题
you have a class A, where you set ctor to be private, so a client can't
call
"A a;"
to create obj on stack.
But someday another developer add a new ctor:
"A(int)"
and try to call "A a(1);" inside main(). So this will create a obj on
stack. How do you prevent that?
z*****j
发帖数: 6
9
1) char * ptr = “Hello”;
sizeof(ptr) = ?
a. 1
b. 4
c. 5
d. 6
2) char obj[10][20][30];
sizeof(obj) = ?
a. 6000
b. 600
c. 60
d. 1
3) char c = 127; c = c + 10;
Which of the following is true?
a. c > 0
b. c = 0
c c < 0
d .c >= 0
4) double a = 5/10*2.0;
a = ?
a. 0
b. 0.25
c. 1
d. 0.05
5) int a = 2|1; //Bitwise OR operation
a = ?
a. 0
b. 1
c. 2
d. 3
6) int a = 3^1; //Bitwise XOR operation
a = ?
a. 0
b. 1
c. 2
d. 3
7) #include
int main()
{
int a = 5;
{int a = 6;cout< return 0;
}
Wha
K******g
发帖数: 1870
10
来自主题: JobHunting版 - 请教一个C++的问题
class Person;
class Command
{
Person* object;
void (Person::*method)();
public:
Command( Person* obj = 0, void (Person::*meth)() = 0 )
{
object = obj;
method = meth;
}
void execute()
{
(object->*method)();
}
};
我有两个问题:
1)void (Person::*method)(); 是什么意思?
2) 如果class person里没有public member fuction,会怎么样呢?
r**e
发帖数: 226
11
来自主题: JobHunting版 - 问个java hashcode的题
为什么答案是 3? 不是2么?
package test;
import java.util.HashSet;
public class Test {

private String str;

public Test(String str) {
this.str = str;
}

@Override
public int hashCode() {
int hascode = this.str.hashCode();
return hascode;
}

@Override
public boolean equals(Object obj) {
return this.str.equals(obj);
}

public static void main(String args[]) {
Test h1 = new Test("1");
Test h2 = new Tes... 阅读全帖
x****d
发帖数: 1766
12
java面试肯定就要回答GC, long live obj ref to short live obj, blah blah blah.
A**u
发帖数: 2458
13
来自主题: JobHunting版 - 发发面经 攒人品 C++的
如果member
只能这样调用
obj << cout;
不能cout << obj
r*********n
发帖数: 4553
14
来自主题: JobHunting版 - G家面经 已跪
Design a class to serialize and deserialize an object
思路是什么呢?
char* ptr = reinterpret_cast(&Obj);
ofstream out("file", ios::binary|ios::out);
out.write(ptr, sizeof(Obj));
p****n
发帖数: 4
15
来自主题: JobHunting版 - 对角线Sum 螺旋(线)
Get the Sum of 对角线 of 螺旋(线) in n X n
Starting with the number 1 and moving to the right in a counter-clockwise
direction a 5 by 5 .
The issue is that the 1 is in the middle.
Normally:
for example :螺旋(线) (3X3)
[ 1, 2, 3 ],
[ 8, 9, 4 ],
[ 7, 6, 5 ]
[leetcode]Spiral Matrix II
(2013-03-12 15:14:57)
转载▼
标签:
分类: leetcode
Given an integer n, generate a square matrix filled with elements from 1 to
n2 in spiral order.
For example,
Given n = 3,
You should return the following matrix:
[
[ 1, 2, 3 ],
[ 8,... 阅读全帖
e********3
发帖数: 18578
16
来自主题: JobHunting版 - G家题讨论: harry potter 走矩阵
Backtrack, recursive, and dynamic programming.
Here is the code (changes size to see the solution for matrices of different
sizes), the time complexity is O(n) (n = size*size) and the memory usage is
O(n) as well:
import java.util.*;
public class HarryPotter{
private static Random rand = new Random();
private static int[][] matrix;
private static Map cache = new HashMap Integer>();

static class CacheKey{
public int x, y;
public Cac... 阅读全帖
T*******e
发帖数: 18
17
非常感谢楼上各位的指点。我会根据自身coding速度做调整。
euclid2003在另一帖中的code就是个很好的参考。
http://www.mitbbs.com/article_t/JobHunting/32611137.html
import java.util.*;
public class HarryPotter{
private static Random rand = new Random();
private static int[][] matrix;
private static Map cache = new HashMap Integer>();

static class CacheKey{
public int x, y;
public CacheKey(int x, int y){
this.x = x;
this.y = y;
}

@... 阅读全帖
e********3
发帖数: 18578
18
来自主题: JobHunting版 - 热腾腾g电面 已挂
BFS+DP,而且需要maintain两个距离,一个是到终点的最小距离,一个是到起点的最小
距离,计算终点的距离需要backtrack,到起点的简单比较保存最小值就行了,类似
Dijkstra算法。电面就考这个有点偏难了,尤其还是同胞就操蛋了,要是老中这么考老
印我绝对赞成。简单的实现还可以把障碍物那个的距离设成100啥的,这样自然就知道
要绕过了。
这个题目的难度比reverse linkedlist, atoi难了几个数量级。。。
我贴两个我自己写的代码抛砖引玉一下,第一个是Harry Potter最小的strength通关,
第二个是经典的Dijkstra algorithm,都是附带了测试数据自动生成的方法,你把这两
个组合一下基本就能解这道题了,过两天我有空了来写一下这道题的具体实现。
import java.util.*;
public class HarryPotter{
private static Random rand = new Random();
private static int[][] matrix;
private static ... 阅读全帖
f********x
发帖数: 2086
19
来自主题: JobHunting版 - Java 面试题

好牛逼的题
http://stackoverflow.com/questions/5654654/static-synchronized-
http://stackoverflow.com/questions/18356795/static-versus-non-s
从这两个连接里看
貌似non static的快些,因为如果不同的obj,会不同的锁,互相不影响;
而static的,即使是不同的obj,因为锁是在class上,所以会互相block。
又学了点东西........
z****e
发帖数: 54598
20
来自主题: JobHunting版 - Leetcode用Python刷通关可以去面试不
server side提供了大量稳定的就业机会,你愿意放弃么?
以后写app是dart&swift了
obj c几乎铁定要被淘汰,apple的架势已经非常明显了
swift应该在明年这个时候,会成为非常流行的语言
因为所有人都需要ios这个平台
java和swift有大量的重合,以后会出现一个平台
把这两个都给统一起来,也就是以后会出现在android上用swift
以及在ios上用java写的framework,后者其实已经出现了
dart应该也很快会出现在android上
这三个都不难,互相切换也就是短时间的事
但是鉴于dart&swift都还不成熟,目前能搞的也就是java
obj c明年就会被淘汰,所有人都在等swift年底出来
v******9
发帖数: 1
21
来自主题: JobHunting版 - 请教一个OOP的C++问题
可以不需要typeid,不过就比较奇怪一点。
tester.h
================
class A{
public:
virtual void invoke();
};
class B:public A{
public:
void virtual invoke();
};
class C:public A{
public:
void invoke();
};
class D:public A{
public:
void invoke();
};
=====================
main.cpp
=====================
#include
#include
#include "tester.h"
using namespace std;
void test(A* a){
cout<<"test: A "< };
void test(B* a){
cout<<"test: B "< };
void test(C* a){
co... 阅读全帖
m*****k
发帖数: 731
22
this is expected, this is why you need define your own equals() if you wanna
use the obj as key in HashMap,
after the same hashcode leads you to the same bucket, you need equals() to
find the obj that matches your input so to retrieve the right value.
放狗, 你一下就明白了。
比如
http://javarevisited.blogspot.com/2013/08/10-equals-and-hashcod

对?
m*****k
发帖数: 731
23
this is expected, this is why you need define your own equals() if you wanna
use the obj as key in HashMap,
after the same hashcode leads you to the same bucket, you need equals() to
find the obj that matches your input so to retrieve the right value.
放狗, 你一下就明白了。
比如
http://javarevisited.blogspot.com/2013/08/10-equals-and-hashcod

对?
e***n
发帖数: 42
24
来自主题: JobHunting版 - LinkedIn 电面
第二题:
public class BlockingQueueImpl implements BlockingQueue{
Queue q = new LinkedList();
int cap = 10;
long timeOut = 1000;

@Override
public Object take() {

while(q.isEmpty()){
try {
this.wait(timeOut);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
Object rst = q.poll();

this.notifyAll();

return rst;
}
@Overrid... 阅读全帖
s********l
发帖数: 998
25
来自主题: JobHunting版 - 近来面经
bless~~
linkedin:
Give code example of virtual function
这个是实现virtual function机制?还是如何用virtual function?
microsoft:
Add an object to a list and remove itself
这个是add object Obj, 然后马上removed Obj?
w********p
发帖数: 948
26
来自主题: JobHunting版 - 请帮我看下这道coding exercise
程序终于吭哧吭哧写完了。
公司说要和我面聊suggestion. 头疼。不知道要建议个啥。
恳请大牛们批评指教。与其被别人challenge, 不如在这预先知道的说。一定发包子感
谢的说。
https://github.com/selinaGit/SortNFiles
为了搏眼球,牺牲下隐私。貌似无盐,切勿下载哦, 否则是小猪🐷
还有主要的reference 是下面这个link. 照葫芦画瓢的说。
http://www.oracle.com/technetwork/articles/java/fork-join-42260
我想请教下在上面的link里为什么要用static method return new object.
而不是 用非static method "public Document fromFile(File file)" 然后 new
WordCounter obj
调用obj.Document fromFile(File file)
没有concurrency 的经验。问题有点傻。求教的说。
我的理解是这样的话,fork之前,file就read到li... 阅读全帖
a**********0
发帖数: 422
27
来自主题: JobHunting版 - Clone() vs new
如果是shallow clone 一个新obj 是不是比用constructor新产生一个 obj更快呢
uj
发帖数: 324
28
* Your TicTacToe object will be instantiated and called as such:
* TicTacToe obj = new TicTacToe(n);
* int param_1 = obj.move(row,col,player);
题目是给你空旗盘,然后一系列moves
如果解法是keep track rows, cols, diagonal, anti-diagonal 用掉空间 O(n),
每一个move, 需要update 和检查4个数,你觉得是 N square complexity ??
r******9
发帖数: 566
29

其实递归不行。我们会有很多很多数据 没人能保证递归会不会爆炸。。。。现在采取
的办法是:
function sendApi(obj){api((obj)=>{sucess:{
这里还有其他两个有dependency的api call。。。
handlesucess()
}
handleError:(){
这里也有两三个apicall。。。。
}
})}
function handleSuccess(){sendNextApi()}
function sendNextApi(){sendApi(array[index+1])}
彻底无语。。。。
b********r
发帖数: 7725
30
来自主题: NewYork版 - 妈的...nnd....
verb-obj is much more vivid than only an obj
as for the verb, well, it's all about the tools.
M****e
发帖数: 2803
31
不懂这词,刚查了一下。
bonk.
[wit.obj.](Brit.)have sexual intercourse[with obj.]
(英)交媾
狂晕
z*******9
发帖数: 167
32
来自主题: Fitness版 - 奔一个,并请教饮食和动作
关于健身做了很久的survey,可是都没认真付诸行动。在此认真请教,附照片供参考。
(工科朋友如果有摄像头和matlab,可以用下面的code照照片
clear;
obj = videoinput('winvideo',1,'YUY2_640x480');
frame = getsnapshot(obj);
img=ycbcr2rgb(frame);
figure;imshow(img);
很方便的。多照照片,方便交流。)
对于我的情况,应该如何选择动作和强度,以及如何配合饮食呢?
T*******e
发帖数: 4110
33
What OBJ did was wrong. But that is only a part of the story. Punishing OBJ
only would let another culprit loose. Now it is more fair to fine Josh as
well.
z*i
发帖数: 58873
34
来自主题: Football版 - Oh Hi 系列之待定:HelloGiants
OBJ情商可能不高,但是你为啥说他脑子不好?
你来列举一下当年笨狗牛仔味精出产过的类似OBJ的wrs,不用数据,大嘴名扔流就行
BTW, 这场我也看好味精。
z*i
发帖数: 58873
35
来自主题: Football版 - Oh Hi 系列之待定:HelloGiants
其实OBJ跟你聪明的一样一样的,
你场内输wb,场外赢美金
OBJ场内踢球网,场外无数赞助合同
lol
B*****e
发帖数: 9375
36
来自主题: Football版 - 如果我是老JJ

哈哈 我可不会说OBJ”命不好”
命不好 就是说被别人坑了毁了
OBJ的行为和结果 全是他自找的
同理 我现在也没弄明白肉末的“命不好" 就怎么不是他自找的
他到底是怎么被别人坑了毁了?
b*****u
发帖数: 1978
37
来自主题: Football版 - OH NO 系列之十八:外卡bye
【前言】两年前,本版著名拍饭加拿大人在版上写了一个 ON TO 系列,反响甚好,我
非常羡慕嫉妒恨,所以今年效一个颦。不过他是西施,而我姓东,一切都要反着来,从
标题开始,就得把 ON TO 倒过来写...
====
OH NO! 我拍外卡周bye,小鸡、汤哥四顾茫然、不知对手,丹牛、胡子四处面经、无心
备战,全队人心涣散、江河日下,当真是呼天不应叫地不灵,这周毫无半分胜算。。。
(一)Special Six
小鸡最喜欢做的事情,是看比赛录像;小鸡最爱看的录像,是对方的两毛五。
可是,当某一周他需要研究的两毛五超过一个的时候,他就会隐隐地感到胃部不适。。。
而这周,他需要研究的两毛五,一共有六个:
Tannehill, Ryan
Moore, Matt
McGloin, Matt
Cook, Connor
Osweiler, Brock
Savage, Tom
小鸡对着白板上这六个名字注视良久,陷入了沉思。
。。。。。。
几天前,在 Market Basket 超市里,小鸡正专心致志淘着便宜货,忽然,Coca Cola 6
-pack 的特价招牌引起了他的注意:This Week's ... 阅读全帖
s*******u
发帖数: 1855
38
来自主题: Football版 - 我图盗版oh no系列之没有第三了
我图盗版oh no系列之没有第三了
---------
膜拜大神白教授,献丑一把,oh no一下我好鸟。
白教授都oh no到系列之十八,我这个系列不起来,赛季最后一次oh no了。
本来上周小鸟就要被狮子吃掉,没有第二的,谁知道前版主三哥最后关头开了金手指,改
机票飞回翡翠城,显身(献身)世纪莲,轻拍了巴西蝴蝶的翅膀, 导致狗代尔连打喷嚏, 折
翼海鹰勉强苟延残喘一把.
这周吗就没有这种黑天鹅了.三哥众筹不成,三嫂一怒之下宣布破产,freeze了三哥的信
用卡.买不了去恶狼屯的机票,我小小鸟唯有束手待擒,被又黑又凶山中大鸟死里蹂躏的
命运,已经是hector输给achilles一样,纵然神仙也干预不得.
------ history ------
我图playoff客场赌场underdog, 结果0:8, 无一幸免. 客场也就欺负一下乳剂菜鸟,遇
上上狗,10死无生,何况面对mvp?
我图最近4年,两次playoff做客nfcs打divisional round, 两个上半场比分? 0:28, 0:
31,加起来0:59.这是什么样的大坑?
mvp同学虽然号称软,但是打playoff... 阅读全帖
f******d
发帖数: 4136
39
来自主题: Football版 - NYG选了Engram,可以audible变阵了
NYG这是all in了,虽然明知道The U那位天花板更高,也要来个即战力。
签了个block很牛但不接球的TE,又选了个接球很牛但是block很一般的TE
可以上双TE,ELLISON去做fb block,OBJ,谢泼德,马勺,Engram一字排开去接球,直
接不要RB了。
估计下赛季会打很多短码数传球,OBJ偶尔偷鸡。
s*****h
发帖数: 44903
40
来自主题: Football版 - 硬了
OBJ这胶水手感确实天赋异禀
前一段看AB训练营的单手接球视频
手感硬多了
然并卵 华而不实
看看人阿棒实战多实在。。。
OBJ鸡贼呀
不搞这些花拳绣腿
哪有这高的人气
也哪有底气跟巨人要最高PAY
s*****h
发帖数: 44903
41
来自主题: Football版 - 硬了
这么看 我确实被OBJ的爱作秀印象流了
难道是OBJ打硬仗不行 估计也是印象流
你巨今年进攻要改善不少
赶脚拿下果冻希望很大
s*****o
发帖数: 22187
42
来自主题: Football版 - 硬了
OBJ单手接球只是锦上添花。人家真正牛逼的是quick slant+YAC。这东西和巨人的Eli+
OL就是绝配,出手时间1秒钟,OBJ随便晃倒个MLB或者SS就直捣黄龙了。关键需要一个
Canceller,把他cancel了,版霸说说对不。
T***u
发帖数: 1468
43
来自主题: Football版 - 硬了
晃掉MLB怎么就直捣黄龙了,一般打NYG都是两个S拖在后面
这种5码slant加50码YAC一年也没几个


: OBJ单手接球只是锦上添花。人家真正牛逼的是quick slant YAC。这东西和巨人
的Eli

: OL就是绝配,出手时间1秒钟,OBJ随便晃倒个MLB或者SS就直捣黄龙了。关键需
要一个

: Canceller,把他cancel了,版霸说说对不。

T***u
发帖数: 1468
44
来自主题: Football版 - 黄狗打算交易状元签
Saquon Barkley实在变态,比Zeke壮,比OBJ跑得快跳得高
CB的速度,FB的力量
Barkley / Zeke / OBJ
Height: 6' / 6' / 5'11
Weight: 233 / 225 / 200
40 yard: 4.41 / 4.47 / 4.43
10 yard split: 1.54 / 1.58 / 1.50
Vertical: 41 / 32.5 / 38.5
Bench press: 29 / ? / 7


: 状元签选RB 太不值了

首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)