Posts

Showing posts from October, 2000

Change SVN Repository URL

Answer : Given that the Apache Subversion server will be moved to this new DNS alias: sub.someaddress.com.tr : With Subversion 1.7 or higher, use svn relocate . Relocate is used when the SVN server's location changes. switch is only used if you want to change your local working copy to another branch or another path. If using TortoiseSVN, you may follow instructions from the TortoiseSVN Manual. If using the SVN command line interface, refer to this section of SVN's documentation. The command should look like this: svn relocate svn://sub.someaddress.com.tr/project Keep using /project given that the actual contents of your repository probably won't change. Note: svn relocate is not available before version 1.7 (thanks to ColinM for the info). In older versions you would use: svn switch --relocate OLD NEW Grepping the URL before and after might give you some peace of mind: svn info | grep URL URL: svn://svnrepo.rz.mycompany.org/repos/trunk/DataPortal

Appending A Dynamic Array In VBA

Answer : Use a variable and increment it, it makes no difference if the variable is larger than the ubound when the code completes: Sub Test() Dim myArray() As Double, X As Long X = 0 ReDim Preserve myArray(X) For Each cell In Range("Hello") If cell <> "" Then ReDim Preserve myArray(0 To X) myArray(X) = cell.Value X = X + 1 End If Next End Sub Change If UBound(myArray) > 0 Then to If UBound(myArray) >= 0 Then that will solve the problem. Sub Test() Dim myArray() As Double ReDim Preserve myArray(0) For Each cell In Range("Hello") If cell <> "" Then If UBound(myArray) >= 0 Then myArray(UBound(myArray)) = cell.Value ReDim Preserve myArray(0 To UBound(myArray) + 1) End If End If Next End Sub

24 Factorial Code Example

Example 1: calculate factorial int factorial ( int n ) { int res = 1 , i ; for ( i = 2 ; i <= n ; i ++ ) res *= i ; return res ; } Example 2: factorial of 8 function getFactorial ( $ int ) { $factorial = 1 ; for ( $i = $ int ; $i > 1 ; $i -- ) { $factorial *= $i ; } echo "The factorial of " . $ int . " is " . $factorial . '<br>' ; }

Matlab Min Function Code Example

Example: matlab min function minimum = min ( x ) if x is a 1 - dimensional array then the min returns the minimum number in the array and if x is a matrix then min returns an array which contains the minimum element from each column in the matrix

Automatic Vertical Scroll Bar In WPF TextBlock?

Answer : Wrap it in a scroll viewer: <ScrollViewer> <TextBlock /> </ScrollViewer> NOTE this answer applies to a TextBlock (a read-only text element) as asked for in the original question. If you want to show scroll bars in a TextBox (an editable text element) then use the ScrollViewer attached properties: <TextBox ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Auto" /> Valid values for these two properties are Disabled , Auto , Hidden and Visible . can use the following now: <TextBox Name="myTextBox" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.CanContentScroll="True">SOME TEXT </TextBox> Something better would be: <Grid Width="Your-specified-value" > <ScrollViewer> <TextBlock

Clojure.inspector

by Rich Hickey Full namespace name: clojure.inspector Overview Graphical object inspector for Clojure data structures. Public Variables and Functions inspect function Usage: (inspect x) creates a graphical (Swing) inspector on the supplied object Added in Clojure version 1.0 Source inspect-table function Usage: (inspect-table data) creates a graphical (Swing) inspector on the supplied regular data, which must be a sequential data structure of data structures of equal length Added in Clojure version 1.0 Source inspect-tree function Usage: (inspect-tree data) creates a graphical (Swing) inspector on the supplied hierarchical data Added in Clojure version 1.0 Source

ATMEGA328P-U Vs ATMEGA328-PU

Image
Answer : The main difference is the bit before the - . That is, the 328 vs the 328P. The "P" there denotes "Picopower" which allows the chip to run at very low power consumptions. Basically the P version is a more modern version of the non-P chip. There are probably other internal differences too but you will have to check the datasheets thoroughly for those. Everything after the - is to do with the packaging and environmental grading of the chip. For example PU is a -40C to +85C grade DIP chip. ANR is a -40C to +105C grade TQFP chip, etc. If you see 328P-U then that's probably a fake chip. There's no such thing as single U suffix. There are three die types: 328 328P 328PB all have different signature bytes which may or may not impact loading code into them. Generally tho the programming software needs to know which part type is being used, at a minimum for installing bootloader code. Serial downloading may end up ignoring the signatur

