Stack Overflow

Subscribe to Stack Overflow feed
most recent 30 from stackoverflow.com 2018-02-21T10:21:19Z
Updated: 4 hours 29 min ago

I wanna dynamically add data in tableview but the following code didn't work. can any one please help me

7 hours 35 min ago

This are the colid specify in fxml file,i don't the way if any one please help i will be very grateful, if i press the add button inputted data are
not showing in the table view. some blank row has been added. i want to add data in tableview from user

@FXML private TableColumn<AddItemDetails, String> colofiice_name; @FXML private TableColumn<AddItemDetails, String> colref_name; @FXML private TableColumn<AddItemDetails, String> colch_item_name; @FXML private TableColumn<AddItemDetails, String> colch_item_code; @FXML private TableColumn<AddItemDetails, String> colch_unit; @FXML private TableColumn<AddItemDetails, String> colch_qty; @FXML private TableColumn<AddItemDetails, String> colch_rec_by; @FXML private TableColumn<AddItemDetails, String> colch_desig; @FXML private TableColumn<AddItemDetails, String> colch_addr; @FXML private TableColumn<AddItemDetails, String> colch_remark; @FXML private TableColumn<AddItemDetails, String> colch_no; @FXML private TableColumn<AddItemDetails, String> colch_action; private JFXCheckBox CB;

I write this code in controller

public void AddTableView(ActionEvent event)throws SQLException{ AddItemDetails additem = new AddItemDetails(); additem.setOfficeName(select_office.getValue()); additem.setRefNo(challan_select_item.getValue()); additem.setItemName(txt_ref_no.getText()); additem.setItemCode(txt_item_code.getText()); additem.setItemUnit(txt_unit.getText()); additem.setItemQty(txt_qty.getText()); additem.setReceiveBY(txt_rec_by.getText()); additem.setDesignation(txt_desig.getText()); additem.setChNo(txt_chllan.getText()); additem.setAddress(txt_addr.getText()); additem.setRemarks(txt_remark.getText()); additem.setAction(CB); tableview2.getItems().addAll(additem); }catch(Exception e){ e.printStackTrace(); }

this my AddItemDetails Class

package inventory_system_app; import com.jfoenix.controls.JFXCheckBox; import com.jfoenix.controls.JFXComboBox; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; public class AddItemDetails { private String office_name; private String ref_no; private String I_name; private String I_code; private String I_unit; private String I_qty; private String rec_by; private String desig; private String ch_no; private String address; private String ch_remarks; private JFXCheckBox Action; public AddItemDetails(String office_name,String ref_no,String I_name,String I_code,String I_unit, String I_qty,String rec_by,String desig,String ch_no,String address, String ch_remarks, String value){ this.office_name = office_name; this.ref_no = ref_no; this.I_name = I_name; this.I_code = I_code; this.I_unit = I_unit; this.I_qty = I_qty; this.rec_by = rec_by; this.desig = desig; this.ch_no = ch_no; this.address = address; this.ch_remarks = ch_remarks; this.Action = new JFXCheckBox(); } AddItemDetails() { } public String getOfficeName(){ return office_name; } public String getRefNo(){ return ref_no; } public String getItemName(){ return I_name; } public String getItemCode(){ return I_code; } public String getItemUnit(){ return I_unit; } public String getItemQty(){ return I_qty; } public String getReceiveBY(){ return rec_by; } public String getDesignation(){ return desig; } public String getChNo(){ return ch_no; } public String getAddress(){ return address; } public String getRemarks(){ return ch_remarks; } public JFXCheckBox getAction() { return Action; } public void setOfficeName(String value){ this.office_name= value; } public void setRefNo(String value){ this.ref_no=value; } public void setItemName(String value){ this.I_name=value; } public void setItemCode(String value){ this.I_code=value; } public void setItemUnit(String value){ this.I_unit=value; } public void setItemQty(String value){ this.I_qty=value; } public void setReceiveBY(String value){ this.rec_by=value; } public void setDesignation(String value){ this.desig=value; } public void setChNo(String value){ this.ch_no=value; } public void setAddress(String value){ this.address=value; } public void setRemarks(String value){ this.ch_remarks=value; } public void setAction(JFXCheckBox Action) { this.Action = Action; }

}

What does Chocolatey consider essential information?

11 hours 41 min ago

The Chocolatey documentation describes the -r, --limitoutput, --limit-output flags as "Limit the output to essential information".

I'm using it with the upgrade command:

choco upgrade all --whatif --limitoutput

