2018-10-22         Selena

How to change Modal state from outside the React class?

I am trying to call my modal by changing the state from outside the react class. But so far no luck. I tried the following:I have a method named Portfolio which needs to activate the modal once user click on the Imageconst Portfolio = (props) => <div className="col-sm-4"> <div className="mb-2"> <img onClick={this.toggle} className="card-img-top" src={"/assets/imgs/project/"+props.portfolio.img_thumb} alt="" /> </div></div>Here is the Class that contain the state and the modal. But I cannot change ...

 javascript                     1 answers                     82 view
 2018-10-22         Selena

C# WinForms User/Permission management

Can anyone provide me an example WinForms application that implements the concept of User authentication and authorization one the basis of Roles or Groups?The application should allow access of users to the main-menu on the basis of their roles. If you are building the menu from a database table, you can security trim it by joining it to another table or view that excludes records on the basis of the permissions set.The diagram below illustrates the basics of setting up role permissions for users, and contains a couple of other tables for security trimming individual co...

 c#                     1 answers                     67 view
 2018-10-22         Selena

Deploy multiple functions using serverless creating each function with all files in it

I am working on serverless. I have created a project using serverless create. Then I have added multiple lambda functions to it. Whenever I deploy, every function is having the entire tree structure as which is not my requirement. I used indivudually: true under package. Still no use. Please help me solve this.Thank you... We have accomplished similar need as follows:"AWS Lambda Functions Code in Java 8 with Maven as dependency and build tool"All the functions are defined in single deployment package and at project level all dependencies are controlled through single Mav...

 amazon-web-services                     1 answers                     30 view
 2018-10-22         Selena

How to use Numpy .tobytes() to serialize objects

How do you serialized/deserialize a numpy array?A = np.random.randint(0, 10, 40).reshape(8, 5)print(A)print (A.dtype)snapshot = Aserialized = snapshot.tobytes() [[9 5 5 7 4] [3 8 8 1 0] [5 7 1 0 2] [2 2 7 1 2] [2 6 3 5 4] [7 5 4 8 3] [2 4 2 4 7] [3 4 2 6 2]] int64Returns deserialized = np.frombuffer(serialized).astype(np.int64) print (deserialized) [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0] There is a mismatch between the default dtype used to generate A and in np.frombuffer. Work...

 python-3.x                     1 answers                     9 view
 2018-10-22         Selena

Cannot use new command inside angular-cli project

It's quite possible that an angular project was accidentally created inside my home folder in mac osx. So every time I try and create a new project using the angular-cli I receive "You cannot use the new command inside an angular-cli project". I've deleted all associated files with scaffolded project but the error persists. Are there any underlying files that need to be deleted to resolve this error? Somewhere in a parent directory is a Angular-Cli project or where an ng init was ran. You have do go up your file structure and find the node_modules folder and delete it al...

 angular-cli                     2 answers                     12 view
 2018-10-22         Selena

What's the intended use of _fread_nolock, _fseek_nolock?

we have a C++ class which basically reads and writes vectors from a binary file. An exemplary read function that loads a single vector into memory looks like this:int load (const __int64 index, T* values) const { int re = _fseeki64(_file, index * _vectorSize + _offsetData, SEEK_SET); assert(re == 0); size_t read = fread(values, sizeof(T), _vectorElements, _file); assert(read == _vectorElements); return 0;}Out programs are multithreaded with OpenMP and multiple threads access the same file at the same time. To avoid issues because of multiple threads we always cover the fun...

 c++                     3 answers                     44 view
 2018-10-22         Selena

ASP.NET how to use __doPostBack from Custom JavaScript with Master/Content Pages

In a simple aspx page I can have a custom JavaScript function postback as describedin http://www.xefteri.com/articles/show.cfm?id=18 The simple page uses a linkbutton:<asp:LinkButton id="CreateFile" runat="server" onclick="CreateFile_Click" />with code behind that has the VB subroutine:Sub CreateFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)and a Javascript custom function that does: __doPostBack('CreateFile','');When I move the code to a content page with a corresponding master page thesimple example no longer works.I'm aware that server contr...

 asp.net                     2 answers                     76 view
 2018-10-22         Selena

How to get next/previous record in MySQL?

Say I have records with IDs 3,4,7,9 and I want to be able to go from one to another by navigation via next/previous links. The problem is, that I don't know how to fetch record with nearest higher ID.So when I have a record with ID 4, I need to be able to fetch next existing record, which would be 7. The query would probably look something likeSELECT * FROM foo WHERE id = 4 OFFSET 1How can I fetch next/previous record without fetching the whole result set and manually iterating?I'm using MySQL 5. next:select * from foo where id = (select min(id) from foo where id > 4)...

 sql                     20 answers                     74 view
 2018-10-22         Selena

Oracle 11g split text column to rows

