Roland Mueller

Ranch Hand
+ Follow
since Oct 28, 2011
Roland likes ...
Android Java Linux
Merit badge: grant badges
For More
Finland
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
45
Received in last 30 days
0
Total given
48
Given in last 30 days
2
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Roland Mueller

Welcome to Coderanch!

I am not sure whether I understood your question.

My assumption: you asked how to import a Python dict(ionary) that is defined in another module.

A: Any element that is visible at the top level of some Python module can be imported. There is no distinction whether the element is a function, a class, or some variables.

Example: following Python file/module exists in the module path that includes the current work directory



Now another Python module or the Python console is able to import "a_dict":

First form imports the module and subsequently dict 'd' must be used together with module name:


In second form the import lists the elements that are imported, and these elements - here 'd' - are used without the module prefix:
2 days ago

Stephen Morris wrote:
From my own experience, SQL Server is broadly similar to Oracle: procedure-oriented, transactional, exception/error handling
Postgres has its own proprietary language PL/pgSQL and server side scripting can be done in other languages.
PL/pgSQL looks like it provides similar features to those of PL/SQL.

DB2 seems to be broadly similar to PL/SQL, but DB2 looks a little more low-level than PL/SQL: procedure-oriented, transactional



I think using any of these scripting languages results in some kind of vendor lock-in - if term "vendor" is allowed to use for opensource too.

This is not as such negative, but one should be aware of that.

In addition migrating a big existing DB to some other vendor is itself quite big project even without regarding procedural languages. there are not only differences in syntax or column types but also big differences how queries are implemented as execution plan and in the performance of them. The same SQL may be lightning fast in one DB and duck slow in another.


Stephen Morris wrote:
Here's a nice comparison between DB2, Oracle, and Postgres



Thanks a lot for this useful link !

Hello Stephen,

what level of application resilience is the target of your book? Is resilence targetting the consistence of data against corruption or is high availablity of the implemented services included too?

Another question is the target environment of the application(s) introduced in the book: are the solutions discussed both value for on-site DB instances and cloud DBs?


BR,
Roland
First, welcome to  Coderanch!

As you said the code works ok for a single forum and you want to support several forums without hardcoding the form names to the code.

Howerver, you did not specify how the data for N formums should be stored. There are some alternatives to do that:

(A) every forum has the same tables but in a separate schema: table names would then be prefixed with the schema name: e.g. 'a.forum_category'
(B) tables for every forum are prefixed:  e.g. 'a_forum_category'
(C)forums are in a separate table with a numeric key, and the key for each forum is an additional column in each table: this requires that all queries and other SQL statements have to be altered to address only a single forum

Alternatives A and B should require only changes in the first lines of the PHP code.

1 month ago
PHP
Python wheel is a package format that distributes python scripts together with prebuild binary stuff such as shared libraries. This allows the installer - let it be pip or some other one - to skip building a Python package from source packages.

What is the way to do this using the pysql wheel file instead of pip install? Thanks


pip can be used to install wheel or some other installer but in my understanding the wheel package itself cannot be used directly by python.

I don't know for sure why you want to have another solution than pip. My only guess is that you do not want to "pollute" your system's python with an installation of 'pysql' rather than using 'pysql' locally. Such a local usage of python packages can be achieved with an virtualenv or venv and by installing the wanted package(s) to the virtual environment.



1 month ago
java.sql.ResultSet has some getObject() methods e.g. to get a column value by column name or by column index.

However, to do something useful in the Java code of the application you most probably have to map the Object to some other type.

In many cases the application would steer the retrieval of data from the DB and it should therefore have knowledge about the concrete column types. Also in SELECT clauses a predefined list of columns (SELECT c1, .., cN FROM t) should be preferred over a wildcard SELECT (SELECT * FROM t) since it binds the app to the concrete structure of a given table. E.g. a SELECT returning an explicit list of columns may even work when the table t is extended with more columns.

 
1 month ago
A Session object of Python module requests can use a dict instead of encoding the parameter string by yourself. This may ease the search for errorness parameters. E.g. spaces are encoded with a + sign.

