DateTime bug between local machine and remote server - using JodaTime(java 1.8) - locale

I have some code running fine locally but i am getting an error when i run it remotely.
I am unable to debug remotely obviously - but from the error I know it has to with some DateTime Logic (belongs to my code).
I am looking for a comprehensive way to find what's different between my machine and this remote server - and that could affect DateTime logic.
I know Locale - 1/ is there a way to know what is affected by Locale?
2/ Any other local settings that could be different between a local machine and a server?
Thanks

I looked at the FirstDayOfWeek and MinimaldaysinFirstWeek
when I run the following code:
Calendar c1 = new GregorianCalendar();
System.out.println(Locale.getDefault() + ": " + c1.getFirstDayOfWeek() + " " + c1.getMinimalDaysInFirstWeek());
Locale.setDefault(Locale.getDefault());
Calendar c = new GregorianCalendar();
System.out.println(Locale.getDefault() + ": " + c.getFirstDayOfWeek() + " " + c.getMinimalDaysInFirstWeek());
I got the following output.... It makes no sense...
en_US: 2 4
en_US: 1 1

Related

Is there any way to configure emulator in Android Studio?

I am doing a project about Android forensics where I need to dump data from android devices so I am using emulator from android studio. using android version 8.1.0. I am following a repo from github here's the link;https://github.com/mspreitz/ADEL
In order to dump file the prerequisite is to add configuration in the xml folder sub directory named https://github.com/mspreitz/ADEL/blob/master/xml/phone_configs.xml
But I cant find any way to configure the emulator...
if anyone could enlighten me will appreciate a lot I have successfully ran the scripts but unable to dump database.the scripts runs ..the code to run '' python adel.py -d emulator-5554'''. I have tried it already but the problem here is the script is unable to dump database for instance: calendar data, contacts data, call logs though I have created these databases and stored it on the emulator when the scripts run it shows
" Calendar database doesn't exist"
" Contacts database doesn't exist"
" database doesn't exist" " mms/sms database doesn't exist"
The code for dumping the contacts database is given :
if float(os_version) < 2.0:
contactsdb_name = "contacts.db"
else:
contactsdb_name = "contacts2.db"
try:
contactsdb = subprocess.Popen(['adb', 'pull', '/data/data/com.android.providers.contacts/databases/' + contactsdb_name, backup_dir], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE)
contactsdb.wait()
_adel_log.log(contactsdb_name + " -> " +
contactsdb.communicate(0)[1].split("(")[1].split(
")")[0] + " -> " + hashlib.sha256(backup_dir +
"/contacts2.db").hexdigest(), 3)
hash_value.write(contactsdb_name + " -> " + hashlib.sha256(
backup_dir + "/" + contactsdb_name).hexdigest() + " \n")
except:
_adel_log.log( "dumpDBs: ----> contacts
database doesn't exist!", 2)
https://github.com/mspreitz/ADEL/blob/master/_dumpFiles.py this is the link of the full script.
If you config the device as
<phone device="emulator" model="sdk" os_version="8">
<smartphone_information>
...
</phone>
you should be able to use the emulator.
Otherwise post the specific error you are receiving.

Nodejs and mssql datetime input params

I'm having troubles querying a sql server function which requires two datetime params.
If I call it in the Sql managment studio it works but if I execute the SAME code in node it does not work.
I have tried so many ways of doing it but I can't make it work.
Tha mssql version I'm using is: "mssql": "^5.1.0"
The error I always get is:
Conversion failed when converting date and/or time from character string.
One of the sql query is:
SELECT * FROM dbo.Festadisticalb_2017(#inidate,#findate)
I have also tried with CONVERT and CAST without success.
I also tried:
queryreppedidos =
"DECLARE #inidate as date;" +
"SET #inidate = DATEADD(DAY, -500, GETDATE());" +
"DECLARE #findate as date;" +
"SET #findate = GetDate();" +
"SELECT TOP 10 fe.NumeroDocumento, fe.Cant_Pedida, fe.Descripcion, " +
"fe.Observacion, fe.Pedido_LB, fe.Referencia, fe.Responsable, " +
"fe.OC_Cliente, fe.Cliente, fe.Linea, fe.Valor_Pedido, fe.Transito_Total, " +
"fe.Orden_Fabrica, fe.Proveedor, fe.Importacion, " +
"fe.Stock, fe.Terceros, fe.Pendientes, fe.Transito, fe.PorComprar, fe.Estado, " +
"fe.Asesor FROM dbo.Festadisticalb_2017(#inidate,#findate) fe " +
"WHERE fe.Responsable = 'SRR';";
The thing is: How to correctly write the datetime input params in order to successfully query a function using mssql in nodejs?
Thanks for your support. Have a great day.

Query the Parameters of a Jenkins Job which is triggered using Rebuild Plugin?

I use the Jenkins CLI to create reports every week for the jobs over the week.
def deployOnK8sJob = Jenkins.instance.getItemByFullName('<JOB>')
def jobBuilds=deployOnK8sJob.getBuilds().byTimestamp(System.currentTimeMillis()-numberOfHoursBack*60*60*1000, System.currentTimeMillis())
println build.number + " " + build.actions[0].parameters[0].value + " " + build.actions[0].parameters[1].value + " " + build.timestamp.format("dd/MM/yyyy HH:mm:ss.SSS") + " " + build.result + " " + build.actions[0].parameters[3].value + " " + build.actions[0].parameters[4].value
This works fine for me. But if there was a build failure and anyone triggered the job again using the Rebuild Plugin, build.actions[0].parameters[x] are not available.
I have a groovy script that collects these reports.
I think that when using the Rebuild Plugin, build.actions[0].parameters[x] are not available because in this case build.actions[0] is not from class ParametersAction but from class CauseAction as the exception you get says.
So, I would recommend to use build.getAction(ParametersAction.class) in stead of build.actions[0].

Want to run several db.query() method in parallel without getting any error

I am using Node JS . I am a beginner. I use OrientJS to connect orientdb from Node JS. I want to run several db.query() method in parallel. This queries are formed by reading a large text file using line-by-line module.
For example,
var queryForGeoUpdate = 'update (' +
'\nselect from (' +
"\n select expand(outE('GeoAgentSummary')) " +
'\n from Agent ' +
'\n where name = "' + name + '" and number = \'' + number + "' and type = '" + type + "'" +
"\n) where in.name = '" + Geo + "'" +
'\n) increment _' + FiscalYear + ' = ' + TMSSalesAllocatedBookingsNet + 'f, _' +
FiscalPeriodID + ' = ' + TMSSalesAllocatedBookingsNet +
'f, _' + FiscalQuarterID + ' = ' + TMSSalesAllocatedBookingsNet + 'f'
// console.log(queryForGeoUpdate)
db.query(queryForGeoUpdate) // query and db call for Country ends here
like db.query(queryForGeoUpdate) there are seven queries like db.query(queryForRegionUpdate) and so on...
if I run it asynchronously "process out of memory occurrs". If I run it synchronously it takes too much time. How can I solve it within very less time..
Any help is appreciated..
I am not familiar with the DB you are using. If you are sure the DB works "correctly" and the calls you make are correct (e.g. if there isn't a way to make you queries much smaller) you could try running with:
node --max_old_space_size="memmory in MB, try something large like 8192" app.js
It seems rather strange that a DB query would run out of memory thought... I always assumed queries are, generally speaking,a lot more CPU intensive and require relatively little memory.
For these sort of large queries you might also try spawning separate processes:
https://nodejs.org/api/child_process.html

RDP to call an EXE file, not the whole desktop

I have used this code to implement RDP.
This works fine but now I want to implement a system , that will call a particular EXE file from the server. Not the whole desktop.
Any idea how can I implement this?
Process rdcProcess = new Process();
rdcProcess.StartInfo.FileName = Environment.ExpandEnvironmentVariables(#"%SystemRoot%\system32\cmdkey.exe");
rdcProcess.StartInfo.Arguments = "/generic:TERMSRV/192.168.0.16 /user:" +Saltlake1" + " /pass:" + "saltlake#1234";
rdcProcess.Start();
rdcProcess.StartInfo.FileName = Environment.ExpandEnvironmentVariables(#"%SystemRoot%\system32\mstsc.exe");
rdcProcess.StartInfo.Arguments = "/v " + "192.168.0.16";
rdcProcess.Start();

Resources