I have table:ID |Values-----+--------------------------------1 |AB,AD2 |AG, ... ,BD3 |AVHow can i transform it to:ID |Value-----+------1 |AB1 |AD2 |AG... |...2 |BD3 |AV Using the built-in XML functions, you can do it like that:with sample_data as( select 1 id, 'AB,AD' vals from dual union all select 2, 'AG,AK,AJ,BA,BD' from dual union all select 3, 'AV' from dual)select id, cast(t.column_value.extract('//text()') as varchar2(10)) val from sample_data, table( xmlsequence( xmltype( '<x><x>' || replace(vals, ',', '</x><...

 sql                     2 answers                     37 view
 2018-10-22         Selena

Executing a long SQL script on Microsoft SQL Server 2017

I need to execute a SQL script (~5000 lines) with DDL and DML commands on a new instance of a Microsoft SQL Server 2017 through a Java application, already with connection pools and data sources deployed and configured. Searching for a solution the only method I have found is to load the script to buffer, read it, and break each line into a Statement and then send each of those statements individually to the database instance, like in this example. Is there a more elegant or simple way of doing this? After researching for a solution I concluded that my first approach ...

 java                     1 answers                     52 view
 2018-10-22         Selena

Kafka - NullPointerException in Send

I'm using Kafka from a Spark application to send some notifications to a topic. I see loads of the following exception in my Spark logs, and the message is not delivered to the topic. 15/09/08 03:29:24 ERROR Sender: Uncaught error in kafka producer I/O thread: java.lang.NullPointerException at org.apache.kafka.common.network.NetworkReceive.complete(NetworkReceive.java:48) at org.apache.kafka.common.network.Selector.poll(Selector.java:249) at org.apache.kafka.clients.NetworkClient.poll(NetworkClient.java:192) at org.apache.kafka.clients.producer.internals.Sender....

 apache-kafka                     2 answers                     25 view
 2018-10-22         Selena

What is double dot(..) and single dot(.) in Linux?

The ls -ai command shows that . and .. have their inodes same as current directory and parent directory, respectively.Could anyone tell me what exactly . and .. are?Are they real files or even hard links? But as I have known, it's not allowed to create a hard link to a directory. They are special name-inode maps which do count as hard-links (they do increase the link-count) though they aren't really hard-links, since, as you said, directories can't have hard-links. Read more here: Hard links and Unix file system nodes (inodes) [XXX]. represents the directory you are ...

 linux                     4 answers                     14 view
 2018-10-22         Selena

Application Insights for applications that hosted on my own server

I've just started working with Microsoft Application Insights and I've started with some videos and this article on Microsoft website. It seems very powerful and promising. Can anyone tell me what feature will I loose if I run my applications on my own servers instead of Azure?P.S:I develop ASP.net applications and use log4net usually for logging. There are documentation: If you can redeploy and application - just install Microsoft.ApplicationInsights.Web NuGet. Or in Visual Studio click "Add Application Insights". Details are here: https://azure.microsoft.com/en-us/doc...

 asp.net                     2 answers                     56 view
 2018-10-22         Selena

Add column after another column

How can I add a column after another column to a database using Alembic or SQLAlchemy? That would be equivalent to this SQL clause: ALTER TABLE fooCHANGE COLUMN barbar COLUMN_DEFINITION_HEREAFTER OTHER_COLUMN;-- orALTER TABLE foo ADD COLUMN baz AFTER bar;I also tried the suggestion in this mailing list thread, but it didn't help.While the order doesn't matter when querying, it helps readability for large tables when in the SQL shell. Use ALTER with AFTER to specify where to place the column.ALTER TABLE foo CHANGE COLUMN foo1 foo1 INT(10) UNSIGNED NULL DEFAULT NULL AFTER...

 python                     1 answers                     27 view
 2018-10-22         Selena

Getting a Model dynamic by knowing its name

I use Django 2.1.I have a general utility/function(using celery) that I call from the save method of a Model(is an abstract Model, inherited by other Models).Because the data from the function will be serialize, I pass to it the Model name and PK.class A(models.Model) def save(self, *args, **kwargs): send_async(model_name=type(self).__name__, pk=self.id))class B(A)class C(A)Later, I want to query the Model, but I don't know how to get the Model:I tried: model = apps.get_model('django_app_name.{}'.format(model_name)) I get the following error:No installed app with labe...

 django                     3 answers                     95 view
 2018-10-22         Selena

Datatables colReorder saving WITHOUT statesave

I am using datatables and am using colReorder and need to save the state of the columns without using statesave(I am not allowed to use localcache). I do however have a preference table in my database for storing this kind of information in JSON format.I have looked at colReorder.order() which looks like what I need to get the order.What I'm thinking so far is on a column change, call colReorder.order() and place that returned array in my preferences table and then on re-initialization use that to re-order the table.So my question/what I need help on is this: On a change of...

 javascript                     2 answers                     48 view

Page 1 of 145  |  Show More Pages:  Top Prev Next Last