How to change access modifier in stetic gui designer - monodevelop

I'm using Monodevelop and Stetic Gui Designer on Ubuntu.
I want to set the cursor at the end of the text in an Entry-Object. When I try to use entry1.Position (-1)', I get an error "Gtk.Entry.Position is inaccessible due to its protection level". For this issue I found a possible answer here Why is the control inaccessible due to its protection level?. So I would like to try to change the access modifier. But I can't see where to do this in stetic gui designer.
Thank you!

I have the same issue, my answer is: declare public variables instead to try change the acces modifler; this is the only way I can pass data betwen the controls in xamarin; I wished give you a better answer.

O.o en your project folder there is one named gtk-gui inside there are files whith the same name of the windows/dialogs, in the begining lines are the acces modiflers of the controls
{// This file has been generated by the GUI designer. Do not modify.
namespace gtk2
{
public partial class Dialog
{
private global::Gtk.VBox vbox3;
private global::Gtk.Entry entry2;
private global::Gtk.Button buttonCancel;
private global::Gtk.Button buttonOk;
but seems like you can't change it

Related

Relative name to get information from Form in MS Access

I would like to know if it is possible in a Saved Query on MS Access to use WHERE clause getting value from a Form independent of MS Access installed language?
In a MS SQL QUERY WHERE clause that should be equal to a text in a form, I wrote it like this
= Form!Form_name!text_name
This work fine if all user have MS English version installed, however, this is not true in my case, as some users have a Portuguese version. In their version, the right way to call the same syntax should be:
= Formulários!Form_name!text_name
So, the problem is that Access does not recognize this considering language version. Due to this, if a user with Portuguese version try to run the query, it will pop up an insert box.
I've look throughout many sources but none could help me to solve this.
Thank you all in advance!
I can't test this as I don't have a portuguese version of Access but I avoid calls to form parameters because they are brittle. For instance the form has to be open or the query fails in wierd ways. If I must use a form's parameter I wrap the parameter in a public function (usually in that forms code behind). A public function usually gets picked up by intellisense even in the designer but a public variable does not.
My style is to synthesize a property with a private global scope variable and public get and set functions. Then in the designer you can call: get-myforms-property instead of Form!Form_name!text_name. When the form opens and closes I usually call set-myforms-property and set it to be equal to the actual form property.
In this way you also get the advantages of wrapping. For instance you can choose what value to return when the form is closed rather than just having the query fail.

Accessing REST api from Windows CE

I have one Windows Handheld device application which has the requirement of accessing a REST API. The REST API gives me JSON output which I am going to handle via Newton.JSON. Now to achieve modular structure I want to have the communication to the REST API be handled via a different module altogether something like a Class Library. But unfortunately it seems that it is not possible to do so via a class library(or maybe possible). So my question is what is the best alternative to do so?
Please note that I don't want to include those connectivity operations in my front end application project. And I am using .Net framework 3.5 & Windows Mobile SDK 6.0
Thanks in advance
Pseudo class library code:
public function void startQuery() //starts a thread that does the JSON query
//inside thread on query result use OnDone() delegate
private delegate void OnDone(string dateTimeString);
//In main GUI code add a reference to the class lib and init a new object then add an event handler to the OnDone delegate of the class lib
JSONClassLib myJson=new JSONClassLib();
...
myJson.OnDone+=new EventHandler(myEventHandler);
void myEventHandler(sender this, objext o){
//will be called when query is done
}
//you need to use Control.Invoke if you want to update the GUI from myEventHandler
//to start a query use something like this from your class lib
myJson.doQuery(string);
If you add your existing code we may help with creating a class lib and async code
Now I got my answer. Sorry I did a mistake while selecting the project type. I selected "Windows Form Class Library" project instead of "Smart Device Class Library" project. Now that I have selected the right one it is working fine for me.
BTW thanks for those responses.
Cheers

How can I get fully-classified class name in PHPStorm's Code Completion?

I'm new to PHPStorm and want to ask how can I get fully-classified class name (absolute path to the class) using Code Completion (Command+Space)?
For example, I have a function in my code:
<?php
namespace A;
use C\D\Class;
/**
* #return Class (what PHPStorm suggests)
* #return \C\D\Class (what I need)
*/
function foo() {
return new Class();
}
?>
This function returns an instance of \C\D\Class
When generating docblock for this function, I use Command+Space to place class name after #return keyword. PHPStorm suggests Class in the expanded list but when I select necessary class it places only "Class" instead of "\C\D\Class".
How can I fix it?
Thanks in advance.
I had the same issue too.
Actually it is very simple, but I also did not find the option. It is well hidden.
Open the settings and go to:
IDE Settings -> Editor -> Auto Import
There you'll find the checkbox "Enable auto-import in namespace scope". Uncheck it, and namespaces will not be shorten anymore using the"use" keyword.
But now PhpStorm will tell you that it is unnecessary to use the complete namespace. To avoid that just disable the inspection "Unnecessary fully qualified name".
You are still able to tell PhpStorm to import the current class' namespace. For me it is just marking the class with the cursor and pressing ALT+ENTER. Then this dialog appears:
When I confirm with ENTER the namespace of this class becomes imported and shorten:
Currently the only way to do so is start typing \C\D\Cla and then complete. If this is not what you want feel free to create a Usability issue on Issue Tracker.

Is it possible to reflect changes in portal-ext.properties without restarting whole Liferay portal?

My problem is every time after changing the Liferay portal-properties (and this is frequent especially at beginning of a new portal project) I need to restart the whole portal.
Some properties I can set over hook and these values will be changed after redeployment. Also that must be possible to change most portal properties at run time.
However, do you know some approach to reflect changes in portal-ext.properties without restarting Liferay portal?
As stoldark mentioned, this is not possible in a production environment at all. Since portal.properties's properties are loaded at portal start-up.
But for development you can use a tool like JRebel, some steps to configure it here. The only issue you would get with this tool is that it is paid ;-).
I know it is a very old thread but it may be helpful for someone who is looking for some type of work around
As we know there is no straight forward way for this but I did this by using java reflection and class loader.
Liferay Version : 6.x
//Loading the PropsUtil class by using PortalClassLoader
Class<?> prospsUtilClass = PortalClassLoaderUtil.getClassLoader().loadClass("com.liferay.portal.util.PropsUtil");
//getting the reload method of PropsUtil class
Method reloadMethod = prospsUtilClass.getMethod("reload", null);
//Invoking the static reload method
reloadMethod.invoke(null, null);
Reload method (re)loads the portal-ext properties to the portal so we can use new properties without restarting Liferay server.
This has also been asked in Liferay forums:
https://www.liferay.com/community/forums/-/message_boards/message/800954
But I am afraid that most properties are only read once during portal startup.
Usually, the use of a properties file as in this case has this drawback.
There's even an issue open at Liferay about this, but is still unresolved:
http://issues.liferay.com/browse/LEP-5579
If you create a hook to override portal properties, you will be able to change properties with just deploying the hook without restarting the Portal.
Be aware that you cannot modify all properties with a hook. For a list of the ones that you can modify, check out: https://docs.liferay.com/portal/6.2/definitions/.
I've just searched for reloading portal-ext.properties and landed here.
Ok - not a feature in Liferay.
So I'll use an old trick I like:
place custom properties in (liferay-tomcat-home)/conf/filename.properties
reload them whenever you want by
Properties customProperties = new Properties();
customProperties.load(new FileInputStream(new File(System.getProperty("catalina.base"), "conf/filename.properties")));
I must confess I haven't tried this in a Liferay-Portlet-Environment, but this system property ("catalina.base") should be available in this context, at least by using some Liferay-Helper-Class.
Some of the Liferay classes read their properties when initialising static field constants. E.g.:
public static final boolean ENABLED = GetterUtil.getBoolean(
PropsUtil.get(DynamicCSSFilter.class.getName()));
Basically, it is possible to reload the properties (eg via script in control-panel), but all those static constants will remain.

How can I save a global variable value after dynamically loading a reference?

I have a Access 2003 database that will dynamically load MDB databases as a library reference. The reason for this is this database is a menu front-end for 60+ application databases. Rather than deal with permanently referencing all these databases, the menu front-end will dynamically reference what is needed when the user makes a selection. I was working on moving this database to Access 2010 and creating a custom ribbon. I started using the technique from here to capture the ribbon object in a global variable when the ribbon loads. I then ran into the problem where I could verify the code was running and the global variable was correctly being assigned the ribbon reference but after the database would run through it's startup routine, that global variable would get reset to Nothing.
To verify what was going on, I created a simple database for testing. In this database, I had a module with a global variable:
Public obj as Object
I then had a function like this:
Public Function SetObj()
Set obj = Application
Debug.Print "IsNothing=" & (obj Is Nothing)
References.AddFromFile "Test.mdb"
Debug.Print "IsNothing=" & (obj Is Nothing)
End Function
Obviously, in my code, "Test.mdb" refers to an actual file. If I run this code, Debug.Print gives me "IsNothing=False" for both instances, but after the function finishes and if I wait a couple seconds, Debug.Print will give me "IsNothing=True". If I comment out References.AddFromFile, Debug.Print gives me "IsNothing=False" no matter how long I wait.
It makes sense to me that since Access has to re-compile the VBA code after loading the library that all global variables are reset. I've experimented with moving the global variable into a class, but since I then need a global variable for the class, the class variable then gets reset instead. I tried using a local variable in the function to save the value of the global variable, but it looks like Access waits a couple seconds after the code is finished running to do the re-compile, so that doesn't work either. Does anyone have any other ideas to accomplish this?
I don't really know if this will solve the problem for this kind of reference, but in general, I don't use public variables for this kind of thing, but instead use a STATIC variable inside your function. It would be something like this:
Public Function SetObj() As Object
Static obj As Object
If (obj Is Nothing) Then
Set obj = Application
End If
Set SetObj = obj
End Function
Then you'd just use SetObj as an object for using your application. In a production app, you'd need tear-down code, too, but I've omitted that here.
I doubt this helps, but your code struck me as rather inefficient and incomplete.
I figured out a solution to my problem, and thanks #David-W-Fenton, as your answer gave me the idea. I use your approach in a library database for caching frequently-accessed values that are stored in a table but don't change after the initial startup. Those values aren't lost every time the references change, and that's when the light bulb lit up.
The solution is to put the global variable in a library database. Access looks to be only resetting global variables in the database that the reference is being loaded into - which makes sense after thinking about it. So since the library database isn't the one being re-compiled, it doesn't get it's global (or private or static) variables reset.
What I ended up doing was creating a new module in an existing library database. It has a private variable and two methods - one to set the variable, one to retrieve the variable value. In my menu front-end database, when the ribbon loads and calls my callback function, rather than saving the ribbon object in the front-end database, I pass it to this module for saving. I now no longer lose that ribbon reference whenever new databases are added to the library references on the fly.