and get this output:

7zip.commandline|16.02.0.20170209|16.02.0.20170209|false 7zip.portable|18.1|18.1|false atom|1.23.3|1.24.0|false autohotkey.portable|1.1.28.00|1.1.28.00|false bulkrenameutility|3.0.0.1|3.0.0.1|false bulkrenameutility.install|3.0.0.1|3.0.0.1|false calibre|3.17.0|3.17.0|false chocolatey|0.10.8|0.10.8|false

The first three columns appear to be:

Package name | installed version | available version

But what's the last column? I initially thought the boolean was for upgrade available, but Atom has an upgrade available yet it's false, so I'm baffled.

Multiple rows returned when only one per part is desired

Tue, 02/20/2018 - 22:18

Good Afternoon,

The SQL below returns multiple rows per pr_codenum. The desired result is one row per. I tried using a GROUP BY without any change to the results. The columns P01, P02, etc. are facility locations that will have a true, false or blank if they do not use a particular pr_codenum. There will ultimately be 20 columns. Any guidance is greatly appreciated. Thank you GQ

SELECT ROW_NUMBER() OVER(ORDER BY wa_name) AS RowID, wa_id INTO #LOC FROM "SomeTable" WHERE IsUsingTable = 1 SELECT DISTINCT pr_codenum, pr_descrip, CASE WHEN RowID = 1 THEN HazMatFlag ELSE '' END AS P01, CASE WHEN RowID = 2 THEN HazMatFlag ELSE '' END AS P02, CASE WHEN RowID = 3 THEN HazMatFlag ELSE '' END AS P03, CASE WHEN RowID = 4 THEN HazMatFlag ELSE '' END AS P04, CASE WHEN RowID = 5 THEN HazMatFlag ELSE '' END AS P05, CASE WHEN RowID = 6 THEN HazMatFlag ELSE '' END AS P06, CASE WHEN RowID = 7 THEN HazMatFlag ELSE '' END AS P07, CASE WHEN RowID = 8 THEN HazMatFlag ELSE '' END AS P08, CASE WHEN RowID = 9 THEN HazMatFlag ELSE '' END AS P09, CASE WHEN RowID = 10 THEN HazMatFlag ELSE '' END AS P010, CASE WHEN RowID = 11 THEN HazMatFlag ELSE '' END AS P011, CASE WHEN RowID = 12 THEN HazMatFlag ELSE '' END AS P012, CASE WHEN RowID = 13 THEN HazMatFlag ELSE '' END AS P013, CASE WHEN RowID = 14 THEN HazMatFlag ELSE '' END AS P014 FROM ( SELECT RowID, pr_codenum, pr_descrip, CASE WHEN p3_hazflag = 1 THEN 'True' ELSE 'False' END AS HazMatFlag FROM "SomeTable" INNER JOIN "AnotherTable" ON p3_prid = pr_id INNER JOIN "DifferentTable" ON wa_id = p3_waid LEFT JOIN #LOC l ON l.wa_id = p3_waid WHERE pr_id IN ( SELECT DISTINCT p3_prid FROM "YetAnotherTable" INNER JOIN "Table" ON pr_id = p3_prid AND pr_active = 1 WHERE p3_hazflag = 0 AND p3_prid IN ( SELECT DISTINCT p3_prid FROM "YetAnotherTable" INNER JOIN "Table" ON pr_id = p3_prid AND pr_active = 1 WHERE p3_hazflag = 1)) )g GROUP BY pr_codenum, pr_descrip, RowID, HazMatFlag ORDER BY pr_codenum DROP TABLE #LOC

Creating a Web API Rest Web Service with OAUTH

Tue, 02/20/2018 - 22:18

I have been asks to help work on a .net web API rest service. i have done these in the past with no issue, however there is a requirement that it has OAUTH.

This is something i am not used to and i am struggling to

A. Understand what is additionally needed to my standard VS project when i start and b. If there is any other configuration that will be required.

any help would be appreciated, i am looking for a practival how to that i can use to understand what is required.

Thank you in advance.

J

Loop through div children and bold specific text not working

Tue, 02/20/2018 - 22:17

I have a suggestion dropdown under an input field and I am trying to make the text in the suggestion divs bold for the portion that matches what is currently in the input field.

e.g

input: AB
dropdown: ABCDE

My current code doesn't seem to be replacing the div content with the span

JS:

