Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I'm trying to implement a RPC server in Go using Hprose. It worked fine but then after adding some more functions it didn't :/
Funny thing is that it doesn't work even on other http libraries such as fasthttp. The ListenAndServe() method just seems to be stuck somewhere during execution as it never returns. What might be causing this?
package main
import (
"net/http"
"fmt"
"github.com/hprose/hprose-golang/rpc"
log "logutil"
)
func main() {
log.InitializeLogger()
InitializeEthClient()
InitializeClients()
server := rpc.NewHTTPService()
// TxtStorage functions
server.AddFunction("DeployTxtStorage", DeployNewTxtStorage)
server.AddFunction("GetPackedData", GetPackedData)
server.AddFunction("GetReputation", GetReputation)
server.AddFunction("GetEventsForReputation", GetEventsForReputation)
server.AddFunction("GetEventsForData", GetEventsForData)
// Clients functions
server.AddFunction("RegisterClient", RegisterClient)
log.Info("Registered server functions!")
err := http.ListenAndServe(":8080", server)
fmt.Println(err)
log.Info("Waiting for incoming connections...")
log.WriteAway()
}
ListenAndServe is blocking, it won't return unless it hits an error. You seem to be expecting your final lines to print out
Waiting for incoming connections...
But that will never happen as the server is running. Are you sure it isn't just working as expected?
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 days ago.
Improve this question
I have a Google Cloud Function scheduled to run every day at 00:10 AM, but today the function runned 10 times. I'm using the same approach for more than a year and its the first time this happened. Has someone had the same problem today?
Function
Function log
I'm just concerned about the problem.
Edit:
Thanks for all the comments here. I think its a new "bug" or just a new characteristic of pubsub schedule. In my configs its already. My function was created as bellow:
exports.processarIndicadoresDiaMoldtool = functions.runWith({ memory: '4GB', timeoutSeconds: 540 }).pubsub.schedule('10 0 * * *')
.timeZone('America/Sao_Paulo')
My Pub/Sub retry config are set to 0:
Today the same thing happened in another cloud scheduled function =/
My solution so far was to try make my function idempotent. I ve creat a log in my firestore database to verify when the function was already runned.
//this.nome = function's name
//this.dia = last day the function has runned - I saw some solutions with eventId too
async getFuncaoProcessada() {
const docFuncao = await db.collection("Processamentos")
.doc(this.nome).get();
if(docFuncao.exists){
let dadosFuncao = docFuncao.data();
if(dadosFuncao.dia == this.dia){
return true;
}
}
return false;
}
Thanks a lot for the help.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 months ago.
Improve this question
I am using Insight.Database version 6.3.10 for SQL Server ORM, using C# as the client. I have a run into an issue where the mapping does not return a correct value for money column data type. I am using decimal in C# client. Below is the sample code:
DROP TABLE IF EXISTS dbo.MyTestTable;
CREATE TABLE dbo.MyTestTable
(
AmountToAllocate MONEY
)
GO
INSERT INTO dbo.MyTestTable VALUES(177279.73)
GO
CREATE OR ALTER PROC [dbo].[MyTestProc]
AS
BEGIN
SELECT TOP 1 m.AmountToAllocate FROM dbo.MyTestTable m
END
GO
I have an object in C# client:
public class MyTestResponse
{
public decimal AmountToAllocate { get; set; }
}
Now, if I execute the store proc with Insight.Database, the returned object has AmountToAllocate property, but its value is 0, instead of 177279.73.
I have no idea what went wrong, and why the mapping does not work properly.
Does anyone know how to resolve it? Thank you
Despite you solving your own problem, for reference for anyone else in the future, you can find all of the SQL Server data type mappings in C# in SQL Server Data Type Mappings.
Money maps to Decimal.
I am trying to make some further adjustments to an address text field. But the problem is that its made with airtable. I want to get the input of that address and use it to get some data from zillow API for the user. How can I do this? I have viewed the source HTML and I only see the airtable script.
This probably went unanswered for being too vague. I'll try to leave some pointers if anyone stumbles upon this in the future.
Are you the host of the WP page? do you have access to the Airtable base in question? Is the "frontend" viewable? Airtable's API is pretty well-documented, simple as it may be. Whatever you need, if it's from a shared view, it can be fetched with a curl request.
Other than that,if the base is public, or shared publicly, and particularly if you need this data at a steady rate or in larger quantities, you'd be better off requesting access and collecting the information with a script from the Scripting app. Since ES6, this is as trivial as doing something like
let query = await base.getTable
(cursor.activeTableId)
.selectRecordsAsync()
let payload, selectAll = query.records.map(rec => rec.name),
selectAll ?
payload = { records: JSON.stringify(selectAll) }
: console.error('something went wrong')
remoteFetchAsync(('your scraping endpoint', payload)=>
//rock'n'roll past this point
})
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
Hi guys how can I request all the data form this kind of DB structure?
I tried this but it's not working:
var recentPostsRef = firebase.database().ref('/store');
You are on the right track, but missing the retrieval part where .then() is used with a callback:
var recentPostsRef = firebase.database().ref('/store');
recentPostsRef.once('value').then(snapshot => {
// snapshot.val() is the dictionary with all your keys/values from the '/store' path
this.setState({ stores: snapshot.val() })
})
The firebase.database.Reference documentation has a lot of good examples and explanations that can help.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 6 years ago.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Improve this question
I have around 100 rows in MS Access, each row includes an attachment. Using RODBC in R I can access the table but have no idea how to access attached files and download them in R
could you plz help me how to do it
Attachments in MS Access are special data types that actually involve nested tables for metadata (filename and filedata) information. Hence, you cannot access this data with DML SQL statements alone via RODBC but can using a COM interface, specifically connecting to the DAO SaveToFile() method.
Consider the following using the RDCOMClient package which allows interfacing to the Access Object Library. Do note: in order to run the below code, you must have MSAccess.exe (the MS Office GUI program) installed and not just the .accdb file. In the SQL query below, ColAttach is the name of the attachment field in your table and you must use those qualifiers .filedata and .filename. DAO recordset field numbers are zero based (hence the 0 and 1).
library(RDCOMClient)
# INITIALIZING OBJECTS
accApp <- COMCreate("Access.Application")
accApp$OpenCurrentDatabase("C:\\Path\\To\\Database.accdb")
docmd <- accApp[["DoCmd"]]
db <- accApp$CurrentDb()
rst <- db$OpenRecordset("SELECT ColAttach.filedata, ColAttach.filename FROM TblAttach")
while(rst$EOF() == FALSE){
rst$Fields(0)$SaveToFile(paste0("C:\\Path\\To\\Output_", rst$Fields(1)$Value()))
rst$MoveNext()
}
# CLOSING OBJECTS
rst$close()
docmd$CloseDatabase()
accApp$Quit()
# RELEASING RESOURCES
accApp <- db <- docmd <- rst <- NULL
rm(rst, db, accApp)
gc()
For multiple attachments, loop through the child recordset on each filename and filedata values (notice the different SQL). Be sure to check if file exists and destroy accordingly else you will receive a COM error:
rst <- db$OpenRecordset("SELECT ID, ColAttach FROM TblAttach")
while(rst$EOF() == FALSE){
childRS <- rst[['ColAttach']]$Value()
while(childRS$EOF() == FALSE){
if (file.exists(paste0("C:\\Path\\To\\Output_", childRS[["filename"]]$Value()))) {
unlink(paste0("C:\\Path\\To\\Output_", childRS[["filename"]]$Value()))
}
childRS[["filedata"]]$SaveToFile(paste0("C:\\Path\\To\\Output_",
childRS[["filename"]]$Value()))
childRS$MoveNext()
}
rst$MoveNext()
}