Posts

Showing posts from February, 2010

c# - Interfaces - Implement abstract class methods -

i'm not sure how ask question, want access abstract methods idog. consider this: static void main(string[] args) { idog dog = new dog(); dog.catchfrisbee(); dog.speak("bark") // error -> no implementation console.readline(); } public class dog : animal, idog { public void catchfrisbee() { console.writeline("dog catching frisbee"); } } public abstract class animal : ianimal { public void speak(string saywhat) { console.writeline(saywhat); } public void die() { console.writeline("no longer exists"); } } public interface idog { void catchfrisbee(); } public interface ianimal { void die(); void speak(string saywhat); } from static void main, able call dog.speak() can't because it's not implemented in idog. know can

c - How to free a two dimensional array allocated memory using int ** ptr -

how free 2 dimensional array using function allocated memory using int ** ptr? for example use allocarray( &ptrarray, row, column); allocate array. proper procedure free allocated memory using function: void freearray( int *** pa, int row, int column) #include <stdio.h> #include <stdlib.h> void allocarray( int *** pa, int row, int column) { int i, j, count; *pa = (int **) malloc(row * sizeof(int *)); (int =0; i<row; ++i) { (*pa)[i] = (int *) malloc( column * sizeof(int)); } // note pa[i][j] same *(*(pa+i)+j) count = 0; (i = 0; < row ; i++) (j = 0; j < column; j++) (*pa)[i][j] = ++count; // or *(*(pa+i)+j) = ++count (i = 0; < row; i++) { (j = 0; j < column; j++) { printf("%d ", (*pa)[i][j]); } printf("\n"); } } // how free 2 dimensional array allocated memory using int ** ptr? void freearray( int *** pa, int row, in

Google fit api can't read steps recorder by the official app -

i updated lollipop, i'm not sure if did noticed apps read request can't steps recorded official google fit app can see steps recorded app misc steps. has come across or know if there's special way access google fits official data. check method public abstract pendingresult<dailytotalresult> readdailytotal (googleapiclient client, datatype datatype) it gets daily step count. https://developer.android.com/reference/com/google/android/gms/fitness/historyapi.html

Windows Azure: redirect website from www to non-www -

i have web.config file on server. <rewrite> <rules> <rule name="http https redirect" stopprocessing="true"> <match url="(.*)" /> <conditions> <add input="{https}" pattern="off" ignorecase="true" /> </conditions> <action type="redirect" redirecttype="found" url="https://{http_host}/{r:1}" /> </rule> <rule name="rule" stopprocessing="true"> <match url="^(.*)$" ignorecase="false" /> <conditions> <add input="{request_filename}" matchtype="isfile" ignorecase="false" negate="true" /> <add input="{request_filename}" matchtype="isdirectory" ignorecase="false" negate="true" />

mysql - Best way to store U.S. phone numbers ( NANP) -

i have requirement store nanp(north american numbering plan) numbers. means don't care , no need bother international numbers. numbering plan goes : npa-nxx-xxxx i filter & strip space or dash(-) make 10 digit correct format. use mysql , couchdb other stuff prefer keep in mysql db preferred storage system. i'm looking fast read operation match numbers during runtime , write can little slow insert/update happen in off hours. since given npa & nxx never start 0 if can separate them , can used integer type in case of want breakdown. for nosql case, possible generate separate document each area code , further isolate nxx & xxxx. rdbms case, full number can stored indexed integer fast accessibility. what best database design store these numbers ? thanks in advance. i'm looking fast read operation match numbers during runtime with couchdb can store every number id of doc e.g. { _id: "npa-nxx-xxxx", _rev: "1-...

java - Upload Image On Php Server In Android Programically -