Apache Cordova - Uninstall Globally

Answer : Try sudo npm uninstall cordova -g to uninstall it globally and then just npm install cordova without the -g flag after cd ing to the local app directory Try this for Windows: npm uninstall -g cordova Try this for MAC: sudo npm uninstall -g cordova You can also add Cordova like this: If You Want To install the previous version of Cordova through the Node Package Manager (npm): npm install -g cordova@3.6.3-0.2.13 If You Want To install the latest version of Cordova: npm install -g cordova Enjoy! Super late here and I still couldn't uninstall using sudo as the other answers suggest. What did it for me was checking where cordova was installed by running which cordova it will output something like this /usr/local/bin/ then removing by rm -rf /usr/local/bin/cordova

Check Open Ports Linux Code Example

Example 1: linux how to see ports in use # Any of the following sudo lsof -i -P -n | grep LISTEN sudo netstat -tulpn | grep LISTEN sudo lsof -i:22 # see a specific port such as 22 sudo nmap -sTU -O IP-address-Here Example 2: how to check list of open ports in linux sudo lsof -i -P -n | grep LISTEN sudo netstat -tulpn | grep LISTEN sudo lsof -i:22 # see a specific port such as 22 sudo nmap -sTU -O IP-address-Here Example 3: linux how to see ports in use sudo netstat -tulpn | grep LISTEN sudo lsof -i:22 # see a specific port such as 22 Example 4: check what ports are open linux ## if you use linux sudo ss -tulw

Apache_Http_Server HTTP/2 Guide

This is the howto guide for the HTTP/2 implementation in Apache httpd. This feature is production-ready and you may expect interfaces and directives to remain consistent releases. The HTTP/2 protocol HTTP/2 is the evolution of the world's most successful application layer protocol, HTTP. It focuses on making more efficient use of network resources. It does not change the fundamentals of HTTP, the semantics. There are still request and responses and headers and all that. So, if you already know HTTP/1, you know 95% about HTTP/2 as well. There has been a lot written about HTTP/2 and how it works. The most normative is, of course, its RFC 7540 ( also available in more readable formatting, YMMV). So, there you'll find the nuts and bolts. But, as RFC do, it's not really a good thing to read first. It's better to first understand what a thing wants to do and then read the RFC about how it is done. A much better document to start with is http2 explained by Daniel St

Cannot Load Gulp Tasks: ReferenceError: Primordials Is Not Defined Code Example

Example 1: ReferenceError: primordials is not defined { "dependencies" : { "graceful-fs" : { "version" : "4.2.2" } } } Example 2: gulp serve primordials is not defined nodejs v10 . x && gulp v3 . x must be installed

Code To Run Gif Tkinter Code Example

Example: code to run gif tkinter #code by TigerhawkT3 (on YT and github) import tkinter from PIL import Image, ImageTk, ImageSequence class App: def __init__(self, parent): self.parent = parent self.canvas = tkinter.Canvas(parent, width=400, height=400) self.canvas.pack() self.sequence = [ImageTk.PhotoImage(img) for img in ImageSequence.Iterator( Image.open( r'gif2.gif'))] self.image = self.canvas.create_image(200,200, image=self.sequence[0]) self.animate(1) def animate(self, counter): self.canvas.itemconfig(self.image, image=self.sequence[counter]) self.parent.after(20, lambda: self.animate((counter+1) % len(self.sequence))) root = tkinter.Tk() app = App(root) root.mainloop()

Can You Run Xcode In Linux?

