Posts

Showing posts from September 21, 2018

How to add a python generated macro-script to an excel-file by xlsx-writer module?

Image
Clash Royale CLAN TAG #URR8PPP How to add a python generated macro-script to an excel-file by xlsx-writer module? I have a python script, which generates a vba written macro variable for excel. A preview of the variable looks kind like this: macro = """Option Explicit Private Sub Worksheet_SelectionChange(ByVal Target As Range) ... End Sub""" In my python script I'm create a workbook with the xlsxwriter module and I would like to add this macro to my workbook within the python script. Does somebody know further information about this issue? I've already tried it with workbook.add_vba_project('./vbaProject.bin') , but it isn't working until now. workbook.add_vba_project('./vbaProject.bin') How did you extract the vbaProject.bin ? Did you use vba_extract.py – Siddharth Rout Aug 6 at 16:19 vbaProject.bin vba_extract.py By clicking "Post Your Answer", you acknowledge that you have read our updated terms of s

Dropwdown list from dynamic table

Image
Clash Royale CLAN TAG #URR8PPP Dropwdown list from dynamic table I have a dynamic table containing the following columns: COUNTRY(String), ACTIVE (Boolean),NAME(String) An example will be: COUNTRY(String), ACTIVE (Boolean),NAME(String) USA, True, Chair Canada, False, Table USA, False, Pen USA, True, Pencil Canada, True, Pencil Canada, True, Basket I want to create a data validation list with the names for every country that are active. The list should be dynamic as the table is constantly being changed. For the example, the data validation list should check whether the cell containing the country name is Canada or USA and if USA then: Chair, Pencil / if Canada: Pencil, Basket. Just to clarify one detail, would "Pencil" get listed twice? or just once? – cybernetic.nomad Aug 6 at 15:59 Twice, as the data depends on the country. I want to create a data validation list with the active names of the 3 different countries I have. @cybernetic.nomad – MTT Aug 6 at 16:

SQL copy a database

Image
Clash Royale CLAN TAG #URR8PPP SQL copy a database I have 2 servers A and B. I have a database in Server A and i want to copy to Server B. Including schema and all database attributes. I have tried Coping the using the copy wizard, it wouldnt work. I also tried using import data, wish imports the data in the table but without the attributes. If there is anyone that could help me of the best possible way to do this i would greatly appreciate it. Thank you Ever heard of a backup? backup, restore on second server. Done. This is EXTREMELY fundamental - everoyne having a server should first learn how to make a backup. Otherwise you WILL at one point be asked to work in another field because you just lost a lot of stuff because - backups are critical. And also useful for transporting data. – TomTom Aug 6 at 15:56 You have tagged two completely different databases here. mysql and sql-server are not the same thing. Please edit the tags so we can know how to help. – JNevil

Windows button ignores alpha channel for fully transparent image

Image
Clash Royale CLAN TAG #URR8PPP Windows button ignores alpha channel for fully transparent image BS_AUTORADIOBUTTON|BS_PUSHLIKE|BS_BITMAP CreateDIBSection BITMAPINFO BI_RGB ppvBits BM_SETIMAGE So far, I can set the RGB and alpha by manipulating the pixels by hand. I tested that even semi-transparent (non-premultiplied) alpha values look good. As far as I can tell, everything works, except if all pixels in the image are transparent. In that case, the button apparently ignores the alpha value, simply displaying a rectangle with each pixel having the respective color with full opacity. I found a hint that Windows - at least in some cases - actually seems to interpret images whose pixels' alpha values are all 0 as completely opaque images: When the window manager sees a 32bpp bitmap, it looks at the alpha channel. If it's all zeroes, then it assumes that the image is in 0RGB format; otherwise it assumes it is in ARGB format Is this behavior documented somewhere? Why woul

How to highlight an input field text in angular 6

Image
Clash Royale CLAN TAG #URR8PPP How to highlight an input field text in angular 6 This is (custom.component.html) file <input type="text" [(ngModel)]="name" (ngModelChange)="onNameChange()"> <div *ngFor="let s of filteredScreenshots"> s </div> <mat-card class="example-card" *ngFor="let filteredScreen of filteredScreens" let i = index> <mat-card-header> <div mat-card-avatar class="example-header-image" > <img mat-card-image class="list-img" src="filteredScreen?.img" > </div> <mat-card-content class="names"><b> filteredScreen?.name </b></mat-card-content> </mat-card-header> </mat-card> This is(customer.component.ts) import Component, OnInit from '@angular/core'; import Http from '@angular/http'; import map from 'rxjs/operators' import * as _ from 'lodash';

Filter , group by and count in pandas?

