[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x

Programming

53K

Solutions

40K

Contributors

Programming includes both the specifics of the language you’re using, like Visual Basic, .NET, Java and others, but also the best practices in user experience and interfaces and the management of projects, version control and development. Other programming topics are related to web and cloud development and system and hardware programming.

Share tech news, updates, or what's on your mind.

Sign up to Post

I'll need a Shell (Bash) script (rather an exact command) that outputs

a)  files' name in the Solaris system, one file per line in the UNIX systems
b) that were modified/created the last 1470 minutes
c) exclude FIFO files, symbolic links, sockets (ie *.sock)
d) names of files of between 1 byte to 20MB in size
e) files in /dev, /devices, /kernel, /cdrom, /platform, /proc, /net
f) files mounted on NFS

I have about 1million files so hoping the command/script of outputting
the file can complete in 30mins, so may need efficient coding.


I need to amend the following script to read (ie for AV to scan) the above output file:

#!/bin/bash
LOGFILE="/var/log/clamav/`hostname`-$(date +'%Y-%m-%d').log";
## suggest to change dirs below to root but exclude databases
DIRTOSCAN="/var /opt /home /etc /tmp /export";

for S in ${DIRTOSCAN}; do
DIRSIZE=$(du -sh "$S" |grep -v "/proc" |grep -v "/dev" |grep -v ...  /2>/dev/null | cut -f1);
## add to grep -v for any other file types to exclude

echo "Starting a daily scan of "$S" directory.
Amount of data to be scanned is "$DIRSIZE".";

clamscan -ri "$S" >> "$LOGFILE";
0
Big Business Goals? Which KPIs Will Help You
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

I am studying programming with Win32 API. I am confused about what window and viewport are.

