Posts

Showing posts from August, 2010

java - Installing Vertica JDBC jar file in WIndows 7 -

having trouble installing vertica_5.1.1_jdk_5 on windows 7 pc. installed latest java sdk. when type java -jar vertica_5.1.1_jdk_5.jar, "no main manifest attributes". opened manifest file within jar, , found "manifest-version: 1.0 created-by: 1.5.0_07 (sun microsystems inc.)". i've read, i'm missing main class statement in here. how figure out add manifest file? a jdbc driver library used java application. not program itself, doesn't have main-class attribute, , therefor cannot run trying do.

java - How to use RESTEasy PreProcessInterceptor only in specific methods? -

i'm writing rest api, making use of resteasy 2.3.4.final. know interceptor intercept of requests, , preprocessinterceptor first (before everything) called. know how can make interceptor called when specific methods called. i tried use both preprocessinterceptor , acceptedbymethod, not able read parameters need. example, need run interceptor when method called: @get @produces("application/json;charset=utf8") @interceptors(myinterceptor.class) public list<city> listbyname(@queryparam("name") string name) {...} to more specific, need run interceptor in methods have @queryparam("name") on signature, can grab name , before everything. is possible? tried catch "name" parameter inside interceptor, not able that. could me, please? you can use acceptedbymethod explained in resteasy documentation create class implement both preprocessinterceptor , acceptedbymethod . in accept -method, can check if method has parameter annotated @que...

python - iterate over a list with some conditions -

i have 2 lists, valid , locations . valid contains ids represented string numbers, , location contains id + strings (path) belonging id follow. my goal check if id part of valid group. if true valid id , following items call functions. when inavlid id detected should skip , move item next id. my code goes this: valid = ['1', '2', '3', '4', '5', '6', '27', '28', '29'] locationlist = ['1', '1_path1','1_path2','1_path3','2', '2_path1','2_path2','2_path3', '55','55_path1','55_path2', '3', '3_path1' ] item in locationlist: if len(item)< 3: if item in valid: print "###########lib id found in item %s############" %item print "call bring file name function - %s" %item continue else: continue print "call fix path function - %s" %item print "call search file function -%s" %...

url rewriting - Amazon Route 53 setup and 301 Redirection setup -

i've setup site on amazon ec2 server. using route 53 , servers dns have propagated correctly when set them on godaddy. have few problems. @ end results want make 301 redirect www non-www (from www.domain.com domain.com). want redirection applicable paths (ie. www.domain.com/folder/ domain.com/folder). in current configuration i've setup record domain.com point elastic ip address i've assigned server. when put domain.com (without www) in url works great , site loads. i've setup www.domain.com record point same ip address. in iis7.5 i've set redirection rule (after i've installed "url rewrite" iis module. here's rule: request url: matches pattern using: wildcards pattern: (.*) logical grouping: match input {http_host} type: matches pattern pattern: www\.mydomainname.com\.com action type: redirect redirect url: mydomainname.com{r:1} redirect type: 301 when run site 'www' returns www.mydomain.com/mydomain.commydomain.commydomain.com ,etc....

sql - Postgres using the primary key index as a covering index -

i'm wondering if, in postgres, there downsides piggybacking fields index implicitly created primary key in order not have create more indices. this common technique in creating clustered indices in sql server. edit good article on postgres indexing. seems postgres indexing dynamics different sql server. no not possible. postgresql cannot "include" columns without making them "active" in index. currently postgresql not support index scans. included in upcoming 9.2 release though. but adding columns index don't need might impose performance penalty updates because non-indexed column more efficient update indexed column.

Sql filtering id's -

i want create sql query lets me make top 5 of used ids in table. table has these columns: reservationid costumerid roomid hotelid i'm trying top 5 of used hotel ids. i thought had use count function doesn't seem work. counts hotelids , doesn't see difference between id's select count(hotelid) reservation; can me push me in right direction? thanks in advance! select count(`hotelid`) `freq`, `hotelid` `reservation` group `hotelid` order `freq` desc limit 5 ;

Random error: #1045 Cannot log in to the MySQL server -

ive had mysql , running month now. using yesterday, , today go login via phpmyadmin , command line , can't. if changed password overnight or something. im trying login using root user. do? edit this mysql running on local laptop development. account on root account, , no caps lock not on. http://www.cyberciti.biz/tips/recover-mysql-root-password.html says 5 step process work, try @ own risk obviously . source has same steps. won't work on windows, similar should http://www.debian-administration.org/articles/442 stop mysql service using /etc/init.d/mysql stop start mysql without password using mysqld_safe --skip-grant-tables & connect server using mysql -u root change root password: mysql> use mysql; mysql> update user set password=password("new-root-password") user='root'; mysql> flush privileges; mysql> quit stop server: /etc/init.d/mysql stop start server: /etc/init.d/mysql start test: mysql -u root -p

jquery - How to achieve effect used on http://www.googleventures.com/? -

i need recreating effect found on http://www.googleventures.com/ wanting make header , content slider on website stays in place rest of page scrolls on it. how can this? appreciated! though might possible parallax, cannot figure out how it...please help! here go, http://jsfiddle.net/xbxhd/1/ the top div can have links etc. on google ventures, not image. idea :)

Cmake flags for debugging don't seem to be useful in valgrind? -