BTW you did not provide any information what kind of error did your code cause.



In you webserver's log you can see then the URL-encoded parameters:

1 month ago
Running Problem1Kt works too with plan java when providing the kotlin-runner and the work directory where ProblemKt.class is located are added to the classpath. Since this is done in Linux classpath has colons as delimiter.

1 month ago

aj Haasan wrote:
The below is kotlin file I created with name "Problem1.kt"



After running this, it generated .class file with name, "Problem1Kt.class"



I don't see any class in compiled code. also I couldn't find any of my source code related compilation . It just showing  { /* compiled code */ }

Please let me know what I'm missing.



Using the command line tools kotlinc and kotlin from kotlin-compiler package both   problem1.kt and my hello.kt compile to valid class files. Building with the IDE should result in producing the same *.class files.

HelloKt class I can even execute with plain java but class Problem1Kt  works only with kotlin since plain JVM missing some class(es).  

1 month ago
Just quoting from JEP 409. It tells that permitted classes must be inside the same package or inside the same module.

JEP 409: Sealed Classes

The classes specified by permits must be located near the superclass: either in the same module (if the superclass is in a named module) or in the same package (if the superclass is in the unnamed module). For example, in the following declaration of Shape its permitted subclasses are all located in different packages of the same named module:

package com.example.geometry;

public abstract sealed class Shape
   permits com.example.polar.Circle,
           com.example.quad.Rectangle,
           com.example.quad.simple.Square { ... }

Tim Holloway wrote:That's why the actual error message is "ORA-00903". Because you can look it up in English in the English-language Oracle messages guide or look it up in German in the German-language Oracle messages guide. Unfortunately, regardless of the language, the message is virtually useless.

If I got an error message beginning with ILF255I, I'd likewise know that I'd need to consult an IBM Messages and Codes manual, and that in fact, the Fortran Messages and Codes for Information-level message 255. Which, no doubt would be equally cryptic. That's just how mainframe error messages are.


The error message when I used the origiginal code was ORA-00904. rather than 00903. Please read my first post.

Roland Mueller wrote:Actually after pasting  https://livesql.oracle.com/apex/livesql/s/oyckv0q8q1zlb1nx6nga4wktu in a SQL sheet, then resetting the SQL sheet I received the "right" error message.
...


My first sentence may be not totally understandable (not even if I would have wrote it in German    ): of course I was executing the code behind the link and only after that resetting the sheet  and executing the errorness SQL in the sheet.
Actually after pasting  https://livesql.oracle.com/apex/livesql/s/oyckv0q8q1zlb1nx6nga4wktu in a SQL sheet, then resetting the SQL sheet I received the "right" error message.

I suspect that  the posted SQL code and the error message "ORA-00903: invalid table name" do not match. When the name of the table is deliberately changed "ORA-00942: table or view does not exist"  occurs. My only guess is the the error "... invalid table name" is caused by some unicode junk from copy&paste.








Does Mobaterm support RDP? I don't know Mobaterm just saw it in some Teams meetings with colleagues from India.

However, in VBox manual it is promised that RDP can be used after installing some required VBox extension.

Please note that extension packages for VBox are not opensource - as VBox itself - and can be only used by paying for them or for private usage!

https://www.virtualbox.org/manual/ch03.html#settings-display

3.6.2. Remote Display Tab

On the Remote Display tab, if the VirtualBox Remote Display Extension (VRDE) is installed, you can enable the VRDP server that is built into Oracle VM VirtualBox. This enables you to connect to the console of the virtual machine remotely with any standard RDP viewer, such as mstsc.exe that comes with Microsoft Windows. On Linux and Oracle Solaris systems you can use the standard open source rdesktop program. These features are described in Section 7.1, “Remote Display (VRDP Support)”.

   Enable Server: Select this check box and configure settings for the remote display connection.

2 months ago
Applying the information in https://www.baeldung.com/linux/set-static-ip-address should help.

Section 6 is about Redhat -based distributions and especially  "6.2. Create Interface Configuration File" contains a network interface example.
2 months ago