I have array of array and want to eliminate duplicity. How can I do this
<__NSArrayM 0x9175640>(
<__NSArrayI 0x919ec80>(
http://scontent-b.cdninstagram.com/hphotos-xfp1/outbound-distilleryimage2/t0.0-17/OBPTH/dccd6b4cb15211e3aeb912af24c9b212_5.jpg,
47738394,
evdokia_bach,
Evdokia Bach,
https://instagramimages-a.akamaihd.net/profiles/profile_47738394_75sq_1388023560.jpg
)
,
<__NSArrayI 0x919eca0>(
http://scontent-b.cdninstagram.com/hphotos-xpf1/outbound-distilleryimage10/t0.0-17/OBPTH/e27402bab15011e39584123223ad70da_5.jpg,
47799994,
allen,
allen warden,
https://instagramimages-a.akamaihd.net/profiles/profile_47738394_75sq_1388023560.jpg
)
,
<__NSArrayI 0x919ecc0>(
http://scontent-a.cdninstagram.com/hphotos-xaf1/outbound-distilleryimage6/t0.0-17/OBPTH/5794c4e0b15011e397e2122466b7dba2_5.jpg,
47738394,
evdokia_bach,
Evdokia Bach,
https://instagramimages-a.akamaihd.net/profiles/profile_47738394_75sq_1388023560.jpg
)
,
<__NSArrayI 0x919ece0>(
http://scontent-b.cdninstagram.com/hphotos-xpf1/outbound-distilleryimage11/t0.0-17/OBPTH/0f0916eab15011e3942d12c36745260f_5.jpg,
47738394,
evdokia_bach,
Evdokia Bach,
https://instagramimages-a.akamaihd.net/profiles/profile_47738394_75sq_1388023560.jpg
)
)
)
I want only unique array how can i do this ?
Related
As described here, Pandoc records Synctex-like information when the source is commonmark+sourcepos. For example, with this commonmark input,
---
title: "Sample"
---
This is a sample document.
the output in native format starts like this:
Pandoc
Meta
{ unMeta =
fromList [ ( "title" , MetaInlines [ Str "Sample" ] ) ]
}
[ Div
( "" , [] , [ ( "data-pos" , "Sample.knit.md#5:1-6:1" ) ] )
[ Para
[ Span
( ""
, []
, [ ( "data-pos" , "Sample.knit.md#5:1-5:5" ) ]
)
[ Str "This" ]
, Span
( ""
, []
, [ ( "data-pos" , "Sample.knit.md#5:5-5:6" ) ]
)
[ Space ]
, Span
( ""
, []
, [ ( "data-pos" , "Sample.knit.md#5:6-5:8" ) ]
)
[ Str "is" ]
but all that appears in the .tex file is this:
{This}{ }{is}...
As a step towards Synctex support, I'd like to insert the data-pos information as LaTeX markup, i.e. change the .tex output to look like this:
{This\datapos{Sample.knit.md#5:1-5:5}}{ \datapos{Sample.knit.md#5:5-5:6}}{is\datapos{Sample.knit.md#5:6-5:8}}...
This looks like something a Lua filter could accomplish pretty easily: look for the data-pos records, copy the location information into the Str record. However, I don't know Lua or Pandoc native language. Could someone help with this? Doing it for the Span records would be enough for my purposes. I'm using Pandoc 2.18 and Lua 5.4.
Here is an attempt that appears to work. Comments or corrections would still be welcome!
Span = function(span)
local datapos = span.attributes['data-pos']
if datapos then
table.insert(span.content, pandoc.RawInline('tex', "\\datapos{" .. datapos .. "}"))
end
return span
end
I'm trying to run an array formula to see how long (days) it is in a current status.
Source:
={
"Days since application submitted";
ArrayFormula(
If(
Isblank(U3:U),
"",
(
IF(
G3:G="APPLICATION SENT",
DATEDIF(U3:U,AA3:AA,"D"),
(
IF(
G3:G="APPLICATION ACCEPTED - AWAITING REPAYMENT",
DATEDIF(U3:U,AF3:AF,"D"),
(
IF(
G3:G="CREDIT",
DATEDIF(U3:U,AF3:AF,"D"),
(
IF(
G3:G="COMPLETED",
DATEDIF(U3:U,AF3:AF,"D"),
)
)
)
)
)
)
)
)
)
)
}
It works fine however if I don't have anything in column 'AF' as I may skip a status it will show up with an error. But if 'AF' is blank I then want to do another check within the same array formula to run something like (IF(ISBLANK(AF3:AF),"",(IF(G3:G="COMPLETED",DATEDIF(U3:U,AJ3:AJ,"D") ... Looking at another date in 'AJ' column.
={
"Days since application submitted";
ArrayFormula(
If(
Isblank(U3:U),
"",
(
IF(
G3:G="APPLICATION SENT",
DATEDIF(U3:U,AA3:AA,"D"),
(
IF(
G3:G="APPLICATION ACCEPTED - AWAITING REPAYMENT",
DATEDIF(U3:U,AF3:AF,"D"),
(
IF(
G3:G="CREDIT",
DATEDIF(U3:U,AF3:AF,"D"),
(
IF(
G3:G="COMPLETED",
DATEDIF(U3:U,AF3:AF,"D"),
OR(
if(
isblank(
AF3:AF,
IF(
G3:G="COMPLETED",
DATEDIF(U3:U,AJ3:AJ,"D"),
)
)
)
)
)
)
)
)
)
)
)
)
)
)
}
Any support would be helpful where I am going wrong.
Instead of nesting many if() functions, try ifs(), like this:
=arrayformula(
{
"Days since application submitted";
ifs(
isblank(U3:U),
iferror(1/0),
isblank(AF3:AF) * (G3:G = "COMPLETED"),
datedif(U3:U, AJ3:AJ, "D"),
G3:G = "APPLICATION SENT",
datedif(U3:U, AA3:AA, "D"),
regexmatch(to_text(G3:G), "(?i)accepted|credit|completed"),
datedif(U3:U, AF3:AF, "D"),
true,
na()
)
}
)
try:
={"Days since application submitted"; ARRAYFORMULA(
IF(ISBLANK(U3:U),,
IF(G3:G="APPLICATION SENT", DATEDIF(U3:U, AA3:AA, "D"),
IF(ISBLANK(AF3:AF),,
IF(REGEXMATCH(""&G3:G, "APPLICATION ACCEPTED - AWAITING REPAYMENT|CREDIT|COMPLETED"),
DATEDIF(U3:U, AF3:AF, "D"))))))}
Does z3py have functions to create a parametric data type, like what would be generated using the following SMTLIB code?
( declare - datatype List ( par ( T )
( ( nil ) ( cons ( car T ) ( cdr ( List T )) ))))
Yes. See here: https://ericpony.github.io/z3py-tutorial/advanced-examples.htm
Search for the section titled "Datatypes."
Here's the example right from that page, that does exactly what you want:
def DeclareList(sort):
List = Datatype('List_of_%s' % sort.name())
List.declare('cons', ('car', sort), ('cdr', List))
List.declare('nil')
return List.create()
IntList = DeclareList(IntSort())
RealList = DeclareList(RealSort())
IntListList = DeclareList(IntList)
This is all my objects and i want to save all objects into single array.
**dataArray:**
<__NSArrayI 0x15e1a460>(
<__NSArrayM 0x15e244a0>(
<CKAsset: 0x15e69770; UUID=ED94A2F1-66C9-4D7C-B0E8-6A51EDBDDECE, arrayIndex=0, size=265849, path="/private~/Library/Caches/CloudKit/Assets/ED94A2F1-66C9-4D7C-B0E8-6A51EDBDDECE.01f8820d30f6147d76af04d3e84ccedc267da5f22d", signature=<01f8820d 30f6147d 76af04d3 e84ccedc 267da5f2 2d>, uploadRank=0>
)
,
<__NSArrayM 0x1706aac0>(
<CKAsset: 0x15ef1d90; UUID=46CA6A72-E1B4-4E03-AF8C-AEA557F62219, arrayIndex=0, size=49637, path="/private~/Library/Caches/CloudKit/Assets/46CA6A72-E1B4-4E03-AF8C-AEA557F62219.010c8944dcfd55b051c51c846092a61d4909708c97", signature=<010c8944 dcfd55b0 51c51c84 6092a61d 4909708c 97>, uploadRank=0>
)
,
<__NSArrayM 0x15e3f120>(
<CKAsset: 0x15e1ffc0; UUID=63018B1D-E340-4963-8BDC-8A2B5E108040, arrayIndex=0, size=102627, path="/private~/Library/Caches/CloudKit/Assets/63018B1D-E340-4963-8BDC-8A2B5E108040.0188b8d9b7cb6f914c2cd7fdb00b08aef3d1296ff0", signature=<0188b8d9 b7cb6f91 4c2cd7fd b00b08ae f3d1296f f0>, uploadRank=0>,
<CKAsset: 0x17057f00; UUID=96A26885-B0E2-4CCC-A571-07D94F22BB56, arrayIndex=1, size=88073, path="/private~/Library/Caches/CloudKit/Assets/96A26885-B0E2-4CCC-A571-07D94F22BB56.015bc1a8cc592f93343ad3baa7b5e92c1bd2c46099", signature=<015bc1a8 cc592f93 343ad3ba a7b5e92c 1bd2c460 99>, uploadRank=0>,
<CKAsset: 0x1706c5f0; UUID=E712BA16-4937-426C-88B4-5535B75F2507, arrayIndex=2, size=86948, path="/private~/Library/Caches/CloudKit/Assets/E712BA16-4937-426C-88B4-5535B75F2507.01a0f2f4bd2e4f92b6b0a530042db554f9904cb965", signature=<01a0f2f4 bd2e4f92 b6b0a530 042db554 f9904cb9 65>, uploadRank=0>
)
,
<__NSArrayM 0x15ecee30>(
<CKAsset: 0x15e3a980; UUID=66515C6E-0181-40C3-8A19-9BE4DBB3AFB5, arrayIndex=0, size=80674, path="/private~/Library/Caches/CloudKit/Assets/66515C6E-0181-40C3-8A19-9BE4DBB3AFB5.0187d802244e8b15b9a70e39755ce55433df6740cb", signature=<0187d802 244e8b15 b9a70e39 755ce554 33df6740 cb>, uploadRank=0>,
<CKAsset: 0x15ef3460; UUID=D80DC154-9278-4F46-9064-7888419C14D4, arrayIndex=1, size=29815, path="/private~/Library/Caches/CloudKit/Assets/D80DC154-9278-4F46-9064-7888419C14D4.012562c3defcf5833f065f305deb8bf83568147293", signature=<012562c3 defcf583 3f065f30 5deb8bf8 35681472 93>, uploadRank=0>
)
,
<__NSArrayM 0x15e3dec0>(
<CKAsset: 0x15e0c2c0; UUID=7357121B-18F6-4094-8844-19F79604FC88, arrayIndex=0, size=90252, path="/private~/Library/Caches/CloudKit/Assets/7357121B-18F6-4094-8844-19F79604FC88.01ee86884fc42ac4aa4ca519508e62e6b6306ad4fd", signature=<01ee8688 4fc42ac4 aa4ca519 508e62e6 b6306ad4 fd>, uploadRank=0>
)
)
I am using this loop for to get all objects and save into single Array:
for (int i = 0 ; i < dataArray.count; i++){
for (int j = 0 ; j<[[dataArray objectAtIndex:i] count]; j++) {
total addObject:[dataArray objectAtIndex:j]];
}
}
Using C-style iteration is not absolutely necessary, here's what you could do:
for(id object in dataArray) {
for(id subobject in object) {
[mutableArray addObject:subobject];
}
}
I am working with a database I am trying to make secure. I have been able to create the database and access the information within it. However once I try to encrypt the individual pieces of information within the database I run into trouble. I am using sqlite3 for my database and openssl to try to encrypt the database.
local users = [[CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, username, password);]]
db:exec( users )
local nameData = cipher:encrypt ( nameField.text, "sbs_math_key" )
local passData = cipher:encrypt ( passwordField.text, "sbs_math_key" )
local tablefill =[[INSERT INTO users VALUES (NULL, ']].. nameData ..[[',']].. passData ..[['); ]]
db:exec( tablefill )
This works if I am inserting into an existing database, however if I am creating a new database it won't let me insert the encrypted information.
Try this:
local nameData = mime.b64 ( cipher:encrypt ( nameField.text, "sbs_math_key") )
local passData = mime.b64 ( cipher:encrypt ( passwordField.text, "sbs_math_key") )
print( "Before : "..nameData )
local tablefill =[[INSERT INTO users VALUES (NULL, ']].. nameData ..[[',']].. passData ..[['); ]]
db:exec( tablefill )
message = cipher:decrypt ( mime.unb64 ( nameData ), "sbs_math_key" )
print( "After : "..message )