Posts

Showing posts from April, 2012

java - The project was not built due to "Could not delete '/Help/build/classes/exportFile'.". -

when imported project in eclipse oxygen, gave below error. "the project not built due "could not delete '/help/build/classes/exportfile'.". fix problem, try refreshing project , building since may inconsistent" googled , got delete contents of bin folder , clean project. there's no bin folder. tried cleaning, still same error. else can done you found solution yourself, here more informations error. first, said, search brought answers deleting bin -directory manually solves don't have directory. reason configured project write classes classes -directory ( bin default). the "cannot delete" message appears on windows systems if there process keeping lock on directory or files within. classic reason run application or have explorer window open shows content of directory. closing application/explorer window solves problem. lock keeps staying. way find culprit using sysinternal's processexplorer. allows search using find -

amazon web services - Create AMI when EC2 instance shuts down -

Image
i need create ami when instance terminated/shuts down up. setup cloudwatch rule on ec2 instance state changed event create ami via ssm run command (target document aws-runshellscript(linux)). works fine, if provide hardcoded instance id command parameter. /home/ec2-user/createimage.sh i-123456 this rule needs applied instances. need instance-id dynamically source , send target. tried input transformer not getting data source. dynamic parameters {{variable name}} not working. suggestions. thanks. you can configure amazon cloudwatch events rule: you can have rule trigger aws lambda function triggers snapshot. when lambda function triggered, following information passed function: { "version": "0", "id": "01345791-08ce-baaf-78f5-437aca50f13c", "detail-type": "ec2 instance state-change notification", "source": "aws.ec2", "account": "123456789012", "ti

netbeans - How to display an image chosen with filechooser Javafx FXML -

this question has answer here: how convert file image display in imageview in java? 2 answers passing parameters javafx fxml 6 answers i have gotten program allow me browse file select using file chooser. see method in code below. problem not know next. want assign file chosen image file. want display image(only image files used in program). since using scene builder, contains actual application(paint) class fxml controller class, believe have add code both classes. have attached both clarity sake. public class fxmldocumentcontroller implements initializable { @fxml private menuitem open; private menuitem exit; private anchorpane pane; private imageview imgv; private stage primarystage; @fxml private void handleopenaction() { filechooser filechooser = new filechoos

php - Laravel Blade: extend multiple views and adding more content -

i have following scenario: view shows data (let's call "cars"), view shows other data (let's call "motorbikes") , view must show data of "cars" , "motorbikes" in addition of content (let's call "vehicles"). the 3 views have sense , can shown separatelly. the problem can't find way build "vehicles" view without repeating code because don't know how use laravel's blade templating in order extend multiple views ('cars' , 'motorbikes') , add more content . each view divided 3 sections ('styles', 'scripts' , 'content') because html content of each view needs specific css , js files. layouts/master.blade.php (simplified version) <html> <head> @yield('styles') @yield('scripts') </head> <body> @yield('content') </body> </html> cars.blade.php (simplified version) @extends('layouts.ma

angular - ngx-loading Toggling from another component -

i'm using ngx-loading , want able trigger it's showing/hiding children components. here have: app.component import { component, injectable } '@angular/core'; @injectable() export class appcomponent implements oninit{ public loading = false; constructor() { } loader() { this.loading = !this.loading; console.log(this.loading); } } child component import { appcomponent} '../app/app-component'; import { myservice } '../service/my-service'; @component({ selector:'child-component', templateurl: './child.component.html', providers: [appcomponent, myservice] }) export class childcomponent implments oninit { constructor(private loader: appcomponent, private service: myservice) {} ngoninit(): void { this.getdata(); } getdata() { this.loader.loader(); this.service.getdatafromservice().then(res => { this.mymodel = res; this.loader.loader(); } } } if check logs this.

php - URL Rewriting for Wordpress -

i working on wordpress project , add region code on url. similar one: link i applied code mentioned , tweaked fit needs. did redirect add region code url: i.e. example.com/category redirected example.com/us/category. works on pages , product categories, however, it's redirect loop on hompage, product pages , posts. just mention, using wpml website in english , not using language translations. need show region-specific content.

autohotkey - #InputLevel bug? Impossible to use custom combination with #InputLevel set to 1 -

i'm using latest version of ahk (1.1.26.01) , following script fails send space key active window when release space key. space key gets disabled. #inputlevel 1 space & lalt:: outputdebug, %a_thishotkey% return space:: outputdebug, %a_thishotkey% send, {space} return without #inputlevel directive works fine. described in ahk file (search "custom combinations"). what want able trigger hotkeys use space in ahk script running, that's why need #inputlevel set 1 consequently sets sendlevel 1. if run script without #inputlevel 1 following in keyhistory after hitting space . , gets sent active window. vk sc type up/dn elapsed key --------------------------------------------------- 20 039 s d 0.76 space 20 039 h u 0.08 space 20 039 d 0.05 space 20 039 u 0.00 space but #inputlevel 1 the following , space not sent though hotkey triggered (as

c++ - lldb is not starting an application -

this first experience in commandline mode of lldb. unsuccessful. installed minimal kit clang, lld, lldb v5 (ubuntu 16.04) sample application built clang. trying start: lldb applcation >run error: process launch failed: unable locate lldb-server-5.0.0 so questions: why lldb tries run server? not remote debugging. why lldb refers 5.0.0 (and change setting)? there added symbolic links automiticaly xxx-5.0 suffix llvm utilities, not xxx-5.0.0. reasonable if refers lldb-server itself, without suffixes. adding lldb-server-5.0.0 symlink doesn't solve problem. any idea how should work? by way question - seems left/right/up/down arrows keys don't work in lldb console? instead of cursor moving adds codes (lldb) ^[[d^[[a^[[c^[[b

html5 - How to make a button pattern? -

i'm trying make little puzzle game in html5 , i'm having trouble figuring out how make puzzle. in puzzle have click squares in order beat it. don't know how make have click buttons in order , if don't you'll lose. <!doctype html> <html> <head> <title>room two</title> <link rel="stylesheet" type="text/css" href="youtubegame.css"> <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=tangerine|inconsolata|droid+sans|oxygen|ubuntu|coming+soon"> </head> <body> <div id="content"> <h1 id="roomnum">room 2</h1> <p id="roominfo">once again door seems magically close behind you.<br /> unlike stone floor previous room, 1 divided wooden slabs.<br /> press foot onto slab. slides down, ,

SQL queries Is there any website where I get to build tables and test SQL queries? -

is there website build tables , test sql queries? have 3 tables , execute sql statement wanna make sure queries correct. want see output. thank ? you can use website testing sql queries http://sqlfiddle.com/ you can choose mysql, oracle, postgre, , mssql

javascript - Storing user response in a variable - facebook messenger bot js -

i'm working on node.js facebook messenger bot , need store user response message bot sends called later, presumably through use of variable. // defines 'text' message sent user let text = event.message.text // if user's text contains 'savings', 'saving', 'calculator', or 'calculator, following conditions occur: if (text.search("saving") >= 0 || text.search("saving") >= 0 || text.search("calculator") >= 0 || text.search("calculator") >= 0) { sendtextmessage(sender, "how save?"); // here want store response how money user wants save } any appreciated! the simplest thing store in object psid key: let cache[psid] = value; the problem using variable isn't particularly stable. if node process crashes lose cache. should ideally use external key value store. redis option that's super easy , running.

logging - Why does slf4j w/ Wildfly ActiveMQ cause ObjectMessage.getMessage () to throw JMSException? -

i’m resurrecting old application worked wildfly 8 / hornetmq / log4j. remote java gui client swaped jms objectmessages. so far works again when reconfigured wildfly 10 / activemq / slf4j, except 1 thing: after mdb receives objectmessage (whose object arraylist) throws jmsexception error when mdb calls getobject() on message. jmsexcetion. e.getmessage() returns: org.slf4j.log4j12.log4jloggeradapter [module "org.apache.activemq.artemis:main" local module loader @1c2c22f3 (finder: local module finder @18e8568 (roots: c:\programfilesgeo\wildfly\wildfly-10.1.0.final\modules, c:\programfilesgeo\wildfly\wildfly-10.1.0.final\modules\system\layers\base) but if remove slf4j logging entityparent instances in arraylist works correctly … except can’t log entityparent subclass mdb extracts objectmessage. here’s know far: it's issue slf4j , guess serialization. because otherwise, slf4j works fine on server side. mean message above written wf lo

amazon s3 - s3 rate limit against website endpoint -

i'm hitting s3 bucket via website endpoint various paths/keys. i'm able ok (200) responses when i'm hitting @ 1,000 requests per second on course of 5 minutes. i'm using popular tool: https://github.com/tsenart/vegeta have confidence in these stats. this suprising considering documentation says above 800 per second problematic. is using website endpoint different api call in terms of throttling? 800 real rate limit or crude theshhold? it's soft limit, , not limit bucket level perspective. read carefully. documentation warns of rapid request rate increase beyond 800 requests per second potentially resulting in temporary rate limits on request rate . s3 increases available capacity keyspace partition splitting , takes time happen... buckets scale workload. if requesting same object(s) repeatedly, not imposing load on available resources if hitting 800 unique objects per second , reading between lines, threshold under discussion -- time keys in

c - Allocate memory to char pointer array as it is read in -

i need read white space separated words stdin, use emalloc function allocate memory each word read in. i finding confusing, here have written far. #include <stdio.h> #include <stdlib.h> int main (void) { #define size 100 char* username[100]; int i; int p; /* read words array */ for(i = 0; < 100; i++) { username[i] = calloc(size, sizeof(char)); scanf("%s",username[i]); } /* print out array */ (p = 0; p < 100; p++) { printf("%s", username[p]); } return 0; } i not sure whether reading words in correctly using scanf , pretty sure memory allocation not quite correct. coming java, memory allocation tricky wrap mind around. how come not include & infront of username[i] in scanf function? your code fine few problems: you should free'ing memory array of pointers point to. the use of scanf() dangerous buffer overflow occur. #include <s

javascript - How to scrollLock body when a modal/lightbox is open -

i using lightbox jquery plugin open lightbox when user clicks on product. lightbox content stretches below fold, , @ moment right scrollbar moves entire page when scroll down. i'd work pinterest lightbox, whereby right scrollbar scrolls lightbox, , rest of page stays fixed. i've seen few posts on this, nothing seems work me. problem want lightbox scroll if content bigger viewport of browser not background. css: #lightbox{ position: absolute; left: 0; width: 100%; z-index: 100; text-align: center; line-height: 0;} #lightbox img{ width: auto; height: auto;} #lightbox img{ border: none; } #outerimagecontainer{ position: relative; background-color: #fff; width: 250px; height: 250px; margin: 0 auto; } #imagecontainer{ padding: 10px; } #loading{ position: absolute; top: 40%; left: 0%; height: 25%; width: 100%; text-align: center; line-height: 0; } #hovernav{ position: absolute; top: 0; left: 0; height: 100%; width: 100%; z-index: 10; } #imagecontainer>#hovernav{ lef

c# - Check file existence before WebClient.DownloadFile -

i know how check if file exists before downloading. current code: string url = environment.getfolderpath(environment.specialfolder.desktop) + "/text.txt"; string path = "asdf.wix.com/text.txt"; using (var client = new webclient()) { client.downloadfile(url, path); } the code works if file missing on site creates empty text.txt causes issues. any ideas? thank you! if url var points location on pc, check existence system.io.file.exists: if(!system.io.file.exists(url) { //code handles file dne case.. maybe log , return? } if it's pointing towards remote location, i'm not sure how check existence beforehand. you could, however, handle 404 case returned webclient , delete erroneous text.txt file using (var client = new webclient()) { try { client.downloadfile(url, path); } catch (webexception e) { var statuscode = ((httpwebresponse) e.response).statuscode; if (statuscode == httpsta

python - Creating while loop based on txt length? -

so trying create loop checks length of txt file. running separate script write text file while script running. when length in txt file longer 5 want break , progress rest of script. seems need have script check txt file each cycle, unsure of how this. how set up? code- import time def start(): open('test.txt') token_text: token = token_text.read().splitlines() response_token = (token[0]) while len(response_token) <= 5: try: print("waiting captcha") time.sleep(1) except: print('captcha ready') break print("script start") start() i create function obtain token length: def token_length(): open('test.txt') file: return len(file.read().splitlines()[0]) while token_length() <= 5: print('waiting') time.sleep(1) print('ready')

javascript - Using jQuery in main process of Electron App -

i've tried using: let $ = require('jquery'); after doing: npm install jquery what use jquery within main process of electron desktop application. possible? i've been researching on google , tutorials , code has been renderers.

authentication - Unable to obtain LinkedIn Access Token using Authorization Code -

i unable obtain linkedin access token. setup follows: i have setup app on li redirect url http://localhost:5000/home i request authorization li , response 'code'. in under 10 seconds, copy code query param out of url bar , paste postman. in postman, have setup follows: post /oauth/v2/accesstoken http/1.1 host: www.linkedin.com content-type: application/x-www-form-urlencoded grant_type=authorization_code& client_id=<client id>& client_secret=<client secret>& redirect_uri=http%3a%2f%2flocalhost%3a5000%2fhome& code=aqsbuzcwwsk_3sqqfusrzwea4tzqu_x4fsqkub9c3eoeczzwno2zh8uazjc-t0t40wrv6qnxnpcdxckejuxhqb56zhkqqreb5mdjm1kzrcrllbbyhzyymf5orzwngobyljukuvq_0oisue0w0rq i have made multiple attempts in response, following error. {"error":"invalid_request","error_description":"unable retrieve access token: appid/redirect uri/code verifier not match authorization code. or authorization code expired. or external m

encoding - Using PowerShell to write a file in UTF-8 without the BOM -

out-file seems force bom when using utf-8: $myfile = get-content $mypath $myfile | out-file -encoding "utf8" $mypath how can write file in utf-8 no bom using powershell? using .net's utf8encoding class , passing $false constructor seems work: $myfile = get-content $mypath $utf8nobomencoding = new-object system.text.utf8encoding $false [system.io.file]::writealllines($mypath, $myfile, $utf8nobomencoding)

ios - How to show multiple local notifications -

background: im writing application bot sends messages. these messages can received local notification. the problem: when bot sends multiple notifications within short span of time (1 second between each message), notification center show 1 message. hear notification sound every time expect to, still see first message. relevant code: func postusernotification(content: string, delay: timeinterval, withdictionary dictionary: [string:string] = [:]) { let notificationcontent = unmutablenotificationcontent() notificationcontent.body = content notificationcontent.userinfo = dictionary notificationcontent.categoryidentifier = "message" let dateafterdelay = date(timeintervalsincenow: delay) let datecomponents = calendar.current.datecomponents([.year,.month,.day,.hour,.minute,.second], from: dateafterdelay) let trigger = uncalendarnotificationtrigger(datematching: datecomponents, repeats: false) let identifier = "identifier"

Oracle SQL VARCHAR2 datatype storage -

from oracle docs : if give every column maximum length or precision data type, application needlessly allocates many megabytes of ram. example, suppose query selects 10 varchar2(4000) columns , bulk fetch operation returns 100 rows. ram application must allocate 10 x 4,000 x 100—almost 4 mb. in contrast, if column length 80, ram application must allocate 10 x 80 x 100—about 78 kb. difference significant single query, , application process many queries concurrently. therefore, application must allocate 4 mb or 78 kb of ram each connection. as know varchar2 variable length datatype, db allocate space used column, i.e. if column 10 character in unicode allocate 10 bytes. according above statement if column (max) 10 character, length of datatype defined 4000, still occupy 4000 bytes? the space allocated on disk long required store actual data each row. the space allocated in memory (in cases) maximum required based on datatype.

android - Is there anyway to keep a WakeLock across processes? -

i built application used foreground service held wakelock. changed service intent service wakefulbroadcastreceiver, , using alarmmanager.rtc_wakeup send broadcasts receiver. since change, users reporting devices not waking up; works fine on other devices. think issue device, workaround issue (and keep them happy), grab wake lock older foreground service did, , hold across processes. understanding cannot done because once process terminates wakelock released. know of way grab wakelocks can live across multiple processes ?

Update if the register exists otherwise insert. MYSQL -

let's suppose have following table in mysql db table: debt id | customer | amount --------------------- 1 | peter | $ 80 2 | john | $120 what want sum new amount of money pending 1 given customer. i've been doing far select check if customer exist in table. if update register sum of previous value plus new one. if register doesn't exist proceed insert . as can see i'm using 2 operations, select , update , or select , and insert . my question if there way 1 single operation https://dev.mysql.com/doc/refman/5.7/en/insert-on-duplicate.html set amount = amount + ?? in on duplicate update clause.

c# - SignalR objects are not being deleted from the heap even when the hub connection is disposed -

i have web application sends messages server front end (javascript) client using signalr. however, there end (.net) client creates proxy hub. end client processes messages , sends them hub, , hub sends these messages front end client. here snippet of end client creates hub connection , proxy send messages hub: hubconnection hubconnection = new hubconnection(serverurl); ihubproxy hubproxy = hubconnection.createhubproxy(hubname); task t = task.run(() => hubconnection.start(new longpollingtransport())); t.waitandunwrap(); if (hubproxy != null && hubconnection.state == connectionstate.connected) { await hubproxy.invoke("messageclients", messageargs); } there more code, covers essential part. the key part is, every time message created, code called. means there hubconnection object created every message needs sent hub, , front end client. after making memory dump, realized lot of objects remain on heap , causing memory leak. figured it's because i&#

-bash: create: command not found when 'create' and 'add' on Git -

i followed instructions installing git , command line tools on mac, when try $ create , $ add files , -bash: create: command not found returns . i typed $ echo ‘export path=/usr/local/git/bin:$path’ >> ~/.profile add path, still returns command not found. what reasons this? init , add both subcommands of git . means must like $ git init or $ git add

javascript - Handsontable Additional Render Calls when Enabling columnSorting and hiddenColumns Options -

i have created handsontable per following configuration... var hot = new handsontable(container, { data: handsontable.helper.createspreadsheetdata(8, 6) , rowheaders: true , colheaders: true , columnsorting: true , hiddencolumns: true }); and have noticed adding columnsorting , hiddencolumns options causes 2 additional renders on initial construction of handsontable. additionally, when table constructed , hot.updatesettings() called. hiddencolumns option causes renderer called twice. this not ideal causes performance issues if have multiple handsontables running on webpage. does know why occurring? have created fiddle below re-produces issue. https://jsfiddle.net/joshadams/69qsdy7f/

swift - String nil inside NSURLSession -

i declare string in beginning var teststring: string? let task = nsurlsession.sharedsession().datataskwithurl(url!) {(data, response, error) in let xml = swxmlhash.parse(data) teststring = xml["root"]["schedule"]["date"].element?.text } but outside nsurlsession, teststring nil. how can make not become nil , can use value? for example, want use println (teststring) after method block. nil the reason variable nil because closures executed asynchronously. means rest of code after network request continue called normal, code containing parameters data, response , error called when network request finished. to work around this, try putting whatever trying variable inside closure, println(teststring) inside curly brackets.

Using VB to open two specific .txt documents in excel, save the workbook as a certain name, and then reference the workbook -

i need program writing open specific .txt documents in excel , save workbook name referenced in excel workbook. overall goal have workbook main cell a3 reference cell b5 workbook test1 created text documents. far can pull recent text document need third recent document in same workbook. so example: folder c:\results contains files: test1_chr.txt test1_ftr.txt test1_hdr.txt test2_chr.txt test2_ftr.txt test2_hdr.txt i need grab both test1 chr , hdr files , import them excel document. have far code (note: works far when txt file has been created same day think have tried 1 day , fine next without changing stopped working) dim filename string dim mostrecentfile string dim mostrecentfilehdr string dim mostrecentdate date dim path string directory = "c:" filename = dir(directory & filespec, 0) if filename <> "" mostrecentfile = filename mostrecentdate = filedatetime(directory & filename) while filename <> "" if

r - Performing a for loop on a matrix instead of a data frame -

i performing rather complicated linear regression involves conditionally creating dummy variables in new columns loop. far i've been doing in couple of data frames, converting them matrices, converting sparse matrices, , joining; however, i've reached computer's limit. sorry if gets confusing - i've tried simplify process as can. edit - added numeric examples original question. here source data numeric values: df <- data.frame(matrix(nrow = 9, ncol = 4)) df$x1 <- c(5, 1, 2, 0, 4, 8, 7, 6, 0) df$x2 <- c(10001, 10001, 10001, 10003, 10003, 10003, 10002, 10002, 10002) df$x3 <- c(10002, 10002, 10002, 10001, 10001, 10001, 10003, 10003, 10003) df$x4 <- c(10001, 10001, 10001, 10003, 10003, 10003, 10002, 10002, 10002) names(df) <- c("response", "group_1", "group_2", "exclude") what looks like: response group_1 group_2 exclude 1 5 10001 10002 10001 2 1 10001 10002 10001 3

android - View Pager in Recycler View fast sliding glitch -

adapter implementation straight-forward private context context; private string images[]; public pageradapter(context context) { this.context = context; } public void setimages(string images[]) { this.images = images; notifydatasetchanged(); } public boolean arearraythesame(string images[]) { return arrays.equals(this.images, images); } @override public int getcount() { if (images != null) { return images.length; } else { return 0; } } @override public boolean isviewfromobject(view view, object object) { return view == object; } @override public object instantiateitem(viewgroup container, final int position) { view itemview = layoutinflater.from(context).inflate(r.layout.cover_image_item, container, false); imageview imageview = (imageview) itemview.findviewbyid(r.id.coverimageiv); glide.with(context).

java - Dynamically add or remove fragments in tabbed activity FragmentStatePagerAdapter without refreshing existing data -

i have created activity named survey in using tabbed activity fragmentstatepageradapter dynamically add or remove tabs , fragments. including common layout named title.xml in each fragment layout. have created 1 button add fragment , 1 remove fragment in actionbar. when use fragmentpageradapter , call remove function removes tabs , title not fragment , when use fragmentstatepageradapter getitemposition return position_none removes fragments refreshes title xml in other fragments. same thing occurs on adding fragments, display values of title xml in current fragment. rest fragments values refreshed. my survey.java public class survey extends appcompatactivity { private sections_pager_adapter msectionspageadapter; private viewpager mviewpager; private textview mtitle; private string projectname,auditstage,sectiontype; private edittext etsectionname; private spinner spsection; private imagebutton ibsectiongps,ibsectioncamera; private arraylist<latlng> sectionlatlong =ne