ok, have qt application i'm attempting debug; upon running valgrind on , redirecting output file, see many 'definitely lost' blocks this, make me sad: ==24357== 24 bytes in 1 blocks lost in loss record 150 of 508 ==24357== @ 0x4c2c56f: malloc (vg_replace_malloc.c:267) ==24357== 0x76ed3ca: fcpatterncreate (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.4.4) ==24357== 0x76eb3cd: fcfontrenderprepare (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.4.4) ==24357== 0x76eb66c: fcfontmatch (in /usr/lib/x86_64-linux-gnu/libfontconfig.so.1.4.4) ==24357== 0x57163d7: qfontdatabase::load(qfontprivate const*, int) (in /usr/lib/x86_64-linux-gnu/libqtgui.so.4.8.1) ==24357== 0x56f3586: qfontprivate::engineforscript(int) const (in /usr/lib/x86_64-linux-gnu/libqtgui.so.4.8.1) ==24357== 0x5728482: ??? (in /usr/lib/x86_64-linux-gnu/libqtgui.so.4.8.1) ==24357== 0x573b73d: qtextline::layout_helper(int) (in /usr/lib/x86_64-linux-gnu/libqtgui.so.4.8.1) ==24357== 0x573d5a4: qtextlayout::endlayout...

c - raw socket. ip header when to use hton -

i new raw socket, , playing around ip header. noticed ip->ip_hl = sizeof(struct ip) >> 2 //works fine; ip->ip_hl = hton(sizeof(struct ip) >> 2) //will not work; what dont understand why not convert numbers network order instead of host order in case? what's general rule judge when use network order/host order? thanks htons 16-bit values. htonl 32-bit values. hton (no suffix), i'm not sure exists. the header length occupies 1 byte (actually part of 1 byte). don't need flip bytes right form. accordingly, there no macro htons or htonl 8-bit values.

php - What is the fastest way to check if files in a folder exist in my mysql database? -

i want scan folder of effects , check if each file listed row in mysql database of effects, , if isn't show un-tracked file. know efficient method achieve php? thank much. i think there's 1 way: glob directory, prepare 2 statements (a check , update) using pdo or mysqli , loop through files. if need on regular basis, should move tracked files different place track / check them.

php - How to optimize query with table scans? -

this far slowest query in web application. select prof.user_id userid, prof.first_name first, prof.last_name last, prof.birthdate, prof.class_string classes, prof.city, prof.country, prof.state, prof.images, prof.videos, u.username, u.avatar, (select count(*) company_member_sponsorship member_id = prof.user_id , status = 'sponsored') sponsor_count, (select count(*) member_schedules user_id = prof.user_id) sched_count member_profiles prof left join users u on u.id = prof.user_id order ( prof.images + prof.videos * 5 + ( case when prof.expire_date > :time 50 else 0 end ) + sponsor_count * 20 + sched_count * 4 ) desc, prof.last_name asc limit :start, :records everything else on site takes less second load lots of queries happening on levels. 1 takes 3-4 seconds. it's table scans causing slowdown. can understand why; first table has 50,000+ rows, second 160,000+ rows. is there way can optimize query make go faster? if worse comes worst can go through code , maintain ta...

How do you append to a Hive array? -

i have hive table user id have ts column, timeseries, stored array. want maintain timeseries recentmost window. (a) how append new number end of each column table joined id? (b) how drop leading number? data in hive typically stored in hdfs. hdfs has limited append capabilities. if constant modification of data @ core of analytics systems, perhaps should consider using alternatives hbase or cassandra. however, if data updates small part of workflow, encourage continue using hive (in order make use of it's sql functionality) reconsider design storing these updates. a quick solution above problem have more 1 record per user id in table. each record have timeseries corresponding user id. when want last n analysis on timeseries, should select table using distribute by on user id column. custom reducer pick out last n (or less, if size of timeseries less n) timestamps , return them. harish butani did work on windowing functions in hive. can take @ his work , associated docume...

Google Celebrity Search Result API? -

Image
i found in google, when type celebrity's name in search bar, there side bar portrait photo of celebrity, brief description , other related information , related people. wondering if wrapped in api provided google, since app need collect sort of information (we use wiki api). give me link or suggestion it? and/or maybe other api gives similar information?(i compare result) in advance. google celebrity search result api? - stack overflow stack overflow questions developer jobs documentation beta tags users current community help chat stack overflow meta stack overflow communities sign up or log in customize list. more stack exchange communities company blog tour start here quick overview of site center detailed answers questions might have meta discuss workings , policies of site learn more stack overflow company business learn more hiring developers or posting ads ...

jQuery ajaxSubmit() API issue with 'iframe: true' -

i using jquery form plugin make ajax call , target response iframe. here's piece of code: function getresponse(requestdata) { $('#myform').ajaxsubmit({ type: "post", url: "servlet/myservletpath", data: {requestdata: requestdata}, timeout: 10000000, iframe: true }); } this works fine except servlet can't find parameter name 'requestdata'. same starts working when remove 'iframe: true'. need post response iframe. any idea happening here? thanks you response success function if succeded add success function success: function (response) { // perform process after succeeding iframe: true }, error: function (xhr, status, error) { alert(error); }

javascript - Splice only working part of the time -

here have array undefined number of elements. tried print random element of array , cut it. here code. function rand(min, max){ return (math.floor(math.random() * (max - min + 1)) + min).tofixed(0); } $('#do').click(function(){ var count = chamarr.length; var num = 0; if (count == 1) { $('#output').html('nothing can found'); } else { num = rand(1,chamarr.length); $('#output').html(chamarr[num]); chamarr.splice(num,1); } }); when logged array cutted, saw ok, element not cut! my guess problem randnum method: function rand(min, max){ return (math.floor(math.random() * (max - min + 1)) + min).tofixed(0); } i believe give value in range [min, max] - inclusive @ both ends . (well, actually, give string version of value tofixed returns string, when use later it'll coerced number.) now you're calling this: num = rand(1,chamarr.length); so if array 6 elements long, you'll value in range [1, 6] . you'll try take chamarr[num] - , r...