Unable to increment a variable scanned in java [duplicate]

java
Question: This question already has an answer here:concatenating string and numbers Java 6 answers Hello I'm a beginner in Java and i'm finding issuses to increment the variable age as it is red as a string or it is an integer This is the Code :public static void main(String[] args) { Scanner name= new Scanner(System.in); System.out.println("Hello your name is "+name.nextLine()); Scanner in = new Scanner(System.in); int age = in.nextInt(); System.out.println("In 17 September i will become "+age+1+" years old"); } Answer: Whenever you add a String in a print statement, all further + signs are considered to be the concatenation operator, instead of the addition sign. To fix, enclose it in brackets, like (age+1). Read more
Read More

golang pprof for c library code

Uncategorized
Question: I have been trying to profile my golang application with pprof, but it seems that the details of my c code(linked as static library) is missed in the output result. flame graph From the frame graph you can see all the c code time consuming is reported within "runtime._ExternalCode", no details at all. And I am very sure my static library is compiled with debug enable. So Is there any way to make the pprof get the details(like stack trace) of 3rd party c code? Or Is there any other golang profiling tool to do this? Answer: Read more
Read More

Unable to install Components in Xamarin.Android

Uncategorized
Question: I am working with Xamarin Android, and in the past couple of days have found that I am unable to install components into projects. I am on Visual Studio 15.3.0 (2017), and basically whenever I add a component, everything looks fine until I close the project and re-open. Before: After: Things I have tried:Updating Visual Studio Reinstalling Visual Studio Deleting everything Xamarin related in C:Users{Me}AppDataLocal I have lost two full days of work because of this and am getting a bit desperate, at this point I'm considering reinstalling Windows. Can anybody provide any insight on why this is happening? Regards Answer: Read more
Read More

Some word vectors return values of infinite or -infinite

Uncategorized
Question: I trained my word vector like i normally would. I cleaned the text before hand where each line is a sentence with tokens separated by a space class Sentences:def __init__(self):pass def __iter__(self):i = 0 with codecs.open('./data/cleaned_corpus.txt', 'r', 'utf-8') as file:for line in file:i += 1 if i % 5000 == 0:print('processed ' + str(i)) yield line.split() w2v = Word2Vec(Sentences(), size=100, min_count=10) w2v.wv.save('model') The issue is that some of the vectors return arrays with values that are numpy infs array([-inf, inf, -inf, inf, inf, inf, inf, inf, -inf, -inf, inf, inf, -inf, -inf, inf, inf, -inf, -inf, inf, inf, inf, -inf, inf, inf, -inf, -inf, -inf, inf, -inf, inf, -inf, inf, inf, -inf, -inf, inf, inf, inf, inf, inf, inf, inf, -inf, -inf, -inf, -inf, inf, inf, inf, -inf, -inf,…
Read More

c# Excel Pie Chart Custom Color

Uncategorized
Question: How to create custom color on my excel pie chart? My pie chart has 5 slice. Below are my source code. using Excel = Microsoft.Office.Interop.Excel; Excel.Range chartRange; Excel.ChartObjects xlCharts = (Excel.ChartObjects)xlWorkSheet.ChartObjects(Type.Missing); Excel.ChartObject myChart = (Excel.ChartObject)xlCharts.Add(10, 80, 500, 350); Excel.Chart chartPage = myChart.Chart; chartRange = xlWorkSheet.get_Range("A3", "B7"); chartPage.ChartStyle = 209; chartPage.HasTitle = true; chartPage.ChartTitle.Text = "HeaderText Title"; chartPage.SetSourceData(chartRange, misValue); chartPage.ChartType = Excel.XlChartType.xl3DPieExploded; chartPage.Elevation = 35; chartPage.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowLabelAndPercent ,false, true, true, false, true, false, true, true, Separator:System.Environment.NewLine); xlWorkBook.SaveAs(saveAsLocation); xlWorkBook.Close(true, misValue, misValue); xlApp.Quit(); Answer: You can change the ColorIndex of each point of your pie chart like this:var series = (Excel.SeriesCollection)chartPage.SeriesCollection(); series.Item(1).Points(1).Interior.ColorIndex = 3; //Red series.Item(1).Points(2).Interior.ColorIndex = 4; //Green series.Item(1).Points(3).Interior.ColorIndex = 5; //Blue series.Item(1).Points(4).Interior.ColorIndex = 6; //Yellow series.Item(1).Points(5).Interior.ColorIndex = 7; //Magenta Here is a full list of available colors msdn The ColorIndex property…
Read More

Gardener Care – Garden, Gardening and Landscaping Responsive HTML5 Template

Uncategorized
Gardener Care is a business template designed specifically for Agriculture, Business, Corporate, Fertilizer, Farmer shop, Florist, Garden, Gardening, Farmers, Landscape architects, Landscaper Site Template, Landscaping, Lawn services,Organic, Trees Plantation etc. The theme comes with a awesome unique design also we ensure you can easily design your website just how you like it.
Read More

How to use tensorflow to build model with the parameters from a config file

Uncategorized
Question: I have a algorithm to produce the parameters which could be feed to Tensorflow to construct DL models. The parameters are like this : hidden_layer_neurons = [100, 200, 300, 400, 500]. Because in TF, we cannot use the for-loop with python, therefore, I cannot use this manner to build the multi-layer model by reading the elements in hidden_layer_neurons. Is there any way to solve my question? Thanks in advance. Answer: When constructing a TF graph it is perfectly valid/possible to allow all kinds of python constructs as loops. So as long as you can structure your program in a way that modifying the graph (using loops) does not need to happen during graph evaluation (e.g. run you algorithm upfront and then construct the graph) there's no problem at all.…
Read More