BoldMatchedText(inputToMatch:string){ var outerDiv = document.getElementById("dropdown"); if(outerDiv != null){ var subDiv = outerDiv.getElementsByTagName("div"); for (var i = 0; i < subDiv.length; i++){ subDiv[i].innerHTML.replace(inputToMatch, "<span id=\"strong\">" + inputToMatch + "</span>"); } } }

html:

<form> <input type="text" id="dropdown-input"> <div id="dropdown"> <div class="reg-list-item">{{reg1}}</div> <div class="reg-list-item">{{reg2}}</div> <div class="reg-list-item">{{reg3}}</div> <div class="reg-list-item">{{reg4}}</div> </div> </form>

Could not load type 'System.Drawing.FontStyle'

Tue, 02/20/2018 - 22:17

I have a library of classes which work with graphic by system.drowing and web-application on .net core 2. When I try to create object object of class from this lybrary in controller it throws exception

TypeLoadException: Could not load type 'System.Drawing.FontStyle' from assembly 'System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

Please, help to solve problem!

Granting permissions to access a file

Tue, 02/20/2018 - 22:17

I am creating a social app sort of like Instagram in corona sdk(Lua) . The user can upload photos and a profile picture . How do I grant permission to the database to access the folder and make changes in it ? Like adding pictures and stuff .

Close after failed attempts

Tue, 02/20/2018 - 22:17

I am trying to have an input asking me to select a number 1-99, I want too have this system.close(0) after 2 failed attempts, if anyone could help me it would be appreciated.

package joey;

import java.util.Scanner; public class Joey {

public static void main(String[] args) { Scanner input = new Scanner(System.in); while (true) { System.out.println("Please enter an number between 0-99: "); int n = input.nextInt(); if ((n > 99) || (n < 1)) System.out.println("Invalid number"); else break; } }

}

Networking app not running on Hololens emulator

Tue, 02/20/2018 - 22:17

NetworkingHololens in the application name and I'm trying to use the SharingService to manipulate a cube over the network.

When I run other apps(without the networking capability), it runs fine on the HoloLens emulator, but when I run this or any other networking app, the following error shows up after the "Made with Unity", and just becomes black.

'NetworkingHololens.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\Users\DefaultAccount\AppData\Local\DevelopmentFiles\NetworkingHololensVS.Debug_x86.Abhijit\UnityEngineProxy.dll'. Cannot find or open the PDB file. 'NetworkingHololens.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\Users\DefaultAccount\AppData\Local\DevelopmentFiles\NetworkingHololensVS.Debug_x86.Abhijit\System.Linq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled. 'NetworkingHololens.exe' (CoreCLR: CoreCLR_UWP_Domain): Loaded 'C:\Data\Users\DefaultAccount\AppData\Local\DevelopmentFiles\NetworkingHololensVS.Debug_x86.Abhijit\System.Reflection.Extensions.dll'. Module was built without symbols. The following GlobalManagers were stripped from the build (Either because they're not used or not supported on this platform): NetworkManager MasterServerInterface UnityAdsManager ClusterInputManager CrashReportManager

I was hoping anyone could help me out with this.

Dgraph: Deep graph traversal possible with recurse?

Tue, 02/20/2018 - 22:17

I have a couple of questions regarding the capabilities of Dgraph regarding graph traversal.

Let's say we have a dataset that consists of nodes of the type post. Each post can have n posts that are replies to this post. The depth of this tree is not limited.

Is it possible with Dgraph to search trough all leaf nodes starting from one starting node and return all leafs that fulfill a certain condition?

Is it possible to set a depth limit to not end up with a gigantic dataset?

Is it also possible to find the children of all parent nodes that fulfill a certain condition?

And finally: Are edges in Dgraph directed? And can I include that in the query?

ResxManager tool is failing to load

Tue, 02/20/2018 - 22:17

I am using Visual Studio 2017 and installed ResxManager tool from Extension and Updates. When I open the project, it gives me following error in output window.

Error: Loader errors at start: Assembly: Microsoft.Expression.Interactions.dll => Could not load file or assembly 'System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.: Could not load file or assembly 'System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.:

My project uses 4.5 version of System.Windows.Interactivity.dll

<script> tags seem to be ignored by HTML file

Tue, 02/20/2018 - 22:12

I have a tooltip which renders a html file that looks like this event_tooltip.html

