Posts

Showing posts with the label database

How can I add files to GitLab with `python-gitlab`?

How can I add files to GitLab with `python-gitlab`? Using Django, I’d like to sync the files in the database with git repositories on my GitLab instance via python-gitlab . python-gitlab Here you can find my Python code: import gitlab import base64 import os from .models import Meme from django.conf import settings class Sync: def sync () : gl = gitlab.Gitlab('<GitLab URL>', private_token='xxxxxxxxxxxxxx') for meme in Meme.objects.all(): meme_title = meme.meme_title meme_file = str(meme.meme_file) root = settings.MEDIA_ROOT place = os.path.join(root, meme_file) # Create a new project on GitLab. project = gl.projects.create({'name': meme_title }) data = { 'branch': 'master', 'commit_message': 'Automatic commit via sync.py.', 'actions': [ { ...

ASP.NET delete specific rows from gridview

ASP.NET delete specific rows from gridview I need help with following problem. I try to delete specific rows from gridview. Code bellow works well, but when page is loading its show all data in database. How can I filter data? I mean when page is loading it shows nothing, but after type some text in text box, it shows me rows with that text and I can delete some of that rows with text from text box by check checkbox and button. This is my code. Pls help me. Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load If IsPostBack Then GetData() End If BindGrid() End Sub Private Sub BindGrid() Dim constr As String = ConfigurationManager _ .ConnectionStrings("conString").ConnectionString() Dim query As String = "select * from TestCustomers" Dim con As New SqlConnection(constr) Dim sda As New SqlDataAdapter(query, con) Dim dt As New DataTable() sda.Fill(dt) gvAll.DataSource = dt ...

Store array and update record in database using codeigniter

Image
Store array and update record in database using codeigniter I am storing dynamic array as well as update the "max_quantity" table in database. The problem is that when update the record than it will sum all the quantity values and subtract it from the 1st value of "max quantity table". But I want that array of quantity is subtracted its own quantity value which is present in the database. This is my code in view <?php $i=1; foreach($result as $row){ ?> <td class="pr-right" style='width:130px; text-align: center; '> <input type="text" min="1" step="1" name="quantity" step="1" class="container" value="" onfocus="this.value = '';" onblur=";" style="width: 60px" id="quantityT<?php echo $i;?>" onkeyup="CalculatePrice (<?php echo $i;?>,<?php echo $row->max_quantity; ?...

What is the difference between Non-Repeatable Read and Phantom Read?

Image
What is the difference between Non-Repeatable Read and Phantom Read? What is the difference between non-repeatable read and phantom read? I have read the Isolation (database systems) article from Wikipedia, but I have a few doubts. In the below example, what will happen: the non-repeatable read and phantom read ? SELECT ID, USERNAME, accountno, amount FROM USERS WHERE ID=1 1----MIKE------29019892---------5000 UPDATE USERS SET amount=amount+5000 where ID=1 AND accountno=29019892; COMMIT; SELECT ID, USERNAME, accountno, amount FROM USERS WHERE ID=1 Another doubt is, in the above example, which isolation level should be used? And why? en.wikipedia.org/wiki/Isolation_(database_systems) – Pavel Veller Jun 15 '12 at 1:59 8 Answers 8 From Wikipedia (which ...

Linking 2 data frames and returning a value using lookup

Linking 2 data frames and returning a value using lookup I'm a beginner in coding and data in general so any help I can get would be really helpful. If I have a data frame as below,where every matchup is a tuple. df1 = Team A Player 1.1 Team A Player 2.1 Team A Player 3.1 ('Max', 'Hatteberg') ('Hatteberg', 'Tejada') ('Max', 'Rincon') ('Tejada', 'Brown') ('Hatteberg', 'Rincon') ('Hatteberg','Brown') and so on.. and I have a crosstable: df2 = Max Hatteberg Tejada Brown Rincon Max NaN -1.0 +2.0 -8.0 +5.0 Hatteberg +1.0 NaN +2.5 +3.0 0 Tejada -2.0 -2.5 NaN +5.5 -3.5 Brown +8.0 -3.0 -5.5 NaN +2.8 Rincon -5.0 0 +3.5 2.8 NaN And I wanted for each matchup to return a value as so df1 = match...

Parsing CSV into database and back

Image
Parsing CSV into database and back I’m in the planning stage of a project currently and we have to make our software work with other client systems. One of these systems is for managing orders within their business, and we need the information regarding stock. Sadly, they have no API, and users can only manually export a CSV file. I can’t come up with the best solution on how to get this CSV data in to our app. At the moment, all I can think of is a manual CSV upload feature that we can use to parse the data in to our database. The main issue is that any changes we make to the data has to be put back into their system, which currently is through CSV upload also. We are supplied no reference data or anything that will help us map the data accurately. All of this on top of the fact that it has to work across multiple devices, probably simultaneously. Can anyone give me an idea of what route to take to solve this problem, and if necessary, should I try to extend the project and recommend ...

Dissplay result sqlite query in textview

Dissplay result sqlite query in textview I tried to calculate a report and displays the result in the texview "edt1". But it's not displayed. there is mydatabasehelper : public void calculrapport(Argent a) { db = this.getWritableDatabase(); String query = "select sum(Entree) from Argent where date between "datedebut" and "datefin" ;"; Cursor cursor = db.rawQuery(query , null) ; int count = cursor.getCount(); } There is my class Rapport.java : public void onOKClick ( View v ) { if (v.getId() == R.id.okrapport) { EditText datedebut = (EditText) findViewById(R.id.datedebut); EditText datefin = (EditText) findViewById(R.id.datefin); String strdatedebut = datedebut.getText().toString(); String strdatefin = datefin.getText().toString(); Argent a = new Argent(); helper.calculrapport(a); edt1.setText( ); } } Thanks in advance. 1 Answe...

Save MS ACCESS attachments with python

Save MS ACCESS attachments with python This seemed pretty simple but it wasn't. The goal was to create an offline database with forms so Users could fill data that will later be put into reports. The catch is that this reports have complex formating and pictures so my idea was to pull data from MS ACCESS (can create tables and forms that manage attachments pretty well) and insert it into word templates using doctpl. My problem is that I can't manage to pull the attached pictures in the ACCESS tables. I've tried using win32com.client like this: import win32com.client daoEngine = win32com.client.Dispatch('DAO.DBEngine.120') db = r"C:UsersPDocumentsdb.accdb" daoDB = daoEngine.OpenDatabase(db) query = "SELECT picture FROM Galery WHERE ID=13" daoRS = daoDB.OpenRecordset(query,2) daoRS.Edit() daoRS.Fields["picture"].SaveToFile("C:UsersPCA037Documents\") daoDB.Close() But it returns error: (-2147352567, 'Exception occurred.',...

Use condition to check for bitwise data in dynamodb

Use condition to check for bitwise data in dynamodb I have fixed length binary range key in a DynamoDB attribute. In database with value 100110. I want to get the row which have 1 in 3/4/5 bit of attribute or any other solution to check for condition to satisfy the value exists. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.