Image
Clash Royale CLAN TAG #URR8PPP Filter , group by and count in pandas? A TSV file contains some user event data : user_uid category event_type "11" "like" "post" "33" "share" "status" "11" "like" "post" "42" "share" "post" what is the best way to get the number of post events for each category and for each user_id? post we should show the following output: user_uid category count "11" "like" 2 "42" "share" 1 1 Answer 1 Clean up any trailing whitespace so that things group properly. Filter your DataFrame , and then apply groupby + size DataFrame groupby size df['category'] = df.category.str.strip() df['user_uid'] = df.user_uid.str.strip() df[df.event_type == 'post'].groupby(['user_uid', 'category']).size() Output: user_uid category 11 like 2 42 share 1 dtype: int64 Did you try

Using teamviewer on mac to sign in on windows

Image
Clash Royale CLAN TAG #URR8PPP Using teamviewer on mac to sign in on windows I am using teamviewer on my mac to sign in on a windows computer. I get stuck at the lock screen on windows because there is no alt command. I try and use the on screen keyboard and it still doesn't work. 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.

Dormant service-worker attack - any mitigation possible?

Image
Clash Royale CLAN TAG #URR8PPP Dormant service-worker attack - any mitigation possible? Looking at this article: https://medium.com/@peter_szilagyi/augur-hijack-via-dormant-service-workers-bea254258f98 the author discloses an attack to localhost -run decentralized apps via dormant web workers. He shows it in the context of the Augur platform, but it applies to any decentralized app which wants to run its interface via localhost . localhost Augur localhost Now, granted, the attack is only possible if the attacker manages to install a malicious web server on the target machine first, which then would install the malicious service worker code. One could say this is unlikely, and if the case, then the system is severely compromised anyways. But in the context of crypto-currencies and decentralized applications, it could well be the intention of an attacker to not be noticed of having breached the target system. In that case the targeted user is in serious trouble, as the malicious co

How to live stream my content to android application?

Image
Clash Royale CLAN TAG #URR8PPP How to live stream my content to android application? I'm using youtube live to stream my sports event on android mobile application. But it not a viable option because whenever I stop the stream and start a new one, the video code of youtube live stream changes, so I cannot stream again if I stop the current stream. Below is the code for my stream : youTubePlayerView = (YouTubePlayerView)findViewById(R.id.youtube_player_view); onInitializedListener = new YouTubePlayer.OnInitializedListener() { @Override public void onInitializationSuccess(YouTubePlayer.Provider provider, YouTubePlayer youTubePlayer, boolean b) youTubePlayer.play(); youTubePlayer.setFullscreen(true); youTubePlayer.loadVideo("video-code"); Is there any method to put the new video code automatically using youtube API? Please help. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie p

How to insert/update a single record using a MERGE statement with Spring JDBC

Image
Clash Royale CLAN TAG #URR8PPP How to insert/update a single record using a MERGE statement with Spring JDBC I have an update/insert SQL query that I created using a MERGE statement. Using either JdbcTemplate or NamedParameterJdbcTemplate, does Spring provide a method that I can use to update a single record , as opposed to a Batch Update? Since this query will be used to persist data from a queue via a JMS listener, I'm only dequeuing one record at a time, and don't have need for the overhead of a batch update. If a batch is the only way to do it through Spring JDBC, that's fine... I just want to make certain I'm not missing something simpler. Just use update method, for example this one: JdbcTemplate#update instead of BatchUpdate. Update updates a single record, batchUpdate updates multiple records using JDBC batch. – krokodilko Aug 6 at 16:55 update Update batchUpdate @krokodiko : Thank you! That is exactly what I needed to know. You were first in,

C++ delete - It deletes my objects but I can still access the data?

Image
Clash Royale CLAN TAG #URR8PPP C++ delete - It deletes my objects but I can still access the data? I have written a simple, working tetris game with each block as an instance of a class singleblock. class SingleBlock public: SingleBlock(int, int); ~SingleBlock(); int x; int y; SingleBlock *next; ; class MultiBlock public: MultiBlock(int, int); SingleBlock *c, *d, *e, *f; ; SingleBlock::SingleBlock(int a, int b) x = a; y = b; SingleBlock::~SingleBlock() x = 222; MultiBlock::MultiBlock(int a, int b) c = new SingleBlock (a,b); d = c->next = new SingleBlock (a+10,b); e = d->next = new SingleBlock (a+20,b); f = e->next = new SingleBlock (a+30,b); I have a function that scans for a complete line, and runs through the linked list of blocks deleting the relevant ones and reassigning the ->next pointers. SingleBlock *deleteBlock; SingleBlock *tempBlock; tempBlock = deleteBlock->next; delete deleteBlock; The game works, blocks are deleted correctly and everythi

cannot connect to existing AWS Cloud9 Environment using new computer

Image
Clash Royale CLAN TAG #URR8PPP cannot connect to existing AWS Cloud9 Environment using new computer I have just switched to a new MacBook and now I can't connect to my AWS Cloud 9 environment. It just hangs and says taking longer than expected. I can't remember when I initially set up my environment if I needed to download any private keys onto my computer. If so is is possible to get another key for the existing environment to install on my new computer. Or is this another issue? 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.

