qid int64 1 74.7M | question stringlengths 15 58.3k | date stringlengths 10 10 | metadata list | response_j stringlengths 4 30.2k | response_k stringlengths 11 36.5k |
|---|---|---|---|---|---|
18,064,785 | I have the following query which is driving me insane:
```
$getLowestPriceN = $wpdb->get_results("SELECT *
FROM $table
WHERE post_id = '$post->post_id'
AND meta_key = '_wholesale_price'
... | 2013/08/05 | [
"https://Stackoverflow.com/questions/18064785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1214660/"
] | I read your question and I think you want to make a single watch page with your all video.
If stand alone player is having a playlist its may be ok. I suggest you can use some js library you 're not necessary to learn PHP and MYSQL. I found this Library
<http://mediafront.org/osmplayer/#.Uf_wrzmy_Dc>
I think its v... | Here is the method for youtube.com Video embed Php Code:
You can see URL Here `https://www.youtube.com/embed/XXX`. Here `XXX` you need to put this PHP code :
```php
<? php echo $_GET['id']; ? >
```
You should need to remove the space between `<?` and `php`from the start of the example `<? php` and at the end you onl... |
15,896,521 | Hello coders. I have a problem with inserting data into a database, can you please help me with the controller function?
Here is my php form:
```
<form method='post' action='<?php echo site_url('a3_bus_system/output')?>'>
<div class="_25">
<strong>Route Name/Number</strong>
<br/>
<input ty... | 2013/04/09 | [
"https://Stackoverflow.com/questions/15896521",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2259307/"
] | Do you have the model already made? In Codeigniter you are supposed to do all your direct DB activities with a model. All you need to know about models is explained here: <http://ellislab.com/codeigniter/user-guide/general/models.html>
Once there you would do the insert like explained here: <http://ellislab.com/codeig... | You cant post array in Database directly...
Serialize the data before inserting
and Unserialize after fetching |
20,892,689 | I'm looking to do a SQL output with most updated price of product. The product\_price can be updated multiple times for the product number, therefore creating more than one row. I'm looking to eliminate more than one row per product\_number.
```
SELECT
product_number
,product_price
,MAX(update_timestamp)
FROM pr... | 2014/01/02 | [
"https://Stackoverflow.com/questions/20892689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2280153/"
] | There are a couple ways of doing this. My preferred is a subquery. First get the product number and it's maxtimestamp:
```
SELECT product_number
,MAX(update_timestamp) as maxtimestamp
FROM product_price
group by product_number
```
Now turn that into a subquery and inner join it to the first table to filter all but... | If you just want the most updated then try sticking a TOP 1 clause in it and remove the MAX: SELECT TOP 1
product\_number
,product\_price
,update\_timestamp
FROM product\_price
ORDER BY 1,2 |
20,892,689 | I'm looking to do a SQL output with most updated price of product. The product\_price can be updated multiple times for the product number, therefore creating more than one row. I'm looking to eliminate more than one row per product\_number.
```
SELECT
product_number
,product_price
,MAX(update_timestamp)
FROM pr... | 2014/01/02 | [
"https://Stackoverflow.com/questions/20892689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2280153/"
] | There are a couple ways of doing this. My preferred is a subquery. First get the product number and it's maxtimestamp:
```
SELECT product_number
,MAX(update_timestamp) as maxtimestamp
FROM product_price
group by product_number
```
Now turn that into a subquery and inner join it to the first table to filter all but... | Assuming that you want the last updated price *for each product*, then try this:
```
SELECT
Ranked.product_number,
Ranked.product_price,
Ranked.update_timestamp
FROM
(
SELECT
pp.product_number,
pp.product_price,
pp.update_timestamp,
DENSE_RANK() OVER (
PARTITION BY pp.product_number
... |
20,892,689 | I'm looking to do a SQL output with most updated price of product. The product\_price can be updated multiple times for the product number, therefore creating more than one row. I'm looking to eliminate more than one row per product\_number.
```
SELECT
product_number
,product_price
,MAX(update_timestamp)
FROM pr... | 2014/01/02 | [
"https://Stackoverflow.com/questions/20892689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2280153/"
] | There are a couple ways of doing this. My preferred is a subquery. First get the product number and it's maxtimestamp:
```
SELECT product_number
,MAX(update_timestamp) as maxtimestamp
FROM product_price
group by product_number
```
Now turn that into a subquery and inner join it to the first table to filter all but... | try this
```
SELECT
product_number
,product_price
,update_timestamp
FROM product_price
ORDER BY update_timestamp DESC LIMIT 1
```
you order by `update_timestamp` and then take the first result.
and if you want get every product its latest update time then use this
```
SELECT
p.*
FROM
product_price ... |
10,100,126 | I am creating a GUI using dojo slider. Beside the slider there is a text box which will be used to display the current value of the slider.
What I want is that each time the slider is slided, the current value of the slider appears on the text box. Next, this value will be used in further calculation and the result wi... | 2012/04/11 | [
"https://Stackoverflow.com/questions/10100126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1221330/"
] | Here are a couple links that explain how to solve this problem with ActiveMQ 5.9:
* <https://issues.apache.org/jira/browse/AMQ-3394>
* <https://planet.jboss.org/post/coming_in_activemq_5_9_a_new_way_to_abort_slow_consumers>
To summarize:
* if the consumer JVM dies, the JMS connection between broker and consumer will... | see <http://activemq.2283324.n4.nabble.com/Acknowledgement-Timeout-td4531016.html>
>
> There is no support for this with the redelivery policy. jms is
> connection oriented, so the assumption is that if the connection is
> alive and there is no ack, the consumer has a good reason not to ack
> yet.
>
>
> |
70,258,664 | How do I make the square move when pressing the "d" button (for example) on the keyboard?
```
from tkinter import *
root = Tk()
root.title('Snake')
root["width"] = 400
root["height"] = 400
field = Canvas(root)
x = 0
y = 0
def snake(x, y):
field.create_rectangle(10, 20, 30, 40)
field.grid(row=x, column=y)
... | 2021/12/07 | [
"https://Stackoverflow.com/questions/70258664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17454874/"
] | This is one way you can do it:
```
import tkinter as tk
from tkinter import Canvas
root = tk.Tk()
root.title('Snake')
root.geometry("450x450")
w = 400
h = 400
x = w//2
y = h//2
field = Canvas(root, width=w, heigh=h, bg="white")
field.pack(pady=5)
my_rectangle = field.create_rectangle(10, 20, 30, 40)
def left(even... | An alternative method
```
from tkinter import *
root = Tk()
root.title('Snake')
root["width"] = 400
root["height"] = 400
field = Canvas(root)
SIZE = 50
class Snake:
def __init__(self,x,y,canvas):
self.x = x
self.y = y
self.canvas = canvas
self.direction = (SIZE,0)
def keypres... |
70,258,664 | How do I make the square move when pressing the "d" button (for example) on the keyboard?
```
from tkinter import *
root = Tk()
root.title('Snake')
root["width"] = 400
root["height"] = 400
field = Canvas(root)
x = 0
y = 0
def snake(x, y):
field.create_rectangle(10, 20, 30, 40)
field.grid(row=x, column=y)
... | 2021/12/07 | [
"https://Stackoverflow.com/questions/70258664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17454874/"
] | An easy way is to use `event.char`. It returns the character of the button pressed. Then check which button it was and move it if it is `w,a,s,d` -
```
from tkinter import *
root = Tk()
root.title('Snake')
root["width"] = 400
root["height"] = 400
field = Canvas(root)
rect = field.create_rectangle(10, 20, 30, 40)
fiel... | This is one way you can do it:
```
import tkinter as tk
from tkinter import Canvas
root = tk.Tk()
root.title('Snake')
root.geometry("450x450")
w = 400
h = 400
x = w//2
y = h//2
field = Canvas(root, width=w, heigh=h, bg="white")
field.pack(pady=5)
my_rectangle = field.create_rectangle(10, 20, 30, 40)
def left(even... |
70,258,664 | How do I make the square move when pressing the "d" button (for example) on the keyboard?
```
from tkinter import *
root = Tk()
root.title('Snake')
root["width"] = 400
root["height"] = 400
field = Canvas(root)
x = 0
y = 0
def snake(x, y):
field.create_rectangle(10, 20, 30, 40)
field.grid(row=x, column=y)
... | 2021/12/07 | [
"https://Stackoverflow.com/questions/70258664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17454874/"
] | An easy way is to use `event.char`. It returns the character of the button pressed. Then check which button it was and move it if it is `w,a,s,d` -
```
from tkinter import *
root = Tk()
root.title('Snake')
root["width"] = 400
root["height"] = 400
field = Canvas(root)
rect = field.create_rectangle(10, 20, 30, 40)
fiel... | An alternative method
```
from tkinter import *
root = Tk()
root.title('Snake')
root["width"] = 400
root["height"] = 400
field = Canvas(root)
SIZE = 50
class Snake:
def __init__(self,x,y,canvas):
self.x = x
self.y = y
self.canvas = canvas
self.direction = (SIZE,0)
def keypres... |
793,549 | I need to get the handle of a control as an IntPtr to pass to a screen capture class in vb.Net 3.0. Tried this but get an invalid handle exception.
```
Dim hwnd As IntPtr = Runtime.InteropServices.GCHandle.Alloc(CanvasMap)
```
Any help would be greatly appreciated.
Thanks | 2009/04/27 | [
"https://Stackoverflow.com/questions/793549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38349/"
] | Apparently not:
```
C:\temp\Tim>type 1.fs 2.fs
1.fs
#light
module Module
let sayHello1 = printfn "Hello, "
2.fs
#light
module Module
let sayHello2 = printfn "world!"
C:\temp\Tim>fsc 1.fs 2.fs
Microsoft F# Compiler, (c) Microsoft Corporation, All Rights Reserved
F# Version 1.9.6.2, compiling for .NET Framework V... | I sometimes split a type over several places, like this:
```
module Foo
type Partial = Bar | BarInt of int
module Bar
type Foo.Partial with
member x.Extend = 5
let b = Foo.Bar.Extend
```
where modules Foo and Bar are in different files. |
793,549 | I need to get the handle of a control as an IntPtr to pass to a screen capture class in vb.Net 3.0. Tried this but get an invalid handle exception.
```
Dim hwnd As IntPtr = Runtime.InteropServices.GCHandle.Alloc(CanvasMap)
```
Any help would be greatly appreciated.
Thanks | 2009/04/27 | [
"https://Stackoverflow.com/questions/793549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38349/"
] | Apparently not:
```
C:\temp\Tim>type 1.fs 2.fs
1.fs
#light
module Module
let sayHello1 = printfn "Hello, "
2.fs
#light
module Module
let sayHello2 = printfn "world!"
C:\temp\Tim>fsc 1.fs 2.fs
Microsoft F# Compiler, (c) Microsoft Corporation, All Rights Reserved
F# Version 1.9.6.2, compiling for .NET Framework V... | Like Kurt says, you can add extension methods to types, and thus
```
// File1.fs
namespace Foo
type Mine() =
static member f1 () = ()
```
then
```
// File2.fs
type Foo.Mine with
static member f2() = ()
Foo.Mine. // both f1 and f2 here
```
Since it's a class and not a module, you lose the ability to d... |
793,549 | I need to get the handle of a control as an IntPtr to pass to a screen capture class in vb.Net 3.0. Tried this but get an invalid handle exception.
```
Dim hwnd As IntPtr = Runtime.InteropServices.GCHandle.Alloc(CanvasMap)
```
Any help would be greatly appreciated.
Thanks | 2009/04/27 | [
"https://Stackoverflow.com/questions/793549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38349/"
] | Apparently not:
```
C:\temp\Tim>type 1.fs 2.fs
1.fs
#light
module Module
let sayHello1 = printfn "Hello, "
2.fs
#light
module Module
let sayHello2 = printfn "world!"
C:\temp\Tim>fsc 1.fs 2.fs
Microsoft F# Compiler, (c) Microsoft Corporation, All Rights Reserved
F# Version 1.9.6.2, compiling for .NET Framework V... | The type extensions are cool, and hopefully they will allow to be cross file, *while still being intrinsic*. If you do a type extension in the same file, it compiles to one class, and the extension has access to private members and so on. If you do it in another file, it's just an "optional" extension, like C# static e... |
793,549 | I need to get the handle of a control as an IntPtr to pass to a screen capture class in vb.Net 3.0. Tried this but get an invalid handle exception.
```
Dim hwnd As IntPtr = Runtime.InteropServices.GCHandle.Alloc(CanvasMap)
```
Any help would be greatly appreciated.
Thanks | 2009/04/27 | [
"https://Stackoverflow.com/questions/793549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38349/"
] | Apparently not:
```
C:\temp\Tim>type 1.fs 2.fs
1.fs
#light
module Module
let sayHello1 = printfn "Hello, "
2.fs
#light
module Module
let sayHello2 = printfn "world!"
C:\temp\Tim>fsc 1.fs 2.fs
Microsoft F# Compiler, (c) Microsoft Corporation, All Rights Reserved
F# Version 1.9.6.2, compiling for .NET Framework V... | On one of my projects the goal was to place file operations `Cp` and `Rm` to separate modules, but do not require user to open two namespaces for both tasks.
```
open Xake.FileTasks
...
do! Cp "*/*.exe" "deploy/*.exe"
do! Rm "*/*.exe"
```
Here're my modules:
```
namespace Xake.FileTasks
[<AutoOpen>]
module RmImpl ... |
793,549 | I need to get the handle of a control as an IntPtr to pass to a screen capture class in vb.Net 3.0. Tried this but get an invalid handle exception.
```
Dim hwnd As IntPtr = Runtime.InteropServices.GCHandle.Alloc(CanvasMap)
```
Any help would be greatly appreciated.
Thanks | 2009/04/27 | [
"https://Stackoverflow.com/questions/793549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38349/"
] | Like Kurt says, you can add extension methods to types, and thus
```
// File1.fs
namespace Foo
type Mine() =
static member f1 () = ()
```
then
```
// File2.fs
type Foo.Mine with
static member f2() = ()
Foo.Mine. // both f1 and f2 here
```
Since it's a class and not a module, you lose the ability to d... | I sometimes split a type over several places, like this:
```
module Foo
type Partial = Bar | BarInt of int
module Bar
type Foo.Partial with
member x.Extend = 5
let b = Foo.Bar.Extend
```
where modules Foo and Bar are in different files. |
793,549 | I need to get the handle of a control as an IntPtr to pass to a screen capture class in vb.Net 3.0. Tried this but get an invalid handle exception.
```
Dim hwnd As IntPtr = Runtime.InteropServices.GCHandle.Alloc(CanvasMap)
```
Any help would be greatly appreciated.
Thanks | 2009/04/27 | [
"https://Stackoverflow.com/questions/793549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38349/"
] | The type extensions are cool, and hopefully they will allow to be cross file, *while still being intrinsic*. If you do a type extension in the same file, it compiles to one class, and the extension has access to private members and so on. If you do it in another file, it's just an "optional" extension, like C# static e... | I sometimes split a type over several places, like this:
```
module Foo
type Partial = Bar | BarInt of int
module Bar
type Foo.Partial with
member x.Extend = 5
let b = Foo.Bar.Extend
```
where modules Foo and Bar are in different files. |
793,549 | I need to get the handle of a control as an IntPtr to pass to a screen capture class in vb.Net 3.0. Tried this but get an invalid handle exception.
```
Dim hwnd As IntPtr = Runtime.InteropServices.GCHandle.Alloc(CanvasMap)
```
Any help would be greatly appreciated.
Thanks | 2009/04/27 | [
"https://Stackoverflow.com/questions/793549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38349/"
] | On one of my projects the goal was to place file operations `Cp` and `Rm` to separate modules, but do not require user to open two namespaces for both tasks.
```
open Xake.FileTasks
...
do! Cp "*/*.exe" "deploy/*.exe"
do! Rm "*/*.exe"
```
Here're my modules:
```
namespace Xake.FileTasks
[<AutoOpen>]
module RmImpl ... | I sometimes split a type over several places, like this:
```
module Foo
type Partial = Bar | BarInt of int
module Bar
type Foo.Partial with
member x.Extend = 5
let b = Foo.Bar.Extend
```
where modules Foo and Bar are in different files. |
201,916 | I have a client that would like to use one-time passwords (via SMS or Email) for their app, and their requirements spec does not include traditional password-based authentication. I haven't seen this done before -- would it be considered bad practice?
My assumption was that 2FA is generally more secure than 1FA, rega... | 2019/01/21 | [
"https://security.stackexchange.com/questions/201916",
"https://security.stackexchange.com",
"https://security.stackexchange.com/users/24250/"
] | Not necessarily. This is a scheme where you don't want to store a password for the user.
Sometimes, this is done so that the user doesn't need to remember yet another password (in fact, there are users heavily relying on resetting the password every time, which produces a similar *email-only "passsord"*).
There are al... | Authentication via One Time Pad is still a passord by any other name. What's more, it begs the question of how the pads will be distributed?
In essence you would have to predeploy dozens, hundreds, thousands, of passwords (pad pages) in advance while maintaining synchronized hashes on the server. The client would hav... |
184,309 | I know there are [libraries out there for working with ZIP files](https://stackoverflow.com/questions/11737/net-library-to-unzip-zip-and-rar-files). And, you can alternatively [use the functionality built into Windows for working ZIP files](https://stackoverflow.com/questions/30211/windows-built-in-zip-compression-scri... | 2008/10/08 | [
"https://Stackoverflow.com/questions/184309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7831/"
] | You will want to use a third-party library, like <http://www.codeplex.com/DotNetZip>, rather than trying to use GZipStream or DeflateStream to read a zip file.
The \*\*\*Stream classes in .NET can let you read or write compressed streams of bytes. These classes DO NOT read or write zip files. The zip file is compress... | An older thread, I know, but I'd like to point out that .NET 4.5 added extensive improvements to system.io.compression. It can now manipulate .zip files quite well, even down to exposing individual files within the zip as streams capable or read and write without the step of extracting and compressing the files. |
184,309 | I know there are [libraries out there for working with ZIP files](https://stackoverflow.com/questions/11737/net-library-to-unzip-zip-and-rar-files). And, you can alternatively [use the functionality built into Windows for working ZIP files](https://stackoverflow.com/questions/30211/windows-built-in-zip-compression-scri... | 2008/10/08 | [
"https://Stackoverflow.com/questions/184309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7831/"
] | Dave, very nice!! I didn't know that was in there.
Now that I know what to look for, I was able to find an article with a small code sample on how to use it:
<http://weblogs.asp.net/jgalloway/archive/2007/10/25/creating-zip-archives-in-net-without-an-external-library-like-sharpziplib.aspx>
On a related note, I also f... | An old thread but I want to share the most simple solution that I found using only System.IO.Compression in one line of code (read/write):
```
System.IO.Compression.ZipFile.ExtractToDirectory(sourceArchiveFileName, destinationDirectoryName);
System.IO.Compression.ZipFile.CreateFromDirectory(directoryToArchivePath, arc... |
184,309 | I know there are [libraries out there for working with ZIP files](https://stackoverflow.com/questions/11737/net-library-to-unzip-zip-and-rar-files). And, you can alternatively [use the functionality built into Windows for working ZIP files](https://stackoverflow.com/questions/30211/windows-built-in-zip-compression-scri... | 2008/10/08 | [
"https://Stackoverflow.com/questions/184309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7831/"
] | You will want to use a third-party library, like <http://www.codeplex.com/DotNetZip>, rather than trying to use GZipStream or DeflateStream to read a zip file.
The \*\*\*Stream classes in .NET can let you read or write compressed streams of bytes. These classes DO NOT read or write zip files. The zip file is compress... | An old thread but I want to share the most simple solution that I found using only System.IO.Compression in one line of code (read/write):
```
System.IO.Compression.ZipFile.ExtractToDirectory(sourceArchiveFileName, destinationDirectoryName);
System.IO.Compression.ZipFile.CreateFromDirectory(directoryToArchivePath, arc... |
184,309 | I know there are [libraries out there for working with ZIP files](https://stackoverflow.com/questions/11737/net-library-to-unzip-zip-and-rar-files). And, you can alternatively [use the functionality built into Windows for working ZIP files](https://stackoverflow.com/questions/30211/windows-built-in-zip-compression-scri... | 2008/10/08 | [
"https://Stackoverflow.com/questions/184309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7831/"
] | Since .NET 4.5, Microsoft has offered the [ZipArchive](http://msdn.microsoft.com/en-us/library/system.io.compression.ziparchive(v=vs.110).aspx) class to the `System.IO.Compression` namespace. Unlike other classes in that namespace, though, like `GZipStream` and `Deflate` stream, the `ZipArchive` *requires a reference t... | Yes, I've used it in the past. I sub-classed [DataSet](http://msdn.microsoft.com/en-us/library/system.data.dataset.aspx) once to support persisting itself out to a file (via the [ReadXML](http://msdn.microsoft.com/en-us/library/system.data.dataset.readxml.aspx)/[WriteXML](http://msdn.microsoft.com/en-us/library/system.... |
184,309 | I know there are [libraries out there for working with ZIP files](https://stackoverflow.com/questions/11737/net-library-to-unzip-zip-and-rar-files). And, you can alternatively [use the functionality built into Windows for working ZIP files](https://stackoverflow.com/questions/30211/windows-built-in-zip-compression-scri... | 2008/10/08 | [
"https://Stackoverflow.com/questions/184309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7831/"
] | MSDN has a complete [example](http://msdn.microsoft.com/en-us/library/system.io.packaging.zippackage.aspx) <http://msdn.microsoft.com/en-us/library/system.io.packaging.zippackage.aspx> using the ZipPackage class. Requires .NET 3.5. | Dave, very nice!! I didn't know that was in there.
Now that I know what to look for, I was able to find an article with a small code sample on how to use it:
<http://weblogs.asp.net/jgalloway/archive/2007/10/25/creating-zip-archives-in-net-without-an-external-library-like-sharpziplib.aspx>
On a related note, I also f... |
184,309 | I know there are [libraries out there for working with ZIP files](https://stackoverflow.com/questions/11737/net-library-to-unzip-zip-and-rar-files). And, you can alternatively [use the functionality built into Windows for working ZIP files](https://stackoverflow.com/questions/30211/windows-built-in-zip-compression-scri... | 2008/10/08 | [
"https://Stackoverflow.com/questions/184309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7831/"
] | MSDN has a complete [example](http://msdn.microsoft.com/en-us/library/system.io.packaging.zippackage.aspx) <http://msdn.microsoft.com/en-us/library/system.io.packaging.zippackage.aspx> using the ZipPackage class. Requires .NET 3.5. | You will want to use a third-party library, like <http://www.codeplex.com/DotNetZip>, rather than trying to use GZipStream or DeflateStream to read a zip file.
The \*\*\*Stream classes in .NET can let you read or write compressed streams of bytes. These classes DO NOT read or write zip files. The zip file is compress... |
184,309 | I know there are [libraries out there for working with ZIP files](https://stackoverflow.com/questions/11737/net-library-to-unzip-zip-and-rar-files). And, you can alternatively [use the functionality built into Windows for working ZIP files](https://stackoverflow.com/questions/30211/windows-built-in-zip-compression-scri... | 2008/10/08 | [
"https://Stackoverflow.com/questions/184309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7831/"
] | Since .NET 4.5, Microsoft has offered the [ZipArchive](http://msdn.microsoft.com/en-us/library/system.io.compression.ziparchive(v=vs.110).aspx) class to the `System.IO.Compression` namespace. Unlike other classes in that namespace, though, like `GZipStream` and `Deflate` stream, the `ZipArchive` *requires a reference t... | An older thread, I know, but I'd like to point out that .NET 4.5 added extensive improvements to system.io.compression. It can now manipulate .zip files quite well, even down to exposing individual files within the zip as streams capable or read and write without the step of extracting and compressing the files. |
184,309 | I know there are [libraries out there for working with ZIP files](https://stackoverflow.com/questions/11737/net-library-to-unzip-zip-and-rar-files). And, you can alternatively [use the functionality built into Windows for working ZIP files](https://stackoverflow.com/questions/30211/windows-built-in-zip-compression-scri... | 2008/10/08 | [
"https://Stackoverflow.com/questions/184309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7831/"
] | An older thread, I know, but I'd like to point out that .NET 4.5 added extensive improvements to system.io.compression. It can now manipulate .zip files quite well, even down to exposing individual files within the zip as streams capable or read and write without the step of extracting and compressing the files. | Yes, I've used it in the past. I sub-classed [DataSet](http://msdn.microsoft.com/en-us/library/system.data.dataset.aspx) once to support persisting itself out to a file (via the [ReadXML](http://msdn.microsoft.com/en-us/library/system.data.dataset.readxml.aspx)/[WriteXML](http://msdn.microsoft.com/en-us/library/system.... |
184,309 | I know there are [libraries out there for working with ZIP files](https://stackoverflow.com/questions/11737/net-library-to-unzip-zip-and-rar-files). And, you can alternatively [use the functionality built into Windows for working ZIP files](https://stackoverflow.com/questions/30211/windows-built-in-zip-compression-scri... | 2008/10/08 | [
"https://Stackoverflow.com/questions/184309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7831/"
] | [.NET Framework Zip / UnZip Tool Using the Packaging Namespace](http://www.codeproject.com/KB/files/ZipUnZipTool.aspx) | Yes, I've used it in the past. I sub-classed [DataSet](http://msdn.microsoft.com/en-us/library/system.data.dataset.aspx) once to support persisting itself out to a file (via the [ReadXML](http://msdn.microsoft.com/en-us/library/system.data.dataset.readxml.aspx)/[WriteXML](http://msdn.microsoft.com/en-us/library/system.... |
184,309 | I know there are [libraries out there for working with ZIP files](https://stackoverflow.com/questions/11737/net-library-to-unzip-zip-and-rar-files). And, you can alternatively [use the functionality built into Windows for working ZIP files](https://stackoverflow.com/questions/30211/windows-built-in-zip-compression-scri... | 2008/10/08 | [
"https://Stackoverflow.com/questions/184309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7831/"
] | You will want to use a third-party library, like <http://www.codeplex.com/DotNetZip>, rather than trying to use GZipStream or DeflateStream to read a zip file.
The \*\*\*Stream classes in .NET can let you read or write compressed streams of bytes. These classes DO NOT read or write zip files. The zip file is compress... | [.NET Framework Zip / UnZip Tool Using the Packaging Namespace](http://www.codeproject.com/KB/files/ZipUnZipTool.aspx) |
103,828 | **Problem:**
In the construction of the Riemann sphere, we begin with the sphere $\mathbb{S}^2$ with two charts:
1. the stereographic projection $\sigma\_N : \mathbb{S}^2 \setminus \{N\} \to \mathbb{R}^2 \cong \mathbb{C}$ from the North pole, $N$, given by
$$
\sigma\_N (x\_1, x\_2, x\_3) := \frac{(x\_1, x\_2)}{1-x\_... | 2012/01/30 | [
"https://math.stackexchange.com/questions/103828",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/23084/"
] | Let the stereographic projection $\sigma\_0 : \mathbb{S}^2 \setminus \{N\} \to \mathbb{C}$ from the North pole, $N$, be given by
$$
\sigma\_0 (x\_1, x\_2, x\_3) := \frac{x\_1 + ix\_2}{1-x\_3},
$$
and the stereographic projection $\sigma\_1 : \mathbb{S}^2 \setminus \{S\} \to \mathbb{R}^2 \cong \mathbb{C}$ from the Nor... | As commented by Ben Blum-Smith, it is impossible that one of two expressions $\sigma\_1 \circ \sigma\_0^{-1}(z)$ and $\sigma\_0 \circ \sigma\_1^{-1}(z)$ produces $\varphi(z) = \frac{1}{z}$ and the other $\psi(z) = \frac{1}{z^\*}$ because $(\sigma\_1 \circ \sigma\_0^{-1})^{-1} = \sigma\_0 \circ \sigma\_1^{-1}$. In fact,... |
18,806,466 | I'm looking to try and have outlook automatically create an appointment based on the Subject line of an incoming email. For instance if I receive an email with the subject line "Demo Downloaded" I want it to create an appointment for this email that shows the body of the message as the "Note" on the Appointment. Also, ... | 2013/09/14 | [
"https://Stackoverflow.com/questions/18806466",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/306283/"
] | In your edited version ...
The mailitem is known from Sub CreateTask(**msg As MailItem**)
Try replacing
```
Sub CreateTask(msg As MailItem)
Dim app As New Outlook.Application
Dim item As Object
Set item = GetCurrentItem()
If item.Class <> olMail Then Exit Sub
Dim email As MailItem
Set email... | I have figured it out after playing around with the code and reading up on a few other things. This is what I came up with.
```
Sub CreateTask(msg As MailItem)
Dim app As New Outlook.Application
Dim item As Object
Set item = GetCurrentItem()
If item.Class <> olMail Then Exit Sub
Dim email As MailI... |
46,008,569 | I would like to display a large FlutterLogo in my app:
<https://docs.flutter.io/flutter/material/FlutterLogo-class.html>
In order to account for varying screen sizes I would like to make it stretch-to fill. Is that possible? Or do I need to use a MediaQuery to determine the parent's size and pass that into FlutterLogo... | 2017/09/01 | [
"https://Stackoverflow.com/questions/46008569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6669611/"
] | With sed:
```
sed '/^\[Block2\]/,/^$/s/here=there/here=anywhere/' file
```
* `/^\[Block2\]/,/^$/`: between line starting with `[Block2]` to next blank line(`^$`) or end of file...
* `s/here=there/here=anywhere/`: replace `here=there` with `here=anywhere` | Possible solution using Perl:
```sh
perl -00 -pe '/^\[Block2\]\n/ or next; s/^here=there$/here=anywhere/m'
```
`-p` tells perl to wrap the code in an implicit input/output loop (similar to sed).
`-00` tells perl to process the input in units of paragraphs (instead of lines).
`-e ...` specifies the program. We firs... |
46,008,569 | I would like to display a large FlutterLogo in my app:
<https://docs.flutter.io/flutter/material/FlutterLogo-class.html>
In order to account for varying screen sizes I would like to make it stretch-to fill. Is that possible? Or do I need to use a MediaQuery to determine the parent's size and pass that into FlutterLogo... | 2017/09/01 | [
"https://Stackoverflow.com/questions/46008569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6669611/"
] | Possible solution using Perl:
```sh
perl -00 -pe '/^\[Block2\]\n/ or next; s/^here=there$/here=anywhere/m'
```
`-p` tells perl to wrap the code in an implicit input/output loop (similar to sed).
`-00` tells perl to process the input in units of paragraphs (instead of lines).
`-e ...` specifies the program. We firs... | I'd use the [Config::IniFiles](http://search.cpan.org/~shlomif/Config-IniFiles-2.94/lib/Config/IniFiles.pm) Perl module. If you are running on a RedHat or Centos system try this:
```
$ sudo yum install perl-Config-IniFiles
```
For Ubuntu use `apt-get ...`.
Here's the modified version of the example script from Conf... |
46,008,569 | I would like to display a large FlutterLogo in my app:
<https://docs.flutter.io/flutter/material/FlutterLogo-class.html>
In order to account for varying screen sizes I would like to make it stretch-to fill. Is that possible? Or do I need to use a MediaQuery to determine the parent's size and pass that into FlutterLogo... | 2017/09/01 | [
"https://Stackoverflow.com/questions/46008569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6669611/"
] | Possible solution using Perl:
```sh
perl -00 -pe '/^\[Block2\]\n/ or next; s/^here=there$/here=anywhere/m'
```
`-p` tells perl to wrap the code in an implicit input/output loop (similar to sed).
`-00` tells perl to process the input in units of paragraphs (instead of lines).
`-e ...` specifies the program. We firs... | First insert "here=anywhere" and then remove doublet.
```
awk '/this=those/{print;print "here=anywhere";next}!($0 in a) {a[$0];print}' file
[Block1]
this=that
here=there
why=why_not
[Block2]
this=those
here=anywhere
why=because
``` |
46,008,569 | I would like to display a large FlutterLogo in my app:
<https://docs.flutter.io/flutter/material/FlutterLogo-class.html>
In order to account for varying screen sizes I would like to make it stretch-to fill. Is that possible? Or do I need to use a MediaQuery to determine the parent's size and pass that into FlutterLogo... | 2017/09/01 | [
"https://Stackoverflow.com/questions/46008569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6669611/"
] | With sed:
```
sed '/^\[Block2\]/,/^$/s/here=there/here=anywhere/' file
```
* `/^\[Block2\]/,/^$/`: between line starting with `[Block2]` to next blank line(`^$`) or end of file...
* `s/here=there/here=anywhere/`: replace `here=there` with `here=anywhere` | I'd use the [Config::IniFiles](http://search.cpan.org/~shlomif/Config-IniFiles-2.94/lib/Config/IniFiles.pm) Perl module. If you are running on a RedHat or Centos system try this:
```
$ sudo yum install perl-Config-IniFiles
```
For Ubuntu use `apt-get ...`.
Here's the modified version of the example script from Conf... |
46,008,569 | I would like to display a large FlutterLogo in my app:
<https://docs.flutter.io/flutter/material/FlutterLogo-class.html>
In order to account for varying screen sizes I would like to make it stretch-to fill. Is that possible? Or do I need to use a MediaQuery to determine the parent's size and pass that into FlutterLogo... | 2017/09/01 | [
"https://Stackoverflow.com/questions/46008569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6669611/"
] | With sed:
```
sed '/^\[Block2\]/,/^$/s/here=there/here=anywhere/' file
```
* `/^\[Block2\]/,/^$/`: between line starting with `[Block2]` to next blank line(`^$`) or end of file...
* `s/here=there/here=anywhere/`: replace `here=there` with `here=anywhere` | This will split the file for you into files named block1, block2, etc. and make the changes you need to Block2 and will work with any awk on any UNIX box:
```
awk -v RS= -F'\n' '
{
close(out)
out = "block" NR
if ($1 == "[Block2]") {
sub(/here=there/,"here=anywhere")
}
print > out
}
' file
... |
46,008,569 | I would like to display a large FlutterLogo in my app:
<https://docs.flutter.io/flutter/material/FlutterLogo-class.html>
In order to account for varying screen sizes I would like to make it stretch-to fill. Is that possible? Or do I need to use a MediaQuery to determine the parent's size and pass that into FlutterLogo... | 2017/09/01 | [
"https://Stackoverflow.com/questions/46008569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6669611/"
] | With sed:
```
sed '/^\[Block2\]/,/^$/s/here=there/here=anywhere/' file
```
* `/^\[Block2\]/,/^$/`: between line starting with `[Block2]` to next blank line(`^$`) or end of file...
* `s/here=there/here=anywhere/`: replace `here=there` with `here=anywhere` | First insert "here=anywhere" and then remove doublet.
```
awk '/this=those/{print;print "here=anywhere";next}!($0 in a) {a[$0];print}' file
[Block1]
this=that
here=there
why=why_not
[Block2]
this=those
here=anywhere
why=because
``` |
46,008,569 | I would like to display a large FlutterLogo in my app:
<https://docs.flutter.io/flutter/material/FlutterLogo-class.html>
In order to account for varying screen sizes I would like to make it stretch-to fill. Is that possible? Or do I need to use a MediaQuery to determine the parent's size and pass that into FlutterLogo... | 2017/09/01 | [
"https://Stackoverflow.com/questions/46008569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6669611/"
] | This will split the file for you into files named block1, block2, etc. and make the changes you need to Block2 and will work with any awk on any UNIX box:
```
awk -v RS= -F'\n' '
{
close(out)
out = "block" NR
if ($1 == "[Block2]") {
sub(/here=there/,"here=anywhere")
}
print > out
}
' file
... | I'd use the [Config::IniFiles](http://search.cpan.org/~shlomif/Config-IniFiles-2.94/lib/Config/IniFiles.pm) Perl module. If you are running on a RedHat or Centos system try this:
```
$ sudo yum install perl-Config-IniFiles
```
For Ubuntu use `apt-get ...`.
Here's the modified version of the example script from Conf... |
46,008,569 | I would like to display a large FlutterLogo in my app:
<https://docs.flutter.io/flutter/material/FlutterLogo-class.html>
In order to account for varying screen sizes I would like to make it stretch-to fill. Is that possible? Or do I need to use a MediaQuery to determine the parent's size and pass that into FlutterLogo... | 2017/09/01 | [
"https://Stackoverflow.com/questions/46008569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6669611/"
] | This will split the file for you into files named block1, block2, etc. and make the changes you need to Block2 and will work with any awk on any UNIX box:
```
awk -v RS= -F'\n' '
{
close(out)
out = "block" NR
if ($1 == "[Block2]") {
sub(/here=there/,"here=anywhere")
}
print > out
}
' file
... | First insert "here=anywhere" and then remove doublet.
```
awk '/this=those/{print;print "here=anywhere";next}!($0 in a) {a[$0];print}' file
[Block1]
this=that
here=there
why=why_not
[Block2]
this=those
here=anywhere
why=because
``` |
65,916,716 | How can I reference a html element like `<h1 anyname>Text</h1>` in CSS, if there is no `class` or `id` specified within it? Is there an option?
`.h1 {...}` is of course valid for all, but I only want to style "h1 anyname".
Thanks in advance! | 2021/01/27 | [
"https://Stackoverflow.com/questions/65916716",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12481438/"
] | You can use an [attribute selector](https://developer.mozilla.org/en-US/docs/Web/CSS/Attribute_selectors) — square brackets with the attribute name.
```css
h1[anyname] {
/* ... */
}
``` | You can use attribute selector <https://www.w3schools.com/css/css_attribute_selectors.asp>
`h1[anyname] { /*** your style ***/ }` |
1,828,136 | My goal is to have one main richtextbox in the form, and then several different richtextbox's in the backround, the backround textbox's get added, removed, and edited behind the scences all the time... and i need a way to swap my richtextbox in the form with the richtextbox's in the backround. what i origannally had wa... | 2009/12/01 | [
"https://Stackoverflow.com/questions/1828136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/222349/"
] | pls check the code below; it's an MouseRightButtonUp event handler for a listbox control which prints the item name under the mouse pointer if it's there
```
private void listBox1_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
{
object item = GetElementFromPoint(listBox1, e.GetPosition(listBox1));
i... | If memory serves, the RightClick event bubbles from the element that is actually clicked up to the root element of the page. If you attach the event handler to the items themselves instead of the ListBox, you will be able to handle the click on the individual items and prevent it from bubbling any further. If the event... |
10,743,033 | I created a middleware which allows me to use a list of dictionaries to specify some access rules for any of my views. Each of these dictionaries looks like this:
```
REQUIREMENTS=(
{'viewname':'addtag',
'permissions':'can_add_tags'},
{'regex':re.compile(r'^somestart'),
'user_check':lambda request:req... | 2012/05/24 | [
"https://Stackoverflow.com/questions/10743033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/581421/"
] | You can do this in your Custom View:
```
if(!isInEditMode()){
// Your custom code that is not letting the Visual Editor draw properly
// i.e. thread spawning or other things in the constructor
}
```
[http://developer.android.com/reference/android/view/View.html#isInEditMode()](http://developer.android.com/refe... | You could create a skeleton activity that loads just the view you want to see and populate it with enough data to make it display. |
10,743,033 | I created a middleware which allows me to use a list of dictionaries to specify some access rules for any of my views. Each of these dictionaries looks like this:
```
REQUIREMENTS=(
{'viewname':'addtag',
'permissions':'can_add_tags'},
{'regex':re.compile(r'^somestart'),
'user_check':lambda request:req... | 2012/05/24 | [
"https://Stackoverflow.com/questions/10743033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/581421/"
] | You can do this in your Custom View:
```
if(!isInEditMode()){
// Your custom code that is not letting the Visual Editor draw properly
// i.e. thread spawning or other things in the constructor
}
```
[http://developer.android.com/reference/android/view/View.html#isInEditMode()](http://developer.android.com/refe... | I'm using Android Studio so I'm not sure this answer will apply to your case.
I think you could override onDraw method in the custom view, like this exemple keeping the aspect ratio of an inner image:
```
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// TODO: consider storing these as... |
3,201,010 | Prove that there is a differentiable function $f$ such that $[f(x)]^5 + f(x) + x = 0$. (My textbook offers the following hint: Show that $f$ can be expressed as an inverse function.)
**My Progress**
$f(x) = -[f(x)]^5 - x$
$x = -[f \ (f^{-1} (x) )]^5 - f^{-1}(x)$
$-x^5 - x = f^{-1}(x)$
However, I do not know where ... | 2019/04/24 | [
"https://math.stackexchange.com/questions/3201010",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/633534/"
] | **Hint**:
Make a list of all the numbers between $1$ and $p^k$.
$$1,2,3,4,\ldots, p^k$$
* How many numbers are there on this list?
>
> There are $p^k$ numbers on the list.
>
>
>
* How many numbers have a common factor with $p^k$?
>
> Since $p$ is a prime another number will have a common factor with $p^k$ if... | Notice that for the definition of prime number, a number $n$ is coprime with $p^k$ if and only if $p$ doesn't divide $n$. Since there are $\frac{p^k}{p}=p^{k-1}$ multiples of $p$ then:
$$\varphi(p^k)=p^k-p^{k-1}$$ |
6,600,897 | How do you configure a TextView to truncate in the middle of a word?
So if I have text="Some Text" I want it to show as "Some Te" assuming the width supports that.
What instead I'm seeing is "Some"; its truncating the entire word "Text" even though there is plenty of space for a couple more characters. | 2011/07/06 | [
"https://Stackoverflow.com/questions/6600897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/483163/"
] | Here is what worked for me:
```
<TextView
android:layout_width="80px"
android:layout_height="wrap_content"
android:text="Some text"
android:background="#88ff0000"
android:singleLine="true"
android:ellipsize="marquee"/>
```

... | Here is my code for a TextView that "truncates" the word with no ellipsis. It doesn't quite cut it off, it simply lets it run off the edge, giving the slight impression that it's been truncated.
```
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="tr... |
6,600,897 | How do you configure a TextView to truncate in the middle of a word?
So if I have text="Some Text" I want it to show as "Some Te" assuming the width supports that.
What instead I'm seeing is "Some"; its truncating the entire word "Text" even though there is plenty of space for a couple more characters. | 2011/07/06 | [
"https://Stackoverflow.com/questions/6600897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/483163/"
] | Here is what worked for me:
```
<TextView
android:layout_width="80px"
android:layout_height="wrap_content"
android:text="Some text"
android:background="#88ff0000"
android:singleLine="true"
android:ellipsize="marquee"/>
```

... | ```
Found Two ways to Truncating texview.
Text to truncate : "Hello World! sample_text_truncate"
Case 1:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"`enter code here`
android:text="Hello World! sample_text_truncate"
android:textSize="28sp"
an... |
6,600,897 | How do you configure a TextView to truncate in the middle of a word?
So if I have text="Some Text" I want it to show as "Some Te" assuming the width supports that.
What instead I'm seeing is "Some"; its truncating the entire word "Text" even though there is plenty of space for a couple more characters. | 2011/07/06 | [
"https://Stackoverflow.com/questions/6600897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/483163/"
] | Here is my code for a TextView that "truncates" the word with no ellipsis. It doesn't quite cut it off, it simply lets it run off the edge, giving the slight impression that it's been truncated.
```
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:singleLine="tr... | ```
Found Two ways to Truncating texview.
Text to truncate : "Hello World! sample_text_truncate"
Case 1:
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"`enter code here`
android:text="Hello World! sample_text_truncate"
android:textSize="28sp"
an... |
4,819,612 | I need to create a web page that authenticates users against an existing active directory. The domain is actually a cloud computing configuration where there is a domain controller and multiple other servers on the stack.
I understand that objects from the System.DirectoryServices namespace can be used. However, I ca... | 2011/01/27 | [
"https://Stackoverflow.com/questions/4819612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/592611/"
] | Take a look at this link (replaced old one with web.archive.org):
[http://www.codeproject.com/KB/system/everythingInAD.aspx#35](http://web.archive.org/web/20110317102802/http://www.codeproject.com/KB/system/everythingInAD.aspx)
This is how to get the default entry:
```
try
{
System.DirectoryServices.DirectoryEnt... | ```
LDAP://domain
```
can be used when the server is joined to said domain; it should then be able to resolve a domain controller, given correct DNS configuration.
Otherwise, if you have the fqdn or ip address of a domain controller, you can use
```
LDAP://fqdn.of.domaincontroller /* or */ LDAP://100.10.100.10
```... |
4,819,612 | I need to create a web page that authenticates users against an existing active directory. The domain is actually a cloud computing configuration where there is a domain controller and multiple other servers on the stack.
I understand that objects from the System.DirectoryServices namespace can be used. However, I ca... | 2011/01/27 | [
"https://Stackoverflow.com/questions/4819612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/592611/"
] | Take a look at this link (replaced old one with web.archive.org):
[http://www.codeproject.com/KB/system/everythingInAD.aspx#35](http://web.archive.org/web/20110317102802/http://www.codeproject.com/KB/system/everythingInAD.aspx)
This is how to get the default entry:
```
try
{
System.DirectoryServices.DirectoryEnt... | It´s been a while but I think I achieve exactly what this question is about.
I tested against this magnificent [free to test LDAP server](https://www.forumsys.com/tutorials/integration-how-to/ldap/online-ldap-test-server/#comment-6953)
```
var path = "LDAP://ldap.forumsys.com:389/dc=example,dc=com";
var user = $@"uid... |
12,011,655 | I have some web app. It is desktop based. I have an issue where the action is getting canceled before I save my data. I am using an unload event in javascript to send some data to mixpanel (just some ajax call). The problem is that I believe that this request gets "cancelled" on occasion.
Is there a way to prevent the... | 2012/08/17 | [
"https://Stackoverflow.com/questions/12011655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/181310/"
] | ```
select MyCol from MyTable
union all
select 'something' as MyCol
``` | You can use a `UNION ALL` to include a new row.
```
SELECT *
FROM yourTable
UNION ALL
SELECT 'newRow'
```
The number of columns needs to be the same between the top query and the bottom one. So if you first query has one column, then the second would also need one column. |
12,011,655 | I have some web app. It is desktop based. I have an issue where the action is getting canceled before I save my data. I am using an unload event in javascript to send some data to mixpanel (just some ajax call). The problem is that I believe that this request gets "cancelled" on occasion.
Is there a way to prevent the... | 2012/08/17 | [
"https://Stackoverflow.com/questions/12011655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/181310/"
] | ```
select MyCol from MyTable
union all
select 'something' as MyCol
``` | If you need to add multiple values there is a stranger syntax available:
```
declare @Footy as VarChar(16) = 'soccer'
select 'a' as Thing, 42 as Thingosity -- Your original SELECT goes here.
union all
select *
from ( values ( 'b', 2 ), ( 'c', 3 ), ( @Footy, Len( @Footy ) ) ) as Placeholder ( Thing, Thingosity ... |
21,658,671 | I am having problems understanding what my regex in bash shell is doing exactly.
I have the string `abcde 12345 67890testing`. I want to extract `12345` from this string using `sed`.
However, using `sed -re 's/([0-9]+).*/\1/'` on the given string will give me `abcde 12345`.
Alternatively, using `sed -re 's/([\d]+).*... | 2014/02/09 | [
"https://Stackoverflow.com/questions/21658671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3289476/"
] | ```
sed -E 's/([0-9]+).*/\1/g' <<< "$s"
```
The above command means: find a sequence of number followed by something and replace it with only the numbers. So it matches *12345 67890testing* and replaces it with only *12345*.
The final string will be *abcd 12345*.
If you want to get only 12345 you should use grep.... | You can use:
```
sed 's/^\([0-9]*\).*$/\1/g' <<< "$s"
12345
```
OR else modifying your sed:
```
sed 's/\([0-9]\+\).*/\1/g' <<< "$s"
12345
```
You need to escape `+` & `( and )` in sed without extended regex flag (`-r OR -E`).
WIth `-r` it will be:
```
sed -r 's/([0-9]+).*/\1/g' <<< "$s"
12345
```
**UPDATE:** ... |
21,658,671 | I am having problems understanding what my regex in bash shell is doing exactly.
I have the string `abcde 12345 67890testing`. I want to extract `12345` from this string using `sed`.
However, using `sed -re 's/([0-9]+).*/\1/'` on the given string will give me `abcde 12345`.
Alternatively, using `sed -re 's/([\d]+).*... | 2014/02/09 | [
"https://Stackoverflow.com/questions/21658671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3289476/"
] | You can use:
```
sed 's/^\([0-9]*\).*$/\1/g' <<< "$s"
12345
```
OR else modifying your sed:
```
sed 's/\([0-9]\+\).*/\1/g' <<< "$s"
12345
```
You need to escape `+` & `( and )` in sed without extended regex flag (`-r OR -E`).
WIth `-r` it will be:
```
sed -r 's/([0-9]+).*/\1/g' <<< "$s"
12345
```
**UPDATE:** ... | since others already provided the solution with sed, grep, here is the awk code:
```
echo "abcde 12345 67890testing"|awk '{for (i=1;i<=NF;i++) if ($i~/^[0-9]+$/) print $i}'
``` |
21,658,671 | I am having problems understanding what my regex in bash shell is doing exactly.
I have the string `abcde 12345 67890testing`. I want to extract `12345` from this string using `sed`.
However, using `sed -re 's/([0-9]+).*/\1/'` on the given string will give me `abcde 12345`.
Alternatively, using `sed -re 's/([\d]+).*... | 2014/02/09 | [
"https://Stackoverflow.com/questions/21658671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3289476/"
] | You can use:
```
sed 's/^\([0-9]*\).*$/\1/g' <<< "$s"
12345
```
OR else modifying your sed:
```
sed 's/\([0-9]\+\).*/\1/g' <<< "$s"
12345
```
You need to escape `+` & `( and )` in sed without extended regex flag (`-r OR -E`).
WIth `-r` it will be:
```
sed -r 's/([0-9]+).*/\1/g' <<< "$s"
12345
```
**UPDATE:** ... | Using cut command is simpler
```
echo "abcde 12345 67890testing" | cut -d' ' -f2
``` |
21,658,671 | I am having problems understanding what my regex in bash shell is doing exactly.
I have the string `abcde 12345 67890testing`. I want to extract `12345` from this string using `sed`.
However, using `sed -re 's/([0-9]+).*/\1/'` on the given string will give me `abcde 12345`.
Alternatively, using `sed -re 's/([\d]+).*... | 2014/02/09 | [
"https://Stackoverflow.com/questions/21658671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3289476/"
] | ```
sed -E 's/([0-9]+).*/\1/g' <<< "$s"
```
The above command means: find a sequence of number followed by something and replace it with only the numbers. So it matches *12345 67890testing* and replaces it with only *12345*.
The final string will be *abcd 12345*.
If you want to get only 12345 you should use grep.... | since others already provided the solution with sed, grep, here is the awk code:
```
echo "abcde 12345 67890testing"|awk '{for (i=1;i<=NF;i++) if ($i~/^[0-9]+$/) print $i}'
``` |
21,658,671 | I am having problems understanding what my regex in bash shell is doing exactly.
I have the string `abcde 12345 67890testing`. I want to extract `12345` from this string using `sed`.
However, using `sed -re 's/([0-9]+).*/\1/'` on the given string will give me `abcde 12345`.
Alternatively, using `sed -re 's/([\d]+).*... | 2014/02/09 | [
"https://Stackoverflow.com/questions/21658671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3289476/"
] | ```
sed -E 's/([0-9]+).*/\1/g' <<< "$s"
```
The above command means: find a sequence of number followed by something and replace it with only the numbers. So it matches *12345 67890testing* and replaces it with only *12345*.
The final string will be *abcd 12345*.
If you want to get only 12345 you should use grep.... | Using cut command is simpler
```
echo "abcde 12345 67890testing" | cut -d' ' -f2
``` |
56,774,295 | I am attempting to create an Auto-grading test of sorts in Excel.
I have 5 values in `Sheet1` that are input by a user in cells `E5:E9`. These should then be compared against a range of 5 more cells in `Sheet2` (also cells `E5:E9`).
As the user might not always list these entries in the same order that I have in my S... | 2019/06/26 | [
"https://Stackoverflow.com/questions/56774295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11703493/"
] | Little Complex :)
```
Sub Q1()
Dim i As Integer
Dim j As Integer
Dim chck(5 To 9) As Boolean
For i = 5 To 9
For j = 5 To 9
If Sheet1.Cells(i, 5) = Sheet2.Cells(j, 5) Then
chck(i) = True
Exit For
Else: chck(i) = False
End If
Next
Next
j = 0
For i = LBou... | Does this really need to be VBA? A formula can perform this calculation. Use this in 'Sheet1' cell F5:
```
=--(SUMPRODUCT(COUNTIF(Sheet2!E5:E9,E5:E9))>0)
```
If at least one of the values in 'Sheet1'!E5:E9 (the user entered values) exists in your 'Sheet2'!E5:E9 list, the formula will return a `1` else `0` which is t... |
51,317,519 | I'm currently using jQuery's `$.get()` to process IDs entered in a text field with a database. It currently works quite well, especially the PHP which can handle multiple comma-separated entries.
The issue I'm having is with jQuery; more specifically, JSON parsing. The PHP file returns an array of arrays, which is use... | 2018/07/13 | [
"https://Stackoverflow.com/questions/51317519",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9348307/"
] | I don't see the need to make `$json_params` as an array. It is stored outside of looping and executed only once. Just remove `[]` part. THe code will look like this.
```
$json_params = array(
"students" => $student_array, /* The array of arrays */
"success" => "n students were checked in, nice!" /* generic mes... | Your code has this:
```
var serverData = $.parseJSON(data)[0];
```
but it's failing because data is already an object (not a json string that needs to be parsed).
Try this:
```
var serverData = data[0];
``` |
4,334,647 | **The Plan:** To use an `INSTEAD OF INSERT` trigger to redirect failed inserts to a 'pending' table. These rows remain in the 'pending' table until some addition information is inserted in another table; when the this new information is available the pending rows are moved to their original destination.
**Background:*... | 2010/12/02 | [
"https://Stackoverflow.com/questions/4334647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/243925/"
] | Of course the rows don't exists in the INSERTED pseudo-table when you update rows that **don't exists in the table** to start with: you issue UPDATE statement on `Trade` for rows that are in `TradePending`!
Besides, your INSTEAD OF INSERT trigger is broken. It only works for single row inserts, and even for those it ... | I have not had time to run this, but are you sure that the inserted table is empty? (You are always joining to other tables, so the lack of records in those tables may cause the row to be suppressed in your result sets.) What about the deleted? For an update, you should have an inserted and a deleted set. |
35,146,662 | I was interview in company and I was asked a question, question was bit strange so wanted to ask with expert guys.
The question suppose I have function which returns bool type. Let us say this :
```
public bool func(int param)
{
bool retVal;
// here is some algorithm which as a result either set the retVal to fal... | 2016/02/02 | [
"https://Stackoverflow.com/questions/35146662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5777317/"
] | I think your code would be like this:
```
public bool func(int param)
{
bool retVal;
return !retVal;
}
``` | If the result of the algorithm is in retval,
```
return (!retval);
``` |
35,146,662 | I was interview in company and I was asked a question, question was bit strange so wanted to ask with expert guys.
The question suppose I have function which returns bool type. Let us say this :
```
public bool func(int param)
{
bool retVal;
// here is some algorithm which as a result either set the retVal to fal... | 2016/02/02 | [
"https://Stackoverflow.com/questions/35146662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5777317/"
] | !retVal is the opposite of retVal. if retVal is true the !retval is false and vice-versa
```
public bool func(int param)
{
bool retVal
//your algo;
return !retVal;
}
``` | If the result of the algorithm is in retval,
```
return (!retval);
``` |
45,337,350 | In a relationship similar to this:
```
class Cat
belongs_to :owner
has_one :pet, class_name: "Cat", foreign_key: "pet_id"
validates :name, uniqueness: { scope: :owner_id }
end
class Owner
has_many :cats
end
```
I would like each `Cat` that belongs to an `Owner` to have a unique name. For example, Bob and Jo... | 2017/07/26 | [
"https://Stackoverflow.com/questions/45337350",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4381225/"
] | ```
cin >> a;
```
If this code fails (and it does if you provide non-integer data), the stream will enter an invalid state, and all subsequent calls to `cin >> a` will return immediately with no side-effects, still in its error state.
This is a C++ design decision I don't particularly like (and probably why most peo... | I got it to work:
```
int a;
cout << "What type of game do you wish to play?\n(Enter the number of the menu option for)\n(1):Player V Player\n(2):Player vComp\n(3):Comp V Comp\n";
cin >> a;
while (a != 1 && a != 2 && a != 3 || cin.fail())
{
cout << "That is not a valid gametype. Pick from the following menu:\... |
767,415 | At my organization we have a number of simple-to-use base AMIs for different services such as ECS and Docker. Since many of our projects involve CloudFormation, we're using `cfn-bootstrap`, which consists of a couple of scripts and a service which run on boot to install certain packages and do certain configuration man... | 2016/03/31 | [
"https://serverfault.com/questions/767415",
"https://serverfault.com",
"https://serverfault.com/users/70024/"
] | systemd provides a [wide variety of conditions you can test](https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Conditions%20and%20Asserts). For instance, you can use `ConditionPathExists=` to test for the existence of a file.
```
[Unit]
ConditionPathExists=/etc/sysconfig/cloudformation
``` | I stumbled upon this question looking for ways to start a systemd service using a condition. There are many ways:
`ConditionArchitecture=, ConditionVirtualization=, ConditionHost=, ConditionKernelCommandLine=, ConditionSecurity=, ConditionCapability=, ConditionACPower=, ConditionNeedsUpdate=, ConditionFirstBoot=, Cond... |
8,519 | I was watching an American Football game the other day (can't remember which, but it was a re-run of an older game) and there were two incidences:
1. The ball is snapped to the QB, he performs a fake hand-off to the RB, and fires a short pass over the top to a receiver. He gets about half a yard before he his tackled ... | 2015/01/10 | [
"https://sports.stackexchange.com/questions/8519",
"https://sports.stackexchange.com",
"https://sports.stackexchange.com/users/6216/"
] | The difference between an "incompletion" and a "completion followed by a fumble" is in the rules for a completion.
A completion has to meet three criteria:
1. The receiver needs to gain control of the ball.
2. The receiver needs to have both feet or any other body part (except hands) on the ground inbounds.
3. The re... | An incomplete pass cannot be fumbled, so technically speaking an incomplete pass never becomes a fumble. Rather, we have two scenarios:
1. The pass was incomplete, in which case it is impossible to fumble it (to fumble you have to have possession).
2. The pass was complete, in which case it is possible to fumble it.
... |
8,519 | I was watching an American Football game the other day (can't remember which, but it was a re-run of an older game) and there were two incidences:
1. The ball is snapped to the QB, he performs a fake hand-off to the RB, and fires a short pass over the top to a receiver. He gets about half a yard before he his tackled ... | 2015/01/10 | [
"https://sports.stackexchange.com/questions/8519",
"https://sports.stackexchange.com",
"https://sports.stackexchange.com/users/6216/"
] | The difference between an "incompletion" and a "completion followed by a fumble" is in the rules for a completion.
A completion has to meet three criteria:
1. The receiver needs to gain control of the ball.
2. The receiver needs to have both feet or any other body part (except hands) on the ground inbounds.
3. The re... | The accepted answer covers the rules. I will give you what referees look for.
* The two feet on the ground are a given.
* A football move means the player is attempting to do something. So if I jumped as high as I could caught the ball with hands over my helmet and then got rocked as I hit the ground. That is the most... |
47,990 | I am testing equality of two binomial proportions 87/88 and 48/60. I use
[this online calculator](http://www.fon.hum.uva.nl/Service/Statistics/Binomial_proportions.html) and it noted that the Standard Normal approximation is not valid in this case. It seem quite strange to me. Is it some problem in testing equality of ... | 2013/01/17 | [
"https://stats.stackexchange.com/questions/47990",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/18409/"
] | Use **Simplex-lattice**, **Simplex-Centroid** designs, or something like that.
First, from your question I guess this is a mixture design in which you change proportions of the components of the muffin (or some of it's components) and measure several responses, i.e. texture, acceptance, etc.
I suppose that you have s... | Are you going to do your experiment within-subject? That is, will each subject try all three formulas? If so, you might consider a latin square design, as it will help control against the ordering of exposure as a confound. Here's [a brief write-up on latin square designs](http://vassarstats.net/lsqtext.html). |
47,990 | I am testing equality of two binomial proportions 87/88 and 48/60. I use
[this online calculator](http://www.fon.hum.uva.nl/Service/Statistics/Binomial_proportions.html) and it noted that the Standard Normal approximation is not valid in this case. It seem quite strange to me. Is it some problem in testing equality of ... | 2013/01/17 | [
"https://stats.stackexchange.com/questions/47990",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/18409/"
] | Are you going to do your experiment within-subject? That is, will each subject try all three formulas? If so, you might consider a latin square design, as it will help control against the ordering of exposure as a confound. Here's [a brief write-up on latin square designs](http://vassarstats.net/lsqtext.html). | Since you modified your question, this is not a mixture design anymore.
In fact, this is a Completely Randomized Design (CRD) and requires an ANOVA model.
The statistical model of fixed effects with one factor is:
$$y\_{ij}=\mu+\tau\_i+\epsilon\_{ij}$$
with $y\_{ij}$ being the response of the $j^{th}$ observation of t... |
47,990 | I am testing equality of two binomial proportions 87/88 and 48/60. I use
[this online calculator](http://www.fon.hum.uva.nl/Service/Statistics/Binomial_proportions.html) and it noted that the Standard Normal approximation is not valid in this case. It seem quite strange to me. Is it some problem in testing equality of ... | 2013/01/17 | [
"https://stats.stackexchange.com/questions/47990",
"https://stats.stackexchange.com",
"https://stats.stackexchange.com/users/18409/"
] | Use **Simplex-lattice**, **Simplex-Centroid** designs, or something like that.
First, from your question I guess this is a mixture design in which you change proportions of the components of the muffin (or some of it's components) and measure several responses, i.e. texture, acceptance, etc.
I suppose that you have s... | Since you modified your question, this is not a mixture design anymore.
In fact, this is a Completely Randomized Design (CRD) and requires an ANOVA model.
The statistical model of fixed effects with one factor is:
$$y\_{ij}=\mu+\tau\_i+\epsilon\_{ij}$$
with $y\_{ij}$ being the response of the $j^{th}$ observation of t... |
209,674 | I made a nice fantasy map with some really interesting geographic constellations, fitting my story. The climate zones don't fit, however.
I found the tool, [Map to Globe](https://www.maptoglobe.com/#) where I can upload my map to create a globe. Is there a similar tool, where I can change the pole axis and download th... | 2021/08/09 | [
"https://worldbuilding.stackexchange.com/questions/209674",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/79394/"
] | If I understand you correctly, what you want to do is re-project an existing equirectangular map to have the pole(s) in a different location—and your title question (“transfer onto a globe and back”) is how you think this might be done, not something that’s absolutely mandatory. Am I right?
That is, would something th... | I can propose a sort of workaround:
1. Redraw your map as best you can in the Fuller/icosahedral projection. [Map to Globe](https://www.maptoglobe.com/) may be useful for getting somewhat accurate polar views for this step.
2. Rearrange the faces of the icosahedron so the new poles are at the top and bottom (the point... |
209,674 | I made a nice fantasy map with some really interesting geographic constellations, fitting my story. The climate zones don't fit, however.
I found the tool, [Map to Globe](https://www.maptoglobe.com/#) where I can upload my map to create a globe. Is there a similar tool, where I can change the pole axis and download th... | 2021/08/09 | [
"https://worldbuilding.stackexchange.com/questions/209674",
"https://worldbuilding.stackexchange.com",
"https://worldbuilding.stackexchange.com/users/79394/"
] | If I understand you correctly, what you want to do is re-project an existing equirectangular map to have the pole(s) in a different location—and your title question (“transfer onto a globe and back”) is how you think this might be done, not something that’s absolutely mandatory. Am I right?
That is, would something th... | If you've already drawn your world map as a single rectangle, either by hand or in some raster program like Photoshop or Gimp, it is pretty much unusable (without significant cleanup) for what you are picturing regardless of what tool you find because of how much square maps distort actual shapes.
The reason world map... |
63,691,837 | Below arrow is composed out of 3 single elements. The center part should stretch horizontally so the arrow can fill its surrounding container. But as you can see in the rendered code, the stretching doesn't work. How to enable stretching and making sure, there are no gaps at the junctures. Probably, there should be a s... | 2020/09/01 | [
"https://Stackoverflow.com/questions/63691837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1116675/"
] | Instead of using 3 svg elements I'm using only one. I'm putting the start and the end of the "arrow" in a `<symbol>` element so that I can use those shapes where I need them. Please observe that the `<symbol>` elements have a tight viewbox (the viewBox is wrapping tight the shape and has the same size as the bounding b... | Use `preserveAspectRatio="none"` on the SVG that you want to stretch. This will allow the inner `rect` to stretch along with the SVG element.
```css
.arrow {
display: flex;
max-width: 200px;
padding-bottom: 2em;
}
.arrow svg {
height: 25px;
shape-rendering: auto;
}
#arrow-1 svg.stretched {}
#arrow-2 svg.s... |
63,691,837 | Below arrow is composed out of 3 single elements. The center part should stretch horizontally so the arrow can fill its surrounding container. But as you can see in the rendered code, the stretching doesn't work. How to enable stretching and making sure, there are no gaps at the junctures. Probably, there should be a s... | 2020/09/01 | [
"https://Stackoverflow.com/questions/63691837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1116675/"
] | You can do the biggest part using CSS and it would easier to handle:
```css
.box {
width: 50%;
margin: auto;
height: 50px;
border: 10px solid;
border-bottom: 0;
border-radius: 20px 20px 0 0;
position: relative;
}
.box::after {
content: "";
position: absolute;
bottom: 0;
right: -5px;
width: 45p... | Use `preserveAspectRatio="none"` on the SVG that you want to stretch. This will allow the inner `rect` to stretch along with the SVG element.
```css
.arrow {
display: flex;
max-width: 200px;
padding-bottom: 2em;
}
.arrow svg {
height: 25px;
shape-rendering: auto;
}
#arrow-1 svg.stretched {}
#arrow-2 svg.s... |
63,691,837 | Below arrow is composed out of 3 single elements. The center part should stretch horizontally so the arrow can fill its surrounding container. But as you can see in the rendered code, the stretching doesn't work. How to enable stretching and making sure, there are no gaps at the junctures. Probably, there should be a s... | 2020/09/01 | [
"https://Stackoverflow.com/questions/63691837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1116675/"
] | You can do the biggest part using CSS and it would easier to handle:
```css
.box {
width: 50%;
margin: auto;
height: 50px;
border: 10px solid;
border-bottom: 0;
border-radius: 20px 20px 0 0;
position: relative;
}
.box::after {
content: "";
position: absolute;
bottom: 0;
right: -5px;
width: 45p... | Instead of using 3 svg elements I'm using only one. I'm putting the start and the end of the "arrow" in a `<symbol>` element so that I can use those shapes where I need them. Please observe that the `<symbol>` elements have a tight viewbox (the viewBox is wrapping tight the shape and has the same size as the bounding b... |
900,706 | I'm running the PS3 Media Server(1.90.1) on Windows 8.1 Wired/Wifi but I have some problem when I want to share 1080p(MKV) Movies. The film is lagging when I want to see the movie. I have a “good” pc (Intel core i3-2100 3.1GHz, 8gb ram, 1gb Videocard). How can I see full HD movies in my PS3 without lag? Do you know a b... | 2015/04/12 | [
"https://superuser.com/questions/900706",
"https://superuser.com",
"https://superuser.com/users/436880/"
] | I've changed the number of cores used by ps3 media server to 2 (two). After that everything went fine.
Here's the image of want I've changed:

* Set buffer size to 300
* Changed CPU threads to 2
* Set Transcoding quality (MPEG-2) to Automatic (Wireless)
After that... | It may depend on the connection and to my results, There is no such program for PS3 just it's built in. Instead for using the built-in Media Server(talking about pc), I recommend to use Tv-Mobili because it is much faster. |
3,010,022 | Here's briefly what I'm trying to do.
The user supplies me with a link to a [photo](http://www.flickr.com/photos/pmorgan/32606683/) from one of several photo-sharing websites (such as Flickr, Zooomr, et. al). I then do some processing on the photo using their respective APIs.
Right now, I'm only implementing one serv... | 2010/06/09 | [
"https://Stackoverflow.com/questions/3010022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/220997/"
] | Yes, [Strategy](http://en.wikipedia.org/wiki/Strategy_pattern) sounds like a good solution to this. An alternative could be [Template Method](http://en.wikipedia.org/wiki/Template_method_pattern).
The strategies associated to different sites can be produced by an [Abstract Factory](http://en.wikipedia.org/wiki/Abstrac... | Looks like you want to do two things:
1. Separate processing implementations for each service. Here, you can use the strategy pattern.
2. Hide the fact that there are different processing implementation details for each service from you caller. Here, use a factory pattern. The factory pattern will encapsulate any logi... |
3,010,022 | Here's briefly what I'm trying to do.
The user supplies me with a link to a [photo](http://www.flickr.com/photos/pmorgan/32606683/) from one of several photo-sharing websites (such as Flickr, Zooomr, et. al). I then do some processing on the photo using their respective APIs.
Right now, I'm only implementing one serv... | 2010/06/09 | [
"https://Stackoverflow.com/questions/3010022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/220997/"
] | Yes, [Strategy](http://en.wikipedia.org/wiki/Strategy_pattern) sounds like a good solution to this. An alternative could be [Template Method](http://en.wikipedia.org/wiki/Template_method_pattern).
The strategies associated to different sites can be produced by an [Abstract Factory](http://en.wikipedia.org/wiki/Abstrac... | Yes, strategy pattern is a good choice.
You should define an `interface` to define your own API, and after to implement it in several strategies.
Take a look in wikipedia the c# example : [Strategy pattern](http://en.wikipedia.org/wiki/Strategy_pattern)
```
interface IStrategy
{
void Execute();
}
// Impl... |
3,010,022 | Here's briefly what I'm trying to do.
The user supplies me with a link to a [photo](http://www.flickr.com/photos/pmorgan/32606683/) from one of several photo-sharing websites (such as Flickr, Zooomr, et. al). I then do some processing on the photo using their respective APIs.
Right now, I'm only implementing one serv... | 2010/06/09 | [
"https://Stackoverflow.com/questions/3010022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/220997/"
] | You don't really need a pattern yet. Just implement the service in a clean fashion, so that somewhere there is an `Image FlikrApi.GetImage(Url)` method.
```
// client code
Image image = flickApi.GetImage(url);
```
When you come to implement your second service, then you will have some requirements as to how to deci... | Yes, [Strategy](http://en.wikipedia.org/wiki/Strategy_pattern) sounds like a good solution to this. An alternative could be [Template Method](http://en.wikipedia.org/wiki/Template_method_pattern).
The strategies associated to different sites can be produced by an [Abstract Factory](http://en.wikipedia.org/wiki/Abstrac... |
3,010,022 | Here's briefly what I'm trying to do.
The user supplies me with a link to a [photo](http://www.flickr.com/photos/pmorgan/32606683/) from one of several photo-sharing websites (such as Flickr, Zooomr, et. al). I then do some processing on the photo using their respective APIs.
Right now, I'm only implementing one serv... | 2010/06/09 | [
"https://Stackoverflow.com/questions/3010022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/220997/"
] | Yes, [Strategy](http://en.wikipedia.org/wiki/Strategy_pattern) sounds like a good solution to this. An alternative could be [Template Method](http://en.wikipedia.org/wiki/Template_method_pattern).
The strategies associated to different sites can be produced by an [Abstract Factory](http://en.wikipedia.org/wiki/Abstrac... | If you're using only one method `GetImage` then strategy is a good choice, you can use Factory method to set the correct factory.
```
class Context
{
IStrategy strategy;
String url;
void GetImage( url )
{
strategy = StrategyFactory.GetStrategyFor( url );
image = strategy.GetI... |
3,010,022 | Here's briefly what I'm trying to do.
The user supplies me with a link to a [photo](http://www.flickr.com/photos/pmorgan/32606683/) from one of several photo-sharing websites (such as Flickr, Zooomr, et. al). I then do some processing on the photo using their respective APIs.
Right now, I'm only implementing one serv... | 2010/06/09 | [
"https://Stackoverflow.com/questions/3010022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/220997/"
] | You don't really need a pattern yet. Just implement the service in a clean fashion, so that somewhere there is an `Image FlikrApi.GetImage(Url)` method.
```
// client code
Image image = flickApi.GetImage(url);
```
When you come to implement your second service, then you will have some requirements as to how to deci... | Looks like you want to do two things:
1. Separate processing implementations for each service. Here, you can use the strategy pattern.
2. Hide the fact that there are different processing implementation details for each service from you caller. Here, use a factory pattern. The factory pattern will encapsulate any logi... |
3,010,022 | Here's briefly what I'm trying to do.
The user supplies me with a link to a [photo](http://www.flickr.com/photos/pmorgan/32606683/) from one of several photo-sharing websites (such as Flickr, Zooomr, et. al). I then do some processing on the photo using their respective APIs.
Right now, I'm only implementing one serv... | 2010/06/09 | [
"https://Stackoverflow.com/questions/3010022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/220997/"
] | You don't really need a pattern yet. Just implement the service in a clean fashion, so that somewhere there is an `Image FlikrApi.GetImage(Url)` method.
```
// client code
Image image = flickApi.GetImage(url);
```
When you come to implement your second service, then you will have some requirements as to how to deci... | Yes, strategy pattern is a good choice.
You should define an `interface` to define your own API, and after to implement it in several strategies.
Take a look in wikipedia the c# example : [Strategy pattern](http://en.wikipedia.org/wiki/Strategy_pattern)
```
interface IStrategy
{
void Execute();
}
// Impl... |
3,010,022 | Here's briefly what I'm trying to do.
The user supplies me with a link to a [photo](http://www.flickr.com/photos/pmorgan/32606683/) from one of several photo-sharing websites (such as Flickr, Zooomr, et. al). I then do some processing on the photo using their respective APIs.
Right now, I'm only implementing one serv... | 2010/06/09 | [
"https://Stackoverflow.com/questions/3010022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/220997/"
] | You don't really need a pattern yet. Just implement the service in a clean fashion, so that somewhere there is an `Image FlikrApi.GetImage(Url)` method.
```
// client code
Image image = flickApi.GetImage(url);
```
When you come to implement your second service, then you will have some requirements as to how to deci... | If you're using only one method `GetImage` then strategy is a good choice, you can use Factory method to set the correct factory.
```
class Context
{
IStrategy strategy;
String url;
void GetImage( url )
{
strategy = StrategyFactory.GetStrategyFor( url );
image = strategy.GetI... |
1,244,584 | I require a list for 20- 30 years in this format .
```
Description First day of the month Last day of the month
2017 January, 2017-01-01, 2017-01-31
2017 February, 2017-02-01, 2017-02-28
```
How can I create such lists with excel?
Simple dragging doesn't work. | 2017/08/26 | [
"https://superuser.com/questions/1244584",
"https://superuser.com",
"https://superuser.com/users/765133/"
] | Formula for `B3`:
```
=DATE(2017,1+ROW()-ROW($B$3),1)
```
for `C3`:
```
=DATE(2017,2+ROW()-ROW($B$3),1)-1
```
[](https://i.stack.imgur.com/2kItF.png) | Use the `EDATE()` function:
1) Input your starting date in B1, i.e. 2017-01-01.
In B2, use this formula: `=edate(B1,1)` - this adds 1 month to the date.
Copy the formula in B2 down for as many rows as you'd like.
2) In C1 you want the last date of the month - which is also the day before the first day of the followin... |
3,300,389 | Does the infinite sum $\sum\_{n = 1}^{\infty} \left( 1-\frac{\ln(n)}{n} \right)^{n}$ converge or diverge? I've applied root, ratio and Gauss's test but it didn't help. | 2019/07/22 | [
"https://math.stackexchange.com/questions/3300389",
"https://math.stackexchange.com",
"https://math.stackexchange.com/users/690661/"
] | $$\begin{split}
\left( 1 - \frac{\ln n}n\right)^n &= \exp\left(n\left(\ln\left(1-\frac {\ln n}n\right)\right)\right)\\
&= \exp\left(n\left(-\frac {\ln n}n +\mathcal O\left(\frac{\ln n}n\right)^2\right)\right)\\
&=\exp\left(-\ln n +\mathcal O\left (\frac{(\ln n)^2}n\right)\right)\\
&=\frac 1 n\exp\left( \mathcal O\left ... | Here is another method (a bit rough, though).
Using the approximation
$$(1-x)^{1/x} \sim e^{-1} \ \ \ \ \mathrm{as } \ x \to 0^+$$
you have
$$\left( 1- \frac{\ln n}{n}\right)^n = \left( \left( 1- \frac{\ln n}{n}\right)^{\frac{ n}{\ln n}} \right)^{\ln n} \sim (e^{-1})^{\ln n} = \frac{1}{n}$$
This shows that the series... |
2,686,615 | I am currently in a situation where I have to make some additions to an application written in classic ASP using server-side JScript on IIS.
The additions that I need to make involve adding a series of includes to the server-side code to extend the application's capabilities. However, the inc files may not exist on th... | 2010/04/21 | [
"https://Stackoverflow.com/questions/2686615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/332851/"
] | If you are really brave, you can read the contents of the file and then [Eval()](http://msdn.microsoft.com/en-us/library/0z5x4094(VS.85).aspx) it.
But you will have not real indication of line numbers if anything goes wrong in the included code.
As a potentially better alternative: Can you not create some sanity check... | Put simply, no. Why would the files not exist? Can you not at least have empty files present? |
2,686,615 | I am currently in a situation where I have to make some additions to an application written in classic ASP using server-side JScript on IIS.
The additions that I need to make involve adding a series of includes to the server-side code to extend the application's capabilities. However, the inc files may not exist on th... | 2010/04/21 | [
"https://Stackoverflow.com/questions/2686615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/332851/"
] | The solution to this turned out to be to use thomask's suggestion to include the files and to set a session variable with a reference to "me" as per <http://www.aspmessageboard.com/showthread.php?t=229532> to allow me to have access to the regular program scope variables.
(I've registered because of this, but can't se... | Put simply, no. Why would the files not exist? Can you not at least have empty files present? |
2,686,615 | I am currently in a situation where I have to make some additions to an application written in classic ASP using server-side JScript on IIS.
The additions that I need to make involve adding a series of includes to the server-side code to extend the application's capabilities. However, the inc files may not exist on th... | 2010/04/21 | [
"https://Stackoverflow.com/questions/2686615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/332851/"
] | **Here's a script to dynamically include asp files:**
```
<%
' **** Dynamic ASP include v.2
function fixInclude(content)
out=""
if instr(content,"#include ")>0 then
response.write "Error: include directive not permitted!"
response.end
end if
content=replace(content,"<"&"%=","<"&"%r... | Put simply, no. Why would the files not exist? Can you not at least have empty files present? |
2,686,615 | I am currently in a situation where I have to make some additions to an application written in classic ASP using server-side JScript on IIS.
The additions that I need to make involve adding a series of includes to the server-side code to extend the application's capabilities. However, the inc files may not exist on th... | 2010/04/21 | [
"https://Stackoverflow.com/questions/2686615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/332851/"
] | If you are really brave, you can read the contents of the file and then [Eval()](http://msdn.microsoft.com/en-us/library/0z5x4094(VS.85).aspx) it.
But you will have not real indication of line numbers if anything goes wrong in the included code.
As a potentially better alternative: Can you not create some sanity check... | What you could do is something like this:
* Use Scripting.FileSystemObject to detect the presence of the files
* Use Server.Exeecute to "include" the files, or at least execute the code.
The only problem is that the files cannot share normal program scope variables. |
2,686,615 | I am currently in a situation where I have to make some additions to an application written in classic ASP using server-side JScript on IIS.
The additions that I need to make involve adding a series of includes to the server-side code to extend the application's capabilities. However, the inc files may not exist on th... | 2010/04/21 | [
"https://Stackoverflow.com/questions/2686615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/332851/"
] | If you are really brave, you can read the contents of the file and then [Eval()](http://msdn.microsoft.com/en-us/library/0z5x4094(VS.85).aspx) it.
But you will have not real indication of line numbers if anything goes wrong in the included code.
As a potentially better alternative: Can you not create some sanity check... | The solution to this turned out to be to use thomask's suggestion to include the files and to set a session variable with a reference to "me" as per <http://www.aspmessageboard.com/showthread.php?t=229532> to allow me to have access to the regular program scope variables.
(I've registered because of this, but can't se... |
2,686,615 | I am currently in a situation where I have to make some additions to an application written in classic ASP using server-side JScript on IIS.
The additions that I need to make involve adding a series of includes to the server-side code to extend the application's capabilities. However, the inc files may not exist on th... | 2010/04/21 | [
"https://Stackoverflow.com/questions/2686615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/332851/"
] | The solution to this turned out to be to use thomask's suggestion to include the files and to set a session variable with a reference to "me" as per <http://www.aspmessageboard.com/showthread.php?t=229532> to allow me to have access to the regular program scope variables.
(I've registered because of this, but can't se... | What you could do is something like this:
* Use Scripting.FileSystemObject to detect the presence of the files
* Use Server.Exeecute to "include" the files, or at least execute the code.
The only problem is that the files cannot share normal program scope variables. |
2,686,615 | I am currently in a situation where I have to make some additions to an application written in classic ASP using server-side JScript on IIS.
The additions that I need to make involve adding a series of includes to the server-side code to extend the application's capabilities. However, the inc files may not exist on th... | 2010/04/21 | [
"https://Stackoverflow.com/questions/2686615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/332851/"
] | **Here's a script to dynamically include asp files:**
```
<%
' **** Dynamic ASP include v.2
function fixInclude(content)
out=""
if instr(content,"#include ")>0 then
response.write "Error: include directive not permitted!"
response.end
end if
content=replace(content,"<"&"%=","<"&"%r... | What you could do is something like this:
* Use Scripting.FileSystemObject to detect the presence of the files
* Use Server.Exeecute to "include" the files, or at least execute the code.
The only problem is that the files cannot share normal program scope variables. |
2,686,615 | I am currently in a situation where I have to make some additions to an application written in classic ASP using server-side JScript on IIS.
The additions that I need to make involve adding a series of includes to the server-side code to extend the application's capabilities. However, the inc files may not exist on th... | 2010/04/21 | [
"https://Stackoverflow.com/questions/2686615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/332851/"
] | **Here's a script to dynamically include asp files:**
```
<%
' **** Dynamic ASP include v.2
function fixInclude(content)
out=""
if instr(content,"#include ")>0 then
response.write "Error: include directive not permitted!"
response.end
end if
content=replace(content,"<"&"%=","<"&"%r... | The solution to this turned out to be to use thomask's suggestion to include the files and to set a session variable with a reference to "me" as per <http://www.aspmessageboard.com/showthread.php?t=229532> to allow me to have access to the regular program scope variables.
(I've registered because of this, but can't se... |
2,940,276 | the idea is to use SVN (Tortoise) but, the thing is I dont have and dont want to use a server, cuz this will be used with only one person, is a college project.
I have an old computer that I could use to make a server, the idea is to use it like a server. What documentation should I read, or what should I do to make i... | 2010/05/30 | [
"https://Stackoverflow.com/questions/2940276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/272087/"
] | You can access the repository using file:// protocol so you will only need Tortoise SVN installed and nothing else. See this question in FAQ: [Is it possible to use TortoiseSVN without a server?](http://tortoisesvn.tigris.org/faq.html#noserver)
You can even have the repository in the usb device so that you can take th... | Access your repository using `file://` or, alternatively, use svnserve. From [Svnserve Based Server](http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-serversetup-svnserve.html):
>
> Subversion includes Svnserve - a lightweight stand-alone server which uses a custom protocol over an ordinary TCP/IP connection. ... |
2,940,276 | the idea is to use SVN (Tortoise) but, the thing is I dont have and dont want to use a server, cuz this will be used with only one person, is a college project.
I have an old computer that I could use to make a server, the idea is to use it like a server. What documentation should I read, or what should I do to make i... | 2010/05/30 | [
"https://Stackoverflow.com/questions/2940276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/272087/"
] | You can access the repository using file:// protocol so you will only need Tortoise SVN installed and nothing else. See this question in FAQ: [Is it possible to use TortoiseSVN without a server?](http://tortoisesvn.tigris.org/faq.html#noserver)
You can even have the repository in the usb device so that you can take th... | 1. Install [TortoiseSVN](http://tortoisesvn.net), right-click on a folder, choose [Create Repository Here](http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-repository.html#tsvn-repository-create-tortoisesvn)
2. Right click on another folder, choose SVN Checkout, and specify the folder from step 1 above for the U... |
2,940,276 | the idea is to use SVN (Tortoise) but, the thing is I dont have and dont want to use a server, cuz this will be used with only one person, is a college project.
I have an old computer that I could use to make a server, the idea is to use it like a server. What documentation should I read, or what should I do to make i... | 2010/05/30 | [
"https://Stackoverflow.com/questions/2940276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/272087/"
] | You can access the repository using file:// protocol so you will only need Tortoise SVN installed and nothing else. See this question in FAQ: [Is it possible to use TortoiseSVN without a server?](http://tortoisesvn.tigris.org/faq.html#noserver)
You can even have the repository in the usb device so that you can take th... | If you want to use an old workstation as an SVN server, I strongly recomend [VisualSVN Server](http://www.visualsvn.com/server/). Its free and dead simple to install. I have a workstation at home running it myself.
But if you are going to be the only one using it, and only from one workstation, then go with file:// pr... |
2,940,276 | the idea is to use SVN (Tortoise) but, the thing is I dont have and dont want to use a server, cuz this will be used with only one person, is a college project.
I have an old computer that I could use to make a server, the idea is to use it like a server. What documentation should I read, or what should I do to make i... | 2010/05/30 | [
"https://Stackoverflow.com/questions/2940276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/272087/"
] | You can access the repository using file:// protocol so you will only need Tortoise SVN installed and nothing else. See this question in FAQ: [Is it possible to use TortoiseSVN without a server?](http://tortoisesvn.tigris.org/faq.html#noserver)
You can even have the repository in the usb device so that you can take th... | Using [git](http://git-scm.com/) is a perfect solution for your problem. It is an distributed version control system and ideal for one person project.
You can also use your computer as a server without any installation. |
2,940,276 | the idea is to use SVN (Tortoise) but, the thing is I dont have and dont want to use a server, cuz this will be used with only one person, is a college project.
I have an old computer that I could use to make a server, the idea is to use it like a server. What documentation should I read, or what should I do to make i... | 2010/05/30 | [
"https://Stackoverflow.com/questions/2940276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/272087/"
] | 1. Install [TortoiseSVN](http://tortoisesvn.net), right-click on a folder, choose [Create Repository Here](http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-repository.html#tsvn-repository-create-tortoisesvn)
2. Right click on another folder, choose SVN Checkout, and specify the folder from step 1 above for the U... | Access your repository using `file://` or, alternatively, use svnserve. From [Svnserve Based Server](http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-serversetup-svnserve.html):
>
> Subversion includes Svnserve - a lightweight stand-alone server which uses a custom protocol over an ordinary TCP/IP connection. ... |
2,940,276 | the idea is to use SVN (Tortoise) but, the thing is I dont have and dont want to use a server, cuz this will be used with only one person, is a college project.
I have an old computer that I could use to make a server, the idea is to use it like a server. What documentation should I read, or what should I do to make i... | 2010/05/30 | [
"https://Stackoverflow.com/questions/2940276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/272087/"
] | Access your repository using `file://` or, alternatively, use svnserve. From [Svnserve Based Server](http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-serversetup-svnserve.html):
>
> Subversion includes Svnserve - a lightweight stand-alone server which uses a custom protocol over an ordinary TCP/IP connection. ... | If you want to use an old workstation as an SVN server, I strongly recomend [VisualSVN Server](http://www.visualsvn.com/server/). Its free and dead simple to install. I have a workstation at home running it myself.
But if you are going to be the only one using it, and only from one workstation, then go with file:// pr... |
2,940,276 | the idea is to use SVN (Tortoise) but, the thing is I dont have and dont want to use a server, cuz this will be used with only one person, is a college project.
I have an old computer that I could use to make a server, the idea is to use it like a server. What documentation should I read, or what should I do to make i... | 2010/05/30 | [
"https://Stackoverflow.com/questions/2940276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/272087/"
] | Access your repository using `file://` or, alternatively, use svnserve. From [Svnserve Based Server](http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-serversetup-svnserve.html):
>
> Subversion includes Svnserve - a lightweight stand-alone server which uses a custom protocol over an ordinary TCP/IP connection. ... | Using [git](http://git-scm.com/) is a perfect solution for your problem. It is an distributed version control system and ideal for one person project.
You can also use your computer as a server without any installation. |
2,940,276 | the idea is to use SVN (Tortoise) but, the thing is I dont have and dont want to use a server, cuz this will be used with only one person, is a college project.
I have an old computer that I could use to make a server, the idea is to use it like a server. What documentation should I read, or what should I do to make i... | 2010/05/30 | [
"https://Stackoverflow.com/questions/2940276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/272087/"
] | 1. Install [TortoiseSVN](http://tortoisesvn.net), right-click on a folder, choose [Create Repository Here](http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-repository.html#tsvn-repository-create-tortoisesvn)
2. Right click on another folder, choose SVN Checkout, and specify the folder from step 1 above for the U... | If you want to use an old workstation as an SVN server, I strongly recomend [VisualSVN Server](http://www.visualsvn.com/server/). Its free and dead simple to install. I have a workstation at home running it myself.
But if you are going to be the only one using it, and only from one workstation, then go with file:// pr... |
2,940,276 | the idea is to use SVN (Tortoise) but, the thing is I dont have and dont want to use a server, cuz this will be used with only one person, is a college project.
I have an old computer that I could use to make a server, the idea is to use it like a server. What documentation should I read, or what should I do to make i... | 2010/05/30 | [
"https://Stackoverflow.com/questions/2940276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/272087/"
] | 1. Install [TortoiseSVN](http://tortoisesvn.net), right-click on a folder, choose [Create Repository Here](http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-repository.html#tsvn-repository-create-tortoisesvn)
2. Right click on another folder, choose SVN Checkout, and specify the folder from step 1 above for the U... | Using [git](http://git-scm.com/) is a perfect solution for your problem. It is an distributed version control system and ideal for one person project.
You can also use your computer as a server without any installation. |
2,940,276 | the idea is to use SVN (Tortoise) but, the thing is I dont have and dont want to use a server, cuz this will be used with only one person, is a college project.
I have an old computer that I could use to make a server, the idea is to use it like a server. What documentation should I read, or what should I do to make i... | 2010/05/30 | [
"https://Stackoverflow.com/questions/2940276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/272087/"
] | If you want to use an old workstation as an SVN server, I strongly recomend [VisualSVN Server](http://www.visualsvn.com/server/). Its free and dead simple to install. I have a workstation at home running it myself.
But if you are going to be the only one using it, and only from one workstation, then go with file:// pr... | Using [git](http://git-scm.com/) is a perfect solution for your problem. It is an distributed version control system and ideal for one person project.
You can also use your computer as a server without any installation. |
24,000 | I'm drawing a automaton figure, and I want to name it says 'M1' below the figure? A minimal example would be greatly appreciated. Thank you.
```
\begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,auto]
\node[state,initial] (q_0) {$q_0$};
\node[state,accepting] (q_1) [right=of... | 2011/07/24 | [
"https://tex.stackexchange.com/questions/24000",
"https://tex.stackexchange.com",
"https://tex.stackexchange.com/users/4322/"
] | Just include your code in a `figure` environment. In that way you'll be able to add a caption to it as a normal figure:
```
\begin{figure}
\centering
\begin{tikzpicture}
<code>
\end{tikzpicture}
\caption{M1} \label{fig:M1}
\end{figure}
``` | This is my solution using an extra node with text, it works pretty well.
```
\begin{tikzpicture}[shorten >=1pt,node distance=2cm,on grid,auto]
\node[state,initial] (q_1) {$q_1$};
\node[state,accepting] (q_2) [right=of q_1] {$q_2$};
\node[state] ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.