on-internet

Calling external Rest API from a Lambda function in java

I am trying to write a lambda function that takes information from lex input, and calls a rest api, passing that information as a parameter, returns a string, which i then want to send to lex as a response. It works as expected when run in eclipse, but when i upload the jar to amazon lambda, it is giving no error, but the output string is null. public class LambdaFunctionHandler implements RequestHandler<Map<String,Object>, Object> { @Override public Object handleRequest(Map<String,Object> input, Context context) { ValidationHook.LexRequest lexRequest= LexRequestFactory.createLexRequest(input)

Join the discussion →

numpy 2d where with constraint on each row

I have a numpy array of shape (2,N) and three constraints to filter on. No value in a column may be negative Row 0 must be less than a constant, say xmax Row 1 must be less than a constant, say ymax Here is what I've tried: xmax, ymax = 7, 8 dst = np.linspace(-2,10,20).reshape((2,-1)).astype(np.int32) mask = np.where((0 <= dst) & (dst[1,:] < xmax) & (dst[0,:] < ymax)) mask = np.vstack(mask).T for p in mask: print(p, dst[:,p[1]]) Which produces (array([[-2, -1, 0, 0, 0, 1, 1, 2, 3, 3], [ 4, 4, 5, 6, 6, 7, 8, 8, 9, 10]]), (2L, 10L)) (array([0, 2]), array([0, 5])) (array([0, 3]), array([0, 6])) (

Join the discussion →

What happens when different CPU cores write to the same RAM address without synchronization?

Let's assume that 2 cores are trying to write different values to the same RAM address (1 byte), at the same moment of time (plus-minus eta), and without using any interlocked instructions or memory barriers. What happens in this case and what value will be written to the main RAM? The first one wins? The last one wins? Undetermined behavior?

Join the discussion →

OutOfMemoryError: Java heap space in docker-compose

I am doing quite expensive for the memory parsing of 50000 HTML pages. While parsing, I am writing them to the database which is defined in my docker-compose.yml file. After 25000 pages are parsed parsing stops and I get such an error: AsyncExecutor.default-11" java.lang.OutOfMemoryError: Java heap space How can I change Java heap size in my docker-compose file so all the data could fit into the database? My docker-compose file looks like this: version: '2' services: app: image: "user/app:latest" depends_on: - "db" api: image: "user/=api:latest" ports: - "7070:7070" depends_on: - "db" db: imag

Join the discussion →

Unable to launch WebDriverAgent because of xcodebuild failure: "xcodebuild failed with code 65" Iphone6 Simulator

I am trying to run the Amazon app on an iPhone 6 simulator using Xcode. The app is getting installed in the iPhone Simulator, but not able to interact with its elements. Appium version - 1.7.2 Xcode Version 9.2 Platform Mac- 10.12.6 Downloaded the app - i.e. xxx.app.ipa Logs: [Xcode] 2018-02-13 21:23:08.009 xcodebuild[9868:75242] Error Domain=IDEFoundationErrorDomain Code=1 "Cannot launch simulated executable: no file found at /Applications/Xcode.app/Contents/Developer/Xcode/DerivedData/WebDriverAgent-dikkwtrisltbeobjmfvpthwwekvs/Build/Products/Debug-iphonesimulator/WebDriverAgentRunner-Runner

Join the discussion →

Php Mysql Insert Array in columns [duplicate]

I have the follow problem: I have differents arrays, each array contain a list of items. I try to insert in database but each item of list result togheter. This is my code: (I use preg_replace to delete <br> between items) $codice = preg_replace('/(<br>)+$/', '', $_POST['jcitemcodice']); $prodotto = preg_replace('/(<br>)+$/', '', $_POST['jcitemname']); $quantita = preg_replace('/(<br>)+$/', '', $_POST['jcitemqty']); $prezzo = preg_replace('/(<br>)+$/', '', $_POST['jcitemprezzo']); $a1 = array("$codice","$prodotto","$quantita","$prezzo"); $res = implode("','" ,$a1); $sql = "INSERT INTO test (co

Join the discussion →

How to parse JSON in Kotlin

How can I parse JSON in Kotlin? It gets the entire array from JSON but can not get a particular object from the Array. It worked in Java but not in Kotlin. try { val jsonObject = JSONObject(result) val users = jsonObject.getJSONArray("Users") for (i in 0 until users.length()) { Toast.makeText(applicationContext,"Json Result is----"+result,Toast.LENGTH_LONG).show() val obj = users.getJSONObject(i) val name = obj.get("name").toString() Toast.makeText(applicationContext, "User name: "+name , Toast.LENGTH_LONG).show(); } }catch(e: JSONException){}

Join the discussion →

How to pass the value and get the value from another page via routerlink in angular4?

I want to pass a value with URL using routerLink and read that value on another page. Like I have Modules and Submodules. On select of first record the id of that record pass to User page. After read that Userid I want to show detail of that User and modules/submodules. So How can I pass and get the Values(object)? Userdetails Component class: import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'userdetail', templateUrl: './userdetail.component.html', styleUrls: ['./userdetail.component.css'] }) export class UserdetailComp