I look forward to your help. If i get an illustrations or links to an explicit explanation of this GDI concepts I will be happy.
0
try{
			
			previouslyTaken = new DataDAO().testForPkgPreviouslyTaken(this....., TimeStamp);//gives true or false boolean value
		}
		catch (XYZExceptionException xyze)
		{
			if(xyze.getMessage().contains("999"))
			{
				LOGGER.error("item is PreviouslyTaken due to aa", xyze);
				errorCodes.add(XYZConstants.PREVIOUS_TAKEN_EXISTS);				
			}
			else if(xyze.getMessage().contains("888"))
			{
				LOGGER.error("item is PreviouslyDumped due to bb", xyze);
				errorCodes.add(XYZConstants.PREVIOUSLY_DUMPED);
			}
			else
			{
				throw new XYZException(xyze);
			}	
			return ;
		}
		LOGGER.info("previouslyTaken indicator from DB {}",previouslyTaken); //coming false t me
		
		if(!previouslyTaken){
		processIt();
		else
		LOGGER.info("item taken or dumped so update status to new)

Open in new window


i have above code in a method.

i never saw if else inside a catch in earlier.

why some one use if else inside catch
when the catch is thrown as try block simply return true or false

when it has 999 or 888 etc value in the xyze exception

please advise
0
Hi,

I am working on an iOS application (in nativescript) that needs to get and post some data to an API in the background each 5 minutes. Now it seems that iOS is closing my application so I took a look at the long running tasks section of https://docs.nativescript.org/core-concepts/ios-runtime/how-to/BackgroundExecution but I fail to see how I should configure an interval now.

Also while it works correctly on the simulator (not thinking about the interval) with the debug fetch command, I can't get it to work correctly on a real device.
0
I tried jsp custom tag example.

custom tag color is not changing even though i changed to blue or some other color it still shows default color as attached.

Index.jsp is

<%--
    Document   : index
    Created on : Nov 6, 2018, 1:41:41 PM
    Author     : saiganesh
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="mytags" uri="/WEB-INF/tlds/my_tags" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>JSP Page</title>
    </head>
    <body>
        <mytags:formattag colour="blue" font_size="50" is_uppercase="false">
            this is ext hello custom tag
            </mytags:formattag>
    </body>
</html>



my_tags.tld is

<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.1" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd">
  <tlib-version>1.0</tlib-version>
  <short-name>my_tags</short-name>
  <uri>/WEB-INF/tlds/my_tags</uri>
 
  <tag>
      <name>formattag</name>
      <tag-class>tags.FormatTag</tag-class>
      <body-content>scriptless</body-content>
      <attribute>
          <name>colour </name>
          <required>true</required>
      </attribute>
        <attribute>
          <name>font_size </name>
          <required>true</required>
      …
0
I have this bit of C Code for a project I working on for a project.  
logit("Username: %s Password: %s", authctxt->user, password);

Open in new window

This is going to be used in a proof of concept project and I want to obscure the real password.  I was thinking of either replacing the whole password with a set of characters or maybe keeping the first and last two characters and replacing the rest with a set of characters.  Maybe Xs.   Looking for suggested modification.
0
Hi,

Ps advice how to syn with my local-repo to the gitlab repo with error. Tks.

giblab_error1.jpg
Keep loading non-stop
giblab_error2.jpg
0
I have a public API endpoint that I am pulling a json file every 30 mins. Right now I am using a python pandas dataframe to pull and upload the file to a cloud storage bucket and then sending to pub sub to process and place into BQ. The problem with this is that the file name stays the same and even though I have  gcs text stream to pub sub if it reads the file once it never reads it again even though the file attributes have changed. My question here is can any one help me with code that will pull from an api web link and stream the data directly to pub sub?

Sample code below:
import json
import pandas as pd
from sodapy import Socrata
from io import StringIO
import datalab.storage as gcs
from google.oauth2 import service_account

client = Socrata("sample.org", None)
results = client.get("xxx")

# Convert to pandas DataFrame
results_df = pd.DataFrame.from_records(results, columns =['segmentid','street','_direction','_fromst','_tost','_length','_strheading','_comments','start_lon','_lif_lat','lit_lon','_lit_lat','_traffic','_last_updt'])
# send results to GCP
gcs.Bucket('test-temp').item('data.json').write_to(results_df.to_json(orient='records', lines=True),'text/json')
0
HI Team,

Project :
MS VS ASP.Net MVC

I am looking for chart control which full fill below requirement.

I have to generate chart control with binding data from ms sql server database tables and with this generated chart need to save in database table with good quality of image so i can use in some annual reports pdf documents.

i have used Kendo UI line chart control have the option to save as either SVG or canvas. I switched it to canvas, which may have improved performance but the image, when retrieved from the database, was of lower quality and performance is very slow to generate for all my 700 companies chart.so i have chosen 50 companies per page to render then save in db and repeating same process until it reaches end of all companies but still performance and quality is not as good and sometime we observed some charts are drawn with empty data or half of data loaded and saving in db, this happens randomly and unable to figureout what problem is......

control i used as below:
https://demos.telerik.com/aspnet-mvc/line-charts

and The ASP.NET MVC version is just a wrapper around Kendo UI for jQuery
https://demos.telerik.com/kendo-ui/line-charts/index

so i am looking for any other chart control which can do my job as draw chart from binding data from tables and save chart images into table with good quality and good performance or how can i improve here

Please,I need your suggestion on this.
0
MQ under glassfish called imqdbroker not running when i double click on windows laptop.
path is
C:\Program Files\glassfish-4.0\mq\bin
i am not able to open default hosts under jms host to see that same mq that is supposed to be started
Please advise
MQ_glasfish.png
MQ_glasfish_2.png
0
Exploring ASP.NET Core: Fundamentals
LVL 12
Exploring ASP.NET Core: Fundamentals

Learn to build web apps and services, IoT apps, and mobile backends by covering the fundamentals of ASP.NET Core and  exploring the core foundations for app libraries.

hi,

I build one stateless session bean example with presentation tier html inddex page and web tier servlet within ejb web project then business tier in the ejb project


<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <title>TODO supply a title</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    </head>
    <body>
        <form action="ConverterServlet" method="POST">
              <input type="number" name="value"></br>
              <select name="type">
                    <option value="C2F">celcius to fahrenheit</option>
                    <option value="F2C">fahrenheit  to celcius</option>
              </select></br>
              <input type="submit" value="Convert">
        </form>
            
    </body>
</html>

Open in new window


do i not need to add close tags for input html element
<input type="submit" value="Convert">

also do i not need to ad begin tag for </br>

please advise

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package servlet;

import bean.ConverterBeanLocal;
import bean.ConverterBeanLocal.ConvertType;
import java.io.IOException;
import java.io.PrintWriter;

Open in new window

0
well  how can I decode the emails  so i can get plain text?

import poplib;

import io;

import string;

import encodings;

try:

 server = poplib.POP3_SSL("pop.gmail.com",poplib.POP3_SSL_PORT);

   

except:

 print("Error");



response = server.user('XXXXXXXX@gmail.com');

response1 =  server.pass_('XXXXXXXX');

print(response);

print(response1);



# download the first message in the list


messages = server.list();

print(messages);
   

























  

Open in new window


help appreciated
0
one registerPhone flow goes through 30 stored procedures. Each stored proc connecting database individually and taking 100 milli seconds to connect.

so 30 multipled by 100 total 3000 milli seconds wasted due to this.

can i make all 30 stored procedures into one call so that only one database connection happens for 100 milli seconds

Like to save those 3000 milli seconds when i can do only with 100 milli seconds

Please advise
0
hi, i can get postman to POST to create a VM but using pycharm encountered this error.

code 1: obtain a token
==========================================================================
import requests
url = "https://IP/silvan/apigateway/v1.0/"
get_apis = "apis_include_throttles"

##API URLs
get_token_url = "https://iam-apigateway-proxy.domain.com/v3/auth/tokens"

create_volume_url = "https://evs.sitc-1.domain.com/v2/6d321dd88c7143ba8d6daf3e15f14be9/volumes"
delete_volume_url = "https://evs.stic-1.domain.com/v2/6d321dd88c7143ba8d6daf3e15f14be9/volumes/"
create_vm_url = "https://ecs.sitc-1.domain.com/v2/6d321dd88c7143ba8d6daf3e15f14be9/servers"



##Images Dictionary
images = {
    "Ubuntu 18.10": "5313ace4-4573-404b-abc6-8548ed14c4f7",
    "RHEL7.5-40G": "aa9d05f3-cb90-4776-9c02-617a9906b271",
    "WindowsServer2016WithGUI": "c54d05fa-5ad8-425e-be56-e60ede395230",
    "Windows10Pro": "29caef55-0617-4813-8a17-cb0bef19de16",
    "RHEL7.5": "c5ccd8a7-d8f3-4a4c-91c3-9d93303aee58",
    "Ubuntu16.04LTS": "3f8948fd-c108-48db-9951-1d617e8e5b03",
    "image-kvm-euler": "298e2912-5a7a-4178-8ac4-b260712d514c",
    "image-ManageOne": "80d9b0ee-a5b3-42fe-99ed-fc32c57da5b3",
    "esight_image": "e1e94234-f3e7-4793-8bdb-0cef9e3194cf"
}


def get_token():
    body = {
        "auth": {
            "identity": {
                "methods": [
                    "password"
                ],
                "password": {
                    "user": {
    …
0
Hello

I am new to the arduino and have just about finished the tutorials that come with the start up set.

I'm now trying to dig a bt deeper into what is going on and I have the following 2 questions

1) how can you tell what libraries a sketch uses as they aren't listed at the top with an include statement
2) Once you've found the libraries how can you view them'? I presume you can open them in notepad but is there a way of finding the libraries used and viewing them in the actual arduino ide

I apologise if this could be found by an internet search but i have n internet connection that is cutting out and only just let me load this page.

Many thanks
0
How to read particular text (like empno,name,salary,etx) from scanned or image file and store in db using python with any one deep learning library (like tensorflow, pytorch,etc)

pls. provide some sample code and which one we can use for this concepts
0
I'm looking for help with code to run on a google form.
On the first section/page, I will prompt the user with some information.
Within that text will be a number (although if it helps I can make it a drop down).
I want that when that selection is made, that I remove one option from the 2nd section/page before they proceed.
0
i'm very new to android... but i have a lot experience in programming with PHP(9+ years) and quite a lot but no so much in Java (~3+years)
i just want to create an app that connects to an api (with login and logout), but before that i have to make it offline, i mean using SQLite in order to READ the data (login)
i'm facing a problem that i cannot access to the database sqlite which i already create using sqllite browser using the folloing line
SQLiteDatabase mydatabase = openOrCreateDatabase("test.db", MODE_PRIVATE, null);

Open in new window

i cannot read the user and my app just get out alone
0
I have successfully packaged OpenCV library in android project using Import Module. But I get the error "Package Not Found - OpenCV Manager package not found, try to install it" What can I do to resolve this problem.
0
Determine the Perfect Price for Your IT Services
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

I have been researching online and can't find a simple solution to emulating F2 and enter in VBA code. It seems to me it should be as simple as this:

Sub HitEnter
Application.SendKeys "{F2}"
Application.SendKeys("~")
End Sub

How do I write it?

Thanks,
John
0
i am learning to use Python / pycharm / PIP to provision 1000 VM through a script to call the  API but i don't know how to start doing it.
 
What is the proper way to install python with IDE, Pycharm and PIP for Windows 10?
Where to obtain the python template code to provision 1000 VMs for example for me to modify the flavours, image, types, servers, network?
How to put the digital token on the script and where & how to execute the script if is connected thr VPN client from my PC?
How to generate a private key from the python script as well?


I managed to use web POSTMAN from google chrome to test calling the API to provision some VM as stated in below.

1. Connected to Private Cloud Fusion Cloud 6.3 from Web POSTMAN

2. Obtained a digital token
POST => https://iam-apigateway-proxy.domain.com/v3/auth/tokens

{
"auth": {
"identity": {
"methods": [
"password"
],
"password": {
"user": {
"domain": {
"name": "XXX"
},
"name": "XXX",
"password": "XXX"
}
}
},
"scope": {
"project": {
"id": "XXX",
"domain": {
"name": "XXX"

3. Provisioned System Volume
POST => https://evs.domain.com/v2/cd088007d3b84e7fa894478e6fe667c4/volumes

{ "volume":
{
"size": 60,
"availability_zone": "az0.dc0",
"volume_type": "ssd",
"name":"volume1",
"multiattach": false,
"imageRef":"ca9384bd-5d78-49ce-a4c3-6d90d77c623c"
}
}

4. Provisioned VM  
POST => https://ecs.domain.com/v2/cd088007d3b84e7fa894478e6fe667c4/servers
{
"server": {
"flavorRef": …
0
Is it possible to develop an Android app 100% locally/offline?

With Kotlin and Gradle. What is needed in order to do it successfully?

Thanks in advance,

Sam
0
I want to extract the product description from a 10-k report for my master thesis (new at programming, finance background). This product description is between "ITEM 1" and "ITEM 2" from the reports. What I did until now is to download all the 10-ks in .txt form, remove html tags and make all text uppercase. My problem is now when I try to select the text I need and save it into another directory. I tried doing the selection on my own, but with unsatisfactory results. Currently, I am using a code made by a guy "iammrhelo" on GitHub. His code is for selecting "ITEM 7" to "ITEM 8". With a bit of tweaking, made it search for what I need. Link to his code: https://github.com/iammrhelo/edgar-10k-mda
The code is able to idetify this:
the code is able to identify thisBut the code is not able to identify this:
the code is not able to identify thisMy problem is now that the parsing he does not work for all 10-ks. To give a little context, I need to find the right syntax that the code has to look for. The words that is looking for are in the list item1_begins variable. The code I am using to select the text, is the following:
import argparse
import codecs
import os
import time
import re

from pathos.pools import ProcessPool
from pathos.helpers import cpu_count

class MDAParser(object):
    def __init__(self):
        pass

    def extract(self, txt_dir, mda_dir, parsing_log):
        self.txt_dir = txt_dir
        if not os.path.exists(txt_dir):
            os.makedirs(txt_dir)

        self.mda_dir

Open in new window

0
Can anyone give an example of sigsuspend?  Like how a parent can suspend a child and resume that child.
0
I have file maker pro 12.  I have a database that uses a portal and I store files from Excel checking "store only as a reference". When I open the file from the portal fnd try to make changes to the excel document , after saving and closing excel I find that when I re open the file the changes have not been saved. Is this inherent in file maker pro or is this a programming issue?
0

Programming

53K

Solutions

40K

Contributors

Programming includes both the specifics of the language you’re using, like Visual Basic, .NET, Java and others, but also the best practices in user experience and interfaces and the management of projects, version control and development. Other programming topics are related to web and cloud development and system and hardware programming.