Answer : The low-level toolchain for Xcode (the gcc compiler family, the gdb debugger, etc.) is all open source and common to Unix and Linux platforms. But the IDE--the editor, project management, indexing, navigation, build system, graphical debugger, visual data modeling, SCM system, refactoring, project snapshots, etc.--is a Mac OS X Cocoa application, and is not portable. Nobody suggested Vagrant yet, so here it is, Vagrant box for OSX vagrant init https://vagrant-osx.nyc3.digitaloceanspaces.com/osx-sierra-0.3.1.box vagrant up and you have a MACOS virtual machine. But according to Apple's EULA, you still need to run it on MacOS hardware :D But anywhere, here's one to all of you geeks who wiped MacOS and installed Ubuntu :D Unfortunately, you can't run the editors from inside using SSH X-forwarding option. I really wanted to comment, not answer. But just to be precise, OSX is not based on BSD, it is an evolution of NeXTStep. The NeXTStep OS utilizes the Ma

Atom Download Windows Code Example

Example 1: atom install Use Atom not VSCode so STFU Cute Crab Download: .deb file: https://atom.io/download/deb .rpm file: https://atom.io/download/rpm Example 2: atom download good choice go ahead

Check If Cariable Isstring Python Code Example

Example: if type is string python isinstance ( s , str )

Canvas Arc Too Pixelated

Answer : You probably were setting the width of your canvas using CSS. Altering the width of a canvas element in CSS stretches the pixels within the canvas Eg. <canvas style='width:400px;height:400px'></canvas> Instead, you need to use the width and height properties of the canvas element itself to define how many pixels the canvas contains. Correct way: <canvas width='400px' height='400px'><canvas>

Angular 5 Download Excel File With Post Request

Answer : I struggle with this one all day. Replace angular HttpClient and use XMLHttpRequest as follows: var oReq = new XMLHttpRequest(); oReq.open("POST", url, true); oReq.setRequestHeader("content-type", "application/json"); oReq.responseType = "arraybuffer"; oReq.onload = function (oEvent) { var arrayBuffer = oReq.response; if (arrayBuffer) { var byteArray = new Uint8Array(arrayBuffer); console.log(byteArray, byteArray.length); this.downloadFile(byteArray, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'export.xlsx'); } }; oReq.send(body); Then modified the creation of the Blob in your downloadFile function: const url = window.URL.createObjectURL(new Blob([binaryData])); In your case the service will look something like this: DownloadData(model:requiredParams):Observable<any>{ return new Observable(obs => { var oReq = new XMLHttpReques

Best Gui Framework For Python 2020 Code Example

Example: python gui best Top 5 Best Python GUI Libraries PyQT5. Python Tkinter. PySide 2. Kivy. wxPython. This is a small list, though making gui s in Python is not really recommended. I would personally recommend a language such as C# for creating programs that need a gui.

Chrome / Safari Not Filling 100% Height Of Flex Parent

Answer : Solution Use nested flex containers. Get rid of percentage heights. Get rid of table properties. Get rid of vertical-align . Avoid absolute positioning. Just stick with flexbox all the way through. Apply display: flex to the flex item ( .item ), making it a flex container. This automatically sets align-items: stretch , which tells the child ( .item-inner ) to expand the full height of the parent. Important: Remove specified heights from flex items for this method to work. If a child has a height specified (e.g. height: 100% ), then it will ignore the align-items: stretch coming from the parent. For the stretch default to work, the child's height must compute to auto (full explanation). Try this (no changes to HTML): .container { display: flex; flex-direction: column; height: 20em; border: 5px solid black } .item { display: flex; /* new; nested flex container */ flex: 1; border-bottom: 1px solid white;

Can I Pass Default Value To Rails Generate Migration?

Answer : You can't: https://guides.rubyonrails.org/active_record_migrations.html#column-modifiers null and default cannot be specified via command line. The only solution is to modify the migration after it's generated. It was the case in Rails 3, still the case in Rails 6 Rails migration generator does not handle default values, but after generation of migration file you should update migration file with following code add_column :users, :disabled, :boolean, default: false you can also see this link - http://api.rubyonrails.org/classes/ActiveRecord/Migration.html Default migration generator in Rails does not handle default values, there is no way around as of now to specify default value defined through terminal in rails migration. you would like to follow below steps in order to achieve what you want 1). Execute $ rails generate migration add_disabled_to_users disabled:boolean 2). Set the new column value to TRUE/FALSE by editing the new migration file cr