<html> <script src="deleteScript.js"></script> <div style="display: grid; min-width: 250px;"> <img onload="startup()" src="https://data_hub.7eleven.com.au/Faces/FaceEventImage?faceEventId=@ids" style="margin: 5px auto; border-color: @colors; border-width: thick; border-radius: 5px;" border="2" > </img> <span style="font-weight: bold; border-left: solid; padding-left: 5px; border-color:rgba(0, 0, 0, 0.05);">Face Id: @face_ids</span> <span style="font-weight: bold; border-left: solid; padding-left: 5px;border-color:rgba(0, 0, 0, 0.05);">Employee Id: @employees</span> <span style="font-weight: bold; border-left: solid; padding-left: 5px;border-color:rgba(0, 0, 0, 0.05);" id="faceEventId">Event Id: @ids</span> <span style="border-left: solid; padding-left: 5px;border-color:rgba(0, 0, 0, 0.05);">Confidence:</span> </div> </html>

The file deleteScript.js is in the same directory, and looks like this:

function startup(param1) { console.log(document.getElementById('faceEventId').innerHTML) // console.log(someNum) }

I'm trying to pass the @ids from the event_tooltip.html to deleteScript().

The issue I get is that the page throws a Uncaught ReferenceError: startup is not defined at HTMLImageElement.onload (graph.html)

graph.html is the parent html file which shows the tooltips

How can I pass the @ids value from a tooltip to any other page?

Data imported to Excel as "general", text started with "=", getting "#name?" Is there a way to get it back to text?

Tue, 02/20/2018 - 22:08

On of our offices started their text data with an equals sign, which, when imported into the spreadsheet, gave the #NAME? error.

Now, I know I can change the cell format to text and then click in the formula bar, and excel recognizes the cell as text, but is there a way to do this through VBA?

EXAMPLE:

Cell display value: #NAME?

cell text =-Notice, ABC

Desired OUTPUT: Notice, ABC

now, normally, I'd do something like

sub convert_it() if left(cells(1,1).value,2) ="=-" then cells(1,1).value = _ right(cells(1,1).value, len(cells(1,1).value) -2) end sub

but that returns a type mismatch error.

Is there some way I can get the text in the cell without manually clicking?

I can click a few thousand times and then Excel recognizes it as text again, and not as an error, but I'd rather avoid that.

Update dynamic object

Tue, 02/20/2018 - 22:07

I have an object :

{ ..., values: {}, ... }

values is empty by default.

Now I want to add dynamic object to this object :

[myDynamicProperty]: { title: '...', introduction: '...' }

That's ok, I know how to do this. But, on other action, I have to add key: value or key: object to [myDynamicProperty], when I try something, I loose the values of my [myDynamicProperty]

I've tried to clone my initial object, but it doesn't work.

For sure, someone on stackoverflow has the solution.

returning a map using getter in c++ performance issues

Tue, 02/20/2018 - 22:05

I have a class that has 3-4 data members of type std::map> which is used for caching the data. Its instance is created once and the data is filled in all the maps from a service call. I have getter functions that are used to access these maps. (this has some thread locking logic in it as well)

These getter functions gets called a lot of times and I am worried about the performance as the map objects are being copied a lot of times.

class A { private: map<string, vector<string>> m1; map<string, vector<string>> m2; map<string, vector<string>> m3; public: map<string, vector<string>> getm1() { return m1; } map<string, vector<string>> getm2() { return m2; } map<string, vector<string>> getm3 { return m3; } } class B { B() { } static A a; map<string, vector<string>> getm1() { return a.m1; } map<string, vector<string>> getm2() { return a.m2; } map<string, vector<string>> getm3 { return a.m3; } }

There are multiple times these getter functions get called from class B. Having intermediate knowledge on cpp, I know that the getter would return an entire map by value. But, would it be better to pass it by reference or using a shared pointer to the map like storing the member variables m1, m2, m3 as shared_ptr

shared_ptr<map<string, vector<string>>> getm1() { return a.m1; }

Is this not a performance concern and will be taken care of, by the compiler ?

After reading a little bit about Return value optimization and understanding it a little bit, compilers can handle some optimizations. Is this a part of RVO ?

Thank you in advance.

Wait for all files to be deleted using FileSystemWatcher

Tue, 02/20/2018 - 22:04

I have a console app that need to monitor a specific directory and wait for all files to be deleted for a specific amount of time. If after that time has exceeded and all of the files has not been deleted yet, I need the program to throw an exception. How can I accomplish this?

public static void FileWatcher(string fileName, int timeToWatch) { FileSystemWatcher watcher = new FileSystemWatcher(); try { watcher.Path = myPath; watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName; watcher.Filter = string.Format("*{0}*", fileName); watcher.Deleted += new FileSystemEventHandler(OnChanged); watcher.EnableRaisingEvents = true; } catch { throw; } }

Associative array replace

Tue, 02/20/2018 - 21:56

These arrays contains same keys simple like follow topic (prop is unique): Check if associative array contains value, and retrieve key / position in array

<?php $array = array( array("prop" => "1", "content" => "text"), array("prop" => "2", "content" => "text"), array("prop" => "3", "content" => "text"), array("prop" => "4", "content" => "text") ); $found = current(array_filter($array, function($item) { return isset($item['prop']) && 3 == $item['prop']; })); print_r($found);

I got prop 3:

Array ( [prop] => 3 [content] => text )

So I want to replace value in $array with:

array("prop" => "3", "content" => "replaced text")

tkinter python3 clearing text

Tue, 02/20/2018 - 21:51

I made a little game for my kiddo and I just got around to putting it into tkinter. I've spent a long time trying to see if just removing text is possible which the methods I've found weren't what I needed (i.e. delete()). Currently, it works, it just keeps returning text on new lines vertically so it gets really long.

alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] win = ["Good work! Let's go again.", "Way to go. Your hard work is paying off!", "Good attention for detail!"] oops = ["Opps. Keep trying! You'll get it next time.", "That's not right but nice try! Keep working at it."] class Window(Frame): def __init__(self, master=None): Frame.__init__(self, master) self.master = master self.init_window() def init_window(self): self.master.title("Learning is fun!") self.pack(fill=BOTH, expand=1) mathButton = Button(self, text="Numbers", command=self.math) letterButton = Button(self, text="Letters", command=self.alphafun) mathButton.place(x=50, y=250) letterButton.place(x=250, y=250) def alphafun(self): self.x = random.choice(alphabet) text = Label(self, text=f"Type this letter: {self.x}") text.pack() self.user_input = StringVar() prompt = ttk.Entry(width=14, textvariable=self.user_input) prompt.place(x=150, y=200) submitButton = Button(self, text="Submit", command=self.alphacheck) submitButton.place(x=255, y=200) submitButton.bind("<Return>", func=self.alphacheck) def alphacheck(self): if self.user_input.get() == self.x: text = Label(self, text=f"\n{random.choice(win)}") text.pack() self.alphafun() else: text = Label(self, text=f"\n{random.choice(oops)}") text.pack() self.alphafun() root = Tk() root.geometry("400x300") app = Window(root) root.mainloop()