i trying upload images android php server server working ios using objective c in android did not not know how upload images. have tried below code server returns message (images not in proper format or missing image file arraylist<file> imagefiles= new arraylist<file>(); for(int i=0;i<mcameradatalist.size();i++) { file f = new file(getfilesdir(),"image"+i+".jpg"); f.createnewfile(); bitmap bitmap = bitmap.createscaledbitmap( bitmapfactory.decodebytearray(mcameradatalist.get(i), 0, mcameradatalist.get(i).length),commonmethods.getdevicewidth(this), commonmethods.getdeviceheight(this), true); bytearrayoutputstream stream = new bytearrayoutputstream(); bitmap.compress(bitmap.compressformat.jpeg, 90, stream); byte[] bitmapdata = stream.tobytearray(); fileoutputstream fos = new fileoutputstream(f); fos.write(bitmapdata);

r - Why does ordering by factor destroy the decimal places -

i try simple ggplot of dataframe structure(list(clevel = c(3, 4, 5, 6, 7, 8, 9, 10, 11), sensitivity = structure(c(1l, 2l, 3l, 3l, 5l, 5l, 7l, 8l, 9l), .label = c("56.6666666666667","53.125", "52.9411764705882", "52.9411764705882", "54.2857142857143", "54.2857142857143", "55.5555555555556", "56.7567567567568", "57.1428571428571"), class = "factor"), specificity = c(76.4705882352941, 76.4705882352941, 76.4705882352941, 76.4705882352941, 76.4705882352941, 76.4705882352941, 76.4705882352941, 76.4705882352941, 76.4705882352941)), .names = c("clevel", "sensitivity", "specificity"), row.names = c(na, -9l), class ="data.frame") when plot follows library(ggplot2) ggplot() + geom_point(aes(clevel, sensitivity, color = "red",size=12), st) + geom_point(shape=5) i x axis not ordered way want. so tried st$sensitivit

asp.net - VB.NET redirection loop error -

i have following code on multilingual website: (masterpage.master.vb) dim pageurl string = httpcontext.current.request.url.absolutepath protected sub page_load(sender object, e system.eventargs) handles me.load dim strlanguage string = session("language") if not ispostback response.redirect(string.format("{0}?language={1}", pageurl, strlanguage)) end if response.write(string.format("{0}?idioma={1}", pageurl, strlanguage)) end sub it display querystrings: '?language=es' or '?language=en' @ end of current url, when run web, browser displays message: page has redirect loop (err_too_many_redirects). why happening? how can fix this? thanks in advance edit: tried with: if ispostback but when that, querystring doesn't appear @ end of url. edit 2 (solved): works @ last! thank zed, final code follows: dim pageurl string = httpcontext.current.request.url.absolutepath protected sub page_l

.htaccess - htaccess redirect with RedirectMatch -

i'm adding 301 redirect website, here htaccess content : redirectmatch ^/gift/birthday/(.*) /gifts.html the result in browser : http://www.website.com/gifts.htmlbirthday/ and want : http://www.website.com/gifts.html how can ? edit : htaccess : <ifmodule mod_rewrite.c> options +followsymlinks rewriteengine on rewriterule ^api/rest api.php?type=rest [qsa,l] rewriterule .* - [e=http_authorization:%{http:authorization}] rewritecond %{request_method} ^trac[ek] rewriterule .* - [l,r=405] rewritecond %{request_uri} !^/(media|skin|js)/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_filename} !-l rewriterule .* index.php [l] redirectmatch ^/gift/birthday/(.*) /gifts.html </ifmodule> don't mix mod_rewrite rules , mod_alias directives this, not processed in order .htaccess, separately handled different apache modules. what need this: # not mod_rewrite rule can outside ifmodu

jdbc - getGeneratedKeys feature is not supported by this database -

i running sql anywhere 16.0 , trying hand @ spring jdbc templates. need simple: insert row table, auto-generated id value. public int log() { simplejdbcinsert insertactor = new simplejdbcinsert(ds) .withtablename("dba.requests") .usinggeneratedkeycolumns("request_id"); map<string, object> parameters = new hashmap<string, object>(); parameters.put("user_id", userid); parameters.put("data_type_id", getproductsku()); parameters.put("price", price); // ...more parameters number requestidnumber = insertactor.executeandreturnkey(parameters); return requestidnumber.intvalue(); } but spring repeatedly gives me error org.springframework.dao.invaliddataaccessresourceusageexception: getgeneratedkeys feature not supported database the driver using should support jdbc 4.0 (the library dbjdbc16.dll , in path, , sajdbc4.jar in tomcat lib directory). relev

Python FTP and Streams -

i need create "turning table" platform. server must able take file ftp , send ftp b. did lot of file transfer systems, have no problem ftplib, aspera, s3 , other transfer protocols. the thing have big files (150g) on ftp a. , many transfers occur @ same time, , many ftp servers or other. i don't want platform store these files in order send them location. don't want load in memory either... need "stream" binary data b, minimal charge on transfer platform. i looking @ https://docs.python.org/2/library/io.html readbuffer , writebuffer, can't find examples , documentation sorta cryptic me... anyone has starting point? buff = io.open('/var/tmp/test', 'wb') def loadbuff(data): buff.write(data) self.ftp.retrbinary('retr ' + name, loadbuff, blocksize=8) so data coming in buff, <_io.bufferedwriter name='/var/tmp/test'> object, how can start reading while ftplib keeps downloading? hope i'm clear e

Difference between Require SSL and using URL Rewrite in IIS -

is there improved security web applications if use "require ssl" in ssl setting section of iis? planning on creating url rewrite rule. " require ssl " cause 403.4 forbidden response if try access site using http://example.com . won't automatically redirect https:// url. this may confusing users if you're not linking in way https://example.com ssl'd url. if want users able randomly hit site using plain http:// , redirect them ssl'd url you're better off leaving "require ssl" turned off , rewrite.

Datapower Secure Connection Bluemix -

does datapower secure connection in bluemix require datapower internet facing ? if bluemix starts connection, answer maybe yes. basic secure connection (software), if 1 initiates connection, server running basic secure connection needs have internet access (behind firewall/gateway/etc...), doesn't need internet facing : ip@ on internet. i have set bluemix datapower secure connection (in bluemix cloud integration service) towards on-premise datapower appliance. datapower secure connection pointing internet ip, , on-premise firewall maps datapower appliances "dmz" ethernet interface. on datapower appliance, cloud gateway service configured receive connections bluemix datapower secure connections. seems work endpoints have added cloud gateway service. right working on adding (1-way , 2-way) tls in bluemix datapower secure connection.

Removing MULTIPLE outliers in regression model in R -

this in r ok i've used cook distances identify points remove dataset of 506 variables have. i able remove 1 point (number 369) follows: modelmc1 = lm(housing[-369,14] ~ housing[-369,1] + housing[-369,2] + housing[-369,3] + housing[-369,4] + housing[-369,5] + housing[-369,6] + housing[-369,7] + housing[-369,8] + housing[-369,9] + housing[-369,10] + housing[-369,11] + housing[-369,12] + housing[-369,13]) my question how remove multiple points (around 30) thanks you can leave out multiple rows in data frame using vector c() . modelmc1 = lm(housing[c(-361, -367, -369),14] ~ housing[c(-361, -367, -369),1] + ...)

javascript - Input value of cookie -

i want apologize in advance if repeat question. want able input value of previous page using cookies jquery. i know how set/get/remove i've never tried use values input fields. can give guidance/example on how accomplish this? jquery: //plug-in// <script src="/path/to/jquery.cookie.js"></script> <script> //set , expire form 1// $(document).ready(function(){ var date = new date(); var minutes = 5; date.settime(date.gettime() + (minutes * 60 * 1000)); $.cookie('name1', 'value1', { expires: date, path: '/' }); $.cookie('name2', 'value2', { expires: date, path: '/' }); $.cookie('name3', 'value3', { expires: date, path: '/' }); $.cookie('name4', 'value4', { expires: date, path: '/' }); }); </script> <script> //get form 2// $(document).ready(function(){ $.cookie('name1'); $.cookie('name2'); $.cookie('name3'); $.c

c# - How can I make this movement relative to my camera direction -

i need move target object in world space relative direction main camera facing on x&z axis , relative player on on y axis. any guidance appreciated. public class test : monobehaviour { public string raise = "raise"; public string lower = "lower"; public string left = "left"; public string right = "right"; public string closer = "closer"; public string further = "further"; public gameobject target; private float xpos; private float ypos; private float zpos; // use initialization void start () { xpos = target.transform.position.x; ypos = target.transform.position.y; zpos = target.transform.position.z; } void fixedupdate () { vector3 currpos = target.transform.position; vector3 nextpos = new vector3 (xpos, ypos, zpos); target.getcomponent < rigidbody > ().velocity = (nextpos - currpos) * 10; if (input.getbutton (raise)) { print ("moving up");

r - How to get output file to open automatically using render() function in RMarkdown -

this small point, it's important bigger i'm creating. when run .rmd file within rstudio pressing "knit word" button, word file created opens automatically. however, when run file using render() function, file created not open -- have navigate file location , open manually. how can output file open automatically using render() function? you cannot directly render function. can open document using e.g. browseurl . filepath <- "c:/test" render(file.path(filepath, "test.rmd")) browseurl(file.path("file:/", filepath, "test.docx"))

CSS keyframes to animate div height from bottom to top -

i have following code animates grey bar top bottom, other way around bottom top: http://jsfiddle.net/hrcu9e6b/3/ <div class="review-type-wrapper-v"> <div class="review-type-inner" style="height:82%"> <div></div> </div> </div> @-webkit-keyframes linev { { height: 0; } { height: 100%; } } @keyframes linev { { height: 0; } { height: 100%; } } .review-type-wrapper-v, .review-type-wrapper-h{ border-radius:3px; border:1px solid $rating-background-dark; overflow: hidden; .review-type-inner{ position: absolute; > div{ background-color: $rating-background-dark; //position: absolute; left: 0; height: 100%; //width:100%; } } } .review-type-wrapper-v{ position: relative; width: 14px; height: 60px; .review-type-inner{

sql server - Combine two columns of a table in third column -

i want create table wherein 'id' column combined 'category' column , gets stored in 'userid' column. here example. id category userid 1 std std1 2 nmm nmm2 3 cov cov3 i have tried : create table tblusers ( id int identity primary key, regid right('0000'+cast([id] varchar(5)),5), category nvarchar(3), userid concat(categoryinitials,id) ) but doesnt work. so, how work while creating table? may this: create table tblusers ( id int identity primary key, category nvarchar(3), userid (category + cast(id varchar(10))) )

javascript - Angular JS function not defined error -

i learning angularjs angularjs.org video tutorials when run code says error: [ng:areq] argument 'reviewcontroller' not function i got undefined in console code looks same in video here html <!doctype html> <html ng-app="store"> <title>testing angularjs</title> <head> <link rel="stylesheet" type="text/css" href="bootstrap.css"/> <script type="text/javascript" src="js/angular.js"></script> <script type="text/javascript" src="app.js"></script> </head> <body ng-controller="storecontroller store"> <ul class="list-group"> <li class="list-group-item" ng-repeat="product in store.products"> <h3>{{product.name}} <em class="pull-right">{{product.price | currency}}</em> <img class="gallery&quo

Error of not enough arguments while using quad in matlab -

i used quad function way: f = @(x)1./(x.^3-2*x-5); q = quad(f,0,2); but f function changed to: f = @(x,y) y./(x.^3-2*x-5); i using quad inside other loop i've got y value each iteration. i tried use quad way: q = quad(f(y),0,2); but error of not enough arguments. can do? you can use anonymous function defined in x evaluate f(x,y) when y known q = quad(@(x) f(x,y), 0, 2)

Wordpress - Alter the form action url in wp-includes/comments-template.php -

i working on website non ssl non ecommerce sections, uses ssl woocommerce portion. attempting redirect reviews of products thank page, able working fine on staging. when moving live environment, comment form calling post url following: " client's website using nonhttps urls everywhere except woocommerce urls. making call url https://website.com/wp-comments-post.php , white screen of deathing. modified core file moment test theory , worked, unable find let me modified url change https http. looked comment_form(), doesn't appear offer hook or filter this. suggestions? i agree doesn't make sense not have https on pages, form input. doing redirect form url in .htaccess way go.

how to clean a JSON file and store it to another file in Python -

i trying read json file python. file described authors not strict json. in order convert strict json, suggest approach: import json def parse(path): g = gzip.open(path, 'r') l in g: yield json.dumps(eval(l)) however, not being familiar python, able execute script not able produce output file new clean json. how should modify script in order produce new json file? have tried this: import json class amazon(): def parse(self, inpath, outpath): g = open(inpath, 'r') out = open(outpath, 'w') l in g: yield json.dumps(eval(l), out) amazon = amazon() amazon.parse("original.json", "cleaned.json") but output empty file. more welcome import json class amazon(): def parse(self, inpath, outpath): g = open(inpath, 'r') open(outpath, 'w') fout: l in g: fout.write(json.dumps(eval(l))) amazon = amazon() amazon.par

Android HttpURLConnection connecting error only on hardware devices (not in emulators) -

i'm new in android developing , looking way download pictures , text internet app. found few tutorials , included code in project. when i'm running app on emulator work fine. if run app on device (samsung galaxy s4) "connecting error" (in httpdownload.java) , have no idea why, cause in other apps internet working. thank u help. here codes: httpdownload.java: import android.app.activity; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.os.bundle; import java.io.ioexception; import java.io.inputstream; import java.io.inputstreamreader; import java.net.httpurlconnection; import java.net.url; import java.net.urlconnection; public class httpdownload extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); } private inputstream openhttpconnection(string urlstring) throws ioexception

angularjs - What is the best way to integrate angular js app to Rails asset pipeline? -

i had application deployed on 2 servers : apache angularjs , unicorn rails 4. want integrate angular app rails one. best way this? in addition kevin b's comment, here's cool tutorial on using rails (rails 4) build json rest api interacts angularjs frontend. link: https://thinkster.io/angular-rails/ gl!

Javadoc reuse predefined text -

is possible somehow create like: /** #define common_note_1="this note want re-use in several places" */ int vara; /** variable (common_note_1) */ int varb; /** variable b (common_note_1) */ some suggested 3 years ago may not been possible know if possible in modern age? if still not possible, there suggestions use c preprocessor. idea if c preprocessor can integrated intellij? or happy python script automatically executed before compilation. know intelli j can configured run ant before compilation. if ready made solution take well. not want write/modify ant script myself. you can follows: /** note want re-use in several places */ static final int dummy; ... /** variable see {@link #dummy common_note}. */ int vara; /** variable b see {@link #dummy common_note}. */ int varb; /** variable b (common_note_1) */ this creates link in documentation when pressed lead common doc. won't show inline though. depending on how long common note might take more w

objective c - OS X 10.10.3 and notification center -

i developed app os x should send local notification. deployed app os x 10.9. app worked fine until apple update os x 10.10.3. installed app standard (not administrator) user , when go under system preference --> notification can't see app has permission send notification. here's code send loca notification on os x: nsusernotification *notification = [[nsusernotification alloc]init]; notification.title = title; notification.informativetext = text; notification.soundname = nsusernotificationdefaultsoundname; notification.userinfo = @{@"url": [nsstring stringwithformat:@"http://myurl.com/%@",detailparams]}; nsusernotificationcenter *center = [nsusernotificationcenter defaultusernotificationcenter]; [center setdelegate:self]; [center schedulenotification:notification]; apple changed after installation of os x 10.10.3? if yes what's wrong code? a couple things ( which found @ tutorial here ): 1) instead of schedule

javascript - jQuery maskedinput triggers completed twice on paste -

i'm facing bug jquery maskedinput. pasting value on masked input triggers completed event twice. behavior can seen on oficial website. open this link , click on demo . select product key input , type aa-999-a999 . after that, try paste same value in field. there other issues related not triggering event on paste, none of them helped me bug... dows know why or had similar problem? thanks in advance. so i've tried simplest case (using this maskedinput.js , though note edit it, below, , this jquery-1.11.2.js ): <html> <body> <script type="text/javascript" src="./jquery-1.11.2.js"></script> <script type="text/javascript" src="./jquery.maskedinput.js"></script> <script type="text/javascript"> jquery(function($) { $.mask.definitions['~']='[+-]'; $("#tin").mask("99-9999999",{completed:function(

cryptography - Hash value MD5 and SHA256 of file is coming different when file is from system32 folder. Why? -

i calculated md5 , sha256 hash values of notepad.exe , mspaint.exe through online hash generators md5filecalculator onlinemd5 . noticed if calculate when both exe's present in actual postion in system32 value coming different when placed somewhere out of system32 folder. reason behind ? correct hash value ? i using software restriction policy block applications, created hash rule notepad.exe(present in syste32 folder) file , blocked it. when check hash value in registry different hash value of notepad.exe (from system32 folder) calculated through other methods online md5 calculators or through windows api. when copy notepad.exe file other folder on desktop , calculate hash value, coming same in registry created rule.so correct value think 1 when file out of system32 folder. not getting why happening ? have permissions ? it's because of 32-bit applications running on 64-bit windows, , how windows handles system32 folder programs. this driving me nuts while b

What should I return from the LocalCerticateSelection callback in sslstream authenticateAsClient? -

i have certificate generated self-signed , had signed vendor. have connect vendor , authenticate using certificate. when authenticateasclient, localcertificateselection callback gets called validissuers parameter being set 1 signed certificate. certificate should returning callback? when return certificate issued vendor error because certificate not sent server. using following code. namespace testclientauthenticatehttps { using system; using system.linq; using system.net; using system.net.security; using system.net.sockets; using system.security.authentication; using system.security.cryptography.x509certificates; class program { private readonly x509certificate2collection _certs; private tcpclient _client; private sslstream _sslstream; private const string host = "smr-staging.surescripts.net"; private const string ssserial = "40 1f c1 ea 00 00 00 00 02 44"; private const sslproto

c# - Can't figure out how this method produces garbage and how to fix it -

i've got method i'm calling ... well, often. , gc becoming problem, because apparently method creating garbage, can't seem figure out why. item item; foreach (point3d p in point3d.alldirections) { item = grid[gridposition + p]; if (item != null && item.state != state.initialized) else return; } othermethod(this); this method inside item class , figures out state of neighbouring items. gridposition variable position of item inside grid , point3d struct contains 3 ints, 1 each axis. contains few predefined static arrays such alldirections contains point3ds. now, state of items can change @ time , once neighbours have specific state (or rather aren't in initialized state) other stuff (othermethod), changes state of item method no longer called. such produced garbage problem when neighbours don't change state (for example when there no user input). guess thi

excel - VBA: need to close window, only can close workbook -

i've set vba filter specific type of file , return filtered data (with 3 columns shown) in new worksheet. have 2 buttons in worksheet - 1 select file path, , other run filter on file in path (which in cell f7). my issue haven't been able read selected file without opening it. fine, since it's quick process, command close file closes workbook, , leaves empty excel window open. workbook want open 1 i'm executing commands, 1 filtered results paste to. suggestions? i'm fine figuring out way window close, or execute process without window needing open in first place (this ideal). public sub commandbutton2_click() b = application.getopenfilename() if b = false msgbox (" have not selected file!") else thisworkbook.worksheets("selectupdatefile").cells(7, 6).value = b msgbox ("your file has been selected. click filter button below generate moved nodes.") end if end sub sub autofilter() dim s string dim oapp objec

javascript - jQuery - changing page with sending a POST parameter -

scenario is: i have html a-tag in page(call 'index.php') link page (lets call page 'action.php') ! 'action.php' page needs receive post parameter, otherwise return error! i have needed parameter in 'index.php' page, dont want use form-tag send it. whenever user clicked on a-tag, parameter should sent 'action.php' page. indeed, ajax has nothing here, while want change page, sending post parameter whenever user click on < > ! example: index.php <a class='showproject' href='action.php' data-pid='<?php echo project_id ?>'> project </a> action.php echo $_post['project_id']; i prefer that, if there way this, jquery code starts following event: $('.showproject').on('click',this,function(e){ /* solution */ }); you can use ajax this. don't know have parameter want pass action.php, in example it's stored in hidden value. $('.show

mysql - Select from a big table with GROUP BY and ORDER BY -

i need top 30 ips period (month here) maximum sum of bytes. select sum(bytes) bytes, ip table stamp_inserted >= '2015-04-01 00:00:00' group ip order bytes desc limit 30 table has 10 000 000+ records (will grow). type myisam. i tryed add indexes bytes, ip, stamp_insered. , 1 index (complex index?). explain says: type: range key: stamp_inserted (complex index) rows: 6988465 extra: using where; using index; using temporary; using filesort it takes 15 seconds. if remove order - 10 seconds. normal? or how can make faster? table structure: create table if not exists `all` ( `id` int(10) unsigned not null auto_increment, `ip` char(15) not null, `bytes` bigint(20) unsigned not null, `stamp_inserted` datetime not null, primary key (`id`), key `ip` (`ip_dst`), key `bytes` (`bytes`), key `stamp_inserted` (`stamp_inserted`), key `bytes_2` (`bytes`,`ip`,`stamp_inserted`) ) engine=myisam

r - Unexpected result using unique inside a data.table -

given data.table (vith version 1.9.5) test <- data.table(1:20,rep(1:5,each=4, times=1)) if run this: test[unique(v2)] i result: v1 v2 1: 1 1 2: 2 1 3: 3 1 4: 4 1 5: 5 2 is intended beahaviour or bug? or i'm not using properly? i reading "r book" , in example use test[unique(vegetation),] , it's intended select subset of rows unique vegetation. i expected like v1 v2 1: 1 1 2: 5 2 3: 9 3 4: 13 4 5: 16 5 though understand need specify aggregation criteria. test[,unique(v2)] gives [1] 1 2 3 4 5 . since test[1:5] supposed give first 5 rows , that's get, there no bug. to expected result, can this: test[!duplicated(v2)] # v1 v2 #1: 1 1 #2: 5 2 #3: 9 3 #4: 13 4 #5: 17 5 or this: test[, v1[1], = v2] # v2 v1 #1: 1 1 #2: 2 5 #3: 3 9 #4: 4 13 #5: 5 17 or @arun reminds me there data.table method unique : unique(test, by="v2") # v1 v2 #1: 1 1 #2: 5 2 #3: 9 3 #

lotusscript - Why wont agent move to next line of text -

i creating agent go through list of lotus notes document id's read in text file. text file holds document id's line line , there no whitespace after each line , no lines after last entry. agent process first line in text file , not move onto next line. why this? before coded loop going through view msgbox outputted every line. sub initialize dim viewallcontracts notesview dim requestdoc1 notesdocument dim filenum integer dim filename string dim constatus variant dim strlinevalue string dim checkid variant set s = new notessession set db = s.currentdatabase filenum% = freefile() filename$ = "c:\contractidtocomplete.txt" open filename$ input filenum% set viewallcontracts = db.getview("contracts \ year") set requestdoc1 = viewallcontracts.getfirstdocument while not eof(filenum%) ' read until end of file. line input #filenum%, strlinevalue$ until requestdoc1 nothing checkid = requestdoc1.getitemvalue("co

osx - Path to exec folder in bash script within .app container -

i'm trying make .app run simple bash script launch java app. found instructions making suitable .app container , running .app runs bash. great. the problem is, want put java app inside .app i'm not sure how bash script launch it. here's current script: #! /bin/sh /library/internet\ plug-ins/javaappletplugin.plugin/contents/home/bin/java -jar -xmx1g javaapp.jar& the script runs , shuts down immediately. i'm assuming because either can't find /java or javaapp.jar put in .app container in same folder bash script ( macos )

html - Iframe content not top 0 and left 0, why? -

Image
i have online store menus hosted in domain, bring them using iframes. website www.paulinhomotos.com.br what happens content iframe not @ top 0 left 0. guys know why , how solve it? in advance. this screenshot showing issue. http://prntscr.com/6zim8q thanks! add css properties iframe iframe{ border: none; } or iframe tag includes frameborder="0" like <iframe src="http://paulinhomotos1.hospedagemdesites.ws/menus/capacetes/menucapacetes.htm" frameborder="0"></iframe>

java - Session expires before session timeout -

Image
to keep session alive pinging server every 30 seconds, if there activity user. sometimes(not consistently happening) after pinging, server doesn't renew session. session timeout 30 minutes. first request sent @ 12:27 , next @ 12:35.....but second request getting unauthorized 401 error. using java on server side , ie10 browsing. unfortunately, reputation low post images of response headers of both requests. in advance. web.xml <?xml version="1.0" encoding="utf-8"?> <!-- use definition if using java ee 6 container stops eclipse complaining 3.0 not valid version --> <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation=" http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> <!-- session configuration --> <session-config> <session-timeo

node.js - Using optional mongoose model property as URL param -

i using property of model url paramater '/parent/:arg1' , controller handles so exports.parent = function (req, res) { if (typeof(user.profile.property) == undefined) { console.log("user not have property"); } unirest('api.example.com/endpoint/' + user.profile.property)` however express returns connect 500 typeerror page saying cannot ready property 'property' of undifined (which expected) don't output typeof check end goal redirect user profile page update system. what error telling user.profile undefined. error thrown because user.profile.property attempting access property of undefined . update conditional check like: exports.parent = function(req, res) { if (user.profile) { if (user.profile.property === undefined) { console.log("user.profile not have property"); } else { unirest('api.example.com/endpoint/' + user.profile.property); } } else { console.log("use

c# - Ordering not working in Entity Framework query -

i'm battling linq query application using entity framework (6.1.3) the query follows: var productperiods = (from pp in ctx.productperiods pp.isactive && pp.product.isbuybackforproduct == null && !pp.product.productaddons.any() && pp.powerregionid == powerregionid select new { productperiod = pp, price = pp.prices .orderbydescending(x => x.created) .groupby(x => x.firmid) .select(pr => pr.firstordefault()) .orderbydescending(x => x.productprice) .firstordefault() }).tolist(); the purpose of query find latest price prices collection of product period, grouped firm id , select best price of latest prices each firm. this works in linqpad, first orderbydescending(x => x.created) doesn't work when used in context of entity framework. does knows why? , perhaps have solution it? :-) thanks in advance! update thanks replies. i&

java - Can we use other class in SortedSet interface -

the below code gives sorted elements & sortedset can't instantiated interface & hence treeset used instantiate class & question why treeset used instead of other classes because sortedset gives sorted order element & hence treeset used? import java.util.hashset; import java.util.iterator; import java.util.sortedset; import java.util.treeset; public class sortedsetdemo { public static void main(string[] args) { sortedset s=new treeset(); s.add("akash"); s.add("prakash"); s.add("bhushan"); s.add("chetan"); system.out.println("sortedset:"); iterator itr=s.iterator(); while(itr.hasnext()) { system.out.println(itr.next()); } } } output: sortedset: akash bhushan chetan prakash as can see here http://docs.oracle.com/javase/7/docs/api/java/util/sortedset.html treeset 1 of classes implements sorteds