Cordova video player not working

Image
Clash Royale CLAN TAG #URR8PPP Cordova video player not working I installed the plugin correctly following the tutorials and even the documentation, but whenever I present my account through DEVAPP, I get a message: "console.warn: Native: tried calling VideoPlayer.play, but the VideoPlayer plugin is not installed. console.warn: Install the VideoPlayer plugin: 'ionic cordova plugin add https://github.com/moust/cordova-plugin-videoplayer.git' I do not really know what might be causing this error as I installed it and I can see in installed plugins. But when I try to run the application, it says it is not installed. Could someone help me with this? Remove node_modules and install again that might be helpful. – Paresh Gami Aug 7 at 13:05 How do I do this? This folder has many files, it already installs all of them again? – Felipe XST Aug 7 at 13:39 By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service,

GoLang write STDOUT and STDERR to log15 file

Image
Clash Royale CLAN TAG #URR8PPP GoLang write STDOUT and STDERR to log15 file I have GoLang Application where I use log15 to write logs to a file. The package I use for log15 is gopkg.in/inconshreveable/log15.v2 I run into a situation where I want to write the information of STDERR and STDOUT to the same file where I write log15 logs. Is there any possible ways to achieve the same gopkg.in/inconshreveable/log15.v2 2 Answers 2 For creating a log file to log data of stderr or stdout. Create a file using OpenFile and then SetOutput to the file as. OpenFile SetOutput f, err := os.OpenFile("EDUC_LOG", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0664) if err != nil panic(err) defer f.Close() log.SetOutput(f) This will print the output to log file everytime you try to log some value like in case of an error as if err != nil log.Println(err) // this will create a file if not created to output the log in a file. Edited: Fatal error will print the output on stdout rather than in a

Multiple simultaneous AJAX GET requests block the server until data is returned

Image
Clash Royale CLAN TAG #URR8PPP Multiple simultaneous AJAX GET requests block the server until data is returned I have a rails application where I'm displaying charts using the gridList library. The chart data is fetched from a controller method (in JSON format) asynchronously using AJAX. When the page is loaded initially, each gridlist item shows loading icon and at the same time ajax call is made to the server to fetch the data. Each individual grid item makes a seperate ajax call. The charts are being rendered properly but the issue is that while the AJAX calls are ongoing, the server does not respond to any other requests like refreshing the page or changes in routes. It get blocked until all the charts are loaded, after which the previously called action occurs. It is a server side issue as the javascript code on front-end works fine while the AJAX call is ongoing. The grid items are rendered using the partial shown below %li.grid_item data: id: chart.id .chart-loading //

Synchronic code with map functions

Image
Clash Royale CLAN TAG #URR8PPP Synchronic code with map functions I think I got totally lost, I thought I had at least some grasp on async stuff, but this particular case got me confused. I perform a search on the database and expect an array of results. Then i map through the array, check for flag and push info to the array. However, I'm doing async calls wrong, because when I console log the finalData it's always empty, therefore it resolves before it should. Here are my attempts, tried it both ways: let finalData = ; let lastWeek = new Date(); lastWeek.setDate(lastWeek.getDate() - 7); db.find( createdAt: "$gte": lastWeek ).then((records, err) => async function test() let array = _.map(records, (record) => db2.find( 'foo': record.id ).then((bar, err) => if (bar.endDate) let data = `Email: $record.email`; finalData.push(data); else let data = `Email: $record.email`; finalData.push(data); ); ); await Promise.all(array).then(() =>

Finding Outlook Email Address of mailitem via SQL/VBA with Access

Image
Clash Royale CLAN TAG #URR8PPP Finding Outlook Email Address of mailitem via SQL/VBA with Access Using Access/VBA/SQL to get various email properties from the inbox as I transfer it into a new table "MyInbox". Sub InboxImport() Dim SqlString As String Dim ConnectionString As String Dim EmailTableName As String Dim UserIdNum As String Dim EmailAddr As String Dim olNS As Outlook.NameSpace Dim olFol As Outlook.Folder Set ol = CreateObject("Outlook.Application") Set olNS = ol.GetNamespace("MAPI") Set olFol = olNS.GetDefaultFolder(olFolderInbox) EmailTableName = "MyInbox" UserIdNum = Environ("USERNAME") '1277523A... EmailAddr = olFol.Parent.Name 'Gives your user email address ConnectionString = "Outlook 9.0;MAPILEVEL=" & EmailAddr & "|;PROFILE=Default Outlook Profile;TABLETYPE=0;TABLENAME=MyInbox;COLSETVERSION=12.0;DATABASE=C:Users" & UserIdNum & "AppDataLocalTemp" SqlStr