C# – WPF class get all resources and fill listbox

Uncategorized
Question: I have class who get all resource names. Here is code :using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using System.Text; namespace Helper { public static class callResources { public static ObservableCollection callAllResources() { var properties = typeof(Properties.Resources).GetProperties( System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Static); ObservableCollection col = new ObservableCollection(); foreach (var propertyInfo in properties) { var s = propertyInfo.Name; if (s != "ResourceManager" && s != "Culture") { col.Add(s); } } return col; } } } in MainWindows.cs have this code:public ObservableCollection resourcesListBox { get { return callResources.callAllResources(); } } If I call resourcesListBox I have only one line in queryListBox. and in MainWindow.xaml have this but it does not work : Answer: So first you need to make your class static so you can call it from…
Read More

why is ‘this’ keyword returning address of class B?

Uncategorized
Question: When I call the super class method ma() it is printing the address of B.My question is in this program what is the function of this keyword. Why using this keyword inside print statement not giving syntax error rather it gives error for the super keyword.why it will print reference of B only why not A class. class A { public void ma() { System.out.print(this); //printing address of B why? } } class B extends A { public void mb() { super.ma(); //calling super class method } public static void main(String[] args) { A re=new B(); //creating object for class B re.mb(); //calling method mb() of class B } } Answer: this is a reference to the current object — the object whose method or constructor is being called…
Read More

dongle is disabled while in system

Uncategorized
Question: i bought 2 huawei 3g modems e179 and i am trying to setup them in 2 systems with asterisk. the first one works fine. the second usb gives me the following error:[Aug 14 12:54:19] ERROR[1206]: at_response.c:364 at_response_error: [dongle0] Getting IMSI number failed [dongle0] 'AT^CVOICE' device disabled [Aug 14 12:54 Bear in mind that the usb is unlocked. any ideas please? Answer: Read more
Read More

allow laravel app to create/modify project files?

Uncategorized
Question: I have plans on making a generator GUI, accessable on a route while in development mode. When taking some action in the GUI it will create or update corresponding files in the project folder. This means the web server user need permissions to handle the files. What is a good way to accomplish that? I have thought of a few approaches but not sure. After you pull in my package, let the user chmod everything themselfs. This might be an issue as these changes will be commited to source control? Add some kind of installer script that you can run with sudo to do 1) for you. Add a temporary workfolder for the generator where it has full access. Then you set up some symlink thing to the actual…
Read More

Disabling an annoying debugger notification in Visual Studio 2017

Uncategorized
Question: Whenever I start debugging with heap profiling turned on in the Diagnostics tools in my Visual Studio 2017, I get the following notification(s): This is quite annoying, since I was made aware of the performance impact these debugging methods might have on my program the first 10 times I was presented with such notifications. To make things worse, the notifications do not disappear by themselves, but instead I have to close them everytime I've been debugging. Where might I find an option to turn these things off, so I might profile the heap in peace? TO BE CLEAR: I do not wish to disable heap profiling. I wish to disable the warning/notification I am presented with whenever I profile the heapiness. Answer: Read more
Read More

if i already know an object`s structure,how can i eval the right value to the object?(javascript)

Uncategorized
Question: If I have an Object like this:let obj = { a:{ b:{ c:{ d:{ e:'nonono' } } } } } and I know the structure of the Object like that: now I want to change the innermost layer of the Object, it is the "e" property. I want to assign another value to "e". I don't want like these ways below:obj.a.b.c.d.e = 'another value'; var str1 = 'a.b.c.d.e'; obj[str1[0]][str[1]][str[2]][str[3]][str[4]]; var str1 = 'obj.a.b.c.d.e'; var str = str1 + "='another value'"; eval(str); above these, I can change the property 'e' of the Object's Value, but I think it`s not grace to express what I mean. If I have the Array like that: var arr= [a,b,c,d,e], I want to recursion a function to find the innermost layer Of the Object, but…
Read More

how to i change the vertical position and size of bar button Item in may navigation controller?

Uncategorized
Question: I am working on a project, i have a navigation bar of height 129 now I need to add a bar button Item to my navigation bar. My problem is with the bar button position i want to change the position of bar button item. This is an image of what is happening: This shows the position for where i want it: Answer: Very specific situation but you can try set image insets for bar button item. let image = UIImage(named: "yourImage") let leftButton = UIBarButtonItem(image: image, style: .plain, target: self, action: #selector(self.leftButtonDidPressed)) leftButton.imageInsets = UIEdgeInsets(top: -64, left: 0, bottom: 0, right: 64) self.navigationItem.leftBarButtonItem = leftButton Read more
Read More

Unable to see TypeScript runner options while configuring runner in Visual Studio Code

Uncategorized
Question: When I try to configure Default build task using the Global Tasks menu of my Visual Studio Code, I dont see the options related to typescript, I see only four options:- MSBuild Maven .NetCore Others Here is the image of my VSCode IDE:- Vscode IDE Build Runner options I have successfully installed typescript on my machine using npm install -g typescript Please someone point out what the issue can be. Answer: Choose Others. This is an example of MY tsc task runner:{ // See https://go.microsoft.com/fwlink/?LinkId=733558 // for the documentation about the tasks.json format "version": "2.0.0", "tasks": [ { "taskName": "tsc", "command": "tsc --watch", "type": "shell", "problemMatcher": [ "$tsc-watch" ] } ] } After you have that saved, you can start it with: CTRL+Shift+P -> Tasks: Run task -> tsc…
Read More

Do I need a saga for local store changes ? (redux-saga)

Uncategorized
Question: It may be a naive/not smart question: I want to keep track of a global state in my app. The user for example choose some options for the app and I want those options to be accessible from any component in my app. So I trigger some "setOptions" action and have a reducer for it. This action dosn't need any server call it's internal to the app. My question is, do it needs to have it's own saga ? In my opinion it's not really needed here but maybe it's good practice to do it this way to better keep tracks of thing ? What do you think the better option is ? thanks Answer: That's not the use case for redux-sagas. Redux-saga is for async operations. If your…
Read More

Azure IoT Hub device twins with AMQP usable already?

azure-iot-hub
Question: I cloned the newest version of the Azure C-SDK. One of the recent commit messages says that device twins over AMQP were added. I tried to switch the devicetwin_simplesample.c of the serializer samples to AMQP:git diff devicetwin_simplesample/devicetwin_simplesample.c diff --git a/serializer/samples/devicetwin_simplesample/devicetwin_simplesample.c b/serializer/samples/devicetwin_simplesample/devicetwin_simplesample.c index 7da717c..d390a25 100644 --- a/serializer/samples/devicetwin_simplesample/devicetwin_simplesample.c +++ b/serializer/samples/devicetwin_simplesample/devicetwin_simplesample.c @@ -14,7 +14,7 @@ /*String containing Hostname, Device Id & Device Key in the format: */ /* "HostName=;DeviceId=;SharedAccessKey=" */ -static const char* connectionString = "HostName=..."; +static const char* connectionString = "HostName=XXXX.azure-devices.net;DeviceId=XXXX;SharedAccessKey=XXXX"; // Define the Model - it is a car. BEGIN_NAMESPACE(Contoso); @@ -47,6 +47,7 @@ DECLARE_DEVICETWIN_MODEL(Car, WITH_REPORTED_PROPERTY(Maker, maker), /*this is a structured reported property*/ WITH_REPORTED_PROPERTY(CarState, state), /*this is a model in model*/ + WITH_DESIRED_PROPERTY(CarSettings, settings) /*this is a model in model*/ WITH_DESIRED_PROPERTY(CarSettings, settings), /*this is a model in model*/ WITH_METHOD(getCarVIN) );…
Read More

Failed to execute : org.apache.maven.plugins:maven-compiler-plugin

Uncategorized
Question: I creating a web project using maven, java 7, String framework, hibernate, JPA and restful service in Eclipse. I changed the jre library in Java Build Path and also change the compiler. but now i got error Cannot change version of project facet Dynamic Web Module to 3.0. thanks in advance !!! Answer: you need to change the version into web.xml you need change some configuration you can find it below: Servlet 3.0 Web Application then Update Project. Read more
Read More

Prolaw Legal Law Firm – Attorney Bootstrap HTML Template

Uncategorized
Prolaw Legal Law Firm – Attorney Bootstrap Html Templates suitable for all types of Law Firms businesses. Prolaw Legal Law Firm is a clean and modern bootstrap html template for law firm, attorneys, business, justice, law, lawyer, lawyers, legal office, politician and many others relevant businesses that provide advocate services in various fields. That Includes totally 11 Pages. There are many more features will come in the future.
Read More