Sam Sam

14492 questions
1

votes
2

answer
1.9k

views

Create a nnModule that's just the identity

I'm trying to debug a pretty complex interaction between different nnModules. It would be very helpful for me to be able to replace one of them with just an identity network for debugging purposes. For example: net_a = NetworkA() net_b = NetworkB() net_c = NetworkC() input = Autograd.Variable(torch....
Sam Bobel
1

votes
2

answer
334

views

get the Alarm object of CloudWatch using boto 2

I created an alarm and want to delete it afterward... The documentation for boto 2 doesn't show how to do that. Any help ? Thanks
Sam Gomari
1

votes
1

answer
1.3k

views

access golang struct field with variable

For reference: example here I am trying to access a struct field using a variable key, to explain in PHP you can do the below. $arr = ['test' => 'foo']; $key = 'test'; $result = $arr[$key]; Or in Javascript you can do the below const obj = {'test': 'foo'} const key = 'test' const result = obj[key] I...
Sam White
1

votes
1

answer
530

views

The import org.springframework cannot be resolved - Java(268435846)

I'm trying to use the Spring Framework in my project, but I have a problem with the import. I'm working with Gradle for builds, React JS for the front end and Java for the back end. The weird thing is that I can use classes as RowMapper and JdbcTemplate (I can read and write in my database using t...
Sam Mahaux
1

votes
2

answer
75

views

How do I correctly launch Kotlin coroutines to implement a Caffeine AsyncLoadingCache?

I have a Kotlin JVM server application using coroutines and I need to put a cache in front of a non-blocking network call. I figure I can use a Caffeine AsyncLoadingCache to get the non-blocking cache behaviour I need. The AsyncCacheLoader interface I would need to implement uses CompletableFuture....
Sam
1

votes
1

answer
51

views

Understanding the OpenGL projection matrix

I've been writing a program to display 3d models using OpenGL and until now I've used orthographic projection, but I want to switch to a perspective projection so that as the camera goes toward the model it appears to get larger. I understand that I have to multiply three matrices (model, view, and...
sam
1

votes
1

answer
57

views

How can I add multiple textures to my openGL program?

I am writing an openGL program and have multiple models drawn into the environment, but I don't know how to apply different textures to each of those models, so for now they all have the same texture. I've read that I need to add multiple texture units into the program or use a texture atlas. A text...
sam
0

votes
0

answer
4

views

Workaround For AWS CodePipeline Source Action Not Allowing Git Submodules

We have 27 independent micro-service repositories in Github with always the potential to add more. I am working on a re-write of the current deployment process which uses Jenkins to use AWS CodePipeline with a Pull Request driven approach. I was 'hoping' that I could add the CI repo as a git submodu...
Sam Hammamy
1

votes
2

answer
398

views

More efficient to check if a variable is set, then set it, or just constantly set it?

Making a game... More efficient to do this? if (37 in keysDown) { //left arrow if (sprite.state != 'left') sprite.state = 'left'; } or this? if (37 in keysDown) { //left arrow sprite.state = 'left'; } This is being called in my game's update function (constantly, as fast as possible). Sidenote: her...
Sam
1

votes
2

answer
827

views

Pygame: Set alpha level for shapes

How would I go about setting the alpha value of a pygame shape: pygame.draw.circle() I tried using an RGBA value, but to no avail.. here is the draw code: pygame.draw.circle(screen, ((0,255,0,alpha)), (px,py), 15) px and py are the player's (circle's) position. alpha is just a place holder for what...
Sam Tubb
0

votes
0

answer
4

views

500 (Internal Server Error) with Django-React and Heroku

On my local host, I have full crud functioning. When I deployed to Heroku, my site runs and everything, but I cannot add anything, and therefore cannot edit, update, or delete. I get the errors: Manifest: Line: 1, column: 1, Unexpected token. manifest.json:1 POST https://the-app-name.herokuapp.com/a...
Sam Schaefer
0

votes
0

answer
7

views

Clearing the terminal in vs code without using ctrl C

I want to know how do I clear up my terminal in Vs code without using Ctrl C and restarting my how program?
TheWorldOf_ Sam
1

votes
1

answer
775

views

Case-sensitive character replacement in a Swift string

I need to replace characters in a Swift string case-sensitively. I've been using the replacingOccurrences(of:with:options:range:) built-in string function to change every 'a' to a '/a/', every 'b' to a '/b/', and so on, like this: stringConverted = stringConverted.replacingOccurrences(of: 'a', with:...
Sam
1

votes
1

answer
30

views

MySql - delete same field inside multiple tables

I need to delete student elements from two tables where the stu_id are the same. I followed this link DELETE s_ezber, s_yem_tem FROM s_ezber INNER JOIN s_yem_tem ON s_ezber.stu_id = s_yem_tem.stu_id WHERE s_ezber.stu_id =1901 (s_yem_tem.stu_id ) However that is not working correctly. The proble...
Sam
1

votes
1

answer
960

views

How to pass this.state value in custom navigationOptions on React-Native

I'm new to React-Native and I'm trying to figure out using React-Native Navigation how to pass values inside my custom header Here's what my Component A looks like with the CustomHeader constructor(props) { super(props); this.state = { sortId: 4 } } componentDidMount() { this.props.navigation...
Sam Bellerose
1

votes
2

answer
687

views

Differences between Reactive Programming and Message Queue

I'm busy with Reactive concept these days. I have understood two separate concepts as Reactive System and Reactive Programming. In addition, I know Reactive System is a larger concept which contains four properties: Responsive Resilient Scalable Event-Driven The Image Reference: medium.com My proble...
Sam
1

votes
1

answer
884

views

Can't get rid of missing manifest.json error

I'm building an ASP.NET Core app with ReactJs front-end in Visual Studio 2017. Recently, I started to notice the missing manifest.json error in the console -- see below. It doesn't seem to effect my app but I do want to get rid of this error. If I view my app in Edge, I don't see the missing manifes...
Sam
1

votes
1

answer
52

views

how can I load into memory a src file in crystal?

The request is very straightforward: To load a file that is in my internal project src/ directory into memory. Finally, print its content to the screen. Any help, please? If we use File.new('path/to/file') it opens a file in the local file system, so that's not what I'm searching for. Greetings.
Sam
1

votes
1

answer
86

views

Snake game: How to increase the length of a snake body based on the amount of food eaten?

I'm trying to recreate the snake game where the snake eats food and the body increases by 1 unit. However I've tried multiple times to increase the length of the body, but nothing has been working the way I want it to. I tried to create another breed of turtles called 'tails' and hatch it behind the...
Sam
1

votes
3

answer
65

views

SQL Date interval not working with AND clause

I am trying to count views in time interval. The request below works only without the AND clause If I take out the AND s.timestamp < 2019-01-31 it works just fine. SELECT s.category_id, c.name, count(s.category_id) AS ViewCount FROM stat_product_category s JOIN category c ON s.category_id = c.id...
Sam
1

votes
3

answer
35

views

Error With Cursor When Loading Details From Database

I'm currently working through a school project, trying to create a Scout Group manager. This is my first time using Java, XML or Android Studio, so progress has been a little slow, but I'm getting there. The issue I'm having at the moment is with extracting Scout details from a database, in order...
Sam Og
1

votes
2

answer
89

views

flutter StaggeredGridView show tiles on condition

I am using StaggeredGridView in one of my Flutter project. I wanted to not load few tiles depending on the data availability. For example. I am showing 5 tiles out of which 3 are dependent on the data available from network. Sometimes it may take 10 to 15 seconds. Right now if I return a Container()...
Sam
1

votes
3

answer
40

views

Python: Json.load gives list and can't parse data from it

I have a data.json file, which looks like this: ['{\'Day\':\'Today\',\'Event\':\'1\', \'Date\':\'2019-03-20\'}'] I am trying to get 'Event' from this file using python and miserably failing at this. with open('data.json', 'r') as json_file: data = json.load(json_file) print (data['Event']) I get the...
Sam
1

votes
0

answer
3

views

Using AWS API Gateway+Lambda Without It becoming a Dependency

There's no doubt to the benefits of API Gatway+Lambda for a micro-services. My concern is what would happen if we decide to move off API Gateway+Lambda to ECS/Fargate, or even another Cloud. There seems to be a consensus on using one Lambda function per route/action. I have some theories about how t...
Sam Hammamy
0

votes
0

answer
6

views

Flutter signing app with same key.jks not working

I developed my Flutter Android application on Windows 10 and released it internally on Google Play. Now I switched from Windows 10 to Mac and trying to update my Google Play app but getting the follwing error. You uploaded an APK that is not signed with the upload certificate. You must use the same...
Sam
1

votes
1

answer
107

views

Bit shifting fails after the 20th time (Solidity)

my goal is to bit shift a maxed uint256 so that zeros are iteratively added to the right side: ...1111111111111... becomes ...1111111111000... I the use the new shifted position as a mask. After about 20 something iterations my code stops working properly. Does anyone have any insight on the matt...
Sam Sendelbach
1

votes
1

answer
1.4k

views

'CXXABI_1.3.11' not found`

I can't get a cross compiled build running on my Raspberry Pi 1 B+. The error I keep getting is: ImportError: /usr/lib/arm-linux-gnueabihf/libstdc++.so.6: version 'CXXABI_1.3.11' not found. I tried multiple compilers with different settings but I keep getting the same error. Also changing the LD_LI...
Sam
1

votes
1

answer
507

views

Combine ASP.NET MVC and Web API projects using identity

I am new to ASP.NET and I have to create an ASP.NET MVC project using the identity framework for authentication and authorization, but the access to the database (SQL Server) must be done in an independent web service project so I created a Web API project with also identity containing all services...
sam
1

votes
0

answer
14

views

How to check if two strings are equal recursively in Python? If equal, return 1, otherwise, return 0

def compare(s1, s2): if s1 == '' and s2 == '': return 1 if len(s1) != len(s2): return 0 if s1 !='' and s2 == '': return 1 else: compare(s1.strip(s2[0]), s2.strip(s1[0]))
Sam Tang
1

votes
0

answer
40

views

Incorrect hex addition on memory mapped address and offsets in C++

Let's start with what I am able to get working and then what is not working, and then hopefully the community can help me figure out why. Let's say I have the following class: #define BASE 0x20200000 /* base GPIO address in memory mapped IO*/ #define GPSET0 0x1c /* Pin Output Set */...
Sam Hammamy
1

votes
1

answer
64

views

Unable to check in project into VSTS Repository

I'm trying to check in an existing project into a fresh new repository on VSTS. I've connected to the repository in Team Services. When I right click my solution and select Add Solution to Source Control, I get the following errors. After that nothing happens. Any idea how to fix this?
Sam
1

votes
0

answer
72

views

How TF-IDF handles missing values?

I am working on a classification problem in which I have to classify product category based on the information of the product like title, description and other attributes. It is working for different categories but getting biased in closed categories like mobile and mobile accessories. Let's say I h...
Sam
1

votes
1

answer
670

views

Angular2 ng2 smart table sorting as numeric

I have implemented the ng2 smart table grid for listing https://akveo.github.io/ng2-smart-table/#/documentation Here I want to integrate the sorting for 2 columns. For this I used the code storeid: { title: 'Store #', sort: true }, But this is not numeric sorting. It sorts as 1,10,11... instead of 1...
Sam Hanson
1

votes
1

answer
363

views

Spring boot oauth2 auth server sessions

I'm attempting to understand how spring boot uses http sessions to manage the oauth authorization code flow. I understand that after the user submits their credentials via the /login form spring will persist the authentication object so it can be retrieved when the browser is redirected to retrieve...
Sam
1

votes
2

answer
320

views

Where to get JWT token in React/Redux app

I need to grab from my backend a JWT token as early as possible. Where's the right place to make my API call from so that I handle this early in the life cycle of my React/Readux app?
Sam
1

votes
0

answer
33

views

AJAX function putting post in URL, rather than to page

I've got a dropdown, which when selected, should then go query the DB and get a report back. When the user selects the option from the dropdown, it should dynamically change the field without reloading the page. However, it does seem to reload the page, and the $_POST data is inserted and visible in...
Sam McLean
1

votes
0

answer
47

views

If any disabled dates between start date and end date, alert user about booking not possible

I have a booking page. eg, The booking start on 2018-01-10 and end on 2018-01-20. If some date 2018-01-15 and 2018-01-16 are disabled so how can we inform user 'there is some disabled dates in between 2018-01-10 and 2018-01-20 so bookings not possible'. or Not clickable end date. $('#dateFrom')....
sam sam
1

votes
0

answer
158

views

Using Google Login with Cognito Identity Pool to Authorize Lambda HTTP Requests

I'm sure someone must have gone through scenario; however, I have not been able to find some documentation/samples covering it. What I'm attempting to do Expose several REST endpoints using Lambda (severless), so this is a registered api with the api gateway Some of these endpoints require a user au...
Sam
1

votes
2

answer
47

views

How can I take specific data from an API and export it without writing the data to a file?

I'm new to Python and using APIs and would love some help! Using the URL: http://api.worldbank.org/v2/countries?format=xml I want to gather each country's 'iso2Code' and 'name'. I want to be able to output the data in a cleaner XML file format or an array (but would love the knowledge on how to do b...
Sam Green
1

votes
0

answer
39

views

TortoiseGit client User info

I am using TortoiseGit 2.3.0.0 on Windows 7 and GitHub enterprise. The repository is created on GitHub server which is accessible from the TortoiseGit client. The GitHub repository is created as private for limited User access. The issue I'm facing is, from the TortoiseGit Settings/Git/Edit global ....
Sam

View additional