Golang

194

Solutions

520

Contributors

Golang, also called Go, is an open source programming language that is a statically-typed language with syntax loosely derived from C, adding automatic memory management, type safety, some dynamic-typing capabilities, additional built-in types such as variable-length arrays and key-value maps, and a large standard library. Go is a general-purpose systems programming language that aims to be efficient both for development and execution with a focus on fast compilation and increased maintainability of large projects. Go was originally targeted at systems programming tasks such as building server/web applications, high throughput middleware and databases.

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

Sign up to Post

0
New feature and membership benefit!
LVL 10
New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Totally new at coding. Having a really tough time on the following assignment. This is the first task, and I cannot go on to finish the other three tasks until I master this one:

I need to return a hash map of YouTubeID's to Song objects containing all the information from a csv file. I am provided a filename for a csv file containing song ratings. Each line of these files will include: YouTubeID,artist,songName,rating. The YouTubeID is to be the key in the hashmap, the values will be Song objects containing the information for each file. The Song object is (String, String, String)

When a song has multiple ratings in the file I cannot just add the original song a second time, or it will over write the first instance. I only want to add another rating to the existing song entry in the map. We are given an addRating method that is supposed to help:

public void addRating(int rating){
this.ratings.add(rating);

I am having difficulty with the part where I add the song to the map without overwriting and only add the rating. I know I need to do something with the "Song" object but I have no idea what. The code I have thus far is:

public HashMap<String, Song> readCSVFile(String filename){
HashMap<String,Song> songs = new HashMap<String,Song>();

try{
for(String line : Files.readAllLines(Paths.get(filename))){
String allValues = line;
String[] data = allValues.split(",");


}}


catch (IOException ex){
ex.printStackTrace();
}
return (songs);
}
0
HI All


I have did the below and go english uk as default language  on it i will have to add  english us keyboard too


Please help
CLASS USER

   CATEGORY "Keyboard Layout"

     POLICY "Keyboard Layout switching"

     KEYNAME "Software\Microsoft\Windows\CurrentVersion\Run"

       VALUENAME "internat.exe"

       VALUEON "internat.exe"

       VALUEOFF DELETE

       END POLICY

     

     POLICY "Keyboard layout"

     KEYNAME "Keyboard Layout\Preload"

         PART "Enable English" CHECKBOX

           DEFCHECKED

          VALUENAME "1"

           VALUEON "00000809"

           VALUEOFF DELETE

         END PART
0
Hi,
Is it possible to register vmx file on an another ESXi when the hosting ESXi host dies and still the vm file is registered on the dead esxi?
We have a vcsa. It is possible one day the  ESXi might go wrong so the VCSA will not be available.
0
I have a series of pages I need to print each week. They have always defaulted to 8.5 x 14, which is how they need to be printed. Suddenly, today, I had to go and either manually check that box, or do it in the page set-up. This affects my efficiency and I'd like to know how I can set the PDF's to automatically print the correct size as they used to.
0
CODE ATTACHED

I had this question after viewing Download file from remote ftp site via VBA (Excel).

Norie gave me instructions on how to call this code and INDIVIDUALLY it works.  I have a form that allows the user to make multiple selections.  Using variables, the code CALLs Norie's code.  If I make only one selection and run, the code works.  I can run Option1-let it finish, go back to the form and run Option2-Let it finish, run Option3-let it finish...etc ALL of my files download.

My problem is that when I select more than ONE Option, only the FIRST Option selected will download..all others will fail. I have attached the code with the FTP site, Password, and UserName changed for protection (my true data works).  Can anyone figure out why this works ONE-At-A-Time but NOT in multiples

My current Work Around is to download files one at a time which is time consuming!
FTP-CODE.docx
0
I found some answers online that just don't work.  Situation: I want to be able to designate WHERE I want a download to go on my Asus tablet/keyboard computer. I went into File Explorer and THOUGHT I had reset the option so that when I select "download" I would then be offered the option to designate where I want the download to go. But when I tried a download, BAM, it went wherever the Windows 10 default is.

Larger challenge for the experts: do you realize that whoever comes up with an operating system that is TRULY user-friendly and simple will be a multi-multi-millionaire? Just sayin'.......
0
Hi,

In Access I manually imported an XML file and saved the import of this process. After importing the XML-file I have a table with the name ExampleTable.

 When I go to Saved Imports and run this saved import in Access I see that a new table is created ExampleTable1. When I run again a table ExampleTable2 is created and so on. Actually I don't want to have new tables, I want that the existing table ExampleTable is refreshed. How can I do that?

Regards Arne
0
Hi experts, I'm trying to get the next availalbe free IP address from a database, using a GoLang Function. This is what I have so far:

func GetNextFreeIP() string{
	db := dbopen()
	addr, err := db.Query("SELECT `IpAddress` FROM `FrontFacingIPs` WHERE `Avlilable` = 1 LIMIT 1")
	if err !=nil {
		fmt.Println("Couldn't find free IP, Error message is", err)
	}
	return addr
}

Open in new window


However, my IDE throes the following error:
"Cannot use addr (type *Rows) as type string"

**You can assume that the query is correct (I tested it) and that there are free IP Addresses (The function that calls this functions checks it beforehand)
0
Dear all,

I need some help removing the mailbox permissions from a list of users:

When we terminate users we need to remove them from all the E-mails they have permissions to.
I usually run this command to see where the user has got permissions
Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission -User "Name User"
and then go to O365 and remove the delegation but I will have a mass termination procedure for many users and I need to automate this. It takes roughly 5 minutes to go through the whole tenant and check per user and then I need to go to O365 and remove it manually.

If anyone can give me guidance how to write this script is more than welcome.

Thank you.
0
Free Tool: Subnet Calculator
LVL 10
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Hi,

We have been asked to setup mandatory TLS by one of our customers, for all incoming and outgoing mail to their domain.

We run Exchange 2010 servers, Sophos Email Appliance, and we also use a cloud based spam filter.
All incoming and outgoing email goes through the Sophos smarthost, also incoming mail hits the spam filter first then is passed to Sophos.  Outgoing mail doesn't go through the spam filter.

I've researched and think I know how to configure TLS on Exchange, Sophos, and our spam filter.

Will I need to configure TLS on Exchange for the send and receive connector?
Exchange isn't externally facing, so I am assuming the self-signed certificate will work for TLS with our internal smarthost?   The smarthost is externally facing so it will need a public cert and configuring for TLS.

I had a thought that maybe for incoming email I wouldn't need to configure TLS on our internal Exchange, but I could be wrong?

Thanks in advance.
0
Excel 2016 - my formatting is going crazy!  I have no idea what happened.  I have a workbook that I use alot.  I use save as and go on to the next job, every version that I open has the same issue...
0
We have a print server running on server 2008 with about 50 printers. Just today we have 3 of them that for some reason keep going offline.
We have tried new print drivers and such but the 3 printers continue to go offline after some time. We can restart the print spooler service and they go back on line but then after a few minutes they go offline once again.
0
I need a powershell command that will go through all the on-prem mailboxes which do not have a sip address in the e-mailaddress tab. i tried running with the below script, but then it does not give me what i want. i want the result to show up with the Primary SMTP address of the on-prem mailbox which does not have the sip address value

Get-ADUser -filter * -Properties proxyAddresses |
    Where {$_.proxyAddresses} |
    Where {-not($_.proxyAddresses  -like "*sip*")}
0
I tried to exclude a file from Symatec Endpoint Protection with no effect,why?i go to settings/exceptions i add the folder and the .exe file and when i click on .exe file saying: Infected,why?i exclude it already?i don't udnesrtand, help!
0
Lenovo thinkpad...I installed a new SSD...installed Win 10 and has been running very well for about a year...

Now...It "may not" boot...I pull power plug...pull the battery...then plug both back in and it will boot...

It will boot normally about half the time...and the other half I have to go thru the little unplug and plugin routine
and then it boots up fine...

Maybe this is the definition of "plug and play"...or "plug and pray"...:):)