There is a math function I left out for brevity.

I would like the window to clear the text, essentially just returning what the screen looks like with the init_window but also rerunning the alphafun function.

Attempts:

self.destroy() - destroys the whole frame (including widgets)

self.update() - at the beginning of alphafun and after alphacheck

self.destroy() after creating a separate create_widget function

def create_widgets(self): mathButton = Button(self, text="Numbers", command=self.math) letterButton = Button(self, text="Letters", command=self.alphafun) mathButton.place(x=50, y=250) letterButton.place(x=250, y=250) def init_window(self): self.master.title("Learning is fun!") # Style().configure("TFrame", background="#333") self.pack(fill=BOTH, expand=1) self.create_widgets() def alphafun(self): self.destroy() self.create_widgets()

Record who has downloaded what file from S3 using my PHP website

Tue, 02/20/2018 - 21:41

I have a website that allows users to download files securely from S3 using a pre signed URL, however I want to log who has downloaded the files and when.

I have tried doing it by redirecting them to a different page which would then download the file automatically using a piece of JavaScript and then insert a record into a database table, but as soon as the script runs it stops the rest of the page loading stopping it redirecting back.

The JavaScript I am using is below:

<script>window.location.href = “url”</script>

Is it possible to do?

Get powershell to control Internet Explorer and switch between 2 webpages

Tue, 02/20/2018 - 21:40

I want to have Internet Explorer to switch between 2 different webpages in an endless loop . The webpages is local files, that has to be viewed for 10 seconds before changing to next webpage. My code so far:

$ie = New-Object -Comobject 'InternetExplorer.Application' $ie.Visible = $true function IEWeb { $ie.navigate(file://D:\web\index.html) Start-sleep 10 $ie.navigate(file://D:\web\index2.html) Start-sleep 10 } while($true) { IEWeb }

Everything is working until the second webpage has to be loaded. Then I get an error message:

Object is disconnected from it's clients. (Exception from HRESULT:0x800010108 (RPC_E_DISCONNECTED))

I have tried with global vars but still the same. Can anyone give Me a hint of what I'm missing?

Pages