Join the discussion →

Tensorflow:UnimplementedError: Cast string to int32 is not supported

I am new to Tensorflow. Here is the code: def get_batch(image,label,new_height,new_width,batch_size,capacity): image=tf.cast(image,tf.string) label=tf.cast(image,tf.int32) input_queue= tf.train.slice_input_producer([image,label]) label=input_queue[1] image_contents=tf.read_file(input_queue[0]) image=tf.image.decode_jpeg(image_contents,channels=3) image=tf.image.resize_images(image,(new_height,new_width)) image=tf.image.per_image_standardization(image) image_batch,label_batch=tf.train.batch([image,label],batch_size=batch_size,capacity=capacity,num_threads=8) label_batch=tf.reshape(label_batch,[

Join the discussion →

Python Tensorflow:UnimplementedError: Cast string to int32 is not supported

everyone. I am new to Tensorflow When I wrote the code like this in this part : def get_batch(image,label,new_height,new_width,batch_size,capacity): image=tf.cast(image,tf.string) label=tf.cast(image,tf.int32) input_queue= tf.train.slice_input_producer([image,label]) label=input_queue[1] image_contents=tf.read_file(input_queue[0]) image=tf.image.decode_jpeg(image_contents,channels=3) image=tf.image.resize_images(image,(new_height,new_width)) image=tf.image.per_image_standardization(image) image_batch,label_batch=tf.train.batch([image,label],batch_size=batch_size,capacity=capacity,num_threads=8

Join the discussion →

What are Facebook Messenger audio message formats?

I'm using Facebook Messenger to send an audio file to my bot. The webhook call that Facebook sends me includes a URL, which is the audio file and when I download it it's in .mp4 format (weird, since it's supposed to be audio not video). I didn't find any documentation as to why it's .mp4, and whether there is the option to get a different format from Facebook. Anyone knows anything about this?

Join the discussion →

How to track unused resources in AWS?

I have been using AWS for a while now. I always have the difficulty tracking AWS resources and how they are interconnected. Obviously, I am using Terraform but still, there is always ad-hoc operations that cut down my visibility. Since I have been charged multiple times for resources/services that are present but not used by me. Unused services include resources that are not pointing to other services but present in the AWS environment. Tools suggestions are also welcome. Also, posted on DevOps. Posting here since there are fewer people there.

Join the discussion →

mysql crashing with "mysqld got signal 11"

I'm running application which reading and writing data with mysql database. I'm having both mysql ndbclustr and master master replication in same database. (bcoz of master master replication tables' engines are innodb, clustering won't replicate data of those tables.) I'm having 64GB RAM in each MYSQL server and there are 2 servers with same configurations Issue I'm getting is, when writing to tables after a few minutes of a time I'm getting 05:49:16 UTC - mysqld got signal 11 ; This could be because you hit a bug. It is also possible that this binary or one of the libraries it was linked agai

Join the discussion →

how to pass data to Angular ng-bootstrap modal for binding

Scenario: ChildComponent - having a lot ngModel binding elements. <input [(ngModel)]="TryToPassDataModel.name">; ParentComponent - btn.onClick = function() { this.bsModalRef = this.modalService.open(ChildComponent, TryToPassDataModel); } This works in ngx-bootstrap, but how to implement this in nb-bootstrap? (it looks like such a simple idea)

Join the discussion →

Making a form read-only for a certain user type

I have created a login form with a combo box for the user type (Admin, User) and a text box for the password. The code for the form is as follows. Private Sub txtPassword_AfterUpdate() If IsNull(Me.cboUser) Then MsgBox "You need to select a user!", vbCritical Me.cboUser.SetFocus Else If Me.txtPassword = Me.cboUser.Column(2) Then If Me.cboUser.Column(3) = True Then MsgBox "Password does not match, please re-enter!", vboOkOnly Me.txtPassword = Null Me.txtPassword.SetFocus End If DoCmd.OpenForm "FE1" Me.Visible = False Else MsgBox "Password does not match, please re-enter!", vboOkOnly Me.txtPassw

Join the discussion →

Laravel insert on DB not working by store request

I am having a problem on insert into DB with information coming from a blade form. The system is not sending to the DB and it doesn't actually through any sense error. It all seems ok and i cant find a possible mistake. Any clue on what might be happening? This is my controller: public function store(Request $request){ Task::create($request->all()); return redirect('/admin/task'); } This is my router, the problem might be coming from here, but just in case: Route::get('/admin/task/store', 'AdminTasksController@store')->name('admin/task/store');

Join the discussion →

Enable GeoLocation On Webview

Good Evening. I'm on making Tracking Application on Android using Webview. i got problem because the system all works well beside the location. in manifest i got this permission settings already <uses-permission android:name="android.permission.INTERNET"></uses-permission> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission> and in mainactivity.java i got this public class MainActivity extends AppCompatActivity { public WebView webView; @Override protected void onC

Join the discussion →

Automatically re-run failed only scenario in cucumber java+testng

How can I make only failed scenarios to be run again automatically on failure ? Here is some clue on what I am doing: Pass TestRunner class from command line through cucumber-testng.xml file at run-time. I am able to see rerun.txt file after scenario failed, with feature/GM/TK/payment.feature:71 (pointing to failed scenario) but failed scenario is not automatically re-run. The "TestRunner" java file @RunWith(Cucumber.class) @CucumberOptions(strict = true, features = { "src/test/resources/" }, //feature file location glue = { "com/test/stepdefs", "com.test.cucumber.hooks" }, //hooks and stepdef

Join the discussion →

Reality Check: Are these Honey Mouths and Thorn Shredders realistic?

On an hot planet at the wooded poles are two aliens species that coexist in a mutually beneficial relationship. The Honey Mouths use gecko-like feet to hang from the far larger Thorn Shredders, where they are protected from predators. They feed primarily on sap that leaks out from the damaged and uprooted trees that the Thorn Shredders leave in their wake as they feed. The gecko-like feet developed much earlier in the genus for climbing rocks and trees to escape predators. The Honey Mouths take in far more sap then they require for their sedentary life, converting much of it into a syrup which

Join the discussion →

Webpack dev server hot reloading not working with reactjs, though i have done "inline:true"?

Why does Hot Module Replacement stop working on webpack dev server? My package.json file: { "name": "routing-react", "version": "1.0.0", "description": "Just a little ReactJS Training Ground", "main": "index.js", "scripts": { "start": "npm run build", "test": "echo \"Error: no test specified\" && exit 1", "build": "webpack -d && cp src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot", "build:prod": "cp src/index.html dist/index.html && webpack -p" }, "keywords": [ "react" ], "author": "gd10", "license": "MIT", "dependencies": { "css-loader": "^0.28.9", "reac

Join the discussion →

Cucumber Report Missing report result - report was not successfully completed

I use Cucumber Reports plugin to get cucumber reports in pipeline jobs it works fine before but now i have this error: [CucumberReport] Preparing Cucumber Reports [CucumberReport] JSON report directory is "target/" [CucumberReport] Copied 1 json files from workspace "c:/jenkins/workspace/..." to reports directory "/var/jenkins_home/jobs/..." [CucumberReport] Copied 0 properties files from workspace "c:/jenkins/workspace/..." to reports directory "/var/jenkins_home/jobs/..." [CucumberReport] Processing 1 json files: [CucumberReport] /var/jenkins_home/jobs/.../cucumber.json [CucumberReport] Miss

Join the discussion →

Incluir en una consulta SQL un campo de otra tabla con una condición

estoy trabajando con SQLServer. Tengo la siguiente consulta sencilla: SELECT fec_emis,a.art_des, a.co_art FROM demo.dbo.art a INNER JOIN demo.dbo.reng_com r ON a.co_art=r.co_art INNER JOIN demo.dbo.compras c ON r.fact_num=c.fact_num Pero ahora necesito añadir un campo que está en otra tabla, este campo lo obtengo individualmente con la siguiente consulta: SELECT TOP 1 tasa_v,fecha FROM tasas WHERE co_mone='$' AND fecha<=GETDATE() ORDER BY fecha DESC Esta ultima consulta lo que hace es darme la tasa más reciente según una fecham que en este caso es la actual (GETDATE()), pero ahora necesito que

Join the discussion →

Laravel Eloquent query - Could not convert to int

I am trying to make build a query on Eloquent using pluck, but for some reason, the return message given to me is: Object of class Illuminate\Support\Collection could not be converted to int (View: /Applications/MAMP/htdocs/Housing_around/resources/views/admin/tasks/create.blade.php) Can someone give me a clue on what is happening? controller method: $house = House::findOrFail(Auth::user()->house->id); $obj = Model::pluck('name', 'id')->all(); $categories = Category::pluck('name', 'id')->all(); $users = User::where('house_id', $house)->pluck('name', 'id'); My view seems to be normal: <div clas

Join the discussion →

Apache camel SSL connection to restful service

I am busy with a project where I have to do a GET on an exposed rest service using specific certificates. I am using the apache camel framework with the https4 component. I created a keystore and tested it using soapUI and it connected successfully, but I am however unable to connect through my project. I used the following page as reference: http://camel.apache.org/http4.html I set up the SSL for the HTTP Client through the following configuration: <spring:sslContextParameters id="sslContextParameters"> <spring:keyManagers keyPassword="xxxx"> <spring:keyStore resource="classpath:certificates/

Join the discussion →

Conditionally hide status bar if app is in landscape mode

In Related question, app can hide the status bar with SystemChrome.setEnabledSystemUIOverlays([]); But if I surround that with a media query to detect orientation in the main app, it causes the app to error because there is no material ancestor widget. // app error if (MediaQuery.of(context).orientation == Orientation.landscape) { SystemChrome.setEnabledSystemUIOverlays([]); } Is there a way to conditionally hide the status bar in Flutter for the entire app, if the device rotates to landscape mode?

Join the discussion →

Sql server. The current transaction cannot be committed and cannot support operations that write to the log file

begin tran begin try select case when 1=0 then 0.0 else '' end --this will not work end try begin catch --error has occured. But it doesnt matter. We want to continue anyway end catch select 1 --do something else commit --unfortunatelly this producess error "The current transaction cannot be committed and cannot support operations that write to the log file" What can I do to commit transaction? I know, select case when 1=0 then 0.0 else '' end is incorrect. Thats why it is in try/catch block (in real situations this is query defined by administrator). But I want to commit the rest of operation

Join the discussion →

Attempt at SSIS Execution Throws Invalid object name 'SSISDB.catalog.customized_logging_levels'

I can run the SSIS package in SSMS 2014 if I set the build to SQL Server 2012, but attempting to run in SSMS 2017 v17.4 gives this error: An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) ADDITIONAL INFORMATION: Invalid object name 'SSISDB.catalog.customized_logging_levels'. (Microsoft SQL Server, Error: 208)" There is little info out there as to a fix.

Join the discussion →

Server side redirect with ReactJs

I am trying to issue a server side redirect for certain pages for SEO reasons. The problem I am trying to solve is that some of my pages will get index by google, so if they are deleted or taken offline we want to redirect them to a different page rather than showing 404. What is the best way to achieve such redirects with React Router on the server side(express.js)?

Join the discussion →
Older stories