At any rate...this might be just reloading W10...I don't think it's SSD related...but could be...

Appreciate any thoughts and suggestions on trouble shooting this...
0
Hi guys. I'm writing a project in Google Go.
I have two packages, the main one (obviously) and another one I named Tools.
In Tools I have several Go files, one of which is a file that allows me to handle various mySQL requests.

Since the file has many functions, I don't want the have the long and tedious do open procedure in each function, so I made it an internal function of the file.
This is the SQLTools file:

package Tools
import "database/sql"
import _ "github.com/go-sql-driver/mysql"
import (
	"fmt"
	"net"
	"os"
	"io/ioutil"
	"bufio"
	str "strings"
)
//Global variables MySQL credentials
var MySQlServerName string
var MySQlServerUser string
var MySQlServerPass string
var MySQlServerDatabase string

func dbopen() *sql.DB{

	file, err := os.Open("config.inc")
	if err != nil {
		fmt.Println("Config file config.inc missing or can't be opened!", err)
		return nil
	}
	defer file.Close()
	var ConfFile [] string //Array reading conf file

	scanner := bufio.NewScanner(file)
	for scanner.Scan() {
		ConfFile = append(ConfFile,scanner.Text()) //Add line to array
	}
	if err := scanner.Err(); err != nil {
		fmt.Println("Error occured in read file!",err)
	}
	for _, line := range ConfFile { //Reading array and check critical variables
		if len(line) == 0 || line[0] == '#' { } else {

			if str.Contains(line, "ServerName") {
				tmpString := str.Split(line, "=")
				_, MySQlServerName = tmpString[0], str.Trim(tmpString[1], " ")
			}
			if str.Contains(line, "ServerUser") {

Open in new window

0
A woman was fired from her teaching position because allegedly made a post telling nwords to go back to Africa.  Other people see the post, but when she opens her own page, it is not there.  What kind of expert could i hire from here that could go back to her events Monday and prove she was hacked ?   Thanks,   Probably some neo-Nazi wannabe getting his rocks off from getting nwords shorts all in a bunch.  This is some serious stuff.
0
I've got a brand new Alcatel PIXI 4g phone. If I go into contacts and add a number, then click more fields, the words more fields goes away but there's nothing else to see. I'm on Android version 6.0.

Actually, when you click more fields, it goes to a different screen, with the words USIM contact and a link back to edit contact.
0
Free Tool: IP Lookup
LVL 10
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Hi,

We are migrating from Exchange 2013 to 2016 but when uninstalling 2013 receive this error:
This computer is a member of a database availability group (DAG). It must be removed from the DAG before you can uninstall Exchange

No DAG exists, if i go into ADSIedit.msc within CN=Database Availability Groups nothing exists either...?

Any ideas?

Thanks!
0
I am trying to display a message in my bootstrap page IF THERE IS AN ERROR IN THE EMAIL FIELDS
I am using :
      <div class="form-group">
            <div class="col-sm-10 col-sm-offset-2">
                  <! Will be used to display an alert to the user>
            </div>
      </div>
I am able to execute the email.php form correctly if everything is fine, but if there is an error I am using
header("location:javascript://history.go(-1)");
to go to the previous page with the USER INPUT.  I have tried several examples from the web and tutorials, but NONE of them have worked for me but this one (history)
My problem is that since it is history page, NO MESSAGE IS DISPLAYED
My question is HOW CAN I APPEND INFO TO MY FIELDS IN BOOTSTRAP LIKE THE ALERT PREVIOUSLY POSTED
Tnx
contactus.htm
0
Hi,

I'm aware others have had similar issues to mine but none of those fixes resolved my issue.  We have 10 sites, each with a SonicWall (various models).  At site A, we recently switched our primary ISP and now our other sites aren't able to ping the LAN IP address of site A even though the VPN is up and running from site A to the other sites.  The other sites can successfully ping other devices at Site A (such as computers) but not the SonicWall LAN IP.  Site A can ping out normally to any other site.  This issue occurred when we switched ISP.  The settings seem to be correct but something is causing the ping not to go through.  It seems "Ping" is enabled in Site A SW where applicable.  I will appreciate any suggestions.
0
I am weary of dealing with web host companies that have creative pricing plans that drive me up a wall. I  would like to know the name of a company that charges ONE rate from the word GO all the way through at least 5 more years of renewals. I am a VERY low user of data. I simply want a reliable host with 24/7 technical help available for photos and emails. Can anyone recommend one or two? I am with one now that is demanding more than DOUBLE what I paid for the first few years! It isn't going to happen.
0
This is in reference to trying to gather "tracking information" when sending a calendar invite to a Firm Distribution List.  The issue here is that the firm Distribution List does NOT expand (whereas if sending to a personal Distribution List it does expand) so the user cannot get the tracking information when someone accepts or decline.  The person will of course get the "accept" or "deny" email but they want to be able to go into their calendar invite and look at ALL of the tracking information at once.

Let me know.  Thanks.

Jackie
0
This will be wordy...trying to give all the info that I know to help out the experts.
We have converted from Ex2010 to Ex2016, we have hub in dmz.
we have a new cert from digicert- owa.company.com, mail.company.com, autodiscover.company.com
Cert has been applied. mail is flowing fine, in and out.
When you open outlook you get a cert error- ex2016.company.local - the name on the cert is invalid or does not match the cert.
I know you can't assign a cert to a .local or internal server name anymore. so I'm not sure what to do?
something else that is very odd in our DNS. we have an A record autodiscover.company.local x.x.x.11 (.11 is ex2010), If I change it to .15 (.15 ex2016 new server) email will not get to exchange- we get a bounceback message stating that the email is rejected due to content filtering. even if the email is nicely worded and formatted properly.
So 2 strange issues.
Last very strange issue...If I manually create an outlook profile- servername: ex2010, username and click check name the servername: ex2010 magically changes to ex2016 and the check name works and there is no cert issue.
I want my 90 users to not have the cert error, and not have to go to 90 workstations and manually recreate every persons profile.
1

Golang

194

Solutions

520

Contributors

Golang, also called Go, is an open source programming language that is a statically-typed language with syntax loosely derived from C, adding automatic memory management, type safety, some dynamic-typing capabilities, additional built-in types such as variable-length arrays and key-value maps, and a large standard library. Go is a general-purpose systems programming language that aims to be efficient both for development and execution with a focus on fast compilation and increased maintainability of large projects. Go was originally targeted at systems programming tasks such as building server/web applications, high throughput middleware and databases.